diff --git a/src/components/Activities/CheckCheckOutForm.jsx b/src/components/Activities/CheckCheckOutForm.jsx index b820233d..ccce971f 100644 --- a/src/components/Activities/CheckCheckOutForm.jsx +++ b/src/components/Activities/CheckCheckOutForm.jsx @@ -7,17 +7,17 @@ import { usePositionTracker } from "../../hooks/usePositionTracker"; import { useDispatch, useSelector } from "react-redux"; import { markAttendance } from "../../slices/apiSlice/attedanceLogsSlice"; import showToast from "../../services/toastService"; -import {checkIfCurrentDate} from "../../utils/dateUtils"; +import { checkIfCurrentDate } from "../../utils/dateUtils"; const schema = z.object({ - markTime: z.string().nonempty({message:"Time is required"}), - description:z.string().max(200,"description should less than 200 chracters").optional() + markTime: z.string().nonempty({ message: "Time is required" }), + description: z.string().max(200, "description should less than 200 chracters").optional() }); -const CheckCheckOutmodel = ({modeldata,closeModal,handleSubmitForm,}) => { +const CheckCheckOutmodel = ({ modeldata, closeModal, handleSubmitForm, }) => { - const projectId = useSelector((store)=>store.localVariables.projectId) + const projectId = useSelector((store) => store.localVariables.projectId) const [isLoading, setIsLoading] = useState(false); const coords = usePositionTracker(); const dispatch = useDispatch() @@ -29,60 +29,60 @@ const CheckCheckOutmodel = ({modeldata,closeModal,handleSubmitForm,}) => { reset, setValue, } = useForm({ - resolver: zodResolver( schema ), - mode:"onChange" + resolver: zodResolver(schema), + mode: "onChange" }); - const onSubmit = ( data ) => - { - let record = {...data, date: new Date().toLocaleDateString(),latitude:coords.latitude,longitude:coords.longitude,employeeId:modeldata.employeeId,action:modeldata.action,id:modeldata?.id || null} - if(modeldata.forWhichTab === 1){ - handleSubmitForm(record) - } else - { + const onSubmit = (data) => { + let record = { ...data, date: new Date().toLocaleDateString(), latitude: coords.latitude, longitude: coords.longitude, employeeId: modeldata.employeeId, action: modeldata.action, id: modeldata?.id || null } + if (modeldata.forWhichTab === 1) { + handleSubmitForm(record) + } else { - // if ( modeldata?.currentDate && checkIfCurrentDate( modeldata?.currentDate ) ) - // { - dispatch(markAttendance(record)) - .unwrap() - .then( ( data ) => - { - - showToast("Attendance Marked Successfully", "success"); - }) - .catch( ( error ) => - { + // if ( modeldata?.currentDate && checkIfCurrentDate( modeldata?.currentDate ) ) + // { + dispatch(markAttendance(record)) + .unwrap() + .then((data) => { - showToast(error, "error" ); + showToast("Attendance Marked Successfully", "success"); + }) + .catch((error) => { + + showToast(error, "error"); + + }); + + // } else + // { + // let formData = {...data, date: new Date().toLocaleDateString(),latitude:coords.latitude,longitude:coords.longitude,employeeId:modeldata.employeeId,projectId:projectId,action:modeldata.action,id:modeldata?.id || null} + // } + } - }); - - // } else - // { - // let formData = {...data, date: new Date().toLocaleDateString(),latitude:coords.latitude,longitude:coords.longitude,employeeId:modeldata.employeeId,projectId:projectId,action:modeldata.action,id:modeldata?.id || null} - // } - } - closeModal() }; return ( - - + +
- +
- setValue("markTime", e)} - interval={10} - checkOutTime={modeldata?.checkOutTime} + +
+
+ setValue("markTime", e)} + interval={10} + checkOutTime={modeldata?.checkOutTime} checkInTime={modeldata?.checkInTime} - /> - {errors. markTime &&

{errors.markTime.message}

} + /> + {errors.markTime &&

{errors.markTime.message}

}
-
- +
@@ -124,15 +124,15 @@ export default CheckCheckOutmodel; const schemaReg = z.object({ - description:z.string().min(1,{message:"please give reason!"}) -} ); + description: z.string().min(1, { message: "please give reason!" }) +}); -export const Regularization = ({modeldata,closeModal,handleSubmitForm})=>{ +export const Regularization = ({ modeldata, closeModal, handleSubmitForm }) => { const [isLoading, setIsLoading] = useState(false); const coords = usePositionTracker(); - + const { register, handleSubmit, @@ -146,22 +146,21 @@ export const Regularization = ({modeldata,closeModal,handleSubmitForm})=>{ return today.toLocaleDateString('en-CA'); }; - - const onSubmit = ( data ) => - { - let record = {...data, date: new Date().toLocaleDateString(),latitude:coords.latitude,longitude:coords.longitude, } + const onSubmit = (data) => { + + let record = { ...data, date: new Date().toLocaleDateString(), latitude: coords.latitude, longitude: coords.longitude, } handleSubmitForm(record) closeModal() }; return ( - - + + - +
-

Regularize Attendance

+

Regularize Attendance

@@ -176,7 +175,7 @@ export const Regularization = ({modeldata,closeModal,handleSubmitForm})=>{ )}
- +
diff --git a/src/components/master/CreateJobRole.jsx b/src/components/master/CreateJobRole.jsx index 6b52b10b..739e7e2f 100644 --- a/src/components/master/CreateJobRole.jsx +++ b/src/components/master/CreateJobRole.jsx @@ -70,7 +70,9 @@ const CreateJobRole = ({onClose}) => { const maxDescriptionLength = 255; return (<> - +
+ +
{ return ( +
+ +
{ const maxDescriptionLength = 255; return (<> +
+ +
diff --git a/src/components/master/EditJobRole.jsx b/src/components/master/EditJobRole.jsx index c13fc0d0..965f209a 100644 --- a/src/components/master/EditJobRole.jsx +++ b/src/components/master/EditJobRole.jsx @@ -77,6 +77,9 @@ const EditJobRole = ({data,onClose}) => { return (<> +
+ +
{ return ( - +
+ +
{ return (<> +
+ +
+