import React, { useState } from "react"; import PropTypes from "prop-types"; import x from "../../assets/images/x.png"; import { Dialog, DialogTitle, DialogActions, useMediaQuery, useTheme, DialogContent, FormControl, InputLabel, Select, MenuItem, TextField, // TextField, } from "@mui/material"; import IconButton from "../IconButton/IconButton"; import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker"; import { useDispatch, useSelector } from "react-redux"; import { format, isValid } from "date-fns"; import { fetchInitProcess } from "../../store/actions/candidates/candidatesActions"; import { useEffect } from "react"; const InterviewDialog = ({ title, subtitle, imgSrc, onClose, open, maxWidth, fullWidth, responsive, }) => { const [selected, setSelected] = useState(""); const [value, setValue] = useState(null); const theme = useTheme(); const fullScreen = useMediaQuery(theme.breakpoints.down("md")); const { options } = useSelector((n) => n.options); const { user } = useSelector((s) => s.user); const { isSuccess } = useSelector((s) => s.initProcess); const dispatch = useDispatch(); useEffect(() => { handleClose(); }, [dispatch, isSuccess]); const handleChange = (newValue) => { if (isValid(newValue)) { // throws an error if invalid value is set var date = format(newValue, "yyyy-MM-dd'T'HH:mm:ss.SSSxxx"); setValue(date); } }; useEffect(()=>{ setSelected('') setValue(null) }, [onClose]) const handleClose = () => { onClose(); }; const submitHandler = () => { dispatch( fetchInitProcess({ model: { schedulerId: user.id, appointment: value, applicantId: selected, }, }) ); }; return (
{fullScreen ? ( <>
{title}

| {subtitle}

) : (
{title}

{subtitle}

)}
Ime kandidata } />
{!fullScreen ? ( Cancel ) : ( "" )} Confirm
); }; InterviewDialog.propTypes = { title: PropTypes.any, subtitle: PropTypes.any, imgSrc: PropTypes.any, open: PropTypes.bool.isRequired, onClose: PropTypes.func.isRequired, maxWidth: PropTypes.oneOf(["xs", "sm", "md", "lg", "xl"]), fullWidth: PropTypes.bool, responsive: PropTypes.bool, }; export default InterviewDialog;