Update logs to reflect check-in/check-out operations immediately
This commit is contained in:
parent
054ef8fd17
commit
4f1cf7c0a5
@ -41,21 +41,23 @@ const CheckCheckOutmodel = ({modeldata,closeModal,handleSubmitForm,}) => {
|
||||
} else
|
||||
{
|
||||
|
||||
if ( modeldata?.currentDate && checkIfCurrentDate(modeldata?.currentDate) )
|
||||
{
|
||||
handleSubmitForm(record)
|
||||
} 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}
|
||||
dispatch(markAttendance(formData))
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
showToast("Attendance Marked Successfully", "success");
|
||||
})
|
||||
.catch((error) => {
|
||||
showToast(error, "error");
|
||||
});
|
||||
}
|
||||
// if ( modeldata?.currentDate && checkIfCurrentDate( modeldata?.currentDate ) )
|
||||
// {
|
||||
dispatch(markAttendance(record))
|
||||
.unwrap()
|
||||
.then( ( data ) =>
|
||||
{
|
||||
|
||||
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}
|
||||
// }
|
||||
}
|
||||
|
||||
closeModal()
|
||||
@ -118,7 +120,10 @@ export default CheckCheckOutmodel;
|
||||
|
||||
const schemaReg = z.object({
|
||||
description:z.string().min(1,{message:"please give reason!"})
|
||||
});
|
||||
} );
|
||||
|
||||
|
||||
|
||||
export const Regularization = ({modeldata,closeModal,handleSubmitForm})=>{
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const coords = usePositionTracker();
|
||||
@ -133,7 +138,6 @@ export const Regularization = ({modeldata,closeModal,handleSubmitForm})=>{
|
||||
|
||||
const getCurrentDate = () => {
|
||||
const today = new Date();
|
||||
// return today.toISOString().split("T")[0];
|
||||
return today.toLocaleDateString('en-CA');
|
||||
};
|
||||
|
||||
@ -142,7 +146,6 @@ export const Regularization = ({modeldata,closeModal,handleSubmitForm})=>{
|
||||
{
|
||||
|
||||
let record = {...data, date: new Date().toLocaleDateString(),latitude:coords.latitude,longitude:coords.longitude, }
|
||||
|
||||
handleSubmitForm(record)
|
||||
closeModal()
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user