oa-componentbook 1.0.1-stage.44 → 1.0.1-stage.440

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.
Files changed (136) hide show
  1. package/build/components/oa-component-accordion/Accordion.js +123 -43
  2. package/build/components/oa-component-accordion/styles.js +2 -2
  3. package/build/components/oa-component-button/CustomButton.js +24 -19
  4. package/build/components/oa-component-button/styles.js +1 -1
  5. package/build/components/oa-component-checkbox/CustomCheckBox.js +20 -17
  6. package/build/components/oa-component-checkbox/styles.js +1 -1
  7. package/build/components/oa-component-datepicker/CustomDatePicker.js +37 -26
  8. package/build/components/oa-component-drawer/CustomDrawer.js +2 -0
  9. package/build/components/oa-component-dropdown/CustomDropdown.js +16 -4
  10. package/build/components/oa-component-icons/MaterialIcon.js +1 -1
  11. package/build/components/oa-component-modal/CustomModal.js +59 -48
  12. package/build/components/oa-component-modal/styles.js +3 -2
  13. package/build/components/oa-component-pagination/CustomPagination.js +111 -0
  14. package/build/components/oa-component-pagination/styles.js +12 -0
  15. package/build/components/oa-component-progress-bar/CustomProgressBar.js +8 -4
  16. package/build/components/oa-component-select/CustomSelect.js +130 -56
  17. package/build/components/oa-component-steps/CustomSteps.js +117 -0
  18. package/build/components/oa-component-steps/styles.js +12 -0
  19. package/build/components/oa-component-table/CustomTable.js +28 -5
  20. package/build/components/oa-component-table/CustomTableV1.js +613 -0
  21. package/build/components/oa-component-table/styles.js +1 -1
  22. package/build/components/oa-component-table/stylesV1.js +19 -0
  23. package/build/components/oa-component-tabs/CustomTabs.js +1 -1
  24. package/build/components/oa-component-tag/CustomTag.js +29 -11
  25. package/build/components/oa-component-tag/styles.js +30 -3
  26. package/build/components/oa-component-textarea/CustomTextArea.js +161 -0
  27. package/build/components/oa-component-textarea/constants.js +39 -0
  28. package/build/components/oa-component-textarea/styles.js +12 -3
  29. package/build/components/oa-component-tooltip/CustomTooltip.js +8 -4
  30. package/build/components/oa-component-upload/CustomUpload.js +129 -42
  31. package/build/components/oa-component-viewer/CustomViewer.js +17 -11
  32. package/build/dev/oa-component-document-viewer/CustomDocumentViewer.js +367 -0
  33. package/build/dev/oa-component-document-viewer/styles.js +12 -0
  34. package/build/dev/oa-component-upload/CustomUpload.js +116 -29
  35. package/build/dev/oa-component-upload/styles.js +2 -2
  36. package/build/dev/oa-widget-document-modal/DocumentSideModal.js +166 -0
  37. package/build/dev/oa-widget-document-modal/styles.js +12 -0
  38. package/build/dev/oa-widget-document-side-drawer/DocumentSideDrawer.js +196 -0
  39. package/build/dev/oa-widget-document-side-drawer/styles.js +12 -0
  40. package/build/global-css/GlobalCss.js +2 -1
  41. package/build/global-css/GridLayout.js +1 -1
  42. package/build/global-css/commonStyles.js +11 -0
  43. package/build/images/Car.png +0 -0
  44. package/build/images/TwoWheeler.png +0 -0
  45. package/build/images/astronaut_emptystate.png +0 -0
  46. package/build/images/exportGrp01.png +0 -0
  47. package/build/images/exportGrp02.png +0 -0
  48. package/build/images/exportGrp03.png +0 -0
  49. package/build/images/outOfStock.png +0 -0
  50. package/build/index.js +114 -2
  51. package/build/layout/DetailDataLayout/DetailDataLayout.js +20 -0
  52. package/build/layout/DetailDataLayout/components/Form.js +22 -0
  53. package/build/layout/DetailDataLayout/components/Header.js +32 -0
  54. package/build/layout/DetailDataLayout/style.css +9 -0
  55. package/build/layout/DetailDataLayout/styles.js +12 -0
  56. package/build/layout/EntityOverviewLayout/EntityOverviewLayout.js +403 -0
  57. package/build/layout/EntityOverviewLayout/reducer/entityOverviewLayoutReducer.js +85 -0
  58. package/build/layout/EntityOverviewLayout/styles.js +13 -0
  59. package/build/layout/GenricLayOut/GenricLayOut.js +2421 -0
  60. package/build/layout/GenricLayOut/components/AppliedFilters.js +90 -0
  61. package/build/layout/GenricLayOut/components/CardList.js +34 -0
  62. package/build/layout/GenricLayOut/components/DropdownSearch.js +48 -0
  63. package/build/layout/GenricLayOut/components/Header.js +74 -0
  64. package/build/layout/GenricLayOut/components/Modal.js +96 -0
  65. package/build/layout/GenricLayOut/components/ProfileSection.js +219 -0
  66. package/build/layout/GenricLayOut/components/Search.js +51 -0
  67. package/build/layout/GenricLayOut/components/StaticFilter.css +73 -0
  68. package/build/layout/GenricLayOut/components/StaticFilter.js +37 -0
  69. package/build/layout/GenricLayOut/reducer/layoutReducer.js +310 -0
  70. package/build/layout/GenricLayOut/resolver/staticConfigResolver.js +98 -0
  71. package/build/layout/GenricLayOut/styles.js +42 -0
  72. package/build/utils/download-file.js +23 -0
  73. package/build/widgets/oa-form-widget/FormWidget.js +577 -0
  74. package/build/widgets/oa-form-widget/FormWidgetStyle.js +18 -0
  75. package/build/widgets/oa-widget-add-spare-part/AddSparePartCollapseWidget.js +80 -16
  76. package/build/widgets/oa-widget-add-spare-part/AddSparePartWidget.js +50 -7
  77. package/build/widgets/oa-widget-address/AddressWidget.js +12 -17
  78. package/build/widgets/oa-widget-approval/ApprovalWidget.js +19 -11
  79. package/build/widgets/oa-widget-approval/ApprovalWidgetNew.js +492 -0
  80. package/build/widgets/oa-widget-approval/styles.js +2 -2
  81. package/build/widgets/oa-widget-chat/ChatWidget.js +5 -5
  82. package/build/widgets/oa-widget-close-claim/CloseClaimWidget.js +17 -5
  83. package/build/widgets/oa-widget-collapsible-key-value/CollapsibleKeyValueWidget.js +396 -0
  84. package/build/widgets/oa-widget-collapsible-key-value/styles.js +16 -0
  85. package/build/widgets/oa-widget-content-panel/ContentPanel.js +82 -0
  86. package/build/widgets/oa-widget-content-panel/styles.js +12 -0
  87. package/build/widgets/oa-widget-customer-rating-card/CustomerRatingCard.js +5 -5
  88. package/build/widgets/oa-widget-detailcard/styles.js +1 -1
  89. package/build/widgets/oa-widget-document-upload/DocUploadWidget.js +6 -9
  90. package/build/widgets/oa-widget-dropdown-search-input/DropdownSearchInput.js +53 -19
  91. package/build/widgets/oa-widget-dropdown-search-input/styles.js +1 -1
  92. package/build/widgets/oa-widget-guide/GuideWidget.js +70 -0
  93. package/build/widgets/oa-widget-guide/GuideWidgetStyle.js +12 -0
  94. package/build/widgets/oa-widget-hub-automation-modal/HubAutomationDeleteBiker.js +24 -0
  95. package/build/widgets/oa-widget-hub-automation-modal/HubAutomationModal.js +34 -0
  96. package/build/widgets/oa-widget-hub-automation-modal/HubAutomationModalStyle.js +13 -0
  97. package/build/widgets/oa-widget-image-carousel/ImageCarouselWidget.js +256 -0
  98. package/build/widgets/oa-widget-image-carousel/styles.js +23 -0
  99. package/build/widgets/oa-widget-image-gallery/FullscreenViewer.js +169 -0
  100. package/build/widgets/oa-widget-image-gallery/ImageGallery.js +87 -0
  101. package/build/widgets/oa-widget-image-gallery/ThumbnailGrid.js +146 -0
  102. package/build/widgets/oa-widget-image-gallery/imageCache.js +15 -0
  103. package/build/widgets/oa-widget-image-gallery/imageGalleryStyle.js +16 -0
  104. package/build/widgets/oa-widget-item-info-card/InfoCardListWidget.js +60 -0
  105. package/build/widgets/oa-widget-item-info-card/ItemInfoCardWidget.js +83 -0
  106. package/build/widgets/oa-widget-item-info-card/styles.css +50 -0
  107. package/build/widgets/oa-widget-item-info-card/styles.js +14 -0
  108. package/build/widgets/oa-widget-key-value/KeyValueWidget.js +46 -12
  109. package/build/widgets/oa-widget-key-value/styles.js +1 -1
  110. package/build/widgets/oa-widget-kpi/KPICardWidget.js +86 -0
  111. package/build/widgets/oa-widget-kpi/styles.js +12 -0
  112. package/build/widgets/oa-widget-map-base-location/AddressDetails.js +21 -7
  113. package/build/widgets/oa-widget-map-base-location/AddressForm.js +32 -5
  114. package/build/widgets/oa-widget-map-base-location/MapBaseLocation.js +9 -3
  115. package/build/widgets/oa-widget-map-base-location/MapComponent.js +17 -2
  116. package/build/widgets/oa-widget-membershipcard/MembershipCard.js +14 -3
  117. package/build/widgets/oa-widget-membershipcard/styles.js +1 -1
  118. package/build/widgets/oa-widget-notes/NotesWidget.js +32 -30
  119. package/build/widgets/oa-widget-notes/styles.js +4 -3
  120. package/build/widgets/oa-widget-profile-data/ProfileDataWidget.js +165 -0
  121. package/build/widgets/oa-widget-profile-data/styles.js +13 -0
  122. package/build/widgets/oa-widget-progressive-steps/ProgressiveStepsWidget.js +362 -0
  123. package/build/widgets/oa-widget-progressive-steps/styles.js +12 -0
  124. package/build/widgets/oa-widget-reimbursement-breakup/ReimbursementBreakupWidget.js +18 -9
  125. package/build/widgets/oa-widget-reimbursement-breakup/styles.js +1 -1
  126. package/build/widgets/oa-widget-reupload-drawer/ReUploadDrawer.js +164 -0
  127. package/build/widgets/oa-widget-select-list-item-modal/SelectListItemModal.js +91 -0
  128. package/build/widgets/oa-widget-sidebar/SidebarWidget.js +175 -0
  129. package/build/widgets/oa-widget-sidebar/components/Header.js +33 -0
  130. package/build/widgets/oa-widget-sidebar/styles.js +13 -0
  131. package/build/widgets/oa-widget-spare-part/SparePartsWidget.js +63 -35
  132. package/build/widgets/oa-widget-track-shipment-list/fn.js +16 -4
  133. package/build/widgets/oa-widget-user-management/UserManagementWidget.js +407 -0
  134. package/build/widgets/oa-widget-user-management/styles.js +15 -0
  135. package/package.json +4 -2
  136. package/build/components/oa-component-textarea/TextArea.js +0 -74
@@ -0,0 +1,2421 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.weak-map.js");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ require("core-js/modules/web.dom-collections.iterator.js");
9
+ require("core-js/modules/es.promise.js");
10
+ require("core-js/modules/es.string.trim.js");
11
+ require("core-js/modules/es.symbol.description.js");
12
+ require("core-js/modules/es.object.assign.js");
13
+ var _react = _interopRequireWildcard(require("react"));
14
+ var _layoutReducer = require("./reducer/layoutReducer");
15
+ var _GlobalCss = _interopRequireDefault(require("../../global-css/GlobalCss"));
16
+ var _SidebarWidget = _interopRequireDefault(require("../../widgets/oa-widget-sidebar/SidebarWidget"));
17
+ var _CardList = _interopRequireDefault(require("./components/CardList"));
18
+ var _DropdownSearch = _interopRequireDefault(require("./components/DropdownSearch"));
19
+ var _Header = _interopRequireDefault(require("./components/Header"));
20
+ var _Search = _interopRequireDefault(require("./components/Search"));
21
+ var _staticConfigResolver = _interopRequireWildcard(require("./resolver/staticConfigResolver"));
22
+ var _CustomTableV = _interopRequireDefault(require("../../components/oa-component-table/CustomTableV1"));
23
+ var _CustomDrawer = _interopRequireDefault(require("../../components/oa-component-drawer/CustomDrawer"));
24
+ var _DetailDataLayout = _interopRequireDefault(require("../DetailDataLayout/DetailDataLayout"));
25
+ var _CustomTabs = _interopRequireDefault(require("../../components/oa-component-tabs/CustomTabs"));
26
+ var _CustomNotification = _interopRequireDefault(require("../../components/oa-component-notification/CustomNotification"));
27
+ var _ContentPanel = _interopRequireDefault(require("../../widgets/oa-widget-content-panel/ContentPanel"));
28
+ var _styles = require("./styles");
29
+ var _CustomButton = _interopRequireDefault(require("../../components/oa-component-button/CustomButton"));
30
+ var _Typography = _interopRequireDefault(require("../../components/oa-component-typography/Typography"));
31
+ var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
32
+ var _Modal = _interopRequireDefault(require("./components/Modal"));
33
+ var _antd = require("antd");
34
+ var _astronaut_emptystate = _interopRequireDefault(require("../../images/astronaut_emptystate.png"));
35
+ var _CustomViewer = _interopRequireDefault(require("../../components/oa-component-viewer/CustomViewer"));
36
+ var _StaticFilter = _interopRequireDefault(require("./components/StaticFilter"));
37
+ var _downloadFile = _interopRequireDefault(require("../../utils/download-file"));
38
+ var _AppliedFilters = _interopRequireDefault(require("./components/AppliedFilters"));
39
+ var _ProfileSection = _interopRequireDefault(require("./components/ProfileSection"));
40
+ var _FilterListRounded = _interopRequireDefault(require("@material-ui/icons/FilterListRounded"));
41
+ var _CustomInfo = _interopRequireDefault(require("../../components/oa-component-info/CustomInfo"));
42
+ const _excluded = ["filteredValue"],
43
+ _excluded2 = ["sortOrder"];
44
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
45
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
46
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
47
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
48
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
49
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
50
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
51
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
52
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
53
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
54
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* eslint-disable */
55
+ function GenricLayOut(_ref) {
56
+ var _state$misc30, _sidebar$mobileMenuIt, _imageViewer$content, _imageViewer$content2, _leftHeaderFirstButto, _leftHeaderFirstButto2, _infoPanel$data, _infoPanel$data2, _infoPanel$data3, _infoPanel$data4, _infoPanel$data5, _state$customDrawer3, _state$customDrawer4, _tabs$list, _tables$columns3, _tables$columns4, _tabs$active3, _state$tables5, _tables$selectionType, _tabs$active4, _tables$selectionType2, _tables$pagination17, _drawer$data, _tabs$active5, _drawer$data$drawer$a, _drawer$data2, _tabs$active6, _tabs$active7, _nestedDrawer$data, _nestedDrawer$data$ca, _nestedDrawer$data2, _customDrawer$data, _customDrawer$data2, _contentPanel$dataSou, _tables$tableFooter, _tables$selectedRowKe, _tables$tableFooter2, _tables$tableFooter3, _tables$tableFooter5;
57
+ let {
58
+ config,
59
+ getInitialData,
60
+ generateS3Url,
61
+ uploadOnS3,
62
+ handlers: {
63
+ handleTabClick,
64
+ handleFooterClick,
65
+ handleTableChange,
66
+ handleDropdownSearchInputChange,
67
+ handleDropdownSearchOptionChange,
68
+ handleTableColumnClick,
69
+ handleSecondaryTableCTAClick,
70
+ handleDropdownSearchEnter,
71
+ handleDropdownSearchClear,
72
+ handleInputSearchChange,
73
+ handleInputSearchEnter,
74
+ handleInputSearchClear,
75
+ handleDrawerFormOnFinish,
76
+ downloadFileOnS3,
77
+ handleModalDataSet,
78
+ handleActionOnTableCTAClick,
79
+ handleModalCloseSuccess,
80
+ handleSubHeadingSelectClick,
81
+ handleCollapsibleKeyData,
82
+ handleProfileReroute,
83
+ handleTableFooterApi,
84
+ handleSwitchSelectItem,
85
+ handleTableColumnClickParent,
86
+ handleLeftHeaderFirstButton
87
+ } = {}
88
+ } = _ref;
89
+ const [state, dispatch] = (0, _react.useReducer)(_layoutReducer.genericLayoutReducer, config !== null && config !== void 0 ? config : _layoutReducer.initialState);
90
+ const [headerButtons, setHeaderButtons] = (0, _react.useState)(null);
91
+ const stateRef = (0, _react.useRef)(state);
92
+ const notificationRef = (0, _react.useRef)(null);
93
+ const openNotification = (0, _react.useCallback)(params => notificationRef.current.openNotification(params), []);
94
+ const {
95
+ header,
96
+ cards,
97
+ sidebar,
98
+ dropdownSearch,
99
+ inputSearch,
100
+ tables,
101
+ drawer,
102
+ tabs,
103
+ contentPanel,
104
+ nestedDrawer,
105
+ modal,
106
+ leftHeaderFirstButton,
107
+ rightHeaderFirstButton,
108
+ rightHeaderSecondButton,
109
+ imageViewer,
110
+ customDrawer,
111
+ staticFilter,
112
+ profileData,
113
+ infoPanel
114
+ } = state !== null && state !== void 0 ? state : {};
115
+ (0, _react.useEffect)(() => {
116
+ init();
117
+ }, []);
118
+ (0, _react.useEffect)(() => {
119
+ stateRef.current = state;
120
+ }, [state]);
121
+ (0, _react.useEffect)(() => {
122
+ const observer = new MutationObserver(e => {
123
+ const parent = document.querySelector(".oaheaderButtons");
124
+ if (parent) {
125
+ var _parent$children;
126
+ setHeaderButtons(parent);
127
+ if ((parent === null || parent === void 0 || (_parent$children = parent.children) === null || _parent$children === void 0 ? void 0 : _parent$children.length) === 1) {
128
+ parent.classList.add("single-child");
129
+ }
130
+ }
131
+ });
132
+ observer.observe(document.body, {
133
+ childList: true,
134
+ subtree: true
135
+ });
136
+ return () => {
137
+ observer.disconnect();
138
+ };
139
+ }, [headerButtons]);
140
+
141
+ // Check for notification data after component mounts (after reload)
142
+ (0, _react.useEffect)(() => {
143
+ const notificationData = sessionStorage.getItem("showEnterpriseNotification");
144
+ if (notificationData) {
145
+ try {
146
+ const {
147
+ message
148
+ } = JSON.parse(notificationData);
149
+ showSuccessNotification(message);
150
+ sessionStorage.removeItem("showEnterpriseNotification");
151
+ } catch (error) {
152
+ console.error("Error parsing notification data:", error);
153
+ sessionStorage.removeItem("showEnterpriseNotification");
154
+ }
155
+ }
156
+ }, []);
157
+
158
+ /**
159
+ * Initializes the layout by fetching initial data and updating the state.
160
+ *
161
+ * If `getInitialData` is provided, it fetches data using the currently active tab and any additional state information.
162
+ * On error, it shows an error notification and sets the table to empty.
163
+ * On success, it replaces variables in the config with the fetched data and initializes the state.
164
+ */
165
+
166
+ const init = async () => {
167
+ dispatch({
168
+ type: _layoutReducer.actionTypes.SET_LOADING,
169
+ payload: true
170
+ });
171
+ if (getInitialData) {
172
+ var _config$tabs, _config$misc;
173
+ const {
174
+ error,
175
+ data
176
+ } = await (getInitialData === null || getInitialData === void 0 ? void 0 : getInitialData(_objectSpread(_objectSpread({}, config !== null && config !== void 0 && (_config$tabs = config.tabs) !== null && _config$tabs !== void 0 && _config$tabs.active ? {
177
+ selectedTab: config.tabs.active
178
+ } : {}), (_config$misc = config === null || config === void 0 ? void 0 : config.misc) !== null && _config$misc !== void 0 ? _config$misc : {})));
179
+ if (error) {
180
+ showErrorNotification(error);
181
+ const dynamicConfig = (0, _staticConfigResolver.default)(config, {});
182
+ dispatch({
183
+ type: _layoutReducer.actionTypes.INIT,
184
+ payload: dynamicConfig
185
+ });
186
+ dispatch({
187
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
188
+ });
189
+ } else {
190
+ const dynamicConfig = (0, _staticConfigResolver.default)(config, data !== null && data !== void 0 ? data : {});
191
+ dispatch({
192
+ type: _layoutReducer.actionTypes.INIT,
193
+ payload: dynamicConfig
194
+ });
195
+ }
196
+ }
197
+ dispatch({
198
+ type: _layoutReducer.actionTypes.SET_LOADING,
199
+ payload: false
200
+ });
201
+ };
202
+
203
+ /**
204
+ * Shows an error notification.
205
+ *
206
+ * @param {string} message - Error message to show in the notification.
207
+ *
208
+ * @returns {void}
209
+ */
210
+ const showErrorNotification = message => {
211
+ openNotification({
212
+ description: message,
213
+ type: "failure",
214
+ mode: "dark",
215
+ showIcon: true,
216
+ placement: "bottomRight"
217
+ });
218
+ };
219
+
220
+ /**
221
+ * Shows a success notification.
222
+ *
223
+ * @param {string} message - Message to show in the notification.
224
+ *
225
+ * @returns {void}
226
+ */
227
+ const showSuccessNotification = message => {
228
+ openNotification({
229
+ description: message,
230
+ type: "success",
231
+ mode: "dark",
232
+ showIcon: true,
233
+ placement: "bottomRight"
234
+ });
235
+ };
236
+ const setStaticFilterData = data => {
237
+ var _staticFilter$data$fi, _config$staticFilter, _staticFilter$data;
238
+ const selectedKey = staticFilter === null || staticFilter === void 0 || (_staticFilter$data$fi = staticFilter.data.find(item => item.selected)) === null || _staticFilter$data$fi === void 0 ? void 0 : _staticFilter$data$fi.value;
239
+ const dynamicConfig = (0, _staticConfigResolver.default)(config === null || config === void 0 || (_config$staticFilter = config.staticFilter) === null || _config$staticFilter === void 0 ? void 0 : _config$staticFilter.data, data !== null && data !== void 0 ? data : {});
240
+ const storePreviousFilters = staticFilter === null || staticFilter === void 0 || (_staticFilter$data = staticFilter.data) === null || _staticFilter$data === void 0 ? void 0 : _staticFilter$data.map((filter, idx) => {
241
+ var _dynamicConfig$idx;
242
+ return _objectSpread(_objectSpread({}, filter), {}, {
243
+ label: (dynamicConfig === null || dynamicConfig === void 0 || (_dynamicConfig$idx = dynamicConfig[idx]) === null || _dynamicConfig$idx === void 0 ? void 0 : _dynamicConfig$idx.label) || filter.label
244
+ });
245
+ });
246
+ dispatch({
247
+ type: _layoutReducer.actionTypes.SET_STATIC_FILTER,
248
+ payload: storePreviousFilters
249
+ });
250
+ dispatch({
251
+ type: _layoutReducer.actionTypes.SET_STATIC_FILTER_SELECTION,
252
+ payload: selectedKey
253
+ });
254
+ };
255
+
256
+ /**
257
+ * Handles the change of the search input value.
258
+ *
259
+ * Updates the `inputSearchValue` state with the new search input value,
260
+ * and if the value is empty, calls the `handleInputSearchChange` callback
261
+ * with the current selected tab and pagination state.
262
+ *
263
+ * @param {{ target: { value: string } }} e - The change event.
264
+ *
265
+ * @returns {Promise<void>} - Resolves when the data has been fetched and the state has been updated.
266
+ */
267
+ const onSearchInputChange = async _ref2 => {
268
+ let {
269
+ target: {
270
+ value
271
+ }
272
+ } = _ref2;
273
+ dispatch({
274
+ type: _layoutReducer.actionTypes.SET_INPUT_SEARCH_VALUE,
275
+ payload: value
276
+ });
277
+ if (value === "") {
278
+ if (handleInputSearchChange) {
279
+ var _state$inputSearch, _state$tabs, _customDrawer$applied, _config$tables, _config$tables2, _tables$sorting, _tables$sorting2, _header$subHeading, _header$subHeading2, _state$misc;
280
+ dispatch({
281
+ type: _layoutReducer.actionTypes.SET_LOADING,
282
+ payload: true
283
+ });
284
+ const {
285
+ error,
286
+ data
287
+ } = await handleInputSearchChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, state === null || state === void 0 || (_state$inputSearch = state.inputSearch) === null || _state$inputSearch === void 0 ? void 0 : _state$inputSearch.request), state !== null && state !== void 0 && (_state$tabs = state.tabs) !== null && _state$tabs !== void 0 && _state$tabs.active ? {
288
+ selectedTab: state.tabs.active
289
+ } : {}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied !== void 0 ? _customDrawer$applied : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), {}, {
290
+ current: config === null || config === void 0 || (_config$tables = config.tables) === null || _config$tables === void 0 || (_config$tables = _config$tables.pagination) === null || _config$tables === void 0 ? void 0 : _config$tables.current,
291
+ pageSize: config === null || config === void 0 || (_config$tables2 = config.tables) === null || _config$tables2 === void 0 || (_config$tables2 = _config$tables2.pagination) === null || _config$tables2 === void 0 ? void 0 : _config$tables2.pageSize,
292
+ field: tables === null || tables === void 0 || (_tables$sorting = tables.sorting) === null || _tables$sorting === void 0 ? void 0 : _tables$sorting.sortBy,
293
+ order: tables === null || tables === void 0 || (_tables$sorting2 = tables.sorting) === null || _tables$sorting2 === void 0 ? void 0 : _tables$sorting2.sortDirection
294
+ }, (header === null || header === void 0 || (_header$subHeading = header.subHeading) === null || _header$subHeading === void 0 || (_header$subHeading = _header$subHeading.jsxConfig) === null || _header$subHeading === void 0 ? void 0 : _header$subHeading.type) == "select" ? {
295
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading2 = header.subHeading) === null || _header$subHeading2 === void 0 || (_header$subHeading2 = _header$subHeading2.jsxConfig) === null || _header$subHeading2 === void 0 ? void 0 : _header$subHeading2.value
296
+ } : {}), (_state$misc = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc !== void 0 ? _state$misc : {}));
297
+ if (error) {
298
+ showErrorNotification(error);
299
+ dispatch({
300
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
301
+ });
302
+ } else {
303
+ var _config$tables3, _config$tables4;
304
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
305
+ setStaticFilterData(data);
306
+ }
307
+ dispatch({
308
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
309
+ payload: data
310
+ });
311
+ dispatch({
312
+ type: _layoutReducer.actionTypes.SET_PAGINATION,
313
+ payload: {
314
+ current: config === null || config === void 0 || (_config$tables3 = config.tables) === null || _config$tables3 === void 0 || (_config$tables3 = _config$tables3.pagination) === null || _config$tables3 === void 0 ? void 0 : _config$tables3.current,
315
+ pageSize: config === null || config === void 0 || (_config$tables4 = config.tables) === null || _config$tables4 === void 0 || (_config$tables4 = _config$tables4.pagination) === null || _config$tables4 === void 0 ? void 0 : _config$tables4.pageSize
316
+ }
317
+ });
318
+ }
319
+ dispatch({
320
+ type: _layoutReducer.actionTypes.SET_LOADING,
321
+ payload: false
322
+ });
323
+ }
324
+ }
325
+ };
326
+
327
+ /**
328
+ * Handles the "Enter" key press event for the search input.
329
+ *
330
+ * Trims the search input value and validates it. If the value is invalid or empty,
331
+ * an error is dispatched. If valid, it dispatches the search value and invokes the
332
+ * `handleInputSearchEnter` callback to fetch data based on the search criteria.
333
+ *
334
+ * @returns {Promise<void>} - Resolves when the data has been fetched and the state has been updated.
335
+ */
336
+
337
+ const onSearchPressEnter = async () => {
338
+ var _state$inputSearch2;
339
+ const {
340
+ value,
341
+ validateInput,
342
+ request
343
+ } = (_state$inputSearch2 = state === null || state === void 0 ? void 0 : state.inputSearch) !== null && _state$inputSearch2 !== void 0 ? _state$inputSearch2 : {};
344
+ const trimedValue = value === null || value === void 0 ? void 0 : value.trim();
345
+ if (trimedValue === "" || !(validateInput !== null && validateInput !== void 0 && validateInput(trimedValue))) {
346
+ dispatch({
347
+ type: _layoutReducer.actionTypes.SET_INPUT_SEARCH_ERROR,
348
+ payload: trimedValue === "" ? null : "Please enter a valid ".concat(selectedOption)
349
+ });
350
+ return;
351
+ }
352
+ dispatch({
353
+ type: _layoutReducer.actionTypes.SET_INPUT_SEARCH_VALUE,
354
+ payload: trimedValue
355
+ });
356
+ if (handleInputSearchEnter) {
357
+ var _state$tabs2, _config$tables5, _config$tables6, _tables$sorting3, _tables$sorting4, _customDrawer$applied2, _header$subHeading3, _header$subHeading4, _state$misc2;
358
+ const {
359
+ error,
360
+ data
361
+ } = await handleInputSearchEnter(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, state !== null && state !== void 0 && (_state$tabs2 = state.tabs) !== null && _state$tabs2 !== void 0 && _state$tabs2.active ? {
362
+ selectedTab: state.tabs.active
363
+ } : {}), {}, {
364
+ searchedValue: trimedValue,
365
+ current: config === null || config === void 0 || (_config$tables5 = config.tables) === null || _config$tables5 === void 0 || (_config$tables5 = _config$tables5.pagination) === null || _config$tables5 === void 0 ? void 0 : _config$tables5.current,
366
+ pageSize: config === null || config === void 0 || (_config$tables6 = config.tables) === null || _config$tables6 === void 0 || (_config$tables6 = _config$tables6.pagination) === null || _config$tables6 === void 0 ? void 0 : _config$tables6.pageSize,
367
+ field: tables === null || tables === void 0 || (_tables$sorting3 = tables.sorting) === null || _tables$sorting3 === void 0 ? void 0 : _tables$sorting3.sortBy,
368
+ order: tables === null || tables === void 0 || (_tables$sorting4 = tables.sorting) === null || _tables$sorting4 === void 0 ? void 0 : _tables$sorting4.sortDirection
369
+ }, (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied2 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied2 !== void 0 ? _customDrawer$applied2 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), inputSearch !== null && inputSearch !== void 0 && inputSearch.queryField ? {
370
+ queryField: inputSearch.queryField
371
+ } : {}), (header === null || header === void 0 || (_header$subHeading3 = header.subHeading) === null || _header$subHeading3 === void 0 || (_header$subHeading3 = _header$subHeading3.jsxConfig) === null || _header$subHeading3 === void 0 ? void 0 : _header$subHeading3.type) == "select" ? {
372
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading4 = header.subHeading) === null || _header$subHeading4 === void 0 || (_header$subHeading4 = _header$subHeading4.jsxConfig) === null || _header$subHeading4 === void 0 ? void 0 : _header$subHeading4.value
373
+ } : {}), (_state$misc2 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc2 !== void 0 ? _state$misc2 : {}));
374
+ if (error) {
375
+ showErrorNotification(error);
376
+ dispatch({
377
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
378
+ });
379
+ } else {
380
+ var _config$tables7, _config$tables8;
381
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
382
+ setStaticFilterData(data);
383
+ }
384
+ dispatch({
385
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
386
+ payload: data
387
+ });
388
+ dispatch({
389
+ type: _layoutReducer.actionTypes.SET_PAGINATION,
390
+ payload: {
391
+ current: config === null || config === void 0 || (_config$tables7 = config.tables) === null || _config$tables7 === void 0 || (_config$tables7 = _config$tables7.pagination) === null || _config$tables7 === void 0 ? void 0 : _config$tables7.current,
392
+ pageSize: config === null || config === void 0 || (_config$tables8 = config.tables) === null || _config$tables8 === void 0 || (_config$tables8 = _config$tables8.pagination) === null || _config$tables8 === void 0 ? void 0 : _config$tables8.pageSize
393
+ }
394
+ });
395
+ }
396
+ }
397
+ };
398
+
399
+ /**
400
+ * Handles changes in the dropdown search input value.
401
+ *
402
+ * Updates the `dropdownSearchValue` in the state with the new value.
403
+ * If the input value is empty, triggers the `handleDropdownSearchInputChange` callback
404
+ * to fetch data based on the current selected tab, pagination, sorting, and additional
405
+ * state information. Displays an error notification and sets the table to empty in case of an error.
406
+ *
407
+ * @param {{ target: { value: string } }} param0 - The change event with the new input value.
408
+ *
409
+ * @returns {Promise<void>} - Resolves when the data has been fetched and the state has been updated.
410
+ */
411
+
412
+ const onDropdownSearchInputChange = async _ref3 => {
413
+ let {
414
+ target: {
415
+ value
416
+ }
417
+ } = _ref3;
418
+ dispatch({
419
+ type: _layoutReducer.actionTypes.SET_DROPDOWN_SEARCH_VALUE,
420
+ payload: value
421
+ });
422
+ if (value === "") {
423
+ if (handleDropdownSearchInputChange) {
424
+ var _state$tabs3, _config$tables9, _config$tables10, _tables$sorting5, _tables$sorting6, _tables$filter, _staticFilter$data2, _customDrawer$applied3, _header$subHeading5, _header$subHeading6, _state$misc3, _state$staticFilter$m, _state$staticFilter;
425
+ dispatch({
426
+ type: _layoutReducer.actionTypes.SET_LOADING,
427
+ payload: true
428
+ });
429
+ const {
430
+ error,
431
+ data
432
+ } = await handleDropdownSearchInputChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
433
+ selectedTab: state === null || state === void 0 || (_state$tabs3 = state.tabs) === null || _state$tabs3 === void 0 ? void 0 : _state$tabs3.active,
434
+ current: config === null || config === void 0 || (_config$tables9 = config.tables) === null || _config$tables9 === void 0 || (_config$tables9 = _config$tables9.pagination) === null || _config$tables9 === void 0 ? void 0 : _config$tables9.current,
435
+ pageSize: config === null || config === void 0 || (_config$tables10 = config.tables) === null || _config$tables10 === void 0 || (_config$tables10 = _config$tables10.pagination) === null || _config$tables10 === void 0 ? void 0 : _config$tables10.pageSize,
436
+ field: tables === null || tables === void 0 || (_tables$sorting5 = tables.sorting) === null || _tables$sorting5 === void 0 ? void 0 : _tables$sorting5.sortBy,
437
+ order: tables === null || tables === void 0 || (_tables$sorting6 = tables.sorting) === null || _tables$sorting6 === void 0 ? void 0 : _tables$sorting6.sortDirection
438
+ }, (tables === null || tables === void 0 || (_tables$filter = tables.filter) === null || _tables$filter === void 0 ? void 0 : _tables$filter.key) && {
439
+ columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
440
+ }), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data2 = staticFilter.data) === null || _staticFilter$data2 === void 0 || (_staticFilter$data2 = _staticFilter$data2.find(item => item.selected)) === null || _staticFilter$data2 === void 0 ? void 0 : _staticFilter$data2.value) && {
441
+ staticFilter: staticFilter.data.find(item => item.selected).value
442
+ }), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied3 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied3 !== void 0 ? _customDrawer$applied3 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (header === null || header === void 0 || (_header$subHeading5 = header.subHeading) === null || _header$subHeading5 === void 0 || (_header$subHeading5 = _header$subHeading5.jsxConfig) === null || _header$subHeading5 === void 0 ? void 0 : _header$subHeading5.type) == "select" ? {
443
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading6 = header.subHeading) === null || _header$subHeading6 === void 0 || (_header$subHeading6 = _header$subHeading6.jsxConfig) === null || _header$subHeading6 === void 0 ? void 0 : _header$subHeading6.value
444
+ } : {}), (_state$misc3 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc3 !== void 0 ? _state$misc3 : {}), {}, {
445
+ multiSelectValue: (_state$staticFilter$m = state === null || state === void 0 || (_state$staticFilter = state.staticFilter) === null || _state$staticFilter === void 0 ? void 0 : _state$staticFilter.multiSelectValue) !== null && _state$staticFilter$m !== void 0 ? _state$staticFilter$m : []
446
+ }));
447
+ if (error) {
448
+ showErrorNotification(error);
449
+ dispatch({
450
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
451
+ });
452
+ } else {
453
+ var _config$tables11, _config$tables12;
454
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
455
+ setStaticFilterData(data);
456
+ }
457
+ dispatch({
458
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
459
+ payload: data
460
+ });
461
+ dispatch({
462
+ type: _layoutReducer.actionTypes.SET_PAGINATION,
463
+ payload: {
464
+ current: config === null || config === void 0 || (_config$tables11 = config.tables) === null || _config$tables11 === void 0 || (_config$tables11 = _config$tables11.pagination) === null || _config$tables11 === void 0 ? void 0 : _config$tables11.current,
465
+ pageSize: config === null || config === void 0 || (_config$tables12 = config.tables) === null || _config$tables12 === void 0 || (_config$tables12 = _config$tables12.pagination) === null || _config$tables12 === void 0 ? void 0 : _config$tables12.pageSize
466
+ }
467
+ });
468
+ }
469
+ dispatch({
470
+ type: _layoutReducer.actionTypes.SET_LOADING,
471
+ payload: false
472
+ });
473
+ }
474
+ }
475
+ };
476
+
477
+ /**
478
+ * Handles the "Enter" key press event for the dropdown search input.
479
+ *
480
+ * Validates the trimmed search input value against the selected option.
481
+ * If invalid or empty, dispatches an error with a message indicating the required input.
482
+ * If valid, it updates the dropdown search value in the state and invokes the
483
+ * `handleDropdownSearchEnter` callback to fetch data based on the search criteria.
484
+ * The callback is provided with details such as the searched value, selected tab,
485
+ * pagination, sorting, filter status, and additional state information.
486
+ * Displays an error notification and sets the table to empty in case of an error.
487
+ * On successful data retrieval, updates the table data in the state.
488
+ *
489
+ * @returns {Promise<void>} - Resolves when the data has been fetched and the state has been updated.
490
+ */
491
+
492
+ const onDropdownSearchPressEnter = async () => {
493
+ var _state$dropdownSearch;
494
+ const {
495
+ value,
496
+ validateInput,
497
+ selectedOption,
498
+ menuItems,
499
+ request
500
+ } = (_state$dropdownSearch = state === null || state === void 0 ? void 0 : state.dropdownSearch) !== null && _state$dropdownSearch !== void 0 ? _state$dropdownSearch : {};
501
+ const trimedValue = value === null || value === void 0 ? void 0 : value.trim();
502
+ if (trimedValue === "" || !(validateInput !== null && validateInput !== void 0 && validateInput(selectedOption, trimedValue))) {
503
+ var _menuItems$find;
504
+ const errorLabel = (Array.isArray(menuItems) ? (_menuItems$find = menuItems.find(item => item.value === selectedOption)) === null || _menuItems$find === void 0 ? void 0 : _menuItems$find.label : null) || selectedOption || "input";
505
+ dispatch({
506
+ type: _layoutReducer.actionTypes.SET_DROPDOWN_SEARCH_ERROR,
507
+ payload: trimedValue === "" ? null : "Please enter a valid ".concat(errorLabel)
508
+ });
509
+ return;
510
+ }
511
+ dispatch({
512
+ type: _layoutReducer.actionTypes.SET_DROPDOWN_SEARCH_VALUE,
513
+ payload: value
514
+ });
515
+ if (handleDropdownSearchEnter) {
516
+ var _state$tabs4, _config$tables13, _config$tables14, _tables$sorting7, _tables$sorting8, _tables$filter2, _staticFilter$data3, _customDrawer$applied4, _header$subHeading7, _header$subHeading8, _state$misc4, _state$staticFilter$m2, _state$staticFilter2;
517
+ const {
518
+ error,
519
+ data
520
+ } = await handleDropdownSearchEnter(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
521
+ searchedValue: value,
522
+ selectedTab: state === null || state === void 0 || (_state$tabs4 = state.tabs) === null || _state$tabs4 === void 0 ? void 0 : _state$tabs4.active,
523
+ selectedOption: state === null || state === void 0 ? void 0 : state.dropdownSearch.selectedOption,
524
+ current: config === null || config === void 0 || (_config$tables13 = config.tables) === null || _config$tables13 === void 0 || (_config$tables13 = _config$tables13.pagination) === null || _config$tables13 === void 0 ? void 0 : _config$tables13.current,
525
+ pageSize: config === null || config === void 0 || (_config$tables14 = config.tables) === null || _config$tables14 === void 0 || (_config$tables14 = _config$tables14.pagination) === null || _config$tables14 === void 0 ? void 0 : _config$tables14.pageSize,
526
+ field: tables === null || tables === void 0 || (_tables$sorting7 = tables.sorting) === null || _tables$sorting7 === void 0 ? void 0 : _tables$sorting7.sortBy,
527
+ order: tables === null || tables === void 0 || (_tables$sorting8 = tables.sorting) === null || _tables$sorting8 === void 0 ? void 0 : _tables$sorting8.sortDirection
528
+ }, (tables === null || tables === void 0 || (_tables$filter2 = tables.filter) === null || _tables$filter2 === void 0 ? void 0 : _tables$filter2.key) && {
529
+ columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
530
+ }), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data3 = staticFilter.data) === null || _staticFilter$data3 === void 0 || (_staticFilter$data3 = _staticFilter$data3.find(item => item.selected)) === null || _staticFilter$data3 === void 0 ? void 0 : _staticFilter$data3.value) && {
531
+ staticFilter: staticFilter.data.find(item => item.selected).value
532
+ }), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied4 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied4 !== void 0 ? _customDrawer$applied4 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (header === null || header === void 0 || (_header$subHeading7 = header.subHeading) === null || _header$subHeading7 === void 0 || (_header$subHeading7 = _header$subHeading7.jsxConfig) === null || _header$subHeading7 === void 0 ? void 0 : _header$subHeading7.type) == "select" ? {
533
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading8 = header.subHeading) === null || _header$subHeading8 === void 0 || (_header$subHeading8 = _header$subHeading8.jsxConfig) === null || _header$subHeading8 === void 0 ? void 0 : _header$subHeading8.value
534
+ } : {}), (_state$misc4 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc4 !== void 0 ? _state$misc4 : {}), {}, {
535
+ multiSelectValue: (_state$staticFilter$m2 = state === null || state === void 0 || (_state$staticFilter2 = state.staticFilter) === null || _state$staticFilter2 === void 0 ? void 0 : _state$staticFilter2.multiSelectValue) !== null && _state$staticFilter$m2 !== void 0 ? _state$staticFilter$m2 : []
536
+ }));
537
+ if (error) {
538
+ showErrorNotification(error);
539
+ dispatch({
540
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
541
+ });
542
+ } else {
543
+ var _config$tables15, _config$tables16;
544
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
545
+ setStaticFilterData(data);
546
+ }
547
+ dispatch({
548
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
549
+ payload: data
550
+ });
551
+ dispatch({
552
+ type: _layoutReducer.actionTypes.SET_PAGINATION,
553
+ payload: {
554
+ current: config === null || config === void 0 || (_config$tables15 = config.tables) === null || _config$tables15 === void 0 || (_config$tables15 = _config$tables15.pagination) === null || _config$tables15 === void 0 ? void 0 : _config$tables15.current,
555
+ pageSize: config === null || config === void 0 || (_config$tables16 = config.tables) === null || _config$tables16 === void 0 || (_config$tables16 = _config$tables16.pagination) === null || _config$tables16 === void 0 ? void 0 : _config$tables16.pageSize
556
+ }
557
+ });
558
+ }
559
+ }
560
+ };
561
+
562
+ /**
563
+ * Handles the change of the selected option in the dropdown search input.
564
+ *
565
+ * Updates the selected option in the state and invokes the
566
+ * `handleDropdownSearchOptionChange` callback to fetch data based on the selected option.
567
+ * The callback is provided with no arguments.
568
+ * Displays an error notification and sets the table to empty in case of an error.
569
+ * On successful data retrieval, updates the table data in the state and triggers a tab click.
570
+ *
571
+ * @param {object} option - The selected option object.
572
+ * @returns {Promise<void>} - Resolves when the data has been fetched and the state has been updated.
573
+ */
574
+ const onDropdownSearchOptionChange = async option => {
575
+ dispatch({
576
+ type: _layoutReducer.actionTypes.SET_DROPDOWN_SEARCH_OPTION,
577
+ payload: option === null || option === void 0 ? void 0 : option.value
578
+ });
579
+ if (handleDropdownSearchOptionChange) {
580
+ var _config$tables17, _config$tables18, _staticFilter$data4, _customDrawer$applied5, _header$subHeading9, _header$subHeading10, _state$misc5, _state$staticFilter$m3, _state$staticFilter3;
581
+ dispatch({
582
+ type: _layoutReducer.actionTypes.SET_LOADING,
583
+ payload: true
584
+ });
585
+ const {
586
+ error,
587
+ data
588
+ } = await handleDropdownSearchOptionChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
589
+ selectedTab: tabs === null || tabs === void 0 ? void 0 : tabs.active,
590
+ current: config === null || config === void 0 || (_config$tables17 = config.tables) === null || _config$tables17 === void 0 || (_config$tables17 = _config$tables17.pagination) === null || _config$tables17 === void 0 ? void 0 : _config$tables17.current,
591
+ pageSize: config === null || config === void 0 || (_config$tables18 = config.tables) === null || _config$tables18 === void 0 || (_config$tables18 = _config$tables18.pagination) === null || _config$tables18 === void 0 ? void 0 : _config$tables18.pageSize
592
+ }, (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data4 = staticFilter.data) === null || _staticFilter$data4 === void 0 || (_staticFilter$data4 = _staticFilter$data4.find(item => item.selected)) === null || _staticFilter$data4 === void 0 ? void 0 : _staticFilter$data4.value) && {
593
+ staticFilter: staticFilter.data.find(item => item.selected).value
594
+ }), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied5 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied5 !== void 0 ? _customDrawer$applied5 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (header === null || header === void 0 || (_header$subHeading9 = header.subHeading) === null || _header$subHeading9 === void 0 || (_header$subHeading9 = _header$subHeading9.jsxConfig) === null || _header$subHeading9 === void 0 ? void 0 : _header$subHeading9.type) == "select" ? {
595
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading10 = header.subHeading) === null || _header$subHeading10 === void 0 || (_header$subHeading10 = _header$subHeading10.jsxConfig) === null || _header$subHeading10 === void 0 ? void 0 : _header$subHeading10.value
596
+ } : {}), (_state$misc5 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc5 !== void 0 ? _state$misc5 : {}), {}, {
597
+ multiSelectValue: (_state$staticFilter$m3 = state === null || state === void 0 || (_state$staticFilter3 = state.staticFilter) === null || _state$staticFilter3 === void 0 ? void 0 : _state$staticFilter3.multiSelectValue) !== null && _state$staticFilter$m3 !== void 0 ? _state$staticFilter$m3 : []
598
+ }));
599
+ if (error) {
600
+ showErrorNotification(error);
601
+ dispatch({
602
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
603
+ });
604
+ } else {
605
+ var _config$tables19, _config$tables20;
606
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
607
+ setStaticFilterData(data);
608
+ }
609
+ dispatch({
610
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
611
+ payload: data
612
+ });
613
+ dispatch({
614
+ type: _layoutReducer.actionTypes.SET_PAGINATION,
615
+ payload: {
616
+ current: config === null || config === void 0 || (_config$tables19 = config.tables) === null || _config$tables19 === void 0 || (_config$tables19 = _config$tables19.pagination) === null || _config$tables19 === void 0 ? void 0 : _config$tables19.current,
617
+ pageSize: config === null || config === void 0 || (_config$tables20 = config.tables) === null || _config$tables20 === void 0 || (_config$tables20 = _config$tables20.pagination) === null || _config$tables20 === void 0 ? void 0 : _config$tables20.pageSize
618
+ }
619
+ });
620
+ if (config !== null && config !== void 0 && config.tabs) {
621
+ dispatch({
622
+ type: _layoutReducer.actionTypes.TAB_CLICK,
623
+ payload: {
624
+ active: tabs === null || tabs === void 0 ? void 0 : tabs.active
625
+ }
626
+ });
627
+ }
628
+ }
629
+ dispatch({
630
+ type: _layoutReducer.actionTypes.SET_LOADING,
631
+ payload: false
632
+ });
633
+ }
634
+ };
635
+
636
+ /**
637
+ * Handles the blur event for the input search.
638
+ *
639
+ * Checks if the input search value is empty, and if so,
640
+ * clears any existing input search error in the state.
641
+ *
642
+ * @returns {Promise<void>} - Resolves when the input search error state has been updated.
643
+ */
644
+
645
+ const onInputSearchBlur = async () => {
646
+ var _state$inputSearch3;
647
+ const {
648
+ value
649
+ } = (_state$inputSearch3 = state === null || state === void 0 ? void 0 : state.inputSearch) !== null && _state$inputSearch3 !== void 0 ? _state$inputSearch3 : {};
650
+ if (value === "") {
651
+ dispatch({
652
+ type: _layoutReducer.actionTypes.SET_INPUT_SEARCH_ERROR,
653
+ payload: null
654
+ });
655
+ }
656
+ };
657
+
658
+ /**
659
+ * Handles the blur event for the dropdown search input.
660
+ *
661
+ * Checks if the dropdown search value is empty, and if so,
662
+ * clears any existing dropdown search error in the state.
663
+ *
664
+ * @returns {Promise<void>} - Resolves when the dropdown search error state has been updated.
665
+ */
666
+ const onDropdownSearchBlur = async () => {
667
+ var _state$dropdownSearch2;
668
+ const {
669
+ value
670
+ } = (_state$dropdownSearch2 = state === null || state === void 0 ? void 0 : state.dropdownSearch) !== null && _state$dropdownSearch2 !== void 0 ? _state$dropdownSearch2 : {};
671
+ if (value === "") {
672
+ dispatch({
673
+ type: _layoutReducer.actionTypes.SET_DROPDOWN_SEARCH_ERROR,
674
+ payload: null
675
+ });
676
+ }
677
+ };
678
+
679
+ /**
680
+ * Handles the clear event for the dropdown search input.
681
+ *
682
+ * Clears the current value of the dropdown search input and triggers
683
+ * a call to the handleDropdownSearchClear callback function, passing
684
+ * the current state of the component as an argument.
685
+ *
686
+ * If the callback function returns an error, shows an error notification
687
+ * and sets the table data to an empty array. If the callback function
688
+ * returns data, sets the table data to the returned data.
689
+ *
690
+ * @returns {Promise<void>} - Resolves when the table data has been updated.
691
+ */
692
+ const onDropdownSearchClear = async () => {
693
+ dispatch({
694
+ type: _layoutReducer.actionTypes.SET_DROPDOWN_SEARCH_VALUE,
695
+ payload: null
696
+ });
697
+ if (handleDropdownSearchClear) {
698
+ var _state$tabs5, _config$tables21, _config$tables22, _tables$sorting9, _tables$sorting10, _tables$filter3, _staticFilter$data5, _customDrawer$applied6, _header$subHeading11, _header$subHeading12, _state$misc6, _state$staticFilter$m4, _state$staticFilter4;
699
+ const {
700
+ error,
701
+ data
702
+ } = await handleDropdownSearchClear(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
703
+ selectedTab: state === null || state === void 0 || (_state$tabs5 = state.tabs) === null || _state$tabs5 === void 0 ? void 0 : _state$tabs5.active,
704
+ current: config === null || config === void 0 || (_config$tables21 = config.tables) === null || _config$tables21 === void 0 || (_config$tables21 = _config$tables21.pagination) === null || _config$tables21 === void 0 ? void 0 : _config$tables21.current,
705
+ pageSize: config === null || config === void 0 || (_config$tables22 = config.tables) === null || _config$tables22 === void 0 || (_config$tables22 = _config$tables22.pagination) === null || _config$tables22 === void 0 ? void 0 : _config$tables22.pageSize,
706
+ field: tables === null || tables === void 0 || (_tables$sorting9 = tables.sorting) === null || _tables$sorting9 === void 0 ? void 0 : _tables$sorting9.sortBy,
707
+ order: tables === null || tables === void 0 || (_tables$sorting10 = tables.sorting) === null || _tables$sorting10 === void 0 ? void 0 : _tables$sorting10.sortDirection
708
+ }, (tables === null || tables === void 0 || (_tables$filter3 = tables.filter) === null || _tables$filter3 === void 0 ? void 0 : _tables$filter3.key) && {
709
+ columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
710
+ }), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data5 = staticFilter.data) === null || _staticFilter$data5 === void 0 || (_staticFilter$data5 = _staticFilter$data5.find(item => item.selected)) === null || _staticFilter$data5 === void 0 ? void 0 : _staticFilter$data5.value) && {
711
+ staticFilter: staticFilter.data.find(item => item.selected).value
712
+ }), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied6 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied6 !== void 0 ? _customDrawer$applied6 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (header === null || header === void 0 || (_header$subHeading11 = header.subHeading) === null || _header$subHeading11 === void 0 || (_header$subHeading11 = _header$subHeading11.jsxConfig) === null || _header$subHeading11 === void 0 ? void 0 : _header$subHeading11.type) == "select" ? {
713
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading12 = header.subHeading) === null || _header$subHeading12 === void 0 || (_header$subHeading12 = _header$subHeading12.jsxConfig) === null || _header$subHeading12 === void 0 ? void 0 : _header$subHeading12.value
714
+ } : {}), (_state$misc6 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc6 !== void 0 ? _state$misc6 : {}), {}, {
715
+ multiSelectValue: (_state$staticFilter$m4 = state === null || state === void 0 || (_state$staticFilter4 = state.staticFilter) === null || _state$staticFilter4 === void 0 ? void 0 : _state$staticFilter4.multiSelectValue) !== null && _state$staticFilter$m4 !== void 0 ? _state$staticFilter$m4 : []
716
+ }));
717
+ if (error) {
718
+ showErrorNotification(error);
719
+ dispatch({
720
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
721
+ });
722
+ } else {
723
+ var _config$tables23, _config$tables24;
724
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
725
+ setStaticFilterData(data);
726
+ }
727
+ dispatch({
728
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
729
+ payload: data
730
+ });
731
+ dispatch({
732
+ type: _layoutReducer.actionTypes.SET_PAGINATION,
733
+ payload: {
734
+ current: config === null || config === void 0 || (_config$tables23 = config.tables) === null || _config$tables23 === void 0 || (_config$tables23 = _config$tables23.pagination) === null || _config$tables23 === void 0 ? void 0 : _config$tables23.current,
735
+ pageSize: config === null || config === void 0 || (_config$tables24 = config.tables) === null || _config$tables24 === void 0 || (_config$tables24 = _config$tables24.pagination) === null || _config$tables24 === void 0 ? void 0 : _config$tables24.pageSize
736
+ }
737
+ });
738
+ }
739
+ }
740
+ };
741
+
742
+ /**
743
+ * Handles the clear event for the input search input.
744
+ *
745
+ * Clears the current value of the input search input and triggers
746
+ * a call to the handleInputSearchClear callback function, passing
747
+ * the current selected tab, pagination state, and sorting state
748
+ * as an argument.
749
+ *
750
+ * If the callback function returns an error, shows an error notification
751
+ * and sets the table data to an empty array. If the callback function
752
+ * returns data, sets the table data to the returned data.
753
+ *
754
+ * @returns {Promise<void>} - Resolves when the table data has been updated.
755
+ */
756
+ const onInputSearchClear = async () => {
757
+ dispatch({
758
+ type: _layoutReducer.actionTypes.SET_INPUT_SEARCH_VALUE,
759
+ payload: null
760
+ });
761
+ if (handleInputSearchClear) {
762
+ var _state$tabs6, _config$tables25, _config$tables26, _tables$sorting11, _tables$sorting12, _customDrawer$applied7, _header$subHeading13, _header$subHeading14, _state$misc7;
763
+ const {
764
+ error,
765
+ data
766
+ } = await handleInputSearchClear(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, state !== null && state !== void 0 && (_state$tabs6 = state.tabs) !== null && _state$tabs6 !== void 0 && _state$tabs6.active ? {
767
+ selectedTab: state.tabs.active
768
+ } : {}), {}, {
769
+ current: config === null || config === void 0 || (_config$tables25 = config.tables) === null || _config$tables25 === void 0 || (_config$tables25 = _config$tables25.pagination) === null || _config$tables25 === void 0 ? void 0 : _config$tables25.current,
770
+ pageSize: config === null || config === void 0 || (_config$tables26 = config.tables) === null || _config$tables26 === void 0 || (_config$tables26 = _config$tables26.pagination) === null || _config$tables26 === void 0 ? void 0 : _config$tables26.pageSize,
771
+ field: tables === null || tables === void 0 || (_tables$sorting11 = tables.sorting) === null || _tables$sorting11 === void 0 ? void 0 : _tables$sorting11.sortBy,
772
+ order: tables === null || tables === void 0 || (_tables$sorting12 = tables.sorting) === null || _tables$sorting12 === void 0 ? void 0 : _tables$sorting12.sortDirection
773
+ }, (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied7 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied7 !== void 0 ? _customDrawer$applied7 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (header === null || header === void 0 || (_header$subHeading13 = header.subHeading) === null || _header$subHeading13 === void 0 || (_header$subHeading13 = _header$subHeading13.jsxConfig) === null || _header$subHeading13 === void 0 ? void 0 : _header$subHeading13.type) == "select" ? {
774
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading14 = header.subHeading) === null || _header$subHeading14 === void 0 || (_header$subHeading14 = _header$subHeading14.jsxConfig) === null || _header$subHeading14 === void 0 ? void 0 : _header$subHeading14.value
775
+ } : {}), (_state$misc7 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc7 !== void 0 ? _state$misc7 : {}));
776
+ if (error) {
777
+ showErrorNotification(error);
778
+ dispatch({
779
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
780
+ });
781
+ } else {
782
+ var _config$tables27, _config$tables28;
783
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
784
+ setStaticFilterData(data);
785
+ }
786
+ dispatch({
787
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
788
+ payload: data
789
+ });
790
+ dispatch({
791
+ type: _layoutReducer.actionTypes.SET_PAGINATION,
792
+ payload: {
793
+ current: config === null || config === void 0 || (_config$tables27 = config.tables) === null || _config$tables27 === void 0 || (_config$tables27 = _config$tables27.pagination) === null || _config$tables27 === void 0 ? void 0 : _config$tables27.current,
794
+ pageSize: config === null || config === void 0 || (_config$tables28 = config.tables) === null || _config$tables28 === void 0 || (_config$tables28 = _config$tables28.pagination) === null || _config$tables28 === void 0 ? void 0 : _config$tables28.pageSize
795
+ }
796
+ });
797
+ }
798
+ }
799
+ };
800
+
801
+ /**
802
+ * Handles various table actions based on the provided configuration arguments.
803
+ *
804
+ * @async
805
+ * @function
806
+ * @param {Object} record - The record object representing the table row.
807
+ * @param {Object} configArgs - The configuration arguments for the action.
808
+ * @returns {Promise<void>} - Resolves after the action is handled.
809
+ *
810
+ * The function performs different actions depending on the `action` specified in `configArgs`:
811
+ * - "OPEN_DRAWER_AND_FETCH": Opens a drawer and fetches data; updates the drawer's state.
812
+ * - "EXPORT_DATA": Triggers data export functionality.
813
+ * - "OPEN_URL_IN_NEW_TAB": Opens a URL in a new browser tab.
814
+ * - "OPEN_MODAL": Opens a modal with updated content.
815
+ * - "ACTION_ON_CTA": Executes a custom table action and displays a success notification.
816
+ *
817
+ * If an error occurs during any action, an error notification is shown.
818
+ */
819
+
820
+ const customTableChange = async (record, configArgs, optKey) => {
821
+ var _state$tables;
822
+ const isRowSelected = state === null || state === void 0 || (_state$tables = state.tables) === null || _state$tables === void 0 || (_state$tables = _state$tables.selectedRows) === null || _state$tables === void 0 ? void 0 : _state$tables.some(row => row.rowKey === record.rowKey);
823
+ if (isRowSelected) {
824
+ return;
825
+ }
826
+ if ((configArgs === null || configArgs === void 0 ? void 0 : configArgs.action) === "OPEN_DRAWER_AND_FETCH") {
827
+ const selectkey = optKey || (configArgs === null || configArgs === void 0 ? void 0 : configArgs.key);
828
+ if (handleTableColumnClick) {
829
+ var _state$misc8;
830
+ const {
831
+ error,
832
+ data
833
+ } = await (handleTableColumnClick === null || handleTableColumnClick === void 0 ? void 0 : handleTableColumnClick(_objectSpread({
834
+ record: record,
835
+ type: configArgs === null || configArgs === void 0 ? void 0 : configArgs.call
836
+ }, (_state$misc8 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc8 !== void 0 ? _state$misc8 : {})));
837
+ if (error) {
838
+ showErrorNotification(error);
839
+ } else {
840
+ if ((data === null || data === void 0 ? void 0 : data.call) === "parent") {
841
+ handleTableColumnClickParent({
842
+ record
843
+ });
844
+ } else if ((configArgs === null || configArgs === void 0 ? void 0 : configArgs.type) === "openNestedDrawer") {
845
+ var _config$nestedDrawer;
846
+ const record = config === null || config === void 0 || (_config$nestedDrawer = config.nestedDrawer) === null || _config$nestedDrawer === void 0 || (_config$nestedDrawer = _config$nestedDrawer.data) === null || _config$nestedDrawer === void 0 ? void 0 : _config$nestedDrawer.cancelOrder;
847
+ const dynamicConfig = (0, _staticConfigResolver.default)(record, data !== null && data !== void 0 ? data : {});
848
+ dispatch({
849
+ type: _layoutReducer.actionTypes.SET_NESTED_DRAWER,
850
+ payload: dynamicConfig
851
+ });
852
+ dispatch({
853
+ type: _layoutReducer.actionTypes.NESTED_DRAWER_OPEN
854
+ });
855
+ } else {
856
+ var _config$drawer, _state$tabs$active, _state$tabs7;
857
+ const record = _objectSpread({}, config === null || config === void 0 || (_config$drawer = config.drawer) === null || _config$drawer === void 0 || (_config$drawer = _config$drawer.data) === null || _config$drawer === void 0 || (_config$drawer = _config$drawer[(_state$tabs$active = state === null || state === void 0 || (_state$tabs7 = state.tabs) === null || _state$tabs7 === void 0 ? void 0 : _state$tabs7.active) !== null && _state$tabs$active !== void 0 ? _state$tabs$active : "default"]) === null || _config$drawer === void 0 ? void 0 : _config$drawer[selectkey]);
858
+ const dynamicConfig = (0, _staticConfigResolver.removeHidden)((0, _staticConfigResolver.default)(record, data !== null && data !== void 0 ? data : {}));
859
+ dispatch({
860
+ type: _layoutReducer.actionTypes.SET_DRAWER,
861
+ payload: {
862
+ dynamicConfig: dynamicConfig,
863
+ active: selectkey
864
+ }
865
+ });
866
+ dispatch({
867
+ type: _layoutReducer.actionTypes.TOGGLE_DRAWER,
868
+ payload: selectkey
869
+ });
870
+ }
871
+ }
872
+ }
873
+ } else if ((configArgs === null || configArgs === void 0 ? void 0 : configArgs.action) === "EXPORT_DATA") {
874
+ if (handleSecondaryTableCTAClick) {
875
+ var _state$misc9;
876
+ const {
877
+ error,
878
+ data
879
+ } = await (handleSecondaryTableCTAClick === null || handleSecondaryTableCTAClick === void 0 ? void 0 : handleSecondaryTableCTAClick(_objectSpread({
880
+ rentalId: record === null || record === void 0 ? void 0 : record.rentalId
881
+ }, (_state$misc9 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc9 !== void 0 ? _state$misc9 : {})));
882
+ if (error) {
883
+ showErrorNotification(error);
884
+ } else {
885
+ (0, _downloadFile.default)(data, configArgs === null || configArgs === void 0 ? void 0 : configArgs.fileName);
886
+ }
887
+ }
888
+ } else if ((configArgs === null || configArgs === void 0 ? void 0 : configArgs.action) === "OPEN_URL_IN_NEW_TAB") {
889
+ if (handleTableColumnClick) {
890
+ var _state$misc10;
891
+ handleTableColumnClick === null || handleTableColumnClick === void 0 || handleTableColumnClick(_objectSpread({
892
+ record: record,
893
+ type: configArgs === null || configArgs === void 0 ? void 0 : configArgs.call
894
+ }, (_state$misc10 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc10 !== void 0 ? _state$misc10 : {}));
895
+ }
896
+ } else if ((configArgs === null || configArgs === void 0 ? void 0 : configArgs.action) === "OPEN_MODAL") {
897
+ if (handleTableColumnClick) {
898
+ var _state$misc11;
899
+ const {
900
+ error,
901
+ data
902
+ } = await (handleTableColumnClick === null || handleTableColumnClick === void 0 ? void 0 : handleTableColumnClick(_objectSpread({
903
+ record: record,
904
+ type: configArgs === null || configArgs === void 0 ? void 0 : configArgs.call
905
+ }, (_state$misc11 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc11 !== void 0 ? _state$misc11 : {})));
906
+ if (error) {
907
+ showErrorNotification(error);
908
+ } else {
909
+ const updatedModalContent = (0, _staticConfigResolver.default)(config === null || config === void 0 ? void 0 : config.modal, data);
910
+ dispatch({
911
+ type: _layoutReducer.actionTypes.SET_MODAL,
912
+ payload: {
913
+ modalData: updatedModalContent
914
+ }
915
+ });
916
+ dispatch({
917
+ type: _layoutReducer.actionTypes.TOGGLE_MODAL,
918
+ payload: true
919
+ });
920
+ }
921
+ }
922
+ } else if ((configArgs === null || configArgs === void 0 ? void 0 : configArgs.action) === "ACTION_ON_CTA") {
923
+ if (handleActionOnTableCTAClick) {
924
+ var _state$misc12;
925
+ const {
926
+ error,
927
+ data
928
+ } = await (handleActionOnTableCTAClick === null || handleActionOnTableCTAClick === void 0 ? void 0 : handleActionOnTableCTAClick(_objectSpread({
929
+ record: record,
930
+ type: configArgs === null || configArgs === void 0 ? void 0 : configArgs.call
931
+ }, (_state$misc12 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc12 !== void 0 ? _state$misc12 : {})));
932
+ if (error) {
933
+ showErrorNotification(error);
934
+ } else {
935
+ showSuccessNotification(data);
936
+ init();
937
+ }
938
+ }
939
+ } else if ((configArgs === null || configArgs === void 0 ? void 0 : configArgs.action) === "VIEW_PHOTO") {
940
+ if (handleTableColumnClick) {
941
+ var _state$misc13;
942
+ const {
943
+ error,
944
+ data
945
+ } = await (handleTableColumnClick === null || handleTableColumnClick === void 0 ? void 0 : handleTableColumnClick(_objectSpread({
946
+ record: record,
947
+ type: configArgs === null || configArgs === void 0 ? void 0 : configArgs.call
948
+ }, (_state$misc13 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc13 !== void 0 ? _state$misc13 : {})));
949
+ if (error) {
950
+ showErrorNotification(error);
951
+ } else {
952
+ var _config$imageViewer;
953
+ const record = config === null || config === void 0 || (_config$imageViewer = config.imageViewer) === null || _config$imageViewer === void 0 ? void 0 : _config$imageViewer.content;
954
+ const dynamicConfig = (0, _staticConfigResolver.default)(record, data !== null && data !== void 0 ? data : {});
955
+ dispatch({
956
+ type: _layoutReducer.actionTypes.TOGGLE_IMAGE_VIEW,
957
+ payload: dynamicConfig
958
+ });
959
+ }
960
+ }
961
+ } else if ((configArgs === null || configArgs === void 0 ? void 0 : configArgs.action) === "CHANGE_ROW") {
962
+ if (handleTableColumnClick) {
963
+ var _state$tables2, _state$misc14;
964
+ const {
965
+ error,
966
+ data
967
+ } = await (handleTableColumnClick === null || handleTableColumnClick === void 0 ? void 0 : handleTableColumnClick(_objectSpread({
968
+ tables: (_state$tables2 = state === null || state === void 0 ? void 0 : state.tables) !== null && _state$tables2 !== void 0 ? _state$tables2 : {},
969
+ record: record,
970
+ type: configArgs === null || configArgs === void 0 ? void 0 : configArgs.call
971
+ }, (_state$misc14 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc14 !== void 0 ? _state$misc14 : {})));
972
+ if (error) {
973
+ showErrorNotification(error);
974
+ } else {
975
+ dispatch({
976
+ type: _layoutReducer.actionTypes.CHANGE_ROW,
977
+ payload: data
978
+ });
979
+ }
980
+ }
981
+ }
982
+ };
983
+
984
+ /**
985
+ * Handles various table footer actions based on the provided configuration arguments.
986
+ *
987
+ * @async
988
+ * @function
989
+ * @param {Object} config - The configuration arguments for the action.
990
+ * @returns {Promise<void>} - Resolves after the action is handled.
991
+ *
992
+ * The function performs different actions depending on the `action` specified in `config`:
993
+ * - "OPEN_MODAL": Opens a modal with updated content.
994
+ *
995
+ * If an error occurs during any action, an error notification is shown.
996
+ */
997
+ const customTableSelectFooterClick = async configData => {
998
+ if ((configData === null || configData === void 0 ? void 0 : configData.action) === "OPEN_MODAL") {
999
+ var _state$modal;
1000
+ const modalContent = state === null || state === void 0 || (_state$modal = state.modal) === null || _state$modal === void 0 ? void 0 : _state$modal.modalContent;
1001
+ if (handleModalDataSet) {
1002
+ const {
1003
+ error,
1004
+ data
1005
+ } = await (handleModalDataSet === null || handleModalDataSet === void 0 ? void 0 : handleModalDataSet(modalContent, state));
1006
+ if (error) {
1007
+ showErrorNotification(error);
1008
+ } else {
1009
+ const updatedModalContent = (0, _staticConfigResolver.default)(config === null || config === void 0 ? void 0 : config.modal, data);
1010
+ dispatch({
1011
+ type: _layoutReducer.actionTypes.SET_MODAL,
1012
+ payload: {
1013
+ modalData: updatedModalContent
1014
+ }
1015
+ });
1016
+ dispatch({
1017
+ type: _layoutReducer.actionTypes.TOGGLE_MODAL,
1018
+ payload: true
1019
+ });
1020
+ }
1021
+ }
1022
+ } else if ((configData === null || configData === void 0 ? void 0 : configData.action) === "CALL_API") {
1023
+ if (handleTableFooterApi) {
1024
+ const {
1025
+ error,
1026
+ data
1027
+ } = await (handleTableFooterApi === null || handleTableFooterApi === void 0 ? void 0 : handleTableFooterApi(state));
1028
+ if (error) {
1029
+ showErrorNotification(error);
1030
+ } else {
1031
+ const updatedModalContent = (0, _staticConfigResolver.default)(config === null || config === void 0 ? void 0 : config.modal, data);
1032
+ dispatch({
1033
+ type: _layoutReducer.actionTypes.SET_MODAL,
1034
+ payload: {
1035
+ modalData: updatedModalContent
1036
+ }
1037
+ });
1038
+ dispatch({
1039
+ type: _layoutReducer.actionTypes.TOGGLE_MODAL,
1040
+ payload: true
1041
+ });
1042
+ }
1043
+ }
1044
+ } else if ((configData === null || configData === void 0 ? void 0 : configData.action) === "ACTION_ON_CTA") {
1045
+ if (handleTableFooterApi) {
1046
+ var _state$tables3;
1047
+ const {
1048
+ error,
1049
+ data
1050
+ } = await (handleTableFooterApi === null || handleTableFooterApi === void 0 ? void 0 : handleTableFooterApi(state === null || state === void 0 || (_state$tables3 = state.tables) === null || _state$tables3 === void 0 ? void 0 : _state$tables3.selectedRowKeys, state));
1051
+ if (error) {
1052
+ showErrorNotification(error);
1053
+ } else {
1054
+ showSuccessNotification(data);
1055
+ }
1056
+ init();
1057
+ }
1058
+ }
1059
+ };
1060
+
1061
+ /**
1062
+ * Handles table change events.
1063
+ *
1064
+ * @async
1065
+ * @function
1066
+ * @param {Object} pagination - The current pagination state.
1067
+ * @param {Object} _f - The current filter state.
1068
+ * @param {Object} sorter - The current sort state.
1069
+ * @returns {Promise<void>} - Resolves after the event is handled.
1070
+ *
1071
+ * Updates the pagination, filter, and sorting state based on the provided event data.
1072
+ * If `handleTableChange` is provided, calls it with the current state and the updated event data.
1073
+ * If an error occurs during the handling of the event, an error notification is shown.
1074
+ */
1075
+ const onTableChange = async (pagination, _f, sorter) => {
1076
+ var _tables$columns, _tabs$active, _tabs$active2, _tables$filter4;
1077
+ const {
1078
+ current,
1079
+ pageSize
1080
+ } = pagination;
1081
+
1082
+ // Check if filters have meaningful values (not empty arrays or null/undefined)
1083
+ const hasActiveFilters = Object.values(_f).some(filterValue => filterValue && Array.isArray(filterValue) && filterValue.length > 0);
1084
+ const currentColumns = (tables === null || tables === void 0 || (_tables$columns = tables.columns) === null || _tables$columns === void 0 ? void 0 : _tables$columns[(_tabs$active = tabs === null || tabs === void 0 ? void 0 : tabs.active) !== null && _tabs$active !== void 0 ? _tabs$active : "default"]) || [];
1085
+ const updatedColumns = currentColumns.map(column => {
1086
+ // Check both dataIndex and key for filter matching
1087
+ const filterKey = column.key || column.dataIndex;
1088
+ const columnKey = column.key || column.dataIndex;
1089
+ let updatedColumn = _objectSpread({}, column);
1090
+
1091
+ // Handle filters
1092
+ if (column.filters) {
1093
+ if (hasActiveFilters && _f[filterKey] && Array.isArray(_f[filterKey]) && _f[filterKey].length > 0) {
1094
+ // Set filtered value when filter is active
1095
+ updatedColumn.filteredValue = _f[filterKey];
1096
+ } else {
1097
+ // Clear filtered value when filter is not active or empty
1098
+ const {
1099
+ filteredValue
1100
+ } = updatedColumn,
1101
+ columnWithoutFilter = _objectWithoutProperties(updatedColumn, _excluded);
1102
+ updatedColumn = columnWithoutFilter;
1103
+ }
1104
+ }
1105
+
1106
+ // Handle sorting - update sortOrder to reflect current sort state in UI
1107
+ if (sorter && sorter.columnKey === columnKey) {
1108
+ updatedColumn.sortOrder = sorter.order;
1109
+ } else {
1110
+ // Clear sort order for other columns
1111
+ const {
1112
+ sortOrder
1113
+ } = updatedColumn,
1114
+ columnWithoutSort = _objectWithoutProperties(updatedColumn, _excluded2);
1115
+ updatedColumn = columnWithoutSort;
1116
+ }
1117
+ return updatedColumn;
1118
+ });
1119
+ dispatch({
1120
+ type: _layoutReducer.actionTypes.SET_TABLE_COLUMNS_RESET,
1121
+ payload: {
1122
+ tabKey: (_tabs$active2 = tabs === null || tabs === void 0 ? void 0 : tabs.active) !== null && _tabs$active2 !== void 0 ? _tabs$active2 : "default",
1123
+ columns: updatedColumns
1124
+ }
1125
+ });
1126
+ dispatch({
1127
+ type: _layoutReducer.actionTypes.SET_PAGINATION,
1128
+ payload: {
1129
+ current: current,
1130
+ pageSize: pageSize
1131
+ }
1132
+ });
1133
+ dispatch({
1134
+ type: _layoutReducer.actionTypes.SET_TABLE_FILTER,
1135
+ payload: {
1136
+ key: tables === null || tables === void 0 || (_tables$filter4 = tables.filter) === null || _tables$filter4 === void 0 ? void 0 : _tables$filter4.key,
1137
+ value: _f
1138
+ }
1139
+ });
1140
+ dispatch({
1141
+ type: _layoutReducer.actionTypes.SET_SORTING,
1142
+ payload: {
1143
+ sortBy: sorter === null || sorter === void 0 ? void 0 : sorter.columnKey,
1144
+ sortDirection: (sorter === null || sorter === void 0 ? void 0 : sorter.order) === "ascend" && "ASC" || (sorter === null || sorter === void 0 ? void 0 : sorter.order) === "descend" && "DESC" || ""
1145
+ }
1146
+ });
1147
+ if (handleTableChange) {
1148
+ var _state$dropdownSearch3, _state$inputSearch4, _state$tabs8, _header$subHeading15, _header$subHeading16, _staticFilter$data6, _customDrawer$applied8, _state$misc15, _state$staticFilter$m5, _state$staticFilter5;
1149
+ dispatch({
1150
+ type: _layoutReducer.actionTypes.SET_LOADING,
1151
+ payload: true
1152
+ });
1153
+ const {
1154
+ error,
1155
+ data
1156
+ } = await handleTableChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (state === null || state === void 0 || (_state$dropdownSearch3 = state.dropdownSearch) === null || _state$dropdownSearch3 === void 0 || (_state$dropdownSearch3 = _state$dropdownSearch3.value) === null || _state$dropdownSearch3 === void 0 ? void 0 : _state$dropdownSearch3.trim()) && {
1157
+ searchedValue: state.dropdownSearch.value,
1158
+ selectedOption: state.dropdownSearch.selectedOption
1159
+ }), (state === null || state === void 0 || (_state$inputSearch4 = state.inputSearch) === null || _state$inputSearch4 === void 0 || (_state$inputSearch4 = _state$inputSearch4.value) === null || _state$inputSearch4 === void 0 ? void 0 : _state$inputSearch4.trim()) && {
1160
+ searchedValue: state.inputSearch.value
1161
+ }), {}, {
1162
+ selectedTab: state === null || state === void 0 || (_state$tabs8 = state.tabs) === null || _state$tabs8 === void 0 ? void 0 : _state$tabs8.active,
1163
+ current: current,
1164
+ pageSize: pageSize,
1165
+ columnFilterStatus: _f,
1166
+ field: sorter === null || sorter === void 0 ? void 0 : sorter.columnKey
1167
+ }, (header === null || header === void 0 || (_header$subHeading15 = header.subHeading) === null || _header$subHeading15 === void 0 || (_header$subHeading15 = _header$subHeading15.jsxConfig) === null || _header$subHeading15 === void 0 ? void 0 : _header$subHeading15.type) == "select" ? {
1168
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading16 = header.subHeading) === null || _header$subHeading16 === void 0 || (_header$subHeading16 = _header$subHeading16.jsxConfig) === null || _header$subHeading16 === void 0 ? void 0 : _header$subHeading16.value
1169
+ } : {}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data6 = staticFilter.data) === null || _staticFilter$data6 === void 0 || (_staticFilter$data6 = _staticFilter$data6.find(item => item.selected)) === null || _staticFilter$data6 === void 0 ? void 0 : _staticFilter$data6.value) && {
1170
+ staticFilter: staticFilter.data.find(item => item.selected).value
1171
+ }), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied8 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied8 !== void 0 ? _customDrawer$applied8 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), {}, {
1172
+ order: (sorter === null || sorter === void 0 ? void 0 : sorter.order) === "ascend" && "ASC" || (sorter === null || sorter === void 0 ? void 0 : sorter.order) === "descend" && "DESC" || ""
1173
+ }, (_state$misc15 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc15 !== void 0 ? _state$misc15 : {}), {}, {
1174
+ multiSelectValue: (_state$staticFilter$m5 = state === null || state === void 0 || (_state$staticFilter5 = state.staticFilter) === null || _state$staticFilter5 === void 0 ? void 0 : _state$staticFilter5.multiSelectValue) !== null && _state$staticFilter$m5 !== void 0 ? _state$staticFilter$m5 : []
1175
+ }));
1176
+ if (error) {
1177
+ showErrorNotification(error);
1178
+ dispatch({
1179
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
1180
+ });
1181
+ } else {
1182
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
1183
+ setStaticFilterData(data);
1184
+ }
1185
+ dispatch({
1186
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
1187
+ payload: data
1188
+ });
1189
+ }
1190
+ dispatch({
1191
+ type: _layoutReducer.actionTypes.SET_LOADING,
1192
+ payload: false
1193
+ });
1194
+ }
1195
+ };
1196
+
1197
+ /**
1198
+ * @function onTabClick
1199
+ * @description A function to handle the tab click action. It dispatches the active tab state and calls the handleTabClick function
1200
+ * @param {string} key - The key of the tab
1201
+ * @returns {void}
1202
+ */
1203
+ const onTabClick = async key => {
1204
+ var _tables$filter5, _tables$columns2, _staticFilter$data$fi2;
1205
+ dispatch({
1206
+ type: _layoutReducer.actionTypes.TAB_CLICK,
1207
+ payload: {
1208
+ active: key
1209
+ }
1210
+ });
1211
+ if (tables !== null && tables !== void 0 && tables.selectionType) {
1212
+ var _state$tabs9;
1213
+ const selectionKey = Object.keys(tables === null || tables === void 0 ? void 0 : tables.selectionType).find(key => (tables === null || tables === void 0 ? void 0 : tables.selectionType[key]) === "checkbox");
1214
+ if ((state === null || state === void 0 || (_state$tabs9 = state.tabs) === null || _state$tabs9 === void 0 ? void 0 : _state$tabs9.activeKey) !== selectionKey) {
1215
+ dispatch({
1216
+ type: _layoutReducer.actionTypes.TABLE_FOOTER_TOGGLE,
1217
+ payload: false
1218
+ });
1219
+ dispatch({
1220
+ type: _layoutReducer.actionTypes.TABLE_ROW_SELECTED_DATA,
1221
+ payload: []
1222
+ });
1223
+ }
1224
+ }
1225
+
1226
+ // Reset table column filters in state
1227
+ dispatch({
1228
+ type: _layoutReducer.actionTypes.SET_TABLE_FILTER,
1229
+ payload: {
1230
+ key: tables === null || tables === void 0 || (_tables$filter5 = tables.filter) === null || _tables$filter5 === void 0 ? void 0 : _tables$filter5.key,
1231
+ value: {}
1232
+ }
1233
+ });
1234
+
1235
+ // Reset UI filters by updating columns with filteredValue: []
1236
+ const currentColumns = (tables === null || tables === void 0 || (_tables$columns2 = tables.columns) === null || _tables$columns2 === void 0 ? void 0 : _tables$columns2[key]) || [];
1237
+ const resetColumns = currentColumns.map(column => {
1238
+ if (column.filters) {
1239
+ return _objectSpread(_objectSpread({}, column), {}, {
1240
+ filteredValue: [] // Empty array resets the UI filter
1241
+ });
1242
+ }
1243
+ return column;
1244
+ });
1245
+
1246
+ // Update columns with reset filters
1247
+ dispatch({
1248
+ type: _layoutReducer.actionTypes.SET_TABLE_COLUMNS_RESET,
1249
+ payload: {
1250
+ tabKey: key,
1251
+ columns: resetColumns
1252
+ }
1253
+ });
1254
+ const selectedStaticFilterValue = tables !== null && tables !== void 0 && tables.staticFilterKey && (tables === null || tables === void 0 ? void 0 : tables.staticFilterKey) == key && Array.isArray(staticFilter.data) ? (_staticFilter$data$fi2 = staticFilter.data.find(item => item.selected)) === null || _staticFilter$data$fi2 === void 0 ? void 0 : _staticFilter$data$fi2.value : undefined;
1255
+ if (handleTabClick) {
1256
+ var _state$misc16, _tables$pagination, _tables$pagination2, _tables$sorting13, _tables$sorting14, _state$dropdownSearch4, _header$subHeading17, _header$subHeading18, _customDrawer$applied9, _state$misc17, _state$staticFilter$m6, _state$staticFilter6;
1257
+ dispatch({
1258
+ type: _layoutReducer.actionTypes.SET_LOADING,
1259
+ payload: true
1260
+ });
1261
+ const {
1262
+ error,
1263
+ data
1264
+ } = await handleTabClick(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (_state$misc16 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc16 !== void 0 ? _state$misc16 : {}), {}, {
1265
+ selectedTab: key,
1266
+ current: tables === null || tables === void 0 || (_tables$pagination = tables.pagination) === null || _tables$pagination === void 0 ? void 0 : _tables$pagination.current,
1267
+ pageSize: tables === null || tables === void 0 || (_tables$pagination2 = tables.pagination) === null || _tables$pagination2 === void 0 ? void 0 : _tables$pagination2.pageSize,
1268
+ field: tables === null || tables === void 0 || (_tables$sorting13 = tables.sorting) === null || _tables$sorting13 === void 0 ? void 0 : _tables$sorting13.sortBy
1269
+ }, selectedStaticFilterValue && {
1270
+ staticFilter: selectedStaticFilterValue
1271
+ }), {}, {
1272
+ order: tables === null || tables === void 0 || (_tables$sorting14 = tables.sorting) === null || _tables$sorting14 === void 0 ? void 0 : _tables$sorting14.sortDirection
1273
+ }, (state === null || state === void 0 || (_state$dropdownSearch4 = state.dropdownSearch) === null || _state$dropdownSearch4 === void 0 || (_state$dropdownSearch4 = _state$dropdownSearch4.value) === null || _state$dropdownSearch4 === void 0 ? void 0 : _state$dropdownSearch4.trim()) && {
1274
+ searchedValue: state.dropdownSearch.value,
1275
+ selectedOption: state.dropdownSearch.selectedOption
1276
+ }), (header === null || header === void 0 || (_header$subHeading17 = header.subHeading) === null || _header$subHeading17 === void 0 || (_header$subHeading17 = _header$subHeading17.jsxConfig) === null || _header$subHeading17 === void 0 ? void 0 : _header$subHeading17.type) == "select" ? {
1277
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading18 = header.subHeading) === null || _header$subHeading18 === void 0 || (_header$subHeading18 = _header$subHeading18.jsxConfig) === null || _header$subHeading18 === void 0 ? void 0 : _header$subHeading18.value
1278
+ } : {}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied9 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied9 !== void 0 ? _customDrawer$applied9 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (_state$misc17 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc17 !== void 0 ? _state$misc17 : {}), {}, {
1279
+ multiSelectValue: (_state$staticFilter$m6 = state === null || state === void 0 || (_state$staticFilter6 = state.staticFilter) === null || _state$staticFilter6 === void 0 ? void 0 : _state$staticFilter6.multiSelectValue) !== null && _state$staticFilter$m6 !== void 0 ? _state$staticFilter$m6 : []
1280
+ }));
1281
+ if (error) {
1282
+ showErrorNotification(error);
1283
+ dispatch({
1284
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
1285
+ });
1286
+ } else {
1287
+ if (selectedStaticFilterValue) {
1288
+ setStaticFilterData(data);
1289
+ }
1290
+ dispatch({
1291
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
1292
+ payload: data
1293
+ });
1294
+ }
1295
+ dispatch({
1296
+ type: _layoutReducer.actionTypes.SET_LOADING,
1297
+ payload: false
1298
+ });
1299
+ }
1300
+ };
1301
+
1302
+ /**
1303
+ * @function onChange
1304
+ * @description Handles the row selection change event.
1305
+ * @param {Array<string>} selectedRowKeys - The keys of the selected rows.
1306
+ * @param {Array<Object>} selectedRows - The selected rows.
1307
+ * @returns {void}
1308
+ *
1309
+ * Dispatches the {@link actionTypes.TABLE_FOOTER_TOGGLE} action with the selected rows length
1310
+ * as the payload to toggle the table footer.
1311
+ * Dispatches the {@link actionTypes.TABLE_ROW_SELECTED_DATA} action with the selected rows
1312
+ * as the payload to update the selected rows state.
1313
+ */
1314
+ const rowSelection = {
1315
+ onChange: (selectedRowKeys, selectedRows) => {
1316
+ dispatch({
1317
+ type: _layoutReducer.actionTypes.TABLE_FOOTER_TOGGLE,
1318
+ payload: (selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length) != 0
1319
+ });
1320
+ dispatch({
1321
+ type: _layoutReducer.actionTypes.TABLE_ROW_SELECTED_DATA,
1322
+ payload: selectedRows
1323
+ });
1324
+ }
1325
+ };
1326
+
1327
+ /**
1328
+ * @function onSubHeadingClick
1329
+ * @description Handles the subheading click event to perform specific actions.
1330
+ * @param {string} action - The action to be performed when the subheading is clicked.
1331
+ *
1332
+ * If the action is "OPEN_MODAL", dispatches actions to set the modal data and toggle the modal visibility.
1333
+ */
1334
+
1335
+ const onSubHeadingClick = action => {
1336
+ if (action === "OPEN_MODAL") {
1337
+ dispatch({
1338
+ type: _layoutReducer.actionTypes.SET_MODAL,
1339
+ payload: {
1340
+ modalData: config === null || config === void 0 ? void 0 : config.modal
1341
+ }
1342
+ });
1343
+ dispatch({
1344
+ type: _layoutReducer.actionTypes.TOGGLE_MODAL,
1345
+ payload: true
1346
+ });
1347
+ }
1348
+ };
1349
+
1350
+ /**
1351
+ * Handles the form submission event for the drawer.
1352
+ *
1353
+ * @async
1354
+ * @function
1355
+ * @param {Object} formData - The data submitted from the drawer form.
1356
+ * @returns {Promise<void>} - Resolves after the form data is processed.
1357
+ *
1358
+ * If the `formData` type is "openNestedDrawer", triggers a custom table change
1359
+ * with the current record and form data. Otherwise, attempts to handle the form
1360
+ * submission by calling `handleDrawerFormOnFinish`. Shows an error notification
1361
+ * if an error occurs, or a success notification if successful, and then closes
1362
+ * the drawer. If a nested drawer is visible, dispatches an action to close it.
1363
+ * Finally, re-initializes the state.
1364
+ */
1365
+
1366
+ const drawerFormOnFinish = async formData => {
1367
+ var _state$drawer, _state$tabs$active2, _state$tabs10, _state$drawer2;
1368
+ const record = _objectSpread({}, state === null || state === void 0 || (_state$drawer = state.drawer) === null || _state$drawer === void 0 || (_state$drawer = _state$drawer.data) === null || _state$drawer === void 0 || (_state$drawer = _state$drawer[(_state$tabs$active2 = state === null || state === void 0 || (_state$tabs10 = state.tabs) === null || _state$tabs10 === void 0 ? void 0 : _state$tabs10.active) !== null && _state$tabs$active2 !== void 0 ? _state$tabs$active2 : "default"]) === null || _state$drawer === void 0 || (_state$drawer = _state$drawer[state === null || state === void 0 || (_state$drawer2 = state.drawer) === null || _state$drawer2 === void 0 ? void 0 : _state$drawer2.active]) === null || _state$drawer === void 0 ? void 0 : _state$drawer.value);
1369
+ if ((formData === null || formData === void 0 ? void 0 : formData.type) === "openNestedDrawer") {
1370
+ customTableChange(record, _objectSpread({}, formData));
1371
+ return;
1372
+ }
1373
+ if (handleDrawerFormOnFinish) {
1374
+ var _state$misc18;
1375
+ const {
1376
+ error,
1377
+ data
1378
+ } = await (handleDrawerFormOnFinish === null || handleDrawerFormOnFinish === void 0 ? void 0 : handleDrawerFormOnFinish(_objectSpread(_objectSpread(_objectSpread({}, record), formData), (_state$misc18 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc18 !== void 0 ? _state$misc18 : {})));
1379
+ if (error) {
1380
+ showErrorNotification(error);
1381
+ } else {
1382
+ showSuccessNotification(data === null || data === void 0 ? void 0 : data.message);
1383
+ dispatch({
1384
+ type: _layoutReducer.actionTypes.CLOSE_DRAWER
1385
+ });
1386
+ (nestedDrawer === null || nestedDrawer === void 0 ? void 0 : nestedDrawer.visible) && dispatch({
1387
+ type: _layoutReducer.actionTypes.NESTED_DRAWER_CLOSED
1388
+ });
1389
+ init();
1390
+ }
1391
+ }
1392
+ };
1393
+ const onRemoveAppliedFilter = async filterKey => {
1394
+ var _state$customDrawer;
1395
+ const currentFilters = _objectSpread({}, state === null || state === void 0 || (_state$customDrawer = state.customDrawer) === null || _state$customDrawer === void 0 ? void 0 : _state$customDrawer.appliedFilters);
1396
+
1397
+ // Remove the specific filter
1398
+ delete currentFilters[filterKey];
1399
+
1400
+ // If there are remaining filters, reapply them
1401
+ if (Object.keys(currentFilters).length > 0) {
1402
+ var _state$dropdownSearch5, _state$inputSearch5, _state$tabs11, _tables$pagination3, _tables$pagination4, _tables$filter6, _tables$sorting15, _header$subHeading19, _header$subHeading20, _staticFilter$data7, _tables$sorting16, _state$misc19, _state$staticFilter$m7, _state$staticFilter7;
1403
+ const {
1404
+ error,
1405
+ data
1406
+ } = await handleTableChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (state === null || state === void 0 || (_state$dropdownSearch5 = state.dropdownSearch) === null || _state$dropdownSearch5 === void 0 || (_state$dropdownSearch5 = _state$dropdownSearch5.value) === null || _state$dropdownSearch5 === void 0 ? void 0 : _state$dropdownSearch5.trim()) && {
1407
+ searchedValue: state.dropdownSearch.value,
1408
+ selectedOption: state.dropdownSearch.selectedOption
1409
+ }), (state === null || state === void 0 || (_state$inputSearch5 = state.inputSearch) === null || _state$inputSearch5 === void 0 || (_state$inputSearch5 = _state$inputSearch5.value) === null || _state$inputSearch5 === void 0 ? void 0 : _state$inputSearch5.trim()) && {
1410
+ searchedValue: state.inputSearch.value
1411
+ }), {}, {
1412
+ filterOn: currentFilters === null || currentFilters === void 0 ? void 0 : currentFilters.filterBy,
1413
+ fromDate: currentFilters === null || currentFilters === void 0 ? void 0 : currentFilters.fromDate,
1414
+ toDate: currentFilters === null || currentFilters === void 0 ? void 0 : currentFilters.toDate,
1415
+ selectedTab: state === null || state === void 0 || (_state$tabs11 = state.tabs) === null || _state$tabs11 === void 0 ? void 0 : _state$tabs11.active,
1416
+ current: tables === null || tables === void 0 || (_tables$pagination3 = tables.pagination) === null || _tables$pagination3 === void 0 ? void 0 : _tables$pagination3.current,
1417
+ pageSize: tables === null || tables === void 0 || (_tables$pagination4 = tables.pagination) === null || _tables$pagination4 === void 0 ? void 0 : _tables$pagination4.pageSize
1418
+ }, (tables === null || tables === void 0 || (_tables$filter6 = tables.filter) === null || _tables$filter6 === void 0 ? void 0 : _tables$filter6.key) && {
1419
+ columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
1420
+ }), {}, {
1421
+ field: tables === null || tables === void 0 || (_tables$sorting15 = tables.sorting) === null || _tables$sorting15 === void 0 ? void 0 : _tables$sorting15.sortBy
1422
+ }, (header === null || header === void 0 || (_header$subHeading19 = header.subHeading) === null || _header$subHeading19 === void 0 || (_header$subHeading19 = _header$subHeading19.jsxConfig) === null || _header$subHeading19 === void 0 ? void 0 : _header$subHeading19.type) == "select" ? {
1423
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading20 = header.subHeading) === null || _header$subHeading20 === void 0 || (_header$subHeading20 = _header$subHeading20.jsxConfig) === null || _header$subHeading20 === void 0 ? void 0 : _header$subHeading20.value
1424
+ } : {}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data7 = staticFilter.data) === null || _staticFilter$data7 === void 0 || (_staticFilter$data7 = _staticFilter$data7.find(item => item.selected)) === null || _staticFilter$data7 === void 0 ? void 0 : _staticFilter$data7.value) && {
1425
+ staticFilter: staticFilter.data.find(item => item.selected).value
1426
+ }), {}, {
1427
+ order: tables === null || tables === void 0 || (_tables$sorting16 = tables.sorting) === null || _tables$sorting16 === void 0 ? void 0 : _tables$sorting16.sortDirection
1428
+ }, (_state$misc19 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc19 !== void 0 ? _state$misc19 : {}), {}, {
1429
+ multiSelectValue: (_state$staticFilter$m7 = state === null || state === void 0 || (_state$staticFilter7 = state.staticFilter) === null || _state$staticFilter7 === void 0 ? void 0 : _state$staticFilter7.multiSelectValue) !== null && _state$staticFilter$m7 !== void 0 ? _state$staticFilter$m7 : []
1430
+ }));
1431
+ if (error) {
1432
+ showErrorNotification(error);
1433
+ dispatch({
1434
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
1435
+ });
1436
+ } else {
1437
+ dispatch({
1438
+ type: _layoutReducer.actionTypes.SET_APPLIED_FILTERS,
1439
+ payload: currentFilters
1440
+ });
1441
+ dispatch({
1442
+ type: _layoutReducer.actionTypes.REMOVE_APPLIED_FILTER,
1443
+ payload: {
1444
+ filterKey
1445
+ }
1446
+ });
1447
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
1448
+ setStaticFilterData(data);
1449
+ }
1450
+ // Sync the filter form with remaining applied filters
1451
+ syncFilterFormWithAppliedFilters(currentFilters);
1452
+ dispatch({
1453
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
1454
+ payload: data
1455
+ });
1456
+ }
1457
+ }
1458
+ };
1459
+ const filterFormOnFinish = async formData => {
1460
+ // Check if this is a cancel/clear action - check both buttonClickType and the actual button data
1461
+ if (formData.type === "FILTER-CANCEL") {
1462
+ var _state$dropdownSearch6, _state$inputSearch6, _state$tabs12, _tables$pagination5, _tables$pagination6, _tables$filter7, _tables$sorting17, _header$subHeading21, _header$subHeading22, _staticFilter$data8, _tables$sorting18, _state$misc20, _state$staticFilter$m8, _state$staticFilter8;
1463
+ if (isFiltersEmpty(customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)) {
1464
+ dispatch({
1465
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_CLOSED
1466
+ });
1467
+ return;
1468
+ }
1469
+ const {
1470
+ error,
1471
+ data
1472
+ } = await handleTableChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (state === null || state === void 0 || (_state$dropdownSearch6 = state.dropdownSearch) === null || _state$dropdownSearch6 === void 0 || (_state$dropdownSearch6 = _state$dropdownSearch6.value) === null || _state$dropdownSearch6 === void 0 ? void 0 : _state$dropdownSearch6.trim()) && {
1473
+ searchedValue: state.dropdownSearch.value,
1474
+ selectedOption: state.dropdownSearch.selectedOption
1475
+ }), (state === null || state === void 0 || (_state$inputSearch6 = state.inputSearch) === null || _state$inputSearch6 === void 0 || (_state$inputSearch6 = _state$inputSearch6.value) === null || _state$inputSearch6 === void 0 ? void 0 : _state$inputSearch6.trim()) && {
1476
+ searchedValue: state.inputSearch.value
1477
+ }), {}, {
1478
+ selectedTab: state === null || state === void 0 || (_state$tabs12 = state.tabs) === null || _state$tabs12 === void 0 ? void 0 : _state$tabs12.active,
1479
+ current: tables === null || tables === void 0 || (_tables$pagination5 = tables.pagination) === null || _tables$pagination5 === void 0 ? void 0 : _tables$pagination5.current,
1480
+ pageSize: tables === null || tables === void 0 || (_tables$pagination6 = tables.pagination) === null || _tables$pagination6 === void 0 ? void 0 : _tables$pagination6.pageSize
1481
+ }, (tables === null || tables === void 0 || (_tables$filter7 = tables.filter) === null || _tables$filter7 === void 0 ? void 0 : _tables$filter7.key) && {
1482
+ columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
1483
+ }), {}, {
1484
+ field: tables === null || tables === void 0 || (_tables$sorting17 = tables.sorting) === null || _tables$sorting17 === void 0 ? void 0 : _tables$sorting17.sortBy
1485
+ }, (header === null || header === void 0 || (_header$subHeading21 = header.subHeading) === null || _header$subHeading21 === void 0 || (_header$subHeading21 = _header$subHeading21.jsxConfig) === null || _header$subHeading21 === void 0 ? void 0 : _header$subHeading21.type) == "select" ? {
1486
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading22 = header.subHeading) === null || _header$subHeading22 === void 0 || (_header$subHeading22 = _header$subHeading22.jsxConfig) === null || _header$subHeading22 === void 0 ? void 0 : _header$subHeading22.value
1487
+ } : {}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data8 = staticFilter.data) === null || _staticFilter$data8 === void 0 || (_staticFilter$data8 = _staticFilter$data8.find(item => item.selected)) === null || _staticFilter$data8 === void 0 ? void 0 : _staticFilter$data8.value) && {
1488
+ staticFilter: staticFilter.data.find(item => item.selected).value
1489
+ }), {}, {
1490
+ order: tables === null || tables === void 0 || (_tables$sorting18 = tables.sorting) === null || _tables$sorting18 === void 0 ? void 0 : _tables$sorting18.sortDirection
1491
+ }, (_state$misc20 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc20 !== void 0 ? _state$misc20 : {}), {}, {
1492
+ multiSelectValue: (_state$staticFilter$m8 = state === null || state === void 0 || (_state$staticFilter8 = state.staticFilter) === null || _state$staticFilter8 === void 0 ? void 0 : _state$staticFilter8.multiSelectValue) !== null && _state$staticFilter$m8 !== void 0 ? _state$staticFilter$m8 : []
1493
+ }));
1494
+ if (error) {
1495
+ showErrorNotification(error);
1496
+ dispatch({
1497
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
1498
+ });
1499
+ } else {
1500
+ var _config$customDrawer;
1501
+ dispatch({
1502
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
1503
+ payload: data
1504
+ });
1505
+ dispatch({
1506
+ type: _layoutReducer.actionTypes.CLEAR_ALL_APPLIED_FILTERS
1507
+ });
1508
+ dispatch({
1509
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_CLOSED
1510
+ });
1511
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
1512
+ setStaticFilterData(data);
1513
+ }
1514
+ const drawerData = config === null || config === void 0 || (_config$customDrawer = config.customDrawer) === null || _config$customDrawer === void 0 || (_config$customDrawer = _config$customDrawer.data) === null || _config$customDrawer === void 0 ? void 0 : _config$customDrawer[rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.drawerKey];
1515
+ if (drawerData) {
1516
+ dispatch({
1517
+ type: _layoutReducer.actionTypes.SET_CUSTOM_DRAWER,
1518
+ payload: drawerData
1519
+ });
1520
+ }
1521
+ }
1522
+ return;
1523
+ }
1524
+ if (formData.type === "EXPORT-CANCEL") {
1525
+ var _config$customDrawer2;
1526
+ const drawerData = config === null || config === void 0 || (_config$customDrawer2 = config.customDrawer) === null || _config$customDrawer2 === void 0 || (_config$customDrawer2 = _config$customDrawer2.data) === null || _config$customDrawer2 === void 0 ? void 0 : _config$customDrawer2[leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 ? void 0 : leftHeaderFirstButton.drawerKey];
1527
+ if (drawerData) {
1528
+ dispatch({
1529
+ type: _layoutReducer.actionTypes.SET_CUSTOM_DRAWER,
1530
+ payload: drawerData
1531
+ });
1532
+ }
1533
+ dispatch({
1534
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_CLOSED
1535
+ });
1536
+ return;
1537
+ }
1538
+
1539
+ // Only process filter data if this is actually a filter drawer
1540
+ if (formData.type === "FILTER-SUBMIT") {
1541
+ var _state$dropdownSearch7, _state$inputSearch7, _ref4, _appliedFilters$filte, _state$tabs13, _config$tables29, _config$tables30, _tables$filter8, _tables$sorting19, _header$subHeading23, _header$subHeading24, _staticFilter$data9, _tables$sorting20, _state$misc21, _state$staticFilter$m9, _state$staticFilter9;
1542
+ const appliedFilters = {};
1543
+ Object.keys(formData).forEach(key => {
1544
+ const value = formData[key];
1545
+ if (value !== undefined && value !== "" && value !== null) {
1546
+ appliedFilters[key] = value;
1547
+ }
1548
+ });
1549
+ if (isFiltersEmpty(appliedFilters)) {
1550
+ dispatch({
1551
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_CLOSED
1552
+ });
1553
+ return;
1554
+ }
1555
+ const {
1556
+ error,
1557
+ data
1558
+ } = await handleTableChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (state === null || state === void 0 || (_state$dropdownSearch7 = state.dropdownSearch) === null || _state$dropdownSearch7 === void 0 || (_state$dropdownSearch7 = _state$dropdownSearch7.value) === null || _state$dropdownSearch7 === void 0 ? void 0 : _state$dropdownSearch7.trim()) && {
1559
+ searchedValue: state.dropdownSearch.value,
1560
+ selectedOption: state.dropdownSearch.selectedOption
1561
+ }), (state === null || state === void 0 || (_state$inputSearch7 = state.inputSearch) === null || _state$inputSearch7 === void 0 || (_state$inputSearch7 = _state$inputSearch7.value) === null || _state$inputSearch7 === void 0 ? void 0 : _state$inputSearch7.trim()) && {
1562
+ searchedValue: state.inputSearch.value
1563
+ }), appliedFilters), {}, {
1564
+ filterOn: (_ref4 = (_appliedFilters$filte = appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.filterBy) !== null && _appliedFilters$filte !== void 0 ? _appliedFilters$filte : customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.defaultAppliedFilter) !== null && _ref4 !== void 0 ? _ref4 : "",
1565
+ fromDate: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.fromDate,
1566
+ toDate: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.toDate,
1567
+ selectedTab: state === null || state === void 0 || (_state$tabs13 = state.tabs) === null || _state$tabs13 === void 0 ? void 0 : _state$tabs13.active,
1568
+ current: config === null || config === void 0 || (_config$tables29 = config.tables) === null || _config$tables29 === void 0 || (_config$tables29 = _config$tables29.pagination) === null || _config$tables29 === void 0 ? void 0 : _config$tables29.current,
1569
+ pageSize: config === null || config === void 0 || (_config$tables30 = config.tables) === null || _config$tables30 === void 0 || (_config$tables30 = _config$tables30.pagination) === null || _config$tables30 === void 0 ? void 0 : _config$tables30.pageSize
1570
+ }, (tables === null || tables === void 0 || (_tables$filter8 = tables.filter) === null || _tables$filter8 === void 0 ? void 0 : _tables$filter8.key) && {
1571
+ columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
1572
+ }), {}, {
1573
+ field: tables === null || tables === void 0 || (_tables$sorting19 = tables.sorting) === null || _tables$sorting19 === void 0 ? void 0 : _tables$sorting19.sortBy
1574
+ }, (header === null || header === void 0 || (_header$subHeading23 = header.subHeading) === null || _header$subHeading23 === void 0 || (_header$subHeading23 = _header$subHeading23.jsxConfig) === null || _header$subHeading23 === void 0 ? void 0 : _header$subHeading23.type) == "select" ? {
1575
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading24 = header.subHeading) === null || _header$subHeading24 === void 0 || (_header$subHeading24 = _header$subHeading24.jsxConfig) === null || _header$subHeading24 === void 0 ? void 0 : _header$subHeading24.value
1576
+ } : {}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data9 = staticFilter.data) === null || _staticFilter$data9 === void 0 || (_staticFilter$data9 = _staticFilter$data9.find(item => item.selected)) === null || _staticFilter$data9 === void 0 ? void 0 : _staticFilter$data9.value) && {
1577
+ staticFilter: staticFilter.data.find(item => item.selected).value
1578
+ }), {}, {
1579
+ order: tables === null || tables === void 0 || (_tables$sorting20 = tables.sorting) === null || _tables$sorting20 === void 0 ? void 0 : _tables$sorting20.sortDirection
1580
+ }, (_state$misc21 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc21 !== void 0 ? _state$misc21 : {}), {}, {
1581
+ multiSelectValue: (_state$staticFilter$m9 = state === null || state === void 0 || (_state$staticFilter9 = state.staticFilter) === null || _state$staticFilter9 === void 0 ? void 0 : _state$staticFilter9.multiSelectValue) !== null && _state$staticFilter$m9 !== void 0 ? _state$staticFilter$m9 : []
1582
+ }));
1583
+ if (error) {
1584
+ showErrorNotification(error);
1585
+ dispatch({
1586
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
1587
+ });
1588
+ } else {
1589
+ var _config$tables31, _config$tables32;
1590
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
1591
+ var _staticFilter$data$fi3, _config$staticFilter2;
1592
+ const selectedKey = staticFilter === null || staticFilter === void 0 || (_staticFilter$data$fi3 = staticFilter.data.find(item => item.selected)) === null || _staticFilter$data$fi3 === void 0 ? void 0 : _staticFilter$data$fi3.value;
1593
+ const dynamicConfig = (0, _staticConfigResolver.default)(config === null || config === void 0 || (_config$staticFilter2 = config.staticFilter) === null || _config$staticFilter2 === void 0 ? void 0 : _config$staticFilter2.data, data !== null && data !== void 0 ? data : {});
1594
+ dispatch({
1595
+ type: _layoutReducer.actionTypes.SET_STATIC_FILTER,
1596
+ payload: dynamicConfig
1597
+ });
1598
+ dispatch({
1599
+ type: _layoutReducer.actionTypes.SET_STATIC_FILTER_SELECTION,
1600
+ payload: selectedKey
1601
+ });
1602
+ }
1603
+ dispatch({
1604
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
1605
+ payload: data
1606
+ });
1607
+ dispatch({
1608
+ type: _layoutReducer.actionTypes.SET_APPLIED_FILTERS,
1609
+ payload: appliedFilters
1610
+ });
1611
+ dispatch({
1612
+ type: _layoutReducer.actionTypes.UPDATE_FILTER_DEFAULT_VALUES,
1613
+ payload: formData
1614
+ });
1615
+ dispatch({
1616
+ type: _layoutReducer.actionTypes.SET_PAGINATION,
1617
+ payload: {
1618
+ current: config === null || config === void 0 || (_config$tables31 = config.tables) === null || _config$tables31 === void 0 || (_config$tables31 = _config$tables31.pagination) === null || _config$tables31 === void 0 ? void 0 : _config$tables31.current,
1619
+ pageSize: config === null || config === void 0 || (_config$tables32 = config.tables) === null || _config$tables32 === void 0 || (_config$tables32 = _config$tables32.pagination) === null || _config$tables32 === void 0 ? void 0 : _config$tables32.pageSize
1620
+ }
1621
+ });
1622
+ dispatch({
1623
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_CLOSED
1624
+ });
1625
+ }
1626
+ } else if (formData.drawerKey === "exportDrawer") {
1627
+ const appliedFilters = {};
1628
+ Object.keys(formData).forEach(key => {
1629
+ const value = formData[key];
1630
+ if (value !== undefined && value !== "" && value !== null) {
1631
+ appliedFilters[key] = value;
1632
+ }
1633
+ });
1634
+ if (handleSecondaryTableCTAClick) {
1635
+ var _state$dropdownSearch8, _state$inputSearch8, _state$tabs14, _tables$pagination7, _tables$pagination8, _tables$filter9, _tables$sorting21, _tables$sorting22, _header$subHeading25, _header$subHeading26, _staticFilter$data10, _state$misc22, _state$staticFilter$m10, _state$staticFilter10;
1636
+ const {
1637
+ error,
1638
+ data
1639
+ } = await (handleSecondaryTableCTAClick === null || handleSecondaryTableCTAClick === void 0 ? void 0 : handleSecondaryTableCTAClick(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (state === null || state === void 0 || (_state$dropdownSearch8 = state.dropdownSearch) === null || _state$dropdownSearch8 === void 0 || (_state$dropdownSearch8 = _state$dropdownSearch8.value) === null || _state$dropdownSearch8 === void 0 ? void 0 : _state$dropdownSearch8.trim()) && {
1640
+ searchedValue: state.dropdownSearch.value,
1641
+ selectedOption: state.dropdownSearch.selectedOption
1642
+ }), (state === null || state === void 0 || (_state$inputSearch8 = state.inputSearch) === null || _state$inputSearch8 === void 0 || (_state$inputSearch8 = _state$inputSearch8.value) === null || _state$inputSearch8 === void 0 ? void 0 : _state$inputSearch8.trim()) && {
1643
+ searchedValue: state.inputSearch.value
1644
+ }), {}, {
1645
+ selectedTab: state === null || state === void 0 || (_state$tabs14 = state.tabs) === null || _state$tabs14 === void 0 ? void 0 : _state$tabs14.active,
1646
+ current: tables === null || tables === void 0 || (_tables$pagination7 = tables.pagination) === null || _tables$pagination7 === void 0 ? void 0 : _tables$pagination7.current,
1647
+ pageSize: tables === null || tables === void 0 || (_tables$pagination8 = tables.pagination) === null || _tables$pagination8 === void 0 ? void 0 : _tables$pagination8.pageSize,
1648
+ columnFilterStatus: tables === null || tables === void 0 || (_tables$filter9 = tables.filter) === null || _tables$filter9 === void 0 ? void 0 : _tables$filter9.value,
1649
+ field: tables === null || tables === void 0 || (_tables$sorting21 = tables.sorting) === null || _tables$sorting21 === void 0 ? void 0 : _tables$sorting21.sortBy,
1650
+ order: tables === null || tables === void 0 || (_tables$sorting22 = tables.sorting) === null || _tables$sorting22 === void 0 ? void 0 : _tables$sorting22.sortDirection
1651
+ }, (header === null || header === void 0 || (_header$subHeading25 = header.subHeading) === null || _header$subHeading25 === void 0 || (_header$subHeading25 = _header$subHeading25.jsxConfig) === null || _header$subHeading25 === void 0 ? void 0 : _header$subHeading25.type) == "select" ? {
1652
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading26 = header.subHeading) === null || _header$subHeading26 === void 0 || (_header$subHeading26 = _header$subHeading26.jsxConfig) === null || _header$subHeading26 === void 0 ? void 0 : _header$subHeading26.value
1653
+ } : {}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data10 = staticFilter.data) === null || _staticFilter$data10 === void 0 || (_staticFilter$data10 = _staticFilter$data10.find(item => item.selected)) === null || _staticFilter$data10 === void 0 ? void 0 : _staticFilter$data10.value) && {
1654
+ staticFilter: staticFilter.data.find(item => item.selected).value
1655
+ }), {}, {
1656
+ fromDate: formData === null || formData === void 0 ? void 0 : formData.fromDate,
1657
+ toDate: formData === null || formData === void 0 ? void 0 : formData.toDate
1658
+ }, appliedFilters), (formData === null || formData === void 0 ? void 0 : formData.exportType) && {
1659
+ exportType: formData === null || formData === void 0 ? void 0 : formData.exportType
1660
+ }), (_state$misc22 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc22 !== void 0 ? _state$misc22 : {}), {}, {
1661
+ multiSelectValue: (_state$staticFilter$m10 = state === null || state === void 0 || (_state$staticFilter10 = state.staticFilter) === null || _state$staticFilter10 === void 0 ? void 0 : _state$staticFilter10.multiSelectValue) !== null && _state$staticFilter$m10 !== void 0 ? _state$staticFilter$m10 : []
1662
+ })));
1663
+ if (error) {
1664
+ showErrorNotification(error);
1665
+ } else {
1666
+ var _formData$fileName;
1667
+ (0, _downloadFile.default)(data, (_formData$fileName = formData.fileName) !== null && _formData$fileName !== void 0 ? _formData$fileName : undefined);
1668
+ dispatch({
1669
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_CLOSED
1670
+ });
1671
+ }
1672
+ }
1673
+ }
1674
+ };
1675
+ const onClearAllAppliedFilters = async () => {
1676
+ var _state$dropdownSearch9, _state$inputSearch9, _state$tabs15, _tables$pagination9, _tables$pagination10, _tables$filter10, _tables$sorting23, _header$subHeading27, _header$subHeading28, _staticFilter$data11, _tables$sorting24, _state$misc23, _state$staticFilter$m11, _state$staticFilter11;
1677
+ const {
1678
+ error,
1679
+ data
1680
+ } = await handleTableChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (state === null || state === void 0 || (_state$dropdownSearch9 = state.dropdownSearch) === null || _state$dropdownSearch9 === void 0 || (_state$dropdownSearch9 = _state$dropdownSearch9.value) === null || _state$dropdownSearch9 === void 0 ? void 0 : _state$dropdownSearch9.trim()) && {
1681
+ searchedValue: state.dropdownSearch.value,
1682
+ selectedOption: state.dropdownSearch.selectedOption
1683
+ }), (state === null || state === void 0 || (_state$inputSearch9 = state.inputSearch) === null || _state$inputSearch9 === void 0 || (_state$inputSearch9 = _state$inputSearch9.value) === null || _state$inputSearch9 === void 0 ? void 0 : _state$inputSearch9.trim()) && {
1684
+ searchedValue: state.inputSearch.value
1685
+ }), {}, {
1686
+ selectedTab: state === null || state === void 0 || (_state$tabs15 = state.tabs) === null || _state$tabs15 === void 0 ? void 0 : _state$tabs15.active,
1687
+ current: tables === null || tables === void 0 || (_tables$pagination9 = tables.pagination) === null || _tables$pagination9 === void 0 ? void 0 : _tables$pagination9.current,
1688
+ pageSize: tables === null || tables === void 0 || (_tables$pagination10 = tables.pagination) === null || _tables$pagination10 === void 0 ? void 0 : _tables$pagination10.pageSize
1689
+ }, (tables === null || tables === void 0 || (_tables$filter10 = tables.filter) === null || _tables$filter10 === void 0 ? void 0 : _tables$filter10.key) && {
1690
+ columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
1691
+ }), {}, {
1692
+ field: tables === null || tables === void 0 || (_tables$sorting23 = tables.sorting) === null || _tables$sorting23 === void 0 ? void 0 : _tables$sorting23.sortBy
1693
+ }, (header === null || header === void 0 || (_header$subHeading27 = header.subHeading) === null || _header$subHeading27 === void 0 || (_header$subHeading27 = _header$subHeading27.jsxConfig) === null || _header$subHeading27 === void 0 ? void 0 : _header$subHeading27.type) == "select" ? {
1694
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading28 = header.subHeading) === null || _header$subHeading28 === void 0 || (_header$subHeading28 = _header$subHeading28.jsxConfig) === null || _header$subHeading28 === void 0 ? void 0 : _header$subHeading28.value
1695
+ } : {}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data11 = staticFilter.data) === null || _staticFilter$data11 === void 0 || (_staticFilter$data11 = _staticFilter$data11.find(item => item.selected)) === null || _staticFilter$data11 === void 0 ? void 0 : _staticFilter$data11.value) && {
1696
+ staticFilter: staticFilter.data.find(item => item.selected).value
1697
+ }), {}, {
1698
+ order: tables === null || tables === void 0 || (_tables$sorting24 = tables.sorting) === null || _tables$sorting24 === void 0 ? void 0 : _tables$sorting24.sortDirection
1699
+ }, (_state$misc23 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc23 !== void 0 ? _state$misc23 : {}), {}, {
1700
+ multiSelectValue: (_state$staticFilter$m11 = state === null || state === void 0 || (_state$staticFilter11 = state.staticFilter) === null || _state$staticFilter11 === void 0 ? void 0 : _state$staticFilter11.multiSelectValue) !== null && _state$staticFilter$m11 !== void 0 ? _state$staticFilter$m11 : []
1701
+ }));
1702
+ if (error) {
1703
+ showErrorNotification(error);
1704
+ dispatch({
1705
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
1706
+ });
1707
+ } else {
1708
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
1709
+ setStaticFilterData(data);
1710
+ }
1711
+ dispatch({
1712
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
1713
+ payload: data
1714
+ });
1715
+ dispatch({
1716
+ type: _layoutReducer.actionTypes.CLEAR_ALL_APPLIED_FILTERS
1717
+ });
1718
+ }
1719
+ };
1720
+ const syncFilterFormWithAppliedFilters = appliedFilters => {
1721
+ dispatch({
1722
+ type: _layoutReducer.actionTypes.UPDATE_FILTER_FORM_VALUES,
1723
+ payload: {
1724
+ formValues: appliedFilters
1725
+ }
1726
+ });
1727
+ };
1728
+
1729
+ /**
1730
+ * Handles the modal footer click event.
1731
+ *
1732
+ * @async
1733
+ * @function
1734
+ * @param {String} action - The action to be performed.
1735
+ * @param {Object} buttonConfig - The button configuration.
1736
+ * @returns {Promise<void>} - Resolves after the action is handled.
1737
+ *
1738
+ * Handles the modal footer button clicks with the following actions:
1739
+ * - "CLOSE_MODAL": Closes the modal.
1740
+ * - "CLOSE_MODAL_AND_FETCH": Calls the `handleModalCloseSuccess` function
1741
+ * if provided, and closes the modal if successful. Also re-initializes the
1742
+ * state.
1743
+ * - Any other action: Calls the `handleDrawerFormOnFinish` function if
1744
+ * provided, with the action as "APPROVE" and the order UUIDs from the
1745
+ * selected row keys. Closes the modal and re-initializes the state if
1746
+ * successful.
1747
+ */
1748
+
1749
+ const onClickModalFooter = async (action, buttonConfig) => {
1750
+ if (action === "CLOSE_MODAL") {
1751
+ dispatch({
1752
+ type: _layoutReducer.actionTypes.TOGGLE_MODAL,
1753
+ payload: false
1754
+ });
1755
+ return;
1756
+ } else if (action === "CLOSE_MODAL_AND_FETCH") {
1757
+ if (handleModalCloseSuccess) {
1758
+ var _stateRef$current, _state$misc24;
1759
+ const {
1760
+ error,
1761
+ data
1762
+ } = await (handleModalCloseSuccess === null || handleModalCloseSuccess === void 0 ? void 0 : handleModalCloseSuccess(_objectSpread({
1763
+ modalValue: stateRef === null || stateRef === void 0 || (_stateRef$current = stateRef.current) === null || _stateRef$current === void 0 || (_stateRef$current = _stateRef$current.modal) === null || _stateRef$current === void 0 ? void 0 : _stateRef$current.value,
1764
+ call: buttonConfig === null || buttonConfig === void 0 ? void 0 : buttonConfig.call
1765
+ }, (_state$misc24 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc24 !== void 0 ? _state$misc24 : {})));
1766
+ if (error) {
1767
+ showErrorNotification(error);
1768
+ } else {
1769
+ showSuccessNotification(data === null || data === void 0 ? void 0 : data.message);
1770
+ dispatch({
1771
+ type: _layoutReducer.actionTypes.TOGGLE_MODAL,
1772
+ payload: false
1773
+ });
1774
+ init();
1775
+ }
1776
+ }
1777
+ } else {
1778
+ if (handleDrawerFormOnFinish) {
1779
+ var _state$tables$selecte, _state$tables4, _state$misc25;
1780
+ let req = {};
1781
+ req.type = "APPROVE";
1782
+ req.orderUUID = (_state$tables$selecte = state === null || state === void 0 || (_state$tables4 = state.tables) === null || _state$tables4 === void 0 || (_state$tables4 = _state$tables4.selectedRowKeys) === null || _state$tables4 === void 0 ? void 0 : _state$tables4.map(item => item.orderUUID)) !== null && _state$tables$selecte !== void 0 ? _state$tables$selecte : [];
1783
+ req.misc = (_state$misc25 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc25 !== void 0 ? _state$misc25 : {};
1784
+ const {
1785
+ error,
1786
+ data
1787
+ } = await (handleDrawerFormOnFinish === null || handleDrawerFormOnFinish === void 0 ? void 0 : handleDrawerFormOnFinish(req));
1788
+ if (error) {
1789
+ showErrorNotification(error);
1790
+ } else {
1791
+ showSuccessNotification(data === null || data === void 0 ? void 0 : data.message);
1792
+ dispatch({
1793
+ type: _layoutReducer.actionTypes.TOGGLE_MODAL,
1794
+ payload: false
1795
+ });
1796
+ init();
1797
+ }
1798
+ }
1799
+ }
1800
+ };
1801
+ const emptyTableState = /*#__PURE__*/_react.default.createElement(_antd.Empty, {
1802
+ image: /*#__PURE__*/_react.default.createElement("img", {
1803
+ src: _astronaut_emptystate.default,
1804
+ alt: "Nothing to show yet"
1805
+ }),
1806
+ description: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
1807
+ className: "margin-top-24"
1808
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
1809
+ color: "primary-content",
1810
+ typography: "type-t1-500"
1811
+ }, "Nothing available at the moment")), /*#__PURE__*/_react.default.createElement("div", {
1812
+ className: "margin-top-12"
1813
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
1814
+ color: "secondary-content",
1815
+ typography: "type-b1-400"
1816
+ }, "There is currently no data to display. We will update automatically when new information is available.")))
1817
+ });
1818
+
1819
+ /**
1820
+ * Handles the left header button click event.
1821
+ *
1822
+ * @async
1823
+ * @function
1824
+ * @param {Object} configArgs - The button configuration arguments.
1825
+ * @returns {Promise<void>} - Resolves after the action is handled.
1826
+ *
1827
+ * Handles the left header button clicks with the following actions:
1828
+ * - "EXPORT_DATA": Triggers data export functionality.
1829
+ * - "OPEN_DRAWER": Opens a drawer with the specified key.
1830
+ * - "OPEN_MODAL": Opens a modal with updated content.
1831
+ */
1832
+ const leftHeaderFirstButtonClick = async () => {
1833
+ if ((leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 ? void 0 : leftHeaderFirstButton.action) === "OPEN_CUSTOM_DRAWER") {
1834
+ var _config$customDrawer3;
1835
+ const drawerData = config === null || config === void 0 || (_config$customDrawer3 = config.customDrawer) === null || _config$customDrawer3 === void 0 || (_config$customDrawer3 = _config$customDrawer3.data) === null || _config$customDrawer3 === void 0 ? void 0 : _config$customDrawer3[leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 ? void 0 : leftHeaderFirstButton.drawerKey];
1836
+ dispatch({
1837
+ type: _layoutReducer.actionTypes.SET_CUSTOM_DRAWER,
1838
+ payload: drawerData
1839
+ });
1840
+ dispatch({
1841
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_OPEN
1842
+ });
1843
+ } else if ((leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 ? void 0 : leftHeaderFirstButton.action) === "EXPORT_DATA") {
1844
+ handleLeftHeaderFirstButton(state).then(res => {
1845
+ const {
1846
+ error,
1847
+ data
1848
+ } = res;
1849
+ if (error) {
1850
+ showErrorNotification(error);
1851
+ } else {
1852
+ showSuccessNotification((data === null || data === void 0 ? void 0 : data.message) || "Export initiated successfully");
1853
+ }
1854
+ }).catch(err => {
1855
+ showErrorNotification(err.message || "An error occurred during export");
1856
+ });
1857
+ }
1858
+ };
1859
+
1860
+ /**
1861
+ * Handles the right header button click event.
1862
+ *
1863
+ * @async
1864
+ * @function
1865
+ * @param {Object} configArgs - The button configuration arguments.
1866
+ * @returns {Promise<void>} - Resolves after the action is handled.
1867
+ *
1868
+ * Handles the right header button clicks with the following actions:
1869
+ * - "OPEN_FILTER_DRAWER": Opens the filter drawer.
1870
+ * - "OPEN_DRAWER": Opens a drawer with the specified key.
1871
+ */
1872
+ const rightHeaderFirstButtonClick = async () => {
1873
+ if ((rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.action) === "OPEN_CUSTOM_DRAWER") {
1874
+ var _config$customDrawer4, _state$customDrawer2;
1875
+ const drawerData = config === null || config === void 0 || (_config$customDrawer4 = config.customDrawer) === null || _config$customDrawer4 === void 0 || (_config$customDrawer4 = _config$customDrawer4.data) === null || _config$customDrawer4 === void 0 ? void 0 : _config$customDrawer4[rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.drawerKey];
1876
+ dispatch({
1877
+ type: _layoutReducer.actionTypes.SET_CUSTOM_DRAWER,
1878
+ payload: drawerData
1879
+ });
1880
+ dispatch({
1881
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_OPEN
1882
+ });
1883
+
1884
+ // Sync the filter form with applied filters if they exist
1885
+ if (state !== null && state !== void 0 && (_state$customDrawer2 = state.customDrawer) !== null && _state$customDrawer2 !== void 0 && _state$customDrawer2.appliedFilters && Object.keys(state.customDrawer.appliedFilters).length > 0) {
1886
+ syncFilterFormWithAppliedFilters(state.customDrawer.appliedFilters);
1887
+ }
1888
+ } else if ((rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.action) === "OPEN_DRAWER") {
1889
+ dispatch({
1890
+ type: _layoutReducer.actionTypes.TOGGLE_DRAWER,
1891
+ payload: rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.key
1892
+ });
1893
+ }
1894
+ };
1895
+ const rightHeaderSecondButtonClick = async () => {
1896
+ if ((rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.action) === "RESET_CUSTOM_DRAWER") {
1897
+ var _state$dropdownSearch10, _state$inputSearch10, _state$tabs16, _tables$pagination11, _tables$pagination12, _tables$filter11, _tables$sorting25, _header$subHeading29, _header$subHeading30, _staticFilter$data12, _tables$sorting26, _state$misc26, _state$staticFilter$m12, _state$staticFilter12;
1898
+ const {
1899
+ error,
1900
+ data
1901
+ } = await handleTableChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (state === null || state === void 0 || (_state$dropdownSearch10 = state.dropdownSearch) === null || _state$dropdownSearch10 === void 0 || (_state$dropdownSearch10 = _state$dropdownSearch10.value) === null || _state$dropdownSearch10 === void 0 ? void 0 : _state$dropdownSearch10.trim()) && {
1902
+ searchedValue: state.dropdownSearch.value,
1903
+ selectedOption: state.dropdownSearch.selectedOption
1904
+ }), (state === null || state === void 0 || (_state$inputSearch10 = state.inputSearch) === null || _state$inputSearch10 === void 0 || (_state$inputSearch10 = _state$inputSearch10.value) === null || _state$inputSearch10 === void 0 ? void 0 : _state$inputSearch10.trim()) && {
1905
+ searchedValue: state.inputSearch.value
1906
+ }), {}, {
1907
+ selectedTab: state === null || state === void 0 || (_state$tabs16 = state.tabs) === null || _state$tabs16 === void 0 ? void 0 : _state$tabs16.active,
1908
+ current: tables === null || tables === void 0 || (_tables$pagination11 = tables.pagination) === null || _tables$pagination11 === void 0 ? void 0 : _tables$pagination11.current,
1909
+ pageSize: tables === null || tables === void 0 || (_tables$pagination12 = tables.pagination) === null || _tables$pagination12 === void 0 ? void 0 : _tables$pagination12.pageSize
1910
+ }, (tables === null || tables === void 0 || (_tables$filter11 = tables.filter) === null || _tables$filter11 === void 0 ? void 0 : _tables$filter11.key) && {
1911
+ columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
1912
+ }), {}, {
1913
+ field: tables === null || tables === void 0 || (_tables$sorting25 = tables.sorting) === null || _tables$sorting25 === void 0 ? void 0 : _tables$sorting25.sortBy
1914
+ }, (header === null || header === void 0 || (_header$subHeading29 = header.subHeading) === null || _header$subHeading29 === void 0 || (_header$subHeading29 = _header$subHeading29.jsxConfig) === null || _header$subHeading29 === void 0 ? void 0 : _header$subHeading29.type) == "select" ? {
1915
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading30 = header.subHeading) === null || _header$subHeading30 === void 0 || (_header$subHeading30 = _header$subHeading30.jsxConfig) === null || _header$subHeading30 === void 0 ? void 0 : _header$subHeading30.value
1916
+ } : {}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data12 = staticFilter.data) === null || _staticFilter$data12 === void 0 || (_staticFilter$data12 = _staticFilter$data12.find(item => item.selected)) === null || _staticFilter$data12 === void 0 ? void 0 : _staticFilter$data12.value) && {
1917
+ staticFilter: staticFilter.data.find(item => item.selected).value
1918
+ }), {}, {
1919
+ order: tables === null || tables === void 0 || (_tables$sorting26 = tables.sorting) === null || _tables$sorting26 === void 0 ? void 0 : _tables$sorting26.sortDirection
1920
+ }, (_state$misc26 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc26 !== void 0 ? _state$misc26 : {}), {}, {
1921
+ multiSelectValue: (_state$staticFilter$m12 = state === null || state === void 0 || (_state$staticFilter12 = state.staticFilter) === null || _state$staticFilter12 === void 0 ? void 0 : _state$staticFilter12.multiSelectValue) !== null && _state$staticFilter$m12 !== void 0 ? _state$staticFilter$m12 : []
1922
+ }));
1923
+ if (error) {
1924
+ showErrorNotification(error);
1925
+ dispatch({
1926
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
1927
+ });
1928
+ } else {
1929
+ var _config$customDrawer5;
1930
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
1931
+ setStaticFilterData(data);
1932
+ }
1933
+ dispatch({
1934
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
1935
+ payload: data
1936
+ });
1937
+ dispatch({
1938
+ type: _layoutReducer.actionTypes.CLEAR_ALL_APPLIED_FILTERS
1939
+ });
1940
+ const drawerData = config === null || config === void 0 || (_config$customDrawer5 = config.customDrawer) === null || _config$customDrawer5 === void 0 || (_config$customDrawer5 = _config$customDrawer5.data) === null || _config$customDrawer5 === void 0 ? void 0 : _config$customDrawer5[rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.drawerKey];
1941
+ if (drawerData) {
1942
+ dispatch({
1943
+ type: _layoutReducer.actionTypes.SET_CUSTOM_DRAWER,
1944
+ payload: drawerData
1945
+ });
1946
+ }
1947
+ }
1948
+ }
1949
+ };
1950
+
1951
+ /**
1952
+ * @function
1953
+ * @param {Object} selectedOption - The selected option from the custom select.
1954
+ * @param {String} key - The key of the drawer data to be updated.
1955
+ * @param {String} action - The custom select action.
1956
+ * @description
1957
+ * Updates the state of the drawer data with the selected option value
1958
+ * for the given key when the action is "changeBillingAddress".
1959
+ */
1960
+ const updateStateData = (selectedOption, key, action) => {
1961
+ if (action === "changeBillingAddress") {
1962
+ dispatch({
1963
+ type: _layoutReducer.actionTypes.SET_CUSTOM_DRAWER_DATA_SELECT,
1964
+ payload: {
1965
+ key: key,
1966
+ value: selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.subLabel
1967
+ }
1968
+ });
1969
+ }
1970
+ };
1971
+ const handleSubHeadingSelect = async val => {
1972
+ if (val) {
1973
+ var _state$tabs17, _tables$pagination13, _tables$pagination14, _state$misc27;
1974
+ dispatch({
1975
+ type: _layoutReducer.actionTypes.SET_SUBHEADING_SELECTED_CONFIG,
1976
+ payload: val
1977
+ });
1978
+ const {
1979
+ error,
1980
+ data
1981
+ } = await handleSubHeadingSelectClick(_objectSpread({
1982
+ selectedTab: state === null || state === void 0 || (_state$tabs17 = state.tabs) === null || _state$tabs17 === void 0 ? void 0 : _state$tabs17.active,
1983
+ searchedValue: inputSearch === null || inputSearch === void 0 ? void 0 : inputSearch.value,
1984
+ current: tables === null || tables === void 0 || (_tables$pagination13 = tables.pagination) === null || _tables$pagination13 === void 0 ? void 0 : _tables$pagination13.current,
1985
+ pageSize: tables === null || tables === void 0 || (_tables$pagination14 = tables.pagination) === null || _tables$pagination14 === void 0 ? void 0 : _tables$pagination14.pageSize,
1986
+ subHeadingSelectVal: val
1987
+ }, (_state$misc27 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc27 !== void 0 ? _state$misc27 : {}));
1988
+ if (error) {
1989
+ showErrorNotification(error);
1990
+ dispatch({
1991
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
1992
+ });
1993
+ } else {
1994
+ dispatch({
1995
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
1996
+ payload: data
1997
+ });
1998
+ }
1999
+ }
2000
+ };
2001
+
2002
+ /**
2003
+ * Handles static filter selection
2004
+ * @param {string} filterValue - The value of the selected filter
2005
+ */
2006
+ const onStaticFilterSelect = async filterValue => {
2007
+ const selectedFilterStatus = staticFilter.data.map(item => item.selected ? item.value : null).filter(Boolean);
2008
+ const currentSelectedIndex = selectedFilterStatus.indexOf(filterValue);
2009
+ if (currentSelectedIndex === -1) {
2010
+ selectedFilterStatus.push(filterValue);
2011
+ } else {
2012
+ selectedFilterStatus.splice(currentSelectedIndex, 1);
2013
+ }
2014
+ const multiSelectValue = [...selectedFilterStatus];
2015
+ dispatch({
2016
+ type: _layoutReducer.actionTypes.SET_STATIC_FILTER_SELECTION,
2017
+ payload: filterValue,
2018
+ source: "click"
2019
+ });
2020
+
2021
+ // Call the handler if provided
2022
+ if (handleTableChange) {
2023
+ var _state$dropdownSearch11, _state$inputSearch11, _state$tabs18, _tables$pagination15, _tables$sorting27, _tables$sorting28, _header$subHeading31, _header$subHeading32, _customDrawer$applied10, _state$misc28;
2024
+ dispatch({
2025
+ type: _layoutReducer.actionTypes.SET_LOADING,
2026
+ payload: true
2027
+ });
2028
+ const {
2029
+ error,
2030
+ data
2031
+ } = await handleTableChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (state === null || state === void 0 || (_state$dropdownSearch11 = state.dropdownSearch) === null || _state$dropdownSearch11 === void 0 || (_state$dropdownSearch11 = _state$dropdownSearch11.value) === null || _state$dropdownSearch11 === void 0 ? void 0 : _state$dropdownSearch11.trim()) && {
2032
+ searchedValue: state.dropdownSearch.value,
2033
+ selectedOption: state.dropdownSearch.selectedOption
2034
+ }), (state === null || state === void 0 || (_state$inputSearch11 = state.inputSearch) === null || _state$inputSearch11 === void 0 || (_state$inputSearch11 = _state$inputSearch11.value) === null || _state$inputSearch11 === void 0 ? void 0 : _state$inputSearch11.trim()) && {
2035
+ searchedValue: state.inputSearch.value
2036
+ }), {}, {
2037
+ selectedTab: state === null || state === void 0 || (_state$tabs18 = state.tabs) === null || _state$tabs18 === void 0 ? void 0 : _state$tabs18.active,
2038
+ current: 1,
2039
+ pageSize: tables === null || tables === void 0 || (_tables$pagination15 = tables.pagination) === null || _tables$pagination15 === void 0 ? void 0 : _tables$pagination15.pageSize,
2040
+ filterStatus: filterValue,
2041
+ field: tables === null || tables === void 0 || (_tables$sorting27 = tables.sorting) === null || _tables$sorting27 === void 0 ? void 0 : _tables$sorting27.sortBy,
2042
+ order: tables === null || tables === void 0 || (_tables$sorting28 = tables.sorting) === null || _tables$sorting28 === void 0 ? void 0 : _tables$sorting28.sortDirection
2043
+ }, (header === null || header === void 0 || (_header$subHeading31 = header.subHeading) === null || _header$subHeading31 === void 0 || (_header$subHeading31 = _header$subHeading31.jsxConfig) === null || _header$subHeading31 === void 0 ? void 0 : _header$subHeading31.type) == "select" ? {
2044
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading32 = header.subHeading) === null || _header$subHeading32 === void 0 || (_header$subHeading32 = _header$subHeading32.jsxConfig) === null || _header$subHeading32 === void 0 ? void 0 : _header$subHeading32.value
2045
+ } : {}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied10 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied10 !== void 0 ? _customDrawer$applied10 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (_state$misc28 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc28 !== void 0 ? _state$misc28 : {}), {}, {
2046
+ staticFilter: filterValue,
2047
+ // Pass static filter value
2048
+ multiSelectValue: multiSelectValue
2049
+ }));
2050
+ if (error) {
2051
+ showErrorNotification(error);
2052
+ dispatch({
2053
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
2054
+ });
2055
+ } else {
2056
+ var _tables$pagination16;
2057
+ dispatch({
2058
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
2059
+ payload: data
2060
+ });
2061
+ // Reset pagination to first page
2062
+ dispatch({
2063
+ type: _layoutReducer.actionTypes.SET_PAGINATION,
2064
+ payload: {
2065
+ current: 1,
2066
+ pageSize: tables === null || tables === void 0 || (_tables$pagination16 = tables.pagination) === null || _tables$pagination16 === void 0 ? void 0 : _tables$pagination16.pageSize
2067
+ }
2068
+ });
2069
+ }
2070
+ dispatch({
2071
+ type: _layoutReducer.actionTypes.SET_LOADING,
2072
+ payload: false
2073
+ });
2074
+ }
2075
+ };
2076
+ const onMobilePageChange = async _ref5 => {
2077
+ let {
2078
+ current,
2079
+ pageSize
2080
+ } = _ref5;
2081
+ dispatch({
2082
+ type: _layoutReducer.actionTypes.SET_PAGINATION,
2083
+ payload: {
2084
+ current,
2085
+ pageSize
2086
+ }
2087
+ });
2088
+ if (handleTableChange) {
2089
+ var _state$dropdownSearch12, _state$inputSearch12, _state$tabs19, _tables$filter12, _tables$sorting29, _tables$sorting30, _header$subHeading33, _header$subHeading34, _staticFilter$data13, _customDrawer$applied11, _state$misc29, _state$staticFilter$m13, _state$staticFilter13;
2090
+ const {
2091
+ error,
2092
+ data
2093
+ } = await handleTableChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (state === null || state === void 0 || (_state$dropdownSearch12 = state.dropdownSearch) === null || _state$dropdownSearch12 === void 0 || (_state$dropdownSearch12 = _state$dropdownSearch12.value) === null || _state$dropdownSearch12 === void 0 ? void 0 : _state$dropdownSearch12.trim()) && {
2094
+ searchedValue: state.dropdownSearch.value,
2095
+ selectedOption: state.dropdownSearch.selectedOption
2096
+ }), (state === null || state === void 0 || (_state$inputSearch12 = state.inputSearch) === null || _state$inputSearch12 === void 0 || (_state$inputSearch12 = _state$inputSearch12.value) === null || _state$inputSearch12 === void 0 ? void 0 : _state$inputSearch12.trim()) && {
2097
+ searchedValue: state.inputSearch.value
2098
+ }), {}, {
2099
+ selectedTab: state === null || state === void 0 || (_state$tabs19 = state.tabs) === null || _state$tabs19 === void 0 ? void 0 : _state$tabs19.active,
2100
+ current,
2101
+ pageSize,
2102
+ columnFilterStatus: tables === null || tables === void 0 || (_tables$filter12 = tables.filter) === null || _tables$filter12 === void 0 ? void 0 : _tables$filter12.value,
2103
+ field: tables === null || tables === void 0 || (_tables$sorting29 = tables.sorting) === null || _tables$sorting29 === void 0 ? void 0 : _tables$sorting29.sortBy,
2104
+ order: tables === null || tables === void 0 || (_tables$sorting30 = tables.sorting) === null || _tables$sorting30 === void 0 ? void 0 : _tables$sorting30.sortDirection
2105
+ }, (header === null || header === void 0 || (_header$subHeading33 = header.subHeading) === null || _header$subHeading33 === void 0 || (_header$subHeading33 = _header$subHeading33.jsxConfig) === null || _header$subHeading33 === void 0 ? void 0 : _header$subHeading33.type) == "select" ? {
2106
+ subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading34 = header.subHeading) === null || _header$subHeading34 === void 0 || (_header$subHeading34 = _header$subHeading34.jsxConfig) === null || _header$subHeading34 === void 0 ? void 0 : _header$subHeading34.value
2107
+ } : {}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data13 = staticFilter.data) === null || _staticFilter$data13 === void 0 || (_staticFilter$data13 = _staticFilter$data13.find(item => item.selected)) === null || _staticFilter$data13 === void 0 ? void 0 : _staticFilter$data13.value) && {
2108
+ staticFilter: staticFilter.data.find(item => item.selected).value
2109
+ }), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied11 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied11 !== void 0 ? _customDrawer$applied11 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (_state$misc29 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc29 !== void 0 ? _state$misc29 : {}), {}, {
2110
+ multiSelectValue: (_state$staticFilter$m13 = state === null || state === void 0 || (_state$staticFilter13 = state.staticFilter) === null || _state$staticFilter13 === void 0 ? void 0 : _state$staticFilter13.multiSelectValue) !== null && _state$staticFilter$m13 !== void 0 ? _state$staticFilter$m13 : []
2111
+ }));
2112
+ if (error) {
2113
+ showErrorNotification(error);
2114
+ dispatch({
2115
+ type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
2116
+ });
2117
+ } else {
2118
+ if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
2119
+ setStaticFilterData(data);
2120
+ }
2121
+ dispatch({
2122
+ type: _layoutReducer.actionTypes.SET_TABLE_DATA,
2123
+ payload: data
2124
+ });
2125
+ }
2126
+ }
2127
+ };
2128
+ function isFiltersEmpty() {
2129
+ let filters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2130
+ const filtersKeyLength = Object.keys(filters).length;
2131
+ if (filtersKeyLength === 0) return true;
2132
+ if (filtersKeyLength === 2) {
2133
+ return (filters === null || filters === void 0 ? void 0 : filters.drawerKey) && (filters === null || filters === void 0 ? void 0 : filters.type);
2134
+ }
2135
+ return false;
2136
+ }
2137
+ console.log(state, "GenricLayOutstate");
2138
+ return /*#__PURE__*/_react.default.createElement(_styles.OapageWithDataStyle, {
2139
+ marginBottom: infoPanel !== null && infoPanel !== void 0 && infoPanel.bottomMarginRequired ? "18px" : "0",
2140
+ className: (state === null || state === void 0 || (_state$misc30 = state.misc) === null || _state$misc30 === void 0 ? void 0 : _state$misc30.flow) === "hubAutomation" ? "hubAutomationContainer" : ""
2141
+ }, /*#__PURE__*/_react.default.createElement(_styles.DrawerWithOutFooter, null), /*#__PURE__*/_react.default.createElement("div", {
2142
+ className: "fullPageLayout"
2143
+ }, /*#__PURE__*/_react.default.createElement(_GlobalCss.default, null, (sidebar === null || sidebar === void 0 ? void 0 : sidebar.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2144
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2145
+ active: true,
2146
+ style: {
2147
+ width: 300
2148
+ }
2149
+ }, /*#__PURE__*/_react.default.createElement(_SidebarWidget.default, _extends({}, sidebar, {
2150
+ handleFooterClick: handleFooterClick,
2151
+ profileData: profileData
2152
+ }))), /*#__PURE__*/_react.default.createElement("div", {
2153
+ className: "oaRightLayouts"
2154
+ }, /*#__PURE__*/_react.default.createElement("div", {
2155
+ className: "oaTopHeaderAndBtnSec "
2156
+ }, /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2157
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2158
+ active: true
2159
+ }, /*#__PURE__*/_react.default.createElement("div", {
2160
+ className: "headerContent"
2161
+ }, /*#__PURE__*/_react.default.createElement("div", {
2162
+ className: "headerLeft"
2163
+ }, (header === null || header === void 0 ? void 0 : header.visible) && /*#__PURE__*/_react.default.createElement(_Header.default, _extends({}, header, {
2164
+ onSubHeadingClick: onSubHeadingClick,
2165
+ handleSubHeadingSelect: handleSubHeadingSelect
2166
+ }))), /*#__PURE__*/_react.default.createElement("div", {
2167
+ className: "headerRight"
2168
+ }, /*#__PURE__*/_react.default.createElement("div", {
2169
+ className: (sidebar === null || sidebar === void 0 || (_sidebar$mobileMenuIt = sidebar.mobileMenuItems) === null || _sidebar$mobileMenuIt === void 0 || (_sidebar$mobileMenuIt = _sidebar$mobileMenuIt.items) === null || _sidebar$mobileMenuIt === void 0 ? void 0 : _sidebar$mobileMenuIt.length) > 0 ? "hideProfileOnMobile" : ""
2170
+ }, /*#__PURE__*/_react.default.createElement(_ProfileSection.default, {
2171
+ profileData: profileData,
2172
+ onProfileClick: () => {
2173
+ handleProfileReroute();
2174
+ }
2175
+ })))))), /*#__PURE__*/_react.default.createElement("div", {
2176
+ className: "layoutHeadingAndSearch"
2177
+ }, (imageViewer === null || imageViewer === void 0 ? void 0 : imageViewer.visible) && /*#__PURE__*/_react.default.createElement(_CustomViewer.default, {
2178
+ open: true,
2179
+ previewFile: imageViewer === null || imageViewer === void 0 || (_imageViewer$content = imageViewer.content) === null || _imageViewer$content === void 0 ? void 0 : _imageViewer$content.url,
2180
+ title: imageViewer === null || imageViewer === void 0 || (_imageViewer$content2 = imageViewer.content) === null || _imageViewer$content2 === void 0 ? void 0 : _imageViewer$content2.name,
2181
+ onCancel: () => dispatch({
2182
+ type: _layoutReducer.actionTypes.TOGGLE_IMAGE_VIEW
2183
+ }),
2184
+ downloadCallback: () => {
2185
+ var _imageViewer$content3;
2186
+ return downloadFileOnS3({
2187
+ url: imageViewer === null || imageViewer === void 0 || (_imageViewer$content3 = imageViewer.content) === null || _imageViewer$content3 === void 0 ? void 0 : _imageViewer$content3.url
2188
+ });
2189
+ }
2190
+ }), (cards === null || cards === void 0 ? void 0 : cards.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2191
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2192
+ active: true,
2193
+ paragraph: {
2194
+ rows: 1
2195
+ }
2196
+ }, /*#__PURE__*/_react.default.createElement(_CardList.default, {
2197
+ cards: cards === null || cards === void 0 ? void 0 : cards.data
2198
+ })), (dropdownSearch === null || dropdownSearch === void 0 ? void 0 : dropdownSearch.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2199
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2200
+ active: true,
2201
+ paragraph: {
2202
+ rows: 1
2203
+ }
2204
+ }, /*#__PURE__*/_react.default.createElement("div", {
2205
+ className: "oaheaderSearchAndFilter"
2206
+ }, /*#__PURE__*/_react.default.createElement(_DropdownSearch.default, _extends({}, dropdownSearch, {
2207
+ selectedOption: dropdownSearch === null || dropdownSearch === void 0 ? void 0 : dropdownSearch.selectedOption,
2208
+ onInputChange: onDropdownSearchInputChange,
2209
+ onPressEnter: onDropdownSearchPressEnter,
2210
+ onOptionChange: onDropdownSearchOptionChange,
2211
+ allowClear: dropdownSearch === null || dropdownSearch === void 0 ? void 0 : dropdownSearch.allowClear,
2212
+ onClear: onDropdownSearchClear,
2213
+ onBlur: onDropdownSearchBlur
2214
+ })), /*#__PURE__*/_react.default.createElement("div", {
2215
+ className: "oaheaderButtons"
2216
+ }, (leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 ? void 0 : leftHeaderFirstButton.visible) && /*#__PURE__*/_react.default.createElement(_CustomButton.default, _extends({
2217
+ label: leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 ? void 0 : leftHeaderFirstButton.label,
2218
+ onClick: leftHeaderFirstButtonClick,
2219
+ type: leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 ? void 0 : leftHeaderFirstButton.type,
2220
+ size: leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 ? void 0 : leftHeaderFirstButton.size
2221
+ }, (leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 ? void 0 : leftHeaderFirstButton.iconConfig) && {
2222
+ iconConfig: {
2223
+ icon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
2224
+ icon: leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 || (_leftHeaderFirstButto = leftHeaderFirstButton.iconConfig) === null || _leftHeaderFirstButto === void 0 ? void 0 : _leftHeaderFirstButto.icon,
2225
+ size: 24,
2226
+ color: "primary"
2227
+ }),
2228
+ position: leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 || (_leftHeaderFirstButto2 = leftHeaderFirstButton.iconConfig) === null || _leftHeaderFirstButto2 === void 0 ? void 0 : _leftHeaderFirstButto2.position
2229
+ }
2230
+ })), /*#__PURE__*/_react.default.createElement("div", {
2231
+ className: "oaheaderButtonsRight"
2232
+ }, (rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.visible) && /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
2233
+ label: rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.label,
2234
+ onClick: rightHeaderSecondButtonClick,
2235
+ type: rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.type,
2236
+ size: rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.size
2237
+ }), (rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.visible) && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
2238
+ label: rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.label,
2239
+ onClick: rightHeaderFirstButtonClick,
2240
+ type: rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.type,
2241
+ size: rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.size,
2242
+ iconConfig: _objectSpread({}, (rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.showIcon) === false ? {} : {
2243
+ icon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
2244
+ icon: _FilterListRounded.default,
2245
+ size: 24,
2246
+ color: "primary"
2247
+ }),
2248
+ position: "left"
2249
+ })
2250
+ }), !isFiltersEmpty(customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && /*#__PURE__*/_react.default.createElement("span", {
2251
+ className: "notifyDot"
2252
+ })))))), (inputSearch === null || inputSearch === void 0 ? void 0 : inputSearch.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2253
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2254
+ active: true,
2255
+ paragraph: {
2256
+ rows: 1
2257
+ }
2258
+ }, /*#__PURE__*/_react.default.createElement(_Search.default, _extends({}, inputSearch, {
2259
+ onInputChange: onSearchInputChange,
2260
+ onPressEnter: onSearchPressEnter,
2261
+ allowClear: true,
2262
+ onClear: onInputSearchClear,
2263
+ onBlur: onInputSearchBlur
2264
+ }))), (infoPanel === null || infoPanel === void 0 ? void 0 : infoPanel.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2265
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2266
+ active: true,
2267
+ paragraph: {
2268
+ rows: 1
2269
+ }
2270
+ }, /*#__PURE__*/_react.default.createElement("div", {
2271
+ className: "margin-bottom-12"
2272
+ }, /*#__PURE__*/_react.default.createElement(_CustomInfo.default, {
2273
+ description: infoPanel === null || infoPanel === void 0 || (_infoPanel$data = infoPanel.data) === null || _infoPanel$data === void 0 ? void 0 : _infoPanel$data.description,
2274
+ color: infoPanel === null || infoPanel === void 0 || (_infoPanel$data2 = infoPanel.data) === null || _infoPanel$data2 === void 0 ? void 0 : _infoPanel$data2.color,
2275
+ iconConfig: {
2276
+ icon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
2277
+ color: (infoPanel === null || infoPanel === void 0 || (_infoPanel$data3 = infoPanel.data) === null || _infoPanel$data3 === void 0 || (_infoPanel$data3 = _infoPanel$data3.iconConfig) === null || _infoPanel$data3 === void 0 ? void 0 : _infoPanel$data3.color) || "warning",
2278
+ icon: infoPanel === null || infoPanel === void 0 || (_infoPanel$data4 = infoPanel.data) === null || _infoPanel$data4 === void 0 || (_infoPanel$data4 = _infoPanel$data4.iconConfig) === null || _infoPanel$data4 === void 0 ? void 0 : _infoPanel$data4.icon
2279
+ }),
2280
+ position: (infoPanel === null || infoPanel === void 0 || (_infoPanel$data5 = infoPanel.data) === null || _infoPanel$data5 === void 0 || (_infoPanel$data5 = _infoPanel$data5.iconConfig) === null || _infoPanel$data5 === void 0 ? void 0 : _infoPanel$data5.position) || "left"
2281
+ }
2282
+ }))), Object.keys((state === null || state === void 0 || (_state$customDrawer3 = state.customDrawer) === null || _state$customDrawer3 === void 0 ? void 0 : _state$customDrawer3.appliedFilters) || {}).length > 0 && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2283
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2284
+ active: true,
2285
+ paragraph: {
2286
+ rows: 1
2287
+ }
2288
+ }, /*#__PURE__*/_react.default.createElement(_AppliedFilters.default, {
2289
+ appliedFilters: state === null || state === void 0 || (_state$customDrawer4 = state.customDrawer) === null || _state$customDrawer4 === void 0 ? void 0 : _state$customDrawer4.appliedFilters,
2290
+ filterConfig: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.data,
2291
+ onRemoveFilter: onRemoveAppliedFilter,
2292
+ onClearAll: onClearAllAppliedFilters,
2293
+ filterDrawerData: state === null || state === void 0 ? void 0 : state.customDrawer
2294
+ })), (tabs === null || tabs === void 0 ? void 0 : tabs.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2295
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2296
+ active: true,
2297
+ paragraph: {
2298
+ rows: 1
2299
+ }
2300
+ }, /*#__PURE__*/_react.default.createElement("div", {
2301
+ className: "oaTabs"
2302
+ }, /*#__PURE__*/_react.default.createElement(_CustomTabs.default, {
2303
+ data: {
2304
+ tabs: tabs === null || tabs === void 0 || (_tabs$list = tabs.list) === null || _tabs$list === void 0 ? void 0 : _tabs$list.map(tab => _objectSpread(_objectSpread({}, tab), {}, {
2305
+ label: "".concat(tab === null || tab === void 0 ? void 0 : tab.label, " (").concat((tab === null || tab === void 0 ? void 0 : tab.value) || 0, ")")
2306
+ }))
2307
+ },
2308
+ activeKey: tabs === null || tabs === void 0 ? void 0 : tabs.active,
2309
+ onTabClick: onTabClick
2310
+ }))), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2311
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2312
+ active: true,
2313
+ paragraph: {
2314
+ rows: 1
2315
+ }
2316
+ }, /*#__PURE__*/_react.default.createElement(_StaticFilter.default, {
2317
+ staticFilter: staticFilter,
2318
+ onFilterSelect: onStaticFilterSelect
2319
+ })), (tables === null || tables === void 0 ? void 0 : tables.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2320
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2321
+ active: true,
2322
+ paragraph: {
2323
+ rows: 5
2324
+ }
2325
+ }, /*#__PURE__*/_react.default.createElement(_styles.TableDataStyle, null, /*#__PURE__*/_react.default.createElement("div", {
2326
+ className: "tableContainerList"
2327
+ }, /*#__PURE__*/_react.default.createElement(_CustomTableV.default, {
2328
+ columns: (_tables$columns3 = tables === null || tables === void 0 || (_tables$columns4 = tables.columns) === null || _tables$columns4 === void 0 ? void 0 : _tables$columns4[(_tabs$active3 = tabs === null || tabs === void 0 ? void 0 : tabs.active) !== null && _tabs$active3 !== void 0 ? _tabs$active3 : "default"]) !== null && _tables$columns3 !== void 0 ? _tables$columns3 : [],
2329
+ dataSource: Array.isArray(tables === null || tables === void 0 ? void 0 : tables.data) ? tables === null || tables === void 0 ? void 0 : tables.data : [],
2330
+ onChange: onTableChange,
2331
+ customTableChange: customTableChange,
2332
+ pagination: tables === null || tables === void 0 ? void 0 : tables.pagination,
2333
+ selectedRows: (state === null || state === void 0 || (_state$tables5 = state.tables) === null || _state$tables5 === void 0 ? void 0 : _state$tables5.selectedRowKeys) || [],
2334
+ rowSelection: (tables === null || tables === void 0 || (_tables$selectionType = tables.selectionType) === null || _tables$selectionType === void 0 ? void 0 : _tables$selectionType[(_tabs$active4 = tabs === null || tabs === void 0 ? void 0 : tabs.active) !== null && _tabs$active4 !== void 0 ? _tabs$active4 : "default"]) && Object.assign({
2335
+ type: tables === null || tables === void 0 || (_tables$selectionType2 = tables.selectionType) === null || _tables$selectionType2 === void 0 ? void 0 : _tables$selectionType2[tabs === null || tabs === void 0 ? void 0 : tabs.active]
2336
+ }, rowSelection),
2337
+ locale: {
2338
+ emptyText: emptyTableState
2339
+ },
2340
+ emptyStateCard: emptyTableState,
2341
+ onMobilePageChange: tables !== null && tables !== void 0 && (_tables$pagination17 = tables.pagination) !== null && _tables$pagination17 !== void 0 && _tables$pagination17.mwebPagination ? onMobilePageChange : undefined
2342
+ })))), (drawer === null || drawer === void 0 ? void 0 : drawer.visible) && /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
2343
+ className: "oaDrawer",
2344
+ title: drawer === null || drawer === void 0 || (_drawer$data = drawer.data) === null || _drawer$data === void 0 || (_drawer$data = _drawer$data[(_tabs$active5 = tabs === null || tabs === void 0 ? void 0 : tabs.active) !== null && _tabs$active5 !== void 0 ? _tabs$active5 : "default"]) === null || _drawer$data === void 0 || (_drawer$data = _drawer$data[drawer === null || drawer === void 0 ? void 0 : drawer.active]) === null || _drawer$data === void 0 ? void 0 : _drawer$data.title,
2345
+ onClose: () => dispatch({
2346
+ type: _layoutReducer.actionTypes.CLOSE_DRAWER
2347
+ }),
2348
+ footer: null,
2349
+ destroyOnClose: true,
2350
+ zIndex: 1000
2351
+ }, /*#__PURE__*/_react.default.createElement(_DetailDataLayout.default, _extends({}, (_drawer$data$drawer$a = drawer === null || drawer === void 0 || (_drawer$data2 = drawer.data) === null || _drawer$data2 === void 0 || (_drawer$data2 = _drawer$data2[(_tabs$active6 = tabs === null || tabs === void 0 ? void 0 : tabs.active) !== null && _tabs$active6 !== void 0 ? _tabs$active6 : "default"]) === null || _drawer$data2 === void 0 ? void 0 : _drawer$data2[drawer === null || drawer === void 0 ? void 0 : drawer.active]) !== null && _drawer$data$drawer$a !== void 0 ? _drawer$data$drawer$a : {}, {
2352
+ activeTab: (_tabs$active7 = tabs === null || tabs === void 0 ? void 0 : tabs.active) !== null && _tabs$active7 !== void 0 ? _tabs$active7 : "default",
2353
+ handleDrawerFormOnFinish: drawerFormOnFinish,
2354
+ generateS3Url: generateS3Url,
2355
+ downloadFileOnS3: downloadFileOnS3,
2356
+ uploadOnS3: uploadOnS3,
2357
+ onSelectHandlers: updateStateData,
2358
+ handleCollapsibleKeyData: handleCollapsibleKeyData
2359
+ }))), (nestedDrawer === null || nestedDrawer === void 0 ? void 0 : nestedDrawer.visible) && /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
2360
+ className: "oaDrawer",
2361
+ title: nestedDrawer === null || nestedDrawer === void 0 || (_nestedDrawer$data = nestedDrawer.data) === null || _nestedDrawer$data === void 0 || (_nestedDrawer$data = _nestedDrawer$data.cancelOrder) === null || _nestedDrawer$data === void 0 ? void 0 : _nestedDrawer$data.title,
2362
+ onClose: () => dispatch({
2363
+ type: _layoutReducer.actionTypes.NESTED_DRAWER_CLOSED
2364
+ }),
2365
+ footer: null,
2366
+ destroyOnClose: true,
2367
+ zIndex: 1000
2368
+ }, /*#__PURE__*/_react.default.createElement(_DetailDataLayout.default, _extends({}, (_nestedDrawer$data$ca = nestedDrawer === null || nestedDrawer === void 0 || (_nestedDrawer$data2 = nestedDrawer.data) === null || _nestedDrawer$data2 === void 0 ? void 0 : _nestedDrawer$data2.cancelOrder) !== null && _nestedDrawer$data$ca !== void 0 ? _nestedDrawer$data$ca : {}, {
2369
+ handleDrawerFormOnFinish: drawerFormOnFinish
2370
+ }))), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.visible) && /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
2371
+ className: "oaDrawer",
2372
+ title: customDrawer === null || customDrawer === void 0 || (_customDrawer$data = customDrawer.data) === null || _customDrawer$data === void 0 ? void 0 : _customDrawer$data.title,
2373
+ onClose: () => dispatch({
2374
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_CLOSED
2375
+ }),
2376
+ footer: null,
2377
+ destroyOnClose: true,
2378
+ zIndex: 1000
2379
+ }, /*#__PURE__*/_react.default.createElement(_DetailDataLayout.default, _extends({}, (_customDrawer$data2 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.data) !== null && _customDrawer$data2 !== void 0 ? _customDrawer$data2 : {}, {
2380
+ handleDrawerFormOnFinish: filterFormOnFinish
2381
+ }))), (contentPanel === null || contentPanel === void 0 ? void 0 : contentPanel.visible) && Array.isArray(contentPanel === null || contentPanel === void 0 ? void 0 : contentPanel.dataSource) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2382
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2383
+ active: true,
2384
+ paragraph: {
2385
+ rows: 2
2386
+ }
2387
+ }, contentPanel === null || contentPanel === void 0 || (_contentPanel$dataSou = contentPanel.dataSource) === null || _contentPanel$dataSou === void 0 ? void 0 : _contentPanel$dataSou.map((item, i) => /*#__PURE__*/_react.default.createElement(_ContentPanel.default, _extends({
2388
+ key: i
2389
+ }, item)))), (tables === null || tables === void 0 || (_tables$tableFooter = tables.tableFooter) === null || _tables$tableFooter === void 0 ? void 0 : _tables$tableFooter.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2390
+ loading: state === null || state === void 0 ? void 0 : state.isLoading,
2391
+ active: true,
2392
+ paragraph: {
2393
+ rows: 1
2394
+ }
2395
+ }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2396
+ className: "bottomSelectedSecion"
2397
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
2398
+ color: "secondary-content",
2399
+ typography: "type-button-500"
2400
+ }, /*#__PURE__*/_react.default.createElement("span", null, "".concat(tables === null || tables === void 0 || (_tables$selectedRowKe = tables.selectedRowKeys) === null || _tables$selectedRowKe === void 0 ? void 0 : _tables$selectedRowKe.length, " ").concat(tables === null || tables === void 0 || (_tables$tableFooter2 = tables.tableFooter) === null || _tables$tableFooter2 === void 0 ? void 0 : _tables$tableFooter2.text))), /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
2401
+ type: tables === null || tables === void 0 || (_tables$tableFooter3 = tables.tableFooter) === null || _tables$tableFooter3 === void 0 || (_tables$tableFooter3 = _tables$tableFooter3.jsxConfig) === null || _tables$tableFooter3 === void 0 ? void 0 : _tables$tableFooter3.buttonType,
2402
+ onClick: () => {
2403
+ var _tables$tableFooter4;
2404
+ return customTableSelectFooterClick(tables === null || tables === void 0 || (_tables$tableFooter4 = tables.tableFooter) === null || _tables$tableFooter4 === void 0 ? void 0 : _tables$tableFooter4.jsxConfig);
2405
+ },
2406
+ label: tables === null || tables === void 0 || (_tables$tableFooter5 = tables.tableFooter) === null || _tables$tableFooter5 === void 0 || (_tables$tableFooter5 = _tables$tableFooter5.jsxConfig) === null || _tables$tableFooter5 === void 0 ? void 0 : _tables$tableFooter5.label
2407
+ })))), (modal === null || modal === void 0 ? void 0 : modal.visible) && /*#__PURE__*/_react.default.createElement(_Modal.default, {
2408
+ modal: modal,
2409
+ onCancel: () => dispatch({
2410
+ type: _layoutReducer.actionTypes.TOGGLE_MODAL,
2411
+ payload: false
2412
+ }),
2413
+ onFooterAction: onClickModalFooter,
2414
+ handleSwitchSelectItem: handleSwitchSelectItem
2415
+ }))), /*#__PURE__*/_react.default.createElement(_CustomNotification.default, {
2416
+ ref: notificationRef
2417
+ }))));
2418
+ }
2419
+ GenricLayOut.propTypes = {};
2420
+ GenricLayOut.defaultProps = {};
2421
+ var _default = exports.default = GenricLayOut;