diff --git a/src/components/Project/Infrastructure/TaskModel.jsx b/src/components/Project/Infrastructure/TaskModel.jsx
index efa2006f..4bbf1555 100644
--- a/src/components/Project/Infrastructure/TaskModel.jsx
+++ b/src/components/Project/Infrastructure/TaskModel.jsx
@@ -112,7 +112,7 @@ const TaskModel = ({ project, onSubmit, onClose }) => {
const { mutate: CreateTask, isPending } = useManageTask({
onSuccessCallback: (response) => {
showToast(response?.message, "success");
- onClose?.();
+ // onClose?.();
},
});
useEffect(() => {
@@ -356,9 +356,10 @@ const TaskModel = ({ project, onSubmit, onClose }) => {
diff --git a/src/components/Tenant/OrganizationInfo.jsx b/src/components/Tenant/OrganizationInfo.jsx
index a34c602f..b12c55b2 100644
--- a/src/components/Tenant/OrganizationInfo.jsx
+++ b/src/components/Tenant/OrganizationInfo.jsx
@@ -203,8 +203,7 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
-
{
- const maxDescriptionLength = 255;
- const { mutate: createActivity, isPending: isLoading } = useCreateActivity(() => onClose?.());
-
- const {
- register,
- handleSubmit,
- control,
- setValue,
- clearErrors,
- setError,
- getValues,
- reset,
- formState: { errors },
- } = useForm({
- resolver: zodResolver(schema),
- defaultValues: {
- activityName: "",
- unitOfMeasurement: "",
- checkList: [],
- },
- });
-
- const {
- fields: checkListItems,
- append,
- remove,
- } = useFieldArray({
- control,
- name: "checkList",
- });
-
- const addChecklistItem = useCallback(() => {
- const values = getValues("checkList");
- const lastIndex = checkListItems.length - 1;
-
- if (
- checkListItems.length > 0 &&
- (!values?.[lastIndex] || values[lastIndex].description.trim() === "")
- ) {
- setError(`checkList.${lastIndex}.description`, {
- type: "manual",
- message: "Please fill this checklist item before adding another.",
- });
- return;
- }
-
- clearErrors(`checkList.${lastIndex}.description`);
- append({ id: null, description: "", isMandatory: false });
- }, [checkListItems, getValues, append, setError, clearErrors]);
-
- const removeChecklistItem = useCallback((index) => {
- remove(index);
- }, [remove]);
-
- const handleChecklistChange = useCallback((index, value) => {
- setValue(`checkList.${index}`, value);
- }, [setValue]);
-
- const onSubmit = (formData) => {
- createActivity(formData);
- };
-
- useEffect(()=>{
- if (activity) {
- reset({
- activityName: activity.activityName || '',
- unitOfMeasurement: activity.unitOfMeasurement || '',
- checkList: activity.checkList?.map((check) => ({
- description: check.description || '',
- isMandatory: check.isMandatory || false,
- })) || [{ description: '', isMandatory: false }],
- });
- }
- },[activity,reset])
- const handleClose = useCallback(() => {
- reset();
- onClose();
- }, [reset, onClose]);
-
- useEffect(() => {
- const tooltipTriggerList = Array.from(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
- tooltipTriggerList.forEach((el) => new bootstrap.Tooltip(el));
- }, []);
-
- return (
-
- );
-};
-
-export default CreateActivity;
diff --git a/src/components/master/EditActivity.jsx b/src/components/master/EditActivity.jsx
deleted file mode 100644
index 15e85255..00000000
--- a/src/components/master/EditActivity.jsx
+++ /dev/null
@@ -1,231 +0,0 @@
-import React, { useEffect, useState } from "react";
-import { useForm, useFieldArray } from "react-hook-form";
-import { z } from "zod";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { MasterRespository } from "../../repositories/MastersRepository";
-import showToast from "../../services/toastService";
-import { getCachedData, cacheData } from "../../slices/apiDataManager";
-import { useUpdateActivity } from "../../hooks/masterHook/useMaster";
-import Label from "../common/Label";
-
-
-const schema = z.object({
- activityName: z.string().min(1, { message: "Activity name is required" }),
- unitOfMeasurement: z.string().min(1, { message: "Measurement is required" }),
- checkList: z
- .array(
- z.object({
- id: z.any().default(null),
- description: z.string().min(1, { message: "Checklist item cannot be empty" }),
- isMandatory: z.boolean().default(false),
- })
- )
- .optional(),
-});
-
-
-const UpdateActivity = ({ activity = null, whichService = null, close }) => {
- const { mutate: updateActivity, isPending: isLoading } = useUpdateActivity(() => onClose?.());
-
- const {
- register,
- handleSubmit,
- control,
- setValue,
- reset,
- setError,
- clearErrors,
- getValues,
- formState: { errors },
- } = useForm({
- resolver: zodResolver(schema),
- defaultValues: {
- id: activity?.id,
- activityName: activity?.activityName,
- unitOfMeasurement: activity?.unitOfMeasurement,
- checkList: activity?.checkLists || [],
- },
- });
-
- const { fields: checkListItems, append, remove } = useFieldArray({
- control,
- name: "checkList",
- });
-
- useEffect(() => {
- if (activity) {
- reset({
- id: activity.id,
- activityName: activity.activityName,
- unitOfMeasurement: activity.unitOfMeasurement,
- checkList: activity.checkLists || [],
- });
- }
- }, [activity, reset]);
-
- const addChecklistItem = () => {
- const values = getValues("checkList");
- const lastIndex = checkListItems.length - 1;
-
- if (
- checkListItems.length > 0 &&
- (!values?.[lastIndex] || values[lastIndex].description.trim() === "")
- ) {
- setError(`checkList.${lastIndex}.description`, {
- type: "manual",
- message: "Please fill this checklist item before adding another.",
- });
- return;
- }
-
- clearErrors(`checkList.${lastIndex}.description`);
- append({ id: null, description: "", isMandatory: false });
- };
-
- const removeChecklistItem = (index) => {
- remove(index);
- };
-
- const handleChecklistChange = (index, value) => {
- setValue(`checkList.${index}`, value);
- };
-
- const onSubmit = (formData) => {
- const payload = { ...formData, id: activity.id };
- updateActivity({ id: activity.id, payload });
- };
-
-
- useEffect(() => {
- const tooltipTriggerList = Array.from(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
- tooltipTriggerList.forEach((el) => new bootstrap.Tooltip(el));
- }, []);
-
- return (
-
- );
-};
-
-export default UpdateActivity;
\ No newline at end of file
diff --git a/src/components/master/MasterModal.jsx b/src/components/master/MasterModal.jsx
index 2c71ea71..38e1d591 100644
--- a/src/components/master/MasterModal.jsx
+++ b/src/components/master/MasterModal.jsx
@@ -3,8 +3,6 @@ import CreateRole from "./CreateRole";
import EditRole from "./EditRole";
import CreateJobRole from "./CreateJobRole";
import EditJobRole from "./EditJobRole";
-import CreateActivity from "./CreateActivity";
-import EditActivity from "./EditActivity";
import CreateWorkCategory from "./CreateWorkCategory";
import EditWorkCategory from "./EditWorkCategory";
import CreateCategory from "./CreateContactCategory";
@@ -35,9 +33,7 @@ const MasterModal = ({ modaldata, closeModal }) => {
),
"Job Role": ,
- "Edit-Job Role": ,
- "Activity": ,
- "Edit-Activity": ,
+ "Edit-Job Role": ,
"Work Category": ,
"Edit-Work Category": ,
"Contact Category": ,
diff --git a/src/components/master/Services/ManageActivity.jsx b/src/components/master/Services/ManageActivity.jsx
index 1c829f2a..eda3b6d6 100644
--- a/src/components/master/Services/ManageActivity.jsx
+++ b/src/components/master/Services/ManageActivity.jsx
@@ -137,8 +137,8 @@ const ManageActivity = ({ activity = null, whichGroup = null, close }) => {
return (