@bjsdistribution/dms-client-return 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/components/order-daily-overview/common/fakedata.d.ts +4 -0
  2. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.d.ts +1 -1
  3. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/{PrintDropDown.d.ts → PrintDropDownReturn.d.ts} +2 -2
  4. package/dist/components/store.d.ts +6 -1
  5. package/dist/dms-client-return.cjs.development.js +279 -112
  6. package/dist/dms-client-return.cjs.development.js.map +1 -1
  7. package/dist/dms-client-return.cjs.production.min.js +1 -1
  8. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  9. package/dist/dms-client-return.esm.js +280 -113
  10. package/dist/dms-client-return.esm.js.map +1 -1
  11. package/package.json +2 -2
  12. package/src/components/order-daily-overview/common/fakedata.tsx +4 -0
  13. package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +10 -1
  14. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +15 -7
  15. package/src/components/order-daily-overview/index.tsx +1 -1
  16. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +4 -8
  17. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +12 -14
  18. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +32 -33
  19. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +74 -30
  20. package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +3 -0
  21. package/src/components/order-daily-overview/table-view/Pagination.tsx +15 -14
  22. package/src/components/order-view/details-filters/left-side-filters/dropdowns/{PrintDropDown.tsx → PrintDropDownReturn.tsx} +4 -4
  23. package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +74 -36
  24. package/src/components/order-view/modalsPopup/ModalManager.tsx +47 -12
  25. package/src/components/store.ts +35 -0
@@ -4,7 +4,7 @@ import styled, { css, keyframes } from 'styled-components';
4
4
  import { Label as Label$h, Input as Input$1, TextArea, FormSection, displayValueOrNA as displayValueOrNA$1, SelectDropdown, dropdownStyles, RadioButtonGroup as RadioButtonGroup$1, Switch, Button as Button$1, useApiHook, getBaseEndpoint, formatDateTime, Alert, Checkbox as Checkbox$1, SectionHeader, CrossIcon, AntSelect, AntTable, CustomRating, DeleteIcon, 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, Input as Input$2, Select, Empty, Checkbox as Checkbox$2, Tabs, Tooltip } from 'antd';
7
+ import { DatePicker, notification, Skeleton, Upload, message, Input as Input$2, Select, Empty, Checkbox as Checkbox$2, Tabs } 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';
@@ -3143,7 +3143,7 @@ function GeneralHeader() {
3143
3143
  var Section = /*#__PURE__*/styled.div(_templateObject$V || (_templateObject$V = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n /* display: flex;\n background: #ffffff;\n // padding: 15px;\n flex-direction: column;\n gap: 14px;\n border-radius: 12px;\n box-shadow: 0px 4px 30px 0px rgba(46, 45, 116, 0.05);\n border: 1px solid #e0e0e0; */\n"])));
3144
3144
 
3145
3145
  var _templateObject19, _templateObject20, _templateObject21;
3146
- var StyledTable = /*#__PURE__*/styled.table(_templateObject19 || (_templateObject19 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-spacing: 0 10px;\n width: 100%;\n /* min-width: 1600px; */\n thead {\n white-space: nowrap;\n tr {\n border-radius: 40px;\n border-spacing: 0 10px;\n .emailInvoiceCheckbox {\n padding-right: 0px;\n width: 0;\n > div {\n width: fit-content;\n }\n }\n .emailInvoiceNo {\n padding-left: 0px;\n }\n .emailInvoiceShare {\n width: 100px;\n }\n th {\n color: #3a3630;\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n padding: 11px 15px;\n background: #f0f2f2;\n border-right: none;\n border-left: none;\n text-align: left;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-width: 1px 0;\n &:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n &:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n }\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 .actionbox {\n display: flex;\n gap: 5px;\n }\n .shareIconContainer {\n display: flex;\n padding: 2px 12px;\n align-items: center;\n gap: 8px;\n border-radius: 20px;\n border: 1px solid var(--tonal-brown-101, #e2e0db);\n background: #fff;\n list-style-type: none;\n /* padding-left: 0; */\n /* fontWeight: 600,\n paddingLeft: 0, */\n cursor: pointer;\n position: relative;\n }\n .statusCancelled {\n color: #e95252;\n /* background: rgba(233, 82, 82, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusOnHold {\n color: #f4a503;\n /* background: #fff1d6; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusSubContracted {\n color: #845adf;\n /* background: rgba(132, 90, 223, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusAwaiting {\n color: #845adf;\n /* background: rgba(132, 90, 223, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusCompleted {\n color: #1f9254;\n /* background: rgba(41, 204, 106, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusOutstanding {\n color: #f4a503;\n /* background: #fff1d6; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusUnknown {\n color: #000;\n /* background: #fff; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n .statustext {\n color: #1f9254;\n font-family: 'Open Sans';\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n }\n .downloadcontainer {\n display: flex;\n padding: 2px 12px;\n align-items: center;\n\n width: 28px;\n height: 28px;\n flex-direction: column;\n\n border-radius: 14px;\n border: 1px solid #e2e0db;\n background: #fff;\n }\n .statuscontainer {\n display: flex;\n padding: 5px 30px 5px 30px;\n justify-content: center;\n align-items: center;\n gap: 5px;\n flex: 1 0 0;\n border-radius: 22px;\n background: rgba(41, 204, 106, 0.15);\n }\n .awaiting {\n display: flex;\n min-width: 85px;\n padding: 6px 10px;\n justify-content: center;\n align-items: center;\n gap: 5px;\n border-radius: 22px;\n background: rgba(233, 82, 82, 0.15);\n color: #e95252;\n font-family: 'Open Sans';\n font-size: 12px;\n font-weight: 600;\n }\n ul > li > a {\n text-decoration: none !important;\n color: #0099ff;\n }\n }\n &:nth-child(even) td {\n background: #f6fbff;\n }\n td:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n td:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n .flex {\n display: flex;\n flex-direction: row;\n gap: 5px;\n height: 29px;\n align-items: center;\n }\n\n &.insideTable {\n td {\n border-radius: 0;\n border: none;\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n table {\n border-spacing: 0;\n width: 100%;\n border-radius: 5px;\n border: 1px solid rgba(0, 0, 0, 0.08);\n overflow: hidden;\n border-top-left-radius: 15px;\n border-top-right-radius: 15px;\n thead {\n tr {\n border-bottom: none;\n th {\n padding: 14px 20px;\n text-align: left;\n border-top: 0;\n border-right: 0;\n border-left: 0;\n background: #f8fafc;\n\n &:first-child {\n border-radius: 0;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n border-top-left-radius: 15px;\n }\n &:last-child {\n border-radius: 0;\n }\n }\n }\n }\n tbody {\n tr {\n td {\n padding: 14px 20px;\n text-align: left;\n border-bottom: 1px solid rgba(58, 54, 48, 0.15);\n background: #fff;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n }\n }\n }\n }\n }\n }\n .actions {\n display: flex;\n align-items: center;\n gap: 20px;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n\n .close-icon {\n transform: scale(1.3);\n background-color: transparent;\n border-radius: 0;\n padding: 0;\n }\n }\n"])));
3146
+ var StyledTable = /*#__PURE__*/styled.table(_templateObject19 || (_templateObject19 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-spacing: 0 10px;\n width: 100%;\n /* min-width: 1600px; */\n thead {\n white-space: nowrap;\n tr {\n border-radius: 40px;\n border-spacing: 0 10px;\n .emailInvoiceCheckbox {\n padding-right: 0px;\n width: 0;\n > div {\n width: fit-content;\n }\n }\n .custom-check {\n position: relative;\n }\n .emailInvoiceNo {\n padding-left: 0px;\n }\n .emailInvoiceShare {\n width: 100px;\n }\n th {\n color: #3a3630;\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n padding: 11px 15px;\n background: #f0f2f2;\n border-right: none;\n border-left: none;\n text-align: left;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-width: 1px 0;\n &:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n &:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n }\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 .actionbox {\n display: flex;\n gap: 5px;\n }\n .shareIconContainer {\n display: flex;\n padding: 2px 12px;\n align-items: center;\n gap: 8px;\n border-radius: 20px;\n border: 1px solid var(--tonal-brown-101, #e2e0db);\n background: #fff;\n list-style-type: none;\n /* padding-left: 0; */\n /* fontWeight: 600,\n paddingLeft: 0, */\n cursor: pointer;\n position: relative;\n }\n .statusCancelled {\n color: #e95252;\n /* background: rgba(233, 82, 82, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusOnHold {\n color: #f4a503;\n /* background: #fff1d6; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusSubContracted {\n color: #845adf;\n /* background: rgba(132, 90, 223, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusAwaiting {\n color: #845adf;\n /* background: rgba(132, 90, 223, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusCompleted {\n color: #1f9254;\n /* background: rgba(41, 204, 106, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusOutstanding {\n color: #f4a503;\n /* background: #fff1d6; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusUnknown {\n color: #000;\n /* background: #fff; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n .statustext {\n color: #1f9254;\n font-family: 'Open Sans';\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n }\n .downloadcontainer {\n display: flex;\n padding: 2px 12px;\n align-items: center;\n\n width: 28px;\n height: 28px;\n flex-direction: column;\n\n border-radius: 14px;\n border: 1px solid #e2e0db;\n background: #fff;\n }\n .statuscontainer {\n display: flex;\n padding: 5px 30px 5px 30px;\n justify-content: center;\n align-items: center;\n gap: 5px;\n flex: 1 0 0;\n border-radius: 22px;\n background: rgba(41, 204, 106, 0.15);\n }\n .awaiting {\n display: flex;\n min-width: 85px;\n padding: 6px 10px;\n justify-content: center;\n align-items: center;\n gap: 5px;\n border-radius: 22px;\n background: rgba(233, 82, 82, 0.15);\n color: #e95252;\n font-family: 'Open Sans';\n font-size: 12px;\n font-weight: 600;\n }\n ul > li > a {\n text-decoration: none !important;\n color: #0099ff;\n }\n }\n &:nth-child(even) td {\n background: #f6fbff;\n }\n td:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n td:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n .flex {\n display: flex;\n flex-direction: row;\n gap: 5px;\n height: 29px;\n align-items: center;\n }\n\n &.insideTable {\n td {\n border-radius: 0;\n border: none;\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n table {\n border-spacing: 0;\n width: 100%;\n border-radius: 5px;\n border: 1px solid rgba(0, 0, 0, 0.08);\n overflow: hidden;\n border-top-left-radius: 15px;\n border-top-right-radius: 15px;\n thead {\n tr {\n border-bottom: none;\n th {\n padding: 14px 20px;\n text-align: left;\n border-top: 0;\n border-right: 0;\n border-left: 0;\n background: #f8fafc;\n\n &:first-child {\n border-radius: 0;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n border-top-left-radius: 15px;\n }\n &:last-child {\n border-radius: 0;\n }\n }\n }\n }\n tbody {\n tr {\n td {\n padding: 14px 20px;\n text-align: left;\n border-bottom: 1px solid rgba(58, 54, 48, 0.15);\n background: #fff;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n }\n }\n }\n }\n }\n }\n .actions {\n display: flex;\n align-items: center;\n gap: 20px;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n\n .close-icon {\n transform: scale(1.3);\n background-color: transparent;\n border-radius: 0;\n padding: 0;\n }\n }\n"])));
3147
3147
  // Styled components
3148
3148
  var StyledTableWrapper = /*#__PURE__*/styled.div(_templateObject20 || (_templateObject20 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n overflow-x: auto;\n max-height: calc(100vh - 396px);\n scrollbar-width: none;\n height: 600px;\n /* box-shadow: 0px 0px 30px 6px rgba(46, 45, 116, 0.05); */\n &::-webkit-scrollbar {\n width: 5px;\n border-radius: 100px;\n height: 5px;\n }\n\n &::-webkit-scrollbar-track {\n background: #777;\n border-radius: 100px;\n }\n\n &::-webkit-scrollbar-thumb {\n background: #7b61ff;\n border-radius: 100px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: #7b61ff;\n }\n"])));
3149
3149
  var CustomDrop = /*#__PURE__*/styled.div(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n /* border-radius: 20px;\n border: 1px solid #e2e0db;\n background: #fff;\n display: flex;\n padding: 4px 8px;\n gap: 8px;\n align-items: center; */\n cursor: pointer;\n &.active .drop {\n transform: rotate(180deg);\n }\n"])));
@@ -3178,6 +3178,11 @@ var locationData = /*#__PURE__*/atom([]);
3178
3178
  var createReturnPayload = /*#__PURE__*/atom(CreateReturnInitial);
3179
3179
  var newPayload = /*#__PURE__*/atom([]);
3180
3180
  var grpPayload = /*#__PURE__*/atom([]);
3181
+ var statusOfOrder = /*#__PURE__*/atom([]);
3182
+ var selectedLocationConfirm = /*#__PURE__*/atom([]);
3183
+ var selectAll = /*#__PURE__*/atom(false);
3184
+ var postLoading = /*#__PURE__*/atom(false);
3185
+ var _final = /*#__PURE__*/atom([]);
3181
3186
  var selectedOrderlList = /*#__PURE__*/atom([]);
3182
3187
  function useSelectedOrders() {
3183
3188
  return useAtom(selectedOrderlList);
@@ -3205,6 +3210,21 @@ function useNewReturnPayload() {
3205
3210
  function useGroupedPayload() {
3206
3211
  return useAtom(grpPayload);
3207
3212
  }
3213
+ function useStatusOrderData() {
3214
+ return useAtom(statusOfOrder);
3215
+ }
3216
+ function useSelectedConfirmLoc() {
3217
+ return useAtom(selectedLocationConfirm);
3218
+ }
3219
+ function useSelectAll() {
3220
+ return useAtom(selectAll);
3221
+ }
3222
+ function usePostLoading() {
3223
+ return useAtom(postLoading);
3224
+ }
3225
+ function useFinalPayload() {
3226
+ return useAtom(_final);
3227
+ }
3208
3228
 
3209
3229
  var ReturnProductTable = function ReturnProductTable() {
3210
3230
  var _useSelectedOrders = useSelectedOrders(),
@@ -8335,6 +8355,12 @@ function SelectionFilter() {
8335
8355
  setStoredCustomerId = _useState6[1];
8336
8356
  var _useNewReturnPayload = useNewReturnPayload(),
8337
8357
  setNewPayload = _useNewReturnPayload[1];
8358
+ var _useGroupedPayload = useGroupedPayload(),
8359
+ setGrouped = _useGroupedPayload[1];
8360
+ var _useSelectedOrders = useSelectedOrders(),
8361
+ setSelectedReturnOrder = _useSelectedOrders[1];
8362
+ var _useSelectAll = useSelectAll(),
8363
+ setSelectAll = _useSelectAll[1];
8338
8364
  //client options
8339
8365
  var clientOptions = customers == null ? void 0 : customers.map(function (option) {
8340
8366
  var _option$customer_name, _option$customer_name2;
@@ -8357,7 +8383,7 @@ function SelectionFilter() {
8357
8383
  var LocationOptions = locationData == null ? void 0 : locationData.map(function (option) {
8358
8384
  return {
8359
8385
  label: option == null ? void 0 : option.location_name,
8360
- value: option == null ? void 0 : option.customer_id
8386
+ value: option == null ? void 0 : option.token
8361
8387
  };
8362
8388
  });
8363
8389
  //client change
@@ -8383,7 +8409,6 @@ function SelectionFilter() {
8383
8409
  customer_id: storedCustomerId
8384
8410
  });
8385
8411
  });
8386
- console.log(selectedUuids, 'selectedUuids');
8387
8412
  var filteredSubLocations = locationData == null ? void 0 : locationData.filter(function (subCat) {
8388
8413
  return (subCat == null ? void 0 : subCat.customer_id) === selectedUuids;
8389
8414
  }).map(function (subCat) {
@@ -8394,6 +8419,10 @@ function SelectionFilter() {
8394
8419
  });
8395
8420
  setFilteredLocationOptions(filteredSubLocations);
8396
8421
  setUuid('');
8422
+ setSelectedReturnOrder([]);
8423
+ setNewPayload([]);
8424
+ setGrouped([]);
8425
+ setSelectAll(false);
8397
8426
  };
8398
8427
  useEffect(function () {
8399
8428
  var accountNumberFromStorage = localStorage.getItem('account_number');
@@ -8417,8 +8446,7 @@ function SelectionFilter() {
8417
8446
  //location change
8418
8447
  var handleLocationChange = function handleLocationChange(value, option) {
8419
8448
  var selectedLabel = option == null ? void 0 : option.label;
8420
- console.log(value, 'value');
8421
- setSelectedLocationValue(selectedLabel);
8449
+ setSelectedLocationValue(value);
8422
8450
  if (selectedLocationValue === selectedLabel) {
8423
8451
  dispatch({
8424
8452
  type: 'CLEAR_ALL_FILTERS',
@@ -8477,8 +8505,8 @@ function SelectionFilter() {
8477
8505
  setIsButtonEnabled(false);
8478
8506
  }
8479
8507
  }, [storedName, selectedFilterValue, selectedLocationValue]);
8480
- console.log(filteredLocationOptions, 'filteredLocationOptions');
8481
- console.log('check', storedName, selectedFilterValue, selectedLocationValue);
8508
+ // console.log(filteredLocationOptions, 'filteredLocationOptions');
8509
+ // console.log('check', storedName, selectedFilterValue, selectedLocationValue);
8482
8510
  return React.createElement(Wrapper$k, null, React.createElement(FilterRow, null, React.createElement(LeftColumn, null, React.createElement(FilterColumn, null, React.createElement(Label$g, null, "Clients"), React.createElement(StyledAntSelect$5, {
8483
8511
  options: clientOptions,
8484
8512
  placeholder: "Select Client Name",
@@ -8520,6 +8548,8 @@ function HeaderFilter() {
8520
8548
  setActionType = _useActionType[1];
8521
8549
  var _useLocationData = useLocationData(),
8522
8550
  setLocationData = _useLocationData[1];
8551
+ var _useStatusOrderData = useStatusOrderData(),
8552
+ setStatusOfOrders = _useStatusOrderData[1];
8523
8553
  //API for client data
8524
8554
  var _useApiHook = useApiHook({
8525
8555
  endpoint: "/customers/",
@@ -8560,10 +8590,13 @@ function HeaderFilter() {
8560
8590
  }, [loading, fetchedCustomerData]);
8561
8591
  useEffect(function () {
8562
8592
  if (fetchedStaticData && fetchedStaticData != null && fetchedStaticData.data) {
8563
- var _fetchedStaticData$da;
8593
+ var _fetchedStaticData$da, _fetchedStaticData$da2;
8564
8594
  setActionType(fetchedStaticData == null || (_fetchedStaticData$da = fetchedStaticData.data) == null ? void 0 : _fetchedStaticData$da.flatMap(function (i) {
8565
8595
  return i == null ? void 0 : i.order_product_return_action;
8566
8596
  }));
8597
+ setStatusOfOrders(fetchedStaticData == null || (_fetchedStaticData$da2 = fetchedStaticData.data) == null ? void 0 : _fetchedStaticData$da2.flatMap(function (i) {
8598
+ return i == null ? void 0 : i.order_stock_alias;
8599
+ }));
8567
8600
  }
8568
8601
  }, [actionLoading, fetchedStaticData]);
8569
8602
  useEffect(function () {
@@ -8819,29 +8852,17 @@ var displayValueOrNA = function displayValueOrNA(value) {
8819
8852
  return value;
8820
8853
  };
8821
8854
 
8822
- var optionsPrint = [{
8823
- icon: 'runSheet',
8824
- label: 'Print Runsheet'
8825
- }, {
8826
- icon: 'loadSheet',
8827
- label: 'Print Loadsheet'
8828
- }, {
8855
+ var optionsForReturnPrint = [{
8829
8856
  icon: 'deliveryLables',
8830
- label: 'Print Delivery Labels'
8831
- }, {
8832
- icon: 'customerLables',
8833
- label: 'Print Customer Labels'
8834
- }, {
8835
- icon: 'collectionLables',
8836
- label: 'Print Collection Labels'
8857
+ label: 'Print Return Labels'
8837
8858
  }];
8838
8859
 
8839
8860
  var _templateObject$23, _templateObject2$1t;
8840
8861
  // import { PrintIconMap } from '../utils';
8841
8862
  // import { optionsPrint } from '../fakeData';
8842
8863
  // import { PrintData } from '../interface';
8843
- var options$2 = optionsPrint;
8844
- var PrintDropDown = function PrintDropDown() {
8864
+ var options$2 = optionsForReturnPrint;
8865
+ var PrintDropDownReturn = function PrintDropDownReturn() {
8845
8866
  var downloadFiles = function downloadFiles() {};
8846
8867
  return React.createElement(OptionsList, null, options$2.map(function (item, index) {
8847
8868
  var IconComponent = PrintIconMap[item.icon];
@@ -8854,22 +8875,22 @@ var PrintDropDown = function PrintDropDown() {
8854
8875
  var OptionsList = /*#__PURE__*/styled.ul(_templateObject$23 || (_templateObject$23 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n padding: 0;\n list-style: none;\n box-sizing: border-box;\n border-radius: 6px;\n border: 1px solid rgba(224, 226, 231, 0.5);\n background: #fff;\n box-shadow: 0px 4px 30px 0px rgba(46, 45, 116, 0.05);\n width: 177px;\n padding: 5px 1px 3px 1px;\n position: absolute;\n top: 26px;\n right: 0;\n z-index: 99;\n min-width: 194px;\n"])));
8855
8876
  var OptionsListLi = /*#__PURE__*/styled.li(_templateObject2$1t || (_templateObject2$1t = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-bottom: 1px solid #f0f2f2;\n padding: 8px 10px;\n display: flex;\n gap: 12px;\n align-items: center;\n font-size: 13px;\n cursor: pointer;\n &:last-child {\n border: none;\n }\n"])));
8856
8877
 
8857
- var ReturnOrderTable = function ReturnOrderTable(_ref) {
8858
- var loadingskeleton = _ref.loadingskeleton;
8878
+ var ReturnOrderTable = function ReturnOrderTable() {
8859
8879
  var _useAtom = useAtom(filtersReducerAtom),
8860
8880
  state = _useAtom[0];
8861
8881
  var _useSelectedOrders = useSelectedOrders(),
8862
8882
  selectedReturnOrder = _useSelectedOrders[0],
8863
8883
  setSelectedReturnOrder = _useSelectedOrders[1];
8864
- var _useState = useState(false),
8865
- selectAll = _useState[0],
8866
- setSelectAll = _useState[1];
8884
+ var _useSelectAll = useSelectAll(),
8885
+ selectAll = _useSelectAll[0],
8886
+ setSelectAll = _useSelectAll[1];
8867
8887
  var filters = state['x-filters'],
8868
8888
  pagination = state['x-pagination'];
8869
8889
  var _useReturnData = useReturnData(),
8870
8890
  returnData = _useReturnData[0],
8871
8891
  setReturnData = _useReturnData[1];
8872
8892
  var _useLoading = useLoading(),
8893
+ load = _useLoading[0],
8873
8894
  setLoading = _useLoading[1];
8874
8895
  var dropdownRefParent = useRef(null);
8875
8896
  var dropdownRef = useRef(null);
@@ -8884,6 +8905,8 @@ var ReturnOrderTable = function ReturnOrderTable(_ref) {
8884
8905
  setNewPayload = _useNewReturnPayload[1];
8885
8906
  var _useGroupedPayload = useGroupedPayload(),
8886
8907
  setGrouped = _useGroupedPayload[1];
8908
+ var _useLocationData = useLocationData(),
8909
+ locationData = _useLocationData[0];
8887
8910
  var OpenDropDown = function OpenDropDown(index) {
8888
8911
  setPrintToggle(function (prevIndex) {
8889
8912
  return prevIndex === index ? null : index;
@@ -8908,56 +8931,75 @@ var ReturnOrderTable = function ReturnOrderTable(_ref) {
8908
8931
  pagination: pagination
8909
8932
  }),
8910
8933
  fetchedOrderData = _useApiHook.data,
8911
- staticDataLoading = _useApiHook.loading;
8934
+ returnDataLoad = _useApiHook.loading;
8912
8935
  useEffect(function () {
8913
- setLoading(staticDataLoading);
8936
+ setLoading(returnDataLoad);
8914
8937
  if (fetchedOrderData && fetchedOrderData != null && fetchedOrderData.data) {
8915
8938
  setReturnData(fetchedOrderData == null ? void 0 : fetchedOrderData.data);
8916
8939
  }
8917
- }, [fetchedOrderData, staticDataLoading]);
8940
+ }, [fetchedOrderData, returnDataLoad]);
8941
+ useEffect(function () {
8942
+ setLoading(returnDataLoad);
8943
+ if (fetchedOrderData && fetchedOrderData != null && fetchedOrderData.data && locationData) {
8944
+ var updatedReturnData = fetchedOrderData.data.map(function (returnItem) {
8945
+ var matchingLocation = locationData.find(function (location) {
8946
+ return (location == null ? void 0 : location.token) === (returnItem == null ? void 0 : returnItem.return_location);
8947
+ });
8948
+ return _extends({}, returnItem, {
8949
+ new_location: matchingLocation ? matchingLocation.location_name : null
8950
+ });
8951
+ });
8952
+ setReturnData(updatedReturnData);
8953
+ }
8954
+ }, [fetchedOrderData, returnDataLoad, locationData]);
8918
8955
  var handleSelectAll = function handleSelectAll(e) {
8919
8956
  setSelectAll(e.target.checked);
8920
8957
  if (e.target.checked) {
8921
8958
  setSelectedReturnOrder(returnData == null ? void 0 : returnData.map(function (loc) {
8922
- var _loc$return_locations;
8923
8959
  return {
8924
8960
  id: loc.id,
8925
8961
  return_locations: loc == null ? void 0 : loc.return_locations,
8926
8962
  return_location: loc == null ? void 0 : loc.return_location,
8927
- products: loc.id,
8963
+ products: loc == null ? void 0 : loc.legacy_product_id,
8928
8964
  order_product_return_action: loc == null ? void 0 : loc.order_product_return_action,
8929
- return_location_token: loc == null || (_loc$return_locations = loc.return_locations) == null ? void 0 : _loc$return_locations.token
8965
+ return_location_token: loc == null ? void 0 : loc.return_location,
8966
+ new_location: loc == null ? void 0 : loc.new_location
8930
8967
  };
8931
8968
  }));
8932
8969
  setNewPayload(returnData == null ? void 0 : returnData.map(function (loc) {
8933
- var _loc$order_product_re, _loc$return_locations2;
8970
+ var _loc$order_product_re;
8934
8971
  return {
8935
8972
  id: loc.id,
8936
8973
  account_number: createReturn == null ? void 0 : createReturn.account_number,
8937
- customer_id: createReturn == null ? void 0 : createReturn.customer_id,
8938
- products: loc.id,
8939
- return_action: (loc == null || (_loc$order_product_re = loc.order_product_return_action) == null ? void 0 : _loc$order_product_re.type) || null,
8940
- return_location_token: loc == null || (_loc$return_locations2 = loc.return_locations) == null ? void 0 : _loc$return_locations2.token
8974
+ customer_id: +(createReturn == null ? void 0 : createReturn.customer_id),
8975
+ products: [loc == null ? void 0 : loc.legacy_product_id],
8976
+ return_action: [loc == null || (_loc$order_product_re = loc.order_product_return_action) == null ? void 0 : _loc$order_product_re.type] || null,
8977
+ return_location_token: (loc == null ? void 0 : loc.return_location) || null,
8978
+ new_location: loc == null ? void 0 : loc.new_location
8941
8979
  };
8942
8980
  }));
8943
8981
  } else {
8944
8982
  setSelectedReturnOrder([]);
8983
+ setNewPayload([]);
8984
+ setGrouped([]);
8945
8985
  }
8946
8986
  };
8947
- var handleSelectOrderReturn = function handleSelectOrderReturn(id, return_location, return_locations, order_product_return_action) {
8987
+ var handleSelectOrderReturn = function handleSelectOrderReturn(id, return_location, return_locations, order_product_return_action, new_location, legacy_product_id) {
8948
8988
  setSelectedReturnOrder(function (prevSelectedLocations) {
8949
8989
  var isSelected = prevSelectedLocations == null ? void 0 : prevSelectedLocations.some(function (loc) {
8950
8990
  return loc.id === id;
8951
8991
  });
8992
+ console.log(new_location, 'new_location');
8952
8993
  if (isSelected) {
8953
8994
  var updatedSelectedLocations = prevSelectedLocations.filter(function (loc) {
8954
8995
  return loc.id !== id;
8955
8996
  });
8956
8997
  setReturnPayload(function (prevState) {
8957
8998
  return _extends({}, prevState, {
8958
- products: id,
8999
+ products: legacy_product_id,
8959
9000
  return_action: (order_product_return_action == null ? void 0 : order_product_return_action.type) || null,
8960
- return_location_token: (return_locations == null ? void 0 : return_locations.token) || null
9001
+ return_location_token: return_location || null,
9002
+ new_location: new_location
8961
9003
  });
8962
9004
  });
8963
9005
  setNewPayload(function (prevPayload) {
@@ -8970,26 +9012,28 @@ var ReturnOrderTable = function ReturnOrderTable(_ref) {
8970
9012
  var newReturnPayload = {
8971
9013
  id: id,
8972
9014
  account_number: createReturn == null ? void 0 : createReturn.account_number,
8973
- customer_id: createReturn == null ? void 0 : createReturn.customer_id,
8974
- products: id,
8975
- return_action: (order_product_return_action == null ? void 0 : order_product_return_action.type) || null,
8976
- return_location_token: (return_locations == null ? void 0 : return_locations.token) || null
9015
+ customer_id: +(createReturn == null ? void 0 : createReturn.customer_id),
9016
+ products: [legacy_product_id],
9017
+ return_action: [order_product_return_action == null ? void 0 : order_product_return_action.type] || null,
9018
+ return_location_token: return_location || null
8977
9019
  };
8978
9020
  setNewPayload(function (prevPayload) {
8979
9021
  return [].concat(prevPayload, [newReturnPayload]);
8980
9022
  });
8981
9023
  setReturnPayload(function (prevState) {
8982
9024
  return _extends({}, prevState, {
8983
- products: id,
9025
+ products: legacy_product_id,
8984
9026
  return_action: (order_product_return_action == null ? void 0 : order_product_return_action.type) || null,
8985
- return_location_token: (return_locations == null ? void 0 : return_locations.token) || null
9027
+ return_location_token: return_location || null,
9028
+ new_location: new_location
8986
9029
  });
8987
9030
  });
8988
9031
  return [].concat(prevSelectedLocations, [{
8989
9032
  id: id,
8990
9033
  return_location: return_location,
8991
9034
  return_locations: return_locations,
8992
- order_product_return_action: order_product_return_action
9035
+ order_product_return_action: order_product_return_action,
9036
+ new_location: new_location
8993
9037
  }]);
8994
9038
  }
8995
9039
  });
@@ -9022,7 +9066,7 @@ var ReturnOrderTable = function ReturnOrderTable(_ref) {
9022
9066
  onChange: handleSelectAll
9023
9067
  })), 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", {
9024
9068
  className: "emailInvoiceShare"
9025
- }, "Labels"))), React.createElement("tbody", null, loadingskeleton ? React.createElement("tr", null, React.createElement("td", {
9069
+ }, "Labels"))), React.createElement("tbody", null, load ? React.createElement("tr", null, React.createElement("td", {
9026
9070
  colSpan: 6
9027
9071
  }, React.createElement(Skeleton, {
9028
9072
  active: true
@@ -9031,19 +9075,20 @@ var ReturnOrderTable = function ReturnOrderTable(_ref) {
9031
9075
  })) : (returnData == null ? void 0 : returnData.length) === 0 ? React.createElement("tr", null, React.createElement("td", {
9032
9076
  colSpan: 14
9033
9077
  }, React.createElement(EmptyDataContainer, null, React.createElement(Empty, null)))) : returnData == null ? void 0 : returnData.map(function (item, index) {
9034
- var _item$orders_products, _item$order_data, _item$order_data2, _item$return_reasons, _item$collection_reas;
9078
+ var _item$orders_products, _item$orders_products2, _item$order_data, _item$order_data2, _item$return_reasons, _item$order_product_r, _item$collection_reas;
9035
9079
  return React.createElement("tr", {
9036
9080
  key: item.id
9037
9081
  }, React.createElement("td", null, React.createElement(Checkbox$1, {
9082
+ className: "custom-check",
9038
9083
  checked: selectedReturnOrder == null ? void 0 : selectedReturnOrder.some(function (selectedInvoice) {
9039
9084
  return (selectedInvoice == null ? void 0 : selectedInvoice.id) === item.id;
9040
9085
  }),
9041
9086
  onChange: function onChange() {
9042
- return handleSelectOrderReturn(item.id, item.return_location, item.return_locations, item.order_product_return_action);
9087
+ return handleSelectOrderReturn(item.id, item.return_location, item.return_locations, item.order_product_return_action, item.new_location, item.legacy_product_id);
9043
9088
  }
9044
- })), React.createElement("td", null, item != null && (_item$orders_products = item.orders_products_stock) != null && _item$orders_products.location ? null : React.createElement("div", {
9089
+ })), React.createElement("td", null, (item == null || (_item$orders_products = item.orders_products_stock) == null ? void 0 : _item$orders_products.location) !== null && (item == null || (_item$orders_products2 = item.orders_products_stock) == null ? void 0 : _item$orders_products2.location) !== undefined ? item.orders_products_stock.location : React.createElement("div", {
9045
9090
  className: "awaiting"
9046
- }, "Awating")), React.createElement("td", null, " ", displayValueOrNA(item == null ? void 0 : item.return_location)), React.createElement("td", null, React.createElement("ul", {
9091
+ }, "Awaiting")), React.createElement("td", null, " ", displayValueOrNA(item == null ? void 0 : item.new_location)), React.createElement("td", null, React.createElement("ul", {
9047
9092
  style: {
9048
9093
  listStyleType: 'none',
9049
9094
  padding: 0
@@ -9058,7 +9103,7 @@ var ReturnOrderTable = function ReturnOrderTable(_ref) {
9058
9103
  style: {
9059
9104
  color: '#888075'
9060
9105
  }
9061
- }, 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), "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, "N/A"), 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", {
9106
+ }, 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), "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, displayValueOrNA(item == null || (_item$order_product_r = item.order_product_returns) == null ? void 0 : _item$order_product_r.collected_at)), 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", {
9062
9107
  className: "actionbox"
9063
9108
  }, React.createElement(CustomDrop, {
9064
9109
  ref: dropdownRefParent,
@@ -9070,7 +9115,7 @@ var ReturnOrderTable = function ReturnOrderTable(_ref) {
9070
9115
  }
9071
9116
  }, React.createElement(PrinterIcon, null), React.createElement(DownIcon, null), printToogle == index && React.createElement("div", {
9072
9117
  ref: dropdownRef
9073
- }, React.createElement(PrintDropDown, null)))))));
9118
+ }, React.createElement(PrintDropDownReturn, null)))))));
9074
9119
  })))));
9075
9120
  };
9076
9121
 
@@ -9741,17 +9786,26 @@ var repackModal = function repackModal() {
9741
9786
  var StyledConatiner$1 = /*#__PURE__*/styled.div(_templateObject$2f || (_templateObject$2f = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n /* text-wrap: nowrap; */\n"])));
9742
9787
 
9743
9788
  var _templateObject$2g, _templateObject2$1D, _templateObject3$X;
9789
+ var _excluded$2 = ["id"];
9744
9790
  var CreateReturnModal = function CreateReturnModal() {
9745
- var _useState = useState([]),
9746
- selectedlocation = _useState[0],
9747
- setSelectedLocations = _useState[1];
9791
+ var _useSelectedConfirmLo = useSelectedConfirmLoc(),
9792
+ selectedlocation = _useSelectedConfirmLo[0],
9793
+ setSelectedLocations = _useSelectedConfirmLo[1];
9748
9794
  var _useSelectedOrders = useSelectedOrders(),
9749
9795
  selectedReturnOrder = _useSelectedOrders[0];
9796
+ var _usePostLoading = usePostLoading(),
9797
+ load = _usePostLoading[0];
9798
+ var _useGroupedPayload = useGroupedPayload(),
9799
+ groupedPayload = _useGroupedPayload[0];
9800
+ var _useSelectedConfirmLo2 = useSelectedConfirmLoc(),
9801
+ forDisabledCheck = _useSelectedConfirmLo2[0];
9802
+ var _useFinalPayload = useFinalPayload(),
9803
+ setNew = _useFinalPayload[1];
9750
9804
  var handleSelectLocations = function handleSelectLocations(id) {
9751
9805
  setSelectedLocations(function (prevSelectedLocations) {
9752
- var isSelected = prevSelectedLocations.includes(id);
9806
+ var isSelected = prevSelectedLocations == null ? void 0 : prevSelectedLocations.includes(id);
9753
9807
  if (isSelected) {
9754
- return prevSelectedLocations.filter(function (selectedId) {
9808
+ return prevSelectedLocations == null ? void 0 : prevSelectedLocations.filter(function (selectedId) {
9755
9809
  return selectedId !== id;
9756
9810
  });
9757
9811
  } else {
@@ -9759,7 +9813,30 @@ var CreateReturnModal = function CreateReturnModal() {
9759
9813
  }
9760
9814
  });
9761
9815
  };
9762
- return React.createElement(Wrapper$l, null, React.createElement(Alert, {
9816
+ var uniqueLocations = selectedReturnOrder == null ? void 0 : selectedReturnOrder.reduce(function (acc, current) {
9817
+ var x = acc.find(function (item) {
9818
+ return item.return_location === current.return_location;
9819
+ });
9820
+ if (!x) {
9821
+ acc.push(current);
9822
+ }
9823
+ return acc;
9824
+ }, []);
9825
+ useEffect(function () {
9826
+ if ((groupedPayload == null ? void 0 : groupedPayload.length) > 0 && (forDisabledCheck == null ? void 0 : forDisabledCheck.length) > 0) {
9827
+ var matchedItems = groupedPayload == null ? void 0 : groupedPayload.filter(function (item) {
9828
+ return forDisabledCheck.includes(item.id);
9829
+ });
9830
+ if (matchedItems.length > 0) {
9831
+ var finalPayload = matchedItems == null ? void 0 : matchedItems.map(function (_ref) {
9832
+ var rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
9833
+ return rest;
9834
+ });
9835
+ setNew(finalPayload);
9836
+ }
9837
+ }
9838
+ }, [forDisabledCheck]);
9839
+ return React.createElement(React.Fragment, null, load && React.createElement(Loader, null), React.createElement(Wrapper$l, null, React.createElement(Alert, {
9763
9840
  onClose: function onClose() {},
9764
9841
  description: "",
9765
9842
  type: "info",
@@ -9770,7 +9847,7 @@ var CreateReturnModal = function CreateReturnModal() {
9770
9847
  listStyle: 'none',
9771
9848
  padding: 0
9772
9849
  }
9773
- }, selectedReturnOrder == null ? void 0 : selectedReturnOrder.map(function (returnLoc) {
9850
+ }, uniqueLocations == null ? void 0 : uniqueLocations.map(function (returnLoc) {
9774
9851
  return React.createElement("li", {
9775
9852
  key: returnLoc.id,
9776
9853
  style: {
@@ -9779,7 +9856,7 @@ var CreateReturnModal = function CreateReturnModal() {
9779
9856
  alignItems: 'center'
9780
9857
  }
9781
9858
  }, React.createElement(Checkbox$1, {
9782
- checked: selectedlocation.includes(returnLoc.id),
9859
+ checked: selectedlocation == null ? void 0 : selectedlocation.includes(returnLoc.id),
9783
9860
  onChange: function onChange() {
9784
9861
  return handleSelectLocations(returnLoc.id);
9785
9862
  }
@@ -9787,14 +9864,13 @@ var CreateReturnModal = function CreateReturnModal() {
9787
9864
  style: {
9788
9865
  marginLeft: '8px'
9789
9866
  }
9790
- }, returnLoc == null ? void 0 : returnLoc.return_location));
9791
- }))));
9867
+ }, displayValueOrNA(returnLoc == null ? void 0 : returnLoc.new_location)));
9868
+ })))));
9792
9869
  };
9793
9870
  var StyledText$1 = /*#__PURE__*/styled.div(_templateObject$2g || (_templateObject$2g = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #8d8f90;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n"])));
9794
9871
  var Container$1b = /*#__PURE__*/styled.div(_templateObject2$1D || (_templateObject2$1D = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
9795
9872
  var Wrapper$l = /*#__PURE__*/styled.div(_templateObject3$X || (_templateObject3$X = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n padding: 15px;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 15px;\n align-self: stretch;\n border-radius: 8px;\n background: #f8fafc;\n box-shadow: 0px 1px 3px 0px rgba(16, 24, 40, 0.1);\n"])));
9796
9873
 
9797
- var _excluded$2 = ["id"];
9798
9874
  var ModalManager = function ModalManager() {
9799
9875
  var _useAtom = useAtom(countReducerAtom),
9800
9876
  popupName = _useAtom[0],
@@ -9818,9 +9894,21 @@ var ModalManager = function ModalManager() {
9818
9894
  selectedTab = _useAtom3[0];
9819
9895
  var _useState = useState(false),
9820
9896
  setIsFormValid = _useState[1];
9897
+ var _useFinalPayload = useFinalPayload(),
9898
+ newGrouped = _useFinalPayload[0],
9899
+ setNewGrouped = _useFinalPayload[1];
9900
+ var _usePostLoading = usePostLoading(),
9901
+ SetPostLoading = _usePostLoading[1];
9902
+ var _useSelectedOrders = useSelectedOrders(),
9903
+ setSelectedReturnOrder = _useSelectedOrders[1];
9904
+ var _useSelectedConfirmLo = useSelectedConfirmLoc(),
9905
+ setCheck = _useSelectedConfirmLo[1];
9821
9906
  var _useNewReturnPayload = useNewReturnPayload(),
9822
- newPayload = _useNewReturnPayload[0],
9823
9907
  setNewPayload = _useNewReturnPayload[1];
9908
+ var _useGroupedPayload = useGroupedPayload(),
9909
+ setGrouped = _useGroupedPayload[1];
9910
+ var _useSelectAll = useSelectAll(),
9911
+ setSelectAll = _useSelectAll[1];
9824
9912
  console.log(orderProduct, 'abcabcabcabcabcabcabcabcabcabcabc');
9825
9913
  var _closeModal = function closeModal() {
9826
9914
  dispatch({
@@ -9996,23 +10084,40 @@ var ModalManager = function ModalManager() {
9996
10084
  var _useApiHook3 = useApiHook({
9997
10085
  endpoint: "return_orders/",
9998
10086
  method: 'POST',
9999
- body: [newPayload],
10087
+ body: newGrouped,
10000
10088
  performAction: false
10001
10089
  }),
10002
10090
  response = _useApiHook3.data,
10003
- setShouldPerformAction = _useApiHook3.setShouldPerformAction;
10091
+ setShouldPerformAction = _useApiHook3.setShouldPerformAction,
10092
+ confirmLoading = _useApiHook3.loading;
10093
+ useEffect(function () {
10094
+ SetPostLoading(confirmLoading);
10095
+ }, [confirmLoading]);
10096
+ console.log(response);
10097
+ useEffect(function () {
10098
+ if (response === null || response && response != null && response.data) {
10099
+ dispatch({
10100
+ type: 'close'
10101
+ });
10102
+ setNewGrouped([]);
10103
+ setSelectedReturnOrder([]);
10104
+ setCheck([]);
10105
+ setNewPayload([]);
10106
+ setGrouped([]);
10107
+ setShouldPerformAction(false);
10108
+ setSelectAll(false);
10109
+ }
10110
+ }, [response]);
10004
10111
  var handleConfirmReturn = function handleConfirmReturn() {
10005
- var payloadWithoutId = newPayload == null ? void 0 : newPayload.map(function (_ref) {
10006
- var rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
10007
- return _extends({}, rest);
10008
- });
10009
- console.log(response);
10010
- if (payloadWithoutId) {
10011
- setNewPayload(payloadWithoutId);
10112
+ setShouldPerformAction(false);
10113
+ if (newGrouped.length > 0) {
10012
10114
  setShouldPerformAction(true);
10013
10115
  } else {
10014
10116
  setShouldPerformAction(false);
10015
10117
  }
10118
+ dispatch({
10119
+ type: 'close'
10120
+ });
10016
10121
  };
10017
10122
  return React.createElement(React.Fragment, null, (popupName == null ? void 0 : popupName.state) == 'create-return' && React.createElement(AntModal, {
10018
10123
  openStatus: (popupName == null ? void 0 : popupName.state) == 'create-return' ? true : false,
@@ -10028,8 +10133,7 @@ var ModalManager = function ModalManager() {
10028
10133
  name: 'Submit',
10029
10134
  btnStyle: 'rounded',
10030
10135
  onClick: handleConfirmReturn,
10031
- type: 'button',
10032
- disabled: !newPayload
10136
+ type: 'button'
10033
10137
  }],
10034
10138
  btnAlign: 'justifyEnd'
10035
10139
  },
@@ -10281,7 +10385,7 @@ var OrderTable = function OrderTable(_ref) {
10281
10385
  onChange: function onChange() {
10282
10386
  return handleSelectInvoice(item.id);
10283
10387
  }
10284
- })), React.createElement("td", null, formatDate$1(new Date(item == null ? void 0 : item.created_at))), React.createElement("td", null, displayValueOrNA$1(item == null ? void 0 : item.return_locations)), React.createElement("td", null, displayValueOrNA$1(item == null ? void 0 : item.pick_up_location)), React.createElement("td", {
10388
+ })), React.createElement("td", null, formatDate$1(new Date(item == null ? void 0 : item.created_at))), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.return_locations)), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.pick_up_location)), React.createElement("td", {
10285
10389
  onClick: function onClick() {
10286
10390
  return setOrderId(item.id);
10287
10391
  }
@@ -10298,11 +10402,11 @@ var OrderTable = function OrderTable(_ref) {
10298
10402
  }
10299
10403
  }, React.createElement(NavLink, {
10300
10404
  to: "" + item.id
10301
- }, displayValueOrNA$1(item == null || (_item$order_recipient = item.order_recipient) == null ? void 0 : _item$order_recipient.recipient_name))), React.createElement("li", {
10405
+ }, displayValueOrNA(item == null || (_item$order_recipient = item.order_recipient) == null ? void 0 : _item$order_recipient.recipient_name))), React.createElement("li", {
10302
10406
  style: {
10303
10407
  color: '#888075'
10304
10408
  }
10305
- }, displayValueOrNA$1(item == null || (_item$order_recipient2 = item.order_recipient) == null ? void 0 : _item$order_recipient2.postcode)))), React.createElement("td", null, displayValueOrNA$1(item == null || (_item$customer_data = item.customer_data) == null ? void 0 : _item$customer_data.customer_name)), React.createElement("td", null, displayValueOrNA$1(item == null ? void 0 : item.consignment)), React.createElement("td", null, displayValueOrNA$1(item == null ? void 0 : item.order_number)), React.createElement("td", null, displayValueOrNA$1(item == null ? void 0 : item.box_count)), React.createElement("td", null, displayValueOrNA$1(item == null ? void 0 : item.weight), "KG"), React.createElement("td", null, displayValueOrNA$1(item == null ? void 0 : item.cube)), React.createElement("td", null, React.createElement(AntSelect, {
10409
+ }, 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), " KG"), React.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.cube)), React.createElement("td", null, React.createElement(AntSelect, {
10306
10410
  options: assigneOptions,
10307
10411
  placeholder: "Select",
10308
10412
  onChange: function onChange() {},
@@ -10332,7 +10436,7 @@ var OrderTable = function OrderTable(_ref) {
10332
10436
  }
10333
10437
  }, React.createElement(PrinterIcon, null), React.createElement(DownIcon, null), printToogle == index && React.createElement("div", {
10334
10438
  ref: dropdownRef
10335
- }, React.createElement(PrintDropDown, null)))), React.createElement("li", {
10439
+ }, React.createElement(PrintDropDownReturn, null)))), React.createElement("li", {
10336
10440
  className: "downloadcontainer"
10337
10441
  }, React.createElement(LoadIcon, null)))));
10338
10442
  })))));
@@ -10468,20 +10572,16 @@ var filterReducer$1 = function filterReducer(state, action) {
10468
10572
  value: action.payload
10469
10573
  }])
10470
10574
  });
10471
- // case 'SET_ACTIONS_FILTER':
10472
- // return {
10473
- // ...state,
10474
- // 'x-filters': [
10475
- // ...state['x-filters'].filter(
10476
- // f => f.field !== 'product_return_action_id'
10477
- // ),
10478
- // {
10479
- // field: 'product_return_action_id',
10480
- // op: '=',
10481
- // value: action.payload,
10482
- // },
10483
- // ],
10484
- // };
10575
+ case 'SET_STATUS_ORDER_FILTER':
10576
+ return _extends({}, state, {
10577
+ 'x-filters': [].concat(state['x-filters'].filter(function (f) {
10578
+ return f.field !== 'status_id';
10579
+ }), [{
10580
+ field: 'status_id',
10581
+ op: '=',
10582
+ value: action.payload
10583
+ }])
10584
+ });
10485
10585
  // case 'SET_LOCATION_FILTER':
10486
10586
  // return {
10487
10587
  // ...state,
@@ -10519,6 +10619,50 @@ var filtersReducerAtom$1 = /*#__PURE__*/atom(function (get) {
10519
10619
  return set(filtersStateAtom$1, filterReducer$1(get(filtersStateAtom$1), action));
10520
10620
  });
10521
10621
 
10622
+ var StatusIcon = function StatusIcon() {
10623
+ return React.createElement("svg", {
10624
+ xmlns: "http://www.w3.org/2000/svg",
10625
+ width: "13",
10626
+ height: "12",
10627
+ viewBox: "0 0 13 12",
10628
+ fill: "none"
10629
+ }, React.createElement("path", {
10630
+ d: "M2.60002 6V4.83333C2.60002 3.90507 2.96877 3.01483 3.62514 2.35845C4.28152 1.70208 5.17176 1.33333 6.10002 1.33333C7.02827 1.33333 7.91851 1.70208 8.57489 2.35845C9.23127 3.01483 9.60002 3.90507 9.60002 4.83333V6M1.43335 9.5C1.43335 9.80941 1.55627 10.1062 1.77506 10.325C1.99385 10.5437 2.2906 10.6667 2.60002 10.6667C2.90944 10.6667 3.20618 10.5437 3.42497 10.325C3.64377 10.1062 3.76668 9.80941 3.76668 9.5C3.76668 9.19058 3.64377 8.89383 3.42497 8.67504C3.20618 8.45625 2.90944 8.33333 2.60002 8.33333C2.2906 8.33333 1.99385 8.45625 1.77506 8.67504C1.55627 8.89383 1.43335 9.19058 1.43335 9.5ZM8.43335 9.5C8.43335 9.80941 8.55627 10.1062 8.77506 10.325C8.99385 10.5437 9.2906 10.6667 9.60002 10.6667C9.90944 10.6667 10.2062 10.5437 10.425 10.325C10.6438 10.1062 10.7667 9.80941 10.7667 9.5C10.7667 9.19058 10.6438 8.89383 10.425 8.67504C10.2062 8.45625 9.90944 8.33333 9.60002 8.33333C9.2906 8.33333 8.99385 8.45625 8.77506 8.67504C8.55627 8.89383 8.43335 9.19058 8.43335 9.5Z",
10631
+ stroke: "#6D6B68",
10632
+ "stroke-width": "2",
10633
+ "stroke-linecap": "round",
10634
+ "stroke-linejoin": "round"
10635
+ }), React.createElement("path", {
10636
+ d: "M7.8501 4.25L9.6001 6L11.3501 4.25",
10637
+ stroke: "#6D6B68",
10638
+ "stroke-width": "2",
10639
+ "stroke-linecap": "round",
10640
+ "stroke-linejoin": "round"
10641
+ }));
10642
+ };
10643
+
10644
+ var AssigneIcon = function AssigneIcon() {
10645
+ return React.createElement("svg", {
10646
+ xmlns: "http://www.w3.org/2000/svg",
10647
+ width: "15",
10648
+ height: "14",
10649
+ viewBox: "0 0 15 14",
10650
+ fill: "none"
10651
+ }, React.createElement("g", {
10652
+ "clip-path": "url(#clip0_504_13636)"
10653
+ }, React.createElement("path", {
10654
+ d: "M4.4751 1.16667H12.6418V6.70834H11.4751V2.33334H10.3084V5.61051L8.55843 4.7355L6.80843 5.61051V2.33334H5.64176V5.54167H4.4751V1.16667ZM7.9751 2.33334V3.72284L8.55843 3.43117L9.14176 3.72284V2.33334H7.9751ZM5.02051 7.72917C4.92474 7.72892 4.82985 7.74755 4.74127 7.78398C4.65269 7.82041 4.57215 7.87394 4.50426 7.9415L3.30843 9.13734V11.375H6.59085L9.97593 10.5292L12.0363 9.6495C12.1064 9.61158 12.1601 9.54908 12.1871 9.47399C12.214 9.3989 12.2123 9.31652 12.1822 9.24263C12.1521 9.16875 12.0958 9.10857 12.0241 9.07364C11.9524 9.0387 11.8703 9.03147 11.7936 9.05334L11.7819 9.05625L8.0416 9.91667H5.93343V8.75H7.75635C7.89172 8.75 8.02154 8.69623 8.11727 8.60051C8.21299 8.50479 8.26676 8.37496 8.26676 8.23959C8.26676 8.10422 8.21299 7.97439 8.11727 7.87867C8.02154 7.78295 7.89172 7.72917 7.75635 7.72917H5.02051ZM9.42585 8.40117L11.4978 7.92459C11.7185 7.86656 11.9496 7.85988 12.1732 7.90505C12.3969 7.95022 12.6072 8.04605 12.7881 8.18518C12.969 8.3243 13.1155 8.50302 13.2166 8.70762C13.3176 8.91221 13.3704 9.13724 13.3709 9.36542C13.3707 9.64241 13.2934 9.91388 13.1478 10.1495C13.0021 10.3851 12.7938 10.5755 12.5461 10.6995L12.5303 10.7077L10.3487 11.6381L6.73435 12.5417H0.100098V8.3125H2.4836L3.6806 7.1155C3.85696 6.93974 4.06622 6.80044 4.29643 6.70555C4.52663 6.61067 4.77327 6.56206 5.02226 6.5625H7.75635C7.99023 6.56247 8.22153 6.61136 8.4354 6.70603C8.64926 6.8007 8.84096 6.93905 8.99818 7.11221C9.15541 7.28536 9.27467 7.48948 9.34832 7.71146C9.42198 7.93345 9.44838 8.16838 9.42585 8.40117ZM2.14176 9.47917H1.26676V11.375H2.14176V9.47917Z",
10655
+ fill: "#6D6B68"
10656
+ })), React.createElement("defs", null, React.createElement("clipPath", {
10657
+ id: "clip0_504_13636"
10658
+ }, React.createElement("rect", {
10659
+ width: "14",
10660
+ height: "14",
10661
+ fill: "white",
10662
+ transform: "translate(0.100098)"
10663
+ }))));
10664
+ };
10665
+
10522
10666
  var _templateObject$2j, _templateObject2$1G;
10523
10667
  var ReturnOrderFilter = function ReturnOrderFilter() {
10524
10668
  var _useAtom = useAtom(filtersReducerAtom$1),
@@ -10528,6 +10672,8 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
10528
10672
  var _useState = useState(),
10529
10673
  selectedDate = _useState[0],
10530
10674
  setSelectedDate = _useState[1];
10675
+ var _useStatusOrderData = useStatusOrderData(),
10676
+ statusOfOrder = _useStatusOrderData[0];
10531
10677
  // const zoneOptions = [
10532
10678
  // { label: 'Zone 1', value: 'zone1' },
10533
10679
  // { label: 'Zone 2', value: 'zone2' },
@@ -10557,6 +10703,14 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
10557
10703
  value: option == null ? void 0 : option.id
10558
10704
  };
10559
10705
  });
10706
+ //status of order
10707
+ var orderOptions = statusOfOrder == null ? void 0 : statusOfOrder.map(function (option) {
10708
+ var _option$status_type, _option$status_type2;
10709
+ return {
10710
+ label: (option == null || (_option$status_type = option.status_type) == null || (_option$status_type = _option$status_type.charAt(0)) == null ? void 0 : _option$status_type.toUpperCase()) + (option == null || (_option$status_type2 = option.status_type) == null ? void 0 : _option$status_type2.slice(1)),
10711
+ value: option == null ? void 0 : option.id
10712
+ };
10713
+ });
10560
10714
  var handleClientChange = function handleClientChange(value) {
10561
10715
  console.log(value, 'value');
10562
10716
  dispatch({
@@ -10564,6 +10718,13 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
10564
10718
  payload: value
10565
10719
  });
10566
10720
  };
10721
+ var handleStatusOfOrder = function handleStatusOfOrder(value) {
10722
+ console.log(value, 'value');
10723
+ dispatch({
10724
+ type: 'SET_STATUS_ORDER_FILTER',
10725
+ payload: value
10726
+ });
10727
+ };
10567
10728
  return React.createElement(React.Fragment, null, React.createElement(StyledFiter, null, React.createElement(StyledFIlterELements, null, React.createElement(LeftSideConatiner, null, React.createElement("div", {
10568
10729
  className: "filtercontainer"
10569
10730
  }, React.createElement("div", {
@@ -10588,6 +10749,19 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
10588
10749
  className: "datefilter"
10589
10750
  }, React.createElement("div", {
10590
10751
  className: "dateiconcontainer"
10752
+ }, React.createElement(StatusIcon, null)), React.createElement(StyledAntSelect$d, null, React.createElement(Select, {
10753
+ options: orderOptions,
10754
+ className: "custom-select",
10755
+ placeholder: "Status of Order",
10756
+ onChange: handleStatusOfOrder,
10757
+ style: {
10758
+ minWidth: '130px'
10759
+ },
10760
+ allowClear: true
10761
+ }))), React.createElement("div", {
10762
+ className: "datefilter"
10763
+ }, React.createElement("div", {
10764
+ className: "dateiconcontainer"
10591
10765
  }, React.createElement(ClientIcon, null)), React.createElement(StyledAntSelect$d, null, React.createElement(Select, {
10592
10766
  options: clientOptions,
10593
10767
  className: "custom-select",
@@ -10597,19 +10771,12 @@ var ReturnOrderFilter = function ReturnOrderFilter() {
10597
10771
  width: '125px',
10598
10772
  border: 'none'
10599
10773
  },
10600
- maxTagCount: 0,
10601
- maxTagPlaceholder: function maxTagPlaceholder(omittedValues) {
10602
- return React.createElement(Tooltip, {
10603
- overlayStyle: {
10604
- pointerEvents: 'none'
10605
- },
10606
- title: omittedValues.map(function (_ref) {
10607
- var label = _ref.label;
10608
- return label;
10609
- }).join(', ')
10610
- }, React.createElement("span", null, omittedValues.length + " selected"));
10611
- }
10612
- }))))), React.createElement(TableFilters, null)));
10774
+ allowClear: true
10775
+ }))), React.createElement("div", {
10776
+ className: "datefilter"
10777
+ }, React.createElement("div", {
10778
+ className: "dateiconcontainer"
10779
+ }, React.createElement(AssigneIcon, null))))), React.createElement(TableFilters, null)));
10613
10780
  };
10614
10781
  var StyledDatePicker = /*#__PURE__*/styled.div(_templateObject$2j || (_templateObject$2j = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .custom-datepicker {\n border: none;\n }\n"])));
10615
10782
  // const DropdownContainer = styled.div``;
@@ -10798,7 +10965,7 @@ function ReturnMainTable() {
10798
10965
  }),
10799
10966
  fetchedClientData = _useApiHook.data,
10800
10967
  staticDataLoading = _useApiHook.loading;
10801
- console.log('fetchedClientData', fetchedClientData == null ? void 0 : fetchedClientData.data);
10968
+ // console.log('fetchedClientData', fetchedClientData?.data);
10802
10969
  useEffect(function () {
10803
10970
  setLoading(staticDataLoading);
10804
10971
  if (fetchedClientData && fetchedClientData.data) {