oa-componentbook 1.0.1-stage.36 → 1.0.1-stage.361

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