fixed attendance logs, attendanance rolename and removed import-userProfile.
This commit is contained in:
parent
e8aa2ae718
commit
faf68cac25
@ -29,7 +29,7 @@ const AttendLogs = ({ Id }) => {
|
|||||||
<tbody>
|
<tbody>
|
||||||
{logs
|
{logs
|
||||||
.slice()
|
.slice()
|
||||||
.sort((a, b) => new Date(b.activityTime) - new Date(a.activityTime))
|
.sort((a, b) => b.id - a.id)
|
||||||
.map((log, index) => (
|
.map((log, index) => (
|
||||||
<tr key={index}>
|
<tr key={index}>
|
||||||
<td>{convertShortTime(log.activityTime)}</td>
|
<td>{convertShortTime(log.activityTime)}</td>
|
||||||
|
@ -67,7 +67,7 @@ const Regularization = ( { handleRequest} ) =>
|
|||||||
</tr>
|
</tr>
|
||||||
))
|
))
|
||||||
):(
|
):(
|
||||||
<td colSpan={5}>No Result Found</td>
|
<td colSpan={5}>No Record Found</td>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useProfile } from "../../hooks/useProfile";
|
|
||||||
|
|
||||||
const Dashboard = () => {
|
const Dashboard = () => {
|
||||||
|
|
||||||
|
@ -3,6 +3,9 @@ import { useForm } from "react-hook-form";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import ProjectRepository from "../../../repositories/ProjectRepository";
|
import ProjectRepository from "../../../repositories/ProjectRepository";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import { useProjectDetails } from "../../../hooks/useProjects";
|
||||||
|
import {getCachedData} from "../../../slices/apiDataManager";
|
||||||
|
|
||||||
// Zod validation schema
|
// Zod validation schema
|
||||||
const buildingSchema = z.object({
|
const buildingSchema = z.object({
|
||||||
@ -22,6 +25,11 @@ const BuildingModel = ({
|
|||||||
onClearComplete,
|
onClearComplete,
|
||||||
editingBuilding = null,
|
editingBuilding = null,
|
||||||
}) => {
|
}) => {
|
||||||
|
const selectedProject = useSelector(
|
||||||
|
(store) => store.localVariables.projectId
|
||||||
|
);
|
||||||
|
const [buildings ,setBuildings] = useState([])
|
||||||
|
const projects_Details = getCachedData("projectInfo")
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
id: "",
|
id: "",
|
||||||
name: "",
|
name: "",
|
||||||
@ -29,7 +37,6 @@ const BuildingModel = ({
|
|||||||
projectId: project.id,
|
projectId: project.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Reset form data if clearTrigger is true, or if editing a building
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (clearTrigger) {
|
if (clearTrigger) {
|
||||||
setFormData({ id: "", name: "", description: "", projectId: project.id });
|
setFormData({ id: "", name: "", description: "", projectId: project.id });
|
||||||
@ -38,39 +45,50 @@ const BuildingModel = ({
|
|||||||
setFormData({ ...editingBuilding, projectId: project.id });
|
setFormData({ ...editingBuilding, projectId: project.id });
|
||||||
}
|
}
|
||||||
|
|
||||||
return () =>
|
return () => {
|
||||||
{
|
setValue("name", null);
|
||||||
setValue("name",null)
|
};
|
||||||
}
|
|
||||||
}, [clearTrigger, onClearComplete, editingBuilding, project.id]);
|
}, [clearTrigger, onClearComplete, editingBuilding, project.id]);
|
||||||
|
|
||||||
const { register, handleSubmit, formState: { errors }, setValue,reset,getValues} = useForm({
|
const {
|
||||||
|
register,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { errors },
|
||||||
|
setValue,
|
||||||
|
reset,
|
||||||
|
getValues,
|
||||||
|
} = useForm({
|
||||||
resolver: zodResolver(buildingSchema),
|
resolver: zodResolver(buildingSchema),
|
||||||
defaultValues: formData, // Set default values from formData state
|
defaultValues: formData, // Set default values from formData state
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleBuildingChange = (e) => {
|
const handleBuildingChange = (e) => {
|
||||||
const selectedBuilding = project.buildings.find(b => b.id === +e.target.value);
|
const selectedBuilding = project.buildings.find(
|
||||||
|
(b) => b.id === +e.target.value
|
||||||
|
);
|
||||||
if (selectedBuilding) {
|
if (selectedBuilding) {
|
||||||
setFormData({ ...selectedBuilding, projectId: project.id });
|
setFormData({ ...selectedBuilding, projectId: project.id });
|
||||||
setValue("name", selectedBuilding.name); // Update name field
|
setValue("name", selectedBuilding.name); // Update name field
|
||||||
setValue("description", selectedBuilding.description); // Update description field
|
setValue("description", selectedBuilding.description); // Update description field
|
||||||
} else {
|
} else {
|
||||||
setFormData({ id: "", name: "", description: "", projectId: project.id });
|
setFormData({ id: "", name: "", description: "", projectId: project.id });
|
||||||
setValue("name", "");
|
setValue("name", "");
|
||||||
setValue("description", "");
|
setValue("description", "");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmitHandler = async( data ) =>
|
const onSubmitHandler = async (data) => {
|
||||||
{
|
onSubmit({ ...data, projectId: project.id });
|
||||||
onSubmit( {...data, projectId: project.id} );
|
reset({
|
||||||
reset( {
|
|
||||||
name: null,
|
name: null,
|
||||||
description:null
|
description: null,
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect( () =>
|
||||||
|
{
|
||||||
|
setBuildings(projects_Details.data?.buildings)
|
||||||
|
},[projects_Details])
|
||||||
return (
|
return (
|
||||||
<div className="modal-dialog modal-lg modal-simple modal-edit-user">
|
<div className="modal-dialog modal-lg modal-simple modal-edit-user">
|
||||||
<div className="modal-content">
|
<div className="modal-content">
|
||||||
@ -81,23 +99,34 @@ const BuildingModel = ({
|
|||||||
data-bs-dismiss="modal"
|
data-bs-dismiss="modal"
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
|
|
||||||
></button>
|
></button>
|
||||||
<h5 className="text-center mb-2">Manage Buildings - {project.name}</h5>
|
<h5 className="text-center mb-2">
|
||||||
|
Manage Buildings - {project.name}
|
||||||
|
</h5>
|
||||||
<form onSubmit={handleSubmit(onSubmitHandler)} className="row g-2">
|
<form onSubmit={handleSubmit(onSubmitHandler)} className="row g-2">
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<label className="form-label">Select Building</label>
|
<label className="form-label">Select Building</label>
|
||||||
<select
|
<select
|
||||||
{...register("Id")}
|
{...register("Id")}
|
||||||
className="select2 form-select form-select-sm"
|
className="select2 form-select form-select-sm"
|
||||||
onChange={(e) => { handleBuildingChange(e); }}
|
onChange={(e) => {
|
||||||
|
handleBuildingChange(e);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<option value="0">Add New Building</option>
|
|
||||||
{project.buildings.map((building) => (
|
<option value="0">Add New Building</option>
|
||||||
<option key={building.id} value={building.id}>{building.name}</option>
|
|
||||||
))}
|
{buildings &&
|
||||||
|
buildings?.length > 0 &&
|
||||||
|
buildings.map((building) => (
|
||||||
|
<option key={building.id} value={building.id}>
|
||||||
|
{building.name}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
</select>
|
</select>
|
||||||
{errors.Id && <span className="danger-text">{errors.Id.message}</span>}
|
{errors.Id && (
|
||||||
|
<span className="danger-text">{errors.Id.message}</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
@ -109,7 +138,9 @@ const BuildingModel = ({
|
|||||||
type="text"
|
type="text"
|
||||||
className="form-control form-control-sm"
|
className="form-control form-control-sm"
|
||||||
/>
|
/>
|
||||||
{errors.name && <span className="danger-text">{errors.name.message}</span>}
|
{errors.name && (
|
||||||
|
<span className="danger-text">{errors.name.message}</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
@ -120,14 +151,26 @@ const BuildingModel = ({
|
|||||||
rows="5"
|
rows="5"
|
||||||
className="form-control form-control-sm"
|
className="form-control form-control-sm"
|
||||||
/>
|
/>
|
||||||
{errors.description && <span className="danger-text">{errors.description.message}</span>}
|
{errors.description && (
|
||||||
|
<span className="danger-text">
|
||||||
|
{errors.description.message}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-12 text-center">
|
<div className="col-12 text-center">
|
||||||
<button type="submit" className="btn btn-sm btn-primary me-3">
|
<button type="submit" className="btn btn-sm btn-primary me-3">
|
||||||
{ ( formData.id && getValues("name")) ? "Edit Building" : "Add Building"}
|
{formData.id && getValues("name")
|
||||||
|
? "Edit Building"
|
||||||
|
: "Add Building"}
|
||||||
</button>
|
</button>
|
||||||
<button type="reset" className="btn btn-sm btn-label-secondary" data-bs-dismiss="modal" aria-label="Close" onClick={onClose}>
|
<button
|
||||||
|
type="reset"
|
||||||
|
className="btn btn-sm btn-label-secondary"
|
||||||
|
data-bs-dismiss="modal"
|
||||||
|
aria-label="Close"
|
||||||
|
onClick={onClose}
|
||||||
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,6 +2,7 @@ import React, { useState, useEffect } from "react";
|
|||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
|
import {getCachedData} from "../../../slices/apiDataManager";
|
||||||
|
|
||||||
// Zod validation schema
|
// Zod validation schema
|
||||||
const floorSchema = z.object({
|
const floorSchema = z.object({
|
||||||
@ -23,7 +24,10 @@ const FloorModel = ({
|
|||||||
onSubmit,
|
onSubmit,
|
||||||
clearTrigger,
|
clearTrigger,
|
||||||
onClearComplete,
|
onClearComplete,
|
||||||
}) => {
|
} ) =>
|
||||||
|
{
|
||||||
|
const [ buildings, setBuildings ] = useState( [] )
|
||||||
|
const projects_Details = getCachedData( "projectInfo" )
|
||||||
const [formData, setFormData] = useState(defaultModel);
|
const [formData, setFormData] = useState(defaultModel);
|
||||||
const [selectedBuilding, setSelectedBuilding] = useState({});
|
const [selectedBuilding, setSelectedBuilding] = useState({});
|
||||||
|
|
||||||
@ -32,6 +36,7 @@ const FloorModel = ({
|
|||||||
register,
|
register,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
setValue,
|
setValue,
|
||||||
|
getValues,
|
||||||
reset,
|
reset,
|
||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = useForm({
|
} = useForm({
|
||||||
@ -39,17 +44,19 @@ const FloorModel = ({
|
|||||||
defaultValues: defaultModel,
|
defaultValues: defaultModel,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect( () =>
|
||||||
|
{
|
||||||
|
|
||||||
if (clearTrigger) {
|
if (clearTrigger) {
|
||||||
reset(defaultModel);
|
reset(defaultModel);
|
||||||
onClearComplete();
|
onClearComplete();
|
||||||
}
|
}
|
||||||
}, [clearTrigger, onClearComplete, reset]);
|
}, [clearTrigger, onClearComplete, reset,]);
|
||||||
|
|
||||||
// Handle building selection change
|
// Handle building selection change
|
||||||
const handleBuildigChange = (e) => {
|
const handleBuildigChange = (e) => {
|
||||||
const buildingId = e.target.value;
|
const buildingId = e.target.value;
|
||||||
const building = project.buildings.find((b) => b.id === Number(buildingId));
|
const building = buildings.find((b) => b.id === Number(buildingId));
|
||||||
if (building) {
|
if (building) {
|
||||||
setSelectedBuilding(building);
|
setSelectedBuilding(building);
|
||||||
setFormData({
|
setFormData({
|
||||||
@ -71,11 +78,13 @@ const FloorModel = ({
|
|||||||
setValue("buildingId", "0");
|
setValue("buildingId", "0");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Handle floor selection change
|
// Handle floor selection change
|
||||||
const handleFloorChange = (e) => {
|
const handleFloorChange = (e) => {
|
||||||
const id = e.target.value;
|
const id = e.target.value;
|
||||||
const floor = selectedBuilding.floors.find((b) => b.id === Number(id));
|
const floor = buildings[getValues("buildingId")].floors.find((b) => b.id === Number(id));
|
||||||
if (floor) {
|
if (floor) {
|
||||||
setFormData({
|
setFormData({
|
||||||
id: floor.id,
|
id: floor.id,
|
||||||
@ -99,7 +108,13 @@ const FloorModel = ({
|
|||||||
const onFormSubmit = (data) => {
|
const onFormSubmit = (data) => {
|
||||||
onSubmit(data);
|
onSubmit(data);
|
||||||
};
|
};
|
||||||
|
useEffect( () =>
|
||||||
|
{
|
||||||
|
setBuildings(projects_Details.data?.buildings)
|
||||||
|
}, [ projects_Details ] )
|
||||||
|
console.log(getValues("buildingId"))
|
||||||
|
console.log(buildings)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="modal-dialog modal-lg modal-simple modal-edit-user">
|
<div className="modal-dialog modal-lg modal-simple modal-edit-user">
|
||||||
<div className="modal-content">
|
<div className="modal-content">
|
||||||
@ -125,7 +140,9 @@ const FloorModel = ({
|
|||||||
onChange={handleBuildigChange}
|
onChange={handleBuildigChange}
|
||||||
>
|
>
|
||||||
<option value="0">Select Building</option>
|
<option value="0">Select Building</option>
|
||||||
{project.buildings.map((building) => (
|
{buildings &&
|
||||||
|
buildings?.length > 0 &&
|
||||||
|
buildings.map((building) => (
|
||||||
<option key={building.id} value={building.id}>
|
<option key={building.id} value={building.id}>
|
||||||
{building.name}
|
{building.name}
|
||||||
</option>
|
</option>
|
||||||
@ -149,11 +166,19 @@ const FloorModel = ({
|
|||||||
onChange={handleFloorChange}
|
onChange={handleFloorChange}
|
||||||
>
|
>
|
||||||
<option value="0">Add New Floor</option>
|
<option value="0">Add New Floor</option>
|
||||||
{selectedBuilding?.floors?.map((floor) => (
|
{/* {selectedBuilding?.floors?.map((floor) => (
|
||||||
<option key={floor.id} value={floor.id}>
|
<option key={floor.id} value={floor.id}>
|
||||||
{floor.floorName}
|
{floor.floorName}
|
||||||
</option>
|
</option>
|
||||||
))}
|
) )} */}
|
||||||
|
|
||||||
|
{buildings &&
|
||||||
|
buildings[getValues("buildingId")]?.length > 0 &&
|
||||||
|
buildings[getValues("buildingId")]?.map((floor) => (
|
||||||
|
<option key={floor.id} value={floor.id}>
|
||||||
|
{floor.floorName}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
</select>
|
</select>
|
||||||
{errors.id && (
|
{errors.id && (
|
||||||
<p className="text-danger">{errors.id.message}</p>
|
<p className="text-danger">{errors.id.message}</p>
|
||||||
@ -186,11 +211,11 @@ const FloorModel = ({
|
|||||||
: "Add Floor"}
|
: "Add Floor"}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="reset"
|
type="button"
|
||||||
className="btn btn-sm btn-label-secondary"
|
className="btn btn-sm btn-label-secondary"
|
||||||
data-bs-dismiss="modal"
|
data-bs-dismiss="modal"
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
onClick={onclose}
|
onClick={onClose}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
|
@ -30,7 +30,10 @@ export const useAttendace =(projectId)=>{
|
|||||||
|
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
fetchData(projectId);
|
if ( projectId )
|
||||||
|
{
|
||||||
|
fetchData(projectId);
|
||||||
|
}
|
||||||
},[projectId])
|
},[projectId])
|
||||||
|
|
||||||
return {attendance,loading,error}
|
return {attendance,loading,error}
|
||||||
@ -40,7 +43,7 @@ export const useAttendace =(projectId)=>{
|
|||||||
|
|
||||||
|
|
||||||
export const useEmployeeAttendacesLog = (id) => {
|
export const useEmployeeAttendacesLog = (id) => {
|
||||||
const [logs, setLogs] = useState();
|
const [logs, setLogs] = useState([]);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
|
|
||||||
|
@ -100,6 +100,8 @@ const AttendancePage = () => {
|
|||||||
dispatch(setProjectId(projects[0]?.id));
|
dispatch(setProjectId(projects[0]?.id));
|
||||||
}, [projects]);
|
}, [projects]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isCreateModalOpen && modelConfig && (
|
{isCreateModalOpen && modelConfig && (
|
||||||
|
@ -14,15 +14,16 @@ import Breadcrumb from "../../components/common/Breadcrumb";
|
|||||||
import { cacheData, getCachedData } from "../../slices/apiDataManager";
|
import { cacheData, getCachedData } from "../../slices/apiDataManager";
|
||||||
import ProjectRepository from "../../repositories/ProjectRepository";
|
import ProjectRepository from "../../repositories/ProjectRepository";
|
||||||
import { ActivityeRepository } from "../../repositories/MastersRepository";
|
import { ActivityeRepository } from "../../repositories/MastersRepository";
|
||||||
|
|
||||||
import "./ProjectDetails.css";
|
import "./ProjectDetails.css";
|
||||||
import {useEmployeesByProjectAllocated, useProjectDetails} from "../../hooks/useProjects";
|
import {useEmployeesByProjectAllocated, useProjectDetails} from "../../hooks/useProjects";
|
||||||
|
import {useDispatch} from "react-redux";
|
||||||
|
import {setProjectId} from "../../slices/localVariablesSlice";
|
||||||
|
|
||||||
|
|
||||||
const ProjectDetails = () => {
|
const ProjectDetails = () => {
|
||||||
let {projectId} = useParams();
|
let {projectId} = useParams();
|
||||||
const {projects_Details,loading:projectLoading,error:ProjectError} = useProjectDetails(projectId)
|
const {projects_Details,loading:projectLoading,error:ProjectError} = useProjectDetails(projectId)
|
||||||
|
const dispatch = useDispatch()
|
||||||
const [project, setProject] = useState(null);
|
const [project, setProject] = useState(null);
|
||||||
const [ projectDetails, setProjectDetails ] = useState( null );
|
const [ projectDetails, setProjectDetails ] = useState( null );
|
||||||
const [activities, setActivities] = useState(null);
|
const [activities, setActivities] = useState(null);
|
||||||
@ -169,10 +170,11 @@ const ProjectDetails = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// fetchData();
|
// fetchData();
|
||||||
|
dispatch(setProjectId(projectId))
|
||||||
setProject( projects_Details )
|
setProject( projects_Details )
|
||||||
setProjectDetails(projects_Details)
|
setProjectDetails(projects_Details)
|
||||||
fetchActivities();
|
fetchActivities();
|
||||||
}, [projects_Details]);
|
}, [projects_Details,projectId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
|
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
|
||||||
import AttendanceRepository from '../../repositories/AttendanceRepository';
|
import AttendanceRepository from '../../repositories/AttendanceRepository';
|
||||||
|
import {clearCacheKey} from '../apiDataManager';
|
||||||
|
|
||||||
// Fetch attendance data
|
// Fetch attendance data
|
||||||
export const fetchAttendanceData = createAsyncThunk(
|
export const fetchAttendanceData = createAsyncThunk(
|
||||||
@ -19,7 +20,7 @@ export const markAttendance = createAsyncThunk(
|
|||||||
'attendanceLogs/markAttendance', // Updated action type prefix
|
'attendanceLogs/markAttendance', // Updated action type prefix
|
||||||
async ( formData, thunkAPI ) =>
|
async ( formData, thunkAPI ) =>
|
||||||
{
|
{
|
||||||
debugger
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let newRecordAttendance = {
|
let newRecordAttendance = {
|
||||||
@ -35,7 +36,8 @@ export const markAttendance = createAsyncThunk(
|
|||||||
image: null,
|
image: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await AttendanceRepository.markAttendance(newRecordAttendance);
|
const response = await AttendanceRepository.markAttendance( newRecordAttendance );
|
||||||
|
clearCacheKey("AttendanceLogs")
|
||||||
return response.data; // Return the newly created or updated record
|
return response.data; // Return the newly created or updated record
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return thunkAPI.rejectWithValue(error.message);
|
return thunkAPI.rejectWithValue(error.message);
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
|
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
|
||||||
import AttendanceRepository from '../../repositories/AttendanceRepository';
|
import AttendanceRepository from '../../repositories/AttendanceRepository';
|
||||||
|
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} ) =>
|
||||||
{
|
{
|
||||||
debugger
|
|
||||||
const { projectId } = getState().localVariables
|
const { projectId } = getState().localVariables
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
console.log(formData)
|
|
||||||
// Create the new attendance record
|
// Create the new attendance record
|
||||||
const newRecordAttendance = {
|
const newRecordAttendance = {
|
||||||
Id: formData.id || null,
|
Id: formData.id || null,
|
||||||
@ -26,6 +27,7 @@ export const markCurrentAttendance = createAsyncThunk(
|
|||||||
|
|
||||||
const response = await AttendanceRepository.markAttendance(newRecordAttendance);
|
const response = await AttendanceRepository.markAttendance(newRecordAttendance);
|
||||||
const markedAttendance = response.data
|
const markedAttendance = response.data
|
||||||
|
clearCacheKey("AttendanceLogs")
|
||||||
return markedAttendance;
|
return markedAttendance;
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -3,6 +3,7 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import axiosRetry from "axios-retry";
|
import axiosRetry from "axios-retry";
|
||||||
import showToast from "../services/toastService";
|
import showToast from "../services/toastService";
|
||||||
const base_Url = process.env.VITE_BASE_URL;
|
const base_Url = process.env.VITE_BASE_URL;
|
||||||
|
// const base_Url = https://api.marcoaiot.com;
|
||||||
export const axiosClient = axios.create({
|
export const axiosClient = axios.create({
|
||||||
baseURL: base_Url, // Your Web API URL
|
baseURL: base_Url, // Your Web API URL
|
||||||
withCredentials: false, // Required if the API uses cookies
|
withCredentials: false, // Required if the API uses cookies
|
||||||
|
Loading…
x
Reference in New Issue
Block a user