Compare commits
4 Commits
c45130b611
...
4a5d9c05e6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a5d9c05e6 | ||
|
|
60232cf121 | ||
|
|
9e32986969 | ||
|
|
aa6ddd7fe9 |
@ -11,7 +11,7 @@ const Regularization = ( { handleRequest} ) =>
|
|||||||
{
|
{
|
||||||
var selectedProject = useSelector((store) => store.localVariables.projectId);
|
var selectedProject = useSelector((store) => store.localVariables.projectId);
|
||||||
const [ regularizesList, setregularizedList ] = useState( [] )
|
const [ regularizesList, setregularizedList ] = useState( [] )
|
||||||
const { regularizes, loading,error} = useRegularizationRequests(selectedProject)
|
const { regularizes, loading,error,refetch} = useRegularizationRequests(selectedProject)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ const Regularization = ( { handleRequest} ) =>
|
|||||||
<td>{att.checkOutTime ? convertShortTime(att.checkOutTime):"--"}</td>
|
<td>{att.checkOutTime ? convertShortTime(att.checkOutTime):"--"}</td>
|
||||||
<td className='text-center ' >
|
<td className='text-center ' >
|
||||||
{/* <div className='d-flex justify-content-center align-items-center gap-3'> */}
|
{/* <div className='d-flex justify-content-center align-items-center gap-3'> */}
|
||||||
<RegularizationActions attendanceData={att} handleRequest={handleRequest} />
|
<RegularizationActions attendanceData={att} handleRequest={handleRequest} refresh={refetch } />
|
||||||
{/* </div> */}
|
{/* </div> */}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -5,9 +5,10 @@ import { useDispatch, useSelector } from 'react-redux';
|
|||||||
import { usePositionTracker } from '../../hooks/usePositionTracker';
|
import { usePositionTracker } from '../../hooks/usePositionTracker';
|
||||||
import {markCurrentAttendance} from '../../slices/apiSlice/attendanceAllSlice';
|
import {markCurrentAttendance} from '../../slices/apiSlice/attendanceAllSlice';
|
||||||
import {cacheData, getCachedData} from '../../slices/apiDataManager';
|
import {cacheData, getCachedData} from '../../slices/apiDataManager';
|
||||||
|
import showToast from '../../services/toastService';
|
||||||
|
|
||||||
|
|
||||||
const RegularizationActions = ({attendanceData,handleRequest}) => {
|
const RegularizationActions = ({attendanceData,handleRequest,refresh}) => {
|
||||||
const [status,setStatus] = useState()
|
const [status,setStatus] = useState()
|
||||||
const [loadingApprove,setLoadingForApprove] = useState(false)
|
const [loadingApprove,setLoadingForApprove] = useState(false)
|
||||||
const [loadingReject,setLoadingForReject] = useState(false)
|
const [loadingReject,setLoadingForReject] = useState(false)
|
||||||
@ -17,7 +18,7 @@ const {latitude,longitude} = usePositionTracker();
|
|||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
|
||||||
const handleRegularization =(request_attendance,IsReqularize)=>{
|
const handleRegularization =(request_attendance,IsReqularize)=>{
|
||||||
debugger
|
|
||||||
if(IsReqularize){
|
if(IsReqularize){
|
||||||
setLoadingForApprove(true)
|
setLoadingForApprove(true)
|
||||||
}else{
|
}else{
|
||||||
@ -46,8 +47,12 @@ const dispatch = useDispatch()
|
|||||||
|
|
||||||
cacheData("regularizedList",{data:updatedata,projectId:projectId})
|
cacheData("regularizedList",{data:updatedata,projectId:projectId})
|
||||||
setLoadingForApprove( false )
|
setLoadingForApprove( false )
|
||||||
setLoadingForReject(false)
|
setLoadingForReject( false )
|
||||||
})
|
refresh()
|
||||||
|
}).catch( ( error ) =>
|
||||||
|
{
|
||||||
|
showToast(error.message,"error")
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -67,7 +72,7 @@ const dispatch = useDispatch()
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-auto d-flex gap-2 align-items-center justify-content-between">
|
<div className="w-auto d-flex gap-2 align-items-center justify-content-end">
|
||||||
{attendanceData.activity == 2 && (
|
{attendanceData.activity == 2 && (
|
||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@ -24,7 +24,7 @@ const RenderAttendanceStatus = ({ attendanceData, handleModalData,Tab,currentDat
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="d-flex justify-content-center">
|
<div className="d-flex justify-content-end">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`btn btn-xs ${color}`}
|
className={`btn btn-xs ${color}`}
|
||||||
|
|||||||
@ -110,5 +110,5 @@ export const useRegularizationRequests = ( projectId ) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
}, [ projectId ] );
|
}, [ projectId ] );
|
||||||
return {regularizes,loading,error}
|
return {regularizes,loading,error,refetch:fetchData}
|
||||||
}
|
}
|
||||||
@ -20,8 +20,6 @@ export const markAttendance = createAsyncThunk(
|
|||||||
'attendanceLogs/markAttendance', // Updated action type prefix
|
'attendanceLogs/markAttendance', // Updated action type prefix
|
||||||
async ( formData, thunkAPI ) =>
|
async ( formData, thunkAPI ) =>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let newRecordAttendance = {
|
let newRecordAttendance = {
|
||||||
Id: formData.id || null,
|
Id: formData.id || null,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ export const markCurrentAttendance = createAsyncThunk(
|
|||||||
'attendanceCurrentDate/markAttendance',
|
'attendanceCurrentDate/markAttendance',
|
||||||
async ( formData, {getState, dispatch, rejectWithValue} ) =>
|
async ( formData, {getState, dispatch, rejectWithValue} ) =>
|
||||||
{
|
{
|
||||||
debugger
|
|
||||||
const { projectId } = getState().localVariables
|
const { projectId } = getState().localVariables
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user