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