@bjsdistribution/dms-client-return 0.0.36 → 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.
@@ -3455,7 +3455,7 @@ function GeneralHeader() {
3455
3455
  var Section = /*#__PURE__*/styled__default.div(_templateObject$T || (_templateObject$T = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
3456
3456
 
3457
3457
  var _templateObject19, _templateObject20, _templateObject21;
3458
- var StyledTable$1 = /*#__PURE__*/styled__default.table(_templateObject19 || (_templateObject19 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-spacing: 0 10px;\n width: 100%;\n /* min-width: 1600px; */\n thead {\n white-space: nowrap;\n 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"])));
3458
+ var StyledTable$1 = /*#__PURE__*/styled__default.table(_templateObject19 || (_templateObject19 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-spacing: 0 10px;\n width: 100%;\n /* min-width: 1600px; */\n thead {\n white-space: nowrap;\n 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"])));
3459
3459
  // Styled components
3460
3460
  var StyledTableWrapper = /*#__PURE__*/styled__default.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"])));
3461
3461
  var CustomDrop = /*#__PURE__*/styled__default.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"])));
@@ -3914,10 +3914,16 @@ var atomRoutesTable = /*#__PURE__*/jotai.atom([]);
3914
3914
  var useRoutesTable = function useRoutesTable() {
3915
3915
  return jotai.useAtom(atomRoutesTable);
3916
3916
  };
3917
+ //this
3917
3918
  var loading = /*#__PURE__*/jotai.atom(false);
3918
- var useLoading = function useLoading() {
3919
+ var useStatsLoading = function useStatsLoading() {
3919
3920
  return jotai.useAtom(loading);
3920
3921
  };
3922
+ //this
3923
+ var loadingState = /*#__PURE__*/jotai.atom(false);
3924
+ var useLoading = function useLoading() {
3925
+ return jotai.useAtom(loadingState);
3926
+ };
3921
3927
  var selectedAction = /*#__PURE__*/jotai.atom(null);
3922
3928
  function useSelectedAction() {
3923
3929
  return jotai.useAtom(selectedAction);
@@ -3964,6 +3970,14 @@ var atomItemsPerReturnPage = /*#__PURE__*/jotai.atom(50);
3964
3970
  var useItemsPerReturnPage = function useItemsPerReturnPage() {
3965
3971
  return jotai.useAtom(atomItemsPerReturnPage);
3966
3972
  };
3973
+ //stats data overview
3974
+ var UsePaginationOverviewData = function UsePaginationOverviewData() {
3975
+ return jotai.useAtom(atomPaginationData);
3976
+ };
3977
+ var atomItemsPerOverviewPage = /*#__PURE__*/jotai.atom(50);
3978
+ var useItemsPerOverviewPage = function useItemsPerOverviewPage() {
3979
+ return jotai.useAtom(atomItemsPerOverviewPage);
3980
+ };
3967
3981
  var countStatus = /*#__PURE__*/jotai.atom([]);
3968
3982
  var useCountData = function useCountData() {
3969
3983
  return jotai.useAtom(countStatus);
@@ -8924,19 +8938,19 @@ function SelectionFilter() {
8924
8938
  });
8925
8939
  if (filteredClient) {
8926
8940
  var _filteredClient$actio, _filteredClient$retur;
8927
- var mappedActions = filteredClient == null || (_filteredClient$actio = filteredClient.actions) == null ? void 0 : _filteredClient$actio.map(function (action) {
8941
+ var mappedActions = Array.isArray(filteredClient == null ? void 0 : filteredClient.actions) ? filteredClient == null || (_filteredClient$actio = filteredClient.actions) == null ? void 0 : _filteredClient$actio.map(function (action) {
8928
8942
  return {
8929
8943
  label: action,
8930
8944
  value: action
8931
8945
  };
8932
- });
8946
+ }) : [];
8933
8947
  setActionTypeOptions(mappedActions);
8934
- var mappedLocations = filteredClient == null || (_filteredClient$retur = filteredClient.return_locations) == null ? void 0 : _filteredClient$retur.map(function (location) {
8948
+ 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) {
8935
8949
  return {
8936
- label: location,
8937
- value: location
8950
+ label: location == null ? void 0 : location.location_name,
8951
+ value: location == null ? void 0 : location.token
8938
8952
  };
8939
- });
8953
+ }) : [];
8940
8954
  setLocationOptions(mappedLocations);
8941
8955
  }
8942
8956
  }
@@ -9410,6 +9424,43 @@ var PrintDropDownReturn = function PrintDropDownReturn(_ref) {
9410
9424
  var OptionsList = /*#__PURE__*/styled__default.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"])));
9411
9425
  var OptionsListLi = /*#__PURE__*/styled__default.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"])));
9412
9426
 
9427
+ function CaretDownFilledIcon(props) {
9428
+ return React__default.createElement("svg", Object.assign({
9429
+ width: "16",
9430
+ height: "16",
9431
+ viewBox: "0 0 18 18",
9432
+ fill: "none",
9433
+ xmlns: "http://www.w3.org/2000/svg"
9434
+ }, props), React__default.createElement("g", {
9435
+ "clip-path": "url(#clip0_2034_435)"
9436
+ }, React__default.createElement("path", {
9437
+ 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",
9438
+ fill: "#9E9E9E"
9439
+ })), React__default.createElement("defs", null, React__default.createElement("clipPath", {
9440
+ id: "clip0_2034_435"
9441
+ }, React__default.createElement("rect", {
9442
+ width: "16",
9443
+ height: "16",
9444
+ fill: "white"
9445
+ }))));
9446
+ }
9447
+
9448
+ var SortIcon = function SortIcon() {
9449
+ return React__default.createElement("svg", {
9450
+ width: "16",
9451
+ height: "17",
9452
+ viewBox: "0 0 16 17",
9453
+ fill: "none",
9454
+ xmlns: "http://www.w3.org/2000/svg"
9455
+ }, React__default.createElement("g", {
9456
+ id: "bxs:sort-alt"
9457
+ }, React__default.createElement("path", {
9458
+ id: "Vector",
9459
+ 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",
9460
+ fill: "#9E9E9E"
9461
+ })));
9462
+ };
9463
+
9413
9464
  var _excluded$3 = ["count"];
9414
9465
  var ReturnOrderTable = function ReturnOrderTable() {
9415
9466
  var _useAtom = jotai.useAtom(filtersReducerAtom),
@@ -9449,6 +9500,46 @@ var ReturnOrderTable = function ReturnOrderTable() {
9449
9500
  setPaginationObject = _UsePaginationData[1];
9450
9501
  var _usefetchAgain = usefetchAgain(),
9451
9502
  callForFetch = _usefetchAgain[0];
9503
+ //sorting
9504
+ var _useState = React.useState(null),
9505
+ sortConfig = _useState[0],
9506
+ setSortConfig = _useState[1];
9507
+ var handleSort = function handleSort(key) {
9508
+ setSortConfig(function (prev) {
9509
+ if ((prev == null ? void 0 : prev.key) === key && prev.direction === 'asc') {
9510
+ return {
9511
+ key: key,
9512
+ direction: 'desc'
9513
+ };
9514
+ }
9515
+ return {
9516
+ key: key,
9517
+ direction: 'asc'
9518
+ };
9519
+ });
9520
+ };
9521
+ var sortedData = React.useMemo(function () {
9522
+ if (!returnData || !sortConfig) return returnData;
9523
+ var key = sortConfig.key,
9524
+ direction = sortConfig.direction;
9525
+ return [].concat(returnData).sort(function (a, b) {
9526
+ var valueA = a[key];
9527
+ var valueB = b[key];
9528
+ if (typeof valueA === 'number' && typeof valueB === 'number') {
9529
+ return direction === 'asc' ? valueA - valueB : valueB - valueA;
9530
+ }
9531
+ if (typeof valueA === 'string' && typeof valueB === 'string') {
9532
+ return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
9533
+ }
9534
+ return 0;
9535
+ });
9536
+ }, [returnData, sortConfig]);
9537
+ var renderSortIcon = function renderSortIcon(columnKey) {
9538
+ if (!sortConfig || sortConfig.key !== columnKey) {
9539
+ return React__default.createElement(SortIcon, null);
9540
+ }
9541
+ return sortConfig.direction === 'asc' ? React__default.createElement(CaretDownFilledIcon, null) : React__default.createElement(CaretDownFilledIcon, null);
9542
+ };
9452
9543
  var OpenDropDown = function OpenDropDown(index) {
9453
9544
  setPrintToggle(function (prevIndex) {
9454
9545
  return prevIndex === index ? null : index;
@@ -9502,7 +9593,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9502
9593
  return (location == null ? void 0 : location.token) === (returnItem == null ? void 0 : returnItem.return_location);
9503
9594
  });
9504
9595
  return _extends({}, returnItem, {
9505
- new_location: matchingLocation ? matchingLocation.location_name : null
9596
+ new_location: matchingLocation ? matchingLocation == null ? void 0 : matchingLocation.location_name : null
9506
9597
  });
9507
9598
  });
9508
9599
  setReturnData(updatedReturnData);
@@ -9522,8 +9613,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9522
9613
  return_location: loc == null ? void 0 : loc.return_location,
9523
9614
  products: loc == null ? void 0 : loc.legacy_product_id,
9524
9615
  order_product_return_action: loc == null ? void 0 : loc.order_product_return_action,
9525
- return_location_token: loc == null ? void 0 : loc.return_location,
9526
- new_location: loc == null ? void 0 : loc.new_location
9616
+ return_location_token: loc == null ? void 0 : loc.return_location
9527
9617
  };
9528
9618
  }));
9529
9619
  setNewPayload(returnData == null ? void 0 : returnData.filter(function (loc) {
@@ -9537,8 +9627,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9537
9627
  customer_id: +(createReturn == null ? void 0 : createReturn.customer_id),
9538
9628
  products: [loc == null ? void 0 : loc.legacy_product_id],
9539
9629
  return_action: loc == null || (_loc$order_product_re3 = loc.order_product_return_action) == null ? void 0 : _loc$order_product_re3.type,
9540
- return_location_token: (loc == null ? void 0 : loc.return_location) || null,
9541
- new_location: loc == null ? void 0 : loc.new_location
9630
+ return_location_token: (loc == null ? void 0 : loc.return_location) || null
9542
9631
  };
9543
9632
  }));
9544
9633
  } else {
@@ -9547,7 +9636,9 @@ var ReturnOrderTable = function ReturnOrderTable() {
9547
9636
  setGrouped([]);
9548
9637
  }
9549
9638
  };
9550
- var handleSelectOrderReturn = function handleSelectOrderReturn(id, return_location, return_locations, order_product_return_action, new_location, legacy_product_id) {
9639
+ var handleSelectOrderReturn = function handleSelectOrderReturn(id, return_location, return_locations, order_product_return_action,
9640
+ // new_location: any,
9641
+ legacy_product_id) {
9551
9642
  setSelectedReturnOrder(function (prevSelectedLocations) {
9552
9643
  var isSelected = prevSelectedLocations == null ? void 0 : prevSelectedLocations.some(function (loc) {
9553
9644
  return loc.id === id;
@@ -9560,8 +9651,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9560
9651
  return _extends({}, prevState, {
9561
9652
  products: legacy_product_id,
9562
9653
  return_action: (order_product_return_action == null ? void 0 : order_product_return_action.type) || null,
9563
- return_location_token: return_location || null,
9564
- new_location: new_location
9654
+ return_location_token: return_location || null
9565
9655
  });
9566
9656
  });
9567
9657
  setNewPayload(function (prevPayload) {
@@ -9586,16 +9676,14 @@ var ReturnOrderTable = function ReturnOrderTable() {
9586
9676
  return _extends({}, prevState, {
9587
9677
  products: legacy_product_id,
9588
9678
  return_action: (order_product_return_action == null ? void 0 : order_product_return_action.type) || null,
9589
- return_location_token: return_location || null,
9590
- new_location: new_location
9679
+ return_location_token: return_location || null
9591
9680
  });
9592
9681
  });
9593
9682
  return [].concat(prevSelectedLocations, [{
9594
9683
  id: id,
9595
9684
  return_location: return_location,
9596
9685
  return_locations: return_locations,
9597
- order_product_return_action: order_product_return_action,
9598
- new_location: new_location
9686
+ order_product_return_action: order_product_return_action
9599
9687
  }]);
9600
9688
  }
9601
9689
  });
@@ -9620,6 +9708,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9620
9708
  }, []);
9621
9709
  var mergedPayload = Object.values(groupedPayload);
9622
9710
  setGrouped(mergedPayload);
9711
+ console.log(mergedPayload, 'mergedPayload');
9623
9712
  }, [newpayload]);
9624
9713
  return React__default.createElement(React__default.Fragment, null, postLoading && React__default.createElement(Loader, null), React__default.createElement(StyledTableWrapper, {
9625
9714
  className: "fortables"
@@ -9631,16 +9720,52 @@ var ReturnOrderTable = function ReturnOrderTable() {
9631
9720
  }, React__default.createElement(dmsComponentLibrary.Checkbox, {
9632
9721
  checked: selectAll,
9633
9722
  onChange: handleSelectAll
9634
- })) : React__default.createElement("th", null), React__default.createElement("th", null, "Product Location"), React__default.createElement("th", null, "Return Location"), React__default.createElement("th", null, "Recipient"), React__default.createElement("th", null, "Return Action"), React__default.createElement("th", null, "Code"), React__default.createElement("th", null, "Description"), React__default.createElement("th", null, "Part"), React__default.createElement("th", null, "Weight"), React__default.createElement("th", null, "CBM"), React__default.createElement("th", null, "Return Reason"), React__default.createElement("th", null, "Collected"), React__default.createElement("th", null, "Collection Reason"), React__default.createElement("th", {
9723
+ })) : React__default.createElement("th", null), React__default.createElement("th", {
9724
+ onClick: function onClick() {
9725
+ return handleSort('orders_products_stock.location');
9726
+ }
9727
+ }, React__default.createElement("div", {
9728
+ className: "sortIconClass"
9729
+ }, "Product Location", ' ', renderSortIcon('orders_products_stock.location'))), React__default.createElement("th", {
9730
+ onClick: function onClick() {
9731
+ return handleSort('new_location');
9732
+ }
9733
+ }, React__default.createElement("div", {
9734
+ className: "sortIconClass"
9735
+ }, "Return Location ", renderSortIcon('new_location'))), React__default.createElement("th", {
9736
+ onClick: function onClick() {
9737
+ return handleSort('order_data.order_recipient.recipient_name');
9738
+ }
9739
+ }, React__default.createElement("div", {
9740
+ className: "sortIconClass"
9741
+ }, "Recipient", ' ', renderSortIcon('order_data.order_recipient.recipient_name'))), React__default.createElement("th", null, "Return Action"), React__default.createElement("th", null, "Code"), React__default.createElement("th", null, "Description"), React__default.createElement("th", null, "Part"), React__default.createElement("th", {
9742
+ onClick: function onClick() {
9743
+ return handleSort('weight');
9744
+ }
9745
+ }, React__default.createElement("div", {
9746
+ className: "sortIconClass"
9747
+ }, "Weight ", renderSortIcon('weight'))), React__default.createElement("th", null, "CBM"), React__default.createElement("th", {
9748
+ onClick: function onClick() {
9749
+ return handleSort('return_reasons.reason');
9750
+ }
9751
+ }, React__default.createElement("div", {
9752
+ className: "sortIconClass"
9753
+ }, "Return Reason ", renderSortIcon('return_reasons.reason'))), React__default.createElement("th", null, "Collected"), React__default.createElement("th", {
9754
+ onClick: function onClick() {
9755
+ return handleSort('collection_reasons.reason');
9756
+ }
9757
+ }, React__default.createElement("div", {
9758
+ className: "sortIconClass"
9759
+ }, "Collection Reason", ' ', renderSortIcon('collection_reasons.reason'))), React__default.createElement("th", {
9635
9760
  className: "emailInvoiceShare"
9636
9761
  }, "Labels"))), React__default.createElement("tbody", null, load ? React__default.createElement("tr", null, React__default.createElement("td", {
9637
- colSpan: 13
9762
+ colSpan: 14
9638
9763
  }, React__default.createElement(antd.Skeleton, {
9639
9764
  active: true
9640
- }))) : (returnData == null ? void 0 : returnData.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
9765
+ }))) : (sortedData == null ? void 0 : sortedData.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
9641
9766
  colSpan: 14
9642
- }, React__default.createElement(EmptyDataContainer$1, null, React__default.createElement(antd.Empty, null)))) : returnData == null ? void 0 : returnData.map(function (item, index) {
9643
- var _item$order_product_r2, _item$orders_products, _item$orders_products2, _item$order_data, _item$order_data2, _item$order_product_r3, _item$return_reasons, _item$order_product_r4, _item$collection_reas;
9767
+ }, React__default.createElement(EmptyDataContainer$1, null, React__default.createElement(antd.Empty, null)))) : sortedData == null ? void 0 : sortedData.map(function (item, index) {
9768
+ 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;
9644
9769
  return React__default.createElement("tr", {
9645
9770
  key: item.id
9646
9771
  }, React__default.createElement("td", null, (item == null || (_item$order_product_r2 = item.order_product_return_action) == null ? void 0 : _item$order_product_r2.type) == 'RTS' ? React__default.createElement(React__default.Fragment, null, React__default.createElement(dmsComponentLibrary.Checkbox, {
@@ -9649,7 +9774,9 @@ var ReturnOrderTable = function ReturnOrderTable() {
9649
9774
  return (selectedInvoice == null ? void 0 : selectedInvoice.id) === item.id;
9650
9775
  }),
9651
9776
  onChange: function onChange() {
9652
- return handleSelectOrderReturn(item.id, item.return_location, item.return_locations, item.order_product_return_action, item.new_location, item.legacy_product_id);
9777
+ return handleSelectOrderReturn(item.id, item.return_location, item.return_locations, item.order_product_return_action,
9778
+ // item.new_location,
9779
+ item.legacy_product_id);
9653
9780
  }
9654
9781
  })) : null), React__default.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__default.createElement("div", {
9655
9782
  className: "awaiting"
@@ -9668,8 +9795,8 @@ var ReturnOrderTable = function ReturnOrderTable() {
9668
9795
  style: {
9669
9796
  color: '#888075'
9670
9797
  }
9671
- }, displayValueOrNA(item == null || (_item$order_data2 = item.order_data) == null || (_item$order_data2 = _item$order_data2.order_recipient) == null ? void 0 : _item$order_data2.postcode)))), React__default.createElement("td", null, displayValueOrNA(item == null || (_item$order_product_r3 = item.order_product_return_action) == null ? void 0 : _item$order_product_r3.type)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.code)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.description)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.parts_count)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.weight), ' ', item != null && item.weight && (item == null ? void 0 : item.weight) !== null ? 'KG' : ''), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.cube)), React__default.createElement("td", null, displayValueOrNA(item == null || (_item$return_reasons = item.return_reasons) == null ? void 0 : _item$return_reasons.reason)), React__default.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) {
9672
- return ret != null && ret.collected_at ? dateFns.format(new Date(ret.collected_at), 'dd/MM/yyyy') : 'UNKNOWN';
9798
+ }, 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__default.createElement("td", null, displayValueOrNA(item == null || (_item$order_product_r3 = item.order_product_return_action) == null ? void 0 : _item$order_product_r3.type)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.code)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.description)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.parts_count)), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.weight), ' ', item != null && item.weight && (item == null ? void 0 : item.weight) !== null ? 'KG' : ''), React__default.createElement("td", null, displayValueOrNA(item == null ? void 0 : item.cube)), React__default.createElement("td", null, displayValueOrNA(item == null || (_item$return_reasons = item.return_reasons) == null ? void 0 : _item$return_reasons.reason)), React__default.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) {
9799
+ return ret != null && ret.collected_at ? dateFns.format(new Date(ret == null ? void 0 : ret.collected_at), 'dd/MM/yyyy') : 'UNKNOWN';
9673
9800
  }) : 'UNKNOWN'), React__default.createElement("td", null, displayValueOrNA(item == null || (_item$collection_reas = item.collection_reasons) == null ? void 0 : _item$collection_reas.reason)), React__default.createElement("td", null, React__default.createElement("ul", {
9674
9801
  className: "actionbox"
9675
9802
  }, React__default.createElement(CustomDrop, {
@@ -9683,7 +9810,7 @@ var ReturnOrderTable = function ReturnOrderTable() {
9683
9810
  }, React__default.createElement(PrinterIcon, null), React__default.createElement(DownIcon, null), printToogle == index && React__default.createElement("div", {
9684
9811
  ref: dropdownRef
9685
9812
  }, React__default.createElement(PrintDropDownReturn, {
9686
- legacyProductId: item.legacy_product_id
9813
+ legacyProductId: item == null ? void 0 : item.legacy_product_id
9687
9814
  })))))));
9688
9815
  })))));
9689
9816
  };
@@ -9889,36 +10016,14 @@ var ModalManager = function ModalManager() {
9889
10016
  type: 'close'
9890
10017
  });
9891
10018
  };
9892
- // useEffect(() => {
9893
- // console.log(error, 'error');
9894
- // //@ts-ignore
9895
- // if (!confirmLoading) {
9896
- // // if (error && error.errorStatus !== 200) {
9897
- // // console.log(error, 'errorINsodeofIFFFFFF');
9898
- // // notification.error({
9899
- // // message: error.errorStatus || 'Error',
9900
- // // description: error.errorMessage || 'Something went wrong',
9901
- // // });
9902
- // // setError(null);
9903
- // // }
9904
- // //@ts-ignore
9905
- // if (error === null && response && response?.code === 200) {
9906
- // notification.success({
9907
- // message: 'Success',
9908
- // // @ts-ignore
9909
- // description: `${response?.message}`,
9910
- // });
9911
- // dispatch({ type: 'close' });
9912
- // setSelectedReturnOrder([]);
9913
- // setCheck([]);
9914
- // setNewPayload([]);
9915
- // setSelectAll(false);
9916
- // }
9917
- // }
9918
- // }, [confirmLoading]); //forCheck
9919
10019
  React.useEffect(function () {
9920
10020
  // @ts-ignore
9921
10021
  if (apiError && (apiError == null ? void 0 : apiError.code) !== 200) {
10022
+ antd.notification.error({
10023
+ message: 'Failure',
10024
+ // @ts-ignore
10025
+ description: "" + (apiError == null ? void 0 : apiError.message)
10026
+ });
9922
10027
  dispatch({
9923
10028
  type: 'close'
9924
10029
  });
@@ -9928,11 +10033,6 @@ var ModalManager = function ModalManager() {
9928
10033
  setGrouped([]);
9929
10034
  setSelectAll(false);
9930
10035
  setShouldPerformAction(false);
9931
- antd.notification.error({
9932
- message: 'Failure',
9933
- // @ts-ignore
9934
- description: "" + (apiError == null ? void 0 : apiError.message)
9935
- });
9936
10036
  setError(null);
9937
10037
  // @ts-ignore
9938
10038
  } else if ((response == null ? void 0 : response.code) === 200) {
@@ -11106,9 +11206,9 @@ var ReturnTable$1 = function ReturnTable() {
11106
11206
  var _useState = React.useState([]),
11107
11207
  updatedData = _useState[0],
11108
11208
  setUpdatedData = _useState[1];
11109
- var _useLoading = useLoading(),
11110
- statsLoading = _useLoading[0],
11111
- setLoading = _useLoading[1];
11209
+ var _useStatsLoading = useStatsLoading(),
11210
+ statsLoading = _useStatsLoading[0],
11211
+ setLoading = _useStatsLoading[1];
11112
11212
  var _useOrderStaticData = useOrderStaticData(),
11113
11213
  setOrderStaticData = _useOrderStaticData[1];
11114
11214
  var _useAtom = jotai.useAtom(filtersReducerAtom),
@@ -11116,6 +11216,47 @@ var ReturnTable$1 = function ReturnTable() {
11116
11216
  var navigate = reactRouterDom.useNavigate();
11117
11217
  var _useCustomerData = useCustomerData(),
11118
11218
  customers = _useCustomerData[0];
11219
+ //sorting
11220
+ var _useState2 = React.useState(null),
11221
+ sortConfig = _useState2[0],
11222
+ setSortConfig = _useState2[1];
11223
+ var handleSort = function handleSort(key) {
11224
+ setSortConfig(function (prev) {
11225
+ if ((prev == null ? void 0 : prev.key) === key && prev.direction === 'asc') {
11226
+ return {
11227
+ key: key,
11228
+ direction: 'desc'
11229
+ };
11230
+ }
11231
+ return {
11232
+ key: key,
11233
+ direction: 'asc'
11234
+ };
11235
+ });
11236
+ };
11237
+ var sortedData = React.useMemo(function () {
11238
+ if (!updatedData || !sortConfig) return updatedData;
11239
+ var key = sortConfig.key,
11240
+ direction = sortConfig.direction;
11241
+ return [].concat(updatedData).sort(function (a, b) {
11242
+ var valueA = a[key];
11243
+ var valueB = b[key];
11244
+ if (typeof valueA === 'number' && typeof valueB === 'number') {
11245
+ return direction === 'asc' ? valueA - valueB : valueB - valueA;
11246
+ }
11247
+ if (typeof valueA === 'string' && typeof valueB === 'string') {
11248
+ return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
11249
+ }
11250
+ return 0;
11251
+ });
11252
+ }, [updatedData, sortConfig]);
11253
+ var renderSortIcon = function renderSortIcon(columnKey) {
11254
+ if (!sortConfig || sortConfig.key !== columnKey) {
11255
+ return React__default.createElement(SortIcon, null);
11256
+ }
11257
+ return sortConfig.direction === 'asc' ? React__default.createElement(CaretDownFilledIcon, null) : React__default.createElement(CaretDownFilledIcon, null);
11258
+ };
11259
+ //API call
11119
11260
  var _useApiHook = dmsComponentLibrary.useApiHook({
11120
11261
  endpoint: "/orders/getStaticData/all/",
11121
11262
  method: 'GET'
@@ -11161,19 +11302,66 @@ var ReturnTable$1 = function ReturnTable() {
11161
11302
  payload: []
11162
11303
  });
11163
11304
  }
11164
- navigate("filter/" + customerId);
11305
+ //navigate(`filter/${customerId}`);
11165
11306
  //forlocal
11166
- // navigate(`/filter/${customerId}`);
11307
+ navigate("/filter/" + customerId);
11167
11308
  };
11168
- return React__default.createElement(React__default.Fragment, null, React__default.createElement(StyledTableWrapper$2, {
11309
+ return React__default.createElement(React__default.Fragment, null, statsLoading && React__default.createElement(Loader, null), React__default.createElement(StyledTableWrapper$2, {
11169
11310
  id: "tableScrolling"
11170
- }, React__default.createElement(StyledTable$3, null, React__default.createElement("thead", null, React__default.createElement("tr", null, React__default.createElement("th", null, "Trading Name"), React__default.createElement("th", null, "Client"), React__default.createElement("th", null, "Orders"), React__default.createElement("th", null, "Products"), React__default.createElement("th", null, "RTS"), React__default.createElement("th", null, "Pending"), React__default.createElement("th", null, "Dispose"), React__default.createElement("th", null, "Re-allocate"), React__default.createElement("th", null, "Re-Del"), React__default.createElement("th", null, "Recycle"), React__default.createElement("th", null, "Unknown"))), React__default.createElement("tbody", null, statsLoading ? React__default.createElement("tr", null, React__default.createElement("td", {
11311
+ }, React__default.createElement(StyledTable$3, null, React__default.createElement("thead", null, React__default.createElement("tr", null, [{
11312
+ label: 'Trading Name',
11313
+ key: 'trading_as'
11314
+ }, {
11315
+ label: 'Client',
11316
+ key: 'customer_name'
11317
+ }, {
11318
+ label: 'Orders',
11319
+ key: 'orders'
11320
+ }, {
11321
+ label: 'Products',
11322
+ key: 'return_order_products'
11323
+ }, {
11324
+ label: 'RTS',
11325
+ key: 'RTS'
11326
+ }, {
11327
+ label: 'Pending',
11328
+ key: 'PENDING'
11329
+ }, {
11330
+ label: 'Dispose',
11331
+ key: 'DISPOSE'
11332
+ }, {
11333
+ label: 'Re-allocate',
11334
+ key: 'RE-ALLOCATE'
11335
+ }, {
11336
+ label: 'Re-Del',
11337
+ key: 'RE-DEL'
11338
+ }, {
11339
+ label: 'Recycle',
11340
+ key: 'RECYCLE'
11341
+ }, {
11342
+ label: 'Unknown',
11343
+ key: 'UNKNOWN'
11344
+ }].map(function (_ref) {
11345
+ var label = _ref.label,
11346
+ key = _ref.key;
11347
+ return React__default.createElement("th", {
11348
+ key: key,
11349
+ onClick: function onClick() {
11350
+ return handleSort(key);
11351
+ }
11352
+ }, React__default.createElement("div", {
11353
+ style: {
11354
+ display: 'flex',
11355
+ cursor: 'pointer'
11356
+ }
11357
+ }, label, " ", React__default.createElement("span", null, renderSortIcon(key))));
11358
+ }))), React__default.createElement("tbody", null, statsLoading ? React__default.createElement("tr", null, React__default.createElement("td", {
11171
11359
  colSpan: 11
11172
11360
  }, React__default.createElement(antd.Skeleton, {
11173
11361
  active: true
11174
- }))) : (updatedData == null ? void 0 : updatedData.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
11362
+ }))) : (sortedData == null ? void 0 : sortedData.length) === 0 ? React__default.createElement("tr", null, React__default.createElement("td", {
11175
11363
  colSpan: 11
11176
- }, React__default.createElement(EmptyDataContainer$1, null, React__default.createElement(antd.Empty, null)))) : updatedData == null ? void 0 : updatedData.map(function (key, index) {
11364
+ }, React__default.createElement(EmptyDataContainer$1, null, React__default.createElement(antd.Empty, null)))) : sortedData == null ? void 0 : sortedData.map(function (key, index) {
11177
11365
  return React__default.createElement("tr", {
11178
11366
  key: index
11179
11367
  }, React__default.createElement("td", null, key == null ? void 0 : key.trading_as), React__default.createElement("td", {
@@ -11239,33 +11427,36 @@ var overviewfiltersReducerAtom = /*#__PURE__*/jotai.atom(function (get) {
11239
11427
  });
11240
11428
 
11241
11429
  var _templateObject$24, _templateObject2$1z, _templateObject3$T;
11242
- // import { notification } from 'antd';
11243
- // import Pagination from './table-view/Pagination';
11244
- // import Pagination from './table-view/Pagination';
11245
- // import { overviewfiltersReducerAtom } from './header-filters/overViewFilter';
11430
+ var _excluded$7 = ["count"];
11246
11431
  function ReturnMainTable() {
11247
11432
  var _useAtom = jotai.useAtom(overviewfiltersReducerAtom),
11248
11433
  state = _useAtom[0];
11249
- // const [paginationObj] = UsePaginationOverviewData();
11250
- // const [, setCurrentPage] = useState(1);
11251
- // const [itemsPerPage, setItemsPerPage] = useItemsPerOverviewPage();
11434
+ var _UsePaginationOvervie = UsePaginationOverviewData(),
11435
+ paginationObj = _UsePaginationOvervie[0],
11436
+ setPaginationObject = _UsePaginationOvervie[1];
11437
+ var _useState = React.useState(1),
11438
+ setCurrentPage = _useState[1];
11439
+ var _useItemsPerOverviewP = useItemsPerOverviewPage(),
11440
+ itemsPerPage = _useItemsPerOverviewP[0],
11441
+ setItemsPerPage = _useItemsPerOverviewP[1];
11252
11442
  var pagination = state['x-pagination'];
11253
- // const { page, total } = paginationObj;
11443
+ var page = paginationObj.page,
11444
+ total = paginationObj.total;
11254
11445
  // const [selectedClient] = useTableName();
11255
11446
  var _useStickyStatus = useStickyStatus(),
11256
11447
  isScrolled = _useStickyStatus[0];
11257
- var _useLoading = useLoading(),
11258
- setLoading = _useLoading[1];
11448
+ var _useStatsLoading = useStatsLoading(),
11449
+ setLoading = _useStatsLoading[1];
11259
11450
  var _useClientData = useClientData(),
11260
11451
  setClientData = _useClientData[1];
11261
11452
  var _useTableName = useTableName(),
11262
11453
  tableName = _useTableName[0];
11263
- // const handlePageChange = (page: number) => {
11264
- // setCurrentPage(page);
11265
- // };
11266
- // const handleItemsPerPageChange = (itemsPerPage: number) => {
11267
- // setItemsPerPage(itemsPerPage);
11268
- // };
11454
+ var handlePageChange = function handlePageChange(page) {
11455
+ setCurrentPage(page);
11456
+ };
11457
+ var handleItemsPerPageChange = function handleItemsPerPageChange(itemsPerPage) {
11458
+ setItemsPerPage(itemsPerPage);
11459
+ };
11269
11460
  var _useApiHook = dmsComponentLibrary.useApiHook({
11270
11461
  endpoint: "/return_orders/stats/",
11271
11462
  method: 'GET',
@@ -11273,28 +11464,36 @@ function ReturnMainTable() {
11273
11464
  pagination: pagination
11274
11465
  }),
11275
11466
  fetchedClientData = _useApiHook.data,
11276
- statsDataLoading = _useApiHook.loading;
11467
+ statsDataLoading = _useApiHook.loading,
11468
+ paginationData = _useApiHook.paginationData;
11277
11469
  React.useEffect(function () {
11278
11470
  setLoading(statsDataLoading);
11279
11471
  if (fetchedClientData && fetchedClientData.data) {
11280
11472
  var result = fetchedClientData == null ? void 0 : fetchedClientData.data;
11281
11473
  setClientData(result);
11282
- // if (paginationData !== null) {
11283
- // const { count, ...rest } = JSON.parse(paginationData);
11284
- // setPaginationObject(rest);
11285
- // } else {
11286
- // notification.error({
11287
- // message: 'Error',
11288
- // description: 'Pagination data is null',
11289
- // });
11290
- // }
11474
+ if (paginationData !== null) {
11475
+ var _JSON$parse = JSON.parse(paginationData),
11476
+ rest = _objectWithoutPropertiesLoose(_JSON$parse, _excluded$7);
11477
+ setPaginationObject(rest);
11478
+ } else {
11479
+ antd.notification.error({
11480
+ message: 'Error',
11481
+ description: 'Pagination data is null'
11482
+ });
11483
+ }
11291
11484
  }
11292
11485
  }, [statsDataLoading]);
11293
11486
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(DashBoardWrapper$3, {
11294
11487
  className: " " + (isScrolled ? 'stickyTableHead' : '')
11295
11488
  }, React__default.createElement("div", {
11296
11489
  className: "Tableconatiner"
11297
- }, React__default.createElement(HeaderFilter, null), React__default.createElement(Container$18, null, React__default.createElement(Row$7, null, React__default.createElement(Text$8, null, "Client Return"), tableName ? React__default.createElement(ReturnFilter, null) : React__default.createElement(Filters, null)), React__default.createElement(ReturnTable$1, null)))));
11490
+ }, React__default.createElement(HeaderFilter, null), React__default.createElement(Container$18, null, React__default.createElement(Row$7, null, React__default.createElement(Text$8, null, "Client Return"), tableName ? React__default.createElement(ReturnFilter, null) : React__default.createElement(Filters, null)), React__default.createElement(ReturnTable$1, null)), total > 0 && React__default.createElement(Pagination, {
11491
+ currentPage: page,
11492
+ totalItems: total,
11493
+ itemsPerPage: itemsPerPage,
11494
+ onPageChange: handlePageChange,
11495
+ onItemsPerPageChange: handleItemsPerPageChange
11496
+ }))));
11298
11497
  }
11299
11498
  var Row$7 = /*#__PURE__*/styled__default.div(_templateObject$24 || (_templateObject$24 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"])));
11300
11499
  var Container$18 = /*#__PURE__*/styled__default.div(_templateObject2$1z || (_templateObject2$1z = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n top: -46px;\n"])));