@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.
@@ -29,3 +29,13 @@ export interface ApiResponse {
29
29
  error_traceback: string | null;
30
30
  data: any[];
31
31
  }
32
+ export interface ClientType {
33
+ id: number;
34
+ name: string;
35
+ client_id: number;
36
+ parent_client_id: number;
37
+ domain: string;
38
+ url: string;
39
+ master_key: string;
40
+ phoneline: string;
41
+ }
@@ -1,6 +1,6 @@
1
1
  import { useAtom } from 'jotai';
2
2
  import { CancelOrderProductsType, CreateProduct, OrdersType, UnRecieveOrderProduct, UpdateOrderProduct } from './types';
3
- import { ClientData } from '../order-daily-overview/common/interface';
3
+ import { ClientData, ClientType } from '../order-daily-overview/common/interface';
4
4
  interface OrderRecipient {
5
5
  recipient_name: string | null;
6
6
  postcode: string | null;
@@ -122,6 +122,7 @@ declare function useEventNotesData(): [any, (args_0: any) => void];
122
122
  declare function useSelectedProductId(): [number | undefined, (args_0: number | ((prev: number | undefined) => number | undefined) | undefined) => void];
123
123
  export declare function useReturnAfterOrderData(): [any[], (args_0: any[] | ((prev: any[]) => any[])) => void];
124
124
  declare function useClientData(): [ClientData[], (args_0: ClientData[] | ((prev: ClientData[]) => ClientData[])) => void];
125
+ export declare function usegetClientData(): [ClientType[], (args_0: ClientType[] | ((prev: ClientType[]) => ClientType[])) => void];
125
126
  export { useAtom, useOrderDetails, useCustomerDetails, useProductDetails, useDepotDetails, useStatusDetails, useDepotOptions, usePrevOrderDetails, useEscData, useDeleteProdsID, useCreateOrderProducts, useRecieveOrderProducts, useUpdateOrderProducts, useOrderProductsResources, useOrderProductsToolbox, useOrderProductSystemLogs, useEventNotesData, useSelectedProductId, useSelectedProductActionTabKey, useClientData, };
126
127
  export declare function usegetNotes(): [any, (args_0: any) => void];
127
128
  export declare function usemoduleIds(): [{
@@ -873,6 +873,10 @@ var clientDataAtom = /*#__PURE__*/jotai.atom([]);
873
873
  function useClientData() {
874
874
  return jotai.useAtom(clientDataAtom);
875
875
  }
876
+ var clientData = /*#__PURE__*/jotai.atom([]);
877
+ function usegetClientData() {
878
+ return jotai.useAtom(clientData);
879
+ }
876
880
  var notes = /*#__PURE__*/jotai.atom([]);
877
881
  function usegetNotes() {
878
882
  return jotai.useAtom(notes);
@@ -2635,22 +2639,6 @@ var ReturnTable = function ReturnTable() {
2635
2639
  var Container$2 = /*#__PURE__*/styled__default.div(_templateObject$8 || (_templateObject$8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n top: -46px;\n"])));
2636
2640
  var DashBoardWrapper = /*#__PURE__*/styled__default.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"])));
2637
2641
 
2638
- function LoadIcon() {
2639
- return React__default.createElement("svg", {
2640
- xmlns: "http://www.w3.org/2000/svg",
2641
- width: "16",
2642
- height: "16",
2643
- viewBox: "0 0 16 16",
2644
- fill: "none"
2645
- }, React__default.createElement("path", {
2646
- 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",
2647
- fill: "#858D9D"
2648
- }), React__default.createElement("path", {
2649
- 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",
2650
- fill: "#858D9D"
2651
- }));
2652
- }
2653
-
2654
2642
  var _templateObject$9, _templateObject2$7;
2655
2643
  var PrintDropDown = function PrintDropDown(_ref) {
2656
2644
  var legacyProductId = _ref.legacyProductId;
@@ -3007,9 +2995,7 @@ var OrderTable = function OrderTable() {
3007
2995
  ref: dropdownRef
3008
2996
  }, React__default.createElement(PrintDropDown, {
3009
2997
  legacyProductId: item
3010
- })))), React__default.createElement("li", {
3011
- className: "downloadcontainer"
3012
- }, React__default.createElement(LoadIcon, null)))));
2998
+ })))))));
3013
2999
  })))));
3014
3000
  };
3015
3001
  var StyledAntSelect$1 = /*#__PURE__*/styled__default(antd.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"])));
@@ -4581,7 +4567,7 @@ var MainContainer$1 = /*#__PURE__*/styled__default.div(_templateObject$B || (_te
4581
4567
 
4582
4568
  var _templateObject$C;
4583
4569
  function Carrier() {
4584
- var _orderStatus$;
4570
+ var _localStorage, _clientData$find, _orderStatus$;
4585
4571
  var _useOrderDetails = useOrderDetails(),
4586
4572
  orderDetails = _useOrderDetails[0],
4587
4573
  setOrderDetails = _useOrderDetails[1];
@@ -4589,16 +4575,36 @@ function Carrier() {
4589
4575
  subContracterData = _useSubContracterData[0];
4590
4576
  var _useStatusDetails = useStatusDetails(),
4591
4577
  orderStatus = _useStatusDetails[0];
4592
- var carrierOptions = subContracterData == null ? void 0 : subContracterData.map(function (carrier) {
4578
+ var _useClientPortal = useClientPortal(),
4579
+ isClientPortal = _useClientPortal[0];
4580
+ var _usegetClientData = usegetClientData(),
4581
+ clientData = _usegetClientData[0];
4582
+ var localClientData = JSON.parse(((_localStorage = localStorage) == null ? void 0 : _localStorage.getItem('Client_iD')) || '{}');
4583
+ var clientId = Number(localClientData == null ? void 0 : localClientData.client_id);
4584
+ // Build options from subContracterData
4585
+ var carrierOptions = (subContracterData == null ? void 0 : subContracterData.map(function (carrier) {
4593
4586
  return {
4594
- label: carrier.name,
4595
- value: carrier.id
4587
+ label: carrier == null ? void 0 : carrier.name,
4588
+ value: carrier == null ? void 0 : carrier.id
4596
4589
  };
4590
+ })) || [];
4591
+ // find the value which is selected
4592
+ var selectedCarrierOption = carrierOptions == null ? void 0 : carrierOptions.find(function (option) {
4593
+ return (option == null ? void 0 : option.value) === (orderDetails == null ? void 0 : orderDetails.carrier_id);
4597
4594
  });
4595
+ // get client name when no carrierid found
4596
+ var fallbackClientName = clientData == null || (_clientData$find = clientData.find(function (client) {
4597
+ return Number(client == null ? void 0 : client.client_id) === clientId;
4598
+ })) == null ? void 0 : _clientData$find.name;
4599
+ // fall if no carrierid
4600
+ var fallbackOption = fallbackClientName ? {
4601
+ label: fallbackClientName,
4602
+ value: ''
4603
+ } : null;
4598
4604
  var onChange = function onChange(selectedOption) {
4599
4605
  setOrderDetails(function (prev) {
4600
4606
  return _extends({}, prev, {
4601
- carrier_id: selectedOption.value
4607
+ carrier_id: selectedOption == null ? void 0 : selectedOption.value
4602
4608
  });
4603
4609
  });
4604
4610
  };
@@ -4609,12 +4615,10 @@ function Carrier() {
4609
4615
  placeholder: "Select Carrier",
4610
4616
  inputId: "CarrierDropdown",
4611
4617
  openMenuOnFocus: false,
4612
- value: carrierOptions.find(function (option) {
4613
- return option.value === (orderDetails == null ? void 0 : orderDetails.carrier_id);
4614
- }) || null,
4618
+ value: selectedCarrierOption || fallbackOption || null,
4615
4619
  options: carrierOptions,
4616
4620
  onChange: onChange,
4617
- isDisabled: (orderStatus == null ? void 0 : orderStatus.length) > 0 && ((_orderStatus$ = orderStatus[0]) == null ? void 0 : _orderStatus$.confirmed) === true
4621
+ isDisabled: isClientPortal ? true : (orderStatus == null ? void 0 : orderStatus.length) > 0 && ((_orderStatus$ = orderStatus[0]) == null ? void 0 : _orderStatus$.confirmed) === true
4618
4622
  }));
4619
4623
  }
4620
4624
  var FormContainer$1 = /*#__PURE__*/styled__default.div(_templateObject$C || (_templateObject$C = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n"])));
@@ -6541,7 +6545,8 @@ var NewReturnDropdown = function NewReturnDropdown() {
6541
6545
  width: 'max-content'
6542
6546
  },
6543
6547
  popupClassName: defaultPopupClassName,
6544
- status: selectedOrderId ? '' : 'error'
6548
+ status: dropdownOptions.length === 0 ? '' : selectedOrderId ? '' : 'error',
6549
+ notFoundContent: "No orders found with a similar postcode"
6545
6550
  }));
6546
6551
  };
6547
6552
  var StyledAntSelect$3 = /*#__PURE__*/styled__default(antd.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"])));
@@ -13810,6 +13815,10 @@ function OrderView() {
13810
13815
  var _useAllOrderStatus = useAllOrderStatus(),
13811
13816
  setStatusVal = _useAllOrderStatus[1];
13812
13817
  var order_id = orderDetails == null ? void 0 : orderDetails.id;
13818
+ var _useAtom = jotai.useAtom(setResourcesCall),
13819
+ getResources = _useAtom[0];
13820
+ var _usegetClientData = usegetClientData(),
13821
+ setClientData = _usegetClientData[1];
13813
13822
  React.useEffect(function () {
13814
13823
  setStatusVal(orderDetails == null ? void 0 : orderDetails.status_value);
13815
13824
  }, [orderDetails == null ? void 0 : orderDetails.status_value]);
@@ -13942,8 +13951,24 @@ function OrderView() {
13942
13951
  }
13943
13952
  }
13944
13953
  }, [statusDataLoading, fetchedStatusData]);
13945
- var _useAtom = jotai.useAtom(setResourcesCall),
13946
- getResources = _useAtom[0];
13954
+ var _useAxios2 = dmsComponentLibrary.useAxios({
13955
+ endpoint: "/v1/client/list",
13956
+ method: 'GET'
13957
+ }),
13958
+ callCLientApi = _useAxios2.fetchData,
13959
+ clientLoading = _useAxios2.loading,
13960
+ clientData = _useAxios2.data;
13961
+ React.useEffect(function () {
13962
+ if (orderId) {
13963
+ callCLientApi();
13964
+ }
13965
+ }, [orderId]);
13966
+ React.useEffect(function () {
13967
+ if (clientData && clientData != null && clientData.data) {
13968
+ var res = clientData == null ? void 0 : clientData.data;
13969
+ setClientData(res);
13970
+ }
13971
+ }, [clientLoading]);
13947
13972
  React.useEffect(function () {
13948
13973
  setLoading(depotDataLoading);
13949
13974
  if (fetchedDepotData && fetchedDepotData.data) {