@bjsdistribution/dms-client-return 0.2.2-prod → 0.2.3-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 (151) hide show
  1. package/dist/common/expand-collapse/index.js +44 -26
  2. package/dist/common/expand-collapse/index.js.map +1 -1
  3. package/dist/common/modals/order-action-modal/OrderActionModal.js.map +1 -1
  4. package/dist/common/modals/order-action-modal/footer/OrderActionFooter.js.map +1 -1
  5. package/dist/components/client-portal/ClientPortalResponsive.js +148 -0
  6. package/dist/components/client-portal/ClientPortalResponsive.js.map +1 -0
  7. package/dist/components/client-portal/OutstandingTable.js +112 -118
  8. package/dist/components/client-portal/OutstandingTable.js.map +1 -1
  9. package/dist/components/client-portal/ReturnOverview.js +38 -37
  10. package/dist/components/client-portal/ReturnOverview.js.map +1 -1
  11. package/dist/components/client-portal/return-confirm/ConfirmedMain.js +4 -4
  12. package/dist/components/client-portal/return-confirm/ConfirmedMain.js.map +1 -1
  13. package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.js +445 -185
  14. package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.js.map +1 -1
  15. package/dist/components/fakeData.js.map +1 -1
  16. package/dist/components/order-daily-overview/common/fakedata.js.map +1 -1
  17. package/dist/components/order-daily-overview/common/mediaQuery.js +17 -0
  18. package/dist/components/order-daily-overview/common/mediaQuery.js.map +1 -0
  19. package/dist/components/order-daily-overview/filters/FilterStyle.js +174 -11
  20. package/dist/components/order-daily-overview/filters/FilterStyle.js.map +1 -1
  21. package/dist/components/order-daily-overview/header/route-header/RouterHeaderStyle.js +9 -4
  22. package/dist/components/order-daily-overview/header/route-header/RouterHeaderStyle.js.map +1 -1
  23. package/dist/components/order-daily-overview/header/route-header/title/HeaderTitle.js +11 -1
  24. package/dist/components/order-daily-overview/header/route-header/title/HeaderTitle.js.map +1 -1
  25. package/dist/components/order-daily-overview/header-filters/Styledfilters.js +46 -17
  26. package/dist/components/order-daily-overview/header-filters/Styledfilters.js.map +1 -1
  27. package/dist/components/order-daily-overview/index.js +76 -53
  28. package/dist/components/order-daily-overview/index.js.map +1 -1
  29. package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js +101 -103
  30. package/dist/components/order-daily-overview/return-after-table/table/OrderTable.js.map +1 -1
  31. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js +135 -134
  32. package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.js.map +1 -1
  33. package/dist/components/order-daily-overview/return-after-table/table-filters/TableFilters.js +17 -11
  34. package/dist/components/order-daily-overview/return-after-table/table-filters/TableFilters.js.map +1 -1
  35. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.js +5 -5
  36. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.js.map +1 -1
  37. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js +129 -135
  38. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.js.map +1 -1
  39. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.js +346 -27
  40. package/dist/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.js.map +1 -1
  41. package/dist/components/order-daily-overview/table/ReturnTable.js +199 -183
  42. package/dist/components/order-daily-overview/table/ReturnTable.js.map +1 -1
  43. package/dist/components/order-daily-overview/table/table-data/styles.js +159 -38
  44. package/dist/components/order-daily-overview/table/table-data/styles.js.map +1 -1
  45. package/dist/components/order-daily-overview/table-view/PaginationStyle.js +21 -6
  46. package/dist/components/order-daily-overview/table-view/PaginationStyle.js.map +1 -1
  47. package/dist/components/order-view/DynamicTable.js +136 -35
  48. package/dist/components/order-view/DynamicTable.js.map +1 -1
  49. package/dist/components/order-view/details-filters/DetailsFilters.js +33 -8
  50. package/dist/components/order-view/details-filters/DetailsFilters.js.map +1 -1
  51. package/dist/components/order-view/details-filters/left-side-filters/ActionsMenu.js +23 -5
  52. package/dist/components/order-view/details-filters/left-side-filters/ActionsMenu.js.map +1 -1
  53. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.js +39 -22
  54. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.js.map +1 -1
  55. package/dist/components/order-view/details-filters/right-side-filters/Details.js +25 -12
  56. package/dist/components/order-view/details-filters/right-side-filters/Details.js.map +1 -1
  57. package/dist/components/order-view/general-information/Status.js +58 -28
  58. package/dist/components/order-view/general-information/Status.js.map +1 -1
  59. package/dist/components/order-view/generic-table/AuditLogs.js +129 -24
  60. package/dist/components/order-view/generic-table/AuditLogs.js.map +1 -1
  61. package/dist/components/order-view/notes/logs/index.js +15 -7
  62. package/dist/components/order-view/notes/logs/index.js.map +1 -1
  63. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.js +7 -7
  64. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.js.map +1 -1
  65. package/dist/components/order-view/notification/index.js +68 -55
  66. package/dist/components/order-view/notification/index.js.map +1 -1
  67. package/dist/components/order-view/order-actions/Dropdown.js +3 -3
  68. package/dist/components/order-view/order-actions/Dropdown.js.map +1 -1
  69. package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js +45 -47
  70. package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.js.map +1 -1
  71. package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js +23 -36
  72. package/dist/components/order-view/order-actions/actions/cancel-order/ReturnReason.js.map +1 -1
  73. package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js +23 -25
  74. package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.js.map +1 -1
  75. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js +88 -89
  76. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.js.map +1 -1
  77. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js +16 -16
  78. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.js.map +1 -1
  79. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js +22 -23
  80. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.js.map +1 -1
  81. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js +52 -56
  82. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.js.map +1 -1
  83. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js +26 -27
  84. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.js.map +1 -1
  85. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js +29 -29
  86. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.js.map +1 -1
  87. package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js +54 -222
  88. package/dist/components/order-view/order-actions/actions/split-order/SplitOrderTable.js.map +1 -1
  89. package/dist/components/order-view/order-actions/actions/split-order/index.js +37 -50
  90. package/dist/components/order-view/order-actions/actions/split-order/index.js.map +1 -1
  91. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js +35 -37
  92. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.js.map +1 -1
  93. package/dist/components/order-view/order-actions/actions/what3words/What3WordsModal.tsx.js +85 -85
  94. package/dist/components/order-view/order-actions/actions/what3words/What3WordsModal.tsx.js.map +1 -1
  95. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.js +12 -8
  96. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.js.map +1 -1
  97. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.js +22 -18
  98. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.js.map +1 -1
  99. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/index.js +14 -8
  100. package/dist/components/order-view/order-details/expanded-content/customer-section/contact-info/index.js.map +1 -1
  101. package/dist/components/order-view/order-details/expanded-content/customer-section/index.js +19 -13
  102. package/dist/components/order-view/order-details/expanded-content/customer-section/index.js.map +1 -1
  103. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Address.js +11 -6
  104. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Address.js.map +1 -1
  105. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Latitude.js +23 -21
  106. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Latitude.js.map +1 -1
  107. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Longitude.js +23 -21
  108. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/Longitude.js.map +1 -1
  109. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/index.js +39 -21
  110. package/dist/components/order-view/order-details/expanded-content/customer-section/location-info/index.js.map +1 -1
  111. package/dist/components/order-view/order-details/expanded-content/footer/index.js +28 -14
  112. package/dist/components/order-view/order-details/expanded-content/footer/index.js.map +1 -1
  113. package/dist/components/order-view/order-details/expanded-content/orders-section/index.js +44 -28
  114. package/dist/components/order-view/order-details/expanded-content/orders-section/index.js.map +1 -1
  115. package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js +28 -20
  116. package/dist/components/order-view/order-details/expanded-content/services-section/OrderServices.js.map +1 -1
  117. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceLevel.js +17 -18
  118. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceLevel.js.map +1 -1
  119. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js +22 -26
  120. package/dist/components/order-view/order-details/expanded-content/services-section/ServiceType.js.map +1 -1
  121. package/dist/components/order-view/order-details/expanded-content/services-section/index.js +79 -25
  122. package/dist/components/order-view/order-details/expanded-content/services-section/index.js.map +1 -1
  123. package/dist/components/order-view/order-details/helper.js.map +1 -1
  124. package/dist/components/order-view/products-info/collapsed-content/index.js +21 -15
  125. package/dist/components/order-view/products-info/collapsed-content/index.js.map +1 -1
  126. package/dist/components/order-view/products-info/index.js +36 -36
  127. package/dist/components/order-view/products-info/index.js.map +1 -1
  128. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js +265 -334
  129. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.js.map +1 -1
  130. package/dist/components/order-view/store.js +155 -162
  131. package/dist/components/order-view/store.js.map +1 -1
  132. package/dist/components/order-view/toolbox-resources/expanded-content/index.js +281 -173
  133. package/dist/components/order-view/toolbox-resources/expanded-content/index.js.map +1 -1
  134. package/dist/components/utils.js +5 -4
  135. package/dist/components/utils.js.map +1 -1
  136. package/dist/types/common/modals/order-action-modal/OrderActionModal.d.ts +1 -2
  137. package/dist/types/common/modals/order-action-modal/footer/OrderActionFooter.d.ts +1 -1
  138. package/dist/types/components/client-portal/ClientPortalResponsive.d.ts +15 -0
  139. package/dist/types/components/order-daily-overview/common/mediaQuery.d.ts +4 -0
  140. package/dist/types/components/order-daily-overview/filters/FilterStyle.d.ts +1 -0
  141. package/dist/types/components/order-view/order-actions/Dropdown.d.ts +0 -1
  142. package/dist/types/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +1 -0
  143. package/dist/types/components/order-view/store.d.ts +0 -1
  144. package/dist/types/components/order-view/types.d.ts +1 -1
  145. package/dist/types/components/utils.d.ts +1 -0
  146. package/package.json +2 -2
  147. package/dist/assets/icons/ChevronDownIcon.js +0 -26
  148. package/dist/assets/icons/ChevronDownIcon.js.map +0 -1
  149. package/dist/components/order-view/return-client-products/product-table/palletGrouping.js +0 -47
  150. package/dist/components/order-view/return-client-products/product-table/palletGrouping.js.map +0 -1
  151. package/dist/types/components/order-view/return-client-products/product-table/palletGrouping.d.ts +0 -23
@@ -1,46 +1,45 @@
1
- import { jsxs as m, jsx as i } from "react/jsx-runtime";
2
- import { toReverseDeliveryLabel as f, Label as R, SelectDropdown as D, dropdownStyles as b } from "@bjsdistribution/dms-component-library";
3
- import { useEffect as h } from "react";
4
- import g from "styled-components";
5
- import { useEscalationReason as C, useOrderStaticData as S, useEscalationCategory as v, useFailureReason as y, useIsFailureReasonChanged as E } from "../../../../store.js";
6
- import { useClientPortal as I } from "../../../../../store.js";
7
- function T() {
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() {
8
7
  const [
9
8
  l,
10
9
  s
11
- ] = C(), [t] = S(), [p] = I(), [n] = v(), [c] = y(), [
10
+ ] = h(), [n] = g(), [t] = S(), [p] = y(), [
12
11
  r,
13
- d
14
- ] = E(), x = n?.value, a = t?.escalation_reasons?.filter(
15
- (e) => e?.escalation_type_id === x
12
+ c
13
+ ] = C(), d = t?.value, a = n?.escalation_reasons?.filter(
14
+ (e) => e?.escalation_type_id === d
16
15
  )?.map((e) => {
17
- const o = t?.order_escalation_reasons?.find(
18
- (u) => u?.id === e?.order_reason_id
16
+ const o = n?.order_escalation_reasons?.find(
17
+ (x) => x?.id === e?.order_reason_id
19
18
  );
20
19
  if (o !== void 0)
21
20
  return {
22
- label: p ? o?.reason : f(o?.reason),
21
+ label: o?.reason,
23
22
  value: o?.id
24
23
  };
25
24
  })?.filter(
26
25
  (e) => e !== void 0
27
26
  );
28
- return h(() => {
27
+ return D(() => {
29
28
  if (r && a?.length > 0) {
30
29
  const e = a?.find(
31
- (o) => o?.label === c?.label
30
+ (o) => o?.label === p?.label
32
31
  );
33
- s(e), d(!1);
32
+ s(e), c(!1);
34
33
  }
35
34
  !r && a?.length > 0 && s(a[0]);
36
- }, [n]), /* @__PURE__ */ m(_, { children: [
37
- /* @__PURE__ */ i(R, { label: "Escalation Reason" }),
35
+ }, [t]), /* @__PURE__ */ u(v, { children: [
36
+ /* @__PURE__ */ i(m, { label: "Escalation Reason" }),
38
37
  /* @__PURE__ */ i(
39
- D,
38
+ f,
40
39
  {
41
40
  options: a || [],
42
41
  styles: {
43
- ...b,
42
+ ...R,
44
43
  control: (e, o) => ({
45
44
  ...e,
46
45
  border: "1px solid #D0D5DD",
@@ -75,13 +74,13 @@ function T() {
75
74
  )
76
75
  ] });
77
76
  }
78
- const _ = g.div`
77
+ const v = b.div`
79
78
  display: flex;
80
79
  flex-direction: column;
81
80
  gap: 8px;
82
81
  flex: 1;
83
82
  `;
84
83
  export {
85
- T as default
84
+ j as default
86
85
  };
87
86
  //# 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 toReverseDeliveryLabel,\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 { 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;AAEpD,MAAAR,EAAyBqB,CAAM,GAC/BV,EAA0B,EAAK;AAAA,IACjC;AACA,IAAI,CAACD,KAA0BI,GAA0B,SAAS,KAChEd,EAAyBc,EAAyB,CAAC,CAAC;AAAA,EAExD,GAAG,CAACR,CAAkB,CAAC,qBAGpBgB,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAM,OAAM,oBAAA,CAAoB;AAAA,IACjC,gBAAAD;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,SAASX,KAA4B,CAAA;AAAA,QACrC,QAAQ;AAAA,UACN,GAAGY;AAAA,UACH,SAAS,CAACC,GAAQC,OAAW;AAAA,YAC3B,GAAGD;AAAA,YACH,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR,cAAc,GACZC,EAAM,YAAY,aAAa,oBAAoB,KACrD;AAAA,YACA,WAAW;AAAA,YACX,WAAW;AAAA,YACX,WAAW;AAAA,cACT,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,OAAO7B;AAAA,QACP,UAAU,CAAA8B,MAAkB7B,EAAyB6B,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';\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,CAAkB,IAAIC,EAAA,GACvB,CAACC,CAAa,IAAIC,EAAA,GAClB;AAAA,IACJC;AAAA,IACAC;AAAA,EAAA,IACEC,EAAA,GAGEC,IAAmBP,GAAoB,OAmBvCQ,IAjBoBV,GAAiB,oBAAoB;AAAA,IAC7D,CAACW,MAAWA,GAAG,uBAAuBF;AAAA,EAAA,GAGY,IAAI,CAACG,MAAc;AACrE,UAAMC,IAAcb,GAAiB,0BAA0B;AAAA,MAC7D,CAAC,MAAW,GAAG,OAAOY,GAAM;AAAA,IAAA;AAE9B,QAAIC,MAAgB;AAClB,aAAO;AAAA,QACL,OAAOA,GAAa;AAAA,QACpB,OAAOA,GAAa;AAAA,MAAA;AAAA,EAK1B,CAAC,GAC0D;AAAA,IACzD,CAACC,MAAgBA,MAAW;AAAA,EAAA;AAG9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AMP,IAAYQ,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1,102 +1,98 @@
1
- import { jsxs as x, jsx as i } from "react/jsx-runtime";
2
- import { toReverseDeliveryLabel as _, RadioButtonGroup as n } from "@bjsdistribution/dms-component-library";
3
- import u from "styled-components";
4
- import { useOrderStaticData as L, useOrderDetails as P } from "../../../../store.js";
1
+ import { jsxs as O, jsx as i } from "react/jsx-runtime";
2
+ 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";
5
5
  import { capitalize as c } from "../../../../utils.js";
6
- import { useClientPortal as A } from "../../../../../store.js";
7
6
  const q = [
8
7
  { label: "Yes", value: "true" },
9
8
  { label: "No", value: "false" }
10
9
  ];
11
- function k() {
12
- const [l] = L(), [t, a] = P(), [p] = A(), y = l?.order_service_levels?.map(
10
+ function G() {
11
+ const [l] = x(), [r, s] = w(), _ = l?.order_service_levels?.map(
13
12
  (e) => ({
14
13
  label: c(e.type.replaceAll("_", " ")),
15
14
  value: e.id.toString()
16
15
  })
17
- ), g = l?.order_delivery_point?.map(
16
+ ), u = l?.order_delivery_point?.map(
18
17
  (e) => ({
19
18
  label: c(e.type.replaceAll("_", " ")),
20
19
  value: e.id.toString()
21
20
  })
22
- ), f = l?.order_type?.map(
23
- (e) => {
24
- const r = c(e.type.replaceAll("_", " "));
25
- return {
26
- label: p ? r : _(r),
27
- value: e.id.toString()
28
- };
29
- }
30
- ), v = l?.order_service_list, h = t?.order_services_detail?.order_delivery_point_id?.toString(), S = t?.order_services_detail?.order_service_level_id?.toString(), m = t?.order_type_id?.toString(), D = (e) => {
31
- const r = {
32
- ...t?.order_services_detail,
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,
33
29
  order_delivery_point_id: +e.target.value
34
- }, o = { ...t, order_services_detail: r };
35
- a(o);
36
- }, b = (e) => {
37
- const r = {
38
- ...t?.order_services_detail,
30
+ }, o = { ...r, order_services_detail: t };
31
+ s(o);
32
+ }, m = (e) => {
33
+ const t = {
34
+ ...r?.order_services_detail,
39
35
  order_service_level_id: +e.target.value
40
- }, o = { ...t, order_services_detail: r };
41
- a(o);
42
- }, C = (e) => {
43
- const r = { ...t, order_type_id: +e.target.value };
44
- a(r);
45
- }, O = (e) => {
46
- const o = v?.find(
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);
41
+ }, b = (e) => {
42
+ const o = p?.find(
47
43
  (d) => d.id === e
48
- )?.type, w = !t[o];
49
- a((d) => ({
44
+ )?.type, C = !r[o];
45
+ s((d) => ({
50
46
  ...d,
51
- [o]: w
47
+ [o]: C
52
48
  }));
53
49
  };
54
- return /* @__PURE__ */ x(T, { children: [
55
- /* @__PURE__ */ i(s, { children: /* @__PURE__ */ i(
50
+ return /* @__PURE__ */ O(A, { children: [
51
+ /* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(
56
52
  n,
57
53
  {
58
54
  heading: "Service Type",
59
- onChange: C,
60
- options: f || [],
61
- selectedValue: m || "",
55
+ onChange: D,
56
+ options: g || [],
57
+ selectedValue: h || "",
62
58
  direction: "vertical",
63
59
  required: !1,
64
60
  isDisabled: !0
65
61
  }
66
62
  ) }),
67
- /* @__PURE__ */ i(s, { children: /* @__PURE__ */ i(
63
+ /* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(
68
64
  n,
69
65
  {
70
66
  heading: "Service Level ",
71
- onChange: b,
72
- options: y || [],
73
- selectedValue: S || "",
67
+ onChange: m,
68
+ options: _ || [],
69
+ selectedValue: f || "",
74
70
  direction: "vertical",
75
71
  required: !1,
76
72
  isDisabled: !0
77
73
  }
78
74
  ) }),
79
- /* @__PURE__ */ i(s, { children: /* @__PURE__ */ i(
75
+ /* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(
80
76
  n,
81
77
  {
82
78
  heading: "Delivery Point",
83
- onChange: D,
84
- options: g || [],
85
- selectedValue: h || "",
79
+ onChange: S,
80
+ options: u || [],
81
+ selectedValue: y || "",
86
82
  direction: "vertical",
87
83
  required: !1,
88
84
  isDisabled: !0
89
85
  }
90
86
  ) }),
91
- v?.map((e) => {
92
- const r = t[e?.type];
93
- return /* @__PURE__ */ i(s, { children: /* @__PURE__ */ i(
87
+ p?.map((e) => {
88
+ const t = r[e?.type];
89
+ return /* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(
94
90
  n,
95
91
  {
96
- heading: p ? e?.type?.replaceAll("_", " ") : _(e?.type?.replaceAll("_", " ")),
97
- onChange: () => O(e?.id),
92
+ heading: e?.type?.replaceAll("_", " "),
93
+ onChange: () => b(e?.id),
98
94
  options: q || [],
99
- selectedValue: r ? "true" : "false",
95
+ selectedValue: t ? "true" : "false",
100
96
  direction: "vertical",
101
97
  required: !1,
102
98
  isDisabled: !0
@@ -105,7 +101,7 @@ function k() {
105
101
  })
106
102
  ] });
107
103
  }
108
- const T = u.div`
104
+ const A = v.div`
109
105
  display: flex;
110
106
  flex-wrap: wrap;
111
107
  gap: 16px;
@@ -113,11 +109,11 @@ const T = u.div`
113
109
  width: 100%;
114
110
  align-items: flex-start;
115
111
  pointer-events: none;
116
- `, s = u.div`
112
+ `, a = v.div`
117
113
  flex: 1;
118
114
  `;
119
115
  export {
120
- k as default,
116
+ G as default,
121
117
  q as radioButtonFilterOptions
122
118
  };
123
119
  //# 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, toReverseDeliveryLabel } 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 { 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":";;;;;;AAQO,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,EACvB,GAGIE,IAAuBV,GAAiB,sBAAsB;AAAA,IAClE,CAACQ,OAAY;AAAA,MACX,OAAOC,EAAWD,EAAE,KAAK,WAAW,KAAK,GAAG,CAAC;AAAA,MAC7C,OAAOA,EAAE,GAAG,SAAA;AAAA,IAAS;AAAA,EACvB,GAGIG,IAAqBX,GAAiB,YAAY;AAAA,IACtD,CAACY,MAAgB;AACf,YAAMC,IAAWJ,EAAWG,EAAO,KAAK,WAAW,KAAK,GAAG,CAAC;AAC5D,aAAO;AAAA,QACL,OAAOP,IAAiBQ,IAAWC,EAAuBD,CAAQ;AAAA,QAClE,OAAOD,EAAO,GAAG,SAAA;AAAA,MAAS;AAAA,IAE9B;AAAA,EAAA,GAGIG,IAAuBf,GAAiB,oBACxCgB,IAAkBd,GAAc,uBAAuB,yBAAyB,SAAA,GAChFe,IAAiBf,GAAc,uBAAuB,wBAAwB,SAAA,GAC9EgB,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SAAQ;AAAA,QACR,UAAUX;AAAA,QACV,SAAShB,KAAuB,CAAA;AAAA,QAChC,eAAeU,KAAkB;AAAA,QACjC,WAAU;AAAA,QACV,UAAU;AAAA,QACV,YAAU;AAAA,MAAA;AAAA,IAAA,GAEd;AAAA,sBACCgB,GAAA,EACC,UAAA,gBAAAD;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,UAAUf;AAAA,QACV,SAAST,KAAwB,CAAA;AAAA,QACjC,eAAeM,KAAmB;AAAA,QAClC,WAAU;AAAA,QACV,UAAU;AAAA,QACV,YAAU;AAAA,MAAA;AAAA,IAAA,GAEd;AAAA,IAECD,GAAsB,IAAI,CAACoB,MAAiB;AAC3C,YAAMC,IAAWlC,EAAaiC,GAAS,IAAwB;AAC/D,+BACGF,GAAA,EACC,UAAA,gBAAAD;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,SACE7B,IACI8B,GAAS,MAAM,WAAW,KAAK,GAAG,IAClCrB,EAAuBqB,GAAS,MAAM,WAAW,KAAK,GAAG,CAAC;AAAA,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
+ {"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,M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a6B,GAAS,IAAwB;AAC/D,+BACGF,GAAA,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,66 +1,65 @@
1
- import { jsxs as C, jsx as t } from "react/jsx-runtime";
2
- import { Label as I, SelectDropdown as O, toReverseDeliveryLabel as x } from "@bjsdistribution/dms-component-library";
3
- import v from "styled-components";
4
- import { useOrderStaticData as D, useFailureReason as S, useIsFailureReasonChanged as w } from "../../../../../store.js";
5
- import { useClientPortal as N } from "../../../../../../store.js";
6
- function z() {
7
- const [a] = D(), [i] = N(), [u, c] = S(), [, d] = w(), p = a?.failure_reasons, n = a?.escalation_category, s = a?.escalation_types, l = a?.fault_non_fault_reasons, f = n?.find(
1
+ import { jsxs as b, jsx as n } from "react/jsx-runtime";
2
+ import { Label as I, SelectDropdown as O } from "@bjsdistribution/dms-component-library";
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(
8
7
  (e) => e?.type === "Failure - Non Fault"
9
- )?.id, F = n?.find(
8
+ )?.id, f = t?.find(
10
9
  (e) => e?.type === "Failure - Fault"
11
- )?.id, R = s?.filter(
10
+ )?.id, F = s?.filter(
11
+ (e) => e?.escalation_category_id === p
12
+ )[0]?.id, R = s?.filter(
12
13
  (e) => e?.escalation_category_id === f
13
- )[0]?.id, m = s?.filter(
14
- (e) => e?.escalation_category_id === F
15
- )[0]?.id, y = l?.filter(
14
+ )[0]?.id, _ = l?.filter(
15
+ (e) => e?.escalation_type_id === F
16
+ ), m = l?.filter(
16
17
  (e) => e?.escalation_type_id === R
17
- ), _ = l?.filter(
18
- (e) => e?.escalation_type_id === m
19
18
  ), r = (e) => {
20
19
  const h = new Set(
21
20
  e?.map((o) => o?.order_reason_id)
22
21
  );
23
- return p?.filter((o) => h?.has(o?.id))?.map((o) => ({
22
+ return d?.filter((o) => h?.has(o?.id))?.map((o) => ({
24
23
  value: o?.reason,
25
- label: i ? o?.title : x(o?.title),
24
+ label: o?.title,
26
25
  id: o?.id
27
26
  }));
28
- }, g = r(_), b = r(y);
29
- return /* @__PURE__ */ C(L, { children: [
30
- /* @__PURE__ */ t(I, { label: "Failure Reason", htmlFor: "failurereasondropdown", required: !0 }),
31
- /* @__PURE__ */ t(
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(
32
31
  O,
33
32
  {
34
33
  placeholder: "Select Reason",
35
34
  options: [
36
35
  {
37
36
  label: "Fault Reasons",
38
- options: g
37
+ options: y
39
38
  },
40
39
  {
41
40
  label: "Non-Fault Reasons",
42
- options: b
41
+ options: g
43
42
  }
44
43
  ] || [],
45
44
  inputId: "failurereasondropdown",
46
45
  openMenuOnFocus: !0,
47
- value: u,
46
+ value: i,
48
47
  onChange: (e) => {
49
- c(e), d(!0);
48
+ u(e), c(!0);
50
49
  },
51
- formatGroupLabel: (e) => /* @__PURE__ */ t("div", { style: { color: "rgba(0,0,0,0.8)" }, children: /* @__PURE__ */ t("span", { children: e?.label }) }),
50
+ formatGroupLabel: (e) => /* @__PURE__ */ n("div", { style: { color: "rgba(0,0,0,0.8)" }, children: /* @__PURE__ */ n("span", { children: e?.label }) }),
52
51
  isDisabled: !1
53
52
  }
54
53
  )
55
54
  ] });
56
55
  }
57
- const L = v.div`
56
+ const D = x.div`
58
57
  display: flex;
59
58
  flex-direction: column;
60
59
  gap: 6px;
61
60
  flex: 1;
62
61
  `;
63
62
  export {
64
- z as default
63
+ q as default
65
64
  };
66
65
  //# 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, toReverseDeliveryLabel } 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 { 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":";;;;;AAUA,SAASA,IAAwB;AAC/B,QAAM,CAACC,CAAe,IAAIC,EAAA,GACpB,CAACC,CAAc,IAAIC,EAAA,GACnB,CAACC,GAAoBC,CAAgB,IAAIC,EAAA,GACzC,CAAA,EAAGC,CAAyB,IAAIC,EAAA,GAChCC,IAAiBT,GAAiB,iBAClCU,IAAqBV,GAAiB,qBACtCW,IAAkBX,GAAiB,kBACnCY,IAAuBZ,GAAiB,yBAGxCa,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,OAAOvB,IACHuB,GAAS,QACTC,EAAuBD,GAAS,KAAK;AAAA,MACzC,IAAIA,GAAS;AAAA,IAAA,EACb;AAAA,EACN,GAEME,IAAqBL,EAAqBD,CAAY,GACtDO,IAAwBN,EAAqBH,CAAe;AAyBlE,2BACGU,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,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
+ {"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,I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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,42 @@
1
1
  import { jsx as o, jsxs as i } from "react/jsx-runtime";
2
- import { useState as h, useEffect as y } from "react";
3
- import { toReverseDeliveryLabel as T, useAxios as Y, Label as p, AntSelect as _ } from "@bjsdistribution/dms-component-library";
4
- import { useOrderId as x, useCurrentAction as R, useOrderStaticData as I, useCustomerInfo as P } from "../../../store.js";
5
- import k from "../../../../../common/modals/order-action-modal/OrderActionModal.js";
6
- import { HoldContentContainer as j, SplitText as B, HoldRow as S, HoldDatePickerWrap as L } from "../modalstyle.js";
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";
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
7
  import { notification as d, DatePicker as U } from "antd";
8
- import D from "dayjs";
8
+ import S from "dayjs";
9
9
  import { useClientPortal as W } from "../../../../store.js";
10
- function Z(n) {
11
- const [a] = x(), [, l] = R(), [H] = I(), [t, c] = h(null), [s, C] = h(void 0), [u] = P(), [m] = W(), b = `${u?.recipient_name}, ${u?.postcode}`, v = H?.onhold_reasons?.map(
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(
12
12
  (e) => ({
13
- label: m ? e?.reason : T(e?.reason),
13
+ label: e?.reason,
14
14
  value: e?.reason
15
15
  })
16
- ), w = t ? `orders/${a}/hold/?hold_reason=${s}&hold_until=${t}` : `orders/${a}/hold/?hold_reason=${s}
17
- `, { fetchData: g, error: r } = Y({
18
- endpoint: w,
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,
19
19
  method: "POST"
20
20
  }), A = () => {
21
21
  l(void 0);
22
22
  }, O = (e) => {
23
23
  C(e);
24
- }, $ = (e, q) => {
25
- const f = e?.format("YYYY-MM-DDTHH:mm:ss");
26
- c(f !== void 0 ? f : null);
24
+ }, $ = (e, L) => {
25
+ const u = e?.format("YYYY-MM-DDTHH:mm:ss");
26
+ c(u !== void 0 ? u : null);
27
27
  }, M = async () => {
28
28
  if (a) {
29
- const e = await g();
29
+ const e = await v();
30
30
  e?.code === 200 && (d.success({
31
31
  message: "Success",
32
32
  description: `${e.message}`
33
- }), m && await n?.callUnresolvedTaskApi(), await n?.callOrderAlertsApi(), await n?.callOrderStatusApi(), await n?.callOrdersApi()), e?.code !== 200 && (d.error({
33
+ }), D && await n?.callUnresolvedTaskApi(), await n?.callOrderAlertsApi(), await n?.callOrderStatusApi(), await n?.callOrdersApi()), e?.code !== 200 && (d.error({
34
34
  message: "Error",
35
35
  description: `${e.error}`
36
36
  }), l(void 0));
37
37
  }
38
38
  };
39
- return y(() => {
39
+ return T(() => {
40
40
  r !== null && r?.code !== 200 && (console.log("entered"), d.error({
41
41
  //@ts-ignore
42
42
  message: `${r?.error}`,
@@ -46,7 +46,7 @@ function Z(n) {
46
46
  )
47
47
  }), l(void 0));
48
48
  }, [r]), /* @__PURE__ */ o(
49
- k,
49
+ P,
50
50
  {
51
51
  minWidth: "24vw",
52
52
  headerTitle: "Hold order",
@@ -56,26 +56,26 @@ function Z(n) {
56
56
  infoText: b,
57
57
  submitBtnTitle: "Save Details",
58
58
  isSubmitDisabled: !(s !== void 0),
59
- children: /* @__PURE__ */ o(j, { children: /* @__PURE__ */ i(B, { children: [
60
- /* @__PURE__ */ i(S, { children: [
61
- /* @__PURE__ */ o(p, { label: "Hold Until (leave blank for indefinite)" }),
62
- /* @__PURE__ */ o(L, { children: /* @__PURE__ */ o(
59
+ 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)" }),
62
+ /* @__PURE__ */ o(B, { children: /* @__PURE__ */ o(
63
63
  U,
64
64
  {
65
65
  needConfirm: !0,
66
66
  format: "MMMM D, YYYY",
67
67
  onChange: $,
68
- value: t === null ? t : D(t),
69
- disabledDate: (e) => e && e < D().startOf("day")
68
+ value: t === null ? t : S(t),
69
+ disabledDate: (e) => e && e < S().startOf("day")
70
70
  }
71
71
  ) })
72
72
  ] }),
73
- /* @__PURE__ */ i(S, { children: [
74
- /* @__PURE__ */ o(p, { label: "Hold Reason", required: !0 }),
73
+ /* @__PURE__ */ i(p, { children: [
74
+ /* @__PURE__ */ o(h, { label: "Hold Reason", required: !0 }),
75
75
  /* @__PURE__ */ o(
76
76
  _,
77
77
  {
78
- options: v || [],
78
+ options: w || [],
79
79
  placeholder: "Select Hold Reason",
80
80
  onChange: O,
81
81
  disabled: !1,
@@ -92,6 +92,6 @@ function Z(n) {
92
92
  );
93
93
  }
94
94
  export {
95
- Z as default
95
+ X as default
96
96
  };
97
97
  //# sourceMappingURL=HoldOrderModal.js.map