| @@ -13,7 +13,6 @@ import { | |||
| Select, | |||
| MenuItem, | |||
| TextField, | |||
| // TextField, | |||
| } from "@mui/material"; | |||
| import IconButton from "../IconButton/IconButton"; | |||
| import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker"; | |||
| @@ -23,7 +22,10 @@ import { format, isValid } from "date-fns"; | |||
| import { useEffect } from "react"; | |||
| import { SelectionContext } from "../../context/SelectionContext"; | |||
| import { setUpdateStatusReq } from "../../store/actions/processes/processAction"; | |||
| import { createScreeningTest, fetchScreeningTests } from "../../store/actions/screeningTests/screeningTestActions"; | |||
| import { | |||
| createScreeningTest, | |||
| fetchScreeningTests, | |||
| } from "../../store/actions/screeningTests/screeningTestActions"; | |||
| const StatusDialog = ({ | |||
| title, | |||
| @@ -35,9 +37,10 @@ const StatusDialog = ({ | |||
| fullWidth, | |||
| responsive, | |||
| }) => { | |||
| const [selected, setSelected] = useState(''); | |||
| const [selected, setSelected] = useState(""); | |||
| const [value, setValue] = useState(null); | |||
| const [selectedScreeningTest, setSelectedScreeningTest] = useState(""); | |||
| const [duration, setDuration] = useState(0); | |||
| const { activeProcess, setActiveProcess } = useContext(SelectionContext); | |||
| @@ -62,24 +65,25 @@ const StatusDialog = ({ | |||
| } | |||
| }; | |||
| useEffect(() => { | |||
| setSelected(''); | |||
| useEffect(() => { | |||
| setSelected(""); | |||
| setValue(null); | |||
| setSelectedScreeningTest("") | |||
| setSelectedScreeningTest(""); | |||
| setDuration(0); | |||
| }, [onClose]); | |||
| useEffect(()=>{ | |||
| if(activeProcess?.process.selectionLevelId === 2){ | |||
| useEffect(() => { | |||
| if (activeProcess?.process.selectionLevelId === 2) { | |||
| dispatch(fetchScreeningTests()); | |||
| } | |||
| },[activeProcess]) | |||
| }, [activeProcess]); | |||
| const handleClose = () => { | |||
| onClose(); | |||
| }; | |||
| const submitHandler = () => { | |||
| console.log(selected) | |||
| console.log(selected); | |||
| if (activeProcess.process.selectionLevelId !== 2) { | |||
| dispatch( | |||
| setUpdateStatusReq({ | |||
| @@ -105,16 +109,15 @@ const StatusDialog = ({ | |||
| }) | |||
| ); | |||
| } | |||
| }; | |||
| const apiSuccessScreeningTests = () => { | |||
| const user = users.find(k => k.id === selected) | |||
| const user = users.find((k) => k.id === selected); | |||
| dispatch( | |||
| createScreeningTest({ | |||
| adminEmail: user.email, | |||
| email: activeProcess.process.applicant.email, | |||
| duration: 60, | |||
| duration: Number.parseInt(duration), | |||
| testId: parseInt(selectedScreeningTest), | |||
| url: "https:dzenis-meris.com", | |||
| }) | |||
| @@ -249,6 +252,17 @@ const StatusDialog = ({ | |||
| </FormControl> | |||
| )} | |||
| {activeProcess !== null && | |||
| activeProcess.process.selectionLevelId === 2 && ( | |||
| <TextField | |||
| name="duration" | |||
| label={"Duration"} | |||
| value={duration} | |||
| onChange={(e) => setDuration(e.target.value)} | |||
| fullWidth | |||
| /> | |||
| )} | |||
| {/* {activeProcess.process && activeProcess.process.date ? <p>Proces ima zakazan termin</p> : ''} */} | |||
| <DateTimePicker | |||
| label="Termin" | |||