rez-table-listing-mui 1.3.39 → 1.3.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/listing/components/common/saved-filter-modal/index.tsx +517 -0
- package/src/listing/components/filter/components/forms/components/Filter-criteria.tsx +4 -1
- package/src/listing/components/filter/components/forms/components/filter-criteria-list.tsx +1 -0
- package/src/listing/components/filter/components/forms/index.tsx +23 -14
- package/src/listing/components/filter/components/main-filter.tsx +6 -6
- package/src/listing/components/filter/components/saved-edit-filter.tsx +5 -3
- package/src/listing/components/filter/components/saved-filter.tsx +300 -124
- package/src/listing/components/filter/components/search/index.tsx +1 -0
- package/src/listing/components/filter/components/single-filter-rendering.tsx +3 -3
- package/src/listing/components/filter/index.tsx +130 -5
- package/src/listing/components/login/index.tsx +3 -6
- package/src/listing/libs/hooks/useEntityTableAPI.tsx +3 -0
- package/src/listing/libs/utils/common.ts +1 -0
- package/src/listing/types/filter.ts +48 -1
- package/src/view/FIlterWrapper.tsx +15 -0
- package/src/view/ListingView.tsx +1 -1
- package/dist/index.d.ts +0 -563
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -2
- package/dist/index.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeEvent,
|
|
3
|
+
Dispatch,
|
|
4
|
+
SetStateAction,
|
|
5
|
+
useEffect,
|
|
6
|
+
useState,
|
|
7
|
+
} from "react";
|
|
8
|
+
import {
|
|
9
|
+
Box,
|
|
10
|
+
Button,
|
|
11
|
+
Checkbox,
|
|
12
|
+
Dialog,
|
|
13
|
+
DialogContent,
|
|
14
|
+
DialogTitle,
|
|
15
|
+
Divider,
|
|
16
|
+
FormControlLabel,
|
|
17
|
+
IconButton,
|
|
18
|
+
TextField,
|
|
19
|
+
Typography,
|
|
20
|
+
} from "@mui/material";
|
|
21
|
+
import { CloseIcon } from "../../../../assets/svg";
|
|
22
|
+
import {
|
|
23
|
+
FilterFormComponentProps,
|
|
24
|
+
FilterMasterStateProps,
|
|
25
|
+
} from "../../../types/filter";
|
|
26
|
+
import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
|
|
27
|
+
import { USER_ID } from "../../../libs/utils/common";
|
|
28
|
+
// import { set } from "react-hook-form";
|
|
29
|
+
|
|
30
|
+
const primary = "#7A5AF8";
|
|
31
|
+
|
|
32
|
+
interface SavedFilterModalViewProps {
|
|
33
|
+
open: boolean;
|
|
34
|
+
onClose: () => void;
|
|
35
|
+
onSave: () => void;
|
|
36
|
+
filterMaster: FilterMasterStateProps | null;
|
|
37
|
+
setFilterMaster: Dispatch<SetStateAction<FilterMasterStateProps | null>>;
|
|
38
|
+
columnsData: FilterFormComponentProps | undefined;
|
|
39
|
+
hasSavedFilters?: boolean;
|
|
40
|
+
forceShowSharingControls?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const SavedFilterModalView = ({
|
|
44
|
+
open,
|
|
45
|
+
onClose,
|
|
46
|
+
onSave,
|
|
47
|
+
filterMaster,
|
|
48
|
+
setFilterMaster,
|
|
49
|
+
columnsData,
|
|
50
|
+
|
|
51
|
+
forceShowSharingControls = false,
|
|
52
|
+
}: SavedFilterModalViewProps) => {
|
|
53
|
+
const [shareWithTeam, setShareWithTeam] = useState<boolean>(false);
|
|
54
|
+
const [allowTeamEdit, setAllowTeamEdit] = useState<boolean>(false);
|
|
55
|
+
const filterNameValue = filterMaster?.saved_filters?.selectedName ?? "";
|
|
56
|
+
const discriptionValue = filterMaster?.saved_filters?.description ?? "";
|
|
57
|
+
|
|
58
|
+
const isSaveDisabled =
|
|
59
|
+
!filterNameValue.trim() || (allowTeamEdit && !shareWithTeam);
|
|
60
|
+
|
|
61
|
+
const selectedFilterId = filterMaster?.saved_filters?.selectedId || "";
|
|
62
|
+
|
|
63
|
+
// Reset modal state when modal opens for a new filter
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!open) return;
|
|
66
|
+
|
|
67
|
+
const filterId = filterMaster?.saved_filters?.selectedId;
|
|
68
|
+
const filterObj1 = columnsData?.shared_filter?.find(
|
|
69
|
+
(f: any) => f.id === filterId
|
|
70
|
+
);
|
|
71
|
+
// NEW FILTER → RESET everything
|
|
72
|
+
if (!filterId && !filterObj1) {
|
|
73
|
+
setFilterMaster((prev: any) => {
|
|
74
|
+
if (!prev) return prev;
|
|
75
|
+
return {
|
|
76
|
+
...prev,
|
|
77
|
+
saved_filters: {
|
|
78
|
+
...(prev.saved_filters ?? {}),
|
|
79
|
+
selectedId: null,
|
|
80
|
+
selectedName: "",
|
|
81
|
+
description: "",
|
|
82
|
+
is_shared: false,
|
|
83
|
+
is_editable: false,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
setShareWithTeam(false);
|
|
88
|
+
setAllowTeamEdit(false);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// EXISTING FILTER → Load from columnsData.saved_filter
|
|
93
|
+
const filterObj = columnsData?.shared_filter?.find(
|
|
94
|
+
(f: any) => f.id === filterId
|
|
95
|
+
);
|
|
96
|
+
if (filterObj) {
|
|
97
|
+
setFilterMaster((prev) => {
|
|
98
|
+
if (!prev) return prev;
|
|
99
|
+
return {
|
|
100
|
+
...prev,
|
|
101
|
+
saved_filters: {
|
|
102
|
+
...(prev.saved_filters ?? {}),
|
|
103
|
+
selectedId: filterId,
|
|
104
|
+
selectedName: filterObj.name || "",
|
|
105
|
+
description: filterObj.description || "",
|
|
106
|
+
is_shared: filterObj.is_shared || false,
|
|
107
|
+
is_editable: filterObj.is_editable === "true",
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
// const initialShare = filterObj.is_shared ?? false;
|
|
112
|
+
// const initialAllow = initialShare
|
|
113
|
+
// ? filterObj.is_editable === "true"
|
|
114
|
+
// : false;
|
|
115
|
+
// setShareWithTeam(initialShare);
|
|
116
|
+
// setAllowTeamEdit(initialAllow);
|
|
117
|
+
const initialShare =
|
|
118
|
+
filterObj.is_shared === true || filterObj.is_shared === "true";
|
|
119
|
+
const initialAllow =
|
|
120
|
+
initialShare &&
|
|
121
|
+
(filterObj.is_editable === true || filterObj.is_editable === "true");
|
|
122
|
+
|
|
123
|
+
setShareWithTeam(initialShare);
|
|
124
|
+
setAllowTeamEdit(initialAllow);
|
|
125
|
+
|
|
126
|
+
persistPreferences(initialShare, initialAllow);
|
|
127
|
+
}
|
|
128
|
+
}, [
|
|
129
|
+
open,
|
|
130
|
+
columnsData,
|
|
131
|
+
filterMaster?.saved_filters?.selectedId,
|
|
132
|
+
setFilterMaster,
|
|
133
|
+
]); // Added dependencies for loading
|
|
134
|
+
|
|
135
|
+
// Persist toggle state to filterMaster
|
|
136
|
+
const persistPreferences = (sharedValue: boolean, editableValue: boolean) => {
|
|
137
|
+
setFilterMaster((prev) => {
|
|
138
|
+
if (!prev) return prev;
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
...prev,
|
|
142
|
+
saved_filters: {
|
|
143
|
+
...(prev.saved_filters ?? {}),
|
|
144
|
+
is_shared: sharedValue,
|
|
145
|
+
is_editable: editableValue,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Handle Share Toggle
|
|
152
|
+
|
|
153
|
+
const handleShareToggle = (
|
|
154
|
+
_: ChangeEvent<HTMLInputElement>,
|
|
155
|
+
checked: boolean
|
|
156
|
+
) => {
|
|
157
|
+
setShareWithTeam(checked);
|
|
158
|
+
|
|
159
|
+
const nextAllow = checked ? allowTeamEdit : false;
|
|
160
|
+
setAllowTeamEdit(nextAllow);
|
|
161
|
+
|
|
162
|
+
persistPreferences(checked, nextAllow);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Handle Allow Edit Toggle
|
|
166
|
+
|
|
167
|
+
const handleAllowEditToggle = (
|
|
168
|
+
_: ChangeEvent<HTMLInputElement>,
|
|
169
|
+
checked: boolean
|
|
170
|
+
) => {
|
|
171
|
+
if (!shareWithTeam) return; // Cannot enable edit without sharing
|
|
172
|
+
|
|
173
|
+
setAllowTeamEdit(checked);
|
|
174
|
+
persistPreferences(shareWithTeam, checked);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const shouldShowSharingControls = forceShowSharingControls || true; // always show
|
|
178
|
+
|
|
179
|
+
const getModalTitle = () => {
|
|
180
|
+
const selectedId = filterMaster?.saved_filters?.selectedId;
|
|
181
|
+
|
|
182
|
+
if (!selectedId) return "Save Filter"; // new filter
|
|
183
|
+
|
|
184
|
+
const filterObj = columnsData?.shared_filter?.find(
|
|
185
|
+
(f: any) => f.id === selectedId
|
|
186
|
+
);
|
|
187
|
+
if (filterObj?.is_shared) {
|
|
188
|
+
return "Shared Filter";
|
|
189
|
+
}
|
|
190
|
+
return "My Filter";
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const handleSave = () => {
|
|
194
|
+
persistPreferences(shareWithTeam, allowTeamEdit);
|
|
195
|
+
onSave(); // call original save handler
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// Get the selected filter object from columnsData.saved_filter
|
|
199
|
+
const selectedFilter = columnsData?.shared_filter?.find(
|
|
200
|
+
(f: any) => f.id === selectedFilterId
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
const selectedSavedFilter = columnsData?.shared_filter?.find(
|
|
204
|
+
(f: any) => f.id === selectedFilterId
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
const isOwner = String(selectedSavedFilter?.is_owner) === "true";
|
|
208
|
+
|
|
209
|
+
// Check if we should show prefields
|
|
210
|
+
const showPrefields =
|
|
211
|
+
(selectedSavedFilter && selectedSavedFilter.is_editable === "true") ||
|
|
212
|
+
selectedSavedFilter;
|
|
213
|
+
|
|
214
|
+
// Disable checkboxes if prefields are shown
|
|
215
|
+
const showCheckboxes = !showPrefields;
|
|
216
|
+
|
|
217
|
+
const isNewFilter = !selectedSavedFilter;
|
|
218
|
+
|
|
219
|
+
const isshow = isOwner;
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<Dialog open={open} onClose={onClose} maxWidth="sm" fullWidth>
|
|
223
|
+
<DialogTitle sx={{ display: "flex", justifyContent: "space-between" }}>
|
|
224
|
+
<Typography fontSize={18} fontWeight={600} marginTop={1}>
|
|
225
|
+
{getModalTitle()}
|
|
226
|
+
</Typography>
|
|
227
|
+
<Box onClick={onClose} sx={{ cursor: "pointer" }}>
|
|
228
|
+
<CloseIcon />
|
|
229
|
+
</Box>
|
|
230
|
+
</DialogTitle>
|
|
231
|
+
|
|
232
|
+
<Divider sx={{ mx: "25px", my: "2px", bgcolor: "#f9f7f727" }} />
|
|
233
|
+
|
|
234
|
+
<DialogContent sx={{ pt: 0 }}>
|
|
235
|
+
<Typography my={1} fontSize={"14px"}>
|
|
236
|
+
Give a name to this filter so you can easily reuse it later.
|
|
237
|
+
</Typography>
|
|
238
|
+
{/* Filter Name */}
|
|
239
|
+
<Typography mt={2} fontSize={11}>
|
|
240
|
+
Filter Name
|
|
241
|
+
</Typography>
|
|
242
|
+
<TextField
|
|
243
|
+
fullWidth
|
|
244
|
+
size="small"
|
|
245
|
+
value={filterNameValue}
|
|
246
|
+
onChange={(e) =>
|
|
247
|
+
setFilterMaster((prev) => {
|
|
248
|
+
if (!prev) return prev;
|
|
249
|
+
return {
|
|
250
|
+
...prev,
|
|
251
|
+
saved_filters: {
|
|
252
|
+
...(prev.saved_filters ?? {}),
|
|
253
|
+
selectedName: e.target.value,
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
})
|
|
257
|
+
}
|
|
258
|
+
sx={{
|
|
259
|
+
mb: 0,
|
|
260
|
+
"& .MuiOutlinedInput-root": {
|
|
261
|
+
width: "50%",
|
|
262
|
+
"& fieldset": { borderColor: "#888" },
|
|
263
|
+
"&:hover fieldset": { borderColor: "black" },
|
|
264
|
+
"&.Mui-focused fieldset": { borderColor: primary },
|
|
265
|
+
"& .MuiInputBase-input": { fontSize: "12px" },
|
|
266
|
+
},
|
|
267
|
+
}}
|
|
268
|
+
/>
|
|
269
|
+
{/* Description */}
|
|
270
|
+
<Typography mt={2} fontSize={11}>
|
|
271
|
+
Description
|
|
272
|
+
</Typography>
|
|
273
|
+
<TextField
|
|
274
|
+
fullWidth
|
|
275
|
+
minRows={3}
|
|
276
|
+
value={discriptionValue}
|
|
277
|
+
size="small"
|
|
278
|
+
sx={{
|
|
279
|
+
mb: 1,
|
|
280
|
+
"& .MuiOutlinedInput-root": {
|
|
281
|
+
"& fieldset": { borderColor: "#888" },
|
|
282
|
+
"&:hover fieldset": { borderColor: "black" },
|
|
283
|
+
"&.Mui-focused fieldset": { borderColor: primary },
|
|
284
|
+
},
|
|
285
|
+
}}
|
|
286
|
+
onChange={(e) =>
|
|
287
|
+
setFilterMaster((prev) => {
|
|
288
|
+
if (!prev) return prev;
|
|
289
|
+
return {
|
|
290
|
+
...prev,
|
|
291
|
+
saved_filters: {
|
|
292
|
+
...(prev.saved_filters ?? {}),
|
|
293
|
+
description: e.target.value,
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
})
|
|
297
|
+
}
|
|
298
|
+
/>
|
|
299
|
+
<Typography sx={{ mb: 1, fontSize: 12, color: "#888" }}>
|
|
300
|
+
(Max. 300 Characters)
|
|
301
|
+
</Typography>
|
|
302
|
+
{/* Sharing Controls */}
|
|
303
|
+
{shouldShowSharingControls && (showCheckboxes || isshow) && (
|
|
304
|
+
<Box
|
|
305
|
+
sx={{
|
|
306
|
+
display: "flex",
|
|
307
|
+
flexDirection: "column",
|
|
308
|
+
gap: 0.5,
|
|
309
|
+
"& .MuiFormControlLabel-label": { fontSize: "14px" },
|
|
310
|
+
}}
|
|
311
|
+
>
|
|
312
|
+
<FormControlLabel
|
|
313
|
+
control={
|
|
314
|
+
<Checkbox
|
|
315
|
+
size="small"
|
|
316
|
+
checked={shareWithTeam}
|
|
317
|
+
onChange={handleShareToggle}
|
|
318
|
+
sx={{
|
|
319
|
+
color: "black",
|
|
320
|
+
"&.Mui-checked": { color: "black" },
|
|
321
|
+
}}
|
|
322
|
+
/>
|
|
323
|
+
}
|
|
324
|
+
label="Share with team member."
|
|
325
|
+
/>
|
|
326
|
+
|
|
327
|
+
{shareWithTeam && (
|
|
328
|
+
<FormControlLabel
|
|
329
|
+
control={
|
|
330
|
+
<Checkbox
|
|
331
|
+
size="small"
|
|
332
|
+
checked={allowTeamEdit}
|
|
333
|
+
onChange={handleAllowEditToggle}
|
|
334
|
+
sx={{
|
|
335
|
+
color: "black",
|
|
336
|
+
"&.Mui-checked": { color: "black" },
|
|
337
|
+
}}
|
|
338
|
+
/>
|
|
339
|
+
}
|
|
340
|
+
label="Allow editing to Team member"
|
|
341
|
+
/>
|
|
342
|
+
)}
|
|
343
|
+
</Box>
|
|
344
|
+
)}
|
|
345
|
+
{/* prefields */}
|
|
346
|
+
{showPrefields && !isshow && (
|
|
347
|
+
<Box
|
|
348
|
+
sx={{
|
|
349
|
+
display: "grid",
|
|
350
|
+
gridTemplateColumns: "1fr 1fr",
|
|
351
|
+
gap: 3,
|
|
352
|
+
mt: 2,
|
|
353
|
+
}}
|
|
354
|
+
>
|
|
355
|
+
<Box>
|
|
356
|
+
<Typography
|
|
357
|
+
sx={{
|
|
358
|
+
fontSize: "14px",
|
|
359
|
+
fontWeight: 500,
|
|
360
|
+
color: "#6b6b6b",
|
|
361
|
+
mb: 0.5,
|
|
362
|
+
}}
|
|
363
|
+
>
|
|
364
|
+
Created On*
|
|
365
|
+
</Typography>
|
|
366
|
+
|
|
367
|
+
<TextField
|
|
368
|
+
fullWidth
|
|
369
|
+
size="small"
|
|
370
|
+
value={
|
|
371
|
+
selectedFilter?.created_date
|
|
372
|
+
? new Date(selectedFilter.created_date).toLocaleString()
|
|
373
|
+
: ""
|
|
374
|
+
} // format date
|
|
375
|
+
InputProps={{
|
|
376
|
+
readOnly: true,
|
|
377
|
+
endAdornment: (
|
|
378
|
+
<IconButton size="small">
|
|
379
|
+
<CalendarTodayIcon fontSize="small" />
|
|
380
|
+
</IconButton>
|
|
381
|
+
),
|
|
382
|
+
sx: {
|
|
383
|
+
backgroundColor: "#0E0C0B0F",
|
|
384
|
+
borderRadius: "4px",
|
|
385
|
+
},
|
|
386
|
+
}}
|
|
387
|
+
/>
|
|
388
|
+
</Box>
|
|
389
|
+
|
|
390
|
+
<Box>
|
|
391
|
+
<Typography
|
|
392
|
+
sx={{
|
|
393
|
+
fontSize: "14px",
|
|
394
|
+
fontWeight: 500,
|
|
395
|
+
color: "#6b6b6b",
|
|
396
|
+
mb: 0.5,
|
|
397
|
+
}}
|
|
398
|
+
>
|
|
399
|
+
Created By*
|
|
400
|
+
</Typography>
|
|
401
|
+
<TextField
|
|
402
|
+
fullWidth
|
|
403
|
+
size="small"
|
|
404
|
+
value={selectedFilter?.created_by || ""}
|
|
405
|
+
InputProps={{
|
|
406
|
+
readOnly: true,
|
|
407
|
+
sx: {
|
|
408
|
+
backgroundColor: "#0E0C0B0F",
|
|
409
|
+
borderRadius: "4px",
|
|
410
|
+
},
|
|
411
|
+
}}
|
|
412
|
+
/>
|
|
413
|
+
</Box>
|
|
414
|
+
|
|
415
|
+
<Box>
|
|
416
|
+
<Typography
|
|
417
|
+
sx={{
|
|
418
|
+
fontSize: "14px",
|
|
419
|
+
fontWeight: 500,
|
|
420
|
+
color: "#6b6b6b",
|
|
421
|
+
mb: 0.5,
|
|
422
|
+
}}
|
|
423
|
+
>
|
|
424
|
+
Modified On*
|
|
425
|
+
</Typography>
|
|
426
|
+
|
|
427
|
+
<TextField
|
|
428
|
+
fullWidth
|
|
429
|
+
size="small"
|
|
430
|
+
value={
|
|
431
|
+
selectedFilter?.modified_date
|
|
432
|
+
? new Date(selectedFilter.modified_date).toLocaleString()
|
|
433
|
+
: ""
|
|
434
|
+
}
|
|
435
|
+
InputProps={{
|
|
436
|
+
readOnly: true,
|
|
437
|
+
endAdornment: (
|
|
438
|
+
<IconButton size="small">
|
|
439
|
+
<CalendarTodayIcon fontSize="small" />
|
|
440
|
+
</IconButton>
|
|
441
|
+
),
|
|
442
|
+
|
|
443
|
+
sx: {
|
|
444
|
+
backgroundColor: "#0E0C0B0F",
|
|
445
|
+
borderRadius: "4px",
|
|
446
|
+
},
|
|
447
|
+
}}
|
|
448
|
+
/>
|
|
449
|
+
</Box>
|
|
450
|
+
|
|
451
|
+
<Box>
|
|
452
|
+
<Typography
|
|
453
|
+
sx={{
|
|
454
|
+
fontSize: "14px",
|
|
455
|
+
fontWeight: 500,
|
|
456
|
+
color: "#6b6b6b",
|
|
457
|
+
mb: 0.5,
|
|
458
|
+
}}
|
|
459
|
+
>
|
|
460
|
+
Modified By*
|
|
461
|
+
</Typography>
|
|
462
|
+
<TextField
|
|
463
|
+
fullWidth
|
|
464
|
+
size="small"
|
|
465
|
+
value={selectedFilter?.modified_by || ""}
|
|
466
|
+
InputProps={{
|
|
467
|
+
readOnly: true,
|
|
468
|
+
sx: {
|
|
469
|
+
backgroundColor: "#0E0C0B0F",
|
|
470
|
+
borderRadius: "4px",
|
|
471
|
+
},
|
|
472
|
+
}}
|
|
473
|
+
/>
|
|
474
|
+
</Box>
|
|
475
|
+
</Box>
|
|
476
|
+
)}
|
|
477
|
+
{/* Buttons */}
|
|
478
|
+
<Box
|
|
479
|
+
sx={{ display: "flex", justifyContent: "flex-end", gap: 1, mt: 3 }}
|
|
480
|
+
>
|
|
481
|
+
<Button
|
|
482
|
+
variant="outlined"
|
|
483
|
+
onClick={onClose}
|
|
484
|
+
sx={{
|
|
485
|
+
borderColor: primary,
|
|
486
|
+
color: primary,
|
|
487
|
+
"&:hover": {
|
|
488
|
+
borderColor: primary,
|
|
489
|
+
backgroundColor: "rgba(122, 90, 248, 0.04)",
|
|
490
|
+
},
|
|
491
|
+
}}
|
|
492
|
+
>
|
|
493
|
+
Cancel
|
|
494
|
+
</Button>
|
|
495
|
+
|
|
496
|
+
<Button
|
|
497
|
+
variant="contained"
|
|
498
|
+
onClick={handleSave}
|
|
499
|
+
disabled={isSaveDisabled}
|
|
500
|
+
sx={{
|
|
501
|
+
backgroundColor: primary,
|
|
502
|
+
"&:hover": { backgroundColor: "#6A4DE8" },
|
|
503
|
+
"&.Mui-disabled": {
|
|
504
|
+
backgroundColor: "#d7cefd",
|
|
505
|
+
color: "rgba(255, 255, 255, 0.7)",
|
|
506
|
+
},
|
|
507
|
+
}}
|
|
508
|
+
>
|
|
509
|
+
Save
|
|
510
|
+
</Button>
|
|
511
|
+
</Box>
|
|
512
|
+
</DialogContent>
|
|
513
|
+
</Dialog>
|
|
514
|
+
);
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
export default SavedFilterModalView;
|
|
@@ -144,11 +144,14 @@ const FilterCriteria = ({
|
|
|
144
144
|
>
|
|
145
145
|
<Box
|
|
146
146
|
sx={{
|
|
147
|
-
maxHeight:
|
|
147
|
+
maxHeight: filterMaster?.saved_filters?.selectedId
|
|
148
|
+
? `calc(100vh - 601px)`
|
|
149
|
+
: `calc(100vh - 440px)`,
|
|
148
150
|
overflowY: "auto",
|
|
149
151
|
width: "100%",
|
|
150
152
|
...filterStyles.scrollbarCustom,
|
|
151
153
|
}}
|
|
154
|
+
className="filter-criteria-list-box"
|
|
152
155
|
>
|
|
153
156
|
{selectedFilterEntity ? (
|
|
154
157
|
<FilterCriteriaList
|
|
@@ -36,7 +36,7 @@ const FilterForm = ({
|
|
|
36
36
|
handleRemoveFilter,
|
|
37
37
|
editMode = false,
|
|
38
38
|
tableStates,
|
|
39
|
-
|
|
39
|
+
onSaveFilterButtonClick,
|
|
40
40
|
setDeleteFilterModalOpen,
|
|
41
41
|
onChangeFunction,
|
|
42
42
|
filterComponentOptions,
|
|
@@ -48,7 +48,7 @@ const FilterForm = ({
|
|
|
48
48
|
handleRemoveFilter: (filter_attribute: string) => void;
|
|
49
49
|
editMode?: boolean;
|
|
50
50
|
tableStates: CraftTableOptionsProps;
|
|
51
|
-
|
|
51
|
+
onSaveFilterButtonClick?: () => void;
|
|
52
52
|
setDeleteFilterModalOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
53
53
|
onChangeFunction: ({
|
|
54
54
|
updatedFilters,
|
|
@@ -67,6 +67,7 @@ const FilterForm = ({
|
|
|
67
67
|
filterComponentOptions?.tabOptions?.mainFilter?.customButtons;
|
|
68
68
|
|
|
69
69
|
const filterName = filterMaster?.saved_filters?.selectedName || "";
|
|
70
|
+
const isOwner = filterMaster?.saved_filters?.is_owner || false;
|
|
70
71
|
|
|
71
72
|
const defaultValues = useMemo(() => {
|
|
72
73
|
const filterValues = filters?.reduce((acc, curr) => {
|
|
@@ -252,22 +253,30 @@ const FilterForm = ({
|
|
|
252
253
|
/>
|
|
253
254
|
)}
|
|
254
255
|
/>
|
|
255
|
-
|
|
256
|
-
<
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
256
|
+
{isOwner && (
|
|
257
|
+
<Box onClick={(e) => e.stopPropagation()}>
|
|
258
|
+
<IconButton
|
|
259
|
+
size="small"
|
|
260
|
+
onClick={() =>
|
|
261
|
+
setDeleteFilterModalOpen && setDeleteFilterModalOpen(true)
|
|
262
|
+
}
|
|
263
|
+
>
|
|
264
|
+
<DeleteIcon />
|
|
265
|
+
</IconButton>
|
|
266
|
+
</Box>
|
|
267
|
+
)}
|
|
265
268
|
</Box>
|
|
266
269
|
)}
|
|
267
270
|
|
|
268
271
|
<Box
|
|
269
272
|
className="filter-criteria-form"
|
|
270
|
-
sx={
|
|
273
|
+
sx={{
|
|
274
|
+
...filterFormStyles.formFlexContainer,
|
|
275
|
+
...(editMode && {
|
|
276
|
+
maxHeight: "calc(100vh - 570px)",
|
|
277
|
+
overflowY: "auto",
|
|
278
|
+
}),
|
|
279
|
+
}}
|
|
271
280
|
>
|
|
272
281
|
<FilterCriteria
|
|
273
282
|
columnsData={columnsData}
|
|
@@ -442,7 +451,7 @@ const FilterForm = ({
|
|
|
442
451
|
},
|
|
443
452
|
}}
|
|
444
453
|
onClick={() => {
|
|
445
|
-
|
|
454
|
+
onSaveFilterButtonClick && onSaveFilterButtonClick();
|
|
446
455
|
}}
|
|
447
456
|
>
|
|
448
457
|
Save Filter
|
|
@@ -11,7 +11,7 @@ const MainFilter = ({
|
|
|
11
11
|
columnsData,
|
|
12
12
|
dropdownData,
|
|
13
13
|
tableStates,
|
|
14
|
-
|
|
14
|
+
onSaveFilterButtonClick,
|
|
15
15
|
onChangeFunction,
|
|
16
16
|
filterComponentOptions,
|
|
17
17
|
}: FilterFormComponentProps) => {
|
|
@@ -22,10 +22,10 @@ const MainFilter = ({
|
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
setFilterMaster(
|
|
24
24
|
(prev) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
({
|
|
26
|
+
...prev,
|
|
27
|
+
activeFilterTabIndex: 0,
|
|
28
|
+
} as FilterMasterStateProps)
|
|
29
29
|
);
|
|
30
30
|
}, []);
|
|
31
31
|
|
|
@@ -61,7 +61,7 @@ const MainFilter = ({
|
|
|
61
61
|
setSearchTerm={setSearchTerm}
|
|
62
62
|
handleRemoveFilter={handleRemoveFilter}
|
|
63
63
|
tableStates={tableStates}
|
|
64
|
-
|
|
64
|
+
onSaveFilterButtonClick={onSaveFilterButtonClick}
|
|
65
65
|
dropdownData={dropdownData}
|
|
66
66
|
onChangeFunction={onChangeFunction}
|
|
67
67
|
filterComponentOptions={filterComponentOptions}
|
|
@@ -18,7 +18,7 @@ const SavedFilterEditComponent = ({
|
|
|
18
18
|
setEditMode,
|
|
19
19
|
searchTerm,
|
|
20
20
|
setSearchTerm,
|
|
21
|
-
|
|
21
|
+
onSaveFilterButtonClick,
|
|
22
22
|
setDeleteFilterModalOpen,
|
|
23
23
|
onChangeFunction,
|
|
24
24
|
filterComponentOptions,
|
|
@@ -30,7 +30,7 @@ const SavedFilterEditComponent = ({
|
|
|
30
30
|
setEditMode?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
31
31
|
searchTerm?: string;
|
|
32
32
|
setSearchTerm: React.Dispatch<React.SetStateAction<string>>;
|
|
33
|
-
|
|
33
|
+
onSaveFilterButtonClick?: () => void;
|
|
34
34
|
setDeleteFilterModalOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
35
35
|
onChangeFunction: ({
|
|
36
36
|
updatedFilters,
|
|
@@ -62,6 +62,8 @@ const SavedFilterEditComponent = ({
|
|
|
62
62
|
selectedId: "",
|
|
63
63
|
selectedName: "",
|
|
64
64
|
selectedCode: "",
|
|
65
|
+
shareWithTeam: false,
|
|
66
|
+
allowTeamEdit: false,
|
|
65
67
|
},
|
|
66
68
|
activeFilterTabIndex: -1,
|
|
67
69
|
} as FilterMasterStateProps)
|
|
@@ -99,7 +101,7 @@ const SavedFilterEditComponent = ({
|
|
|
99
101
|
dropdownData={dropdownData}
|
|
100
102
|
searchTerm={searchTerm}
|
|
101
103
|
setSearchTerm={setSearchTerm}
|
|
102
|
-
|
|
104
|
+
onSaveFilterButtonClick={onSaveFilterButtonClick}
|
|
103
105
|
setDeleteFilterModalOpen={setDeleteFilterModalOpen}
|
|
104
106
|
onChangeFunction={onChangeFunction}
|
|
105
107
|
filterComponentOptions={filterComponentOptions}
|