@bjsdistribution/dms-client-return 0.1.77-prod → 0.1.78-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.
Files changed (68) hide show
  1. package/dist/common/utils.js +8 -7
  2. package/dist/common/utils.js.map +1 -1
  3. package/dist/components/client-portal/OutstandingTable.js +122 -116
  4. package/dist/components/client-portal/OutstandingTable.js.map +1 -1
  5. package/dist/components/fakeData.js.map +1 -1
  6. package/dist/components/order-daily-overview/common/fakedata.js.map +1 -1
  7. package/dist/components/order-daily-overview/header-filters/overViewFilter.js +7 -11
  8. package/dist/components/order-daily-overview/header-filters/overViewFilter.js.map +1 -1
  9. package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js +32 -30
  10. package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js.map +1 -1
  11. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js +58 -54
  12. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js.map +1 -1
  13. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js +157 -151
  14. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js.map +1 -1
  15. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.js.map +1 -1
  16. package/dist/components/order-view/fakedata.js.map +1 -1
  17. package/dist/components/order-view/general-information/dropdowns/Print.js +11 -11
  18. package/dist/components/order-view/general-information/dropdowns/Print.js.map +1 -1
  19. package/dist/components/order-view/index.js +154 -133
  20. package/dist/components/order-view/index.js.map +1 -1
  21. package/dist/components/order-view/order-actions/Dropdown.js +3 -3
  22. package/dist/components/order-view/order-actions/Dropdown.js.map +1 -1
  23. package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js +47 -45
  24. package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js.map +1 -1
  25. package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js +36 -23
  26. package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js.map +1 -1
  27. package/dist/components/order-view/order-actions/actions/cancel-order/index.js.map +1 -1
  28. package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js +25 -23
  29. package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js.map +1 -1
  30. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js +90 -88
  31. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js.map +1 -1
  32. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js +16 -16
  33. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js.map +1 -1
  34. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js +24 -22
  35. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js.map +1 -1
  36. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js +56 -51
  37. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js.map +1 -1
  38. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.js.map +1 -1
  39. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js +26 -24
  40. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js.map +1 -1
  41. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js +30 -29
  42. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js.map +1 -1
  43. package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js +25 -23
  44. package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js.map +1 -1
  45. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js +37 -35
  46. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js.map +1 -1
  47. package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js +20 -18
  48. package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js.map +1 -1
  49. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js +27 -22
  50. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js.map +1 -1
  51. package/dist/components/order-view/order-details/helper.js.map +1 -1
  52. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js +179 -151
  53. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js.map +1 -1
  54. package/dist/components/order-view/store.js +160 -144
  55. package/dist/components/order-view/store.js.map +1 -1
  56. package/dist/components/order-view/toolbox-resources/collapsed-content/index.js +16 -0
  57. package/dist/components/order-view/toolbox-resources/collapsed-content/index.js.map +1 -0
  58. package/dist/components/order-view/toolbox-resources/expanded-content/index.js +534 -0
  59. package/dist/components/order-view/toolbox-resources/expanded-content/index.js.map +1 -0
  60. package/dist/components/utils.js +5 -4
  61. package/dist/components/utils.js.map +1 -1
  62. package/dist/types/common/utils.d.ts +1 -0
  63. package/dist/types/components/order-view/order-actions/Dropdown.d.ts +1 -0
  64. package/dist/types/components/order-view/store.d.ts +6 -0
  65. package/dist/types/components/order-view/toolbox-resources/collapsed-content/index.d.ts +2 -0
  66. package/dist/types/components/order-view/toolbox-resources/expanded-content/index.d.ts +2 -0
  67. package/dist/types/components/utils.d.ts +1 -0
  68. package/package.json +2 -3
@@ -1,45 +1,47 @@
1
- import { jsxs as u, jsx as i } from "react/jsx-runtime";
2
- import { Label as m, SelectDropdown as f, dropdownStyles as R } from "@bjsdistribution/dms-component-library";
3
- import { useEffect as D } from "react";
4
- import b from "styled-components";
5
- import { useEscalationReason as h, useOrderStaticData as g, useEscalationCategory as S, useFailureReason as y, useIsFailureReasonChanged as C } from "../../../../store.js";
6
- function j() {
1
+ import { jsxs as m, jsx as i } from "react/jsx-runtime";
2
+ import { Label as f, SelectDropdown as R, dropdownStyles as D } from "@bjsdistribution/dms-component-library";
3
+ import { useEffect as b } from "react";
4
+ import h from "styled-components";
5
+ import { useEscalationReason as g, useOrderStaticData as C, useEscalationCategory as S, useFailureReason as v, useIsFailureReasonChanged as y } from "../../../../store.js";
6
+ import { toReverseDeliveryLabel as E } from "../../../../../../common/utils.js";
7
+ import { useClientPortal as I } from "../../../../../store.js";
8
+ function $() {
7
9
  const [
8
10
  l,
9
11
  s
10
- ] = h(), [n] = g(), [t] = S(), [p] = y(), [
12
+ ] = g(), [t] = C(), [p] = I(), [n] = S(), [c] = v(), [
11
13
  r,
12
- c
13
- ] = C(), d = t?.value, a = n?.escalation_reasons?.filter(
14
- (e) => e?.escalation_type_id === d
14
+ d
15
+ ] = y(), x = n?.value, a = t?.escalation_reasons?.filter(
16
+ (e) => e?.escalation_type_id === x
15
17
  )?.map((e) => {
16
- const o = n?.order_escalation_reasons?.find(
17
- (x) => x?.id === e?.order_reason_id
18
+ const o = t?.order_escalation_reasons?.find(
19
+ (u) => u?.id === e?.order_reason_id
18
20
  );
19
21
  if (o !== void 0)
20
22
  return {
21
- label: o?.reason,
23
+ label: p ? o?.reason : E(o?.reason),
22
24
  value: o?.id
23
25
  };
24
26
  })?.filter(
25
27
  (e) => e !== void 0
26
28
  );
27
- return D(() => {
29
+ return b(() => {
28
30
  if (r && a?.length > 0) {
29
31
  const e = a?.find(
30
- (o) => o?.label === p?.label
32
+ (o) => o?.label === c?.label
31
33
  );
32
- s(e), c(!1);
34
+ s(e), d(!1);
33
35
  }
34
36
  !r && a?.length > 0 && s(a[0]);
35
- }, [t]), /* @__PURE__ */ u(v, { children: [
36
- /* @__PURE__ */ i(m, { label: "Escalation Reason" }),
37
+ }, [n]), /* @__PURE__ */ m(_, { children: [
38
+ /* @__PURE__ */ i(f, { label: "Escalation Reason" }),
37
39
  /* @__PURE__ */ i(
38
- f,
40
+ R,
39
41
  {
40
42
  options: a || [],
41
43
  styles: {
42
- ...R,
44
+ ...D,
43
45
  control: (e, o) => ({
44
46
  ...e,
45
47
  border: "1px solid #D0D5DD",
@@ -74,13 +76,13 @@ function j() {
74
76
  )
75
77
  ] });
76
78
  }
77
- const v = b.div`
79
+ const _ = h.div`
78
80
  display: flex;
79
81
  flex-direction: column;
80
82
  gap: 8px;
81
83
  flex: 1;
82
84
  `;
83
85
  export {
84
- j as default
86
+ $ as default
85
87
  };
86
88
  //# sourceMappingURL=EscalationReason.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EscalationReason.js","sources":["../../../../../../../src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx"],"sourcesContent":["import {\n Label,\n SelectDropdown,\n dropdownStyles,\n} from '@bjsdistribution/dms-component-library';\nimport React, { useEffect } from 'react';\nimport styled from 'styled-components';\n\nimport {\n useEscalationCategory,\n useEscalationReason,\n useFailureReason,\n useIsFailureReasonChanged,\n useOrderStaticData,\n} from '../../../../store';\n\nfunction EscalationReason() {\n const [\n escalationReasonState,\n setEscalationReasonState,\n ] = useEscalationReason();\n const [orderStaticData] = useOrderStaticData();\n const [escalationCategory] = useEscalationCategory();\n const [failureReason] = useFailureReason();\n const [\n isFailureReasonChanged,\n setIsFailureReasonChanged,\n ] = useIsFailureReasonChanged();\n\n // escalationCategory.value is now escalation_type.id directly (same as orders force-debrief)\n const escalationTypeId = escalationCategory?.value;\n\n const escalationReasons = orderStaticData?.escalation_reasons?.filter(\n (x: any) => x?.escalation_type_id === escalationTypeId\n );\n\n const escalationReasonsOptions = escalationReasons?.map((item: any) => {\n const matchedItem = orderStaticData?.order_escalation_reasons?.find(\n (x: any) => x?.id === item?.order_reason_id\n );\n if (matchedItem !== undefined) {\n return {\n label: matchedItem?.reason,\n value: matchedItem?.id,\n };\n } else {\n return;\n }\n });\n const filteredEscReasonOptions = escalationReasonsOptions?.filter(\n (option: any) => option !== undefined\n );\n\n useEffect(() => {\n if (isFailureReasonChanged && filteredEscReasonOptions?.length > 0) {\n // ids of both esc reason options and failure reason not matched but their labels matched\n const reason = filteredEscReasonOptions?.find(\n (option: any) => option?.label === failureReason?.label\n );\n setEscalationReasonState(reason);\n setIsFailureReasonChanged(false);\n }\n if (!isFailureReasonChanged && filteredEscReasonOptions?.length > 0) {\n setEscalationReasonState(filteredEscReasonOptions[0]);\n }\n }, [escalationCategory]);\n\n return (\n <Container>\n <Label label=\"Escalation Reason\" />\n <SelectDropdown\n options={filteredEscReasonOptions || []}\n styles={{\n ...dropdownStyles,\n control: (styles, state) => ({\n ...styles,\n border: '1px solid #D0D5DD',\n cursor: 'pointer',\n borderRadius: `${\n state.selectProps.menuIsOpen ? '0px 0px 6px 6px' : '6px'\n }`,\n boxShadow: '0px 3px 22px #00000014',\n minHeight: '40px',\n '&:hover': {\n borderColor: '#D0D5DD',\n boxShadow: '0px 3px 22px #00000014',\n },\n }),\n menu: styles => ({\n ...styles,\n marginBottom: '0px',\n borderRadius: '6px 6px 0px 0px',\n boxShadow: '0px 3px 22px #00000014',\n border: '1px solid #D0D5DD',\n borderBottom: '0px',\n }),\n dropdownIndicator: (styles, state) => ({\n ...styles,\n transition: 'all 0.3s ease-in-out',\n transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : 'null',\n }),\n }}\n placeholder=\"Select Reason\"\n menuPlacement=\"top\"\n value={escalationReasonState}\n onChange={selectedOption => setEscalationReasonState(selectedOption)}\n />\n </Container>\n );\n}\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 8px;\n flex: 1;\n`;\n\nexport default EscalationReason;\n"],"names":["EscalationReason","escalationReasonState","setEscalationReasonState","useEscalationReason","orderStaticData","useOrderStaticData","escalationCategory","useEscalationCategory","failureReason","useFailureReason","isFailureReasonChanged","setIsFailureReasonChanged","useIsFailureReasonChanged","escalationTypeId","filteredEscReasonOptions","x","item","matchedItem","option","useEffect","reason","Container","jsx","Label","SelectDropdown","dropdownStyles","styles","state","selectedOption","styled"],"mappings":";;;;;AAgBA,SAASA,IAAmB;AAC1B,QAAM;AAAA,IACJC;AAAA,IACAC;AAAA,EAAA,IACEC,EAAA,GACE,CAACC,CAAe,IAAIC,EAAA,GACpB,CAACC,CA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,aAAa;AAAA,cACb,WAAW;AAAA,YAAA;AAAA,UACb;AAAA,UAEF,MAAM,CAAAD,OAAW;AAAA,YACf,GAAGA;AAAA,YACH,cAAc;AAAA,YACd,cAAc;AAAA,YACd,WAAW;AAAA,YACX,QAAQ;AAAA,YACR,cAAc;AAAA,UAAA;AAAA,UAEhB,mBAAmB,CAACA,GAAQC,OAAW;AAAA,YACrC,GAAGD;AAAA,YACH,YAAY;AAAA,YACZ,WAAWC,EAAM,YAAY,aAAa,mBAAmB;AAAA,UAAA;AAAA,QAC/D;AAAA,QAEF,aAAY;AAAA,QACZ,eAAc;AAAA,QACd,OAAO1B;AAAA,QACP,UAAU,CAAA2B,MAAkB1B,EAAyB0B,CAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EACrE,GACF;AAEJ;AAEA,MAAMP,IAAYQ,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"EscalationReason.js","sources":["../../../../../../../src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx"],"sourcesContent":["import {\n Label,\n SelectDropdown,\n dropdownStyles,\n} from '@bjsdistribution/dms-component-library';\nimport React, { useEffect } from 'react';\nimport styled from 'styled-components';\n\nimport {\n useEscalationCategory,\n useEscalationReason,\n useFailureReason,\n useIsFailureReasonChanged,\n useOrderStaticData,\n} from '../../../../store';\nimport { toReverseDeliveryLabel } from '../../../../../../common/utils';\nimport { useClientPortal } from '../../../../../store';\n\nfunction EscalationReason() {\n const [\n escalationReasonState,\n setEscalationReasonState,\n ] = useEscalationReason();\n const [orderStaticData] = useOrderStaticData();\n const [isClientPortal] = useClientPortal();\n const [escalationCategory] = useEscalationCategory();\n const [failureReason] = useFailureReason();\n const [\n isFailureReasonChanged,\n setIsFailureReasonChanged,\n ] = useIsFailureReasonChanged();\n\n // escalationCategory.value is now escalation_type.id directly (same as orders force-debrief)\n const escalationTypeId = escalationCategory?.value;\n\n const escalationReasons = orderStaticData?.escalation_reasons?.filter(\n (x: any) => x?.escalation_type_id === escalationTypeId\n );\n\n const escalationReasonsOptions = escalationReasons?.map((item: any) => {\n const matchedItem = orderStaticData?.order_escalation_reasons?.find(\n (x: any) => x?.id === item?.order_reason_id\n );\n if (matchedItem !== undefined) {\n return {\n label: isClientPortal\n ? matchedItem?.reason\n : toReverseDeliveryLabel(matchedItem?.reason),\n value: matchedItem?.id,\n };\n } else {\n return;\n }\n });\n const filteredEscReasonOptions = escalationReasonsOptions?.filter(\n (option: any) => option !== undefined\n );\n\n useEffect(() => {\n if (isFailureReasonChanged && filteredEscReasonOptions?.length > 0) {\n // ids of both esc reason options and failure reason not matched but their labels matched\n const reason = filteredEscReasonOptions?.find(\n (option: any) => option?.label === failureReason?.label\n );\n setEscalationReasonState(reason);\n setIsFailureReasonChanged(false);\n }\n if (!isFailureReasonChanged && filteredEscReasonOptions?.length > 0) {\n setEscalationReasonState(filteredEscReasonOptions[0]);\n }\n }, [escalationCategory]);\n\n return (\n <Container>\n <Label label=\"Escalation Reason\" />\n <SelectDropdown\n options={filteredEscReasonOptions || []}\n styles={{\n ...dropdownStyles,\n control: (styles, state) => ({\n ...styles,\n border: '1px solid #D0D5DD',\n cursor: 'pointer',\n borderRadius: `${\n state.selectProps.menuIsOpen ? '0px 0px 6px 6px' : '6px'\n }`,\n boxShadow: '0px 3px 22px #00000014',\n minHeight: '40px',\n '&:hover': {\n borderColor: '#D0D5DD',\n boxShadow: '0px 3px 22px #00000014',\n },\n }),\n menu: styles => ({\n ...styles,\n marginBottom: '0px',\n borderRadius: '6px 6px 0px 0px',\n boxShadow: '0px 3px 22px #00000014',\n border: '1px solid #D0D5DD',\n borderBottom: '0px',\n }),\n dropdownIndicator: (styles, state) => ({\n ...styles,\n transition: 'all 0.3s ease-in-out',\n transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : 'null',\n }),\n }}\n placeholder=\"Select Reason\"\n menuPlacement=\"top\"\n value={escalationReasonState}\n onChange={selectedOption => setEscalationReasonState(selectedOption)}\n />\n </Container>\n );\n}\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 8px;\n flex: 1;\n`;\n\nexport default EscalationReason;\n"],"names":["EscalationReason","escalationReasonState","setEscalationReasonState","useEscalationReason","orderStaticData","useOrderStaticData","isClientPortal","useClientPortal","escalationCategory","useEscalationCategory","failureReason","useFailureReason","isFailureReasonChanged","setIsFailureReasonChanged","useIsFailureReasonChanged","escalationTypeId","filteredEscReasonOptions","x","item","matchedItem","toReverseDeliveryLabel","option","useEffect","reason","Container","jsx","Label","SelectDropdown","dropdownStyles","styles","state","selectedOption","styled"],"mappings":";;;;;;;AAkBA,SAASA,IAAmB;AAC1B,QAAM;AAAA,IACJC;AAAA,IACAC;AAAA,EAAA,IACEC,EAAA,GACE,CAACC,CAAe,IAAIC,EAAA,GACpB,CAACC,CAAc,IAAIC,EAAA,GACnB,CAACC,CAAkB,IAAIC,EAAA,GACvB,CAACC,CAAa,IAAIC,EAAA,GAClB;AAAA,IACJC;AAAA,IACAC;AAAA,EAAA,IACEC,EAAA,GAGEC,IAAmBP,GAAoB,OAqBvCQ,IAnBoBZ,GAAiB,oBAAoB;AAAA,IAC7D,CAACa,MAAWA,GAAG,uBAAuBF;AAAA,EAAA,GAGY,IAAI,CAACG,MAAc;AACrE,UAAMC,IAAcf,GAAiB,0BAA0B;AAAA,MAC7D,CAACa,MAAWA,GAAG,OAAOC,GAAM;AAAA,IAAA;AAE9B,QAAIC,MAAgB;AAClB,aAAO;AAAA,QACL,OAAOb,IACHa,GAAa,SACbC,EAAuBD,GAAa,MAAM;AAAA,QAC9C,OAAOA,GAAa;AAAA,MAAA;AAAA,EAK1B,CAAC,GAC0D;AAAA,IACzD,CAACE,MAAgBA,MAAW;AAAA,EAAA;AAG9B,SAAAC,EAAU,MAAM;AACd,QAAIV,KAA0BI,GAA0B,SAAS,GAAG;AAElE,YAAMO,IAASP,GAA0B;AAAA,QACvC,CAACK,MAAgBA,GAAQ,UAAUX,GAAe;AAAA,MAAA;AAEp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
  import { RadioButtonGroup as n } from "@bjsdistribution/dms-component-library";
3
- import v from "styled-components";
4
- import { useOrderStaticData as x, useOrderDetails as w } from "../../../../store.js";
3
+ import u from "styled-components";
4
+ import { useOrderStaticData as L, useOrderDetails as P } from "../../../../store.js";
5
5
  import { capitalize as c } from "../../../../utils.js";
6
+ import { toReverseDeliveryLabel as _ } from "../../../../../../common/utils.js";
7
+ import { useClientPortal as A } from "../../../../../store.js";
6
8
  const q = [
7
9
  { label: "Yes", value: "true" },
8
10
  { label: "No", value: "false" }
9
11
  ];
10
- function G() {
11
- const [l] = x(), [r, s] = w(), _ = l?.order_service_levels?.map(
12
+ function z() {
13
+ const [l] = L(), [t, a] = P(), [p] = A(), y = l?.order_service_levels?.map(
12
14
  (e) => ({
13
15
  label: c(e.type.replaceAll("_", " ")),
14
16
  value: e.id.toString()
15
17
  })
16
- ), u = l?.order_delivery_point?.map(
18
+ ), g = l?.order_delivery_point?.map(
17
19
  (e) => ({
18
20
  label: c(e.type.replaceAll("_", " ")),
19
21
  value: e.id.toString()
20
22
  })
21
- ), g = l?.order_type?.map(
22
- (e) => ({
23
- label: c(e.type.replaceAll("_", " ")),
24
- value: e.id.toString()
25
- })
26
- ), p = l?.order_service_list, y = r?.order_services_detail?.order_delivery_point_id?.toString(), f = r?.order_services_detail?.order_service_level_id?.toString(), h = r?.order_type_id?.toString(), S = (e) => {
27
- const t = {
28
- ...r?.order_services_detail,
23
+ ), f = l?.order_type?.map(
24
+ (e) => {
25
+ const r = c(e.type.replaceAll("_", " "));
26
+ return {
27
+ label: p ? r : _(r),
28
+ value: e.id.toString()
29
+ };
30
+ }
31
+ ), v = l?.order_service_list, m = t?.order_services_detail?.order_delivery_point_id?.toString(), h = t?.order_services_detail?.order_service_level_id?.toString(), S = t?.order_type_id?.toString(), D = (e) => {
32
+ const r = {
33
+ ...t?.order_services_detail,
29
34
  order_delivery_point_id: +e.target.value
30
- }, o = { ...r, order_services_detail: t };
31
- s(o);
32
- }, m = (e) => {
33
- const t = {
34
- ...r?.order_services_detail,
35
- order_service_level_id: +e.target.value
36
- }, o = { ...r, order_services_detail: t };
37
- s(o);
38
- }, D = (e) => {
39
- const t = { ...r, order_type_id: +e.target.value };
40
- s(t);
35
+ }, o = { ...t, order_services_detail: r };
36
+ a(o);
41
37
  }, b = (e) => {
42
- const o = p?.find(
38
+ const r = {
39
+ ...t?.order_services_detail,
40
+ order_service_level_id: +e.target.value
41
+ }, o = { ...t, order_services_detail: r };
42
+ a(o);
43
+ }, C = (e) => {
44
+ const r = { ...t, order_type_id: +e.target.value };
45
+ a(r);
46
+ }, O = (e) => {
47
+ const o = v?.find(
43
48
  (d) => d.id === e
44
- )?.type, C = !r[o];
45
- s((d) => ({
49
+ )?.type, w = !t[o];
50
+ a((d) => ({
46
51
  ...d,
47
- [o]: C
52
+ [o]: w
48
53
  }));
49
54
  };
50
- return /* @__PURE__ */ O(A, { children: [
51
- /* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(
55
+ return /* @__PURE__ */ x(T, { children: [
56
+ /* @__PURE__ */ i(s, { children: /* @__PURE__ */ i(
52
57
  n,
53
58
  {
54
59
  heading: "Service Type",
55
- onChange: D,
56
- options: g || [],
57
- selectedValue: h || "",
60
+ onChange: C,
61
+ options: f || [],
62
+ selectedValue: S || "",
58
63
  direction: "vertical",
59
64
  required: !1,
60
65
  isDisabled: !0
61
66
  }
62
67
  ) }),
63
- /* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(
68
+ /* @__PURE__ */ i(s, { children: /* @__PURE__ */ i(
64
69
  n,
65
70
  {
66
71
  heading: "Service Level ",
67
- onChange: m,
68
- options: _ || [],
69
- selectedValue: f || "",
72
+ onChange: b,
73
+ options: y || [],
74
+ selectedValue: h || "",
70
75
  direction: "vertical",
71
76
  required: !1,
72
77
  isDisabled: !0
73
78
  }
74
79
  ) }),
75
- /* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(
80
+ /* @__PURE__ */ i(s, { children: /* @__PURE__ */ i(
76
81
  n,
77
82
  {
78
83
  heading: "Delivery Point",
79
- onChange: S,
80
- options: u || [],
81
- selectedValue: y || "",
84
+ onChange: D,
85
+ options: g || [],
86
+ selectedValue: m || "",
82
87
  direction: "vertical",
83
88
  required: !1,
84
89
  isDisabled: !0
85
90
  }
86
91
  ) }),
87
- p?.map((e) => {
88
- const t = r[e?.type];
89
- return /* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(
92
+ v?.map((e) => {
93
+ const r = t[e?.type];
94
+ return /* @__PURE__ */ i(s, { children: /* @__PURE__ */ i(
90
95
  n,
91
96
  {
92
- heading: e?.type?.replaceAll("_", " "),
93
- onChange: () => b(e?.id),
97
+ heading: p ? e?.type?.replaceAll("_", " ") : _(e?.type?.replaceAll("_", " ")),
98
+ onChange: () => O(e?.id),
94
99
  options: q || [],
95
- selectedValue: t ? "true" : "false",
100
+ selectedValue: r ? "true" : "false",
96
101
  direction: "vertical",
97
102
  required: !1,
98
103
  isDisabled: !0
@@ -101,7 +106,7 @@ function G() {
101
106
  })
102
107
  ] });
103
108
  }
104
- const A = v.div`
109
+ const T = u.div`
105
110
  display: flex;
106
111
  flex-wrap: wrap;
107
112
  gap: 16px;
@@ -109,11 +114,11 @@ const A = v.div`
109
114
  width: 100%;
110
115
  align-items: flex-start;
111
116
  pointer-events: none;
112
- `, a = v.div`
117
+ `, s = u.div`
113
118
  flex: 1;
114
119
  `;
115
120
  export {
116
- G as default,
121
+ z as default,
117
122
  q as radioButtonFilterOptions
118
123
  };
119
124
  //# sourceMappingURL=RadioButtons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButtons.js","sources":["../../../../../../../src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx"],"sourcesContent":["import { RadioButtonGroup } from '@bjsdistribution/dms-component-library';\nimport React from 'react';\nimport styled from 'styled-components';\nimport { useOrderDetails, useOrderStaticData } from '../../../../store';\nimport { OrdersType } from '../../../../types';\nimport { capitalize } from '../../../../utils';\n\nexport const radioButtonFilterOptions = [\n { label: 'Yes', value: 'true' },\n { label: 'No', value: 'false' },\n];\n\nfunction RadioButtonGroups() {\n const [orderStaticData] = useOrderStaticData();\n const [orderDetails, setOrderDetails] = useOrderDetails();\n\n const serviceLevelOptions = orderStaticData?.order_service_levels?.map(\n (x: any) => ({\n label: capitalize(x.type.replaceAll('_', ' ')),\n value: x.id.toString(),\n })\n );\n\n const deliveryPointOptions = orderStaticData?.order_delivery_point?.map(\n (x: any) => ({\n label: capitalize(x.type.replaceAll('_', ' ')),\n value: x.id.toString(),\n })\n );\n\n const serviceTypeOptions = orderStaticData?.order_type?.map(\n (option: any) => ({\n label: capitalize(option.type.replaceAll('_', ' ')),\n value: option.id.toString(),\n })\n );\n\n const orderServicesOptions = orderStaticData?.order_service_list;\n const deliveryPointId = orderDetails?.order_services_detail?.order_delivery_point_id?.toString();\n const serviceLevelId = orderDetails?.order_services_detail?.order_service_level_id?.toString();\n const orderTypeId = orderDetails?.order_type_id?.toString();\n\n // ON CHANGE HANDLERS\n const onChangeDeliveryPoint = (\n event: React.ChangeEvent<HTMLInputElement>\n ) => {\n const updatedServices = {\n ...orderDetails?.order_services_detail!,\n order_delivery_point_id: +event.target.value,\n };\n const newData = { ...orderDetails, order_services_detail: updatedServices };\n setOrderDetails(newData);\n };\n\n const onChangeServiceLevel = (event: React.ChangeEvent<HTMLInputElement>) => {\n const updatedServices = {\n ...orderDetails?.order_services_detail!,\n order_service_level_id: +event.target.value,\n };\n const newData = { ...orderDetails, order_services_detail: updatedServices };\n setOrderDetails(newData);\n };\n\n const onChangeServiceType = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newData = { ...orderDetails, order_type_id: +event.target.value };\n setOrderDetails(newData);\n };\n\n const onChangeServices = (id: number) => {\n const selectedService = orderServicesOptions?.find(\n (item: any) => item.id === id\n );\n const key = selectedService?.type;\n const value = !orderDetails[key as keyof OrdersType];\n setOrderDetails(prev => ({\n ...prev,\n [key]: value,\n }));\n };\n\n return (\n <Container>\n <Group>\n <RadioButtonGroup\n heading=\"Service Type\"\n onChange={onChangeServiceType}\n options={serviceTypeOptions || []}\n selectedValue={orderTypeId || ''}\n direction=\"vertical\"\n required={false}\n isDisabled\n />\n </Group>\n <Group>\n <RadioButtonGroup\n heading=\"Service Level \"\n onChange={onChangeServiceLevel}\n options={serviceLevelOptions || []}\n selectedValue={serviceLevelId || ''}\n direction=\"vertical\"\n required={false}\n isDisabled\n />\n </Group>\n <Group>\n <RadioButtonGroup\n heading=\"Delivery Point\"\n onChange={onChangeDeliveryPoint}\n options={deliveryPointOptions || []}\n selectedValue={deliveryPointId || ''}\n direction=\"vertical\"\n required={false}\n isDisabled\n />\n </Group>\n\n {orderServicesOptions?.map((service: any) => {\n const selected = orderDetails[service?.type as keyof OrdersType];\n return (\n <Group>\n <RadioButtonGroup\n heading={service?.type?.replaceAll('_', ' ')}\n onChange={() => onChangeServices(service?.id)}\n options={radioButtonFilterOptions || []}\n selectedValue={selected ? 'true' : 'false'}\n direction=\"vertical\"\n required={false}\n isDisabled\n />\n </Group>\n );\n })}\n </Container>\n );\n}\nconst Container = styled.div`\n display: flex;\n flex-wrap: wrap;\n gap: 16px;\n padding: 8px;\n width: 100%;\n align-items: flex-start;\n pointer-events: none;\n`;\n\nconst Group = styled.div`\n flex: 1;\n`;\n\nexport default RadioButtonGroups;\n"],"names":["radioButtonFilterOptions","RadioButtonGroups","orderStaticData","useOrderStaticData","orderDetails","setOrderDetails","useOrderDetails","serviceLevelOptions","x","capitalize","deliveryPointOptions","serviceTypeOptions","option","orderServicesOptions","deliveryPointId","serviceLevelId","orderTypeId","onChangeDeliveryPoint","event","updatedServices","newData","onChangeServiceLevel","onChangeServiceType","onChangeServices","id","key","item","value","prev","Container","jsx","Group","RadioButtonGroup","service","selected","styled"],"mappings":";;;;;AAOO,MAAMA,IAA2B;AAAA,EACtC,EAAE,OAAO,OAAO,OAAO,OAAA;AAAA,EACvB,EAAE,OAAO,MAAM,OAAO,QAAA;AACxB;AAEA,SAASC,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AA,EACC,UAAA,gBAAAD;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,SAASC,GAAS,MAAM,WAAW,KAAK,GAAG;AAAA,UAC3C,UAAU,MAAMV,EAAiBU,GAAS,EAAE;AAAA,UAC5C,SAASjC,KAA4B,CAAA;AAAA,UACrC,eAAekC,IAAW,SAAS;AAAA,UACnC,WAAU;AAAA,UACV,UAAU;AAAA,UACV,YAAU;AAAA,QAAA;AAAA,MAAA,GAEd;AAAA,IAEJ,CAAC;AAAA,EAAA,GACH;AAEJ;AACA,MAAML,IAAYM,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAUnBJ,IAAQI,EAAO;AAAA;AAAA;"}
1
+ {"version":3,"file":"RadioButtons.js","sources":["../../../../../../../src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx"],"sourcesContent":["import { RadioButtonGroup } from '@bjsdistribution/dms-component-library';\nimport React from 'react';\nimport styled from 'styled-components';\nimport { useOrderDetails, useOrderStaticData } from '../../../../store';\nimport { OrdersType } from '../../../../types';\nimport { capitalize } from '../../../../utils';\nimport { toReverseDeliveryLabel } from '../../../../../../common/utils';\nimport { useClientPortal } from '../../../../../store';\n\nexport const radioButtonFilterOptions = [\n { label: 'Yes', value: 'true' },\n { label: 'No', value: 'false' },\n];\n\nfunction RadioButtonGroups() {\n const [orderStaticData] = useOrderStaticData();\n const [orderDetails, setOrderDetails] = useOrderDetails();\n const [isClientPortal] = useClientPortal();\n\n const serviceLevelOptions = orderStaticData?.order_service_levels?.map(\n (x: any) => ({\n label: capitalize(x.type.replaceAll('_', ' ')),\n value: x.id.toString(),\n })\n );\n\n const deliveryPointOptions = orderStaticData?.order_delivery_point?.map(\n (x: any) => ({\n label: capitalize(x.type.replaceAll('_', ' ')),\n value: x.id.toString(),\n })\n );\n\n const serviceTypeOptions = orderStaticData?.order_type?.map(\n (option: any) => {\n const rawLabel = capitalize(option.type.replaceAll('_', ' '));\n return {\n label: isClientPortal ? rawLabel : toReverseDeliveryLabel(rawLabel),\n value: option.id.toString(),\n };\n }\n );\n\n const orderServicesOptions = orderStaticData?.order_service_list;\n const deliveryPointId = orderDetails?.order_services_detail?.order_delivery_point_id?.toString();\n const serviceLevelId = orderDetails?.order_services_detail?.order_service_level_id?.toString();\n const orderTypeId = orderDetails?.order_type_id?.toString();\n\n // ON CHANGE HANDLERS\n const onChangeDeliveryPoint = (\n event: React.ChangeEvent<HTMLInputElement>\n ) => {\n const updatedServices = {\n ...orderDetails?.order_services_detail!,\n order_delivery_point_id: +event.target.value,\n };\n const newData = { ...orderDetails, order_services_detail: updatedServices };\n setOrderDetails(newData);\n };\n\n const onChangeServiceLevel = (event: React.ChangeEvent<HTMLInputElement>) => {\n const updatedServices = {\n ...orderDetails?.order_services_detail!,\n order_service_level_id: +event.target.value,\n };\n const newData = { ...orderDetails, order_services_detail: updatedServices };\n setOrderDetails(newData);\n };\n\n const onChangeServiceType = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newData = { ...orderDetails, order_type_id: +event.target.value };\n setOrderDetails(newData);\n };\n\n const onChangeServices = (id: number) => {\n const selectedService = orderServicesOptions?.find(\n (item: any) => item.id === id\n );\n const key = selectedService?.type;\n const value = !orderDetails[key as keyof OrdersType];\n setOrderDetails(prev => ({\n ...prev,\n [key]: value,\n }));\n };\n\n return (\n <Container>\n <Group>\n <RadioButtonGroup\n heading=\"Service Type\"\n onChange={onChangeServiceType}\n options={serviceTypeOptions || []}\n selectedValue={orderTypeId || ''}\n direction=\"vertical\"\n required={false}\n isDisabled\n />\n </Group>\n <Group>\n <RadioButtonGroup\n heading=\"Service Level \"\n onChange={onChangeServiceLevel}\n options={serviceLevelOptions || []}\n selectedValue={serviceLevelId || ''}\n direction=\"vertical\"\n required={false}\n isDisabled\n />\n </Group>\n <Group>\n <RadioButtonGroup\n heading=\"Delivery Point\"\n onChange={onChangeDeliveryPoint}\n options={deliveryPointOptions || []}\n selectedValue={deliveryPointId || ''}\n direction=\"vertical\"\n required={false}\n isDisabled\n />\n </Group>\n\n {orderServicesOptions?.map((service: any) => {\n const selected = orderDetails[service?.type as keyof OrdersType];\n return (\n <Group>\n <RadioButtonGroup\n heading={\n isClientPortal\n ? service?.type?.replaceAll('_', ' ')\n : toReverseDeliveryLabel(service?.type?.replaceAll('_', ' '))\n }\n onChange={() => onChangeServices(service?.id)}\n options={radioButtonFilterOptions || []}\n selectedValue={selected ? 'true' : 'false'}\n direction=\"vertical\"\n required={false}\n isDisabled\n />\n </Group>\n );\n })}\n </Container>\n );\n}\nconst Container = styled.div`\n display: flex;\n flex-wrap: wrap;\n gap: 16px;\n padding: 8px;\n width: 100%;\n align-items: flex-start;\n pointer-events: none;\n`;\n\nconst Group = styled.div`\n flex: 1;\n`;\n\nexport default RadioButtonGroups;\n"],"names":["radioButtonFilterOptions","RadioButtonGroups","orderStaticData","useOrderStaticData","orderDetails","setOrderDetails","useOrderDetails","isClientPortal","useClientPortal","serviceLevelOptions","x","capitalize","deliveryPointOptions","serviceTypeOptions","option","rawLabel","toReverseDeliveryLabel","orderServicesOptions","deliveryPointId","serviceLevelId","orderTypeId","onChangeDeliveryPoint","event","updatedServices","newData","onChangeServiceLevel","onChangeServiceType","onChangeServices","id","key","item","value","prev","Container","jsx","Group","RadioButtonGroup","service","selected","styled"],"mappings":";;;;;;;AASO,MAAMA,IAA2B;AAAA,EACtC,EAAE,OAAO,OAAO,OAAO,OAAA;AAAA,EACvB,EAAE,OAAO,MAAM,OAAO,QAAA;AACxB;AAEA,SAASC,IAAoB;AAC3B,QAAM,CAACC,CAAe,IAAIC,EAAA,GACpB,CAACC,GAAcC,CAAe,IAAIC,EAAA,GAClC,CAACC,CAAc,IAAIC,EAAA,GAEnBC,IAAsBP,GAAiB,sBAAsB;AAAA,IACjE,CAACQ,OAAY;AAAA,MACX,OAAOC,EAAWD,EAAE,KAAK,WAAW,KAAK,GAAG,CAAC;AAAA,MAC7C,OAAOA,EAAE,GAAG,SAAA;AAAA,IAAS;AAAA,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,UAEhE,UAAU,MAAMV,EAAiBU,GAAS,EAAE;AAAA,UAC5C,SAASrC,KAA4B,CAAA;AAAA,UACrC,eAAesC,IAAW,SAAS;AAAA,UACnC,WAAU;AAAA,UACV,UAAU;AAAA,UACV,YAAU;AAAA,QAAA;AAAA,MAAA,GAEd;AAAA,IAEJ,CAAC;AAAA,EAAA,GACH;AAEJ;AACA,MAAML,IAAYM,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAUnBJ,IAAQI,EAAO;AAAA;AAAA;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CancellationReasonDropdown.js","sources":["../../../../../../../../src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx"],"sourcesContent":["import { Label, SelectDropdown } from '@bjsdistribution/dms-component-library';\nimport React from 'react';\nimport styled from 'styled-components';\nimport { useOrderCancelReason, useOrderStaticData } from '../../../../../store';\n\nfunction CancellationReasonDropdown() {\n const [cancelationReason, setCancelationReason] = useOrderCancelReason();\n const [orderStaticData] = useOrderStaticData();\n const cancellationReasonOptions =\n orderStaticData?.cancellation_reasons?.map((x: any) => ({\n label: x.reason,\n value: x.id,\n })) || [];\n return (\n <Container>\n <Label\n label=\"Cancellation Reason\"\n htmlFor=\"cancellationreasondropdown\"\n required\n />\n <SelectDropdown\n placeholder=\"Select Reason\"\n options={cancellationReasonOptions || []}\n inputId=\"cancellationreasondropdown\"\n openMenuOnFocus\n value={cancelationReason}\n onChange={selectedOption => setCancelationReason(selectedOption)}\n />\n </Container>\n );\n}\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n`;\n\nexport default CancellationReasonDropdown;\n"],"names":["CancellationReasonDropdown","cancelationReason","setCancelationReason","useOrderCancelReason","orderStaticData","useOrderStaticData","cancellationReasonOptions","x","Container","jsx","Label","SelectDropdown","selectedOption","styled"],"mappings":";;;;AAKA,SAASA,IAA6B;AACpC,QAAM,CAACC,GAAmBC,CAAoB,IAAIC,EAAA,GAC5C,CAACC,CAAe,IAAIC,EAAA,GACpBC,IACJF,GAAiB,sBAAsB,IAAI,CAACG,OAAY;AAAA,IACtD,OAAOA,EAAE;AAAA,IACT,OAAOA,EAAE;AAAA,EAAA,EACT,KAAK,CAAA;AACT,2BACGC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,UAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,IAEV,gBAAAD;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,aAAY;AAAA,QACZ,SAASL,KAA6B,CAAA;AAAA,QACtC,SAAQ;AAAA,QACR,iBAAe;AAAA,QACf,OAAOL;AAAA,QACP,UAAU,CAAAW,MAAkBV,EAAqBU,CAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EACjE,GACF;AAEJ;AAEA,MAAMJ,IAAYK,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"CancellationReasonDropdown.js","sources":["../../../../../../../../src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx"],"sourcesContent":["import { Label, SelectDropdown } from '@bjsdistribution/dms-component-library';\nimport React from 'react';\nimport styled from 'styled-components';\nimport {\n useOrderCancelReason,\n useOrderStaticData,\n} from '../../../../../store';\n\nfunction CancellationReasonDropdown() {\n const [cancelationReason, setCancelationReason] = useOrderCancelReason();\n const [orderStaticData] = useOrderStaticData();\n const cancellationReasonOptions =\n orderStaticData?.cancellation_reasons?.map((x: any) => ({\n label: x.reason,\n value: x.id,\n })) || [];\n return (\n <Container>\n <Label\n label=\"Cancellation Reason\"\n htmlFor=\"cancellationreasondropdown\"\n required\n />\n <SelectDropdown\n placeholder=\"Select Reason\"\n options={cancellationReasonOptions || []}\n inputId=\"cancellationreasondropdown\"\n openMenuOnFocus\n value={cancelationReason}\n onChange={selectedOption => setCancelationReason(selectedOption)}\n />\n </Container>\n );\n}\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n`;\n\nexport default CancellationReasonDropdown;\n"],"names":["CancellationReasonDropdown","cancelationReason","setCancelationReason","useOrderCancelReason","orderStaticData","useOrderStaticData","cancellationReasonOptions","x","Container","jsx","Label","SelectDropdown","selectedOption","styled"],"mappings":";;;;AAQA,SAASA,IAA6B;AACpC,QAAM,CAACC,GAAmBC,CAAoB,IAAIC,EAAA,GAC5C,CAACC,CAAe,IAAIC,EAAA,GACpBC,IACJF,GAAiB,sBAAsB,IAAI,CAACG,OAAY;AAAA,IACtD,OAAOA,EAAE;AAAA,IACT,OAAOA,EAAE;AAAA,EAAA,EACT,KAAK,CAAA;AACT,2BACGC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,UAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,IAEV,gBAAAD;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,aAAY;AAAA,QACZ,SAASL,KAA6B,CAAA;AAAA,QACtC,SAAQ;AAAA,QACR,iBAAe;AAAA,QACf,OAAOL;AAAA,QACP,UAAU,CAAAW,MAAkBV,EAAqBU,CAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EACjE,GACF;AAEJ;AAEA,MAAMJ,IAAYK,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1,65 +1,67 @@
1
- import { jsxs as b, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as C, jsx as t } from "react/jsx-runtime";
2
2
  import { Label as I, SelectDropdown as O } from "@bjsdistribution/dms-component-library";
3
3
  import x from "styled-components";
4
- import { useOrderStaticData as C, useFailureReason as S, useIsFailureReasonChanged as w } from "../../../../../store.js";
5
- function q() {
6
- const [a] = C(), [i, u] = S(), [, c] = w(), d = a?.failure_reasons, t = a?.escalation_category, s = a?.escalation_types, l = a?.fault_non_fault_reasons, p = t?.find(
4
+ import { useOrderStaticData as v, useFailureReason as D, useIsFailureReasonChanged as S } from "../../../../../store.js";
5
+ import { toReverseDeliveryLabel as w } from "../../../../../../../common/utils.js";
6
+ import { useClientPortal as N } from "../../../../../../store.js";
7
+ function A() {
8
+ const [a] = v(), [i] = N(), [u, c] = D(), [, d] = S(), p = a?.failure_reasons, n = a?.escalation_category, s = a?.escalation_types, l = a?.fault_non_fault_reasons, f = n?.find(
7
9
  (e) => e?.type === "Failure - Non Fault"
8
- )?.id, f = t?.find(
10
+ )?.id, F = n?.find(
9
11
  (e) => e?.type === "Failure - Fault"
10
- )?.id, F = s?.filter(
11
- (e) => e?.escalation_category_id === p
12
- )[0]?.id, R = s?.filter(
12
+ )?.id, m = s?.filter(
13
13
  (e) => e?.escalation_category_id === f
14
- )[0]?.id, _ = l?.filter(
15
- (e) => e?.escalation_type_id === F
16
- ), m = l?.filter(
14
+ )[0]?.id, R = s?.filter(
15
+ (e) => e?.escalation_category_id === F
16
+ )[0]?.id, y = l?.filter(
17
+ (e) => e?.escalation_type_id === m
18
+ ), _ = l?.filter(
17
19
  (e) => e?.escalation_type_id === R
18
20
  ), r = (e) => {
19
21
  const h = new Set(
20
22
  e?.map((o) => o?.order_reason_id)
21
23
  );
22
- return d?.filter((o) => h?.has(o?.id))?.map((o) => ({
24
+ return p?.filter((o) => h?.has(o?.id))?.map((o) => ({
23
25
  value: o?.reason,
24
- label: o?.title,
26
+ label: i ? o?.title : w(o?.title),
25
27
  id: o?.id
26
28
  }));
27
- }, y = r(m), g = r(_);
28
- return /* @__PURE__ */ b(D, { children: [
29
- /* @__PURE__ */ n(I, { label: "Failure Reason", htmlFor: "failurereasondropdown", required: !0 }),
30
- /* @__PURE__ */ n(
29
+ }, g = r(_), b = r(y);
30
+ return /* @__PURE__ */ C(L, { children: [
31
+ /* @__PURE__ */ t(I, { label: "Failure Reason", htmlFor: "failurereasondropdown", required: !0 }),
32
+ /* @__PURE__ */ t(
31
33
  O,
32
34
  {
33
35
  placeholder: "Select Reason",
34
36
  options: [
35
37
  {
36
38
  label: "Fault Reasons",
37
- options: y
39
+ options: g
38
40
  },
39
41
  {
40
42
  label: "Non-Fault Reasons",
41
- options: g
43
+ options: b
42
44
  }
43
45
  ] || [],
44
46
  inputId: "failurereasondropdown",
45
47
  openMenuOnFocus: !0,
46
- value: i,
48
+ value: u,
47
49
  onChange: (e) => {
48
- u(e), c(!0);
50
+ c(e), d(!0);
49
51
  },
50
- formatGroupLabel: (e) => /* @__PURE__ */ n("div", { style: { color: "rgba(0,0,0,0.8)" }, children: /* @__PURE__ */ n("span", { children: e?.label }) }),
52
+ formatGroupLabel: (e) => /* @__PURE__ */ t("div", { style: { color: "rgba(0,0,0,0.8)" }, children: /* @__PURE__ */ t("span", { children: e?.label }) }),
51
53
  isDisabled: !1
52
54
  }
53
55
  )
54
56
  ] });
55
57
  }
56
- const D = x.div`
58
+ const L = x.div`
57
59
  display: flex;
58
60
  flex-direction: column;
59
61
  gap: 6px;
60
62
  flex: 1;
61
63
  `;
62
64
  export {
63
- q as default
65
+ A as default
64
66
  };
65
67
  //# sourceMappingURL=FailureReasonDropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FailureReasonDropdown.js","sources":["../../../../../../../../src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx"],"sourcesContent":["import { Label, SelectDropdown } from '@bjsdistribution/dms-component-library';\nimport React from 'react';\nimport styled from 'styled-components';\nimport {\n useFailureReason,\n useIsFailureReasonChanged,\n useOrderStaticData,\n} from '../../../../../store';\n\nfunction FailureReasonDropdown() {\n const [orderStaticData] = useOrderStaticData();\n const [failureReasonState, setFailureReason] = useFailureReason();\n const [, setIsFailureReasonChanged] = useIsFailureReasonChanged(); // to map esc reason properly\n const failureReasons = orderStaticData?.failure_reasons;\n const escalationCategory = orderStaticData?.escalation_category;\n const escalationTypes = orderStaticData?.escalation_types;\n const faultNonFaultReasons = orderStaticData?.fault_non_fault_reasons;\n\n // Step 1: Get IDs of \"Failure-Non_Fault\" and \"Failure-Fault\"\n const failureNonFaultId = escalationCategory?.find(\n (category: any) => category?.type === 'Failure - Non Fault'\n )?.id;\n const failureFaultId = escalationCategory?.find(\n (category: any) => category?.type === 'Failure - Fault'\n )?.id;\n\n // Step 2: Map to get escalation type IDs\n\n const failureNonFaultEscTypeId = escalationTypes?.filter(\n (type: any) => type?.escalation_category_id === failureNonFaultId\n )[0]?.id;\n const failureFaultEscTypeId = escalationTypes?.filter(\n (type: any) => type?.escalation_category_id === failureFaultId\n )[0]?.id;\n\n // Step 3: Separate fault and non-fault reasons\n const nonFaultReasons = faultNonFaultReasons?.filter(\n (reason: any) => reason?.escalation_type_id === failureNonFaultEscTypeId\n );\n const faultReasons = faultNonFaultReasons?.filter(\n (reason: any) => reason?.escalation_type_id === failureFaultEscTypeId\n );\n\n // Step 4: Simplified mapping to failureReasons\n const mapReasonsToFailures = (reasons: any) => {\n const reasonIds = new Set(\n reasons?.map((reason: any) => reason?.order_reason_id)\n );\n return failureReasons\n ?.filter((failure: any) => reasonIds?.has(failure?.id))\n ?.map((failure: any) => ({\n value: failure?.reason,\n label: failure?.title,\n id: failure?.id,\n }));\n };\n\n const faultReasonOptions = mapReasonsToFailures(faultReasons);\n const nonFaultReasonOptions = mapReasonsToFailures(nonFaultReasons);\n\n const groupedOptions: any = [\n {\n label: 'Fault Reasons',\n options: faultReasonOptions,\n },\n {\n label: 'Non-Fault Reasons',\n options: nonFaultReasonOptions,\n },\n ];\n\n const onChangeOption = (option: any) => {\n setFailureReason(option);\n setIsFailureReasonChanged(true);\n };\n\n const formatGroupLabel = (data: any) => (\n <div style={{ color: 'rgba(0,0,0,0.8)' }}>\n <span>{data?.label}</span>\n {/* <span>{data?.options?.length}</span> */}\n </div>\n );\n\n return (\n <Container>\n <Label label=\"Failure Reason\" htmlFor=\"failurereasondropdown\" required />\n <SelectDropdown\n placeholder=\"Select Reason\"\n options={groupedOptions || []}\n inputId=\"failurereasondropdown\"\n openMenuOnFocus\n value={failureReasonState}\n onChange={onChangeOption}\n formatGroupLabel={formatGroupLabel}\n isDisabled={false}\n />\n </Container>\n );\n}\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n`;\n\nexport default FailureReasonDropdown;\n"],"names":["FailureReasonDropdown","orderStaticData","useOrderStaticData","failureReasonState","setFailureReason","useFailureReason","setIsFailureReasonChanged","useIsFailureReasonChanged","failureReasons","escalationCategory","escalationTypes","faultNonFaultReasons","failureNonFaultId","category","failureFaultId","failureNonFaultEscTypeId","type","failureFaultEscTypeId","nonFaultReasons","reason","faultReasons","mapReasonsToFailures","reasons","reasonIds","failure","faultReasonOptions","nonFaultReasonOptions","Container","jsx","Label","SelectDropdown","option","data","styled"],"mappings":";;;;AASA,SAASA,IAAwB;AAC/B,QAAM,CAACC,CAAe,IAAIC,EAAA,GACpB,CAACC,GAAoBC,CAAgB,IAAIC,EAAA,GACzC,CAAA,EAAGC,CAAyB,IAAIC,EAAA,GAChCC,IAAiBP,GAAiB,iBAClCQ,IAAqBR,GAAiB,qBACtCS,IAAkBT,GAAiB,kBACnCU,IAAuBV,GAAiB,yBAGxCW,IAAoBH,GAAoB;AAAA,IAC5C,CAACI,MAAkBA,GAAU,SAAS;AAAA,EAAA,GACrC,IACGC,IAAiBL,GAAoB;AAAA,IACzC,CAACI,MAAkBA,GAAU,SAAS;AAAA,EAAA,GACrC,IAIGE,IAA2BL,GAAiB;AAAA,IAChD,CAACM,MAAcA,GAAM,2BAA2BJ;AAAA,EAAA,EAChD,CAAC,GAAG,IACAK,IAAwBP,GAAiB;AAAA,IAC7C,CAACM,MAAcA,GAAM,2BAA2BF;AAAA,EAAA,EAChD,CAAC,GAAG,IAGAI,IAAkBP,GAAsB;AAAA,IAC5C,CAACQ,MAAgBA,GAAQ,uBAAuBJ;AAAA,EAAA,GAE5CK,IAAeT,GAAsB;AAAA,IACzC,CAACQ,MAAgBA,GAAQ,uBAAuBF;AAAA,EAAA,GAI5CI,IAAuB,CAACC,MAAiB;AAC7C,UAAMC,IAAY,IAAI;AAAA,MACpBD,GAAS,IAAI,CAACH,MAAgBA,GAAQ,eAAe;AAAA,IAAA;AAEvD,WAAOX,GACH,OAAO,CAACgB,MAAiBD,GAAW,IAAIC,GAAS,EAAE,CAAC,GACpD,IAAI,CAACA,OAAkB;AAAA,MACvB,OAAOA,GAAS;AAAA,MAChB,OAAOA,GAAS;AAAA,MAChB,IAAIA,GAAS;AAAA,IAAA,EACb;AAAA,EACN,GAEMC,IAAqBJ,EAAqBD,CAAY,GACtDM,IAAwBL,EAAqBH,CAAe;AAyBlE,2BACGS,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAM,OAAM,kBAAiB,SAAQ,yBAAwB,UAAQ,IAAC;AAAA,IACvE,gBAAAD;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,aAAY;AAAA,QACZ,SA5BsB;AAAA,UAC1B;AAAA,YACE,OAAO;AAAA,YACP,SAASL;AAAA,UAAA;AAAA,UAEX;AAAA,YACE,OAAO;AAAA,YACP,SAASC;AAAA,UAAA;AAAA,QACX,KAoB+B,CAAA;AAAA,QAC3B,SAAQ;AAAA,QACR,iBAAe;AAAA,QACf,OAAOvB;AAAA,QACP,UArBiB,CAAC4B,MAAgB;AACtC,UAAA3B,EAAiB2B,CAAM,GACvBzB,EAA0B,EAAI;AAAA,QAChC;AAAA,QAmBM,kBAjBmB,CAAC0B,MACxB,gBAAAJ,EAAC,SAAI,OAAO,EAAE,OAAO,kBAAA,GACnB,UAAA,gBAAAA,EAAC,QAAA,EAAM,UAAAI,GAAM,OAAM,GAErB;AAAA,QAcI,YAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EACd,GACF;AAEJ;AAEA,MAAML,IAAYM,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"FailureReasonDropdown.js","sources":["../../../../../../../../src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx"],"sourcesContent":["import { Label, SelectDropdown } from '@bjsdistribution/dms-component-library';\nimport React from 'react';\nimport styled from 'styled-components';\nimport {\n useFailureReason,\n useIsFailureReasonChanged,\n useOrderStaticData,\n} from '../../../../../store';\nimport { toReverseDeliveryLabel } from '../../../../../../../common/utils';\nimport { useClientPortal } from '../../../../../../store';\n\nfunction FailureReasonDropdown() {\n const [orderStaticData] = useOrderStaticData();\n const [isClientPortal] = useClientPortal();\n const [failureReasonState, setFailureReason] = useFailureReason();\n const [, setIsFailureReasonChanged] = useIsFailureReasonChanged(); // to map esc reason properly\n const failureReasons = orderStaticData?.failure_reasons;\n const escalationCategory = orderStaticData?.escalation_category;\n const escalationTypes = orderStaticData?.escalation_types;\n const faultNonFaultReasons = orderStaticData?.fault_non_fault_reasons;\n\n // Step 1: Get IDs of \"Failure-Non_Fault\" and \"Failure-Fault\"\n const failureNonFaultId = escalationCategory?.find(\n (category: any) => category?.type === 'Failure - Non Fault'\n )?.id;\n const failureFaultId = escalationCategory?.find(\n (category: any) => category?.type === 'Failure - Fault'\n )?.id;\n\n // Step 2: Map to get escalation type IDs\n\n const failureNonFaultEscTypeId = escalationTypes?.filter(\n (type: any) => type?.escalation_category_id === failureNonFaultId\n )[0]?.id;\n const failureFaultEscTypeId = escalationTypes?.filter(\n (type: any) => type?.escalation_category_id === failureFaultId\n )[0]?.id;\n\n // Step 3: Separate fault and non-fault reasons\n const nonFaultReasons = faultNonFaultReasons?.filter(\n (reason: any) => reason?.escalation_type_id === failureNonFaultEscTypeId\n );\n const faultReasons = faultNonFaultReasons?.filter(\n (reason: any) => reason?.escalation_type_id === failureFaultEscTypeId\n );\n\n // Step 4: Simplified mapping to failureReasons\n const mapReasonsToFailures = (reasons: any) => {\n const reasonIds = new Set(\n reasons?.map((reason: any) => reason?.order_reason_id)\n );\n return failureReasons\n ?.filter((failure: any) => reasonIds?.has(failure?.id))\n ?.map((failure: any) => ({\n value: failure?.reason,\n label: isClientPortal\n ? failure?.title\n : toReverseDeliveryLabel(failure?.title),\n id: failure?.id,\n }));\n };\n\n const faultReasonOptions = mapReasonsToFailures(faultReasons);\n const nonFaultReasonOptions = mapReasonsToFailures(nonFaultReasons);\n\n const groupedOptions: any = [\n {\n label: 'Fault Reasons',\n options: faultReasonOptions,\n },\n {\n label: 'Non-Fault Reasons',\n options: nonFaultReasonOptions,\n },\n ];\n\n const onChangeOption = (option: any) => {\n setFailureReason(option);\n setIsFailureReasonChanged(true);\n };\n\n const formatGroupLabel = (data: any) => (\n <div style={{ color: 'rgba(0,0,0,0.8)' }}>\n <span>{data?.label}</span>\n {/* <span>{data?.options?.length}</span> */}\n </div>\n );\n\n return (\n <Container>\n <Label label=\"Failure Reason\" htmlFor=\"failurereasondropdown\" required />\n <SelectDropdown\n placeholder=\"Select Reason\"\n options={groupedOptions || []}\n inputId=\"failurereasondropdown\"\n openMenuOnFocus\n value={failureReasonState}\n onChange={onChangeOption}\n formatGroupLabel={formatGroupLabel}\n isDisabled={false}\n />\n </Container>\n );\n}\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n`;\n\nexport default FailureReasonDropdown;\n"],"names":["FailureReasonDropdown","orderStaticData","useOrderStaticData","isClientPortal","useClientPortal","failureReasonState","setFailureReason","useFailureReason","setIsFailureReasonChanged","useIsFailureReasonChanged","failureReasons","escalationCategory","escalationTypes","faultNonFaultReasons","failureNonFaultId","category","failureFaultId","failureNonFaultEscTypeId","type","failureFaultEscTypeId","nonFaultReasons","reason","faultReasons","mapReasonsToFailures","reasons","reasonIds","failure","toReverseDeliveryLabel","faultReasonOptions","nonFaultReasonOptions","Container","jsx","Label","SelectDropdown","option","data","styled"],"mappings":";;;;;;AAWA,SAASA,IAAwB;AAC/B,QAAM,CAACC,CAAe,IAAIC,EAAA,GACpB,CAACC,CAAc,IAAIC,EAAA,GACnB,CAACC,GAAoBC,CAAgB,IAAIC,EAAA,GACzC,CAAA,EA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5BsB;AAAA,UAC1B;AAAA,YACE,OAAO;AAAA,YACP,SAASL;AAAA,UAAA;AAAA,UAEX;AAAA,YACE,OAAO;AAAA,YACP,SAASC;AAAA,UAAA;AAAA,QACX,KAoB+B,CAAA;AAAA,QAC3B,SAAQ;AAAA,QACR,iBAAe;AAAA,QACf,OAAOxB;AAAA,QACP,UArBiB,CAAC6B,MAAgB;AACtC,UAAA5B,EAAiB4B,CAAM,GACvB1B,EAA0B,EAAI;AAAA,QAChC;AAAA,QAmBM,kBAjBmB,CAAC2B,MACxB,gBAAAJ,EAAC,SAAI,OAAO,EAAE,OAAO,kBAAA,GACnB,UAAA,gBAAAA,EAAC,QAAA,EAAM,UAAAI,GAAM,OAAM,GAErB;AAAA,QAcI,YAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EACd,GACF;AAEJ;AAEA,MAAML,IAAYM,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1,42 +1,43 @@
1
1
  import { jsx as o, jsxs as i } from "react/jsx-runtime";
2
- import { useState as f, useEffect as T } from "react";
3
- import { useAxios as Y, Label as h, AntSelect as _ } from "@bjsdistribution/dms-component-library";
4
- import { useOrderId as x, useCurrentAction as y, useOrderStaticData as I, useCustomerInfo as R } from "../../../store.js";
2
+ import { useState as h, useEffect as y } from "react";
3
+ import { useAxios as T, Label as p, AntSelect as Y } from "@bjsdistribution/dms-component-library";
4
+ import { useOrderId as _, useCurrentAction as x, useOrderStaticData as R, useCustomerInfo as I } from "../../../store.js";
5
5
  import P from "../../../../../common/modals/order-action-modal/OrderActionModal.js";
6
- import { HoldContentContainer as k, SplitText as j, HoldRow as p, HoldDatePickerWrap as B } from "../modalstyle.js";
7
- import { notification as d, DatePicker as U } from "antd";
8
- import S from "dayjs";
9
- import { useClientPortal as W } from "../../../../store.js";
10
- function X(n) {
11
- const [a] = x(), [, l] = y(), [H] = I(), [t, c] = f(null), [s, C] = f(void 0), [m] = R(), [D] = W(), b = `${m?.recipient_name}, ${m?.postcode}`, w = H?.onhold_reasons?.map(
6
+ import { HoldContentContainer as k, SplitText as j, HoldRow as S, HoldDatePickerWrap as B } from "../modalstyle.js";
7
+ import { notification as d, DatePicker as L } from "antd";
8
+ import D from "dayjs";
9
+ import { useClientPortal as U } from "../../../../store.js";
10
+ import { toReverseDeliveryLabel as W } from "../../../../../common/utils.js";
11
+ function ee(n) {
12
+ const [a] = _(), [, l] = x(), [H] = R(), [t, c] = h(null), [s, C] = h(void 0), [m] = I(), [u] = U(), b = `${m?.recipient_name}, ${m?.postcode}`, v = H?.onhold_reasons?.map(
12
13
  (e) => ({
13
- label: e?.reason,
14
+ label: u ? e?.reason : W(e?.reason),
14
15
  value: e?.reason
15
16
  })
16
- ), g = t ? `orders/${a}/hold/?hold_reason=${s}&hold_until=${t}` : `orders/${a}/hold/?hold_reason=${s}
17
- `, { fetchData: v, error: r } = Y({
18
- endpoint: g,
17
+ ), w = t ? `orders/${a}/hold/?hold_reason=${s}&hold_until=${t}` : `orders/${a}/hold/?hold_reason=${s}
18
+ `, { fetchData: g, error: r } = T({
19
+ endpoint: w,
19
20
  method: "POST"
20
21
  }), A = () => {
21
22
  l(void 0);
22
23
  }, O = (e) => {
23
24
  C(e);
24
- }, $ = (e, L) => {
25
- const u = e?.format("YYYY-MM-DDTHH:mm:ss");
26
- c(u !== void 0 ? u : null);
25
+ }, $ = (e, q) => {
26
+ const f = e?.format("YYYY-MM-DDTHH:mm:ss");
27
+ c(f !== void 0 ? f : null);
27
28
  }, M = async () => {
28
29
  if (a) {
29
- const e = await v();
30
+ const e = await g();
30
31
  e?.code === 200 && (d.success({
31
32
  message: "Success",
32
33
  description: `${e.message}`
33
- }), D && await n?.callUnresolvedTaskApi(), await n?.callOrderAlertsApi(), await n?.callOrderStatusApi(), await n?.callOrdersApi()), e?.code !== 200 && (d.error({
34
+ }), u && await n?.callUnresolvedTaskApi(), await n?.callOrderAlertsApi(), await n?.callOrderStatusApi(), await n?.callOrdersApi()), e?.code !== 200 && (d.error({
34
35
  message: "Error",
35
36
  description: `${e.error}`
36
37
  }), l(void 0));
37
38
  }
38
39
  };
39
- return T(() => {
40
+ return y(() => {
40
41
  r !== null && r?.code !== 200 && (console.log("entered"), d.error({
41
42
  //@ts-ignore
42
43
  message: `${r?.error}`,
@@ -57,25 +58,25 @@ function X(n) {
57
58
  submitBtnTitle: "Save Details",
58
59
  isSubmitDisabled: !(s !== void 0),
59
60
  children: /* @__PURE__ */ o(k, { children: /* @__PURE__ */ i(j, { children: [
60
- /* @__PURE__ */ i(p, { children: [
61
- /* @__PURE__ */ o(h, { label: "Hold Until (leave blank for indefinite)" }),
61
+ /* @__PURE__ */ i(S, { children: [
62
+ /* @__PURE__ */ o(p, { label: "Hold Until (leave blank for indefinite)" }),
62
63
  /* @__PURE__ */ o(B, { children: /* @__PURE__ */ o(
63
- U,
64
+ L,
64
65
  {
65
66
  needConfirm: !0,
66
67
  format: "MMMM D, YYYY",
67
68
  onChange: $,
68
- value: t === null ? t : S(t),
69
- disabledDate: (e) => e && e < S().startOf("day")
69
+ value: t === null ? t : D(t),
70
+ disabledDate: (e) => e && e < D().startOf("day")
70
71
  }
71
72
  ) })
72
73
  ] }),
73
- /* @__PURE__ */ i(p, { children: [
74
- /* @__PURE__ */ o(h, { label: "Hold Reason", required: !0 }),
74
+ /* @__PURE__ */ i(S, { children: [
75
+ /* @__PURE__ */ o(p, { label: "Hold Reason", required: !0 }),
75
76
  /* @__PURE__ */ o(
76
- _,
77
+ Y,
77
78
  {
78
- options: w || [],
79
+ options: v || [],
79
80
  placeholder: "Select Hold Reason",
80
81
  onChange: O,
81
82
  disabled: !1,
@@ -92,6 +93,6 @@ function X(n) {
92
93
  );
93
94
  }
94
95
  export {
95
- X as default
96
+ ee as default
96
97
  };
97
98
  //# sourceMappingURL=HoldOrderModal.js.map