@bjsdistribution/dms-client-return 0.0.37 → 0.0.38

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.
@@ -3447,7 +3447,7 @@ function GeneralHeader() {
3447
3447
  var Section = /*#__PURE__*/styled.div(_templateObject$T || (_templateObject$T = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
3448
3448
 
3449
3449
  var _templateObject19, _templateObject20, _templateObject21;
3450
- var StyledTable$1 = /*#__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 position: relative;\n font-family: 'lato', sans-serif;\n .emailInvoiceCheckbox {\n padding-right: 0px;\n width: 0;\n > div {\n width: fit-content;\n }\n }\n .custom-check {\n position: absloute;\n }\n .emailInvoiceNo {\n padding-left: 0px;\n }\n .emailInvoiceShare {\n width: 100px;\n }\n th {\n color: #3a3630;\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n padding: 11px 15px;\n background: #f0f2f2;\n border-right: none;\n border-left: none;\n text-align: left;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-width: 1px 0;\n &:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n &:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n }\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 position: relative;\n .actionbox {\n display: flex;\n gap: 5px;\n }\n .shareIconContainer {\n display: flex;\n padding: 2px 12px;\n align-items: center;\n gap: 8px;\n border-radius: 20px;\n border: 1px solid var(--tonal-brown-101, #e2e0db);\n background: #fff;\n list-style-type: none;\n /* padding-left: 0; */\n /* fontWeight: 600,\n paddingLeft: 0, */\n cursor: pointer;\n position: relative;\n }\n .statusCancelled {\n color: #e95252;\n /* background: rgba(233, 82, 82, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusOnHold {\n color: #f4a503;\n /* background: #fff1d6; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusSubContracted {\n color: #845adf;\n /* background: rgba(132, 90, 223, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusAwaiting {\n color: #845adf;\n /* background: rgba(132, 90, 223, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusCompleted {\n color: #1f9254;\n /* background: rgba(41, 204, 106, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusOutstanding {\n color: #f4a503;\n /* background: #fff1d6; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusUnknown {\n color: #000;\n /* background: #fff; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n .statustext {\n color: #1f9254;\n font-family: 'Open Sans';\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n }\n .downloadcontainer {\n display: flex;\n padding: 2px 12px;\n align-items: center;\n\n width: 28px;\n height: 28px;\n flex-direction: column;\n\n border-radius: 14px;\n border: 1px solid #e2e0db;\n background: #fff;\n }\n .statuscontainer {\n display: flex;\n padding: 5px 30px 5px 30px;\n justify-content: center;\n align-items: center;\n gap: 5px;\n flex: 1 0 0;\n border-radius: 22px;\n background: rgba(41, 204, 106, 0.15);\n }\n .awaiting {\n display: flex;\n min-width: 85px;\n padding: 6px 10px;\n justify-content: center;\n align-items: center;\n gap: 5px;\n border-radius: 22px;\n background: rgba(233, 82, 82, 0.15);\n color: #e95252;\n font-family: 'Open Sans';\n font-size: 12px;\n font-weight: 600;\n }\n ul > li > a {\n text-decoration: none !important;\n color: #0099ff;\n }\n }\n &:nth-child(even) td {\n background: #f6fbff;\n }\n td:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n td:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n .flex {\n display: flex;\n flex-direction: row;\n gap: 5px;\n height: 29px;\n align-items: center;\n }\n\n &.insideTable {\n td {\n border-radius: 0;\n border: none;\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n table {\n border-spacing: 0;\n width: 100%;\n border-radius: 5px;\n border: 1px solid rgba(0, 0, 0, 0.08);\n overflow: hidden;\n border-top-left-radius: 15px;\n border-top-right-radius: 15px;\n thead {\n tr {\n border-bottom: none;\n th {\n padding: 14px 20px;\n text-align: left;\n border-top: 0;\n border-right: 0;\n border-left: 0;\n background: #f8fafc;\n\n &:first-child {\n border-radius: 0;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n border-top-left-radius: 15px;\n }\n &:last-child {\n border-radius: 0;\n }\n }\n }\n }\n tbody {\n tr {\n td {\n padding: 14px 20px;\n text-align: left;\n border-bottom: 1px solid rgba(58, 54, 48, 0.15);\n background: #fff;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n }\n }\n }\n }\n }\n }\n .actions {\n display: flex;\n align-items: center;\n gap: 20px;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n\n .close-icon {\n transform: scale(1.3);\n background-color: transparent;\n border-radius: 0;\n padding: 0;\n }\n }\n"])));
3450
+ var StyledTable$1 = /*#__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 position: relative;\n font-family: 'lato', sans-serif;\n .emailInvoiceCheckbox {\n padding-right: 0px;\n width: 0;\n > div {\n width: fit-content;\n }\n }\n .custom-check {\n position: absloute;\n }\n .emailInvoiceNo {\n padding-left: 0px;\n }\n .emailInvoiceShare {\n width: 100px;\n }\n th {\n color: #3a3630;\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n padding: 11px 15px;\n background: #f0f2f2;\n border-right: none;\n border-left: none;\n text-align: left;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-width: 1px 0;\n &:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n &:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n .sortIconClass {\n cursor: pointer;\n display: flex;\n }\n }\n }\n }\n tbody {\n tr {\n td {\n color: #3a3630;\n font-size: 13px;\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n padding: 12px 15px;\n background: #fff;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-right: none;\n border-left: none;\n position: relative;\n .actionbox {\n display: flex;\n gap: 5px;\n }\n .shareIconContainer {\n display: flex;\n padding: 2px 12px;\n align-items: center;\n gap: 8px;\n border-radius: 20px;\n border: 1px solid var(--tonal-brown-101, #e2e0db);\n background: #fff;\n list-style-type: none;\n /* padding-left: 0; */\n /* fontWeight: 600,\n paddingLeft: 0, */\n cursor: pointer;\n position: relative;\n }\n .statusCancelled {\n color: #e95252;\n /* background: rgba(233, 82, 82, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusOnHold {\n color: #f4a503;\n /* background: #fff1d6; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusSubContracted {\n color: #845adf;\n /* background: rgba(132, 90, 223, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusAwaiting {\n color: #845adf;\n /* background: rgba(132, 90, 223, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusCompleted {\n color: #1f9254;\n /* background: rgba(41, 204, 106, 0.15); */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusOutstanding {\n color: #f4a503;\n /* background: #fff1d6; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n\n .statusUnknown {\n color: #000;\n /* background: #fff; */\n padding: 4px 8px;\n border-radius: 4px;\n }\n .statustext {\n color: #1f9254;\n font-family: 'Open Sans';\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n }\n .downloadcontainer {\n display: flex;\n padding: 2px 12px;\n align-items: center;\n\n width: 28px;\n height: 28px;\n flex-direction: column;\n\n border-radius: 14px;\n border: 1px solid #e2e0db;\n background: #fff;\n }\n .statuscontainer {\n display: flex;\n padding: 5px 30px 5px 30px;\n justify-content: center;\n align-items: center;\n gap: 5px;\n flex: 1 0 0;\n border-radius: 22px;\n background: rgba(41, 204, 106, 0.15);\n }\n .awaiting {\n display: flex;\n min-width: 85px;\n padding: 6px 10px;\n justify-content: center;\n align-items: center;\n gap: 5px;\n border-radius: 22px;\n background: rgba(233, 82, 82, 0.15);\n color: #e95252;\n font-family: 'Open Sans';\n font-size: 12px;\n font-weight: 600;\n }\n ul > li > a {\n text-decoration: none !important;\n color: #0099ff;\n }\n }\n &:nth-child(even) td {\n background: #f6fbff;\n }\n td:first-child {\n border-radius: 100px 0 0 100px;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n }\n td:last-child {\n border-radius: 0px 100px 100px 0;\n border-right: 1px solid rgba(0, 0, 0, 0.08);\n }\n .flex {\n display: flex;\n flex-direction: row;\n gap: 5px;\n height: 29px;\n align-items: center;\n }\n\n &.insideTable {\n td {\n border-radius: 0;\n border: none;\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n table {\n border-spacing: 0;\n width: 100%;\n border-radius: 5px;\n border: 1px solid rgba(0, 0, 0, 0.08);\n overflow: hidden;\n border-top-left-radius: 15px;\n border-top-right-radius: 15px;\n thead {\n tr {\n border-bottom: none;\n th {\n padding: 14px 20px;\n text-align: left;\n border-top: 0;\n border-right: 0;\n border-left: 0;\n background: #f8fafc;\n\n &:first-child {\n border-radius: 0;\n border-left: 1px solid rgba(0, 0, 0, 0.08);\n border-top-left-radius: 15px;\n }\n &:last-child {\n border-radius: 0;\n }\n }\n }\n }\n tbody {\n tr {\n td {\n padding: 14px 20px;\n text-align: left;\n border-bottom: 1px solid rgba(58, 54, 48, 0.15);\n background: #fff;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n &:last-child {\n border-radius: 0;\n border-right: none;\n }\n }\n }\n }\n }\n }\n }\n }\n .actions {\n display: flex;\n align-items: center;\n gap: 20px;\n > svg {\n transform: scale(1.5);\n background-color: #edebe8;\n border-radius: 20px;\n padding: 5px;\n }\n\n .close-icon {\n transform: scale(1.3);\n background-color: transparent;\n border-radius: 0;\n padding: 0;\n }\n }\n"])));
3451
3451
  // Styled components
3452
3452
  var StyledTableWrapper = /*#__PURE__*/styled.div(_templateObject20 || (_templateObject20 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-height: 60vh;\n overflow-x: auto;\n scrollbar-width: none;\n min-height: 50vh;\n\n .fortables {\n max-height: 60vh;\n overflow-x: auto;\n scrollbar-width: none;\n min-height: 50vh;\n }\n /* height: 600px; */\n /* box-shadow: 0px 0px 30px 6px rgba(46, 45, 116, 0.05); */\n &::-webkit-scrollbar {\n width: 5px;\n border-radius: 100px;\n height: 5px;\n }\n\n &::-webkit-scrollbar-track {\n background: #777;\n border-radius: 100px;\n }\n\n &::-webkit-scrollbar-thumb {\n background: #7b61ff;\n border-radius: 100px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: #7b61ff;\n }\n"])));
3453
3453
  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"])));
@@ -3906,10 +3906,16 @@ var atomRoutesTable = /*#__PURE__*/atom([]);
3906
3906
  var useRoutesTable = function useRoutesTable() {
3907
3907
  return useAtom(atomRoutesTable);
3908
3908
  };
3909
+ //this
3909
3910
  var loading = /*#__PURE__*/atom(false);
3910
- var useLoading = function useLoading() {
3911
+ var useStatsLoading = function useStatsLoading() {
3911
3912
  return useAtom(loading);
3912
3913
  };
3914
+ //this
3915
+ var loadingState = /*#__PURE__*/atom(false);
3916
+ var useLoading = function useLoading() {
3917
+ return useAtom(loadingState);
3918
+ };
3913
3919
  var selectedAction = /*#__PURE__*/atom(null);
3914
3920
  function useSelectedAction() {
3915
3921
  return useAtom(selectedAction);
@@ -3956,6 +3962,14 @@ var atomItemsPerReturnPage = /*#__PURE__*/atom(50);
3956
3962
  var useItemsPerReturnPage = function useItemsPerReturnPage() {
3957
3963
  return useAtom(atomItemsPerReturnPage);
3958
3964
  };
3965
+ //stats data overview
3966
+ var UsePaginationOverviewData = function UsePaginationOverviewData() {
3967
+ return useAtom(atomPaginationData);
3968
+ };
3969
+ var atomItemsPerOverviewPage = /*#__PURE__*/atom(50);
3970
+ var useItemsPerOverviewPage = function useItemsPerOverviewPage() {
3971
+ return useAtom(atomItemsPerOverviewPage);
3972
+ };
3959
3973
  var countStatus = /*#__PURE__*/atom([]);
3960
3974
  var useCountData = function useCountData() {
3961
3975
  return useAtom(countStatus);
@@ -8925,8 +8939,8 @@ function SelectionFilter() {
8925
8939
  setActionTypeOptions(mappedActions);
8926
8940
  var mappedLocations = Array.isArray(filteredClient == null ? void 0 : filteredClient.return_locations) ? filteredClient == null || (_filteredClient$retur = filteredClient.return_locations) == null ? void 0 : _filteredClient$retur.map(function (location) {
8927
8941
  return {
8928
- label: location,
8929
- value: location
8942
+ label: location == null ? void 0 : location.location_name,
8943
+ value: location == null ? void 0 : location.token
8930
8944
  };
8931
8945
  }) : [];
8932
8946
  setLocationOptions(mappedLocations);
@@ -9402,6 +9416,43 @@ var PrintDropDownReturn = function PrintDropDownReturn(_ref) {
9402
9416
  var OptionsList = /*#__PURE__*/styled.ul(_templateObject$1V || (_templateObject$1V = /*#__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"])));
9403
9417
  var OptionsListLi = /*#__PURE__*/styled.li(_templateObject2$1p || (_templateObject2$1p = /*#__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"])));
9404
9418
 
9419
+ function CaretDownFilledIcon(props) {
9420
+ return React.createElement("svg", Object.assign({
9421
+ width: "16",
9422
+ height: "16",
9423
+ viewBox: "0 0 18 18",
9424
+ fill: "none",
9425
+ xmlns: "http://www.w3.org/2000/svg"
9426
+ }, props), React.createElement("g", {
9427
+ "clip-path": "url(#clip0_2034_435)"
9428
+ }, React.createElement("path", {
9429
+ d: "M13.5 6.75C14.139 6.75 14.4727 7.4895 14.0872 7.96725L14.0302 8.03025L9.53021 12.5303C9.40107 12.6594 9.22924 12.737 9.04698 12.7484C8.86471 12.7599 8.68452 12.7044 8.54021 12.5925L8.46971 12.5303L3.96972 8.03025L3.90746 7.95975L3.86697 7.902L3.82647 7.83L3.81371 7.803L3.79347 7.75275L3.76946 7.67175L3.76196 7.632L3.75446 7.587L3.75146 7.54425V7.45575L3.75521 7.41225L3.76196 7.36725L3.76946 7.32825L3.79347 7.24725L3.81371 7.197L3.86622 7.098L3.91496 7.0305L3.96972 6.96975L4.04021 6.9075L4.09797 6.867L4.16996 6.8265L4.19697 6.81375L4.24721 6.7935L4.32821 6.7695L4.36796 6.762L4.41296 6.7545L4.45571 6.7515L13.5 6.75Z",
9430
+ fill: "#9E9E9E"
9431
+ })), React.createElement("defs", null, React.createElement("clipPath", {
9432
+ id: "clip0_2034_435"
9433
+ }, React.createElement("rect", {
9434
+ width: "16",
9435
+ height: "16",
9436
+ fill: "white"
9437
+ }))));
9438
+ }
9439
+
9440
+ var SortIcon = function SortIcon() {
9441
+ return React.createElement("svg", {
9442
+ width: "16",
9443
+ height: "17",
9444
+ viewBox: "0 0 16 17",
9445
+ fill: "none",
9446
+ xmlns: "http://www.w3.org/2000/svg"
9447
+ }, React.createElement("g", {
9448
+ id: "bxs:sort-alt"
9449
+ }, React.createElement("path", {
9450
+ id: "Vector",
9451
+ d: "M4.15138 7.83335H11.8494C12.424 7.83335 12.7294 7.15335 12.3474 6.72335L8.49871 2.39335C8.43628 2.32288 8.35961 2.26647 8.27377 2.22783C8.18792 2.1892 8.09485 2.16922 8.00071 2.16922C7.90657 2.16922 7.8135 2.1892 7.72766 2.22783C7.64181 2.26647 7.56514 2.32288 7.50271 2.39335L3.65271 6.72335C3.27071 7.15335 3.57604 7.83335 4.15138 7.83335ZM7.50204 14.606C7.56447 14.6765 7.64114 14.7329 7.72699 14.7715C7.81284 14.8102 7.9059 14.8301 8.00004 14.8301C8.09418 14.8301 8.18725 14.8102 8.2731 14.7715C8.35895 14.7329 8.43562 14.6765 8.49804 14.606L12.3467 10.276C12.7294 9.84668 12.424 9.16668 11.8487 9.16668H4.15138C3.57671 9.16668 3.27138 9.84668 3.65338 10.2767L7.50204 14.606Z",
9452
+ fill: "#9E9E9E"
9453
+ })));
9454
+ };
9455
+
9405
9456
  var _excluded$3 = ["count"];
9406
9457
  var ReturnOrderTable = function ReturnOrderTable() {
9407
9458
  var _useAtom = useAtom(filtersReducerAtom),
@@ -9441,6 +9492,46 @@ var ReturnOrderTable = function ReturnOrderTable() {
9441
9492
  setPaginationObject = _UsePaginationData[1];
9442
9493
  var _usefetchAgain = usefetchAgain(),
9443
9494
  callForFetch = _usefetchAgain[0];
9495
+ //sorting
9496
+ var _useState = useState(null),
9497
+ sortConfig = _useState[0],
9498
+ setSortConfig = _useState[1];
9499
+ var handleSort = function handleSort(key) {
9500
+ setSortConfig(function (prev) {
9501
+ if ((prev == null ? void 0 : prev.key) === key && prev.direction === 'asc') {
9502
+ return {
9503
+ key: key,
9504
+ direction: 'desc'
9505
+ };
9506
+ }
9507
+ return {
9508
+ key: key,
9509
+ direction: 'asc'
9510
+ };
9511
+ });
9512
+ };
9513
+ var sortedData = useMemo(function () {
9514
+ if (!returnData || !sortConfig) return returnData;
9515
+ var key = sortConfig.key,
9516
+ direction = sortConfig.direction;
9517
+ return [].concat(returnData).sort(function (a, b) {
9518
+ var valueA = a[key];
9519
+ var valueB = b[key];
9520
+ if (typeof valueA === 'number' && typeof valueB === 'number') {
9521
+ return direction === 'asc' ? valueA - valueB : valueB - valueA;
9522
+ }
9523
+ if (typeof valueA === 'string' && typeof valueB === 'string') {
9524
+ return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
9525
+ }
9526
+ return 0;
9527
+ });
9528
+ }, [returnData, sortConfig]);
9529
+ var renderSortIcon = function renderSortIcon(columnKey) {
9530
+ if (!sortConfig || sortConfig.key !== columnKey) {
9531
+ return React.createElement(SortIcon, null);
9532
+ }
9533
+ return sortConfig.direction === 'asc' ? React.createElement(CaretDownFilledIcon, null) : React.createElement(CaretDownFilledIcon, null);
9534
+ };
9444
9535
  var OpenDropDown = function OpenDropDown(index) {
9445
9536
  setPrintToggle(function (prevIndex) {
9446
9537
  return prevIndex === index ? null : index;
@@ -9494,7 +9585,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9494
9585
  return (location == null ? void 0 : location.token) === (returnItem == null ? void 0 : returnItem.return_location);
9495
9586
  });
9496
9587
  return _extends({}, returnItem, {
9497
- new_location: matchingLocation ? matchingLocation.location_name : null
9588
+ new_location: matchingLocation ? matchingLocation == null ? void 0 : matchingLocation.location_name : null
9498
9589
  });
9499
9590
  });
9500
9591
  setReturnData(updatedReturnData);
@@ -9514,8 +9605,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9514
9605
  return_location: loc == null ? void 0 : loc.return_location,
9515
9606
  products: loc == null ? void 0 : loc.legacy_product_id,
9516
9607
  order_product_return_action: loc == null ? void 0 : loc.order_product_return_action,
9517
- return_location_token: loc == null ? void 0 : loc.return_location,
9518
- new_location: loc == null ? void 0 : loc.new_location
9608
+ return_location_token: loc == null ? void 0 : loc.return_location
9519
9609
  };
9520
9610
  }));
9521
9611
  setNewPayload(returnData == null ? void 0 : returnData.filter(function (loc) {
@@ -9529,8 +9619,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9529
9619
  customer_id: +(createReturn == null ? void 0 : createReturn.customer_id),
9530
9620
  products: [loc == null ? void 0 : loc.legacy_product_id],
9531
9621
  return_action: loc == null || (_loc$order_product_re3 = loc.order_product_return_action) == null ? void 0 : _loc$order_product_re3.type,
9532
- return_location_token: (loc == null ? void 0 : loc.return_location) || null,
9533
- new_location: loc == null ? void 0 : loc.new_location
9622
+ return_location_token: (loc == null ? void 0 : loc.return_location) || null
9534
9623
  };
9535
9624
  }));
9536
9625
  } else {
@@ -9539,7 +9628,9 @@ var ReturnOrderTable = function ReturnOrderTable() {
9539
9628
  setGrouped([]);
9540
9629
  }
9541
9630
  };
9542
- var handleSelectOrderReturn = function handleSelectOrderReturn(id, return_location, return_locations, order_product_return_action, new_location, legacy_product_id) {
9631
+ var handleSelectOrderReturn = function handleSelectOrderReturn(id, return_location, return_locations, order_product_return_action,
9632
+ // new_location: any,
9633
+ legacy_product_id) {
9543
9634
  setSelectedReturnOrder(function (prevSelectedLocations) {
9544
9635
  var isSelected = prevSelectedLocations == null ? void 0 : prevSelectedLocations.some(function (loc) {
9545
9636
  return loc.id === id;
@@ -9552,8 +9643,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9552
9643
  return _extends({}, prevState, {
9553
9644
  products: legacy_product_id,
9554
9645
  return_action: (order_product_return_action == null ? void 0 : order_product_return_action.type) || null,
9555
- return_location_token: return_location || null,
9556
- new_location: new_location
9646
+ return_location_token: return_location || null
9557
9647
  });
9558
9648
  });
9559
9649
  setNewPayload(function (prevPayload) {
@@ -9578,16 +9668,14 @@ var ReturnOrderTable = function ReturnOrderTable() {
9578
9668
  return _extends({}, prevState, {
9579
9669
  products: legacy_product_id,
9580
9670
  return_action: (order_product_return_action == null ? void 0 : order_product_return_action.type) || null,
9581
- return_location_token: return_location || null,
9582
- new_location: new_location
9671
+ return_location_token: return_location || null
9583
9672
  });
9584
9673
  });
9585
9674
  return [].concat(prevSelectedLocations, [{
9586
9675
  id: id,
9587
9676
  return_location: return_location,
9588
9677
  return_locations: return_locations,
9589
- order_product_return_action: order_product_return_action,
9590
- new_location: new_location
9678
+ order_product_return_action: order_product_return_action
9591
9679
  }]);
9592
9680
  }
9593
9681
  });
@@ -9612,6 +9700,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9612
9700
  }, []);
9613
9701
  var mergedPayload = Object.values(groupedPayload);
9614
9702
  setGrouped(mergedPayload);
9703
+ console.log(mergedPayload, 'mergedPayload');
9615
9704
  }, [newpayload]);
9616
9705
  return React.createElement(React.Fragment, null, postLoading && React.createElement(Loader, null), React.createElement(StyledTableWrapper, {
9617
9706
  className: "fortables"
@@ -9623,16 +9712,52 @@ var ReturnOrderTable = function ReturnOrderTable() {
9623
9712
  }, React.createElement(Checkbox$1, {
9624
9713
  checked: selectAll,
9625
9714
  onChange: handleSelectAll
9626
- })) : 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", {
9715
+ })) : React.createElement("th", null), React.createElement("th", {
9716
+ onClick: function onClick() {
9717
+ return handleSort('orders_products_stock.location');
9718
+ }
9719
+ }, React.createElement("div", {
9720
+ className: "sortIconClass"
9721
+ }, "Product Location", ' ', renderSortIcon('orders_products_stock.location'))), React.createElement("th", {
9722
+ onClick: function onClick() {
9723
+ return handleSort('new_location');
9724
+ }
9725
+ }, React.createElement("div", {
9726
+ className: "sortIconClass"
9727
+ }, "Return Location ", renderSortIcon('new_location'))), React.createElement("th", {
9728
+ onClick: function onClick() {
9729
+ return handleSort('order_data.order_recipient.recipient_name');
9730
+ }
9731
+ }, React.createElement("div", {
9732
+ className: "sortIconClass"
9733
+ }, "Recipient", ' ', renderSortIcon('order_data.order_recipient.recipient_name'))), React.createElement("th", null, "Return Action"), React.createElement("th", null, "Code"), React.createElement("th", null, "Description"), React.createElement("th", null, "Part"), React.createElement("th", {
9734
+ onClick: function onClick() {
9735
+ return handleSort('weight');
9736
+ }
9737
+ }, React.createElement("div", {
9738
+ className: "sortIconClass"
9739
+ }, "Weight ", renderSortIcon('weight'))), React.createElement("th", null, "CBM"), React.createElement("th", {
9740
+ onClick: function onClick() {
9741
+ return handleSort('return_reasons.reason');
9742
+ }
9743
+ }, React.createElement("div", {
9744
+ className: "sortIconClass"
9745
+ }, "Return Reason ", renderSortIcon('return_reasons.reason'))), React.createElement("th", null, "Collected"), React.createElement("th", {
9746
+ onClick: function onClick() {
9747
+ return handleSort('collection_reasons.reason');
9748
+ }
9749
+ }, React.createElement("div", {
9750
+ className: "sortIconClass"
9751
+ }, "Collection Reason", ' ', renderSortIcon('collection_reasons.reason'))), React.createElement("th", {
9627
9752
  className: "emailInvoiceShare"
9628
9753
  }, "Labels"))), React.createElement("tbody", null, load ? React.createElement("tr", null, React.createElement("td", {
9629
- colSpan: 13
9754
+ colSpan: 14
9630
9755
  }, React.createElement(Skeleton, {
9631
9756
  active: true
9632
- }))) : (returnData == null ? void 0 : returnData.length) === 0 ? React.createElement("tr", null, React.createElement("td", {
9757
+ }))) : (sortedData == null ? void 0 : sortedData.length) === 0 ? React.createElement("tr", null, React.createElement("td", {
9633
9758
  colSpan: 14
9634
- }, React.createElement(EmptyDataContainer$1, null, React.createElement(Empty, null)))) : returnData == null ? void 0 : returnData.map(function (item, index) {
9635
- 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;
9759
+ }, React.createElement(EmptyDataContainer$1, null, React.createElement(Empty, null)))) : sortedData == null ? void 0 : sortedData.map(function (item, index) {
9760
+ 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$order_product_r5, _item$collection_reas;
9636
9761
  return React.createElement("tr", {
9637
9762
  key: item.id
9638
9763
  }, 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, {
@@ -9641,7 +9766,9 @@ var ReturnOrderTable = function ReturnOrderTable() {
9641
9766
  return (selectedInvoice == null ? void 0 : selectedInvoice.id) === item.id;
9642
9767
  }),
9643
9768
  onChange: function onChange() {
9644
- return handleSelectOrderReturn(item.id, item.return_location, item.return_locations, item.order_product_return_action, item.new_location, item.legacy_product_id);
9769
+ return handleSelectOrderReturn(item.id, item.return_location, item.return_locations, item.order_product_return_action,
9770
+ // item.new_location,
9771
+ item.legacy_product_id);
9645
9772
  }
9646
9773
  })) : null), 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", {
9647
9774
  className: "awaiting"
@@ -9660,8 +9787,8 @@ var ReturnOrderTable = function ReturnOrderTable() {
9660
9787
  style: {
9661
9788
  color: '#888075'
9662
9789
  }
9663
- }, 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) {
9664
- return ret != null && ret.collected_at ? format(new Date(ret.collected_at), 'dd/MM/yyyy') : 'UNKNOWN';
9790
+ }, 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 == null || (_item$order_product_r5 = item.order_product_returns) == null ? void 0 : _item$order_product_r5.map(function (ret) {
9791
+ return ret != null && ret.collected_at ? format(new Date(ret == null ? void 0 : ret.collected_at), 'dd/MM/yyyy') : 'UNKNOWN';
9665
9792
  }) : '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", {
9666
9793
  className: "actionbox"
9667
9794
  }, React.createElement(CustomDrop, {
@@ -9675,7 +9802,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9675
9802
  }, React.createElement(PrinterIcon, null), React.createElement(DownIcon, null), printToogle == index && React.createElement("div", {
9676
9803
  ref: dropdownRef
9677
9804
  }, React.createElement(PrintDropDownReturn, {
9678
- legacyProductId: item.legacy_product_id
9805
+ legacyProductId: item == null ? void 0 : item.legacy_product_id
9679
9806
  })))))));
9680
9807
  })))));
9681
9808
  };
@@ -9881,36 +10008,14 @@ var ModalManager = function ModalManager() {
9881
10008
  type: 'close'
9882
10009
  });
9883
10010
  };
9884
- // useEffect(() => {
9885
- // console.log(error, 'error');
9886
- // //@ts-ignore
9887
- // if (!confirmLoading) {
9888
- // // if (error && error.errorStatus !== 200) {
9889
- // // console.log(error, 'errorINsodeofIFFFFFF');
9890
- // // notification.error({
9891
- // // message: error.errorStatus || 'Error',
9892
- // // description: error.errorMessage || 'Something went wrong',
9893
- // // });
9894
- // // setError(null);
9895
- // // }
9896
- // //@ts-ignore
9897
- // if (error === null && response && response?.code === 200) {
9898
- // notification.success({
9899
- // message: 'Success',
9900
- // // @ts-ignore
9901
- // description: `${response?.message}`,
9902
- // });
9903
- // dispatch({ type: 'close' });
9904
- // setSelectedReturnOrder([]);
9905
- // setCheck([]);
9906
- // setNewPayload([]);
9907
- // setSelectAll(false);
9908
- // }
9909
- // }
9910
- // }, [confirmLoading]); //forCheck
9911
10011
  useEffect(function () {
9912
10012
  // @ts-ignore
9913
10013
  if (apiError && (apiError == null ? void 0 : apiError.code) !== 200) {
10014
+ notification.error({
10015
+ message: 'Failure',
10016
+ // @ts-ignore
10017
+ description: "" + (apiError == null ? void 0 : apiError.message)
10018
+ });
9914
10019
  dispatch({
9915
10020
  type: 'close'
9916
10021
  });
@@ -9920,11 +10025,6 @@ var ModalManager = function ModalManager() {
9920
10025
  setGrouped([]);
9921
10026
  setSelectAll(false);
9922
10027
  setShouldPerformAction(false);
9923
- notification.error({
9924
- message: 'Failure',
9925
- // @ts-ignore
9926
- description: "" + (apiError == null ? void 0 : apiError.message)
9927
- });
9928
10028
  setError(null);
9929
10029
  // @ts-ignore
9930
10030
  } else if ((response == null ? void 0 : response.code) === 200) {
@@ -11098,9 +11198,9 @@ var ReturnTable$1 = function ReturnTable() {
11098
11198
  var _useState = useState([]),
11099
11199
  updatedData = _useState[0],
11100
11200
  setUpdatedData = _useState[1];
11101
- var _useLoading = useLoading(),
11102
- statsLoading = _useLoading[0],
11103
- setLoading = _useLoading[1];
11201
+ var _useStatsLoading = useStatsLoading(),
11202
+ statsLoading = _useStatsLoading[0],
11203
+ setLoading = _useStatsLoading[1];
11104
11204
  var _useOrderStaticData = useOrderStaticData(),
11105
11205
  setOrderStaticData = _useOrderStaticData[1];
11106
11206
  var _useAtom = useAtom(filtersReducerAtom),
@@ -11108,6 +11208,47 @@ var ReturnTable$1 = function ReturnTable() {
11108
11208
  var navigate = useNavigate();
11109
11209
  var _useCustomerData = useCustomerData(),
11110
11210
  customers = _useCustomerData[0];
11211
+ //sorting
11212
+ var _useState2 = useState(null),
11213
+ sortConfig = _useState2[0],
11214
+ setSortConfig = _useState2[1];
11215
+ var handleSort = function handleSort(key) {
11216
+ setSortConfig(function (prev) {
11217
+ if ((prev == null ? void 0 : prev.key) === key && prev.direction === 'asc') {
11218
+ return {
11219
+ key: key,
11220
+ direction: 'desc'
11221
+ };
11222
+ }
11223
+ return {
11224
+ key: key,
11225
+ direction: 'asc'
11226
+ };
11227
+ });
11228
+ };
11229
+ var sortedData = useMemo(function () {
11230
+ if (!updatedData || !sortConfig) return updatedData;
11231
+ var key = sortConfig.key,
11232
+ direction = sortConfig.direction;
11233
+ return [].concat(updatedData).sort(function (a, b) {
11234
+ var valueA = a[key];
11235
+ var valueB = b[key];
11236
+ if (typeof valueA === 'number' && typeof valueB === 'number') {
11237
+ return direction === 'asc' ? valueA - valueB : valueB - valueA;
11238
+ }
11239
+ if (typeof valueA === 'string' && typeof valueB === 'string') {
11240
+ return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
11241
+ }
11242
+ return 0;
11243
+ });
11244
+ }, [updatedData, sortConfig]);
11245
+ var renderSortIcon = function renderSortIcon(columnKey) {
11246
+ if (!sortConfig || sortConfig.key !== columnKey) {
11247
+ return React.createElement(SortIcon, null);
11248
+ }
11249
+ return sortConfig.direction === 'asc' ? React.createElement(CaretDownFilledIcon, null) : React.createElement(CaretDownFilledIcon, null);
11250
+ };
11251
+ //API call
11111
11252
  var _useApiHook = useApiHook({
11112
11253
  endpoint: "/orders/getStaticData/all/",
11113
11254
  method: 'GET'
@@ -11153,19 +11294,66 @@ var ReturnTable$1 = function ReturnTable() {
11153
11294
  payload: []
11154
11295
  });
11155
11296
  }
11156
- navigate("filter/" + customerId);
11297
+ //navigate(`filter/${customerId}`);
11157
11298
  //forlocal
11158
- // navigate(`/filter/${customerId}`);
11299
+ navigate("/filter/" + customerId);
11159
11300
  };
11160
- return React.createElement(React.Fragment, null, React.createElement(StyledTableWrapper$2, {
11301
+ return React.createElement(React.Fragment, null, statsLoading && React.createElement(Loader, null), React.createElement(StyledTableWrapper$2, {
11161
11302
  id: "tableScrolling"
11162
- }, 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", {
11303
+ }, React.createElement(StyledTable$3, null, React.createElement("thead", null, React.createElement("tr", null, [{
11304
+ label: 'Trading Name',
11305
+ key: 'trading_as'
11306
+ }, {
11307
+ label: 'Client',
11308
+ key: 'customer_name'
11309
+ }, {
11310
+ label: 'Orders',
11311
+ key: 'orders'
11312
+ }, {
11313
+ label: 'Products',
11314
+ key: 'return_order_products'
11315
+ }, {
11316
+ label: 'RTS',
11317
+ key: 'RTS'
11318
+ }, {
11319
+ label: 'Pending',
11320
+ key: 'PENDING'
11321
+ }, {
11322
+ label: 'Dispose',
11323
+ key: 'DISPOSE'
11324
+ }, {
11325
+ label: 'Re-allocate',
11326
+ key: 'RE-ALLOCATE'
11327
+ }, {
11328
+ label: 'Re-Del',
11329
+ key: 'RE-DEL'
11330
+ }, {
11331
+ label: 'Recycle',
11332
+ key: 'RECYCLE'
11333
+ }, {
11334
+ label: 'Unknown',
11335
+ key: 'UNKNOWN'
11336
+ }].map(function (_ref) {
11337
+ var label = _ref.label,
11338
+ key = _ref.key;
11339
+ return React.createElement("th", {
11340
+ key: key,
11341
+ onClick: function onClick() {
11342
+ return handleSort(key);
11343
+ }
11344
+ }, React.createElement("div", {
11345
+ style: {
11346
+ display: 'flex',
11347
+ cursor: 'pointer'
11348
+ }
11349
+ }, label, " ", React.createElement("span", null, renderSortIcon(key))));
11350
+ }))), React.createElement("tbody", null, statsLoading ? React.createElement("tr", null, React.createElement("td", {
11163
11351
  colSpan: 11
11164
11352
  }, React.createElement(Skeleton, {
11165
11353
  active: true
11166
- }))) : (updatedData == null ? void 0 : updatedData.length) === 0 ? React.createElement("tr", null, React.createElement("td", {
11354
+ }))) : (sortedData == null ? void 0 : sortedData.length) === 0 ? React.createElement("tr", null, React.createElement("td", {
11167
11355
  colSpan: 11
11168
- }, React.createElement(EmptyDataContainer$1, null, React.createElement(Empty, null)))) : updatedData == null ? void 0 : updatedData.map(function (key, index) {
11356
+ }, React.createElement(EmptyDataContainer$1, null, React.createElement(Empty, null)))) : sortedData == null ? void 0 : sortedData.map(function (key, index) {
11169
11357
  return React.createElement("tr", {
11170
11358
  key: index
11171
11359
  }, React.createElement("td", null, key == null ? void 0 : key.trading_as), React.createElement("td", {
@@ -11231,33 +11419,36 @@ var overviewfiltersReducerAtom = /*#__PURE__*/atom(function (get) {
11231
11419
  });
11232
11420
 
11233
11421
  var _templateObject$24, _templateObject2$1z, _templateObject3$T;
11234
- // import { notification } from 'antd';
11235
- // import Pagination from './table-view/Pagination';
11236
- // import Pagination from './table-view/Pagination';
11237
- // import { overviewfiltersReducerAtom } from './header-filters/overViewFilter';
11422
+ var _excluded$7 = ["count"];
11238
11423
  function ReturnMainTable() {
11239
11424
  var _useAtom = useAtom(overviewfiltersReducerAtom),
11240
11425
  state = _useAtom[0];
11241
- // const [paginationObj] = UsePaginationOverviewData();
11242
- // const [, setCurrentPage] = useState(1);
11243
- // const [itemsPerPage, setItemsPerPage] = useItemsPerOverviewPage();
11426
+ var _UsePaginationOvervie = UsePaginationOverviewData(),
11427
+ paginationObj = _UsePaginationOvervie[0],
11428
+ setPaginationObject = _UsePaginationOvervie[1];
11429
+ var _useState = useState(1),
11430
+ setCurrentPage = _useState[1];
11431
+ var _useItemsPerOverviewP = useItemsPerOverviewPage(),
11432
+ itemsPerPage = _useItemsPerOverviewP[0],
11433
+ setItemsPerPage = _useItemsPerOverviewP[1];
11244
11434
  var pagination = state['x-pagination'];
11245
- // const { page, total } = paginationObj;
11435
+ var page = paginationObj.page,
11436
+ total = paginationObj.total;
11246
11437
  // const [selectedClient] = useTableName();
11247
11438
  var _useStickyStatus = useStickyStatus(),
11248
11439
  isScrolled = _useStickyStatus[0];
11249
- var _useLoading = useLoading(),
11250
- setLoading = _useLoading[1];
11440
+ var _useStatsLoading = useStatsLoading(),
11441
+ setLoading = _useStatsLoading[1];
11251
11442
  var _useClientData = useClientData(),
11252
11443
  setClientData = _useClientData[1];
11253
11444
  var _useTableName = useTableName(),
11254
11445
  tableName = _useTableName[0];
11255
- // const handlePageChange = (page: number) => {
11256
- // setCurrentPage(page);
11257
- // };
11258
- // const handleItemsPerPageChange = (itemsPerPage: number) => {
11259
- // setItemsPerPage(itemsPerPage);
11260
- // };
11446
+ var handlePageChange = function handlePageChange(page) {
11447
+ setCurrentPage(page);
11448
+ };
11449
+ var handleItemsPerPageChange = function handleItemsPerPageChange(itemsPerPage) {
11450
+ setItemsPerPage(itemsPerPage);
11451
+ };
11261
11452
  var _useApiHook = useApiHook({
11262
11453
  endpoint: "/return_orders/stats/",
11263
11454
  method: 'GET',
@@ -11265,28 +11456,36 @@ function ReturnMainTable() {
11265
11456
  pagination: pagination
11266
11457
  }),
11267
11458
  fetchedClientData = _useApiHook.data,
11268
- statsDataLoading = _useApiHook.loading;
11459
+ statsDataLoading = _useApiHook.loading,
11460
+ paginationData = _useApiHook.paginationData;
11269
11461
  useEffect(function () {
11270
11462
  setLoading(statsDataLoading);
11271
11463
  if (fetchedClientData && fetchedClientData.data) {
11272
11464
  var result = fetchedClientData == null ? void 0 : fetchedClientData.data;
11273
11465
  setClientData(result);
11274
- // if (paginationData !== null) {
11275
- // const { count, ...rest } = JSON.parse(paginationData);
11276
- // setPaginationObject(rest);
11277
- // } else {
11278
- // notification.error({
11279
- // message: 'Error',
11280
- // description: 'Pagination data is null',
11281
- // });
11282
- // }
11466
+ if (paginationData !== null) {
11467
+ var _JSON$parse = JSON.parse(paginationData),
11468
+ rest = _objectWithoutPropertiesLoose(_JSON$parse, _excluded$7);
11469
+ setPaginationObject(rest);
11470
+ } else {
11471
+ notification.error({
11472
+ message: 'Error',
11473
+ description: 'Pagination data is null'
11474
+ });
11475
+ }
11283
11476
  }
11284
11477
  }, [statsDataLoading]);
11285
11478
  return React.createElement(React.Fragment, null, React.createElement(DashBoardWrapper$3, {
11286
11479
  className: " " + (isScrolled ? 'stickyTableHead' : '')
11287
11480
  }, React.createElement("div", {
11288
11481
  className: "Tableconatiner"
11289
- }, 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)))));
11482
+ }, 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, {
11483
+ currentPage: page,
11484
+ totalItems: total,
11485
+ itemsPerPage: itemsPerPage,
11486
+ onPageChange: handlePageChange,
11487
+ onItemsPerPageChange: handleItemsPerPageChange
11488
+ }))));
11290
11489
  }
11291
11490
  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"])));
11292
11491
  var Container$18 = /*#__PURE__*/styled.div(_templateObject2$1z || (_templateObject2$1z = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n top: -46px;\n"])));