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 tags: z
.array( .array(
z.object({ z.object({
id: z.string().nullable().optional(), id: z.string().nullable(),
name: z.string(), name: z.string(),
}) })
) )

View File

@ -87,7 +87,6 @@ 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 || [],
@ -178,6 +177,7 @@ 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)}>
@ -205,13 +205,12 @@ const ManageContact = ({ contactId, closeModal }) => {
<Label htmlFor={"organization"} required> <Label htmlFor={"organization"} required>
Organization Organization
</Label> </Label>
<InputSuggestions <InputSuggestions
organizationList={organizationList} organizationList={organizationList}
value={watch("organization") || ""} value={getValues("organization") || ""}
onChange={(val) => setValue("organization", val, { shouldValidate: true })} onChange={(val) => setValue("organization", val)}
error={errors.organization?.message} error={errors.organization?.message}
/> />
</div> </div>
</div> </div>
@ -472,14 +471,13 @@ 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" disabled={isPending}> <button className="btn btn-sm btn-primary" type="submit">
{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>

View File

@ -8,6 +8,7 @@ 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);

View File

@ -221,10 +221,10 @@ useEffect(() => {
recallEmployeeData( recallEmployeeData(
showInactive, showInactive,
showAllEmployees ? null : selectedProjectId showAllEmployees ? null : selectedProjectId
); ); // Use selectedProjectId here
} }
}, },
[employees, showInactive, showAllEmployees, selectedProjectId] [employees, showInactive, showAllEmployees, selectedProjectId] // Add all relevant dependencies
); );
useEffect(() => { useEffect(() => {
@ -247,7 +247,7 @@ useEffect(() => {
)} )}
{showModal && ( {showModal && (
<GlobalModel <GlobalModel
isOpen={showModal} isOpen={showModal}
size="lg" size="lg"
closeModal={() => setShowModal(false)} closeModal={() => setShowModal(false)}
@ -259,22 +259,40 @@ useEffect(() => {
/> />
</GlobalModel> </GlobalModel>
)} )}
{IsDeleteModalOpen && (
<ConfirmModal {IsDeleteModalOpen && (
isOpen={IsDeleteModalOpen} <div
type="delete" className={`modal fade ${IsDeleteModalOpen ? "show" : ""}`}
header="Suspend Employee" tabIndex="-1"
message="Are you sure you want suspend?" role="dialog"
onSubmit={(id) => 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={() =>
suspendEmployee({ suspendEmployee({
employeeId:id , employeeId: selectedEmpFordelete.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">
@ -647,7 +665,7 @@ useEffect(() => {
<button <button
className="dropdown-item py-1" className="dropdown-item py-1"
onClick={() => onClick={() =>
handleOpenDelete(item) handleOpenDelete(item.id)
} }
> >
<i className="bx bx-task-x bx-sm"></i>{" "} <i className="bx bx-task-x bx-sm"></i>{" "}