Merge branch 'Organization_Management' of https://git.marcoaiot.com/admin/marco.pms.web into Organization_Management
This commit is contained in:
commit
4fd6e5cc1a
@ -112,7 +112,7 @@ const TaskModel = ({ project, onSubmit, onClose }) => {
|
|||||||
const { mutate: CreateTask, isPending } = useManageTask({
|
const { mutate: CreateTask, isPending } = useManageTask({
|
||||||
onSuccessCallback: (response) => {
|
onSuccessCallback: (response) => {
|
||||||
showToast(response?.message, "success");
|
showToast(response?.message, "success");
|
||||||
onClose?.();
|
// onClose?.();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -356,9 +356,10 @@ const TaskModel = ({ project, onSubmit, onClose }) => {
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="btn btn-sm btn-primary"
|
className="btn btn-sm btn-primary"
|
||||||
disabled={isSubmitting}
|
// disabled={isSubmitting}
|
||||||
|
disabled={isPending}
|
||||||
>
|
>
|
||||||
{isSubmitting ? "Please Wait..." : "Add Task"}
|
{isPending ? "Please Wait..." : "Add Task"}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -203,8 +203,7 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-sm-6">
|
<div className="col-sm-6">
|
||||||
<SelectMultiple
|
<SelectMultiple
|
||||||
required
|
|
||||||
name="serviceIds"
|
name="serviceIds"
|
||||||
label="Services"
|
label="Services"
|
||||||
options={services?.data}
|
options={services?.data}
|
||||||
|
@ -33,7 +33,7 @@ export const newTenantSchema = z.object({
|
|||||||
organizationSize: z.string().nonempty("Organization size is required"),
|
organizationSize: z.string().nonempty("Organization size is required"),
|
||||||
industryId: z.string().uuid("Invalid industry ID"),
|
industryId: z.string().uuid("Invalid industry ID"),
|
||||||
reference: z.string().nonempty("Reference is required"),
|
reference: z.string().nonempty("Reference is required"),
|
||||||
serviceIds: z.array(z.string()).nonempty("Services is required"),
|
serviceIds: z.array(z.string()).optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const tenantDefaultValues = {
|
export const tenantDefaultValues = {
|
||||||
|
@ -1,235 +0,0 @@
|
|||||||
import React, { useState, useEffect, useCallback } from "react";
|
|
||||||
import { useFieldArray, useForm } from "react-hook-form";
|
|
||||||
import { z } from "zod";
|
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
|
||||||
|
|
||||||
import { MasterRespository } from "../../repositories/MastersRepository";
|
|
||||||
import { clearApiCacheKey } from "../../slices/apiCacheSlice";
|
|
||||||
import { getCachedData, cacheData } from "../../slices/apiDataManager";
|
|
||||||
import showToast from "../../services/toastService";
|
|
||||||
import { useCreateActivity } 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: "Unit of Measurement is required" }),
|
|
||||||
checkList: z
|
|
||||||
.array(
|
|
||||||
z.object({
|
|
||||||
description: z.string().min(1, { message: "descriptionlist item cannot be empty" }),
|
|
||||||
isMandatory: z.boolean().default(false),
|
|
||||||
id: z.any().default(null),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
});
|
|
||||||
|
|
||||||
const CreateActivity = ({ activity = null, whichGroup = null, close }) => {
|
|
||||||
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 (
|
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
|
||||||
{/* <h6>Create Activity</h6> */}
|
|
||||||
<div className="row">
|
|
||||||
<div className="col-6 text-start">
|
|
||||||
<Label className="form-label" required>Activity</Label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
{...register("activityName")}
|
|
||||||
className={`form-control form-control-sm ${errors.activityName ? "is-invalid" : ""
|
|
||||||
}`}
|
|
||||||
/>
|
|
||||||
{errors.activityName && (
|
|
||||||
<p className="danger-text">{errors.activityName.message}</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="col-6 text-start">
|
|
||||||
<Label className="form-label" required>Measurement</Label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
{...register("unitOfMeasurement")}
|
|
||||||
className={`form-control form-control-sm ${errors.unitOfMeasurement ? "is-invalid" : ""
|
|
||||||
}`}
|
|
||||||
/>
|
|
||||||
{errors.unitOfMeasurement && (
|
|
||||||
<p className="danger-text">{errors.unitOfMeasurement.message}</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="col-md-12 text-start mt-1">
|
|
||||||
<p className="py-1 my-0">{checkListItems.length > 0 ? "Check List" : "Add Check List"}</p>
|
|
||||||
{checkListItems.length > 0 && (
|
|
||||||
<table className="table mt-1 border-0">
|
|
||||||
<thead className="py-0 my-0 table-border-top-0">
|
|
||||||
<tr className="py-1">
|
|
||||||
<th colSpan={2} className="py-1">
|
|
||||||
<small>Name</small>
|
|
||||||
</th>
|
|
||||||
<th colSpan={2} className="py-1 text-center">
|
|
||||||
<small>Is Mandatory</small>
|
|
||||||
</th>
|
|
||||||
<th className="text-center py-1">Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody className="table-border-bottom-0 ">
|
|
||||||
{checkListItems.map((item, index) => (
|
|
||||||
<tr key={index} className="border-top-0">
|
|
||||||
<td colSpan={2} className="border-top-0 border-0">
|
|
||||||
<input
|
|
||||||
className="d-none"
|
|
||||||
{...register(`checkList.${index}.id`)}
|
|
||||||
></input>
|
|
||||||
<input
|
|
||||||
{...register(`checkList.${index}.description`)}
|
|
||||||
className="form-control form-control-sm"
|
|
||||||
placeholder={`Checklist item ${index + 1}`}
|
|
||||||
onChange={(e) =>
|
|
||||||
handleChecklistChange(index, e.target.value)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
{errors.checkList?.[index]?.description && (
|
|
||||||
<small
|
|
||||||
style={{ fontSize: "10px" }}
|
|
||||||
className="danger-text"
|
|
||||||
>
|
|
||||||
{errors.checkList[index]?.description?.message}
|
|
||||||
</small>
|
|
||||||
)}
|
|
||||||
</td>
|
|
||||||
<td colSpan={2} className="text-center border-0">
|
|
||||||
<input
|
|
||||||
className="form-check-input"
|
|
||||||
type="checkbox"
|
|
||||||
{...register(`checkList.${index}.isMandatory`)}
|
|
||||||
defaultChecked={item.isMandatory}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td className="text-center border-0">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => removeChecklistItem(index)}
|
|
||||||
className="btn btn-xs btn-icon btn-text-secondary"
|
|
||||||
>
|
|
||||||
<i className="bx bxs-minus-circle text-danger" data-bs-toggle="tooltip"
|
|
||||||
title="Remove Check"
|
|
||||||
data-bs-original-title="Remove check"></i>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
)}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="btn btn-xs btn-primary mt-2"
|
|
||||||
onClick={addChecklistItem}
|
|
||||||
>
|
|
||||||
<i className="bx bx-plus-circle" data-bs-toggle="tooltip"
|
|
||||||
title="Add Check"
|
|
||||||
data-bs-original-title="Add check" ></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="col-12 text-end mt-3">
|
|
||||||
<button
|
|
||||||
type="reset"
|
|
||||||
className="btn btn-sm btn-label-secondary me-3"
|
|
||||||
onClick={handleClose}
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button type="submit" className="btn btn-sm btn-primary">
|
|
||||||
{isLoading ? "Please Wait" : "Submit"}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CreateActivity;
|
|
@ -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 (
|
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
|
||||||
<div className="row">
|
|
||||||
{/* Activity Name */}
|
|
||||||
<div className="col-md-6 text-start">
|
|
||||||
<Label className="form-label" required>Activity Name</Label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
{...register("activityName")}
|
|
||||||
className={`form-control form-control-sm ${errors.activityName ? "is-invalid" : ""}`}
|
|
||||||
/>
|
|
||||||
{errors.activityName && (
|
|
||||||
<div className="text-danger">{errors.activityName.message}</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Unit of Measurement */}
|
|
||||||
<div className="col-md-6 text-start">
|
|
||||||
<Label className="form-label" required>Measurement</Label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
{...register("unitOfMeasurement")}
|
|
||||||
className={`form-control form-control-sm ${errors.unitOfMeasurement ? "is-invalid" : ""}`}
|
|
||||||
/>
|
|
||||||
{errors.unitOfMeasurement && (
|
|
||||||
<div className="text-danger">{errors.unitOfMeasurement.message}</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Checklist */}
|
|
||||||
<div className="col-md-12 text-start mt-1">
|
|
||||||
<p className="py-1 my-0">{checkListItems.length > 0 ? "Check List" : "Add Check List"}</p>
|
|
||||||
{checkListItems.length > 0 && (
|
|
||||||
<table className="table mt-1 border-0">
|
|
||||||
<thead className="py-0 my-0 table-border-top-0">
|
|
||||||
<tr className="py-1">
|
|
||||||
<th colSpan={2} className="py-1">
|
|
||||||
<small>Name</small>
|
|
||||||
</th>
|
|
||||||
<th colSpan={2} className="py-1 text-center">
|
|
||||||
<small>Is Mandatory</small>
|
|
||||||
</th>
|
|
||||||
<th className="text-center py-1">Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{checkListItems.map((item, index) => (
|
|
||||||
<tr key={item.id} className="border-top-0">
|
|
||||||
<td colSpan={2} className=" border-0">
|
|
||||||
<input
|
|
||||||
className="d-none"
|
|
||||||
{...register(`checkList.${index}.id`)}
|
|
||||||
></input>
|
|
||||||
<input
|
|
||||||
{...register(`checkList.${index}.description`)}
|
|
||||||
className="form-control form-control-sm"
|
|
||||||
placeholder={`Checklist item ${index + 1}`}
|
|
||||||
onChange={(e) =>
|
|
||||||
handleChecklistChange(index, e.target.value)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
{errors.checkList?.[index]?.description && (
|
|
||||||
<small
|
|
||||||
style={{ fontSize: "10px" }}
|
|
||||||
className="danger-text"
|
|
||||||
>
|
|
||||||
{errors.checkList[index]?.description?.message}
|
|
||||||
</small>
|
|
||||||
)}
|
|
||||||
</td>
|
|
||||||
<td colSpan={2} className="text-center border-0">
|
|
||||||
<input
|
|
||||||
className="form-check-input"
|
|
||||||
type="checkbox"
|
|
||||||
{...register(`checkList.${index}.isMandatory`)}
|
|
||||||
defaultChecked={item.isMandatory}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td className="text-center border-0">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => removeChecklistItem(index)}
|
|
||||||
className="btn btn-xs btn-icon btn-text-secondary"
|
|
||||||
|
|
||||||
>
|
|
||||||
<i className="bx bxs-minus-circle text-danger" data-bs-toggle="tooltip"
|
|
||||||
title="Add Check"
|
|
||||||
data-bs-original-title="Add check" ></i>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
)}
|
|
||||||
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="btn btn-xs btn-primary mt-2"
|
|
||||||
onClick={addChecklistItem}
|
|
||||||
>
|
|
||||||
<i className="bx bx-plus-circle" data-bs-toggle="tooltip"
|
|
||||||
title="Add Check"
|
|
||||||
data-bs-original-title="Add check" ></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Submit / Cancel */}
|
|
||||||
<div className="col-12 text-end mt-3">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="btn btn-sm btn-label-secondary me-3"
|
|
||||||
onClick={onClose}
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button type="submit" className="btn btn-sm btn-primary">
|
|
||||||
{isLoading ? "Please Wait" : "Submit"}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default UpdateActivity;
|
|
@ -3,8 +3,6 @@ import CreateRole from "./CreateRole";
|
|||||||
import EditRole from "./EditRole";
|
import EditRole from "./EditRole";
|
||||||
import CreateJobRole from "./CreateJobRole";
|
import CreateJobRole from "./CreateJobRole";
|
||||||
import EditJobRole from "./EditJobRole";
|
import EditJobRole from "./EditJobRole";
|
||||||
import CreateActivity from "./CreateActivity";
|
|
||||||
import EditActivity from "./EditActivity";
|
|
||||||
import CreateWorkCategory from "./CreateWorkCategory";
|
import CreateWorkCategory from "./CreateWorkCategory";
|
||||||
import EditWorkCategory from "./EditWorkCategory";
|
import EditWorkCategory from "./EditWorkCategory";
|
||||||
import CreateCategory from "./CreateContactCategory";
|
import CreateCategory from "./CreateContactCategory";
|
||||||
@ -35,9 +33,7 @@ const MasterModal = ({ modaldata, closeModal }) => {
|
|||||||
<EditRole master={modaldata} onClose={closeModal} />
|
<EditRole master={modaldata} onClose={closeModal} />
|
||||||
),
|
),
|
||||||
"Job Role": <CreateJobRole onClose={closeModal} />,
|
"Job Role": <CreateJobRole onClose={closeModal} />,
|
||||||
"Edit-Job Role": <EditJobRole data={item} onClose={closeModal} />,
|
"Edit-Job Role": <EditJobRole data={item} onClose={closeModal} />,
|
||||||
"Activity": <CreateActivity onClose={closeModal} />,
|
|
||||||
"Edit-Activity": <EditActivity activityData={item} onClose={closeModal} />,
|
|
||||||
"Work Category": <CreateWorkCategory onClose={closeModal} />,
|
"Work Category": <CreateWorkCategory onClose={closeModal} />,
|
||||||
"Edit-Work Category": <EditWorkCategory data={item} onClose={closeModal} />,
|
"Edit-Work Category": <EditWorkCategory data={item} onClose={closeModal} />,
|
||||||
"Contact Category": <CreateCategory data={item} onClose={closeModal} />,
|
"Contact Category": <CreateCategory data={item} onClose={closeModal} />,
|
||||||
|
@ -137,8 +137,8 @@ const ManageActivity = ({ activity = null, whichGroup = null, close }) => {
|
|||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit(onSubmit)} className="px-7">
|
<form onSubmit={handleSubmit(onSubmit)} className="px-7">
|
||||||
{/* <h6>Create Activity</h6> */}
|
{/* <h6>Create Activity</h6> */}
|
||||||
<div className="row">
|
<div className="row border border-1 border-secondary rounded-3 mt-2">
|
||||||
<div className="col-6 text-start">
|
<div className="col-6 text-start mt-3">
|
||||||
<Label className="form-label" required>
|
<Label className="form-label" required>
|
||||||
Activity
|
Activity
|
||||||
</Label>
|
</Label>
|
||||||
@ -154,7 +154,7 @@ const ManageActivity = ({ activity = null, whichGroup = null, close }) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-6 text-start">
|
<div className="col-6 text-start mt-3">
|
||||||
<Label className="form-label" required>
|
<Label className="form-label" required>
|
||||||
Measurement
|
Measurement
|
||||||
</Label>
|
</Label>
|
||||||
@ -170,7 +170,7 @@ const ManageActivity = ({ activity = null, whichGroup = null, close }) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-md-12 text-start mt-1">
|
<div className="col-md-12 text-start mt-3">
|
||||||
<label className="py-1 form-label my-0">
|
<label className="py-1 form-label my-0">
|
||||||
Add Check List <i
|
Add Check List <i
|
||||||
className="bx bx-plus-circle text-primary cursor-pointer"
|
className="bx bx-plus-circle text-primary cursor-pointer"
|
||||||
@ -248,7 +248,7 @@ const ManageActivity = ({ activity = null, whichGroup = null, close }) => {
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-12 text-end mt-3">
|
<div className="col-12 text-end mt-3 mb-4">
|
||||||
<button
|
<button
|
||||||
type="reset"
|
type="reset"
|
||||||
className="btn btn-sm btn-label-secondary me-3"
|
className="btn btn-sm btn-label-secondary me-3"
|
||||||
|
@ -53,55 +53,55 @@ const ManageGroup = ({ group = null, whichService = null, close }) => {
|
|||||||
|
|
||||||
let isPending = isCreating || isUpdating;
|
let isPending = isCreating || isUpdating;
|
||||||
return (
|
return (
|
||||||
<form className="row px-12" onSubmit={handleSubmit(onSubmit)} cl>
|
<form className="row px-12" onSubmit={handleSubmit(onSubmit)} >
|
||||||
<div className="col-12 col-md-12 text-start">
|
<div className="border border-1 border-secondary rounded-3 p-2 mt-2">
|
||||||
<Label className="form-label" required>
|
<div className="col-12 col-md-12 text-start">
|
||||||
Group Name
|
<Label className="form-label" required>
|
||||||
</Label>
|
Group Name
|
||||||
<input
|
</Label>
|
||||||
type="text"
|
<input
|
||||||
{...register("name")}
|
type="text"
|
||||||
className={`form-control form-control-sm ${
|
{...register("name")}
|
||||||
errors.name ? "is-invalids" : ""
|
className={`form-control form-control-sm ${errors.name ? "is-invalids" : ""
|
||||||
}`}
|
}`}
|
||||||
/>
|
/>
|
||||||
{errors.name && (
|
{errors.name && (
|
||||||
<p className="danger-text m-0">{errors.name.message}</p>
|
<p className="danger-text m-0">{errors.name.message}</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="col-12 col-md-12 text-start mb-2">
|
<div className="col-12 col-md-12 text-start mb-2">
|
||||||
<Label className="form-label" htmlFor="description" required>
|
<Label className="form-label" htmlFor="description" required>
|
||||||
Description
|
Description
|
||||||
</Label>
|
</Label>
|
||||||
<textarea
|
<textarea
|
||||||
rows="3"
|
rows="3"
|
||||||
{...register("description")}
|
{...register("description")}
|
||||||
className={`form-control form-control-sm ${
|
className={`form-control form-control-sm ${errors.description ? "is-invalids" : ""
|
||||||
errors.description ? "is-invalids" : ""
|
}`}
|
||||||
}`}
|
></textarea>
|
||||||
></textarea>
|
|
||||||
|
|
||||||
{errors.description && (
|
{errors.description && (
|
||||||
<p className="danger-text m-0">{errors.description.message}</p>
|
<p className="danger-text m-0">{errors.description.message}</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-12 text-end">
|
<div className="col-12 text-end mt-5">
|
||||||
<button
|
<button
|
||||||
className="btn btn-xs btn-label-secondary me-3"
|
className="btn btn-sm btn-label-secondary me-3"
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
onClick={close}
|
onClick={close}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="btn btn-xs btn-primary"
|
className="btn btn-sm btn-primary"
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
>
|
>
|
||||||
{isPending ? "Please Wait..." : group ? "Update" : "Submit"}
|
{isPending ? "Please Wait..." : group ? "Update" : "Submit"}
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
@ -135,31 +135,19 @@ const TenantPage = () => {
|
|||||||
onChange={(e) => setSearchText(e.target.value)}
|
onChange={(e) => setSearchText(e.target.value)}
|
||||||
placeholder="Search Tenant"
|
placeholder="Search Tenant"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Actions */}
|
{/* Actions */}
|
||||||
<div className="col-6 col-md-6 col-lg-10 text-end">
|
<div className="col-6 col-md-6 col-lg-10 text-end">
|
||||||
<span
|
|
||||||
className="text-tiny text-muted p-1 border-0 bg-none lead mx-3 cursor-pointer"
|
|
||||||
disabled={isRefetching}
|
|
||||||
onClick={() => refetchFn && refetchFn()}
|
|
||||||
>
|
|
||||||
Refresh{" "}
|
|
||||||
<i
|
|
||||||
className={`bx bx-refresh ms-1 ${isRefetching ? "bx-spin" : ""
|
|
||||||
}`}
|
|
||||||
></i>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
className="btn btn-sm btn-primary"
|
className="btn btn-sm btn-primary"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleNewTenant}
|
onClick={handleNewTenant}
|
||||||
>
|
>
|
||||||
<i className="bx bx-plus-circle me-2"></i>
|
<i className="bx bx-plus-circle me-2"></i>
|
||||||
<span className="d-none d-md-inline-block">
|
<span className="d-none d-md-inline-block">
|
||||||
Add New Tenant
|
Add New Tenant
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user