rez-table-listing-mui 1.2.14 → 1.2.16
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/dist/index.d.ts +8 -110
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/kanban/components/LeadCard.tsx +1 -1
- package/src/kanban/hooks/hooks.ts +2 -2
- package/src/kanban/index.tsx +50 -41
- package/src/kanban/services/service.ts +1 -1
- package/src/kanban/types/types.ts +22 -95
- package/src/listing/components/common/index.scss +1 -1
- package/src/listing/components/index.scss +0 -2
- package/src/listing/components/table-head-dnd-cell.tsx +5 -5
- package/src/listing/components/table-head.tsx +5 -5
- package/src/listing/components/table-settings/components/column.tsx +0 -5
- package/src/listing/components/table-settings/components/group-by.tsx +511 -0
- package/src/listing/components/table-settings/components/lane.tsx +510 -0
- package/src/listing/components/table-settings/components/sorting.tsx +0 -2
- package/src/listing/components/table-settings/constants.ts +12 -0
- package/src/listing/components/table-settings/index.tsx +61 -29
- package/src/listing/components/tabs/index.scss +1 -1
- package/src/listing/libs/hooks/useDefaultColumns.tsx +0 -1
- package/src/listing/libs/hooks/useEntityTableAPI.tsx +0 -1
- package/src/listing/libs/utils/common.ts +1 -4
- package/src/listing/types/filter-settings.ts +1 -0
- package/src/view/KanbanView.tsx +58 -6
- package/src/view/ListingView.tsx +1 -3
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ import PhoneOutlinedIcon from "@mui/icons-material/PhoneOutlined";
|
|
|
13
13
|
import EmailOutlinedIcon from "@mui/icons-material/EmailOutlined";
|
|
14
14
|
import { kanbanStyles } from "../styles/styles";
|
|
15
15
|
|
|
16
|
-
const LeadCard = ({ lead }: LeadCardProps) => {
|
|
16
|
+
const LeadCard = ({ cardData: lead }: LeadCardProps) => {
|
|
17
17
|
const formatEnquiryDate = (enquiryDate: string | null) => {
|
|
18
18
|
if (!enquiryDate) return "N/A";
|
|
19
19
|
const date = new Date(enquiryDate);
|
|
@@ -3,7 +3,7 @@ import { getKanbanData } from "../services/service";
|
|
|
3
3
|
|
|
4
4
|
export const useGetKanbanData = (entity_type: string) => {
|
|
5
5
|
const {
|
|
6
|
-
data:
|
|
6
|
+
data: metaData,
|
|
7
7
|
isPending,
|
|
8
8
|
isLoading,
|
|
9
9
|
error,
|
|
@@ -12,5 +12,5 @@ export const useGetKanbanData = (entity_type: string) => {
|
|
|
12
12
|
queryFn: () => getKanbanData(entity_type),
|
|
13
13
|
enabled: !!entity_type, // Only fetch when workflowId is valid
|
|
14
14
|
});
|
|
15
|
-
return {
|
|
15
|
+
return { metaData, isPending, isLoading, error };
|
|
16
16
|
};
|
package/src/kanban/index.tsx
CHANGED
|
@@ -6,33 +6,35 @@ import {
|
|
|
6
6
|
AccordionSummary,
|
|
7
7
|
AccordionDetails,
|
|
8
8
|
IconButton,
|
|
9
|
-
Badge,
|
|
10
9
|
} from "@mui/material";
|
|
11
10
|
import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined";
|
|
12
11
|
import {
|
|
13
|
-
Add,
|
|
14
12
|
ExpandMore as ExpandMoreIcon,
|
|
15
13
|
Settings as SettingsIcon,
|
|
16
14
|
} from "@mui/icons-material";
|
|
17
15
|
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
18
|
-
import { useGetKanbanData } from "./hooks/hooks";
|
|
19
16
|
import { kanbanStyles } from "./styles/styles";
|
|
20
|
-
import
|
|
21
|
-
import { Lane, LeadData, SubLane, SwimLane } from "./types/types";
|
|
17
|
+
import { Lane, SubLane, SwimLane } from "./types/types";
|
|
22
18
|
import { COLOR_CONSTANTS } from "./constants/kanban-constants";
|
|
23
19
|
import Loader from "../listing/components/common/loader/loader";
|
|
24
20
|
|
|
25
21
|
const Kanban = ({
|
|
26
|
-
|
|
22
|
+
metaData,
|
|
23
|
+
data,
|
|
27
24
|
isLoading,
|
|
28
25
|
KanbanCardComponent,
|
|
26
|
+
showSettings,
|
|
27
|
+
onOpenSettings,
|
|
29
28
|
}: {
|
|
30
|
-
|
|
29
|
+
metaData: any;
|
|
30
|
+
data: any;
|
|
31
31
|
isLoading?: boolean;
|
|
32
32
|
KanbanCardComponent: React.ComponentType<{
|
|
33
33
|
key: string | number;
|
|
34
|
-
|
|
34
|
+
cardData: any;
|
|
35
35
|
}>;
|
|
36
|
+
showSettings: boolean;
|
|
37
|
+
onOpenSettings?: () => void;
|
|
36
38
|
}) => {
|
|
37
39
|
const [expandedPanels, setExpandedPanels] = useState<{
|
|
38
40
|
[key: string]: boolean;
|
|
@@ -45,9 +47,9 @@ const Kanban = ({
|
|
|
45
47
|
}>({});
|
|
46
48
|
|
|
47
49
|
useEffect(() => {
|
|
48
|
-
if (
|
|
50
|
+
if (metaData?.swim_lanes?.length) {
|
|
49
51
|
const initial: { [key: string]: boolean } = {};
|
|
50
|
-
|
|
52
|
+
metaData?.swim_lanes.forEach((swim_lane: SwimLane) => {
|
|
51
53
|
swim_lane?.sub_lanes?.forEach((sub_lane) => {
|
|
52
54
|
const key = `${swim_lane.id}-${sub_lane.lane_id}-${sub_lane.id}`;
|
|
53
55
|
initial[key] = sub_lane.expanded || false;
|
|
@@ -55,7 +57,7 @@ const Kanban = ({
|
|
|
55
57
|
});
|
|
56
58
|
setSubLaneExpanded(initial);
|
|
57
59
|
}
|
|
58
|
-
}, [
|
|
60
|
+
}, [metaData]);
|
|
59
61
|
|
|
60
62
|
const handleAccordionChange =
|
|
61
63
|
(panel: string) => (event: React.SyntheticEvent, isExpanded: boolean) => {
|
|
@@ -73,17 +75,17 @@ const Kanban = ({
|
|
|
73
75
|
};
|
|
74
76
|
|
|
75
77
|
const getLeadCount = (laneId: number): number => {
|
|
76
|
-
if (!
|
|
78
|
+
if (!metaData?.swim_lanes || !data) return 0;
|
|
77
79
|
|
|
78
80
|
const seenLeadIds = new Set<number | string>();
|
|
79
81
|
let count = 0;
|
|
80
82
|
|
|
81
|
-
|
|
83
|
+
metaData?.swim_lanes.forEach((swimLane: SwimLane) => {
|
|
82
84
|
swimLane.sub_lanes
|
|
83
85
|
?.filter((subLane) => subLane.lane_id === laneId)
|
|
84
86
|
?.forEach((subLane) => {
|
|
85
|
-
|
|
86
|
-
if (lead
|
|
87
|
+
data.forEach((lead: any) => {
|
|
88
|
+
if (lead?.stage_id === subLane?.id && !seenLeadIds.has(lead?.id)) {
|
|
87
89
|
seenLeadIds.add(lead.id);
|
|
88
90
|
count++;
|
|
89
91
|
}
|
|
@@ -103,7 +105,13 @@ const Kanban = ({
|
|
|
103
105
|
<Box sx={{ width: "100%", bgcolor: "white", overflowX: "auto" }}>
|
|
104
106
|
{/* Header */}
|
|
105
107
|
<Box sx={kanbanStyles.topHeader}>
|
|
106
|
-
<IconButton
|
|
108
|
+
<IconButton
|
|
109
|
+
onClick={onOpenSettings}
|
|
110
|
+
sx={{
|
|
111
|
+
...kanbanStyles.settingStyle,
|
|
112
|
+
visibility: showSettings ? "visible" : "hidden",
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
107
115
|
<SettingsOutlinedIcon />
|
|
108
116
|
</IconButton>
|
|
109
117
|
|
|
@@ -114,7 +122,7 @@ const Kanban = ({
|
|
|
114
122
|
flex: 1,
|
|
115
123
|
}}
|
|
116
124
|
>
|
|
117
|
-
{
|
|
125
|
+
{metaData?.lanes?.map((lane: Lane, index: number) => (
|
|
118
126
|
<Box
|
|
119
127
|
className="lane-header"
|
|
120
128
|
sx={{
|
|
@@ -156,7 +164,7 @@ const Kanban = ({
|
|
|
156
164
|
}}
|
|
157
165
|
>
|
|
158
166
|
{/* Swim Lanes */}
|
|
159
|
-
{
|
|
167
|
+
{metaData?.swim_lanes?.map((swim_lane: SwimLane) => (
|
|
160
168
|
<Accordion
|
|
161
169
|
key={swim_lane.id}
|
|
162
170
|
expanded={!!expandedPanels[swim_lane.name]}
|
|
@@ -189,7 +197,7 @@ const Kanban = ({
|
|
|
189
197
|
>
|
|
190
198
|
{/* Replaced Grid with Flex */}
|
|
191
199
|
<Box sx={{ ...kanbanStyles.syncingStyle, pl: 7 }}>
|
|
192
|
-
{
|
|
200
|
+
{metaData?.lanes?.map((lane: Lane, index: number) => (
|
|
193
201
|
<Box
|
|
194
202
|
className="column"
|
|
195
203
|
sx={{
|
|
@@ -211,10 +219,10 @@ const Kanban = ({
|
|
|
211
219
|
<Accordion
|
|
212
220
|
key={sub_section.id}
|
|
213
221
|
expanded={
|
|
214
|
-
|
|
215
|
-
(lead:
|
|
216
|
-
lead.
|
|
217
|
-
lead.
|
|
222
|
+
data?.filter(
|
|
223
|
+
(lead: any) =>
|
|
224
|
+
lead.stage_id === sub_section.id &&
|
|
225
|
+
lead.lead_status_id == swim_lane.id
|
|
218
226
|
)?.length === 0
|
|
219
227
|
? false
|
|
220
228
|
: subLaneExpanded[subLaneKey] || false
|
|
@@ -228,7 +236,7 @@ const Kanban = ({
|
|
|
228
236
|
}`,
|
|
229
237
|
}}
|
|
230
238
|
// disabled={
|
|
231
|
-
//
|
|
239
|
+
// metaData?.data?.filter(
|
|
232
240
|
// (lead: LeadData) =>
|
|
233
241
|
// lead.sub_lane_id === sub_section.id &&
|
|
234
242
|
// !usedLeadIds.has(lead.id)
|
|
@@ -242,11 +250,12 @@ const Kanban = ({
|
|
|
242
250
|
<ExpandMoreIcon
|
|
243
251
|
sx={{
|
|
244
252
|
display:
|
|
245
|
-
|
|
246
|
-
(lead:
|
|
247
|
-
lead.
|
|
253
|
+
data?.filter(
|
|
254
|
+
(lead: any) =>
|
|
255
|
+
lead.stage_id ===
|
|
248
256
|
sub_section.id &&
|
|
249
|
-
lead.
|
|
257
|
+
lead.lead_status_id ==
|
|
258
|
+
swim_lane.id
|
|
250
259
|
)?.length === 0
|
|
251
260
|
? "none"
|
|
252
261
|
: "block",
|
|
@@ -270,11 +279,10 @@ const Kanban = ({
|
|
|
270
279
|
.darkColor,
|
|
271
280
|
}}
|
|
272
281
|
>
|
|
273
|
-
{
|
|
274
|
-
(lead:
|
|
275
|
-
lead.
|
|
276
|
-
|
|
277
|
-
lead.lead_status === swim_lane.id
|
|
282
|
+
{data?.filter(
|
|
283
|
+
(lead: any) =>
|
|
284
|
+
lead.stage_id === sub_section.id &&
|
|
285
|
+
lead.lead_status_id === swim_lane.id
|
|
278
286
|
)?.length || 0}
|
|
279
287
|
</Box>
|
|
280
288
|
<Typography
|
|
@@ -292,19 +300,20 @@ const Kanban = ({
|
|
|
292
300
|
>
|
|
293
301
|
{(() => {
|
|
294
302
|
const leadsForThisSubLane =
|
|
295
|
-
|
|
296
|
-
(lead:
|
|
297
|
-
lead.
|
|
298
|
-
|
|
299
|
-
|
|
303
|
+
data?.filter(
|
|
304
|
+
(lead: any) =>
|
|
305
|
+
lead.stage_id === sub_section.id &&
|
|
306
|
+
lead.lead_status_id ==
|
|
307
|
+
swim_lane.id &&
|
|
308
|
+
lead.stage_group_id == lane.id
|
|
300
309
|
) || [];
|
|
301
310
|
|
|
302
311
|
return leadsForThisSubLane.map(
|
|
303
|
-
(
|
|
312
|
+
(card: any) =>
|
|
304
313
|
(KanbanCardComponent && (
|
|
305
314
|
<KanbanCardComponent
|
|
306
|
-
key={
|
|
307
|
-
|
|
315
|
+
key={card.id}
|
|
316
|
+
cardData={card}
|
|
308
317
|
/>
|
|
309
318
|
)) ||
|
|
310
319
|
null
|
|
@@ -2,7 +2,7 @@ import { api } from "../../listing/libs/utils/common";
|
|
|
2
2
|
|
|
3
3
|
export const getKanbanData = async (entity_type: string) => {
|
|
4
4
|
try {
|
|
5
|
-
const response = await api.get(`/lead/
|
|
5
|
+
const response = await api.get(`/lead/getlanes?entity_type=${entity_type}`);
|
|
6
6
|
return response.data;
|
|
7
7
|
} catch (error) {
|
|
8
8
|
console.error("Failed to fetch action category:", error);
|
|
@@ -1,130 +1,57 @@
|
|
|
1
1
|
export interface LeadCardProps {
|
|
2
2
|
key: string | number;
|
|
3
|
-
|
|
3
|
+
cardData: any;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
export interface LeadData {
|
|
7
7
|
id: string | number;
|
|
8
8
|
entity_type: string;
|
|
9
|
-
name: string
|
|
9
|
+
name: string;
|
|
10
10
|
status: string;
|
|
11
|
+
admission_grade: string;
|
|
12
|
+
status_id: string;
|
|
11
13
|
parent_type: string | null;
|
|
12
14
|
parent_id: string | null;
|
|
13
|
-
primary_email: string | null;
|
|
14
|
-
primary_mobile: string | null;
|
|
15
15
|
code: string;
|
|
16
16
|
created_by: string;
|
|
17
|
-
created_date: string;
|
|
18
|
-
modified_by: string
|
|
19
|
-
modified_date: string
|
|
20
|
-
enterprise_id: number;
|
|
21
|
-
organization_id: number;
|
|
17
|
+
created_date: string; // ISO datetime string
|
|
18
|
+
modified_by: string;
|
|
19
|
+
modified_date: string; // ISO datetime string
|
|
20
|
+
enterprise_id: number | string | null;
|
|
21
|
+
organization_id: number | string | null;
|
|
22
22
|
appcode: string | null;
|
|
23
|
-
level_id: string;
|
|
23
|
+
level_id: string | number;
|
|
24
24
|
level_type: string;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
last_name: string | null;
|
|
28
|
-
relationship_student: string | null;
|
|
29
|
-
phone_number: string | null;
|
|
30
|
-
email: string | null;
|
|
31
|
-
pin_code: string | null;
|
|
32
|
-
first_name_std: string | null;
|
|
33
|
-
last_name_std: string | null;
|
|
34
|
-
gender: string | null;
|
|
35
|
-
academic_year: string | null;
|
|
36
|
-
curr_grade: string | null;
|
|
37
|
-
source: string | null;
|
|
38
|
-
stage: string | null;
|
|
39
|
-
lead_owner: string | null;
|
|
40
|
-
lead_owner_name: string | null;
|
|
41
|
-
profile: {
|
|
42
|
-
signedUrl: string;
|
|
43
|
-
fileName: string;
|
|
44
|
-
id: string | number;
|
|
45
|
-
};
|
|
25
|
+
lead_owner: string;
|
|
26
|
+
student_first_name: string;
|
|
46
27
|
lead_source: string | null;
|
|
47
|
-
|
|
48
|
-
source_details: string | null;
|
|
28
|
+
enquiry_date: string; // format: DD-MM-YYYY
|
|
49
29
|
lead_status: string;
|
|
30
|
+
lead_status_id: string;
|
|
50
31
|
assigned_counselor: string | null;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
enrollment_timeline: string | null;
|
|
57
|
-
lead_temperature: string | null;
|
|
58
|
-
utm_source: string | null;
|
|
59
|
-
student_first_name: string;
|
|
60
|
-
student_middle_name: string;
|
|
61
|
-
student_last_name: string;
|
|
62
|
-
student_gender: string;
|
|
63
|
-
student_age: string | null;
|
|
64
|
-
current_grade: string;
|
|
65
|
-
admission_grade: string;
|
|
66
|
-
current_school: string | null;
|
|
67
|
-
number_input: string | null;
|
|
68
|
-
current_board: string | null;
|
|
69
|
-
special_needs: string | null;
|
|
70
|
-
special_needs_details: string | null;
|
|
71
|
-
previous_school_reason: string | null;
|
|
72
|
-
academic_performance: string | null;
|
|
73
|
-
interested_academic_year: string | null;
|
|
74
|
-
father_salutation: string | null;
|
|
75
|
-
father_first_name: string | null;
|
|
76
|
-
father_last_name: string | null;
|
|
77
|
-
father_mobile: string | null;
|
|
78
|
-
father_email: string | null;
|
|
79
|
-
father_qualification: string | null;
|
|
80
|
-
father_occupation: string | null;
|
|
81
|
-
father_designation: string | null;
|
|
82
|
-
father_company: string | null;
|
|
83
|
-
father_annual_income: string | null;
|
|
84
|
-
father_office_address: string | null;
|
|
85
|
-
mother_salutation: string | null;
|
|
86
|
-
mother_first_name: string | null;
|
|
87
|
-
mother_last_name: string | null;
|
|
88
|
-
mother_email: string | null;
|
|
89
|
-
mother_mobile: string | null;
|
|
90
|
-
mother_qualification: string | null;
|
|
91
|
-
mother_designation: string | null;
|
|
92
|
-
mother_company: string | null;
|
|
93
|
-
mother_annual_income: string | null;
|
|
94
|
-
mother_office_address: string | null;
|
|
95
|
-
mother_occupation: string | null;
|
|
96
|
-
how_did_you_hear: string | null;
|
|
97
|
-
specific_requirements: string | null;
|
|
98
|
-
parent_questions: string | null;
|
|
99
|
-
special_requirements: string | null;
|
|
100
|
-
comments: string | null;
|
|
101
|
-
lead_reasons: string | null;
|
|
102
|
-
referral_source: string | null;
|
|
103
|
-
campaign_code: string | null;
|
|
104
|
-
DOB: string | null;
|
|
105
|
-
date: string | null;
|
|
106
|
-
enquiry_date: string;
|
|
107
|
-
student_dob: string | null;
|
|
108
|
-
date_input: string | null;
|
|
109
|
-
sub_lane_id: number;
|
|
32
|
+
contact_first_name: string;
|
|
33
|
+
primary_mobile: string;
|
|
34
|
+
stage_group_id: number | string;
|
|
35
|
+
stage_id: number | string;
|
|
36
|
+
profile_image: string | null;
|
|
110
37
|
}
|
|
111
38
|
|
|
112
39
|
export interface Lane {
|
|
113
|
-
id: string;
|
|
40
|
+
id: string | number;
|
|
114
41
|
name: string;
|
|
115
42
|
color: string | null;
|
|
116
43
|
darkColor: string | null;
|
|
117
44
|
}
|
|
118
45
|
|
|
119
46
|
export interface SwimLane {
|
|
120
|
-
id: string;
|
|
47
|
+
id: string | number;
|
|
121
48
|
name: string;
|
|
122
49
|
sub_lanes: SubLane[];
|
|
123
50
|
count: number | string;
|
|
124
51
|
}
|
|
125
52
|
|
|
126
53
|
export interface SubLane {
|
|
127
|
-
id: number;
|
|
54
|
+
id: number | string;
|
|
128
55
|
name: string;
|
|
129
56
|
color: string;
|
|
130
57
|
lane_id: number | string;
|
|
@@ -52,11 +52,11 @@ function DraggableTableHeader<T>({
|
|
|
52
52
|
style?: CSSProperties;
|
|
53
53
|
} = {
|
|
54
54
|
className: "ts__content",
|
|
55
|
-
style: {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
55
|
+
// style: {
|
|
56
|
+
// justifyContent: getColumnAlignment(
|
|
57
|
+
// (header?.column?.columnDef?.meta as align)?.align
|
|
58
|
+
// ),
|
|
59
|
+
// },
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
// if (header.column.getCanSort()) {
|
|
@@ -75,11 +75,11 @@ function TableHead<T>({
|
|
|
75
75
|
style?: CSSProperties;
|
|
76
76
|
} = {
|
|
77
77
|
className: "ts__content",
|
|
78
|
-
style: {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
78
|
+
// style: {
|
|
79
|
+
// justifyContent: getColumnAlignment(
|
|
80
|
+
// (header?.column?.columnDef?.meta as align)?.align
|
|
81
|
+
// ),
|
|
82
|
+
// },
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
// if (header.column.getCanSort()) {
|
|
@@ -119,17 +119,13 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
|
|
|
119
119
|
|
|
120
120
|
if (showList || hideList) {
|
|
121
121
|
const isValidShowList = showList?.length > 0;
|
|
122
|
-
console.log("inside show list and hide list if", isValidShowList);
|
|
123
122
|
|
|
124
123
|
if (!isValidShowList) {
|
|
125
|
-
console.log("not a valid show list");
|
|
126
|
-
|
|
127
124
|
const hasColumnError = saveButtonError.messages.some(
|
|
128
125
|
(message) => message.type === ERROR_CODE
|
|
129
126
|
);
|
|
130
127
|
|
|
131
128
|
if (!hasColumnError) {
|
|
132
|
-
console.log("inside if");
|
|
133
129
|
setSaveButtonError((prev) => ({
|
|
134
130
|
...prev,
|
|
135
131
|
hasError: true,
|
|
@@ -143,7 +139,6 @@ const ColumnTab = ({ filterSettingStates, columnsData }: ColumnTabProps) => {
|
|
|
143
139
|
}));
|
|
144
140
|
}
|
|
145
141
|
} else {
|
|
146
|
-
console.log("inside else");
|
|
147
142
|
const hasOtherMessages = saveButtonError?.messages?.some(
|
|
148
143
|
(message) => message.type !== ERROR_CODE
|
|
149
144
|
);
|