Compare commits

..

3 Commits

4 changed files with 27 additions and 44 deletions

View File

@ -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(),
})
)

View File

@ -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)}>
@ -205,12 +205,13 @@ const ManageContact = ({ contactId, closeModal }) => {
<Label htmlFor={"organization"} required>
Organization
</Label>
<InputSuggestions
organizationList={organizationList}
value={getValues("organization") || ""}
onChange={(val) => setValue("organization", val)}
error={errors.organization?.message}
/>
<InputSuggestions
organizationList={organizationList}
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>

View File

@ -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);

View File

@ -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={() =>
{IsDeleteModalOpen && (
<ConfirmModal
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}
/>
</div>
onClose={() => setIsDeleteModalOpen(false)}
loading={employeeLodaing}
paramData={selectedEmpFordelete.id}
/>
)}
<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>{" "}