@bjsdistribution/dms-client-return 0.0.95-prod → 0.0.96-prod

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.
@@ -865,6 +865,10 @@ var clientDataAtom = /*#__PURE__*/atom([]);
865
865
  function useClientData() {
866
866
  return useAtom(clientDataAtom);
867
867
  }
868
+ var clientData = /*#__PURE__*/atom([]);
869
+ function usegetClientData() {
870
+ return useAtom(clientData);
871
+ }
868
872
  var notes = /*#__PURE__*/atom([]);
869
873
  function usegetNotes() {
870
874
  return useAtom(notes);
@@ -2627,22 +2631,6 @@ var ReturnTable = function ReturnTable() {
2627
2631
  var Container$2 = /*#__PURE__*/styled.div(_templateObject$8 || (_templateObject$8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n top: -46px;\n"])));
2628
2632
  var DashBoardWrapper = /*#__PURE__*/styled.section(_templateObject2$6 || (_templateObject2$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .Tableconatiner {\n border-radius: 12px;\n background: #fff;\n box-shadow: -2px 0px 12px 0px rgba(56, 71, 109, 0.1);\n display: block;\n padding: 15px 20px;\n }\n .headerWrap,\n .tableData,\n .styleCovered {\n transition: all ease 0.5s;\n }\n &.stickyTableHead {\n h2 {\n font-size: 21px;\n }\n .headerWrap {\n height: 84px;\n padding: 10px;\n border-radius: 0px 0px 15px 15px;\n > div {\n position: relative;\n z-index: 10;\n }\n }\n .styleCovered {\n margin-top: -32px;\n width: 67%;\n float: right;\n gap: 5px;\n padding-right: 11px;\n\n li {\n padding: 4px 10px 5px 5px;\n gap: 5px;\n .svgCover {\n width: 30px;\n height: 30px;\n svg {\n height: auto;\n width: 58%;\n }\n }\n .countDigit {\n font-size: 19px;\n }\n }\n .countMess {\n font-size: 13px;\n }\n }\n .dmsBulkFilter {\n min-height: unset;\n gap: 4px;\n > div {\n padding: 4px 12px;\n label {\n font-size: 11px;\n }\n }\n }\n\n .StyledFilterList {\n gap: 4px;\n li {\n height: 29px;\n padding: 3px 8px;\n gap: 4px;\n .StyledFilterBtnIcon {\n width: 20px;\n height: 20px;\n svh {\n width: 10px;\n height: auto;\n }\n }\n .StyledFilterBtnLabel {\n font-size: 13px;\n }\n }\n }\n .StyledFilterLabel {\n padding-left: 10px;\n span {\n font-size: 13px;\n }\n }\n .cardcontainer.tableData {\n max-height: calc(100vh - 310px);\n min-height: calc(100vh - 310px);\n }\n\n .tableData {\n max-height: calc(100vh - 320px);\n min-height: calc(100vh - 320px);\n\n margin-top: 8px;\n thead {\n position: sticky;\n top: 0;\n z-index: 9;\n th {\n font-size: 13px;\n padding: 2px 15px;\n }\n }\n }\n }\n"])));
2629
2633
 
2630
- function LoadIcon() {
2631
- return React.createElement("svg", {
2632
- xmlns: "http://www.w3.org/2000/svg",
2633
- width: "16",
2634
- height: "16",
2635
- viewBox: "0 0 16 16",
2636
- fill: "none"
2637
- }, React.createElement("path", {
2638
- d: "M3.70123 13.9787C3.47112 13.9722 3.24467 13.9196 3.0353 13.8239C2.82594 13.7282 2.63795 13.5914 2.48248 13.4216C2.32702 13.2519 2.20726 13.0526 2.13031 12.8356C2.05336 12.6187 2.0208 12.3885 2.03456 12.1587C2.02656 10.7233 2.03456 9.28801 2.03456 7.85268C2.03456 7.76428 2.06968 7.67949 2.13219 7.61698C2.1947 7.55447 2.27949 7.51935 2.36789 7.51935C2.4563 7.51935 2.54108 7.55447 2.6036 7.61698C2.66611 7.67949 2.70123 7.76428 2.70123 7.85268C2.70123 9.31935 2.67989 10.786 2.70123 12.2527C2.71189 12.9907 3.26656 13.312 3.92656 13.312H12.2352C12.4451 13.3172 12.6514 13.2581 12.8268 13.1428C13.0022 13.0275 13.1382 12.8614 13.2166 12.6667C13.2805 12.4367 13.3031 12.1972 13.2832 11.9593V7.85268C13.2832 7.76428 13.3183 7.67949 13.3809 7.61698C13.4434 7.55447 13.5282 7.51935 13.6166 7.51935C13.705 7.51935 13.7898 7.55447 13.8523 7.61698C13.9148 7.67949 13.9499 7.76428 13.9499 7.85268C13.9499 9.33535 14.0066 10.8293 13.9499 12.3107C13.9442 12.5375 13.8934 12.761 13.8005 12.968C13.7076 13.175 13.5744 13.3615 13.4088 13.5166C13.2431 13.6717 13.0483 13.7923 12.8356 13.8714C12.6229 13.9505 12.3966 13.9865 12.1699 13.9773L3.70123 13.9787Z",
2639
- fill: "#858D9D"
2640
- }), React.createElement("path", {
2641
- d: "M7.75344 10.5453C7.80838 10.6016 7.88286 10.6345 7.96144 10.6373C7.97077 10.6373 7.97944 10.6407 7.98944 10.6413C7.99944 10.642 8.00744 10.6413 8.01677 10.6373C8.09538 10.6347 8.16991 10.6017 8.22477 10.5453L10.6708 8.09934C10.7315 8.03648 10.7651 7.95227 10.7643 7.86488C10.7636 7.77748 10.7285 7.69387 10.6667 7.63207C10.6049 7.57027 10.5213 7.53521 10.4339 7.53445C10.3465 7.53369 10.2623 7.56729 10.1994 7.62801L8.32277 9.50468V2.34334C8.32277 2.25494 8.28765 2.17015 8.22514 2.10764C8.16263 2.04513 8.07784 2.01001 7.98944 2.01001C7.90103 2.01001 7.81625 2.04513 7.75374 2.10764C7.69122 2.17015 7.6561 2.25494 7.6561 2.34334V9.50468L5.77877 7.62801C5.7159 7.56729 5.6317 7.53369 5.5443 7.53445C5.45691 7.53521 5.3733 7.57027 5.3115 7.63207C5.2497 7.69387 5.21464 7.77748 5.21388 7.86488C5.21312 7.95227 5.24672 8.03648 5.30744 8.09934L7.75344 10.5453Z",
2642
- fill: "#858D9D"
2643
- }));
2644
- }
2645
-
2646
2634
  var _templateObject$9, _templateObject2$7;
2647
2635
  var PrintDropDown = function PrintDropDown(_ref) {
2648
2636
  var legacyProductId = _ref.legacyProductId;
@@ -2999,9 +2987,7 @@ var OrderTable = function OrderTable() {
2999
2987
  ref: dropdownRef
3000
2988
  }, React.createElement(PrintDropDown, {
3001
2989
  legacyProductId: item
3002
- })))), React.createElement("li", {
3003
- className: "downloadcontainer"
3004
- }, React.createElement(LoadIcon, null)))));
2990
+ })))))));
3005
2991
  })))));
3006
2992
  };
3007
2993
  var StyledAntSelect$1 = /*#__PURE__*/styled(Select)(_templateObject$a || (_templateObject$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .ant-select-selector {\n /* width: 22vw; */\n border-radius: 22px;\n }\n .ant-select-clear {\n top: 40% !important;\n font-size: 18px !important;\n }\n"])));
@@ -4573,7 +4559,7 @@ var MainContainer$1 = /*#__PURE__*/styled.div(_templateObject$B || (_templateObj
4573
4559
 
4574
4560
  var _templateObject$C;
4575
4561
  function Carrier() {
4576
- var _orderStatus$;
4562
+ var _localStorage, _clientData$find, _orderStatus$;
4577
4563
  var _useOrderDetails = useOrderDetails(),
4578
4564
  orderDetails = _useOrderDetails[0],
4579
4565
  setOrderDetails = _useOrderDetails[1];
@@ -4581,16 +4567,36 @@ function Carrier() {
4581
4567
  subContracterData = _useSubContracterData[0];
4582
4568
  var _useStatusDetails = useStatusDetails(),
4583
4569
  orderStatus = _useStatusDetails[0];
4584
- var carrierOptions = subContracterData == null ? void 0 : subContracterData.map(function (carrier) {
4570
+ var _useClientPortal = useClientPortal(),
4571
+ isClientPortal = _useClientPortal[0];
4572
+ var _usegetClientData = usegetClientData(),
4573
+ clientData = _usegetClientData[0];
4574
+ var localClientData = JSON.parse(((_localStorage = localStorage) == null ? void 0 : _localStorage.getItem('Client_iD')) || '{}');
4575
+ var clientId = Number(localClientData == null ? void 0 : localClientData.client_id);
4576
+ // Build options from subContracterData
4577
+ var carrierOptions = (subContracterData == null ? void 0 : subContracterData.map(function (carrier) {
4585
4578
  return {
4586
- label: carrier.name,
4587
- value: carrier.id
4579
+ label: carrier == null ? void 0 : carrier.name,
4580
+ value: carrier == null ? void 0 : carrier.id
4588
4581
  };
4582
+ })) || [];
4583
+ // find the value which is selected
4584
+ var selectedCarrierOption = carrierOptions == null ? void 0 : carrierOptions.find(function (option) {
4585
+ return (option == null ? void 0 : option.value) === (orderDetails == null ? void 0 : orderDetails.carrier_id);
4589
4586
  });
4587
+ // get client name when no carrierid found
4588
+ var fallbackClientName = clientData == null || (_clientData$find = clientData.find(function (client) {
4589
+ return Number(client == null ? void 0 : client.client_id) === clientId;
4590
+ })) == null ? void 0 : _clientData$find.name;
4591
+ // fall if no carrierid
4592
+ var fallbackOption = fallbackClientName ? {
4593
+ label: fallbackClientName,
4594
+ value: ''
4595
+ } : null;
4590
4596
  var onChange = function onChange(selectedOption) {
4591
4597
  setOrderDetails(function (prev) {
4592
4598
  return _extends({}, prev, {
4593
- carrier_id: selectedOption.value
4599
+ carrier_id: selectedOption == null ? void 0 : selectedOption.value
4594
4600
  });
4595
4601
  });
4596
4602
  };
@@ -4601,12 +4607,10 @@ function Carrier() {
4601
4607
  placeholder: "Select Carrier",
4602
4608
  inputId: "CarrierDropdown",
4603
4609
  openMenuOnFocus: false,
4604
- value: carrierOptions.find(function (option) {
4605
- return option.value === (orderDetails == null ? void 0 : orderDetails.carrier_id);
4606
- }) || null,
4610
+ value: selectedCarrierOption || fallbackOption || null,
4607
4611
  options: carrierOptions,
4608
4612
  onChange: onChange,
4609
- isDisabled: (orderStatus == null ? void 0 : orderStatus.length) > 0 && ((_orderStatus$ = orderStatus[0]) == null ? void 0 : _orderStatus$.confirmed) === true
4613
+ isDisabled: isClientPortal ? true : (orderStatus == null ? void 0 : orderStatus.length) > 0 && ((_orderStatus$ = orderStatus[0]) == null ? void 0 : _orderStatus$.confirmed) === true
4610
4614
  }));
4611
4615
  }
4612
4616
  var FormContainer$1 = /*#__PURE__*/styled.div(_templateObject$C || (_templateObject$C = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n"])));
@@ -6533,7 +6537,8 @@ var NewReturnDropdown = function NewReturnDropdown() {
6533
6537
  width: 'max-content'
6534
6538
  },
6535
6539
  popupClassName: defaultPopupClassName,
6536
- status: selectedOrderId ? '' : 'error'
6540
+ status: dropdownOptions.length === 0 ? '' : selectedOrderId ? '' : 'error',
6541
+ notFoundContent: "No orders found with a similar postcode"
6537
6542
  }));
6538
6543
  };
6539
6544
  var StyledAntSelect$3 = /*#__PURE__*/styled(Select)(_templateObject$1c || (_templateObject$1c = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .ant-select-selector {\n /* width: 22vw; */\n border-radius: 22px;\n }\n .ant-select-clear {\n top: 40% !important;\n font-size: 18px !important;\n }\n"])));
@@ -13802,6 +13807,10 @@ function OrderView() {
13802
13807
  var _useAllOrderStatus = useAllOrderStatus(),
13803
13808
  setStatusVal = _useAllOrderStatus[1];
13804
13809
  var order_id = orderDetails == null ? void 0 : orderDetails.id;
13810
+ var _useAtom = useAtom(setResourcesCall),
13811
+ getResources = _useAtom[0];
13812
+ var _usegetClientData = usegetClientData(),
13813
+ setClientData = _usegetClientData[1];
13805
13814
  useEffect(function () {
13806
13815
  setStatusVal(orderDetails == null ? void 0 : orderDetails.status_value);
13807
13816
  }, [orderDetails == null ? void 0 : orderDetails.status_value]);
@@ -13934,8 +13943,24 @@ function OrderView() {
13934
13943
  }
13935
13944
  }
13936
13945
  }, [statusDataLoading, fetchedStatusData]);
13937
- var _useAtom = useAtom(setResourcesCall),
13938
- getResources = _useAtom[0];
13946
+ var _useAxios2 = useAxios({
13947
+ endpoint: "/v1/client/list",
13948
+ method: 'GET'
13949
+ }),
13950
+ callCLientApi = _useAxios2.fetchData,
13951
+ clientLoading = _useAxios2.loading,
13952
+ clientData = _useAxios2.data;
13953
+ useEffect(function () {
13954
+ if (orderId) {
13955
+ callCLientApi();
13956
+ }
13957
+ }, [orderId]);
13958
+ useEffect(function () {
13959
+ if (clientData && clientData != null && clientData.data) {
13960
+ var res = clientData == null ? void 0 : clientData.data;
13961
+ setClientData(res);
13962
+ }
13963
+ }, [clientLoading]);
13939
13964
  useEffect(function () {
13940
13965
  setLoading(depotDataLoading);
13941
13966
  if (fetchedDepotData && fetchedDepotData.data) {