@bjsdistribution/dms-client-return 0.1.19-dev → 0.1.20-dev
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/dist/components/client-portal/OutstandingTable.d.ts +3 -0
- package/dist/components/client-portal/ReturnStatus.d.ts +5 -0
- package/dist/components/client-portal/return-confirm/ConfirmedMain.d.ts +3 -0
- package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.d.ts +3 -0
- package/dist/components/store.d.ts +5 -1
- package/dist/dms-client-return.cjs.development.js +1105 -296
- package/dist/dms-client-return.cjs.development.js.map +1 -1
- package/dist/dms-client-return.cjs.production.min.js +1 -1
- package/dist/dms-client-return.cjs.production.min.js.map +1 -1
- package/dist/dms-client-return.esm.js +1106 -297
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/client-portal/OutstandingTable.tsx +412 -0
- package/src/components/client-portal/ReturnAfterSearchBar.tsx +116 -11
- package/src/components/client-portal/ReturnOverview.tsx +4 -4
- package/src/components/client-portal/ReturnRTFilters.tsx +59 -40
- package/src/components/client-portal/ReturnSearchBar.tsx +90 -9
- package/src/components/client-portal/ReturnStatus.tsx +36 -3
- package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +235 -0
- package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +404 -0
- package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +18 -38
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +18 -24
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +35 -146
- package/src/components/store.ts +23 -0
|
@@ -430,6 +430,10 @@ var selectedCPOrderlList = /*#__PURE__*/jotai.atom([]);
|
|
|
430
430
|
function useSelectedClientPortOrders() {
|
|
431
431
|
return jotai.useAtom(selectedCPOrderlList);
|
|
432
432
|
}
|
|
433
|
+
var selectedCPOrderAfterlList = /*#__PURE__*/jotai.atom([]);
|
|
434
|
+
function useSelectedClientAfterOrders() {
|
|
435
|
+
return jotai.useAtom(selectedCPOrderAfterlList);
|
|
436
|
+
}
|
|
433
437
|
//start date and end date
|
|
434
438
|
var startCPDate = /*#__PURE__*/jotai.atom( /*#__PURE__*/dayjs());
|
|
435
439
|
function useStartDate() {
|
|
@@ -454,6 +458,18 @@ var searchAfter = /*#__PURE__*/jotai.atom('');
|
|
|
454
458
|
var useSearchAfterText = function useSearchAfterText() {
|
|
455
459
|
return jotai.useAtom(searchAfter);
|
|
456
460
|
};
|
|
461
|
+
var rclientReturnDataAtom = /*#__PURE__*/jotai.atom([]);
|
|
462
|
+
function useClientOutstandingReturnData() {
|
|
463
|
+
return jotai.useAtom(rclientReturnDataAtom);
|
|
464
|
+
}
|
|
465
|
+
var returnConfirmedOrderAtom = /*#__PURE__*/jotai.atom([]);
|
|
466
|
+
function useReturnConfirmedOrderData() {
|
|
467
|
+
return jotai.useAtom(returnConfirmedOrderAtom);
|
|
468
|
+
}
|
|
469
|
+
var statsCPCount = /*#__PURE__*/jotai.atom(null);
|
|
470
|
+
function useStatsCPCount() {
|
|
471
|
+
return jotai.useAtom(statsCPCount);
|
|
472
|
+
}
|
|
457
473
|
function useCustomerData() {
|
|
458
474
|
return jotai.useAtom(customerData);
|
|
459
475
|
}
|
|
@@ -1559,18 +1575,22 @@ var ReturnStatus = function ReturnStatus() {
|
|
|
1559
1575
|
dispatch = _useAtom[1];
|
|
1560
1576
|
var _useParams = reactRouterDom.useParams(),
|
|
1561
1577
|
status = _useParams.status;
|
|
1562
|
-
var
|
|
1563
|
-
count =
|
|
1564
|
-
setCount =
|
|
1578
|
+
var _useStatsCPCount = useStatsCPCount(),
|
|
1579
|
+
count = _useStatsCPCount[0],
|
|
1580
|
+
setCount = _useStatsCPCount[1];
|
|
1565
1581
|
var _useStartDate = useStartDate(),
|
|
1566
1582
|
startDate = _useStartDate[0];
|
|
1567
1583
|
var _useEndDate = useEndDate(),
|
|
1568
1584
|
endDate = _useEndDate[0];
|
|
1569
1585
|
var _useClientPortal = useClientPortal(),
|
|
1570
1586
|
clientPortal = _useClientPortal[0];
|
|
1571
|
-
var
|
|
1572
|
-
modifiedFilters =
|
|
1573
|
-
setModifiedFilters =
|
|
1587
|
+
var _useState = React.useState([]),
|
|
1588
|
+
modifiedFilters = _useState[0],
|
|
1589
|
+
setModifiedFilters = _useState[1];
|
|
1590
|
+
var _useSearchText = useSearchText(),
|
|
1591
|
+
debouncedSearchText = _useSearchText[0];
|
|
1592
|
+
var _useSearchAfterText = useSearchAfterText(),
|
|
1593
|
+
debouncedSearchAfterText = _useSearchAfterText[0];
|
|
1574
1594
|
var getDateFilters = function getDateFilters(startDate, endDate) {
|
|
1575
1595
|
var stored = JSON.parse(localStorage.getItem('returnDate') || '{}');
|
|
1576
1596
|
var sDate = startDate != null && startDate.isValid != null && startDate.isValid() ? startDate : dayjs(stored == null ? void 0 : stored.startDate);
|
|
@@ -1614,6 +1634,24 @@ var ReturnStatus = function ReturnStatus() {
|
|
|
1614
1634
|
statsData = _useAxios.data,
|
|
1615
1635
|
apiLoading = _useAxios.loading,
|
|
1616
1636
|
fetchData = _useAxios.fetchData;
|
|
1637
|
+
var prevSearchTextRef = React.useRef('');
|
|
1638
|
+
var prevSearchAfterTextRef = React.useRef('');
|
|
1639
|
+
React.useEffect(function () {
|
|
1640
|
+
var prev = prevSearchTextRef.current;
|
|
1641
|
+
if (clientPortal && prev && debouncedSearchText === '') {
|
|
1642
|
+
fetchData();
|
|
1643
|
+
}
|
|
1644
|
+
prevSearchTextRef.current = debouncedSearchText;
|
|
1645
|
+
}, [debouncedSearchText, startDate, endDate]);
|
|
1646
|
+
React.useEffect(function () {
|
|
1647
|
+
var prev = prevSearchAfterTextRef.current;
|
|
1648
|
+
if (clientPortal && prev && debouncedSearchAfterText === '') {
|
|
1649
|
+
fetchData();
|
|
1650
|
+
}
|
|
1651
|
+
prevSearchAfterTextRef.current = debouncedSearchAfterText;
|
|
1652
|
+
}, [debouncedSearchAfterText, startDate, endDate]);
|
|
1653
|
+
console.log(debouncedSearchText, 'debouncedSearchText');
|
|
1654
|
+
console.log(debouncedSearchAfterText, 'debouncedSearchAfterText');
|
|
1617
1655
|
React.useEffect(function () {
|
|
1618
1656
|
fetchData();
|
|
1619
1657
|
}, [startDate, endDate]);
|
|
@@ -1643,12 +1681,15 @@ var ReturnStatus = function ReturnStatus() {
|
|
|
1643
1681
|
label: 'Return Completed'
|
|
1644
1682
|
}];
|
|
1645
1683
|
var navigate = reactRouterDom.useNavigate();
|
|
1684
|
+
var _useSearchAfterText2 = useSearchAfterText(),
|
|
1685
|
+
setDebouncedSearchText = _useSearchAfterText2[1];
|
|
1646
1686
|
var handleCardClick = function handleCardClick(item) {
|
|
1647
1687
|
if (activeCardId === (item == null ? void 0 : item.id)) {
|
|
1648
1688
|
return;
|
|
1649
1689
|
}
|
|
1650
1690
|
setActiveCardId(item == null ? void 0 : item.id);
|
|
1651
1691
|
navigate("/return/" + (item == null ? void 0 : item.status));
|
|
1692
|
+
setDebouncedSearchText('');
|
|
1652
1693
|
if ((item == null ? void 0 : item.status) == 'scheduled_for_return') {
|
|
1653
1694
|
dispatch({
|
|
1654
1695
|
type: 'SET_SCHEDULED_RETURN_FILTER',
|
|
@@ -1779,8 +1820,13 @@ var ReturnRTFilters = function ReturnRTFilters() {
|
|
|
1779
1820
|
state = _useAtom2[0];
|
|
1780
1821
|
var _useReturnAfterOrderD = useReturnAfterOrderData(),
|
|
1781
1822
|
returnAfterOrder = _useReturnAfterOrderD[0];
|
|
1823
|
+
// const [selectedReturnOrder] = useSelectedClientPortOrders();
|
|
1824
|
+
var _useSelectedClientAft = useSelectedClientAfterOrders(),
|
|
1825
|
+
selectedOrderIds = _useSelectedClientAft[0],
|
|
1826
|
+
setSelectedOrderIds = _useSelectedClientAft[1];
|
|
1782
1827
|
var _useSelectedClientPor = useSelectedClientPortOrders(),
|
|
1783
|
-
|
|
1828
|
+
selectedPendingOrderIds = _useSelectedClientPor[0],
|
|
1829
|
+
setSelectedPendingOrderIds = _useSelectedClientPor[1];
|
|
1784
1830
|
var _useParams = reactRouterDom.useParams(),
|
|
1785
1831
|
status = _useParams.status;
|
|
1786
1832
|
var pendingFilters = pendingState['x-filters'];
|
|
@@ -1807,20 +1853,16 @@ var ReturnRTFilters = function ReturnRTFilters() {
|
|
|
1807
1853
|
feature_name: 'return'
|
|
1808
1854
|
};
|
|
1809
1855
|
}
|
|
1810
|
-
// console.log(selectedReturnOrder, 'selectedReturnOrder');
|
|
1811
1856
|
//Export Manifest
|
|
1812
|
-
var
|
|
1813
|
-
return item.id;
|
|
1814
|
-
});
|
|
1815
|
-
var isExportEnabled = (onlyIds == null ? void 0 : onlyIds.length) > 0;
|
|
1857
|
+
var isExportEnabled = status === 'outstanding_return' ? (selectedPendingOrderIds == null ? void 0 : selectedPendingOrderIds.length) > 0 : status === 'scheduled_for_return' || status === 'return_completed' ? (selectedOrderIds == null ? void 0 : selectedOrderIds.length) > 0 : false;
|
|
1816
1858
|
var _useAxios = dmsComponentLibrary.useAxios({
|
|
1817
1859
|
endpoint: "/v1/orders/import/manifest/csv/",
|
|
1818
1860
|
method: 'POST'
|
|
1819
1861
|
}),
|
|
1820
1862
|
callExportApi = _useAxios.fetchData;
|
|
1821
|
-
var
|
|
1863
|
+
var handleExportManifest = /*#__PURE__*/function () {
|
|
1822
1864
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1823
|
-
var _response$data, response,
|
|
1865
|
+
var exportOrderIds, _response$data, response, _response$data2;
|
|
1824
1866
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1825
1867
|
while (1) switch (_context.prev = _context.next) {
|
|
1826
1868
|
case 0:
|
|
@@ -1830,80 +1872,55 @@ var ReturnRTFilters = function ReturnRTFilters() {
|
|
|
1830
1872
|
}
|
|
1831
1873
|
return _context.abrupt("return");
|
|
1832
1874
|
case 2:
|
|
1833
|
-
|
|
1834
|
-
_context.
|
|
1875
|
+
exportOrderIds = status === 'outstanding_return' ? selectedPendingOrderIds : status === 'scheduled_for_return' || status === 'return_completed' ? selectedOrderIds : [];
|
|
1876
|
+
_context.prev = 3;
|
|
1877
|
+
_context.next = 6;
|
|
1835
1878
|
return callExportApi({
|
|
1836
1879
|
payload: {
|
|
1837
|
-
order_ids:
|
|
1880
|
+
order_ids: exportOrderIds
|
|
1838
1881
|
}
|
|
1839
1882
|
});
|
|
1840
|
-
case
|
|
1883
|
+
case 6:
|
|
1841
1884
|
response = _context.sent;
|
|
1842
|
-
if (
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
break;
|
|
1885
|
+
if (response != null && (_response$data = response.data) != null && _response$data.url) {
|
|
1886
|
+
antd.notification.success({
|
|
1887
|
+
message: 'Success',
|
|
1888
|
+
description: (response == null ? void 0 : response.message) || 'Export completed.'
|
|
1889
|
+
});
|
|
1890
|
+
window.open(response == null || (_response$data2 = response.data) == null ? void 0 : _response$data2.url, '_blank');
|
|
1891
|
+
if (status === 'outstanding_return') {
|
|
1892
|
+
setSelectedPendingOrderIds([]);
|
|
1893
|
+
} else if (status === 'scheduled_for_return' || status === 'return_completed') {
|
|
1894
|
+
setSelectedOrderIds([]);
|
|
1895
|
+
}
|
|
1896
|
+
} else {
|
|
1897
|
+
antd.notification.error({
|
|
1898
|
+
message: 'No File URL',
|
|
1899
|
+
description: 'Export succeeded but no download URL was returned.'
|
|
1900
|
+
});
|
|
1859
1901
|
}
|
|
1860
|
-
|
|
1861
|
-
case 14:
|
|
1862
|
-
_context.next = 16;
|
|
1863
|
-
return downloadResponse.blob();
|
|
1864
|
-
case 16:
|
|
1865
|
-
blob = _context.sent;
|
|
1866
|
-
urlObject = window.URL.createObjectURL(blob);
|
|
1867
|
-
link = document.createElement('a');
|
|
1868
|
-
link.href = urlObject;
|
|
1869
|
-
// You can customize the filename or extract it from headers
|
|
1870
|
-
contentDisposition = downloadResponse.headers.get('Content-Disposition');
|
|
1871
|
-
filenameMatch = contentDisposition == null ? void 0 : contentDisposition.match(/filename="?(.+)"?/);
|
|
1872
|
-
filename = (filenameMatch == null ? void 0 : filenameMatch[1]) || 'download.csv';
|
|
1873
|
-
link.download = filename;
|
|
1874
|
-
document.body.appendChild(link);
|
|
1875
|
-
link.click();
|
|
1876
|
-
document.body.removeChild(link);
|
|
1877
|
-
window.URL.revokeObjectURL(urlObject);
|
|
1878
|
-
antd.notification.success({
|
|
1879
|
-
message: 'Downloaded',
|
|
1880
|
-
description: 'File downloaded successfully.'
|
|
1881
|
-
});
|
|
1882
|
-
_context.next = 32;
|
|
1902
|
+
_context.next = 15;
|
|
1883
1903
|
break;
|
|
1884
|
-
case
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
description: 'Export succeeded but no download URL was returned.'
|
|
1888
|
-
});
|
|
1889
|
-
case 32:
|
|
1890
|
-
_context.next = 38;
|
|
1891
|
-
break;
|
|
1892
|
-
case 34:
|
|
1893
|
-
_context.prev = 34;
|
|
1894
|
-
_context.t0 = _context["catch"](2);
|
|
1904
|
+
case 10:
|
|
1905
|
+
_context.prev = 10;
|
|
1906
|
+
_context.t0 = _context["catch"](3);
|
|
1895
1907
|
console.error('Error during export or download:', _context.t0);
|
|
1896
1908
|
antd.notification.error({
|
|
1897
1909
|
message: 'Export Failed',
|
|
1898
1910
|
description: 'Something went wrong during export.'
|
|
1899
1911
|
});
|
|
1900
|
-
|
|
1912
|
+
if (status === 'outstanding_return') {
|
|
1913
|
+
setSelectedPendingOrderIds([]);
|
|
1914
|
+
} else if (status === 'scheduled_for_return' || status === 'return_completed') {
|
|
1915
|
+
setSelectedOrderIds([]);
|
|
1916
|
+
}
|
|
1917
|
+
case 15:
|
|
1901
1918
|
case "end":
|
|
1902
1919
|
return _context.stop();
|
|
1903
1920
|
}
|
|
1904
|
-
}, _callee, null, [[
|
|
1921
|
+
}, _callee, null, [[3, 10]]);
|
|
1905
1922
|
}));
|
|
1906
|
-
return function
|
|
1923
|
+
return function handleExportManifest() {
|
|
1907
1924
|
return _ref.apply(this, arguments);
|
|
1908
1925
|
};
|
|
1909
1926
|
}();
|
|
@@ -1912,12 +1929,16 @@ var ReturnRTFilters = function ReturnRTFilters() {
|
|
|
1912
1929
|
}, React__default.createElement(dmsComponentLibrary.ExportButton, {
|
|
1913
1930
|
moduleInfoModule: moduleInfo
|
|
1914
1931
|
}), React__default.createElement(StyledBulkItem, {
|
|
1915
|
-
onClick:
|
|
1932
|
+
onClick: handleExportManifest,
|
|
1933
|
+
style: {
|
|
1934
|
+
pointerEvents: isExportEnabled ? 'auto' : 'none',
|
|
1935
|
+
opacity: isExportEnabled ? 1 : 0.5
|
|
1936
|
+
}
|
|
1916
1937
|
}, React__default.createElement(Text$1, null, "Export Manifest")));
|
|
1917
1938
|
};
|
|
1918
1939
|
var Text$1 = /*#__PURE__*/styled__default.div(_templateObject$4 || (_templateObject$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #6a7378;\n text-align: center;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 18px;\n"])));
|
|
1919
1940
|
var StyledBulkFilterCover = /*#__PURE__*/styled__default.div(_templateObject2$2 || (_templateObject2$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-radius: 100px;\n border: 1px solid rgba(208, 213, 221, 0.5);\n background: #fff;\n display: flex;\n min-height: 40px;\n // gap: 8px;\n"])));
|
|
1920
|
-
var StyledBulkItem = /*#__PURE__*/styled__default.div(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 6px 12px;\n display: flex;\n align-items: center;\n border-right: 1px solid #d0d5dd;\n gap: 8px;\n position: relative;\n a {\n text-decoration: none;\n }\n &.disabled {\n /* opacity: 0.5; */\n width: 150px;\n cursor: default;\n a {\n cursor: default;\n\n label {\n cursor: default;\n }\n }\n }\n @media screen and (max-width: 1030px) {\n padding: 6px 4px;\n }\n\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n box-sizing: border-box;\n top: 54px;\n }\n &:last-child {\n border-right: none;\n }\n &.active svg.arrowDown {\n transform: rotate(180deg);\n }\n label {\n color: #3a3630;\n text-align: center;\n font-family: 'Open Sans';\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 18px;\n cursor: pointer;\n }\n\n &.noPadding {\n padding: 0;\n }\n"])));
|
|
1941
|
+
var StyledBulkItem = /*#__PURE__*/styled__default.div(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 6px 12px;\n display: flex;\n align-items: center;\n border-right: 1px solid #d0d5dd;\n gap: 8px;\n position: relative;\n a {\n text-decoration: none;\n }\n &.disabled {\n /* opacity: 0.5; */\n width: 150px;\n cursor: default;\n a {\n cursor: default;\n\n label {\n cursor: default;\n }\n }\n }\n &:hover:not(:disabled) {\n background: #f0f0f0;\n cursor: pointer;\n }\n\n @media screen and (max-width: 1030px) {\n padding: 6px 4px;\n }\n\n ul {\n margin: 0;\n padding: 0;\n list-style: none;\n box-sizing: border-box;\n top: 54px;\n }\n &:last-child {\n border-right: none;\n }\n &.active svg.arrowDown {\n transform: rotate(180deg);\n }\n label {\n color: #3a3630;\n text-align: center;\n font-family: 'Open Sans';\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 18px;\n cursor: pointer;\n }\n\n &.noPadding {\n padding: 0;\n }\n"])));
|
|
1921
1942
|
|
|
1922
1943
|
var ReturnFilter = function ReturnFilter() {
|
|
1923
1944
|
var _useCustomerData = useCustomerData(),
|
|
@@ -2235,7 +2256,8 @@ var ClearAll = /*#__PURE__*/styled__default.div(_templateObject35 || (_templateO
|
|
|
2235
2256
|
var StyledFilterBtnIcon = /*#__PURE__*/styled__default.div(_templateObject36 || (_templateObject36 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 24px;\n height: 24px;\n justify-content: center;\n align-items: center;\n border-radius: 20px;\n border: 1px solid #e2e0db;\n background: #b2b3b3;\n .cross {\n position: relative;\n &:after {\n display: inline-block;\n content: 'X';\n font-style: normal;\n font-size: 14px;\n color: #000;\n }\n }\n"])));
|
|
2236
2257
|
var StyledFilterBtnLabel = /*#__PURE__*/styled__default.div(_templateObject37 || (_templateObject37 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #6a7378;\n font-size: 13px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n white-space: nowrap;\n"])));
|
|
2237
2258
|
|
|
2238
|
-
var _templateObject19, _templateObject20, _templateObject21;
|
|
2259
|
+
var _templateObject18, _templateObject19, _templateObject20, _templateObject21;
|
|
2260
|
+
var EmptyDataContainer$1 = /*#__PURE__*/styled__default.div(_templateObject18 || (_templateObject18 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n"])));
|
|
2239
2261
|
var StyledTable$1 = /*#__PURE__*/styled__default.table(_templateObject19 || (_templateObject19 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-spacing: 0 10px;\n width: 100%;\n /* min-width: 1600px; */\n thead {\n white-space: nowrap;\n position: sticky;\n top: 10px;\n z-index: 1;\n background: #fff;\n box-shadow: 0px 0px 1px #ffffff, 0px -10px 1px #ffffff;\n tr {\n border-radius: 40px;\n border-spacing: 0 10px;\n position: relative;\n font-family: 'lato', sans-serif;\n .emailInvoiceCheckbox {\n padding-right: 0px;\n width: 0;\n > div {\n width: fit-content;\n }\n }\n .custom-check {\n position: absloute;\n }\n .emailInvoiceNo {\n padding-left: 0px;\n }\n .emailInvoiceShare {\n width: 100px;\n }\n th {\n color: #3a3630;\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n padding: 11px 15px;\n background: #f0f2f2;\n border-right: none;\n border-left: none;\n text-align: left;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-width: 1px 0;\n &:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n &:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n .sortIconClass {\n cursor: pointer;\n display: flex;\n }\n }\n }\n }\n tbody {\n max-height: 400px;\n overflow-y: auto;\n tr {\n td {\n color: #3a3630;\n font-size: 13px;\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n padding: 12px 15px;\n background: #fff;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-right: none;\n border-left: none;\n position: relative;\n .actionbox {\n display: flex;\n gap: 5px;\n }\n .shareIconContainer {\n display: flex;\n padding: 2px 12px;\n align-items: center;\n gap: 8px;\n border-radius: 20px;\n border: 1px solid var(--tonal-brown-101, #e2e0db);\n background: #fff;\n list-style-type: none;\n /* padding-left: 0; */\n /* fontWeight: 600,\n paddingLeft: 0, */\n cursor: pointer;\n position: relative;\n }\n .statusCancelled {\n color: #e95252;\n /* background: rgba(233, 82, 82, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusOnHold {\n color: #f4a503;\n /* background: #fff1d6; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusSubContracted {\n color: #845adf;\n /* background: rgba(132, 90, 223, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusAwaiting {\n color: #845adf;\n /* background: rgba(132, 90, 223, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusCompleted {\n color: #1f9254;\n /* background: rgba(41, 204, 106, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusOutstanding {\n color: #f4a503;\n /* background: #fff1d6; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusUnknown {\n color: #000;\n /* background: #fff; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n .statustext {\n color: #1f9254;\n font-family: 'Open Sans';\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n }\n .downloadcontainer {\n display: flex;\n padding: 2px 12px;\n align-items: center;\n\n width: 28px;\n height: 28px;\n flex-direction: column;\n\n border-radius: 14px;\n border: 1px solid #e2e0db;\n background: #fff;\n }\n .statuscontainer {\n display: flex;\n padding: 5px 30px 5px 30px;\n justify-content: center;\n align-items: center;\n gap: 5px;\n flex: 1 0 0;\n border-radius: 22px;\n background: rgba(41, 204, 106, 0.15);\n }\n .awaiting {\n display: flex;\n min-width: 85px;\n padding: 6px 10px;\n justify-content: center;\n align-items: center;\n gap: 5px;\n border-radius: 22px;\n background: rgba(233, 82, 82, 0.15);\n color: #e95252;\n font-family: 'Open Sans';\n font-size: 12px;\n font-weight: 600;\n }\n ul > li > a {\n text-decoration: none !important;\n color: #0099ff;\n }\n }\n &:nth-child(even) td {\n background: #f6fbff;\n }\n td:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n td:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n .flex {\n display: flex;\n flex-direction: row;\n gap: 5px;\n height: 29px;\n align-items: center;\n }\n\n &.insideTable {\n td {\n border-radius: 0;\n border: none;\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n table {\n border-spacing: 0;\n width: 100%;\n border-radius: 5px;\n border: 1px solid rgba(0, 0, 0, 0.08);\n overflow: hidden;\n border-top-left-radius: 15px;\n border-top-right-radius: 15px;\n thead {\n tr {\n border-bottom: none;\n th {\n padding: 14px 20px;\n text-align: left;\n border-top: 0;\n border-right: 0;\n border-left: 0;\n background: #f8fafc;\n\n &:first-child {\n border-radius: 0;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n border-top-left-radius: 15px;\n }\n &:last-child {\n border-radius: 0;\n }\n }\n }\n }\n tbody {\n tr {\n td {\n padding: 14px 20px;\n text-align: left;\n border-bottom: 1px solid rgba(58, 54, 48, 0.15);\n background: #fff;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n }\n }\n }\n }\n }\n }\n .actions {\n display: flex;\n align-items: center;\n gap: 20px;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n\n .close-icon {\n transform: scale(1.3);\n background-color: transparent;\n border-radius: 0;\n padding: 0;\n }\n }\n"])));
|
|
2240
2262
|
// Styled components
|
|
2241
2263
|
var StyledTableWrapper$1 = /*#__PURE__*/styled__default.div(_templateObject20 || (_templateObject20 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-height: 60vh;\n overflow-x: auto;\n // min-height: 50vh;\n\n .fortables {\n max-height: 60vh;\n overflow-x: auto;\n min-height: 50vh;\n }\n /* height: 600px; */\n /* box-shadow: 0px 0px 30px 6px rgba(46, 45, 116, 0.05); */\n &::-webkit-scrollbar {\n width: 5px;\n border-radius: 100px;\n height: 5px;\n }\n\n &::-webkit-scrollbar-track {\n background: #777;\n border-radius: 100px;\n }\n\n &::-webkit-scrollbar-thumb {\n background: #7b61ff;\n border-radius: 100px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: #7b61ff;\n }\n"])));
|
|
@@ -2278,23 +2300,10 @@ var ReturnOrderTable = function ReturnOrderTable() {
|
|
|
2278
2300
|
setPaginationObject = _UsePaginationData[1];
|
|
2279
2301
|
var _usefetchAgain = usefetchAgain(),
|
|
2280
2302
|
callForFetch = _usefetchAgain[0];
|
|
2281
|
-
var _useClientPortal = useClientPortal(),
|
|
2282
|
-
clientPortal = _useClientPortal[0];
|
|
2283
|
-
var _useParams = reactRouterDom.useParams(),
|
|
2284
|
-
status = _useParams.status;
|
|
2285
|
-
var _useSelectedClientPor = useSelectedClientPortOrders(),
|
|
2286
|
-
selectedOrderIds = _useSelectedClientPor[0],
|
|
2287
|
-
setSelectedOrderIds = _useSelectedClientPor[1];
|
|
2288
|
-
var _useState = React.useState(false),
|
|
2289
|
-
selectClientAll = _useState[0],
|
|
2290
|
-
setSelectClientAll = _useState[1];
|
|
2291
|
-
var _useState2 = React.useState([]),
|
|
2292
|
-
modifiedFilters = _useState2[0],
|
|
2293
|
-
setModifiedFilters = _useState2[1];
|
|
2294
2303
|
//sorting
|
|
2295
|
-
var
|
|
2296
|
-
sortConfig =
|
|
2297
|
-
setSortConfig =
|
|
2304
|
+
var _useState = React.useState(null),
|
|
2305
|
+
sortConfig = _useState[0],
|
|
2306
|
+
setSortConfig = _useState[1];
|
|
2298
2307
|
var handleSort = function handleSort(key) {
|
|
2299
2308
|
setSortConfig(function (prev) {
|
|
2300
2309
|
if ((prev == null ? void 0 : prev.key) === key && prev.direction === 'asc') {
|
|
@@ -2348,56 +2357,17 @@ var ReturnOrderTable = function ReturnOrderTable() {
|
|
|
2348
2357
|
setPrintToggle(null);
|
|
2349
2358
|
}
|
|
2350
2359
|
};
|
|
2351
|
-
|
|
2352
|
-
var _useStartDate = useStartDate(),
|
|
2353
|
-
startDate = _useStartDate[0];
|
|
2354
|
-
var _useEndDate = useEndDate(),
|
|
2355
|
-
endDate = _useEndDate[0];
|
|
2356
|
-
React.useEffect(function () {
|
|
2357
|
-
if (!clientPortal) return;
|
|
2358
|
-
var stored = JSON.parse(localStorage.getItem('returnDate') || '{}');
|
|
2359
|
-
var sDate = startDate != null && startDate.isValid != null && startDate.isValid() ? startDate : dayjs(stored == null ? void 0 : stored.startDate);
|
|
2360
|
-
var eDate = endDate != null && endDate.isValid != null && endDate.isValid() ? endDate : stored != null && stored.endDate ? dayjs(stored == null ? void 0 : stored.endDate) : null;
|
|
2361
|
-
if (!(sDate != null && sDate.isValid != null && sDate.isValid())) return;
|
|
2362
|
-
var dateFilters = [];
|
|
2363
|
-
if (eDate && eDate.isValid()) {
|
|
2364
|
-
dateFilters = [{
|
|
2365
|
-
field: 'created_at',
|
|
2366
|
-
op: '>=',
|
|
2367
|
-
value: sDate.format('YYYY-MM-DD')
|
|
2368
|
-
}, {
|
|
2369
|
-
field: 'created_at',
|
|
2370
|
-
op: '<=',
|
|
2371
|
-
value: eDate.add(1, 'day').format('YYYY-MM-DD')
|
|
2372
|
-
}];
|
|
2373
|
-
} else {
|
|
2374
|
-
dateFilters = [{
|
|
2375
|
-
field: 'created_at',
|
|
2376
|
-
op: '=',
|
|
2377
|
-
value: sDate.format('YYYY-MM-DD')
|
|
2378
|
-
}];
|
|
2379
|
-
}
|
|
2380
|
-
var updatedFilters = status === 'outstanding_return' ? [{
|
|
2381
|
-
field: 'isdeleted',
|
|
2382
|
-
op: '=',
|
|
2383
|
-
value: 0
|
|
2384
|
-
}, {
|
|
2385
|
-
field: 'product_return_action_id',
|
|
2386
|
-
op: '=',
|
|
2387
|
-
value: 'RTS'
|
|
2388
|
-
}].concat(dateFilters) : dateFilters;
|
|
2389
|
-
setModifiedFilters(updatedFilters);
|
|
2390
|
-
}, [startDate, endDate, status]);
|
|
2391
|
-
var _useAxios = dmsComponentLibrary.useAxios({
|
|
2360
|
+
var _useApiHook = dmsComponentLibrary.useApiHook({
|
|
2392
2361
|
endpoint: '/v1/return/product/pending/',
|
|
2393
2362
|
method: 'GET',
|
|
2394
|
-
filters:
|
|
2395
|
-
pagination: pagination
|
|
2363
|
+
filters: filters,
|
|
2364
|
+
pagination: pagination,
|
|
2365
|
+
performAction: false
|
|
2396
2366
|
}),
|
|
2397
|
-
fetchedOrderData =
|
|
2398
|
-
returnDataLoad =
|
|
2399
|
-
paginationData =
|
|
2400
|
-
|
|
2367
|
+
fetchedOrderData = _useApiHook.data,
|
|
2368
|
+
returnDataLoad = _useApiHook.loading,
|
|
2369
|
+
paginationData = _useApiHook.paginationData,
|
|
2370
|
+
setShouldPerformAction = _useApiHook.setShouldPerformAction;
|
|
2401
2371
|
React.useEffect(function () {
|
|
2402
2372
|
setLoading(returnDataLoad);
|
|
2403
2373
|
if (fetchedOrderData && fetchedOrderData != null && fetchedOrderData.data) {
|
|
@@ -2423,20 +2393,9 @@ var ReturnOrderTable = function ReturnOrderTable() {
|
|
|
2423
2393
|
}
|
|
2424
2394
|
}
|
|
2425
2395
|
}, [fetchedOrderData, returnDataLoad]);
|
|
2426
|
-
React.useEffect(function () {
|
|
2427
|
-
if (!clientPortal) {
|
|
2428
|
-
fetchData();
|
|
2429
|
-
}
|
|
2430
|
-
}, []);
|
|
2431
|
-
var _useSearchText = useSearchText(),
|
|
2432
|
-
debouncedSearchText = _useSearchText[0];
|
|
2433
|
-
React.useEffect(function () {
|
|
2434
|
-
if (clientPortal && debouncedSearchText == '') {
|
|
2435
|
-
fetchData();
|
|
2436
|
-
}
|
|
2437
|
-
}, [debouncedSearchText]);
|
|
2438
2396
|
React.useEffect(function () {
|
|
2439
2397
|
setLoading(returnDataLoad);
|
|
2398
|
+
setShouldPerformAction(true);
|
|
2440
2399
|
if (fetchedOrderData && fetchedOrderData != null && fetchedOrderData.data && locationData) {
|
|
2441
2400
|
var updatedReturnData = fetchedOrderData.data.map(function (returnItem) {
|
|
2442
2401
|
var matchingLocation = locationData.find(function (location) {
|
|
@@ -2457,7 +2416,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
|
|
|
2457
2416
|
var filteredData = returnData == null ? void 0 : returnData.filter(function (loc) {
|
|
2458
2417
|
return (loc == null ? void 0 : loc.product_return_action) === 'RTS';
|
|
2459
2418
|
});
|
|
2460
|
-
var selectedOrders = filteredData
|
|
2419
|
+
var selectedOrders = filteredData.map(function (loc) {
|
|
2461
2420
|
return {
|
|
2462
2421
|
id: loc.id,
|
|
2463
2422
|
return_locations: loc == null ? void 0 : loc.return_location_name,
|
|
@@ -2555,25 +2514,6 @@ var ReturnOrderTable = function ReturnOrderTable() {
|
|
|
2555
2514
|
var mergedPayload = Object.values(groupedPayload);
|
|
2556
2515
|
setGrouped(mergedPayload);
|
|
2557
2516
|
}, [newpayload]);
|
|
2558
|
-
//Client Portal
|
|
2559
|
-
var handleSelectOrderId = function handleSelectOrderId(id) {
|
|
2560
|
-
setSelectedOrderIds(function (prev) {
|
|
2561
|
-
return prev.includes(id) ? prev.filter(function (orderId) {
|
|
2562
|
-
return orderId !== id;
|
|
2563
|
-
}) : [].concat(prev, [id]);
|
|
2564
|
-
});
|
|
2565
|
-
};
|
|
2566
|
-
var handleClientSelectAll = function handleClientSelectAll(e) {
|
|
2567
|
-
var isChecked = e.target.checked;
|
|
2568
|
-
setSelectClientAll(isChecked);
|
|
2569
|
-
if (isChecked) {
|
|
2570
|
-
setSelectedOrderIds((returnData == null ? void 0 : returnData.map(function (item) {
|
|
2571
|
-
return item == null ? void 0 : item.order_id;
|
|
2572
|
-
})) || []);
|
|
2573
|
-
} else {
|
|
2574
|
-
setSelectedOrderIds([]);
|
|
2575
|
-
}
|
|
2576
|
-
};
|
|
2577
2517
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement(StyledTableWrapper$1, {
|
|
2578
2518
|
className: "fortables"
|
|
2579
2519
|
}, React__default.createElement(StyledTable$1, null, React__default.createElement("thead", null, React__default.createElement("tr", null, returnData != null && returnData.some(function (item) {
|
|
@@ -2583,12 +2523,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
|
|
|
2583
2523
|
}, React__default.createElement(dmsComponentLibrary.Checkbox, {
|
|
2584
2524
|
checked: selectAll,
|
|
2585
2525
|
onChange: handleSelectAll
|
|
2586
|
-
})) :
|
|
2587
|
-
className: "emailInvoiceCheckbox"
|
|
2588
|
-
}, React__default.createElement(dmsComponentLibrary.Checkbox, {
|
|
2589
|
-
checked: selectClientAll,
|
|
2590
|
-
onChange: handleClientSelectAll
|
|
2591
|
-
})) : React__default.createElement("th", null), !clientPortal && React__default.createElement("th", {
|
|
2526
|
+
})) : React__default.createElement("th", null), React__default.createElement("th", {
|
|
2592
2527
|
onClick: function onClick() {
|
|
2593
2528
|
return handleSort('location');
|
|
2594
2529
|
}
|
|
@@ -2635,20 +2570,15 @@ var ReturnOrderTable = function ReturnOrderTable() {
|
|
|
2635
2570
|
}, React__default.createElement(EmptyDataContainer, null, React__default.createElement(antd.Empty, null)))) : sortedData == null ? void 0 : sortedData.map(function (item, index) {
|
|
2636
2571
|
return React__default.createElement("tr", {
|
|
2637
2572
|
key: item.id
|
|
2638
|
-
}, React__default.createElement("td", null,
|
|
2639
|
-
checked: selectedOrderIds.includes(item == null ? void 0 : item.order_id),
|
|
2640
|
-
onChange: function onChange() {
|
|
2641
|
-
return handleSelectOrderId(item == null ? void 0 : item.order_id);
|
|
2642
|
-
}
|
|
2643
|
-
}) : React__default.createElement(React__default.Fragment, null, (item == null ? void 0 : item.product_return_action) === 'RTS' ? React__default.createElement(dmsComponentLibrary.Checkbox, {
|
|
2573
|
+
}, React__default.createElement("td", null, (item == null ? void 0 : item.product_return_action) === 'RTS' ? React__default.createElement(dmsComponentLibrary.Checkbox, {
|
|
2644
2574
|
className: "custom-check",
|
|
2645
|
-
checked: selectedReturnOrder
|
|
2575
|
+
checked: selectedReturnOrder.some(function (selectedInvoice) {
|
|
2646
2576
|
return (selectedInvoice == null ? void 0 : selectedInvoice.id) === (item == null ? void 0 : item.id);
|
|
2647
2577
|
}),
|
|
2648
2578
|
onChange: function onChange() {
|
|
2649
2579
|
return handleSelectOrderReturn(item == null ? void 0 : item.id, item == null ? void 0 : item.return_location, item == null ? void 0 : item.return_location_name, item == null ? void 0 : item.product_return_action, item == null ? void 0 : item.legacy_product_id);
|
|
2650
2580
|
}
|
|
2651
|
-
}) : null)
|
|
2581
|
+
}) : null), React__default.createElement("td", null, (item == null ? void 0 : item.location) !== null && (item == null ? void 0 : item.location) !== undefined ? item == null ? void 0 : item.location : React__default.createElement("div", {
|
|
2652
2582
|
className: "awaiting"
|
|
2653
2583
|
}, "Awaiting")), React__default.createElement("td", null, " ", displayValueOrNA(item == null ? void 0 : item.return_location_name)), React__default.createElement("td", null, React__default.createElement("ul", {
|
|
2654
2584
|
style: {
|
|
@@ -3392,8 +3322,6 @@ var OrderTable = function OrderTable() {
|
|
|
3392
3322
|
setCallAPi = _useCallApiAgain[1];
|
|
3393
3323
|
var _useLoading = useLoading(),
|
|
3394
3324
|
loading = _useLoading[0];
|
|
3395
|
-
var _useClientPortal = useClientPortal(),
|
|
3396
|
-
clientPortal = _useClientPortal[0];
|
|
3397
3325
|
//sorting
|
|
3398
3326
|
var _useState2 = React.useState(null),
|
|
3399
3327
|
sortConfig = _useState2[0],
|
|
@@ -3585,7 +3513,7 @@ var OrderTable = function OrderTable() {
|
|
|
3585
3513
|
}
|
|
3586
3514
|
}, React__default.createElement("div", {
|
|
3587
3515
|
className: "sortIconClass"
|
|
3588
|
-
}, "Return Location ", renderSortIcon('return_location_name'))),
|
|
3516
|
+
}, "Return Location ", renderSortIcon('return_location_name'))), React__default.createElement("th", null, "Pick Up Location"), React__default.createElement("th", {
|
|
3589
3517
|
onClick: function onClick() {
|
|
3590
3518
|
return handleSort('recipient_name');
|
|
3591
3519
|
}
|
|
@@ -3603,7 +3531,7 @@ var OrderTable = function OrderTable() {
|
|
|
3603
3531
|
}
|
|
3604
3532
|
}, React__default.createElement("div", {
|
|
3605
3533
|
className: "sortIconClass"
|
|
3606
|
-
}, "Total CBM ", renderSortIcon('cube'))),
|
|
3534
|
+
}, "Total CBM ", renderSortIcon('cube'))), React__default.createElement("th", null, "Assign"), React__default.createElement("th", null, "Status"), React__default.createElement("th", {
|
|
3607
3535
|
className: "emailInvoiceShare"
|
|
3608
3536
|
}, "Labels"))), React__default.createElement("tbody", null, loading ? React__default.createElement("tr", null, React__default.createElement("td", {
|
|
3609
3537
|
colSpan: 16
|
|
@@ -3630,7 +3558,7 @@ var OrderTable = function OrderTable() {
|
|
|
3630
3558
|
var statusClass = getStatusClass(status);
|
|
3631
3559
|
return React__default.createElement("tr", {
|
|
3632
3560
|
key: item.id
|
|
3633
|
-
}, React__default.createElement("td", null, formatDate(new Date(item == null ? void 0 : item.created_at))), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.return_location_name)),
|
|
3561
|
+
}, React__default.createElement("td", null, formatDate(new Date(item == null ? void 0 : item.created_at))), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.return_location_name)), React__default.createElement("td", null, item != null && (_item$locations = item.locations) != null && _item$locations.length ? item == null ? void 0 : item.locations.join(', ') : 'N/A'), React__default.createElement("td", {
|
|
3634
3562
|
onClick: function onClick() {
|
|
3635
3563
|
return setOrderId(item.id);
|
|
3636
3564
|
}
|
|
@@ -3651,7 +3579,7 @@ var OrderTable = function OrderTable() {
|
|
|
3651
3579
|
style: {
|
|
3652
3580
|
color: '#888075'
|
|
3653
3581
|
}
|
|
3654
|
-
}, displayValueOrNA(item == null ? void 0 : item.postcode)))), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.customer_name)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.consignment)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.order_number)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.total_products)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.weight), ' ', item != null && item.weight && (item == null ? void 0 : item.weight) > 0 ? 'KG' : ''), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.cube)),
|
|
3582
|
+
}, displayValueOrNA(item == null ? void 0 : item.postcode)))), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.customer_name)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.consignment)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.order_number)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.total_products)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.weight), ' ', item != null && item.weight && (item == null ? void 0 : item.weight) > 0 ? 'KG' : ''), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.cube)), React__default.createElement("td", {
|
|
3655
3583
|
key: item.id
|
|
3656
3584
|
}, React__default.createElement(StyledAntSelect$1, {
|
|
3657
3585
|
options: assignOptions,
|
|
@@ -4141,6 +4069,7 @@ var _templateObject$f, _templateObject2$b;
|
|
|
4141
4069
|
var _excluded$3 = ["count"];
|
|
4142
4070
|
var ReturnAfterTable = function ReturnAfterTable() {
|
|
4143
4071
|
var _useReturnAfterOrderD = useReturnAfterOrderData(),
|
|
4072
|
+
returnAfterOrder = _useReturnAfterOrderD[0],
|
|
4144
4073
|
setReturnOrderData = _useReturnAfterOrderD[1];
|
|
4145
4074
|
var _useLoading = useLoading(),
|
|
4146
4075
|
setLoading = _useLoading[1];
|
|
@@ -4161,48 +4090,30 @@ var ReturnAfterTable = function ReturnAfterTable() {
|
|
|
4161
4090
|
setPaginationObject = _UsePaginationData[1];
|
|
4162
4091
|
var page = paginationObj.page,
|
|
4163
4092
|
total = paginationObj.total;
|
|
4164
|
-
var _useClientPortal = useClientPortal(),
|
|
4165
|
-
clientPortal = _useClientPortal[0];
|
|
4166
|
-
var _useSearchAfterText = useSearchAfterText(),
|
|
4167
|
-
debouncedSearchText = _useSearchAfterText[0];
|
|
4168
4093
|
var handlePageChange = function handlePageChange(page) {
|
|
4169
4094
|
setCurrentPage(page);
|
|
4170
4095
|
};
|
|
4171
4096
|
var handleItemsPerPageChange = function handleItemsPerPageChange(itemsPerPage) {
|
|
4172
4097
|
setItemsPerPage(itemsPerPage);
|
|
4173
4098
|
};
|
|
4174
|
-
var
|
|
4175
|
-
status = _useParams.status;
|
|
4176
|
-
var _useAxios = dmsComponentLibrary.useAxios({
|
|
4099
|
+
var _useApiHook = dmsComponentLibrary.useApiHook({
|
|
4177
4100
|
endpoint: '/v1/return/orders/',
|
|
4178
4101
|
method: 'GET',
|
|
4179
4102
|
filters: filters && (filters == null ? void 0 : filters.length) > 0 ? filters : undefined,
|
|
4180
|
-
pagination: pagination
|
|
4103
|
+
pagination: pagination,
|
|
4104
|
+
performAction: false
|
|
4181
4105
|
}),
|
|
4182
|
-
fetchedReturnOrderData =
|
|
4183
|
-
loading =
|
|
4184
|
-
|
|
4185
|
-
|
|
4106
|
+
fetchedReturnOrderData = _useApiHook.data,
|
|
4107
|
+
loading = _useApiHook.loading,
|
|
4108
|
+
setShouldPerformAction = _useApiHook.setShouldPerformAction,
|
|
4109
|
+
paginationData = _useApiHook.paginationData;
|
|
4186
4110
|
React.useEffect(function () {
|
|
4187
|
-
|
|
4188
|
-
fetchData();
|
|
4189
|
-
}
|
|
4111
|
+
callApi ? setShouldPerformAction(true) : setShouldPerformAction(false);
|
|
4190
4112
|
}, [callApi]);
|
|
4191
|
-
React.useEffect(function () {
|
|
4192
|
-
if (!clientPortal) {
|
|
4193
|
-
fetchData();
|
|
4194
|
-
}
|
|
4195
|
-
}, []);
|
|
4196
|
-
//CP
|
|
4197
|
-
React.useEffect(function () {
|
|
4198
|
-
if (clientPortal && debouncedSearchText.trim().length === 0) {
|
|
4199
|
-
fetchData();
|
|
4200
|
-
}
|
|
4201
|
-
}, [debouncedSearchText, clientPortal, status]);
|
|
4202
4113
|
React.useEffect(function () {
|
|
4203
4114
|
setLoading(loading);
|
|
4204
|
-
if (fetchedReturnOrderData != null && fetchedReturnOrderData.data
|
|
4205
|
-
setReturnOrderData(fetchedReturnOrderData.data);
|
|
4115
|
+
if (fetchedReturnOrderData && fetchedReturnOrderData != null && fetchedReturnOrderData.data) {
|
|
4116
|
+
setReturnOrderData(fetchedReturnOrderData == null ? void 0 : fetchedReturnOrderData.data);
|
|
4206
4117
|
if (paginationData) {
|
|
4207
4118
|
try {
|
|
4208
4119
|
var _JSON$parse = JSON.parse(paginationData),
|
|
@@ -4210,17 +4121,23 @@ var ReturnAfterTable = function ReturnAfterTable() {
|
|
|
4210
4121
|
rest = _objectWithoutPropertiesLoose(_JSON$parse, _excluded$3);
|
|
4211
4122
|
setPaginationObject(rest);
|
|
4212
4123
|
} catch (error) {
|
|
4124
|
+
console.error('Error parsing paginationData:', error);
|
|
4213
4125
|
antd.notification.error({
|
|
4214
4126
|
message: 'Error',
|
|
4215
4127
|
description: 'Failed to parse pagination data'
|
|
4216
4128
|
});
|
|
4217
4129
|
}
|
|
4130
|
+
} else {
|
|
4131
|
+
antd.notification.error({
|
|
4132
|
+
message: 'Error',
|
|
4133
|
+
description: 'Pagination data is null or undefined'
|
|
4134
|
+
});
|
|
4218
4135
|
}
|
|
4219
4136
|
}
|
|
4220
|
-
}, [fetchedReturnOrderData, loading]);
|
|
4137
|
+
}, [fetchedReturnOrderData, loading, returnAfterOrder]);
|
|
4221
4138
|
return React__default.createElement("div", null, React__default.createElement(DashBoardWrapper$1, null, React__default.createElement("div", {
|
|
4222
4139
|
className: "Tableconatiner"
|
|
4223
|
-
}, React__default.createElement(Container$4, null,
|
|
4140
|
+
}, React__default.createElement(Container$4, null, React__default.createElement(ReturnOrderFilter, null), React__default.createElement(OrderTable, null), total > 0 && React__default.createElement(ReturnPagination, {
|
|
4224
4141
|
currentPage: page,
|
|
4225
4142
|
totalItems: total,
|
|
4226
4143
|
itemsPerPage: itemsPerPage,
|
|
@@ -7825,7 +7742,7 @@ var _templateObject$1m, _templateObject2$$, _templateObject3$w;
|
|
|
7825
7742
|
// Styled components
|
|
7826
7743
|
var StyledTableWrapper$2 = /*#__PURE__*/styled__default.div(_templateObject$1m || (_templateObject$1m = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n overflow-x: auto;\n max-height: calc(100vh - 290px);\n scrollbar-width: none;\n /* box-shadow: 0px 0px 30px 6px rgba(46, 45, 116, 0.05); */\n &::-webkit-scrollbar {\n width: 5px;\n border-radius: 100px;\n height: 5px;\n }\n\n &::-webkit-scrollbar-track {\n background: #777;\n border-radius: 100px;\n }\n\n &::-webkit-scrollbar-thumb {\n background: #7b61ff;\n border-radius: 100px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: #7b61ff;\n }\n"])));
|
|
7827
7744
|
var StyledTable$2 = /*#__PURE__*/styled__default.table(_templateObject2$$ || (_templateObject2$$ = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-spacing: 0 10px;\n width: 100%;\n padding: 10px;\n thead {\n tr {\n border-radius: 40px;\n border-spacing: 0 10px;\n th {\n color: #3a3630;\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n padding: 5px 15px;\n background: #f0f2f2;\n border-right: none;\n border-left: none;\n text-align: left;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-width: 1px 0;\n text-transform: capitalize;\n &:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n &:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n }\n }\n }\n tbody {\n tr {\n td {\n color: #3a3630;\n font-size: 13px;\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n padding: 12px 15px;\n background: #fff;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-right: none;\n border-left: none;\n }\n .link {\n color: #09f;\n font-family: Roboto;\n font-weight: 400;\n cursor: pointer;\n }\n td {\n .flex {\n display: flex;\n gap: 4px;\n align-items: center;\n }\n .overDue {\n border-radius: 20px;\n border: 1px solid #edebe8;\n background: #fff;\n padding: 4px 8px;\n color: #e95252;\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n }\n &:nth-child(even) td {\n background: #f6fbff;\n }\n td:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n td:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n .emptyTd {\n border-radius: 100px !important;\n }\n .flex {\n display: flex;\n flex-direction: row;\n gap: 5px;\n height: 29px;\n align-items: center;\n }\n\n &.insideTable {\n td {\n border-radius: 0;\n border: none;\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n table {\n border-spacing: 0;\n width: 100%;\n border-radius: 5px;\n border: 1px solid rgba(0, 0, 0, 0.08);\n overflow: hidden;\n border-top-left-radius: 15px;\n border-top-right-radius: 15px;\n thead {\n tr {\n border-bottom: none;\n th {\n padding: 14px 20px;\n text-align: left;\n border-top: 0;\n border-right: 0;\n border-left: 0;\n background: #f8fafc;\n &:first-child {\n border-radius: 0;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n border-top-left-radius: 15px;\n }\n &:last-child {\n border-radius: 0;\n }\n }\n }\n }\n tbody {\n tr {\n td {\n padding: 14px 20px;\n text-align: left;\n border-bottom: 1px solid rgba(58, 54, 48, 0.15);\n background: #fff;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n }\n }\n }\n }\n }\n }\n .actions {\n display: flex;\n align-items: center;\n gap: 20px;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n\n .close-icon {\n transform: scale(1.3);\n background-color: transparent;\n border-radius: 0;\n padding: 0;\n }\n }\n"])));
|
|
7828
|
-
var EmptyDataContainer$
|
|
7745
|
+
var EmptyDataContainer$2 = /*#__PURE__*/styled__default.div(_templateObject3$w || (_templateObject3$w = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n"])));
|
|
7829
7746
|
|
|
7830
7747
|
function SplitOrderTable() {
|
|
7831
7748
|
var _useProductDetails = useProductDetails(),
|
|
@@ -7893,7 +7810,7 @@ function SplitOrderTable() {
|
|
|
7893
7810
|
})) : (orderProductDetails == null ? void 0 : orderProductDetails.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
|
|
7894
7811
|
className: "emptyTd",
|
|
7895
7812
|
colSpan: 7
|
|
7896
|
-
}, React__default.createElement(EmptyDataContainer$
|
|
7813
|
+
}, React__default.createElement(EmptyDataContainer$2, null, React__default.createElement(antd.Empty, {
|
|
7897
7814
|
description: "No Data Found"
|
|
7898
7815
|
})))) : (orderProductDetails == null ? void 0 : orderProductDetails.length) > 0 && (orderProductDetails == null ? void 0 : orderProductDetails.map(function (order) {
|
|
7899
7816
|
var _order$order_product_;
|
|
@@ -8468,7 +8385,7 @@ function ChargeLog() {
|
|
|
8468
8385
|
})) : (fetchedData == null || (_fetchedData$data = fetchedData.data) == null ? void 0 : _fetchedData$data.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
|
|
8469
8386
|
className: "emptyTd",
|
|
8470
8387
|
colSpan: 7
|
|
8471
|
-
}, React__default.createElement(EmptyDataContainer$
|
|
8388
|
+
}, React__default.createElement(EmptyDataContainer$3, null, React__default.createElement(antd.Empty, null)))) : fetchedData == null || (_fetchedData$data2 = fetchedData.data) == null ? void 0 : _fetchedData$data2.map(function (order) {
|
|
8472
8389
|
var _order$status, _order$status2;
|
|
8473
8390
|
var label = order == null || (_order$status = order.status) == null ? void 0 : _order$status.split(':')[0];
|
|
8474
8391
|
var val = order == null || (_order$status2 = order.status) == null ? void 0 : _order$status2.split(':')[1];
|
|
@@ -8484,7 +8401,7 @@ function ChargeLog() {
|
|
|
8484
8401
|
// Styled components
|
|
8485
8402
|
var StyledTableWrapper$3 = /*#__PURE__*/styled__default.div(_templateObject$1v || (_templateObject$1v = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n overflow-x: auto;\n max-height: calc(100vh - 290px);\n scrollbar-width: none;\n width: 100%;\n /* box-shadow: 0px 0px 30px 6px rgba(46, 45, 116, 0.05); */\n &::-webkit-scrollbar {\n width: 5px;\n border-radius: 100px;\n height: 5px;\n }\n\n &::-webkit-scrollbar-track {\n background: #777;\n border-radius: 100px;\n }\n\n &::-webkit-scrollbar-thumb {\n background: #7b61ff;\n border-radius: 100px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: #7b61ff;\n }\n"])));
|
|
8486
8403
|
var StyledTable$3 = /*#__PURE__*/styled__default.table(_templateObject2$15 || (_templateObject2$15 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-spacing: 0 10px;\n width: 100%;\n padding: 10px;\n thead {\n tr {\n border-radius: 40px;\n border-spacing: 0 10px;\n th {\n color: #3a3630;\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n padding: 5px 15px;\n background: #f0f2f2;\n border-right: none;\n border-left: none;\n text-align: left;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-width: 1px 0;\n text-transform: capitalize;\n &:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n &:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n }\n }\n }\n tbody {\n tr {\n td {\n color: #3a3630;\n font-size: 13px;\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n padding: 12px 15px;\n background: #fff;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-right: none;\n border-left: none;\n }\n .link {\n color: #09f;\n font-family: Roboto;\n font-weight: 400;\n .linkHover {\n cursor: pointer;\n }\n }\n td {\n .flex {\n display: flex;\n gap: 4px;\n align-items: center;\n }\n .overDue {\n border-radius: 20px;\n border: 1px solid #edebe8;\n background: #fff;\n padding: 4px 8px;\n color: #e95252;\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n }\n &:nth-child(even) td {\n background: #f6fbff;\n }\n td:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n td:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n .emptyTd {\n border-radius: 100px !important;\n }\n .flex {\n display: flex;\n flex-direction: row;\n gap: 5px;\n height: 29px;\n align-items: center;\n }\n\n &.insideTable {\n td {\n border-radius: 0;\n border: none;\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n table {\n border-spacing: 0;\n width: 100%;\n border-radius: 5px;\n border: 1px solid rgba(0, 0, 0, 0.08);\n overflow: hidden;\n border-top-left-radius: 15px;\n border-top-right-radius: 15px;\n thead {\n tr {\n border-bottom: none;\n th {\n padding: 14px 20px;\n text-align: left;\n border-top: 0;\n border-right: 0;\n border-left: 0;\n background: #f8fafc;\n &:first-child {\n border-radius: 0;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n border-top-left-radius: 15px;\n }\n &:last-child {\n border-radius: 0;\n }\n }\n }\n }\n tbody {\n tr {\n td {\n padding: 14px 20px;\n text-align: left;\n border-bottom: 1px solid rgba(58, 54, 48, 0.15);\n background: #fff;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n }\n }\n }\n }\n }\n }\n .actions {\n display: flex;\n align-items: center;\n gap: 20px;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n\n .close-icon {\n transform: scale(1.3);\n background-color: transparent;\n border-radius: 0;\n padding: 0;\n }\n }\n"])));
|
|
8487
|
-
var EmptyDataContainer$
|
|
8404
|
+
var EmptyDataContainer$3 = /*#__PURE__*/styled__default.div(_templateObject3$C || (_templateObject3$C = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n"])));
|
|
8488
8405
|
var Value = /*#__PURE__*/styled__default.span(_templateObject9$3 || (_templateObject9$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #29cc6a;\n"])));
|
|
8489
8406
|
|
|
8490
8407
|
var _templateObject$1w, _templateObject2$16, _templateObject3$D, _templateObject4$i, _templateObject5$d;
|
|
@@ -8544,7 +8461,7 @@ var CancelOrderTable = function CancelOrderTable() {
|
|
|
8544
8461
|
}))) : (cancelOrderProducts == null ? void 0 : cancelOrderProducts.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
|
|
8545
8462
|
className: "emptyTd",
|
|
8546
8463
|
colSpan: 4
|
|
8547
|
-
}, React__default.createElement(EmptyDataContainer$
|
|
8464
|
+
}, React__default.createElement(EmptyDataContainer$3, null, React__default.createElement(antd.Empty, null)))) : cancelOrderProducts == null ? void 0 : cancelOrderProducts.map(function (product) {
|
|
8548
8465
|
var dropdownOptions = (product == null ? void 0 : product.product_type) === 'deliver' ? deliverTypeOptions : collectTypeOptions;
|
|
8549
8466
|
var isReturn = (product == null ? void 0 : product.action) === 'return';
|
|
8550
8467
|
return React__default.createElement("tr", {
|
|
@@ -9293,7 +9210,7 @@ function ProductTable$1() {
|
|
|
9293
9210
|
})) : (orderProductDetails == null ? void 0 : orderProductDetails.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
|
|
9294
9211
|
className: "emptyTd",
|
|
9295
9212
|
colSpan: 7
|
|
9296
|
-
}, React__default.createElement(EmptyDataContainer$
|
|
9213
|
+
}, React__default.createElement(EmptyDataContainer$2, null, React__default.createElement(antd.Empty, null)))) : orderProductDetails == null ? void 0 : orderProductDetails.map(function (order) {
|
|
9297
9214
|
var _order$order_product_;
|
|
9298
9215
|
return React__default.createElement("tr", {
|
|
9299
9216
|
key: order.id
|
|
@@ -9383,7 +9300,7 @@ function NotesTable() {
|
|
|
9383
9300
|
})) : (notes == null ? void 0 : notes.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
|
|
9384
9301
|
className: "emptyTd",
|
|
9385
9302
|
colSpan: 7
|
|
9386
|
-
}, React__default.createElement(EmptyDataContainer$
|
|
9303
|
+
}, React__default.createElement(EmptyDataContainer$2, null, React__default.createElement(antd.Empty, null)))) : notes == null ? void 0 : notes.map(function (order) {
|
|
9387
9304
|
return React__default.createElement("tr", {
|
|
9388
9305
|
key: order.id
|
|
9389
9306
|
}, React__default.createElement("td", null, React__default.createElement("div", {
|
|
@@ -9814,7 +9731,7 @@ function ConfirmOrder() {
|
|
|
9814
9731
|
var Wrapper$h = /*#__PURE__*/styled__default.div(_templateObject$1L || (_templateObject$1L = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: 10px;\n"])));
|
|
9815
9732
|
var ContentContainer$4 = /*#__PURE__*/styled__default.div(_templateObject2$1k || (_templateObject2$1k = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n /* display: flex; */\n padding: 15px 12px;\n flex: 1 0 0;\n border-radius: 15px;\n background: white;\n display: flex;\n flex-direction: column;\n gap: 15px;\n overflow: auto;\n min-height: 500px;\n overflow-x: hidden;\n max-height: 500px;\n scrollbar-width: thin;\n"])));
|
|
9816
9733
|
|
|
9817
|
-
var _templateObject2$1l, _templateObject3$L, _templateObject5$f, _templateObject6$7, _templateObject7$9, _templateObject8$7, _templateObject9$5, _templateObject10$3, _templateObject11$2, _templateObject18, _templateObject19$1;
|
|
9734
|
+
var _templateObject2$1l, _templateObject3$L, _templateObject5$f, _templateObject6$7, _templateObject7$9, _templateObject8$7, _templateObject9$5, _templateObject10$3, _templateObject11$2, _templateObject18$1, _templateObject19$1;
|
|
9818
9735
|
var StyledInput = /*#__PURE__*/styled__default(dmsComponentLibrary.Input)(_templateObject2$1l || (_templateObject2$1l = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-radius: 66px;\n min-width: 700px;\n"])));
|
|
9819
9736
|
var StyledTextArea$1 = /*#__PURE__*/styled__default(dmsComponentLibrary.TextArea)(_templateObject3$L || (_templateObject3$L = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n padding: 12px;\n align-items: flex-start;\n gap: 4px;\n flex: 1 0 0;\n align-self: stretch;\n border-radius: 10px;\n border: 1px solid #e0e2e7;\n background: #fff;\n resize: none;\n min-height: 200px;\n"])));
|
|
9820
9737
|
var SplitLayout = /*#__PURE__*/styled__default.div(_templateObject5$f || (_templateObject5$f = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n gap: 10px;\n"])));
|
|
@@ -9824,7 +9741,7 @@ var HoldRow = /*#__PURE__*/styled__default.div(_templateObject8$7 || (_templateO
|
|
|
9824
9741
|
var Label$e = /*#__PURE__*/styled__default.label(_templateObject9$5 || (_templateObject9$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #758588;\n font-family: 'Lato', sans-serif;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n"])));
|
|
9825
9742
|
var ContentContainer$5 = /*#__PURE__*/styled__default.div(_templateObject10$3 || (_templateObject10$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n padding: 12px 12px;\n margin: 5px 14px;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 15px;\n flex: 1 0 0;\n border-radius: 15px;\n background: #f8fafc;\n"])));
|
|
9826
9743
|
var HoldContentContainer = /*#__PURE__*/styled__default.div(_templateObject11$2 || (_templateObject11$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n padding: 20px 20px;\n margin: 5px 14px;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 15px;\n flex: 1 0 0;\n border-radius: 15px;\n"])));
|
|
9827
|
-
var HoldDatePickerWrap = /*#__PURE__*/styled__default.div(_templateObject18 || (_templateObject18 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n border-radius: 66px;\n border: 1px solid #e0e2e7;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n\n input[type='text'] {\n border-radius: 20px;\n background: #fff;\n border: none;\n color: #6a7378;\n font-size: 14px;\n font-weight: 400;\n line-height: 18px;\n padding: 10px 0;\n padding-left: 33px;\n min-width: 21.5vw;\n &:focus-visible {\n outline: none;\n }\n }\n svg {\n position: absolute;\n right: 10px;\n top: 50%;\n transform: translateY(-50%);\n }\n .react-datepicker-wrapper {\n background-color: white;\n border-radius: 66px;\n }\n .ant-picker-outlined {\n border-style: none;\n border-radius: 66px;\n outline: none;\n width: 346px;\n }\n"])));
|
|
9744
|
+
var HoldDatePickerWrap = /*#__PURE__*/styled__default.div(_templateObject18$1 || (_templateObject18$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n border-radius: 66px;\n border: 1px solid #e0e2e7;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n\n input[type='text'] {\n border-radius: 20px;\n background: #fff;\n border: none;\n color: #6a7378;\n font-size: 14px;\n font-weight: 400;\n line-height: 18px;\n padding: 10px 0;\n padding-left: 33px;\n min-width: 21.5vw;\n &:focus-visible {\n outline: none;\n }\n }\n svg {\n position: absolute;\n right: 10px;\n top: 50%;\n transform: translateY(-50%);\n }\n .react-datepicker-wrapper {\n background-color: white;\n border-radius: 66px;\n }\n .ant-picker-outlined {\n border-style: none;\n border-radius: 66px;\n outline: none;\n width: 346px;\n }\n"])));
|
|
9828
9745
|
var DatePickerWrap = /*#__PURE__*/styled__default.div(_templateObject19$1 || (_templateObject19$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n\n border-radius: 66px;\n border: 1px solid #e0e2e7;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n\n input[type='text'] {\n border-radius: 20px;\n background: #fff;\n border: none;\n color: #6a7378;\n font-size: 14px;\n font-weight: 400;\n line-height: 18px;\n padding: 10px 0;\n padding-left: 33px;\n min-width: 18vw;\n &:focus-visible {\n outline: none;\n }\n }\n svg {\n position: absolute;\n right: 10px;\n top: 50%;\n transform: translateY(-50%);\n }\n .react-datepicker-wrapper {\n background-color: white;\n border-radius: 66px;\n }\n .ant-picker-outlined {\n border-style: none;\n border-radius: 66px;\n outline: none;\n width: 100%;\n }\n"])));
|
|
9829
9746
|
|
|
9830
9747
|
var _templateObject$1M, _templateObject2$1m;
|
|
@@ -11712,7 +11629,7 @@ var UnCancelOrderTable = function UnCancelOrderTable() {
|
|
|
11712
11629
|
}))) : (cancelOrderProducts == null ? void 0 : cancelOrderProducts.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
|
|
11713
11630
|
className: "emptyTd",
|
|
11714
11631
|
colSpan: 5
|
|
11715
|
-
}, React__default.createElement(EmptyDataContainer$
|
|
11632
|
+
}, React__default.createElement(EmptyDataContainer$2, null, React__default.createElement(antd.Empty, null)))) : cancelOrderProducts == null ? void 0 : cancelOrderProducts.map(function (product) {
|
|
11716
11633
|
var dropdownOptions = (product == null ? void 0 : product.product_type) === 'deliver' ? deliverTypeOptions$1 : collectTypeOptions$1;
|
|
11717
11634
|
var isReturn = (product == null ? void 0 : product.action) === 'return';
|
|
11718
11635
|
return React__default.createElement("tr", {
|
|
@@ -15233,8 +15150,8 @@ function ReturnSearchBar() {
|
|
|
15233
15150
|
var _useState2 = React.useState([]),
|
|
15234
15151
|
modifiedFilters = _useState2[0],
|
|
15235
15152
|
setModifiedFilters = _useState2[1];
|
|
15236
|
-
var
|
|
15237
|
-
|
|
15153
|
+
var _useClientOutstanding = useClientOutstandingReturnData(),
|
|
15154
|
+
setOutstandingData = _useClientOutstanding[1];
|
|
15238
15155
|
var _useParams = reactRouterDom.useParams(),
|
|
15239
15156
|
status = _useParams.status;
|
|
15240
15157
|
//condition on client view
|
|
@@ -15252,6 +15169,11 @@ function ReturnSearchBar() {
|
|
|
15252
15169
|
endDate = _useEndDate[0];
|
|
15253
15170
|
var _useAtom = jotai.useAtom(filtersReducerAtom),
|
|
15254
15171
|
state = _useAtom[0];
|
|
15172
|
+
var _useStatsCPCount = useStatsCPCount(),
|
|
15173
|
+
setCount = _useStatsCPCount[1];
|
|
15174
|
+
var _useState3 = React.useState([]),
|
|
15175
|
+
modifiedStatsFilters = _useState3[0],
|
|
15176
|
+
setModifiedStatsFilters = _useState3[1];
|
|
15255
15177
|
var pagination = state['x-pagination'];
|
|
15256
15178
|
React.useEffect(function () {
|
|
15257
15179
|
var isClientOutstanding = clientPortal && status === 'outstanding_return';
|
|
@@ -15301,6 +15223,37 @@ function ReturnSearchBar() {
|
|
|
15301
15223
|
}].concat(dateFilters) : dateFilters;
|
|
15302
15224
|
setModifiedFilters(updatedFilters);
|
|
15303
15225
|
}, [startDate, endDate, status]);
|
|
15226
|
+
//For stats
|
|
15227
|
+
var getDateFilters = function getDateFilters(startDate, endDate) {
|
|
15228
|
+
var stored = JSON.parse(localStorage.getItem('returnDate') || '{}');
|
|
15229
|
+
var sDate = startDate != null && startDate.isValid != null && startDate.isValid() ? startDate : dayjs(stored == null ? void 0 : stored.startDate);
|
|
15230
|
+
var eDate = endDate != null && endDate.isValid != null && endDate.isValid() ? endDate : stored != null && stored.endDate ? dayjs(stored == null ? void 0 : stored.endDate) : null;
|
|
15231
|
+
if (!(sDate != null && sDate.isValid != null && sDate.isValid())) return [];
|
|
15232
|
+
var dateFilters = [];
|
|
15233
|
+
if (eDate && eDate.isValid()) {
|
|
15234
|
+
dateFilters = [{
|
|
15235
|
+
field: 'created_at',
|
|
15236
|
+
op: '>=',
|
|
15237
|
+
value: sDate.format('YYYY-MM-DD')
|
|
15238
|
+
}, {
|
|
15239
|
+
field: 'created_at',
|
|
15240
|
+
op: '<=',
|
|
15241
|
+
value: eDate.add(1, 'day').format('YYYY-MM-DD')
|
|
15242
|
+
}];
|
|
15243
|
+
} else {
|
|
15244
|
+
dateFilters = [{
|
|
15245
|
+
field: 'created_at',
|
|
15246
|
+
op: '=',
|
|
15247
|
+
value: sDate.format('YYYY-MM-DD')
|
|
15248
|
+
}];
|
|
15249
|
+
}
|
|
15250
|
+
return dateFilters;
|
|
15251
|
+
};
|
|
15252
|
+
React.useEffect(function () {
|
|
15253
|
+
if (!clientPortal) return;
|
|
15254
|
+
var dateFilters = getDateFilters(startDate, endDate);
|
|
15255
|
+
setModifiedStatsFilters(dateFilters);
|
|
15256
|
+
}, [startDate, endDate]);
|
|
15304
15257
|
var _useAxios = dmsComponentLibrary.useAxios({
|
|
15305
15258
|
endpoint: '/v1/return/product/pending/',
|
|
15306
15259
|
method: 'GET',
|
|
@@ -15310,7 +15263,7 @@ function ReturnSearchBar() {
|
|
|
15310
15263
|
paginationData = _useAxios.paginationData,
|
|
15311
15264
|
getPendingData = _useAxios.fetchData;
|
|
15312
15265
|
React.useEffect(function () {
|
|
15313
|
-
if (debouncedSearchText.length > 1) {
|
|
15266
|
+
if ((debouncedSearchText == null ? void 0 : debouncedSearchText.length) > 1) {
|
|
15314
15267
|
getPendingData({
|
|
15315
15268
|
endPointQuery: "?search_term=" + debouncedSearchText
|
|
15316
15269
|
}).then(function (response) {
|
|
@@ -15321,12 +15274,12 @@ function ReturnSearchBar() {
|
|
|
15321
15274
|
setPaginationObject(rest);
|
|
15322
15275
|
}
|
|
15323
15276
|
if ((response == null || (_response$data = response.data) == null ? void 0 : _response$data.length) > 0) {
|
|
15324
|
-
|
|
15277
|
+
setOutstandingData(response == null ? void 0 : response.data);
|
|
15325
15278
|
} else {
|
|
15326
|
-
|
|
15279
|
+
setOutstandingData([]);
|
|
15327
15280
|
}
|
|
15328
15281
|
});
|
|
15329
|
-
} else if (debouncedSearchText.length > 0 && debouncedSearchText.length <= 2) {
|
|
15282
|
+
} else if ((debouncedSearchText == null ? void 0 : debouncedSearchText.length) > 0 && (debouncedSearchText == null ? void 0 : debouncedSearchText.length) <= 2) {
|
|
15330
15283
|
antd.notification.warning({
|
|
15331
15284
|
message: 'Search Phrase cannot be less than 3 characters'
|
|
15332
15285
|
});
|
|
@@ -15342,39 +15295,82 @@ function ReturnSearchBar() {
|
|
|
15342
15295
|
};
|
|
15343
15296
|
}, [searchText]);
|
|
15344
15297
|
React.useEffect(function () {
|
|
15345
|
-
if (debouncedSearchText.length === 0) {
|
|
15298
|
+
if ((debouncedSearchText == null ? void 0 : debouncedSearchText.length) === 0) {
|
|
15346
15299
|
setSearchText('');
|
|
15347
15300
|
}
|
|
15348
15301
|
}, [debouncedSearchText]);
|
|
15349
|
-
|
|
15350
|
-
|
|
15351
|
-
|
|
15352
|
-
|
|
15353
|
-
|
|
15354
|
-
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
|
|
15358
|
-
|
|
15359
|
-
|
|
15360
|
-
|
|
15361
|
-
|
|
15362
|
-
|
|
15363
|
-
var
|
|
15364
|
-
var
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
|
|
15368
|
-
|
|
15369
|
-
|
|
15302
|
+
//
|
|
15303
|
+
var _useAxios2 = dmsComponentLibrary.useAxios({
|
|
15304
|
+
endpoint: "v1/portal/return/stats/",
|
|
15305
|
+
method: 'GET',
|
|
15306
|
+
pagination: {
|
|
15307
|
+
is_pagination: false
|
|
15308
|
+
},
|
|
15309
|
+
filters: modifiedStatsFilters
|
|
15310
|
+
}),
|
|
15311
|
+
fetchStatsData = _useAxios2.fetchData;
|
|
15312
|
+
React.useEffect(function () {
|
|
15313
|
+
var isClientOutstanding = clientPortal && status === 'outstanding_return';
|
|
15314
|
+
if (!isClientOutstanding || (debouncedSearchText == null ? void 0 : debouncedSearchText.length) < 3) return;
|
|
15315
|
+
var fetchStats = /*#__PURE__*/function () {
|
|
15316
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
15317
|
+
var response;
|
|
15318
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15319
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15320
|
+
case 0:
|
|
15321
|
+
_context.next = 2;
|
|
15322
|
+
return fetchStatsData({
|
|
15323
|
+
endPointQuery: "?search_term=" + debouncedSearchText + "&type=outstanding"
|
|
15324
|
+
});
|
|
15325
|
+
case 2:
|
|
15326
|
+
response = _context.sent;
|
|
15327
|
+
//@ts-ignore
|
|
15328
|
+
if (response != null && response.data) {
|
|
15329
|
+
//@ts-ignore
|
|
15330
|
+
setCount(response == null ? void 0 : response.data); // Set the count here
|
|
15331
|
+
} else {
|
|
15332
|
+
setCount(null); // fallback if no data
|
|
15333
|
+
}
|
|
15334
|
+
case 4:
|
|
15335
|
+
case "end":
|
|
15336
|
+
return _context.stop();
|
|
15337
|
+
}
|
|
15338
|
+
}, _callee);
|
|
15339
|
+
}));
|
|
15340
|
+
return function fetchStats() {
|
|
15341
|
+
return _ref.apply(this, arguments);
|
|
15342
|
+
};
|
|
15343
|
+
}();
|
|
15344
|
+
fetchStats();
|
|
15345
|
+
}, [debouncedSearchText, status, clientPortal]);
|
|
15346
|
+
var handleClear = function handleClear() {
|
|
15347
|
+
setSearchText('');
|
|
15348
|
+
};
|
|
15349
|
+
return React__default.createElement(Search$1, null, React__default.createElement(dmsComponentLibrary.SearchIcon, null), React__default.createElement(SearchInput$1, {
|
|
15350
|
+
type: "text",
|
|
15351
|
+
placeholder: "Search",
|
|
15352
|
+
value: searchText,
|
|
15353
|
+
onChange: handleInputChange
|
|
15354
|
+
}), searchText ? React__default.createElement(ClearButton$1, {
|
|
15355
|
+
className: "clear",
|
|
15356
|
+
onClick: handleClear
|
|
15357
|
+
}, React__default.createElement(dmsComponentLibrary.CrossIcon, null)) : null);
|
|
15358
|
+
}
|
|
15359
|
+
var ClearButton$1 = /*#__PURE__*/styled__default.button(_templateObject$2w || (_templateObject$2w = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: none;\n background: none;\n position: relative;\n border: none;\n cursor: pointer;\n padding: 0 4px;\n font-size: 0;\n &:hover {\n color: #000;\n }\n"])));
|
|
15360
|
+
var Search$1 = /*#__PURE__*/styled__default.div(_templateObject2$1V || (_templateObject2$1V = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n padding: 4px 12px;\n align-items: center;\n gap: 8px;\n align-self: stretch;\n border-radius: 20px;\n border: 1px solid var(--Neutral-Gray-Gray-100, #e0e2e7);\n background-color: var(--Flowkit-White, #fff);\n height: 35px;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n"])));
|
|
15361
|
+
var SearchInput$1 = /*#__PURE__*/styled__default.input(_templateObject3$14 || (_templateObject3$14 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: none;\n outline: none;\n flex-grow: 1;\n width: 100%;\n background: transparent;\n"])));
|
|
15362
|
+
var ReturnSearchBar$1 = /*#__PURE__*/React__default.memo(ReturnSearchBar);
|
|
15363
|
+
|
|
15364
|
+
var _templateObject$2x, _templateObject2$1W, _templateObject3$15;
|
|
15365
|
+
function ReturnAfterSearchBar() {
|
|
15370
15366
|
var _useState = React.useState(''),
|
|
15371
15367
|
searchText = _useState[0],
|
|
15372
15368
|
setSearchText = _useState[1];
|
|
15373
15369
|
var _useSearchAfterText = useSearchAfterText(),
|
|
15374
15370
|
debouncedSearchText = _useSearchAfterText[0],
|
|
15375
15371
|
setDebouncedSearchText = _useSearchAfterText[1];
|
|
15376
|
-
var
|
|
15377
|
-
|
|
15372
|
+
var _useReturnConfirmedOr = useReturnConfirmedOrderData(),
|
|
15373
|
+
setReturnConfirmedData = _useReturnConfirmedOr[1];
|
|
15378
15374
|
//condition on client view
|
|
15379
15375
|
var _UsePaginationData = UsePaginationData(),
|
|
15380
15376
|
setPaginationObject = _UsePaginationData[1];
|
|
@@ -15382,10 +15378,24 @@ function ReturnAfterSearchBar() {
|
|
|
15382
15378
|
setSearchText(event.target.value);
|
|
15383
15379
|
};
|
|
15384
15380
|
//CP
|
|
15381
|
+
var _useState2 = React.useState([]),
|
|
15382
|
+
modifiedStatsFilters = _useState2[0],
|
|
15383
|
+
setModifiedStatsFilters = _useState2[1];
|
|
15384
|
+
var _useStartDate = useStartDate(),
|
|
15385
|
+
startDate = _useStartDate[0];
|
|
15386
|
+
var _useEndDate = useEndDate(),
|
|
15387
|
+
endDate = _useEndDate[0];
|
|
15385
15388
|
var _useAtom = jotai.useAtom(filtersReducerReturnAtom),
|
|
15386
15389
|
state = _useAtom[0];
|
|
15387
15390
|
var filters = state['x-filters'],
|
|
15388
15391
|
pagination = state['x-pagination'];
|
|
15392
|
+
var _useStatsCPCount = useStatsCPCount(),
|
|
15393
|
+
count = _useStatsCPCount[0],
|
|
15394
|
+
setCount = _useStatsCPCount[1];
|
|
15395
|
+
var _useClientPortal = useClientPortal(),
|
|
15396
|
+
clientPortal = _useClientPortal[0];
|
|
15397
|
+
var _useParams = reactRouterDom.useParams(),
|
|
15398
|
+
status = _useParams.status;
|
|
15389
15399
|
var _useAxios = dmsComponentLibrary.useAxios({
|
|
15390
15400
|
endpoint: '/v1/return/orders/',
|
|
15391
15401
|
method: 'GET',
|
|
@@ -15395,7 +15405,7 @@ function ReturnAfterSearchBar() {
|
|
|
15395
15405
|
paginationData = _useAxios.paginationData,
|
|
15396
15406
|
returnAfterCall = _useAxios.fetchData;
|
|
15397
15407
|
React.useEffect(function () {
|
|
15398
|
-
if (debouncedSearchText.length > 1) {
|
|
15408
|
+
if ((debouncedSearchText == null ? void 0 : debouncedSearchText.length) > 1) {
|
|
15399
15409
|
returnAfterCall({
|
|
15400
15410
|
endPointQuery: "?search_term=" + debouncedSearchText
|
|
15401
15411
|
}).then(function (response) {
|
|
@@ -15405,12 +15415,12 @@ function ReturnAfterSearchBar() {
|
|
|
15405
15415
|
setPaginationObject(rest);
|
|
15406
15416
|
}
|
|
15407
15417
|
if (response != null && response.data) {
|
|
15408
|
-
|
|
15418
|
+
setReturnConfirmedData(response == null ? void 0 : response.data);
|
|
15409
15419
|
} else {
|
|
15410
|
-
|
|
15420
|
+
setReturnConfirmedData([]);
|
|
15411
15421
|
}
|
|
15412
15422
|
});
|
|
15413
|
-
} else if (debouncedSearchText.length > 0 && debouncedSearchText.length <= 2) {
|
|
15423
|
+
} else if ((debouncedSearchText == null ? void 0 : debouncedSearchText.length) > 0 && (debouncedSearchText == null ? void 0 : debouncedSearchText.length) <= 2) {
|
|
15414
15424
|
antd.notification.warning({
|
|
15415
15425
|
message: 'Search Phrase cannot be less than 3 characters'
|
|
15416
15426
|
});
|
|
@@ -15426,13 +15436,97 @@ function ReturnAfterSearchBar() {
|
|
|
15426
15436
|
};
|
|
15427
15437
|
}, [searchText]);
|
|
15428
15438
|
React.useEffect(function () {
|
|
15429
|
-
if (debouncedSearchText.length === 0) {
|
|
15439
|
+
if ((debouncedSearchText == null ? void 0 : debouncedSearchText.length) === 0) {
|
|
15430
15440
|
setSearchText('');
|
|
15431
15441
|
}
|
|
15432
15442
|
}, [debouncedSearchText]);
|
|
15443
|
+
//
|
|
15444
|
+
var getDateFilters = function getDateFilters(startDate, endDate) {
|
|
15445
|
+
var stored = JSON.parse(localStorage.getItem('returnDate') || '{}');
|
|
15446
|
+
var sDate = startDate != null && startDate.isValid != null && startDate.isValid() ? startDate : dayjs(stored == null ? void 0 : stored.startDate);
|
|
15447
|
+
var eDate = endDate != null && endDate.isValid != null && endDate.isValid() ? endDate : stored != null && stored.endDate ? dayjs(stored == null ? void 0 : stored.endDate) : null;
|
|
15448
|
+
if (!(sDate != null && sDate.isValid != null && sDate.isValid())) return [];
|
|
15449
|
+
var dateFilters = [];
|
|
15450
|
+
if (eDate && eDate.isValid()) {
|
|
15451
|
+
dateFilters = [{
|
|
15452
|
+
field: 'created_at',
|
|
15453
|
+
op: '>=',
|
|
15454
|
+
value: sDate.format('YYYY-MM-DD')
|
|
15455
|
+
}, {
|
|
15456
|
+
field: 'created_at',
|
|
15457
|
+
op: '<=',
|
|
15458
|
+
value: eDate.add(1, 'day').format('YYYY-MM-DD')
|
|
15459
|
+
}];
|
|
15460
|
+
} else {
|
|
15461
|
+
dateFilters = [{
|
|
15462
|
+
field: 'created_at',
|
|
15463
|
+
op: '=',
|
|
15464
|
+
value: sDate.format('YYYY-MM-DD')
|
|
15465
|
+
}];
|
|
15466
|
+
}
|
|
15467
|
+
return dateFilters;
|
|
15468
|
+
};
|
|
15469
|
+
React.useEffect(function () {
|
|
15470
|
+
if (!clientPortal) return;
|
|
15471
|
+
var dateFilters = getDateFilters(startDate, endDate);
|
|
15472
|
+
setModifiedStatsFilters(dateFilters);
|
|
15473
|
+
}, [startDate, endDate]);
|
|
15474
|
+
var _useAxios2 = dmsComponentLibrary.useAxios({
|
|
15475
|
+
endpoint: "v1/portal/return/stats/",
|
|
15476
|
+
method: 'GET',
|
|
15477
|
+
pagination: {
|
|
15478
|
+
is_pagination: false
|
|
15479
|
+
},
|
|
15480
|
+
filters: modifiedStatsFilters
|
|
15481
|
+
}),
|
|
15482
|
+
statsData = _useAxios2.data,
|
|
15483
|
+
fetchStatsData = _useAxios2.fetchData;
|
|
15484
|
+
React.useEffect(function () {
|
|
15485
|
+
var validStatuses = ['scheduled_for_return', 'return_completed'];
|
|
15486
|
+
var isClientView = clientPortal && validStatuses.includes(status || '');
|
|
15487
|
+
if (!isClientView || (debouncedSearchText == null ? void 0 : debouncedSearchText.length) < 3) return;
|
|
15488
|
+
console.log('IN after view entered');
|
|
15489
|
+
var statusTypeMap = {
|
|
15490
|
+
scheduled_for_return: 'scheduled',
|
|
15491
|
+
return_completed: 'complete'
|
|
15492
|
+
};
|
|
15493
|
+
var type = statusTypeMap[status];
|
|
15494
|
+
var fetchStats = /*#__PURE__*/function () {
|
|
15495
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
15496
|
+
var response;
|
|
15497
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15498
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15499
|
+
case 0:
|
|
15500
|
+
_context.next = 2;
|
|
15501
|
+
return fetchStatsData({
|
|
15502
|
+
endPointQuery: "?search_term=" + debouncedSearchText + "&type=" + type
|
|
15503
|
+
});
|
|
15504
|
+
case 2:
|
|
15505
|
+
response = _context.sent;
|
|
15506
|
+
//@ts-ignore
|
|
15507
|
+
if (response != null && response.data) {
|
|
15508
|
+
console.log('inside response', response);
|
|
15509
|
+
// @ts-ignore
|
|
15510
|
+
setCount(response == null ? void 0 : response.data);
|
|
15511
|
+
} else {
|
|
15512
|
+
setCount(null);
|
|
15513
|
+
}
|
|
15514
|
+
case 4:
|
|
15515
|
+
case "end":
|
|
15516
|
+
return _context.stop();
|
|
15517
|
+
}
|
|
15518
|
+
}, _callee);
|
|
15519
|
+
}));
|
|
15520
|
+
return function fetchStats() {
|
|
15521
|
+
return _ref.apply(this, arguments);
|
|
15522
|
+
};
|
|
15523
|
+
}();
|
|
15524
|
+
fetchStats();
|
|
15525
|
+
}, [debouncedSearchText, status, clientPortal]);
|
|
15526
|
+
console.log(statsData, 'statsData');
|
|
15527
|
+
console.log(count, 'new count');
|
|
15433
15528
|
var handleClear = function handleClear() {
|
|
15434
15529
|
setSearchText('');
|
|
15435
|
-
setDebouncedSearchText('');
|
|
15436
15530
|
};
|
|
15437
15531
|
return React__default.createElement(Search$2, null, React__default.createElement(dmsComponentLibrary.SearchIcon, null), React__default.createElement(SearchInput$2, {
|
|
15438
15532
|
type: "text",
|
|
@@ -15526,41 +15620,756 @@ var RouterHeader = function RouterHeader(_ref) {
|
|
|
15526
15620
|
};
|
|
15527
15621
|
var DatePickerWrap$1 = /*#__PURE__*/styled__default.div(_templateObject$2y || (_templateObject$2y = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n padding-right: 10px;\n padding-left: 7px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n border-radius: 20px;\n border: 1px solid #e0e2e7;\n background: var(--Neutral-White, #fff);\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n min-width: 22vw;\n height: 35px;\n input[type='text'] {\n border-radius: 20px;\n background: var(--Flowkit-White, #fff);\n border: none;\n color: #6a7378;\n font-size: 13px;\n font-weight: 400;\n line-height: 18px;\n padding: 8px 0;\n padding-left: 10px;\n &:focus-visible {\n outline: none;\n }\n }\n\n .ant-picker-outlined {\n border-style: none !important;\n }\n\n .ant-picker-focused {\n box-shadow: none;\n }\n\n /* .ant-picker {\n .ant-picker-input {\n width: 150px;\n }\n } */\n .ant-btn {\n background-color: #3348ff !important;\n }\n"])));
|
|
15528
15622
|
|
|
15529
|
-
var
|
|
15530
|
-
var
|
|
15623
|
+
var _excluded$a = ["count"];
|
|
15624
|
+
var OutstandingTable = function OutstandingTable() {
|
|
15625
|
+
var _useAtom = jotai.useAtom(filtersReducerAtom),
|
|
15626
|
+
state = _useAtom[0];
|
|
15627
|
+
var pagination = state['x-pagination'];
|
|
15628
|
+
var _useClientOutstanding = useClientOutstandingReturnData(),
|
|
15629
|
+
outstandingReturnData = _useClientOutstanding[0],
|
|
15630
|
+
setOutstandingReturnData = _useClientOutstanding[1];
|
|
15631
|
+
var _useLoading = useLoading(),
|
|
15632
|
+
load = _useLoading[0],
|
|
15633
|
+
setLoading = _useLoading[1];
|
|
15634
|
+
var dropdownRefParent = React.useRef(null);
|
|
15635
|
+
var dropdownRef = React.useRef(null);
|
|
15636
|
+
var _usePrintOptionTOggle = usePrintOptionTOggle(),
|
|
15637
|
+
printToogle = _usePrintOptionTOggle[0],
|
|
15638
|
+
setPrintToggle = _usePrintOptionTOggle[1];
|
|
15639
|
+
var _useLocationData = useLocationData(),
|
|
15640
|
+
locationData = _useLocationData[0];
|
|
15531
15641
|
var _UsePaginationData = UsePaginationData(),
|
|
15532
|
-
|
|
15533
|
-
var
|
|
15534
|
-
|
|
15535
|
-
var _useItemsPerPage = useItemsPerPage(),
|
|
15536
|
-
itemsPerPage = _useItemsPerPage[0],
|
|
15537
|
-
setItemsPerPage = _useItemsPerPage[1];
|
|
15538
|
-
var page = paginationObj.page,
|
|
15539
|
-
total = paginationObj.total;
|
|
15540
|
-
var _useParams = reactRouterDom.useParams(),
|
|
15541
|
-
status = _useParams.status;
|
|
15642
|
+
setPaginationObject = _UsePaginationData[1];
|
|
15643
|
+
var _usefetchAgain = usefetchAgain(),
|
|
15644
|
+
callForFetch = _usefetchAgain[0];
|
|
15542
15645
|
var _useClientPortal = useClientPortal(),
|
|
15543
15646
|
clientPortal = _useClientPortal[0];
|
|
15544
|
-
var
|
|
15545
|
-
|
|
15647
|
+
var _useParams = reactRouterDom.useParams(),
|
|
15648
|
+
status = _useParams.status;
|
|
15649
|
+
var _useSelectedClientPor = useSelectedClientPortOrders(),
|
|
15650
|
+
selectedOrderIds = _useSelectedClientPor[0],
|
|
15651
|
+
setSelectedOrderIds = _useSelectedClientPor[1];
|
|
15652
|
+
var _useState = React.useState(false),
|
|
15653
|
+
selectClientAll = _useState[0],
|
|
15654
|
+
setSelectClientAll = _useState[1];
|
|
15655
|
+
var _useSearchText = useSearchText(),
|
|
15656
|
+
debouncedSearchText = _useSearchText[0];
|
|
15657
|
+
//sorting
|
|
15658
|
+
var _useState2 = React.useState(null),
|
|
15659
|
+
sortConfig = _useState2[0],
|
|
15660
|
+
setSortConfig = _useState2[1];
|
|
15661
|
+
var handleSort = function handleSort(key) {
|
|
15662
|
+
setSortConfig(function (prev) {
|
|
15663
|
+
if ((prev == null ? void 0 : prev.key) === key && prev.direction === 'asc') {
|
|
15664
|
+
return {
|
|
15665
|
+
key: key,
|
|
15666
|
+
direction: 'desc'
|
|
15667
|
+
};
|
|
15668
|
+
}
|
|
15669
|
+
return {
|
|
15670
|
+
key: key,
|
|
15671
|
+
direction: 'asc'
|
|
15672
|
+
};
|
|
15673
|
+
});
|
|
15546
15674
|
};
|
|
15547
|
-
var
|
|
15548
|
-
|
|
15675
|
+
var sortedData = React.useMemo(function () {
|
|
15676
|
+
if (!outstandingReturnData || !sortConfig) return outstandingReturnData;
|
|
15677
|
+
var key = sortConfig.key,
|
|
15678
|
+
direction = sortConfig.direction;
|
|
15679
|
+
return [].concat(outstandingReturnData).sort(function (a, b) {
|
|
15680
|
+
var valueA = a[key];
|
|
15681
|
+
var valueB = b[key];
|
|
15682
|
+
if (typeof valueA === 'number' && typeof valueB === 'number') {
|
|
15683
|
+
return direction === 'asc' ? valueA - valueB : valueB - valueA;
|
|
15684
|
+
}
|
|
15685
|
+
if (typeof valueA === 'string' && typeof valueB === 'string') {
|
|
15686
|
+
return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
|
|
15687
|
+
}
|
|
15688
|
+
return 0;
|
|
15689
|
+
});
|
|
15690
|
+
}, [outstandingReturnData, sortConfig]);
|
|
15691
|
+
var renderSortIcon = function renderSortIcon(columnKey) {
|
|
15692
|
+
if (!sortConfig || sortConfig.key !== columnKey) {
|
|
15693
|
+
return React__default.createElement(SortIcon, null);
|
|
15694
|
+
}
|
|
15695
|
+
return sortConfig.direction === 'asc' ? React__default.createElement(CaretDownFilledIcon, null) : React__default.createElement(CaretDownFilledIcon, null);
|
|
15549
15696
|
};
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
}
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
};
|
|
15562
|
-
var
|
|
15563
|
-
|
|
15697
|
+
var OpenDropDown = function OpenDropDown(index) {
|
|
15698
|
+
setPrintToggle(function (prevIndex) {
|
|
15699
|
+
return prevIndex === index ? null : index;
|
|
15700
|
+
});
|
|
15701
|
+
};
|
|
15702
|
+
// Close dropdown outside click
|
|
15703
|
+
React.useEffect(function () {
|
|
15704
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
15705
|
+
return function () {
|
|
15706
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
15707
|
+
};
|
|
15708
|
+
}, []);
|
|
15709
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
15710
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
15711
|
+
setPrintToggle(null);
|
|
15712
|
+
}
|
|
15713
|
+
};
|
|
15714
|
+
//CP
|
|
15715
|
+
var _useStartDate = useStartDate(),
|
|
15716
|
+
startDate = _useStartDate[0];
|
|
15717
|
+
var _useEndDate = useEndDate(),
|
|
15718
|
+
endDate = _useEndDate[0];
|
|
15719
|
+
var filters = React.useMemo(function () {
|
|
15720
|
+
if (!clientPortal) return [];
|
|
15721
|
+
var stored = JSON.parse(localStorage.getItem('returnDate') || '{}');
|
|
15722
|
+
var sDate = startDate != null && startDate.isValid != null && startDate.isValid() ? startDate : dayjs(stored == null ? void 0 : stored.startDate);
|
|
15723
|
+
var eDate = endDate != null && endDate.isValid != null && endDate.isValid() ? endDate : stored != null && stored.endDate ? dayjs(stored == null ? void 0 : stored.endDate) : null;
|
|
15724
|
+
if (!(sDate != null && sDate.isValid != null && sDate.isValid())) return [];
|
|
15725
|
+
var dateFilters = [];
|
|
15726
|
+
if (eDate && eDate.isValid()) {
|
|
15727
|
+
dateFilters = [{
|
|
15728
|
+
field: 'created_at',
|
|
15729
|
+
op: '>=',
|
|
15730
|
+
value: sDate.format('YYYY-MM-DD')
|
|
15731
|
+
}, {
|
|
15732
|
+
field: 'created_at',
|
|
15733
|
+
op: '<=',
|
|
15734
|
+
value: eDate.add(1, 'day').format('YYYY-MM-DD')
|
|
15735
|
+
}];
|
|
15736
|
+
} else {
|
|
15737
|
+
dateFilters = [{
|
|
15738
|
+
field: 'created_at',
|
|
15739
|
+
op: '=',
|
|
15740
|
+
value: sDate.format('YYYY-MM-DD')
|
|
15741
|
+
}];
|
|
15742
|
+
}
|
|
15743
|
+
var baseFilters = status === 'outstanding_return' ? [{
|
|
15744
|
+
field: 'isdeleted',
|
|
15745
|
+
op: '=',
|
|
15746
|
+
value: 0
|
|
15747
|
+
}, {
|
|
15748
|
+
field: 'product_return_action_id',
|
|
15749
|
+
op: '=',
|
|
15750
|
+
value: 'RTS'
|
|
15751
|
+
}] : [];
|
|
15752
|
+
return [].concat(baseFilters, dateFilters);
|
|
15753
|
+
}, [startDate, endDate, status]);
|
|
15754
|
+
var _useAxios = dmsComponentLibrary.useAxios({
|
|
15755
|
+
endpoint: '/v1/return/product/pending/',
|
|
15756
|
+
method: 'GET',
|
|
15757
|
+
filters: filters,
|
|
15758
|
+
pagination: pagination
|
|
15759
|
+
}),
|
|
15760
|
+
fetchedOrderData = _useAxios.data,
|
|
15761
|
+
returnDataLoad = _useAxios.loading,
|
|
15762
|
+
paginationData = _useAxios.paginationData,
|
|
15763
|
+
fetchData = _useAxios.fetchData;
|
|
15764
|
+
console.log(filters, 'outstanding filters');
|
|
15765
|
+
var hasFetchedRef = React.useRef(false);
|
|
15766
|
+
React.useEffect(function () {
|
|
15767
|
+
var shouldFetch = clientPortal && debouncedSearchText === '' && (filters == null ? void 0 : filters.length) > 0 && !hasFetchedRef.current;
|
|
15768
|
+
if (shouldFetch) {
|
|
15769
|
+
fetchData();
|
|
15770
|
+
hasFetchedRef.current = true;
|
|
15771
|
+
}
|
|
15772
|
+
}, [debouncedSearchText, filters, clientPortal]);
|
|
15773
|
+
React.useEffect(function () {
|
|
15774
|
+
hasFetchedRef.current = false;
|
|
15775
|
+
}, [debouncedSearchText, filters]);
|
|
15776
|
+
React.useEffect(function () {
|
|
15777
|
+
setLoading(returnDataLoad);
|
|
15778
|
+
if (fetchedOrderData && fetchedOrderData != null && fetchedOrderData.data) {
|
|
15779
|
+
setOutstandingReturnData(fetchedOrderData == null ? void 0 : fetchedOrderData.data);
|
|
15780
|
+
if (paginationData) {
|
|
15781
|
+
try {
|
|
15782
|
+
var _JSON$parse = JSON.parse(paginationData),
|
|
15783
|
+
count = _JSON$parse.count,
|
|
15784
|
+
rest = _objectWithoutPropertiesLoose(_JSON$parse, _excluded$a);
|
|
15785
|
+
setPaginationObject(rest);
|
|
15786
|
+
} catch (error) {
|
|
15787
|
+
console.error('Error parsing paginationData:', error);
|
|
15788
|
+
antd.notification.error({
|
|
15789
|
+
message: 'Error',
|
|
15790
|
+
description: 'Failed to parse pagination data'
|
|
15791
|
+
});
|
|
15792
|
+
}
|
|
15793
|
+
} else {
|
|
15794
|
+
antd.notification.error({
|
|
15795
|
+
message: 'Error',
|
|
15796
|
+
description: 'Pagination data is null or undefined'
|
|
15797
|
+
});
|
|
15798
|
+
}
|
|
15799
|
+
}
|
|
15800
|
+
}, [fetchedOrderData, returnDataLoad]);
|
|
15801
|
+
// console.log(modifiedFilters, 'modifiedFilters');
|
|
15802
|
+
React.useEffect(function () {
|
|
15803
|
+
setLoading(returnDataLoad);
|
|
15804
|
+
if (fetchedOrderData && fetchedOrderData != null && fetchedOrderData.data && locationData) {
|
|
15805
|
+
var updatedReturnData = fetchedOrderData.data.map(function (returnItem) {
|
|
15806
|
+
var matchingLocation = locationData.find(function (location) {
|
|
15807
|
+
return (location == null ? void 0 : location.token) === (returnItem == null ? void 0 : returnItem.return_location);
|
|
15808
|
+
});
|
|
15809
|
+
return _extends({}, returnItem, {
|
|
15810
|
+
new_location: matchingLocation ? matchingLocation == null ? void 0 : matchingLocation.location_name : null
|
|
15811
|
+
});
|
|
15812
|
+
});
|
|
15813
|
+
setOutstandingReturnData(updatedReturnData);
|
|
15814
|
+
}
|
|
15815
|
+
}, [fetchedOrderData, returnDataLoad, locationData, state, callForFetch]);
|
|
15816
|
+
//Client Portal
|
|
15817
|
+
var handleSelectOrderId = function handleSelectOrderId(id) {
|
|
15818
|
+
setSelectedOrderIds(function (prev) {
|
|
15819
|
+
return prev.includes(id) ? prev.filter(function (orderId) {
|
|
15820
|
+
return orderId !== id;
|
|
15821
|
+
}) : [].concat(prev, [id]);
|
|
15822
|
+
});
|
|
15823
|
+
};
|
|
15824
|
+
var handleClientSelectAll = function handleClientSelectAll(e) {
|
|
15825
|
+
var isChecked = e.target.checked;
|
|
15826
|
+
setSelectClientAll(isChecked);
|
|
15827
|
+
if (isChecked) {
|
|
15828
|
+
setSelectedOrderIds((outstandingReturnData == null ? void 0 : outstandingReturnData.map(function (item) {
|
|
15829
|
+
return item == null ? void 0 : item.order_id;
|
|
15830
|
+
})) || []);
|
|
15831
|
+
} else {
|
|
15832
|
+
setSelectedOrderIds([]);
|
|
15833
|
+
}
|
|
15834
|
+
};
|
|
15835
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(StyledTableWrapper$1, {
|
|
15836
|
+
className: "fortables"
|
|
15837
|
+
}, React__default.createElement(StyledTable$1, null, React__default.createElement("thead", null, React__default.createElement("tr", null, React__default.createElement("th", {
|
|
15838
|
+
className: "emailInvoiceCheckbox"
|
|
15839
|
+
}, React__default.createElement(dmsComponentLibrary.Checkbox, {
|
|
15840
|
+
checked: selectClientAll,
|
|
15841
|
+
onChange: handleClientSelectAll
|
|
15842
|
+
})), React__default.createElement("th", {
|
|
15843
|
+
onClick: function onClick() {
|
|
15844
|
+
return handleSort('return_location_name');
|
|
15845
|
+
}
|
|
15846
|
+
}, React__default.createElement("div", {
|
|
15847
|
+
className: "sortIconClass"
|
|
15848
|
+
}, "Return Location ", renderSortIcon('return_location_name'))), React__default.createElement("th", {
|
|
15849
|
+
onClick: function onClick() {
|
|
15850
|
+
return handleSort('recipient_name');
|
|
15851
|
+
}
|
|
15852
|
+
}, React__default.createElement("div", {
|
|
15853
|
+
className: "sortIconClass"
|
|
15854
|
+
}, "Recipient ", renderSortIcon('recipient_name'))), React__default.createElement("th", null, "Return Action"), React__default.createElement("th", null, "Code"), React__default.createElement("th", null, "Description"), React__default.createElement("th", null, "Part"), React__default.createElement("th", {
|
|
15855
|
+
onClick: function onClick() {
|
|
15856
|
+
return handleSort('weight');
|
|
15857
|
+
}
|
|
15858
|
+
}, React__default.createElement("div", {
|
|
15859
|
+
className: "sortIconClass"
|
|
15860
|
+
}, "Weight ", renderSortIcon('weight'))), React__default.createElement("th", null, "CBM"), React__default.createElement("th", {
|
|
15861
|
+
onClick: function onClick() {
|
|
15862
|
+
return handleSort('return_reason');
|
|
15863
|
+
}
|
|
15864
|
+
}, React__default.createElement("div", {
|
|
15865
|
+
className: "sortIconClass"
|
|
15866
|
+
}, "Return Reason ", renderSortIcon('return_reason'))), React__default.createElement("th", null, "Collected"), React__default.createElement("th", {
|
|
15867
|
+
onClick: function onClick() {
|
|
15868
|
+
return handleSort('collection_reason');
|
|
15869
|
+
}
|
|
15870
|
+
}, React__default.createElement("div", {
|
|
15871
|
+
className: "sortIconClass"
|
|
15872
|
+
}, "Collection Reason ", renderSortIcon('collection_reason'))), React__default.createElement("th", {
|
|
15873
|
+
className: "emailInvoiceShare"
|
|
15874
|
+
}, "Labels"))), React__default.createElement("tbody", null, load ? React__default.createElement("tr", null, React__default.createElement("td", {
|
|
15875
|
+
colSpan: 14
|
|
15876
|
+
}, React__default.createElement(antd.Skeleton, {
|
|
15877
|
+
active: true
|
|
15878
|
+
}))) : (sortedData == null ? void 0 : sortedData.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
|
|
15879
|
+
colSpan: 14
|
|
15880
|
+
}, React__default.createElement(EmptyDataContainer$1, null, React__default.createElement(antd.Empty, null)))) : sortedData == null ? void 0 : sortedData.map(function (item, index) {
|
|
15881
|
+
return React__default.createElement("tr", {
|
|
15882
|
+
key: item.id
|
|
15883
|
+
}, React__default.createElement("td", null, React__default.createElement(dmsComponentLibrary.Checkbox, {
|
|
15884
|
+
checked: selectedOrderIds.includes(item == null ? void 0 : item.order_id),
|
|
15885
|
+
onChange: function onChange() {
|
|
15886
|
+
return handleSelectOrderId(item == null ? void 0 : item.order_id);
|
|
15887
|
+
}
|
|
15888
|
+
})), React__default.createElement("td", null, " ", dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.return_location_name)), React__default.createElement("td", null, React__default.createElement("ul", {
|
|
15889
|
+
style: {
|
|
15890
|
+
listStyleType: 'none',
|
|
15891
|
+
padding: 0
|
|
15892
|
+
}
|
|
15893
|
+
}, React__default.createElement("li", {
|
|
15894
|
+
style: {
|
|
15895
|
+
color: '#0099ff',
|
|
15896
|
+
fontWeight: 600,
|
|
15897
|
+
paddingLeft: 0
|
|
15898
|
+
}
|
|
15899
|
+
}, React__default.createElement(reactRouterDom.NavLink, {
|
|
15900
|
+
to: "/orders/view/" + (item == null ? void 0 : item.order_id)
|
|
15901
|
+
}, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.recipient_name))), React__default.createElement("li", {
|
|
15902
|
+
style: {
|
|
15903
|
+
color: '#888075'
|
|
15904
|
+
}
|
|
15905
|
+
}, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.postcode)))), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.product_return_action)), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.code)), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.description)), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.part)), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.weight), ' ', item != null && item.weight && (item == null ? void 0 : item.weight) !== null ? 'KG' : ''), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.cube)), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.return_reason)), React__default.createElement("td", null, item != null && item.collected_at ? dateFns.format(new Date(item == null ? void 0 : item.collected_at), 'dd/MM/yyyy') : 'UNKNOWN'), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.collection_reason)), React__default.createElement("td", null, React__default.createElement("ul", {
|
|
15906
|
+
className: "actionbox"
|
|
15907
|
+
}, React__default.createElement(CustomDrop, {
|
|
15908
|
+
ref: dropdownRefParent,
|
|
15909
|
+
className: printToogle === index ? 'active' : ''
|
|
15910
|
+
}, React__default.createElement("li", {
|
|
15911
|
+
className: "shareIconContainer",
|
|
15912
|
+
onClick: function onClick() {
|
|
15913
|
+
return OpenDropDown(index);
|
|
15914
|
+
}
|
|
15915
|
+
}, React__default.createElement(PrinterIcon, null), React__default.createElement(DownIcon, null), printToogle === index && React__default.createElement("div", {
|
|
15916
|
+
ref: dropdownRef
|
|
15917
|
+
}, React__default.createElement(PrintDropDownReturn, {
|
|
15918
|
+
legacyURL: item == null ? void 0 : item.return_order_product_label,
|
|
15919
|
+
legacyProductID: item == null ? void 0 : item.legacy_product_id
|
|
15920
|
+
})))))));
|
|
15921
|
+
})))));
|
|
15922
|
+
};
|
|
15923
|
+
|
|
15924
|
+
var ReturnConfirmedTable = function ReturnConfirmedTable() {
|
|
15925
|
+
var dropdownRefParent = React.useRef(null);
|
|
15926
|
+
var dropdownRef = React.useRef(null);
|
|
15927
|
+
var _usePrintOptionTOggle = usePrintOptionTOggle(),
|
|
15928
|
+
printToogle = _usePrintOptionTOggle[0],
|
|
15929
|
+
setPrintToggle = _usePrintOptionTOggle[1];
|
|
15930
|
+
var _useOrderId = useOrderId(),
|
|
15931
|
+
setOrderId = _useOrderId[1];
|
|
15932
|
+
var _useReturnConfirmedOr = useReturnConfirmedOrderData(),
|
|
15933
|
+
returnConfirmedTable = _useReturnConfirmedOr[0];
|
|
15934
|
+
var _useLoading = useLoading(),
|
|
15935
|
+
loading = _useLoading[0];
|
|
15936
|
+
var _useState = React.useState(false),
|
|
15937
|
+
selectClientAll = _useState[0],
|
|
15938
|
+
setSelectClientAll = _useState[1];
|
|
15939
|
+
var _useSelectedClientAft = useSelectedClientAfterOrders(),
|
|
15940
|
+
selectedOrderIds = _useSelectedClientAft[0],
|
|
15941
|
+
setSelectedOrderIds = _useSelectedClientAft[1];
|
|
15942
|
+
//sorting
|
|
15943
|
+
var _useState2 = React.useState(null),
|
|
15944
|
+
sortConfig = _useState2[0],
|
|
15945
|
+
setSortConfig = _useState2[1];
|
|
15946
|
+
var handleSort = function handleSort(key) {
|
|
15947
|
+
setSortConfig(function (prev) {
|
|
15948
|
+
if ((prev == null ? void 0 : prev.key) === key && prev.direction === 'asc') {
|
|
15949
|
+
return {
|
|
15950
|
+
key: key,
|
|
15951
|
+
direction: 'desc'
|
|
15952
|
+
};
|
|
15953
|
+
}
|
|
15954
|
+
return {
|
|
15955
|
+
key: key,
|
|
15956
|
+
direction: 'asc'
|
|
15957
|
+
};
|
|
15958
|
+
});
|
|
15959
|
+
};
|
|
15960
|
+
var sortedData = React.useMemo(function () {
|
|
15961
|
+
if (!returnConfirmedTable || !sortConfig) return returnConfirmedTable;
|
|
15962
|
+
var key = sortConfig.key,
|
|
15963
|
+
direction = sortConfig.direction;
|
|
15964
|
+
return [].concat(returnConfirmedTable).sort(function (a, b) {
|
|
15965
|
+
var valueA = a[key];
|
|
15966
|
+
var valueB = b[key];
|
|
15967
|
+
if (typeof valueA === 'number' && typeof valueB === 'number') {
|
|
15968
|
+
return direction === 'asc' ? valueA - valueB : valueB - valueA;
|
|
15969
|
+
}
|
|
15970
|
+
if (typeof valueA === 'string' && typeof valueB === 'string') {
|
|
15971
|
+
return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
|
|
15972
|
+
}
|
|
15973
|
+
return 0;
|
|
15974
|
+
});
|
|
15975
|
+
}, [returnConfirmedTable, sortConfig]);
|
|
15976
|
+
var renderSortIcon = function renderSortIcon(columnKey) {
|
|
15977
|
+
if (!sortConfig || sortConfig.key !== columnKey) {
|
|
15978
|
+
return React__default.createElement(SortIcon, null);
|
|
15979
|
+
}
|
|
15980
|
+
return sortConfig.direction === 'asc' ? React__default.createElement(CaretDownFilledIcon, null) : React__default.createElement(CaretDownFilledIcon, null);
|
|
15981
|
+
};
|
|
15982
|
+
var OpenDropDown = function OpenDropDown(index) {
|
|
15983
|
+
setPrintToggle(function (prevIndex) {
|
|
15984
|
+
return prevIndex === index ? null : index;
|
|
15985
|
+
});
|
|
15986
|
+
};
|
|
15987
|
+
// Close dropdown outside click
|
|
15988
|
+
React.useEffect(function () {
|
|
15989
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
15990
|
+
return function () {
|
|
15991
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
15992
|
+
};
|
|
15993
|
+
}, []);
|
|
15994
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
15995
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
15996
|
+
setPrintToggle(null);
|
|
15997
|
+
}
|
|
15998
|
+
};
|
|
15999
|
+
// const handleSelectAll = (e: any) => {
|
|
16000
|
+
// setSelectAll(e.target.checked);
|
|
16001
|
+
// if (e.target.checked) {
|
|
16002
|
+
// setSelectedReturnOrder(
|
|
16003
|
+
// returnAfterOrder.map((e: any) => ({
|
|
16004
|
+
// id: e.id,
|
|
16005
|
+
// status_id: 3,
|
|
16006
|
+
// }))
|
|
16007
|
+
// );
|
|
16008
|
+
// } else {
|
|
16009
|
+
// setSelectedReturnOrder([]);
|
|
16010
|
+
// }
|
|
16011
|
+
// };
|
|
16012
|
+
// const handleSelectInvoice = (id: any) => {
|
|
16013
|
+
// setSelectedReturnOrder((prevSelectedInvoices: any) => {
|
|
16014
|
+
// const isSelected = prevSelectedInvoices?.some(
|
|
16015
|
+
// (item: any) => item.id === id
|
|
16016
|
+
// );
|
|
16017
|
+
// if (isSelected) {
|
|
16018
|
+
// return prevSelectedInvoices.filter((items: any) => items.id !== id);
|
|
16019
|
+
// } else {
|
|
16020
|
+
// return [...prevSelectedInvoices, { id, status_id: 3 }];
|
|
16021
|
+
// }
|
|
16022
|
+
// });
|
|
16023
|
+
// };
|
|
16024
|
+
var getStatusClass = function getStatusClass(status) {
|
|
16025
|
+
switch (status) {
|
|
16026
|
+
case 'Cancelled':
|
|
16027
|
+
return {
|
|
16028
|
+
color: '#E95252',
|
|
16029
|
+
background: 'rgba(233, 82, 82, 0.15)'
|
|
16030
|
+
};
|
|
16031
|
+
case 'On Hold':
|
|
16032
|
+
return {
|
|
16033
|
+
color: '#F4A503',
|
|
16034
|
+
background: '#FFF1D6'
|
|
16035
|
+
};
|
|
16036
|
+
case 'Sub-Contracted':
|
|
16037
|
+
return {
|
|
16038
|
+
color: '#F4A503',
|
|
16039
|
+
background: '#FFF1D6'
|
|
16040
|
+
};
|
|
16041
|
+
case 'Awaiting route':
|
|
16042
|
+
return {
|
|
16043
|
+
color: '#845ADF',
|
|
16044
|
+
background: 'rgba(132, 90, 223, 0.15)'
|
|
16045
|
+
};
|
|
16046
|
+
case 'Awaiting':
|
|
16047
|
+
return {
|
|
16048
|
+
color: '#845ADF',
|
|
16049
|
+
background: 'rgba(132, 90, 223, 0.15)'
|
|
16050
|
+
};
|
|
16051
|
+
case 'Completed':
|
|
16052
|
+
return {
|
|
16053
|
+
color: '#1F9254',
|
|
16054
|
+
background: 'rgba(41, 204, 106, 0.15)'
|
|
16055
|
+
};
|
|
16056
|
+
case 'Outstanding':
|
|
16057
|
+
return {
|
|
16058
|
+
color: '#FF9900',
|
|
16059
|
+
background: 'rgba(255, 153, 0, 0.15)'
|
|
16060
|
+
};
|
|
16061
|
+
case 'Routed':
|
|
16062
|
+
return {
|
|
16063
|
+
color: '#6396E5',
|
|
16064
|
+
background: 'rgba(99, 150, 229, 0.15)'
|
|
16065
|
+
};
|
|
16066
|
+
default:
|
|
16067
|
+
return {
|
|
16068
|
+
color: '#000',
|
|
16069
|
+
background: '#fff'
|
|
16070
|
+
};
|
|
16071
|
+
}
|
|
16072
|
+
};
|
|
16073
|
+
// API for Assign
|
|
16074
|
+
// const {
|
|
16075
|
+
// data: actionResponse,
|
|
16076
|
+
// setShouldPerformAction: setAssignAction,
|
|
16077
|
+
// error: apiError,
|
|
16078
|
+
// } = useApiHook<{
|
|
16079
|
+
// data: ApiResponse[];
|
|
16080
|
+
// }>({
|
|
16081
|
+
// endpoint: `return_orders/update/assign/`,
|
|
16082
|
+
// method: 'PUT',
|
|
16083
|
+
// body: [assignPayload],
|
|
16084
|
+
// performAction: false,
|
|
16085
|
+
// });
|
|
16086
|
+
//client options
|
|
16087
|
+
// const assignOptions = assignData?.map((option: any) => ({
|
|
16088
|
+
// label: option?.type?.charAt(0)?.toUpperCase() + option?.type?.slice(1),
|
|
16089
|
+
// value: option?.bjs_delivery,
|
|
16090
|
+
// }));
|
|
16091
|
+
// const handleAssignPayload = (Id: number, value: boolean) => {
|
|
16092
|
+
// setCallAPi(false);
|
|
16093
|
+
// setAssign(value);
|
|
16094
|
+
// setAssignPayload({
|
|
16095
|
+
// ...assignPayload,
|
|
16096
|
+
// return_order_id: Id,
|
|
16097
|
+
// bjs_delivery: value,
|
|
16098
|
+
// });
|
|
16099
|
+
// setAssignAction(true);
|
|
16100
|
+
// };
|
|
16101
|
+
// useEffect(() => {
|
|
16102
|
+
// //@ts-ignore
|
|
16103
|
+
// if (actionResponse?.code === 200) {
|
|
16104
|
+
// setCallAPi(true);
|
|
16105
|
+
// notification.success({
|
|
16106
|
+
// message: 'Success',
|
|
16107
|
+
// // @ts-ignore
|
|
16108
|
+
// description: `${actionResponse?.message}`,
|
|
16109
|
+
// });
|
|
16110
|
+
// // @ts-ignore
|
|
16111
|
+
// } else if (apiError?.detail) {
|
|
16112
|
+
// notification.error({
|
|
16113
|
+
// message: 'Failure',
|
|
16114
|
+
// // @ts-ignore
|
|
16115
|
+
// description: `${apiError?.detail[0]?.msg}`,
|
|
16116
|
+
// });
|
|
16117
|
+
// }
|
|
16118
|
+
// }, [actionResponse, apiError]);
|
|
16119
|
+
var handleSelectOrderId = function handleSelectOrderId(id) {
|
|
16120
|
+
setSelectedOrderIds(function (prev) {
|
|
16121
|
+
return prev.includes(id) ? prev.filter(function (orderId) {
|
|
16122
|
+
return orderId !== id;
|
|
16123
|
+
}) : [].concat(prev, [id]);
|
|
16124
|
+
});
|
|
16125
|
+
};
|
|
16126
|
+
var handleClientSelectAll = function handleClientSelectAll(e) {
|
|
16127
|
+
var isChecked = e.target.checked;
|
|
16128
|
+
setSelectClientAll(isChecked);
|
|
16129
|
+
if (isChecked) {
|
|
16130
|
+
setSelectedOrderIds((returnConfirmedTable == null ? void 0 : returnConfirmedTable.map(function (item) {
|
|
16131
|
+
return item == null ? void 0 : item.id;
|
|
16132
|
+
})) || []);
|
|
16133
|
+
} else {
|
|
16134
|
+
setSelectedOrderIds([]);
|
|
16135
|
+
}
|
|
16136
|
+
};
|
|
16137
|
+
console.log('selectedOrderIds===>', selectedOrderIds);
|
|
16138
|
+
console.log('returnConfirmedTable=====>', returnConfirmedTable);
|
|
16139
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(StyledTableWrapper$1, {
|
|
16140
|
+
className: "fortables"
|
|
16141
|
+
}, React__default.createElement(StyledTable$1, null, React__default.createElement("thead", null, React__default.createElement("tr", null, React__default.createElement("th", {
|
|
16142
|
+
className: "emailInvoiceCheckbox"
|
|
16143
|
+
}, React__default.createElement(dmsComponentLibrary.Checkbox, {
|
|
16144
|
+
checked: selectClientAll,
|
|
16145
|
+
onChange: handleClientSelectAll
|
|
16146
|
+
})), React__default.createElement("th", {
|
|
16147
|
+
onClick: function onClick() {
|
|
16148
|
+
return handleSort('created_at');
|
|
16149
|
+
}
|
|
16150
|
+
}, React__default.createElement("div", {
|
|
16151
|
+
className: "sortIconClass"
|
|
16152
|
+
}, "Created ", renderSortIcon('created_at'))), React__default.createElement("th", {
|
|
16153
|
+
onClick: function onClick() {
|
|
16154
|
+
return handleSort('return_location_name');
|
|
16155
|
+
}
|
|
16156
|
+
}, React__default.createElement("div", {
|
|
16157
|
+
className: "sortIconClass"
|
|
16158
|
+
}, "Return Location ", renderSortIcon('return_location_name'))), React__default.createElement("th", {
|
|
16159
|
+
onClick: function onClick() {
|
|
16160
|
+
return handleSort('recipient_name');
|
|
16161
|
+
}
|
|
16162
|
+
}, React__default.createElement("div", {
|
|
16163
|
+
className: "sortIconClass"
|
|
16164
|
+
}, "Recipient ", renderSortIcon('recipient_name'))), React__default.createElement("th", null, " Client"), React__default.createElement("th", null, "Consignment"), React__default.createElement("th", null, "Return Order No"), React__default.createElement("th", null, " Total Parts"), React__default.createElement("th", {
|
|
16165
|
+
onClick: function onClick() {
|
|
16166
|
+
return handleSort('weight');
|
|
16167
|
+
}
|
|
16168
|
+
}, React__default.createElement("div", {
|
|
16169
|
+
className: "sortIconClass"
|
|
16170
|
+
}, "Total Weight ", renderSortIcon('weight'))), React__default.createElement("th", {
|
|
16171
|
+
onClick: function onClick() {
|
|
16172
|
+
return handleSort('cube');
|
|
16173
|
+
}
|
|
16174
|
+
}, React__default.createElement("div", {
|
|
16175
|
+
className: "sortIconClass"
|
|
16176
|
+
}, "Total CBM ", renderSortIcon('cube'))), React__default.createElement("th", null, "Status"), React__default.createElement("th", {
|
|
16177
|
+
className: "emailInvoiceShare"
|
|
16178
|
+
}, "Labels"))), React__default.createElement("tbody", null, loading ? React__default.createElement("tr", null, React__default.createElement("td", {
|
|
16179
|
+
colSpan: 16
|
|
16180
|
+
}, React__default.createElement(antd.Skeleton, {
|
|
16181
|
+
active: true
|
|
16182
|
+
})), React__default.createElement("td", {
|
|
16183
|
+
colSpan: 16
|
|
16184
|
+
})) : (sortedData == null ? void 0 : sortedData.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
|
|
16185
|
+
colSpan: 16
|
|
16186
|
+
}, React__default.createElement(EmptyDataContainer$1, null, React__default.createElement(antd.Empty, null)))) : sortedData == null ? void 0 : sortedData.map(function (item, index) {
|
|
16187
|
+
var statusMapping = {
|
|
16188
|
+
cancelled: 'Cancelled',
|
|
16189
|
+
'on hold': 'On Hold',
|
|
16190
|
+
SC: 'Sub-Contracted',
|
|
16191
|
+
'awaiting route': 'Awaiting',
|
|
16192
|
+
'awaiting confirmation': 'Awaiting',
|
|
16193
|
+
complete: 'Completed',
|
|
16194
|
+
outstanding: 'Outstanding',
|
|
16195
|
+
routed: 'Routed',
|
|
16196
|
+
failed: 'Failed'
|
|
16197
|
+
};
|
|
16198
|
+
var status = statusMapping[item == null ? void 0 : item.status_value] || 'Unknown';
|
|
16199
|
+
var statusClass = getStatusClass(status);
|
|
16200
|
+
return React__default.createElement("tr", {
|
|
16201
|
+
key: item.id
|
|
16202
|
+
}, React__default.createElement("td", null, React__default.createElement(dmsComponentLibrary.Checkbox, {
|
|
16203
|
+
checked: selectedOrderIds.includes(item == null ? void 0 : item.id),
|
|
16204
|
+
onChange: function onChange() {
|
|
16205
|
+
return handleSelectOrderId(item == null ? void 0 : item.id);
|
|
16206
|
+
}
|
|
16207
|
+
})), React__default.createElement("td", null, formatDate(new Date(item == null ? void 0 : item.created_at))), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.return_location_name)), React__default.createElement("td", {
|
|
16208
|
+
onClick: function onClick() {
|
|
16209
|
+
return setOrderId(item.id);
|
|
16210
|
+
}
|
|
16211
|
+
}, React__default.createElement("ul", {
|
|
16212
|
+
style: {
|
|
16213
|
+
listStyleType: 'none',
|
|
16214
|
+
padding: 0
|
|
16215
|
+
}
|
|
16216
|
+
}, React__default.createElement("li", {
|
|
16217
|
+
style: {
|
|
16218
|
+
color: '#0099ff',
|
|
16219
|
+
fontWeight: 600,
|
|
16220
|
+
paddingLeft: 0
|
|
16221
|
+
}
|
|
16222
|
+
}, React__default.createElement(reactRouterDom.NavLink, {
|
|
16223
|
+
to: "../" + item.id
|
|
16224
|
+
}, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.recipient_name))), React__default.createElement("li", {
|
|
16225
|
+
style: {
|
|
16226
|
+
color: '#888075'
|
|
16227
|
+
}
|
|
16228
|
+
}, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.postcode)))), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.customer_name)), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.consignment)), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.order_number)), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.total_products)), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.weight), ' ', item != null && item.weight && (item == null ? void 0 : item.weight) > 0 ? 'KG' : ''), React__default.createElement("td", null, dmsComponentLibrary.displayValueOrNA(item == null ? void 0 : item.cube)), React__default.createElement("td", null, React__default.createElement("ul", {
|
|
16229
|
+
className: "statuscontainer",
|
|
16230
|
+
style: {
|
|
16231
|
+
listStyleType: 'none',
|
|
16232
|
+
background: statusClass.background
|
|
16233
|
+
}
|
|
16234
|
+
}, React__default.createElement("li", {
|
|
16235
|
+
className: "statustext",
|
|
16236
|
+
style: {
|
|
16237
|
+
color: statusClass.color
|
|
16238
|
+
}
|
|
16239
|
+
}, status))), React__default.createElement("td", null, React__default.createElement("ul", {
|
|
16240
|
+
className: "actionbox"
|
|
16241
|
+
}, React__default.createElement(CustomDrop, {
|
|
16242
|
+
ref: dropdownRefParent,
|
|
16243
|
+
className: printToogle === index ? 'active' : ''
|
|
16244
|
+
}, React__default.createElement("li", {
|
|
16245
|
+
className: "shareIconContainer",
|
|
16246
|
+
onClick: function onClick() {
|
|
16247
|
+
return OpenDropDown(index);
|
|
16248
|
+
}
|
|
16249
|
+
}, React__default.createElement(PrinterIcon, null), React__default.createElement(DownIcon, null), printToogle === index && React__default.createElement("div", {
|
|
16250
|
+
ref: dropdownRef
|
|
16251
|
+
}, React__default.createElement(PrintDropDown, {
|
|
16252
|
+
legacyProductId: item
|
|
16253
|
+
})))))));
|
|
16254
|
+
})))));
|
|
16255
|
+
};
|
|
16256
|
+
|
|
16257
|
+
var _templateObject$2z, _templateObject2$1X;
|
|
16258
|
+
var _excluded$b = ["count"];
|
|
16259
|
+
var ConfirmedMain = function ConfirmedMain() {
|
|
16260
|
+
var _useReturnConfirmedOr = useReturnConfirmedOrderData(),
|
|
16261
|
+
setReturnConfirmedData = _useReturnConfirmedOr[1];
|
|
16262
|
+
var _useLoading = useLoading(),
|
|
16263
|
+
setLoading = _useLoading[1];
|
|
16264
|
+
var _useAtom = jotai.useAtom(filtersReducerReturnAtom),
|
|
16265
|
+
state = _useAtom[0];
|
|
16266
|
+
// const [callApi] = useCallApiAgain();
|
|
16267
|
+
var filters = state['x-filters'],
|
|
16268
|
+
pagination = state['x-pagination'];
|
|
16269
|
+
var _UsePaginationReturnD = UsePaginationReturnData(),
|
|
16270
|
+
paginationObj = _UsePaginationReturnD[0];
|
|
16271
|
+
var _useState = React.useState(1),
|
|
16272
|
+
setCurrentPage = _useState[1];
|
|
16273
|
+
var _useItemsPerReturnPag = useItemsPerReturnPage(),
|
|
16274
|
+
itemsPerPage = _useItemsPerReturnPag[0],
|
|
16275
|
+
setItemsPerPage = _useItemsPerReturnPag[1];
|
|
16276
|
+
var _UsePaginationData = UsePaginationData(),
|
|
16277
|
+
setPaginationObject = _UsePaginationData[1];
|
|
16278
|
+
var page = paginationObj.page,
|
|
16279
|
+
total = paginationObj.total;
|
|
16280
|
+
var _useSearchAfterText = useSearchAfterText(),
|
|
16281
|
+
debouncedSearchText = _useSearchAfterText[0];
|
|
16282
|
+
var handlePageChange = function handlePageChange(page) {
|
|
16283
|
+
setCurrentPage(page);
|
|
16284
|
+
};
|
|
16285
|
+
var handleItemsPerPageChange = function handleItemsPerPageChange(itemsPerPage) {
|
|
16286
|
+
setItemsPerPage(itemsPerPage);
|
|
16287
|
+
};
|
|
16288
|
+
var _useParams = reactRouterDom.useParams(),
|
|
16289
|
+
status = _useParams.status;
|
|
16290
|
+
var _useAxios = dmsComponentLibrary.useAxios({
|
|
16291
|
+
endpoint: '/v1/return/orders/',
|
|
16292
|
+
method: 'GET',
|
|
16293
|
+
filters: filters && (filters == null ? void 0 : filters.length) > 0 ? filters : undefined,
|
|
16294
|
+
pagination: pagination
|
|
16295
|
+
}),
|
|
16296
|
+
fetchedReturnOrderData = _useAxios.data,
|
|
16297
|
+
loading = _useAxios.loading,
|
|
16298
|
+
paginationData = _useAxios.paginationData,
|
|
16299
|
+
fetchData = _useAxios.fetchData;
|
|
16300
|
+
React.useEffect(function () {
|
|
16301
|
+
var shouldFetch = debouncedSearchText === '' && (filters == null ? void 0 : filters.length) > 0;
|
|
16302
|
+
if (shouldFetch) {
|
|
16303
|
+
fetchData();
|
|
16304
|
+
}
|
|
16305
|
+
}, [debouncedSearchText, status, JSON.stringify(filters)]);
|
|
16306
|
+
React.useEffect(function () {
|
|
16307
|
+
setLoading(loading);
|
|
16308
|
+
if (fetchedReturnOrderData != null && fetchedReturnOrderData.data) {
|
|
16309
|
+
setReturnConfirmedData(fetchedReturnOrderData == null ? void 0 : fetchedReturnOrderData.data);
|
|
16310
|
+
if (paginationData) {
|
|
16311
|
+
try {
|
|
16312
|
+
var _JSON$parse = JSON.parse(paginationData),
|
|
16313
|
+
count = _JSON$parse.count,
|
|
16314
|
+
rest = _objectWithoutPropertiesLoose(_JSON$parse, _excluded$b);
|
|
16315
|
+
setPaginationObject(rest);
|
|
16316
|
+
} catch (error) {
|
|
16317
|
+
antd.notification.error({
|
|
16318
|
+
message: 'Error',
|
|
16319
|
+
description: 'Failed to parse pagination data'
|
|
16320
|
+
});
|
|
16321
|
+
}
|
|
16322
|
+
}
|
|
16323
|
+
}
|
|
16324
|
+
}, [fetchedReturnOrderData, loading]);
|
|
16325
|
+
return React__default.createElement("div", null, React__default.createElement(DashBoardWrapper$4, null, React__default.createElement("div", {
|
|
16326
|
+
className: "Tableconatiner"
|
|
16327
|
+
}, React__default.createElement(Container$1c, null, React__default.createElement(ReturnConfirmedTable, null), total > 0 && React__default.createElement(ReturnPagination, {
|
|
16328
|
+
currentPage: page,
|
|
16329
|
+
totalItems: total,
|
|
16330
|
+
itemsPerPage: itemsPerPage,
|
|
16331
|
+
onPageChange: handlePageChange,
|
|
16332
|
+
onItemsPerPageChange: handleItemsPerPageChange
|
|
16333
|
+
})))));
|
|
16334
|
+
};
|
|
16335
|
+
var Container$1c = /*#__PURE__*/styled__default.div(_templateObject$2z || (_templateObject$2z = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n /* top: -30px; */\n"])));
|
|
16336
|
+
var DashBoardWrapper$4 = /*#__PURE__*/styled__default.section(_templateObject2$1X || (_templateObject2$1X = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .Tableconatiner {\n border-radius: 12px;\n background: #fff;\n box-shadow: -2px 0px 12px 0px rgba(56, 71, 109, 0.1);\n display: block;\n padding: 15px 20px;\n }\n .headerWrap,\n .tableData,\n .styleCovered {\n transition: all ease 0.5s;\n }\n &.stickyTableHead {\n h2 {\n font-size: 21px;\n }\n .headerWrap {\n height: 84px;\n padding: 10px;\n border-radius: 0px 0px 15px 15px;\n > div {\n position: relative;\n z-index: 10;\n }\n }\n .styleCovered {\n margin-top: -32px;\n width: 67%;\n float: right;\n gap: 5px;\n padding-right: 11px;\n\n li {\n padding: 4px 10px 5px 5px;\n gap: 5px;\n .svgCover {\n width: 30px;\n height: 30px;\n svg {\n height: auto;\n width: 58%;\n }\n }\n .countDigit {\n font-size: 19px;\n }\n }\n .countMess {\n font-size: 13px;\n }\n }\n .dmsBulkFilter {\n min-height: unset;\n gap: 4px;\n > div {\n padding: 4px 12px;\n label {\n font-size: 11px;\n }\n }\n }\n\n .StyledFilterList {\n gap: 4px;\n li {\n height: 29px;\n padding: 3px 8px;\n gap: 4px;\n .StyledFilterBtnIcon {\n width: 20px;\n height: 20px;\n svh {\n width: 10px;\n height: auto;\n }\n }\n .StyledFilterBtnLabel {\n font-size: 13px;\n }\n }\n }\n .StyledFilterLabel {\n padding-left: 10px;\n span {\n font-size: 13px;\n }\n }\n .cardcontainer.tableData {\n max-height: calc(100vh - 310px);\n min-height: calc(100vh - 310px);\n }\n\n .tableData {\n max-height: calc(100vh - 320px);\n min-height: calc(100vh - 320px);\n\n margin-top: 8px;\n thead {\n position: sticky;\n top: 0;\n z-index: 9;\n th {\n font-size: 13px;\n padding: 2px 15px;\n }\n }\n }\n }\n"])));
|
|
16337
|
+
|
|
16338
|
+
var _templateObject$2A, _templateObject2$1Y;
|
|
16339
|
+
var ReturnOverview = function ReturnOverview() {
|
|
16340
|
+
var _UsePaginationData = UsePaginationData(),
|
|
16341
|
+
paginationObj = _UsePaginationData[0];
|
|
16342
|
+
var _useState = React.useState(1),
|
|
16343
|
+
setCurrentPage = _useState[1];
|
|
16344
|
+
var _useItemsPerPage = useItemsPerPage(),
|
|
16345
|
+
itemsPerPage = _useItemsPerPage[0],
|
|
16346
|
+
setItemsPerPage = _useItemsPerPage[1];
|
|
16347
|
+
var page = paginationObj.page,
|
|
16348
|
+
total = paginationObj.total;
|
|
16349
|
+
var _useParams = reactRouterDom.useParams(),
|
|
16350
|
+
status = _useParams.status;
|
|
16351
|
+
var _useClientPortal = useClientPortal(),
|
|
16352
|
+
clientPortal = _useClientPortal[0];
|
|
16353
|
+
var handlePageChange = function handlePageChange(page) {
|
|
16354
|
+
setCurrentPage(page);
|
|
16355
|
+
};
|
|
16356
|
+
var handleItemsPerPageChange = function handleItemsPerPageChange(itemsPerPage) {
|
|
16357
|
+
setItemsPerPage(itemsPerPage);
|
|
16358
|
+
};
|
|
16359
|
+
console.log(status, 'status');
|
|
16360
|
+
var shouldShowReturnAfterTable = clientPortal && status === 'scheduled_for_return' || clientPortal && status === 'return_completed';
|
|
16361
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(RouterHeader, null), React__default.createElement("div", null, React__default.createElement(DashBoardWrapper$5, null, React__default.createElement("div", {
|
|
16362
|
+
className: "Tableconatiner"
|
|
16363
|
+
}, React__default.createElement(HeaderFilter, null), React__default.createElement(Container$1d, null, React__default.createElement(ReturnFilter, null), clientPortal && status === 'outstanding_return' && React__default.createElement(React__default.Fragment, null, React__default.createElement(OutstandingTable, null), total > 0 && React__default.createElement(Pagination, {
|
|
16364
|
+
currentPage: page,
|
|
16365
|
+
totalItems: total,
|
|
16366
|
+
itemsPerPage: itemsPerPage,
|
|
16367
|
+
onPageChange: handlePageChange,
|
|
16368
|
+
onItemsPerPageChange: handleItemsPerPageChange
|
|
16369
|
+
})), shouldShowReturnAfterTable && React__default.createElement(React__default.Fragment, null, React__default.createElement(ConfirmedMain, null)))))));
|
|
16370
|
+
};
|
|
16371
|
+
var Container$1d = /*#__PURE__*/styled__default.div(_templateObject$2A || (_templateObject$2A = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n top: -16px;\n"])));
|
|
16372
|
+
var DashBoardWrapper$5 = /*#__PURE__*/styled__default.section(_templateObject2$1Y || (_templateObject2$1Y = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .Tableconatiner {\n border-radius: 12px;\n background: #fff;\n box-shadow: -2px 0px 12px 0px rgba(56, 71, 109, 0.1);\n display: block;\n padding: 15px 20px;\n }\n .headerWrap,\n .tableData,\n .styleCovered {\n transition: all ease 0.5s;\n }\n &.stickyTableHead {\n h2 {\n font-size: 21px;\n }\n .headerWrap {\n height: 84px;\n padding: 10px;\n border-radius: 0px 0px 15px 15px;\n > div {\n position: relative;\n z-index: 10;\n }\n }\n .styleCovered {\n margin-top: -32px;\n width: 67%;\n float: right;\n gap: 5px;\n padding-right: 11px;\n\n li {\n padding: 4px 10px 5px 5px;\n gap: 5px;\n .svgCover {\n width: 30px;\n height: 30px;\n svg {\n height: auto;\n width: 58%;\n }\n }\n .countDigit {\n font-size: 19px;\n }\n }\n .countMess {\n font-size: 13px;\n }\n }\n .dmsBulkFilter {\n min-height: unset;\n gap: 4px;\n > div {\n padding: 4px 12px;\n label {\n font-size: 11px;\n }\n }\n }\n\n .StyledFilterList {\n gap: 4px;\n li {\n height: 29px;\n padding: 3px 8px;\n gap: 4px;\n .StyledFilterBtnIcon {\n width: 20px;\n height: 20px;\n svh {\n width: 10px;\n height: auto;\n }\n }\n .StyledFilterBtnLabel {\n font-size: 13px;\n }\n }\n }\n .StyledFilterLabel {\n padding-left: 10px;\n span {\n font-size: 13px;\n }\n }\n .cardcontainer.tableData {\n max-height: calc(100vh - 310px);\n min-height: calc(100vh - 310px);\n }\n\n .tableData {\n max-height: calc(100vh - 320px);\n min-height: calc(100vh - 320px);\n\n margin-top: 8px;\n thead {\n position: sticky;\n top: 0;\n z-index: 9;\n th {\n font-size: 13px;\n padding: 2px 15px;\n }\n }\n }\n }\n"])));
|
|
15564
16373
|
|
|
15565
16374
|
function ReturnClient() {
|
|
15566
16375
|
antd.notification.config({
|