Conver Int to Guid
This commit is contained in:
parent
02f37be504
commit
1bbc8fd422
@ -48,7 +48,7 @@ const InfraPlanning = () =>
|
||||
{(project_listLoader || projects.length < 0) && <option value="Loading..." disabled>Loading...</option> }
|
||||
|
||||
{!project_listLoader && projects?.filter(project =>
|
||||
LoggedUser?.projects?.map(Number).includes(project.id)).map((project)=>(
|
||||
LoggedUser?.projects?.map(String).includes(project.id)).map((project)=>(
|
||||
<option key={project.id} value={project.id}>{project.name}</option>
|
||||
))}
|
||||
</select>
|
||||
|
@ -37,7 +37,7 @@ export const ReportTask = ({ report, closeModal, refetch }) => {
|
||||
checkList:[]
|
||||
};
|
||||
|
||||
let response = await TasksRepository.reportTsak(reportData);
|
||||
let response = await TasksRepository.reportTask(reportData);
|
||||
showToast("succesfully", "success");
|
||||
refetch();
|
||||
closeModal();
|
||||
@ -64,76 +64,76 @@ export const ReportTask = ({ report, closeModal, refetch }) => {
|
||||
></button>
|
||||
|
||||
<div className="container m-0">
|
||||
<div class="mb-1 row text-start">
|
||||
<label for="html5-text-input" class="col-md-4 col-form-label">
|
||||
<div className="mb-1 row text-start">
|
||||
<label htmlFor="html5-text-input" className="col-md-4 col-form-label">
|
||||
Assigned Date :{" "}
|
||||
</label>
|
||||
<div class="col-md-8 text-start">
|
||||
<label class="col-md-2 col-form-label">
|
||||
<div className="col-md-8 text-start">
|
||||
<label className="col-md-2 col-form-label">
|
||||
{formatDate(report?.assignmentDate)}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-1 row text-start">
|
||||
<label for="html5-search-input" class="col-md-4 col-form-label">
|
||||
<div className="mb-1 row text-start">
|
||||
<label htmlFor="html5-search-input" className="col-md-4 col-form-label">
|
||||
Assigned By :{" "}
|
||||
</label>
|
||||
<div class="col-md-8 text-start">
|
||||
<label class=" col-form-label">{` ${report?.assignedBy.firstName} ${report?.assignedBy.lastName}`}</label>
|
||||
<div className="col-md-8 text-start">
|
||||
<label className=" col-form-label">{` ${report?.assignedBy.firstName} ${report?.assignedBy.lastName}`}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-1 row text-start">
|
||||
<label for="html5-email-input" class="col-md-4 col-form-label">
|
||||
<div className="mb-1 row text-start">
|
||||
<label htmlFor="html5-email-input" className="col-md-4 col-form-label">
|
||||
Wrok Area :
|
||||
</label>
|
||||
<div class="col-md-8 text-start text-wrap">
|
||||
<label class=" col-form-label">
|
||||
<div className="col-md-8 text-start text-wrap">
|
||||
<label className=" col-form-label">
|
||||
{" "}
|
||||
{report?.workItem?.workArea?.floor?.building?.name}{" "}
|
||||
<i class="bx bx-chevron-right"></i>{" "}
|
||||
<i className="bx bx-chevron-right"></i>{" "}
|
||||
{report?.workItem?.workArea?.floor?.floorName}{" "}
|
||||
<i class="bx bx-chevron-right"> </i>
|
||||
<i className="bx bx-chevron-right"> </i>
|
||||
{report?.workItem?.workArea?.areaName}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-1 row text-start">
|
||||
<label for="html5-email-input" class="col-md-4 col-form-label">
|
||||
<div className="mb-1 row text-start">
|
||||
<label htmlFor="html5-email-input" className="col-md-4 col-form-label">
|
||||
Activity :
|
||||
</label>
|
||||
<div class="col-md-8 text-start text-wrap">
|
||||
<label class=" col-form-label">
|
||||
<div className="col-md-8 text-start text-wrap">
|
||||
<label className=" col-form-label">
|
||||
{report?.workItem?.activityMaster.activityName}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-1 row text-start">
|
||||
<label for="html5-email-input" class="col-md-4 col-form-label">
|
||||
<div className="mb-1 row text-start">
|
||||
<label htmlFor="html5-email-input" className="col-md-4 col-form-label">
|
||||
Team Size :
|
||||
</label>
|
||||
<div class="col-md-8 text-start text-wrap">
|
||||
<label class=" col-form-label">
|
||||
<div className="col-md-8 text-start text-wrap">
|
||||
<label className=" col-form-label">
|
||||
{report?.teamMembers?.length}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-1 row text-start">
|
||||
<label for="html5-email-input" class="col-md-4 col-form-label">
|
||||
<div className="mb-1 row text-start">
|
||||
<label htmlFor="html5-email-input" className="col-md-4 col-form-label">
|
||||
Planned :
|
||||
</label>
|
||||
<div class="col-md-8 text-start text-wrap">
|
||||
<label class=" col-form-label">
|
||||
<div className="col-md-8 text-start text-wrap">
|
||||
<label className=" col-form-label">
|
||||
{report?.plannedTask
|
||||
}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<div class="mb-1 row text-start">
|
||||
<label for="html5-email-input" class="col-md-4 col-form-label">
|
||||
<div className="mb-1 row text-start">
|
||||
<label htmlFor="html5-email-input" className="col-md-4 col-form-label">
|
||||
Completed Work
|
||||
</label>
|
||||
<div class="col-md-8 text-start text-wrap">
|
||||
<div className="col-md-8 text-start text-wrap">
|
||||
<input
|
||||
{...register("completedTask", { valueAsNumber: true })}
|
||||
id="smallInput"
|
||||
@ -148,11 +148,11 @@ export const ReportTask = ({ report, closeModal, refetch }) => {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-1 row text-start">
|
||||
<label for="html5-email-input" class="col-md-4 col-form-label">
|
||||
<div className="mb-1 row text-start">
|
||||
<label htmlFor="html5-email-input" className="col-md-4 col-form-label">
|
||||
Comment
|
||||
</label>
|
||||
<div class="col-md-8 text-start text-wrap">
|
||||
<div className="col-md-8 text-start text-wrap">
|
||||
<textarea
|
||||
{...register("comment")}
|
||||
className="form-control"
|
||||
|
@ -91,11 +91,11 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
|
||||
></button>
|
||||
<p className="fs-6 text-dark text-start">
|
||||
{`${commentsData?.workItem?.workArea?.floor?.building?.name}`}{" "}
|
||||
<i class="bx bx-chevron-right"></i>{" "}
|
||||
<i className="bx bx-chevron-right"></i>{" "}
|
||||
{`${commentsData?.workItem?.workArea?.floor?.floorName} `}{" "}
|
||||
<i class="bx bx-chevron-right"></i>
|
||||
<i className="bx bx-chevron-right"></i>
|
||||
{`${commentsData?.workItem?.workArea?.areaName}`}
|
||||
<i class="bx bx-chevron-right"></i>
|
||||
<i className="bx bx-chevron-right"></i>
|
||||
{` ${commentsData?.workItem?.activityMaster?.activityName}`}
|
||||
</p>
|
||||
|
||||
@ -115,9 +115,9 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
|
||||
<div
|
||||
className={`li-wrapper d-flex justify-content-start align-items-start my-0 `}
|
||||
>
|
||||
<div class="avatar avatar-xs me-1">
|
||||
<div className="avatar avatar-xs me-1">
|
||||
<span
|
||||
class={`avatar-initial rounded-circle bg-label-primary}`}
|
||||
className={`avatar-initial rounded-circle bg-label-primary}`}
|
||||
>
|
||||
{`${data?.employee?.firstName.slice(
|
||||
0,
|
||||
|
@ -47,7 +47,7 @@ const Dashboard = () => {
|
||||
const { dashboard_data, loading: isLineChartLoading } = useDashboard_Data({
|
||||
days,
|
||||
FromDate,
|
||||
projectId: selectedProjectId === "all" ? 0 : selectedProjectId,
|
||||
projectId: selectedProjectId === "all" ? null : selectedProjectId,
|
||||
});
|
||||
|
||||
// Sort dashboard_data by date ascending
|
||||
|
@ -36,7 +36,7 @@ const ManageEmployee = () => {
|
||||
const [permanentAddressLength, setPermanentAddressLength] = useState(0);
|
||||
|
||||
const userSchema = z.object({
|
||||
...(employeeId ? { Id: z.number().optional() } : {}),
|
||||
...(employeeId ? { Id: z.string().optional() } : {}),
|
||||
FirstName: z.string().min(1, { message: "First Name is required" }),
|
||||
MiddleName: z.string().optional(),
|
||||
LastName: z.string().min(1, { message: "Last Name is required" }),
|
||||
@ -132,7 +132,7 @@ const ManageEmployee = () => {
|
||||
} = useForm({
|
||||
resolver: zodResolver(userSchema),
|
||||
defaultValues: {
|
||||
Id: currentEmployee?.id || "",
|
||||
Id: currentEmployee?.id || null,
|
||||
FirstName: currentEmployee?.firstName || "",
|
||||
MiddleName: currentEmployee?.middleName || "",
|
||||
LastName: currentEmployee?.lastName || "",
|
||||
@ -147,7 +147,7 @@ const ManageEmployee = () => {
|
||||
PanNumber: currentEmployee?.panNumber || "",
|
||||
PermanentAddress: currentEmployee?.permanentAddress || "",
|
||||
PhoneNumber: currentEmployee?.phoneNumber || "",
|
||||
JobRoleId: currentEmployee?.jobRoleId || "",
|
||||
JobRoleId: currentEmployee?.jobRoleId.toString() || null,
|
||||
},
|
||||
mode: "onChange",
|
||||
});
|
||||
@ -209,7 +209,7 @@ const ManageEmployee = () => {
|
||||
reset(
|
||||
currentEmployee
|
||||
? {
|
||||
Id: currentEmployee.id || "",
|
||||
Id: currentEmployee.id || null,
|
||||
FirstName: currentEmployee.firstName || "",
|
||||
MiddleName: currentEmployee.middleName || "",
|
||||
LastName: currentEmployee.lastName || "",
|
||||
@ -619,7 +619,7 @@ const ManageEmployee = () => {
|
||||
{employeeId && (
|
||||
<div className="row mb-3 d-none">
|
||||
<div className="col-sm-12">
|
||||
<input type="number" name="id" {...register("Id")} />
|
||||
<input type="text" name="id" {...register("Id")} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
@ -20,7 +20,7 @@ const AssignRoleModel = ({ assignData, onClose }) => {
|
||||
|
||||
const schema = z.object({
|
||||
selectedEmployees: z
|
||||
.array(z.number())
|
||||
.array(z.string())
|
||||
.min(1, { message: "At least one employee must be selected" }),
|
||||
description: z.string().min(1, { message: "Description is required" }),
|
||||
plannedTask: z.preprocess(
|
||||
|
@ -40,7 +40,7 @@ const BuildingModel = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (clearTrigger) {
|
||||
setFormData({ id: "", name: "", description: "", projectId: project.id });
|
||||
setFormData({ id: null, name: "", description: "", projectId: project.id });
|
||||
onClearComplete();
|
||||
} else if (editingBuilding) {
|
||||
setFormData({ ...editingBuilding, projectId: project.id });
|
||||
@ -72,13 +72,16 @@ const BuildingModel = ({
|
||||
setValue("name", selectedBuilding.name); // Update name field
|
||||
setValue("description", selectedBuilding.description); // Update description field
|
||||
} else {
|
||||
setFormData({ id: "", name: "", description: "", projectId: project.id });
|
||||
setFormData({ id: null, name: "", description: "", projectId: project.id });
|
||||
setValue("name", "");
|
||||
setValue("description", "");
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmitHandler = async (data) => {
|
||||
if (String(data.Id) === "0") {
|
||||
data.Id = null;
|
||||
}
|
||||
onSubmit({ ...data, projectId: project.id });
|
||||
reset({
|
||||
Id: "0",
|
||||
|
@ -53,7 +53,7 @@ const FloorModel = ({
|
||||
// Handle building selection change
|
||||
const handleBuildigChange = (e) => {
|
||||
const buildingId = e.target.value;
|
||||
const building = buildings.find((b) => b.id === Number(buildingId));
|
||||
const building = buildings.find((b) => b.id === String(buildingId));
|
||||
if (building) {
|
||||
setSelectedBuilding(building);
|
||||
setFormData({
|
||||
@ -77,7 +77,7 @@ const FloorModel = ({
|
||||
// Handle floor selection change
|
||||
const handleFloorChange = (e) => {
|
||||
const id = e.target.value;
|
||||
const floor = selectedBuilding.floors.find((b) => b.id === Number(id));
|
||||
const floor = selectedBuilding.floors.find((b) => b.id === String(id));
|
||||
if (floor) {
|
||||
setFormData({
|
||||
id: floor.id,
|
||||
@ -97,6 +97,9 @@ const FloorModel = ({
|
||||
|
||||
// Handle form submission
|
||||
const onFormSubmit = (data) => {
|
||||
if(data.id == "0"){
|
||||
data.id = null;
|
||||
}
|
||||
onSubmit(data);
|
||||
reset({
|
||||
floorName: "",
|
||||
|
@ -9,18 +9,18 @@ import useMaster from "../../../hooks/masterHook/useMaster";
|
||||
const taskSchema = z.object({
|
||||
buildingID: z.string().min(1, "Building is required"),
|
||||
floorId: z.string().min(1, "Floor is required"),
|
||||
workAreaId: z.number().min(1, "Work Area is required"),
|
||||
activityID: z.number().min(1, "Activity is required"),
|
||||
workAreaId: z.string().min(1, "Work Area is required"),
|
||||
activityID: z.string().min(1, "Activity is required"),
|
||||
plannedWork: z.number().min(1, "Planned Work must be greater than 0"),
|
||||
completedWork: z.number().optional(),
|
||||
});
|
||||
|
||||
const defaultModel = {
|
||||
id: "0",
|
||||
buildingID: "0",
|
||||
floorId: "0",
|
||||
workAreaId: 0,
|
||||
activityID: 0,
|
||||
id: null,
|
||||
buildingID: null,
|
||||
floorId: null,
|
||||
workAreaId: null,
|
||||
activityID: null,
|
||||
plannedWork: 0,
|
||||
completedWork: 0,
|
||||
};
|
||||
@ -60,7 +60,7 @@ const TaskModel = ({
|
||||
|
||||
const handleBuildingChange = (e) => {
|
||||
const { value } = e.target;
|
||||
const building = project.buildings.find((b) => b.id === Number(value));
|
||||
const building = project.buildings.find((b) => b.id === String(value));
|
||||
setSelectedBuilding(building);
|
||||
setSelectedFloor(null);
|
||||
setSelectedWorkArea(null);
|
||||
@ -73,7 +73,7 @@ const TaskModel = ({
|
||||
|
||||
const handleFloorChange = (e) => {
|
||||
const { value } = e.target;
|
||||
const floor = selectedBuilding.floors.find((b) => b.id === Number(value));
|
||||
const floor = selectedBuilding.floors.find((b) => b.id === String(value));
|
||||
setSelectedFloor(floor);
|
||||
setSelectedWorkArea(null);
|
||||
setSelectedActivity(null);
|
||||
@ -88,22 +88,22 @@ const TaskModel = ({
|
||||
const handleWorkAreaChange = (e) => {
|
||||
const { value } = e.target;
|
||||
const workArea = selectedFloor.workAreas.find(
|
||||
(b) => b.id === Number(value)
|
||||
(b) => b.id === String(value)
|
||||
);
|
||||
setSelectedWorkArea(workArea);
|
||||
reset((prev) => ({
|
||||
...prev,
|
||||
workAreaId: Number(value),
|
||||
workAreaId: String(value),
|
||||
}));
|
||||
};
|
||||
|
||||
const handleActivityChange = (e) => {
|
||||
const { value } = e.target;
|
||||
const activity = activityData.find((b) => b.id === Number(value));
|
||||
const activity = activityData.find((b) => b.id === String(value));
|
||||
setSelectedActivity(activity);
|
||||
reset((prev) => ({
|
||||
...prev,
|
||||
activityID: Number(value),
|
||||
activityID: String(value),
|
||||
}));
|
||||
};
|
||||
|
||||
@ -220,7 +220,7 @@ const TaskModel = ({
|
||||
<select
|
||||
id="workAreaId"
|
||||
className="form-select form-select-sm"
|
||||
{...register("workAreaId", { valueAsNumber: true })}
|
||||
{...register("workAreaId")}
|
||||
onChange={handleWorkAreaChange}
|
||||
>
|
||||
<option value="0">Select Work Area</option>
|
||||
@ -253,7 +253,7 @@ const TaskModel = ({
|
||||
<select
|
||||
id="activityID"
|
||||
className="form-select form-select-sm"
|
||||
{...register("activityID", { valueAsNumber: true })}
|
||||
{...register("activityID")}
|
||||
onChange={handleActivityChange}
|
||||
>
|
||||
<option value="0">Select Activity</option>
|
||||
|
@ -67,7 +67,7 @@ const WorkAreaModel = ({
|
||||
setWorkArea(String(0));
|
||||
} else {
|
||||
const workArea = selectedFloor?.workAreas.find(
|
||||
(b) => b.id === Number(value)
|
||||
(b) => b.id === String(value)
|
||||
);
|
||||
if (workArea) {
|
||||
setValue("id", String(workArea.id)); // Set id as a string
|
||||
@ -79,7 +79,7 @@ const WorkAreaModel = ({
|
||||
|
||||
const handleFloorChange = (e) => {
|
||||
const { value } = e.target;
|
||||
const floor = selectedBuilding?.floors.find((b) => b.id === Number(value));
|
||||
const floor = selectedBuilding?.floors.find((b) => b.id === String(value));
|
||||
|
||||
if (floor) {
|
||||
setSelectedFloor(floor);
|
||||
@ -96,7 +96,7 @@ const WorkAreaModel = ({
|
||||
|
||||
const handleBuildingChange = (e) => {
|
||||
const { value } = e.target;
|
||||
const building = project?.buildings.find((b) => b.id === Number(value));
|
||||
const building = project?.buildings.find((b) => b.id === String(value));
|
||||
setSelectedBuilding(building);
|
||||
setSelectedFloor(null); // Reset selected floor on building change
|
||||
reset(defaultModel); // Reset the form when a new building is selected
|
||||
@ -104,7 +104,7 @@ const WorkAreaModel = ({
|
||||
|
||||
const onSubmitForm = (data) => {
|
||||
let WorkArea = {
|
||||
id: data.id,
|
||||
id: data.id == "0" ? null : data.id,
|
||||
areaName: data.areaName,
|
||||
floorId: data.floorId,
|
||||
buildingId: data.buildingId,
|
||||
|
@ -24,7 +24,7 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
|
||||
|
||||
const projectSchema = z
|
||||
.object({
|
||||
...(project?.id ? { id: z.number().optional() } : {}),
|
||||
...(project?.id ? { id: z.string().optional() } : {}),
|
||||
name: z.string().min(1, { message: "Project Name is required" }),
|
||||
contactPerson: z
|
||||
.string()
|
||||
@ -44,13 +44,6 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
|
||||
projectStatusId: z
|
||||
.string()
|
||||
.min(1, { message: "Status is required" })
|
||||
.transform((val) => {
|
||||
const num = Number(val);
|
||||
if (isNaN(num)) {
|
||||
throw new Error("Status must be a valid number");
|
||||
}
|
||||
return num;
|
||||
}),
|
||||
})
|
||||
.refine(
|
||||
(data) => {
|
||||
@ -80,7 +73,7 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
|
||||
projectAddress: project?.projectAddress || "",
|
||||
startDate: formatDate(project?.startDate) || currentDate,
|
||||
endDate: formatDate(project?.endDate) || currentDate,
|
||||
projectStatusId: String(project?.projectStatusId || "0"),
|
||||
projectStatusId: String(project?.projectStatusId || "00000000-0000-0000-0000-000000000000"),
|
||||
},
|
||||
mode: "onChange",
|
||||
});
|
||||
@ -96,7 +89,7 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
|
||||
projectAddress: project?.projectAddress || "",
|
||||
startDate: formatDate(project?.startDate) || "",
|
||||
endDate: formatDate(project?.endDate) || "",
|
||||
projectStatusId: String(project.projectStatusId) || "0",
|
||||
projectStatusId: String(project.projectStatusId) || "00000000-0000-0000-0000-000000000000",
|
||||
}
|
||||
: {}
|
||||
);
|
||||
@ -229,13 +222,13 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
|
||||
})}
|
||||
>
|
||||
<option disabled>Status</option>
|
||||
<option value="1">Active</option>
|
||||
<option value="2">On Hold</option>
|
||||
<option value="b74da4c2-d07e-46f2-9919-e75e49b12731">Active</option>
|
||||
<option value="603e994b-a27f-4e5d-a251-f3d69b0498ba">On Hold</option>
|
||||
|
||||
{/* <option value="3">Suspended</option> */}
|
||||
<option value="3">Inactive</option>
|
||||
<option value="ef1c356e-0fe0-42df-a5d3-8daee355492d">Inactive</option>
|
||||
|
||||
<option value="4">Completed</option>
|
||||
<option value="33deaef9-9af1-4f2a-b443-681ea0d04f81">Completed</option>
|
||||
</select>
|
||||
{errors.projectStatusId && (
|
||||
<div
|
||||
|
@ -43,7 +43,7 @@ const ProjectBanner = ( {project_data} ) =>
|
||||
project.id === CurrentProject.id ? {
|
||||
...project,
|
||||
...response.data,
|
||||
tenant:project.tenant
|
||||
// tenant:project.tenant
|
||||
} : project
|
||||
);
|
||||
|
||||
|
@ -64,7 +64,9 @@ const ProjectCard = ({ projectData }) => {
|
||||
if (projects_list) {
|
||||
const updatedProjectsList = projects_list.map((project) =>
|
||||
project.id === projectInfo.id
|
||||
? { ...project, ...response.data, tenant: project.tenant }
|
||||
? { ...project, ...response.data,
|
||||
// tenant: project.tenant
|
||||
}
|
||||
: project
|
||||
);
|
||||
cacheData("projectslist", updatedProjectsList);
|
||||
|
@ -110,7 +110,7 @@ const ProjectInfra = ({
|
||||
};
|
||||
|
||||
const handleTaskModelFormSubmit = (updatedModel) => {
|
||||
if (updatedModel.id == "") updatedModel.id = 0;
|
||||
if (updatedModel.id == "") updatedModel.id = null;
|
||||
const updatedProject = { ...project };
|
||||
|
||||
ProjectRepository.manageProjectTasks([updatedModel])
|
||||
|
@ -16,7 +16,7 @@ const schema = z.object({
|
||||
z.object({
|
||||
description: z.string().min(1, { message: "descriptionlist item cannot be empty" }),
|
||||
isMandatory: z.boolean().default(false),
|
||||
id: z.any().default(0),
|
||||
id: z.any().default(null),
|
||||
})
|
||||
)
|
||||
.optional(),
|
||||
@ -91,7 +91,7 @@ const CreateActivity = ({ onClose }) => {
|
||||
}
|
||||
clearErrors(`checkList.${lastIndex}.description`);
|
||||
append({
|
||||
id: 0,
|
||||
id: null,
|
||||
description: "",
|
||||
isMandatory: false,
|
||||
});
|
||||
|
@ -13,7 +13,7 @@ const schema = z.object({
|
||||
checkList: z
|
||||
.array(
|
||||
z.object({
|
||||
id: z.any().default(0),
|
||||
id: z.any().default(null),
|
||||
description: z.string().min(1, { message: "Checklist item cannot be empty" }),
|
||||
isMandatory: z.boolean().default(false),
|
||||
})
|
||||
@ -115,7 +115,7 @@ const UpdateActivity = ({ activityData, onClose }) => {
|
||||
}
|
||||
|
||||
clearErrors(`checkList.${lastIndex}.description`);
|
||||
append({ id: 0, description: "", isMandatory: false });
|
||||
append({ id: null, description: "", isMandatory: false });
|
||||
};
|
||||
|
||||
const removeChecklistItem = (index) => {
|
||||
|
@ -18,7 +18,7 @@ export const useDashboard_Data = ({ days, FromDate, projectId }) => {
|
||||
const payload = {
|
||||
days,
|
||||
FromDate: FromDate || '',
|
||||
projectId: projectId || 0,
|
||||
projectId: projectId || null,
|
||||
};
|
||||
|
||||
const response = await GlobalRepository.getDashboardProgressionData(payload);
|
||||
|
@ -139,7 +139,7 @@ const AttendancePage = () => {
|
||||
{!projectLoading &&
|
||||
projects
|
||||
?.filter((project) =>
|
||||
loginUser?.projects?.map(Number).includes(project.id)
|
||||
loginUser?.projects?.map(String).includes(project.id)
|
||||
)
|
||||
.map((project) => (
|
||||
<option value={project.id} key={project.id}>
|
||||
|
@ -36,7 +36,7 @@ const DailyTask = () => {
|
||||
useEffect(() => {
|
||||
if (!project_lodaing && projects.length > 0 && !initialized) {
|
||||
const userProjects = projects.filter((p) =>
|
||||
LoggedUser?.projects?.map(Number).includes(p.id)
|
||||
LoggedUser?.projects?.map(String).includes(p.id)
|
||||
);
|
||||
|
||||
if (projectId) {
|
||||
@ -144,7 +144,7 @@ const DailyTask = () => {
|
||||
{!project_lodaing &&
|
||||
projects
|
||||
?.filter((project) =>
|
||||
LoggedUser?.projects?.map(Number).includes(project.id)
|
||||
LoggedUser?.projects?.map(String).includes(project.id)
|
||||
)
|
||||
.map((project) => (
|
||||
<option value={project.id} key={project.id}>
|
||||
|
@ -27,7 +27,7 @@ const ProjectList = () => {
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [itemsPerPage] = useState(6);
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [selectedStatuses, setSelectedStatuses] = useState([1, 2, 3, 4]);
|
||||
const [selectedStatuses, setSelectedStatuses] = useState(["b74da4c2-d07e-46f2-9919-e75e49b12731","603e994b-a27f-4e5d-a251-f3d69b0498ba","ef1c356e-0fe0-42df-a5d3-8daee355492d","33deaef9-9af1-4f2a-b443-681ea0d04f81",]);
|
||||
|
||||
const handleShow = () => setShowModal(true);
|
||||
const handleClose = () => setShowModal(false);
|
||||
@ -234,10 +234,10 @@ const ProjectList = () => {
|
||||
</a>
|
||||
<ul className="dropdown-menu p-2 text-capitalize">
|
||||
{[
|
||||
{ id: 1, label: "Active" },
|
||||
{ id: 2, label: "On Hold" },
|
||||
{ id: 3, label: "Inactive" },
|
||||
{ id: 4, label: "Completed" },
|
||||
{ id: "b74da4c2-d07e-46f2-9919-e75e49b12731", label: "Active" },
|
||||
{ id: "603e994b-a27f-4e5d-a251-f3d69b0498ba", label: "On Hold" },
|
||||
{ id: "ef1c356e-0fe0-42df-a5d3-8daee355492d", label: "Inactive" },
|
||||
{ id: "33deaef9-9af1-4f2a-b443-681ea0d04f81", label: "Completed" },
|
||||
].map(({ id, label }) => (
|
||||
<li key={id}>
|
||||
<div className="form-check">
|
||||
|
@ -68,7 +68,9 @@ const ProjectListView = ({ projectData }) => {
|
||||
if (projects_list) {
|
||||
const updatedProjectsList = projects_list.map((project) =>
|
||||
project.id === projectInfo.id
|
||||
? { ...project, ...response.data, tenant: project.tenant }
|
||||
? { ...project, ...response.data,
|
||||
// tenant: project.tenant
|
||||
}
|
||||
: project
|
||||
);
|
||||
cacheData("projectslist", updatedProjectsList);
|
||||
|
@ -2,11 +2,19 @@ import { api } from "../utils/axiosClient";
|
||||
|
||||
const GlobalRepository = {
|
||||
getDashboardProgressionData: ({ days = '', FromDate = '', projectId = '' }) => {
|
||||
const params = new URLSearchParams({
|
||||
days: days.toString(),
|
||||
FromDate,
|
||||
projectId,
|
||||
});
|
||||
let params;
|
||||
if(projectId == null){
|
||||
params = new URLSearchParams({
|
||||
days: days.toString(),
|
||||
FromDate,
|
||||
});
|
||||
}else{
|
||||
params = new URLSearchParams({
|
||||
days: days.toString(),
|
||||
FromDate,
|
||||
projectId,
|
||||
});
|
||||
}
|
||||
|
||||
return api.get(`/api/Dashboard/Progression?${params.toString()}`);
|
||||
},
|
||||
|
@ -24,6 +24,6 @@ const ProjectRepository = {
|
||||
|
||||
export const TasksRepository = {
|
||||
assignTask: ( data ) => api.post( "/api/task/assign", data ),
|
||||
reportTak:(data)=>api.post("/api/task/report",data)
|
||||
// reportTask:(data)=>api.post("/api/task/report",data)
|
||||
}
|
||||
export default ProjectRepository;
|
||||
|
@ -14,6 +14,6 @@ export const TasksRepository = {
|
||||
|
||||
return api.get(url);
|
||||
},
|
||||
reportTsak: (data) => api.post("api/task/report", data),
|
||||
reportTask: (data) => api.post("api/task/report", data),
|
||||
taskComments: (data) => api.post("api/task/comment", data),
|
||||
};
|
||||
|
@ -1,27 +1,27 @@
|
||||
export const getProjectStatusName = (statusId) => {
|
||||
switch (statusId) {
|
||||
case 1:
|
||||
case "b74da4c2-d07e-46f2-9919-e75e49b12731":
|
||||
return "Active";
|
||||
case 2:
|
||||
case "603e994b-a27f-4e5d-a251-f3d69b0498ba":
|
||||
return "On Hold";
|
||||
// case 3:
|
||||
// return "Suspended";
|
||||
case 3:
|
||||
case "ef1c356e-0fe0-42df-a5d3-8daee355492d":
|
||||
return "Inactive";
|
||||
case 4:
|
||||
case "33deaef9-9af1-4f2a-b443-681ea0d04f81":
|
||||
return "Completed";
|
||||
}
|
||||
};
|
||||
|
||||
export const getProjectStatusColor = (statusId) => {
|
||||
switch (statusId) {
|
||||
case 1:
|
||||
case "b74da4c2-d07e-46f2-9919-e75e49b12731":
|
||||
return "bg-label-success";
|
||||
case 2:
|
||||
case "603e994b-a27f-4e5d-a251-f3d69b0498ba":
|
||||
return "bg-label-warning";
|
||||
case 3:
|
||||
case "ef1c356e-0fe0-42df-a5d3-8daee355492d":
|
||||
return "bg-label-info";
|
||||
case 4:
|
||||
case "33deaef9-9af1-4f2a-b443-681ea0d04f81":
|
||||
return "bg-label-secondary";
|
||||
case 5:
|
||||
return "bg-label-dark";
|
||||
|
Loading…
x
Reference in New Issue
Block a user