Compare commits

..

No commits in common. "6a6f0356bc04c390db80b209dc359312d8474f6d" and "453c53940f28b594083350329f8f209f229c8d5c" have entirely different histories.

2 changed files with 89 additions and 78 deletions

View File

@ -38,7 +38,6 @@ const AttendancePage = () => {
date: new Date().toLocaleDateString(), date: new Date().toLocaleDateString(),
}); });
const getRole = (roleId) => { const getRole = (roleId) => {
if (!empRoles) return "Unassigned"; if (!empRoles) return "Unassigned";
if (!roleId) return "Unassigned"; if (!roleId) return "Unassigned";
@ -68,24 +67,24 @@ const AttendancePage = () => {
} }
}; };
const handleSubmit = ( formData ) => const handleSubmit = ( formData ) =>
{ {
debugger dispatch(markCurrentAttendance(formData))
dispatch( markCurrentAttendance( formData ) ).then( ( action ) => .then((action) => {
{ const updatedAttendance = attendances.map((item) =>
const updatedAttendance = attendances.map(item =>
item.employeeId === action.payload.employeeId item.employeeId === action.payload.employeeId
? { ...item, ...action.payload } ? { ...item, ...action.payload }
: item : item
); );
cacheData("Attendance", { data: updatedAttendance, projectId: selectedProject }) cacheData("Attendance", {
setAttendances(updatedAttendance) data: updatedAttendance,
showToast("Attedance Marked Successfully","success") projectId: selectedProject,
});
setAttendances(updatedAttendance);
showToast("Attedance Marked Successfully", "success");
}) })
.catch( ( error ) => .catch((error) => {
{ showToast(error.message, "error");
showToast(error.message,"error")
}); });
}; };
@ -128,59 +127,69 @@ const AttendancePage = () => {
{ label: "Attendance", link: null }, { label: "Attendance", link: null },
]} ]}
></Breadcrumb> ></Breadcrumb>
<div class="nav-align-top nav-tabs-shadow"> <div className="nav-align-top nav-tabs-shadow">
<ul class="nav nav-tabs" role="tablist"> <ul className="nav nav-tabs" role="tablist">
<div <div
className="dataTables_length text-start py-2 px-2" className="dataTables_length text-start py-2 px-2"
id="DataTables_Table_0_length" id="DataTables_Table_0_length"
> >
{ {loginUser && loginUser?.projects.length > 1 && (
((loginUser && loginUser?.projects?.length > 1) ) && (<label> <label>
<select <select
name="DataTables_Table_0_length" name="DataTables_Table_0_length"
aria-controls="DataTables_Table_0" aria-controls="DataTables_Table_0"
className="form-select form-select-sm" className="form-select form-select-sm"
value={selectedProject} value={selectedProject}
onChange={(e)=>dispatch(setProjectId(e.target.value))} onChange={(e) => dispatch(setProjectId(e.target.value))}
aria-label="" aria-label=""
> >
{!projectLoading && projects?.filter(project => {!projectLoading &&
loginUser?.projects?.map(Number).includes(project.id)).map((project)=>( projects
?.filter((project) =>
loginUser?.projects?.map(Number).includes(project.id)
)
.map((project) => (
<option value={project.id}>{project.name}</option> <option value={project.id}>{project.name}</option>
))} ))}
{projectLoading && <option value="Loading..." disabled>Loading...</option> } {projectLoading && (
<option value="Loading..." disabled>
Loading...
</option>
)}
</select> </select>
</label>) </label>
} )}
</div> </div>
</ul> </ul>
<ul class="nav nav-tabs" role="tablist"> <ul className="nav nav-tabs" role="tablist">
<li class="nav-item"> <li className="nav-item">
<button <button
type="button" type="button"
class="nav-link active" className="nav-link active"
role="tab" role="tab"
data-bs-toggle="tab" data-bs-toggle="tab"
data-bs-target="#navs-top-home" data-bs-target="#navs-top-home"
aria-controls="navs-top-home" aria-controls="navs-top-home"
aria-selected="true"> aria-selected="true"
>
All All
</button> </button>
</li> </li>
<li class="nav-item"> <li className="nav-item">
<button <button
type="button" type="button"
class="nav-link" className="nav-link"
role="tab" role="tab"
data-bs-toggle="tab" data-bs-toggle="tab"
data-bs-target="#navs-top-profile" data-bs-target="#navs-top-profile"
aria-controls="navs-top-profile" aria-controls="navs-top-profile"
aria-selected="false"> aria-selected="false"
>
Logs Logs
</button> </button>
</li> </li>
<li className={`nav-item ${!DoRegularized && 'd-none'}`}> <li className={`nav-item ${!DoRegularized && "d-none"}`}>
<button <button
type="button" type="button"
className="nav-link " className="nav-link "

View File

@ -4,7 +4,9 @@ import {clearCacheKey} from '../apiDataManager';
export const markCurrentAttendance = createAsyncThunk( export const markCurrentAttendance = createAsyncThunk(
'attendanceCurrentDate/markAttendance', 'attendanceCurrentDate/markAttendance',
async (formData, { getState, dispatch, rejectWithValue }) => { async ( formData, {getState, dispatch, rejectWithValue} ) =>
{
const { projectId } = getState().localVariables const { projectId } = getState().localVariables
try try
{ {