@feedmepos/mf-inventory-portal 1.3.14-dev.2 → 1.3.14

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 (105) hide show
  1. package/dist/App-BQZQFNKG.js +411 -0
  2. package/dist/{ApprovalView-CfF2FqsE.js → ApprovalView-BVszC4Cw.js} +12 -12
  3. package/dist/{BindingsDialog-H-juP-az.js → BindingsDialog-B3L_3xdo.js} +13 -13
  4. package/dist/{BindingsPicker-ClruHF7p.js → BindingsPicker-A4togB2v.js} +2 -2
  5. package/dist/{BindingsTable-Bx9pbFOO.js → BindingsTable-DacoMdY6.js} +3 -3
  6. package/dist/{ClosingDraftView-DN97Tao5.js → ClosingDraftView-C9tvMgLl.js} +16 -16
  7. package/dist/{ClosingHistoryView-DsRYUqa2.js → ClosingHistoryView-CqqzqSqU.js} +5 -5
  8. package/dist/{ClosingTemplateView-f9zfsxCu.js → ClosingTemplateView-CLi0XE8S.js} +15 -15
  9. package/dist/{DeliveryOrderPrintPreview-BMK4kBCQ.js → DeliveryOrderPrintPreview-DEHEfd80.js} +11 -11
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bqj_Ygmo.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BDZVaj3l.js} +16 -16
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CK1ha_AY.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-xxS4P6uo.js} +2 -2
  12. package/dist/{FmMultiselectDialog-BazT9oUX.js → FmMultiselectDialog-CR2peMEL.js} +1 -1
  13. package/dist/{FmMultiselectDialog-_gUuhudi.js → FmMultiselectDialog-FGR8t9rz.js} +16 -16
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BBtAgdsA.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DgXOsVLe.js} +4 -4
  15. package/dist/{ImportView-jpkwuCXO.js → ImportView-CEI0QqGz.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DLJnF4do.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-cRgKjHY0.js} +1 -1
  17. package/dist/{IngredientGroupView-x3t1hyNn.js → IngredientGroupView-DEELNMpl.js} +6 -6
  18. package/dist/{IngredientsView-BzWTnlb4.js → IngredientsView-D3OcjZdT.js} +16 -16
  19. package/dist/{IntegrationExplorerView-Bca3owbx.js → IntegrationExplorerView-ByPpT3hC.js} +5 -5
  20. package/dist/{IntegrationView-Dh1c4Qyo.js → IntegrationView-BSqlJBp-.js} +81 -81
  21. package/dist/{InventoryBindingForm-B1sI1TGZ.js → InventoryBindingForm-SgmyJvCs.js} +1 -1
  22. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-7NeE7Xos.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-GLipe2bO.js} +5 -5
  23. package/dist/{InventoryBindingSummary-R8zHPc52.js → InventoryBindingSummary-D6deGR6B.js} +1 -1
  24. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DMJVh7Nt.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DGDL-t7m.js} +1 -1
  25. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-ChC9sEIk.js → PremiumBadge.vue_vue_type_script_setup_true_lang-ff1rPUJW.js} +7 -7
  26. package/dist/{PublishView-Bqp8Ww4J.js → PublishView-7TAa2QQB.js} +15 -15
  27. package/dist/{PurchaseOrderPrintPreview-D7TCn8U-.js → PurchaseOrderPrintPreview-DhcnInSW.js} +11 -11
  28. package/dist/ReceiveRequestView-Z3JYH3gf.js +36203 -0
  29. package/dist/{RecipeView-D8Mvgji9.js → RecipeView--ALwYD-O.js} +16 -16
  30. package/dist/{SettingsView-BJScLK9z.js → SettingsView-F_BWUxoq.js} +4 -4
  31. package/dist/StockView-BLrquJf2.js +2406 -0
  32. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DUKv_LV6.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CxNgi5uv.js} +1 -1
  33. package/dist/{SupplierView-DdBBIV8W.js → SupplierView-DklOXwHD.js} +13 -13
  34. package/dist/{SurchargeView-DisBUPIs.js → SurchargeView-DcImorUr.js} +17 -17
  35. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CZ3Q3BAf.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-xdLxGAOM.js} +2 -2
  36. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CC7F5HVc.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Bu4XKhII.js} +1 -1
  37. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DMrRfwKD.js +3890 -0
  38. package/dist/{TransferTemplateView-7ICJMF9z.js → TransferTemplateView-DTdlSI2b.js} +18 -18
  39. package/dist/{UnitCostHistoryView-BMRDBQ58.js → UnitCostHistoryView-CQ_DJE-t.js} +243 -246
  40. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-mNXHzLN3.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-QuejzcCL.js} +4 -4
  41. package/dist/{UnitView-uUUYOjYn.js → UnitView-DzcCdCGw.js} +8 -8
  42. package/dist/{WarehouseView-BfMf_iuj.js → WarehouseView-BYj9DD1N.js} +26 -26
  43. package/dist/{WastageTemplateView-BQYjJGZ-.js → WastageTemplateView--w6an2Ar.js} +15 -15
  44. package/dist/api/email.d.ts +54 -0
  45. package/dist/{app-B_zMegJc.js → app-CPlgHGkC.js} +22314 -23519
  46. package/dist/app.d.ts +14 -22
  47. package/dist/app.js +2 -2
  48. package/dist/{closing-template-9vhx5Ji1.js → closing-template-B9JOB9ah.js} +1 -1
  49. package/dist/components/row-action.enum.d.ts +2 -1
  50. package/dist/{date2-BMCS_Dsc.js → date2-Ci9tlLMJ.js} +1 -1
  51. package/dist/{dayjs.min-Dl26OaXo.js → dayjs.min-DTx2lmq6.js} +26 -26
  52. package/dist/{decimal-e6OK2jkR.js → decimal-iKhH_VJO.js} +2 -2
  53. package/dist/{defineDeepModel-BvLlwxnd.js → defineDeepModel-C25T8oyP.js} +1 -1
  54. package/dist/{duplicate-template-Cnhu8Rxw.js → duplicate-template-BptIBRQ3.js} +1 -1
  55. package/dist/{empty-placeholder-B0QU467o.js → empty-placeholder-wf6-BWE8.js} +1 -1
  56. package/dist/{export-CGvyGmeo.js → export-CKuVd5pP.js} +1 -1
  57. package/dist/{feature-Do41WWzx.js → feature-CXMSo4z7.js} +121 -116
  58. package/dist/{format-time-from-id-CqX_KaUG.js → format-time-from-id-Bk60g6lh.js} +1 -1
  59. package/dist/{format-unit-display-D8qWmRXP.js → format-unit-display-C4nf8hG8.js} +12 -12
  60. package/dist/{import-export.helper-85V8Ib5e.js → import-export.helper-BDzsQcYD.js} +6 -6
  61. package/dist/{index-C-CwnjUn.js → index-CUVlQagt.js} +3 -3
  62. package/dist/{index-CtUF9Nsv.js → index-DTszDSPO.js} +1 -1
  63. package/dist/{index-Cg3aLEhT.js → index-DiKOwY5C.js} +1 -1
  64. package/dist/{inventory-core-dart.default-B64FzAla.js → inventory-core-dart.default-Cn3sonot.js} +10 -10
  65. package/dist/{lodash-U9ycVPlv.js → lodash-DGOK6ZkA.js} +1 -1
  66. package/dist/{lz-string-0CgVsQoC.js → lz-string-QrWbdmw6.js} +21 -21
  67. package/dist/{netsuite-Du7-sXJt.js → netsuite-DglgyKcZ.js} +37 -37
  68. package/dist/{number-iJAzDfmj.js → number-Ut7u2ZEE.js} +11 -11
  69. package/dist/{predefined-templates-LlSrXOXm.js → predefined-templates-DZtFebPU.js} +1 -1
  70. package/dist/{purchase-order-template-DFuXb0rr.js → purchase-order-template-DhNVhXmD.js} +1 -1
  71. package/dist/{recalculationUtils-DWPnMW1G.js → recalculationUtils-CqJRd9B2.js} +1 -1
  72. package/dist/router/name.d.ts +0 -1
  73. package/dist/{row-action.enum-Co_O4qD9.js → row-action.enum-DQ9bJ_uv.js} +7 -1
  74. package/dist/{rules-DefSKiUN.js → rules-BIm67nl_.js} +2 -2
  75. package/dist/{stock-BfF6peMd.js → stock-CzdMn9n8.js} +3 -3
  76. package/dist/{stock-Cx1BwdWs.js → stock-Dc4_U69J.js} +27 -28
  77. package/dist/stores/feature.d.ts +2 -0
  78. package/dist/{supplier-CU3iqdGr.js → supplier-De5G6CeF.js} +2 -2
  79. package/dist/{surcharge-D77J5opH.js → surcharge-CN5FtDZq.js} +8 -8
  80. package/dist/tsconfig.app.tsbuildinfo +1 -1
  81. package/dist/{use-ingredient-select-dialog-B-jxV-79.js → use-ingredient-select-dialog-Wy4CtYcZ.js} +2 -2
  82. package/dist/{use-inventory-binding-dialog-BdTd5qPl.js → use-inventory-binding-dialog-C1LCH0jV.js} +2 -2
  83. package/dist/{use-template-enabled-locations-vFvaCjlH.js → use-template-enabled-locations-BfZFcXZ_.js} +2 -2
  84. package/dist/views/receive-request/components/email-dialog/EmailDialog.vue.d.ts +20 -0
  85. package/dist/views/receive-request/components/email-dialog/EmailDialogProps.d.ts +13 -0
  86. package/dist/views/receive-request/composables/use-order-draft-permission.d.ts +5 -2
  87. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +3 -0
  88. package/dist/vue-i18n-CvVV4Xof.js +2365 -0
  89. package/dist/{xlsx-o7n1whCa.js → xlsx-lawW6Hwh.js} +570 -570
  90. package/dist/{xlsx.util-D6nPboPW.js → xlsx.util-DSCqPt8v.js} +1 -1
  91. package/package.json +2 -2
  92. package/dist/App-D1_jkD6L.js +0 -309
  93. package/dist/DefaultView-COVVxOrF.js +0 -31
  94. package/dist/ReceiveRequestView-oNBVAMYu.js +0 -2817
  95. package/dist/StockView-CRRdVCcD.js +0 -2439
  96. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BLlg1Vka.js +0 -3837
  97. package/dist/components/HrmPermissionGuard.vue.d.ts +0 -54
  98. package/dist/composable/useHrmPermission.d.ts +0 -17
  99. package/dist/composable/useInventoryAccess.d.ts +0 -11
  100. package/dist/composable/useNavigationMenu.d.ts +0 -14
  101. package/dist/router/route-permission.d.ts +0 -10
  102. package/dist/useHrmPermission-CekUhyck.js +0 -16
  103. package/dist/useNavigationMenu-BiLWMIip.js +0 -162
  104. package/dist/views/DefaultView.vue.d.ts +0 -2
  105. package/dist/vue-i18n-C3_OsgSl.js +0 -2365
@@ -1,3837 +0,0 @@
1
- import { defineComponent as Oe, ref as W, watch as et, nextTick as Zt, openBlock as l, createBlock as ie, Teleport as er, createElementBlock as v, withModifiers as tr, createElementVNode as e, normalizeClass as Pe, toDisplayString as d, createCommentVNode as j, unref as m, withDirectives as rr, vModelText as sr, toRaw as or, shallowRef as Tt, onUnmounted as nr, triggerRef as ar, computed as Z, readonly as lr, h as z, reactive as ir, onMounted as Ut, resolveComponent as X, withCtx as oe, createVNode as L, Fragment as fe, renderList as ke, createTextVNode as Ee, renderSlot as cr, isRef as ur, resolveDynamicComponent as dr } from "vue";
2
- import { f as mr, h as pr, r as fr, s as yr } from "./predefined-templates-LlSrXOXm.js";
3
- import { f as tt, p as vr } from "./format-time-from-id-CqX_KaUG.js";
4
- import { c as Ft } from "./component-kqxARxvM.js";
5
- import { D as xe, R as ue } from "./row-action.enum-Co_O4qD9.js";
6
- import { G as We, m as br, u as Te, W as N, X as lt, P as ae, a as hr, Y as It, Z as gr, _ as _r, E as xr, c as Bt, s as ht, q as De, K as qt, $ as zt, r as Xe, B as st, w as Ue, C as Me } from "./app-B_zMegJc.js";
7
- import { j as Sr, c as Or, a as be, t as ot, d as Qe } from "./number-iJAzDfmj.js";
8
- import { F as wr } from "./decimal-e6OK2jkR.js";
9
- import { h as gt, t as Cr, d as Dr, a as Ze } from "./date2-BMCS_Dsc.js";
10
- import { F as Je, c as $r, a as dt } from "./inventory-core-dart.default-B64FzAla.js";
11
- import { L as kr } from "./lz-string-0CgVsQoC.js";
12
- import { useI18n as it, useCoreStore as _t } from "@feedmepos/mf-common";
13
- import { u as ct, a as xt, S as Ne } from "./netsuite-Du7-sXJt.js";
14
- import { useDialog as ut, useSnackbar as Ke, components as nt, FmButtonVariant as Ce, useProxiedModel as Rr } from "@feedmepos/ui-library";
15
- import { F as ze } from "./FmAdminBadge-DjnBAgyv.js";
16
- import { u as Ve } from "./feature-Do41WWzx.js";
17
- import { _ as Nr } from "./empty-placeholder-B0QU467o.js";
18
- import { u as Ar, a as Pr, f as Tr } from "./format-unit-display-D8qWmRXP.js";
19
- import { u as He, _ as Fr } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-CZ3Q3BAf.js";
20
- import { _ as Ir, a as qr, b as Er } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-BBtAgdsA.js";
21
- import { u as Vr, R as Et } from "./usePromise-CbVUCxhj.js";
22
- import { c as Lr } from "./index-C-CwnjUn.js";
23
- import { i as jr } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CK1ha_AY.js";
24
- import { F as Vt } from "./form-mode.enum-BKiNVH6A.js";
25
- import { u as Mr } from "./supplier-CU3iqdGr.js";
26
- import { u as Ur } from "./surcharge-D77J5opH.js";
27
- import { d as Kt } from "./defineDeepModel-BvLlwxnd.js";
28
- import { u as Br } from "./vue-i18n-C3_OsgSl.js";
29
- import { u as zr } from "./useHrmPermission-CekUhyck.js";
30
- function Ht(f, r) {
31
- return r.reduce(
32
- (i, c) => {
33
- const n = c.received.find((p) => p.sku._id === f._id);
34
- return n && (i = Sr(i, n.amount)), i;
35
- },
36
- wr.toPrecision(Or(0), f.unit.precision)
37
- );
38
- }
39
- function Kr(f) {
40
- const { po: r, currentLocation: s, business: i, fulfilling: c, por: n } = f, { name: p, address: t, regNo: a, legalName: b } = s.doc.profile, y = {
41
- name: p,
42
- legalName: b || void 0,
43
- registrationNumber: a || void 0,
44
- line1: (t == null ? void 0 : t.line1) || "",
45
- line2: (t == null ? void 0 : t.line2) || void 0,
46
- postcode: (t == null ? void 0 : t.postcode) || "",
47
- city: (t == null ? void 0 : t.city) || "",
48
- state: (t == null ? void 0 : t.state) || "",
49
- country: (t == null ? void 0 : t.country) || ""
50
- }, x = {
51
- name: r.supplier.name,
52
- phoneNumber: r.supplier.phoneNumber || void 0,
53
- registrationNumber: r.supplier.registrationNumber || void 0,
54
- line1: r.supplier.address.line1,
55
- line2: r.supplier.address.line2 || void 0,
56
- postcode: r.supplier.address.postcode,
57
- city: r.supplier.address.city,
58
- state: r.supplier.address.state,
59
- country: r.supplier.address.country
60
- }, _ = r.items.map((k) => {
61
- const { sku: Y, measurement: A } = k, T = be(
62
- Ht(k.sku, r.deliveryOrder || []),
63
- !1
64
- );
65
- return {
66
- code: Y.code,
67
- description: Y.name,
68
- quantity: be(k.quantity, !1),
69
- unit: (A == null ? void 0 : A.abbrev) || Y.unit.abbrev,
70
- received: T,
71
- unitCost: k.totalCost ? `${k.totalCost.currency} ${Je.toFormatString({
72
- value: k.quantity.amount === 0 ? Je.fromNumber(0) : Je.divide([k.totalCost, k.quantity])
73
- })}` : void 0,
74
- cost: k.totalCost ? `${k.totalCost.currency} ${Je.toFormatString({
75
- value: k.totalCost
76
- })}` : void 0
77
- };
78
- }), C = r.deliveryOrder.map((k) => ({
79
- createdAt: gt(new Date(k.createdAt)),
80
- ref: k.deliveryOrderNumber,
81
- remark: k.remark || "",
82
- items: k.received.map((Y) => {
83
- var A;
84
- return {
85
- code: Y.sku.code,
86
- description: Y.sku.name,
87
- quantity: be(Y.amount),
88
- unit: ((A = Y.measurement) == null ? void 0 : A.abbrev) || Y.sku.unit.abbrev
89
- };
90
- })
91
- }));
92
- let h = We.Enum.purchaseOrder, M = "Inventory Receive Note";
93
- if (r.supplier.internal ? (M = "Inventory Transfer Note", h = We.Enum.transferOrder) : (M = "Purchase Order", h = We.Enum.purchaseOrder), n) {
94
- const k = n.from.dbName;
95
- s.dbName === k || (M = "Inventory Receive Note", h = We.Enum.goodsReceivedNote);
96
- }
97
- const U = {
98
- title: M,
99
- businessName: i == null ? void 0 : i.name,
100
- logo: i == null ? void 0 : i.thumbnail,
101
- orderNumber: r.seqNumber.toString(),
102
- createdAt: tt(r._id),
103
- ref: r.ref || "",
104
- remark: r.remark || "",
105
- buyer: y,
106
- supplier: x,
107
- items: _,
108
- status: r.status,
109
- deliveryOrders: C
110
- }, O = c && (r.deliveryFullfillment || []).length > 0;
111
- return O && (h = We.Enum.deliveryOrder), { printData: U, templateType: h, isDeliveryPrint: O };
112
- }
113
- function Hr(f) {
114
- var y;
115
- const { printData: r, templateType: s } = Kr(f), c = mr().getTemplateByType(s), n = !!((y = c == null ? void 0 : c.blocks) != null && y.length), p = pr(s), t = n ? c.blocks : p.blocks, a = n ? c.name : p.name, b = !n;
116
- try {
117
- const x = fr(t, r), _ = x.match(/<style>([\s\S]*?)<\/style>/), C = _ ? `<style>${_[1]}</style>` : "", h = x.replace(/<style>[\s\S]*?<\/style>/, "");
118
- return {
119
- html: `<!DOCTYPE html>
120
- <html>
121
- <head>
122
- <meta charset="utf-8">
123
- <title>Print Preview</title>
124
- <style>
125
- @page { margin: 0; }
126
- @media print {
127
- body { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
128
- }
129
- * { box-sizing: border-box; margin: 0; padding: 0; }
130
- </style>
131
- ${C}
132
- </head>
133
- <body>${h}</body>
134
- </html>`,
135
- templateName: a,
136
- isDefault: b
137
- };
138
- } catch {
139
- return alert("Failed to render print template. Please try recreating the template."), null;
140
- }
141
- }
142
- const Gr = { class: "w-[95vw] h-[95vh] bg-white rounded-lg flex flex-col shadow-2xl overflow-hidden" }, Wr = { class: "flex justify-between items-center px-16 py-3 border-b border-gray-200 bg-gray-50" }, Yr = { class: "flex items-center gap-2.5" }, Qr = {
143
- key: 1,
144
- class: "text-xs text-gray-100 bg-gray-500 px-2 py-0.5 rounded font-medium"
145
- }, Jr = { class: "flex-1 overflow-auto bg-gray-100" }, _l = /* @__PURE__ */ Oe({
146
- __name: "CustomPrintTemplatePreview",
147
- props: {
148
- html: {},
149
- modelValue: { type: Boolean },
150
- templateName: {},
151
- isDefault: { type: Boolean }
152
- },
153
- emits: ["update:modelValue"],
154
- setup(f, { emit: r }) {
155
- const s = f, i = r, c = W(null);
156
- function n() {
157
- i("update:modelValue", !1);
158
- }
159
- function p() {
160
- var a, b;
161
- try {
162
- (b = (a = c.value) == null ? void 0 : a.contentWindow) == null || b.print();
163
- } catch {
164
- alert("Failed to trigger print.");
165
- }
166
- }
167
- et(
168
- () => s.modelValue,
169
- async (a) => {
170
- a && (await Zt(), t(), setTimeout(() => {
171
- p();
172
- }, 300));
173
- }
174
- );
175
- function t() {
176
- var x;
177
- const a = c.value;
178
- if (!a) return;
179
- const b = yr(s.html), y = a.contentDocument || ((x = a.contentWindow) == null ? void 0 : x.document);
180
- y && (y.open(), y.write(`
181
- <!DOCTYPE html>
182
- <html>
183
- <head>
184
- <meta charset="utf-8">
185
- <meta http-equiv="Content-Security-Policy" content="
186
- default-src 'none';
187
- style-src 'unsafe-inline';
188
- img-src 'self' data: https:;
189
- font-src 'self' data:;
190
- script-src 'none';
191
- object-src 'none';
192
- frame-src 'none';
193
- base-uri 'none';
194
- form-action 'none';
195
- ">
196
- <style>
197
- * {
198
- box-sizing: border-box;
199
- }
200
- body {
201
- margin: 0;
202
- padding: 40px 20px;
203
- background: #f0f0f0;
204
- min-height: 100vh;
205
- }
206
- .print-container {
207
- max-width: 800px;
208
- margin: 0 auto;
209
- padding: 30px;
210
- border: 1px solid #ddd;
211
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
212
- background: #ffffff;
213
- font-size: 16px;
214
- line-height: 1.5;
215
- font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
216
- color: #555;
217
- }
218
- @media print {
219
- body {
220
- background: white !important;
221
- padding: 0 !important;
222
- margin: 0 !important;
223
- }
224
- .print-container {
225
- border: none !important;
226
- box-shadow: none !important;
227
- padding: 0 !important;
228
- margin: 0 !important;
229
- max-width: none !important;
230
- }
231
- }
232
- </style>
233
- </head>
234
- <body>
235
- <div class="print-container">
236
- ${b}
237
- </div>
238
- </body>
239
- </html>
240
- `), y.close());
241
- }
242
- return (a, b) => (l(), ie(er, { to: "body" }, [
243
- a.modelValue ? (l(), v("div", {
244
- key: 0,
245
- class: "fixed inset-0 z-[9999] bg-black/50 flex justify-center items-center",
246
- onClick: tr(n, ["self"])
247
- }, [
248
- e("div", Gr, [
249
- e("div", Wr, [
250
- e("div", Yr, [
251
- b[0] || (b[0] = e("span", { class: "text-base font-semibold text-gray-700" }, "Print Preview", -1)),
252
- a.templateName ? (l(), v("span", {
253
- key: 0,
254
- class: Pe(["text-xs font-medium px-2 py-0.5 rounded", a.isDefault ? "text-gray-500 bg-gray-100" : "text-blue-700 bg-blue-50"])
255
- }, d(a.templateName), 3)) : j("", !0),
256
- a.isDefault ? (l(), v("span", Qr, "Default")) : j("", !0)
257
- ]),
258
- e("div", { class: "flex gap-2 items-center" }, [
259
- e("button", {
260
- class: "px-8 py-1.5 bg-blue-500 text-white border-none rounded text-sm cursor-pointer hover:bg-blue-700",
261
- onClick: p
262
- }, " Print "),
263
- e("button", {
264
- class: "px-2.5 py-1 bg-transparent border border-gray-300 rounded text-xl leading-none cursor-pointer text-gray-500 hover:bg-gray-100",
265
- onClick: n
266
- }, " × ")
267
- ])
268
- ]),
269
- e("div", Jr, [
270
- e("iframe", {
271
- ref_key: "iframeRef",
272
- ref: c,
273
- class: "w-full h-full border-none",
274
- sandbox: "allow-same-origin allow-modals"
275
- }, null, 512)
276
- ])
277
- ])
278
- ])) : j("", !0)
279
- ]));
280
- }
281
- }), Xr = br((f, r) => {
282
- const s = Te();
283
- return {
284
- async getShipments({
285
- start: i,
286
- end: c
287
- }) {
288
- const n = s.currentLocationDBName, p = `${f.inventoryBackendUrl}/${n}/shipments`;
289
- return await r.get(`${p}?start=${i}&end=${c}`);
290
- },
291
- async getShipmentsByIds(i) {
292
- if (i.length === 0)
293
- return [];
294
- const c = s.currentLocationDBName, n = `${f.inventoryBackendUrl}/${c}/shipments/get`;
295
- return await r.post(n, { shipmentIds: i });
296
- }
297
- };
298
- }), Gt = {
299
- [N.enum.confirmDraft]: {
300
- primaryActions: {
301
- text: "Confirm draft",
302
- close: !0
303
- },
304
- title: "Confirm draft?",
305
- message: "Purchase order cannot be changed after confirm draft.",
306
- successMessage: "Purchase order draft has been confirmed"
307
- },
308
- [N.enum.cancelDraft]: {
309
- primaryActions: {
310
- text: "Cancel draft",
311
- close: !0,
312
- variant: "destructive"
313
- },
314
- title: "Cancel draft?",
315
- message: "Purchase order cannot be changed after cancelled draft.",
316
- successMessage: "Purchase order draft has been cancelled"
317
- },
318
- [N.enum.approveDraft]: {
319
- primaryActions: {
320
- text: "Approve draft",
321
- close: !0
322
- },
323
- title: "Approve draft?",
324
- message: "Purchase order request will be accepted.",
325
- successMessage: "Purchase order has been approved"
326
- },
327
- [N.enum.rejectDraft]: {
328
- primaryActions: {
329
- text: "Reject draft",
330
- close: !0
331
- },
332
- title: "Reject draft?",
333
- message: "Purchase order request will be rejected. You may provide an optional reason for rejection.",
334
- successMessage: "Purchase order has been rejected"
335
- },
336
- [N.enum.submitRequest]: {
337
- primaryActions: {
338
- text: "Submit request",
339
- close: !0
340
- },
341
- title: "Confirm draft?",
342
- message: "Purchase order cannot be changed after confirm draft.",
343
- successMessage: "Purchase order draft has been submitted"
344
- },
345
- [N.enum.completeReceive]: {
346
- primaryActions: {
347
- text: "Mark received",
348
- close: !0
349
- },
350
- title: "Mark as received",
351
- message: "Purchase order cannot be changed after it has complete receiving.",
352
- successMessage: "Purchase order has been marked as received"
353
- },
354
- [N.enum.approveRequest]: {
355
- primaryActions: {
356
- text: "Accept request",
357
- close: !0
358
- },
359
- title: "Accept request?",
360
- message: "Transfer out request will be accepted.",
361
- successMessage: "Transfer out request has been approved"
362
- },
363
- [N.enum.rejectRequest]: {
364
- primaryActions: {
365
- text: "Reject request",
366
- close: !0,
367
- variant: "destructive"
368
- },
369
- title: "Reject request?",
370
- message: "Purchase order will be rejected.",
371
- successMessage: "Purchase order has been rejected"
372
- },
373
- [N.enum.processRequest]: {
374
- primaryActions: {
375
- text: "Process request",
376
- close: !0,
377
- variant: "destructive"
378
- },
379
- title: "Process request?",
380
- message: "Purchase order will be processed.",
381
- successMessage: "Purchase order has been processed"
382
- }
383
- }, Zr = { class: "p-4" }, es = {
384
- key: 0,
385
- class: "fm-typo-en-body-md-400 mb-3"
386
- }, ts = { class: "fm-typo-en-body-md-400" }, Wt = /* @__PURE__ */ Oe({
387
- __name: "RejectDraftForm",
388
- props: {
389
- message: {},
390
- confirm: { type: Function },
391
- onChange: { type: Function }
392
- },
393
- setup(f) {
394
- const r = f, { t: s } = it(), i = W("");
395
- et(i, (n) => {
396
- var p;
397
- (p = r.onChange) == null || p.call(r, n ?? "");
398
- });
399
- function c() {
400
- i.value = "";
401
- }
402
- return (n, p) => (l(), v("div", Zr, [
403
- r.message ? (l(), v("div", es, d(r.message), 1)) : j("", !0),
404
- e("label", ts, d(m(s)("inventory.transfer.receiveRequest.details.rejectionReason")) + " (" + d(m(s)("inventory.common.optional")) + ")", 1),
405
- rr(e("textarea", {
406
- "onUpdate:modelValue": p[0] || (p[0] = (t) => i.value = t),
407
- rows: "4",
408
- class: "w-full mt-2 p-2 border rounded"
409
- }, null, 512), [
410
- [sr, i.value]
411
- ]),
412
- e("div", { class: "mt-3 flex gap-2" }, [
413
- e("button", {
414
- type: "button",
415
- class: "fm-btn fm-btn-tertiary",
416
- onClick: c
417
- }, "Clear")
418
- ])
419
- ]));
420
- }
421
- });
422
- function at(f) {
423
- return lt.generatedPOReceivedMap({
424
- purchaseOrder: f
425
- });
426
- }
427
- function rs(f) {
428
- return lt.validatePOItemReceivedStatus({
429
- dto: f
430
- });
431
- }
432
- function yt(f) {
433
- return lt.validatePOReceivedStatus({
434
- receivedMap: f
435
- });
436
- }
437
- function vt(f, r, s) {
438
- if (!ae.safeParse(f).success)
439
- throw new Error(`Invalid purchase order status: ${f}`);
440
- const i = ae.parse(f);
441
- return lt.orderStatusCombination({
442
- status: i,
443
- isPOPartialReceive: r,
444
- isPOOverReceive: s
445
- });
446
- }
447
- function Yt() {
448
- const f = Te(), r = He(), s = Ve();
449
- async function i(n, p) {
450
- const t = f.currentLocationDBName;
451
- return n.doc.supplier.internal && n.operation === N.enum.confirmDraft && (n.operation = N.enum.submitRequest), await r.processPurchaseOrder(n, p || t);
452
- }
453
- async function c(n, p) {
454
- const t = f.currentLocationDBName;
455
- return await r.processPurchaseOrderV2(n, p || t);
456
- }
457
- return (n) => s.useOperatePurchaseOrderV2 ? c(n.operateV2, n.transferTo) : i(n.operate, n.transferTo);
458
- }
459
- function qe(f) {
460
- const r = or(f);
461
- if (Array.isArray(r))
462
- return r.map(qe);
463
- if (r !== null && typeof r == "object") {
464
- const s = {};
465
- for (const i in r)
466
- Object.prototype.hasOwnProperty.call(r, i) && (s[i] = qe(r[i]));
467
- return s;
468
- }
469
- return r;
470
- }
471
- const mt = {
472
- set: "set",
473
- add: "add",
474
- delete: "delete"
475
- };
476
- function Lt(f) {
477
- return {
478
- dbName: f.dbName,
479
- type: f.type,
480
- name: f.name,
481
- acceptRequest: f.acceptRequest ?? !1,
482
- doc: f.doc
483
- };
484
- }
485
- function jt(f, r, s, i, c) {
486
- const n = qe(f.suppliers ?? []), p = qe(r.allLocations ?? []).map(Lt), t = r._currentLocation ? Lt(qe(r._currentLocation)) : null, a = s.inventory ? [qe(s.inventory)] : [], b = i.state.setting ? qe(i.state.setting) : null, y = qe(c.surcharges ?? []);
487
- return {
488
- suppliers: n,
489
- locations: p,
490
- currentLocation: t,
491
- inventoryDoc: a,
492
- netSuiteSetting: b,
493
- surcharges: y
494
- };
495
- }
496
- function Qt() {
497
- const f = Mr(), r = Te(), s = hr(), i = ct(), c = Ur(), n = jt(
498
- f,
499
- r,
500
- s,
501
- i,
502
- c
503
- ), p = Tt($r({ env: n }));
504
- p.value.setUsePartialUpdates(!0);
505
- const t = Tt(p.value.state()), a = (_) => {
506
- t.value = _;
507
- };
508
- p.value.addListener(a);
509
- const b = (_, C, h) => {
510
- switch (_) {
511
- case mt.set:
512
- It(t.value, C, h);
513
- break;
514
- case mt.add:
515
- _r(t.value, C, h);
516
- break;
517
- case mt.delete:
518
- gr(t.value, C);
519
- break;
520
- default:
521
- console.warn(`Unknown partial update operation: ${_}, falling back to 'set'`), It(t.value, C, h);
522
- }
523
- C !== "remark" && C !== "ref" && ar(t);
524
- };
525
- p.value.addPartialListener(b);
526
- function y() {
527
- const _ = jt(
528
- f,
529
- r,
530
- s,
531
- i,
532
- c
533
- );
534
- p.value.updateFullEnv(_), t.value = p.value.state();
535
- }
536
- et(
537
- [
538
- () => f.suppliers,
539
- () => r.allLocations,
540
- () => r._currentLocation,
541
- () => s.inventory,
542
- () => i.state.setting,
543
- () => c.surcharges
544
- ],
545
- () => {
546
- y();
547
- },
548
- { deep: !0 }
549
- ), nr(() => {
550
- p.value.removeListener(a), p.value.removePartialListener(b);
551
- });
552
- function x(_) {
553
- var C;
554
- if (_ != null && _._id) {
555
- p.value.loadPurchaseOrder(_);
556
- return;
557
- }
558
- if (!Ve().mustUsePoTemplate) {
559
- p.value.init();
560
- return;
561
- }
562
- _ != null && _.template && ((C = _.templateDoc) != null && C.purchaseOrder) ? (_.items = _.templateDoc.purchaseOrder.items, p.value.initFromTemplate(_)) : p.value.initOutletToOutlet();
563
- }
564
- return {
565
- controller: p,
566
- state: t,
567
- init: x
568
- };
569
- }
570
- var bt = /* @__PURE__ */ ((f) => (f.RECEIVE_REQUEST = "receive/request", f.APPROVAL = "approval", f))(bt || {});
571
- const Ye = W(), pt = W();
572
- function xl(f, r) {
573
- const s = ut(), i = Te(), c = Ve(), n = Ar(), p = Pr(), t = W(!1), a = Ke(), b = He(), y = Xr(), x = W(new Array()), _ = W(new Array()), C = W(
574
- r != null && r.startDate && (r != null && r.endDate) ? r : jr()
575
- ), h = Z(() => {
576
- const E = new Date(C.value.startDate), F = new Date(C.value.endDate);
577
- return {
578
- start: Cr(E).toISOString(),
579
- end: Dr(F).toISOString()
580
- };
581
- }), M = W(new Array()), R = xr(), U = W(null);
582
- async function O(E) {
583
- function F(w) {
584
- const g = {
585
- mode: Vt.CREATE,
586
- modelValue: E || void 0,
587
- show: !0,
588
- "onUpdate:show"(V) {
589
- Ye.value.show = V;
590
- },
591
- templateId: w,
592
- lastClosingDate: U.value
593
- };
594
- Ye.value = g;
595
- }
596
- let ee;
597
- c.mustUsePoTemplate && !(E != null && E.template) ? s.open({
598
- title: "Create transfer",
599
- message: "",
600
- primaryActions: {
601
- text: "Select a template",
602
- close: !0
603
- },
604
- secondaryActions: {
605
- text: "Outlet to Outlet",
606
- variant: "secondary",
607
- close: !0
608
- }
609
- }).onPrimary(async () => {
610
- ee = await n.getTemplateId(), ee && F(ee);
611
- }).onSecondary(() => {
612
- F(void 0);
613
- }) : F(ee);
614
- }
615
- function k(E) {
616
- const F = {
617
- mode: Vt.UPDATE,
618
- modelValue: Bt(E),
619
- show: !0,
620
- "onUpdate:show"(ee) {
621
- Ye.value.show = ee;
622
- },
623
- lastClosingDate: U.value
624
- };
625
- Ye.value = F;
626
- }
627
- async function Y() {
628
- x.value = [], _.value = [], t.value = !0;
629
- try {
630
- const E = await b.getPurchaseOrders(h.value);
631
- x.value = E.sort((H, ce) => ce._id.localeCompare(H._id));
632
- const F = E.flatMap((H) => H.shipmentIds || []).filter(Boolean), ee = F.length > 0 ? await y.getShipmentsByIds(F) : [];
633
- _.value = ee;
634
- const w = await R.readCurrentLocationLastClosing(!0), g = w == null ? void 0 : w._id;
635
- g && (U.value = vr(g)), await c.awaitFeatureLoaded(() => c.mustUsePoTemplate) && await p.fetchTemplates();
636
- const V = x.value.map((H) => {
637
- var ce;
638
- return ((ce = H.request) == null ? void 0 : ce.id) ?? "";
639
- }).filter((H) => H);
640
- M.value = await b.readRequestByIds(V);
641
- } catch {
642
- a.open({
643
- title: "Something went wrong",
644
- message: "Error at fetching purchase orders",
645
- type: "error"
646
- });
647
- } finally {
648
- t.value = !1;
649
- }
650
- }
651
- async function A() {
652
- M.value = [], t.value = !0;
653
- try {
654
- M.value = await b.readRequests(
655
- void 0,
656
- h.value.start,
657
- h.value.end
658
- ).then((E) => E.reverse());
659
- } catch {
660
- a.open({
661
- title: "Something went wrong",
662
- message: "Error at fetching purchase requests",
663
- type: "error"
664
- });
665
- } finally {
666
- t.value = !1;
667
- }
668
- }
669
- function T() {
670
- switch (f) {
671
- case "receive/request":
672
- return Y();
673
- case "approval":
674
- return A();
675
- }
676
- }
677
- function $(E, F) {
678
- C.value = {
679
- startDate: E,
680
- endDate: F
681
- }, T();
682
- }
683
- i.watchLocation(async (E) => {
684
- if (!E) {
685
- x.value = [];
686
- return;
687
- }
688
- await T();
689
- });
690
- const S = W(), q = W(Math.random().toString());
691
- async function G(E, F) {
692
- const ee = Math.random().toString();
693
- q.value = ee, F ?? (F = M.value.computeFirst(
694
- (H) => H.purchaseOrderId === E._id ? H : null
695
- ) ?? void 0);
696
- const w = f === "receive/request" ? i.currentLocation : F == null ? void 0 : F.to, g = f === "approval", V = {
697
- poRequest: F,
698
- purchaseOrder: {
699
- ...E,
700
- status: g && (F != null && F.rejectedAt) ? ae.Enum.REJECT : E.status
701
- },
702
- transferTo: w == null ? void 0 : w.name,
703
- transferToDbName: w == null ? void 0 : w.dbName,
704
- show: !0,
705
- canResubmit: !1,
706
- canApprove: g,
707
- "onUpdate:show"(H) {
708
- S.value.show = H;
709
- },
710
- scope: f,
711
- receivedMap: at(E) ?? {},
712
- shipments: _.value
713
- };
714
- S.value = V;
715
- }
716
- async function Q(E, F, ee, w, g) {
717
- const V = Yt();
718
- t.value = !0;
719
- try {
720
- await V({
721
- operate: {
722
- operation: F,
723
- doc: E,
724
- options: (
725
- // auto receive for supplier to warehouse
726
- (F === N.enum.confirmDraft || // auto receive for warehouse to warehouse
727
- F === N.enum.completeReceive) && c.autoReceiveWarehouse ? {
728
- autoReceive: !0
729
- } : void 0
730
- )
731
- },
732
- operateV2: {
733
- _id: E._id,
734
- _rev: E._rev ?? "",
735
- action: F === N.enum.submitRequest ? N.enum.confirmDraft : F,
736
- payloads: g ?? []
737
- },
738
- transferTo: w
739
- }), await new Promise((Re) => setTimeout(Re, 1e3));
740
- const ce = Te().currentLocationDBName.startsWith("restaurant_");
741
- F === N.enum.confirmDraft && E.effectiveAt && ce ? a.open({
742
- title: "Success",
743
- message: `${ee}. The backdate will be reflected once your POS has received this change.`,
744
- type: "success"
745
- }) : a.open({
746
- title: "Success",
747
- message: ee,
748
- type: "success"
749
- });
750
- } catch (H) {
751
- a.open({
752
- title: "Something went wrong",
753
- message: "Please try again.",
754
- type: "error"
755
- }), console.error("Error when submitting PO operation", F, E, H);
756
- } finally {
757
- t.value = !1, T();
758
- }
759
- }
760
- async function ye(E, F, ee) {
761
- const w = Gt[F];
762
- if (!w) {
763
- a.open({
764
- title: "Something went wrong",
765
- message: `Cannot process order: ${ht(F)}`,
766
- type: "error"
767
- });
768
- return;
769
- }
770
- const { successMessage: g, ...V } = w;
771
- if (F === N.enum.rejectDraft) {
772
- let Re = "";
773
- s.open({
774
- title: V.title,
775
- message: V.message,
776
- primaryActions: V.primaryActions,
777
- contentComponent: Wt,
778
- contentComponentProps: {
779
- message: V.message,
780
- onChange: (we) => Re = we
781
- }
782
- }).onPrimary(() => {
783
- const we = [];
784
- we.push({
785
- action: "rejectDraft",
786
- payload: {
787
- rejectReason: Re
788
- }
789
- }), Q(E, F, g, ee, we);
790
- });
791
- return;
792
- }
793
- const H = [], ce = Qt();
794
- ce.init(E), (F === N.enum.confirmDraft || F === N.enum.submitRequest) && H.push({
795
- action: "confirmDraft",
796
- payload: ce.controller.value.toConfirmDraftData(De())
797
- }), s.open({
798
- title: V.title,
799
- message: V.message,
800
- primaryActions: V.primaryActions
801
- }).onPrimary(() => {
802
- Q(E, F, g, ee, H);
803
- });
804
- }
805
- async function he() {
806
- s.open({
807
- title: "Upload Transfer",
808
- primaryActions: {
809
- text: "Xilnex transfer note",
810
- close: !0
811
- },
812
- secondaryActions: {
813
- text: "Cancel",
814
- close: !0
815
- }
816
- }).onPrimary(() => {
817
- const E = {
818
- show: !0,
819
- "onUpdate:show"(F) {
820
- pt.value.show = F;
821
- }
822
- };
823
- pt.value = E;
824
- });
825
- }
826
- return {
827
- purchaseOrders: x,
828
- shipments: _,
829
- purchaseRequests: M,
830
- updateDateRange: $,
831
- fetchData: T,
832
- loading: t,
833
- transferDialogProps: Ye,
834
- promptCreateTransferDialog: O,
835
- promptUpdateTransferDialog: k,
836
- transferDetailsProps: S,
837
- promptShowTransferDetails: G,
838
- submitAction: ye,
839
- xilnexImportDialogProps: pt,
840
- promptUploadTransferDialog: he
841
- };
842
- }
843
- function ss(f) {
844
- const { po: r, currentLocation: s, business: i, fulfilling: c, por: n } = f, { name: p, address: t, regNo: a, legalName: b } = s.doc.profile, y = {
845
- name: p,
846
- legalName: b,
847
- registrationNumber: a,
848
- line1: t == null ? void 0 : t.line1,
849
- line2: t == null ? void 0 : t.line2,
850
- postcode: t == null ? void 0 : t.postcode,
851
- city: t == null ? void 0 : t.city,
852
- state: t == null ? void 0 : t.state,
853
- country: t == null ? void 0 : t.country
854
- }, x = {
855
- name: r.supplier.name,
856
- phoneNumber: r.supplier.phoneNumber,
857
- registrationNumber: r.supplier.registrationNumber,
858
- line1: r.supplier.address.line1,
859
- line2: r.supplier.address.line2,
860
- postcode: r.supplier.address.postcode,
861
- city: r.supplier.address.city,
862
- state: r.supplier.address.state,
863
- country: r.supplier.address.country
864
- }, _ = r.items.map((A) => {
865
- const { sku: T, measurement: $ } = A, S = be(
866
- Ht(A.sku, r.deliveryOrder || []),
867
- !1
868
- );
869
- return {
870
- code: T.code,
871
- description: T.name,
872
- quantity: be(A.quantity, !1),
873
- unit: ($ == null ? void 0 : $.abbrev) || T.unit.abbrev,
874
- received: S,
875
- cost: A.totalCost ? `${A.totalCost.currency} ${Je.toFormatString({
876
- value: A.totalCost
877
- })}` : void 0
878
- };
879
- }), C = r.deliveryOrder.map((A) => ({
880
- createdAt: gt(new Date(A.createdAt)),
881
- ref: A.deliveryOrderNumber,
882
- remark: A.remark || "",
883
- items: A.received.map((T) => {
884
- var $;
885
- return {
886
- code: T.sku.code,
887
- description: T.sku.name,
888
- quantity: be(T.amount),
889
- unit: (($ = T.measurement) == null ? void 0 : $.abbrev) || T.sku.unit.abbrev
890
- };
891
- })
892
- })), h = [
893
- // Production
894
- "67ca5d2c80bd0e001c5bf5bc",
895
- // Dev
896
- "6880b36a3054c5001db19218"
897
- ];
898
- let M = "Inventory Receive Note";
899
- if (r.supplier.internal ? (M = "Inventory Transfer Note", h.includes((i == null ? void 0 : i._id) || "") && (M = "Stock Request")) : M = "Purchase Order", n) {
900
- const A = n.from.dbName;
901
- s.dbName === A || (M = "Inventory Receive Note");
902
- }
903
- const U = {
904
- title: M,
905
- businessName: i == null ? void 0 : i.name,
906
- logo: i == null ? void 0 : i.thumbnail,
907
- orderNumber: r.seqNumber.toString(),
908
- createdAt: tt(r._id),
909
- ref: r.ref || "",
910
- remark: r.remark || "",
911
- buyer: y,
912
- supplier: x,
913
- items: _,
914
- status: r.status,
915
- deliveryOrders: C
916
- }, O = new URL(window.location.href), k = c && (r.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
917
- O.pathname = O.hostname.includes("portal.feedme") ? `/inventory/${k}` : `/${k}`;
918
- const Y = kr.compressToEncodedURIComponent(JSON.stringify(U));
919
- O.searchParams.append("data", Y), window.open(O.href, "_blank", "noreferrer");
920
- }
921
- const Ie = {
922
- submitRequest: {
923
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
924
- color: "text-fm-color-typo-primary",
925
- value: N.enum.submitRequest
926
- },
927
- confirmDraft: {
928
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
929
- color: "text-fm-color-typo-primary",
930
- value: N.enum.confirmDraft
931
- },
932
- cancelDraft: {
933
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
934
- color: "text-fm-color-typo-error",
935
- value: N.enum.cancelDraft
936
- },
937
- approveRequest: {
938
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
939
- color: "text-fm-color-typo-primary",
940
- value: N.enum.approveRequest
941
- },
942
- rejectRequest: {
943
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
944
- color: "text-fm-color-typo-error",
945
- value: N.enum.rejectRequest
946
- },
947
- processRequest: {
948
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
949
- color: "text-fm-color-typo-primary",
950
- value: N.enum.processRequest
951
- },
952
- receiveStock: {
953
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
954
- color: "text-fm-color-typo-primary",
955
- value: N.enum.receiveStock
956
- },
957
- completeReceive: {
958
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
959
- color: "text-fm-color-typo-primary",
960
- value: N.enum.completeReceive
961
- },
962
- closeRequest: {
963
- translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
964
- color: "system-error-300",
965
- value: N.enum.closeRequest
966
- },
967
- approveDraft: {
968
- translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
969
- color: "text-fm-color-typo-primary",
970
- value: N.enum.approveDraft
971
- },
972
- rejectDraft: {
973
- translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
974
- color: "text-fm-color-typo-error",
975
- value: N.enum.rejectDraft
976
- },
977
- returnStock: {
978
- translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
979
- color: "text-fm-color-typo-primary",
980
- value: N.enum.returnStock
981
- }
982
- };
983
- function Jt() {
984
- const f = Ve();
985
- return {
986
- ableToMarkReceived(r) {
987
- if (!r || r.status !== ae.enum.RECEIVING || f.useOperatePurchaseOrderV2) return !1;
988
- const i = Te().currentLocationDBName;
989
- return `${r.supplier.internal}_${r.supplier._id}` !== i;
990
- },
991
- ableToMarkApproved(r) {
992
- return !(!r || (r == null ? void 0 : r.status) !== ae.enum.REQUESTING);
993
- },
994
- ableToCreateFulfillment(r, s) {
995
- var n, p;
996
- if (!f.acceptRequireFulfillment || !r || !s || r.status !== ae.enum.PROCESSING || !s.processedAt)
997
- return !1;
998
- const i = (n = s == null ? void 0 : s.from) == null ? void 0 : n.dbName, c = (p = s == null ? void 0 : s.to) == null ? void 0 : p.dbName;
999
- return !(i.startsWith("restaurant_") && c.startsWith("restaurant_"));
1000
- }
1001
- };
1002
- }
1003
- function Xt() {
1004
- const f = Z(() => [
1005
- {
1006
- action: qt.Action.manage,
1007
- subject: qt.Subject.Business.inventory_orderDraftApproval
1008
- }
1009
- ]), { hasPermission: r } = zr(f);
1010
- return {
1011
- hasOrderDraftPermission: lr(r)
1012
- };
1013
- }
1014
- function Sl(f, r, s) {
1015
- const i = Te(), c = ct(), n = _t(), p = Jt(), { t } = it(), { hasOrderDraftPermission: a } = Xt(), b = Ve(), y = Z(
1016
- () => b.enablePrintTemplate ? [xe[ue.PrintCustom]] : []
1017
- );
1018
- function x(A) {
1019
- switch (A.status) {
1020
- case "DRAFT":
1021
- return [
1022
- xe[ue.Update],
1023
- xe[ue.Details],
1024
- A.supplier.internal === "restaurant" || A.supplier.internal === "warehouse" ? Ie[N.enum.submitRequest] : Ie[N.enum.confirmDraft],
1025
- Ie[N.enum.cancelDraft]
1026
- ];
1027
- case "RECEIVING":
1028
- return [
1029
- ...p.ableToMarkReceived(A) ? [Ie[N.enum.completeReceive]] : [],
1030
- xe[ue.Details],
1031
- xe[ue.Print],
1032
- ...y.value
1033
- ];
1034
- case "PENDING_APPROVAL": {
1035
- const $ = [xe[ue.Details]];
1036
- return a.value && $.push(
1037
- xe[ue.Update],
1038
- Ie[N.enum.approveDraft],
1039
- Ie[N.enum.rejectDraft]
1040
- ), $;
1041
- }
1042
- case "REQUESTING":
1043
- return f === "receive/request" ? [
1044
- xe[ue.Details],
1045
- xe[ue.Print],
1046
- ...y.value
1047
- ] : [
1048
- Ie[N.enum.approveRequest],
1049
- Ie[N.enum.rejectRequest],
1050
- xe[ue.Details]
1051
- // DefaultRowActions[RowActionEnum.Print]
1052
- ];
1053
- case "PROCESSING":
1054
- return [
1055
- xe[ue.Details],
1056
- xe[ue.Print],
1057
- ...y.value
1058
- ];
1059
- case "COMPLETE":
1060
- case "CANCEL":
1061
- default:
1062
- return [
1063
- xe[ue.Details],
1064
- xe[ue.Print],
1065
- ...y.value
1066
- ];
1067
- }
1068
- }
1069
- function _(A) {
1070
- return Object.values(N.enum).includes(A);
1071
- }
1072
- async function C(A, T, $) {
1073
- var q, G, Q, ye, he, E;
1074
- const S = Bt(T);
1075
- if (A === ue.Print || A === ue.PrintCustom) {
1076
- const F = ($ == null ? void 0 : $.toInventoryLocation) ?? i.currentLocation;
1077
- if (F.type === "restaurant") {
1078
- const w = i.locationRestaurantFromCore(F.doc._id);
1079
- w !== null && (F.doc = w);
1080
- }
1081
- ((q = $ == null ? void 0 : $.netSuite) != null && q.refNo || (G = S.netSuite) != null && G.refNo) && (S.ref = [((Q = $ == null ? void 0 : $.netSuite) == null ? void 0 : Q.refNo) || ((ye = S.netSuite) == null ? void 0 : ye.refNo)].filter((w) => w).join(" "));
1082
- const ee = {
1083
- po: S,
1084
- currentLocation: F,
1085
- business: n.currentBusiness.value,
1086
- fulfilling: f === "approval",
1087
- por: $
1088
- };
1089
- if (A === ue.PrintCustom) {
1090
- const w = Hr(ee);
1091
- w && (O.value = w.html, k.value = w.templateName, Y.value = w.isDefault, U.value = !0);
1092
- } else
1093
- ss(ee);
1094
- return;
1095
- }
1096
- if (A === ue.Details) {
1097
- r.promptShowTransferDetails(S, $);
1098
- return;
1099
- }
1100
- if (A === ue.Update) {
1101
- (he = r.promptUpdateTransferDialog) == null || he.call(r, S);
1102
- return;
1103
- }
1104
- if (_(A)) {
1105
- r.submitAction(T, A, (E = $ == null ? void 0 : $.to) == null ? void 0 : E.dbName);
1106
- return;
1107
- }
1108
- }
1109
- function h() {
1110
- var T;
1111
- const A = [
1112
- {
1113
- accessorKey: "seqNumber",
1114
- header: () => t("inventory.transfer.table.seqNo"),
1115
- enableSorting: !0,
1116
- size: 80,
1117
- sortUndefined: "last"
1118
- },
1119
- {
1120
- accessorKey: "_id",
1121
- header: () => t("inventory.transfer.table.createdAt"),
1122
- cell($) {
1123
- return tt(`${$.getValue()}`);
1124
- },
1125
- enableSorting: !0
1126
- },
1127
- {
1128
- accessorKey: "supplier.name",
1129
- header: () => t("inventory.transfer.table.transferFrom"),
1130
- enableSorting: !0,
1131
- size: 200
1132
- },
1133
- {
1134
- accessorKey: "items.length",
1135
- header: () => t("inventory.transfer.table.noOfItems"),
1136
- cell: ($) => {
1137
- const S = $.row.original.version || "1", q = $.getValue();
1138
- return z("div", { class: "flex items-center gap-2" }, [
1139
- q,
1140
- S !== "1" ? z(
1141
- "div",
1142
- { class: "py-3" },
1143
- z(
1144
- ze,
1145
- z(
1146
- "div",
1147
- {
1148
- class: ["fm-status-badge", "fm-status-badge-draft"].join(" ")
1149
- },
1150
- `v${S}`
1151
- )
1152
- )
1153
- ) : null
1154
- ]);
1155
- },
1156
- enableSorting: !1,
1157
- meta: {
1158
- width: "10rem"
1159
- }
1160
- },
1161
- {
1162
- accessorKey: "ref",
1163
- header: () => t("inventory.transfer.table.reference"),
1164
- enableSorting: !1,
1165
- size: "auto"
1166
- },
1167
- ...(T = n.sessionUser.value) != null && T.role.isAdmin ? [
1168
- {
1169
- id: "statusForAdmin",
1170
- header: () => z(ze, {}, () => `${t("inventory.transfer.table.status")}`),
1171
- cell($) {
1172
- return $.row.original.status;
1173
- },
1174
- enableSorting: !0,
1175
- size: 200
1176
- }
1177
- ] : [],
1178
- {
1179
- accessorKey: "status",
1180
- header: () => t("inventory.transfer.table.status"),
1181
- cell($) {
1182
- const S = $.getValue(), q = at($.row.original), { partial: G, over: Q } = yt(q), ye = vt(S ?? "", G, Q);
1183
- let he = t(`inventory.transfer.status.${ye}`), E = `${S ?? ""}`.toLocaleLowerCase("en-us");
1184
- ye === ae.enum.CLOSE && (he = `${t(`inventory.transfer.status.${ae.enum.COMPLETE}`)}`), ye === "PARTIAL_RECEIVED" && E === ae.enum.PROCESSING.toLocaleLowerCase("en-us") && (E = ae.enum.RECEIVING.toLocaleLowerCase("en-us"));
1185
- let F = null;
1186
- const ee = s.value.find((w) => w.ref === $.row.original._id);
1187
- if (ee != null && ee.milestones && ee.milestones.length > 0) {
1188
- const w = ee.milestones[ee.milestones.length - 1];
1189
- if (w.estimatedTime) {
1190
- const g = new Date(w.estimatedTime), V = g.getDate().toString().padStart(2, "0");
1191
- F = `${g.toLocaleString("en-US", { month: "short" })} ${V}`;
1192
- }
1193
- }
1194
- return z(
1195
- "div",
1196
- {
1197
- class: "flex"
1198
- },
1199
- [
1200
- z(
1201
- "div",
1202
- { class: "flex items-center" },
1203
- z(
1204
- "div",
1205
- {
1206
- class: [
1207
- "fm-status-badge",
1208
- `fm-status-badge-${E}`,
1209
- Q && "fm-status-badge-error"
1210
- ].filter(Boolean).join(" ")
1211
- },
1212
- `${he}`
1213
- )
1214
- ),
1215
- ...F ? [
1216
- z(
1217
- "div",
1218
- {
1219
- class: "flex items-center gap-1 ml-2"
1220
- },
1221
- [
1222
- z(nt.FmIcon, {
1223
- name: "local_shipping",
1224
- size: "md",
1225
- color: "neutral-gray-400"
1226
- }),
1227
- z(
1228
- "span",
1229
- { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
1230
- F
1231
- )
1232
- ]
1233
- )
1234
- ] : []
1235
- ]
1236
- );
1237
- },
1238
- enableSorting: !0,
1239
- size: 150
1240
- },
1241
- {
1242
- id: "action",
1243
- cell($) {
1244
- const S = $.row.original, q = x(S);
1245
- return Ft(q, (G) => C(G, S));
1246
- },
1247
- enableSorting: !1,
1248
- size: 40,
1249
- meta: {
1250
- cellClass: "",
1251
- headerClass: ""
1252
- }
1253
- }
1254
- ];
1255
- if (c.isEnabled) {
1256
- const $ = [
1257
- {
1258
- id: "netsuiteTransferOrder",
1259
- accessorFn: (S) => {
1260
- var q;
1261
- return (q = S.netSuite) != null && q.id ? `${S.netSuite.refNo} (${S.netSuite.id})` : "N/A";
1262
- },
1263
- header: () => "NetSuite Order (ID)",
1264
- cell(S) {
1265
- var G;
1266
- const q = S.row.original;
1267
- return (G = q.netSuite) != null && G.id ? `${q.netSuite.refNo} (${q.netSuite.id})` : "N/A";
1268
- },
1269
- enableSorting: !1,
1270
- size: 200,
1271
- meta: {
1272
- cellClass: "",
1273
- headerClass: ""
1274
- }
1275
- },
1276
- {
1277
- id: "netsuiteTransactionNumber",
1278
- accessorFn: (S) => {
1279
- var q, G;
1280
- return ((G = (q = S.netSuite) == null ? void 0 : q.additionalInfo) == null ? void 0 : G.transactionnumber) ?? "N/A";
1281
- },
1282
- header: () => "NetSuite Transaction No.",
1283
- cell(S) {
1284
- var G, Q;
1285
- return ((Q = (G = S.row.original.netSuite) == null ? void 0 : G.additionalInfo) == null ? void 0 : Q.transactionnumber) ?? "N/A";
1286
- },
1287
- enableSorting: !1,
1288
- size: 200,
1289
- meta: {
1290
- cellClass: "",
1291
- headerClass: ""
1292
- }
1293
- }
1294
- ];
1295
- A.splice(A.length - 1, 0, ...$);
1296
- }
1297
- return A;
1298
- }
1299
- function M() {
1300
- var T;
1301
- const A = [
1302
- {
1303
- accessorKey: "purchaseOrder.seqNumber",
1304
- header: () => t("inventory.transfer.table.seqNo"),
1305
- enableSorting: !0,
1306
- size: 80,
1307
- sortUndefined: "last"
1308
- },
1309
- {
1310
- accessorKey: "purchaseOrder._id",
1311
- header: () => t("inventory.transfer.table.createdAt"),
1312
- cell($) {
1313
- return tt(`${$.getValue()}`);
1314
- },
1315
- enableSorting: !0
1316
- },
1317
- {
1318
- accessorKey: "to.name",
1319
- header: () => t("inventory.transfer.table.transferTo"),
1320
- enableSorting: !1,
1321
- size: 200
1322
- },
1323
- {
1324
- accessorKey: "purchaseOrder.items.length",
1325
- header: () => t("inventory.transfer.table.noOfItems"),
1326
- enableSorting: !1
1327
- },
1328
- {
1329
- accessorKey: "purchaseOrder.ref",
1330
- header: () => t("inventory.transfer.table.reference"),
1331
- enableSorting: !1,
1332
- size: "auto"
1333
- },
1334
- ...(T = n.sessionUser.value) != null && T.role.isAdmin ? [
1335
- {
1336
- id: "statusForAdmin",
1337
- header: () => z(ze, {}, () => `${t("inventory.transfer.table.status")}`),
1338
- cell($) {
1339
- return $.row.original.status;
1340
- },
1341
- enableSorting: !0,
1342
- size: 200
1343
- }
1344
- ] : [],
1345
- {
1346
- accessorKey: "purchaseOrder.status",
1347
- header: () => t("inventory.transfer.table.status"),
1348
- cell($) {
1349
- const S = $.row.original, q = $.getValue();
1350
- if (!S.purchaseOrder)
1351
- return z(nt.FmChip, {
1352
- label: "N/A",
1353
- compact: !0
1354
- });
1355
- const G = at(S.purchaseOrder), { partial: Q, over: ye } = yt(G), he = vt(q ?? "", Q, ye);
1356
- let E = t(`inventory.transfer.status.${he}`), F = `${q ?? ""}`.toLocaleLowerCase("en-us");
1357
- return he === ae.enum.CLOSE && (E = `${t(`inventory.transfer.status.${ae.enum.COMPLETE}`)}`), he === "PARTIAL_RECEIVED" && F === ae.enum.PROCESSING.toLocaleLowerCase("en-us") && (F = ae.enum.RECEIVING.toLocaleLowerCase("en-us")), S.rejectedAt && (E = t("inventory.transfer.status.REJECT"), F = ae.enum.REJECT.toLocaleLowerCase("en-us")), z(
1358
- "div",
1359
- {
1360
- class: "flex"
1361
- },
1362
- z(
1363
- "div",
1364
- {
1365
- class: [
1366
- "fm-status-badge",
1367
- `fm-status-badge-${F}`,
1368
- ye && "fm-status-badge-error"
1369
- ].filter(Boolean).join(" ")
1370
- },
1371
- `${E}`
1372
- )
1373
- );
1374
- },
1375
- enableSorting: !0
1376
- },
1377
- {
1378
- id: "action",
1379
- cell($) {
1380
- const S = $.row.original, G = (S.purchaseOrder ? x(S.purchaseOrder) : []).map((Q) => Q.value === ue.Print ? {
1381
- ...Q,
1382
- translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
1383
- } : Q);
1384
- return Ft(
1385
- G,
1386
- (Q) => S.purchaseOrder ? C(Q, S.purchaseOrder, S) : void 0
1387
- );
1388
- },
1389
- enableSorting: !1,
1390
- size: 40,
1391
- meta: {
1392
- cellClass: "",
1393
- headerClass: ""
1394
- }
1395
- }
1396
- ];
1397
- if (c.isEnabled) {
1398
- const $ = [
1399
- {
1400
- id: "netsuiteTransferOrder",
1401
- accessorFn: (S) => {
1402
- var q;
1403
- return (q = S.netSuite) != null && q.id ? `${S.netSuite.refNo} (${S.netSuite.id})` : "N/A";
1404
- },
1405
- header: () => "NetSuite Order (ID)",
1406
- cell(S) {
1407
- var G;
1408
- const q = S.row.original;
1409
- return (G = q.netSuite) != null && G.id ? `${q.netSuite.refNo} (${q.netSuite.id})` : "N/A";
1410
- },
1411
- enableSorting: !1,
1412
- size: 200,
1413
- meta: {
1414
- cellClass: "",
1415
- headerClass: ""
1416
- }
1417
- },
1418
- {
1419
- id: "netsuiteTransactionNumber",
1420
- accessorFn: (S) => {
1421
- var q, G;
1422
- return ((G = (q = S.netSuite) == null ? void 0 : q.additionalInfo) == null ? void 0 : G.transactionnumber) ?? "N/A";
1423
- },
1424
- header: () => "NetSuite Transaction No.",
1425
- cell(S) {
1426
- var G, Q;
1427
- return ((Q = (G = S.row.original.netSuite) == null ? void 0 : G.additionalInfo) == null ? void 0 : Q.transactionnumber) ?? "N/A";
1428
- },
1429
- enableSorting: !1,
1430
- size: 200,
1431
- meta: {
1432
- cellClass: "",
1433
- headerClass: ""
1434
- }
1435
- }
1436
- ];
1437
- A.splice(A.length - 2, 0, ...$);
1438
- }
1439
- return A;
1440
- }
1441
- const R = Z(() => f === "receive/request" ? h() : M()), U = W(!1), O = W(""), k = W(""), Y = W(!1);
1442
- return {
1443
- columnDefs: R,
1444
- showCustomPrintDialog: U,
1445
- customPrintHtml: O,
1446
- customPrintTemplateName: k,
1447
- customPrintIsDefault: Y
1448
- };
1449
- }
1450
- const os = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, ns = { class: "flex flex-col gap-8" }, as = { class: "flex w-full justify-end gap-16" }, ls = /* @__PURE__ */ Oe({
1451
- __name: "FulfillmentForm",
1452
- props: {
1453
- purchaseOrder: {},
1454
- confirm: { type: Function }
1455
- },
1456
- emits: ["update:show"],
1457
- setup(f, { emit: r }) {
1458
- const s = f, i = ir({
1459
- id: "",
1460
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1461
- items: []
1462
- }), c = W(), n = r;
1463
- Ut(() => {
1464
- s.purchaseOrder && (i.items = s.purchaseOrder.items.map((t) => ({
1465
- id: t.id,
1466
- sku: t.sku,
1467
- measurement: t.measurement,
1468
- amount: t.quantity ?? { amount: 1, precision: 0 }
1469
- })));
1470
- });
1471
- const p = Z(() => i.items.length <= 10);
1472
- return (t, a) => {
1473
- const b = X("FmTable"), y = X("FmButton"), x = X("FmForm");
1474
- return l(), ie(x, {
1475
- ref_key: "formRef",
1476
- ref: c,
1477
- class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
1478
- onValidationFailed: console.log,
1479
- onValidationSuccess: a[1] || (a[1] = () => s.confirm(i))
1480
- }, {
1481
- default: oe(() => [
1482
- a[2] || (a[2] = e("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
1483
- e("div", os, [
1484
- e("div", ns, [
1485
- L(b, {
1486
- "column-defs": [
1487
- {
1488
- header: "Code",
1489
- cell: (_) => {
1490
- const C = s.purchaseOrder.items.find((h) => h.id === _.row.original.id || h.sku._id === _.row.original.sku._id);
1491
- return z(
1492
- m(nt).FmTooltip,
1493
- {
1494
- content: C.code,
1495
- placement: "top",
1496
- variant: "plain",
1497
- zIndex: 50
1498
- },
1499
- z(
1500
- "span",
1501
- {
1502
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
1503
- },
1504
- C.code
1505
- )
1506
- );
1507
- }
1508
- },
1509
- {
1510
- header: "Name",
1511
- cell: (_) => {
1512
- const C = s.purchaseOrder.items.find((h) => h.id === _.row.original.id || h.sku._id === _.row.original.sku._id);
1513
- return z(
1514
- m(nt).FmTooltip,
1515
- {
1516
- content: C.name,
1517
- placement: "top",
1518
- variant: "plain",
1519
- zIndex: 50
1520
- },
1521
- z(
1522
- "span",
1523
- {
1524
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
1525
- },
1526
- C.name
1527
- )
1528
- );
1529
- }
1530
- },
1531
- {
1532
- header: "Amount",
1533
- cell: (_) => {
1534
- const C = _.row.original, h = s.purchaseOrder.items.find((R) => R.id === C.id || R.sku._id === C.sku._id), M = C.amount ?? {
1535
- amount: 1,
1536
- precision: 0
1537
- };
1538
- return z(Ir, {
1539
- style: {
1540
- flex: "1 1 0%"
1541
- },
1542
- modelValue: {
1543
- amount: M,
1544
- measurement: C.measurement ?? null
1545
- },
1546
- key: C.id ?? C.sku._id,
1547
- unit: C.sku.unit,
1548
- "onUpdate:modelValue": (R) => {
1549
- if (!R) return;
1550
- const U = i.items.find((O) => O.id === C.id || O.sku._id === C.sku._id);
1551
- U && (U.amount = R.amount);
1552
- },
1553
- disableUnit: !0,
1554
- rules: [
1555
- m(qr)(
1556
- +m(be)({ amount: 0, precision: 0 })
1557
- ),
1558
- m(Er)(+m(be)(h.quantity))
1559
- ],
1560
- applyDefaultRules: !0
1561
- });
1562
- }
1563
- }
1564
- ],
1565
- "row-data": i.items,
1566
- "hide-footer": p.value
1567
- }, null, 8, ["column-defs", "row-data", "hide-footer"])
1568
- ])
1569
- ]),
1570
- e("div", as, [
1571
- L(y, {
1572
- class: "px-16",
1573
- label: "Confirm",
1574
- size: "md",
1575
- variant: "primary",
1576
- type: "submit"
1577
- }),
1578
- L(y, {
1579
- class: "px-16",
1580
- label: "Cancel",
1581
- size: "md",
1582
- variant: "secondary",
1583
- onClick: a[0] || (a[0] = () => n("update:show", !1))
1584
- })
1585
- ])
1586
- ]),
1587
- _: 1
1588
- }, 8, ["onValidationFailed"]);
1589
- };
1590
- }
1591
- }), ft = {
1592
- submitRequest: {
1593
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
1594
- color: "primary",
1595
- buttonVariant: Ce.Primary
1596
- },
1597
- confirmDraft: {
1598
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
1599
- color: "primary",
1600
- buttonVariant: Ce.Primary
1601
- },
1602
- cancelDraft: {
1603
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
1604
- color: "system-error-300",
1605
- buttonVariant: Ce.Destructive
1606
- },
1607
- approveDraft: {
1608
- translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
1609
- color: "primary",
1610
- buttonVariant: Ce.Primary
1611
- },
1612
- rejectDraft: {
1613
- translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
1614
- color: "system-error-300",
1615
- buttonVariant: Ce.Destructive
1616
- },
1617
- approveRequest: {
1618
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
1619
- color: "primary",
1620
- buttonVariant: Ce.Primary
1621
- },
1622
- processRequest: {
1623
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
1624
- color: "primary",
1625
- buttonVariant: Ce.Primary
1626
- },
1627
- receiveStock: {
1628
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
1629
- color: "primary",
1630
- buttonVariant: Ce.Primary,
1631
- available: !1
1632
- },
1633
- completeReceive: {
1634
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
1635
- color: "primary",
1636
- buttonVariant: Ce.Plain
1637
- },
1638
- rejectRequest: {
1639
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
1640
- color: "system-error-300",
1641
- buttonVariant: Ce.Destructive
1642
- },
1643
- closeRequest: {
1644
- translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
1645
- color: "system-error-300",
1646
- buttonVariant: Ce.Destructive,
1647
- available: !1
1648
- },
1649
- returnStock: {
1650
- translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
1651
- color: "primary",
1652
- buttonVariant: Ce.Primary,
1653
- available: !1
1654
- }
1655
- }, is = { class: "flex flex-row-reverse" }, cs = /* @__PURE__ */ Oe({
1656
- __name: "NetSuiteSync",
1657
- props: {
1658
- poRequest: {},
1659
- purchaseOrder: {},
1660
- isTransferBetweenOutlets: { type: Boolean },
1661
- scope: {}
1662
- },
1663
- setup(f) {
1664
- const r = f, s = ct(), i = Ke(), c = ut(), n = W(!1);
1665
- Z(() => {
1666
- var y, x, _, C;
1667
- let t = !0;
1668
- s.isEnabled || (t = !1);
1669
- const a = r.purchaseOrder, b = r.poRequest;
1670
- return a && ((y = a == null ? void 0 : a.supplier) != null && y.internal ? (!b && a.status == ae.enum.DRAFT && (t = !1), b && !((x = b == null ? void 0 : b.netSuite) != null && x.id) && (t = !1), r.isTransferBetweenOutlets && (t = !1)) : ((a == null ? void 0 : a.status) !== ae.enum.REQUESTING && a.supplier.internal && (t = !1), !b && !((_ = a == null ? void 0 : a.netSuite) != null && _.id) && (t = !1), !b && ((C = a == null ? void 0 : a.netSuite) != null && C.id) && (a == null ? void 0 : a.status) == ae.enum.REQUESTING && (t = !1))), t;
1671
- });
1672
- async function p() {
1673
- n.value || c.open({
1674
- title: "Sync with NetSuite",
1675
- contentComponent: z("div", [
1676
- z("p", "Are you sure you want to sync now?"),
1677
- z("br"),
1678
- z(
1679
- "p",
1680
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1681
- "Please wait a moment before syncing manually to avoid unnecessary actions."
1682
- )
1683
- ]),
1684
- primaryActions: {
1685
- text: "Sync",
1686
- close: !0,
1687
- variant: "destructive"
1688
- },
1689
- secondaryActions: { text: "Not now", close: !0 }
1690
- }).onPrimary(async () => {
1691
- var t, a, b, y, x, _, C;
1692
- try {
1693
- n.value = !0;
1694
- const h = ((t = r.purchaseOrder) == null ? void 0 : t._id) || ((a = r.poRequest) == null ? void 0 : a.purchaseOrderId) || "", M = (b = r.poRequest) == null ? void 0 : b.to.dbName;
1695
- await s.syncPurchaseOrder({
1696
- purchaseOrderId: h,
1697
- locationId: r.scope === "approval" ? M : void 0,
1698
- netsuiteId: ((x = (y = r.purchaseOrder) == null ? void 0 : y.netSuite) == null ? void 0 : x.id) || ((C = (_ = r.poRequest) == null ? void 0 : _.netSuite) == null ? void 0 : C.id)
1699
- }), i.open({
1700
- title: "Sync with NetSuite",
1701
- message: "Requested to sync with NetSuite. Please wait a moment.",
1702
- type: "success"
1703
- }), await new Promise((R) => setTimeout(R, 5e3)), n.value = !1;
1704
- } catch (h) {
1705
- console.log("Failed to sync with NetSuite", h), i.open({
1706
- title: "Error",
1707
- message: "Failed to sync with NetSuite",
1708
- type: "error"
1709
- }), n.value = !1;
1710
- }
1711
- });
1712
- }
1713
- return (t, a) => {
1714
- const b = X("FmButton");
1715
- return l(), v("div", is, [
1716
- L(b, {
1717
- "prepend-icon": "sync",
1718
- variant: "secondary",
1719
- label: "Sync",
1720
- loading: n.value,
1721
- onClick: p,
1722
- "text-color": "primary",
1723
- "bg-color": "transparent",
1724
- "border-color": "primary"
1725
- }, null, 8, ["loading"])
1726
- ]);
1727
- };
1728
- }
1729
- }), us = {
1730
- key: 0,
1731
- class: "flex flex-col gap-8"
1732
- }, ds = { class: "flex flex-col gap-4" }, ms = { class: "fm-typo-en-body-lg-600" }, ps = {
1733
- key: 0,
1734
- class: "flex flex-col gap-4"
1735
- }, fs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ys = { class: "fm-typo-en-body-lg-600" }, vs = { key: 0 }, bs = { key: 1 }, hs = {
1736
- key: 1,
1737
- class: "flex flex-col gap-4"
1738
- }, gs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _s = { class: "fm-typo-en-body-lg-600" }, xs = { key: 0 }, Ss = { key: 1 }, Os = {
1739
- key: 2,
1740
- class: "flex flex-col gap-4"
1741
- }, ws = { class: "fm-typo-en-body-lg-600" }, Cs = {
1742
- key: 3,
1743
- class: "flex flex-col gap-4"
1744
- }, Ds = { class: "fm-typo-en-body-lg-600" }, $s = /* @__PURE__ */ Oe({
1745
- __name: "NetSuiteInfo",
1746
- props: {
1747
- transferType: {},
1748
- transferToDbName: {},
1749
- poRequest: {},
1750
- purchaseOrder: {},
1751
- isTransferBetweenOutlets: { type: Boolean },
1752
- scope: {}
1753
- },
1754
- setup(f) {
1755
- const r = f, s = ct(), i = He(), c = W(r.poRequest);
1756
- Ut(async () => {
1757
- var a;
1758
- if (!r.poRequest && ((a = r.purchaseOrder) != null && a._id)) {
1759
- const b = await i.getLatestPurchaseOrderRequest(r.purchaseOrder._id);
1760
- c.value = b;
1761
- }
1762
- });
1763
- const n = Z(
1764
- () => {
1765
- var a, b, y, x, _, C;
1766
- return s.getSubsidiaryFullName(
1767
- ((y = (b = (a = r.purchaseOrder) == null ? void 0 : a.netSuite) == null ? void 0 : b.subsidiary) == null ? void 0 : y.id) || ((C = (_ = (x = r.poRequest) == null ? void 0 : x.netSuite) == null ? void 0 : _.subsidiary) == null ? void 0 : C.id)
1768
- ).fullName;
1769
- }
1770
- ), p = Z(() => {
1771
- var a, b, y, x, _, C, h, M, R, U, O, k;
1772
- return (y = (b = (a = r.purchaseOrder) == null ? void 0 : a.netSuite) == null ? void 0 : b.additionalInfo) != null && y.transactionnumber ? (C = (_ = (x = r.purchaseOrder) == null ? void 0 : x.netSuite) == null ? void 0 : _.additionalInfo) == null ? void 0 : C.transactionnumber : (R = (M = (h = c.value) == null ? void 0 : h.netSuite) == null ? void 0 : M.additionalInfo) != null && R.transactionnumber ? (k = (O = (U = c.value) == null ? void 0 : U.netSuite) == null ? void 0 : O.additionalInfo) == null ? void 0 : k.transactionnumber : null;
1773
- }), t = Z(() => {
1774
- var a, b, y, x, _, C;
1775
- return (b = (a = r.purchaseOrder) == null ? void 0 : a.deliveryFullfillment) != null && b.length && ((x = (y = r.purchaseOrder) == null ? void 0 : y.deliveryFullfillment) == null ? void 0 : x.length) > 0 ? (C = (_ = r.purchaseOrder) == null ? void 0 : _.deliveryFullfillment) == null ? void 0 : C.map((h) => {
1776
- var M;
1777
- return (M = h.netSuite) == null ? void 0 : M.refNo;
1778
- }).join(", ") : "N/A";
1779
- });
1780
- return (a, b) => {
1781
- var y, x, _, C, h, M, R, U, O, k, Y, A, T, $, S, q;
1782
- return m(s).isEnabled ? (l(), v("div", us, [
1783
- e("div", ds, [
1784
- b[0] || (b[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
1785
- e("div", ms, d(n.value || "N/A"), 1)
1786
- ]),
1787
- !a.isTransferBetweenOutlets && a.scope === m(bt).RECEIVE_REQUEST ? (l(), v("div", ps, [
1788
- e("div", fs, " NetSuite " + d((x = (y = a.purchaseOrder) == null ? void 0 : y.netSuite) != null && x.recordType ? m(zt)((C = (_ = a.purchaseOrder) == null ? void 0 : _.netSuite) == null ? void 0 : C.recordType) : a.transferType === m(Xe).enum.purchase ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1789
- e("div", ys, [
1790
- (M = (h = a.purchaseOrder) == null ? void 0 : h.netSuite) != null && M.id ? (l(), v("span", vs, d((U = (R = a.purchaseOrder) == null ? void 0 : R.netSuite) == null ? void 0 : U.refNo) + " (" + d((k = (O = a.purchaseOrder) == null ? void 0 : O.netSuite) == null ? void 0 : k.id) + ") ", 1)) : (l(), v("span", bs, "N/A"))
1791
- ])
1792
- ])) : j("", !0),
1793
- !a.isTransferBetweenOutlets && c.value || a.scope === m(bt).APPROVAL ? (l(), v("div", hs, [
1794
- e("div", gs, " (Request) NetSuite " + d(a.transferType === m(Xe).enum.purchase ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1795
- e("div", _s, [
1796
- (A = (Y = c.value) == null ? void 0 : Y.netSuite) != null && A.id ? (l(), v("span", xs, d(($ = (T = c.value) == null ? void 0 : T.netSuite) == null ? void 0 : $.refNo) + " (" + d((q = (S = c.value) == null ? void 0 : S.netSuite) == null ? void 0 : q.id) + ") ", 1)) : (l(), v("span", Ss, "N/A"))
1797
- ])
1798
- ])) : j("", !0),
1799
- p.value ? (l(), v("div", Os, [
1800
- b[1] || (b[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
1801
- e("div", ws, d(p.value), 1)
1802
- ])) : j("", !0),
1803
- m(s).isEnabled && a.transferType === m(Xe).enum.transfer && !a.isTransferBetweenOutlets ? (l(), v("div", Cs, [
1804
- b[2] || (b[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1805
- e("div", Ds, d(t.value), 1)
1806
- ])) : j("", !0)
1807
- ])) : j("", !0);
1808
- };
1809
- }
1810
- }), ks = { class: "flex flex-row-reverse" }, Rs = /* @__PURE__ */ Oe({
1811
- __name: "NetSuiteLog",
1812
- props: {
1813
- netsuiteId: {},
1814
- purchaseOrderId: {}
1815
- },
1816
- setup(f) {
1817
- const r = Ke(), s = xt();
1818
- async function i(c, n) {
1819
- const p = [];
1820
- if (c && p.push(`body.message:*${c}*`), n) {
1821
- const y = n.replace(/:/g, "\\:");
1822
- p.push(`${y}`);
1823
- }
1824
- if (p.length === 0) {
1825
- r.open({
1826
- message: "Cannot open logs without valid filters.",
1827
- type: "error"
1828
- });
1829
- return;
1830
- }
1831
- const a = `attributes.pod:netsuite* AND (${p.join(" OR ")})`, { url: b } = await s.getSyncLogs(a);
1832
- r.open(
1833
- {
1834
- message: "Opening NetSuite logs...",
1835
- type: "info"
1836
- },
1837
- 800
1838
- ), await new Promise((y) => setTimeout(y, 800)), window.open(b, "_blank");
1839
- }
1840
- return (c, n) => {
1841
- const p = X("FmButton");
1842
- return l(), v("div", ks, [
1843
- L(p, {
1844
- "prepend-icon": "history",
1845
- variant: "secondary",
1846
- label: "Logs",
1847
- onClick: n[0] || (n[0] = (t) => i(c.netsuiteId, c.purchaseOrderId)),
1848
- "text-color": "primary",
1849
- "bg-color": "transparent",
1850
- "border-color": "primary"
1851
- })
1852
- ]);
1853
- };
1854
- }
1855
- }), Ns = { class: "flex flex-row-reverse" }, As = { key: 0 }, Ps = { key: 1 }, Ts = { class: "mb-6" }, Fs = { class: "fm-typo-en-body-md-400" }, Is = { key: 0 }, qs = { key: 1 }, Es = {
1856
- key: 0,
1857
- class: "flex"
1858
- }, Vs = {
1859
- key: 1,
1860
- class: "border-t pt-6"
1861
- }, Ls = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, js = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, Ms = { class: "w-full" }, Us = {
1862
- class: "p-3 fm-typo-en-body-sm-600",
1863
- style: { "min-width": "130px" }
1864
- }, Bs = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, zs = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ks = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Hs = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Gs = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ws = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ys = { class: "p-3 fm-typo-en-body-sm-600" }, Qs = { key: 2 }, Js = { key: 1 }, Xs = /* @__PURE__ */ Oe({
1865
- __name: "NetSuiteLatestInfo",
1866
- props: {
1867
- netsuiteId: {},
1868
- purchaseOrderId: {}
1869
- },
1870
- setup(f) {
1871
- const r = f, s = xt(), i = W(!1), c = Te(), n = W(!0), p = W(!1), t = W(!1), a = W(!1), b = W(null), y = W([]);
1872
- async function x() {
1873
- if (!b.value) {
1874
- i.value = !0;
1875
- try {
1876
- n.value = !0;
1877
- const M = await s.getMoreInfo(
1878
- c.currentLocation.dbName,
1879
- r.purchaseOrderId
1880
- );
1881
- b.value = M, p.value = !1;
1882
- } catch {
1883
- p.value = !0;
1884
- } finally {
1885
- n.value = !1;
1886
- }
1887
- await _();
1888
- }
1889
- }
1890
- async function _() {
1891
- if (!(y.value.length > 0))
1892
- try {
1893
- t.value = !0;
1894
- const M = await s.getChangeLogs(r.netsuiteId);
1895
- y.value = M, a.value = !1;
1896
- } catch {
1897
- a.value = !0;
1898
- } finally {
1899
- t.value = !1;
1900
- }
1901
- }
1902
- function C(M) {
1903
- switch (M) {
1904
- case Ne.Create:
1905
- return "text-green-600 bg-green-100";
1906
- case Ne.Set:
1907
- return "text-blue-600 bg-blue-100";
1908
- case Ne.Change:
1909
- return "text-yellow-600 bg-yellow-100";
1910
- case Ne.Unset:
1911
- return "text-red-600 bg-red-100";
1912
- default:
1913
- return "text-gray-600 bg-gray-100";
1914
- }
1915
- }
1916
- function h(M) {
1917
- return new Date(M).toLocaleDateString("en-US", {
1918
- year: "numeric",
1919
- month: "short",
1920
- day: "numeric",
1921
- hour: "2-digit",
1922
- minute: "2-digit"
1923
- });
1924
- }
1925
- return (M, R) => {
1926
- const U = X("FmButton"), O = X("FmLabel"), k = X("FmCircularProgress"), Y = X("FmIcon"), A = X("FmDialog");
1927
- return l(), v("div", Ns, [
1928
- L(A, {
1929
- modelValue: i.value,
1930
- "onUpdate:modelValue": R[2] || (R[2] = (T) => i.value = T),
1931
- overlay: !0,
1932
- "max-width": 800
1933
- }, {
1934
- "dialog-button": oe(() => [
1935
- L(U, {
1936
- "prepend-icon": "info",
1937
- variant: "secondary",
1938
- label: "Latest Info",
1939
- onClick: R[0] || (R[0] = (T) => x()),
1940
- "text-color": "primary",
1941
- "bg-color": "transparent",
1942
- "border-color": "primary"
1943
- })
1944
- ]),
1945
- "dialog-header": oe(() => R[3] || (R[3] = [
1946
- e("div", null, "NetSuite latest info", -1)
1947
- ])),
1948
- default: oe(() => [
1949
- n.value ? (l(), v("div", As, "Loading...")) : (l(), v("div", Ps, [
1950
- p.value ? (l(), v("p", Js, "Something went wrong.")) : (l(), v(fe, { key: 0 }, [
1951
- e("div", Ts, [
1952
- R[4] || (R[4] = e("h3", { class: "fm-typo-en-body-lg-600 mb-4" }, "NetSuite Order Details", -1)),
1953
- (l(!0), v(fe, null, ke(b.value, (T, $) => (l(), v("div", {
1954
- key: $,
1955
- class: "mb-2"
1956
- }, [
1957
- e("div", null, [
1958
- L(O, {
1959
- label: m(ht)($)
1960
- }, null, 8, ["label"]),
1961
- e("div", Fs, [
1962
- Array.isArray(T) ? (l(), v("span", Is, d(T.length > 0 ? T.join(", ") : "N/A"), 1)) : (l(), v("span", qs, d(T), 1))
1963
- ])
1964
- ])
1965
- ]))), 128))
1966
- ]),
1967
- t.value ? (l(), v("div", Es, [
1968
- R[5] || (R[5] = e("span", null, "Change Log Loading...", -1)),
1969
- L(k, { size: "md" })
1970
- ])) : j("", !0),
1971
- !t.value && y.value.length > 0 ? (l(), v("div", Vs, [
1972
- e("h3", Ls, [
1973
- L(Y, {
1974
- name: "error",
1975
- color: "#ff9500",
1976
- size: "sm"
1977
- }),
1978
- R[6] || (R[6] = Ee(" Change Logs "))
1979
- ]),
1980
- e("div", js, [
1981
- e("table", Ms, [
1982
- R[7] || (R[7] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
1983
- e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
1984
- e("th", {
1985
- class: "text-left p-3 fm-typo-en-body-md-600",
1986
- style: { "min-width": "130px" }
1987
- }, " Date "),
1988
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
1989
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
1990
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
1991
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
1992
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
1993
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
1994
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
1995
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
1996
- ])
1997
- ], -1)),
1998
- e("tbody", null, [
1999
- (l(!0), v(fe, null, ke(y.value, (T, $) => (l(), v("tr", {
2000
- key: $,
2001
- class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
2002
- }, [
2003
- e("td", Us, d(h(T._dateiso8601)), 1),
2004
- e("td", Bs, d(T._rolename), 1),
2005
- e("td", zs, d(T._employeename), 1),
2006
- e("td", Ks, d(T._contextname), 1),
2007
- e("td", {
2008
- class: Pe(`p-3 fm-typo-en-body-sm-600 ${C(Number(T.type) - 1)}`)
2009
- }, d(m(Ne)[Number(T.type) - 1]), 3),
2010
- e("td", Hs, d(T.lineid || ""), 1),
2011
- e("td", Gs, d(T._fieldname), 1),
2012
- e("td", Ws, d(T.oldvalue || ""), 1),
2013
- e("td", Ys, d(T.newvalue || ""), 1)
2014
- ]))), 128))
2015
- ])
2016
- ])
2017
- ])
2018
- ])) : (l(), v("div", Qs, R[8] || (R[8] = [
2019
- e("p", null, "No change logs available.", -1)
2020
- ])))
2021
- ], 64))
2022
- ]))
2023
- ]),
2024
- "dialog-footer": oe(() => [
2025
- L(U, {
2026
- class: "ml-auto sm:w-full xs:w-full",
2027
- label: "Close",
2028
- size: "md",
2029
- variant: "primary",
2030
- onClick: R[1] || (R[1] = (T) => i.value = !1)
2031
- })
2032
- ]),
2033
- _: 1
2034
- }, 8, ["modelValue"])
2035
- ]);
2036
- };
2037
- }
2038
- }), Zs = {
2039
- key: 0,
2040
- class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
2041
- }, eo = { class: "flex gap-8 items-center" }, to = { class: "ml-auto" }, ro = { class: "flex gap-3" }, so = /* @__PURE__ */ Oe({
2042
- __name: "NetSuitePanel",
2043
- props: {
2044
- poRequest: {},
2045
- purchaseOrder: {},
2046
- transferType: {},
2047
- transferToDbName: {},
2048
- scope: {}
2049
- },
2050
- setup(f) {
2051
- const r = f, s = Lr(), i = Z(() => s.isNetSuiteEnabled);
2052
- return (c, n) => {
2053
- var t, a;
2054
- const p = X("FmMenuDivider");
2055
- return i.value ? (l(), v("div", Zs, [
2056
- e("div", eo, [
2057
- n[0] || (n[0] = e("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
2058
- e("div", to, [
2059
- e("div", ro, [
2060
- (a = (t = r.purchaseOrder) == null ? void 0 : t.netSuite) != null && a.id ? (l(), ie(ze, { key: 0 }, {
2061
- default: oe(() => {
2062
- var b, y, x;
2063
- return [
2064
- L(Xs, {
2065
- "netsuite-id": (y = (b = c.purchaseOrder) == null ? void 0 : b.netSuite) == null ? void 0 : y.id,
2066
- "purchase-order-id": (x = c.purchaseOrder) == null ? void 0 : x._id
2067
- }, null, 8, ["netsuite-id", "purchase-order-id"])
2068
- ];
2069
- }),
2070
- _: 1
2071
- })) : j("", !0),
2072
- L(ze, null, {
2073
- default: oe(() => {
2074
- var b, y, x;
2075
- return [
2076
- L(Rs, {
2077
- "netsuite-id": (y = (b = c.purchaseOrder) == null ? void 0 : b.netSuite) == null ? void 0 : y.id,
2078
- "purchase-order-id": (x = c.purchaseOrder) == null ? void 0 : x._id
2079
- }, null, 8, ["netsuite-id", "purchase-order-id"])
2080
- ];
2081
- }),
2082
- _: 1
2083
- }),
2084
- L(cs, {
2085
- "po-request": c.poRequest,
2086
- "purchase-order": c.purchaseOrder,
2087
- "is-transfer-between-outlets": !i.value,
2088
- scope: c.scope
2089
- }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
2090
- ])
2091
- ])
2092
- ]),
2093
- L(p),
2094
- L($s, {
2095
- "po-request": c.poRequest,
2096
- "purchase-order": c.purchaseOrder,
2097
- "transfer-type": c.transferType,
2098
- "transfer-to-db-name": c.transferToDbName,
2099
- "is-transfer-between-outlets": !i.value,
2100
- scope: c.scope
2101
- }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
2102
- ])) : j("", !0);
2103
- };
2104
- }
2105
- }), oo = ["open"], no = { class: "fm-typo-en-body-sm-600 cursor-pointer select-none" }, Mt = /* @__PURE__ */ Oe({
2106
- __name: "FmAdminCollapsiblePanel",
2107
- props: {
2108
- title: { default: "Admin" },
2109
- open: { type: Boolean, default: !1 },
2110
- selectable: { type: Boolean, default: !0 },
2111
- class: { default: void 0 },
2112
- contentClass: { default: void 0 }
2113
- },
2114
- setup(f) {
2115
- const r = f;
2116
- return (s, i) => (l(), ie(ze, {
2117
- selectable: r.selectable,
2118
- class: Pe(r.class)
2119
- }, {
2120
- default: oe(() => [
2121
- e("details", {
2122
- open: r.open,
2123
- class: "w-full"
2124
- }, [
2125
- e("summary", no, d(r.title), 1),
2126
- e("div", {
2127
- class: Pe(["mt-4 flex flex-col gap-2", r.contentClass])
2128
- }, [
2129
- cr(s.$slots, "default")
2130
- ], 2)
2131
- ], 8, oo)
2132
- ]),
2133
- _: 3
2134
- }, 8, ["selectable", "class"]));
2135
- }
2136
- }), ao = { class: "flex flex-col gap-3" }, lo = { class: "flex flex-col gap-4" }, io = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, co = { class: "flex flex-col gap-4" }, uo = { class: "flex justify-between items-center py-1 gap-4" }, mo = { class: "flex flex-col" }, po = { class: "fm-typo-en-body-lg-600" }, fo = { class: "fm-typo-en-body-md-400" }, yo = { class: "flex flex-col gap-2 items-end" }, vo = { class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, bo = {
2137
- key: 0,
2138
- class: "flex items-center gap-2"
2139
- }, ho = {
2140
- key: 0,
2141
- class: "border-b border-fm-color-stroke-secondary"
2142
- }, go = { class: "flex flex-col gap-4" }, _o = { class: "flex flex-col gap-4" }, xo = { class: "flex flex-col gap-4" }, So = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Oo = {
2143
- key: 0,
2144
- class: "flex flex-col gap-4"
2145
- }, wo = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Co = /* @__PURE__ */ Oe({
2146
- __name: "EditForm",
2147
- props: {
2148
- purchaseOrder: {},
2149
- deliveryOrder: {}
2150
- },
2151
- emits: ["submitted"],
2152
- setup(f, { emit: r }) {
2153
- Br();
2154
- const s = Ve(), i = Ke(), c = W(!1), n = f, p = r, t = Kt("deliveryOrder"), a = He(), b = Z(
2155
- () => {
2156
- var U;
2157
- return ((U = n.purchaseOrder.deliveryFullfillment) == null ? void 0 : U.findIndex(
2158
- (O) => n.deliveryOrder.fullfillmentId && O.id === n.deliveryOrder.fullfillmentId
2159
- )) ?? -1;
2160
- }
2161
- ), y = s.enablePurchaseOrderReceiveWithCustomCost, x = s.enablePortalDeliveryOrderWrite, _ = W({}), C = Z(() => n.purchaseOrder.items.map((U, O) => Z({
2162
- get: () => {
2163
- var Y;
2164
- const k = (Y = t.received[O]) == null ? void 0 : Y.cost;
2165
- return k ? +be(k) : 0;
2166
- },
2167
- set: (k) => {
2168
- t.received[O].cost = {
2169
- currency: De(),
2170
- ...ot(k, 4)
2171
- };
2172
- }
2173
- }))), h = Z(() => n.deliveryOrder.received.map((U, O) => Z({
2174
- get: () => {
2175
- var Y;
2176
- const k = (Y = t.received[O]) == null ? void 0 : Y.amount;
2177
- return k ? +be(k) : 0;
2178
- },
2179
- set: (k) => {
2180
- t.received[O].amount = ot(k, 2);
2181
- }
2182
- })));
2183
- function M(U) {
2184
- const O = !_.value[U];
2185
- if (_.value[U] = O, O) {
2186
- const k = n.deliveryOrder.received[U];
2187
- k.cost ? t.received[U].cost = {
2188
- currency: k.cost.currency,
2189
- amount: k.cost.amount,
2190
- precision: k.cost.precision
2191
- } : t.received[U].cost = {
2192
- currency: De(),
2193
- amount: 0,
2194
- precision: 4
2195
- };
2196
- } else
2197
- delete t.received[U].cost;
2198
- }
2199
- function R() {
2200
- a.updateDeliveryOrder({
2201
- deliveryOrder: {
2202
- ...n.deliveryOrder,
2203
- ...t
2204
- },
2205
- purchaseOrderId: n.purchaseOrder._id,
2206
- purchaseOrderRev: n.purchaseOrder._rev
2207
- }).then(() => {
2208
- i.open(
2209
- {
2210
- title: "Success",
2211
- message: `PO# ${n.purchaseOrder.seqNumber} Changes have been saved`,
2212
- type: "success"
2213
- },
2214
- 1e4
2215
- ), c.value = !1, p("submitted");
2216
- });
2217
- }
2218
- return (U, O) => {
2219
- const k = X("FmButton"), Y = X("FmStepperField"), A = X("FmSwitch"), T = X("FmTextField"), $ = X("FmDialog");
2220
- return l(), ie($, {
2221
- modelValue: c.value,
2222
- "onUpdate:modelValue": O[1] || (O[1] = (S) => c.value = S),
2223
- overlay: !0
2224
- }, {
2225
- "dialog-button": oe(() => [
2226
- m(x) ? (l(), ie(k, {
2227
- key: 0,
2228
- variant: "plain",
2229
- label: "Edit",
2230
- size: "md",
2231
- "prepend-icon": "edit"
2232
- })) : j("", !0)
2233
- ]),
2234
- "dialog-header": oe(() => [
2235
- e("div", null, "Received on " + d(m(Ze)(n.deliveryOrder.createdAt)), 1)
2236
- ]),
2237
- "dialog-footer": oe(() => [
2238
- L(k, {
2239
- class: "ml-auto",
2240
- label: "Apply changes",
2241
- size: "md",
2242
- variant: "destructive",
2243
- onClick: R
2244
- })
2245
- ]),
2246
- default: oe(() => [
2247
- e("div", null, [
2248
- e("div", ao, [
2249
- e("div", lo, [
2250
- O[2] || (O[2] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Adjustment date", -1)),
2251
- e("div", io, d(n.deliveryOrder.adjustment ? m(Ze)(new Date(m(st)(n.deliveryOrder.adjustment))) : "-"), 1)
2252
- ]),
2253
- e("div", co, [
2254
- O[4] || (O[4] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received items", -1)),
2255
- (l(!0), v(fe, null, ke(n.deliveryOrder.received, (S, q) => {
2256
- var G;
2257
- return l(), v("div", { key: q }, [
2258
- e("div", uo, [
2259
- e("div", mo, [
2260
- e("span", po, d(S.sku.name), 1),
2261
- e("span", fo, d(S.sku.code), 1)
2262
- ]),
2263
- e("div", yo, [
2264
- L(Y, {
2265
- label: "Receive Quantity",
2266
- modelValue: h.value[q].value,
2267
- "onUpdate:modelValue": (Q) => h.value[q].value = Q,
2268
- min: 0,
2269
- "append-text": ((G = S.measurement) == null ? void 0 : G.abbrev) ?? S.sku.unit.abbrev
2270
- }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"]),
2271
- e("div", vo, d(`${S.cost ? `${m(Qe)(S.cost)}` : ""}`), 1),
2272
- m(y) ? (l(), v("div", bo, [
2273
- L(A, {
2274
- "model-value": _.value[q],
2275
- "onUpdate:modelValue": (Q) => M(q),
2276
- size: "sm"
2277
- }, null, 8, ["model-value", "onUpdate:modelValue"]),
2278
- O[3] || (O[3] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
2279
- ])) : j("", !0),
2280
- m(y) && _.value[q] ? (l(), ie(Y, {
2281
- key: 1,
2282
- modelValue: C.value[q].value,
2283
- "onUpdate:modelValue": (Q) => C.value[q].value = Q,
2284
- label: "Total Cost",
2285
- step: 1e-4,
2286
- min: 0,
2287
- placeholder: "0.0000",
2288
- size: "sm",
2289
- "append-text": m(De)()
2290
- }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : j("", !0)
2291
- ])
2292
- ]),
2293
- q < n.purchaseOrder.items.length - 1 ? (l(), v("div", ho)) : j("", !0)
2294
- ]);
2295
- }), 128))
2296
- ]),
2297
- e("div", go, [
2298
- O[5] || (O[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
2299
- e("div", _o, [
2300
- L(T, {
2301
- modelValue: m(t).deliveryOrderNumber,
2302
- "onUpdate:modelValue": O[0] || (O[0] = (S) => m(t).deliveryOrderNumber = S),
2303
- size: "md",
2304
- placeholder: n.deliveryOrder.deliveryOrderNumber
2305
- }, null, 8, ["modelValue", "placeholder"])
2306
- ])
2307
- ]),
2308
- e("div", xo, [
2309
- O[6] || (O[6] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
2310
- e("div", So, d(n.deliveryOrder.remark || "N/A"), 1)
2311
- ]),
2312
- b.value >= 0 ? (l(), v("div", Oo, [
2313
- O[7] || (O[7] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fulfilment's sequence ", -1)),
2314
- e("div", wo, d(b.value + 1), 1)
2315
- ])) : j("", !0)
2316
- ])
2317
- ])
2318
- ]),
2319
- _: 1
2320
- }, 8, ["modelValue"]);
2321
- };
2322
- }
2323
- }), Do = { class: "flex flex-col gap-3" }, $o = { class: "flex flex-col gap-4" }, ko = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Ro = {
2324
- key: 0,
2325
- class: "flex flex-col gap-4"
2326
- }, No = { class: "flex items-center justify-between" }, Ao = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Po = {
2327
- key: 0,
2328
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
2329
- }, To = { class: "flex gap-4" }, Fo = { class: "flex-1" }, Io = { class: "flex-1" }, qo = {
2330
- key: 0,
2331
- class: "flex items-center text-fm-color-system-error-300"
2332
- }, Eo = { class: "fm-typo-en-body-md-400" }, Vo = { class: "flex flex-col gap-4" }, Lo = { class: "flex justify-between items-center py-1 gap-4" }, jo = { class: "flex flex-col" }, Mo = { class: "fm-typo-en-body-lg-600" }, Uo = { class: "fm-typo-en-body-md-400" }, Bo = { class: "flex flex-col gap-2 items-end" }, zo = {
2333
- key: 0,
2334
- class: "flex items-center gap-2"
2335
- }, Ko = {
2336
- key: 0,
2337
- class: "border-b border-fm-color-stroke-secondary"
2338
- }, Ho = { class: "flex flex-col gap-4" }, Go = { class: "flex flex-col gap-4" }, Wo = { class: "flex flex-col gap-4" }, Yo = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Qo = /* @__PURE__ */ Oe({
2339
- __name: "CreateForm",
2340
- props: {
2341
- purchaseOrder: {},
2342
- receivedInfoMap: {}
2343
- },
2344
- emits: ["submitted"],
2345
- setup(f, { emit: r }) {
2346
- var E, F, ee;
2347
- const { t: s } = it(), i = W(!1), c = _t(), n = f, p = r, t = Kt("", {
2348
- default: {
2349
- deliveryOrderNumber: "",
2350
- remark: "",
2351
- received: n.purchaseOrder.items.map((w) => ({
2352
- sku: w.sku,
2353
- amount: Ue.fromNumber(0),
2354
- measurement: w.measurement
2355
- })),
2356
- createdBy: {
2357
- id: ((E = c.sessionUser.value) == null ? void 0 : E.id) || "",
2358
- name: ((F = c.sessionUser.value) == null ? void 0 : F.displayName) || ""
2359
- },
2360
- createdAt: ""
2361
- }
2362
- }), a = He(), b = ut(), y = Ve(), x = ((ee = n.purchaseOrder) == null ? void 0 : ee.supplier.internal) != null, _ = x && y.enablePOSTransferRequireFulfillment, C = y.enablePortalDeliveryOrderWrite && (n.purchaseOrder.status === ae.Enum.RECEIVING || n.purchaseOrder.status === ae.Enum.COMPLETE) && (x ? !_ : !0), h = y.enablePurchaseOrderReceiveWithCustomCost, M = y.enableBackdateReceive, R = W({}), U = Ke(), O = Z({
2363
- get() {
2364
- if (!t.createdAt) return "";
2365
- const w = new Date(t.createdAt), g = w.getFullYear(), V = String(w.getMonth() + 1).padStart(2, "0"), H = String(w.getDate()).padStart(2, "0");
2366
- return `${g}-${V}-${H}`;
2367
- },
2368
- set(w) {
2369
- if (w) {
2370
- const g = t.createdAt ? new Date(t.createdAt) : /* @__PURE__ */ new Date(), [V, H, ce] = w.split("-");
2371
- g.setFullYear(parseInt(V)), g.setMonth(parseInt(H) - 1), g.setDate(parseInt(ce)), t.createdAt = g.toISOString();
2372
- }
2373
- }
2374
- }), k = Z({
2375
- get() {
2376
- if (!t.createdAt) return "";
2377
- const w = new Date(t.createdAt), g = String(w.getHours()).padStart(2, "0"), V = String(w.getMinutes()).padStart(2, "0");
2378
- return `${g}:${V}`;
2379
- },
2380
- set(w) {
2381
- if (w) {
2382
- const g = t.createdAt ? new Date(t.createdAt) : /* @__PURE__ */ new Date(), [V, H] = w.split(":");
2383
- g.setHours(parseInt(V)), g.setMinutes(parseInt(H)), t.createdAt = g.toISOString();
2384
- }
2385
- }
2386
- }), Y = Z(() => {
2387
- const w = st(n.purchaseOrder._id);
2388
- if (!w) return "";
2389
- const g = new Date(w), V = g.getFullYear(), H = String(g.getMonth() + 1).padStart(2, "0"), ce = String(g.getDate()).padStart(2, "0");
2390
- return `${V}-${H}-${ce}`;
2391
- }), A = Z(() => {
2392
- const w = st(n.purchaseOrder._id);
2393
- return w ? new Date(w) : null;
2394
- }), T = Z(() => {
2395
- if (!O.value || !k.value || !A.value) return null;
2396
- if (/* @__PURE__ */ new Date(`${O.value}T${k.value}:00`) < A.value) {
2397
- const g = Y.value, V = A.value.getHours(), H = A.value.getMinutes(), ce = V >= 12 ? "PM" : "AM", Re = V % 12 || 12, we = `${String(Re).padStart(2, "0")}:${String(H).padStart(2, "0")} ${ce}`;
2398
- return `Delivery date & time cannot be earlier than order creation (${g} ${we})`;
2399
- }
2400
- return null;
2401
- }), $ = Z(() => T.value ? !1 : t.received.some((g) => {
2402
- const V = g.amount;
2403
- return V ? +be(V) > 0 : !1;
2404
- }));
2405
- function S() {
2406
- t.createdAt = "";
2407
- }
2408
- const q = Z(() => n.purchaseOrder.items.map((w, g) => Z({
2409
- get: () => {
2410
- var H;
2411
- const V = (H = t.received[g]) == null ? void 0 : H.amount;
2412
- return V ? +be(V) : 0;
2413
- },
2414
- set: (V) => {
2415
- t.received[g].amount = ot(V, 2);
2416
- }
2417
- })));
2418
- function G(w) {
2419
- const g = !R.value[w];
2420
- if (R.value[w] = g, g) {
2421
- const V = n.purchaseOrder.items[w];
2422
- V.totalCost ? t.received[w].cost = {
2423
- currency: V.totalCost.currency,
2424
- amount: V.totalCost.amount,
2425
- precision: 4
2426
- // Standardize to 4 decimals
2427
- } : t.received[w].cost = {
2428
- currency: De(),
2429
- amount: 0,
2430
- precision: 4
2431
- };
2432
- } else
2433
- delete t.received[w].cost;
2434
- }
2435
- const Q = Z(() => n.purchaseOrder.items.map((w, g) => Z({
2436
- get: () => {
2437
- var H;
2438
- const V = (H = t.received[g]) == null ? void 0 : H.cost;
2439
- return V ? +be(V) : 0;
2440
- },
2441
- set: (V) => {
2442
- t.received[g].cost = {
2443
- currency: De(),
2444
- ...ot(V, 4)
2445
- };
2446
- }
2447
- })));
2448
- function ye() {
2449
- b.open({
2450
- title: "Confirm Create Delivery Order",
2451
- message: `Are you sure you want to create delivery order for PO# ${n.purchaseOrder.seqNumber}?`,
2452
- primaryActions: {
2453
- text: "Create",
2454
- close: !0,
2455
- variant: "primary"
2456
- },
2457
- secondaryActions: {
2458
- text: "Cancel",
2459
- close: !0
2460
- }
2461
- }).onPrimary(() => he());
2462
- }
2463
- function he() {
2464
- a.createDeliveryOrder({
2465
- deliveryOrder: t,
2466
- purchaseOrderId: n.purchaseOrder._id,
2467
- purchaseOrderRev: n.purchaseOrder._rev,
2468
- currency: De()
2469
- }).then(() => {
2470
- U.open(
2471
- {
2472
- title: "Success",
2473
- message: `New delivery order created for PO# ${n.purchaseOrder.seqNumber}`,
2474
- type: "success"
2475
- },
2476
- 1e4
2477
- ), i.value = !1, p("submitted");
2478
- });
2479
- }
2480
- return (w, g) => {
2481
- const V = X("FmButton"), H = X("FmDatePicker"), ce = X("FmTimePicker"), Re = X("FmIcon"), we = X("FmStepperField"), Ge = X("FmSwitch"), o = X("FmTextField"), u = X("FmDialog");
2482
- return l(), ie(u, {
2483
- modelValue: i.value,
2484
- "onUpdate:modelValue": g[4] || (g[4] = (I) => i.value = I),
2485
- overlay: !0,
2486
- "min-width": 800
2487
- }, {
2488
- "dialog-button": oe(() => [
2489
- m(C) ? (l(), ie(V, {
2490
- key: 0,
2491
- variant: "primary",
2492
- label: "Create",
2493
- size: "md",
2494
- "prepend-icon": "add",
2495
- class: "w-full"
2496
- })) : j("", !0)
2497
- ]),
2498
- "dialog-header": oe(() => [
2499
- e("div", null, "Order #" + d(n.purchaseOrder.seqNumber) + " (New Delivery Order)", 1)
2500
- ]),
2501
- "dialog-footer": oe(() => [
2502
- L(V, {
2503
- class: "ml-auto",
2504
- label: "Create",
2505
- size: "md",
2506
- variant: "destructive",
2507
- disabled: !$.value,
2508
- onClick: ye
2509
- }, null, 8, ["disabled"])
2510
- ]),
2511
- default: oe(() => {
2512
- var I;
2513
- return [
2514
- e("div", Do, [
2515
- e("div", $o, [
2516
- g[5] || (g[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received by", -1)),
2517
- e("div", ko, d((I = m(c).sessionUser.value) == null ? void 0 : I.displayName), 1)
2518
- ]),
2519
- m(M) ? (l(), v("div", Ro, [
2520
- e("div", No, [
2521
- e("div", Ao, [
2522
- g[6] || (g[6] = Ee(" Delivery Date & Time ")),
2523
- !O.value && !k.value ? (l(), v("div", Po, " Leave blank to use current date & time ")) : j("", !0)
2524
- ]),
2525
- O.value || k.value ? (l(), ie(V, {
2526
- key: 0,
2527
- variant: "tertiary",
2528
- label: "Clear",
2529
- "prepend-icon": "close",
2530
- onClick: S
2531
- })) : j("", !0)
2532
- ]),
2533
- e("div", To, [
2534
- e("div", Fo, [
2535
- L(H, {
2536
- modelValue: O.value,
2537
- "onUpdate:modelValue": g[0] || (g[0] = (P) => O.value = P)
2538
- }, null, 8, ["modelValue"])
2539
- ]),
2540
- e("div", Io, [
2541
- L(ce, {
2542
- modelValue: k.value,
2543
- "onUpdate:modelValue": g[1] || (g[1] = (P) => k.value = P)
2544
- }, null, 8, ["modelValue"])
2545
- ])
2546
- ]),
2547
- T.value ? (l(), v("div", qo, [
2548
- L(Re, {
2549
- name: "error",
2550
- class: "inline-block mr-1",
2551
- size: "sm"
2552
- }),
2553
- e("div", Eo, d(T.value), 1)
2554
- ])) : j("", !0)
2555
- ])) : j("", !0),
2556
- e("div", Vo, [
2557
- g[8] || (g[8] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Items going to receive ", -1)),
2558
- (l(!0), v(fe, null, ke(n.purchaseOrder.items, (P, K) => {
2559
- var B, J, D;
2560
- return l(), v("div", { key: K }, [
2561
- e("div", Lo, [
2562
- e("div", jo, [
2563
- e("span", Mo, d(P.sku.name), 1),
2564
- e("span", Uo, d(P.sku.code), 1)
2565
- ]),
2566
- e("div", Bo, [
2567
- L(we, {
2568
- label: "Receive Quantity",
2569
- modelValue: q.value[K].value,
2570
- "onUpdate:modelValue": (te) => q.value[K].value = te,
2571
- "helper-text": `${m(s)("inventory.transfer.receiveRequest.details.received")} ${m(Ue).toFormatString(
2572
- {
2573
- value: (B = w.receivedInfoMap[P.sku._id]) == null ? void 0 : B.received
2574
- }
2575
- )} ${((J = P.measurement) == null ? void 0 : J.abbrev) ?? P.sku.unit.abbrev}`,
2576
- min: 0,
2577
- "append-text": ((D = P.measurement) == null ? void 0 : D.abbrev) ?? P.sku.unit.abbrev
2578
- }, null, 8, ["modelValue", "onUpdate:modelValue", "helper-text", "append-text"]),
2579
- m(h) ? (l(), v("div", zo, [
2580
- L(Ge, {
2581
- "model-value": R.value[K],
2582
- "onUpdate:modelValue": (te) => G(K),
2583
- size: "sm"
2584
- }, null, 8, ["model-value", "onUpdate:modelValue"]),
2585
- g[7] || (g[7] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
2586
- ])) : j("", !0),
2587
- m(h) && R.value[K] ? (l(), ie(we, {
2588
- key: 1,
2589
- modelValue: Q.value[K].value,
2590
- "onUpdate:modelValue": (te) => Q.value[K].value = te,
2591
- label: "Total Cost",
2592
- step: 1e-4,
2593
- min: 0,
2594
- placeholder: "0.0000",
2595
- size: "sm",
2596
- "append-text": m(De)()
2597
- }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : j("", !0)
2598
- ])
2599
- ]),
2600
- K < n.purchaseOrder.items.length - 1 ? (l(), v("div", Ko)) : j("", !0)
2601
- ]);
2602
- }), 128))
2603
- ]),
2604
- e("div", Ho, [
2605
- g[9] || (g[9] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
2606
- e("div", Go, [
2607
- L(o, {
2608
- modelValue: m(t).deliveryOrderNumber,
2609
- "onUpdate:modelValue": g[2] || (g[2] = (P) => m(t).deliveryOrderNumber = P),
2610
- size: "md"
2611
- }, null, 8, ["modelValue"])
2612
- ])
2613
- ]),
2614
- e("div", Wo, [
2615
- g[10] || (g[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
2616
- e("div", Yo, [
2617
- L(o, {
2618
- modelValue: m(t).remark,
2619
- "onUpdate:modelValue": g[3] || (g[3] = (P) => m(t).remark = P),
2620
- size: "md"
2621
- }, null, 8, ["modelValue"])
2622
- ])
2623
- ])
2624
- ])
2625
- ];
2626
- }),
2627
- _: 1
2628
- }, 8, ["modelValue"]);
2629
- };
2630
- }
2631
- }), Jo = { class: "flex flex-row-reverse" }, Xo = {
2632
- key: 0,
2633
- class: "flex"
2634
- }, Zo = {
2635
- key: 1,
2636
- class: "border-t pt-6"
2637
- }, en = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, tn = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, rn = { class: "w-full" }, sn = {
2638
- class: "p-3 fm-typo-en-body-sm-600",
2639
- style: { "min-width": "130px" }
2640
- }, on = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, nn = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, an = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ln = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, cn = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, un = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, dn = { class: "p-3 fm-typo-en-body-sm-600" }, mn = { key: 2 }, pn = /* @__PURE__ */ Oe({
2641
- __name: "NetSuiteTransactionChangeLog",
2642
- props: {
2643
- netsuiteId: {}
2644
- },
2645
- setup(f) {
2646
- const r = f, s = xt(), i = W(!1), c = W(!1), n = W(!1), p = W([]);
2647
- async function t() {
2648
- if (!(p.value.length > 0))
2649
- try {
2650
- c.value = !0;
2651
- const y = await s.getChangeLogs(r.netsuiteId);
2652
- p.value = y, n.value = !1;
2653
- } catch {
2654
- n.value = !0;
2655
- } finally {
2656
- c.value = !1;
2657
- }
2658
- }
2659
- function a(y) {
2660
- switch (y) {
2661
- case Ne.Create:
2662
- return "text-green-600 bg-green-100";
2663
- case Ne.Set:
2664
- return "text-blue-600 bg-blue-100";
2665
- case Ne.Change:
2666
- return "text-yellow-600 bg-yellow-100";
2667
- case Ne.Unset:
2668
- return "text-red-600 bg-red-100";
2669
- default:
2670
- return "text-gray-600 bg-gray-100";
2671
- }
2672
- }
2673
- function b(y) {
2674
- return new Date(y).toLocaleDateString("en-US", {
2675
- year: "numeric",
2676
- month: "short",
2677
- day: "numeric",
2678
- hour: "2-digit",
2679
- minute: "2-digit"
2680
- });
2681
- }
2682
- return (y, x) => {
2683
- const _ = X("FmButton"), C = X("FmCircularProgress"), h = X("FmIcon"), M = X("FmDialog");
2684
- return l(), v("div", Jo, [
2685
- L(M, {
2686
- modelValue: i.value,
2687
- "onUpdate:modelValue": x[2] || (x[2] = (R) => i.value = R),
2688
- overlay: !0,
2689
- "max-width": 800
2690
- }, {
2691
- "dialog-button": oe(() => [
2692
- L(_, {
2693
- "prepend-icon": "info",
2694
- variant: "secondary",
2695
- label: "NetSuite",
2696
- onClick: x[0] || (x[0] = (R) => t()),
2697
- "text-color": "primary",
2698
- "bg-color": "transparent",
2699
- "border-color": "primary"
2700
- })
2701
- ]),
2702
- "dialog-header": oe(() => x[3] || (x[3] = [
2703
- e("div", null, "NetSuite info", -1)
2704
- ])),
2705
- default: oe(() => [
2706
- c.value ? (l(), v("div", Xo, [
2707
- x[4] || (x[4] = e("span", null, "Change Log Loading...", -1)),
2708
- L(C, { size: "md" })
2709
- ])) : j("", !0),
2710
- !c.value && p.value.length > 0 ? (l(), v("div", Zo, [
2711
- e("h3", en, [
2712
- L(h, {
2713
- name: "error",
2714
- color: "#ff9500",
2715
- size: "sm"
2716
- }),
2717
- x[5] || (x[5] = Ee(" Change Logs "))
2718
- ]),
2719
- e("div", tn, [
2720
- e("table", rn, [
2721
- x[6] || (x[6] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
2722
- e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
2723
- e("th", {
2724
- class: "text-left p-3 fm-typo-en-body-md-600",
2725
- style: { "min-width": "130px" }
2726
- }, " Date "),
2727
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
2728
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
2729
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
2730
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
2731
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
2732
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
2733
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
2734
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
2735
- ])
2736
- ], -1)),
2737
- e("tbody", null, [
2738
- (l(!0), v(fe, null, ke(p.value, (R, U) => (l(), v("tr", {
2739
- key: U,
2740
- class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
2741
- }, [
2742
- e("td", sn, d(b(R._dateiso8601)), 1),
2743
- e("td", on, d(R._rolename), 1),
2744
- e("td", nn, d(R._employeename), 1),
2745
- e("td", an, d(R._contextname), 1),
2746
- e("td", {
2747
- class: Pe(`p-3 fm-typo-en-body-sm-600 ${a(Number(R.type) - 1)}`)
2748
- }, d(m(Ne)[Number(R.type) - 1]), 3),
2749
- e("td", ln, d(R.lineid || ""), 1),
2750
- e("td", cn, d(R._fieldname), 1),
2751
- e("td", un, d(R.oldvalue || ""), 1),
2752
- e("td", dn, d(R.newvalue || ""), 1)
2753
- ]))), 128))
2754
- ])
2755
- ])
2756
- ])
2757
- ])) : (l(), v("div", mn, x[7] || (x[7] = [
2758
- e("p", null, "No change logs available.", -1)
2759
- ])))
2760
- ]),
2761
- "dialog-footer": oe(() => [
2762
- L(_, {
2763
- class: "ml-auto sm:w-full xs:w-full",
2764
- label: "Close",
2765
- size: "md",
2766
- variant: "primary",
2767
- onClick: x[1] || (x[1] = (R) => i.value = !1)
2768
- })
2769
- ]),
2770
- _: 1
2771
- }, 8, ["modelValue"])
2772
- ]);
2773
- };
2774
- }
2775
- }), fn = { class: "flex flex-col w-full gap-3" }, yn = { class: "flex" }, vn = { class: "fm-typo-en-title-md-600 text-fm-color-typo-primary" }, bn = { class: "flex flex-col gap-16 w-full h-full" }, hn = { class: "flex justify-between" }, gn = { class: "fm-typo-en-body-lg-600" }, _n = { class: "flex gap-2" }, xn = {
2776
- key: 0,
2777
- class: "flex items-center gap-1"
2778
- }, Sn = { class: "fm-typo-en-body-md-400" }, On = { class: "flex flex-col gap-8" }, wn = {
2779
- key: 0,
2780
- class: "flex items-start justify-between gap-6"
2781
- }, Cn = { class: "text-xs font-mono text-right break-all" }, Dn = {
2782
- key: 1,
2783
- class: "flex items-start justify-between gap-6"
2784
- }, $n = { class: "fm-typo-en-body-sm-600" }, kn = {
2785
- key: 2,
2786
- class: "flex items-start justify-between gap-6"
2787
- }, Rn = { class: "text-xs font-mono text-right break-all" }, Nn = {
2788
- key: 3,
2789
- class: "flex items-start justify-between gap-6"
2790
- }, An = { class: "text-xs font-mono text-right break-all" }, Pn = { class: "flex flex-col gap-4" }, Tn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Fn = { class: "flex gap-1" }, In = { class: "fm-typo-en-body-lg-600" }, qn = {
2791
- key: 0,
2792
- class: "flex flex-col gap-4"
2793
- }, En = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Vn = { class: "fm-typo-en-body-lg-600" }, Ln = { class: "flex flex-col gap-4" }, jn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Mn = { class: "fm-typo-en-body-lg-600" }, Un = {
2794
- key: 1,
2795
- class: "flex flex-col gap-4"
2796
- }, Bn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, zn = { class: "fm-typo-en-body-lg-600" }, Kn = {
2797
- key: 2,
2798
- class: "flex flex-col gap-4"
2799
- }, Hn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gn = { class: "fm-typo-en-body-lg-600" }, Wn = {
2800
- key: 3,
2801
- class: "flex flex-col gap-4"
2802
- }, Yn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Qn = { class: "fm-typo-en-body-lg-600" }, Jn = {
2803
- key: 4,
2804
- class: "flex flex-col gap-4"
2805
- }, Xn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Zn = { class: "fm-typo-en-body-lg-600" }, ea = {
2806
- key: 5,
2807
- class: "flex flex-col gap-4"
2808
- }, ta = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ra = { class: "fm-typo-en-body-lg-600" }, sa = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, oa = { class: "flex flex-col gap-8" }, na = { class: "flex gap-8 items-center" }, aa = { class: "flex-1 fm-typo-en-body-lg-600" }, la = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, ia = { class: "flex w-full gap-4" }, ca = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2 flex items-center gap-2" }, ua = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-2" }, da = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, ma = ["innerHTML"], pa = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, fa = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, ya = {
2809
- key: 0,
2810
- class: "flex items-center gap-4"
2811
- }, va = { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ba = {
2812
- key: 0,
2813
- class: "inline-flex items-center gap-1 text-xs font-medium text-gray-500 bg-gray-100 px-2 py-0.5 rounded-full"
2814
- }, ha = { class: "py-8" }, ga = { class: "flex justify-end gap-4 items-center" }, _a = { class: "fm-typo-en-body-lg-600" }, xa = {
2815
- key: 1,
2816
- class: "flex-1 xs:w-screen xs:max-w-full"
2817
- }, Sa = {
2818
- key: 0,
2819
- class: "flex flex-col items-center gap-8 h-full"
2820
- }, Oa = ["src"], wa = { class: "fm-typo-en-body-lg-600" }, Ca = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Da = {
2821
- key: 1,
2822
- class: "px-4 flex flex-col"
2823
- }, $a = { class: "flex gap-12 content-stretch" }, ka = {
2824
- class: "flex flex-col w-40",
2825
- name: "circles"
2826
- }, Ra = { class: "flex-1 flex flex-col items-center" }, Na = { class: "h-40 w-40 bg-fm-color-primary rounded-full flex items-center justify-center" }, Aa = { class: "flex-1 flex flex-col items-center" }, Pa = { class: "flex w-full items-center gap-4" }, Ta = {
2827
- class: "py-12 flex flex-col gap-4",
2828
- name: "received-at header"
2829
- }, Fa = { class: "fm-typo-en-body-lg-400" }, Ia = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, qa = { class: "ml-auto flex gap-1" }, Ea = { class: "flex gap-12 content-stretch" }, Va = {
2830
- class: "flex flex-col w-40",
2831
- name: "circles"
2832
- }, La = { class: "flex-1 flex flex-col items-center" }, ja = {
2833
- class: "py-12 flex flex-col gap-4 flex-1",
2834
- name: "delivery details"
2835
- }, Ma = { class: "flex flex-col gap-8" }, Ua = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ba = { class: "flex flex-col gap-4" }, za = { class: "flex gap-8 xs:flex-col" }, Ol = /* @__PURE__ */ Oe({
2836
- __name: "TransferDetails",
2837
- props: {
2838
- poRequest: {},
2839
- purchaseOrder: {},
2840
- transferTo: {},
2841
- transferToDbName: {},
2842
- show: { type: Boolean },
2843
- canResubmit: { type: Boolean },
2844
- canApprove: { type: Boolean },
2845
- scope: {},
2846
- receivedMap: {},
2847
- shipments: {}
2848
- },
2849
- emits: ["update:show", "submitted"],
2850
- setup(f, { emit: r }) {
2851
- const s = f, i = r, c = ut(), n = Ke(), p = Ve(), t = Te(), a = _t(), { hasOrderDraftPermission: b } = Xt(), y = Qt();
2852
- function x(o) {
2853
- const u = o.isCustomCost, I = o.totalCost;
2854
- return u != null ? u === !0 : I != null;
2855
- }
2856
- et(
2857
- () => s.purchaseOrder,
2858
- (o) => {
2859
- y.init(o);
2860
- },
2861
- { immediate: !0 }
2862
- );
2863
- const _ = Z(
2864
- () => {
2865
- var o, u;
2866
- return {
2867
- id: ((o = a.sessionUser.value) == null ? void 0 : o.id) ?? "",
2868
- name: ((u = a.sessionUser.value) == null ? void 0 : u.displayName) ?? ""
2869
- };
2870
- }
2871
- ), C = Jt(), { t: h } = it(), M = Z(
2872
- () => {
2873
- var o, u, I, P;
2874
- return ((u = (o = s.purchaseOrder) == null ? void 0 : o.supplier) == null ? void 0 : u.internal) === "restaurant" || ((P = (I = s.purchaseOrder) == null ? void 0 : I.supplier) == null ? void 0 : P.internal) === "warehouse" ? Xe.enum.transfer : Xe.enum.purchase;
2875
- }
2876
- ), R = Z(() => {
2877
- var I;
2878
- const o = (I = s.shipments) == null ? void 0 : I.find((P) => {
2879
- var K;
2880
- return P.ref === ((K = s.purchaseOrder) == null ? void 0 : K._id);
2881
- });
2882
- let u = null;
2883
- if (o != null && o.milestones && o.milestones.length > 0) {
2884
- const P = o.milestones[o.milestones.length - 1];
2885
- if (P.estimatedTime) {
2886
- const K = new Date(P.estimatedTime), B = K.getDate().toString().padStart(2, "0");
2887
- u = `${K.toLocaleString("en-US", { month: "short" })} ${B}`;
2888
- }
2889
- }
2890
- return u;
2891
- }), U = W(!1), O = W(""), k = W(!0), Y = He(), A = Vr(Y.getWorkflowConfig), T = Yt(), $ = [
2892
- N.enum.receiveStock,
2893
- N.enum.processRequest,
2894
- N.enum.closeRequest
2895
- ], S = Z(() => {
2896
- if (!s.purchaseOrder)
2897
- return [];
2898
- const o = A.result.value;
2899
- if (o.state === Et.loading)
2900
- return [];
2901
- const u = {
2902
- user: _.value,
2903
- executedAt: t.locations.computeFirst(
2904
- (J) => {
2905
- var D;
2906
- return J.dbName === ((D = t._currentLocation) == null ? void 0 : D.dbName) ? J : null;
2907
- }
2908
- ),
2909
- purchaseOrderRequest: s.poRequest,
2910
- purchaseOrder: s.purchaseOrder
2911
- }, I = p.useOperatePurchaseOrderV2, P = p.poWorkflowAllowToMarkCompleted, K = [...$];
2912
- I && !P && K.push(N.enum.completeReceive);
2913
- let B = [];
2914
- try {
2915
- o.state === Et.error ? (console.error("Error fetching workflow config:", o.error), B = dt.getAvailableActions({
2916
- ...u,
2917
- orderConfig: dt.getDefaultConfig()
2918
- }).actions.filter((J) => !K.includes(J))) : B = dt.getAvailableActions({
2919
- ...u,
2920
- orderConfig: o.data
2921
- }).actions.filter((J) => !K.includes(J));
2922
- } catch (J) {
2923
- console.error("Error getting available actions:", J);
2924
- }
2925
- return s.scope === "approval" && (B = B.filter((J) => J !== N.enum.completeReceive)), b.value || (B = B.filter(
2926
- (J) => J !== N.enum.approveDraft && J !== N.enum.rejectDraft
2927
- )), B;
2928
- }), q = Rr(s, "show"), G = Z(() => [
2929
- {
2930
- label: h("inventory.transfer.receiveRequest.details.overview"),
2931
- value: "overview"
2932
- },
2933
- {
2934
- label: h("inventory.transfer.receiveRequest.details.deliveryHistory"),
2935
- value: "deliveryHistory"
2936
- }
2937
- ]), Q = W(G.value[0]);
2938
- et(
2939
- () => s.show,
2940
- (o) => {
2941
- o && (Q.value = G.value[0]);
2942
- }
2943
- );
2944
- function ye(o) {
2945
- return o.map((u) => ({
2946
- ...u,
2947
- amount: {
2948
- ...u.amount,
2949
- amount: -Math.abs(u.amount.amount)
2950
- }
2951
- }));
2952
- }
2953
- async function he(o, u, I, P, K) {
2954
- return new Promise((B, J) => {
2955
- const D = {
2956
- closeButton: !1,
2957
- title: P.title,
2958
- message: P.message,
2959
- primaryActions: P.primaryActions,
2960
- secondaryActions: { text: "No", close: !1 }
2961
- };
2962
- let te = u.rejectReason ?? "";
2963
- I === N.enum.rejectDraft && (D.contentComponent = Wt, D.contentComponentProps = {
2964
- message: P.message,
2965
- onChange: (ne) => {
2966
- te = ne ?? "";
2967
- }
2968
- }), c.open(D).onPrimary(async () => {
2969
- var de, re, le, ve;
2970
- const ne = [];
2971
- I === N.enum.confirmDraft || I === N.enum.submitRequest ? ne.push({
2972
- action: "confirmDraft",
2973
- payload: y.controller.value.toConfirmDraftData(De())
2974
- }) : I === N.enum.approveRequest ? (ne.push({
2975
- action: "approveRequest",
2976
- payload: null
2977
- }), u.fulfillment && ne.push({
2978
- action: "processRequest",
2979
- payload: {
2980
- fulfillmentId: "",
2981
- deliveryOrderNumber: "",
2982
- deliveryRemark: null,
2983
- items: ye(u.fulfillment.items),
2984
- createdBy: _.value
2985
- }
2986
- })) : I === N.enum.processRequest ? u.fulfillment && ne.push({
2987
- action: "processRequest",
2988
- payload: {
2989
- fulfillmentId: "",
2990
- deliveryOrderNumber: "",
2991
- deliveryRemark: null,
2992
- items: ye(u.fulfillment.items),
2993
- createdBy: _.value
2994
- }
2995
- }) : I === N.enum.rejectRequest ? ne.push({
2996
- action: "rejectRequest",
2997
- payload: null
2998
- }) : I === N.enum.closeRequest ? ne.push({
2999
- action: "closeRequest",
3000
- payload: null
3001
- }) : I === N.enum.rejectDraft && ne.push({
3002
- action: "rejectDraft",
3003
- payload: {
3004
- rejectReason: te ?? ""
3005
- }
3006
- });
3007
- try {
3008
- await T({
3009
- operate: {
3010
- operation: I,
3011
- doc: o,
3012
- options: u
3013
- },
3014
- operateV2: {
3015
- _id: ((de = s.purchaseOrder) == null ? void 0 : de._id) ?? "",
3016
- _rev: ((re = s.purchaseOrder) == null ? void 0 : re._rev) ?? "",
3017
- action: I === N.enum.submitRequest ? N.enum.confirmDraft : I,
3018
- payloads: ne
3019
- // add payload if action is receiveStock or processRequest
3020
- },
3021
- transferTo: (ve = (le = s.poRequest) == null ? void 0 : le.to) == null ? void 0 : ve.dbName
3022
- }).delayed(1e3), B("submitted");
3023
- } catch (Ae) {
3024
- J(Ae);
3025
- }
3026
- }).onSecondary(() => {
3027
- B("cancelled");
3028
- for (let ne = 0; ne < K + 2; ne++)
3029
- c.close();
3030
- }).onClose(() => {
3031
- });
3032
- });
3033
- }
3034
- async function E(o) {
3035
- var K, B, J, D;
3036
- if (o === N.enum.receiveStock)
3037
- return;
3038
- const u = Gt[o];
3039
- if (!u) {
3040
- n.open({
3041
- title: "Something went wrong",
3042
- message: `Cannot process order: ${ht(o)}`,
3043
- type: "error"
3044
- });
3045
- return;
3046
- }
3047
- const { successMessage: I, ...P } = u;
3048
- if (s.purchaseOrder) {
3049
- O.value = `${o}`, U.value = !0, k.value = !1;
3050
- const te = {};
3051
- let ne = 0;
3052
- if ((o === N.enum.confirmDraft || // auto receive for warehouse to warehouse
3053
- o === N.enum.completeReceive) && p.autoReceiveWarehouse)
3054
- te.autoReceive = !0;
3055
- else if ((o === N.enum.approveRequest || o === N.enum.processRequest) && p.acceptRequireFulfillment) {
3056
- const de = (B = (K = s.poRequest) == null ? void 0 : K.from) == null ? void 0 : B.dbName, re = (D = (J = s.poRequest) == null ? void 0 : J.to) == null ? void 0 : D.dbName;
3057
- if (de && re && (de.startsWith("warehouse_") || re.startsWith("warehouse_"))) {
3058
- const le = await new Promise((ve, Ae) => {
3059
- c.open({
3060
- closeButton: !1,
3061
- title: "Confirm transfer amount",
3062
- dialogComponent: ls,
3063
- dialogComponentProps: {
3064
- purchaseOrder: s.purchaseOrder,
3065
- confirm: ve,
3066
- "onUpdate:show": (Le) => {
3067
- Le || (O.value = "", U.value = !1, k.value = !0, ne++, c.close()), Ae("cancelled");
3068
- }
3069
- }
3070
- });
3071
- });
3072
- te.fulfillment = le;
3073
- }
3074
- }
3075
- try {
3076
- await he(
3077
- s.purchaseOrder,
3078
- te,
3079
- o,
3080
- u,
3081
- ne
3082
- ) === "submitted" && (n.open({
3083
- title: "Success",
3084
- message: I,
3085
- type: "success"
3086
- }), i("update:show", !1), i("submitted"));
3087
- } catch (de) {
3088
- n.open({
3089
- title: "Something went wrong",
3090
- message: "Please try again.",
3091
- type: "error"
3092
- }), console.error("Error when submitting PO operation", o, s.purchaseOrder, de);
3093
- } finally {
3094
- O.value = "", U.value = !1, k.value = !0;
3095
- }
3096
- }
3097
- }
3098
- const F = Z(() => {
3099
- var o, u;
3100
- return ((o = s.purchaseOrder) == null ? void 0 : o.status) === ae.enum.RECEIVING || ((u = s.purchaseOrder) == null ? void 0 : u.status) === ae.enum.COMPLETE;
3101
- }), ee = Z(() => s.purchaseOrder ? at(s.purchaseOrder) : {}), w = Z(() => {
3102
- const o = s.purchaseOrder;
3103
- if (!o) return { status: "", statusClass: "" };
3104
- const { partial: u, over: I } = yt(ee.value), P = vt(o.status, u, I);
3105
- let K = h(`inventory.transfer.status.${P}`), B = `${o.status}`.toLocaleLowerCase("en-us");
3106
- return P === ae.enum.CLOSE && (K = `${h(`inventory.transfer.status.${ae.enum.COMPLETE}`)}`), P === "PARTIAL_RECEIVED" && B === ae.enum.PROCESSING.toLocaleLowerCase("en-us") && (B = ae.enum.RECEIVING.toLocaleLowerCase("en-us")), {
3107
- status: K,
3108
- statusClass: `fm-status-badge fm-status-badge-${B}`
3109
- };
3110
- }), g = Z(() => {
3111
- var B, J;
3112
- const o = ((B = s.purchaseOrder) == null ? void 0 : B.deliveryOrder) ?? [], u = ((J = s.purchaseOrder) == null ? void 0 : J.deliveryFullfillment) ?? [], I = [
3113
- ...o.map((D) => ({
3114
- createdAt: D.createdAt,
3115
- type: "grn",
3116
- doc: D
3117
- })),
3118
- ...u.map((D) => ({
3119
- createdAt: D.createdAt,
3120
- type: "fulfillment",
3121
- doc: D
3122
- }))
3123
- ];
3124
- I.reverse().sort((D, te) => D.createdAt.localeCompare(te.createdAt));
3125
- function P(D) {
3126
- var de, re, le, ve, Ae, Le, se, me, ge, Se, $e, Fe;
3127
- const te = u.findIndex((pe) => pe.id === D.fullfillmentId), ne = [
3128
- (re = (de = u[te]) == null ? void 0 : de.netSuite) != null && re.id ? {
3129
- label: "Fulfillment's ref no. (Netsuite)",
3130
- values: [
3131
- `${((ve = (le = u[te]) == null ? void 0 : le.netSuite) == null ? void 0 : ve.refNo) ?? "N/A"} (${((Le = (Ae = u[te]) == null ? void 0 : Ae.netSuite) == null ? void 0 : Le.id) ?? "-"})`
3132
- ]
3133
- } : null,
3134
- (se = D == null ? void 0 : D.netSuite) != null && se.id ? {
3135
- label: "Netsuite ref no.",
3136
- values: [`${((me = D == null ? void 0 : D.netSuite) == null ? void 0 : me.refNo) ?? "N/A"} (${((ge = D == null ? void 0 : D.netSuite) == null ? void 0 : ge.id) ?? "-"})`]
3137
- } : null,
3138
- (Se = D == null ? void 0 : D.netSuite) != null && Se.recordType ? {
3139
- label: "Netsuite Type",
3140
- values: [zt(($e = D == null ? void 0 : D.netSuite) == null ? void 0 : $e.recordType)]
3141
- } : null
3142
- ];
3143
- return {
3144
- header: "Received",
3145
- deliveryOrder: D,
3146
- date: Ze(new Date(D.createdAt)),
3147
- info: [
3148
- {
3149
- label: "Adjustment date",
3150
- values: [
3151
- D.adjustment ? Ze(new Date(st(D.adjustment))) : "-"
3152
- ]
3153
- },
3154
- {
3155
- label: "Received by",
3156
- values: [(Fe = D.createdBy) == null ? void 0 : Fe.name]
3157
- },
3158
- {
3159
- label: "Received items",
3160
- values: D.received.map((pe) => {
3161
- var _e;
3162
- return z("div", [
3163
- z(
3164
- "div",
3165
- {
3166
- class: "flex gap-4"
3167
- },
3168
- [
3169
- z(
3170
- "div",
3171
- {
3172
- class: "flex flex-col"
3173
- },
3174
- [
3175
- z(
3176
- "span",
3177
- {
3178
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
3179
- },
3180
- `${pe.sku.name}`
3181
- ),
3182
- z(
3183
- "span",
3184
- {
3185
- class: "fm-typo-en-body-md-400"
3186
- },
3187
- `${pe.sku.code} `
3188
- )
3189
- ]
3190
- ),
3191
- z(
3192
- "div",
3193
- {
3194
- class: "ml-auto flex flex-col"
3195
- },
3196
- [
3197
- z(
3198
- "div",
3199
- {
3200
- class: "ml-auto flex gap-1"
3201
- },
3202
- [
3203
- z(
3204
- "span",
3205
- {
3206
- class: "fm-typo-en-body-lg-600 self-end"
3207
- },
3208
- be(pe.amount, !1)
3209
- ),
3210
- z(
3211
- "span",
3212
- {
3213
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
3214
- },
3215
- ((_e = pe.measurement) == null ? void 0 : _e.abbrev) ?? pe.sku.unit.abbrev
3216
- )
3217
- ]
3218
- ),
3219
- z(
3220
- "div",
3221
- {
3222
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
3223
- },
3224
- `${pe.cost ? `(${Qe(pe.cost)})` : ""}`
3225
- )
3226
- ]
3227
- )
3228
- ]
3229
- )
3230
- ]);
3231
- })
3232
- },
3233
- {
3234
- label: "Delivery order no.",
3235
- values: [D.deliveryOrderNumber || "N/A"]
3236
- },
3237
- {
3238
- label: "Remark",
3239
- values: [D.remark || "N/A"]
3240
- },
3241
- te > -1 ? {
3242
- label: "Fulfilment's sequence",
3243
- values: [`${te + 1}`]
3244
- } : null,
3245
- ...ne
3246
- ].filter((pe) => !!pe)
3247
- };
3248
- }
3249
- function K(D) {
3250
- var ne, de, re;
3251
- const te = u.findIndex((le) => le.id === D.id);
3252
- return {
3253
- header: "Fulfillment",
3254
- date: Ze(new Date(D.createdAt)),
3255
- info: [
3256
- {
3257
- label: "Sequence",
3258
- values: [String(te + 1)]
3259
- },
3260
- {
3261
- label: "Receiveable items",
3262
- values: D.items.map((le) => {
3263
- var ve;
3264
- return z("div", [
3265
- z(
3266
- "div",
3267
- {
3268
- class: "flex gap-4"
3269
- },
3270
- [
3271
- z(
3272
- "div",
3273
- {
3274
- class: "flex flex-col"
3275
- },
3276
- [
3277
- z(
3278
- "span",
3279
- {
3280
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
3281
- },
3282
- `${le.sku.name}`
3283
- ),
3284
- z(
3285
- "span",
3286
- {
3287
- class: "fm-typo-en-body-md-400"
3288
- },
3289
- `${le.sku.code} `
3290
- )
3291
- ]
3292
- ),
3293
- z(
3294
- "div",
3295
- {
3296
- class: "ml-auto flex flex-col"
3297
- },
3298
- [
3299
- z(
3300
- "div",
3301
- {
3302
- class: "ml-auto flex gap-1"
3303
- },
3304
- [
3305
- z(
3306
- "span",
3307
- {
3308
- class: "fm-typo-en-body-lg-600 self-end"
3309
- },
3310
- be(le.amount, !1)
3311
- ),
3312
- z(
3313
- "span",
3314
- {
3315
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
3316
- },
3317
- ((ve = le.measurement) == null ? void 0 : ve.abbrev) ?? le.sku.unit.abbrev
3318
- )
3319
- ]
3320
- ),
3321
- z(
3322
- "div",
3323
- {
3324
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
3325
- },
3326
- `${le.cost ? `(${Qe(le.cost)})` : ""}`
3327
- )
3328
- ]
3329
- )
3330
- ]
3331
- )
3332
- ]);
3333
- })
3334
- },
3335
- (ne = D.netSuite) != null && ne.refNo ? {
3336
- label: "Netsuite Ref no. (ID)",
3337
- values: [`${(de = D.netSuite) == null ? void 0 : de.refNo} (${((re = D.netSuite) == null ? void 0 : re.id) ?? "-"})`]
3338
- } : null
3339
- ].filter((le) => !!le)
3340
- };
3341
- }
3342
- return I.map(
3343
- (D) => D.type === "grn" ? P(D.doc) : K(D.doc)
3344
- );
3345
- });
3346
- function V(o) {
3347
- var B;
3348
- const I = (((B = s.purchaseOrder) == null ? void 0 : B.version) ?? Me.enum[1]) === Me.enum[2] ? o.id : o.sku._id, P = s.receivedMap[I];
3349
- return `<span class="${H(o)} fm-typo-en-body-lg-600">${Ue.toFormatString({ value: P.received })}</span>/${Tr(o.quantity, o.sku.unit, o.measurement)}`;
3350
- }
3351
- function H(o) {
3352
- var te;
3353
- const I = (((te = s.purchaseOrder) == null ? void 0 : te.version) ?? Me.enum[1]) === Me.enum[2] ? o.id : o.sku._id, P = s.receivedMap[I], { isPartialReceive: K, isNoReceive: B, isOverReceive: J, isFullReceive: D } = rs(P);
3354
- return B ? "text-fm-color-typo-tertiary" : K ? "text-fm-color-system-warning-300" : J ? "text-fm-color-system-error-300" : D ? "text-fm-color-system-success-300" : "";
3355
- }
3356
- const ce = Z(() => {
3357
- var o, u, I;
3358
- return (o = s.purchaseOrder) != null && o.itemsAtSubmission ? ((u = s.purchaseOrder) == null ? void 0 : u.version) === Me.enum[2] ? s.purchaseOrder.items.reduce((P, K) => {
3359
- var J, D;
3360
- const B = (D = (J = s.purchaseOrder) == null ? void 0 : J.itemsAtSubmission) == null ? void 0 : D.find(
3361
- (te) => te.id === K.id
3362
- );
3363
- return B && B.quantity !== K.quantity && P.set(K.sku.code, {
3364
- originalAmount: Number(Ue.toFormatString({ value: B.quantity })),
3365
- newAmount: Number(Ue.toFormatString({ value: K.quantity }))
3366
- }), P;
3367
- }, /* @__PURE__ */ new Map()) : (I = s.purchaseOrder) == null ? void 0 : I.items.reduce((P, K) => {
3368
- var te, ne;
3369
- const B = (ne = (te = s.purchaseOrder) == null ? void 0 : te.itemsAtSubmission) == null ? void 0 : ne.find(
3370
- (de) => de.sku._id === K.sku._id
3371
- ), J = B ? Number(Ue.toFormatString({ value: B.quantity })) : 0, D = Number(Ue.toFormatString({ value: K.quantity }));
3372
- return B && J !== D && P.set(K.sku.code, {
3373
- originalAmount: J,
3374
- newAmount: D
3375
- }), P;
3376
- }, /* @__PURE__ */ new Map()) : /* @__PURE__ */ new Map();
3377
- }), Re = (o) => {
3378
- var I, P;
3379
- const u = ce.value;
3380
- return ((I = s.purchaseOrder) == null ? void 0 : I.version) === Me.enum[2] ? u.has(o.id) : u.has((P = o.sku) == null ? void 0 : P.code);
3381
- }, we = (o) => {
3382
- var I, P;
3383
- const u = ce.value;
3384
- return ((I = s.purchaseOrder) == null ? void 0 : I.version) === Me.enum[2] ? u.get(o.id) : u.get((P = o.sku) == null ? void 0 : P.code);
3385
- }, Ge = Z(() => {
3386
- const o = s.purchaseOrder;
3387
- if (!o) return "";
3388
- const u = o.actionChangelogs ?? [], I = u.length ? u[u.length - 1] : null;
3389
- if (I && I.action === "rejectDraft") {
3390
- const P = I.remarks ?? "";
3391
- return P && P.toString().trim() !== "" ? P.toString() : "-";
3392
- }
3393
- return "";
3394
- });
3395
- return (o, u) => {
3396
- const I = X("FmButton"), P = X("FmButtonGroup"), K = X("FmChip"), B = X("FmIcon"), J = X("FmMenuDivider"), D = X("FmCard"), te = X("FmTooltip"), ne = X("FmSpacer"), de = X("FmSideSheet");
3397
- return l(), ie(de, {
3398
- modelValue: m(q),
3399
- "onUpdate:modelValue": u[8] || (u[8] = (re) => ur(q) ? q.value = re : null),
3400
- "dismiss-away": k.value,
3401
- "max-width": 600,
3402
- "close-button": !1
3403
- }, {
3404
- "side-sheet-header": oe(() => {
3405
- var re, le;
3406
- return [
3407
- e("div", fn, [
3408
- e("div", yn, [
3409
- e("div", vn, d(m(h)("inventory.transfer.receiveRequest.details.title") + ((re = o.purchaseOrder) != null && re.seqNumber ? ` #${(le = o.purchaseOrder) == null ? void 0 : le.seqNumber}` : "")), 1),
3410
- L(I, {
3411
- class: "ml-auto -m-2",
3412
- variant: "tertiary",
3413
- "prepend-icon": "close",
3414
- onClick: u[0] || (u[0] = (ve) => i("update:show", !1))
3415
- })
3416
- ]),
3417
- L(P, {
3418
- items: G.value,
3419
- modelValue: Q.value,
3420
- "onUpdate:modelValue": u[1] || (u[1] = (ve) => Q.value = ve)
3421
- }, null, 8, ["items", "modelValue"]),
3422
- o.purchaseOrder && Q.value.value === "deliveryHistory" ? (l(), ie(Qo, {
3423
- key: 0,
3424
- "purchase-order": o.purchaseOrder,
3425
- "received-info-map": ee.value,
3426
- onSubmitted: u[2] || (u[2] = () => {
3427
- i("update:show", !1), i("submitted");
3428
- })
3429
- }, null, 8, ["purchase-order", "received-info-map"])) : j("", !0)
3430
- ])
3431
- ];
3432
- }),
3433
- default: oe(() => {
3434
- var re, le, ve, Ae, Le;
3435
- return [
3436
- e("div", bn, [
3437
- Q.value.value === "overview" ? (l(), v(fe, { key: 0 }, [
3438
- e("div", null, [
3439
- L(D, {
3440
- variant: "outlined",
3441
- class: "flex flex-col gap-8 px-12 py-16"
3442
- }, {
3443
- default: oe(() => {
3444
- var se, me, ge, Se, $e, Fe, pe, _e, je, Be;
3445
- return [
3446
- e("div", hn, [
3447
- e("div", gn, d(m(h)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
3448
- e("div", _n, [
3449
- L(K, {
3450
- label: w.value.status,
3451
- class: Pe(w.value.statusClass),
3452
- compact: ""
3453
- }, null, 8, ["label", "class"]),
3454
- R.value ? (l(), v("div", xn, [
3455
- L(B, {
3456
- name: "local_shipping",
3457
- color: "#666666"
3458
- }),
3459
- e("span", Sn, d(R.value), 1)
3460
- ])) : j("", !0)
3461
- ])
3462
- ]),
3463
- L(J),
3464
- e("div", On, [
3465
- L(Mt, { title: "Debug Info" }, {
3466
- default: oe(() => {
3467
- var rt, St, Ot, wt, Ct, Dt, $t, kt, Rt, Nt, At, Pt;
3468
- return [
3469
- (rt = o.purchaseOrder) != null && rt._id ? (l(), v("div", wn, [
3470
- u[9] || (u[9] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Purchase Order ID ", -1)),
3471
- e("span", Cn, d((St = o.purchaseOrder) == null ? void 0 : St._id), 1)
3472
- ])) : j("", !0),
3473
- (Ot = o.purchaseOrder) != null && Ot.status ? (l(), v("div", Dn, [
3474
- u[10] || (u[10] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Purchase Order Status ", -1)),
3475
- e("span", $n, d((wt = o.purchaseOrder) == null ? void 0 : wt.status), 1)
3476
- ])) : j("", !0),
3477
- (Dt = (Ct = o.purchaseOrder) == null ? void 0 : Ct.supplier) != null && Dt._id ? (l(), v("div", kn, [
3478
- u[11] || (u[11] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Source Location ID ", -1)),
3479
- e("span", Rn, d(((kt = ($t = o.purchaseOrder) == null ? void 0 : $t.supplier) == null ? void 0 : kt.internal) != null ? `${(Nt = (Rt = o.purchaseOrder) == null ? void 0 : Rt.supplier) == null ? void 0 : Nt.internal}_` : "") + d((Pt = (At = o.purchaseOrder) == null ? void 0 : At.supplier) == null ? void 0 : Pt._id), 1)
3480
- ])) : j("", !0),
3481
- o.transferToDbName ? (l(), v("div", Nn, [
3482
- u[12] || (u[12] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Destination Location ID ", -1)),
3483
- e("span", An, d(o.transferToDbName), 1)
3484
- ])) : j("", !0)
3485
- ];
3486
- }),
3487
- _: 1
3488
- }),
3489
- e("div", Pn, [
3490
- e("div", Tn, [
3491
- e("div", Fn, d(m(h)("inventory.transfer.receiveRequest.details.createdAt")), 1)
3492
- ]),
3493
- e("div", In, d(m(tt)(((se = o.purchaseOrder) == null ? void 0 : se._id) ?? "")), 1)
3494
- ]),
3495
- (me = o.purchaseOrder) != null && me.effectiveAt ? (l(), v("div", qn, [
3496
- e("div", En, d(m(h)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
3497
- e("div", Vn, d(m(gt)(new Date((ge = o.purchaseOrder) == null ? void 0 : ge.effectiveAt))), 1)
3498
- ])) : j("", !0),
3499
- e("div", Ln, [
3500
- e("div", jn, d(m(h)("inventory.transfer.receiveRequest.details.type.title")), 1),
3501
- e("div", Mn, d(m(h)(
3502
- `inventory.transfer.receiveRequest.details.type.${M.value.toLocaleLowerCase("en-US")}`
3503
- )), 1)
3504
- ]),
3505
- ($e = (Se = o.purchaseOrder) == null ? void 0 : Se.supplier) != null && $e.name ? (l(), v("div", Un, [
3506
- e("div", Bn, d(m(h)("inventory.transfer.receiveRequest.details.from")), 1),
3507
- e("div", zn, d((pe = (Fe = o.purchaseOrder) == null ? void 0 : Fe.supplier) == null ? void 0 : pe.name), 1)
3508
- ])) : j("", !0),
3509
- o.transferTo ? (l(), v("div", Kn, [
3510
- e("div", Hn, d(m(h)("inventory.transfer.receiveRequest.details.to")), 1),
3511
- e("div", Gn, d(o.transferTo), 1)
3512
- ])) : j("", !0),
3513
- (_e = o.purchaseOrder) != null && _e.ref ? (l(), v("div", Wn, [
3514
- e("div", Yn, d(m(h)("inventory.transfer.receiveRequest.details.reference")), 1),
3515
- e("div", Qn, d(o.purchaseOrder.ref), 1)
3516
- ])) : j("", !0),
3517
- (je = o.purchaseOrder) != null && je.remark ? (l(), v("div", Jn, [
3518
- e("div", Xn, d(m(h)("inventory.transfer.receiveRequest.details.remark")), 1),
3519
- e("div", Zn, d(o.purchaseOrder.remark), 1)
3520
- ])) : j("", !0),
3521
- ((Be = o.purchaseOrder) == null ? void 0 : Be.status) === m(ae).enum.DRAFT && Ge.value ? (l(), v("div", ea, [
3522
- e("div", ta, d(m(h)("inventory.transfer.receiveRequest.details.rejectionReason")), 1),
3523
- e("div", ra, d(Ge.value !== "" ? Ge.value : "-"), 1)
3524
- ])) : j("", !0)
3525
- ])
3526
- ];
3527
- }),
3528
- _: 1
3529
- })
3530
- ]),
3531
- L(so, {
3532
- "po-request": o.poRequest,
3533
- purchaseOrder: o.purchaseOrder,
3534
- transferType: M.value,
3535
- transferToDbName: o.transferToDbName,
3536
- scope: o.scope
3537
- }, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
3538
- e("div", sa, [
3539
- e("div", oa, [
3540
- e("div", na, [
3541
- e("span", aa, [
3542
- Ee(d(F.value ? m(h)("inventory.transfer.receiveRequest.details.receivedItems") : m(h)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
3543
- (le = (re = o.purchaseOrder) == null ? void 0 : re.netSuite) != null && le.missingItems && ((Ae = (ve = o.purchaseOrder) == null ? void 0 : ve.netSuite) == null ? void 0 : Ae.missingItems.length) > 0 ? (l(), ie(te, {
3544
- key: 0,
3545
- variant: "rich",
3546
- placement: "top",
3547
- "z-index": 51
3548
- }, {
3549
- content: oe(() => {
3550
- var se, me;
3551
- return [
3552
- e("div", la, [
3553
- (l(!0), v(fe, null, ke((me = (se = o.purchaseOrder) == null ? void 0 : se.netSuite) == null ? void 0 : me.missingItems, (ge, Se) => (l(), v("div", {
3554
- class: "flex justify-center align-middle",
3555
- key: Se
3556
- }, [
3557
- L(B, {
3558
- name: "arrow_right",
3559
- size: "sm"
3560
- }),
3561
- Ee(" " + d(`(${ge.netSuiteId}) ${ge.name}: ${ge.reason}`), 1)
3562
- ]))), 128))
3563
- ])
3564
- ];
3565
- }),
3566
- default: oe(() => [
3567
- L(B, {
3568
- name: "error",
3569
- color: "#ff2c2c",
3570
- size: "sm"
3571
- })
3572
- ]),
3573
- _: 1
3574
- })) : j("", !0)
3575
- ])
3576
- ]),
3577
- L(J),
3578
- (l(!0), v(fe, null, ke(((Le = o.purchaseOrder) == null ? void 0 : Le.items) ?? [], (se, me) => {
3579
- var ge;
3580
- return l(), v("div", {
3581
- key: me,
3582
- class: "flex flex-col"
3583
- }, [
3584
- e("div", ia, [
3585
- e("div", ca, [
3586
- Ee(d(se.name) + " ", 1),
3587
- Re(se) ? (l(), ie(te, {
3588
- key: 0,
3589
- variant: "rich",
3590
- placement: "top",
3591
- "z-index": 51
3592
- }, {
3593
- content: oe(() => {
3594
- var Se, $e;
3595
- return [
3596
- e("div", ua, [
3597
- u[13] || (u[13] = e("div", { class: "font-semibold" }, "Submission changes", -1)),
3598
- e("div", null, "Original Amount: " + d((Se = we(se)) == null ? void 0 : Se.originalAmount), 1),
3599
- e("div", null, " New Amount: " + d(($e = we(se)) == null ? void 0 : $e.newAmount), 1)
3600
- ])
3601
- ];
3602
- }),
3603
- default: oe(() => [
3604
- L(B, {
3605
- name: "error",
3606
- color: "#ff9500",
3607
- size: "sm"
3608
- })
3609
- ]),
3610
- _: 2
3611
- }, 1024)) : j("", !0)
3612
- ]),
3613
- e("div", da, [
3614
- e("span", {
3615
- innerHTML: V(se)
3616
- }, null, 8, ma)
3617
- ])
3618
- ]),
3619
- e("div", pa, [
3620
- e("div", fa, d(se.code), 1),
3621
- m(p).enableTotalCost ? (l(), v("div", ya, [
3622
- e("span", va, d(m(Qe)(
3623
- (ge = se.totalCost) != null && ge.amount ? se.totalCost : m(y).controller.value.getItemCost(se, m(De)()).cost
3624
- )), 1),
3625
- x(se) ? j("", !0) : (l(), v("span", ba, [
3626
- u[14] || (u[14] = e("span", { class: "w-1.5 h-1.5 rounded-full bg-gray-400" }, null, -1)),
3627
- Ee(" " + d(m(h)("inventory.transfer.form.items.autoCalculated")), 1)
3628
- ]))
3629
- ])) : j("", !0)
3630
- ])
3631
- ]);
3632
- }), 128)),
3633
- +m(be)(m(y).controller.value.getTotalCosts()) ? (l(), v(fe, { key: 0 }, [
3634
- e("div", ha, [
3635
- L(J)
3636
- ]),
3637
- e("div", ga, [
3638
- u[15] || (u[15] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
3639
- e("div", _a, d(m(De)()) + " " + d(m(Qe)({
3640
- ...m(y).controller.value.getTotalCosts(),
3641
- currency: m(De)()
3642
- }).replace(/[^0-9.,]/g, "")), 1)
3643
- ])
3644
- ], 64)) : j("", !0)
3645
- ])
3646
- ])
3647
- ], 64)) : Q.value.value === "deliveryHistory" ? (l(), v("div", xa, [
3648
- g.value.length ? (l(), v("div", Da, [
3649
- (l(!0), v(fe, null, ke(g.value, (se, me) => {
3650
- var ge, Se, $e, Fe, pe;
3651
- return l(), v(fe, { key: me }, [
3652
- e("div", $a, [
3653
- e("div", ka, [
3654
- e("div", Ra, [
3655
- e("div", {
3656
- class: Pe([
3657
- {
3658
- "bg-fm-color-primary": me !== 0,
3659
- "bg-white": me === 0
3660
- },
3661
- "w-[2px] h-full"
3662
- ])
3663
- }, null, 2)
3664
- ]),
3665
- e("div", Na, [
3666
- se.header === "Received" ? (l(), ie(B, {
3667
- key: 0,
3668
- name: "local_shipping",
3669
- outline: "",
3670
- color: "#ffffff"
3671
- })) : j("", !0)
3672
- ]),
3673
- e("div", Aa, [
3674
- e("div", {
3675
- class: Pe([
3676
- {
3677
- "bg-fm-color-primary": me < g.value.length - 1,
3678
- "bg-white": me >= g.value.length - 1
3679
- },
3680
- "w-[2px] h-full"
3681
- ])
3682
- }, null, 2)
3683
- ])
3684
- ]),
3685
- e("div", Pa, [
3686
- e("div", Ta, [
3687
- e("div", Fa, d(se.header), 1),
3688
- e("div", Ia, d(se.date), 1)
3689
- ]),
3690
- e("div", qa, [
3691
- se.header === "Received" && se.deliveryOrder && o.purchaseOrder ? (l(), ie(Co, {
3692
- key: 0,
3693
- deliveryOrder: se.deliveryOrder,
3694
- purchaseOrder: o.purchaseOrder,
3695
- onSubmitted: u[3] || (u[3] = () => {
3696
- i("update:show", !1), i("submitted");
3697
- })
3698
- }, null, 8, ["deliveryOrder", "purchaseOrder"])) : j("", !0),
3699
- (Se = (ge = se.deliveryOrder) == null ? void 0 : ge.netSuite) != null && Se.id ? (l(), ie(Mt, {
3700
- key: 1,
3701
- title: "Admin",
3702
- class: "min-w-[140px]"
3703
- }, {
3704
- default: oe(() => {
3705
- var _e, je;
3706
- return [
3707
- L(pn, {
3708
- "netsuite-id": (je = (_e = se.deliveryOrder) == null ? void 0 : _e.netSuite) == null ? void 0 : je.id
3709
- }, null, 8, ["netsuite-id"])
3710
- ];
3711
- }),
3712
- _: 2
3713
- }, 1024)) : j("", !0),
3714
- o.purchaseOrder && (($e = se.deliveryOrder) != null && $e.id) ? (l(), ie(Fr, {
3715
- key: 2,
3716
- "purchase-order-id": (Fe = o.purchaseOrder) == null ? void 0 : Fe._id,
3717
- "delivery-order-id": (pe = se.deliveryOrder) == null ? void 0 : pe.id
3718
- }, null, 8, ["purchase-order-id", "delivery-order-id"])) : j("", !0)
3719
- ])
3720
- ])
3721
- ]),
3722
- e("div", Ea, [
3723
- e("div", Va, [
3724
- e("div", La, [
3725
- e("div", {
3726
- class: Pe([
3727
- {
3728
- "bg-fm-color-primary": me < g.value.length - 1,
3729
- "bg-white": me >= g.value.length - 1
3730
- },
3731
- "w-[2px] h-full"
3732
- ])
3733
- }, null, 2)
3734
- ])
3735
- ]),
3736
- e("div", ja, [
3737
- L(D, {
3738
- variant: "outlined",
3739
- class: "py-12 px-16"
3740
- }, {
3741
- default: oe(() => [
3742
- e("div", Ma, [
3743
- (l(!0), v(fe, null, ke(se.info, (_e, je) => (l(), v("div", {
3744
- key: je,
3745
- class: "flex flex-col gap-4"
3746
- }, [
3747
- e("div", Ua, d(_e == null ? void 0 : _e.label), 1),
3748
- e("div", Ba, [
3749
- (l(!0), v(fe, null, ke(_e == null ? void 0 : _e.values, (Be, rt) => (l(), v("div", {
3750
- key: rt,
3751
- class: "fm-typo-en-body-lg-600"
3752
- }, [
3753
- typeof Be == "string" ? (l(), v(fe, { key: 0 }, [
3754
- Ee(d(Be), 1)
3755
- ], 64)) : (l(), ie(dr(Be), { key: 1 }))
3756
- ]))), 128))
3757
- ])
3758
- ]))), 128))
3759
- ])
3760
- ]),
3761
- _: 2
3762
- }, 1024)
3763
- ])
3764
- ])
3765
- ], 64);
3766
- }), 128))
3767
- ])) : (l(), v("div", Sa, [
3768
- L(ne),
3769
- e("div", null, [
3770
- e("img", {
3771
- src: m(Nr),
3772
- alt: "List is empty"
3773
- }, null, 8, Oa)
3774
- ]),
3775
- e("div", wa, d(m(h)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
3776
- e("div", Ca, d(m(h)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
3777
- L(ne),
3778
- L(ne)
3779
- ]))
3780
- ])) : j("", !0)
3781
- ])
3782
- ];
3783
- }),
3784
- "side-sheet-footer": oe(() => [
3785
- e("div", za, [
3786
- (l(!0), v(fe, null, ke(S.value, (re) => (l(), v(fe, null, [
3787
- m(ft)[re].available != !1 ? (l(), ie(I, {
3788
- key: re,
3789
- label: m(h)(m(ft)[re].translationKey),
3790
- onClick: (le) => E(re),
3791
- loading: O.value === re,
3792
- disabled: O.value !== re && U.value,
3793
- variant: m(ft)[re].buttonVariant
3794
- }, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : j("", !0)
3795
- ], 64))), 256)),
3796
- m(C).ableToMarkReceived(o.purchaseOrder) && !S.value.includes("completeReceive") ? (l(), ie(I, {
3797
- key: 0,
3798
- label: m(h)("inventory.transfer.receiveRequest.actions.completeReceive"),
3799
- onClick: u[4] || (u[4] = (re) => E("completeReceive")),
3800
- loading: O.value === "completeReceive",
3801
- disabled: O.value !== "completeReceive" && U.value
3802
- }, null, 8, ["label", "loading", "disabled"])) : j("", !0),
3803
- m(C).ableToMarkApproved(o.purchaseOrder) && o.canApprove && !S.value.includes("approveRequest") ? (l(), ie(I, {
3804
- key: 1,
3805
- label: m(h)("inventory.transfer.approval.actions.approveRequest"),
3806
- onClick: u[5] || (u[5] = (re) => E("approveRequest")),
3807
- loading: O.value === "approveRequest",
3808
- disabled: O.value !== "approveRequest" && U.value
3809
- }, null, 8, ["label", "loading", "disabled"])) : j("", !0),
3810
- m(C).ableToCreateFulfillment(o.purchaseOrder, o.poRequest) && s.scope === "approval" ? (l(), ie(I, {
3811
- key: 2,
3812
- label: m(h)("inventory.transfer.receiveRequest.actions.processRequest"),
3813
- onClick: u[6] || (u[6] = (re) => E("processRequest")),
3814
- loading: O.value === "processRequest",
3815
- disabled: O.value !== "processRequest" && U.value
3816
- }, null, 8, ["label", "loading", "disabled"])) : j("", !0),
3817
- L(I, {
3818
- label: m(h)("common.close"),
3819
- variant: "tertiary",
3820
- onClick: u[7] || (u[7] = (re) => i("update:show", !1))
3821
- }, null, 8, ["label"])
3822
- ])
3823
- ]),
3824
- _: 1
3825
- }, 8, ["modelValue", "dismiss-away"]);
3826
- };
3827
- }
3828
- });
3829
- export {
3830
- bt as P,
3831
- Ol as _,
3832
- xl as a,
3833
- Sl as b,
3834
- _l as c,
3835
- Ht as g,
3836
- Qt as u
3837
- };