oa-componentbook 1.0.1-stage.46 → 1.0.1-stage.460

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