Apply functionality for Both Notes and Contact filter

This commit is contained in:
Kartik Sharma 2025-09-12 17:09:48 +05:30
parent 0484de498c
commit 7e5b6952f5
5 changed files with 12 additions and 12 deletions

View File

@ -81,21 +81,21 @@ export const defaultContactValue = {
};
export const contactsFilter = z.object({
buckets: z.array(z.string()).optional(),
contactCategories: z.array(z.string()).optional(),
bucketIds: z.array(z.string()).optional(),
categoryIds: z.array(z.string()).optional(),
});
export const defaultContactFilter = {
buckets: [],
contactCategories: [],
bucketIds: [],
categoryIds: [],
};
export const notesFilter = z.object({
createdBy: z.array(z.string()).optional(),
createdByIds: z.array(z.string()).optional(),
organizations: z.array(z.string()).optional(),
});
export const defaultNotesFilter = {
createdBy: [],
createdByIds: [],
organizations: [],
};

View File

@ -243,7 +243,7 @@ export const useDirectoryNotes = (
const cleanFilter = (filter) => {
const cleaned = { ...filter };
["bucketIds", "contactCategories"].forEach((key) => {
["bucketIds", "categoryIds"].forEach((key) => {
if (Array.isArray(cleaned[key]) && cleaned[key].length === 0) {
delete cleaned[key];
}
@ -307,7 +307,7 @@ export const useContactDetails = (contactId) => {
const cleanNoteFilter = (filter) => {
const cleaned = { ...filter };
["bucketIds", "contactCategories"].forEach((key) => {
["createdByIds", "organizations"].forEach((key) => {
if (Array.isArray(cleaned[key]) && cleaned[key].length === 0) {
delete cleaned[key];
}

View File

@ -42,14 +42,14 @@ const ContactFilterPanel = ({ onApply, clearFilter }) => {
<form onSubmit={handleSubmit(onSubmit)} className="p-2 text-start">
<div className="row g-2">
<SelectMultiple
name="buckets"
name="bucketIds"
label="Buckets :"
options={data.buckets}
labelKey="name"
valueKey="id"
/>
<SelectMultiple
name="contactCategories"
name="categoryIds"
label="Contact Category :"
options={data.contactCategories}
labelKey={(item) => item.name}

View File

@ -42,7 +42,7 @@ const NoteFilterPanel = ({ onApply, clearFilter }) => {
<form onSubmit={handleSubmit(onSubmit)} className="p-2 text-start">
<div className="row g-2">
<SelectMultiple
name="createdBy"
name="createdByIds"
label="Created By :"
options={data.createdBy}
labelKey="name"

View File

@ -62,5 +62,5 @@ export const DirectoryRepository = {
)}&searchString=${encodeURIComponent(searchString)}`
);
},
GetNoteFilter:()=>api.get("/api/Directory/notes/filter")
GetNoteFilter:()=>api.get("/api/directory/notes/filter")
};