@bigbinary/neeto-payments-frontend 3.0.23 → 3.0.25
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.
- package/app/javascript/src/translations/en.json +16 -2
- package/dist/SplitTransfersDashboard.js +221 -29
- package/dist/SplitTransfersDashboard.js.map +1 -1
- package/dist/cjs/SplitTransfersDashboard.js +238 -27
- package/dist/cjs/SplitTransfersDashboard.js.map +1 -1
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"paymentAmount": "Payment amount",
|
|
41
41
|
"transferredAmount": "Transferred amount",
|
|
42
42
|
"search": "Search",
|
|
43
|
+
"takeAction": "Take action",
|
|
43
44
|
"createdAt": "Created at",
|
|
44
45
|
"country": "Country",
|
|
45
46
|
"email": "Email",
|
|
@@ -69,7 +70,8 @@
|
|
|
69
70
|
"discountCode": "Discount code",
|
|
70
71
|
"netAmount": "Net amount",
|
|
71
72
|
"payoutStatus": "Payout status",
|
|
72
|
-
"searchByIdentifier": "Search by identifier"
|
|
73
|
+
"searchByIdentifier": "Search by identifier",
|
|
74
|
+
"submit": "Submit"
|
|
73
75
|
},
|
|
74
76
|
"alert": {
|
|
75
77
|
"stripe": {
|
|
@@ -411,7 +413,19 @@
|
|
|
411
413
|
"netAmountHelpTitle": "What is the net amount?",
|
|
412
414
|
"platformShareHelpTitle": "What is the platform share?",
|
|
413
415
|
"netAmountDescription": "The net amount is the final payment you receive after deducting the payment provider's fees.",
|
|
414
|
-
"platformShareDescription": "The platform share is the amount that will be deposited into your bank account after subtracting all service provider shares. (net amount - transferred amount)"
|
|
416
|
+
"platformShareDescription": "The platform share is the amount that will be deposited into your bank account after subtracting all service provider shares. (net amount - transferred amount)",
|
|
417
|
+
"selectAll": "Select all {{count}} pending split transfers",
|
|
418
|
+
"selectedSplitTransfers": "All {{selectedCount}} pending split transfers on this page are selected",
|
|
419
|
+
"recordWithCount_one": "{{count}} split transfer selected of <span>{{recordsCount}}</span>",
|
|
420
|
+
"recordWithCount_other": "{{count}} split transfers selected of <span>{{recordsCount}}</span>"
|
|
421
|
+
},
|
|
422
|
+
"cancelSplitTransfers": {
|
|
423
|
+
"cancellationReasonRequired": "Cancellation reason is required",
|
|
424
|
+
"modal": {
|
|
425
|
+
"title": "Cancel split transfers?",
|
|
426
|
+
"message": "You are about to cancel pending split transfers. This can't be undone.",
|
|
427
|
+
"cancelReason": "Reason for cancellation"
|
|
428
|
+
}
|
|
415
429
|
}
|
|
416
430
|
}
|
|
417
431
|
}
|
|
@@ -6,35 +6,41 @@ import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE } from '@bigbinary/neeto-commons-
|
|
|
6
6
|
import { currencyFormat, getQueryParams, buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
7
7
|
import { buildFiltersFromURL } from '@bigbinary/neeto-filters-frontend/utils';
|
|
8
8
|
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
9
|
-
import { mergeLeft, curry, mergeDeepWith, concat, reject, isNil, map, prop, sortBy, isEmpty, modify } from 'ramda';
|
|
9
|
+
import { mergeLeft, curry, mergeDeepWith, concat, reject, isNil, map, prop, sortBy, isEmpty, modify, pluck } from 'ramda';
|
|
10
10
|
import { useHistory } from 'react-router-dom';
|
|
11
11
|
import { E as ExportModal } from './ExportModal-C6-IwFlZ.js';
|
|
12
12
|
import { useQuery } from '@tanstack/react-query';
|
|
13
|
+
import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
13
14
|
import axios from 'axios';
|
|
14
15
|
import { B as BASE_URL, k as preProcessStatus, l as getTagStyle, f as formatAmount, d as formatCurrency, m as PAYMENT_KIND, p as processDataIndex, S as SORT_DIRECTIONS, D as DEFAULT_SORT_PROPERTIES, s as shouldTabsVisible, U as UN_HIDEABLE_COLUMNS, h as DEFAULT_PAGE_VALUES, i as DASHBOARD_KIND } from './index-lD18ClWH.js';
|
|
15
16
|
import { Q as QUERY_KEYS } from './queryConstants-BCx5cEmf.js';
|
|
17
|
+
import Modal from '@bigbinary/neetoui/Modal';
|
|
18
|
+
import Typography from '@bigbinary/neetoui/Typography';
|
|
19
|
+
import Form from '@bigbinary/neetoui/formik/Form';
|
|
20
|
+
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
21
|
+
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
22
|
+
import { useTranslation, Trans } from 'react-i18next';
|
|
16
23
|
import { t } from 'i18next';
|
|
17
|
-
import
|
|
24
|
+
import * as yup from 'yup';
|
|
25
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
26
|
+
import { isNotPresent, isPresent, removeBy, camelToSnakeCase, isNotEmpty } from '@bigbinary/neeto-cist';
|
|
18
27
|
import { useHiddenColumns } from '@bigbinary/neeto-molecules/Columns';
|
|
19
28
|
import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
|
|
20
29
|
import Table from '@bigbinary/neetoui/Table';
|
|
21
30
|
import NoData from '@bigbinary/neetoui/NoData';
|
|
22
|
-
import { useTranslation } from 'react-i18next';
|
|
23
31
|
import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
|
|
24
32
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
25
|
-
import Typography from '@bigbinary/neetoui/Typography';
|
|
26
33
|
import Button from '@bigbinary/neetoui/Button';
|
|
27
34
|
import Tag from '@bigbinary/neetoui/Tag';
|
|
28
35
|
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
29
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
30
36
|
import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
|
|
31
37
|
import { C as CopyButtonWrapper } from './CopyButtonWrapper-SoJkwX-d.js';
|
|
32
38
|
import FiltersBar from '@bigbinary/neeto-filters-frontend/Bar';
|
|
33
39
|
import Header from '@bigbinary/neeto-molecules/Header';
|
|
34
40
|
import SubHeader from '@bigbinary/neeto-molecules/SubHeader';
|
|
35
41
|
import Tab from '@bigbinary/neetoui/Tab';
|
|
42
|
+
import Dropdown from '@bigbinary/neetoui/Dropdown';
|
|
36
43
|
import '@bigbinary/neeto-icons/Download';
|
|
37
|
-
import '@bigbinary/neetoui/Modal';
|
|
38
44
|
import './exportChannel-CViICC6x.js';
|
|
39
45
|
import '@bigbinary/neeto-molecules/CopyToClipboardButton';
|
|
40
46
|
|
|
@@ -46,9 +52,15 @@ var list = function list(payload) {
|
|
|
46
52
|
var show = function show(id) {
|
|
47
53
|
return axios.get("".concat(BASE_URL, "/api/v1/split_transfers/").concat(id));
|
|
48
54
|
};
|
|
55
|
+
var bulkCancellation = function bulkCancellation(payload) {
|
|
56
|
+
return axios.post("".concat(BASE_URL, "/api/v1/split_transfers/bulk_cancellation"), {
|
|
57
|
+
splitTransfer: payload
|
|
58
|
+
});
|
|
59
|
+
};
|
|
49
60
|
var splitTransfersApi = {
|
|
50
61
|
list: list,
|
|
51
|
-
show: show
|
|
62
|
+
show: show,
|
|
63
|
+
bulkCancellation: bulkCancellation
|
|
52
64
|
};
|
|
53
65
|
|
|
54
66
|
function ownKeys$2(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; }
|
|
@@ -71,6 +83,11 @@ var useShowSplitTransfers = function useShowSplitTransfers(id, options) {
|
|
|
71
83
|
}
|
|
72
84
|
}, options));
|
|
73
85
|
};
|
|
86
|
+
var useBulkCancellationSplitTransfers = function useBulkCancellationSplitTransfers(options) {
|
|
87
|
+
return useMutationWithInvalidation(splitTransfersApi.bulkCancellation, _objectSpread$2({
|
|
88
|
+
keysToInvalidate: [QUERY_KEYS.SPLIT_TRANSFERS_LISTw]
|
|
89
|
+
}, options));
|
|
90
|
+
};
|
|
74
91
|
|
|
75
92
|
var COLUMNS_STORAGE_KEY = "splitTransfersDashboard";
|
|
76
93
|
var SPLIT_TRANSFERS_DASHBOARD_TAB = {
|
|
@@ -99,6 +116,65 @@ var INITIAL_TRANSFER_DETAILS = {
|
|
|
99
116
|
id: null,
|
|
100
117
|
isPaneOpen: false
|
|
101
118
|
};
|
|
119
|
+
var VALIDATION_SCHEMA = yup.object().shape({
|
|
120
|
+
cancellationReason: yup.string().required(t("neetoPayments.cancelSplitTransfers.cancellationReasonRequired"))
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
var CancelModal = function CancelModal(_ref) {
|
|
124
|
+
var isOpen = _ref.isOpen,
|
|
125
|
+
onClose = _ref.onClose,
|
|
126
|
+
handleSplitTransfersCancellation = _ref.handleSplitTransfersCancellation;
|
|
127
|
+
var _useTranslation = useTranslation(),
|
|
128
|
+
t = _useTranslation.t;
|
|
129
|
+
var handleSubmit = function handleSubmit(_ref2) {
|
|
130
|
+
var cancellationReason = _ref2.cancellationReason;
|
|
131
|
+
handleSplitTransfersCancellation(cancellationReason);
|
|
132
|
+
};
|
|
133
|
+
return /*#__PURE__*/jsxs(Modal, {
|
|
134
|
+
isOpen: isOpen,
|
|
135
|
+
onClose: onClose,
|
|
136
|
+
size: "large",
|
|
137
|
+
children: [/*#__PURE__*/jsx(Modal.Header, {
|
|
138
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
139
|
+
style: "h2",
|
|
140
|
+
weight: "medium",
|
|
141
|
+
children: t("neetoPayments.cancelSplitTransfers.modal.title")
|
|
142
|
+
})
|
|
143
|
+
}), /*#__PURE__*/jsx(Form, {
|
|
144
|
+
formikProps: {
|
|
145
|
+
initialValues: {
|
|
146
|
+
cancellationReason: ""
|
|
147
|
+
},
|
|
148
|
+
validationSchema: VALIDATION_SCHEMA,
|
|
149
|
+
onSubmit: handleSubmit
|
|
150
|
+
},
|
|
151
|
+
children: /*#__PURE__*/jsxs(Fragment, {
|
|
152
|
+
children: [/*#__PURE__*/jsx(Modal.Body, {
|
|
153
|
+
children: /*#__PURE__*/jsx("div", {
|
|
154
|
+
className: "flex flex-col space-y-4",
|
|
155
|
+
children: /*#__PURE__*/jsx(Textarea, {
|
|
156
|
+
required: true,
|
|
157
|
+
name: "cancellationReason",
|
|
158
|
+
label: t("neetoPayments.cancelSplitTransfers.modal.cancelReason")
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
}), /*#__PURE__*/jsx(Modal.Footer, {
|
|
162
|
+
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
163
|
+
position: "right",
|
|
164
|
+
cancelButtonProps: {
|
|
165
|
+
onClick: onClose,
|
|
166
|
+
style: "tertiary"
|
|
167
|
+
},
|
|
168
|
+
submitButtonProps: {
|
|
169
|
+
disabled: false,
|
|
170
|
+
label: t("neetoPayments.common.submit")
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
})]
|
|
174
|
+
})
|
|
175
|
+
})]
|
|
176
|
+
});
|
|
177
|
+
};
|
|
102
178
|
|
|
103
179
|
var Status = function Status(_ref) {
|
|
104
180
|
var type = _ref.type,
|
|
@@ -562,11 +638,14 @@ var buildRowData = function buildRowData(_ref3) {
|
|
|
562
638
|
var List = function List(_ref) {
|
|
563
639
|
var isFetching = _ref.isFetching,
|
|
564
640
|
splitTransfers = _ref.splitTransfers,
|
|
641
|
+
selectedRows = _ref.selectedRows,
|
|
565
642
|
views = _ref.views,
|
|
566
643
|
payableEntityColumns = _ref.payableEntityColumns,
|
|
567
|
-
setSortProperties = _ref.setSortProperties,
|
|
568
644
|
pageProperties = _ref.pageProperties,
|
|
569
|
-
|
|
645
|
+
onRowSelect = _ref.onRowSelect,
|
|
646
|
+
setSortProperties = _ref.setSortProperties,
|
|
647
|
+
handleTablePagination = _ref.handleTablePagination,
|
|
648
|
+
setHasBulkSelectedAllRows = _ref.setHasBulkSelectedAllRows;
|
|
570
649
|
var _useState = useState(INITIAL_TRANSFER_DETAILS),
|
|
571
650
|
_useState2 = _slicedToArray(_useState, 2),
|
|
572
651
|
selectedTransfer = _useState2[0],
|
|
@@ -581,6 +660,19 @@ var List = function List(_ref) {
|
|
|
581
660
|
_useHiddenColumns$hid = _useHiddenColumns.hiddenColumns,
|
|
582
661
|
hiddenColumns = _useHiddenColumns$hid === void 0 ? [] : _useHiddenColumns$hid;
|
|
583
662
|
var splitTransfersCount = views[tab];
|
|
663
|
+
var getRowSelection = function getRowSelection() {
|
|
664
|
+
if (tab === SPLIT_TRANSFERS_DASHBOARD_TAB.pending) return true;
|
|
665
|
+
if (tab === SPLIT_TRANSFERS_DASHBOARD_TAB.all) {
|
|
666
|
+
return {
|
|
667
|
+
getCheckboxProps: function getCheckboxProps(record) {
|
|
668
|
+
return {
|
|
669
|
+
disabled: record.status !== SPLIT_TRANSFERS_DASHBOARD_TAB.pending
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
return false;
|
|
675
|
+
};
|
|
584
676
|
var visibleColumns = buildTableColumns({
|
|
585
677
|
tab: tab,
|
|
586
678
|
hiddenColumns: hiddenColumns,
|
|
@@ -610,6 +702,7 @@ var List = function List(_ref) {
|
|
|
610
702
|
children: [/*#__PURE__*/jsx(TableWrapper, {
|
|
611
703
|
hasPagination: splitTransfersCount > (pageProperties === null || pageProperties === void 0 ? void 0 : pageProperties.pageSize),
|
|
612
704
|
children: /*#__PURE__*/jsx(Table, {
|
|
705
|
+
onRowSelect: onRowSelect,
|
|
613
706
|
fixedHeight: true,
|
|
614
707
|
allowRowClick: false,
|
|
615
708
|
columnData: visibleColumns,
|
|
@@ -621,9 +714,19 @@ var List = function List(_ref) {
|
|
|
621
714
|
pageProperties: pageProperties,
|
|
622
715
|
tab: tab
|
|
623
716
|
}),
|
|
624
|
-
rowSelection:
|
|
717
|
+
rowSelection: getRowSelection(),
|
|
718
|
+
selectedRowKeys: selectedRows,
|
|
625
719
|
sortDirections: SORT_DIRECTIONS,
|
|
626
720
|
totalCount: splitTransfersCount,
|
|
721
|
+
bulkSelectAllRowsProps: {
|
|
722
|
+
selectAllRowMessage: t("neetoPayments.splitTransferDetails.selectedSplitTransfers", {
|
|
723
|
+
count: selectedRows.length
|
|
724
|
+
}),
|
|
725
|
+
selectAllRowButtonLabel: t("neetoPayments.splitTransferDetails.selectAll", {
|
|
726
|
+
count: views[SPLIT_TRANSFERS_DASHBOARD_TAB.pending]
|
|
727
|
+
}),
|
|
728
|
+
setBulkSelectedAllRows: setHasBulkSelectedAllRows
|
|
729
|
+
},
|
|
627
730
|
paginationProps: {
|
|
628
731
|
showSizeChanger: true,
|
|
629
732
|
hideOnSinglePage: true,
|
|
@@ -640,10 +743,15 @@ var List = function List(_ref) {
|
|
|
640
743
|
});
|
|
641
744
|
};
|
|
642
745
|
|
|
746
|
+
var Menu = Dropdown.Menu,
|
|
747
|
+
MenuItem = Dropdown.MenuItem;
|
|
643
748
|
var TopSection = function TopSection(_ref) {
|
|
644
749
|
var views = _ref.views,
|
|
645
750
|
filters = _ref.filters,
|
|
751
|
+
setIsCancelModalOpen = _ref.setIsCancelModalOpen,
|
|
752
|
+
selectedRows = _ref.selectedRows,
|
|
646
753
|
setFilters = _ref.setFilters,
|
|
754
|
+
hasBulkSelectedAllRows = _ref.hasBulkSelectedAllRows,
|
|
647
755
|
filterableColumns = _ref.filterableColumns,
|
|
648
756
|
searchKeywordProps = _ref.searchKeywordProps,
|
|
649
757
|
payableEntityColumns = _ref.payableEntityColumns,
|
|
@@ -661,6 +769,8 @@ var TopSection = function TopSection(_ref) {
|
|
|
661
769
|
var splitTransfersCount = views[tab];
|
|
662
770
|
var splitTransfersCountVisible = splitTransfersCount > 0;
|
|
663
771
|
var isFilterButtonVisible = splitTransfersCount || isPresent(filters);
|
|
772
|
+
var isDropdownVisible = isNotEmpty(selectedRows);
|
|
773
|
+
var selectedRecordsCount = hasBulkSelectedAllRows ? splitTransfersCount : selectedRows.length;
|
|
664
774
|
var handleFiltersChange = function handleFiltersChange(filters) {
|
|
665
775
|
startTransition(function () {
|
|
666
776
|
setFilters(filters);
|
|
@@ -696,14 +806,46 @@ var TopSection = function TopSection(_ref) {
|
|
|
696
806
|
})
|
|
697
807
|
}), /*#__PURE__*/jsx(SubHeader, {
|
|
698
808
|
className: "mt-4",
|
|
699
|
-
leftActionBlock: splitTransfersCountVisible && /*#__PURE__*/jsx(
|
|
700
|
-
className: "
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
809
|
+
leftActionBlock: splitTransfersCountVisible && /*#__PURE__*/jsx("div", {
|
|
810
|
+
className: "w-100 flex items-center space-x-3",
|
|
811
|
+
children: isDropdownVisible ? /*#__PURE__*/jsxs(Fragment, {
|
|
812
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
813
|
+
className: "neeto-ui-gray-800 mr-2 font-semibold",
|
|
814
|
+
component: "h4",
|
|
815
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
816
|
+
count: selectedRecordsCount,
|
|
817
|
+
i18nKey: "neetoPayments.splitTransferDetails.recordWithCount",
|
|
818
|
+
components: {
|
|
819
|
+
span: /*#__PURE__*/jsx("span", {
|
|
820
|
+
className: "neeto-ui-text-gray-600"
|
|
821
|
+
})
|
|
822
|
+
},
|
|
823
|
+
values: {
|
|
824
|
+
count: selectedRecordsCount,
|
|
825
|
+
recordsCount: splitTransfersCount
|
|
826
|
+
}
|
|
827
|
+
})
|
|
828
|
+
}), /*#__PURE__*/jsx(Dropdown, {
|
|
829
|
+
buttonStyle: "secondary",
|
|
830
|
+
label: t("neetoPayments.common.takeAction"),
|
|
831
|
+
children: /*#__PURE__*/jsx(Menu, {
|
|
832
|
+
children: /*#__PURE__*/jsx(MenuItem.Button, {
|
|
833
|
+
onClick: function onClick() {
|
|
834
|
+
return setIsCancelModalOpen(true);
|
|
835
|
+
},
|
|
836
|
+
children: t("neetoPayments.common.cancel")
|
|
837
|
+
})
|
|
838
|
+
})
|
|
839
|
+
})]
|
|
840
|
+
}) : /*#__PURE__*/jsx(Typography, {
|
|
841
|
+
className: "neeto-ui-gray-800 mr-2 font-semibold",
|
|
842
|
+
component: "h4",
|
|
843
|
+
children: tab === SPLIT_TRANSFERS_DASHBOARD_TAB.all ? t("neetoPayments.countOf.splitTransfer", {
|
|
844
|
+
count: splitTransfersCount
|
|
845
|
+
}) : t("neetoPayments.countOf.splitTransferWithStatus", {
|
|
846
|
+
count: splitTransfersCount,
|
|
847
|
+
status: tab
|
|
848
|
+
})
|
|
707
849
|
})
|
|
708
850
|
}),
|
|
709
851
|
rightActionBlock: /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -746,22 +888,38 @@ var SplitTransfersDashboard = function SplitTransfersDashboard(_ref) {
|
|
|
746
888
|
searchTerm = _getQueryParams$searc === void 0 ? "" : _getQueryParams$searc;
|
|
747
889
|
var filterableColumns = buildFilterColumns(payableEntityColumns);
|
|
748
890
|
var searchKeywordProps = buildSearchProps(searchProps, searchTerm);
|
|
749
|
-
var _useState = useState(
|
|
891
|
+
var _useState = useState([]),
|
|
750
892
|
_useState2 = _slicedToArray(_useState, 2),
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
var _useState3 = useState(
|
|
893
|
+
selectedRows = _useState2[0],
|
|
894
|
+
setSelectedRows = _useState2[1];
|
|
895
|
+
var _useState3 = useState([]),
|
|
754
896
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
755
|
-
|
|
756
|
-
|
|
897
|
+
selectedRowData = _useState4[0],
|
|
898
|
+
setSelectedRowData = _useState4[1];
|
|
757
899
|
var _useState5 = useState(false),
|
|
758
900
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
759
901
|
isExportModalOpen = _useState6[0],
|
|
760
902
|
setIsExportModalOpen = _useState6[1];
|
|
761
|
-
var _useState7 = useState(
|
|
903
|
+
var _useState7 = useState(false),
|
|
762
904
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
763
|
-
|
|
764
|
-
|
|
905
|
+
isCancelModalOpen = _useState8[0],
|
|
906
|
+
setIsCancelModalOpen = _useState8[1];
|
|
907
|
+
var _useState9 = useState(false),
|
|
908
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
909
|
+
hasBulkSelectedAllRows = _useState10[0],
|
|
910
|
+
setHasBulkSelectedAllRows = _useState10[1];
|
|
911
|
+
var _useState11 = useState(DEFAULT_SORT_PROPERTIES),
|
|
912
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
913
|
+
sortProperties = _useState12[0],
|
|
914
|
+
setSortProperties = _useState12[1];
|
|
915
|
+
var _useState13 = useState(DEFAULT_PAGE_VALUES),
|
|
916
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
917
|
+
pageProperties = _useState14[0],
|
|
918
|
+
setPageProperties = _useState14[1];
|
|
919
|
+
var _useState15 = useState(buildFiltersFromURL([].concat(_toConsumableArray(filterableColumns), [searchKeywordProps]))),
|
|
920
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
921
|
+
filters = _useState16[0],
|
|
922
|
+
setFilters = _useState16[1];
|
|
765
923
|
var history = useHistory();
|
|
766
924
|
var _getQueryParams2 = getQueryParams(),
|
|
767
925
|
_getQueryParams2$tab = _getQueryParams2.tab,
|
|
@@ -777,6 +935,23 @@ var SplitTransfersDashboard = function SplitTransfersDashboard(_ref) {
|
|
|
777
935
|
views = _useFetchSplitTransfe3.views,
|
|
778
936
|
isFetching = _useFetchSplitTransfe.isFetching,
|
|
779
937
|
isSplitTransfersLoading = _useFetchSplitTransfe.isPending;
|
|
938
|
+
var _useBulkCancellationS = useBulkCancellationSplitTransfers({
|
|
939
|
+
onSuccess: function onSuccess() {
|
|
940
|
+
setSelectedRowData([]);
|
|
941
|
+
setSelectedRows([]);
|
|
942
|
+
}
|
|
943
|
+
}),
|
|
944
|
+
cancelSplitTransfers = _useBulkCancellationS.mutate,
|
|
945
|
+
isCancelling = _useBulkCancellationS.isPending;
|
|
946
|
+
var handleSplitTransfersCancellation = function handleSplitTransfersCancellation(cancellationReason) {
|
|
947
|
+
var ids = pluck("id", selectedRowData);
|
|
948
|
+
cancelSplitTransfers({
|
|
949
|
+
ids: ids,
|
|
950
|
+
cancellationReason: cancellationReason,
|
|
951
|
+
isApplyChangesToAllRequired: hasBulkSelectedAllRows
|
|
952
|
+
});
|
|
953
|
+
setIsCancelModalOpen(false);
|
|
954
|
+
};
|
|
780
955
|
var handleTablePagination = function handleTablePagination(page, pageSize) {
|
|
781
956
|
var queryParams = getQueryParams({
|
|
782
957
|
toCamelCase: false
|
|
@@ -790,11 +965,15 @@ var SplitTransfersDashboard = function SplitTransfersDashboard(_ref) {
|
|
|
790
965
|
pageSize: pageSize
|
|
791
966
|
});
|
|
792
967
|
};
|
|
968
|
+
var handleRowSelect = function handleRowSelect(keys, rowData) {
|
|
969
|
+
setSelectedRows(keys);
|
|
970
|
+
setSelectedRowData(rowData);
|
|
971
|
+
};
|
|
793
972
|
useEffect(function () {
|
|
794
973
|
handleTablePagination(DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE);
|
|
795
974
|
setSortProperties(DEFAULT_SORT_PROPERTIES);
|
|
796
975
|
}, [filters, tab]);
|
|
797
|
-
if (isSplitTransfersLoading) {
|
|
976
|
+
if (isSplitTransfersLoading || isCancelling) {
|
|
798
977
|
return /*#__PURE__*/jsx("div", {
|
|
799
978
|
className: "flex h-full w-full items-center justify-center",
|
|
800
979
|
children: /*#__PURE__*/jsx(Spinner, {})
|
|
@@ -804,10 +983,13 @@ var SplitTransfersDashboard = function SplitTransfersDashboard(_ref) {
|
|
|
804
983
|
children: [/*#__PURE__*/jsx(TopSection, {
|
|
805
984
|
filterableColumns: filterableColumns,
|
|
806
985
|
filters: filters,
|
|
986
|
+
hasBulkSelectedAllRows: hasBulkSelectedAllRows,
|
|
807
987
|
pageProperties: pageProperties,
|
|
808
988
|
payableEntityColumns: payableEntityColumns,
|
|
809
989
|
searchKeywordProps: searchKeywordProps,
|
|
990
|
+
selectedRows: selectedRows,
|
|
810
991
|
setFilters: setFilters,
|
|
992
|
+
setIsCancelModalOpen: setIsCancelModalOpen,
|
|
811
993
|
setIsExportModalOpen: setIsExportModalOpen,
|
|
812
994
|
setPageProperties: setPageProperties,
|
|
813
995
|
setSortProperties: setSortProperties,
|
|
@@ -817,15 +999,25 @@ var SplitTransfersDashboard = function SplitTransfersDashboard(_ref) {
|
|
|
817
999
|
isFetching: isFetching,
|
|
818
1000
|
pageProperties: pageProperties,
|
|
819
1001
|
payableEntityColumns: payableEntityColumns,
|
|
1002
|
+
selectedRows: selectedRows,
|
|
1003
|
+
setHasBulkSelectedAllRows: setHasBulkSelectedAllRows,
|
|
1004
|
+
setSelectedRows: setSelectedRows,
|
|
820
1005
|
setSortProperties: setSortProperties,
|
|
821
1006
|
splitTransfers: splitTransfers,
|
|
822
|
-
views: views
|
|
1007
|
+
views: views,
|
|
1008
|
+
onRowSelect: handleRowSelect
|
|
823
1009
|
}), /*#__PURE__*/jsx(ExportModal, {
|
|
824
1010
|
filters: filters,
|
|
825
1011
|
isExportModalOpen: isExportModalOpen,
|
|
826
1012
|
setIsExportModalOpen: setIsExportModalOpen,
|
|
827
1013
|
sortProperties: sortProperties,
|
|
828
1014
|
dashboardKind: DASHBOARD_KIND.splitTransfers
|
|
1015
|
+
}), /*#__PURE__*/jsx(CancelModal, {
|
|
1016
|
+
handleSplitTransfersCancellation: handleSplitTransfersCancellation,
|
|
1017
|
+
isOpen: isCancelModalOpen,
|
|
1018
|
+
onClose: function onClose() {
|
|
1019
|
+
return setIsCancelModalOpen(false);
|
|
1020
|
+
}
|
|
829
1021
|
})]
|
|
830
1022
|
});
|
|
831
1023
|
};
|