rez-table-listing-mui 2.0.13 → 2.0.15

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.
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from "react";
1
+ import { useEffect, useState } from "react";
2
2
  import {
3
3
  Box,
4
4
  Select,
@@ -8,7 +8,6 @@ import {
8
8
  Checkbox,
9
9
  FormControlLabel,
10
10
  Grid,
11
- Alert,
12
11
  } from "@mui/material";
13
12
 
14
13
  import ListingValues from "../common/listing-values";
@@ -22,127 +21,101 @@ import {
22
21
  useSensors,
23
22
  DragEndEvent,
24
23
  } from "@dnd-kit/core";
25
- import {
26
- QuickTabConfigProps,
27
- SettingsQuickTabProps,
28
- } from "../../../types/filter-settings";
29
24
  import { TabsStyles } from "../style";
30
- import InfoAlert from "../common/info-alert";
31
25
  import { craftTableFilterSettingsOptionsProps } from "../../../types/table-options";
32
- import { LANE_SELECTS } from "../constants";
33
26
 
34
27
  const Lane = ({
35
28
  filterSettingStates,
36
29
  columnsData,
37
30
  tabsApiData,
38
31
  tabsApiDataLoading,
32
+ selectAttributeData,
33
+ laneHideListData,
39
34
  }: {
40
35
  filterSettingStates: craftTableFilterSettingsOptionsProps;
41
36
  columnsData: any;
42
37
  tabsApiData?: { label: string; value: string }[];
43
38
  tabsApiDataLoading?: boolean;
39
+ selectAttributeData?: { label: string; value: string }[];
40
+ laneHideListData?: { label: string; value: string }[];
44
41
  }) => {
45
- const { settingsData, setSettingsData, saveButtonError, setSaveButtonError } =
46
- filterSettingStates;
42
+ const { kanbanSettingsData, setKanbanSettingsData } = filterSettingStates;
47
43
 
48
44
  const [searchTerm, setSearchTerm] = useState<string>("");
49
- const [currentQuickAttribute, setCurrentQuickAttribute] = useState<string>(
50
- settingsData?.quick_tab?.attribute || ""
45
+ const [currentLaneAttribute, setCurrentLaneAttribute] = useState<string>(
46
+ kanbanSettingsData?.lane?.attribute || ""
51
47
  );
52
48
 
53
- const quickTabStates = settingsData?.quick_tab as any;
49
+ console.log("selectAttributeData", selectAttributeData);
54
50
 
55
- // In case there is no quick tab state from API
56
51
  useEffect(() => {
57
52
  const stateToArray =
58
- (quickTabStates && Object.entries(quickTabStates)) || [];
53
+ (kanbanSettingsData?.lane && Object.entries(kanbanSettingsData?.lane)) ||
54
+ [];
59
55
  const isEmptyState = stateToArray.length ? false : true;
60
56
 
61
57
  if (isEmptyState) {
62
- setSettingsData((prev) => ({
58
+ setKanbanSettingsData((prev) => ({
63
59
  ...prev,
64
- quick_tab: {
65
- ...prev?.quick_tab,
66
- attribute: LANE_SELECTS[0].value,
67
- sorting: "asc",
60
+ lane: {
61
+ ...prev?.lane,
62
+ attribute:
63
+ selectAttributeData
64
+ ?.filter(
65
+ (i) => i?.value !== kanbanSettingsData?.swim_lane?.attribute
66
+ )
67
+ ?.find((i) => i?.value == "stage_group")?.value || "",
68
68
  },
69
69
  }));
70
+ } else {
71
+ if (
72
+ kanbanSettingsData?.swim_lane?.attribute ==
73
+ kanbanSettingsData?.lane?.attribute
74
+ ) {
75
+ setKanbanSettingsData((prev) => ({
76
+ ...prev,
77
+ swim_lane: {
78
+ ...prev?.swim_lane,
79
+ attribute:
80
+ selectAttributeData
81
+ ?.filter(
82
+ (i) => i?.value !== kanbanSettingsData?.swim_lane?.attribute
83
+ )
84
+ ?.find((i) => i?.value == "stage_group")?.value || "",
85
+ // sorting: "asc",
86
+ },
87
+ }));
88
+ }
70
89
  }
71
- }, [columnsData]);
90
+ }, [selectAttributeData]);
72
91
 
73
- // When user changes attribute
74
92
  useEffect(() => {
75
- if (currentQuickAttribute === settingsData?.quick_tab?.attribute) return;
93
+ if (currentLaneAttribute === kanbanSettingsData?.lane?.attribute) return;
76
94
 
77
- if (tabsApiData?.length) {
78
- setSettingsData((prev) => ({
95
+ if (laneHideListData?.length) {
96
+ setKanbanSettingsData((prev) => ({
79
97
  ...prev,
80
- quick_tab: {
81
- ...prev?.quick_tab,
82
- hide_list: tabsApiData,
98
+ lane: {
99
+ ...prev?.lane,
100
+ hide_list: laneHideListData,
83
101
  show_list: [],
84
102
  },
85
103
  }));
86
104
 
87
- setCurrentQuickAttribute(settingsData?.quick_tab?.attribute || "");
88
- }
89
- }, [tabsApiData]);
105
+ setCurrentLaneAttribute(kanbanSettingsData?.lane?.attribute || "");
106
+ } else {
107
+ setKanbanSettingsData((prev) => ({
108
+ ...prev,
109
+ lane: {
110
+ ...prev?.lane,
111
+ hide_list: [],
112
+ show_list: [],
113
+ },
114
+ }));
90
115
 
91
- // Validation when user changes show list or hide list
92
- useEffect(() => {
93
- const showList = quickTabStates?.show_list || [];
94
- const hideList = quickTabStates?.hide_list || [];
95
-
96
- if (showList || hideList) {
97
- // Check if showList is valid (between 1 and 5 items)
98
- const isValidShowList = showList.length > 0 && showList.length <= 5;
99
- const ERROR_CODE = "quick_tab_error";
100
-
101
- if (!isValidShowList) {
102
- const errorMessage = {
103
- type: ERROR_CODE,
104
- message:
105
- showList.length === 0
106
- ? "Quick Lane: Please select at least one item"
107
- : "Quick Lane: Please select no more than 5 items",
108
- };
109
-
110
- // Check if the error is already present in the messages array
111
- const hasQuickTabError = saveButtonError?.messages?.some(
112
- (message) => message.type === ERROR_CODE
113
- );
114
-
115
- // Update the error state
116
-
117
- // Later we can use this to show error message when we will make error logic more simple
118
- // setSaveButtonError((prev) => {
119
- // const otherMessages =
120
- // prev?.messages?.filter((message) => message.type !== ERROR_CODE) ||
121
- // [];
122
-
123
- // return {
124
- // ...prev,
125
- // hasError: true,
126
- // messages: hasQuickTabError
127
- // ? [...prev?.messages]
128
- // : [...otherMessages, errorMessage],
129
- // };
130
- // });
131
- } else {
132
- const hasOtherMessages = saveButtonError?.messages?.some(
133
- (message) => message.type !== ERROR_CODE
134
- );
135
- // Reset error state if the list is valid
136
- // setSaveButtonError((prev) => ({
137
- // ...prev,
138
- // hasError: hasOtherMessages,
139
- // messages:
140
- // prev?.messages?.filter((message) => message.type !== ERROR_CODE) ||
141
- // [],
142
- // }));
143
- }
116
+ setCurrentLaneAttribute("");
144
117
  }
145
- }, [quickTabStates?.hide_list, quickTabStates?.show_list]);
118
+ }, [laneHideListData]);
146
119
 
147
120
  const sortingOptions = [
148
121
  { label: "A-Z", value: "asc" },
@@ -152,357 +125,331 @@ const Lane = ({
152
125
  { label: "Custom", value: "custom" },
153
126
  ];
154
127
 
155
- // Convert show_list/hide_list to FilterValue[] for rendering only
156
- const showListValues = (quickTabStates?.show_list || [])?.map((id: any) => ({
157
- id,
158
- label: id?.charAt(0)?.toUpperCase() + id?.slice(1),
159
- }));
160
- const hideListValues = (quickTabStates?.hide_list || [])?.map((id: any) => ({
161
- id,
162
- label: id?.charAt(0)?.toUpperCase() + id?.slice(1),
163
- }));
128
+ const isWorkflowAttribute =
129
+ kanbanSettingsData?.lane?.attribute === "stage_group" ||
130
+ kanbanSettingsData?.lane?.attribute === "stage";
131
+
132
+ const isSourceAttribute =
133
+ kanbanSettingsData?.lane?.attribute === "lead_source";
134
+
135
+ useEffect(() => {
136
+ if (isSourceAttribute) {
137
+ setKanbanSettingsData((prev) => ({
138
+ ...prev,
139
+ lane: {
140
+ ...prev.lane,
141
+ sorting: prev.lane?.sorting || "asc",
142
+ },
143
+ }));
144
+ }
145
+ }, [kanbanSettingsData?.lane?.attribute]);
146
+
147
+ const displaySortingValue = isWorkflowAttribute
148
+ ? "workflow_sequence"
149
+ : kanbanSettingsData?.lane?.sorting;
150
+
151
+ const enableDND =
152
+ isSourceAttribute && kanbanSettingsData?.lane?.sorting === "custom";
153
+
154
+ const normalizeTabItem = (item: any) => ({
155
+ label: item.label,
156
+ value: item?.value,
157
+ });
158
+ const constructHideList = () => {
159
+ const normalizedTabs = laneHideListData?.map(normalizeTabItem) || [];
160
+ return normalizedTabs?.filter(
161
+ (tab) => !showListValues?.some((i) => i?.value === tab?.value)
162
+ );
163
+ };
164
+
165
+ const showListValues = kanbanSettingsData?.lane?.show_list || [];
166
+ const hideListValues = constructHideList() || [];
167
+
168
+ const filteredListValues = hideListValues.filter((value: any) =>
169
+ value?.label?.toLowerCase().includes(searchTerm.toLowerCase())
170
+ );
164
171
 
172
+ /* ===========================================================
173
+ DND CONFIG
174
+ =========================================================== */
165
175
  const sensors = useSensors(
166
176
  useSensor(MouseSensor),
167
177
  useSensor(TouchSensor),
168
178
  useSensor(KeyboardSensor)
169
179
  );
170
180
 
171
- // Drag and drop logic, update only local state
172
181
  const handleDragEnd = (event: DragEndEvent) => {
182
+ if (!enableDND) return; // protect reorder when drag is disabled
183
+
173
184
  const { active, over } = event;
174
- if (!over) {
175
- return;
176
- }
185
+ if (!over) return;
186
+
177
187
  const currentContainer = active.data.current?.containerId;
178
188
  const overContainer = over.data.current?.containerId;
189
+
179
190
  if (!currentContainer || !overContainer) return;
191
+
192
+ let newShowList = [...(kanbanSettingsData?.lane?.show_list ?? [])];
193
+ let newHideList = [...(kanbanSettingsData?.lane?.hide_list ?? [])];
194
+
180
195
  if (currentContainer === overContainer) {
181
- // Reorder within the same list
182
- let newShowList = [...(quickTabStates.show_list ?? [])];
183
- let newHideList = [...(quickTabStates.hide_list ?? [])];
184
196
  if (currentContainer === "list") {
185
- const oldIndex = newHideList.indexOf(String(active.id));
186
- const newIndex = newHideList.indexOf(String(over.id));
197
+ const oldIndex = newHideList.findIndex((i) => i.value === active.id);
198
+ const newIndex = newHideList.findIndex((i) => i.value === over.id);
199
+
187
200
  if (oldIndex !== -1 && newIndex !== -1) {
188
201
  const [removed] = newHideList.splice(oldIndex, 1);
189
202
  newHideList.splice(newIndex, 0, removed);
190
203
  }
191
204
  } else {
192
- const oldIndex = newShowList.indexOf(String(active.id));
193
- const newIndex = newShowList.indexOf(String(over.id));
205
+ const oldIndex = newShowList.findIndex((i) => i.value === active.id);
206
+ const newIndex = newShowList.findIndex((i) => i.value === over.id);
207
+
194
208
  if (oldIndex !== -1 && newIndex !== -1) {
195
209
  const [removed] = newShowList.splice(oldIndex, 1);
196
210
  newShowList.splice(newIndex, 0, removed);
197
211
  }
198
212
  }
213
+ }
199
214
 
200
- setSettingsData((prev) => ({
201
- ...prev,
202
- quick_tab: {
203
- ...prev?.quick_tab,
204
- show_list: newShowList,
205
- hide_list: newHideList,
206
- },
207
- }));
208
- } else {
209
- // Move between lists
210
- let newShowList = [...(quickTabStates.show_list ?? [])];
211
- let newHideList = [...(quickTabStates.hide_list ?? [])];
212
- if (currentContainer === "list" && overContainer === "lanes") {
213
- if (newShowList.length >= 5) return; // prevent overflow
214
- // Move from hide to show
215
-
216
- const idx = newHideList.indexOf(String(active.id));
215
+ if (currentContainer !== overContainer) {
216
+ if (currentContainer === "list" && overContainer === "tabs") {
217
+ const idx = newHideList.findIndex((i) => i.value === String(active.id));
217
218
  if (idx !== -1) {
218
- newHideList.splice(idx, 1);
219
- newShowList.push(String(active.id));
219
+ const item = newHideList.splice(idx, 1)[0];
220
+ newShowList.push(item);
220
221
  }
221
- } else if (currentContainer === "lanes" && overContainer === "list") {
222
- // Move from show to hide
223
- const idx = newShowList.indexOf(String(active.id));
222
+ } else if (currentContainer === "tabs" && overContainer === "list") {
223
+ const idx = newShowList.findIndex((i) => i.value === String(active.id));
224
224
  if (idx !== -1) {
225
- newShowList.splice(idx, 1);
226
- newHideList.push(String(active.id));
225
+ const item = newShowList.splice(idx, 1)[0];
226
+ newHideList.push(item);
227
227
  }
228
228
  }
229
-
230
- setSettingsData((prev) => ({
231
- ...prev,
232
- quick_tab: {
233
- ...prev?.quick_tab,
234
- show_list: newShowList,
235
- hide_list: newHideList,
236
- },
237
- }));
238
229
  }
239
- };
240
-
241
- const filteredListValues = hideListValues.filter((value: any) =>
242
- value?.label?.toLowerCase().includes(searchTerm.toLowerCase())
243
- );
244
-
245
- // Show All/Hide All logic (local only)
246
- const handleShowAll = () => {
247
- const currentShowList = quickTabStates.show_list || [];
248
- const currentHideList = quickTabStates.hide_list || [];
249
-
250
- const availableSlots = 5 - currentShowList.length;
251
-
252
- if (availableSlots <= 0) return; // Already at limit
253
-
254
- const limitedHideList = currentHideList.slice(0, availableSlots);
255
230
 
256
- setSettingsData((prev) => ({
231
+ setKanbanSettingsData((prev) => ({
257
232
  ...prev,
258
- quick_tab: {
259
- ...prev?.quick_tab,
260
- show_list: [...currentShowList, ...limitedHideList],
261
- hide_list: currentHideList.filter(
262
- (item: string) => !limitedHideList.includes(item)
263
- ),
233
+ lane: {
234
+ ...prev.lane,
235
+ show_list: newShowList,
236
+ hide_list: newHideList,
264
237
  },
265
238
  }));
266
239
  };
267
240
 
268
- const handleHideAll = () => {
269
- setSettingsData((prev) => ({
241
+ const handleShowAll = () => {
242
+ setKanbanSettingsData((prev) => ({
270
243
  ...prev,
271
- quick_tab: {
272
- ...prev?.quick_tab,
273
- hide_list: [
274
- ...(prev?.quick_tab?.hide_list || []),
275
- ...(prev?.quick_tab?.show_list || []),
244
+ lane: {
245
+ ...prev?.lane,
246
+ show_list: [
247
+ ...(prev?.lane?.show_list || []),
248
+ ...(prev?.lane?.hide_list || []),
276
249
  ],
277
- show_list: [],
250
+ hide_list: [],
278
251
  },
279
252
  }));
280
253
  };
281
254
 
282
- // Checkbox logic (local only)
283
- const handleShowSubLaneChange = (e: React.ChangeEvent<HTMLInputElement>) => {
284
- setSettingsData((prev) => ({
255
+ const handleHideAll = () => {
256
+ setKanbanSettingsData((prev) => ({
285
257
  ...prev,
286
- quick_tab: {
287
- ...prev?.quick_tab,
288
- showSubLane: e.target.checked,
258
+ lane: {
259
+ ...prev?.lane,
260
+ hide_list: [
261
+ ...(prev?.lane?.hide_list || []),
262
+ ...(prev?.lane?.show_list || []),
263
+ ],
264
+ show_list: [],
289
265
  },
290
266
  }));
291
267
  };
292
268
 
293
- const handleShowColorColumnsChange = (
294
- e: React.ChangeEvent<HTMLInputElement>
269
+ const handleItemToggle = (
270
+ item: { label: string; value: string },
271
+ fromContainerId: string
295
272
  ) => {
296
- setSettingsData((prev) => ({
297
- ...prev,
298
- quick_tab: {
299
- ...prev?.quick_tab,
300
- showColorColumns: e.target.checked,
301
- },
302
- }));
303
- };
304
-
305
- const handleItemToggle = (itemId: string, fromContainerId: string) => {
306
- const toShowList = [...(quickTabStates.show_list ?? [])];
307
- const toHideList = [...(quickTabStates.hide_list ?? [])];
308
-
309
- if (fromContainerId === "list") {
310
- if (toShowList.length >= 5) return; // prevent overflow
311
- // Move from hide_list to show_list
312
- const index = toHideList.indexOf(itemId);
313
- if (index > -1) {
314
- toHideList.splice(index, 1);
315
- toShowList.push(itemId);
316
- }
317
- } else if (fromContainerId === "lanes") {
318
- // Move from show_list to hide_list
319
- const index = toShowList.indexOf(itemId);
320
- if (index > -1) {
321
- toShowList.splice(index, 1);
322
- toHideList.push(itemId);
273
+ setKanbanSettingsData((prev) => {
274
+ const toShowList = [...(kanbanSettingsData?.lane?.show_list ?? [])];
275
+ const toHideList = [...(kanbanSettingsData?.lane?.hide_list ?? [])];
276
+
277
+ if (fromContainerId === "list") {
278
+ const index = toHideList.findIndex((i) => i.value == item.value);
279
+ if (index > -1) {
280
+ toHideList.splice(index, 1);
281
+ toShowList.push(item);
282
+ }
283
+ } else if (fromContainerId === "tabs") {
284
+ const index = toShowList.findIndex((i) => i.value == item.value);
285
+ if (index > -1) {
286
+ toShowList.splice(index, 1);
287
+ toHideList.push(item);
288
+ }
323
289
  }
324
- }
325
-
326
- setSettingsData((prev) => ({
327
- ...prev,
328
- quick_tab: {
329
- ...prev?.quick_tab,
330
- show_list: toShowList,
331
- hide_list: toHideList,
332
- },
333
- }));
290
+ return {
291
+ ...prev,
292
+ lane: {
293
+ ...prev?.lane,
294
+ show_list: toShowList,
295
+ hide_list: toHideList,
296
+ },
297
+ };
298
+ });
334
299
  };
335
300
 
336
- const enableDND = quickTabStates?.sorting === "custom" ? true : false;
301
+ console.log("kanban", kanbanSettingsData);
337
302
 
303
+ /* ===========================================================
304
+ RENDER
305
+ =========================================================== */
338
306
  return (
339
- <Box
340
- sx={{
341
- display: "flex",
342
- flexDirection: "column",
343
- // gap: "0.5rem",
344
- height: "100%",
345
- }}
346
- >
307
+ <Box sx={{ display: "flex", flexDirection: "column", height: "100%" }}>
347
308
  <Typography variant="caption" sx={TabsStyles.mainTabsHeader}>
348
- *Quick filter settings will be reflected in vertical lanes
309
+ **Quick filter settings will be reflected in vertical lanes
349
310
  </Typography>
350
- <Box>
351
- <Grid sx={{ position: "relative" }} container>
352
- <Grid size={12}>
353
- <Box>
354
- <Grid sx={TabsStyles.mainTabDropdown} size={6}>
355
- <FormControl sx={TabsStyles.mainTabSelect} size="small">
356
- <Select
357
- value={quickTabStates?.attribute || ""}
358
- onChange={(e) =>
359
- setSettingsData((prev) => ({
360
- ...prev,
361
- quick_tab: {
362
- ...prev?.quick_tab,
363
- attribute: e.target.value,
364
- },
365
- }))
366
- }
367
- displayEmpty
368
- renderValue={(selected) => {
369
- if (!selected) {
370
- return <em>Select Attribute</em>;
371
- }
372
- return selected;
373
- }}
374
- >
375
- {LANE_SELECTS?.map((lane: any) => (
376
- <MenuItem key={lane?.key} value={lane?.value}>
377
- {lane?.value}
378
- </MenuItem>
379
- ))}
380
- </Select>
381
- </FormControl>
382
- <FormControl
383
- sx={TabsStyles.selectDropdownSeparator}
384
- size="small"
385
- >
386
- <Select
387
- value={quickTabStates?.sorting || "asc"}
388
- onChange={(e) =>
389
- setSettingsData((prev) => ({
390
- ...prev,
391
- quick_tab: {
392
- ...prev?.quick_tab,
393
- sorting: e.target.value,
394
- },
395
- }))
396
- }
397
- displayEmpty
398
- renderValue={(selected) => {
399
- if (!selected) {
400
- return <em>Sort by</em>;
401
- }
402
- const option = sortingOptions.find(
403
- (opt) => opt.value === selected
404
- );
405
- return option?.label || selected;
406
- }}
407
- >
408
- {sortingOptions.map((option) => (
409
- <MenuItem key={option?.value} value={option?.value}>
410
- {option?.label}
411
- </MenuItem>
412
- ))}
413
- </Select>
414
- </FormControl>
415
- </Grid>
416
- </Box>
311
+
312
+ <Grid sx={{ position: "relative" }} container>
313
+ {/* Attribute + Sort */}
314
+ <Grid size={12}>
315
+ <Grid sx={TabsStyles.mainTabDropdown} size={6}>
316
+ <FormControl sx={TabsStyles.mainTabSelect} size="small">
317
+ <Select
318
+ value={kanbanSettingsData?.lane?.attribute || ""}
319
+ onChange={(e) =>
320
+ setKanbanSettingsData((prev) => ({
321
+ ...prev,
322
+ lane: {
323
+ ...prev?.lane,
324
+ attribute: e.target.value,
325
+ },
326
+ }))
327
+ }
328
+ >
329
+ {selectAttributeData
330
+ ?.filter(
331
+ (i) => i?.value !== kanbanSettingsData?.swim_lane?.attribute
332
+ )
333
+ ?.map((lane: any) => (
334
+ <MenuItem key={lane?.key} value={lane?.value}>
335
+ {lane?.label}
336
+ </MenuItem>
337
+ ))}
338
+ </Select>
339
+ </FormControl>
340
+
341
+ <FormControl sx={TabsStyles.selectDropdownSeparator} size="small">
342
+ <Select
343
+ value={displaySortingValue || ""}
344
+ disabled={isWorkflowAttribute}
345
+ onChange={(e) => {
346
+ if (!isWorkflowAttribute) {
347
+ const value = e.target.value as
348
+ | "asc"
349
+ | "dsc"
350
+ | "count_asc"
351
+ | "count_dsc"
352
+ | "custom";
353
+
354
+ setKanbanSettingsData((prev) => ({
355
+ ...prev,
356
+ lane: {
357
+ ...prev?.lane,
358
+ sorting: value,
359
+ },
360
+ }));
361
+ }
362
+ }}
363
+ >
364
+ {isWorkflowAttribute && (
365
+ <MenuItem value="workflow_sequence">
366
+ Workflow Sequence
367
+ </MenuItem>
368
+ )}
369
+
370
+ {!isWorkflowAttribute &&
371
+ sortingOptions.map((option) => (
372
+ <MenuItem key={option.value} value={option.value}>
373
+ {option.label}
374
+ </MenuItem>
375
+ ))}
376
+ </Select>
377
+ </FormControl>
417
378
  </Grid>
418
- <Grid>
419
- {/* <Alert
420
- severity="info"
421
- sx={{
422
- fontSize: "12px",
423
- color: "#088AB2",
424
- }}
425
- >
426
- Please select at least 1 and at most 5 values to display as lanes.
427
- </Alert> */}
379
+ </Grid>
380
+
381
+ {/* LISTING + DRAG */}
382
+ <DndContext
383
+ sensors={sensors}
384
+ collisionDetection={closestCenter}
385
+ onDragEnd={handleDragEnd}
386
+ >
387
+ <Grid sx={{ mt: 2 }} container spacing={2} size={12}>
388
+ <ListingValues
389
+ buttonText="Show All"
390
+ onClick={handleShowAll}
391
+ headerText="List of Values"
392
+ filteredValues={filteredListValues}
393
+ searchTerm={searchTerm}
394
+ setSearchTerm={setSearchTerm}
395
+ containerId="list"
396
+ tabsApiDataLoading={tabsApiDataLoading}
397
+ onItemToggle={handleItemToggle}
398
+ enableDragAndDrop={enableDND}
399
+ />
400
+
401
+ <ListingValues
402
+ buttonText="Hide All"
403
+ onClick={handleHideAll}
404
+ headerText="View as Lanes"
405
+ filteredValues={showListValues}
406
+ containerId="tabs"
407
+ onItemToggle={handleItemToggle}
408
+ enableDragAndDrop={enableDND}
409
+ />
428
410
  </Grid>
429
- <DndContext
430
- sensors={sensors}
431
- collisionDetection={closestCenter}
432
- onDragEnd={handleDragEnd}
433
- >
434
- <Grid sx={{ mt: 2 }} container spacing={2} size={12}>
435
- <ListingValues
436
- buttonText="Show All"
437
- onClick={handleShowAll}
438
- headerText="List of Values"
439
- filteredValues={filteredListValues}
440
- searchTerm={searchTerm}
441
- setSearchTerm={setSearchTerm}
442
- containerId="list"
443
- tabsApiDataLoading={tabsApiDataLoading}
444
- onItemToggle={handleItemToggle}
445
- enableDragAndDrop={enableDND}
446
- />
447
- <ListingValues
448
- buttonText="Hide All"
449
- onClick={handleHideAll}
450
- headerText="View as Lanes"
451
- filteredValues={showListValues}
452
- containerId="lanes"
453
- // tabsApiDataLoading={tabsApiDataLoading}
454
- onItemToggle={handleItemToggle}
455
- enableDragAndDrop={enableDND}
456
- AlertComponenet={
457
- <InfoAlert
458
- message="Please select at least 1 and at most 5 values to display as
459
- lanes."
460
- width={"49%"}
461
- position="absolute"
462
- color="#088AB2"
463
- top={10}
464
- zIndex={1}
465
- />
466
- }
467
- />
468
- </Grid>
469
- </DndContext>
411
+ </DndContext>
412
+
413
+ {/* SUBLANE CHECKBOX */}
414
+ {kanbanSettingsData?.lane?.attribute === "stage_group" && (
470
415
  <Grid size={12}>
471
416
  <Box sx={TabsStyles.checkboxStyle}>
472
417
  <FormControlLabel
473
418
  control={
474
419
  <Checkbox
475
- checked={quickTabStates?.showSubLane || false}
476
- onChange={handleShowSubLaneChange}
420
+ checked={kanbanSettingsData?.lane?.isSubLane || false}
421
+ onChange={(e) =>
422
+ setKanbanSettingsData((prev) => ({
423
+ ...prev,
424
+ lane: {
425
+ ...prev?.lane,
426
+ isSubLane: e.target.checked,
427
+ },
428
+ }))
429
+ }
477
430
  size="small"
478
- sx={{
479
- "&.Mui-checked": {
480
- color: "#7A5AF8",
481
- },
482
- }}
483
431
  />
484
432
  }
485
433
  label="Show Sublane"
486
434
  />
487
- <FormControlLabel
488
- control={
489
- <Checkbox
490
- checked={quickTabStates?.showColorColumns || false}
491
- onChange={handleShowColorColumnsChange}
492
- size="small"
493
- sx={{
494
- "&.Mui-checked": {
495
- color: "#7A5AF8",
496
- },
497
- }}
498
- />
499
- }
500
- label="Show Color columns"
501
- />
502
435
  </Box>
503
436
  </Grid>
504
- </Grid>
505
- </Box>
437
+ )}
438
+
439
+ {/* SUBLANE STAGE SELECT */}
440
+ {kanbanSettingsData?.lane?.attribute === "stage_group" &&
441
+ kanbanSettingsData?.lane?.isSubLane && (
442
+ <Grid size={12}>
443
+ <Grid sx={TabsStyles.mainTabDropdown} size={6}>
444
+ <FormControl sx={TabsStyles.mainTabSelect} size="small">
445
+ <Select value="Stage">
446
+ <MenuItem value="Stage">Stage</MenuItem>
447
+ </Select>
448
+ </FormControl>
449
+ </Grid>
450
+ </Grid>
451
+ )}
452
+ </Grid>
506
453
  </Box>
507
454
  );
508
455
  };