rez-table-listing-mui 1.2.13 → 1.2.14
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 +116 -1
- 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/App.tsx +47 -405
- package/src/index.ts +10 -9
- package/src/kanban/components/LeadCard.tsx +130 -0
- package/src/kanban/constants/kanban-constants.ts +249 -0
- package/src/kanban/hooks/hooks.ts +16 -0
- package/src/kanban/index.tsx +331 -0
- package/src/kanban/services/service.ts +11 -0
- package/src/kanban/styles/styles.tsx +256 -0
- package/src/kanban/types/types.ts +132 -0
- package/src/{components → listing/components}/column-visibility-modal/column-list-item.tsx +1 -1
- package/src/{components → listing/components}/column-visibility-modal/index.tsx +1 -1
- package/src/{components → listing/components}/filter/components/forms/components/Filter-criteria.tsx +1 -1
- package/src/{components → listing/components}/filter/components/forms/index.tsx +1 -1
- package/src/{components → listing/components}/filter/components/saved-filter.tsx +2 -2
- package/src/{components → listing/components}/filter/components/search/index.tsx +1 -1
- package/src/{components → listing/components}/filter/components/tabs/index.tsx +1 -1
- package/src/{components → listing/components}/index-table.tsx +1 -1
- package/src/{components → listing/components}/pagination/default/index.tsx +1 -1
- package/src/{components → listing/components}/search/index.tsx +1 -1
- package/src/{components → listing/components}/sorting-modal.tsx/index.tsx +1 -1
- package/src/{components → listing/components}/sorting-modal.tsx/sorting-item.tsx +1 -1
- package/src/{components → listing/components}/table-change-layout.tsx +1 -1
- package/src/{components → listing/components}/table-head-dnd-cell.tsx +6 -6
- package/src/{components → listing/components}/table-head-pin.tsx +1 -1
- package/src/{components → listing/components}/table-head-popover.tsx +1 -1
- package/src/{components → listing/components}/table-head.tsx +6 -6
- package/src/{components → listing/components}/table-settings/common/listing-values.tsx +1 -1
- package/src/{components → listing/components}/table-settings/components/sorting.tsx +1 -1
- package/src/{components → listing/components}/tabs/index.tsx +1 -1
- package/src/{components → listing/components}/topbar/index.tsx +7 -7
- package/src/{components → listing/components}/viewmore/index.tsx +1 -1
- package/src/{libs → listing/libs}/hooks/useDefaultColumns.tsx +1 -0
- package/src/{libs → listing/libs}/utils/common.ts +1 -1
- package/src/view/KanbanView.tsx +16 -0
- package/src/view/ListingView.tsx +423 -0
- /package/src/{components → listing/components}/column-visibility-modal/index.scss +0 -0
- /package/src/{components → listing/components}/common/confirm-modal/index.tsx +0 -0
- /package/src/{components → listing/components}/common/index.scss +0 -0
- /package/src/{components → listing/components}/common/index.tsx +0 -0
- /package/src/{components → listing/components}/common/loader/loader.tsx +0 -0
- /package/src/{components → listing/components}/dropdown/index.scss +0 -0
- /package/src/{components → listing/components}/dropdown/index.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/attributes-filter.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/Date.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/Dropdown.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/Multi-Select.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/Select.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/Textfield.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/forms/components/styles.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/main-filter.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/saved-edit-filter.tsx +0 -0
- /package/src/{components → listing/components}/filter/components/tabs/custom-tab-panel.tsx +0 -0
- /package/src/{components → listing/components}/filter/index.tsx +0 -0
- /package/src/{components → listing/components}/filter/style.ts +0 -0
- /package/src/{components → listing/components}/index.scss +0 -0
- /package/src/{components → listing/components}/inputs/checkbox/index.tsx +0 -0
- /package/src/{components → listing/components}/inputs/index.scss +0 -0
- /package/src/{components → listing/components}/inputs/switch.tsx +0 -0
- /package/src/{components → listing/components}/login/index.tsx +0 -0
- /package/src/{components → listing/components}/nestedcomponent/index.scss +0 -0
- /package/src/{components → listing/components}/nestedcomponent/index.tsx +0 -0
- /package/src/{components → listing/components}/pagination/default/index.scss +0 -0
- /package/src/{components → listing/components}/search/style.ts +0 -0
- /package/src/{components → listing/components}/table-body-dnd-cell.tsx +0 -0
- /package/src/{components → listing/components}/table-body.tsx +0 -0
- /package/src/{components → listing/components}/table-dnd.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/common/draggable-listitem.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/common/info-alert.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/components/column.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/components/custom-button.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/components/custom-dialog.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/components/quick-tab.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/components/toggle-button-switch.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/constants.ts +0 -0
- /package/src/{components → listing/components}/table-settings/index.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/style.ts +0 -0
- /package/src/{components → listing/components}/table-settings/tabs/horizontal/index.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/tabs/styles.ts +0 -0
- /package/src/{components → listing/components}/table-settings/tabs/vertical/custom-tab-panel.tsx +0 -0
- /package/src/{components → listing/components}/table-settings/tabs/vertical/index.tsx +0 -0
- /package/src/{components → listing/components}/table.tsx +0 -0
- /package/src/{components → listing/components}/tabs/index.scss +0 -0
- /package/src/{components → listing/components}/tabs/styles.ts +0 -0
- /package/src/{components → listing/components}/topbar/index.scss +0 -0
- /package/src/{components → listing/components}/viewmore/index.scss +0 -0
- /package/src/{libs → listing/libs}/hooks/useCraftTable.tsx +0 -0
- /package/src/{libs → listing/libs}/hooks/useCraftTableFilterSettings.tsx +0 -0
- /package/src/{libs → listing/libs}/hooks/useElementWidth.tsx +0 -0
- /package/src/{libs → listing/libs}/hooks/useEntityTableAPI.tsx +0 -0
- /package/src/{libs → listing/libs}/hooks/useEntityTableHooks.ts +0 -0
- /package/src/{libs → listing/libs}/hooks/useFullScreen.tsx +0 -0
- /package/src/{libs → listing/libs}/hooks/useOutsideClick.tsx +0 -0
- /package/src/{libs → listing/libs}/utils/Data-format.ts +0 -0
- /package/src/{libs → listing/libs}/utils/amount-format.ts +0 -0
- /package/src/{libs → listing/libs}/utils/apiColumn.ts +0 -0
- /package/src/{libs → listing/libs}/utils/date-format.ts +0 -0
- /package/src/{libs → listing/libs}/utils/debounce.ts +0 -0
- /package/src/{libs → listing/libs}/utils/make-data.ts +0 -0
- /package/src/{libs → listing/libs}/utils/make-hierar-data.ts +0 -0
- /package/src/{libs → listing/libs}/utils/make-nested-data.ts +0 -0
- /package/src/{libs → listing/libs}/utils/rows-data.ts +0 -0
- /package/src/{types → listing/types}/common.ts +0 -0
- /package/src/{types → listing/types}/filter-settings.ts +0 -0
- /package/src/{types → listing/types}/filter.ts +0 -0
- /package/src/{types → listing/types}/table-options.ts +0 -0
- /package/src/{types → listing/types}/table.ts +0 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
export const rawData = {
|
|
2
|
+
lanes: [
|
|
3
|
+
{ id: 1, name: "Enquiry", color: "#fff0f3", darkColor: "#fea3b4" },
|
|
4
|
+
{ id: 2, name: "Qualified Lead", color: "#fffbed", darkColor: "#fde272" },
|
|
5
|
+
{ id: 3, name: "Application", color: "#ebf9fc", darkColor: "#67e3f9" },
|
|
6
|
+
{ id: 4, name: "Admission", color: "#edf9f3", darkColor: "#73e2a3" },
|
|
7
|
+
{ id: 5, name: "Documents", color: "#edf9f3", darkColor: "#73e2a3" },
|
|
8
|
+
{ id: 6, name: "Admission", color: "#edf9f3", darkColor: "#73e2a3" },
|
|
9
|
+
],
|
|
10
|
+
swim_lanes: [
|
|
11
|
+
{
|
|
12
|
+
id: 12,
|
|
13
|
+
name: "Active",
|
|
14
|
+
sub_lanes: [
|
|
15
|
+
{
|
|
16
|
+
id: 1,
|
|
17
|
+
name: "Lead Assignment",
|
|
18
|
+
color: "red",
|
|
19
|
+
lane_id: 1,
|
|
20
|
+
expanded: true,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 2,
|
|
24
|
+
name: "Initial Outreach",
|
|
25
|
+
color: "green",
|
|
26
|
+
lane_id: 1,
|
|
27
|
+
expanded: true,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 3,
|
|
31
|
+
name: "Lead Assessment",
|
|
32
|
+
color: "yellow",
|
|
33
|
+
lane_id: 2,
|
|
34
|
+
expanded: true,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 4,
|
|
38
|
+
name: "Campus Visit",
|
|
39
|
+
color: "#FFE885",
|
|
40
|
+
lane_id: 2,
|
|
41
|
+
expanded: true,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 5,
|
|
45
|
+
name: "Application Collection",
|
|
46
|
+
color: "#90E0F3",
|
|
47
|
+
lane_id: 3,
|
|
48
|
+
expanded: true,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 6,
|
|
52
|
+
name: "Student Assessment",
|
|
53
|
+
color: "#90E0F3",
|
|
54
|
+
lane_id: 3,
|
|
55
|
+
expanded: true,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 7,
|
|
59
|
+
name: "Fee Collection",
|
|
60
|
+
color: "#90EE90",
|
|
61
|
+
lane_id: 4,
|
|
62
|
+
expanded: true,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 8,
|
|
66
|
+
name: "System Integration",
|
|
67
|
+
color: "#90EE90",
|
|
68
|
+
lane_id: 4,
|
|
69
|
+
expanded: true,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 13,
|
|
75
|
+
name: "Dormant",
|
|
76
|
+
sub_lanes: [],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: 14,
|
|
80
|
+
name: "Disqualify",
|
|
81
|
+
sub_lanes: [],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 15,
|
|
85
|
+
name: "Lost",
|
|
86
|
+
sub_lanes: [],
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
data: [
|
|
90
|
+
// Lead Assignment
|
|
91
|
+
{
|
|
92
|
+
id: 1,
|
|
93
|
+
name: "Aditi Sharma",
|
|
94
|
+
sub_lane_id: 1,
|
|
95
|
+
email: "aditisharma@gmail.com",
|
|
96
|
+
phone: "+91 9846213495",
|
|
97
|
+
status: "Active",
|
|
98
|
+
progress: 0,
|
|
99
|
+
days: "10 Days",
|
|
100
|
+
reference_id: "INQ2024XY",
|
|
101
|
+
priority: null,
|
|
102
|
+
lost: false,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 2,
|
|
106
|
+
name: "Aditi Sharma",
|
|
107
|
+
sub_lane_id: 1,
|
|
108
|
+
email: "aditisharma@gmail.com",
|
|
109
|
+
phone: "+91 9846213495",
|
|
110
|
+
status: "Active",
|
|
111
|
+
progress: 0,
|
|
112
|
+
days: "10 Days",
|
|
113
|
+
reference_id: "INQ2024XY",
|
|
114
|
+
priority: null,
|
|
115
|
+
lost: false,
|
|
116
|
+
},
|
|
117
|
+
// Initial Outreach
|
|
118
|
+
{
|
|
119
|
+
id: 3,
|
|
120
|
+
name: "Rashmi Desai",
|
|
121
|
+
sub_lane_id: 2,
|
|
122
|
+
email: "aditisharma@gmail.com",
|
|
123
|
+
phone: "+91 9765874320",
|
|
124
|
+
status: "Active",
|
|
125
|
+
progress: 0,
|
|
126
|
+
days: "10 Days",
|
|
127
|
+
reference_id: "INQ2024XY",
|
|
128
|
+
priority: null,
|
|
129
|
+
lost: false,
|
|
130
|
+
},
|
|
131
|
+
// Lead Assessment
|
|
132
|
+
{
|
|
133
|
+
id: 4,
|
|
134
|
+
name: "Aditi Sharma",
|
|
135
|
+
sub_lane_id: 3,
|
|
136
|
+
email: "aditisharma@gmail.com",
|
|
137
|
+
phone: "+91 9846213495",
|
|
138
|
+
status: "Active",
|
|
139
|
+
progress: 0,
|
|
140
|
+
days: "10 Days",
|
|
141
|
+
reference_id: "INQ2024XY",
|
|
142
|
+
priority: null,
|
|
143
|
+
lost: false,
|
|
144
|
+
},
|
|
145
|
+
// Campus Visit
|
|
146
|
+
{
|
|
147
|
+
id: 5,
|
|
148
|
+
name: "Aditi Sharma",
|
|
149
|
+
sub_lane_id: 4,
|
|
150
|
+
email: "aditisharma@gmail.com",
|
|
151
|
+
phone: "+91 9846213495",
|
|
152
|
+
status: "Lost",
|
|
153
|
+
progress: 0,
|
|
154
|
+
days: "10 Days",
|
|
155
|
+
reference_id: "2DQ2024XY",
|
|
156
|
+
priority: null,
|
|
157
|
+
lost: true,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: 6,
|
|
161
|
+
name: "Aditi Sharma",
|
|
162
|
+
sub_lane_id: 4,
|
|
163
|
+
email: "aditisharma@gmail.com",
|
|
164
|
+
phone: "+91 9846213495",
|
|
165
|
+
status: "Active",
|
|
166
|
+
progress: 0,
|
|
167
|
+
days: "10 Days",
|
|
168
|
+
reference_id: "INQ2024XY",
|
|
169
|
+
priority: null,
|
|
170
|
+
lost: false,
|
|
171
|
+
},
|
|
172
|
+
// Application Collection
|
|
173
|
+
{
|
|
174
|
+
id: 7,
|
|
175
|
+
name: "Aditi Sharma",
|
|
176
|
+
sub_lane_id: 5,
|
|
177
|
+
email: "aditisharma@gmail.com",
|
|
178
|
+
phone: "+91 9452013495",
|
|
179
|
+
status: "Active",
|
|
180
|
+
progress: 0,
|
|
181
|
+
days: "10 Days",
|
|
182
|
+
reference_id: "INQ2024XY",
|
|
183
|
+
priority: null,
|
|
184
|
+
lost: false,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
id: 8,
|
|
188
|
+
name: "Aditi Sharma",
|
|
189
|
+
sub_lane_id: 5,
|
|
190
|
+
email: "aditisharma@gmail.com",
|
|
191
|
+
phone: "+91 9452013495",
|
|
192
|
+
status: "Active",
|
|
193
|
+
progress: 0,
|
|
194
|
+
days: "10 Days",
|
|
195
|
+
reference_id: "INQ2024XY",
|
|
196
|
+
priority: null,
|
|
197
|
+
lost: false,
|
|
198
|
+
},
|
|
199
|
+
// Student Assessment
|
|
200
|
+
{
|
|
201
|
+
id: 9,
|
|
202
|
+
name: "Aditi Sharma",
|
|
203
|
+
sub_lane_id: 6,
|
|
204
|
+
email: "aditisharma@gmail.com",
|
|
205
|
+
phone: "+91 9452013495",
|
|
206
|
+
status: "Active",
|
|
207
|
+
progress: 0,
|
|
208
|
+
days: "10 Days",
|
|
209
|
+
reference_id: "INQ2024XY",
|
|
210
|
+
priority: null,
|
|
211
|
+
lost: false,
|
|
212
|
+
},
|
|
213
|
+
// Fee Collection
|
|
214
|
+
{
|
|
215
|
+
id: 10,
|
|
216
|
+
name: "Aditi Sharma",
|
|
217
|
+
sub_lane_id: 7,
|
|
218
|
+
email: "aditisharma@gmail.com",
|
|
219
|
+
phone: "+91 9846015495",
|
|
220
|
+
status: "Active",
|
|
221
|
+
progress: 0,
|
|
222
|
+
days: "You",
|
|
223
|
+
reference_id: "INQ2024XY",
|
|
224
|
+
priority: "High",
|
|
225
|
+
lost: false,
|
|
226
|
+
},
|
|
227
|
+
// System Integration
|
|
228
|
+
{
|
|
229
|
+
id: 11,
|
|
230
|
+
name: "Aditi Sharma",
|
|
231
|
+
sub_lane_id: 8,
|
|
232
|
+
email: "aditisharma@gmail.com",
|
|
233
|
+
phone: "+91 9846015495",
|
|
234
|
+
status: "Lost",
|
|
235
|
+
progress: 0,
|
|
236
|
+
days: "You",
|
|
237
|
+
reference_id: "INQ2024XY",
|
|
238
|
+
priority: "Low",
|
|
239
|
+
lost: true,
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export const COLOR_CONSTANTS = [
|
|
245
|
+
{ color: "#fff0f3", darkColor: "#fea3b4" },
|
|
246
|
+
{ color: "#fffbed", darkColor: "#fde272" },
|
|
247
|
+
{ color: "#ebf9fc", darkColor: "#67e3f9" },
|
|
248
|
+
{ color: "#edf9f3", darkColor: "#73e2a3" },
|
|
249
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { getKanbanData } from "../services/service";
|
|
3
|
+
|
|
4
|
+
export const useGetKanbanData = (entity_type: string) => {
|
|
5
|
+
const {
|
|
6
|
+
data: rawData,
|
|
7
|
+
isPending,
|
|
8
|
+
isLoading,
|
|
9
|
+
error,
|
|
10
|
+
} = useQuery({
|
|
11
|
+
queryKey: ["stageGroupsOptions", entity_type],
|
|
12
|
+
queryFn: () => getKanbanData(entity_type),
|
|
13
|
+
enabled: !!entity_type, // Only fetch when workflowId is valid
|
|
14
|
+
});
|
|
15
|
+
return { rawData, isPending, isLoading, error };
|
|
16
|
+
};
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Typography,
|
|
5
|
+
Accordion,
|
|
6
|
+
AccordionSummary,
|
|
7
|
+
AccordionDetails,
|
|
8
|
+
IconButton,
|
|
9
|
+
Badge,
|
|
10
|
+
} from "@mui/material";
|
|
11
|
+
import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined";
|
|
12
|
+
import {
|
|
13
|
+
Add,
|
|
14
|
+
ExpandMore as ExpandMoreIcon,
|
|
15
|
+
Settings as SettingsIcon,
|
|
16
|
+
} from "@mui/icons-material";
|
|
17
|
+
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
18
|
+
import { useGetKanbanData } from "./hooks/hooks";
|
|
19
|
+
import { kanbanStyles } from "./styles/styles";
|
|
20
|
+
import LeadCard from "./components/LeadCard";
|
|
21
|
+
import { Lane, LeadData, SubLane, SwimLane } from "./types/types";
|
|
22
|
+
import { COLOR_CONSTANTS } from "./constants/kanban-constants";
|
|
23
|
+
import Loader from "../listing/components/common/loader/loader";
|
|
24
|
+
|
|
25
|
+
const Kanban = ({
|
|
26
|
+
rawData,
|
|
27
|
+
isLoading,
|
|
28
|
+
KanbanCardComponent,
|
|
29
|
+
}: {
|
|
30
|
+
rawData: any;
|
|
31
|
+
isLoading?: boolean;
|
|
32
|
+
KanbanCardComponent: React.ComponentType<{
|
|
33
|
+
key: string | number;
|
|
34
|
+
lead: LeadData;
|
|
35
|
+
}>;
|
|
36
|
+
}) => {
|
|
37
|
+
const [expandedPanels, setExpandedPanels] = useState<{
|
|
38
|
+
[key: string]: boolean;
|
|
39
|
+
}>({
|
|
40
|
+
Active: true,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const [subLaneExpanded, setSubLaneExpanded] = useState<{
|
|
44
|
+
[key: string]: boolean;
|
|
45
|
+
}>({});
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (rawData?.swim_lanes?.length) {
|
|
49
|
+
const initial: { [key: string]: boolean } = {};
|
|
50
|
+
rawData.swim_lanes.forEach((swim_lane: SwimLane) => {
|
|
51
|
+
swim_lane?.sub_lanes?.forEach((sub_lane) => {
|
|
52
|
+
const key = `${swim_lane.id}-${sub_lane.lane_id}-${sub_lane.id}`;
|
|
53
|
+
initial[key] = sub_lane.expanded || false;
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
setSubLaneExpanded(initial);
|
|
57
|
+
}
|
|
58
|
+
}, [rawData]);
|
|
59
|
+
|
|
60
|
+
const handleAccordionChange =
|
|
61
|
+
(panel: string) => (event: React.SyntheticEvent, isExpanded: boolean) => {
|
|
62
|
+
setExpandedPanels((prev) => ({
|
|
63
|
+
...prev,
|
|
64
|
+
[panel]: isExpanded,
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const toggleSubLane = (subLaneId: number | string) => {
|
|
69
|
+
setSubLaneExpanded((prev) => ({
|
|
70
|
+
...prev,
|
|
71
|
+
[subLaneId]: !prev[subLaneId],
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const getLeadCount = (laneId: number): number => {
|
|
76
|
+
if (!rawData?.swim_lanes || !rawData?.data) return 0;
|
|
77
|
+
|
|
78
|
+
const seenLeadIds = new Set<number | string>();
|
|
79
|
+
let count = 0;
|
|
80
|
+
|
|
81
|
+
rawData.swim_lanes.forEach((swimLane: SwimLane) => {
|
|
82
|
+
swimLane.sub_lanes
|
|
83
|
+
?.filter((subLane) => subLane.lane_id === laneId)
|
|
84
|
+
?.forEach((subLane) => {
|
|
85
|
+
rawData.data.forEach((lead: LeadData) => {
|
|
86
|
+
if (lead.sub_lane_id === subLane.id && !seenLeadIds.has(lead.id)) {
|
|
87
|
+
seenLeadIds.add(lead.id);
|
|
88
|
+
count++;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return count;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<>
|
|
99
|
+
{isLoading ? (
|
|
100
|
+
<Loader />
|
|
101
|
+
) : (
|
|
102
|
+
<Box>
|
|
103
|
+
<Box sx={{ width: "100%", bgcolor: "white", overflowX: "auto" }}>
|
|
104
|
+
{/* Header */}
|
|
105
|
+
<Box sx={kanbanStyles.topHeader}>
|
|
106
|
+
<IconButton sx={kanbanStyles.settingStyle}>
|
|
107
|
+
<SettingsOutlinedIcon />
|
|
108
|
+
</IconButton>
|
|
109
|
+
|
|
110
|
+
{/* Lane Headers - Replaced Grid with Flex */}
|
|
111
|
+
<Box
|
|
112
|
+
sx={{
|
|
113
|
+
...kanbanStyles.syncingStyle,
|
|
114
|
+
flex: 1,
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
{rawData?.lanes?.map((lane: Lane, index: number) => (
|
|
118
|
+
<Box
|
|
119
|
+
className="lane-header"
|
|
120
|
+
sx={{
|
|
121
|
+
...kanbanStyles.laneHeader,
|
|
122
|
+
|
|
123
|
+
bgcolor: lane.color || COLOR_CONSTANTS[index % 4].color,
|
|
124
|
+
}}
|
|
125
|
+
key={lane.id}
|
|
126
|
+
>
|
|
127
|
+
<Box
|
|
128
|
+
sx={{
|
|
129
|
+
...kanbanStyles.badge,
|
|
130
|
+
|
|
131
|
+
bgcolor:
|
|
132
|
+
lane.darkColor ||
|
|
133
|
+
COLOR_CONSTANTS[index % 4].darkColor,
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
{getLeadCount(Number(lane.id))}
|
|
137
|
+
</Box>
|
|
138
|
+
|
|
139
|
+
<Typography variant="h6" fontWeight="bold" sx={{ px: 2 }}>
|
|
140
|
+
{lane.name}
|
|
141
|
+
</Typography>
|
|
142
|
+
</Box>
|
|
143
|
+
))}
|
|
144
|
+
</Box>
|
|
145
|
+
</Box>
|
|
146
|
+
|
|
147
|
+
{/* Content */}
|
|
148
|
+
<Box
|
|
149
|
+
className="kanban-content"
|
|
150
|
+
id="kanban-content"
|
|
151
|
+
sx={{
|
|
152
|
+
maxHeight: "calc(100vh - 186px)",
|
|
153
|
+
// minWidth: "100%",
|
|
154
|
+
|
|
155
|
+
width: "fit-content",
|
|
156
|
+
}}
|
|
157
|
+
>
|
|
158
|
+
{/* Swim Lanes */}
|
|
159
|
+
{rawData?.swim_lanes?.map((swim_lane: SwimLane) => (
|
|
160
|
+
<Accordion
|
|
161
|
+
key={swim_lane.id}
|
|
162
|
+
expanded={!!expandedPanels[swim_lane.name]}
|
|
163
|
+
onChange={handleAccordionChange(swim_lane.name)}
|
|
164
|
+
sx={kanbanStyles.swimLaneAccordionStyle}
|
|
165
|
+
// disabled={getSwimLaneCount(swim_lane.id) === 0 ? true : false}
|
|
166
|
+
>
|
|
167
|
+
<AccordionSummary
|
|
168
|
+
disabled={swim_lane?.sub_lanes?.length > 0 ? false : true}
|
|
169
|
+
expandIcon={
|
|
170
|
+
<ArrowDropDownIcon
|
|
171
|
+
sx={{
|
|
172
|
+
color: "black",
|
|
173
|
+
}}
|
|
174
|
+
/>
|
|
175
|
+
}
|
|
176
|
+
sx={kanbanStyles.swimlaneWrapperStyle}
|
|
177
|
+
>
|
|
178
|
+
<Typography
|
|
179
|
+
variant="body1"
|
|
180
|
+
fontWeight="medium"
|
|
181
|
+
sx={{ ml: 1.5 }}
|
|
182
|
+
>
|
|
183
|
+
{swim_lane.name} ({swim_lane?.count})
|
|
184
|
+
</Typography>
|
|
185
|
+
</AccordionSummary>
|
|
186
|
+
|
|
187
|
+
<AccordionDetails
|
|
188
|
+
sx={{ pl: "16px", pr: "8px", width: "fit-content", py: 0 }}
|
|
189
|
+
>
|
|
190
|
+
{/* Replaced Grid with Flex */}
|
|
191
|
+
<Box sx={{ ...kanbanStyles.syncingStyle, pl: 7 }}>
|
|
192
|
+
{rawData?.lanes?.map((lane: Lane, index: number) => (
|
|
193
|
+
<Box
|
|
194
|
+
className="column"
|
|
195
|
+
sx={{
|
|
196
|
+
...kanbanStyles.columnStyle,
|
|
197
|
+
bgcolor:
|
|
198
|
+
lane.color || COLOR_CONSTANTS[index % 4].color,
|
|
199
|
+
}}
|
|
200
|
+
key={lane.id}
|
|
201
|
+
>
|
|
202
|
+
{/* Sub-lanes for this lane */}
|
|
203
|
+
{swim_lane?.sub_lanes
|
|
204
|
+
?.filter(
|
|
205
|
+
(sub_lane: SubLane) =>
|
|
206
|
+
sub_lane.lane_id.toString() === lane.id
|
|
207
|
+
)
|
|
208
|
+
?.map((sub_section: SubLane) => {
|
|
209
|
+
const subLaneKey = `${swim_lane.id}-${lane.id}-${sub_section.id}`;
|
|
210
|
+
return (
|
|
211
|
+
<Accordion
|
|
212
|
+
key={sub_section.id}
|
|
213
|
+
expanded={
|
|
214
|
+
rawData?.data?.filter(
|
|
215
|
+
(lead: LeadData) =>
|
|
216
|
+
lead.sub_lane_id === sub_section.id &&
|
|
217
|
+
lead.lead_status == swim_lane.id
|
|
218
|
+
)?.length === 0
|
|
219
|
+
? false
|
|
220
|
+
: subLaneExpanded[subLaneKey] || false
|
|
221
|
+
}
|
|
222
|
+
onChange={() => toggleSubLane(subLaneKey)}
|
|
223
|
+
sx={{
|
|
224
|
+
...kanbanStyles.stageStyle,
|
|
225
|
+
borderLeft: `4px solid ${
|
|
226
|
+
lane.darkColor ||
|
|
227
|
+
COLOR_CONSTANTS[index % 4].darkColor
|
|
228
|
+
}`,
|
|
229
|
+
}}
|
|
230
|
+
// disabled={
|
|
231
|
+
// rawData?.data?.filter(
|
|
232
|
+
// (lead: LeadData) =>
|
|
233
|
+
// lead.sub_lane_id === sub_section.id &&
|
|
234
|
+
// !usedLeadIds.has(lead.id)
|
|
235
|
+
// )?.length === 0
|
|
236
|
+
// ? true
|
|
237
|
+
// : false
|
|
238
|
+
// }
|
|
239
|
+
>
|
|
240
|
+
<AccordionSummary
|
|
241
|
+
expandIcon={
|
|
242
|
+
<ExpandMoreIcon
|
|
243
|
+
sx={{
|
|
244
|
+
display:
|
|
245
|
+
rawData?.data?.filter(
|
|
246
|
+
(lead: LeadData) =>
|
|
247
|
+
lead.sub_lane_id ===
|
|
248
|
+
sub_section.id &&
|
|
249
|
+
lead.lead_status == swim_lane.id
|
|
250
|
+
)?.length === 0
|
|
251
|
+
? "none"
|
|
252
|
+
: "block",
|
|
253
|
+
}}
|
|
254
|
+
/>
|
|
255
|
+
}
|
|
256
|
+
sx={kanbanStyles.subSectionAccordion}
|
|
257
|
+
>
|
|
258
|
+
<Box
|
|
259
|
+
sx={
|
|
260
|
+
kanbanStyles.subSectionHeaderContainer
|
|
261
|
+
}
|
|
262
|
+
>
|
|
263
|
+
<Box
|
|
264
|
+
className="sub-section-count"
|
|
265
|
+
sx={{
|
|
266
|
+
...kanbanStyles.subSectionCountContainer,
|
|
267
|
+
bgcolor:
|
|
268
|
+
lane.darkColor ||
|
|
269
|
+
COLOR_CONSTANTS[index % 4]
|
|
270
|
+
.darkColor,
|
|
271
|
+
}}
|
|
272
|
+
>
|
|
273
|
+
{rawData?.data?.filter(
|
|
274
|
+
(lead: LeadData) =>
|
|
275
|
+
lead.sub_lane_id ===
|
|
276
|
+
sub_section.id &&
|
|
277
|
+
lead.lead_status === swim_lane.id
|
|
278
|
+
)?.length || 0}
|
|
279
|
+
</Box>
|
|
280
|
+
<Typography
|
|
281
|
+
fontWeight="700"
|
|
282
|
+
color="#555354"
|
|
283
|
+
fontSize="12px"
|
|
284
|
+
>
|
|
285
|
+
{sub_section.name}
|
|
286
|
+
</Typography>
|
|
287
|
+
</Box>
|
|
288
|
+
</AccordionSummary>
|
|
289
|
+
|
|
290
|
+
<AccordionDetails
|
|
291
|
+
sx={kanbanStyles.cardsContainer}
|
|
292
|
+
>
|
|
293
|
+
{(() => {
|
|
294
|
+
const leadsForThisSubLane =
|
|
295
|
+
rawData?.data?.filter(
|
|
296
|
+
(lead: LeadData) =>
|
|
297
|
+
lead.sub_lane_id ===
|
|
298
|
+
sub_section.id &&
|
|
299
|
+
lead.lead_status == swim_lane.id
|
|
300
|
+
) || [];
|
|
301
|
+
|
|
302
|
+
return leadsForThisSubLane.map(
|
|
303
|
+
(lead_card: LeadData) =>
|
|
304
|
+
(KanbanCardComponent && (
|
|
305
|
+
<KanbanCardComponent
|
|
306
|
+
key={lead_card.id}
|
|
307
|
+
lead={lead_card}
|
|
308
|
+
/>
|
|
309
|
+
)) ||
|
|
310
|
+
null
|
|
311
|
+
);
|
|
312
|
+
})()}
|
|
313
|
+
</AccordionDetails>
|
|
314
|
+
</Accordion>
|
|
315
|
+
);
|
|
316
|
+
})}
|
|
317
|
+
</Box>
|
|
318
|
+
))}
|
|
319
|
+
</Box>
|
|
320
|
+
</AccordionDetails>
|
|
321
|
+
</Accordion>
|
|
322
|
+
))}
|
|
323
|
+
</Box>
|
|
324
|
+
</Box>
|
|
325
|
+
</Box>
|
|
326
|
+
)}
|
|
327
|
+
</>
|
|
328
|
+
);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export default Kanban;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { api } from "../../listing/libs/utils/common";
|
|
2
|
+
|
|
3
|
+
export const getKanbanData = async (entity_type: string) => {
|
|
4
|
+
try {
|
|
5
|
+
const response = await api.get(`/lead/getleads?entity_type=${entity_type}`);
|
|
6
|
+
return response.data;
|
|
7
|
+
} catch (error) {
|
|
8
|
+
console.error("Failed to fetch action category:", error);
|
|
9
|
+
throw error;
|
|
10
|
+
}
|
|
11
|
+
};
|