oa-componentbook 1.0.1-stage.42 → 1.0.1-stage.421

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