| } | } | ||||
| } | } | ||||
| .sel-item-no-data { | |||||
| display: flex; | |||||
| flex-direction: row; | |||||
| align-items: center; | |||||
| padding: 18px 36px; | |||||
| gap: 18px; | |||||
| width: 458px; | |||||
| background: #FFFFFF; | |||||
| border: 1px solid #E4E4E4; | |||||
| border-radius: 18px; | |||||
| transition: 0.3s; | |||||
| @include media-below($bp-xl) { | |||||
| justify-content: space-between; | |||||
| padding: 18px; | |||||
| width: 303px; | |||||
| } | |||||
| } | |||||
| .sel-item .status { | .sel-item .status { | ||||
| font-family: 'Source Sans Pro'; | font-family: 'Source Sans Pro'; | ||||
| font-style: normal; | font-style: normal; |
| </div> | </div> | ||||
| <div className="ad-filters-technologies-checkboxes"> | <div className="ad-filters-technologies-checkboxes"> | ||||
| <FormGroup> | <FormGroup> | ||||
| {technologies.map((technology, index) => ( | |||||
| {technologies?.map((technology, index) => ( | |||||
| <FormControlLabel | <FormControlLabel | ||||
| key={index} | key={index} | ||||
| control={ | control={ |
| } | } | ||||
| const Selection = (props) => { | const Selection = (props) => { | ||||
| const applicants = props.selection.selectionProcesses; | |||||
| const allApplicants = props.selection.selectionProcesses; | |||||
| const errorMessage = useSelector(selectDoneProcessError); | const errorMessage = useSelector(selectDoneProcessError); | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const user = useSelector(selectAuthUser); | const user = useSelector(selectAuthUser); | ||||
| const handleOpenDetails = (id) => { | const handleOpenDetails = (id) => { | ||||
| props.history.push(SELECTION_PROCESS_OF_APPLICANT_PAGE.replace(":id", id)) | props.history.push(SELECTION_PROCESS_OF_APPLICANT_PAGE.replace(":id", id)) | ||||
| } | } | ||||
| const applicants = allApplicants?.filter(a => a.status !== "Odrađen"); | |||||
| const renderList = applicants?.map((item, index) => { | const renderList = applicants?.map((item, index) => { | ||||
| return <div draggable key={index} className="sel-item" onDragStart={e => dragStart(e, item)} | return <div draggable key={index} className="sel-item" onDragStart={e => dragStart(e, item)} | ||||
| onClick={() => handleOpenDetails(item.applicant.applicantId)}> | onClick={() => handleOpenDetails(item.applicant.applicantId)}> | ||||
| <Backdrop position="absolute" isLoading={isLoading} /> | <Backdrop position="absolute" isLoading={isLoading} /> | ||||
| {applicants.length > 0 && renderList} | {applicants.length > 0 && renderList} | ||||
| {applicants.length === 0 && <div className="sel-item"> | |||||
| {applicants.length === 0 && <div className="sel-item-no-data"> | |||||
| <div className="date"> | <div className="date"> | ||||
| <p>Nema kandidata u selekciji</p> | <p>Nema kandidata u selekciji</p> | ||||
| </div> | </div> |
| import React, { useState } from "react"; | |||||
| import PropType from "prop-types"; | |||||
| import Box from "@mui/material/Box"; | |||||
| import Drawer from "@mui/material/Drawer"; | |||||
| import FormGroup from "@mui/material/FormGroup"; | |||||
| import FormControlLabel from "@mui/material/FormControlLabel"; | |||||
| import Checkbox from "@mui/material/Checkbox"; | |||||
| import filterIcon from "../../assets/images/filter_vector.png"; | |||||
| import x from "../../assets/images/x.png"; | |||||
| import { changeStatusIsCheckedValue } from "../../store/actions/processes/statusAction"; | |||||
| import { useDispatch } from "react-redux"; | |||||
| import { setFilteredProcessesReq } from "../../store/actions/processes/processesAction"; | |||||
| import { useTranslation } from "react-i18next"; | |||||
| const SelectionFilter = ({ open, handleClose, statuses }) => { | |||||
| const [startAt, setStartAt] = useState(""); | |||||
| const [endAt, setEndAt] = useState(""); | |||||
| const { t } = useTranslation(); | |||||
| const dispatch = useDispatch(); | |||||
| const onSubmitFilters = () => { | |||||
| const status = statuses | |||||
| .filter((status) => status.isChecked === true) | |||||
| .map((status) => status.name); | |||||
| if (status.length === 0) { | |||||
| return; | |||||
| } | |||||
| dispatch( | |||||
| setFilteredProcessesReq({ | |||||
| statuses: status, | |||||
| startAt, | |||||
| endAt | |||||
| }) | |||||
| ); | |||||
| handleClose(); | |||||
| }; | |||||
| const handleCheckboxes = (e) => { | |||||
| const { value } = e.target; | |||||
| dispatch(changeStatusIsCheckedValue(value)); | |||||
| }; | |||||
| const list = () => ( | |||||
| <Box | |||||
| sx={{ | |||||
| width: 360, | |||||
| height: "100%", | |||||
| borderRadius: "18px 0 0 18px", | |||||
| padding: "36px", | |||||
| }} | |||||
| role="presentation" | |||||
| // onClick={handleClose} | |||||
| onKeyDown={handleClose} | |||||
| > | |||||
| <div> | |||||
| <div className="ad-filters-header-container"> | |||||
| <div className="ad-filters-header"> | |||||
| <img src={filterIcon} alt="filter_icon" /> | |||||
| <h3>{t("filter.title")}</h3> | |||||
| <p> | |||||
| <sub>| {t("selection.title")}</sub> | |||||
| </p> | |||||
| </div> | |||||
| <div className="ad-filters-header-close" onClick={handleClose}> | |||||
| <img src={x} alt="x" /> | |||||
| </div> | |||||
| </div> | |||||
| <div className="ad-filters-technologies"> | |||||
| <div className="ad-filters-sub-title"> | |||||
| <p>{t("selection.filterStatus")}</p> | |||||
| </div> | |||||
| <div className="ad-filters-technologies-checkboxes"> | |||||
| <FormGroup> | |||||
| {statuses?.map((technology, index) => ( | |||||
| <FormControlLabel | |||||
| key={index} | |||||
| control={ | |||||
| <Checkbox | |||||
| onChange={handleCheckboxes} | |||||
| value={technology.name} | |||||
| checked={technology.isChecked} | |||||
| /> | |||||
| } | |||||
| label={technology.name} | |||||
| /> | |||||
| ))} | |||||
| </FormGroup> | |||||
| </div> | |||||
| </div> | |||||
| <div className="ad-filters-technologies"> | |||||
| {/* <div className="ad-filters-sub-title"> | |||||
| <p>Datum isteka oglasa</p> | |||||
| </div> | |||||
| <input | |||||
| type="date" | |||||
| placeholder="ex" | |||||
| value={expiredAt} | |||||
| onChange={(e) => setExpiredAt(e.target.value)} | |||||
| /> */} | |||||
| <div className="ad-filters-sub-title"> | |||||
| <p>{t("selection.filterDate")}</p> | |||||
| </div> | |||||
| <div className="add-ad-modal-stage-sub-card"> | |||||
| <label>{t("selection.filterFrom")}</label> | |||||
| <input | |||||
| type="date" | |||||
| placeholder="ex" | |||||
| value={startAt} | |||||
| onChange={(e) => setStartAt(e.target.value)} | |||||
| /> | |||||
| </div> | |||||
| <div className="add-ad-modal-stage-sub-card"> | |||||
| <label>{t("selection.filterTo")}</label> | |||||
| <input | |||||
| type="date" | |||||
| placeholder="ex" | |||||
| value={endAt} | |||||
| onChange={(e) => setEndAt(e.target.value)} | |||||
| /> | |||||
| </div> | |||||
| </div> | |||||
| <div className="ad-filters-search"> | |||||
| <button onClick={onSubmitFilters} className="c-btn c-btn--primary"> | |||||
| {t("selection.filterSubmit")} | |||||
| </button> | |||||
| </div> | |||||
| </div> | |||||
| </Box > | |||||
| ); | |||||
| return ( | |||||
| <div> | |||||
| <Drawer anchor="right" open={open} onClose={handleClose}> | |||||
| {list()} | |||||
| </Drawer> | |||||
| </div> | |||||
| ); | |||||
| }; | |||||
| SelectionFilter.propTypes = { | |||||
| open: PropType.any, | |||||
| handleClose: PropType.func, | |||||
| statuses: PropType.any, | |||||
| }; | |||||
| export default SelectionFilter; |
| title: "Tok Selekcije", | title: "Tok Selekcije", | ||||
| subtitle: "Svi kandidati", | subtitle: "Svi kandidati", | ||||
| tipHeader: "Savet za uspešan Screening test", | tipHeader: "Savet za uspešan Screening test", | ||||
| tipBody: "Zapamtite da odeljenje za ljudske resurse u sebi sadrži reč „ljudski“. HR treba da vas vidi kakvi ste i da bi stekli osećaj za vašu stvarnu ličnost i postarali se da se dobro uklopite u kompaniju. Zato je bolje da se ponašate prirodno i opušteno. Važno je i pokazati da posedujete snažne međuljudske veštine i da se ponašate profesionalno. Na dan intervjua budite tačni, predstavite se pristojno i obucite se na odgovarajući način. To znači da razmislite o slici kompanije, ali i da se odevate na način koji vam je ugodan tokom dana." | |||||
| tipBody: "Zapamtite da odeljenje za ljudske resurse u sebi sadrži reč „ljudski“. HR treba da vas vidi kakvi ste i da bi stekli osećaj za vašu stvarnu ličnost i postarali se da se dobro uklopite u kompaniju. Zato je bolje da se ponašate prirodno i opušteno. Važno je i pokazati da posedujete snažne međuljudske veštine i da se ponašate profesionalno. Na dan intervjua budite tačni, predstavite se pristojno i obucite se na odgovarajući način. To znači da razmislite o slici kompanije, ali i da se odevate na način koji vam je ugodan tokom dana.", | |||||
| filterStatus: "Status", | |||||
| filterDate: "Datum", | |||||
| filterFrom: "Od", | |||||
| filterTo: "Do", | |||||
| filterSubmit: "Pretraži" | |||||
| }, | }, | ||||
| users:{ | |||||
| management: "Upravljanje korisnicima", | |||||
| fullName: 'Ime i prezime', | |||||
| position: 'Pozicija', | |||||
| invite: 'Pozovi', | |||||
| inviteUser: 'Pozovi korisnika', | |||||
| regLink: 'Registracioni link', | |||||
| receiver: 'Primalac', | |||||
| user: 'Korisnik', | |||||
| contact: 'Kontakt', | |||||
| phone: 'Telefon', | |||||
| socials: 'Društvene mreže', | |||||
| } | |||||
| users: { | |||||
| management: "Upravljanje korisnicima", | |||||
| fullName: 'Ime i prezime', | |||||
| position: 'Pozicija', | |||||
| invite: 'Pozovi', | |||||
| inviteUser: 'Pozovi korisnika', | |||||
| regLink: 'Registracioni link', | |||||
| receiver: 'Primalac', | |||||
| user: 'Korisnik', | |||||
| contact: 'Kontakt', | |||||
| phone: 'Telefon', | |||||
| socials: 'Društvene mreže', | |||||
| }, | |||||
| filter: { | |||||
| title: "Filteri" | |||||
| } | |||||
| }; | }; |
| const concatLevels = () => { | const concatLevels = () => { | ||||
| const applicantSelections = []; | const applicantSelections = []; | ||||
| for (var i = processes.length; i < levels.length; i++) { | for (var i = processes.length; i < levels.length; i++) { | ||||
| applicantSelections.push(<ApplicantSelection | applicantSelections.push(<ApplicantSelection | ||||
| levelNumber={levels[i].id} | levelNumber={levels[i].id} | ||||
| className={index === processes.length - 1 ? "active-process" : ""} | className={index === processes.length - 1 ? "active-process" : ""} | ||||
| /> | /> | ||||
| })} | })} | ||||
| {processes.length < levels.length && concatLevels()} | |||||
| {processes.length <= levels.length && concatLevels()} | |||||
| </Slider> | </Slider> | ||||
| </div> | </div> | ||||
| </div> | </div> |
| import React, { useState, useEffect } from "react"; | import React, { useState, useEffect } from "react"; | ||||
| import { useSelector} from 'react-redux'; | import { useSelector} from 'react-redux'; | ||||
| import Selection from "../../components/Selection/Selection"; | import Selection from "../../components/Selection/Selection"; | ||||
| import IconButton from "../../components/IconButton/IconButton"; | |||||
| import filterVector from "../../assets/images/filter_vector.png"; | |||||
| import FilterButton from "../../components/Button/FilterButton"; | |||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| import AddAdModal from "../../components/Ads/AddAdModal"; | import AddAdModal from "../../components/Ads/AddAdModal"; | ||||
| import { useDispatch } from "react-redux"; | import { useDispatch } from "react-redux"; | ||||
| import AdFilters from "../../components/Ads/AdFilters"; | |||||
| import { setDoneProcess } from "../../store/actions/processes/processAction"; | import { setDoneProcess } from "../../store/actions/processes/processAction"; | ||||
| import { setProcessesReq } from "../../store/actions/processes/processesAction"; | import { setProcessesReq } from "../../store/actions/processes/processesAction"; | ||||
| import { setStatuses } from "../../store/actions/processes/statusAction"; | |||||
| import { selectDoneProcess } from "../../store/selectors/processSelectors"; | import { selectDoneProcess } from "../../store/selectors/processSelectors"; | ||||
| import { selectProcesses } from "../../store/selectors/processesSelectors" | import { selectProcesses } from "../../store/selectors/processesSelectors" | ||||
| import { selecStatuses } from "../../store/selectors/statusSelectors" | |||||
| import PropTypes from "prop-types"; | import PropTypes from "prop-types"; | ||||
| import SelectionFilter from "../../components/Selection/SelectionFilter" | |||||
| const SelectionProcessPage = ({history}) => { | const SelectionProcessPage = ({history}) => { | ||||
| const [toggleFiltersDrawer, setToggleFiltersDrawer] = useState(false); | const [toggleFiltersDrawer, setToggleFiltersDrawer] = useState(false); | ||||
| // const doneErrorMessage = useSelector(selectDoneProcessError); | // const doneErrorMessage = useSelector(selectDoneProcessError); | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const statuses = useSelector(selecStatuses); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| dispatch(setProcessesReq()); | dispatch(setProcessesReq()); | ||||
| const s = [ | |||||
| {"isChecked":false,"name":"Zakazan"}, | |||||
| {"isChecked":false,"name":"Odrađen"}, | |||||
| {"isChecked":false,"name":"Čeka na zakazivanje"}, | |||||
| {"isChecked":false,"name":"Čeka se odgovor"}] | |||||
| dispatch(setStatuses(s)); | |||||
| }, []); | }, []); | ||||
| <> | <> | ||||
| <div className="l-t-rectangle"></div> | <div className="l-t-rectangle"></div> | ||||
| <div className="r-b-rectangle"></div> | <div className="r-b-rectangle"></div> | ||||
| <AdFilters /> | |||||
| <AdFilters | |||||
| <SelectionFilter /> | |||||
| <SelectionFilter | |||||
| open={toggleFiltersDrawer} | open={toggleFiltersDrawer} | ||||
| handleClose={handleToggleFiltersDrawer} | handleClose={handleToggleFiltersDrawer} | ||||
| statuses={statuses} | |||||
| /> | /> | ||||
| <AddAdModal open={toggleModal} handleClose={handleToggleModal} /> | <AddAdModal open={toggleModal} handleClose={handleToggleModal} /> | ||||
| <div className="selections"> | <div className="selections"> | ||||
| {t("selection.subtitle")} | {t("selection.subtitle")} | ||||
| </span> | </span> | ||||
| </h1> | </h1> | ||||
| <FilterButton onShowFilters={handleToggleFiltersDrawer} /> | |||||
| </div> | </div> | ||||
| <div> | <div> | ||||
| <IconButton | |||||
| {/* <IconButton | |||||
| sx={{ marginLeft: "15px" }} | sx={{ marginLeft: "15px" }} | ||||
| className="c-btn c-btn--primary-outlined fixed-right" | className="c-btn c-btn--primary-outlined fixed-right" | ||||
| onClick={handleToggleFiltersDrawer} | onClick={handleToggleFiltersDrawer} | ||||
| > | > | ||||
| Filteri{" "} | Filteri{" "} | ||||
| <img src={filterVector} alt="filter" className="filter-vector" /> | <img src={filterVector} alt="filter" className="filter-vector" /> | ||||
| </IconButton> | |||||
| </IconButton> */} | |||||
| <div className="selection-levels-processes"> | <div className="selection-levels-processes"> | ||||
| <div className="selection-levels-processes-process"> | <div className="selection-levels-processes-process"> | ||||
| {renderList} | {renderList} |
| }, | }, | ||||
| processes: { | processes: { | ||||
| allLevels: base + "/selectionlevels", | allLevels: base + "/selectionlevels", | ||||
| filteredLevels: base + "/selectionlevels/filtered", | |||||
| doneProcess: base + "/selectionprocesses", | doneProcess: base + "/selectionprocesses", | ||||
| getApplicantProcesses: base + "/applicants/processes", | getApplicantProcesses: base + "/applicants/processes", | ||||
| // allProcesses: base + "/selectionprocesses", | // allProcesses: base + "/selectionprocesses", |
| export const getAllLevels = () => getRequest(apiEndpoints.processes.allLevels); | export const getAllLevels = () => getRequest(apiEndpoints.processes.allLevels); | ||||
| export const doneProcess = (data) => postRequest(apiEndpoints.processes.doneProcess,data); | export const doneProcess = (data) => postRequest(apiEndpoints.processes.doneProcess,data); | ||||
| export const getProcessesOfApplicant = (id) => getRequest(`${apiEndpoints.processes.getApplicantProcesses}/${id}`); | export const getProcessesOfApplicant = (id) => getRequest(`${apiEndpoints.processes.getApplicantProcesses}/${id}`); | ||||
| export const getAllFilteredProcessesReq = (payload) => { | |||||
| let statusesQuery = ""; | |||||
| for (let i = 0; i < payload.statuses.length; i++) { | |||||
| statusesQuery += `statuses=${payload.statuses[i]}&`; | |||||
| } | |||||
| if(payload.startAt && payload.startAt !== null) | |||||
| statusesQuery += `DateStart=${payload.startAt}`; | |||||
| if(payload.endAt && payload.endAt !== null) | |||||
| statusesQuery += `&DateEnd=${payload.endAt}`; | |||||
| return getRequest( | |||||
| apiEndpoints.processes.filteredLevels + | |||||
| "?" + | |||||
| `${statusesQuery}` | |||||
| ); | |||||
| }; |
| FETCH_PROCESSES_REQ, | FETCH_PROCESSES_REQ, | ||||
| FETCH_PROCESSES_ERR, | FETCH_PROCESSES_ERR, | ||||
| FETCH_PROCESSES_SUCCESS, | FETCH_PROCESSES_SUCCESS, | ||||
| FETCH_FILTERED_PROCESSES_REQ | |||||
| } from "./processesActionConstants"; | } from "./processesActionConstants"; | ||||
| export const setProcessesReq = () => ({ | export const setProcessesReq = () => ({ | ||||
| type: FETCH_PROCESSES_REQ, | type: FETCH_PROCESSES_REQ, | ||||
| }); | }); | ||||
| export const setFilteredProcessesReq = (payload) => ({ | |||||
| type: FETCH_FILTERED_PROCESSES_REQ, | |||||
| payload, | |||||
| }); | |||||
| export const setProcessesError = (payload) => ({ | export const setProcessesError = (payload) => ({ | ||||
| type: FETCH_PROCESSES_ERR, | type: FETCH_PROCESSES_ERR, | ||||
| payload, | payload, |
| export const FETCH_PROCESSES_REQ = 'FETCH_PROCESSES_REQ'; | export const FETCH_PROCESSES_REQ = 'FETCH_PROCESSES_REQ'; | ||||
| export const FETCH_PROCESSES_ERR = 'FETCH_PROCESSES_ERR'; | export const FETCH_PROCESSES_ERR = 'FETCH_PROCESSES_ERR'; | ||||
| export const FETCH_PROCESSES_SUCCESS = 'FETCH_PROCESSES_SUCCESS'; | export const FETCH_PROCESSES_SUCCESS = 'FETCH_PROCESSES_SUCCESS'; | ||||
| export const FETCH_FILTERED_PROCESSES_REQ = 'FETCH_FILTERED_PROCESSES_REQ'; | |||||
| const PUT_PROCESS_SCOPE = 'PUT_PROCESS'; | const PUT_PROCESS_SCOPE = 'PUT_PROCESS'; | ||||
| export const PUT_PROCESS_REQ = createFetchType(PUT_PROCESS_SCOPE); | export const PUT_PROCESS_REQ = createFetchType(PUT_PROCESS_SCOPE); | ||||
| export const FETCH_APPLICANT_PROCESSES_REQ = 'FETCH_APPLICANT_PROCESSES_REQ'; | export const FETCH_APPLICANT_PROCESSES_REQ = 'FETCH_APPLICANT_PROCESSES_REQ'; | ||||
| export const FETCH_APPLICANT_PROCESSES_ERR = 'FETCH_APPLICANT_PROCESSES_ERR'; | export const FETCH_APPLICANT_PROCESSES_ERR = 'FETCH_APPLICANT_PROCESSES_ERR'; | ||||
| export const FETCH_APPLICANT_PROCESSES_SUCCESS = 'FETCH_APPLICANT_PROCESSES_SUCCESS'; | |||||
| export const FETCH_APPLICANT_PROCESSES_SUCCESS = 'FETCH_APPLICANT_PROCESSES_SUCCESS'; | |||||
| export const FETCH_STATUSES_REQ = 'FETCH_STATUSES_REQ'; | |||||
| export const FETCH_STATUSES_ERR = 'FETCH_STATUSES_ERR'; | |||||
| export const FETCH_STATUSES_SUCCESS = 'FETCH_STATUSES_SUCCESS'; | |||||
| export const CHANGE_STATUS_ISCHECKED_VALUE = 'CHANGE_STATUS_ISCHECKED_VALUE'; |
| import { | |||||
| FETCH_STATUSES_ERR, | |||||
| FETCH_STATUSES_SUCCESS, | |||||
| FETCH_STATUSES_REQ, | |||||
| CHANGE_STATUS_ISCHECKED_VALUE | |||||
| } from "./processesActionConstants"; | |||||
| export const setStatusesReq = () => ({ | |||||
| type: FETCH_STATUSES_REQ, | |||||
| }); | |||||
| export const setStatusesError = (payload) => ({ | |||||
| type: FETCH_STATUSES_ERR, | |||||
| payload, | |||||
| }); | |||||
| export const setStatuses = (payload) => ({ | |||||
| type: FETCH_STATUSES_SUCCESS, | |||||
| payload, | |||||
| }); | |||||
| export const changeStatusIsCheckedValue = (payload) => ({ | |||||
| type: CHANGE_STATUS_ISCHECKED_VALUE, | |||||
| payload, | |||||
| }); |
| import applicantWithProcessesReducer from "./processes/applicantWithProcessesReducer"; | import applicantWithProcessesReducer from "./processes/applicantWithProcessesReducer"; | ||||
| import userDetailsReducer from "./user/userDetailsReducer"; | import userDetailsReducer from "./user/userDetailsReducer"; | ||||
| import inviteUserReducer from "./user/inviteUserReducer"; | import inviteUserReducer from "./user/inviteUserReducer"; | ||||
| import statusReducer from "./processes/statusReducer"; | |||||
| export default combineReducers({ | export default combineReducers({ | ||||
| login: loginReducer, | login: loginReducer, | ||||
| applicant: applicantWithProcessesReducer, | applicant: applicantWithProcessesReducer, | ||||
| userDetails: userDetailsReducer, | userDetails: userDetailsReducer, | ||||
| invite: inviteUserReducer, | invite: inviteUserReducer, | ||||
| statuses: statusReducer, | |||||
| }); | }); |
| import createReducer from "../../utils/createReducer"; | |||||
| import { | |||||
| FETCH_STATUSES_SUCCESS, | |||||
| FETCH_STATUSES_ERR, | |||||
| CHANGE_STATUS_ISCHECKED_VALUE, | |||||
| } from "../../actions/processes/processesActionConstants"; | |||||
| const initialState = { | |||||
| statuses: [], | |||||
| errorMessage: "", | |||||
| }; | |||||
| export default createReducer( | |||||
| { | |||||
| [FETCH_STATUSES_SUCCESS]: setStateStatuses, | |||||
| [FETCH_STATUSES_ERR]: setStateErrorMessage, | |||||
| [CHANGE_STATUS_ISCHECKED_VALUE]: setIsCheckedStatus, | |||||
| }, | |||||
| initialState | |||||
| ); | |||||
| function setStateStatuses(state, action) { | |||||
| return { ...state, statuses: action.payload }; | |||||
| } | |||||
| function setStateErrorMessage(state, action) { | |||||
| return { ...state, errorMessage: action.payload }; | |||||
| } | |||||
| function setIsCheckedStatus(state, action) { | |||||
| const tmpIndex = state.statuses.findIndex( | |||||
| (x) => x.name === action.payload | |||||
| ); | |||||
| if (tmpIndex === -1) { | |||||
| return state; | |||||
| } | |||||
| return { | |||||
| ...state, | |||||
| statuses: state.statuses.map((status, index) => | |||||
| tmpIndex === index ? { ...status, isChecked: !status.isChecked } : status | |||||
| ), | |||||
| }; | |||||
| } |
| import { all, call, put, takeLatest } from "redux-saga/effects"; | import { all, call, put, takeLatest } from "redux-saga/effects"; | ||||
| import { getAllLevels, doneProcess, getProcessesOfApplicant } from "../../request/processesReguest"; | |||||
| import { getAllLevels, doneProcess, getProcessesOfApplicant, getAllFilteredProcessesReq } from "../../request/processesReguest"; | |||||
| import { setProcesses, setProcessesError } from "../actions/processes/processesAction"; | import { setProcesses, setProcessesError } from "../actions/processes/processesAction"; | ||||
| import { addHeaderToken } from "../../request"; | import { addHeaderToken } from "../../request"; | ||||
| import { authScopeStringGetHelper } from "../../util/helpers/authScopeHelpers"; | import { authScopeStringGetHelper } from "../../util/helpers/authScopeHelpers"; | ||||
| import { JWT_TOKEN } from "../../constants/localStorage"; | import { JWT_TOKEN } from "../../constants/localStorage"; | ||||
| import { setDoneProcess, setDoneProcessError } from "../actions/processes/processAction"; | import { setDoneProcess, setDoneProcessError } from "../actions/processes/processAction"; | ||||
| import { setApplicant, setApplicantError } from "../actions/processes/applicantAction"; | import { setApplicant, setApplicantError } from "../actions/processes/applicantAction"; | ||||
| import { FETCH_PROCESSES_REQ, PUT_PROCESS_REQ, FETCH_APPLICANT_PROCESSES_REQ } from "../actions/processes/processesActionConstants"; | |||||
| import { FETCH_PROCESSES_REQ, FETCH_FILTERED_PROCESSES_REQ ,PUT_PROCESS_REQ, FETCH_APPLICANT_PROCESSES_REQ } from "../actions/processes/processesActionConstants"; | |||||
| export function* getProcesses() { | export function* getProcesses() { | ||||
| try { | try { | ||||
| } | } | ||||
| } | } | ||||
| export function* getFilteredProcesses(payload) { | |||||
| try { | |||||
| // const JwtToken = yield call(authScopeStringGetHelper, JWT_TOKEN); | |||||
| // yield call(addHeaderToken, JwtToken); | |||||
| console.log(payload.payload) | |||||
| const result = yield call(getAllFilteredProcessesReq, payload.payload); | |||||
| yield put(setProcesses(result.data)); | |||||
| } catch (error) { | |||||
| yield put(setProcessesError(error)); | |||||
| } | |||||
| } | |||||
| export function* finishProcess(payload) { | export function* finishProcess(payload) { | ||||
| try { | try { | ||||
| const JwtToken = yield call(authScopeStringGetHelper, JWT_TOKEN); | const JwtToken = yield call(authScopeStringGetHelper, JWT_TOKEN); | ||||
| export default function* processesSaga() { | export default function* processesSaga() { | ||||
| yield all([takeLatest(FETCH_PROCESSES_REQ, getProcesses)]); | yield all([takeLatest(FETCH_PROCESSES_REQ, getProcesses)]); | ||||
| yield all([takeLatest(FETCH_FILTERED_PROCESSES_REQ, getFilteredProcesses)]); | |||||
| yield all([takeLatest(PUT_PROCESS_REQ, finishProcess)]); | yield all([takeLatest(PUT_PROCESS_REQ, finishProcess)]); | ||||
| yield all([takeLatest(FETCH_APPLICANT_PROCESSES_REQ, getApplicantProcesses)]); | yield all([takeLatest(FETCH_APPLICANT_PROCESSES_REQ, getApplicantProcesses)]); | ||||
| } | } |
| import { createSelector } from "@reduxjs/toolkit"; | |||||
| export const statusesSelector = (state) => state.statuses; | |||||
| export const selecStatuses = createSelector( | |||||
| statusesSelector, | |||||
| (state) => state.statuses | |||||
| ); | |||||
| export const selecStatusesError = createSelector( | |||||
| statusesSelector, | |||||
| (state) => state.errorMessage | |||||
| ); |