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
|
} else
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( modeldata?.currentDate && checkIfCurrentDate(modeldata?.currentDate) )
|
// if ( modeldata?.currentDate && checkIfCurrentDate( modeldata?.currentDate ) )
|
||||||
{
|
// {
|
||||||
handleSubmitForm(record)
|
dispatch(markAttendance(record))
|
||||||
} else
|
.unwrap()
|
||||||
{
|
.then( ( data ) =>
|
||||||
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()
|
showToast("Attendance Marked Successfully", "success");
|
||||||
.then(() => {
|
})
|
||||||
showToast("Attendance Marked Successfully", "success");
|
.catch((error) => {
|
||||||
})
|
showToast(error, "error");
|
||||||
.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()
|
closeModal()
|
||||||
@ -118,7 +120,10 @@ export default CheckCheckOutmodel;
|
|||||||
|
|
||||||
const schemaReg = z.object({
|
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 [isLoading, setIsLoading] = useState(false);
|
||||||
const coords = usePositionTracker();
|
const coords = usePositionTracker();
|
||||||
@ -133,7 +138,6 @@ export const Regularization = ({modeldata,closeModal,handleSubmitForm})=>{
|
|||||||
|
|
||||||
const getCurrentDate = () => {
|
const getCurrentDate = () => {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
// return today.toISOString().split("T")[0];
|
|
||||||
return today.toLocaleDateString('en-CA');
|
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, }
|
let record = {...data, date: new Date().toLocaleDateString(),latitude:coords.latitude,longitude:coords.longitude, }
|
||||||
|
|
||||||
handleSubmitForm(record)
|
handleSubmitForm(record)
|
||||||
closeModal()
|
closeModal()
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user