oa-componentbook 1.0.1-stage.4 → 1.0.1-stage.400

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