Compare commits
3 Commits
b51b3db9ec
...
717264c9f9
| Author | SHA1 | Date | |
|---|---|---|---|
| 717264c9f9 | |||
| 1a04dd51fc | |||
| c83de16466 |
@ -35,7 +35,7 @@ export const ContactSchema = z.object({
|
|||||||
tags: z
|
tags: z
|
||||||
.array(
|
.array(
|
||||||
z.object({
|
z.object({
|
||||||
id: z.string().nullable(),
|
id: z.string().nullable().optional(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@ -87,6 +87,7 @@ const ManageContact = ({ contactId, closeModal }) => {
|
|||||||
: [{ label: "Office", phoneNumber: "" }],
|
: [{ label: "Office", phoneNumber: "" }],
|
||||||
|
|
||||||
contactCategoryId: contactData.contactCategory?.id || "",
|
contactCategoryId: contactData.contactCategory?.id || "",
|
||||||
|
address: contactData?.address || "",
|
||||||
projectIds: contactData.projects?.map((p) => p.id) || [],
|
projectIds: contactData.projects?.map((p) => p.id) || [],
|
||||||
bucketIds: contactData.buckets?.map((b) => b.id) || [],
|
bucketIds: contactData.buckets?.map((b) => b.id) || [],
|
||||||
tags: contactData.tags || [],
|
tags: contactData.tags || [],
|
||||||
@ -177,7 +178,6 @@ const ManageContact = ({ contactId, closeModal }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const isPending = updating || creating;
|
const isPending = updating || creating;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormProvider {...methods}>
|
<FormProvider {...methods}>
|
||||||
<form className="p-2 p-sm-0" onSubmit={handleSubmit(onSubmit)}>
|
<form className="p-2 p-sm-0" onSubmit={handleSubmit(onSubmit)}>
|
||||||
@ -207,10 +207,11 @@ const ManageContact = ({ contactId, closeModal }) => {
|
|||||||
</Label>
|
</Label>
|
||||||
<InputSuggestions
|
<InputSuggestions
|
||||||
organizationList={organizationList}
|
organizationList={organizationList}
|
||||||
value={getValues("organization") || ""}
|
value={watch("organization") || ""}
|
||||||
onChange={(val) => setValue("organization", val)}
|
onChange={(val) => setValue("organization", val, { shouldValidate: true })}
|
||||||
error={errors.organization?.message}
|
error={errors.organization?.message}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -471,13 +472,14 @@ const ManageContact = ({ contactId, closeModal }) => {
|
|||||||
|
|
||||||
{/* Actions */}
|
{/* Actions */}
|
||||||
<div className="d-flex justify-content-end gap-3 py-2">
|
<div className="d-flex justify-content-end gap-3 py-2">
|
||||||
<button className="btn btn-sm btn-primary" type="submit">
|
<button className="btn btn-sm btn-primary" type="submit" disabled={isPending}>
|
||||||
{isPending ? "Please Wait..." : "Submit"}
|
{isPending ? "Please Wait..." : "Submit"}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className="btn btn-sm btn-secondary"
|
className="btn btn-sm btn-secondary"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleClosed}
|
onClick={handleClosed}
|
||||||
|
disabled={isPending}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -8,7 +8,6 @@ const InputSuggestions = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [filteredList, setFilteredList] = useState([]);
|
const [filteredList, setFilteredList] = useState([]);
|
||||||
const [showSuggestions, setShowSuggestions] = useState(false);
|
const [showSuggestions, setShowSuggestions] = useState(false);
|
||||||
|
|
||||||
const handleInputChange = (e) => {
|
const handleInputChange = (e) => {
|
||||||
const val = e.target.value;
|
const val = e.target.value;
|
||||||
onChange(val);
|
onChange(val);
|
||||||
|
|||||||
@ -221,10 +221,10 @@ useEffect(() => {
|
|||||||
recallEmployeeData(
|
recallEmployeeData(
|
||||||
showInactive,
|
showInactive,
|
||||||
showAllEmployees ? null : selectedProjectId
|
showAllEmployees ? null : selectedProjectId
|
||||||
); // Use selectedProjectId here
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[employees, showInactive, showAllEmployees, selectedProjectId] // Add all relevant dependencies
|
[employees, showInactive, showAllEmployees, selectedProjectId]
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -259,40 +259,22 @@ useEffect(() => {
|
|||||||
/>
|
/>
|
||||||
</GlobalModel>
|
</GlobalModel>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{IsDeleteModalOpen && (
|
{IsDeleteModalOpen && (
|
||||||
<div
|
|
||||||
className={`modal fade ${IsDeleteModalOpen ? "show" : ""}`}
|
|
||||||
tabIndex="-1"
|
|
||||||
role="dialog"
|
|
||||||
style={{
|
|
||||||
display: IsDeleteModalOpen ? "block" : "none",
|
|
||||||
backgroundColor: IsDeleteModalOpen
|
|
||||||
? "rgba(0,0,0,0.5)"
|
|
||||||
: "transparent",
|
|
||||||
}}
|
|
||||||
aria-hidden="false"
|
|
||||||
>
|
|
||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
type={"delete"}
|
isOpen={IsDeleteModalOpen}
|
||||||
header={
|
type="delete"
|
||||||
selectedEmpFordelete?.isActive
|
header="Suspend Employee"
|
||||||
? "Suspend Employee"
|
message="Are you sure you want suspend?"
|
||||||
: "Reactivate Employee"
|
onSubmit={(id) =>
|
||||||
}
|
|
||||||
message={`Are you sure you want to ${
|
|
||||||
selectedEmpFordelete?.isActive ? "suspend" : "reactivate"
|
|
||||||
} this employee?`}
|
|
||||||
onSubmit={() =>
|
|
||||||
suspendEmployee({
|
suspendEmployee({
|
||||||
employeeId: selectedEmpFordelete.id,
|
employeeId:id ,
|
||||||
active: !selectedEmpFordelete.isActive,
|
active: !selectedEmpFordelete.isActive,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
onClose={() => setIsDeleteModalOpen(false)}
|
onClose={() => setIsDeleteModalOpen(false)}
|
||||||
loading={employeeLodaing}
|
loading={employeeLodaing}
|
||||||
|
paramData={selectedEmpFordelete.id}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="container-fluid">
|
<div className="container-fluid">
|
||||||
@ -665,7 +647,7 @@ useEffect(() => {
|
|||||||
<button
|
<button
|
||||||
className="dropdown-item py-1"
|
className="dropdown-item py-1"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
handleOpenDelete(item.id)
|
handleOpenDelete(item)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<i className="bx bx-task-x bx-sm"></i>{" "}
|
<i className="bx bx-task-x bx-sm"></i>{" "}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user