Compare commits

..

No commits in common. "0746e5c34947012837332d2a6849adda5540cb7e" and "83143dff0a9d27a46a5627d2083490ff5d2a86f0" have entirely different histories.

View File

@ -6,10 +6,9 @@ import {
useActivitiesMaster,
useWorkCategoriesMaster,
} from "../../../hooks/masterHook/useMaster";
import { useManageTask, useProjectAssignedServices } from "../../../hooks/useProjects";
import { useManageTask } from "../../../hooks/useProjects";
import showToast from "../../../services/toastService";
import Label from "../../common/Label";
import { useSelectedProject } from "../../../slices/apiDataManager";
const taskSchema = z.object({
buildingID: z.string().min(1, "Building is required"),
@ -38,15 +37,6 @@ const TaskModel = ({ project, onSubmit, onClose }) => {
const { activities, loading: activityLoading } = useActivitiesMaster();
const { categories, categoryLoading } = useWorkCategoriesMaster();
const projectId = useSelectedProject();
const { data: assignedServices, isLoading: servicesLoading } = useProjectAssignedServices(projectId);
const [selectedService, setSelectedService] = useState("");
const handleServiceChange = (e) => {
setSelectedService(e.target.value);
};
const {
register,
handleSubmit,
@ -106,12 +96,10 @@ const TaskModel = ({ project, onSubmit, onClose }) => {
}, [categories]);
const onSubmitForm = async (data) => {
const payload = [data];
CreateTask({
payload: payload, buildingId: data.buildingID,
const payload = [data];
CreateTask({payload:payload,buildingId: data.buildingID,
floorId: data.floorId,
workAreaId: data.workAreaId, PreviousPlannedWork: 0, previousCompletedWork: 0
});
workAreaId: data.workAreaId, PreviousPlannedWork:0,previousCompletedWork:0});
};
return (
@ -162,7 +150,6 @@ const TaskModel = ({ project, onSubmit, onClose }) => {
</div>
)}
{/* Work Area Selection */}
{selectedFloor && (
<div className="col-12 text-start">
<Label className="form-label" required>Select Work Area</Label>
@ -185,32 +172,6 @@ const TaskModel = ({ project, onSubmit, onClose }) => {
</div>
)}
{/* Services Selection */}
{selectedWorkArea && (
<div className="col-12 text-start">
<Label className="form-label">Select Services</Label>
<select
name="DataTables_Table_0_length"
aria-controls="DataTables_Table_0"
className="form-select form-select-sm"
aria-label="Select Service"
value={selectedService}
onChange={handleServiceChange}
>
{servicesLoading && <option>Loading...</option>}
{assignedServices?.map((service) => (
<option key={service.id} value={service.id}>
{service.name}
</option>
))}
</select>
{errors.buildingID && (
<p className="danger-text">{errors.buildingID.message}</p>
)}
</div>
)}
{/* Activity Selection */}
{selectedWorkArea && (
<div className="col-12 text-start">
<Label className="form-label" required>Select Activity</Label>
@ -231,7 +192,6 @@ const TaskModel = ({ project, onSubmit, onClose }) => {
</div>
)}
{selectedWorkArea && (
<div className="col-12 text-start">
<label className="form-label">Select Work Category</label>
@ -301,7 +261,7 @@ const TaskModel = ({ project, onSubmit, onClose }) => {
</div>
)}
<div className="col-12 text-end mt-5">
<div className="col-12 text-end mt-5">
<button
type="button"
className="btn btn-sm btn-label-secondary me-3"