@bjsdistribution/dms-client-return 0.1.93-prod → 0.1.94-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.
@@ -46,22 +46,8 @@ const e = [
46
46
  },
47
47
  { label: "Charge Log", value: "charge-log" },
48
48
  { label: "Force Debrief", value: "force-debrief" }
49
- ], r = [
50
- {
51
- label: "Proof of Delivery",
52
- value: "proofofdelivery"
53
- },
54
- {
55
- label: "Return Labels",
56
- value: "returnlabels"
57
- },
58
- {
59
- label: "Return Cover Notes",
60
- value: "returncovernote"
61
- }
62
49
  ];
63
50
  export {
64
- r as PrintMenu,
65
51
  e as bjsMenu,
66
52
  a as optionsMenu,
67
53
  l as optionsMenuClientPortal
@@ -1 +1 @@
1
- {"version":3,"file":"fakedata.js","sources":["../../../src/components/order-view/fakedata.ts"],"sourcesContent":["import { ChargeLogData } from './types';\n\nexport const bjsMenu = [\n {\n label: 'Add Order Resources',\n value: 'add-resources',\n },\n {\n label: 'Split Order',\n value: 'split-order',\n },\n];\n\nexport const optionsMenuClientPortal = [\n { label: 'Create Task', value: 'create-task' },\n {\n label: 'On Hold',\n value: 'hold-order',\n },\n {\n label: 'Un Hold',\n value: 'unhold-order',\n },\n {\n label: 'Cancel',\n value: 'cancel-order',\n },\n {\n label: 'Un-Cancel',\n value: 'uncancel-order',\n },\n];\n\nexport const optionsMenu = [\n { label: 'Create Reminder', value: 'create-reminder' },\n { label: 'Create Task', value: 'create-task' },\n { label: 'Confirm', value: 'confirm-order' },\n { label: 'Hold', value: 'hold-order' },\n { label: 'Cancel', value: 'cancel-order' },\n { label: 'Un Hold', value: 'unhold-order' },\n {\n label: 'Remove from Route',\n value: 'remove-from-route',\n },\n {\n label: 'Un-Cancel',\n value: 'uncancel-order',\n },\n {\n label: 'Clear Booking Status',\n value: 'clear-date',\n },\n { label: 'Charge Log', value: 'charge-log' },\n { label: 'Force Debrief', value: 'force-debrief' },\n];\n\nexport const PrintMenu = [\n {\n label: 'Proof of Delivery',\n value: 'proofofdelivery',\n },\n {\n label: 'Return Labels',\n value: 'returnlabels',\n },\n {\n label: 'Return Cover Notes',\n value: 'returncovernote',\n },\n];\n\nexport const orderResources = [\n {\n date: '15/01/2024 06:22:47',\n updated_at: '15/01/2024 06:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 1,\n },\n {\n date: '22/01/2024 07:22:47',\n updated_at: '22/01/2024 07:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 2,\n },\n {\n date: '22/01/2024 07:22:47',\n updated_at: '22/01/2024 07:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 3,\n },\n {\n date: '22/01/2024 07:22:47',\n updated_at: '22/01/2024 07:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 4,\n },\n {\n date: '22/01/2024 07:22:47',\n updated_at: '22/01/2024 07:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 5,\n },\n {\n date: '22/01/2024 07:22:47',\n updated_at: '22/01/2024 07:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 6,\n },\n];\n\nexport const HoldOptionMenu = [\n {\n label: 'STOCK RECEIPT / DAMAGED - Awaiting Client Instructions',\n value: 'STOCK RECEIPT / DAMAGED - Awaiting Client Instructions',\n },\n {\n label: 'STOCK RECEIPT / EXTRA ITEMS - Awaiting Client Instructions',\n value: 'STOCK RECEIPT / EXTRA ITEMS - Awaiting Client Instructions',\n },\n {\n label: 'STOCK RECEIPT / NO STOCK - Awaiting Client Instructions',\n value: 'STOCK RECEIPT / NO STOCK - Awaiting Client Instructions',\n },\n {\n label: 'STOCK RECEIPT / DAMAGED - Awaiting Client Instructions',\n value: 'STOCK RECEIPT / DAMAGED - Awaiting Client Instructions',\n },\n {\n label: 'STOCK RECEIPT / NO STOCK - CANX',\n value: 'STOCK RECEIPT / NO STOCK - CANX',\n },\n {\n label: 'STOCK RECEIPT / RE-ALLOCATION',\n value: 'STOCK RECEIPT / RE-ALLOCATION',\n },\n {\n label: 'CONTACT DETAILS / MISSING TEL NUMBER',\n value: 'CONTACT DETAILS / MISSING TEL NUMBER',\n },\n {\n label: 'CONTACT DETAILS / INCORRECT ADDRESS',\n value: 'CONTACT DETAILS / INCORRECT ADDRESS',\n },\n];\n\nexport const initialData: ChargeLogData[] = [\n {\n id: 1,\n date: '17/05/2024',\n description: 'Delivery Success - 17/05/2024',\n amount: '0.00',\n status: '2024-06-02 - Moreham Wood Direct - 34113',\n },\n {\n id: 2,\n date: '17/05/2024',\n description: 'Delivery Success - 17/05/2024',\n amount: '0.45',\n status: '2024-06-02 - Moreham Wood Direct - 34113',\n },\n {\n id: 3,\n date: '17/05/2024',\n description: 'Delivery Success - 17/05/2024',\n amount: '0.00',\n status: '',\n },\n {\n id: 4,\n date: '17/05/2024',\n description: 'Delivery Success - 17/05/2024',\n amount: '0.78',\n status: 'Awaiting Invoice',\n },\n {\n id: 5,\n date: '17/05/2024',\n description: 'Delivery Success - 17/05/2024',\n amount: '0.108',\n status: 'Awaiting',\n },\n];\n"],"names":["bjsMenu","optionsMenuClientPortal","optionsMenu","PrintMenu"],"mappings":"AAEO,MAAMA,IAAU;AAAA,EACrB;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAEX,GAEaC,IAA0B;AAAA,EACrC,EAAE,OAAO,eAAe,OAAO,cAAA;AAAA,EAC/B;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAEX,GAEaC,IAAc;AAAA,EACzB,EAAE,OAAO,mBAAmB,OAAO,kBAAA;AAAA,EACnC,EAAE,OAAO,eAAe,OAAO,cAAA;AAAA,EAC/B,EAAE,OAAO,WAAW,OAAO,gBAAA;AAAA,EAC3B,EAAE,OAAO,QAAQ,OAAO,aAAA;AAAA,EACxB,EAAE,OAAO,UAAU,OAAO,eAAA;AAAA,EAC1B,EAAE,OAAO,WAAW,OAAO,eAAA;AAAA,EAC3B;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET,EAAE,OAAO,cAAc,OAAO,aAAA;AAAA,EAC9B,EAAE,OAAO,iBAAiB,OAAO,gBAAA;AACnC,GAEaC,IAAY;AAAA,EACvB;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAEX;"}
1
+ {"version":3,"file":"fakedata.js","sources":["../../../src/components/order-view/fakedata.ts"],"sourcesContent":["import { ChargeLogData } from './types';\n\nexport const bjsMenu = [\n {\n label: 'Add Order Resources',\n value: 'add-resources',\n },\n {\n label: 'Split Order',\n value: 'split-order',\n },\n];\n\nexport const optionsMenuClientPortal = [\n { label: 'Create Task', value: 'create-task' },\n {\n label: 'On Hold',\n value: 'hold-order',\n },\n {\n label: 'Un Hold',\n value: 'unhold-order',\n },\n {\n label: 'Cancel',\n value: 'cancel-order',\n },\n {\n label: 'Un-Cancel',\n value: 'uncancel-order',\n },\n];\n\nexport const optionsMenu = [\n { label: 'Create Reminder', value: 'create-reminder' },\n { label: 'Create Task', value: 'create-task' },\n { label: 'Confirm', value: 'confirm-order' },\n { label: 'Hold', value: 'hold-order' },\n { label: 'Cancel', value: 'cancel-order' },\n { label: 'Un Hold', value: 'unhold-order' },\n {\n label: 'Remove from Route',\n value: 'remove-from-route',\n },\n {\n label: 'Un-Cancel',\n value: 'uncancel-order',\n },\n {\n label: 'Clear Booking Status',\n value: 'clear-date',\n },\n { label: 'Charge Log', value: 'charge-log' },\n { label: 'Force Debrief', value: 'force-debrief' },\n];\n\nexport const PrintMenu = [\n {\n label: 'Proof of Delivery',\n value: 'proofofdelivery',\n },\n {\n label: 'Return Labels',\n value: 'returnlabels',\n },\n {\n label: 'Return Cover Notes',\n value: 'returncovernote',\n },\n];\n\nexport const orderResources = [\n {\n date: '15/01/2024 06:22:47',\n updated_at: '15/01/2024 06:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 1,\n },\n {\n date: '22/01/2024 07:22:47',\n updated_at: '22/01/2024 07:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 2,\n },\n {\n date: '22/01/2024 07:22:47',\n updated_at: '22/01/2024 07:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 3,\n },\n {\n date: '22/01/2024 07:22:47',\n updated_at: '22/01/2024 07:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 4,\n },\n {\n date: '22/01/2024 07:22:47',\n updated_at: '22/01/2024 07:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 5,\n },\n {\n date: '22/01/2024 07:22:47',\n updated_at: '22/01/2024 07:22:47',\n type: 'Workflow',\n category: 'Epod',\n reference: 'Success Note',\n id: 6,\n },\n];\n\nexport const HoldOptionMenu = [\n {\n label: 'STOCK RECEIPT / DAMAGED - Awaiting Client Instructions',\n value: 'STOCK RECEIPT / DAMAGED - Awaiting Client Instructions',\n },\n {\n label: 'STOCK RECEIPT / EXTRA ITEMS - Awaiting Client Instructions',\n value: 'STOCK RECEIPT / EXTRA ITEMS - Awaiting Client Instructions',\n },\n {\n label: 'STOCK RECEIPT / NO STOCK - Awaiting Client Instructions',\n value: 'STOCK RECEIPT / NO STOCK - Awaiting Client Instructions',\n },\n {\n label: 'STOCK RECEIPT / DAMAGED - Awaiting Client Instructions',\n value: 'STOCK RECEIPT / DAMAGED - Awaiting Client Instructions',\n },\n {\n label: 'STOCK RECEIPT / NO STOCK - CANX',\n value: 'STOCK RECEIPT / NO STOCK - CANX',\n },\n {\n label: 'STOCK RECEIPT / RE-ALLOCATION',\n value: 'STOCK RECEIPT / RE-ALLOCATION',\n },\n {\n label: 'CONTACT DETAILS / MISSING TEL NUMBER',\n value: 'CONTACT DETAILS / MISSING TEL NUMBER',\n },\n {\n label: 'CONTACT DETAILS / INCORRECT ADDRESS',\n value: 'CONTACT DETAILS / INCORRECT ADDRESS',\n },\n];\n\nexport const initialData: ChargeLogData[] = [\n {\n id: 1,\n date: '17/05/2024',\n description: 'Delivery Success - 17/05/2024',\n amount: '0.00',\n status: '2024-06-02 - Moreham Wood Direct - 34113',\n },\n {\n id: 2,\n date: '17/05/2024',\n description: 'Delivery Success - 17/05/2024',\n amount: '0.45',\n status: '2024-06-02 - Moreham Wood Direct - 34113',\n },\n {\n id: 3,\n date: '17/05/2024',\n description: 'Delivery Success - 17/05/2024',\n amount: '0.00',\n status: '',\n },\n {\n id: 4,\n date: '17/05/2024',\n description: 'Delivery Success - 17/05/2024',\n amount: '0.78',\n status: 'Awaiting Invoice',\n },\n {\n id: 5,\n date: '17/05/2024',\n description: 'Delivery Success - 17/05/2024',\n amount: '0.108',\n status: 'Awaiting',\n },\n];\n"],"names":["bjsMenu","optionsMenuClientPortal","optionsMenu"],"mappings":"AAEO,MAAMA,IAAU;AAAA,EACrB;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAEX,GAEaC,IAA0B;AAAA,EACrC,EAAE,OAAO,eAAe,OAAO,cAAA;AAAA,EAC/B;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAEX,GAEaC,IAAc;AAAA,EACzB,EAAE,OAAO,mBAAmB,OAAO,kBAAA;AAAA,EACnC,EAAE,OAAO,eAAe,OAAO,cAAA;AAAA,EAC/B,EAAE,OAAO,WAAW,OAAO,gBAAA;AAAA,EAC3B,EAAE,OAAO,QAAQ,OAAO,aAAA;AAAA,EACxB,EAAE,OAAO,UAAU,OAAO,eAAA;AAAA,EAC1B,EAAE,OAAO,WAAW,OAAO,eAAA;AAAA,EAC3B;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET,EAAE,OAAO,cAAc,OAAO,aAAA;AAAA,EAC9B,EAAE,OAAO,iBAAiB,OAAO,gBAAA;AACnC;"}
@@ -1,17 +1,21 @@
1
- import { jsx as t, jsxs as f } from "react/jsx-runtime";
2
- import { useMemo as v } from "react";
3
- import i from "styled-components";
4
- import { PrintMenu as g } from "../../fakedata.js";
5
- import { useOrderDetails as _ } from "../../store.js";
6
- import { Space as h, Dropdown as b } from "antd";
1
+ import { jsx as o, jsxs as b } from "react/jsx-runtime";
2
+ import { useMemo as f } from "react";
3
+ import a from "styled-components";
4
+ import { useOrderDetails as g } from "../../store.js";
5
+ import { Space as h, Dropdown as _ } from "antd";
7
6
  import y from "../../../../assets/icons/ArrowDownIcon.js";
8
- import { getBaseEndpoint as w } from "@bjsdistribution/dms-component-library";
9
- function T() {
10
- const [o] = _(), s = o?.gsit_order_id, l = v(() => o?.id, [o]), a = () => {
7
+ import { getBaseEndpoint as i } from "@bjsdistribution/dms-component-library";
8
+ const l = [
9
+ { key: "pdf", label: "PDF", noteFormat: "pdf" },
10
+ { key: "doc", label: "Word", noteFormat: "word" },
11
+ { key: "zpl", label: "ZPL", noteFormat: "zpl" }
12
+ ];
13
+ function D() {
14
+ const [t] = g(), n = t?.consignment, s = f(() => t?.id, [t]), c = () => {
11
15
  const e = process.env.REACT_APP_PROJECT_ENV, r = process.env.REACT_APP_API_PATH;
12
16
  return r === "https://us.dms.api.bjshomedelivery.com" ? "release_us" : r === "https://development.dms.api.bjshomedelivery.com" ? "development" : r === "https://staging.dms.api.bjshomedelivery.com" ? "staging" : e === "release_uk" ? "release_uk" : e === "release_us" ? "release_us" : e === "staging" ? "staging" : "development";
13
17
  }, d = () => {
14
- switch (a()) {
18
+ switch (c()) {
15
19
  case "release_uk":
16
20
  return "https://api.bjshomedelivery.com/v2/orders/labels";
17
21
  case "release_us":
@@ -21,51 +25,60 @@ function T() {
21
25
  default:
22
26
  return "https://api.development.bjshomedelivery.com/v2/orders/labels";
23
27
  }
24
- }, c = (e) => {
25
- const r = e?.toLowerCase()?.replaceAll(" ", ""), n = d();
26
- return s ? r === "returnlabels" ? `${n}/generate_labels?pdf=true&product_type=Return&order_id=${s}` : "" : (console.error("Missing orderId. Cannot generate Return Labels URL."), "");
27
- }, p = (e) => {
28
- const r = e?.value, n = w();
29
- if (r)
30
- if (r === "returncovernote")
31
- window.open(
32
- `${n}/orders/return_cover_notes/?order_id=${l}`,
33
- "_blank"
34
- );
35
- else if (r === "proofofdelivery")
36
- window.open(
37
- `${n}/orders/generate_note/?order_id=${l}&output_format=pdf`,
38
- "_blank"
39
- );
40
- else {
41
- const m = c(r);
42
- window.open(m, "_blank");
28
+ }, p = (e) => n ? `${d()}/generate_labels?consignment_no=${n}&product_type=Return&${e}=1` : (console.error(
29
+ "Missing consignment number. Cannot generate Return Labels URL."
30
+ ), ""), m = (e) => `${i()}/orders/generate_note/?order_id=${s}&output_format=${e}`, u = () => {
31
+ const e = i();
32
+ window.open(
33
+ `${e}/orders/return_cover_notes/?order_id=${s}`,
34
+ "_blank"
35
+ );
36
+ }, v = {
37
+ items: [
38
+ ...l.map((e) => ({
39
+ key: `proofofdelivery-${e.key}`,
40
+ label: /* @__PURE__ */ o(
41
+ "div",
42
+ {
43
+ onClick: (r) => {
44
+ r.stopPropagation(), window.open(m(e.noteFormat), "_blank");
45
+ },
46
+ children: `Proof of Delivery - ${e.label}`
47
+ }
48
+ )
49
+ })),
50
+ ...l.map((e) => ({
51
+ key: `returnlabels-${e.key}`,
52
+ label: /* @__PURE__ */ o(
53
+ "div",
54
+ {
55
+ onClick: (r) => {
56
+ r.stopPropagation(), window.open(p(e.key), "_blank");
57
+ },
58
+ children: `Return Labels - ${e.label}`
59
+ }
60
+ )
61
+ })),
62
+ {
63
+ key: "returncovernote",
64
+ label: /* @__PURE__ */ o(
65
+ "div",
66
+ {
67
+ onClick: (e) => {
68
+ e.stopPropagation(), u();
69
+ },
70
+ children: "Return Cover Notes"
71
+ }
72
+ )
43
73
  }
44
- }, u = {
45
- items: g?.map((e) => ({
46
- key: e.value,
47
- label: e.label,
48
- value: e.value
49
- }))?.map((e) => ({
50
- key: e.value,
51
- label: /* @__PURE__ */ t(
52
- "div",
53
- {
54
- onClick: (r) => {
55
- r.stopPropagation(), p(e);
56
- },
57
- children: e.label
58
- }
59
- )
60
- // disabled,
61
- }))
74
+ ]
62
75
  };
63
- return /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(b, { menu: u, trigger: ["hover"], children: /* @__PURE__ */ t("a", { onClick: (e) => e.preventDefault(), style: { cursor: "pointer" }, children: /* @__PURE__ */ f(j, { children: [
76
+ return /* @__PURE__ */ o(k, { children: /* @__PURE__ */ o(_, { menu: v, trigger: ["hover"], children: /* @__PURE__ */ o("a", { onClick: (e) => e.preventDefault(), style: { cursor: "pointer" }, children: /* @__PURE__ */ b(P, { children: [
64
77
  "PRINT",
65
- /* @__PURE__ */ t(y, { fill: "#f0f2f2" })
78
+ /* @__PURE__ */ o(y, { fill: "#f0f2f2" })
66
79
  ] }) }) }) });
67
80
  }
68
- const P = i.div``, j = i(h)`
81
+ const k = a.div``, P = a(h)`
69
82
  .ant-space-item {
70
83
  color: #6a7378;
71
84
  text-align: center;
@@ -76,6 +89,6 @@ const P = i.div``, j = i(h)`
76
89
  }
77
90
  `;
78
91
  export {
79
- T as default
92
+ D as default
80
93
  };
81
94
  //# sourceMappingURL=Print.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Print.js","sources":["../../../../../src/components/order-view/general-information/dropdowns/Print.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport styled from 'styled-components';\nimport { PrintMenu } from '../../fakedata';\nimport { useOrderDetails } from '../../store';\nimport { Dropdown, Space } from 'antd';\nimport ArrowDownIcon from '../../../../assets/icons/ArrowDownIcon';\nimport { getBaseEndpoint } from '@bjsdistribution/dms-component-library';\n\nfunction Print() {\n const [orderDetails] = useOrderDetails();\n const gsitId = orderDetails?.gsit_order_id;\n\n const orderId = useMemo(() => {\n return orderDetails?.id;\n }, [orderDetails]);\n\n const getEnvironment = ():\n | 'development'\n | 'release_us'\n | 'release_uk'\n | 'staging' => {\n const projectEnv = process.env.REACT_APP_PROJECT_ENV;\n const apiPath = process.env.REACT_APP_API_PATH;\n\n if (apiPath === 'https://us.dms.api.bjshomedelivery.com') {\n return 'release_us';\n }\n if (apiPath === 'https://development.dms.api.bjshomedelivery.com') {\n return 'development';\n }\n if (apiPath === 'https://staging.dms.api.bjshomedelivery.com') {\n return 'staging';\n }\n\n if (projectEnv === 'release_uk') {\n return 'release_uk';\n }\n if (projectEnv === 'release_us') {\n return 'release_us';\n }\n if (projectEnv === 'staging') {\n return 'staging';\n }\n return 'development';\n };\n\n const getBaseUrl = (): string => {\n const environment = getEnvironment();\n switch (environment) {\n case 'release_uk':\n return 'https://api.bjshomedelivery.com/v2/orders/labels';\n case 'release_us':\n return 'https://us.api.bjshomedelivery.com/v2/orders/labels';\n case 'staging':\n return 'https://staging.api.bjshomedelivery.com/v2/orders/labels';\n default:\n return 'https://api.development.bjshomedelivery.com/v2/orders/labels';\n }\n };\n\n const getUrl = (option: string) => {\n const val = option?.toLowerCase()?.replaceAll(' ', '');\n const baseUrl = getBaseUrl();\n\n if (!gsitId) {\n console.error('Missing orderId. Cannot generate Return Labels URL.');\n return '';\n }\n if (val === 'returnlabels') {\n return `${baseUrl}/generate_labels?pdf=true&product_type=Return&order_id=${gsitId}`;\n } else {\n return '';\n }\n };\n\n const handleSelectChange = (selectedOption: any) => {\n const selectedValue = selectedOption?.value;\n const baseEndpoint = getBaseEndpoint();\n if (selectedValue) {\n //return\n if (selectedValue === 'returncovernote') {\n window.open(\n `${baseEndpoint}/orders/return_cover_notes/?order_id=${orderId}`,\n '_blank'\n );\n //proof\n } else if (selectedValue === 'proofofdelivery') {\n window.open(\n `${baseEndpoint}/orders/generate_note/?order_id=${orderId}&output_format=pdf`,\n '_blank'\n );\n } else {\n const url = getUrl(selectedValue);\n window.open(url, '_blank');\n }\n }\n };\n\n // const optionToLabelKey: Record<string, keyof typeof orderDetails.labels> = {\n // proofofdelivery: 'deliver',\n // returnlabels: 'return',\n // returncovernote: 'collect',\n // };\n\n // const isOptionDisabled = (optionValue: string) => {\n // const labels = orderDetails?.labels || {};\n // const labelKey = optionToLabelKey[optionValue];\n\n // if (!labelKey) return false;\n // return !labels[labelKey];\n // };\n\n const filteredOptions = PrintMenu?.map((option: any) => ({\n key: option.value,\n label: option.label,\n value: option.value,\n }));\n\n const menuItems = {\n items: filteredOptions?.map((option: any) => {\n // const disabled = isOptionDisabled(option.value);\n\n return {\n key: option.value,\n label: (\n <div\n onClick={e => {\n e.stopPropagation();\n // if (!disabled) {\n handleSelectChange(option);\n // }\n }}\n // style={{\n // color: disabled ? '#bfbfbf' : undefined,\n // cursor: disabled ? 'not-allowed' : 'pointer',\n // }}\n >\n {option.label}\n </div>\n ),\n // disabled,\n };\n }),\n };\n\n return (\n <Container>\n <Dropdown menu={menuItems} trigger={['hover']}>\n <a onClick={e => e.preventDefault()} style={{ cursor: 'pointer' }}>\n <StyledSpace>\n PRINT\n <ArrowDownIcon fill={'#f0f2f2'} />\n </StyledSpace>\n </a>\n </Dropdown>\n </Container>\n );\n}\n\nconst Container = styled.div``;\n\nconst StyledSpace = styled(Space)`\n .ant-space-item {\n color: #6a7378;\n text-align: center;\n font-family: Lato;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n`;\n\nexport default Print;\n"],"names":["Print","orderDetails","useOrderDetails","gsitId","orderId","useMemo","getEnvironment","projectEnv","apiPath","getBaseUrl","getUrl","option","val","baseUrl","handleSelectChange","selectedOption","selectedValue","baseEndpoint","getBaseEndpoint","url","menuItems","PrintMenu","jsx","e","Container","Dropdown","jsxs","StyledSpace","ArrowDownIcon","styled","Space"],"mappings":";;;;;;;;AAQA,SAASA,IAAQ;AACf,QAAM,CAACC,CAAY,IAAIC,EAAA,GACjBC,IAASF,GAAc,eAEvBG,IAAUC,EAAQ,MACfJ,GAAc,IACpB,CAACA,CAAY,CAAC,GAEXK,IAAiB,MAIN;AACf,UAAMC,IAAa,QAAA,IAAY,uBACzBC,IAAU,QAAA,IAAY;AAE5B,WAAIA,MAAY,2CACP,eAELA,MAAY,oDACP,gBAELA,MAAY,gDACP,YAGLD,MAAe,eACV,eAELA,MAAe,eACV,eAELA,MAAe,YACV,YAEF;AAAA,EACT,GAEME,IAAa,MAAc;AAE/B,YADoBH,EAAA,GACZ;AAAA,MACN,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IAAA;AAAA,EAEb,GAEMI,IAAS,CAACC,MAAmB;AACjC,UAAMC,IAAMD,GAAQ,YAAA,GAAe,WAAW,KAAK,EAAE,GAC/CE,IAAUJ,EAAA;AAEhB,WAAKN,IAIDS,MAAQ,iBACH,GAAGC,CAAO,0DAA0DV,CAAM,KAE1E,MANP,QAAQ,MAAM,qDAAqD,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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"Print.js","sources":["../../../../../src/components/order-view/general-information/dropdowns/Print.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport styled from 'styled-components';\nimport { useOrderDetails } from '../../store';\nimport { Dropdown, Space } from 'antd';\nimport ArrowDownIcon from '../../../../assets/icons/ArrowDownIcon';\nimport { getBaseEndpoint } from '@bjsdistribution/dms-component-library';\n\nconst LABEL_FORMATS = [\n { key: 'pdf', label: 'PDF', noteFormat: 'pdf' },\n { key: 'doc', label: 'Word', noteFormat: 'word' },\n { key: 'zpl', label: 'ZPL', noteFormat: 'zpl' },\n] as const;\n\nfunction Print() {\n const [orderDetails] = useOrderDetails();\n const consignmentNo = orderDetails?.consignment;\n\n const orderId = useMemo(() => {\n return orderDetails?.id;\n }, [orderDetails]);\n\n const getEnvironment = ():\n | 'development'\n | 'release_us'\n | 'release_uk'\n | 'staging' => {\n const projectEnv = process.env.REACT_APP_PROJECT_ENV;\n const apiPath = process.env.REACT_APP_API_PATH;\n\n if (apiPath === 'https://us.dms.api.bjshomedelivery.com') {\n return 'release_us';\n }\n if (apiPath === 'https://development.dms.api.bjshomedelivery.com') {\n return 'development';\n }\n if (apiPath === 'https://staging.dms.api.bjshomedelivery.com') {\n return 'staging';\n }\n\n if (projectEnv === 'release_uk') {\n return 'release_uk';\n }\n if (projectEnv === 'release_us') {\n return 'release_us';\n }\n if (projectEnv === 'staging') {\n return 'staging';\n }\n return 'development';\n };\n\n const getBaseUrl = (): string => {\n const environment = getEnvironment();\n switch (environment) {\n case 'release_uk':\n return 'https://api.bjshomedelivery.com/v2/orders/labels';\n case 'release_us':\n return 'https://us.api.bjshomedelivery.com/v2/orders/labels';\n case 'staging':\n return 'https://staging.api.bjshomedelivery.com/v2/orders/labels';\n default:\n return 'https://api.development.bjshomedelivery.com/v2/orders/labels';\n }\n };\n\n const getReturnLabelUrl = (format: (typeof LABEL_FORMATS)[number]['key']) => {\n if (!consignmentNo) {\n console.error(\n 'Missing consignment number. Cannot generate Return Labels URL.'\n );\n return '';\n }\n const baseUrl = getBaseUrl();\n return `${baseUrl}/generate_labels?consignment_no=${consignmentNo}&product_type=Return&${format}=1`;\n };\n\n const getProofOfDeliveryUrl = (\n noteFormat: (typeof LABEL_FORMATS)[number]['noteFormat']\n ) => {\n const baseEndpoint = getBaseEndpoint();\n return `${baseEndpoint}/orders/generate_note/?order_id=${orderId}&output_format=${noteFormat}`;\n };\n\n const handleReturnCoverNote = () => {\n const baseEndpoint = getBaseEndpoint();\n window.open(\n `${baseEndpoint}/orders/return_cover_notes/?order_id=${orderId}`,\n '_blank'\n );\n };\n\n const menuItems = {\n items: [\n ...LABEL_FORMATS.map(format => ({\n key: `proofofdelivery-${format.key}`,\n label: (\n <div\n onClick={e => {\n e.stopPropagation();\n window.open(getProofOfDeliveryUrl(format.noteFormat), '_blank');\n }}\n >\n {`Proof of Delivery - ${format.label}`}\n </div>\n ),\n })),\n ...LABEL_FORMATS.map(format => ({\n key: `returnlabels-${format.key}`,\n label: (\n <div\n onClick={e => {\n e.stopPropagation();\n window.open(getReturnLabelUrl(format.key), '_blank');\n }}\n >\n {`Return Labels - ${format.label}`}\n </div>\n ),\n })),\n {\n key: 'returncovernote',\n label: (\n <div\n onClick={e => {\n e.stopPropagation();\n handleReturnCoverNote();\n }}\n >\n Return Cover Notes\n </div>\n ),\n },\n ],\n };\n\n return (\n <Container>\n <Dropdown menu={menuItems} trigger={['hover']}>\n <a onClick={e => e.preventDefault()} style={{ cursor: 'pointer' }}>\n <StyledSpace>\n PRINT\n <ArrowDownIcon fill={'#f0f2f2'} />\n </StyledSpace>\n </a>\n </Dropdown>\n </Container>\n );\n}\n\nconst Container = styled.div``;\n\nconst StyledSpace = styled(Space)`\n .ant-space-item {\n color: #6a7378;\n text-align: center;\n font-family: Lato;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n`;\n\nexport default Print;\n"],"names":["LABEL_FORMATS","Print","orderDetails","useOrderDetails","consignmentNo","orderId","useMemo","getEnvironment","projectEnv","apiPath","getBaseUrl","getReturnLabelUrl","format","getProofOfDeliveryUrl","noteFormat","getBaseEndpoint","handleReturnCoverNote","baseEndpoint","menuItems","jsx","e","Container","Dropdown","jsxs","StyledSpace","ArrowDownIcon","styled","Space"],"mappings":";;;;;;;AAOA,MAAMA,IAAgB;AAAA,EACpB,EAAE,KAAK,OAAO,OAAO,OAAO,YAAY,MAAA;AAAA,EACxC,EAAE,KAAK,OAAO,OAAO,QAAQ,YAAY,OAAA;AAAA,EACzC,EAAE,KAAK,OAAO,OAAO,OAAO,YAAY,MAAA;AAC1C;AAEA,SAASC,IAAQ;AACf,QAAM,CAACC,CAAY,IAAIC,EAAA,GACjBC,IAAgBF,GAAc,aAE9BG,IAAUC,EAAQ,MACfJ,GAAc,IACpB,CAACA,CAAY,CAAC,GAEXK,IAAiB,MAIN;AACf,UAAMC,IAAa,QAAA,IAAY,uBACzBC,IAAU,QAAA,IAAY;AAE5B,WAAIA,MAAY,2CACP,eAELA,MAAY,oDACP,gBAELA,MAAY,gDACP,YAGLD,MAAe,eACV,eAELA,MAAe,eACV,eAELA,MAAe,YACV,YAEF;AAAA,EACT,GAEME,IAAa,MAAc;AAE/B,YADoBH,EAAA,GACZ;AAAA,MACN,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IAAA;AAAA,EAEb,GAEMI,IAAoB,CAACC,MACpBR,IAOE,GADSM,EAAA,CACC,mCAAmCN,CAAa,wBAAwBQ,CAAM,QAN7F,QAAQ;AAAA,IACN;AAAA,EAAA,GAEK,KAMLC,IAAwB,CAC5BC,MAGO,GADcC,EAAA,CACC,mCAAmCV,CAAO,kBAAkBS,CAAU,IAGxFE,IAAwB,MAAM;AAClC,UAAMC,IAAeF,EAAA;AACrB,WAAO;AAAA,MACL,GAAGE,CAAY,wCAAwCZ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AACM,GAAA,EAAc,MAAM,WAAW;AAAA,EAAA,GAClC,EAAA,CACF,EAAA,CACF,GACF;AAEJ;AAEA,MAAMJ,IAAYK,EAAO,OAEnBF,IAAcE,EAAOC,CAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1,38 +1,38 @@
1
1
  import { jsxs as C, jsx as r } from "react/jsx-runtime";
2
- import { useState as Z, useEffect as o, useRef as Nt } from "react";
3
- import m from "styled-components";
4
- import kt from "./order-details/index.js";
5
- import Ht from "./notes/index.js";
6
- import Ft from "./system-event-logs/expanded-content/index.js";
7
- import Kt from "./general-information/index.js";
8
- import Vt from "./products-info/index.js";
9
- import jt from "./order-actions/index.js";
10
- import { useAxios as u, useApiHook as i, DocumentTitle as qt } from "@bjsdistribution/dms-component-library";
11
- import { useOrderId as zt, useGsitOrderId as Jt, useOrderDetails as Yt, usePrevOrderDetails as Zt, useStatusDetails as Qt, useDepotOptions as Bt, useCustomerInfo as Mt, useLocationOptions as Wt, useOrderProductsResources as Xt, useGsitCUstomerId as te, useOrderProductId as ee, useCUstomerId as oe, useRouteId as se, useLiveRecalling as re, useGlobalStateHitOrder as ae, usegetClientData as ne, useGlobalEscData as ie, useEpodImages as de, skeletonTomTom as ce, useOrderProductSystemLogs as le } from "./store.js";
12
- import { useLocation as ue, useNavigate as pe } from "react-router-dom";
13
- import { notification as fe, message as Q } from "antd";
14
- import me from "./details-filters/DetailsFilters.js";
15
- import { useSubContracterData as ge, useIsShowNorthSouth as he, useClientPortal as De } from "../store.js";
16
- import _e from "./notification/index.js";
17
- import Se from "./order-resources/expanded-content/index.js";
18
- import { useAllOrderStatus as Ie, setResourcesCall as Oe } from "./order-actions/store.js";
19
- import { POSTCODE_LABEL as Pe } from "../../common/utils.js";
20
- import { getEnvironment as Ee } from "./utils.js";
21
- import Ae from "./toolbox-resources/expanded-content/index.js";
22
- import { useAtom as B } from "jotai";
23
- function Me({ locationloading: M }) {
24
- fe.config({
2
+ import { useState as Q, useEffect as o, useRef as Ne } from "react";
3
+ import f from "styled-components";
4
+ import ke from "./order-details/index.js";
5
+ import He from "./notes/index.js";
6
+ import Fe from "./system-event-logs/expanded-content/index.js";
7
+ import Ke from "./general-information/index.js";
8
+ import Ve from "./products-info/index.js";
9
+ import je from "./order-actions/index.js";
10
+ import { useAxios as l, useApiHook as i, DocumentTitle as qe } from "@bjsdistribution/dms-component-library";
11
+ import { useOrderId as ze, useGsitOrderId as Ye, useOrderDetails as Ze, usePrevOrderDetails as Qe, useStatusDetails as Be, useDepotOptions as Je, useCustomerInfo as Me, useLocationOptions as We, useOrderProductsResources as Xe, useGsitCUstomerId as et, useOrderProductId as tt, useCUstomerId as ot, useRouteId as st, useLiveRecalling as rt, useGlobalStateHitOrder as at, usegetClientData as nt, useGlobalEscData as it, useEpodImages as dt, skeletonTomTom as ct, useOrderProductSystemLogs as lt } from "./store.js";
12
+ import { useLocation as ut, useNavigate as pt } from "react-router-dom";
13
+ import { notification as ft, message as B } from "antd";
14
+ import mt from "./details-filters/DetailsFilters.js";
15
+ import { useSubContracterData as gt, useIsShowNorthSouth as ht, useClientPortal as Dt } from "../store.js";
16
+ import _t from "./notification/index.js";
17
+ import St from "./order-resources/expanded-content/index.js";
18
+ import { useAllOrderStatus as Et, setResourcesCall as It } from "./order-actions/store.js";
19
+ import { POSTCODE_LABEL as Ot } from "../../common/utils.js";
20
+ import { getEnvironment as Pt } from "./utils.js";
21
+ import At from "./toolbox-resources/expanded-content/index.js";
22
+ import { useAtom as J } from "jotai";
23
+ function Mt({ locationloading: M }) {
24
+ ft.config({
25
25
  top: 150
26
26
  });
27
- const [s, T] = zt(), [W, G] = Jt(), [a, X] = Yt(), [, tt] = Zt(), [, g] = Z(!1), [, et] = Qt(), [, x] = Bt(), [R, ot] = Mt(), [, st] = Wt(), [rt, b] = Xt(), [h, at] = te(), [, nt] = ee(), [, it] = oe(), [, dt] = se(), [$] = re(), [, ct] = ge(), [w] = ae(), [, lt] = Ie(), U = a?.id, [N] = B(Oe), [, ut] = ne(), [, k] = ie(), [, pt] = he(), [, ft] = de(), [, mt] = B(ce), [gt] = De();
27
+ const [s, y] = ze(), [W, G] = Ye(), [a, X] = Ze(), [, ee] = Qe(), [, m] = Q(!1), [, te] = Be(), [, x] = Je(), [R, oe] = Me(), [, se] = We(), [re, b] = Xe(), [g, ae] = et(), [, ne] = tt(), [, ie] = ot(), [, de] = st(), [$] = rt(), [, ce] = gt(), [w] = at(), [, le] = Et(), U = a?.id, [N] = J(It), [, ue] = nt(), [, k] = it(), [, pe] = ht(), [, fe] = dt(), [, me] = J(ct), [ge] = Dt();
28
28
  o(() => {
29
- lt(a?.status_value);
29
+ le(a?.status_value);
30
30
  }, [a?.status_value]);
31
31
  const {
32
- data: D,
33
- fetchData: ht,
32
+ data: h,
33
+ fetchData: he,
34
34
  loading: H
35
- } = u({
35
+ } = l({
36
36
  endpoint: "/events/get/event/",
37
37
  method: "GET",
38
38
  pagination: { page: 1, per_page: 100 },
@@ -44,10 +44,10 @@ function Me({ locationloading: M }) {
44
44
  }
45
45
  ],
46
46
  showLoader: !1
47
- }), _ = ue(), Dt = pe(), [F, _t] = Z([]), {
48
- data: St,
49
- loading: It,
50
- setShouldPerformAction: Ot
47
+ }), D = ut(), De = pt(), [F, _e] = Q([]), {
48
+ data: Se,
49
+ loading: Ee,
50
+ setShouldPerformAction: Ie
51
51
  } = i({
52
52
  endpoint: "orders/",
53
53
  method: "GET",
@@ -55,42 +55,42 @@ function Me({ locationloading: M }) {
55
55
  performAction: !1
56
56
  });
57
57
  o(() => {
58
- const t = new URLSearchParams(_.search);
59
- if (t?.toString()) {
60
- const e = [];
61
- t?.forEach((n, f) => {
62
- f === "order" ? e.push({
58
+ const e = new URLSearchParams(D.search);
59
+ if (e?.toString()) {
60
+ const t = [];
61
+ e?.forEach((n, p) => {
62
+ p === "order" ? t.push({
63
63
  field: "gsit_order_id",
64
64
  op: "=",
65
65
  value: n
66
- }) : e.push({
67
- field: f,
66
+ }) : t.push({
67
+ field: p,
68
68
  op: "=",
69
69
  value: n
70
70
  });
71
- }), _t(e), F && (Ot(!0), T(St?.data[0]?.id));
71
+ }), _e(t), F && (Ie(!0), y(Se?.data[0]?.id));
72
72
  } else {
73
- const e = _.pathname.split("/");
74
- T(e[e?.length - 1]);
73
+ const t = D.pathname.split("/");
74
+ y(t[t?.length - 1]);
75
75
  }
76
- }, [_.search, It]);
76
+ }, [D.search, Ee]);
77
77
  const {
78
- data: c,
78
+ data: _,
79
79
  loading: S,
80
- setShouldPerformAction: Pt
80
+ setShouldPerformAction: Oe
81
81
  } = i({
82
82
  endpoint: `orders/${s}`,
83
83
  method: "GET",
84
84
  performAction: !1
85
85
  }), {
86
- data: p,
87
- loading: I,
86
+ data: u,
87
+ loading: E,
88
88
  setShouldPerformAction: K
89
89
  } = i({
90
90
  endpoint: `/orders/get_live_status/${s}`,
91
91
  method: "GET",
92
92
  performAction: !1
93
- }), { data: O, loading: P } = i({
93
+ }), { data: I, loading: O } = i({
94
94
  endpoint: "/depot/",
95
95
  method: "GET",
96
96
  filters: [{ field: "visibility", op: "=", value: !0 }],
@@ -98,67 +98,58 @@ function Me({ locationloading: M }) {
98
98
  pagination: { is_pagination: !1 }
99
99
  });
100
100
  o(() => {
101
- s && (Pt(w), K(!$));
101
+ s && (Oe(w), K(!$));
102
102
  }, [s, $, w]), o(() => {
103
- if (g(S), c && c.data) {
104
- const t = c?.data;
105
- if (t[0]?.order_type?.type && t[0]?.order_type?.type !== "return") {
106
- Dt(`/orders/view/${s}`, { replace: !0 });
103
+ if (m(S), _ && _.data) {
104
+ const e = _?.data;
105
+ if (e[0]?.order_type?.type && e[0]?.order_type?.type !== "return") {
106
+ De(`/orders/view/${s}`, { replace: !0 });
107
107
  return;
108
108
  }
109
- X(t[0]), it(t[0]?.customer_id), dt(t[0]?.order_routes?.route_id), G(t[0]?.gsit_order_id), nt(t[0]?.id), ot({
110
- recipient_name: t[0]?.order_recipient?.recipient_name ?? null,
111
- postcode: t[0]?.order_recipient?.postcode ?? null,
112
- return_action: t[0]?.return_action ?? null
113
- }), tt(t[0]), c?.data[0]?.gsit_order_id ? localStorage.setItem(
114
- "dbSyncAPICall",
115
- JSON.stringify({
116
- status: !0,
117
- gsit_orderId: c?.data[0]?.gsit_order_id
118
- })
119
- ) : localStorage.setItem("dbSyncAPICall", JSON.stringify({}));
109
+ X(e[0]), ie(e[0]?.customer_id), de(e[0]?.order_routes?.route_id), G(e[0]?.gsit_order_id), ne(e[0]?.id), oe({
110
+ recipient_name: e[0]?.order_recipient?.recipient_name ?? null,
111
+ postcode: e[0]?.order_recipient?.postcode ?? null,
112
+ return_action: e[0]?.return_action ?? null
113
+ }), ee(e[0]);
120
114
  }
121
- return () => {
122
- localStorage.removeItem("dbSyncAPICall");
123
- };
124
115
  }, [S]), o(() => {
125
- if (g(I), p && p.data) {
126
- const t = p?.data;
127
- t && et(t);
116
+ if (m(E), u && u.data) {
117
+ const e = u?.data;
118
+ e && te(e);
128
119
  }
129
- }, [I, p]);
120
+ }, [E, u]);
130
121
  const {
131
- fetchData: Et,
132
- loading: At,
133
- data: E
134
- } = u({
122
+ fetchData: Pe,
123
+ loading: Ae,
124
+ data: P
125
+ } = l({
135
126
  endpoint: "/v1/client/list",
136
127
  method: "GET"
137
128
  });
138
129
  o(() => {
139
- s && (Et(), Gt());
130
+ s && (Pe(), Ge());
140
131
  }, [s]), o(() => {
141
- if (E && E?.data) {
142
- const t = E?.data;
143
- ut(t);
132
+ if (P && P?.data) {
133
+ const e = P?.data;
134
+ ue(e);
144
135
  }
145
- }, [At]), o(() => {
146
- if (g(P), O && O.data) {
147
- const t = O?.data;
148
- if (t.length > 0) {
149
- const e = t?.map((n) => ({
136
+ }, [Ae]), o(() => {
137
+ if (m(O), I && I.data) {
138
+ const e = I?.data;
139
+ if (e.length > 0) {
140
+ const t = e?.map((n) => ({
150
141
  label: n.name,
151
142
  value: n.id
152
143
  }));
153
- x(e);
144
+ x(t);
154
145
  } else
155
146
  x([]);
156
147
  }
157
- }, [P]);
148
+ }, [O]);
158
149
  const {
159
150
  data: V,
160
151
  setShouldPerformAction: d,
161
- loading: vt
152
+ loading: Le
162
153
  } = i({
163
154
  endpoint: `/orders/${s}/order_resources/`,
164
155
  method: "GET",
@@ -173,161 +164,161 @@ function Me({ locationloading: M }) {
173
164
  s && d(!0);
174
165
  }, [s, d]), o(() => {
175
166
  s && b(V);
176
- }, [V, rt, b]);
167
+ }, [V, re, b]);
177
168
  const {
178
169
  data: A,
179
170
  loading: j,
180
- fetchData: yt
181
- } = u({
171
+ fetchData: ve
172
+ } = l({
182
173
  endpoint: `orders/${s}/epod_resources/?finance=false`,
183
174
  method: "GET"
184
175
  });
185
176
  o(() => {
186
- s && (yt(), a?.order_recipient?.postcode != null && J({
177
+ s && (ve(), a?.order_recipient?.postcode != null && Y({
187
178
  endPointQuery: `?postcode=${a?.order_recipient?.postcode}`
188
179
  }));
189
180
  }, [s]), o(() => {
190
181
  if (A && A?.data) {
191
- const t = A?.data?.resources;
192
- ft(t);
182
+ const e = A?.data?.resources;
183
+ fe(e);
193
184
  }
194
- mt(j);
185
+ me(j);
195
186
  }, [j]), o(() => () => {
196
- at((t) => ({ ...t, id: void 0 }));
187
+ ae((e) => ({ ...e, id: void 0 }));
197
188
  }, []);
198
189
  const {
199
- data: v,
200
- loading: Lt,
190
+ data: L,
191
+ loading: Te,
201
192
  setShouldPerformAction: q
202
193
  } = i({
203
- endpoint: `/return_locations/?customer_id=${h?.id}`,
194
+ endpoint: `/return_locations/?customer_id=${g?.id}`,
204
195
  method: "GET",
205
196
  performAction: !1
206
197
  });
207
198
  o(() => {
208
- h?.id ? q(!0) : q(!1);
209
- }, [h]), o(() => {
210
- if (v && v?.data) {
211
- const t = v?.data?.map((e) => ({
212
- label: e?.location_name + ", " + e?.postcode,
213
- value: e?.token,
214
- is_default: e?.is_default === "True"
199
+ g?.id ? q(!0) : q(!1);
200
+ }, [g]), o(() => {
201
+ if (L && L?.data) {
202
+ const e = L?.data?.map((t) => ({
203
+ label: t?.location_name + ", " + t?.postcode,
204
+ value: t?.token,
205
+ is_default: t?.is_default === "True"
215
206
  }));
216
- st(t);
207
+ se(e);
217
208
  }
218
- }, [Lt]);
219
- const [, Ct] = le();
209
+ }, [Te]);
210
+ const [, Ce] = lt();
220
211
  o(() => {
221
- D && D?.data && Ct(D?.data);
222
- }, [H]), o(() => (W && ht(), () => {
212
+ h && h?.data && Ce(h?.data);
213
+ }, [H]), o(() => (W && he(), () => {
223
214
  G(void 0);
224
215
  }), [U]);
225
- const { data: l, loading: Tt } = i({
216
+ const { data: c, loading: ye } = i({
226
217
  endpoint: "/sub-contractor/sub_contractor/get/",
227
218
  method: "GET"
228
219
  });
229
220
  o(() => {
230
- if (l && l?.data) {
231
- const t = l?.data?.map(
232
- (e) => ({
233
- id: e.id,
234
- name: e.name
221
+ if (c && c?.data) {
222
+ const e = c?.data?.map(
223
+ (t) => ({
224
+ id: t.id,
225
+ name: t.name
235
226
  })
236
227
  );
237
- ct(t);
228
+ ce(e);
238
229
  }
239
- }, [l, l, Tt]);
230
+ }, [c, c, ye]);
240
231
  const {
241
232
  data: z,
242
- fetchData: Gt,
243
- loading: xt
244
- } = u({
233
+ fetchData: Ge,
234
+ loading: xe
235
+ } = l({
245
236
  endpoint: `/orders/escalations/${s}`,
246
237
  method: "GET"
247
238
  });
248
239
  o(() => {
249
240
  if (z?.data) {
250
- const e = z?.data?.sort(
251
- (f, Ut) => new Date(Ut?.created_at).getTime() - new Date(f?.created_at).getTime()
252
- ), n = e != null && e.length > 0;
253
- k(n ? e : []);
241
+ const t = z?.data?.sort(
242
+ (p, Ue) => new Date(Ue?.created_at).getTime() - new Date(p?.created_at).getTime()
243
+ ), n = t != null && t.length > 0;
244
+ k(n ? t : []);
254
245
  }
255
- }, [xt]);
256
- const Rt = `${R?.recipient_name}, ${R?.postcode}`, y = Ee(), { fetchData: J } = u({
246
+ }, [xe]);
247
+ const Re = `${R?.recipient_name}, ${R?.postcode}`, v = Pt(), { fetchData: Y } = l({
257
248
  endpoint: "v1/orders/customs/postcode/check/",
258
249
  method: "GET"
259
- }), bt = async () => {
250
+ }), be = async () => {
260
251
  try {
261
- const t = await J({
252
+ const e = await Y({
262
253
  endPointQuery: `?postcode=${a?.order_recipient?.postcode}`
263
254
  });
264
- if (t?.code === 200) {
265
- const e = t?.data?.order_customs_postcodes;
266
- pt(e);
255
+ if (e?.code === 200) {
256
+ const t = e?.data?.order_customs_postcodes;
257
+ pe(t);
267
258
  } else
268
- Q.open({
259
+ B.open({
269
260
  type: "error",
270
261
  //@ts-ignore
271
- content: t?.error || "Something went wrong"
262
+ content: e?.error || "Something went wrong"
272
263
  });
273
264
  } catch {
274
- Q.open({
265
+ B.open({
275
266
  type: "error",
276
- content: `Failed to check ${Pe.toLowerCase()}. Please try again.`
267
+ content: `Failed to check ${Ot.toLowerCase()}. Please try again.`
277
268
  });
278
269
  }
279
- }, L = {
270
+ }, T = {
280
271
  UK: /\b(?:[A-Za-z][A-HJ-Ya-hj-y]?[0-9][0-9A-Za-z]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})\b/,
281
272
  IRISH: /^(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}$/,
282
273
  US: /^\d{5}(-\d{4})?$/
283
- }, $t = y === "development" || y === "staging" || y === "release_uk", wt = (t) => $t ? L.UK.test(t) || L.IRISH.test(t) : L.US.test(t), Y = Nt(!1);
274
+ }, $e = v === "development" || v === "staging" || v === "release_uk", we = (e) => $e ? T.UK.test(e) || T.IRISH.test(e) : T.US.test(e), Z = Ne(!1);
284
275
  return o(() => {
285
- const t = a?.order_recipient?.postcode?.trim();
286
- t && wt(t) && !Y.current && (Y.current = !0, bt());
287
- }, [a?.order_recipient?.postcode]), /* @__PURE__ */ C(ve, { children: [
288
- /* @__PURE__ */ r(qt, { title: Rt }),
289
- /* @__PURE__ */ r(Kt, { statusDataLoading: I }),
290
- /* @__PURE__ */ r(me, {}),
291
- /* @__PURE__ */ r(_e, {}),
276
+ const e = a?.order_recipient?.postcode?.trim();
277
+ e && we(e) && !Z.current && (Z.current = !0, be());
278
+ }, [a?.order_recipient?.postcode]), /* @__PURE__ */ C(Lt, { children: [
279
+ /* @__PURE__ */ r(qe, { title: Re }),
280
+ /* @__PURE__ */ r(Ke, { statusDataLoading: E }),
281
+ /* @__PURE__ */ r(mt, {}),
282
+ /* @__PURE__ */ r(_t, {}),
292
283
  /* @__PURE__ */ r(
293
- kt,
284
+ ke,
294
285
  {
295
286
  orderLoading: S,
296
- depotDataLoading: P
287
+ depotDataLoading: O
297
288
  }
298
289
  ),
299
- /* @__PURE__ */ r(Vt, { locationloading: M }),
300
- /* @__PURE__ */ C(ye, { children: [
301
- /* @__PURE__ */ r(Le, { children: /* @__PURE__ */ r(Ht, {}) }),
302
- /* @__PURE__ */ C(Ce, { children: [
303
- /* @__PURE__ */ r(Se, { loading: vt }),
304
- !gt && /* @__PURE__ */ r(Ae, {}),
305
- /* @__PURE__ */ r(Ft, { loading: H })
290
+ /* @__PURE__ */ r(Ve, { locationloading: M }),
291
+ /* @__PURE__ */ C(vt, { children: [
292
+ /* @__PURE__ */ r(Tt, { children: /* @__PURE__ */ r(He, {}) }),
293
+ /* @__PURE__ */ C(Ct, { children: [
294
+ /* @__PURE__ */ r(St, { loading: Le }),
295
+ !ge && /* @__PURE__ */ r(At, {}),
296
+ /* @__PURE__ */ r(Fe, { loading: H })
306
297
  ] })
307
298
  ] }),
308
- /* @__PURE__ */ r(jt, {})
299
+ /* @__PURE__ */ r(je, {})
309
300
  ] });
310
301
  }
311
- const ve = m.div`
302
+ const Lt = f.div`
312
303
  display: flex;
313
304
  flex-direction: column;
314
305
  gap: 10px;
315
306
  padding-bottom: 30px;
316
- `, ye = m.div`
307
+ `, vt = f.div`
317
308
  display: flex;
318
309
  gap: 15px;
319
310
  @media (max-width: 1024px) {
320
311
  display: contents;
321
312
  }
322
- `, Le = m.div`
313
+ `, Tt = f.div`
323
314
  flex: 1;
324
- `, Ce = m.div`
315
+ `, Ct = f.div`
325
316
  flex: 1;
326
317
  display: flex;
327
318
  flex-direction: column;
328
319
  gap: 15px;
329
320
  `;
330
321
  export {
331
- Me as default
322
+ Mt as default
332
323
  };
333
324
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/order-view/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport OrderDetails from './order-details';\nimport Notes from './notes';\nimport SystemLogs from './system-event-logs/expanded-content';\nimport GeneralHeader from './general-information';\nimport ProductsInfo from './products-info';\nimport OrderActions from './order-actions';\nimport {\n DocumentTitle,\n useApiHook,\n useAxios,\n} from '@bjsdistribution/dms-component-library';\nimport {\n useOrderDetails,\n // useOrderStaticData,\n useStatusDetails,\n useOrderId,\n useDepotOptions,\n usePrevOrderDetails,\n useOrderProductsResources,\n useCustomerInfo,\n useLocationOptions,\n useOrderProductSystemLogs,\n useGsitCUstomerId,\n useCUstomerId,\n useRouteId,\n useGsitOrderId,\n useOrderProductId,\n useLiveRecalling,\n useGlobalStateHitOrder,\n useAtom,\n usegetClientData,\n useGlobalEscData,\n useEpodImages,\n skeletonTomTom,\n} from './store';\nimport { OrdersType } from './types';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport { message, notification } from 'antd';\nimport DetailsFilters from './details-filters/DetailsFilters';\nimport {\n useClientPortal,\n useIsShowNorthSouth,\n useSubContracterData,\n} from '../store';\nimport Notification from './notification';\nimport Order from './order-resources/expanded-content';\nimport { setResourcesCall, useAllOrderStatus } from './order-actions/store';\nimport { ClientType } from '../order-daily-overview/common/interface';\nimport { POSTCODE_LABEL } from '../../common/utils';\nimport { getEnvironment } from './utils';\nimport Toolbox from './toolbox-resources/expanded-content';\n\ninterface ApiResponse {\n message: string;\n code: number;\n error: string | null;\n error_traceback: string | null;\n data: [];\n setShouldPerformAction: boolean;\n}\n\nfunction OrderView({ locationloading }: any) {\n notification.config({\n top: 150,\n });\n const [orderId, setOrderId] = useOrderId();\n const [gsitOrderId, setGsitOrderId] = useGsitOrderId();\n // For API Call\n const [orderDetails, setOrderDetails] = useOrderDetails();\n const [, setPrevOrderDetails] = usePrevOrderDetails();\n const [, setLoading] = useState<boolean>(false);\n const [, setOrderStatus] = useStatusDetails();\n const [, setDepotOptions] = useDepotOptions();\n const [customerInfo, setCustomerInfo] = useCustomerInfo();\n const [, setLocationOptions] = useLocationOptions();\n const [orderResources, setOrderResources] = useOrderProductsResources();\n const [GsitCUstomerId, setGsitCUstomerId] = useGsitCUstomerId();\n const [, setOrderProductId] = useOrderProductId();\n const [, setCUstomerId] = useCUstomerId();\n const [, setRouteId] = useRouteId();\n const [liveRecalling] = useLiveRecalling();\n const [, setSubContracterData] = useSubContracterData();\n const [recallOrders] = useGlobalStateHitOrder();\n const [, setStatusVal] = useAllOrderStatus();\n const order_id = orderDetails?.id;\n const [getResources] = useAtom(setResourcesCall);\n const [, setClientData] = usegetClientData();\n const [, setGlobalEscData] = useGlobalEscData();\n const [, setIsNorthSouth] = useIsShowNorthSouth();\n const [, setEpodImages] = useEpodImages();\n const [, setSkeletonTomTom] = useAtom(skeletonTomTom);\n const [clientPortal] = useClientPortal();\n\n useEffect(() => {\n setStatusVal(orderDetails?.status_value);\n }, [orderDetails?.status_value]);\n\n //get system event logs\n const {\n data: fetchedSystemLogsData,\n fetchData: callSystemLogsAPI,\n loading: logsLoading,\n } = useAxios<{\n data: any[];\n }>({\n endpoint: `/events/get/event/`,\n method: 'GET',\n pagination: { page: 1, per_page: 100 },\n filters: [\n {\n field: 'order_id',\n op: '=',\n value: `${order_id}`,\n },\n ],\n showLoader: false,\n });\n\n // query param\n const location = useLocation();\n const navigate = useNavigate();\n const [filters, setFilters] = useState<\n Array<{ field: string; op: string; value: string | null }>\n >([]);\n\n // for third party apps\n const {\n data: fetchedDataExternal,\n loading: loadingExternal,\n setShouldPerformAction: setShouldPerformExternal,\n } = useApiHook<{\n data: any[];\n }>({\n endpoint: `orders/`,\n method: 'GET',\n filters: filters,\n performAction: false,\n });\n\n useEffect(() => {\n const searchParams = new URLSearchParams(location.search);\n if (searchParams?.toString()) {\n const dynamicFilters: Array<{\n field: string;\n op: string;\n value: string | null;\n }> = [];\n searchParams?.forEach((value, key) => {\n if (key === 'order') {\n dynamicFilters.push({\n field: 'gsit_order_id',\n op: '=',\n value: value,\n });\n } else {\n dynamicFilters.push({\n field: key,\n op: '=',\n value: value,\n });\n }\n });\n setFilters(dynamicFilters);\n if (filters) {\n setShouldPerformExternal(true);\n setOrderId(fetchedDataExternal?.data[0]?.id);\n }\n } else {\n const paths = location.pathname.split('/');\n setOrderId(paths[paths?.length - 1]);\n }\n }, [location.search, loadingExternal]);\n\n const {\n data: fetchedData,\n loading,\n setShouldPerformAction: orderUpdate,\n } = useApiHook<{\n data: OrdersType[];\n }>({\n endpoint: `orders/${orderId}`,\n method: 'GET',\n performAction: false,\n });\n\n //Order status api\n const {\n data: fetchedStatusData,\n loading: statusDataLoading,\n setShouldPerformAction: setLivePerformAction,\n } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `/orders/get_live_status/${orderId}`,\n method: 'GET',\n performAction: false,\n });\n const { data: fetchedDepotData, loading: depotDataLoading } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `/depot/`,\n method: 'GET',\n filters: [{ field: 'visibility', op: '=', value: true }],\n //@ts-ignore\n pagination: { is_pagination: false },\n });\n useEffect(() => {\n if (orderId) {\n orderUpdate(recallOrders);\n liveRecalling ? setLivePerformAction(false) : setLivePerformAction(true);\n }\n }, [orderId, liveRecalling, recallOrders]);\n\n useEffect(() => {\n setLoading(loading);\n if (fetchedData && fetchedData.data) {\n const requiredData = fetchedData?.data;\n\n if (requiredData[0]?.order_type?.type && requiredData[0]?.order_type?.type !== 'return') {\n navigate(`/orders/view/${orderId}`, { replace: true });\n return;\n }\n \n setOrderDetails(requiredData[0]);\n //@ts-ignore\n setCUstomerId(requiredData[0]?.customer_id);\n setRouteId(requiredData[0]?.order_routes?.route_id);\n //@ts-ignore\n setGsitOrderId(requiredData[0]?.gsit_order_id);\n //@ts-ignore\n setOrderProductId(requiredData[0]?.id);\n setCustomerInfo({\n recipient_name:\n requiredData[0]?.order_recipient?.recipient_name ?? null,\n postcode: requiredData[0]?.order_recipient?.postcode ?? null,\n return_action: requiredData[0]?.return_action ?? null,\n });\n\n setPrevOrderDetails(requiredData[0]);\n\n //dbSync Api call\n if (fetchedData?.data[0]?.gsit_order_id) {\n localStorage.setItem(\n 'dbSyncAPICall',\n JSON.stringify({\n status: true,\n gsit_orderId: fetchedData?.data[0]?.gsit_order_id,\n })\n );\n } else {\n localStorage.setItem('dbSyncAPICall', JSON.stringify({}));\n }\n }\n return () => {\n localStorage.removeItem('dbSyncAPICall');\n };\n }, [loading]);\n\n useEffect(() => {\n setLoading(statusDataLoading);\n if (fetchedStatusData && fetchedStatusData.data) {\n const requiredData = fetchedStatusData?.data;\n if (requiredData) {\n setOrderStatus(requiredData);\n } else {\n // setOrderStatus(null);\n }\n }\n }, [statusDataLoading, fetchedStatusData]);\n\n const {\n fetchData: callCLientApi,\n loading: clientLoading,\n data: clientData,\n } = useAxios<{\n data: ClientType[];\n }>({\n endpoint: `/v1/client/list`,\n method: 'GET',\n });\n\n useEffect(() => {\n if (orderId) {\n callCLientApi();\n callEscalationApi();\n }\n }, [orderId]);\n\n useEffect(() => {\n if (clientData && clientData?.data) {\n const res = clientData?.data;\n setClientData(res);\n }\n }, [clientLoading]);\n\n useEffect(() => {\n setLoading(depotDataLoading);\n if (fetchedDepotData && fetchedDepotData.data) {\n const requiredData = fetchedDepotData?.data;\n if (requiredData.length > 0) {\n const options = requiredData?.map((x: any) => {\n return {\n label: x.name,\n value: x.id,\n };\n });\n setDepotOptions(options);\n } else {\n setDepotOptions([]);\n }\n }\n }, [depotDataLoading]);\n\n // Order resources\n const {\n data: fetchedResourcesData,\n setShouldPerformAction: setActions,\n loading: loadingResources,\n } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `/orders/${orderId}/order_resources/`,\n method: 'GET',\n performAction: false,\n showLoader: false,\n });\n\n useEffect(() => {\n if (orderId) {\n if (getResources) {\n setActions(false);\n setTimeout(() => {\n setActions(true);\n }, 200);\n } else {\n setActions(true);\n }\n }\n }, [orderId, setActions, getResources]);\n\n useEffect(() => {\n if (orderId) {\n setActions(true);\n }\n }, [orderId, setActions]);\n\n useEffect(() => {\n if (orderId) {\n setOrderResources(fetchedResourcesData);\n }\n }, [fetchedResourcesData, orderResources, setOrderResources]);\n\n //EPOD Images\n const {\n data: fetchedEpodImages,\n loading: epodLoading,\n fetchData: fetchEpodImages,\n } = useAxios<{\n data: ApiResponse[];\n }>({\n endpoint: `orders/${orderId}/epod_resources/?finance=false`,\n method: 'GET',\n });\n\n useEffect(() => {\n if (orderId) {\n fetchEpodImages();\n if (orderDetails?.order_recipient?.postcode != null) {\n callCheckPostcode({\n endPointQuery: `?postcode=${orderDetails?.order_recipient?.postcode}`,\n });\n }\n }\n }, [orderId]);\n\n useEffect(() => {\n if (fetchedEpodImages && fetchedEpodImages?.data) {\n //@ts-ignore\n const result = fetchedEpodImages?.data?.resources;\n setEpodImages(result);\n }\n setSkeletonTomTom(epodLoading);\n }, [epodLoading]);\n\n useEffect(() => {\n return () => {\n setGsitCUstomerId((prev: any) => ({ ...prev, id: undefined }));\n };\n }, []);\n\n const {\n data: fetchedLocationData,\n loading: dataLoading,\n setShouldPerformAction: shouldFetch,\n } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `/return_locations/?customer_id=${GsitCUstomerId?.id}`,\n method: 'GET',\n performAction: false,\n });\n\n useEffect(() => {\n if (GsitCUstomerId?.id) {\n shouldFetch(true);\n } else {\n shouldFetch(false);\n }\n }, [GsitCUstomerId]);\n\n useEffect(() => {\n if (fetchedLocationData && fetchedLocationData?.data) {\n const locationOptions = fetchedLocationData?.data?.map((item: any) => {\n return {\n label: item?.location_name + ', ' + item?.postcode,\n value: item?.token,\n is_default: item?.is_default === 'True' ? true : false,\n };\n });\n setLocationOptions(locationOptions);\n }\n }, [dataLoading]);\n const [, setSystemLogsEvents] = useOrderProductSystemLogs();\n\n useEffect(() => {\n if (fetchedSystemLogsData && fetchedSystemLogsData?.data) {\n setSystemLogsEvents(fetchedSystemLogsData?.data);\n }\n }, [logsLoading]);\n\n useEffect(() => {\n if (gsitOrderId) {\n callSystemLogsAPI();\n }\n return () => {\n setGsitOrderId(undefined);\n };\n }, [order_id]);\n\n const { data: fetchedSubcontractotData, loading: apiLoading } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `/sub-contractor/sub_contractor/get/`,\n method: 'GET',\n });\n\n useEffect(() => {\n if (fetchedSubcontractotData && fetchedSubcontractotData?.data) {\n const formattedData = fetchedSubcontractotData?.data?.map(\n (item: any) => ({\n id: item.id,\n name: item.name,\n })\n );\n setSubContracterData(formattedData);\n }\n }, [fetchedSubcontractotData, fetchedSubcontractotData, apiLoading]);\n\n // ESCALATIONS API\n\n const {\n data: fetchedEscalationData,\n fetchData: callEscalationApi,\n loading: escalationDataLoading,\n } = useAxios<{\n data: any;\n }>({\n endpoint: `/orders/escalations/${orderId}`,\n method: 'GET',\n });\n\n useEffect(() => {\n if (fetchedEscalationData?.data) {\n const escalationData = fetchedEscalationData?.data;\n const sortedEscData = escalationData?.sort(\n (a: any, b: any) =>\n new Date(b?.created_at).getTime() - new Date(a?.created_at).getTime()\n );\n const showEsc = sortedEscData != null && sortedEscData.length > 0;\n showEsc ? setGlobalEscData(sortedEscData) : setGlobalEscData([]);\n }\n }, [escalationDataLoading]);\n\n const docTitle = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;\n const environment = getEnvironment();\n const { fetchData: callCheckPostcode } = useAxios<{\n data: ApiResponse[];\n }>({\n endpoint: `v1/orders/customs/postcode/check/`,\n method: 'GET',\n });\n\n //northern southern\n const callCheckPostcodeAPI = async () => {\n try {\n const response = await callCheckPostcode({\n endPointQuery: `?postcode=${orderDetails?.order_recipient?.postcode}`,\n });\n //@ts-ignore\n if (response?.code === 200) {\n //@ts-ignore\n const isNorthSouth = response?.data?.order_customs_postcodes;\n setIsNorthSouth(isNorthSouth);\n } else {\n message.open({\n type: 'error',\n //@ts-ignore\n content: response?.error || 'Something went wrong',\n });\n }\n } catch (err) {\n message.open({\n type: 'error',\n content: `Failed to check ${POSTCODE_LABEL.toLowerCase()}. Please try again.`,\n });\n }\n };\n const POSTCODE_REGEX = {\n UK: /\\b(?:[A-Za-z][A-HJ-Ya-hj-y]?[0-9][0-9A-Za-z]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})\\b/,\n IRISH: /^(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}$/,\n US: /^\\d{5}(-\\d{4})?$/,\n };\n const isDevelopmentOrStagingOrReleaseUK =\n environment === 'development' ||\n environment === 'staging' ||\n environment === 'release_uk';\n const isValidPostcode = (val: any) => {\n if (isDevelopmentOrStagingOrReleaseUK) {\n return POSTCODE_REGEX.UK.test(val) || POSTCODE_REGEX.IRISH.test(val);\n } else {\n return POSTCODE_REGEX.US.test(val);\n }\n };\n const hasCalledInitialAPI = useRef(false);\n\n useEffect(() => {\n const currentPostcode = orderDetails?.order_recipient?.postcode?.trim();\n\n if (\n currentPostcode &&\n isValidPostcode(currentPostcode) &&\n !hasCalledInitialAPI.current\n ) {\n hasCalledInitialAPI.current = true;\n callCheckPostcodeAPI();\n }\n }, [orderDetails?.order_recipient?.postcode]);\n return (\n <MainContainer>\n <DocumentTitle title={docTitle} />\n <GeneralHeader statusDataLoading={statusDataLoading} />\n\n <DetailsFilters />\n <Notification />\n <OrderDetails\n orderLoading={loading}\n depotDataLoading={depotDataLoading}\n />\n <ProductsInfo locationloading={locationloading} />\n <SplitLayout>\n <NotesContainer>\n <Notes />\n </NotesContainer>\n <TablesContainer>\n <Order loading={loadingResources} />\n {!clientPortal && <Toolbox />}\n\n <SystemLogs loading={logsLoading} />\n </TablesContainer>\n </SplitLayout>\n <OrderActions />\n </MainContainer>\n );\n}\n\nconst MainContainer = styled.div`\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding-bottom: 30px;\n`;\n\nconst SplitLayout = styled.div`\n display: flex;\n gap: 15px;\n @media (max-width: 1024px) {\n display: contents;\n }\n`;\n\nconst NotesContainer = styled.div`\n flex: 1;\n`;\n\nconst TablesContainer = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 15px;\n`;\n\nexport default OrderView;\n"],"names":["OrderView","locationloading","notification","orderId","setOrderId","useOrderId","gsitOrderId","setGsitOrderId","useGsitOrderId","orderDetails","setOrderDetails","useOrderDetails","setPrevOrderDetails","usePrevOrderDetails","setLoading","useState","setOrderStatus","useStatusDetails","setDepotOptions","useDepotOptions","customerInfo","setCustomerInfo","useCustomerInfo","setLocationOptions","useLocationOptions","orderResources","setOrderResources","useOrderProductsResources","GsitCUstomerId","setGsitCUstomerId","useGsitCUstomerId","setOrderProductId","useOrderProductId","setCUstomerId","useCUstomerId","setRouteId","useRouteId","liveRecalling","useLiveRecalling","setSubContracterData","useSubContracterData","recallOrders","useGlobalStateHitOrder","setStatusVal","useAllOrderStatus","order_id","getResources","useAtom","setResourcesCall","setClientData","usegetClientData","setGlobalEscData","useGlobalEscData","setIsNorthSouth","useIsShowNorthSouth","setEpodImages","useEpodImages","setSkeletonTomTom","skeletonTomTom","clientPortal","useClientPortal","useEffect","fetchedSystemLogsData","callSystemLogsAPI","logsLoading","useAxios","location","useLocation","navigate","useNavigate","filters","setFilters","fetchedDataExternal","loadingExternal","setShouldPerformExternal","useApiHook","searchParams","dynamicFilters","value","key","paths","fetchedData","loading","orderUpdate","fetchedStatusData","statusDataLoading","setLivePerformAction","fetchedDepotData","depotDataLoading","requiredData","callCLientApi","clientLoading","clientData","callEscalationApi","res","options","x","fetchedResourcesData","setActions","loadingResources","fetchedEpodImages","epodLoading","fetchEpodImages","callCheckPostcode","result","prev","fetchedLocationData","dataLoading","shouldFetch","locationOptions","item","setSystemLogsEvents","useOrderProductSystemLogs","fetchedSubcontractotData","apiLoading","formattedData","fetchedEscalationData","escalationDataLoading","sortedEscData","a","b","showEsc","docTitle","environment","getEnvironment","callCheckPostcodeAPI","response","isNorthSouth","message","POSTCODE_LABEL","POSTCODE_REGEX","isDevelopmentOrStagingOrReleaseUK","isValidPostcode","val","hasCalledInitialAPI","useRef","currentPostcode","MainContainer","jsx","DocumentTitle","GeneralHeader","DetailsFilters","Notification","OrderDetails","ProductsInfo","SplitLayout","NotesContainer","Notes","TablesContainer","Order","Toolbox","SystemLogs","OrderActions","styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+DA,SAASA,GAAU,EAAE,iBAAAC,KAAwB;AAC3C,EAAAC,GAAa,OAAO;AAAA,IAClB,KAAK;AAAA,EAAA,CACN;AACD,QAAM,CAACC,GAASC,CAAU,IAAIC,GAAA,GACxB,CAACC,GAAaC,CAAc,IAAIC,GAAA,GAEhC,CAACC,GAAcC,CAAe,IAAIC,GAAA,GAClC,CAAA,EAAGC,EAAmB,IAAIC,GAAA,GAC1B,GAAGC,CAAU,IAAIC,EAAkB,EAAK,GACxC,CAAA,EAAGC,EAAc,IAAIC,GAAA,GACrB,CAAA,EAAGC,CAAe,IAAIC,GAAA,GACtB,CAACC,GAAcC,EAAe,IAAIC,GAAA,GAClC,CAAA,EAAGC,EAAkB,IAAIC,GAAA,GACzB,CAACC,IAAgBC,CAAiB,IAAIC,GAAA,GACtC,CAACC,GAAgBC,EAAiB,IAAIC,GAAA,GACtC,CAAA,EAAGC,EAAiB,IAAIC,GAAA,GACxB,CAAA,EAAGC,EAAa,IAAIC,GAAA,GACpB,CAAA,EAAGC,EAAU,IAAIC,GAAA,GACjB,CAACC,CAAa,IAAIC,GAAA,GAClB,CAAA,EAAGC,EAAoB,IAAIC,GAAA,GAC3B,CAACC,CAAY,IA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T,GAAA;AAAA,EAEJ,GAAG,CAACpH,GAAc,iBAAiB,QAAQ,CAAC,qBAEzCgI,IAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,IAAA,EAAc,OAAOjB,GAAA,CAAU;AAAA,IAChC,gBAAAgB,EAACE,MAAc,mBAAAvD,GAAsC;AAAA,sBAEpDwD,IAAA,EAAe;AAAA,sBACfC,IAAA,EAAa;AAAA,IACd,gBAAAJ;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,cAAc7D;AAAA,QACd,kBAAAM;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,gBAAAkD,EAACM,MAAa,iBAAA/I,GAAkC;AAAA,sBAC/CgJ,IAAA,EACC,UAAA;AAAA,MAAA,gBAAAP,EAACQ,IAAA,EACC,UAAA,gBAAAR,EAACS,IAAA,CAAA,CAAM,GACT;AAAA,wBACCC,IAAA,EACC,UAAA;AAAA,QAAA,gBAAAV,EAACW,IAAA,EAAM,SAASlD,GAAA,CAAkB;AAAA,QACjC,CAACxC,MAAgB,gBAAA+E,EAACY,IAAA,EAAQ;AAAA,QAE3B,gBAAAZ,EAACa,IAAA,EAAW,SAASvF,EAAA,CAAa;AAAA,MAAA,EAAA,CACpC;AAAA,IAAA,GACF;AAAA,sBACCwF,IAAA,CAAA,CAAa;AAAA,EAAA,GAChB;AAEJ;AAEA,MAAMf,KAAgBgB,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOvBR,KAAcQ,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQrBP,KAAiBO,EAAO;AAAA;AAAA,GAIxBL,KAAkBK,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/order-view/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport OrderDetails from './order-details';\nimport Notes from './notes';\nimport SystemLogs from './system-event-logs/expanded-content';\nimport GeneralHeader from './general-information';\nimport ProductsInfo from './products-info';\nimport OrderActions from './order-actions';\nimport {\n DocumentTitle,\n useApiHook,\n useAxios,\n} from '@bjsdistribution/dms-component-library';\nimport {\n useOrderDetails,\n // useOrderStaticData,\n useStatusDetails,\n useOrderId,\n useDepotOptions,\n usePrevOrderDetails,\n useOrderProductsResources,\n useCustomerInfo,\n useLocationOptions,\n useOrderProductSystemLogs,\n useGsitCUstomerId,\n useCUstomerId,\n useRouteId,\n useGsitOrderId,\n useOrderProductId,\n useLiveRecalling,\n useGlobalStateHitOrder,\n useAtom,\n usegetClientData,\n useGlobalEscData,\n useEpodImages,\n skeletonTomTom,\n} from './store';\nimport { OrdersType } from './types';\nimport { useLocation, useNavigate } from 'react-router-dom';\nimport { message, notification } from 'antd';\nimport DetailsFilters from './details-filters/DetailsFilters';\nimport {\n useClientPortal,\n useIsShowNorthSouth,\n useSubContracterData,\n} from '../store';\nimport Notification from './notification';\nimport Order from './order-resources/expanded-content';\nimport { setResourcesCall, useAllOrderStatus } from './order-actions/store';\nimport { ClientType } from '../order-daily-overview/common/interface';\nimport { POSTCODE_LABEL } from '../../common/utils';\nimport { getEnvironment } from './utils';\nimport Toolbox from './toolbox-resources/expanded-content';\n\ninterface ApiResponse {\n message: string;\n code: number;\n error: string | null;\n error_traceback: string | null;\n data: [];\n setShouldPerformAction: boolean;\n}\n\nfunction OrderView({ locationloading }: any) {\n notification.config({\n top: 150,\n });\n const [orderId, setOrderId] = useOrderId();\n const [gsitOrderId, setGsitOrderId] = useGsitOrderId();\n // For API Call\n const [orderDetails, setOrderDetails] = useOrderDetails();\n const [, setPrevOrderDetails] = usePrevOrderDetails();\n const [, setLoading] = useState<boolean>(false);\n const [, setOrderStatus] = useStatusDetails();\n const [, setDepotOptions] = useDepotOptions();\n const [customerInfo, setCustomerInfo] = useCustomerInfo();\n const [, setLocationOptions] = useLocationOptions();\n const [orderResources, setOrderResources] = useOrderProductsResources();\n const [GsitCUstomerId, setGsitCUstomerId] = useGsitCUstomerId();\n const [, setOrderProductId] = useOrderProductId();\n const [, setCUstomerId] = useCUstomerId();\n const [, setRouteId] = useRouteId();\n const [liveRecalling] = useLiveRecalling();\n const [, setSubContracterData] = useSubContracterData();\n const [recallOrders] = useGlobalStateHitOrder();\n const [, setStatusVal] = useAllOrderStatus();\n const order_id = orderDetails?.id;\n const [getResources] = useAtom(setResourcesCall);\n const [, setClientData] = usegetClientData();\n const [, setGlobalEscData] = useGlobalEscData();\n const [, setIsNorthSouth] = useIsShowNorthSouth();\n const [, setEpodImages] = useEpodImages();\n const [, setSkeletonTomTom] = useAtom(skeletonTomTom);\n const [clientPortal] = useClientPortal();\n\n useEffect(() => {\n setStatusVal(orderDetails?.status_value);\n }, [orderDetails?.status_value]);\n\n //get system event logs\n const {\n data: fetchedSystemLogsData,\n fetchData: callSystemLogsAPI,\n loading: logsLoading,\n } = useAxios<{\n data: any[];\n }>({\n endpoint: `/events/get/event/`,\n method: 'GET',\n pagination: { page: 1, per_page: 100 },\n filters: [\n {\n field: 'order_id',\n op: '=',\n value: `${order_id}`,\n },\n ],\n showLoader: false,\n });\n\n // query param\n const location = useLocation();\n const navigate = useNavigate();\n const [filters, setFilters] = useState<\n Array<{ field: string; op: string; value: string | null }>\n >([]);\n\n // for third party apps\n const {\n data: fetchedDataExternal,\n loading: loadingExternal,\n setShouldPerformAction: setShouldPerformExternal,\n } = useApiHook<{\n data: any[];\n }>({\n endpoint: `orders/`,\n method: 'GET',\n filters: filters,\n performAction: false,\n });\n\n useEffect(() => {\n const searchParams = new URLSearchParams(location.search);\n if (searchParams?.toString()) {\n const dynamicFilters: Array<{\n field: string;\n op: string;\n value: string | null;\n }> = [];\n searchParams?.forEach((value, key) => {\n if (key === 'order') {\n dynamicFilters.push({\n field: 'gsit_order_id',\n op: '=',\n value: value,\n });\n } else {\n dynamicFilters.push({\n field: key,\n op: '=',\n value: value,\n });\n }\n });\n setFilters(dynamicFilters);\n if (filters) {\n setShouldPerformExternal(true);\n setOrderId(fetchedDataExternal?.data[0]?.id);\n }\n } else {\n const paths = location.pathname.split('/');\n setOrderId(paths[paths?.length - 1]);\n }\n }, [location.search, loadingExternal]);\n\n const {\n data: fetchedData,\n loading,\n setShouldPerformAction: orderUpdate,\n } = useApiHook<{\n data: OrdersType[];\n }>({\n endpoint: `orders/${orderId}`,\n method: 'GET',\n performAction: false,\n });\n\n //Order status api\n const {\n data: fetchedStatusData,\n loading: statusDataLoading,\n setShouldPerformAction: setLivePerformAction,\n } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `/orders/get_live_status/${orderId}`,\n method: 'GET',\n performAction: false,\n });\n const { data: fetchedDepotData, loading: depotDataLoading } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `/depot/`,\n method: 'GET',\n filters: [{ field: 'visibility', op: '=', value: true }],\n //@ts-ignore\n pagination: { is_pagination: false },\n });\n useEffect(() => {\n if (orderId) {\n orderUpdate(recallOrders);\n liveRecalling ? setLivePerformAction(false) : setLivePerformAction(true);\n }\n }, [orderId, liveRecalling, recallOrders]);\n\n useEffect(() => {\n setLoading(loading);\n if (fetchedData && fetchedData.data) {\n const requiredData = fetchedData?.data;\n\n if (requiredData[0]?.order_type?.type && requiredData[0]?.order_type?.type !== 'return') {\n navigate(`/orders/view/${orderId}`, { replace: true });\n return;\n }\n \n setOrderDetails(requiredData[0]);\n //@ts-ignore\n setCUstomerId(requiredData[0]?.customer_id);\n setRouteId(requiredData[0]?.order_routes?.route_id);\n //@ts-ignore\n setGsitOrderId(requiredData[0]?.gsit_order_id);\n //@ts-ignore\n setOrderProductId(requiredData[0]?.id);\n setCustomerInfo({\n recipient_name:\n requiredData[0]?.order_recipient?.recipient_name ?? null,\n postcode: requiredData[0]?.order_recipient?.postcode ?? null,\n return_action: requiredData[0]?.return_action ?? null,\n });\n\n setPrevOrderDetails(requiredData[0]);\n\n //dbSync Api call\n // if (fetchedData?.data[0]?.gsit_order_id) {\n // localStorage.setItem(\n // 'dbSyncAPICall',\n // JSON.stringify({\n // status: true,\n // gsit_orderId: fetchedData?.data[0]?.gsit_order_id,\n // })\n // );\n // } else {\n // localStorage.setItem('dbSyncAPICall', JSON.stringify({}));\n // }\n }\n // return () => {\n // localStorage.removeItem('dbSyncAPICall');\n // };\n }, [loading]);\n\n useEffect(() => {\n setLoading(statusDataLoading);\n if (fetchedStatusData && fetchedStatusData.data) {\n const requiredData = fetchedStatusData?.data;\n if (requiredData) {\n setOrderStatus(requiredData);\n } else {\n // setOrderStatus(null);\n }\n }\n }, [statusDataLoading, fetchedStatusData]);\n\n const {\n fetchData: callCLientApi,\n loading: clientLoading,\n data: clientData,\n } = useAxios<{\n data: ClientType[];\n }>({\n endpoint: `/v1/client/list`,\n method: 'GET',\n });\n\n useEffect(() => {\n if (orderId) {\n callCLientApi();\n callEscalationApi();\n }\n }, [orderId]);\n\n useEffect(() => {\n if (clientData && clientData?.data) {\n const res = clientData?.data;\n setClientData(res);\n }\n }, [clientLoading]);\n\n useEffect(() => {\n setLoading(depotDataLoading);\n if (fetchedDepotData && fetchedDepotData.data) {\n const requiredData = fetchedDepotData?.data;\n if (requiredData.length > 0) {\n const options = requiredData?.map((x: any) => {\n return {\n label: x.name,\n value: x.id,\n };\n });\n setDepotOptions(options);\n } else {\n setDepotOptions([]);\n }\n }\n }, [depotDataLoading]);\n\n // Order resources\n const {\n data: fetchedResourcesData,\n setShouldPerformAction: setActions,\n loading: loadingResources,\n } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `/orders/${orderId}/order_resources/`,\n method: 'GET',\n performAction: false,\n showLoader: false,\n });\n\n useEffect(() => {\n if (orderId) {\n if (getResources) {\n setActions(false);\n setTimeout(() => {\n setActions(true);\n }, 200);\n } else {\n setActions(true);\n }\n }\n }, [orderId, setActions, getResources]);\n\n useEffect(() => {\n if (orderId) {\n setActions(true);\n }\n }, [orderId, setActions]);\n\n useEffect(() => {\n if (orderId) {\n setOrderResources(fetchedResourcesData);\n }\n }, [fetchedResourcesData, orderResources, setOrderResources]);\n\n //EPOD Images\n const {\n data: fetchedEpodImages,\n loading: epodLoading,\n fetchData: fetchEpodImages,\n } = useAxios<{\n data: ApiResponse[];\n }>({\n endpoint: `orders/${orderId}/epod_resources/?finance=false`,\n method: 'GET',\n });\n\n useEffect(() => {\n if (orderId) {\n fetchEpodImages();\n if (orderDetails?.order_recipient?.postcode != null) {\n callCheckPostcode({\n endPointQuery: `?postcode=${orderDetails?.order_recipient?.postcode}`,\n });\n }\n }\n }, [orderId]);\n\n useEffect(() => {\n if (fetchedEpodImages && fetchedEpodImages?.data) {\n //@ts-ignore\n const result = fetchedEpodImages?.data?.resources;\n setEpodImages(result);\n }\n setSkeletonTomTom(epodLoading);\n }, [epodLoading]);\n\n useEffect(() => {\n return () => {\n setGsitCUstomerId((prev: any) => ({ ...prev, id: undefined }));\n };\n }, []);\n\n const {\n data: fetchedLocationData,\n loading: dataLoading,\n setShouldPerformAction: shouldFetch,\n } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `/return_locations/?customer_id=${GsitCUstomerId?.id}`,\n method: 'GET',\n performAction: false,\n });\n\n useEffect(() => {\n if (GsitCUstomerId?.id) {\n shouldFetch(true);\n } else {\n shouldFetch(false);\n }\n }, [GsitCUstomerId]);\n\n useEffect(() => {\n if (fetchedLocationData && fetchedLocationData?.data) {\n const locationOptions = fetchedLocationData?.data?.map((item: any) => {\n return {\n label: item?.location_name + ', ' + item?.postcode,\n value: item?.token,\n is_default: item?.is_default === 'True' ? true : false,\n };\n });\n setLocationOptions(locationOptions);\n }\n }, [dataLoading]);\n const [, setSystemLogsEvents] = useOrderProductSystemLogs();\n\n useEffect(() => {\n if (fetchedSystemLogsData && fetchedSystemLogsData?.data) {\n setSystemLogsEvents(fetchedSystemLogsData?.data);\n }\n }, [logsLoading]);\n\n useEffect(() => {\n if (gsitOrderId) {\n callSystemLogsAPI();\n }\n return () => {\n setGsitOrderId(undefined);\n };\n }, [order_id]);\n\n const { data: fetchedSubcontractotData, loading: apiLoading } = useApiHook<{\n data: ApiResponse[];\n }>({\n endpoint: `/sub-contractor/sub_contractor/get/`,\n method: 'GET',\n });\n\n useEffect(() => {\n if (fetchedSubcontractotData && fetchedSubcontractotData?.data) {\n const formattedData = fetchedSubcontractotData?.data?.map(\n (item: any) => ({\n id: item.id,\n name: item.name,\n })\n );\n setSubContracterData(formattedData);\n }\n }, [fetchedSubcontractotData, fetchedSubcontractotData, apiLoading]);\n\n // ESCALATIONS API\n\n const {\n data: fetchedEscalationData,\n fetchData: callEscalationApi,\n loading: escalationDataLoading,\n } = useAxios<{\n data: any;\n }>({\n endpoint: `/orders/escalations/${orderId}`,\n method: 'GET',\n });\n\n useEffect(() => {\n if (fetchedEscalationData?.data) {\n const escalationData = fetchedEscalationData?.data;\n const sortedEscData = escalationData?.sort(\n (a: any, b: any) =>\n new Date(b?.created_at).getTime() - new Date(a?.created_at).getTime()\n );\n const showEsc = sortedEscData != null && sortedEscData.length > 0;\n showEsc ? setGlobalEscData(sortedEscData) : setGlobalEscData([]);\n }\n }, [escalationDataLoading]);\n\n const docTitle = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;\n const environment = getEnvironment();\n const { fetchData: callCheckPostcode } = useAxios<{\n data: ApiResponse[];\n }>({\n endpoint: `v1/orders/customs/postcode/check/`,\n method: 'GET',\n });\n\n //northern southern\n const callCheckPostcodeAPI = async () => {\n try {\n const response = await callCheckPostcode({\n endPointQuery: `?postcode=${orderDetails?.order_recipient?.postcode}`,\n });\n //@ts-ignore\n if (response?.code === 200) {\n //@ts-ignore\n const isNorthSouth = response?.data?.order_customs_postcodes;\n setIsNorthSouth(isNorthSouth);\n } else {\n message.open({\n type: 'error',\n //@ts-ignore\n content: response?.error || 'Something went wrong',\n });\n }\n } catch (err) {\n message.open({\n type: 'error',\n content: `Failed to check ${POSTCODE_LABEL.toLowerCase()}. Please try again.`,\n });\n }\n };\n const POSTCODE_REGEX = {\n UK: /\\b(?:[A-Za-z][A-HJ-Ya-hj-y]?[0-9][0-9A-Za-z]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})\\b/,\n IRISH: /^(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}$/,\n US: /^\\d{5}(-\\d{4})?$/,\n };\n const isDevelopmentOrStagingOrReleaseUK =\n environment === 'development' ||\n environment === 'staging' ||\n environment === 'release_uk';\n const isValidPostcode = (val: any) => {\n if (isDevelopmentOrStagingOrReleaseUK) {\n return POSTCODE_REGEX.UK.test(val) || POSTCODE_REGEX.IRISH.test(val);\n } else {\n return POSTCODE_REGEX.US.test(val);\n }\n };\n const hasCalledInitialAPI = useRef(false);\n\n useEffect(() => {\n const currentPostcode = orderDetails?.order_recipient?.postcode?.trim();\n\n if (\n currentPostcode &&\n isValidPostcode(currentPostcode) &&\n !hasCalledInitialAPI.current\n ) {\n hasCalledInitialAPI.current = true;\n callCheckPostcodeAPI();\n }\n }, [orderDetails?.order_recipient?.postcode]);\n return (\n <MainContainer>\n <DocumentTitle title={docTitle} />\n <GeneralHeader statusDataLoading={statusDataLoading} />\n\n <DetailsFilters />\n <Notification />\n <OrderDetails\n orderLoading={loading}\n depotDataLoading={depotDataLoading}\n />\n <ProductsInfo locationloading={locationloading} />\n <SplitLayout>\n <NotesContainer>\n <Notes />\n </NotesContainer>\n <TablesContainer>\n <Order loading={loadingResources} />\n {!clientPortal && <Toolbox />}\n\n <SystemLogs loading={logsLoading} />\n </TablesContainer>\n </SplitLayout>\n <OrderActions />\n </MainContainer>\n );\n}\n\nconst MainContainer = styled.div`\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding-bottom: 30px;\n`;\n\nconst SplitLayout = styled.div`\n display: flex;\n gap: 15px;\n @media (max-width: 1024px) {\n display: contents;\n }\n`;\n\nconst NotesContainer = styled.div`\n flex: 1;\n`;\n\nconst TablesContainer = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 15px;\n`;\n\nexport default OrderView;\n"],"names":["OrderView","locationloading","notification","orderId","setOrderId","useOrderId","gsitOrderId","setGsitOrderId","useGsitOrderId","orderDetails","setOrderDetails","useOrderDetails","setPrevOrderDetails","usePrevOrderDetails","setLoading","useState","setOrderStatus","useStatusDetails","setDepotOptions","useDepotOptions","customerInfo","setCustomerInfo","useCustomerInfo","setLocationOptions","useLocationOptions","orderResources","setOrderResources","useOrderProductsResources","GsitCUstomerId","setGsitCUstomerId","useGsitCUstomerId","setOrderProductId","useOrderProductId","setCUstomerId","useCUstomerId","setRouteId","useRouteId","liveRecalling","useLiveRecalling","setSubContracterData","useSubContracterData","recallOrders","useGlobalStateHitOrder","setStatusVal","useAllOrderStatus","order_id","getResources","useAtom","setResourcesCall","setClientData","usegetClientData","setGlobalEscData","useGlobalEscData","setIsNorthSouth","useIsShowNorthSouth","setEpodImages","useEpodImages","setSkeletonTomTom","skeletonTomTom","clientPortal","useClientPortal","useEffect","fetchedSystemLogsData","callSystemLogsAPI","logsLoading","useAxios","location","useLocation","navigate","useNavigate","filters","setFilters","fetchedDataExternal","loadingExternal","setShouldPerformExternal","useApiHook","searchParams","dynamicFilters","value","key","paths","fetchedData","loading","orderUpdate","fetchedStatusData","statusDataLoading","setLivePerformAction","fetchedDepotData","depotDataLoading","requiredData","callCLientApi","clientLoading","clientData","callEscalationApi","res","options","x","fetchedResourcesData","setActions","loadingResources","fetchedEpodImages","epodLoading","fetchEpodImages","callCheckPostcode","result","prev","fetchedLocationData","dataLoading","shouldFetch","locationOptions","item","setSystemLogsEvents","useOrderProductSystemLogs","fetchedSubcontractotData","apiLoading","formattedData","fetchedEscalationData","escalationDataLoading","sortedEscData","a","b","showEsc","docTitle","environment","getEnvironment","callCheckPostcodeAPI","response","isNorthSouth","message","POSTCODE_LABEL","POSTCODE_REGEX","isDevelopmentOrStagingOrReleaseUK","isValidPostcode","val","hasCalledInitialAPI","useRef","currentPostcode","MainContainer","jsx","DocumentTitle","GeneralHeader","DetailsFilters","Notification","OrderDetails","ProductsInfo","SplitLayout","NotesContain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3B,gBAAAZ,EAACa,IAAA,EAAW,SAASvF,EAAA,CAAa;AAAA,MAAA,EAAA,CACpC;AAAA,IAAA,GACF;AAAA,sBACCwF,IAAA,CAAA,CAAa;AAAA,EAAA,GAChB;AAEJ;AAEA,MAAMf,KAAgBgB,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOvBR,KAAcQ,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQrBP,KAAiBO,EAAO;AAAA;AAAA,GAIxBL,KAAkBK,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": " 0.1.93-prod",
2
+ "version": "0.1.94-prod",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
@@ -88,4 +88,4 @@
88
88
  "react-switch-selector": "^2.2.1",
89
89
  "uuid": "^10.0.0"
90
90
  }
91
- }
91
+ }