oa-componentbook 1.0.1-stage.38 → 1.0.1-stage.381

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