@feedmepos/mf-inventory-portal 1.4.2 → 1.4.4-dev.1

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