| import { render, screen } from '@testing-library/react'; | |||||
| import App from './App'; | |||||
| test('renders learn react link', () => { | |||||
| render(<App />); | |||||
| const linkElement = screen.getByText(/learn react/i); | |||||
| expect(linkElement).toBeInTheDocument(); | |||||
| }); |
| text-align: center !important; | text-align: center !important; | ||||
| } | } | ||||
| .text-black{ | |||||
| .text-black { | |||||
| color: $mainBlack; | color: $mainBlack; | ||||
| } | } | ||||
| .text-blue{ | |||||
| .text-blue { | |||||
| color: $mainBlue; | color: $mainBlue; | ||||
| } | } | ||||
| .text-grey9d{ | |||||
| .text-grey9d { | |||||
| color: $grey-9D; | color: $grey-9D; | ||||
| } | } | ||||
| .text-uppercase{ | |||||
| .text-uppercase { | |||||
| text-transform: uppercase !important; | text-transform: uppercase !important; | ||||
| } | } | ||||
| .page-heading{ | |||||
| .page-heading { | |||||
| font-style: normal; | font-style: normal; | ||||
| font-weight: 600; | |||||
| font-size: 36px; | |||||
| line-height: 32px; | |||||
| /* identical to box height, or 89% */ | |||||
| font-weight: 600; | |||||
| font-size: 36px; | |||||
| line-height: 32px; | |||||
| /* identical to box height, or 89% */ | |||||
| letter-spacing: 0.02em; | |||||
| letter-spacing: 0.02em; | |||||
| /* Main Black */ | |||||
| /* Main Black */ | |||||
| color: #272727;@include media-below($bp-xl) { | |||||
| font-size: 18px !important; | |||||
| color: #272727; | |||||
| @include media-below($bp-xl) { | |||||
| font-size: 18px !important; | |||||
| } | |||||
| } | |||||
| .highlighted{ | |||||
| background: $mainBlue; | |||||
| color: #fff; | |||||
| } | } | ||||
| } |
| flex: 1 1 auto; | flex: 1 1 auto; | ||||
| overflow: auto; | overflow: auto; | ||||
| } | } | ||||
| .dialog-btn{ | |||||
| text-transform: uppercase; | |||||
| letter-spacing: 1px !important; | |||||
| font-size: 12px !important; | |||||
| min-width: 200px !important; | |||||
| } | |||||
| .dialog-btn:last-of-type{ | |||||
| color: $white; | |||||
| background-color: $mainBlue; | |||||
| } | |||||
| .modal-content{ | |||||
| padding: 25px 0px 15px 0px; | |||||
| font-size: 16px; | |||||
| color: $mainBlack; | |||||
| text-align: center; | |||||
| } |
| gap: 9px; | gap: 9px; | ||||
| } | } | ||||
| .inviteBtn { | .inviteBtn { | ||||
| font-size: 12px; | |||||
| letter-spacing: 1px; | |||||
| text-transform: uppercase; | |||||
| padding: 18px 70px !important; | |||||
| margin-top: 60px; | |||||
| text-transform: capitalize; | |||||
| padding: 10px 40px !important; | |||||
| margin-left: 20px; | |||||
| font-size: 16px !important; | |||||
| } | } | ||||
| .secondaryRow:hover { | .secondaryRow:hover { | ||||
| background-color: $mainBlueLight; | background-color: $mainBlueLight; |
| return ( | return ( | ||||
| <button | <button | ||||
| data-testid="btn-testid" | |||||
| type="button" | type="button" | ||||
| ref={buttonRef} | ref={buttonRef} | ||||
| onClick={handleClick} | onClick={handleClick} |
| import React from "react"; | |||||
| import PropTypes from "prop-types"; | |||||
| import { | |||||
| Dialog, | |||||
| DialogTitle, | |||||
| DialogActions, | |||||
| useMediaQuery, | |||||
| useTheme, | |||||
| DialogContent, | |||||
| } from "@mui/material"; | |||||
| import IconButton from "../IconButton/IconButton"; | |||||
| const ConfirmDialog = ({ | |||||
| title, | |||||
| subtitle, | |||||
| imgSrc, | |||||
| content, | |||||
| onConfirm, | |||||
| onClose, | |||||
| open, | |||||
| maxWidth, | |||||
| fullWidth, | |||||
| responsive, | |||||
| }) => { | |||||
| const theme = useTheme(); | |||||
| const fullScreen = useMediaQuery(theme.breakpoints.down("md")); | |||||
| // const { t } = useTranslation(); | |||||
| const handleClose = () => { | |||||
| onClose(); | |||||
| }; | |||||
| // useEffect(()=>{ | |||||
| // handleClose(); | |||||
| // },[onConfirm]) | |||||
| return ( | |||||
| <Dialog | |||||
| maxWidth={maxWidth} | |||||
| fullWidth={fullWidth} | |||||
| fullScreen={responsive && fullScreen} | |||||
| onClose={handleClose} | |||||
| open={open} | |||||
| style={{ | |||||
| padding: "36px", | |||||
| }} | |||||
| > | |||||
| <div style={{ padding: "36px" }}> | |||||
| <DialogTitle style={{ padding: 0 }}> | |||||
| <div | |||||
| className="flex-center" | |||||
| style={{ justifyContent: "space-between" }} | |||||
| > | |||||
| <div className="flex-center" style={{ justifyContent: "start" }}> | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| top: -0.25, | |||||
| paddingRight: "10px", | |||||
| }} | |||||
| src={imgSrc} | |||||
| /> | |||||
| <h5>{title}</h5> | |||||
| <div className="vr"></div> | |||||
| <p className="dialog-subtitle">{subtitle}</p> | |||||
| </div> | |||||
| </div> | |||||
| </DialogTitle> | |||||
| <DialogContent> | |||||
| <div className="modal-content">{content}</div> | |||||
| </DialogContent> | |||||
| <DialogActions style={{ padding: 0 }}> | |||||
| <IconButton | |||||
| data-testid="editbtn" | |||||
| className={`c-btn--primary-outlined c-btn dialog-btn`} | |||||
| onClick={onClose} | |||||
| > | |||||
| Cancel | |||||
| </IconButton> | |||||
| <IconButton | |||||
| data-testid="editbtn" | |||||
| className={`c-btn--primary-outlined c-btn dialog-btn`} | |||||
| onClick={onConfirm} | |||||
| > | |||||
| Confirm | |||||
| </IconButton> | |||||
| </DialogActions> | |||||
| </div> | |||||
| </Dialog> | |||||
| ); | |||||
| }; | |||||
| ConfirmDialog.propTypes = { | |||||
| title: PropTypes.any, | |||||
| subtitle: PropTypes.any, | |||||
| imgSrc: PropTypes.any, | |||||
| open: PropTypes.bool.isRequired, | |||||
| content: PropTypes.any, | |||||
| onClose: PropTypes.func.isRequired, | |||||
| onConfirm: PropTypes.func.isRequired, | |||||
| maxWidth: PropTypes.oneOf(["xs", "sm", "md", "lg", "xl"]), | |||||
| fullWidth: PropTypes.bool, | |||||
| responsive: PropTypes.bool, | |||||
| }; | |||||
| export default ConfirmDialog; |
| import React from "react"; | |||||
| import React, { useState } from "react"; | |||||
| import PropTypes from "prop-types"; | import PropTypes from "prop-types"; | ||||
| import avatar from "../../assets/images/Avatar.png"; | import avatar from "../../assets/images/Avatar.png"; | ||||
| import filters from "../../assets/images/filters.png"; | import filters from "../../assets/images/filters.png"; | ||||
| import forbiden from "../../assets/images/forbiden.png"; | import forbiden from "../../assets/images/forbiden.png"; | ||||
| import IconButton from "../../components/IconButton/IconButton"; | import IconButton from "../../components/IconButton/IconButton"; | ||||
| import { Link, useParams } from "react-router-dom"; | import { Link, useParams } from "react-router-dom"; | ||||
| import { deleteUserReq, setEnableUsersReq, userDetailsReq } from "../../store/actions/users/usersActions"; | |||||
| import { | |||||
| deleteUserReq, | |||||
| setEnableUsersReq, | |||||
| userDetailsReq, | |||||
| } from "../../store/actions/users/usersActions"; | |||||
| import { useDispatch, useSelector } from "react-redux"; | import { useDispatch, useSelector } from "react-redux"; | ||||
| import { USERS_PAGE } from "../../constants/pages"; | import { USERS_PAGE } from "../../constants/pages"; | ||||
| import { forgetPassword } from "../../store/actions/login/loginActions"; | import { forgetPassword } from "../../store/actions/login/loginActions"; | ||||
| import { useEffect } from "react"; | import { useEffect } from "react"; | ||||
| import { useTheme } from "@emotion/react"; | import { useTheme } from "@emotion/react"; | ||||
| import { useMediaQuery } from "@mui/material"; | import { useMediaQuery } from "@mui/material"; | ||||
| import ConfirmDialog from "../../components/MUI/ConfirmDialog"; | |||||
| const UserDetails = ({ history }) => { | const UserDetails = ({ history }) => { | ||||
| const theme = useTheme(); | const theme = useTheme(); | ||||
| const matches = useMediaQuery(theme.breakpoints.down("sm")); | const matches = useMediaQuery(theme.breakpoints.down("sm")); | ||||
| const { id } = useParams(); | const { id } = useParams(); | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const [showConfirm, setConfirm] = useState(false); | |||||
| const [showReset, setReset] = useState(false); | |||||
| const [showDelete, setDelete] = useState(false); | |||||
| const { user } = useSelector((s) => s.userDetails); | const { user } = useSelector((s) => s.userDetails); | ||||
| const handleReset = (email) => { | |||||
| dispatch( | |||||
| forgetPassword({ | |||||
| email, | |||||
| handleApiResponseSuccessReset, | |||||
| }) | |||||
| ); | |||||
| }; | |||||
| const enableHandler = () =>{ | |||||
| dispatch(setEnableUsersReq({ id: user.id })); | |||||
| } | |||||
| const handleReset = (email) => { | |||||
| dispatch( | |||||
| forgetPassword({ | |||||
| email, | |||||
| handleApiResponseSuccess: handleApiResponseSuccessReset, | |||||
| }) | |||||
| ); | |||||
| }; | |||||
| const handleApiResponseSuccessReset = () => { | const handleApiResponseSuccessReset = () => { | ||||
| console.log('DONE!') | |||||
| setReset(false); | |||||
| }; | |||||
| const enableHandler = () => { | |||||
| dispatch( | |||||
| setEnableUsersReq({ | |||||
| id: user.id, | |||||
| handleApiResponseSuccess: handleApiResponseSuccessEnable, | |||||
| }) | |||||
| ); | |||||
| }; | |||||
| const handleApiResponseSuccessEnable = () => { | |||||
| setConfirm(false); | |||||
| }; | |||||
| const deleteHandler = () => { | |||||
| dispatch( | |||||
| deleteUserReq({ | |||||
| id, | |||||
| handleApiResponseSuccess: handleApiResponseSuccessDelete, | |||||
| }) | |||||
| ); | |||||
| }; | }; | ||||
| const handleApiResponseSuccess = () => { | |||||
| const handleApiResponseSuccessDelete = () => { | |||||
| history.push({ | history.push({ | ||||
| pathname: USERS_PAGE, | pathname: USERS_PAGE, | ||||
| state: { | state: { | ||||
| }); | }); | ||||
| }; | }; | ||||
| const deleteHandler = () => { | |||||
| dispatch(deleteUserReq({ id, handleApiResponseSuccess })); | |||||
| }; | |||||
| useEffect(()=>{ | |||||
| dispatch(userDetailsReq({id})) | |||||
| },[dispatch]) | |||||
| useEffect(() => { | |||||
| dispatch(userDetailsReq({ id })); | |||||
| }, [dispatch]); | |||||
| return ( | return ( | ||||
| <div> | <div> | ||||
| <div className="l-t-rectangle"></div> | <div className="l-t-rectangle"></div> | ||||
| <div className="r-b-rectangle"></div> | <div className="r-b-rectangle"></div> | ||||
| <ConfirmDialog | |||||
| open={showReset} | |||||
| title={"Reset password"} | |||||
| subtitle={user?.firstName + " " + user?.lastName} | |||||
| imgSrc={lock} | |||||
| content="Are you sure you want to send password reset link?" | |||||
| onClose={() => { | |||||
| setReset(false); | |||||
| }} | |||||
| onConfirm={() => { | |||||
| handleReset(user.email); | |||||
| // setConfirm(false) | |||||
| }} | |||||
| /> | |||||
| <ConfirmDialog | |||||
| open={showConfirm} | |||||
| title={"Disable user"} | |||||
| subtitle={user?.firstName + " " + user?.lastName} | |||||
| imgSrc={forbiden} | |||||
| content="Are you sure you want to disable user?" | |||||
| onClose={() => { | |||||
| setConfirm(false); | |||||
| }} | |||||
| onConfirm={() => { | |||||
| enableHandler(user.id); | |||||
| // setConfirm(false) | |||||
| }} | |||||
| /> | |||||
| <ConfirmDialog | |||||
| open={showDelete} | |||||
| title={"Delete user"} | |||||
| subtitle={user?.firstName + " " + user?.lastName} | |||||
| imgSrc={filters} | |||||
| content="Are you sure you want to delete user?" | |||||
| onClose={() => { | |||||
| setDelete(false); | |||||
| }} | |||||
| onConfirm={() => { | |||||
| deleteHandler(user.id); | |||||
| // setConfirm(false) | |||||
| }} | |||||
| /> | |||||
| <div className="pl-144 pt-36px"> | <div className="pl-144 pt-36px"> | ||||
| <div className="divider"> | <div className="divider"> | ||||
| <div className="flex-center"> | <div className="flex-center"> | ||||
| }} | }} | ||||
| className="text-blue" | className="text-blue" | ||||
| > | > | ||||
| {user && user.firstName} {user && user.lastName} | |||||
| {user && user.firstName} {user && user.lastName} | |||||
| </h3> | </h3> | ||||
| </div> | </div> | ||||
| <div className="flex-center"> | <div className="flex-center"> | ||||
| className={ | className={ | ||||
| "c-btn--primary-outlined c-btn userPageBtn ml-20px no-padding" | "c-btn--primary-outlined c-btn userPageBtn ml-20px no-padding" | ||||
| } | } | ||||
| onClick={() => handleReset(user.email)} | |||||
| onClick={() => setReset(true)} | |||||
| > | > | ||||
| {!matches && 'Resetuj password'} | |||||
| {!matches && "Resetuj password"} | |||||
| <img | <img | ||||
| style={{ | style={{ | ||||
| position: "relative", | position: "relative", | ||||
| src={lock} | src={lock} | ||||
| /> | /> | ||||
| </IconButton> | </IconButton> | ||||
| {!matches && <IconButton | |||||
| className={ | |||||
| `c-btn--primary-outlined c-btn userPageBtn ml-20px no-padding ${user?.isEnabled ? 'activeEnable' : 'deactiveEnable'}` | |||||
| } | |||||
| onClick={enableHandler} | |||||
| > | |||||
| {user?.isEnabled ? 'Blokiraj' : 'Odblokiraj'} | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| top: -0.25, | |||||
| paddingLeft: "10px", | |||||
| }} | |||||
| src={forbiden} | |||||
| /> | |||||
| </IconButton>} | |||||
| {!matches && <IconButton | |||||
| className={ | |||||
| "c-btn--primary-outlined c-btn userPageBtn ml-20px no-padding" | |||||
| } | |||||
| onClick={deleteHandler} | |||||
| > | |||||
| Obrisi | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| top: -0.25, | |||||
| paddingLeft: "10px", | |||||
| }} | |||||
| src={filters} | |||||
| /> | |||||
| </IconButton>} | |||||
| {!matches && ( | |||||
| <IconButton | |||||
| className={`c-btn--primary-outlined c-btn userPageBtn ml-20px no-padding ${ | |||||
| user?.isEnabled ? "activeEnable" : "deactiveEnable" | |||||
| }`} | |||||
| onClick={() => setConfirm(true)} | |||||
| > | |||||
| {user?.isEnabled ? "Blokiraj" : "Odblokiraj"} | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| top: -0.25, | |||||
| paddingLeft: "10px", | |||||
| }} | |||||
| src={forbiden} | |||||
| /> | |||||
| </IconButton> | |||||
| )} | |||||
| {!matches && ( | |||||
| <IconButton | |||||
| className={ | |||||
| "c-btn--primary-outlined c-btn userPageBtn ml-20px no-padding" | |||||
| } | |||||
| onClick={() => setDelete(true)} | |||||
| > | |||||
| Obrisi | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| top: -0.25, | |||||
| paddingLeft: "10px", | |||||
| }} | |||||
| src={filters} | |||||
| /> | |||||
| </IconButton> | |||||
| )} | |||||
| <IconButton | <IconButton | ||||
| className={ | className={ | ||||
| "c-btn--primary-outlined c-btn userPageBtn ml-20px no-padding" | "c-btn--primary-outlined c-btn userPageBtn ml-20px no-padding" | ||||
| width="108px" | width="108px" | ||||
| style={{ margin: "18px 15px 36px 0px" }} | style={{ margin: "18px 15px 36px 0px" }} | ||||
| /> | /> | ||||
| <p>{user?.position ? user.position : "Position has not been declared yet."}</p> | |||||
| <p> | |||||
| {user?.position | |||||
| ? user.position | |||||
| : "Position has not been declared yet."} | |||||
| </p> | |||||
| </div> | </div> | ||||
| <div style={{ display: "flex", flexDirection: "column", gap: "18px" }}> | <div style={{ display: "flex", flexDirection: "column", gap: "18px" }}> | ||||
| <p style={{ fontWeight: "600" }}>Kontakt</p> | <p style={{ fontWeight: "600" }}>Kontakt</p> | ||||
| </div> | </div> | ||||
| <div className="flex-center" style={{ justifyContent: "flex-start" }}> | <div className="flex-center" style={{ justifyContent: "flex-start" }}> | ||||
| <p style={{ width: "85px" }}>Telefon:</p> | <p style={{ width: "85px" }}>Telefon:</p> | ||||
| <p className="text-blue">{user?.phoneNumber ? user.phoneNumber : "User has no phone number saved."}</p> | |||||
| <p className="text-blue"> | |||||
| {user?.phoneNumber | |||||
| ? user.phoneNumber | |||||
| : "User has no phone number saved."} | |||||
| </p> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div | <div | ||||
| <p style={{ fontWeight: "600" }}>Drustvene mreze</p> | <p style={{ fontWeight: "600" }}>Drustvene mreze</p> | ||||
| <div className="flex-center" style={{ justifyContent: "flex-start" }}> | <div className="flex-center" style={{ justifyContent: "flex-start" }}> | ||||
| <p style={{ width: "85px" }}>LinkedIn:</p> | <p style={{ width: "85px" }}>LinkedIn:</p> | ||||
| <p className="text-blue">{user?.socialMedias ? user.socialMedias : "User takes not part in any social media."}</p> | |||||
| <p className="text-blue"> | |||||
| {user?.socialMedias | |||||
| ? user.socialMedias | |||||
| : "User takes not part in any social media."} | |||||
| </p> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div | <div |
| import userPageBtnIcon from "../../assets/images/userPageBtnIcon.png"; | import userPageBtnIcon from "../../assets/images/userPageBtnIcon.png"; | ||||
| import planeVector from "../../assets/images/planeVector.png"; | import planeVector from "../../assets/images/planeVector.png"; | ||||
| import lock from "../../assets/images/lock.png"; | import lock from "../../assets/images/lock.png"; | ||||
| import filters from "../../assets/images/filters.png"; | |||||
| // import filters from "../../assets/images/filters.png"; | |||||
| import forbiden from "../../assets/images/forbiden.png"; | import forbiden from "../../assets/images/forbiden.png"; | ||||
| import x from "../../assets/images/x.png"; | import x from "../../assets/images/x.png"; | ||||
| import edit from "../../assets/images/edit.png"; | import edit from "../../assets/images/edit.png"; | ||||
| setUsersReq, | setUsersReq, | ||||
| } from "../../store/actions/users/usersActions"; | } from "../../store/actions/users/usersActions"; | ||||
| import { useTheme } from "@mui/system"; | import { useTheme } from "@mui/system"; | ||||
| import { useMediaQuery } from "@mui/material"; | |||||
| import { TextField, useMediaQuery } from "@mui/material"; | |||||
| // import DialogComponent from "../../components/MUI/DialogComponent"; | // import DialogComponent from "../../components/MUI/DialogComponent"; | ||||
| import InviteDialog from "../../components/MUI/InviteDialog"; | import InviteDialog from "../../components/MUI/InviteDialog"; | ||||
| import { Link } from "react-router-dom"; | import { Link } from "react-router-dom"; | ||||
| import { forgetPassword } from "../../store/actions/login/loginActions"; | import { forgetPassword } from "../../store/actions/login/loginActions"; | ||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| import ConfirmDialog from "../../components/MUI/ConfirmDialog"; | |||||
| const UsersPage = () => { | const UsersPage = () => { | ||||
| const theme = useTheme(); | const theme = useTheme(); | ||||
| const [showInvite, setShowInvite] = useState(false); | const [showInvite, setShowInvite] = useState(false); | ||||
| const [editEnable, setEdit] = useState(false); | const [editEnable, setEdit] = useState(false); | ||||
| const [search, setSearch] = useState(""); | |||||
| const [chosen, setChosen] = useState(null); | |||||
| const [showConfirm, setConfirm] = useState(false); | |||||
| const [showReset, setReset] = useState(false); | |||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| }, [dispatch]); | }, [dispatch]); | ||||
| const disableHandler = (id) => { | const disableHandler = (id) => { | ||||
| dispatch(setEnableUsersReq({ id })); | |||||
| dispatch( | |||||
| setEnableUsersReq({ | |||||
| id, | |||||
| handleApiResponseSuccess: handleApiResponseSuccessEnable, | |||||
| }) | |||||
| ); | |||||
| }; | }; | ||||
| const handleReset = (email) => { | const handleReset = (email) => { | ||||
| dispatch( | dispatch( | ||||
| forgetPassword({ | forgetPassword({ | ||||
| email, | email, | ||||
| handleApiResponseSuccessReset, | |||||
| handleApiResponseSuccess: handleApiResponseSuccessReset, | |||||
| }) | }) | ||||
| ); | ); | ||||
| }; | }; | ||||
| const handleApiResponseSuccessReset = () => { | const handleApiResponseSuccessReset = () => { | ||||
| console.log("DONE!"); | |||||
| setReset(false) | |||||
| }; | |||||
| const handleApiResponseSuccessEnable = () => { | |||||
| setConfirm(false); | |||||
| }; | |||||
| const formatLabel = (string, value) => { | |||||
| if (!value) { | |||||
| return string; | |||||
| } | |||||
| return ( | |||||
| <span> | |||||
| {string.split(value).reduce((prev, current, i) => { | |||||
| if (!i) { | |||||
| return [current]; | |||||
| } | |||||
| return prev.concat( | |||||
| <b className="highlighted" key={value + current}> | |||||
| {value} | |||||
| </b>, | |||||
| current | |||||
| ); | |||||
| }, [])} | |||||
| </span> | |||||
| ); | |||||
| }; | }; | ||||
| return ( | return ( | ||||
| <div> | <div> | ||||
| <div className="l-t-rectangle"></div> | <div className="l-t-rectangle"></div> | ||||
| <div className="r-b-rectangle"></div> | <div className="r-b-rectangle"></div> | ||||
| {/* {showInvite && <DialogComponent/>} */} | |||||
| <ConfirmDialog | |||||
| open={showConfirm} | |||||
| title={"Disable user"} | |||||
| subtitle={chosen?.firstName + ' ' + chosen?.lastName} | |||||
| imgSrc={forbiden} | |||||
| content='Are you sure you want to disable user?' | |||||
| onClose={() => { | |||||
| setConfirm(false); | |||||
| }} | |||||
| onConfirm={() => { | |||||
| disableHandler(chosen.id); | |||||
| // setConfirm(false) | |||||
| }} | |||||
| /> | |||||
| <ConfirmDialog | |||||
| open={showReset} | |||||
| title={"Reset password"} | |||||
| subtitle={chosen?.firstName + ' ' + chosen?.lastName} | |||||
| imgSrc={lock} | |||||
| content='Are you sure you want to send password reset link?' | |||||
| onClose={() => { | |||||
| setReset(false); | |||||
| }} | |||||
| onConfirm={() => { | |||||
| handleReset(chosen.email) | |||||
| // setConfirm(false) | |||||
| }} | |||||
| /> | |||||
| <InviteDialog | <InviteDialog | ||||
| open={showInvite} | open={showInvite} | ||||
| onClose={() => { | onClose={() => { | ||||
| <IconButton | <IconButton | ||||
| className={`${ | className={`${ | ||||
| editEnable && "enabledEdit" | editEnable && "enabledEdit" | ||||
| } c-btn--primary-outlined c-btn userPageBtn`} | |||||
| } c-btn--primary-outlined editEnableBtn c-btn userPageBtn`} | |||||
| onClick={() => { | onClick={() => { | ||||
| setEdit((s) => !s); | setEdit((s) => !s); | ||||
| }} | }} | ||||
| /> | /> | ||||
| </IconButton> | </IconButton> | ||||
| <IconButton | <IconButton | ||||
| className={ | |||||
| "c-btn--primary-outlined c-btn userPageBtn ml-20px no-padding" | |||||
| } | |||||
| className={"c-btn--primary c-btn inviteBtn"} | |||||
| onClick={() => { | |||||
| setShowInvite(true); | |||||
| }} | |||||
| > | > | ||||
| {!matches && "Filteri"} | |||||
| {t("users.invite")} | |||||
| <img | <img | ||||
| style={{ | style={{ | ||||
| position: "relative", | position: "relative", | ||||
| top: -0.25, | |||||
| paddingLeft: matches ? "0px" : "10px", | |||||
| top: 1.25, | |||||
| paddingLeft: "15px", | |||||
| }} | }} | ||||
| src={filters} | |||||
| /> | |||||
| src={planeVector} | |||||
| />{" "} | |||||
| </IconButton> | </IconButton> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| }} | }} | ||||
| > | > | ||||
| <div className=" table-cont"> | <div className=" table-cont"> | ||||
| <TextField | |||||
| name="username" | |||||
| label={t("common.labelUsername")} | |||||
| margin="normal" | |||||
| value={search} | |||||
| // value={formik.values.username} | |||||
| // onChange={formik.handleChange} | |||||
| // error={formik.touched.username && Boolean(formik.errors.username)} | |||||
| // helperText={formik.touched.username && formik.errors.username} | |||||
| // autoFocus | |||||
| // fullWidth | |||||
| onChange={(e) => setSearch(e.target.value)} | |||||
| style={{ | |||||
| width: "893.56px", | |||||
| }} | |||||
| /> | |||||
| <table className="usersTable" style={{ width: "893.56px" }}> | <table className="usersTable" style={{ width: "893.56px" }}> | ||||
| <thead> | <thead> | ||||
| <tr className="headingRow"> | <tr className="headingRow"> | ||||
| </tr> | </tr> | ||||
| </thead> | </thead> | ||||
| <tbody> | <tbody> | ||||
| {users.map((n) => ( | |||||
| <tr key={n.id} className="secondaryRow"> | |||||
| <td> | |||||
| {n.firstName} {n.lastName} | |||||
| </td> | |||||
| <td>{n.email}</td> | |||||
| <td>HR Specialist</td> | |||||
| {/* <td className="cvLink">CV_Ermin.pdf</td> */} | |||||
| <td> | |||||
| {editEnable && ( | |||||
| <> | |||||
| <IconButton | |||||
| className={`c-btn--primary-outlined c-btn td-btn`} | |||||
| onClick={() => handleReset(n.email)} | |||||
| > | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| }} | |||||
| src={lock} | |||||
| /> | |||||
| </IconButton> | |||||
| <IconButton | |||||
| className={`c-btn--primary-outlined c-btn td-btn ${ | |||||
| n.isEnabled ? "active" : "inactive" | |||||
| }`} | |||||
| onClick={() => disableHandler(n.id)} | |||||
| > | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| }} | |||||
| src={forbiden} | |||||
| /> | |||||
| </IconButton> | |||||
| <Link to={`/users/${n.id}`}> | |||||
| <IconButton | |||||
| className={"c-btn--primary-outlined c-btn td-btn"} | |||||
| > | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| { | |||||
| // search !== '' ? users.map((n) => ( | |||||
| // <tr "user-row" key={n.id} className="secondaryRow"> | |||||
| // <td> | |||||
| // {n.firstName} {n.lastName} | |||||
| // </td> | |||||
| // <td>{n.email}</td> | |||||
| // <td>HR Specialist</td> | |||||
| // <td> | |||||
| // {editEnable && ( | |||||
| // <> | |||||
| // <IconButton | |||||
| // className={`c-btn--primary-outlined c-btn td-btn`} | |||||
| // onClick={() => handleReset(n.email)} | |||||
| // > | |||||
| // <img | |||||
| // style={{ | |||||
| // position: "relative", | |||||
| // }} | |||||
| // src={lock} | |||||
| // /> | |||||
| // </IconButton> | |||||
| // <IconButton | |||||
| // className={`c-btn--primary-outlined c-btn td-btn ${ | |||||
| // n.isEnabled ? "active" : "inactive" | |||||
| // }`} | |||||
| // onClick={() => disableHandler(n.id)} | |||||
| // > | |||||
| // <img | |||||
| // style={{ | |||||
| // position: "relative", | |||||
| // }} | |||||
| // src={forbiden} | |||||
| // /> | |||||
| // </IconButton> | |||||
| // <Link to={`/users/${n.id}`}> | |||||
| // <IconButton | |||||
| // className={"c-btn--primary-outlined c-btn td-btn"} | |||||
| // > | |||||
| // <img | |||||
| // style={{ | |||||
| // position: "relative", | |||||
| // }} | |||||
| // src={edit} | |||||
| // /> | |||||
| // </IconButton> | |||||
| // </Link> | |||||
| // </> | |||||
| // )} | |||||
| // </td> | |||||
| // </tr> | |||||
| // )) | |||||
| // : | |||||
| users | |||||
| .filter((n) => | |||||
| (n.firstName + " " + n.lastName) | |||||
| .toLowerCase() | |||||
| .includes(search.toLowerCase()) | |||||
| ) | |||||
| .map((n) => ( | |||||
| <tr | |||||
| key={n.id} | |||||
| className="secondaryRow" | |||||
| > | |||||
| <td> | |||||
| {(n.firstName + " " + n.lastName).includes(search) ? ( | |||||
| formatLabel(n.firstName + " " + n.lastName, search) | |||||
| ) : ( | |||||
| <span>{n.firstName + " " + n.lastName}</span> | |||||
| )} | |||||
| </td> | |||||
| <td>{n.email}</td> | |||||
| <td>HR Specialist</td> | |||||
| <td> | |||||
| {editEnable && ( | |||||
| <> | |||||
| <IconButton | |||||
| className={`c-btn--primary-outlined c-btn td-btn`} | |||||
| onClick={() => { | |||||
| setChosen(n); | |||||
| setReset(true); | |||||
| }} | |||||
| > | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| }} | |||||
| src={lock} | |||||
| /> | |||||
| </IconButton> | |||||
| <IconButton | |||||
| className={`c-btn--primary-outlined c-btn td-btn ${ | |||||
| n.isEnabled ? "active" : "inactive" | |||||
| }`} | |||||
| onClick={() => { | |||||
| setChosen(n); | |||||
| setConfirm(true); | |||||
| }} | }} | ||||
| src={edit} | |||||
| /> | |||||
| </IconButton> | |||||
| </Link> | |||||
| </> | |||||
| )} | |||||
| </td> | |||||
| </tr> | |||||
| ))} | |||||
| > | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| }} | |||||
| src={forbiden} | |||||
| /> | |||||
| </IconButton> | |||||
| <Link to={`/users/${n.id}`}> | |||||
| <IconButton | |||||
| className={ | |||||
| "c-btn--primary-outlined c-btn td-btn" | |||||
| } | |||||
| > | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| }} | |||||
| src={edit} | |||||
| /> | |||||
| </IconButton> | |||||
| </Link> | |||||
| </> | |||||
| )} | |||||
| </td> | |||||
| </tr> | |||||
| )) | |||||
| } | |||||
| </tbody> | </tbody> | ||||
| </table> | </table> | ||||
| </div> | </div> | ||||
| <div style={{ display: "flex", justifyContent: "flex-end", marginBottom:'35px' }}> | |||||
| <IconButton | |||||
| className={"c-btn--primary c-btn inviteBtn"} | |||||
| onClick={() => { | |||||
| setShowInvite(true); | |||||
| }} | |||||
| // style={{ | |||||
| // // marginBottom:'20px !important' | |||||
| // }} | |||||
| > | |||||
| <img | |||||
| style={{ | |||||
| position: "relative", | |||||
| top: 1.25, | |||||
| paddingRight: "15px", | |||||
| }} | |||||
| src={planeVector} | |||||
| />{" "} | |||||
| {t("users.invite")} | |||||
| </IconButton> | |||||
| </div> | |||||
| <div | |||||
| style={{ | |||||
| display: "flex", | |||||
| justifyContent: "flex-end", | |||||
| marginBottom: "35px", | |||||
| }} | |||||
| ></div> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> |
| } | } | ||||
| function toggleUserDetails(state) { | function toggleUserDetails(state) { | ||||
| console.log('ovde') | |||||
| return state.user | return state.user | ||||
| ? { | ? { | ||||
| ...state, | ...state, |
| const result = yield call(enableUserRequest, payload.id); | const result = yield call(enableUserRequest, payload.id); | ||||
| yield put(setEnableUsers(result.data)); | yield put(setEnableUsers(result.data)); | ||||
| yield put(toggleSingleUser()); | yield put(toggleSingleUser()); | ||||
| if(payload.handleApiResponseSuccess){ | |||||
| yield call(payload.handleApiResponseSuccess) | |||||
| } | |||||
| } catch (error) { | } catch (error) { | ||||
| if (error.response && error.response.data) { | if (error.response && error.response.data) { | ||||
| const errorMessage = yield call(rejectErrorCodeHelper, error); | const errorMessage = yield call(rejectErrorCodeHelper, error); |