oa-componentbook 1.0.1-stage.43 → 1.0.1-stage.431

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