@bjsdistribution/dms-client-return 0.0.33 → 0.0.34
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/order-daily-overview/store/store.d.ts +3 -0
- package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
- package/dist/components/store.d.ts +12 -2
- package/dist/components/types.d.ts +4 -0
- package/dist/dms-client-return.cjs.development.js +619 -345
- 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 +623 -349
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +118 -139
- package/src/components/order-daily-overview/header-filters/filterStore.ts +4 -4
- package/src/components/order-daily-overview/index.tsx +29 -25
- package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +14 -10
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +88 -32
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +18 -2
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +18 -7
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +2 -3
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +6 -4
- package/src/components/order-daily-overview/store/store.ts +15 -0
- package/src/components/order-daily-overview/table/ReturnTable.tsx +16 -11
- package/src/components/order-daily-overview/table/table-data/styles.ts +1 -1
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +3 -3
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.tsx +1 -1
- package/src/components/order-view/general-information/dropdowns/Print.tsx +1 -1
- package/src/components/order-view/modalsPopup/ModalManager.tsx +3 -9
- package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +88 -13
- package/src/components/order-view/products-info/expanded-content/index.tsx +91 -16
- package/src/components/order-view/products-info/index.tsx +1 -1
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +47 -42
- package/src/components/store.ts +51 -1
- package/src/components/types.ts +5 -0
- package/src/index.tsx +25 -16
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useEffect, useState, useMemo,
|
|
2
|
-
import { useLocation,
|
|
1
|
+
import React, { useEffect, useState, useMemo, useRef, Suspense } from 'react';
|
|
2
|
+
import { useLocation, useNavigate, NavLink, Routes, Route } from 'react-router-dom';
|
|
3
3
|
import styled, { keyframes, css } from 'styled-components';
|
|
4
|
-
import { Label as Label$h, Input as Input$1, TextArea, FormSection, displayValueOrNA as displayValueOrNA$1, SelectDropdown, dropdownStyles, RadioButtonGroup as RadioButtonGroup$1, Switch, getBaseEndpoint, Button, useApiHook, formatDateTime, Checkbox as Checkbox$1,
|
|
4
|
+
import { Label as Label$h, Input as Input$1, TextArea, FormSection, displayValueOrNA as displayValueOrNA$1, SelectDropdown, dropdownStyles, RadioButtonGroup as RadioButtonGroup$1, Switch, getBaseEndpoint, Button, useApiHook, formatDateTime, Checkbox as Checkbox$1, SectionHeader, CrossIcon, AntSelect, Alert, CustomRating, AntTable, CancelationModal, CancelAndCompleteAction, filterDropdownStyles, BackgroundModal as BackgroundModal$1, AntModal } from '@bjsdistribution/dms-component-library';
|
|
5
5
|
import { useAtom, atom } from 'jotai';
|
|
6
6
|
import { atomWithReducer } from 'jotai/utils';
|
|
7
|
-
import { DatePicker, notification, Skeleton, Upload, message, Empty, Input as Input$2
|
|
7
|
+
import { DatePicker, notification, Skeleton, Select, Upload, message, Empty, Input as Input$2 } from 'antd';
|
|
8
8
|
import dayjs from 'dayjs';
|
|
9
9
|
import { useReactTable, getCoreRowModel, getSortedRowModel, flexRender } from '@tanstack/react-table';
|
|
10
10
|
import Scrollbars from 'react-custom-scrollbars-2';
|
|
@@ -679,10 +679,6 @@ var deleteProdId = /*#__PURE__*/atom([]);
|
|
|
679
679
|
function useDeleteProdsID() {
|
|
680
680
|
return useAtom(deleteProdId);
|
|
681
681
|
}
|
|
682
|
-
var createOrderProduct = /*#__PURE__*/atom([]);
|
|
683
|
-
function useCreateOrderProducts() {
|
|
684
|
-
return useAtom(createOrderProduct);
|
|
685
|
-
}
|
|
686
682
|
var errorAtom = /*#__PURE__*/atom({
|
|
687
683
|
homeContactError: '',
|
|
688
684
|
workCOntanctError: '',
|
|
@@ -3473,6 +3469,21 @@ var ActionIcon = function ActionIcon() {
|
|
|
3473
3469
|
}));
|
|
3474
3470
|
};
|
|
3475
3471
|
|
|
3472
|
+
var _templateObject$U, _templateObject2$G, _templateObject3$m, _templateObject4$a, _templateObject5$5, _templateObject6$3, _templateObject7$3;
|
|
3473
|
+
function Loader(props) {
|
|
3474
|
+
return React.createElement(MainContainer$6, {
|
|
3475
|
+
id: "loder"
|
|
3476
|
+
}, React.createElement(Container$B, null, React.createElement(Spinner, null), React.createElement(Wrapper$b, null, React.createElement(Title, null, props.title || 'Loading...'), React.createElement(Subtitle, null, props.subtitle || "Sit tight - won't be long!"))));
|
|
3477
|
+
}
|
|
3478
|
+
var rotate = /*#__PURE__*/keyframes(_templateObject$U || (_templateObject$U = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n"])));
|
|
3479
|
+
// Styled components for the loading spinner
|
|
3480
|
+
var Spinner = /*#__PURE__*/styled.div(_templateObject2$G || (_templateObject2$G = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 4px solid rgb(0 0 0 / 50%);\n border-left-color: #feba30;\n border-radius: 50%;\n width: 50px;\n height: 50px;\n animation: ", " 1s linear infinite;\n"])), rotate);
|
|
3481
|
+
var Container$B = /*#__PURE__*/styled.div(_templateObject3$m || (_templateObject3$m = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: 25px;\n align-items: center;\n flex-direction: column;\n text-align: center;\n"])));
|
|
3482
|
+
var Subtitle = /*#__PURE__*/styled.span(_templateObject4$a || (_templateObject4$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n font-size: 25px;\n text-transform: capitalize;\n font-weight: bold;\n"])));
|
|
3483
|
+
var Title = /*#__PURE__*/styled.span(_templateObject5$5 || (_templateObject5$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n font-size: 25px;\n text-transform: capitalize;\n font-weight: bold;\n"])));
|
|
3484
|
+
var Wrapper$b = /*#__PURE__*/styled.div(_templateObject6$3 || (_templateObject6$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 20px;\n"])));
|
|
3485
|
+
var MainContainer$6 = /*#__PURE__*/styled.div(_templateObject7$3 || (_templateObject7$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 9999;\n background-color: rgba(0, 0, 0, 0.3);\n backdrop-filter: blur(5px);\n display: flex;\n justify-content: center;\n align-items: center;\n"])));
|
|
3486
|
+
|
|
3476
3487
|
var CreateReturnInitial = {
|
|
3477
3488
|
customer_id: 0,
|
|
3478
3489
|
account_number: '',
|
|
@@ -3480,6 +3491,10 @@ var CreateReturnInitial = {
|
|
|
3480
3491
|
products: [],
|
|
3481
3492
|
return_action: []
|
|
3482
3493
|
};
|
|
3494
|
+
var AssignUpdateInitial = {
|
|
3495
|
+
return_order_id: 0,
|
|
3496
|
+
bjs_delivery: false
|
|
3497
|
+
};
|
|
3483
3498
|
var customerData = /*#__PURE__*/atom([]);
|
|
3484
3499
|
var actionTypeData = /*#__PURE__*/atom([]);
|
|
3485
3500
|
var locationData = /*#__PURE__*/atom([]);
|
|
@@ -3492,6 +3507,11 @@ var selectAll = /*#__PURE__*/atom(false);
|
|
|
3492
3507
|
var postLoading = /*#__PURE__*/atom(false);
|
|
3493
3508
|
var _final = /*#__PURE__*/atom([]);
|
|
3494
3509
|
var clearState = /*#__PURE__*/atom(false);
|
|
3510
|
+
var assignData = /*#__PURE__*/atom([]);
|
|
3511
|
+
var assignPayload = /*#__PURE__*/atom(AssignUpdateInitial);
|
|
3512
|
+
var callAPIAgain = /*#__PURE__*/atom(true);
|
|
3513
|
+
var actionTypeOptions = /*#__PURE__*/atom([]);
|
|
3514
|
+
var selectedProductsMove = /*#__PURE__*/atom([]);
|
|
3495
3515
|
var selectedOrderlList = /*#__PURE__*/atom([]);
|
|
3496
3516
|
function useSelectedOrders() {
|
|
3497
3517
|
return useAtom(selectedOrderlList);
|
|
@@ -3537,26 +3557,27 @@ function useFinalPayload() {
|
|
|
3537
3557
|
function useClearState() {
|
|
3538
3558
|
return useAtom(clearState);
|
|
3539
3559
|
}
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3560
|
+
function useAssignData() {
|
|
3561
|
+
return useAtom(assignData);
|
|
3562
|
+
}
|
|
3563
|
+
function useAssignPayload() {
|
|
3564
|
+
return useAtom(assignPayload);
|
|
3565
|
+
}
|
|
3566
|
+
function useCallApiAgain() {
|
|
3567
|
+
return useAtom(callAPIAgain);
|
|
3568
|
+
}
|
|
3569
|
+
function useActionTypeOptions() {
|
|
3570
|
+
return useAtom(actionTypeOptions);
|
|
3571
|
+
}
|
|
3572
|
+
function useSelectedProducts() {
|
|
3573
|
+
return useAtom(selectedProductsMove);
|
|
3546
3574
|
}
|
|
3547
|
-
var rotate = /*#__PURE__*/keyframes(_templateObject$U || (_templateObject$U = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n"])));
|
|
3548
|
-
// Styled components for the loading spinner
|
|
3549
|
-
var Spinner = /*#__PURE__*/styled.div(_templateObject2$G || (_templateObject2$G = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 4px solid rgb(0 0 0 / 50%);\n border-left-color: #feba30;\n border-radius: 50%;\n width: 50px;\n height: 50px;\n animation: ", " 1s linear infinite;\n"])), rotate);
|
|
3550
|
-
var Container$B = /*#__PURE__*/styled.div(_templateObject3$m || (_templateObject3$m = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: 25px;\n align-items: center;\n flex-direction: column;\n text-align: center;\n"])));
|
|
3551
|
-
var Subtitle = /*#__PURE__*/styled.span(_templateObject4$a || (_templateObject4$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n font-size: 25px;\n text-transform: capitalize;\n font-weight: bold;\n"])));
|
|
3552
|
-
var Title = /*#__PURE__*/styled.span(_templateObject5$5 || (_templateObject5$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n font-size: 25px;\n text-transform: capitalize;\n font-weight: bold;\n"])));
|
|
3553
|
-
var Wrapper$b = /*#__PURE__*/styled.div(_templateObject6$3 || (_templateObject6$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 20px;\n"])));
|
|
3554
|
-
var MainContainer$6 = /*#__PURE__*/styled.div(_templateObject7$3 || (_templateObject7$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 9999;\n background-color: rgba(0, 0, 0, 0.3);\n backdrop-filter: blur(5px);\n display: flex;\n justify-content: center;\n align-items: center;\n"])));
|
|
3555
3575
|
|
|
3556
3576
|
var ReturnProductTable = function ReturnProductTable() {
|
|
3557
3577
|
var _orderStaticData$retu;
|
|
3558
|
-
var
|
|
3559
|
-
|
|
3578
|
+
var _useSelectedProducts = useSelectedProducts(),
|
|
3579
|
+
selectedProducts = _useSelectedProducts[0],
|
|
3580
|
+
setSelectedProducts = _useSelectedProducts[1];
|
|
3560
3581
|
var _useState = useState(false),
|
|
3561
3582
|
selectAll = _useState[0],
|
|
3562
3583
|
setSelectAll = _useState[1];
|
|
@@ -3568,9 +3589,9 @@ var ReturnProductTable = function ReturnProductTable() {
|
|
|
3568
3589
|
setSelectedRowId = _useState2[1];
|
|
3569
3590
|
var _useOrderId = useOrderId(),
|
|
3570
3591
|
orderId = _useOrderId[0];
|
|
3571
|
-
var handleActionClick =
|
|
3592
|
+
var handleActionClick = function handleActionClick(id) {
|
|
3572
3593
|
setSelectedRowId(id);
|
|
3573
|
-
}
|
|
3594
|
+
};
|
|
3574
3595
|
var _useApiHook = useApiHook({
|
|
3575
3596
|
endpoint: "order/order_products/delete/",
|
|
3576
3597
|
method: 'DELETE',
|
|
@@ -3581,21 +3602,19 @@ var ReturnProductTable = function ReturnProductTable() {
|
|
|
3581
3602
|
performAction: false
|
|
3582
3603
|
}),
|
|
3583
3604
|
isresponse = _useApiHook.data,
|
|
3584
|
-
|
|
3605
|
+
setAction = _useApiHook.setShouldPerformAction,
|
|
3585
3606
|
loading = _useApiHook.loading;
|
|
3586
3607
|
useEffect(function () {
|
|
3587
3608
|
if (isresponse && isresponse.data) {
|
|
3588
3609
|
notification.success({
|
|
3589
3610
|
message: 'Success',
|
|
3590
|
-
description:
|
|
3591
|
-
//@ts-ignore
|
|
3592
|
-
(isresponse == null ? void 0 : isresponse.message) || 'An error has occurred. Please try again later.'
|
|
3611
|
+
description: 'An error has occurred. Please try again later.'
|
|
3593
3612
|
});
|
|
3594
3613
|
handleRemoveRow();
|
|
3595
3614
|
setSelectedRowId(null);
|
|
3596
3615
|
}
|
|
3597
3616
|
}, [isresponse]);
|
|
3598
|
-
var handleRemoveRow =
|
|
3617
|
+
var handleRemoveRow = function handleRemoveRow() {
|
|
3599
3618
|
if (selectedRowId !== null) {
|
|
3600
3619
|
setProductData(function (prevData) {
|
|
3601
3620
|
return prevData.filter(function (item) {
|
|
@@ -3603,16 +3622,28 @@ var ReturnProductTable = function ReturnProductTable() {
|
|
|
3603
3622
|
});
|
|
3604
3623
|
});
|
|
3605
3624
|
}
|
|
3606
|
-
}
|
|
3607
|
-
var onDeleteProducts =
|
|
3608
|
-
|
|
3609
|
-
}
|
|
3610
|
-
var handleSelectAll =
|
|
3611
|
-
|
|
3612
|
-
|
|
3625
|
+
};
|
|
3626
|
+
var onDeleteProducts = function onDeleteProducts() {
|
|
3627
|
+
setAction(true);
|
|
3628
|
+
};
|
|
3629
|
+
var handleSelectAll = function handleSelectAll() {
|
|
3630
|
+
if (selectAll) {
|
|
3631
|
+
setSelectedProducts([]);
|
|
3632
|
+
} else {
|
|
3633
|
+
var allProductIds = productData.map(function (product) {
|
|
3634
|
+
return product.id;
|
|
3635
|
+
});
|
|
3636
|
+
setSelectedProducts(allProductIds);
|
|
3637
|
+
}
|
|
3638
|
+
setSelectAll(!selectAll);
|
|
3639
|
+
};
|
|
3640
|
+
var handleSelectProduct = function handleSelectProduct(id) {
|
|
3641
|
+
setSelectedProducts(function (prevSelected) {
|
|
3642
|
+
return prevSelected.includes(id) ? prevSelected.filter(function (selectedId) {
|
|
3643
|
+
return selectedId !== id;
|
|
3644
|
+
}) : [].concat(prevSelected, [id]);
|
|
3613
3645
|
});
|
|
3614
|
-
}
|
|
3615
|
-
// const returnreason =
|
|
3646
|
+
};
|
|
3616
3647
|
var _useOrderStaticData = useOrderStaticData(),
|
|
3617
3648
|
orderStaticData = _useOrderStaticData[0];
|
|
3618
3649
|
var returnReasonsOptions = orderStaticData == null || (_orderStaticData$retu = orderStaticData.return_reasons) == null ? void 0 : _orderStaticData$retu.map(function (option) {
|
|
@@ -3625,34 +3656,30 @@ var ReturnProductTable = function ReturnProductTable() {
|
|
|
3625
3656
|
var matchedReason = returnReasonsOptions == null ? void 0 : returnReasonsOptions.find(function (option) {
|
|
3626
3657
|
return option.value === returnReasonId;
|
|
3627
3658
|
});
|
|
3628
|
-
return matchedReason ? matchedReason.label : 'N/A';
|
|
3659
|
+
return matchedReason ? matchedReason.label : 'N/A';
|
|
3629
3660
|
};
|
|
3630
3661
|
return React.createElement("div", null, loading && React.createElement(Loader, {
|
|
3631
3662
|
title: "Deleting"
|
|
3632
3663
|
}), React.createElement(StyledTableWrapper, {
|
|
3633
|
-
id: "tableScrolling"
|
|
3664
|
+
id: "tableScrolling",
|
|
3665
|
+
className: "orderProductTable"
|
|
3634
3666
|
}, React.createElement(StyledTable$1, null, React.createElement("thead", null, React.createElement("tr", null, React.createElement("th", {
|
|
3635
|
-
className: "
|
|
3667
|
+
className: "emailproductsCheckbox"
|
|
3636
3668
|
}, React.createElement(Checkbox$1, {
|
|
3637
3669
|
checked: selectAll,
|
|
3638
|
-
onChange: handleSelectAll
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
cursor: 'not-allowed'
|
|
3642
|
-
}
|
|
3643
|
-
})), React.createElement("th", null, "Location"), React.createElement("th", null, "Sender"), React.createElement("th", null, "Code"), React.createElement("th", null, "Description"), React.createElement("th", null, "Return Reason"), React.createElement("th", null, "Part"), React.createElement("th", null, "Action"))), React.createElement("tbody", null, productData && productData.length > 0 ? productData.map(function (invoice) {
|
|
3670
|
+
onChange: handleSelectAll
|
|
3671
|
+
})), React.createElement("th", null, "Location"), React.createElement("th", null, "Sender"), React.createElement("th", null, "Code"), React.createElement("th", null, "Description"), React.createElement("th", null, "Return Reason"), React.createElement("th", null, "Part"), React.createElement("th", null, "Action"))), React.createElement("tbody", null, productData && (productData == null ? void 0 : productData.length) > 0 ? productData == null ? void 0 : productData.map(function (product) {
|
|
3672
|
+
var _product$orders_produ, _product$order_data, _product$order_data2;
|
|
3644
3673
|
return React.createElement("tr", {
|
|
3645
|
-
key:
|
|
3674
|
+
key: product.id
|
|
3646
3675
|
}, React.createElement("td", null, React.createElement(Checkbox$1, {
|
|
3647
|
-
checked:
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
style: {
|
|
3651
|
-
cursor: 'not-allowed'
|
|
3676
|
+
checked: selectedProducts == null ? void 0 : selectedProducts.includes(product == null ? void 0 : product.id),
|
|
3677
|
+
onChange: function onChange() {
|
|
3678
|
+
return handleSelectProduct(product == null ? void 0 : product.id);
|
|
3652
3679
|
}
|
|
3653
|
-
})), React.createElement("td", null, 'N/A'), React.createElement("td", null, '
|
|
3680
|
+
})), React.createElement("td", null, (product == null || (_product$orders_produ = product.orders_products_stock) == null ? void 0 : _product$orders_produ.location) || 'N/A'), React.createElement("td", null, product == null || (_product$order_data = product.order_data) == null || (_product$order_data = _product$order_data.order_recipient) == null ? void 0 : _product$order_data.recipient_name, ' ', product == null || (_product$order_data2 = product.order_data) == null || (_product$order_data2 = _product$order_data2.order_recipient) == null ? void 0 : _product$order_data2.postcode), React.createElement("td", null, product == null ? void 0 : product.code), React.createElement("td", null, product == null ? void 0 : product.description), React.createElement("td", null, getReturnReasonLabel(product == null ? void 0 : product.return_reason_id)), React.createElement("td", null, "1 of 1"), React.createElement("td", null, React.createElement("div", {
|
|
3654
3681
|
onClick: function onClick() {
|
|
3655
|
-
handleActionClick(
|
|
3682
|
+
handleActionClick(product == null ? void 0 : product.id);
|
|
3656
3683
|
onDeleteProducts();
|
|
3657
3684
|
},
|
|
3658
3685
|
style: {
|
|
@@ -3674,47 +3701,189 @@ var ProductTable = function ProductTable() {
|
|
|
3674
3701
|
var Container$C = /*#__PURE__*/styled.div(_templateObject$V || (_templateObject$V = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n /* height: 230px; */\n overflow: auto; /* Enable scrolling */\n scrollbar-width: thin;\n"])));
|
|
3675
3702
|
|
|
3676
3703
|
var _templateObject$W, _templateObject2$H;
|
|
3704
|
+
var payloadAtom = /*#__PURE__*/atom(null);
|
|
3677
3705
|
var NewReturnDropdown = function NewReturnDropdown() {
|
|
3678
3706
|
var defaultSelectStyle = {
|
|
3679
3707
|
width: '100%'
|
|
3680
3708
|
};
|
|
3681
3709
|
var defaultPopupClassName = 'dropDownStyle';
|
|
3682
|
-
var
|
|
3683
|
-
|
|
3684
|
-
|
|
3710
|
+
var _useState = useState([]),
|
|
3711
|
+
returnOrderData = _useState[0],
|
|
3712
|
+
setReturnOrderData = _useState[1];
|
|
3713
|
+
var _useState2 = useState(null),
|
|
3714
|
+
selectedOrderId = _useState2[0],
|
|
3715
|
+
setSelectedOrderId = _useState2[1];
|
|
3716
|
+
var _useSelectedProducts = useSelectedProducts(),
|
|
3717
|
+
selectedProducts = _useSelectedProducts[0];
|
|
3718
|
+
var _useOrderDetails = useOrderDetails(),
|
|
3719
|
+
orderData = _useOrderDetails[0];
|
|
3720
|
+
var _useAtom = useAtom(payloadAtom),
|
|
3721
|
+
setPayload = _useAtom[1];
|
|
3722
|
+
var _useProductDetails = useProductDetails(),
|
|
3723
|
+
productData = _useProductDetails[0];
|
|
3724
|
+
var _useState3 = useState(),
|
|
3725
|
+
idProduct = _useState3[0],
|
|
3726
|
+
setId = _useState3[1];
|
|
3727
|
+
var id = orderData == null ? void 0 : orderData.customer_id;
|
|
3728
|
+
useEffect(function () {
|
|
3729
|
+
var allProductIds = (productData == null ? void 0 : productData.map(function (product) {
|
|
3730
|
+
return product.return_location;
|
|
3731
|
+
})) || [];
|
|
3732
|
+
setId(allProductIds);
|
|
3733
|
+
}, [productData]);
|
|
3734
|
+
var filters = [{
|
|
3735
|
+
field: 'customer_id',
|
|
3736
|
+
op: '=',
|
|
3737
|
+
value: id
|
|
3738
|
+
}, {
|
|
3739
|
+
field: 'is_deleted',
|
|
3740
|
+
op: '=',
|
|
3741
|
+
value: 0
|
|
3742
|
+
}, {
|
|
3743
|
+
field: 'status',
|
|
3744
|
+
op: '!=',
|
|
3745
|
+
value: 'SD'
|
|
3746
|
+
}];
|
|
3747
|
+
if ((idProduct == null ? void 0 : idProduct.length) > 0 && idProduct[0]) {
|
|
3748
|
+
filters.push({
|
|
3749
|
+
field: 'return_order_products.return_location',
|
|
3750
|
+
op: '=',
|
|
3751
|
+
value: idProduct[0]
|
|
3752
|
+
});
|
|
3753
|
+
}
|
|
3754
|
+
var _useApiHook = useApiHook({
|
|
3755
|
+
endpoint: '/return_orders/?skip_filters=0',
|
|
3756
|
+
method: 'GET',
|
|
3757
|
+
filters: filters,
|
|
3758
|
+
//@ts-ignore
|
|
3759
|
+
pagination: {
|
|
3760
|
+
is_pagination: false
|
|
3761
|
+
},
|
|
3762
|
+
performAction: false
|
|
3763
|
+
}),
|
|
3764
|
+
fetchedReturnOrderData = _useApiHook.data,
|
|
3765
|
+
setShouldPerformAction = _useApiHook.setShouldPerformAction;
|
|
3766
|
+
useEffect(function () {
|
|
3767
|
+
if (id && (idProduct == null ? void 0 : idProduct.length) > 0 && idProduct[0]) {
|
|
3768
|
+
setShouldPerformAction(true);
|
|
3769
|
+
}
|
|
3770
|
+
}, [id, idProduct, setShouldPerformAction]);
|
|
3771
|
+
useEffect(function () {
|
|
3772
|
+
if (fetchedReturnOrderData && fetchedReturnOrderData != null && fetchedReturnOrderData.data && id !== null) {
|
|
3773
|
+
setReturnOrderData(fetchedReturnOrderData == null ? void 0 : fetchedReturnOrderData.data);
|
|
3774
|
+
}
|
|
3775
|
+
}, [fetchedReturnOrderData, id]);
|
|
3776
|
+
useEffect(function () {
|
|
3777
|
+
if (selectedOrderId && (selectedProducts == null ? void 0 : selectedProducts.length) > 0) {
|
|
3778
|
+
var newPayload = {
|
|
3779
|
+
new_return_order: selectedOrderId,
|
|
3780
|
+
products: selectedProducts
|
|
3781
|
+
};
|
|
3782
|
+
setPayload(newPayload);
|
|
3783
|
+
}
|
|
3784
|
+
}, [selectedOrderId, selectedProducts, setPayload]);
|
|
3785
|
+
var handleDropdownChange = function handleDropdownChange(value) {
|
|
3786
|
+
setSelectedOrderId(value);
|
|
3787
|
+
};
|
|
3788
|
+
var dropdownOptions = returnOrderData == null ? void 0 : returnOrderData.map(function (order) {
|
|
3789
|
+
return {
|
|
3790
|
+
label: order.order_recipient.recipient_name + " - " + order.order_recipient.postcode,
|
|
3791
|
+
value: order.id
|
|
3792
|
+
};
|
|
3793
|
+
});
|
|
3794
|
+
return React.createElement(Container$D, null, React.createElement(Text$3, null, "New Return Order:"), React.createElement(Select, {
|
|
3795
|
+
options: dropdownOptions,
|
|
3685
3796
|
placeholder: "Select",
|
|
3686
|
-
onChange:
|
|
3687
|
-
defaultValue: 'Current Return Order' ,
|
|
3797
|
+
onChange: handleDropdownChange,
|
|
3688
3798
|
style: defaultSelectStyle,
|
|
3689
3799
|
disabled: false,
|
|
3690
|
-
// onSearch={handleSearch}
|
|
3691
3800
|
showSearch: true,
|
|
3692
|
-
|
|
3693
|
-
|
|
3801
|
+
dropdownStyle: {
|
|
3802
|
+
width: 'max-content'
|
|
3803
|
+
},
|
|
3804
|
+
popupClassName: defaultPopupClassName
|
|
3694
3805
|
}));
|
|
3695
3806
|
};
|
|
3696
|
-
var Container$D = /*#__PURE__*/styled.div(_templateObject$W || (_templateObject$W = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 10px;\n align-self: stretch;\n"])));
|
|
3697
|
-
var Text$3 = /*#__PURE__*/styled.div(_templateObject2$H || (_templateObject2$H = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #000;\n
|
|
3807
|
+
var Container$D = /*#__PURE__*/styled.div(_templateObject$W || (_templateObject$W = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 10px;\n align-self: stretch;\n white-space: nowrap;\n"])));
|
|
3808
|
+
var Text$3 = /*#__PURE__*/styled.div(_templateObject2$H || (_templateObject2$H = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #000;\n font-family: 'Lato';\n font-size: 13px;\n font-weight: 400;\n line-height: 16px;\n"])));
|
|
3698
3809
|
|
|
3699
3810
|
var _templateObject$X, _templateObject2$I, _templateObject3$n;
|
|
3700
|
-
// import { notification } from 'antd';
|
|
3701
3811
|
function ExpandedContent$2() {
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3812
|
+
var _response$data, _response$data2;
|
|
3813
|
+
var _useAtom = useAtom(payloadAtom),
|
|
3814
|
+
payload = _useAtom[0];
|
|
3815
|
+
var _usePostLoading = usePostLoading(),
|
|
3816
|
+
setPostLoading = _usePostLoading[1];
|
|
3817
|
+
var _useOrderId = useOrderId(),
|
|
3818
|
+
orderId = _useOrderId[0];
|
|
3819
|
+
var _useState = useState(true),
|
|
3820
|
+
isButtonDisabled = _useState[0],
|
|
3821
|
+
setIsButtonDisabled = _useState[1];
|
|
3822
|
+
var navigate = useNavigate();
|
|
3823
|
+
var _useSelectedProducts = useSelectedProducts(),
|
|
3824
|
+
setSelectedProducts = _useSelectedProducts[1];
|
|
3825
|
+
var _useApiHook = useApiHook({
|
|
3826
|
+
endpoint: "return_order_products/move/" + orderId,
|
|
3827
|
+
method: 'POST',
|
|
3828
|
+
body: payload,
|
|
3829
|
+
performAction: false
|
|
3830
|
+
}),
|
|
3831
|
+
response = _useApiHook.data,
|
|
3832
|
+
setShouldPerformAction = _useApiHook.setShouldPerformAction,
|
|
3833
|
+
confirmLoading = _useApiHook.loading;
|
|
3834
|
+
useEffect(function () {
|
|
3835
|
+
setPostLoading(confirmLoading);
|
|
3836
|
+
}, [confirmLoading, setPostLoading]);
|
|
3837
|
+
useEffect(function () {
|
|
3838
|
+
var _payload$products;
|
|
3839
|
+
if (payload != null && payload.new_return_order && (payload == null || (_payload$products = payload.products) == null ? void 0 : _payload$products.length) > 0) {
|
|
3840
|
+
setIsButtonDisabled(false);
|
|
3841
|
+
} else {
|
|
3842
|
+
setIsButtonDisabled(true);
|
|
3843
|
+
}
|
|
3844
|
+
}, [payload]);
|
|
3845
|
+
var handleConfirmReturn = function handleConfirmReturn() {
|
|
3846
|
+
if (!isButtonDisabled) {
|
|
3847
|
+
setShouldPerformAction(true);
|
|
3848
|
+
setPostLoading(confirmLoading);
|
|
3849
|
+
} else {
|
|
3850
|
+
console.error('Payload is incomplete:', payload);
|
|
3851
|
+
}
|
|
3852
|
+
};
|
|
3853
|
+
var newId = Array.isArray(response == null ? void 0 : response.data) ? //@ts-ignore
|
|
3854
|
+
response == null || (_response$data = response.data) == null || (_response$data = _response$data[0]) == null ? void 0 : _response$data.id : //@ts-ignore
|
|
3855
|
+
response == null || (_response$data2 = response.data) == null ? void 0 : _response$data2.id;
|
|
3856
|
+
useEffect(function () {
|
|
3857
|
+
//@ts-ignore
|
|
3858
|
+
if ((response == null ? void 0 : response.code) === 200) {
|
|
3859
|
+
notification.success({
|
|
3860
|
+
message: 'Success',
|
|
3861
|
+
//@ts-ignore
|
|
3862
|
+
description: (response == null ? void 0 : response.message) || 'Products moved successfully'
|
|
3863
|
+
});
|
|
3864
|
+
setSelectedProducts([]);
|
|
3865
|
+
} else if (response) {
|
|
3866
|
+
notification.error({
|
|
3867
|
+
message: 'Error',
|
|
3868
|
+
//@ts-ignore
|
|
3869
|
+
description: (response == null ? void 0 : response.message) || 'Error while moving products'
|
|
3870
|
+
});
|
|
3871
|
+
}
|
|
3872
|
+
//@ts-ignore
|
|
3873
|
+
if ((response == null ? void 0 : response.code) === 200 && newId) {
|
|
3874
|
+
navigate("details/" + newId);
|
|
3875
|
+
setSelectedProducts([]);
|
|
3876
|
+
}
|
|
3877
|
+
}, [response, newId, navigate, setSelectedProducts]);
|
|
3878
|
+
return React.createElement(Container$E, null, React.createElement(ProductTable, null), React.createElement(MidContainer, null, React.createElement(SaveNoteContainer$1, null, React.createElement(Button, {
|
|
3710
3879
|
style: {
|
|
3711
3880
|
borderRadius: '20px'
|
|
3712
3881
|
},
|
|
3713
|
-
onClick:
|
|
3714
|
-
disabled:
|
|
3882
|
+
onClick: handleConfirmReturn,
|
|
3883
|
+
disabled: isButtonDisabled
|
|
3715
3884
|
}, "Move Products"), React.createElement(NewReturnDropdown, null))));
|
|
3716
3885
|
}
|
|
3717
|
-
var
|
|
3886
|
+
var MidContainer = /*#__PURE__*/styled.div(_templateObject$X || (_templateObject$X = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n padding: 10px 15px;\n align-items: flex-start;\n border-top: 1px solid #edebe8;\n background: #f8fafc;\n margin: 0px -15px -15px -15px;\n border-radius: 0px 0px 8px 8px;\n margin-bottom: 22px;\n"])));
|
|
3718
3887
|
var SaveNoteContainer$1 = /*#__PURE__*/styled.div(_templateObject2$I || (_templateObject2$I = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-flex;\n gap: 10px;\n"])));
|
|
3719
3888
|
var Container$E = /*#__PURE__*/styled.div(_templateObject3$n || (_templateObject3$n = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
|
|
3720
3889
|
|
|
@@ -3753,6 +3922,10 @@ var selectedClient = /*#__PURE__*/atom(null);
|
|
|
3753
3922
|
function useSelectedClient() {
|
|
3754
3923
|
return useAtom(selectedClient);
|
|
3755
3924
|
}
|
|
3925
|
+
var clientTableId = /*#__PURE__*/atom(null);
|
|
3926
|
+
function useIdForTableName() {
|
|
3927
|
+
return useAtom(clientTableId);
|
|
3928
|
+
}
|
|
3756
3929
|
var clientTableName = /*#__PURE__*/atom(null);
|
|
3757
3930
|
function useTableName() {
|
|
3758
3931
|
return useAtom(clientTableName);
|
|
@@ -3783,6 +3956,14 @@ var atomItemsPerReturnPage = /*#__PURE__*/atom(50);
|
|
|
3783
3956
|
var useItemsPerReturnPage = function useItemsPerReturnPage() {
|
|
3784
3957
|
return useAtom(atomItemsPerReturnPage);
|
|
3785
3958
|
};
|
|
3959
|
+
//stats data overview
|
|
3960
|
+
var UsePaginationOverviewData = function UsePaginationOverviewData() {
|
|
3961
|
+
return useAtom(atomPaginationData);
|
|
3962
|
+
};
|
|
3963
|
+
var atomItemsPerOverviewPage = /*#__PURE__*/atom(50);
|
|
3964
|
+
var useItemsPerOverviewPage = function useItemsPerOverviewPage() {
|
|
3965
|
+
return useAtom(atomItemsPerOverviewPage);
|
|
3966
|
+
};
|
|
3786
3967
|
var countStatus = /*#__PURE__*/atom([]);
|
|
3787
3968
|
var useCountData = function useCountData() {
|
|
3788
3969
|
return useAtom(countStatus);
|
|
@@ -3808,7 +3989,7 @@ function ProductsInfo() {
|
|
|
3808
3989
|
var _useLoading = useLoading(),
|
|
3809
3990
|
setLoading = _useLoading[1];
|
|
3810
3991
|
var _useApiHook = useApiHook({
|
|
3811
|
-
endpoint: "/
|
|
3992
|
+
endpoint: "return_order_products/" + customerData.id,
|
|
3812
3993
|
method: 'GET',
|
|
3813
3994
|
performAction: false
|
|
3814
3995
|
}),
|
|
@@ -8069,11 +8250,10 @@ var OptionsDropDown = function OptionsDropDown() {
|
|
|
8069
8250
|
setIsOpen = _useState[1];
|
|
8070
8251
|
var dropdownRef = useRef(null);
|
|
8071
8252
|
var _useCurrentAction = useCurrentAction(),
|
|
8072
|
-
action = _useCurrentAction[0],
|
|
8073
8253
|
setCurrentAction = _useCurrentAction[1];
|
|
8074
8254
|
var _useIsOnHoldOrder = useIsOnHoldOrder(),
|
|
8075
8255
|
hold = _useIsOnHoldOrder[0];
|
|
8076
|
-
console.log(action, 'action');
|
|
8256
|
+
// console.log(action, 'action');
|
|
8077
8257
|
var handleClick = function handleClick() {
|
|
8078
8258
|
setIsOpen(function (prev) {
|
|
8079
8259
|
return !prev;
|
|
@@ -8087,7 +8267,6 @@ var OptionsDropDown = function OptionsDropDown() {
|
|
|
8087
8267
|
}
|
|
8088
8268
|
});
|
|
8089
8269
|
var handleSelect = function handleSelect(selectedOption) {
|
|
8090
|
-
console.log(selectedOption);
|
|
8091
8270
|
setCurrentAction(selectedOption);
|
|
8092
8271
|
setIsOpen(false);
|
|
8093
8272
|
};
|
|
@@ -8164,7 +8343,7 @@ function Print() {
|
|
|
8164
8343
|
orderDetails = _useOrderDetails[0];
|
|
8165
8344
|
var gsitId = orderDetails == null ? void 0 : orderDetails.gsit_order_id;
|
|
8166
8345
|
var dropdownRef = useRef(null);
|
|
8167
|
-
console.log(gsitId, 'gsitId');
|
|
8346
|
+
// console.log(gsitId, 'gsitId');
|
|
8168
8347
|
var _useState = useState(false),
|
|
8169
8348
|
isOpen = _useState[0],
|
|
8170
8349
|
setIsOpen = _useState[1];
|
|
@@ -8552,7 +8731,11 @@ var ApplyButton = /*#__PURE__*/styled.button(_templateObject14$2 || (_templateOb
|
|
|
8552
8731
|
|
|
8553
8732
|
// let todayDate = new Date();
|
|
8554
8733
|
var initialState$1 = {
|
|
8555
|
-
'x-filters': [
|
|
8734
|
+
'x-filters': [{
|
|
8735
|
+
field: 'isdeleted',
|
|
8736
|
+
op: '=',
|
|
8737
|
+
value: 0
|
|
8738
|
+
}],
|
|
8556
8739
|
'x-pagination': {
|
|
8557
8740
|
page: 1,
|
|
8558
8741
|
per_page: 50
|
|
@@ -8591,9 +8774,9 @@ var filterReducer = function filterReducer(state, action) {
|
|
|
8591
8774
|
case 'SET_ACTIONS_FILTER':
|
|
8592
8775
|
return _extends({}, state, {
|
|
8593
8776
|
'x-filters': [].concat(state['x-filters'].filter(function (f) {
|
|
8594
|
-
return f.field !== '
|
|
8777
|
+
return f.field !== 'order_product_return_action.type';
|
|
8595
8778
|
}), [{
|
|
8596
|
-
field: '
|
|
8779
|
+
field: 'order_product_return_action.type',
|
|
8597
8780
|
op: '=',
|
|
8598
8781
|
value: action.payload
|
|
8599
8782
|
}])
|
|
@@ -8617,7 +8800,7 @@ var filterReducer = function filterReducer(state, action) {
|
|
|
8617
8800
|
case 'CLEAR_ACTION':
|
|
8618
8801
|
return _extends({}, state, {
|
|
8619
8802
|
'x-filters': state['x-filters'].filter(function (f) {
|
|
8620
|
-
return f.field !== '
|
|
8803
|
+
return f.field !== 'order_product_return_action.type';
|
|
8621
8804
|
})
|
|
8622
8805
|
});
|
|
8623
8806
|
case 'CLEAR_LOC':
|
|
@@ -8657,15 +8840,6 @@ var _templateObject$1R;
|
|
|
8657
8840
|
function SelectionFilter() {
|
|
8658
8841
|
var _useCustomerData = useCustomerData(),
|
|
8659
8842
|
customers = _useCustomerData[0];
|
|
8660
|
-
var _useActionType = useActionType(),
|
|
8661
|
-
actionType = _useActionType[0];
|
|
8662
|
-
var _useLocationData = useLocationData(),
|
|
8663
|
-
locationData = _useLocationData[0];
|
|
8664
|
-
var _useState = useState([]),
|
|
8665
|
-
filteredLocationOptions = _useState[0],
|
|
8666
|
-
setFilteredLocationOptions = _useState[1];
|
|
8667
|
-
var _useState2 = useState(),
|
|
8668
|
-
setUuid = _useState2[1];
|
|
8669
8843
|
var _useSelectedAction = useSelectedAction(),
|
|
8670
8844
|
selectedFilterValue = _useSelectedAction[0],
|
|
8671
8845
|
setSelectedFilterValue = _useSelectedAction[1];
|
|
@@ -8675,138 +8849,115 @@ function SelectionFilter() {
|
|
|
8675
8849
|
selectedLocationValue = _useSelectedLocation[0],
|
|
8676
8850
|
setSelectedLocationValue = _useSelectedLocation[1];
|
|
8677
8851
|
var _useSelectedClient = useSelectedClient(),
|
|
8852
|
+
selectedClient = _useSelectedClient[0],
|
|
8678
8853
|
setSelectedClient = _useSelectedClient[1];
|
|
8679
|
-
var
|
|
8680
|
-
|
|
8681
|
-
var
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
isButtonEnabled = _useState4[0],
|
|
8685
|
-
setIsButtonEnabled = _useState4[1];
|
|
8854
|
+
var _useIdForTableName = useIdForTableName(),
|
|
8855
|
+
setClientIdForTable = _useIdForTableName[1];
|
|
8856
|
+
var _useState = useState(false),
|
|
8857
|
+
isButtonEnabled = _useState[0],
|
|
8858
|
+
setIsButtonEnabled = _useState[1];
|
|
8686
8859
|
var _useReturnPayload = useReturnPayload(),
|
|
8687
8860
|
setReturnPayload = _useReturnPayload[1];
|
|
8688
|
-
var
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
storedCustomerId = _useState6[0],
|
|
8693
|
-
setStoredCustomerId = _useState6[1];
|
|
8694
|
-
var _useNewReturnPayload = useNewReturnPayload(),
|
|
8695
|
-
setNewPayload = _useNewReturnPayload[1];
|
|
8696
|
-
var _useGroupedPayload = useGroupedPayload(),
|
|
8697
|
-
setGrouped = _useGroupedPayload[1];
|
|
8698
|
-
var _useSelectedOrders = useSelectedOrders(),
|
|
8699
|
-
setSelectedReturnOrder = _useSelectedOrders[1];
|
|
8700
|
-
var _useSelectAll = useSelectAll(),
|
|
8701
|
-
setSelectAll = _useSelectAll[1];
|
|
8702
|
-
var _useSelectedConfirmLo = useSelectedConfirmLoc(),
|
|
8703
|
-
setCheck = _useSelectedConfirmLo[1];
|
|
8861
|
+
var _useLoading = useLoading(),
|
|
8862
|
+
load = _useLoading[0];
|
|
8863
|
+
var _useTableName = useTableName(),
|
|
8864
|
+
setTableName = _useTableName[1];
|
|
8704
8865
|
var _useClearState = useClearState(),
|
|
8705
8866
|
clearState = _useClearState[0],
|
|
8706
8867
|
setClear = _useClearState[1];
|
|
8707
|
-
|
|
8868
|
+
var _useActionTypeOptions = useActionTypeOptions(),
|
|
8869
|
+
actionTypeOptions = _useActionTypeOptions[0],
|
|
8870
|
+
setActionTypeOptions = _useActionTypeOptions[1];
|
|
8871
|
+
var _useLocationOptions = useLocationOptions(),
|
|
8872
|
+
locationOptions = _useLocationOptions[0],
|
|
8873
|
+
setLocationOptions = _useLocationOptions[1];
|
|
8708
8874
|
var clientOptions = customers == null ? void 0 : customers.map(function (option) {
|
|
8709
8875
|
var _option$customer_name, _option$customer_name2;
|
|
8710
8876
|
return {
|
|
8711
8877
|
label: (option == null || (_option$customer_name = option.customer_name) == null || (_option$customer_name = _option$customer_name.charAt(0)) == null ? void 0 : _option$customer_name.toUpperCase()) + (option == null || (_option$customer_name2 = option.customer_name) == null ? void 0 : _option$customer_name2.slice(1)),
|
|
8712
|
-
value:
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
account_number: option == null ? void 0 : option.account_number
|
|
8716
|
-
gsit_customer_id: option == null ? void 0 : option.gsit_customer_id
|
|
8717
|
-
};
|
|
8718
|
-
});
|
|
8719
|
-
var actionTypeOptions = actionType == null ? void 0 : actionType.map(function (option) {
|
|
8720
|
-
var _option$type, _option$type2;
|
|
8721
|
-
return {
|
|
8722
|
-
label: (option == null || (_option$type = option.type) == null || (_option$type = _option$type.charAt(0)) == null ? void 0 : _option$type.toUpperCase()) + (option == null || (_option$type2 = option.type) == null ? void 0 : _option$type2.slice(1)),
|
|
8723
|
-
value: option == null ? void 0 : option.id
|
|
8724
|
-
};
|
|
8725
|
-
});
|
|
8726
|
-
var LocationOptions = locationData == null ? void 0 : locationData.map(function (option) {
|
|
8727
|
-
return {
|
|
8728
|
-
label: option == null ? void 0 : option.location_name,
|
|
8729
|
-
value: option == null ? void 0 : option.token
|
|
8878
|
+
value: option == null ? void 0 : option.customer_id,
|
|
8879
|
+
actions: option == null ? void 0 : option.actions,
|
|
8880
|
+
return_locations: option == null ? void 0 : option.return_locations,
|
|
8881
|
+
account_number: option == null ? void 0 : option.account_number
|
|
8730
8882
|
};
|
|
8731
8883
|
});
|
|
8732
8884
|
//client change
|
|
8733
|
-
var
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
var
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8885
|
+
var handleClientChange = function handleClientChange(value, option) {
|
|
8886
|
+
// console.log(value, 'value');
|
|
8887
|
+
setSelectedClient(value);
|
|
8888
|
+
localStorage.setItem('clientName', option == null ? void 0 : option.label);
|
|
8889
|
+
localStorage.setItem('clientId', value == null ? void 0 : value.toString());
|
|
8890
|
+
localStorage.setItem('account_number', option == null ? void 0 : option.account_number);
|
|
8891
|
+
var selectedClient = clientOptions == null ? void 0 : clientOptions.find(function (client) {
|
|
8892
|
+
return (client == null ? void 0 : client.value) === value;
|
|
8893
|
+
});
|
|
8894
|
+
var clientActions = (selectedClient == null ? void 0 : selectedClient.actions) || [];
|
|
8895
|
+
var clientLocations = (selectedClient == null ? void 0 : selectedClient.return_locations) || [];
|
|
8896
|
+
setActionTypeOptions(clientActions == null ? void 0 : clientActions.map(function (action) {
|
|
8897
|
+
return {
|
|
8898
|
+
label: action,
|
|
8899
|
+
value: action
|
|
8900
|
+
};
|
|
8901
|
+
}));
|
|
8902
|
+
setLocationOptions(clientLocations == null ? void 0 : clientLocations.map(function (action) {
|
|
8903
|
+
return {
|
|
8904
|
+
label: action,
|
|
8905
|
+
value: action
|
|
8906
|
+
};
|
|
8907
|
+
}));
|
|
8753
8908
|
//set payload
|
|
8754
8909
|
setReturnPayload(function (prevState) {
|
|
8755
8910
|
return _extends({}, prevState, {
|
|
8756
|
-
account_number:
|
|
8757
|
-
customer_id:
|
|
8911
|
+
account_number: option == null ? void 0 : option.account_number,
|
|
8912
|
+
customer_id: value
|
|
8758
8913
|
});
|
|
8759
8914
|
});
|
|
8760
|
-
//filtering locations
|
|
8761
|
-
var filteredSubLocations = locationData == null ? void 0 : locationData.filter(function (subCat) {
|
|
8762
|
-
return (subCat == null ? void 0 : subCat.customer_id) === storedUuid;
|
|
8763
|
-
}).map(function (subCat) {
|
|
8764
|
-
return {
|
|
8765
|
-
label: subCat == null ? void 0 : subCat.location_name,
|
|
8766
|
-
value: subCat == null ? void 0 : subCat.token
|
|
8767
|
-
};
|
|
8768
|
-
});
|
|
8769
|
-
setFilteredLocationOptions(filteredSubLocations);
|
|
8770
|
-
//clearing states
|
|
8771
|
-
setUuid('');
|
|
8772
|
-
setSelectedReturnOrder([]);
|
|
8773
|
-
setNewPayload([]);
|
|
8774
|
-
setGrouped([]);
|
|
8775
|
-
setSelectAll(false);
|
|
8776
|
-
setCheck([]);
|
|
8777
8915
|
};
|
|
8916
|
+
var storedName = localStorage.getItem('clientName');
|
|
8917
|
+
var storedClientId = localStorage.getItem('clientId');
|
|
8918
|
+
var storedAccountNumber = localStorage.getItem('account_number');
|
|
8778
8919
|
useEffect(function () {
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
}
|
|
8784
|
-
if (customerIdFromStorage) {
|
|
8785
|
-
setStoredCustomerId(customerIdFromStorage);
|
|
8920
|
+
if (storedClientId !== selectedClient) {
|
|
8921
|
+
localStorage.removeItem('clientDetails');
|
|
8922
|
+
localStorage.removeItem('clientActions');
|
|
8923
|
+
localStorage.removeItem('clientLocations');
|
|
8786
8924
|
}
|
|
8787
|
-
|
|
8925
|
+
}, [storedClientId]);
|
|
8926
|
+
useEffect(function () {
|
|
8927
|
+
if (storedClientId && storedAccountNumber) {
|
|
8788
8928
|
setReturnPayload(function (prevState) {
|
|
8789
8929
|
return _extends({}, prevState, {
|
|
8790
|
-
account_number:
|
|
8791
|
-
customer_id:
|
|
8930
|
+
account_number: storedAccountNumber,
|
|
8931
|
+
customer_id: storedClientId
|
|
8792
8932
|
});
|
|
8793
8933
|
});
|
|
8794
8934
|
}
|
|
8795
|
-
}, [
|
|
8796
|
-
var storedUuid = localStorage.getItem('uuid');
|
|
8935
|
+
}, [storedClientId, storedAccountNumber]);
|
|
8797
8936
|
useEffect(function () {
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
return {
|
|
8803
|
-
label: subCat == null ? void 0 : subCat.location_name,
|
|
8804
|
-
value: subCat == null ? void 0 : subCat.token
|
|
8805
|
-
};
|
|
8937
|
+
var storedClientId = localStorage.getItem('clientId');
|
|
8938
|
+
if (storedClientId && (clientOptions == null ? void 0 : clientOptions.length) > 0) {
|
|
8939
|
+
var filteredClient = clientOptions == null ? void 0 : clientOptions.find(function (client) {
|
|
8940
|
+
return (client == null ? void 0 : client.value) == storedClientId;
|
|
8806
8941
|
});
|
|
8807
|
-
|
|
8942
|
+
if (filteredClient) {
|
|
8943
|
+
var _filteredClient$actio, _filteredClient$retur;
|
|
8944
|
+
var mappedActions = filteredClient == null || (_filteredClient$actio = filteredClient.actions) == null ? void 0 : _filteredClient$actio.map(function (action) {
|
|
8945
|
+
return {
|
|
8946
|
+
label: action,
|
|
8947
|
+
value: action
|
|
8948
|
+
};
|
|
8949
|
+
});
|
|
8950
|
+
setActionTypeOptions(mappedActions);
|
|
8951
|
+
var mappedLocations = filteredClient == null || (_filteredClient$retur = filteredClient.return_locations) == null ? void 0 : _filteredClient$retur.map(function (location) {
|
|
8952
|
+
return {
|
|
8953
|
+
label: location,
|
|
8954
|
+
value: location
|
|
8955
|
+
};
|
|
8956
|
+
});
|
|
8957
|
+
setLocationOptions(mappedLocations);
|
|
8958
|
+
}
|
|
8808
8959
|
}
|
|
8809
|
-
}, [
|
|
8960
|
+
}, [load]);
|
|
8810
8961
|
//location change
|
|
8811
8962
|
var handleLocationChange = function handleLocationChange(value) {
|
|
8812
8963
|
setSelectedLocationValue(value);
|
|
@@ -8817,8 +8968,11 @@ function SelectionFilter() {
|
|
|
8817
8968
|
};
|
|
8818
8969
|
//Apply filters
|
|
8819
8970
|
var applyFilters = function applyFilters() {
|
|
8971
|
+
if (selectedClient) {
|
|
8972
|
+
setClientIdForTable(selectedClient);
|
|
8973
|
+
}
|
|
8820
8974
|
if (storedName) {
|
|
8821
|
-
|
|
8975
|
+
setTableName(storedName);
|
|
8822
8976
|
}
|
|
8823
8977
|
//client value
|
|
8824
8978
|
if (storedClientId) {
|
|
@@ -8859,8 +9013,7 @@ function SelectionFilter() {
|
|
|
8859
9013
|
});
|
|
8860
9014
|
}
|
|
8861
9015
|
};
|
|
8862
|
-
|
|
8863
|
-
var storedClientId = localStorage.getItem('clientId');
|
|
9016
|
+
// const storedName = localStorage.getItem('clientName');
|
|
8864
9017
|
useEffect(function () {
|
|
8865
9018
|
if (storedClientId) {
|
|
8866
9019
|
dispatch({
|
|
@@ -8870,12 +9023,12 @@ function SelectionFilter() {
|
|
|
8870
9023
|
}
|
|
8871
9024
|
}, []);
|
|
8872
9025
|
useEffect(function () {
|
|
8873
|
-
if (
|
|
9026
|
+
if (storedClientId || selectedFilterValue || selectedLocationValue) {
|
|
8874
9027
|
setIsButtonEnabled(true);
|
|
8875
9028
|
} else {
|
|
8876
9029
|
setIsButtonEnabled(false);
|
|
8877
9030
|
}
|
|
8878
|
-
}, [
|
|
9031
|
+
}, [storedClientId, selectedFilterValue, selectedLocationValue]);
|
|
8879
9032
|
useEffect(function () {}, [location.pathname]);
|
|
8880
9033
|
useEffect(function () {
|
|
8881
9034
|
if (!selectedFilterValue || selectedFilterValue === null) {
|
|
@@ -8891,8 +9044,7 @@ function SelectionFilter() {
|
|
|
8891
9044
|
}, [selectedFilterValue, selectedLocationValue]);
|
|
8892
9045
|
var handleClear = function handleClear() {
|
|
8893
9046
|
setClear(false);
|
|
8894
|
-
localStorage.removeItem('
|
|
8895
|
-
localStorage.removeItem('clientId');
|
|
9047
|
+
localStorage.removeItem('clientDetails');
|
|
8896
9048
|
setClear(true);
|
|
8897
9049
|
};
|
|
8898
9050
|
useEffect(function () {
|
|
@@ -8900,21 +9052,20 @@ function SelectionFilter() {
|
|
|
8900
9052
|
dispatch({
|
|
8901
9053
|
type: 'CLEAR_CLIENT'
|
|
8902
9054
|
});
|
|
8903
|
-
|
|
8904
|
-
window.location.replace('/returnclient');
|
|
9055
|
+
window.location.href = '/returnclient';
|
|
8905
9056
|
}
|
|
8906
9057
|
}, [clearState]);
|
|
8907
9058
|
return React.createElement(Wrapper$j, null, React.createElement(FilterRow, null, React.createElement(LeftColumn, null, React.createElement(FilterColumn, null, React.createElement(Label$g, null, "Clients"), React.createElement(StyledAntSelect$2, {
|
|
8908
9059
|
options: clientOptions,
|
|
8909
9060
|
placeholder: "Select Client Name",
|
|
8910
|
-
onChange:
|
|
9061
|
+
onChange: handleClientChange,
|
|
8911
9062
|
style: {
|
|
8912
9063
|
minWidth: '14vw'
|
|
8913
9064
|
},
|
|
8914
9065
|
value: storedName,
|
|
8915
9066
|
allowClear: true,
|
|
8916
9067
|
onClear: handleClear
|
|
8917
|
-
})),
|
|
9068
|
+
})), React.createElement(React.Fragment, null, React.createElement(FilterColumn, null, React.createElement(Label$g, null, "Action Type"), React.createElement(StyledAntSelect$2, {
|
|
8918
9069
|
options: actionTypeOptions,
|
|
8919
9070
|
placeholder: "Select Action Type",
|
|
8920
9071
|
value: selectedFilterValue,
|
|
@@ -8924,7 +9075,7 @@ function SelectionFilter() {
|
|
|
8924
9075
|
},
|
|
8925
9076
|
allowClear: true
|
|
8926
9077
|
})), React.createElement(FilterColumn, null, React.createElement(Label$g, null, "Location "), React.createElement(StyledAntSelect$2, {
|
|
8927
|
-
options:
|
|
9078
|
+
options: locationOptions,
|
|
8928
9079
|
value: selectedLocationValue,
|
|
8929
9080
|
placeholder: "Select Location",
|
|
8930
9081
|
onChange: handleLocationChange,
|
|
@@ -8933,7 +9084,7 @@ function SelectionFilter() {
|
|
|
8933
9084
|
},
|
|
8934
9085
|
allowClear: true,
|
|
8935
9086
|
mode: "multiple"
|
|
8936
|
-
})))
|
|
9087
|
+
})))), React.createElement(RightColumn$1, null, React.createElement(ApplyButton, {
|
|
8937
9088
|
onClick: applyFilters,
|
|
8938
9089
|
disabled: !isButtonEnabled
|
|
8939
9090
|
}, "Apply"))));
|
|
@@ -9042,9 +9193,8 @@ var Container$13 = /*#__PURE__*/styled.div(_templateObject$1T || (_templateObjec
|
|
|
9042
9193
|
var ButtonText = /*#__PURE__*/styled.button(_templateObject2$1n || (_templateObject2$1n = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n\n display: flex;\n padding: 7px 12px;\n justify-content: center;\n align-items: center;\n gap: 2px;\n border-radius: 15px;\n background: #3a3630;\n font-family: 'Lato';\n cursor: pointer;\n border: none;\n\n &:disabled {\n border-radius: 15px;\n background: rgba(136, 128, 117, 0.35);\n color: #888075;\n cursor: not-allowed;\n }\n"])));
|
|
9043
9194
|
|
|
9044
9195
|
var ReturnFilter = function ReturnFilter() {
|
|
9045
|
-
var
|
|
9046
|
-
|
|
9047
|
-
return React.createElement(React.Fragment, null, React.createElement(StyledFiter, null, React.createElement(Text$8, null, " ", clientName), React.createElement(StyledFIlterELements, null, React.createElement(StyledTableFilter, null)), React.createElement(RightFilters, null)));
|
|
9196
|
+
var storedName = localStorage.getItem('clientName');
|
|
9197
|
+
return React.createElement(React.Fragment, null, React.createElement(StyledFiter, null, React.createElement(Text$8, null, storedName), React.createElement(StyledFIlterELements, null, React.createElement(StyledTableFilter, null)), React.createElement(RightFilters, null)));
|
|
9048
9198
|
};
|
|
9049
9199
|
|
|
9050
9200
|
var _templateObject$1U, _templateObject2$1o, _templateObject3$Q, _templateObject4$u, _templateObject34, _templateObject35, _templateObject36, _templateObject37;
|
|
@@ -9055,7 +9205,7 @@ var StyledTableWrapper$2 = /*#__PURE__*/styled.div(_templateObject3$Q || (_templ
|
|
|
9055
9205
|
var StyledTable$3 = /*#__PURE__*/styled.table(_templateObject4$u || (_templateObject4$u = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-spacing: 0 10px;\n width: 100%;\n /* min-width: 1600px; */\n thead {\n tr {\n border-radius: 40px;\n border-spacing: 0 10px;\n font-family: 'lato', sans-serif;\n .emailInvoiceCheckbox {\n padding-right: 0px;\n width: 0;\n > div {\n width: fit-content;\n }\n }\n .emailInvoiceNo {\n padding-left: 12px;\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 }\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 .shareIconContainer {\n display: flex;\n width: 24px;\n height: 24px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 10px;\n flex-shrink: 0;\n border-radius: 15px;\n background: #edebe8;\n cursor: pointer;\n }\n .statuscontainer {\n display: flex;\n padding: 6px 10px;\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 }\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"])));
|
|
9056
9206
|
var EmptyDataContainer$1 = /*#__PURE__*/styled.div(_templateObject34 || (_templateObject34 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n"])));
|
|
9057
9207
|
var ClearAll = /*#__PURE__*/styled.div(_templateObject35 || (_templateObject35 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-radius: 20px;\n border: 1px solid #edebe8;\n background: #fff;\n display: flex;\n padding: 6px 6px;\n justify-content: center;\n align-items: center;\n gap: 8px;\n cursor: pointer;\n\n &.active {\n background: #313130;\n & > div {\n color: #fff;\n }\n }\n"])));
|
|
9058
|
-
var StyledFilterBtnIcon = /*#__PURE__*/styled.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: #
|
|
9208
|
+
var StyledFilterBtnIcon = /*#__PURE__*/styled.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"])));
|
|
9059
9209
|
var StyledFilterBtnLabel = /*#__PURE__*/styled.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"])));
|
|
9060
9210
|
|
|
9061
9211
|
var PrinterIcon = function PrinterIcon() {
|
|
@@ -9246,7 +9396,7 @@ var PrintDropDownReturn = function PrintDropDownReturn(_ref) {
|
|
|
9246
9396
|
var legacyProductId = _ref.legacyProductId;
|
|
9247
9397
|
console.log(legacyProductId, 'legacyProductId');
|
|
9248
9398
|
var downloadFiles = function downloadFiles() {
|
|
9249
|
-
var url = "https://toolbox.bjshomedelivery.com/offload/return_label?gsit_products_id=" + legacyProductId;
|
|
9399
|
+
var url = "https://us.toolbox.bjshomedelivery.com/offload/return_label?gsit_products_id=" + legacyProductId;
|
|
9250
9400
|
window.open(url, '_blank'); // Opens the URL in a new tab
|
|
9251
9401
|
};
|
|
9252
9402
|
return React.createElement(OptionsList, null, options == null ? void 0 : options.map(function (item, index) {
|
|
@@ -9426,7 +9576,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
|
|
|
9426
9576
|
account_number: createReturn == null ? void 0 : createReturn.account_number,
|
|
9427
9577
|
customer_id: +(createReturn == null ? void 0 : createReturn.customer_id),
|
|
9428
9578
|
products: [legacy_product_id],
|
|
9429
|
-
return_action:
|
|
9579
|
+
return_action: order_product_return_action != null && order_product_return_action.type ? [order_product_return_action.type] : null,
|
|
9430
9580
|
return_location_token: return_location || null
|
|
9431
9581
|
};
|
|
9432
9582
|
setNewPayload(function (prevPayload) {
|
|
@@ -9481,7 +9631,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
|
|
|
9481
9631
|
}, React.createElement(Checkbox$1, {
|
|
9482
9632
|
checked: selectAll,
|
|
9483
9633
|
onChange: handleSelectAll
|
|
9484
|
-
})) : React.createElement("th", null), React.createElement("th", null, "Product Location"), React.createElement("th", null, "Return Location"), React.createElement("th", null, "Recipient"), React.createElement("th", null, "Code"), React.createElement("th", null, "Description"), React.createElement("th", null, "Part"), React.createElement("th", null, "Weight"), React.createElement("th", null, "CBM"), React.createElement("th", null, "Return Reason"), React.createElement("th", null, "Collected"), React.createElement("th", null, "Collection Reason"), React.createElement("th", {
|
|
9634
|
+
})) : React.createElement("th", null), React.createElement("th", null, "Product Location"), React.createElement("th", null, "Return Location"), React.createElement("th", null, "Recipient"), React.createElement("th", null, "Return Action"), React.createElement("th", null, "Code"), React.createElement("th", null, "Description"), React.createElement("th", null, "Part"), React.createElement("th", null, "Weight"), React.createElement("th", null, "CBM"), React.createElement("th", null, "Return Reason"), React.createElement("th", null, "Collected"), React.createElement("th", null, "Collection Reason"), React.createElement("th", {
|
|
9485
9635
|
className: "emailInvoiceShare"
|
|
9486
9636
|
}, "Labels"))), React.createElement("tbody", null, load ? React.createElement("tr", null, React.createElement("td", {
|
|
9487
9637
|
colSpan: 13
|
|
@@ -9490,7 +9640,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
|
|
|
9490
9640
|
}))) : (returnData == null ? void 0 : returnData.length) === 0 ? React.createElement("tr", null, React.createElement("td", {
|
|
9491
9641
|
colSpan: 14
|
|
9492
9642
|
}, React.createElement(EmptyDataContainer$1, null, React.createElement(Empty, null)))) : returnData == null ? void 0 : returnData.map(function (item, index) {
|
|
9493
|
-
var _item$order_product_r2, _item$orders_products, _item$orders_products2, _item$order_data, _item$order_data2, _item$return_reasons, _item$
|
|
9643
|
+
var _item$order_product_r2, _item$orders_products, _item$orders_products2, _item$order_data, _item$order_data2, _item$order_product_r3, _item$return_reasons, _item$order_product_r4, _item$collection_reas;
|
|
9494
9644
|
return React.createElement("tr", {
|
|
9495
9645
|
key: item.id
|
|
9496
9646
|
}, React.createElement("td", null, (item == null || (_item$order_product_r2 = item.order_product_return_action) == null ? void 0 : _item$order_product_r2.type) == 'RTS' ? React.createElement(React.Fragment, null, React.createElement(Checkbox$1, {
|
|
@@ -9518,7 +9668,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
|
|
|
9518
9668
|
style: {
|
|
9519
9669
|
color: '#888075'
|
|
9520
9670
|
}
|
|
9521
|
-
}, displayValueOrNA(item == null || (_item$order_data2 = item.order_data) == null || (_item$order_data2 = _item$order_data2.order_recipient) == null ? void 0 : _item$order_data2.postcode)))), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.code)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.description)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.parts_count)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.weight), ' ', item != null && item.weight && (item == null ? void 0 : item.weight) !== null ? 'KG' : ''), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.cube)), React.createElement("td", null, displayValueOrNA(item == null || (_item$return_reasons = item.return_reasons) == null ? void 0 : _item$return_reasons.reason)), React.createElement("td", null, (item == null || (_item$
|
|
9671
|
+
}, displayValueOrNA(item == null || (_item$order_data2 = item.order_data) == null || (_item$order_data2 = _item$order_data2.order_recipient) == null ? void 0 : _item$order_data2.postcode)))), React.createElement("td", null, displayValueOrNA(item == null || (_item$order_product_r3 = item.order_product_return_action) == null ? void 0 : _item$order_product_r3.type)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.code)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.description)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.parts_count)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.weight), ' ', item != null && item.weight && (item == null ? void 0 : item.weight) !== null ? 'KG' : ''), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.cube)), React.createElement("td", null, displayValueOrNA(item == null || (_item$return_reasons = item.return_reasons) == null ? void 0 : _item$return_reasons.reason)), React.createElement("td", null, (item == null || (_item$order_product_r4 = item.order_product_returns) == null ? void 0 : _item$order_product_r4.length) > 0 ? item.order_product_returns.map(function (ret) {
|
|
9522
9672
|
return ret != null && ret.collected_at ? format(new Date(ret.collected_at), 'dd/MM/yyyy') : 'UNKNOWN';
|
|
9523
9673
|
}) : 'UNKNOWN'), React.createElement("td", null, displayValueOrNA(item == null || (_item$collection_reas = item.collection_reasons) == null ? void 0 : _item$collection_reas.reason)), React.createElement("td", null, React.createElement("ul", {
|
|
9524
9674
|
className: "actionbox"
|
|
@@ -9680,8 +9830,6 @@ var ModalManager = function ModalManager() {
|
|
|
9680
9830
|
popupName = _useAtom[0],
|
|
9681
9831
|
dispatch = _useAtom[1];
|
|
9682
9832
|
var _useProductDetails = useProductDetails();
|
|
9683
|
-
var _useCreateOrderProduc = useCreateOrderProducts(),
|
|
9684
|
-
orderProduct = _useCreateOrderProduc[0];
|
|
9685
9833
|
var _useDeleteProdsID = useDeleteProdsID(),
|
|
9686
9834
|
selectedRows = _useDeleteProdsID[0];
|
|
9687
9835
|
var _useState = useState(false),
|
|
@@ -9705,14 +9853,12 @@ var ModalManager = function ModalManager() {
|
|
|
9705
9853
|
var _usefetchAgain = usefetchAgain(),
|
|
9706
9854
|
setCallForFetch = _usefetchAgain[1];
|
|
9707
9855
|
var navigate = useNavigate();
|
|
9708
|
-
console.log(orderProduct, 'abcabcabcabcabcabcabcabcabcabcabc');
|
|
9709
9856
|
var _closeModal = function closeModal() {
|
|
9710
9857
|
dispatch({
|
|
9711
9858
|
type: 'close'
|
|
9712
9859
|
});
|
|
9713
9860
|
};
|
|
9714
9861
|
var validateForm = function validateForm() {
|
|
9715
|
-
console.log(selectedRows, 'selectedRowsselectedRowsselectedRows');
|
|
9716
9862
|
return (selectedRows == null ? void 0 : selectedRows.length) > 0;
|
|
9717
9863
|
};
|
|
9718
9864
|
useEffect(function () {
|
|
@@ -9730,7 +9876,7 @@ var ModalManager = function ModalManager() {
|
|
|
9730
9876
|
confirmLoading = _useApiHook.loading,
|
|
9731
9877
|
apiError = _useApiHook.error,
|
|
9732
9878
|
setError = _useApiHook.setError;
|
|
9733
|
-
|
|
9879
|
+
useEffect(function () {
|
|
9734
9880
|
SetPostLoading(confirmLoading);
|
|
9735
9881
|
}, [confirmLoading]);
|
|
9736
9882
|
var handleConfirmReturn = function handleConfirmReturn() {
|
|
@@ -10062,20 +10208,29 @@ var OptionsListLi$1 = /*#__PURE__*/styled.li(_templateObject2$1u || (_templateOb
|
|
|
10062
10208
|
return disabled ? 'transparent' : '#f0f0f0';
|
|
10063
10209
|
});
|
|
10064
10210
|
|
|
10211
|
+
var _templateObject$1$;
|
|
10065
10212
|
var OrderTable = function OrderTable(_ref) {
|
|
10066
10213
|
var loadingskeleton = _ref.loadingskeleton;
|
|
10067
10214
|
// const [, setSelectedReturnOrder] = useSelectedOrders();
|
|
10068
10215
|
// const [selectAll, setSelectAll] = useState(false);
|
|
10069
|
-
// const defaultSelectStyle = { width: '100%' };
|
|
10070
|
-
var defaultPopupClassName = 'dropDownStyle';
|
|
10071
|
-
var defaultSelectWrapperClass = 'rounded';
|
|
10072
10216
|
var dropdownRefParent = useRef(null);
|
|
10073
10217
|
var dropdownRef = useRef(null);
|
|
10074
10218
|
var _usePrintOptionTOggle = usePrintOptionTOggle(),
|
|
10075
10219
|
printToogle = _usePrintOptionTOggle[0],
|
|
10076
10220
|
setPrintToggle = _usePrintOptionTOggle[1];
|
|
10221
|
+
var _useAssignData = useAssignData(),
|
|
10222
|
+
assignData = _useAssignData[0];
|
|
10223
|
+
var _useOrderId = useOrderId(),
|
|
10224
|
+
setOrderId = _useOrderId[1];
|
|
10077
10225
|
var _useReturnAfterOrderD = useReturnAfterOrderData(),
|
|
10078
10226
|
returnAfterOrder = _useReturnAfterOrderD[0];
|
|
10227
|
+
var _useAssignPayload = useAssignPayload(),
|
|
10228
|
+
assignPayload = _useAssignPayload[0],
|
|
10229
|
+
setAssignPayload = _useAssignPayload[1];
|
|
10230
|
+
var _useState = useState(false),
|
|
10231
|
+
setAssign = _useState[1];
|
|
10232
|
+
var _useCallApiAgain = useCallApiAgain(),
|
|
10233
|
+
setCallAPi = _useCallApiAgain[1];
|
|
10079
10234
|
var OpenDropDown = function OpenDropDown(index) {
|
|
10080
10235
|
setPrintToggle(function (prevIndex) {
|
|
10081
10236
|
return prevIndex === index ? null : index;
|
|
@@ -10118,14 +10273,6 @@ var OrderTable = function OrderTable(_ref) {
|
|
|
10118
10273
|
// }
|
|
10119
10274
|
// });
|
|
10120
10275
|
// };
|
|
10121
|
-
// console.log('', returnAfterOrder);
|
|
10122
|
-
var assigneOptions = [{
|
|
10123
|
-
label: 'BJS Distribution',
|
|
10124
|
-
value: 'bjs-dist'
|
|
10125
|
-
}, {
|
|
10126
|
-
label: 'Haulage',
|
|
10127
|
-
value: 'haulage'
|
|
10128
|
-
}];
|
|
10129
10276
|
var getStatusClass = function getStatusClass(status) {
|
|
10130
10277
|
switch (status) {
|
|
10131
10278
|
case 'Cancelled':
|
|
@@ -10170,14 +10317,56 @@ var OrderTable = function OrderTable(_ref) {
|
|
|
10170
10317
|
};
|
|
10171
10318
|
}
|
|
10172
10319
|
};
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10320
|
+
// API for Assign
|
|
10321
|
+
var _useApiHook = useApiHook({
|
|
10322
|
+
endpoint: "return_orders/update/assign/",
|
|
10323
|
+
method: 'PUT',
|
|
10324
|
+
body: [assignPayload],
|
|
10325
|
+
performAction: false
|
|
10326
|
+
}),
|
|
10327
|
+
actionResponse = _useApiHook.data,
|
|
10328
|
+
setAssignAction = _useApiHook.setShouldPerformAction,
|
|
10329
|
+
AssignLoading = _useApiHook.loading,
|
|
10330
|
+
apiError = _useApiHook.error;
|
|
10331
|
+
//client options
|
|
10332
|
+
var assignOptions = assignData == null ? void 0 : assignData.map(function (option) {
|
|
10333
|
+
var _option$type, _option$type2;
|
|
10334
|
+
return {
|
|
10335
|
+
label: (option == null || (_option$type = option.type) == null || (_option$type = _option$type.charAt(0)) == null ? void 0 : _option$type.toUpperCase()) + (option == null || (_option$type2 = option.type) == null ? void 0 : _option$type2.slice(1)),
|
|
10336
|
+
value: option == null ? void 0 : option.bjs_delivery
|
|
10337
|
+
};
|
|
10338
|
+
});
|
|
10339
|
+
var handleAssignPayload = function handleAssignPayload(Id, value) {
|
|
10340
|
+
setCallAPi(false);
|
|
10341
|
+
setAssign(value);
|
|
10342
|
+
setAssignPayload(_extends({}, assignPayload, {
|
|
10343
|
+
return_order_id: Id,
|
|
10344
|
+
bjs_delivery: value
|
|
10345
|
+
}));
|
|
10346
|
+
setAssignAction(true);
|
|
10347
|
+
};
|
|
10348
|
+
useEffect(function () {
|
|
10349
|
+
//@ts-ignore
|
|
10350
|
+
if ((actionResponse == null ? void 0 : actionResponse.code) === 200) {
|
|
10351
|
+
setCallAPi(true);
|
|
10352
|
+
notification.success({
|
|
10353
|
+
message: 'Success',
|
|
10354
|
+
// @ts-ignore
|
|
10355
|
+
description: "" + (actionResponse == null ? void 0 : actionResponse.message)
|
|
10356
|
+
});
|
|
10357
|
+
// @ts-ignore
|
|
10358
|
+
} else if (apiError != null && apiError.detail) {
|
|
10359
|
+
var _apiError$detail$;
|
|
10360
|
+
notification.error({
|
|
10361
|
+
message: 'Failure',
|
|
10362
|
+
// @ts-ignore
|
|
10363
|
+
description: "" + (apiError == null || (_apiError$detail$ = apiError.detail[0]) == null ? void 0 : _apiError$detail$.msg)
|
|
10364
|
+
});
|
|
10365
|
+
}
|
|
10366
|
+
}, [actionResponse, apiError]);
|
|
10367
|
+
return React.createElement(React.Fragment, null, AssignLoading && React.createElement(Loader, null), React.createElement(StyledTableWrapper, {
|
|
10177
10368
|
className: "fortables"
|
|
10178
|
-
}, React.createElement(StyledTable$1, null, React.createElement("thead", null, React.createElement("tr", null, React.createElement("th", {
|
|
10179
|
-
className: "emailInvoiceNo"
|
|
10180
|
-
}, "Created"), React.createElement("th", null, "Return Location"), React.createElement("th", null, "Pick Up Location"), React.createElement("th", null, "Recipient"), React.createElement("th", null, " Client"), React.createElement("th", null, "Consignment"), React.createElement("th", null, "Return Order No"), React.createElement("th", null, " Total Parts"), React.createElement("th", null, "Total Weight"), React.createElement("th", null, "Total CBM"), React.createElement("th", null, "Assign"), React.createElement("th", null, "Status"), React.createElement("th", {
|
|
10369
|
+
}, React.createElement(StyledTable$1, null, React.createElement("thead", null, React.createElement("tr", null, React.createElement("th", null, "Created"), React.createElement("th", null, "Return Location"), React.createElement("th", null, "Pick Up Location"), React.createElement("th", null, "Recipient"), React.createElement("th", null, " Client"), React.createElement("th", null, "Consignment"), React.createElement("th", null, "Return Order No"), React.createElement("th", null, " Total Parts"), React.createElement("th", null, "Total Weight"), React.createElement("th", null, "Total CBM"), React.createElement("th", null, "Assign"), React.createElement("th", null, "Status"), React.createElement("th", {
|
|
10181
10370
|
className: "emailInvoiceShare"
|
|
10182
10371
|
}, "Labels"))), React.createElement("tbody", null, loadingskeleton ? React.createElement("tr", null, React.createElement("td", {
|
|
10183
10372
|
colSpan: 16
|
|
@@ -10223,17 +10412,18 @@ var OrderTable = function OrderTable(_ref) {
|
|
|
10223
10412
|
style: {
|
|
10224
10413
|
color: '#888075'
|
|
10225
10414
|
}
|
|
10226
|
-
}, displayValueOrNA(item == null || (_item$order_recipient2 = item.order_recipient) == null ? void 0 : _item$order_recipient2.postcode)))), React.createElement("td", null, displayValueOrNA(item == null || (_item$customer_data = item.customer_data) == null ? void 0 : _item$customer_data.customer_name)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.consignment)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.order_number)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.box_count)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.weight), ' ', item != null && item.weight && (item == null ? void 0 : item.weight) !== null ? 'KG' : ''), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.cube)), React.createElement("td",
|
|
10227
|
-
|
|
10415
|
+
}, displayValueOrNA(item == null || (_item$order_recipient2 = item.order_recipient) == null ? void 0 : _item$order_recipient2.postcode)))), React.createElement("td", null, displayValueOrNA(item == null || (_item$customer_data = item.customer_data) == null ? void 0 : _item$customer_data.customer_name)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.consignment)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.order_number)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.box_count)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.weight), ' ', item != null && item.weight && (item == null ? void 0 : item.weight) !== null ? 'KG' : ''), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.cube)), React.createElement("td", {
|
|
10416
|
+
key: item.id
|
|
10417
|
+
}, React.createElement(StyledAntSelect$3, {
|
|
10418
|
+
options: assignOptions,
|
|
10228
10419
|
placeholder: "Select",
|
|
10229
|
-
onChange: function onChange() {
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
selectWrapperClass: defaultSelectWrapperClass
|
|
10420
|
+
onChange: function onChange(value) {
|
|
10421
|
+
return handleAssignPayload(item == null ? void 0 : item.id, value);
|
|
10422
|
+
},
|
|
10423
|
+
style: {
|
|
10424
|
+
width: '150px'
|
|
10425
|
+
},
|
|
10426
|
+
value: item == null ? void 0 : item.bjs_delivery
|
|
10237
10427
|
})), React.createElement("td", null, React.createElement("ul", {
|
|
10238
10428
|
className: "statuscontainer",
|
|
10239
10429
|
style: {
|
|
@@ -10264,8 +10454,9 @@ var OrderTable = function OrderTable(_ref) {
|
|
|
10264
10454
|
}, React.createElement(LoadIcon, null)))));
|
|
10265
10455
|
})))));
|
|
10266
10456
|
};
|
|
10457
|
+
var StyledAntSelect$3 = /*#__PURE__*/styled(Select)(_templateObject$1$ || (_templateObject$1$ = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .ant-select-selector {\n /* width: 22vw; */\n border-radius: 22px;\n }\n .ant-select-clear {\n top: 40% !important;\n font-size: 18px !important;\n }\n"])));
|
|
10267
10458
|
|
|
10268
|
-
var _templateObject$
|
|
10459
|
+
var _templateObject$20;
|
|
10269
10460
|
// import DownloadIcon from '../../../../assets/icons/DownloadIcon';
|
|
10270
10461
|
var TableFilters = function TableFilters() {
|
|
10271
10462
|
return React.createElement(Container$16, null);
|
|
@@ -10282,7 +10473,7 @@ var TableFilters = function TableFilters() {
|
|
|
10282
10473
|
// // </StyledBulkFilterCover>
|
|
10283
10474
|
// );
|
|
10284
10475
|
};
|
|
10285
|
-
var Container$16 = /*#__PURE__*/styled.div(_templateObject$
|
|
10476
|
+
var Container$16 = /*#__PURE__*/styled.div(_templateObject$20 || (_templateObject$20 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n /* align-items: flex-start; */\n gap: 16px;\n align-items: center;\n"])));
|
|
10286
10477
|
|
|
10287
10478
|
var FilterIcon = function FilterIcon() {
|
|
10288
10479
|
return React.createElement("svg", {
|
|
@@ -10395,7 +10586,6 @@ var initialState$2 = {
|
|
|
10395
10586
|
}
|
|
10396
10587
|
};
|
|
10397
10588
|
var filterReducer$1 = function filterReducer(state, action) {
|
|
10398
|
-
console.log(action, 'action');
|
|
10399
10589
|
switch (action.type) {
|
|
10400
10590
|
case 'SET_DATE_FILTER':
|
|
10401
10591
|
return _extends({}, state, {
|
|
@@ -10431,6 +10621,22 @@ var filterReducer$1 = function filterReducer(state, action) {
|
|
|
10431
10621
|
value: action.payload
|
|
10432
10622
|
}])
|
|
10433
10623
|
});
|
|
10624
|
+
// case 'CLEAR_CLIENT':
|
|
10625
|
+
// return {
|
|
10626
|
+
// ...state,
|
|
10627
|
+
// 'x-filters': state['x-filters'].filter(f => f.field !== 'customer_id'),
|
|
10628
|
+
// };
|
|
10629
|
+
// case 'CLEAR_STATUS_ORDER':
|
|
10630
|
+
// return {
|
|
10631
|
+
// ...state,
|
|
10632
|
+
// 'x-filters': state['x-filters'].filter(f => f.field !== 'status_id'),
|
|
10633
|
+
// };
|
|
10634
|
+
case 'CLEAR_DATE':
|
|
10635
|
+
return _extends({}, state, {
|
|
10636
|
+
'x-filters': state['x-filters'].filter(function (f) {
|
|
10637
|
+
return f.field !== 'created_at';
|
|
10638
|
+
})
|
|
10639
|
+
});
|
|
10434
10640
|
case 'SET_PAGE':
|
|
10435
10641
|
return _extends({}, state, {
|
|
10436
10642
|
'x-pagination': _extends({}, state['x-pagination'], {
|
|
@@ -10460,7 +10666,7 @@ var filtersReducerReturnAtom = /*#__PURE__*/atom(function (get) {
|
|
|
10460
10666
|
return set(filtersStateAtom$1, filterReducer$1(get(filtersStateAtom$1), action));
|
|
10461
10667
|
});
|
|
10462
10668
|
|
|
10463
|
-
var _templateObject$
|
|
10669
|
+
var _templateObject$21, _templateObject2$1v;
|
|
10464
10670
|
var ReturnOrderFilter = function ReturnOrderFilter() {
|
|
10465
10671
|
var _useAtom = useAtom(filtersReducerReturnAtom),
|
|
10466
10672
|
dispatch = _useAtom[1];
|
|
@@ -10477,7 +10683,6 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
|
|
|
10477
10683
|
var _useState3 = useState(),
|
|
10478
10684
|
statusOrder = _useState3[0],
|
|
10479
10685
|
setStatusOfOrder = _useState3[1];
|
|
10480
|
-
console.log(selectedClient, 'fffffselectedClient');
|
|
10481
10686
|
var zoneOptions = [{
|
|
10482
10687
|
label: 'Zone 1',
|
|
10483
10688
|
value: 'zone1'
|
|
@@ -10497,11 +10702,9 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
|
|
|
10497
10702
|
// date change here
|
|
10498
10703
|
var handleDateChange = function handleDateChange(date) {
|
|
10499
10704
|
setSelectedDate(date ? date == null ? void 0 : date.$d : null);
|
|
10500
|
-
console.log(selectedDate, 'selected');
|
|
10501
10705
|
};
|
|
10502
10706
|
useEffect(function () {
|
|
10503
10707
|
if (selectedDate) {
|
|
10504
|
-
console.log(selectedDate, 'selected');
|
|
10505
10708
|
dispatch({
|
|
10506
10709
|
type: 'SET_DATE_FILTER',
|
|
10507
10710
|
payload: selectedDate
|
|
@@ -10518,10 +10721,9 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
|
|
|
10518
10721
|
var _option$customer_name, _option$customer_name2;
|
|
10519
10722
|
return {
|
|
10520
10723
|
label: (option == null || (_option$customer_name = option.customer_name) == null || (_option$customer_name = _option$customer_name.charAt(0)) == null ? void 0 : _option$customer_name.toUpperCase()) + (option == null || (_option$customer_name2 = option.customer_name) == null ? void 0 : _option$customer_name2.slice(1)),
|
|
10521
|
-
value: option == null ? void 0 : option.
|
|
10724
|
+
value: option == null ? void 0 : option.customer_id
|
|
10522
10725
|
};
|
|
10523
10726
|
});
|
|
10524
|
-
console.log(clientOptions, 'clientOptions');
|
|
10525
10727
|
//status of order
|
|
10526
10728
|
var orderOptions = statusOfOrder == null ? void 0 : statusOfOrder.map(function (option) {
|
|
10527
10729
|
var _option$status_type, _option$status_type2;
|
|
@@ -10532,7 +10734,6 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
|
|
|
10532
10734
|
});
|
|
10533
10735
|
var handleClientChange = function handleClientChange(value) {
|
|
10534
10736
|
if (value === selectedClient) return;
|
|
10535
|
-
console.log(value, 'value');
|
|
10536
10737
|
setSelectedClient(value);
|
|
10537
10738
|
dispatch({
|
|
10538
10739
|
type: 'SET_CLIENT_FILTER',
|
|
@@ -10546,7 +10747,6 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
|
|
|
10546
10747
|
};
|
|
10547
10748
|
var handleStatusOfOrder = function handleStatusOfOrder(value) {
|
|
10548
10749
|
if (value === statusOfOrder) return;
|
|
10549
|
-
console.log(value, 'value');
|
|
10550
10750
|
setStatusOfOrder(value);
|
|
10551
10751
|
dispatch({
|
|
10552
10752
|
type: 'SET_STATUS_ORDER_FILTER',
|
|
@@ -10566,6 +10766,14 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
|
|
|
10566
10766
|
type: 'CLEAR_ALL_FILTER'
|
|
10567
10767
|
});
|
|
10568
10768
|
};
|
|
10769
|
+
//clearing filters
|
|
10770
|
+
useEffect(function () {
|
|
10771
|
+
if (selectedDate === null) {
|
|
10772
|
+
dispatch({
|
|
10773
|
+
type: 'CLEAR_DATE'
|
|
10774
|
+
});
|
|
10775
|
+
}
|
|
10776
|
+
}, [selectedDate]);
|
|
10569
10777
|
return React.createElement(React.Fragment, null, React.createElement(StyledFiter, null, React.createElement(StyledFIlterELements, null, React.createElement(LeftSideConatiner, null, React.createElement("div", {
|
|
10570
10778
|
className: "filtercontainer"
|
|
10571
10779
|
}, React.createElement("div", {
|
|
@@ -10585,12 +10793,13 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
|
|
|
10585
10793
|
value: selectedDate ? dayjs(selectedDate) : null,
|
|
10586
10794
|
format: "DD/MM/YY",
|
|
10587
10795
|
placeholder: "Date",
|
|
10588
|
-
needConfirm: true
|
|
10796
|
+
needConfirm: true,
|
|
10797
|
+
allowClear: true
|
|
10589
10798
|
}))), React.createElement("div", {
|
|
10590
10799
|
className: "datefilter"
|
|
10591
10800
|
}, React.createElement("div", {
|
|
10592
10801
|
className: "dateiconcontainer"
|
|
10593
|
-
}, React.createElement(StatusIcon, null)), React.createElement(StyledAntSelect$
|
|
10802
|
+
}, React.createElement(StatusIcon, null)), React.createElement(StyledAntSelect$4, null, React.createElement(Select, {
|
|
10594
10803
|
options: orderOptions,
|
|
10595
10804
|
className: "custom-select",
|
|
10596
10805
|
placeholder: "Status of Order",
|
|
@@ -10603,7 +10812,7 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
|
|
|
10603
10812
|
className: "datefilter"
|
|
10604
10813
|
}, React.createElement("div", {
|
|
10605
10814
|
className: "dateiconcontainer"
|
|
10606
|
-
}, React.createElement(ClientIcon, null)), React.createElement(StyledAntSelect$
|
|
10815
|
+
}, React.createElement(ClientIcon, null)), React.createElement(StyledAntSelect$4, null, React.createElement(Select, {
|
|
10607
10816
|
options: clientOptions,
|
|
10608
10817
|
className: "custom-select",
|
|
10609
10818
|
placeholder: "Client",
|
|
@@ -10621,7 +10830,7 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
|
|
|
10621
10830
|
}
|
|
10622
10831
|
}, React.createElement("div", {
|
|
10623
10832
|
className: "dateiconcontainer"
|
|
10624
|
-
}, React.createElement(AssigneIcon, null)), React.createElement(StyledAntSelect$
|
|
10833
|
+
}, React.createElement(AssigneIcon, null)), React.createElement(StyledAntSelect$4, null, React.createElement(Select, {
|
|
10625
10834
|
options: zoneOptions,
|
|
10626
10835
|
className: "custom-select",
|
|
10627
10836
|
placeholder: "Asignee",
|
|
@@ -10636,9 +10845,9 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
|
|
|
10636
10845
|
className: "cross"
|
|
10637
10846
|
})), React.createElement(StyledFilterBtnLabel, null, "Clear all"))) : null)), React.createElement(TableFilters, null)));
|
|
10638
10847
|
};
|
|
10639
|
-
var StyledDatePicker = /*#__PURE__*/styled.div(_templateObject$
|
|
10848
|
+
var StyledDatePicker = /*#__PURE__*/styled.div(_templateObject$21 || (_templateObject$21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .custom-datepicker {\n border: none;\n }\n"])));
|
|
10640
10849
|
// const DropdownContainer = styled.div``;
|
|
10641
|
-
var StyledAntSelect$
|
|
10850
|
+
var StyledAntSelect$4 = /*#__PURE__*/styled.div(_templateObject2$1v || (_templateObject2$1v = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .custom-select {\n border: none;\n width: 80px;\n }\n .ant-select-selector {\n border: 1px solid #ffffff !important;\n }\n :where(.css-dev-only-do-not-override-m4timi).ant-select-single:not(.ant-select-customize-input)\n .ant-select-selector {\n padding: 0 5px;\n }\n :where(.css-dev-only-do-not-override-m4timi).ant-select-outlined:not(.ant-select-customize-input)\n .ant-select-selector {\n border: none;\n }\n .roundbox {\n display: flex;\n width: 18px;\n height: 18px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n border-radius: 18px;\n background: #fff;\n box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);\n left: 359px;\n position: absolute;\n border-radius: 18px;\n background: #fff;\n box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);\n top: 16px;\n }\n .ant-select-clear {\n top: 40% !important;\n font-size: 18px !important;\n }\n"])));
|
|
10642
10851
|
|
|
10643
10852
|
var PAGE_SIZE_OPTIONS$1 = [50, 100, 150];
|
|
10644
10853
|
var MAX_PAGES_TO_SHOW$1 = 5;
|
|
@@ -10724,25 +10933,20 @@ var ReturnPagination = function ReturnPagination(_ref) {
|
|
|
10724
10933
|
}, React.createElement(NextIcon, null)))));
|
|
10725
10934
|
};
|
|
10726
10935
|
|
|
10727
|
-
var _templateObject$
|
|
10936
|
+
var _templateObject$22, _templateObject2$1w;
|
|
10728
10937
|
var _excluded$5 = ["count"];
|
|
10729
10938
|
var ReturnAfterTable = function ReturnAfterTable() {
|
|
10730
10939
|
var _useReturnAfterOrderD = useReturnAfterOrderData(),
|
|
10940
|
+
returnAfterOrder = _useReturnAfterOrderD[0],
|
|
10731
10941
|
setReturnOrderData = _useReturnAfterOrderD[1];
|
|
10732
10942
|
var _useLoading = useLoading(),
|
|
10733
10943
|
setLoading = _useLoading[1];
|
|
10734
10944
|
var _useAtom = useAtom(filtersReducerReturnAtom),
|
|
10735
10945
|
state = _useAtom[0];
|
|
10946
|
+
var _useCallApiAgain = useCallApiAgain(),
|
|
10947
|
+
callApi = _useCallApiAgain[0];
|
|
10736
10948
|
var filters = state['x-filters'],
|
|
10737
10949
|
pagination = state['x-pagination'];
|
|
10738
|
-
var splitPath = function splitPath(str) {
|
|
10739
|
-
var _str$split;
|
|
10740
|
-
var parts = str == null || (_str$split = str.split('/')) == null ? void 0 : _str$split.filter(function (part) {
|
|
10741
|
-
return part !== '';
|
|
10742
|
-
}); // Filter out empty parts
|
|
10743
|
-
return parts;
|
|
10744
|
-
};
|
|
10745
|
-
var paths = splitPath(location.pathname);
|
|
10746
10950
|
var _UsePaginationReturnD = UsePaginationReturnData(),
|
|
10747
10951
|
paginationObj = _UsePaginationReturnD[0];
|
|
10748
10952
|
var _useState = useState(1),
|
|
@@ -10752,7 +10956,6 @@ var ReturnAfterTable = function ReturnAfterTable() {
|
|
|
10752
10956
|
setItemsPerPage = _useItemsPerReturnPag[1];
|
|
10753
10957
|
var _UsePaginationData = UsePaginationData(),
|
|
10754
10958
|
setPaginationObject = _UsePaginationData[1];
|
|
10755
|
-
console.log(paths, 'paths');
|
|
10756
10959
|
var page = paginationObj.page,
|
|
10757
10960
|
total = paginationObj.total;
|
|
10758
10961
|
var handlePageChange = function handlePageChange(page) {
|
|
@@ -10765,13 +10968,18 @@ var ReturnAfterTable = function ReturnAfterTable() {
|
|
|
10765
10968
|
endpoint: '/return_orders/?skip_filters=0',
|
|
10766
10969
|
method: 'GET',
|
|
10767
10970
|
filters: filters,
|
|
10768
|
-
pagination: pagination
|
|
10971
|
+
pagination: pagination,
|
|
10972
|
+
performAction: false
|
|
10769
10973
|
}),
|
|
10770
10974
|
fetchedReturnOrderData = _useApiHook.data,
|
|
10771
|
-
|
|
10975
|
+
loading = _useApiHook.loading,
|
|
10976
|
+
setShouldPerformAction = _useApiHook.setShouldPerformAction,
|
|
10772
10977
|
paginationData = _useApiHook.paginationData;
|
|
10773
10978
|
useEffect(function () {
|
|
10774
|
-
|
|
10979
|
+
callApi ? setShouldPerformAction(true) : setShouldPerformAction(false);
|
|
10980
|
+
}, [callApi]);
|
|
10981
|
+
useEffect(function () {
|
|
10982
|
+
setLoading(loading);
|
|
10775
10983
|
if (fetchedReturnOrderData && fetchedReturnOrderData != null && fetchedReturnOrderData.data) {
|
|
10776
10984
|
setReturnOrderData(fetchedReturnOrderData == null ? void 0 : fetchedReturnOrderData.data);
|
|
10777
10985
|
if (paginationData !== null) {
|
|
@@ -10785,7 +10993,7 @@ var ReturnAfterTable = function ReturnAfterTable() {
|
|
|
10785
10993
|
});
|
|
10786
10994
|
}
|
|
10787
10995
|
}
|
|
10788
|
-
}, [fetchedReturnOrderData,
|
|
10996
|
+
}, [fetchedReturnOrderData, loading, returnAfterOrder]);
|
|
10789
10997
|
return React.createElement("div", null, React.createElement(DashBoardWrapper$2, null, React.createElement("div", {
|
|
10790
10998
|
className: "Tableconatiner"
|
|
10791
10999
|
}, React.createElement(Container$17, null, React.createElement(ReturnOrderFilter, null), React.createElement(OrderTable, null), total > 0 && React.createElement(ReturnPagination, {
|
|
@@ -10796,13 +11004,13 @@ var ReturnAfterTable = function ReturnAfterTable() {
|
|
|
10796
11004
|
onItemsPerPageChange: handleItemsPerPageChange
|
|
10797
11005
|
})))));
|
|
10798
11006
|
};
|
|
10799
|
-
var Container$17 = /*#__PURE__*/styled.div(_templateObject$
|
|
11007
|
+
var Container$17 = /*#__PURE__*/styled.div(_templateObject$22 || (_templateObject$22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n /* top: -30px; */\n"])));
|
|
10800
11008
|
var DashBoardWrapper$2 = /*#__PURE__*/styled.section(_templateObject2$1w || (_templateObject2$1w = /*#__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"])));
|
|
10801
11009
|
|
|
10802
11010
|
var _templateObject2$1x;
|
|
10803
11011
|
var StyledBulkItem = /*#__PURE__*/styled.div(_templateObject2$1x || (_templateObject2$1x = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 8px 12px;\n display: flex;\n align-items: center;\n /* border-right: 1px solid #d0d5dd; */\n gap: 8px;\n cursor: pointer;\n position: relative;\n\n @media screen and (max-width: 1030px) {\n padding: 8px 11px;\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: #6a7378;\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"])));
|
|
10804
11012
|
|
|
10805
|
-
var _templateObject$
|
|
11013
|
+
var _templateObject$23, _templateObject2$1y;
|
|
10806
11014
|
var SearchType = function SearchType() {
|
|
10807
11015
|
var _useState = useState(''),
|
|
10808
11016
|
searchText = _useState[0],
|
|
@@ -10817,7 +11025,7 @@ var SearchType = function SearchType() {
|
|
|
10817
11025
|
onChange: handleInputChange
|
|
10818
11026
|
}));
|
|
10819
11027
|
};
|
|
10820
|
-
var Search = /*#__PURE__*/styled.div(_templateObject$
|
|
11028
|
+
var Search = /*#__PURE__*/styled.div(_templateObject$23 || (_templateObject$23 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n svg {\n position: absolute;\n left: 12px;\n top: 50%;\n transform: translateY(-50%);\n }\n"])));
|
|
10821
11029
|
var SearchInput = /*#__PURE__*/styled.input(_templateObject2$1y || (_templateObject2$1y = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-radius: 20px;\n border: 1px solid #e0e2e7;\n background: #fff;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n display: flex;\n padding: 8.5px 12px;\n align-items: center;\n gap: 8px;\n align-self: stretch;\n padding-left: 39px;\n"])));
|
|
10822
11030
|
|
|
10823
11031
|
var BulkFilter = function BulkFilter() {
|
|
@@ -10892,14 +11100,14 @@ var Filters = function Filters() {
|
|
|
10892
11100
|
return React.createElement(React.Fragment, null, React.createElement(StyledFiter, null, React.createElement(StyledFIlterELements, null, React.createElement(StyledTableFilter, null)), React.createElement(BulkFilter, null)));
|
|
10893
11101
|
};
|
|
10894
11102
|
|
|
10895
|
-
var ReturnTable$1 = function ReturnTable(
|
|
10896
|
-
var loadingskeleton = _ref.loadingskeleton;
|
|
11103
|
+
var ReturnTable$1 = function ReturnTable() {
|
|
10897
11104
|
var _useClientData = useClientData(),
|
|
10898
11105
|
clientData = _useClientData[0];
|
|
10899
11106
|
var _useState = useState([]),
|
|
10900
11107
|
updatedData = _useState[0],
|
|
10901
11108
|
setUpdatedData = _useState[1];
|
|
10902
11109
|
var _useLoading = useLoading(),
|
|
11110
|
+
statsLoading = _useLoading[0],
|
|
10903
11111
|
setLoading = _useLoading[1];
|
|
10904
11112
|
var _useOrderStaticData = useOrderStaticData(),
|
|
10905
11113
|
setOrderStaticData = _useOrderStaticData[1];
|
|
@@ -10925,19 +11133,19 @@ var ReturnTable$1 = function ReturnTable(_ref) {
|
|
|
10925
11133
|
useEffect(function () {
|
|
10926
11134
|
var updatedClientData = clientData == null ? void 0 : clientData.map(function (client) {
|
|
10927
11135
|
var matchingCustomer = customers == null ? void 0 : customers.find(function (customer) {
|
|
10928
|
-
return (customer == null ? void 0 : customer.
|
|
11136
|
+
return (customer == null ? void 0 : customer.customer_id) === (client == null ? void 0 : client.customer_id);
|
|
10929
11137
|
});
|
|
10930
11138
|
return _extends({}, client, {
|
|
10931
|
-
|
|
11139
|
+
account_number: matchingCustomer ? matchingCustomer == null ? void 0 : matchingCustomer.account_number : null
|
|
10932
11140
|
});
|
|
10933
11141
|
});
|
|
10934
11142
|
setUpdatedData(updatedClientData);
|
|
10935
11143
|
}, [customers, clientData]);
|
|
10936
11144
|
//handle Redirect
|
|
10937
|
-
var handleRedirect = function handleRedirect(customerName, customerId,
|
|
11145
|
+
var handleRedirect = function handleRedirect(customerName, customerId, account_number) {
|
|
10938
11146
|
localStorage.setItem('clientName', customerName);
|
|
10939
11147
|
localStorage.setItem('clientId', customerId == null ? void 0 : customerId.toString());
|
|
10940
|
-
localStorage.setItem('
|
|
11148
|
+
localStorage.setItem('account_number', account_number);
|
|
10941
11149
|
if (customerId) {
|
|
10942
11150
|
dispatch({
|
|
10943
11151
|
type: 'SET_CLIENT_FILTER',
|
|
@@ -10953,12 +11161,13 @@ var ReturnTable$1 = function ReturnTable(_ref) {
|
|
|
10953
11161
|
payload: []
|
|
10954
11162
|
});
|
|
10955
11163
|
}
|
|
10956
|
-
|
|
10957
|
-
|
|
11164
|
+
navigate("filter/" + customerId);
|
|
11165
|
+
//forlocal
|
|
11166
|
+
// navigate(`/filter/${customerId}`);
|
|
10958
11167
|
};
|
|
10959
11168
|
return React.createElement(React.Fragment, null, React.createElement(StyledTableWrapper$2, {
|
|
10960
11169
|
id: "tableScrolling"
|
|
10961
|
-
}, React.createElement(StyledTable$3, null, React.createElement("thead", null, React.createElement("tr", null, React.createElement("th", null, "Trading Name"), React.createElement("th", null, "Client"), React.createElement("th", null, "Orders"), React.createElement("th", null, "Products"), React.createElement("th", null, "RTS"), React.createElement("th", null, "Pending"), React.createElement("th", null, "Dispose"), React.createElement("th", null, "Re-allocate"), React.createElement("th", null, "Re-Del"), React.createElement("th", null, "Recycle"), React.createElement("th", null, "Unknown"))), React.createElement("tbody", null,
|
|
11170
|
+
}, React.createElement(StyledTable$3, null, React.createElement("thead", null, React.createElement("tr", null, React.createElement("th", null, "Trading Name"), React.createElement("th", null, "Client"), React.createElement("th", null, "Orders"), React.createElement("th", null, "Products"), React.createElement("th", null, "RTS"), React.createElement("th", null, "Pending"), React.createElement("th", null, "Dispose"), React.createElement("th", null, "Re-allocate"), React.createElement("th", null, "Re-Del"), React.createElement("th", null, "Recycle"), React.createElement("th", null, "Unknown"))), React.createElement("tbody", null, statsLoading ? React.createElement("tr", null, React.createElement("td", {
|
|
10962
11171
|
colSpan: 11
|
|
10963
11172
|
}, React.createElement(Skeleton, {
|
|
10964
11173
|
active: true
|
|
@@ -10969,55 +11178,107 @@ var ReturnTable$1 = function ReturnTable(_ref) {
|
|
|
10969
11178
|
key: index
|
|
10970
11179
|
}, React.createElement("td", null, key == null ? void 0 : key.trading_as), React.createElement("td", {
|
|
10971
11180
|
onClick: function onClick() {
|
|
10972
|
-
return handleRedirect(key == null ? void 0 : key.customer_name, key == null ? void 0 : key.customer_id, key == null ? void 0 : key.
|
|
11181
|
+
return handleRedirect(key == null ? void 0 : key.customer_name, key == null ? void 0 : key.customer_id, key == null ? void 0 : key.account_number);
|
|
10973
11182
|
},
|
|
10974
11183
|
style: {
|
|
10975
11184
|
color: '#0099ff',
|
|
10976
11185
|
fontWeight: 600,
|
|
10977
11186
|
cursor: 'pointer'
|
|
10978
11187
|
}
|
|
10979
|
-
}, React.createElement("span", null, key == null ? void 0 : key.customer_name)), React.createElement("td", null, React.createElement(ColumStyle, null, React.createElement(GreyBox, null, key == null ? void 0 : key.
|
|
11188
|
+
}, React.createElement("span", null, key == null ? void 0 : key.customer_name)), React.createElement("td", null, React.createElement(ColumStyle, null, React.createElement(GreyBox, null, key == null ? void 0 : key.orders))), React.createElement("td", null, React.createElement(ColumStyle, null, React.createElement(GreyBox, null, key == null ? void 0 : key.return_order_products))), React.createElement("td", null, React.createElement(ColumStyle, null, React.createElement(GreyBox, null, key == null ? void 0 : key.RTS))), React.createElement("td", null, React.createElement(ColumStyle, null, React.createElement(GreyBox, null, key == null ? void 0 : key.PENDING))), React.createElement("td", null, React.createElement(ColumStyle, null, React.createElement(GreyBox, null, key == null ? void 0 : key.DISPOSE))), React.createElement("td", null, React.createElement(ColumStyle, null, React.createElement(GreyBox, null, key == null ? void 0 : key['RE-ALLOCATE']), ' ')), React.createElement("td", null, React.createElement(ColumStyle, null, React.createElement(GreyBox, null, key == null ? void 0 : key['RE-DEL']))), React.createElement("td", null, React.createElement(ColumStyle, null, React.createElement(GreyBox, null, key == null ? void 0 : key.RECYCLE))), React.createElement("td", null, React.createElement(ColumStyle, null, React.createElement(GreyBox, null, key == null ? void 0 : key.UNKNOWN))));
|
|
10980
11189
|
})))));
|
|
10981
11190
|
};
|
|
10982
11191
|
|
|
10983
|
-
|
|
11192
|
+
// let todayDate = new Date();
|
|
11193
|
+
var initialState$3 = {
|
|
11194
|
+
'x-filters': [
|
|
11195
|
+
// {
|
|
11196
|
+
// field: 'action_date',
|
|
11197
|
+
// op: '>=',
|
|
11198
|
+
// value: `${format(new Date(todayDate), 'yyyy-MM-dd')}T00:00:00+00:00`,
|
|
11199
|
+
// },
|
|
11200
|
+
// {
|
|
11201
|
+
// field: 'action_date',
|
|
11202
|
+
// op: '<=',
|
|
11203
|
+
// value: `${format(new Date(todayDate), 'yyyy-MM-dd')}T23:59:59+00:00`,
|
|
11204
|
+
// },
|
|
11205
|
+
// { field: 'status', op: 'count', value: '' },
|
|
11206
|
+
],
|
|
11207
|
+
'x-pagination': {
|
|
11208
|
+
page: 1,
|
|
11209
|
+
per_page: 50
|
|
11210
|
+
}
|
|
11211
|
+
};
|
|
11212
|
+
var filterReducer$2 = function filterReducer(state, action) {
|
|
11213
|
+
switch (action.type) {
|
|
11214
|
+
case 'SET_PAGE':
|
|
11215
|
+
return _extends({}, state, {
|
|
11216
|
+
'x-pagination': _extends({}, state['x-pagination'], {
|
|
11217
|
+
page: action.payload
|
|
11218
|
+
})
|
|
11219
|
+
});
|
|
11220
|
+
case 'SET_PERPAGE':
|
|
11221
|
+
return _extends({}, state, {
|
|
11222
|
+
'x-pagination': _extends({}, state['x-pagination'], {
|
|
11223
|
+
per_page: action.payload
|
|
11224
|
+
})
|
|
11225
|
+
});
|
|
11226
|
+
case 'CLEAR_FILTERS':
|
|
11227
|
+
return _extends({}, state);
|
|
11228
|
+
case 'CLEAR_ALL_FILTER':
|
|
11229
|
+
return _extends({}, state);
|
|
11230
|
+
default:
|
|
11231
|
+
return state;
|
|
11232
|
+
}
|
|
11233
|
+
};
|
|
11234
|
+
var filtersStateAtom$2 = /*#__PURE__*/atom(initialState$3);
|
|
11235
|
+
var overviewfiltersReducerAtom = /*#__PURE__*/atom(function (get) {
|
|
11236
|
+
return get(filtersStateAtom$2);
|
|
11237
|
+
}, function (get, set, action) {
|
|
11238
|
+
return set(filtersStateAtom$2, filterReducer$2(get(filtersStateAtom$2), action));
|
|
11239
|
+
});
|
|
11240
|
+
|
|
11241
|
+
var _templateObject$24, _templateObject2$1z, _templateObject3$T;
|
|
10984
11242
|
// import Pagination from './table-view/Pagination';
|
|
10985
11243
|
// import { overviewfiltersReducerAtom } from './header-filters/overViewFilter';
|
|
10986
11244
|
function ReturnMainTable() {
|
|
10987
|
-
|
|
10988
|
-
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
11245
|
+
var _useAtom = useAtom(overviewfiltersReducerAtom),
|
|
11246
|
+
state = _useAtom[0];
|
|
11247
|
+
var _UsePaginationOvervie = UsePaginationOverviewData(),
|
|
11248
|
+
paginationObj = _UsePaginationOvervie[0];
|
|
11249
|
+
var _useState = useState(1),
|
|
11250
|
+
setCurrentPage = _useState[1];
|
|
11251
|
+
var _useItemsPerOverviewP = useItemsPerOverviewPage(),
|
|
11252
|
+
itemsPerPage = _useItemsPerOverviewP[0],
|
|
11253
|
+
setItemsPerPage = _useItemsPerOverviewP[1];
|
|
11254
|
+
var pagination = state['x-pagination'];
|
|
11255
|
+
var page = paginationObj.page,
|
|
11256
|
+
total = paginationObj.total;
|
|
10993
11257
|
// const [selectedClient] = useTableName();
|
|
10994
|
-
// const [, setPaginationObject] = UsePaginationData();
|
|
10995
11258
|
var _useStickyStatus = useStickyStatus(),
|
|
10996
11259
|
isScrolled = _useStickyStatus[0];
|
|
10997
11260
|
var _useLoading = useLoading(),
|
|
10998
11261
|
setLoading = _useLoading[1];
|
|
10999
11262
|
var _useClientData = useClientData(),
|
|
11000
11263
|
setClientData = _useClientData[1];
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11264
|
+
var _useTableName = useTableName(),
|
|
11265
|
+
tableName = _useTableName[0];
|
|
11266
|
+
var handlePageChange = function handlePageChange(page) {
|
|
11267
|
+
setCurrentPage(page);
|
|
11268
|
+
};
|
|
11269
|
+
var handleItemsPerPageChange = function handleItemsPerPageChange(itemsPerPage) {
|
|
11270
|
+
setItemsPerPage(itemsPerPage);
|
|
11271
|
+
};
|
|
11007
11272
|
var _useApiHook = useApiHook({
|
|
11008
|
-
endpoint: "/return_orders/
|
|
11273
|
+
endpoint: "/return_orders/stats/",
|
|
11009
11274
|
method: 'GET',
|
|
11010
11275
|
//@ts-ignore
|
|
11011
|
-
pagination:
|
|
11012
|
-
page: 1,
|
|
11013
|
-
per_page: 200,
|
|
11014
|
-
is_pagination: false
|
|
11015
|
-
}
|
|
11276
|
+
pagination: pagination
|
|
11016
11277
|
}),
|
|
11017
11278
|
fetchedClientData = _useApiHook.data,
|
|
11018
|
-
|
|
11279
|
+
statsDataLoading = _useApiHook.loading;
|
|
11019
11280
|
useEffect(function () {
|
|
11020
|
-
setLoading(
|
|
11281
|
+
setLoading(statsDataLoading);
|
|
11021
11282
|
if (fetchedClientData && fetchedClientData.data) {
|
|
11022
11283
|
var result = fetchedClientData == null ? void 0 : fetchedClientData.data;
|
|
11023
11284
|
setClientData(result);
|
|
@@ -11031,33 +11292,38 @@ function ReturnMainTable() {
|
|
|
11031
11292
|
// });
|
|
11032
11293
|
// }
|
|
11033
11294
|
}
|
|
11034
|
-
}, [
|
|
11035
|
-
var getClient = localStorage.getItem('clientName');
|
|
11295
|
+
}, [statsDataLoading]);
|
|
11036
11296
|
return React.createElement(React.Fragment, null, React.createElement(DashBoardWrapper$3, {
|
|
11037
11297
|
className: " " + (isScrolled ? 'stickyTableHead' : '')
|
|
11038
11298
|
}, React.createElement("div", {
|
|
11039
11299
|
className: "Tableconatiner"
|
|
11040
|
-
}, React.createElement(HeaderFilter, null), React.createElement(Container$18, null, React.createElement(Row$7, null, React.createElement(Text$8, null, "Client Return"),
|
|
11300
|
+
}, React.createElement(HeaderFilter, null), React.createElement(Container$18, null, React.createElement(Row$7, null, React.createElement(Text$8, null, "Client Return"), tableName ? React.createElement(ReturnFilter, null) : React.createElement(Filters, null)), React.createElement(ReturnTable$1, null)), total > 0 && React.createElement(Pagination, {
|
|
11301
|
+
currentPage: page,
|
|
11302
|
+
totalItems: total,
|
|
11303
|
+
itemsPerPage: itemsPerPage,
|
|
11304
|
+
onPageChange: handlePageChange,
|
|
11305
|
+
onItemsPerPageChange: handleItemsPerPageChange
|
|
11306
|
+
}))));
|
|
11041
11307
|
}
|
|
11042
|
-
var Row$7 = /*#__PURE__*/styled.div(_templateObject$
|
|
11308
|
+
var Row$7 = /*#__PURE__*/styled.div(_templateObject$24 || (_templateObject$24 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"])));
|
|
11043
11309
|
var Container$18 = /*#__PURE__*/styled.div(_templateObject2$1z || (_templateObject2$1z = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n top: -46px;\n"])));
|
|
11044
11310
|
var DashBoardWrapper$3 = /*#__PURE__*/styled.section(_templateObject3$T || (_templateObject3$T = /*#__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"])));
|
|
11045
11311
|
|
|
11046
|
-
var _templateObject$
|
|
11047
|
-
var HeaderWrapper = /*#__PURE__*/styled.div(_templateObject$
|
|
11312
|
+
var _templateObject$25, _templateObject2$1A;
|
|
11313
|
+
var HeaderWrapper = /*#__PURE__*/styled.div(_templateObject$25 || (_templateObject$25 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n padding: 20px;\n gap: 10px;\n border-radius: 0px 0px 30px 30px;\n background: #313130;\n height: 151px;\n background: url(./assets/bgBlack.png) no-repeat;\n background-size: cover;\n background-color: #000000d9;\n"])));
|
|
11048
11314
|
var StyledFlex = /*#__PURE__*/styled.div(_templateObject2$1A || (_templateObject2$1A = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
|
|
11049
11315
|
|
|
11050
|
-
var _templateObject$
|
|
11316
|
+
var _templateObject$26;
|
|
11051
11317
|
var HeaderTitle = function HeaderTitle(props) {
|
|
11052
11318
|
return React.createElement(React.Fragment, null, React.createElement(Title$7, null, props.title));
|
|
11053
11319
|
};
|
|
11054
|
-
var Title$7 = /*#__PURE__*/styled.h2(_templateObject$
|
|
11320
|
+
var Title$7 = /*#__PURE__*/styled.h2(_templateObject$26 || (_templateObject$26 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0px;\n padding: 0px;\n color: #fff;\n font-size: 26px;\n font-style: normal;\n font-weight: 700;\n line-height: 36px;\n text-transform: uppercase;\n margin-bottom: 8px;\n"])));
|
|
11055
11321
|
|
|
11056
|
-
var _templateObject$
|
|
11322
|
+
var _templateObject$27, _templateObject2$1B;
|
|
11057
11323
|
function Breadcrumb(props) {
|
|
11058
11324
|
return React.createElement(BreadcrumbContainer, null, React.createElement(BreadcrumbList, null, props.title || ''), React.createElement(BreadcrumbList, null, props.subtitle || ''), props.subPart && React.createElement(React.Fragment, null, React.createElement(BreadcrumbList, null, props.subPart)));
|
|
11059
11325
|
}
|
|
11060
|
-
var BreadcrumbContainer = /*#__PURE__*/styled.div(_templateObject$
|
|
11326
|
+
var BreadcrumbContainer = /*#__PURE__*/styled.div(_templateObject$27 || (_templateObject$27 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n"])));
|
|
11061
11327
|
var BreadcrumbList = /*#__PURE__*/styled.span(_templateObject2$1B || (_templateObject2$1B = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #edebe8;\n font-family: 'Open Sans', sans-serif;\n font-size: 13px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n"])));
|
|
11062
11328
|
|
|
11063
11329
|
var RouterHeader = function RouterHeader(_ref) {
|
|
@@ -11080,20 +11346,16 @@ var RouterHeader = function RouterHeader(_ref) {
|
|
|
11080
11346
|
})))));
|
|
11081
11347
|
};
|
|
11082
11348
|
|
|
11083
|
-
// import { filtersReducerAtom } from './components/order-daily-overview/header-filters/filterStore';
|
|
11084
11349
|
function ReturnClient() {
|
|
11085
|
-
var _selectedClientString;
|
|
11086
11350
|
notification.config({
|
|
11087
11351
|
top: 80
|
|
11088
11352
|
});
|
|
11089
11353
|
var LoadingMessage = function LoadingMessage() {
|
|
11090
11354
|
return React.createElement("div", null, "Loading...");
|
|
11091
11355
|
};
|
|
11092
|
-
var
|
|
11093
|
-
|
|
11356
|
+
var _useIdForTableName = useIdForTableName(),
|
|
11357
|
+
selectedClientId = _useIdForTableName[0];
|
|
11094
11358
|
var navigate = useNavigate();
|
|
11095
|
-
var selectedClientString = selectedClient == null ? void 0 : selectedClient.replace(/\s+/g, '-');
|
|
11096
|
-
selectedClientString = (_selectedClientString = selectedClientString) == null ? void 0 : _selectedClientString.toLowerCase();
|
|
11097
11359
|
var _useCustomerData = useCustomerData(),
|
|
11098
11360
|
setCustomers = _useCustomerData[1];
|
|
11099
11361
|
var _useActionType = useActionType(),
|
|
@@ -11102,7 +11364,14 @@ function ReturnClient() {
|
|
|
11102
11364
|
setLocationData = _useLocationData[1];
|
|
11103
11365
|
var _useStatusOrderData = useStatusOrderData(),
|
|
11104
11366
|
setStatusOfOrders = _useStatusOrderData[1];
|
|
11105
|
-
|
|
11367
|
+
var _useAssignData = useAssignData(),
|
|
11368
|
+
setAssignData = _useAssignData[1];
|
|
11369
|
+
var _useActionTypeOptions = useActionTypeOptions(),
|
|
11370
|
+
setActionTypeOptions = _useActionTypeOptions[1];
|
|
11371
|
+
var _useLocationOptions = useLocationOptions(),
|
|
11372
|
+
setLocationOptions = _useLocationOptions[1];
|
|
11373
|
+
var _useTableName = useTableName(),
|
|
11374
|
+
setTableName = _useTableName[1];
|
|
11106
11375
|
var splitPath = function splitPath(str) {
|
|
11107
11376
|
var _str$split;
|
|
11108
11377
|
var parts = str == null || (_str$split = str.split('/')) == null ? void 0 : _str$split.filter(function (part) {
|
|
@@ -11115,23 +11384,25 @@ function ReturnClient() {
|
|
|
11115
11384
|
if (paths[paths.length - 1] === 'returnclient') {
|
|
11116
11385
|
localStorage.removeItem('clientName');
|
|
11117
11386
|
localStorage.removeItem('clientId');
|
|
11118
|
-
localStorage.removeItem('
|
|
11119
|
-
|
|
11387
|
+
localStorage.removeItem('account_number');
|
|
11388
|
+
setActionTypeOptions([]);
|
|
11389
|
+
setLocationOptions([]);
|
|
11390
|
+
setTableName('');
|
|
11120
11391
|
}
|
|
11121
11392
|
}, [location.pathname]);
|
|
11122
11393
|
useEffect(function () {
|
|
11123
|
-
if (
|
|
11124
|
-
|
|
11125
|
-
navigate("filter/" + _selectedClientString2);
|
|
11394
|
+
if (selectedClientId) {
|
|
11395
|
+
navigate("filter/" + selectedClientId);
|
|
11126
11396
|
}
|
|
11127
|
-
}, [
|
|
11397
|
+
}, [selectedClientId]);
|
|
11128
11398
|
//API for client data
|
|
11129
11399
|
var _useApiHook = useApiHook({
|
|
11130
|
-
endpoint: "/customers/",
|
|
11400
|
+
endpoint: "/return_orders/customers/",
|
|
11131
11401
|
method: 'GET',
|
|
11132
11402
|
//@ts-ignore
|
|
11133
11403
|
pagination: {
|
|
11134
|
-
|
|
11404
|
+
page: 1,
|
|
11405
|
+
per_page: 50
|
|
11135
11406
|
}
|
|
11136
11407
|
}),
|
|
11137
11408
|
fetchedCustomerData = _useApiHook.data,
|
|
@@ -11161,13 +11432,16 @@ function ReturnClient() {
|
|
|
11161
11432
|
}, [loading]);
|
|
11162
11433
|
useEffect(function () {
|
|
11163
11434
|
if (fetchedStaticData && fetchedStaticData != null && fetchedStaticData.data) {
|
|
11164
|
-
var _fetchedStaticData$da, _fetchedStaticData$da2;
|
|
11435
|
+
var _fetchedStaticData$da, _fetchedStaticData$da2, _fetchedStaticData$da3;
|
|
11165
11436
|
setActionType(fetchedStaticData == null || (_fetchedStaticData$da = fetchedStaticData.data) == null ? void 0 : _fetchedStaticData$da.flatMap(function (i) {
|
|
11166
11437
|
return i == null ? void 0 : i.order_product_return_action;
|
|
11167
11438
|
}));
|
|
11168
11439
|
setStatusOfOrders(fetchedStaticData == null || (_fetchedStaticData$da2 = fetchedStaticData.data) == null ? void 0 : _fetchedStaticData$da2.flatMap(function (i) {
|
|
11169
11440
|
return i == null ? void 0 : i.order_stock_alias;
|
|
11170
11441
|
}));
|
|
11442
|
+
setAssignData(fetchedStaticData == null || (_fetchedStaticData$da3 = fetchedStaticData.data) == null ? void 0 : _fetchedStaticData$da3.flatMap(function (i) {
|
|
11443
|
+
return i == null ? void 0 : i.assign_client;
|
|
11444
|
+
}));
|
|
11171
11445
|
}
|
|
11172
11446
|
}, [actionLoading]);
|
|
11173
11447
|
useEffect(function () {
|
|
@@ -11187,7 +11461,7 @@ function ReturnClient() {
|
|
|
11187
11461
|
path: "order-return/:id",
|
|
11188
11462
|
element: React.createElement(OrderView, null)
|
|
11189
11463
|
}), React.createElement(Route, {
|
|
11190
|
-
path: "filter/:
|
|
11464
|
+
path: "filter/:clientId",
|
|
11191
11465
|
element: React.createElement(ReturnTable, null)
|
|
11192
11466
|
}))));
|
|
11193
11467
|
}
|