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