Compare commits

..

No commits in common. "717264c9f997cbe5695b13744e1bc846e676adbb" and "b51b3db9eca09fde3d315e9c0a3c4266bd097c78" have entirely different histories.

4 changed files with 44 additions and 27 deletions

View File

@ -35,7 +35,7 @@ export const ContactSchema = z.object({
tags: z
.array(
z.object({
id: z.string().nullable().optional(),
id: z.string().nullable(),
name: z.string(),
})
)

View File

@ -87,7 +87,6 @@ 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 || [],
@ -178,6 +177,7 @@ const ManageContact = ({ contactId, closeModal }) => {
};
const isPending = updating || creating;
return (
<FormProvider {...methods}>
<form className="p-2 p-sm-0" onSubmit={handleSubmit(onSubmit)}>
@ -207,11 +207,10 @@ const ManageContact = ({ contactId, closeModal }) => {
</Label>
<InputSuggestions
organizationList={organizationList}
value={watch("organization") || ""}
onChange={(val) => setValue("organization", val, { shouldValidate: true })}
value={getValues("organization") || ""}
onChange={(val) => setValue("organization", val)}
error={errors.organization?.message}
/>
/>
</div>
</div>
@ -472,14 +471,13 @@ 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" disabled={isPending}>
<button className="btn btn-sm btn-primary" type="submit">
{isPending ? "Please Wait..." : "Submit"}
</button>
<button
className="btn btn-sm btn-secondary"
type="button"
onClick={handleClosed}
disabled={isPending}
>
Cancel
</button>

View File

@ -8,6 +8,7 @@ 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]
[employees, showInactive, showAllEmployees, selectedProjectId] // Add all relevant dependencies
);
useEffect(() => {
@ -259,22 +259,40 @@ 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
isOpen={IsDeleteModalOpen}
type="delete"
header="Suspend Employee"
message="Are you sure you want suspend?"
onSubmit={(id) =>
type={"delete"}
header={
selectedEmpFordelete?.isActive
? "Suspend Employee"
: "Reactivate Employee"
}
message={`Are you sure you want to ${
selectedEmpFordelete?.isActive ? "suspend" : "reactivate"
} this employee?`}
onSubmit={() =>
suspendEmployee({
employeeId:id ,
employeeId: selectedEmpFordelete.id,
active: !selectedEmpFordelete.isActive,
})
}
onClose={() => setIsDeleteModalOpen(false)}
loading={employeeLodaing}
paramData={selectedEmpFordelete.id}
/>
</div>
)}
<div className="container-fluid">
@ -647,7 +665,7 @@ useEffect(() => {
<button
className="dropdown-item py-1"
onClick={() =>
handleOpenDelete(item)
handleOpenDelete(item.id)
}
>
<i className="bx bx-task-x bx-sm"></i>{" "}