@feedmepos/mf-inventory-portal 1.2.12-dev.3 → 1.2.13

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 (74) hide show
  1. package/dist/{App-D5hXQpVn.js → App-ZoXow3DD.js} +40 -44
  2. package/dist/{ApprovalView-B__WDklZ.js → ApprovalView-BWX6xBQs.js} +30 -30
  3. package/dist/{BindingsDialog-DXdwRSnn.js → BindingsDialog-CuwkcDKX.js} +2 -2
  4. package/dist/{BindingsPicker-CqAD3aHc.js → BindingsPicker-BibFsY0g.js} +1 -1
  5. package/dist/{BindingsTable-DVNjpusl.js → BindingsTable-AdjKwSPH.js} +1 -1
  6. package/dist/{ClosingDraftView-DL678GBB.js → ClosingDraftView-DWFHP9nE.js} +129 -129
  7. package/dist/{ClosingTemplateView-DThiXLtp.js → ClosingTemplateView-DOCF5f_u.js} +28 -28
  8. package/dist/{DeliveryOrderPrintPreview-B2MB9S6a.js → DeliveryOrderPrintPreview-DNDtL_Vo.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BNxs6Bcr.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BWhINOE8.js} +3 -3
  10. package/dist/{FmMultiselectDialog-B45ZLjVp.js → FmMultiselectDialog-Dfo04ak5.js} +1 -1
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-D8ks6AEM.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DGVs4zLl.js} +45 -45
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-C5zIvG2h.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BESx2u4Y.js} +1 -1
  13. package/dist/{IngredientGroupView-D95dFXIZ.js → IngredientGroupView-M9sXlnE0.js} +32 -31
  14. package/dist/IngredientsView-DUwhH3j1.js +2475 -0
  15. package/dist/{IntegrationView-9m3N_9lW.js → IntegrationView-BlUNz1yc.js} +57 -57
  16. package/dist/{InventoryBindingForm-kLoQskao.js → InventoryBindingForm-CvQ5zh6v.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BytErBcK.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BEAEmPsU.js} +31 -31
  18. package/dist/{InventoryBindingSummary-Dg0FH7ad.js → InventoryBindingSummary-CsJ-6G2P.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BKrUNLuG.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DjN_ktl1.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BL1f817e.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BN_e7k7U.js} +1 -1
  21. package/dist/{PublishView-BcOHSAj3.js → PublishView-DZgCyLK2.js} +15 -15
  22. package/dist/{PurchaseOrderPrintPreview-UfF8RVkv.js → PurchaseOrderPrintPreview-CB2xvQ33.js} +1 -1
  23. package/dist/{ReceiveRequestView-D_y_xNUb.js → ReceiveRequestView-DgDHOS-Y.js} +63 -62
  24. package/dist/RecipeView-DQDfwCJd.js +621 -0
  25. package/dist/{StockView-ciU6aAV7.js → StockView-eJOngk08.js} +166 -165
  26. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-XwDTGpR-.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BMFfegsk.js} +1 -1
  27. package/dist/{SupplierView-DFwtALPg.js → SupplierView-BS8rBAKC.js} +492 -490
  28. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-w98ibfql.js +3060 -0
  29. package/dist/{TransferTemplateView-BXr_GqTi.js → TransferTemplateView-By5Ci4Yg.js} +48 -48
  30. package/dist/UnitView-DmuWMFlA.js +667 -0
  31. package/dist/{WarehouseView-BYd0bPhi.js → WarehouseView-4ZLSJXYc.js} +32 -32
  32. package/dist/api/inventory.d.ts +0 -306
  33. package/dist/api/purchase-order.d.ts +0 -1
  34. package/dist/{app-Bb0-8bRg.js → app-D2lun71R.js} +11108 -11723
  35. package/dist/app.d.ts +0 -421
  36. package/dist/app.js +1 -1
  37. package/dist/array-Ca8T3f_G.js +44 -0
  38. package/dist/{closing-template-DPVNEyI7.js → closing-template-Cm1TtVzm.js} +1 -1
  39. package/dist/{decimal-BdBZYISm.js → decimal-eeicE4jp.js} +1 -1
  40. package/dist/{format-unit-display-DlmCwWo_.js → format-unit-display-vHKazw0l.js} +25 -25
  41. package/dist/helper/number.d.ts +0 -1
  42. package/dist/{index-CqBKFj1B.js → index-C5s-1g7c.js} +1 -1
  43. package/dist/{index-CKFmV1Pk.js → index-DvX9cMJV.js} +1 -1
  44. package/dist/{purchase-order-template-CLtEYr5E.js → purchase-order-template-uTs7bR89.js} +1 -1
  45. package/dist/router/name.d.ts +0 -1
  46. package/dist/{stock-nHQhfe2W.js → stock-CL2LNdXp.js} +1 -1
  47. package/dist/stores/feature.d.ts +0 -2
  48. package/dist/stores/inventory.d.ts +199 -26
  49. package/dist/{supplier-DuOjLpOa.js → supplier-CuzoW2k4.js} +1 -1
  50. package/dist/tsconfig.app.tsbuildinfo +1 -1
  51. package/dist/{use-ingredient-select-dialog-B-11Eqlm.js → use-ingredient-select-dialog-Cpg4lHHC.js} +1 -1
  52. package/dist/{use-inventory-binding-dialog-DhLSdRtp.js → use-inventory-binding-dialog-h4M4ICQK.js} +1 -1
  53. package/dist/views/ingredients/helper/import-export.helper.d.ts +1 -3
  54. package/dist/views/recipe/RecipeView.vue.d.ts +0 -1
  55. package/dist/views/unit/UnitView.vue.d.ts +0 -1
  56. package/package.json +2 -2
  57. package/dist/ImportView-EXm_g_jD.js +0 -1303
  58. package/dist/IngredientsView-MF1USuZI.js +0 -2240
  59. package/dist/RecipeView-DOaU9GIF.js +0 -636
  60. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CdA5_lEz.js +0 -3221
  61. package/dist/UnitView-CAXHvh3n.js +0 -674
  62. package/dist/import-export.helper-B04wszRI.js +0 -243
  63. package/dist/views/import/ImportView.vue.d.ts +0 -3
  64. package/dist/views/import/components/ImportDialog.vue.d.ts +0 -2
  65. package/dist/views/import/helper/import-export.helper.d.ts +0 -4
  66. package/dist/views/receive-request/components/delivery-order-form/SystemTrailDialog.vue.d.ts +0 -17
  67. package/dist/views/recipe/components/import-recipes/ImportRecipeItem.vue.d.ts +0 -16
  68. package/dist/views/recipe/components/import-recipes/ImportRecipes.vue.d.ts +0 -2
  69. package/dist/views/recipe/helper/import-recipe.d.ts +0 -48
  70. package/dist/views/unit/components/import-units/ImportUnitItem.vue.d.ts +0 -12
  71. package/dist/views/unit/components/import-units/ImportUnitItemProps.d.ts +0 -6
  72. package/dist/views/unit/components/import-units/ImportUnits.vue.d.ts +0 -9
  73. package/dist/views/unit/components/import-units/ImportUnitsProps.d.ts +0 -5
  74. package/dist/views/unit/helper/import-export.helper.d.ts +0 -40
@@ -1,3221 +0,0 @@
1
- import { a6 as mt, u as xe, aW as P, aX as Ze, aG as te, c as Pe, b as Je, ae as wt, ag as xt, ah as $t, aY as Rt, e as ct, f as pt, a4 as at, aZ as kt, ab as ft, Z as yt, l as ye, a9 as Dt, a_ as vt, al as We, h as Ae, i as ut, j as me, D as ge, a$ as ht, b0 as bt, b1 as Ee, aH as Nt, O as gt, aE as we, t as Ye, a7 as Me, a8 as Qe, ad as Be, Y as Ne, b2 as et, b3 as De } from "./app-Bb0-8bRg.js";
2
- import { ref as W, computed as G, h as I, defineComponent as Oe, reactive as Ct, onMounted as _t, resolveComponent as K, openBlock as d, createBlock as se, withCtx as Q, createElementVNode as e, createVNode as q, unref as v, createElementBlock as R, toDisplayString as $, createCommentVNode as U, Fragment as ce, renderList as Se, createTextVNode as Ce, normalizeClass as Ue, watch as At, isRef as Tt, resolveDynamicComponent as Ft } from "vue";
3
- import { F as qt } from "./decimal-BdBZYISm.js";
4
- import { useCoreStore as Ke, useI18n as lt } from "@feedmepos/mf-common";
5
- import { useDialog as ze, useSnackbar as Ve, components as je, FmButtonVariant as he, useProxiedModel as It } from "@feedmepos/ui-library";
6
- import { a as Pt, u as Vt, P as Te, f as Et } from "./format-unit-display-DlmCwWo_.js";
7
- import { E as Lt } from "./empty-placeholder-wf6-BWE8.js";
8
- import { _ as Bt, F as Ut, a as Mt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-D8ks6AEM.js";
9
- import { u as jt, R as dt } from "./usePromise-CbVUCxhj.js";
10
- import { u as Kt } from "./index-CKFmV1Pk.js";
11
- const Fe = mt((_, o) => {
12
- const n = xe(), f = Ke();
13
- return {
14
- async readRequests(a, t, l) {
15
- const s = a ?? n.currentLocationDBName, i = `${_.inventoryBackendUrl}/${s}/purchase-request`;
16
- return t && l ? await o.get(`${i}?startDate=${t}&endDate=${l}`) : await o.get(i);
17
- },
18
- async readRequestById(a, t) {
19
- const l = t ?? n.currentLocationDBName, s = `${_.inventoryBackendUrl}/${l}/purchase-request/${a}`;
20
- return await o.get(s);
21
- },
22
- async readRequestByIds(a, t) {
23
- const l = t ?? n.currentLocationDBName, s = `${_.inventoryBackendUrl}/${l}/purchase-request/find`;
24
- return await o.post(s, { requestIds: a });
25
- },
26
- async getPurchaseOrders({
27
- start: a,
28
- end: t
29
- }) {
30
- const l = n.currentLocationDBName, s = `${_.inventoryBackendUrl}/${l}/purchase-order`;
31
- return await o.get(`${s}?start=${a}&end=${t}`);
32
- },
33
- async getLatestPurchaseOrderRequest(a) {
34
- const t = n.currentLocationDBName, l = `${_.inventoryBackendUrl}/${t}/purchase-request/find-by-purchase-order-id`;
35
- return await o.get(`${l}/${a}`);
36
- },
37
- async getPurchaseOrderById(a) {
38
- const t = n.currentLocationDBName, l = `${_.inventoryBackendUrl}/${t}/purchase-order`;
39
- return await o.get(`${l}/${a}`);
40
- },
41
- /**
42
- * @deprecated Use `processPurchaseOrderV2` instead.
43
- */
44
- async processPurchaseOrder(a, t) {
45
- const l = n.currentLocationDBName, s = t || l, i = `${_.inventoryBackendUrl}/${s}/purchase-order/run-operation`;
46
- return await o.put(i, a);
47
- },
48
- async createPurchaseOrder(a) {
49
- const t = n.currentLocationDBName, l = `${_.inventoryBackendUrl}/${t}/purchase-order`;
50
- return await o.post(l, a);
51
- },
52
- async updatePurchaseOrder(a) {
53
- const t = n.currentLocationDBName, l = `${_.inventoryBackendUrl}/${t}/purchase-order`;
54
- return await o.put(l, a);
55
- },
56
- async importFromXilnex(a) {
57
- const t = n.currentLocationDBName, l = `${_.inventoryBackendUrl}/${t}/purchase-order/import-from-xilnex`;
58
- return await o.post(l, a);
59
- },
60
- async processPurchaseOrderV2(a, t) {
61
- const l = n.currentLocationDBName, s = t || l, i = `${_.inventoryBackendUrl}/${s}/v2/purchase-order/run-operation`;
62
- return await o.put(i, a);
63
- },
64
- async getWorkflowConfig() {
65
- var s;
66
- const t = `business_${(s = f.currentBusiness.value) == null ? void 0 : s._id}`, l = `${_.inventoryBackendUrl}/${t}/v2/purchase-order/workflow-config`;
67
- return await o.get(l);
68
- },
69
- async updateDeliveryOrder(a) {
70
- const t = n.currentLocationDBName, l = `${_.inventoryBackendUrl}/${t}/delivery-order`;
71
- return await o.put(l, a);
72
- },
73
- async createDeliveryOrder(a) {
74
- const t = n.currentLocationDBName, l = `${_.inventoryBackendUrl}/${t}/delivery-order`;
75
- return await o.post(l, a);
76
- },
77
- async getDeliveryOrderTrails(a, t) {
78
- const l = n.currentLocationDBName, s = `${_.inventoryBackendUrl}/${l}/delivery-order/audit-trails`;
79
- return await o.post(s, { purchaseOrderId: a, deliveryOrderId: t });
80
- }
81
- };
82
- }), zt = mt((_, o) => {
83
- const n = xe();
84
- return {
85
- async getShipments({
86
- start: f,
87
- end: a
88
- }) {
89
- const t = n.currentLocationDBName, l = `${_.inventoryBackendUrl}/${t}/shipments`;
90
- return await o.get(`${l}?start=${f}&end=${a}`);
91
- },
92
- async getShipmentsByIds(f) {
93
- if (f.length === 0)
94
- return [];
95
- const a = n.currentLocationDBName, t = `${_.inventoryBackendUrl}/${a}/shipments/get`;
96
- return await o.post(t, { shipmentIds: f });
97
- }
98
- };
99
- }), St = {
100
- [P.enum.confirmDraft]: {
101
- primaryActions: {
102
- text: "Confirm draft",
103
- close: !0
104
- },
105
- title: "Confirm draft?",
106
- message: "Purchase order cannot be changed after confirm draft.",
107
- successMessage: "Purchase order draft has been confirmed"
108
- },
109
- [P.enum.cancelDraft]: {
110
- primaryActions: {
111
- text: "Cancel draft",
112
- close: !0,
113
- variant: "destructive"
114
- },
115
- title: "Cancel draft?",
116
- message: "Purchase order cannot be changed after cancelled draft.",
117
- successMessage: "Purchase order draft has been cancelled"
118
- },
119
- [P.enum.submitRequest]: {
120
- primaryActions: {
121
- text: "Submit request",
122
- close: !0
123
- },
124
- title: "Confirm draft?",
125
- message: "Purchase order cannot be changed after confirm draft.",
126
- successMessage: "Purchase order draft has been submitted"
127
- },
128
- [P.enum.completeReceive]: {
129
- primaryActions: {
130
- text: "Mark received",
131
- close: !0
132
- },
133
- title: "Mark as received",
134
- message: "Purchase order cannot be changed after it has complete receiving.",
135
- successMessage: "Purchase order has been marked as received"
136
- },
137
- [P.enum.approveRequest]: {
138
- primaryActions: {
139
- text: "Accept request",
140
- close: !0
141
- },
142
- title: "Accept request?",
143
- message: "Transfer out request will be accepted.",
144
- successMessage: "Transfer out request has been approved"
145
- },
146
- [P.enum.rejectRequest]: {
147
- primaryActions: {
148
- text: "Reject request",
149
- close: !0,
150
- variant: "destructive"
151
- },
152
- title: "Reject request?",
153
- message: "Purchase order will be rejected.",
154
- successMessage: "Purchase order has been rejected"
155
- },
156
- [P.enum.processRequest]: {
157
- primaryActions: {
158
- text: "Process request",
159
- close: !0,
160
- variant: "destructive"
161
- },
162
- title: "Process request?",
163
- message: "Purchase order will be processed.",
164
- successMessage: "Purchase order has been processed"
165
- }
166
- };
167
- function Xe(_) {
168
- return Ze.generatedPOReceivedMap({
169
- purchaseOrder: _
170
- });
171
- }
172
- function Ht(_) {
173
- return Ze.validatePOItemReceivedStatus({
174
- dto: _
175
- });
176
- }
177
- function st(_) {
178
- return Ze.validatePOReceivedStatus({
179
- receivedMap: _
180
- });
181
- }
182
- function ot(_, o, n) {
183
- if (!te.safeParse(_).success)
184
- throw new Error(`Invalid purchase order status: ${_}`);
185
- const f = te.parse(_);
186
- return Ze.orderStatusCombination({
187
- status: f,
188
- isPOPartialReceive: o,
189
- isPOOverReceive: n
190
- });
191
- }
192
- function Ot() {
193
- const _ = xe(), o = Fe(), n = Pe();
194
- async function f(t, l) {
195
- const s = _.currentLocationDBName;
196
- return t.doc.supplier.internal && t.operation === P.enum.confirmDraft && (t.operation = P.enum.submitRequest), await o.processPurchaseOrder(t, l || s);
197
- }
198
- async function a(t, l) {
199
- const s = _.currentLocationDBName;
200
- return await o.processPurchaseOrderV2(t, l || s);
201
- }
202
- return (t) => n.useOperatePurchaseOrderV2 ? a(t.operateV2, t.transferTo) : f(t.operate, t.transferTo);
203
- }
204
- var nt = /* @__PURE__ */ ((_) => (_.RECEIVE_REQUEST = "receive/request", _.APPROVAL = "approval", _))(nt || {});
205
- const Le = W(), tt = W();
206
- function hn(_, o) {
207
- const n = ze(), f = xe(), a = Pe();
208
- Je();
209
- const t = Pt(), l = Vt(), s = W(!1), i = Ve(), O = Fe(), w = zt(), h = W(new Array()), F = W(new Array()), b = W(
210
- o != null && o.startDate && (o != null && o.endDate) ? o : wt()
211
- ), N = G(() => {
212
- const B = new Date(b.value.startDate), M = new Date(b.value.endDate);
213
- return {
214
- start: xt(B).toISOString(),
215
- end: $t(M).toISOString()
216
- };
217
- }), u = W(new Array()), c = Rt(), y = W(null);
218
- async function p(B) {
219
- function M(D) {
220
- const x = {
221
- mode: ct.CREATE,
222
- modelValue: B || void 0,
223
- show: !0,
224
- "onUpdate:show"(A) {
225
- Le.value.show = A;
226
- },
227
- templateId: D,
228
- lastClosingDate: y.value
229
- };
230
- Le.value = x;
231
- }
232
- let ne;
233
- a.mustUsePoTemplate && !(B != null && B.template) ? n.open({
234
- title: "Create transfer",
235
- message: "",
236
- primaryActions: {
237
- text: "Select a template",
238
- close: !0
239
- },
240
- secondaryActions: {
241
- text: "Outlet to Outlet",
242
- variant: "secondary",
243
- close: !0
244
- }
245
- }).onPrimary(async () => {
246
- ne = await t.getTemplateId(), ne && M(ne);
247
- }).onSecondary(() => {
248
- M(void 0);
249
- }) : M(ne);
250
- }
251
- function S(B) {
252
- const M = {
253
- mode: ct.UPDATE,
254
- modelValue: pt(B),
255
- show: !0,
256
- "onUpdate:show"(ne) {
257
- Le.value.show = ne;
258
- },
259
- lastClosingDate: y.value
260
- };
261
- Le.value = M;
262
- }
263
- async function V() {
264
- h.value = [], F.value = [], s.value = !0;
265
- try {
266
- const B = await O.getPurchaseOrders(N.value);
267
- h.value = B.sort((r, m) => m._id.localeCompare(r._id));
268
- const M = B.flatMap((r) => r.shipmentIds || []).filter(Boolean), ne = M.length > 0 ? await w.getShipmentsByIds(M) : [];
269
- F.value = ne;
270
- const D = await c.readCurrentLocationLastClosing(!0), x = D == null ? void 0 : D._id;
271
- x && (y.value = kt(x)), await a.awaitFeatureLoaded(() => a.mustUsePoTemplate) && await l.fetchTemplates();
272
- const A = h.value.map((r) => {
273
- var m;
274
- return ((m = r.request) == null ? void 0 : m.id) ?? "";
275
- }).filter((r) => r);
276
- u.value = await O.readRequestByIds(A);
277
- } catch {
278
- i.open({
279
- title: "Something went wrong",
280
- message: "Error at fetching purchase orders",
281
- type: "error"
282
- });
283
- } finally {
284
- s.value = !1;
285
- }
286
- }
287
- async function C() {
288
- u.value = [], s.value = !0;
289
- try {
290
- u.value = await O.readRequests(
291
- void 0,
292
- N.value.start,
293
- N.value.end
294
- ).then((B) => B.reverse());
295
- } catch {
296
- i.open({
297
- title: "Something went wrong",
298
- message: "Error at fetching purchase requests",
299
- type: "error"
300
- });
301
- } finally {
302
- s.value = !1;
303
- }
304
- }
305
- function z() {
306
- switch (_) {
307
- case "receive/request":
308
- return V();
309
- case "approval":
310
- return C();
311
- }
312
- }
313
- function ee(B, M) {
314
- b.value = {
315
- startDate: B,
316
- endDate: M
317
- }, z();
318
- }
319
- f.watchLocation(async (B) => {
320
- if (!B) {
321
- h.value = [];
322
- return;
323
- }
324
- await z();
325
- });
326
- const Y = W(), X = W(Math.random().toString());
327
- async function be(B, M) {
328
- const ne = Math.random().toString();
329
- X.value = ne, M ?? (M = u.value.computeFirst(
330
- (A) => A.purchaseOrderId === B._id ? A : null
331
- ) ?? void 0);
332
- const D = _ === "receive/request" ? f.currentLocation : M == null ? void 0 : M.to, x = {
333
- poRequest: M,
334
- purchaseOrder: B,
335
- transferTo: D == null ? void 0 : D.name,
336
- transferToDbName: D == null ? void 0 : D.dbName,
337
- show: !0,
338
- canResubmit: !1,
339
- canApprove: _ === "approval",
340
- "onUpdate:show"(A) {
341
- Y.value.show = A;
342
- },
343
- scope: _,
344
- receivedMap: Xe(B) ?? {},
345
- shipments: F.value
346
- };
347
- Y.value = x;
348
- }
349
- async function pe(B, M, ne, D) {
350
- const x = Ot();
351
- s.value = !0;
352
- try {
353
- await x({
354
- operate: {
355
- operation: M,
356
- doc: B,
357
- options: (
358
- // auto receive for supplier to warehouse
359
- (M === P.enum.confirmDraft || // auto receive for warehouse to warehouse
360
- M === P.enum.completeReceive) && a.autoReceiveWarehouse ? {
361
- autoReceive: !0
362
- } : void 0
363
- )
364
- },
365
- operateV2: {
366
- _id: B._id,
367
- _rev: B._rev ?? "",
368
- action: M,
369
- payloads: []
370
- },
371
- transferTo: D
372
- }), await new Promise((m) => setTimeout(m, 1e3));
373
- const r = xe().currentLocationDBName.startsWith("restaurant_");
374
- M === P.enum.confirmDraft && B.effectiveAt && r ? i.open({
375
- title: "Success",
376
- message: `${ne}. The backdate will be reflected once your POS has received this change.`,
377
- type: "success"
378
- }) : i.open({
379
- title: "Success",
380
- message: ne,
381
- type: "success"
382
- });
383
- } catch (A) {
384
- i.open({
385
- title: "Something went wrong",
386
- message: "Please try again.",
387
- type: "error"
388
- }), console.error("Error when submitting PO operation", M, B, A);
389
- } finally {
390
- s.value = !1, z();
391
- }
392
- }
393
- async function $e(B, M, ne) {
394
- const D = St[M];
395
- if (!D) {
396
- i.open({
397
- title: "Something went wrong",
398
- message: `Cannot process order: ${at(M)}`,
399
- type: "error"
400
- });
401
- return;
402
- }
403
- const { successMessage: x, ...A } = D;
404
- n.open({
405
- title: A.title,
406
- message: A.message,
407
- primaryActions: A.primaryActions
408
- }).onPrimary(() => {
409
- pe(B, M, x, ne);
410
- });
411
- }
412
- async function _e() {
413
- n.open({
414
- title: "Upload Transfer",
415
- primaryActions: {
416
- text: "Xilnex transfer note",
417
- close: !0
418
- },
419
- secondaryActions: {
420
- text: "Cancel",
421
- close: !0
422
- }
423
- }).onPrimary(() => {
424
- const B = {
425
- show: !0,
426
- "onUpdate:show"(M) {
427
- tt.value.show = M;
428
- }
429
- };
430
- tt.value = B;
431
- });
432
- }
433
- return {
434
- purchaseOrders: h,
435
- shipments: F,
436
- purchaseRequests: u,
437
- updateDateRange: ee,
438
- fetchData: z,
439
- loading: s,
440
- transferDialogProps: Le,
441
- promptCreateTransferDialog: p,
442
- promptUpdateTransferDialog: S,
443
- transferDetailsProps: Y,
444
- promptShowTransferDetails: be,
445
- submitAction: $e,
446
- xilnexImportDialogProps: tt,
447
- promptUploadTransferDialog: _e
448
- };
449
- }
450
- function Gt(_, o) {
451
- return o.reduce(
452
- (f, a) => {
453
- const t = a.received.find((l) => l.sku._id === _._id);
454
- return t && (f = ft(f, t.amount)), f;
455
- },
456
- qt.toPrecision(yt(0), _.unit.precision)
457
- );
458
- }
459
- function Wt(_) {
460
- const { po: o, currentLocation: n, business: f, fulfilling: a, por: t } = _, { name: l, address: s, regNo: i } = n.doc.profile, O = {
461
- name: l,
462
- registrationNumber: i,
463
- line1: s == null ? void 0 : s.line1,
464
- line2: s == null ? void 0 : s.line2,
465
- postcode: s == null ? void 0 : s.postcode,
466
- city: s == null ? void 0 : s.city,
467
- state: s == null ? void 0 : s.state,
468
- country: s == null ? void 0 : s.country
469
- }, w = {
470
- name: o.supplier.name,
471
- phoneNumber: o.supplier.phoneNumber,
472
- registrationNumber: o.supplier.registrationNumber,
473
- line1: o.supplier.address.line1,
474
- line2: o.supplier.address.line2,
475
- postcode: o.supplier.address.postcode,
476
- city: o.supplier.address.city,
477
- state: o.supplier.address.state,
478
- country: o.supplier.address.country
479
- }, h = o.items.map((S) => {
480
- const { sku: V, measurement: C } = S, z = ye(
481
- Gt(S.sku, o.deliveryOrder || []),
482
- !1
483
- );
484
- return {
485
- code: V.code,
486
- description: V.name,
487
- quantity: ye(S.quantity, !1),
488
- unit: (C == null ? void 0 : C.abbrev) || V.unit.abbrev,
489
- received: z,
490
- cost: S.totalCost ? `${S.totalCost.currency} ${Dt.toFormatString({
491
- value: S.totalCost
492
- })}` : void 0
493
- };
494
- }), F = o.deliveryOrder.map((S) => ({
495
- createdAt: vt(new Date(S.createdAt)),
496
- ref: S.deliveryOrderNumber,
497
- remark: S.remark || "",
498
- items: S.received.map((V) => {
499
- var C;
500
- return {
501
- code: V.sku.code,
502
- description: V.sku.name,
503
- quantity: ye(V.amount),
504
- unit: ((C = V.measurement) == null ? void 0 : C.abbrev) || V.sku.unit.abbrev
505
- };
506
- })
507
- })), b = [
508
- // Production
509
- "67ca5d2c80bd0e001c5bf5bc",
510
- // Dev
511
- "6880b36a3054c5001db19218"
512
- ];
513
- let N = "Inventory Receive Note";
514
- if (o.supplier.internal ? (N = "Inventory Transfer Note", b.includes((f == null ? void 0 : f._id) || "") && (N = "Stock Request")) : N = "Purchase Order", t) {
515
- const S = t.from.dbName;
516
- n.dbName === S || (N = "Inventory Receive Note");
517
- }
518
- const c = {
519
- title: N,
520
- businessName: f == null ? void 0 : f.name,
521
- logo: f == null ? void 0 : f.thumbnail,
522
- orderNumber: o.seqNumber.toString(),
523
- createdAt: We(o._id),
524
- ref: o.ref || "",
525
- remark: o.remark || "",
526
- buyer: O,
527
- supplier: w,
528
- items: h,
529
- status: o.status,
530
- deliveryOrders: F
531
- }, y = new URL(window.location.href), p = a && (o.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
532
- y.pathname = y.hostname.includes("portal.feedme") ? `/inventory/${p}` : `/${p}`, y.searchParams.append("data", JSON.stringify(c)), window.open(y.href, "_blank", "noreferrer");
533
- }
534
- const Ie = {
535
- submitRequest: {
536
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
537
- color: "text-fm-color-typo-primary",
538
- value: P.enum.submitRequest
539
- },
540
- confirmDraft: {
541
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
542
- color: "text-fm-color-typo-primary",
543
- value: P.enum.confirmDraft
544
- },
545
- cancelDraft: {
546
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
547
- color: "text-fm-color-typo-error",
548
- value: P.enum.cancelDraft
549
- },
550
- approveRequest: {
551
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
552
- color: "text-fm-color-typo-primary",
553
- value: P.enum.approveRequest
554
- },
555
- rejectRequest: {
556
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
557
- color: "text-fm-color-typo-error",
558
- value: P.enum.rejectRequest
559
- },
560
- processRequest: {
561
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
562
- color: "text-fm-color-typo-primary",
563
- value: P.enum.processRequest
564
- },
565
- receiveStock: {
566
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
567
- color: "text-fm-color-typo-primary",
568
- value: P.enum.receiveStock
569
- },
570
- completeReceive: {
571
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
572
- color: "text-fm-color-typo-primary",
573
- value: P.enum.completeReceive
574
- },
575
- closeRequest: {
576
- translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
577
- color: "system-error-300",
578
- value: P.enum.closeRequest
579
- },
580
- approveDraft: {
581
- translationKey: "",
582
- color: "",
583
- value: void 0
584
- },
585
- rejectDraft: {
586
- translationKey: "",
587
- color: "",
588
- value: void 0
589
- },
590
- returnStock: {
591
- translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
592
- color: "text-fm-color-typo-primary",
593
- value: P.enum.returnStock
594
- }
595
- };
596
- function bn(_, o, n) {
597
- const f = xe(), a = Je(), t = Ke(), { t: l } = lt();
598
- function s(b) {
599
- switch (b.status) {
600
- case "DRAFT":
601
- return [
602
- ge[me.Update],
603
- ge[me.Details],
604
- b.supplier.internal === "restaurant" || b.supplier.internal === "warehouse" ? Ie[P.enum.submitRequest] : Ie[P.enum.confirmDraft],
605
- Ie[P.enum.cancelDraft]
606
- ];
607
- case "RECEIVING":
608
- return [
609
- Ie[P.enum.completeReceive],
610
- ge[me.Details],
611
- ge[me.Print]
612
- ];
613
- case "REQUESTING":
614
- return _ === "receive/request" ? [ge[me.Details], ge[me.Print]] : [
615
- Ie[P.enum.approveRequest],
616
- Ie[P.enum.rejectRequest],
617
- ge[me.Details]
618
- // DefaultRowActions[RowActionEnum.Print]
619
- ];
620
- case "PROCESSING":
621
- return [ge[me.Details], ge[me.Print]];
622
- case "COMPLETE":
623
- case "CANCEL":
624
- default:
625
- return [ge[me.Details], ge[me.Print]];
626
- }
627
- }
628
- function i(b) {
629
- return Object.values(P.enum).includes(b);
630
- }
631
- async function O(b, N, u) {
632
- var y, p, S, V, C, z;
633
- const c = pt(N);
634
- if (b === me.Print) {
635
- const ee = (u == null ? void 0 : u.toInventoryLocation) ?? f.currentLocation;
636
- ((y = u == null ? void 0 : u.netSuite) != null && y.refNo || (p = c.netSuite) != null && p.refNo) && (c.ref = [((S = u == null ? void 0 : u.netSuite) == null ? void 0 : S.refNo) || ((V = c.netSuite) == null ? void 0 : V.refNo)].filter((Y) => Y).join(" ")), Wt({
637
- po: c,
638
- currentLocation: ee,
639
- business: t.currentBusiness.value,
640
- fulfilling: _ === "approval",
641
- por: u
642
- });
643
- return;
644
- }
645
- if (b === me.Details) {
646
- o.promptShowTransferDetails(c, u);
647
- return;
648
- }
649
- if (b === me.Update) {
650
- (C = o.promptUpdateTransferDialog) == null || C.call(o, c);
651
- return;
652
- }
653
- if (i(b)) {
654
- o.submitAction(N, b, (z = u == null ? void 0 : u.to) == null ? void 0 : z.dbName);
655
- return;
656
- }
657
- }
658
- function w() {
659
- var N;
660
- const b = [
661
- {
662
- accessorKey: "seqNumber",
663
- header: () => l("inventory.transfer.table.seqNo"),
664
- enableSorting: !0,
665
- size: 80,
666
- sortUndefined: "last"
667
- },
668
- {
669
- accessorKey: "_id",
670
- header: () => l("inventory.transfer.table.createdAt"),
671
- cell(u) {
672
- return We(`${u.getValue()}`);
673
- },
674
- enableSorting: !0
675
- },
676
- {
677
- accessorKey: "supplier.name",
678
- header: () => l("inventory.transfer.table.transferFrom"),
679
- enableSorting: !0,
680
- size: 200
681
- },
682
- {
683
- accessorKey: "items.length",
684
- header: () => l("inventory.transfer.table.noOfItems"),
685
- cell: (u) => {
686
- const c = u.row.original.version || "1", y = u.getValue();
687
- return I("div", { class: "flex items-center gap-2" }, [
688
- y,
689
- c !== "1" ? I(
690
- "div",
691
- { class: "py-3" },
692
- I(
693
- Ae,
694
- I(
695
- "div",
696
- {
697
- class: ["fm-status-badge", "fm-status-badge-draft"].join(" ")
698
- },
699
- `v${c}`
700
- )
701
- )
702
- ) : null
703
- ]);
704
- },
705
- enableSorting: !1,
706
- meta: {
707
- width: "10rem"
708
- }
709
- },
710
- {
711
- accessorKey: "ref",
712
- header: () => l("inventory.transfer.table.reference"),
713
- enableSorting: !1,
714
- size: "auto"
715
- },
716
- ...(N = t.sessionUser.value) != null && N.role.isAdmin ? [
717
- {
718
- id: "statusForAdmin",
719
- header: () => I(Ae, {}, () => `${l("inventory.transfer.table.status")}`),
720
- cell(u) {
721
- return u.row.original.status;
722
- },
723
- enableSorting: !0,
724
- size: 200
725
- }
726
- ] : [],
727
- {
728
- accessorKey: "status",
729
- header: () => l("inventory.transfer.table.status"),
730
- cell(u) {
731
- const c = u.getValue(), y = Xe(u.row.original), { partial: p, over: S } = st(y), V = ot(c ?? "", p, S);
732
- let C = l(`inventory.transfer.status.${V}`), z = `${c ?? ""}`.toLocaleLowerCase("en-us");
733
- V === te.enum.CLOSE && (C = `${l(`inventory.transfer.status.${te.enum.COMPLETE}`)}`), V === "PARTIAL_RECEIVED" && z === te.enum.PROCESSING.toLocaleLowerCase("en-us") && (z = te.enum.RECEIVING.toLocaleLowerCase("en-us"));
734
- let ee = null;
735
- const Y = n.value.find((X) => X.ref === u.row.original._id);
736
- if (Y != null && Y.milestones && Y.milestones.length > 0) {
737
- const X = Y.milestones[Y.milestones.length - 1];
738
- if (X.estimatedTime) {
739
- const be = new Date(X.estimatedTime), pe = be.getDate().toString().padStart(2, "0");
740
- ee = `${be.toLocaleString("en-US", { month: "short" })} ${pe}`;
741
- }
742
- }
743
- return I(
744
- "div",
745
- {
746
- class: "flex"
747
- },
748
- [
749
- I(
750
- "div",
751
- { class: "flex items-center" },
752
- I(
753
- "div",
754
- {
755
- class: [
756
- "fm-status-badge",
757
- `fm-status-badge-${z}`,
758
- S && "fm-status-badge-error"
759
- ].filter(Boolean).join(" ")
760
- },
761
- `${C}`
762
- )
763
- ),
764
- ...ee ? [
765
- I(
766
- "div",
767
- {
768
- class: "flex items-center gap-1 ml-2"
769
- },
770
- [
771
- I(je.FmIcon, {
772
- name: "local_shipping",
773
- size: "md",
774
- color: "neutral-gray-400"
775
- }),
776
- I(
777
- "span",
778
- { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
779
- ee
780
- )
781
- ]
782
- )
783
- ] : []
784
- ]
785
- );
786
- },
787
- enableSorting: !0,
788
- size: 150
789
- },
790
- {
791
- id: "action",
792
- cell(u) {
793
- const c = u.row.original, y = s(c);
794
- return ut(y, (p) => O(p, c));
795
- },
796
- enableSorting: !1,
797
- size: 40,
798
- meta: {
799
- cellClass: "",
800
- headerClass: ""
801
- }
802
- }
803
- ];
804
- if (a.isEnabled) {
805
- const u = [
806
- {
807
- id: "netsuiteTransferOrder",
808
- accessorFn: (c) => {
809
- var y;
810
- return (y = c.netSuite) != null && y.id ? `${c.netSuite.refNo} (${c.netSuite.id})` : "N/A";
811
- },
812
- header: () => "NetSuite Order (ID)",
813
- cell(c) {
814
- var p;
815
- const y = c.row.original;
816
- return (p = y.netSuite) != null && p.id ? `${y.netSuite.refNo} (${y.netSuite.id})` : "N/A";
817
- },
818
- enableSorting: !1,
819
- size: 200,
820
- meta: {
821
- cellClass: "",
822
- headerClass: ""
823
- }
824
- },
825
- {
826
- id: "netsuiteTransactionNumber",
827
- accessorFn: (c) => {
828
- var y, p;
829
- return ((p = (y = c.netSuite) == null ? void 0 : y.additionalInfo) == null ? void 0 : p.transactionnumber) ?? "N/A";
830
- },
831
- header: () => "NetSuite Transaction No.",
832
- cell(c) {
833
- var p, S;
834
- return ((S = (p = c.row.original.netSuite) == null ? void 0 : p.additionalInfo) == null ? void 0 : S.transactionnumber) ?? "N/A";
835
- },
836
- enableSorting: !1,
837
- size: 200,
838
- meta: {
839
- cellClass: "",
840
- headerClass: ""
841
- }
842
- }
843
- ];
844
- b.splice(b.length - 1, 0, ...u);
845
- }
846
- return b;
847
- }
848
- function h() {
849
- var N;
850
- const b = [
851
- {
852
- accessorKey: "purchaseOrder.seqNumber",
853
- header: () => l("inventory.transfer.table.seqNo"),
854
- enableSorting: !0,
855
- size: 80,
856
- sortUndefined: "last"
857
- },
858
- {
859
- accessorKey: "purchaseOrder._id",
860
- header: () => l("inventory.transfer.table.createdAt"),
861
- cell(u) {
862
- return We(`${u.getValue()}`);
863
- },
864
- enableSorting: !0
865
- },
866
- {
867
- accessorKey: "to.name",
868
- header: () => l("inventory.transfer.table.transferTo"),
869
- enableSorting: !1,
870
- size: 200
871
- },
872
- {
873
- accessorKey: "purchaseOrder.items.length",
874
- header: () => l("inventory.transfer.table.noOfItems"),
875
- enableSorting: !1
876
- },
877
- {
878
- accessorKey: "purchaseOrder.ref",
879
- header: () => l("inventory.transfer.table.reference"),
880
- enableSorting: !1,
881
- size: "auto"
882
- },
883
- ...(N = t.sessionUser.value) != null && N.role.isAdmin ? [
884
- {
885
- id: "statusForAdmin",
886
- header: () => I(Ae, {}, () => `${l("inventory.transfer.table.status")}`),
887
- cell(u) {
888
- return u.row.original.status;
889
- },
890
- enableSorting: !0,
891
- size: 200
892
- }
893
- ] : [],
894
- {
895
- accessorKey: "purchaseOrder.status",
896
- header: () => l("inventory.transfer.table.status"),
897
- cell(u) {
898
- const c = u.row.original, y = u.getValue();
899
- if (!c.purchaseOrder)
900
- return I(je.FmChip, {
901
- label: "N/A",
902
- compact: !0
903
- });
904
- const p = Xe(c.purchaseOrder), { partial: S, over: V } = st(p), C = ot(y ?? "", S, V);
905
- let z = l(`inventory.transfer.status.${C}`), ee = `${y ?? ""}`.toLocaleLowerCase("en-us");
906
- return C === te.enum.CLOSE && (z = `${l(`inventory.transfer.status.${te.enum.COMPLETE}`)}`), C === "PARTIAL_RECEIVED" && ee === te.enum.PROCESSING.toLocaleLowerCase("en-us") && (ee = te.enum.RECEIVING.toLocaleLowerCase("en-us")), I(
907
- "div",
908
- {
909
- class: "flex"
910
- },
911
- I(
912
- "div",
913
- {
914
- class: [
915
- "fm-status-badge",
916
- `fm-status-badge-${ee}`,
917
- V && "fm-status-badge-error"
918
- ].filter(Boolean).join(" ")
919
- },
920
- `${z}`
921
- )
922
- );
923
- },
924
- enableSorting: !0
925
- },
926
- {
927
- id: "action",
928
- cell(u) {
929
- const c = u.row.original, p = (c.purchaseOrder ? s(c.purchaseOrder) : []).map((S) => S.value === me.Print ? {
930
- ...S,
931
- translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
932
- } : S);
933
- return ut(
934
- p,
935
- (S) => c.purchaseOrder ? O(S, c.purchaseOrder, c) : void 0
936
- );
937
- },
938
- enableSorting: !1,
939
- size: 40,
940
- meta: {
941
- cellClass: "",
942
- headerClass: ""
943
- }
944
- }
945
- ];
946
- if (a.isEnabled) {
947
- const u = [
948
- {
949
- id: "netsuiteTransferOrder",
950
- accessorFn: (c) => {
951
- var y;
952
- return (y = c.netSuite) != null && y.id ? `${c.netSuite.refNo} (${c.netSuite.id})` : "N/A";
953
- },
954
- header: () => "NetSuite Order (ID)",
955
- cell(c) {
956
- var p;
957
- const y = c.row.original;
958
- return (p = y.netSuite) != null && p.id ? `${y.netSuite.refNo} (${y.netSuite.id})` : "N/A";
959
- },
960
- enableSorting: !1,
961
- size: 200,
962
- meta: {
963
- cellClass: "",
964
- headerClass: ""
965
- }
966
- },
967
- {
968
- id: "netsuiteTransactionNumber",
969
- accessorFn: (c) => {
970
- var y, p;
971
- return ((p = (y = c.netSuite) == null ? void 0 : y.additionalInfo) == null ? void 0 : p.transactionnumber) ?? "N/A";
972
- },
973
- header: () => "NetSuite Transaction No.",
974
- cell(c) {
975
- var p, S;
976
- return ((S = (p = c.row.original.netSuite) == null ? void 0 : p.additionalInfo) == null ? void 0 : S.transactionnumber) ?? "N/A";
977
- },
978
- enableSorting: !1,
979
- size: 200,
980
- meta: {
981
- cellClass: "",
982
- headerClass: ""
983
- }
984
- }
985
- ];
986
- b.splice(b.length - 2, 0, ...u);
987
- }
988
- return b;
989
- }
990
- return {
991
- columnDefs: G(() => _ === "receive/request" ? w() : h())
992
- };
993
- }
994
- const Yt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Qt = { class: "flex flex-col gap-8" }, Xt = { class: "flex w-full justify-end gap-16" }, Zt = /* @__PURE__ */ Oe({
995
- __name: "FulfillmentForm",
996
- props: {
997
- purchaseOrder: {},
998
- confirm: { type: Function }
999
- },
1000
- emits: ["update:show"],
1001
- setup(_, { emit: o }) {
1002
- const n = _, f = Ct({
1003
- id: "",
1004
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1005
- items: []
1006
- }), a = W(), t = o;
1007
- _t(() => {
1008
- n.purchaseOrder && (f.items = n.purchaseOrder.items.map((s) => ({
1009
- id: s.id,
1010
- sku: s.sku,
1011
- measurement: s.measurement,
1012
- amount: s.quantity ?? { amount: 1, precision: 0 }
1013
- })));
1014
- });
1015
- const l = G(() => f.items.length <= 10);
1016
- return (s, i) => {
1017
- const O = K("FmTable"), w = K("FmButton"), h = K("FmForm");
1018
- return d(), se(h, {
1019
- ref_key: "formRef",
1020
- ref: a,
1021
- class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
1022
- onValidationFailed: console.log,
1023
- onValidationSuccess: i[1] || (i[1] = () => n.confirm(f))
1024
- }, {
1025
- default: Q(() => [
1026
- i[2] || (i[2] = e("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
1027
- e("div", Yt, [
1028
- e("div", Qt, [
1029
- q(O, {
1030
- "column-defs": [
1031
- {
1032
- header: "Code",
1033
- cell: (F) => {
1034
- const b = n.purchaseOrder.items.find((N) => N.id === F.row.original.id || N.sku._id === F.row.original.sku._id);
1035
- return I(
1036
- v(je).FmTooltip,
1037
- {
1038
- content: b.code,
1039
- placement: "top",
1040
- variant: "plain",
1041
- zIndex: 50
1042
- },
1043
- I(
1044
- "span",
1045
- {
1046
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
1047
- },
1048
- b.code
1049
- )
1050
- );
1051
- }
1052
- },
1053
- {
1054
- header: "Name",
1055
- cell: (F) => {
1056
- const b = n.purchaseOrder.items.find((N) => N.id === F.row.original.id || N.sku._id === F.row.original.sku._id);
1057
- return I(
1058
- v(je).FmTooltip,
1059
- {
1060
- content: b.name,
1061
- placement: "top",
1062
- variant: "plain",
1063
- zIndex: 50
1064
- },
1065
- I(
1066
- "span",
1067
- {
1068
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
1069
- },
1070
- b.name
1071
- )
1072
- );
1073
- }
1074
- },
1075
- {
1076
- header: "Amount",
1077
- cell: (F) => {
1078
- const b = F.row.original, N = n.purchaseOrder.items.find((c) => c.id === b.id || c.sku._id === b.sku._id), u = b.amount ?? {
1079
- amount: 1,
1080
- precision: 0
1081
- };
1082
- return I(Bt, {
1083
- style: {
1084
- flex: "1 1 0%"
1085
- },
1086
- modelValue: {
1087
- amount: u,
1088
- measurement: b.measurement ?? null
1089
- },
1090
- key: b.id ?? b.sku._id,
1091
- unit: b.sku.unit,
1092
- "onUpdate:modelValue": (c) => {
1093
- if (!c) return;
1094
- const y = f.items.find((p) => p.id === b.id || p.sku._id === b.sku._id);
1095
- y && (y.amount = c.amount);
1096
- },
1097
- disableUnit: !0,
1098
- rules: [
1099
- v(Ut)(
1100
- +v(ye)({ amount: 0, precision: 0 })
1101
- ),
1102
- v(Mt)(+v(ye)(N.quantity))
1103
- ],
1104
- applyDefaultRules: !0
1105
- });
1106
- }
1107
- }
1108
- ],
1109
- "row-data": f.items,
1110
- "hide-footer": l.value
1111
- }, null, 8, ["column-defs", "row-data", "hide-footer"])
1112
- ])
1113
- ]),
1114
- e("div", Xt, [
1115
- q(w, {
1116
- class: "px-16",
1117
- label: "Confirm",
1118
- size: "md",
1119
- variant: "primary",
1120
- type: "submit"
1121
- }),
1122
- q(w, {
1123
- class: "px-16",
1124
- label: "Cancel",
1125
- size: "md",
1126
- variant: "secondary",
1127
- onClick: i[0] || (i[0] = () => t("update:show", !1))
1128
- })
1129
- ])
1130
- ]),
1131
- _: 1
1132
- }, 8, ["onValidationFailed"]);
1133
- };
1134
- }
1135
- }), rt = {
1136
- submitRequest: {
1137
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
1138
- color: "primary",
1139
- buttonVariant: he.Primary
1140
- },
1141
- confirmDraft: {
1142
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
1143
- color: "primary",
1144
- buttonVariant: he.Primary
1145
- },
1146
- cancelDraft: {
1147
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
1148
- color: "system-error-300",
1149
- buttonVariant: he.Destructive
1150
- },
1151
- approveDraft: {
1152
- translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
1153
- color: "primary",
1154
- buttonVariant: he.Primary
1155
- },
1156
- rejectDraft: {
1157
- translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
1158
- color: "system-error-300",
1159
- buttonVariant: he.Destructive
1160
- },
1161
- approveRequest: {
1162
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
1163
- color: "primary",
1164
- buttonVariant: he.Primary
1165
- },
1166
- processRequest: {
1167
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
1168
- color: "primary",
1169
- buttonVariant: he.Primary
1170
- },
1171
- receiveStock: {
1172
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
1173
- color: "primary",
1174
- buttonVariant: he.Primary,
1175
- available: !1
1176
- },
1177
- completeReceive: {
1178
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
1179
- color: "primary",
1180
- buttonVariant: he.Plain
1181
- },
1182
- rejectRequest: {
1183
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
1184
- color: "system-error-300",
1185
- buttonVariant: he.Destructive
1186
- },
1187
- closeRequest: {
1188
- translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
1189
- color: "system-error-300",
1190
- buttonVariant: he.Destructive,
1191
- available: !1
1192
- },
1193
- returnStock: {
1194
- translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
1195
- color: "primary",
1196
- buttonVariant: he.Primary,
1197
- available: !1
1198
- }
1199
- };
1200
- function Jt() {
1201
- const _ = Pe();
1202
- return {
1203
- ableToMarkReceived(o) {
1204
- if (!o || o.status !== te.enum.RECEIVING)
1205
- return !1;
1206
- const f = xe().currentLocationDBName;
1207
- return `${o.supplier.internal}_${o.supplier._id}` !== f;
1208
- },
1209
- ableToMarkApproved(o) {
1210
- return !(!o || (o == null ? void 0 : o.status) !== te.enum.REQUESTING);
1211
- },
1212
- ableToCreateFulfillment(o, n) {
1213
- var t, l;
1214
- if (!_.acceptRequireFulfillment || !o || !n || o.status !== te.enum.PROCESSING || !n.processedAt)
1215
- return !1;
1216
- const f = (t = n == null ? void 0 : n.from) == null ? void 0 : t.dbName, a = (l = n == null ? void 0 : n.to) == null ? void 0 : l.dbName;
1217
- return !(f.startsWith("restaurant_") && a.startsWith("restaurant_"));
1218
- }
1219
- };
1220
- }
1221
- const er = { class: "flex flex-row-reverse" }, tr = /* @__PURE__ */ Oe({
1222
- __name: "NetSuiteSync",
1223
- props: {
1224
- poRequest: {},
1225
- purchaseOrder: {},
1226
- isTransferBetweenOutlets: { type: Boolean },
1227
- scope: {}
1228
- },
1229
- setup(_) {
1230
- const o = _, n = Je(), f = Ve(), a = ze(), t = W(!1);
1231
- G(() => {
1232
- var w, h, F, b;
1233
- let s = !0;
1234
- n.isEnabled || (s = !1);
1235
- const i = o.purchaseOrder, O = o.poRequest;
1236
- return i && ((w = i == null ? void 0 : i.supplier) != null && w.internal ? (!O && i.status == te.enum.DRAFT && (s = !1), O && !((h = O == null ? void 0 : O.netSuite) != null && h.id) && (s = !1), o.isTransferBetweenOutlets && (s = !1)) : ((i == null ? void 0 : i.status) !== te.enum.REQUESTING && i.supplier.internal && (s = !1), !O && !((F = i == null ? void 0 : i.netSuite) != null && F.id) && (s = !1), !O && ((b = i == null ? void 0 : i.netSuite) != null && b.id) && (i == null ? void 0 : i.status) == te.enum.REQUESTING && (s = !1))), s;
1237
- });
1238
- async function l() {
1239
- t.value || a.open({
1240
- title: "Sync with NetSuite",
1241
- contentComponent: I("div", [
1242
- I("p", "Are you sure you want to sync now?"),
1243
- I("br"),
1244
- I(
1245
- "p",
1246
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1247
- "Please wait a moment before syncing manually to avoid unnecessary actions."
1248
- )
1249
- ]),
1250
- primaryActions: {
1251
- text: "Sync",
1252
- close: !0,
1253
- variant: "destructive"
1254
- },
1255
- secondaryActions: { text: "Not now", close: !0 }
1256
- }).onPrimary(async () => {
1257
- var s, i, O;
1258
- try {
1259
- t.value = !0;
1260
- const w = ((s = o.purchaseOrder) == null ? void 0 : s._id) || ((i = o.poRequest) == null ? void 0 : i.purchaseOrderId) || "", h = (O = o.poRequest) == null ? void 0 : O.to.dbName;
1261
- await n.syncPurchaseOrder(
1262
- w,
1263
- o.scope === "approval" ? h : void 0
1264
- ), f.open({
1265
- title: "Sync with NetSuite",
1266
- message: "Requested to sync with NetSuite. Please wait a moment.",
1267
- type: "success"
1268
- }), await new Promise((F) => setTimeout(F, 5e3)), t.value = !1;
1269
- } catch {
1270
- f.open({
1271
- title: "Error",
1272
- message: "Failed to sync with NetSuite",
1273
- type: "error"
1274
- }), t.value = !1;
1275
- }
1276
- });
1277
- }
1278
- return (s, i) => {
1279
- const O = K("FmButton");
1280
- return d(), R("div", er, [
1281
- q(O, {
1282
- "prepend-icon": "sync",
1283
- variant: "secondary",
1284
- label: "Sync",
1285
- loading: t.value,
1286
- onClick: l,
1287
- "text-color": "primary",
1288
- "bg-color": "transparent",
1289
- "border-color": "primary"
1290
- }, null, 8, ["loading"])
1291
- ]);
1292
- };
1293
- }
1294
- }), rr = {
1295
- key: 0,
1296
- class: "flex flex-col gap-8"
1297
- }, sr = { class: "flex flex-col gap-4" }, or = { class: "fm-typo-en-body-lg-600" }, nr = {
1298
- key: 0,
1299
- class: "flex flex-col gap-4"
1300
- }, ar = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lr = { class: "fm-typo-en-body-lg-600" }, ir = { key: 0 }, cr = { key: 1 }, ur = {
1301
- key: 1,
1302
- class: "flex flex-col gap-4"
1303
- }, dr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, mr = { class: "fm-typo-en-body-lg-600" }, pr = { key: 0 }, fr = { key: 1 }, yr = {
1304
- key: 2,
1305
- class: "flex flex-col gap-4"
1306
- }, vr = { class: "fm-typo-en-body-lg-600" }, hr = {
1307
- key: 3,
1308
- class: "flex flex-col gap-4"
1309
- }, br = { class: "fm-typo-en-body-lg-600" }, gr = /* @__PURE__ */ Oe({
1310
- __name: "NetSuiteInfo",
1311
- props: {
1312
- transferType: {},
1313
- transferToDbName: {},
1314
- poRequest: {},
1315
- purchaseOrder: {},
1316
- isTransferBetweenOutlets: { type: Boolean },
1317
- scope: {}
1318
- },
1319
- setup(_) {
1320
- const o = _, n = Je(), f = Fe(), a = W(o.poRequest);
1321
- _t(async () => {
1322
- var i;
1323
- if (!o.poRequest && ((i = o.purchaseOrder) != null && i._id)) {
1324
- const O = await f.getLatestPurchaseOrderRequest(o.purchaseOrder._id);
1325
- a.value = O;
1326
- }
1327
- });
1328
- const t = G(
1329
- () => {
1330
- var i, O, w, h, F, b;
1331
- return n.getSubsidiaryFullName(
1332
- ((w = (O = (i = o.purchaseOrder) == null ? void 0 : i.netSuite) == null ? void 0 : O.subsidiary) == null ? void 0 : w.id) || ((b = (F = (h = o.poRequest) == null ? void 0 : h.netSuite) == null ? void 0 : F.subsidiary) == null ? void 0 : b.id)
1333
- ).fullName;
1334
- }
1335
- ), l = G(() => {
1336
- var i, O, w, h, F, b, N, u, c, y, p, S;
1337
- return (w = (O = (i = o.purchaseOrder) == null ? void 0 : i.netSuite) == null ? void 0 : O.additionalInfo) != null && w.transactionnumber ? (b = (F = (h = o.purchaseOrder) == null ? void 0 : h.netSuite) == null ? void 0 : F.additionalInfo) == null ? void 0 : b.transactionnumber : (c = (u = (N = a.value) == null ? void 0 : N.netSuite) == null ? void 0 : u.additionalInfo) != null && c.transactionnumber ? (S = (p = (y = a.value) == null ? void 0 : y.netSuite) == null ? void 0 : p.additionalInfo) == null ? void 0 : S.transactionnumber : null;
1338
- }), s = G(() => {
1339
- var i, O, w, h, F, b;
1340
- return (O = (i = o.purchaseOrder) == null ? void 0 : i.deliveryFullfillment) != null && O.length && ((h = (w = o.purchaseOrder) == null ? void 0 : w.deliveryFullfillment) == null ? void 0 : h.length) > 0 ? (b = (F = o.purchaseOrder) == null ? void 0 : F.deliveryFullfillment) == null ? void 0 : b.map((N) => {
1341
- var u;
1342
- return (u = N.netSuite) == null ? void 0 : u.refNo;
1343
- }).join(", ") : "N/A";
1344
- });
1345
- return (i, O) => {
1346
- var w, h, F, b, N, u, c, y, p, S, V, C, z, ee, Y, X;
1347
- return v(n).isEnabled ? (d(), R("div", rr, [
1348
- e("div", sr, [
1349
- O[0] || (O[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
1350
- e("div", or, $(t.value || "N/A"), 1)
1351
- ]),
1352
- !i.isTransferBetweenOutlets && i.scope === v(nt).RECEIVE_REQUEST ? (d(), R("div", nr, [
1353
- e("div", ar, " NetSuite " + $((h = (w = i.purchaseOrder) == null ? void 0 : w.netSuite) != null && h.recordType ? v(ht)((b = (F = i.purchaseOrder) == null ? void 0 : F.netSuite) == null ? void 0 : b.recordType) : i.transferType === v(Te).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1354
- e("div", lr, [
1355
- (u = (N = i.purchaseOrder) == null ? void 0 : N.netSuite) != null && u.id ? (d(), R("span", ir, $((y = (c = i.purchaseOrder) == null ? void 0 : c.netSuite) == null ? void 0 : y.refNo) + " (" + $((S = (p = i.purchaseOrder) == null ? void 0 : p.netSuite) == null ? void 0 : S.id) + ") ", 1)) : (d(), R("span", cr, "N/A"))
1356
- ])
1357
- ])) : U("", !0),
1358
- !i.isTransferBetweenOutlets && a.value || i.scope === v(nt).APPROVAL ? (d(), R("div", ur, [
1359
- e("div", dr, " (Request) NetSuite " + $(i.transferType === v(Te).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1360
- e("div", mr, [
1361
- (C = (V = a.value) == null ? void 0 : V.netSuite) != null && C.id ? (d(), R("span", pr, $((ee = (z = a.value) == null ? void 0 : z.netSuite) == null ? void 0 : ee.refNo) + " (" + $((X = (Y = a.value) == null ? void 0 : Y.netSuite) == null ? void 0 : X.id) + ") ", 1)) : (d(), R("span", fr, "N/A"))
1362
- ])
1363
- ])) : U("", !0),
1364
- l.value ? (d(), R("div", yr, [
1365
- O[1] || (O[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
1366
- e("div", vr, $(l.value), 1)
1367
- ])) : U("", !0),
1368
- v(n).isEnabled && i.transferType === v(Te).TRANSFER && !i.isTransferBetweenOutlets ? (d(), R("div", hr, [
1369
- O[2] || (O[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1370
- e("div", br, $(s.value), 1)
1371
- ])) : U("", !0)
1372
- ])) : U("", !0);
1373
- };
1374
- }
1375
- }), _r = { class: "flex flex-row-reverse" }, Sr = /* @__PURE__ */ Oe({
1376
- __name: "NetSuiteLog",
1377
- props: {
1378
- netsuiteId: {},
1379
- purchaseOrderId: {}
1380
- },
1381
- setup(_) {
1382
- const o = Ve(), n = bt();
1383
- async function f(a, t) {
1384
- const l = [];
1385
- if (a && l.push(`body.message:*${a}*`), t) {
1386
- const w = t.replace(/:/g, "\\:");
1387
- l.push(`${w}`);
1388
- }
1389
- if (l.length === 0) {
1390
- o.open({
1391
- message: "Cannot open logs without valid filters.",
1392
- type: "error"
1393
- });
1394
- return;
1395
- }
1396
- const i = `attributes.pod:netsuite* AND (${l.join(" OR ")})`, { url: O } = await n.getSyncLogs(i);
1397
- o.open(
1398
- {
1399
- message: "Opening NetSuite logs...",
1400
- type: "info"
1401
- },
1402
- 800
1403
- ), await new Promise((w) => setTimeout(w, 800)), window.open(O, "_blank");
1404
- }
1405
- return (a, t) => {
1406
- const l = K("FmButton");
1407
- return d(), R("div", _r, [
1408
- q(l, {
1409
- "prepend-icon": "history",
1410
- variant: "secondary",
1411
- label: "Logs",
1412
- onClick: t[0] || (t[0] = (s) => f(a.netsuiteId, a.purchaseOrderId)),
1413
- "text-color": "primary",
1414
- "bg-color": "transparent",
1415
- "border-color": "primary"
1416
- })
1417
- ]);
1418
- };
1419
- }
1420
- }), Or = { class: "flex flex-row-reverse" }, wr = { key: 0 }, xr = { key: 1 }, $r = { class: "mb-6" }, Rr = { class: "fm-typo-en-body-md-400" }, kr = { key: 0 }, Dr = { key: 1 }, Nr = { key: 0 }, Cr = {
1421
- key: 1,
1422
- class: "border-t pt-6"
1423
- }, Ar = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, Tr = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, Fr = { class: "w-full" }, qr = {
1424
- class: "p-3 fm-typo-en-body-sm-600",
1425
- style: { "min-width": "130px" }
1426
- }, Ir = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Pr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Vr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Er = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Lr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Br = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ur = { class: "p-3 fm-typo-en-body-sm-600" }, Mr = { key: 2 }, jr = { key: 1 }, Kr = /* @__PURE__ */ Oe({
1427
- __name: "NetSuiteLatestInfo",
1428
- props: {
1429
- netsuiteId: {},
1430
- purchaseOrderId: {}
1431
- },
1432
- setup(_) {
1433
- const o = _, n = bt(), f = W(!1), a = xe(), t = W(!0), l = W(!1), s = W(!1), i = W(!1), O = W(null), w = W([]);
1434
- async function h() {
1435
- if (!O.value) {
1436
- f.value = !0;
1437
- try {
1438
- t.value = !0;
1439
- const u = await n.getMoreInfo(
1440
- a.currentLocation.dbName,
1441
- o.purchaseOrderId
1442
- );
1443
- O.value = u, l.value = !1;
1444
- } catch {
1445
- l.value = !0;
1446
- } finally {
1447
- t.value = !1;
1448
- }
1449
- await F();
1450
- }
1451
- }
1452
- async function F() {
1453
- if (!(w.value.length > 0))
1454
- try {
1455
- s.value = !0;
1456
- const u = await n.getChangeLogs(o.netsuiteId);
1457
- w.value = u, i.value = !1;
1458
- } catch {
1459
- i.value = !0;
1460
- } finally {
1461
- s.value = !1;
1462
- }
1463
- }
1464
- function b(u) {
1465
- switch (u) {
1466
- case Ee.Create:
1467
- return "text-green-600 bg-green-100";
1468
- case Ee.Set:
1469
- return "text-blue-600 bg-blue-100";
1470
- case Ee.Change:
1471
- return "text-yellow-600 bg-yellow-100";
1472
- case Ee.Unset:
1473
- return "text-red-600 bg-red-100";
1474
- default:
1475
- return "text-gray-600 bg-gray-100";
1476
- }
1477
- }
1478
- function N(u) {
1479
- return new Date(u).toLocaleDateString("en-US", {
1480
- year: "numeric",
1481
- month: "short",
1482
- day: "numeric",
1483
- hour: "2-digit",
1484
- minute: "2-digit"
1485
- });
1486
- }
1487
- return (u, c) => {
1488
- const y = K("FmButton"), p = K("FmLabel"), S = K("FmIcon"), V = K("FmDialog");
1489
- return d(), R("div", Or, [
1490
- q(V, {
1491
- modelValue: f.value,
1492
- "onUpdate:modelValue": c[2] || (c[2] = (C) => f.value = C),
1493
- overlay: !0,
1494
- "max-width": 800
1495
- }, {
1496
- "dialog-button": Q(() => [
1497
- q(y, {
1498
- "prepend-icon": "info",
1499
- variant: "secondary",
1500
- label: "Latest Info",
1501
- onClick: c[0] || (c[0] = (C) => h()),
1502
- "text-color": "primary",
1503
- "bg-color": "transparent",
1504
- "border-color": "primary"
1505
- })
1506
- ]),
1507
- "dialog-header": Q(() => c[3] || (c[3] = [
1508
- e("div", null, "NetSuite latest info", -1)
1509
- ])),
1510
- default: Q(() => [
1511
- t.value ? (d(), R("div", wr, "Loading...")) : (d(), R("div", xr, [
1512
- l.value ? (d(), R("p", jr, "Something went wrong.")) : (d(), R(ce, { key: 0 }, [
1513
- e("div", $r, [
1514
- c[4] || (c[4] = e("h3", { class: "fm-typo-en-body-lg-600 mb-4" }, "NetSuite Order Details", -1)),
1515
- (d(!0), R(ce, null, Se(O.value, (C, z) => (d(), R("div", {
1516
- key: z,
1517
- class: "mb-2"
1518
- }, [
1519
- e("div", null, [
1520
- q(p, {
1521
- label: v(at)(z)
1522
- }, null, 8, ["label"]),
1523
- e("div", Rr, [
1524
- Array.isArray(C) ? (d(), R("span", kr, $(C.length > 0 ? C.join(", ") : "N/A"), 1)) : (d(), R("span", Dr, $(C), 1))
1525
- ])
1526
- ])
1527
- ]))), 128))
1528
- ]),
1529
- s.value ? (d(), R("div", Nr, "Change Log Loading...")) : U("", !0),
1530
- !s.value && w.value.length > 0 ? (d(), R("div", Cr, [
1531
- e("h3", Ar, [
1532
- q(S, {
1533
- name: "error",
1534
- color: "#ff9500",
1535
- size: "sm"
1536
- }),
1537
- c[5] || (c[5] = Ce(" Change Logs "))
1538
- ]),
1539
- e("div", Tr, [
1540
- e("table", Fr, [
1541
- c[6] || (c[6] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
1542
- e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
1543
- e("th", {
1544
- class: "text-left p-3 fm-typo-en-body-md-600",
1545
- style: { "min-width": "130px" }
1546
- }, " Date "),
1547
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
1548
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
1549
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
1550
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
1551
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
1552
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
1553
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
1554
- e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
1555
- ])
1556
- ], -1)),
1557
- e("tbody", null, [
1558
- (d(!0), R(ce, null, Se(w.value, (C, z) => (d(), R("tr", {
1559
- key: z,
1560
- class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
1561
- }, [
1562
- e("td", qr, $(N(C._dateiso8601)), 1),
1563
- e("td", Ir, $(C._rolename), 1),
1564
- e("td", Pr, $(C._employeename), 1),
1565
- e("td", Vr, $(C._contextname), 1),
1566
- e("td", {
1567
- class: Ue(`p-3 fm-typo-en-body-sm-600 ${b(Number(C.type) - 1)}`)
1568
- }, $(v(Ee)[Number(C.type) - 1]), 3),
1569
- e("td", Er, $(C.lineid || ""), 1),
1570
- e("td", Lr, $(C._fieldname), 1),
1571
- e("td", Br, $(C.oldvalue || ""), 1),
1572
- e("td", Ur, $(C.newvalue || ""), 1)
1573
- ]))), 128))
1574
- ])
1575
- ])
1576
- ])
1577
- ])) : (d(), R("div", Mr, c[7] || (c[7] = [
1578
- e("p", null, "No change logs available.", -1)
1579
- ])))
1580
- ], 64))
1581
- ]))
1582
- ]),
1583
- "dialog-footer": Q(() => [
1584
- q(y, {
1585
- class: "ml-auto sm:w-full xs:w-full",
1586
- label: "Close",
1587
- size: "md",
1588
- variant: "primary",
1589
- onClick: c[1] || (c[1] = (C) => f.value = !1)
1590
- })
1591
- ]),
1592
- _: 1
1593
- }, 8, ["modelValue"])
1594
- ]);
1595
- };
1596
- }
1597
- }), zr = {
1598
- key: 0,
1599
- class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
1600
- }, Hr = { class: "flex gap-8 items-center" }, Gr = { class: "ml-auto" }, Wr = { class: "flex gap-3" }, Yr = /* @__PURE__ */ Oe({
1601
- __name: "NetSuitePanel",
1602
- props: {
1603
- poRequest: {},
1604
- purchaseOrder: {},
1605
- transferType: {},
1606
- transferToDbName: {},
1607
- scope: {}
1608
- },
1609
- setup(_) {
1610
- const o = _, n = Kt();
1611
- Ke();
1612
- const f = G(() => {
1613
- var s, i, O, w, h, F, b;
1614
- const a = ((s = o.transferToDbName) == null ? void 0 : s.startsWith("restaurant")) && ((O = (i = o.purchaseOrder) == null ? void 0 : i.supplier) == null ? void 0 : O.internal) === "restaurant", t = o.transferType === Te.PURCHASE, l = o.transferType === Te.TRANSFER;
1615
- return t || l && !a || ((h = (w = o.purchaseOrder) == null ? void 0 : w.netSuite) == null ? void 0 : h.id) || ((b = (F = o.poRequest) == null ? void 0 : F.netSuite) == null ? void 0 : b.id);
1616
- });
1617
- return (a, t) => {
1618
- var s, i;
1619
- const l = K("FmMenuDivider");
1620
- return v(n).isNetSuiteEnabled && f.value ? (d(), R("div", zr, [
1621
- e("div", Hr, [
1622
- t[0] || (t[0] = e("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1623
- e("div", Gr, [
1624
- e("div", Wr, [
1625
- (i = (s = o.purchaseOrder) == null ? void 0 : s.netSuite) != null && i.id ? (d(), se(Ae, { key: 0 }, {
1626
- default: Q(() => {
1627
- var O, w, h;
1628
- return [
1629
- q(Kr, {
1630
- "netsuite-id": (w = (O = a.purchaseOrder) == null ? void 0 : O.netSuite) == null ? void 0 : w.id,
1631
- "purchase-order-id": (h = a.purchaseOrder) == null ? void 0 : h._id
1632
- }, null, 8, ["netsuite-id", "purchase-order-id"])
1633
- ];
1634
- }),
1635
- _: 1
1636
- })) : U("", !0),
1637
- q(Ae, null, {
1638
- default: Q(() => {
1639
- var O, w, h;
1640
- return [
1641
- q(Sr, {
1642
- "netsuite-id": (w = (O = a.purchaseOrder) == null ? void 0 : O.netSuite) == null ? void 0 : w.id,
1643
- "purchase-order-id": (h = a.purchaseOrder) == null ? void 0 : h._id
1644
- }, null, 8, ["netsuite-id", "purchase-order-id"])
1645
- ];
1646
- }),
1647
- _: 1
1648
- }),
1649
- q(tr, {
1650
- "po-request": a.poRequest,
1651
- "purchase-order": a.purchaseOrder,
1652
- "is-transfer-between-outlets": !f.value,
1653
- scope: a.scope
1654
- }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
1655
- ])
1656
- ])
1657
- ]),
1658
- q(l),
1659
- q(gr, {
1660
- "po-request": a.poRequest,
1661
- "purchase-order": a.purchaseOrder,
1662
- "transfer-type": a.transferType,
1663
- "transfer-to-db-name": a.transferToDbName,
1664
- "is-transfer-between-outlets": !f.value,
1665
- scope: a.scope
1666
- }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1667
- ])) : U("", !0);
1668
- };
1669
- }
1670
- }), Qr = { class: "flex flex-col gap-3" }, Xr = { class: "flex flex-col gap-4" }, Zr = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Jr = { class: "flex flex-col gap-4" }, es = { class: "flex justify-between items-center py-1 gap-4" }, ts = { class: "flex flex-col" }, rs = { class: "fm-typo-en-body-lg-600" }, ss = { class: "fm-typo-en-body-md-400" }, os = { class: "flex flex-col gap-2 items-end" }, ns = { class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, as = {
1671
- key: 0,
1672
- class: "flex items-center gap-2"
1673
- }, ls = {
1674
- key: 0,
1675
- class: "border-b border-fm-color-stroke-secondary"
1676
- }, is = { class: "flex flex-col gap-4" }, cs = { class: "flex flex-col gap-4" }, us = { class: "flex flex-col gap-4" }, ds = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, ms = {
1677
- key: 0,
1678
- class: "flex flex-col gap-4"
1679
- }, ps = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, fs = /* @__PURE__ */ Oe({
1680
- __name: "EditForm",
1681
- props: {
1682
- purchaseOrder: {},
1683
- deliveryOrder: {}
1684
- },
1685
- emits: ["submitted"],
1686
- setup(_, { emit: o }) {
1687
- Nt();
1688
- const n = Pe(), f = Ve(), a = W(!1), t = _, l = o, s = gt("deliveryOrder"), i = Fe(), O = G(
1689
- () => {
1690
- var y;
1691
- return ((y = t.purchaseOrder.deliveryFullfillment) == null ? void 0 : y.findIndex(
1692
- (p) => t.deliveryOrder.fullfillmentId && p.id === t.deliveryOrder.fullfillmentId
1693
- )) ?? -1;
1694
- }
1695
- ), w = n.enablePurchaseOrderReceiveWithCustomCost, h = n.enablePortalDeliveryOrderWrite, F = W({}), b = G(() => t.purchaseOrder.items.map((y, p) => G({
1696
- get: () => {
1697
- var V;
1698
- const S = (V = s.received[p]) == null ? void 0 : V.cost;
1699
- return S ? +ye(S) : 0;
1700
- },
1701
- set: (S) => {
1702
- s.received[p].cost = {
1703
- currency: we(),
1704
- ...Ye(S, 4)
1705
- };
1706
- }
1707
- }))), N = G(() => t.deliveryOrder.received.map((y, p) => G({
1708
- get: () => {
1709
- var V;
1710
- const S = (V = s.received[p]) == null ? void 0 : V.amount;
1711
- return S ? +ye(S) : 0;
1712
- },
1713
- set: (S) => {
1714
- s.received[p].amount = Ye(S, 2);
1715
- }
1716
- })));
1717
- function u(y) {
1718
- const p = !F.value[y];
1719
- if (F.value[y] = p, p) {
1720
- const S = t.deliveryOrder.received[y];
1721
- S.cost ? s.received[y].cost = {
1722
- currency: S.cost.currency,
1723
- amount: S.cost.amount,
1724
- precision: S.cost.precision
1725
- } : s.received[y].cost = {
1726
- currency: we(),
1727
- amount: 0,
1728
- precision: 4
1729
- };
1730
- } else
1731
- delete s.received[y].cost;
1732
- }
1733
- function c() {
1734
- i.updateDeliveryOrder({
1735
- deliveryOrder: {
1736
- ...t.deliveryOrder,
1737
- ...s
1738
- },
1739
- purchaseOrderId: t.purchaseOrder._id,
1740
- purchaseOrderRev: t.purchaseOrder._rev
1741
- }).then(() => {
1742
- f.open(
1743
- {
1744
- title: "Success",
1745
- message: `PO# ${t.purchaseOrder.seqNumber} Changes have been saved`,
1746
- type: "success"
1747
- },
1748
- 1e4
1749
- ), a.value = !1, l("submitted");
1750
- });
1751
- }
1752
- return (y, p) => {
1753
- const S = K("FmButton"), V = K("FmStepperField"), C = K("FmSwitch"), z = K("FmTextField"), ee = K("FmDialog");
1754
- return d(), se(ee, {
1755
- modelValue: a.value,
1756
- "onUpdate:modelValue": p[1] || (p[1] = (Y) => a.value = Y),
1757
- overlay: !0
1758
- }, {
1759
- "dialog-button": Q(() => [
1760
- v(h) ? (d(), se(S, {
1761
- key: 0,
1762
- variant: "plain",
1763
- label: "Edit",
1764
- size: "md",
1765
- "prepend-icon": "edit"
1766
- })) : U("", !0)
1767
- ]),
1768
- "dialog-header": Q(() => [
1769
- e("div", null, "Received on " + $(v(Me)(t.deliveryOrder.createdAt)), 1)
1770
- ]),
1771
- "dialog-footer": Q(() => [
1772
- q(S, {
1773
- class: "ml-auto",
1774
- label: "Apply changes",
1775
- size: "md",
1776
- variant: "destructive",
1777
- onClick: c
1778
- })
1779
- ]),
1780
- default: Q(() => [
1781
- e("div", null, [
1782
- e("div", Qr, [
1783
- e("div", Xr, [
1784
- p[2] || (p[2] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Adjustment date", -1)),
1785
- e("div", Zr, $(t.deliveryOrder.adjustment ? v(Me)(new Date(v(Qe)(t.deliveryOrder.adjustment))) : "-"), 1)
1786
- ]),
1787
- e("div", Jr, [
1788
- p[4] || (p[4] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received items", -1)),
1789
- (d(!0), R(ce, null, Se(t.deliveryOrder.received, (Y, X) => {
1790
- var be;
1791
- return d(), R("div", { key: X }, [
1792
- e("div", es, [
1793
- e("div", ts, [
1794
- e("span", rs, $(Y.sku.name), 1),
1795
- e("span", ss, $(Y.sku.code), 1)
1796
- ]),
1797
- e("div", os, [
1798
- q(V, {
1799
- label: "Receive Quantity",
1800
- modelValue: N.value[X].value,
1801
- "onUpdate:modelValue": (pe) => N.value[X].value = pe,
1802
- min: 0,
1803
- "append-text": ((be = Y.measurement) == null ? void 0 : be.abbrev) ?? Y.sku.unit.abbrev
1804
- }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"]),
1805
- e("div", ns, $(`${Y.cost ? `${v(Be)(Y.cost)}` : ""}`), 1),
1806
- v(w) ? (d(), R("div", as, [
1807
- q(C, {
1808
- "model-value": F.value[X],
1809
- "onUpdate:modelValue": (pe) => u(X),
1810
- size: "sm"
1811
- }, null, 8, ["model-value", "onUpdate:modelValue"]),
1812
- p[3] || (p[3] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
1813
- ])) : U("", !0),
1814
- v(w) && F.value[X] ? (d(), se(V, {
1815
- key: 1,
1816
- modelValue: b.value[X].value,
1817
- "onUpdate:modelValue": (pe) => b.value[X].value = pe,
1818
- label: "Total Cost",
1819
- step: 1e-4,
1820
- min: 0,
1821
- placeholder: "0.0000",
1822
- size: "sm",
1823
- "append-text": v(we)()
1824
- }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : U("", !0)
1825
- ])
1826
- ]),
1827
- X < t.purchaseOrder.items.length - 1 ? (d(), R("div", ls)) : U("", !0)
1828
- ]);
1829
- }), 128))
1830
- ]),
1831
- e("div", is, [
1832
- p[5] || (p[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
1833
- e("div", cs, [
1834
- q(z, {
1835
- modelValue: v(s).deliveryOrderNumber,
1836
- "onUpdate:modelValue": p[0] || (p[0] = (Y) => v(s).deliveryOrderNumber = Y),
1837
- size: "md",
1838
- placeholder: t.deliveryOrder.deliveryOrderNumber
1839
- }, null, 8, ["modelValue", "placeholder"])
1840
- ])
1841
- ]),
1842
- e("div", us, [
1843
- p[6] || (p[6] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
1844
- e("div", ds, $(t.deliveryOrder.remark || "N/A"), 1)
1845
- ]),
1846
- O.value >= 0 ? (d(), R("div", ms, [
1847
- p[7] || (p[7] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fulfilment's sequence ", -1)),
1848
- e("div", ps, $(O.value + 1), 1)
1849
- ])) : U("", !0)
1850
- ])
1851
- ])
1852
- ]),
1853
- _: 1
1854
- }, 8, ["modelValue"]);
1855
- };
1856
- }
1857
- }), ys = { class: "flex flex-col gap-3" }, vs = { class: "flex flex-col gap-4" }, hs = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, bs = {
1858
- key: 0,
1859
- class: "flex flex-col gap-4"
1860
- }, gs = { class: "flex items-center justify-between" }, _s = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ss = {
1861
- key: 0,
1862
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1863
- }, Os = { class: "flex gap-4" }, ws = { class: "flex-1" }, xs = { class: "flex-1" }, $s = {
1864
- key: 0,
1865
- class: "flex items-center text-fm-color-system-error-300"
1866
- }, Rs = { class: "fm-typo-en-body-md-400" }, ks = { class: "flex flex-col gap-4" }, Ds = { class: "flex justify-between items-center py-1 gap-4" }, Ns = { class: "flex flex-col" }, Cs = { class: "fm-typo-en-body-lg-600" }, As = { class: "fm-typo-en-body-md-400" }, Ts = { class: "flex flex-col gap-2 items-end" }, Fs = {
1867
- key: 0,
1868
- class: "flex items-center gap-2"
1869
- }, qs = {
1870
- key: 0,
1871
- class: "border-b border-fm-color-stroke-secondary"
1872
- }, Is = { class: "flex flex-col gap-4" }, Ps = { class: "flex flex-col gap-4" }, Vs = { class: "flex flex-col gap-4" }, Es = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Ls = /* @__PURE__ */ Oe({
1873
- __name: "CreateForm",
1874
- props: {
1875
- purchaseOrder: {},
1876
- receivedInfoMap: {}
1877
- },
1878
- emits: ["submitted"],
1879
- setup(_, { emit: o }) {
1880
- var B, M, ne;
1881
- const { t: n } = lt(), f = W(!1), a = Ke(), t = _, l = o, s = gt("", {
1882
- default: {
1883
- deliveryOrderNumber: "",
1884
- remark: "",
1885
- received: t.purchaseOrder.items.map((D) => ({
1886
- sku: D.sku,
1887
- amount: Ne.fromNumber(0),
1888
- measurement: D.measurement
1889
- })),
1890
- createdBy: {
1891
- id: ((B = a.sessionUser.value) == null ? void 0 : B.id) || "",
1892
- name: ((M = a.sessionUser.value) == null ? void 0 : M.displayName) || ""
1893
- },
1894
- createdAt: ""
1895
- }
1896
- }), i = Fe(), O = ze(), w = Pe(), h = ((ne = t.purchaseOrder) == null ? void 0 : ne.supplier.internal) != null, F = h && w.enablePOSTransferRequireFulfillment, b = w.enablePortalDeliveryOrderWrite && (t.purchaseOrder.status === te.Enum.RECEIVING || t.purchaseOrder.status === te.Enum.COMPLETE) && (h ? !F : !0), N = w.enablePurchaseOrderReceiveWithCustomCost, u = w.enableBackdateReceive, c = W({}), y = Ve(), p = G({
1897
- get() {
1898
- if (!s.createdAt) return "";
1899
- const D = new Date(s.createdAt), x = D.getFullYear(), A = String(D.getMonth() + 1).padStart(2, "0"), r = String(D.getDate()).padStart(2, "0");
1900
- return `${x}-${A}-${r}`;
1901
- },
1902
- set(D) {
1903
- if (D) {
1904
- const x = s.createdAt ? new Date(s.createdAt) : /* @__PURE__ */ new Date(), [A, r, m] = D.split("-");
1905
- x.setFullYear(parseInt(A)), x.setMonth(parseInt(r) - 1), x.setDate(parseInt(m)), s.createdAt = x.toISOString();
1906
- }
1907
- }
1908
- }), S = G({
1909
- get() {
1910
- if (!s.createdAt) return "";
1911
- const D = new Date(s.createdAt), x = String(D.getHours()).padStart(2, "0"), A = String(D.getMinutes()).padStart(2, "0");
1912
- return `${x}:${A}`;
1913
- },
1914
- set(D) {
1915
- if (D) {
1916
- const x = s.createdAt ? new Date(s.createdAt) : /* @__PURE__ */ new Date(), [A, r] = D.split(":");
1917
- x.setHours(parseInt(A)), x.setMinutes(parseInt(r)), s.createdAt = x.toISOString();
1918
- }
1919
- }
1920
- }), V = G(() => {
1921
- const D = Qe(t.purchaseOrder._id);
1922
- if (!D) return "";
1923
- const x = new Date(D), A = x.getFullYear(), r = String(x.getMonth() + 1).padStart(2, "0"), m = String(x.getDate()).padStart(2, "0");
1924
- return `${A}-${r}-${m}`;
1925
- }), C = G(() => {
1926
- const D = Qe(t.purchaseOrder._id);
1927
- return D ? new Date(D) : null;
1928
- }), z = G(() => {
1929
- if (!p.value || !S.value || !C.value) return null;
1930
- if (/* @__PURE__ */ new Date(`${p.value}T${S.value}:00`) < C.value) {
1931
- const x = V.value, A = C.value.getHours(), r = C.value.getMinutes(), m = A >= 12 ? "PM" : "AM", T = A % 12 || 12, k = `${String(T).padStart(2, "0")}:${String(r).padStart(2, "0")} ${m}`;
1932
- return `Delivery date & time cannot be earlier than order creation (${x} ${k})`;
1933
- }
1934
- return null;
1935
- }), ee = G(() => z.value ? !1 : s.received.some((x) => {
1936
- const A = x.amount;
1937
- return A ? +ye(A) > 0 : !1;
1938
- }));
1939
- function Y() {
1940
- s.createdAt = "";
1941
- }
1942
- const X = G(() => t.purchaseOrder.items.map((D, x) => G({
1943
- get: () => {
1944
- var r;
1945
- const A = (r = s.received[x]) == null ? void 0 : r.amount;
1946
- return A ? +ye(A) : 0;
1947
- },
1948
- set: (A) => {
1949
- s.received[x].amount = Ye(A, 2);
1950
- }
1951
- })));
1952
- function be(D) {
1953
- const x = !c.value[D];
1954
- if (c.value[D] = x, x) {
1955
- const A = t.purchaseOrder.items[D];
1956
- A.totalCost ? s.received[D].cost = {
1957
- currency: A.totalCost.currency,
1958
- amount: A.totalCost.amount,
1959
- precision: 4
1960
- // Standardize to 4 decimals
1961
- } : s.received[D].cost = {
1962
- currency: we(),
1963
- amount: 0,
1964
- precision: 4
1965
- };
1966
- } else
1967
- delete s.received[D].cost;
1968
- }
1969
- const pe = G(() => t.purchaseOrder.items.map((D, x) => G({
1970
- get: () => {
1971
- var r;
1972
- const A = (r = s.received[x]) == null ? void 0 : r.cost;
1973
- return A ? +ye(A) : 0;
1974
- },
1975
- set: (A) => {
1976
- s.received[x].cost = {
1977
- currency: we(),
1978
- ...Ye(A, 4)
1979
- };
1980
- }
1981
- })));
1982
- function $e() {
1983
- O.open({
1984
- title: "Confirm Create Delivery Order",
1985
- message: `Are you sure you want to create delivery order for PO# ${t.purchaseOrder.seqNumber}?`,
1986
- primaryActions: {
1987
- text: "Create",
1988
- close: !0,
1989
- variant: "primary"
1990
- },
1991
- secondaryActions: {
1992
- text: "Cancel",
1993
- close: !0
1994
- }
1995
- }).onPrimary(() => _e());
1996
- }
1997
- function _e() {
1998
- i.createDeliveryOrder({
1999
- deliveryOrder: s,
2000
- purchaseOrderId: t.purchaseOrder._id,
2001
- purchaseOrderRev: t.purchaseOrder._rev,
2002
- currency: we()
2003
- }).then(() => {
2004
- y.open(
2005
- {
2006
- title: "Success",
2007
- message: `New delivery order created for PO# ${t.purchaseOrder.seqNumber}`,
2008
- type: "success"
2009
- },
2010
- 1e4
2011
- ), f.value = !1, l("submitted");
2012
- });
2013
- }
2014
- return (D, x) => {
2015
- const A = K("FmButton"), r = K("FmDatePicker"), m = K("FmTimePicker"), T = K("FmIcon"), k = K("FmStepperField"), H = K("FmSwitch"), j = K("FmTextField"), re = K("FmDialog");
2016
- return d(), se(re, {
2017
- modelValue: f.value,
2018
- "onUpdate:modelValue": x[4] || (x[4] = (g) => f.value = g),
2019
- overlay: !0,
2020
- "min-width": 800
2021
- }, {
2022
- "dialog-button": Q(() => [
2023
- v(b) ? (d(), se(A, {
2024
- key: 0,
2025
- variant: "primary",
2026
- label: "Create",
2027
- size: "md",
2028
- "prepend-icon": "add",
2029
- class: "w-full"
2030
- })) : U("", !0)
2031
- ]),
2032
- "dialog-header": Q(() => [
2033
- e("div", null, "Order #" + $(t.purchaseOrder.seqNumber) + " (New Delivery Order)", 1)
2034
- ]),
2035
- "dialog-footer": Q(() => [
2036
- q(A, {
2037
- class: "ml-auto",
2038
- label: "Create",
2039
- size: "md",
2040
- variant: "destructive",
2041
- disabled: !ee.value,
2042
- onClick: $e
2043
- }, null, 8, ["disabled"])
2044
- ]),
2045
- default: Q(() => {
2046
- var g;
2047
- return [
2048
- e("div", ys, [
2049
- e("div", vs, [
2050
- x[5] || (x[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received by", -1)),
2051
- e("div", hs, $((g = v(a).sessionUser.value) == null ? void 0 : g.displayName), 1)
2052
- ]),
2053
- v(u) ? (d(), R("div", bs, [
2054
- e("div", gs, [
2055
- e("div", _s, [
2056
- x[6] || (x[6] = Ce(" Delivery Date & Time ")),
2057
- !p.value && !S.value ? (d(), R("div", Ss, " Leave blank to use current date & time ")) : U("", !0)
2058
- ]),
2059
- p.value || S.value ? (d(), se(A, {
2060
- key: 0,
2061
- variant: "tertiary",
2062
- label: "Clear",
2063
- "prepend-icon": "close",
2064
- onClick: Y
2065
- })) : U("", !0)
2066
- ]),
2067
- e("div", Os, [
2068
- e("div", ws, [
2069
- q(r, {
2070
- modelValue: p.value,
2071
- "onUpdate:modelValue": x[0] || (x[0] = (L) => p.value = L)
2072
- }, null, 8, ["modelValue"])
2073
- ]),
2074
- e("div", xs, [
2075
- q(m, {
2076
- modelValue: S.value,
2077
- "onUpdate:modelValue": x[1] || (x[1] = (L) => S.value = L)
2078
- }, null, 8, ["modelValue"])
2079
- ])
2080
- ]),
2081
- z.value ? (d(), R("div", $s, [
2082
- q(T, {
2083
- name: "error",
2084
- class: "inline-block mr-1",
2085
- size: "sm"
2086
- }),
2087
- e("div", Rs, $(z.value), 1)
2088
- ])) : U("", !0)
2089
- ])) : U("", !0),
2090
- e("div", ks, [
2091
- x[8] || (x[8] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Items going to receive ", -1)),
2092
- (d(!0), R(ce, null, Se(t.purchaseOrder.items, (L, Z) => {
2093
- var oe, E, le;
2094
- return d(), R("div", { key: Z }, [
2095
- e("div", Ds, [
2096
- e("div", Ns, [
2097
- e("span", Cs, $(L.sku.name), 1),
2098
- e("span", As, $(L.sku.code), 1)
2099
- ]),
2100
- e("div", Ts, [
2101
- q(k, {
2102
- label: "Receive Quantity",
2103
- modelValue: X.value[Z].value,
2104
- "onUpdate:modelValue": (ue) => X.value[Z].value = ue,
2105
- "helper-text": `${v(n)("inventory.transfer.receiveRequest.details.received")} ${v(Ne).toFormatString(
2106
- {
2107
- value: (oe = D.receivedInfoMap[L.sku._id]) == null ? void 0 : oe.received
2108
- }
2109
- )} ${((E = L.measurement) == null ? void 0 : E.abbrev) ?? L.sku.unit.abbrev}`,
2110
- min: 0,
2111
- "append-text": ((le = L.measurement) == null ? void 0 : le.abbrev) ?? L.sku.unit.abbrev
2112
- }, null, 8, ["modelValue", "onUpdate:modelValue", "helper-text", "append-text"]),
2113
- v(N) ? (d(), R("div", Fs, [
2114
- q(H, {
2115
- "model-value": c.value[Z],
2116
- "onUpdate:modelValue": (ue) => be(Z),
2117
- size: "sm"
2118
- }, null, 8, ["model-value", "onUpdate:modelValue"]),
2119
- x[7] || (x[7] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
2120
- ])) : U("", !0),
2121
- v(N) && c.value[Z] ? (d(), se(k, {
2122
- key: 1,
2123
- modelValue: pe.value[Z].value,
2124
- "onUpdate:modelValue": (ue) => pe.value[Z].value = ue,
2125
- label: "Total Cost",
2126
- step: 1e-4,
2127
- min: 0,
2128
- placeholder: "0.0000",
2129
- size: "sm",
2130
- "append-text": v(we)()
2131
- }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : U("", !0)
2132
- ])
2133
- ]),
2134
- Z < t.purchaseOrder.items.length - 1 ? (d(), R("div", qs)) : U("", !0)
2135
- ]);
2136
- }), 128))
2137
- ]),
2138
- e("div", Is, [
2139
- x[9] || (x[9] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
2140
- e("div", Ps, [
2141
- q(j, {
2142
- modelValue: v(s).deliveryOrderNumber,
2143
- "onUpdate:modelValue": x[2] || (x[2] = (L) => v(s).deliveryOrderNumber = L),
2144
- size: "md"
2145
- }, null, 8, ["modelValue"])
2146
- ])
2147
- ]),
2148
- e("div", Vs, [
2149
- x[10] || (x[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
2150
- e("div", Es, [
2151
- q(j, {
2152
- modelValue: v(s).remark,
2153
- "onUpdate:modelValue": x[3] || (x[3] = (L) => v(s).remark = L),
2154
- size: "md"
2155
- }, null, 8, ["modelValue"])
2156
- ])
2157
- ])
2158
- ])
2159
- ];
2160
- }),
2161
- _: 1
2162
- }, 8, ["modelValue"]);
2163
- };
2164
- }
2165
- }), Bs = /* @__PURE__ */ Oe({
2166
- __name: "SystemTrailDialog",
2167
- props: {
2168
- purchaseOrderId: {},
2169
- deliveryOrderId: {}
2170
- },
2171
- setup(_) {
2172
- const o = _, n = Fe(), f = W(!1), a = ze(), t = W([]), l = W("");
2173
- async function s() {
2174
- await n.getDeliveryOrderTrails(o.purchaseOrderId, o.deliveryOrderId).then((w) => {
2175
- t.value = w;
2176
- });
2177
- }
2178
- function i(w) {
2179
- a.open({
2180
- title: "Metadata",
2181
- contentComponent: I(
2182
- "pre",
2183
- { class: "bg-gray-100 p-4 rounded whitespace-pre-wrap" },
2184
- JSON.stringify(w, null, 2)
2185
- )
2186
- });
2187
- }
2188
- const O = [
2189
- {
2190
- accessorKey: "createdAt",
2191
- header: () => "Created At"
2192
- },
2193
- {
2194
- accessorKey: "createdBy",
2195
- header: () => "Created By",
2196
- cell: (w) => w.getValue().name
2197
- },
2198
- {
2199
- accessorKey: "message",
2200
- header: () => "Message"
2201
- },
2202
- {
2203
- accessorKey: "metadata",
2204
- header: () => "Metadata",
2205
- cell: (w) => I(je.FmButton, {
2206
- label: "View",
2207
- onClick: () => i(w.getValue())
2208
- }),
2209
- meta: {
2210
- cellSpanClass: ""
2211
- }
2212
- }
2213
- ];
2214
- return (w, h) => {
2215
- const F = K("FmButton"), b = K("FmTable"), N = K("FmDialog");
2216
- return d(), se(N, {
2217
- modelValue: f.value,
2218
- "onUpdate:modelValue": h[0] || (h[0] = (u) => f.value = u),
2219
- overlay: !0,
2220
- dismissAway: "",
2221
- "max-width": "800px"
2222
- }, {
2223
- "dialog-button": Q(() => [
2224
- q(Ae, null, {
2225
- default: Q(() => [
2226
- q(F, {
2227
- variant: "plain",
2228
- label: "Trails",
2229
- size: "md",
2230
- "prepend-icon": "overview",
2231
- onClick: s
2232
- })
2233
- ]),
2234
- _: 1
2235
- })
2236
- ]),
2237
- "dialog-header": Q(() => [
2238
- e("div", null, 'Delivery Order "' + $(w.deliveryOrderId) + '" Trails', 1)
2239
- ]),
2240
- default: Q(() => [
2241
- e("div", null, [
2242
- q(b, {
2243
- "row-data": t.value,
2244
- "column-defs": O,
2245
- "search-value": l.value,
2246
- "shrink-at": !1
2247
- }, null, 8, ["row-data", "search-value"])
2248
- ])
2249
- ]),
2250
- _: 1
2251
- }, 8, ["modelValue"]);
2252
- };
2253
- }
2254
- }), Us = { class: "flex flex-col w-full gap-3" }, Ms = { class: "flex" }, js = { class: "fm-typo-en-title-md-600 text-fm-color-typo-primary" }, Ks = { class: "flex flex-col gap-16 w-full h-full" }, zs = { class: "flex justify-between" }, Hs = { class: "fm-typo-en-body-lg-600" }, Gs = { class: "flex gap-2" }, Ws = {
2255
- key: 0,
2256
- class: "flex items-center gap-1"
2257
- }, Ys = { class: "fm-typo-en-body-md-400" }, Qs = { class: "flex flex-col gap-8" }, Xs = { class: "flex flex-col gap-4" }, Zs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Js = { class: "flex gap-1" }, eo = { class: "fm-typo-en-body-lg-600" }, to = {
2258
- key: 0,
2259
- class: "flex flex-col gap-4"
2260
- }, ro = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, so = { class: "fm-typo-en-body-lg-600" }, oo = { class: "flex flex-col gap-4" }, no = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ao = { class: "fm-typo-en-body-lg-600" }, lo = {
2261
- key: 1,
2262
- class: "flex flex-col gap-4"
2263
- }, io = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, co = { class: "fm-typo-en-body-lg-600" }, uo = {
2264
- key: 2,
2265
- class: "flex flex-col gap-4"
2266
- }, mo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, po = { class: "fm-typo-en-body-lg-600" }, fo = {
2267
- key: 3,
2268
- class: "flex flex-col gap-4"
2269
- }, yo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, vo = { class: "fm-typo-en-body-lg-600" }, ho = {
2270
- key: 4,
2271
- class: "flex flex-col gap-4"
2272
- }, bo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, go = { class: "fm-typo-en-body-lg-600" }, _o = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, So = { class: "flex flex-col gap-8" }, Oo = { class: "flex gap-8 items-center" }, wo = { class: "flex-1 fm-typo-en-body-lg-600" }, xo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, $o = { class: "flex w-full gap-4" }, Ro = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2 flex items-center gap-2" }, ko = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-2" }, Do = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, No = ["innerHTML"], Co = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Ao = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, To = {
2273
- key: 0,
2274
- class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2275
- }, Fo = { class: "py-8" }, qo = { class: "flex justify-end gap-4 items-center" }, Io = { class: "fm-typo-en-body-lg-600" }, Po = {
2276
- key: 1,
2277
- class: "flex-1 xs:w-screen xs:max-w-full"
2278
- }, Vo = {
2279
- key: 0,
2280
- class: "flex flex-col items-center gap-8 h-full"
2281
- }, Eo = ["src"], Lo = { class: "fm-typo-en-body-lg-600" }, Bo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Uo = {
2282
- key: 1,
2283
- class: "px-4 flex flex-col"
2284
- }, Mo = { class: "flex gap-12 content-stretch" }, jo = {
2285
- class: "flex flex-col w-40",
2286
- name: "circles"
2287
- }, Ko = { class: "flex-1 flex flex-col items-center" }, zo = { class: "h-40 w-40 bg-fm-color-primary rounded-full flex items-center justify-center" }, Ho = { class: "flex-1 flex flex-col items-center" }, Go = { class: "flex w-full items-center gap-4" }, Wo = {
2288
- class: "py-12 flex flex-col gap-4",
2289
- name: "received-at header"
2290
- }, Yo = { class: "fm-typo-en-body-lg-400" }, Qo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Xo = { class: "ml-auto flex gap-1" }, Zo = { class: "flex gap-12 content-stretch" }, Jo = {
2291
- class: "flex flex-col w-40",
2292
- name: "circles"
2293
- }, en = { class: "flex-1 flex flex-col items-center" }, tn = {
2294
- class: "py-12 flex flex-col gap-4 flex-1",
2295
- name: "delivery details"
2296
- }, rn = { class: "flex flex-col gap-8" }, sn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, on = { class: "flex flex-col gap-4" }, nn = { class: "flex gap-8 xs:flex-col" }, gn = /* @__PURE__ */ Oe({
2297
- __name: "TransferDetails",
2298
- props: {
2299
- poRequest: {},
2300
- purchaseOrder: {},
2301
- transferTo: {},
2302
- transferToDbName: {},
2303
- show: { type: Boolean },
2304
- canResubmit: { type: Boolean },
2305
- canApprove: { type: Boolean },
2306
- scope: {},
2307
- receivedMap: {},
2308
- shipments: {}
2309
- },
2310
- emits: ["update:show", "submitted"],
2311
- setup(_, { emit: o }) {
2312
- const n = _, f = o, a = ze(), t = Ve(), l = Pe(), s = xe(), i = Ke(), O = G(
2313
- () => {
2314
- var r, m;
2315
- return {
2316
- id: ((r = i.sessionUser.value) == null ? void 0 : r.id) ?? "",
2317
- name: ((m = i.sessionUser.value) == null ? void 0 : m.displayName) ?? ""
2318
- };
2319
- }
2320
- ), w = Jt(), { t: h } = lt(), F = G(
2321
- () => {
2322
- var r, m, T, k;
2323
- return ((m = (r = n.purchaseOrder) == null ? void 0 : r.supplier) == null ? void 0 : m.internal) === "restaurant" || ((k = (T = n.purchaseOrder) == null ? void 0 : T.supplier) == null ? void 0 : k.internal) === "warehouse" ? Te.TRANSFER : Te.PURCHASE;
2324
- }
2325
- ), b = G(() => {
2326
- var T;
2327
- const r = (T = n.shipments) == null ? void 0 : T.find((k) => {
2328
- var H;
2329
- return k.ref === ((H = n.purchaseOrder) == null ? void 0 : H._id);
2330
- });
2331
- let m = null;
2332
- if (r != null && r.milestones && r.milestones.length > 0) {
2333
- const k = r.milestones[r.milestones.length - 1];
2334
- if (k.estimatedTime) {
2335
- const H = new Date(k.estimatedTime), j = H.getDate().toString().padStart(2, "0");
2336
- m = `${H.toLocaleString("en-US", { month: "short" })} ${j}`;
2337
- }
2338
- }
2339
- return m;
2340
- }), N = W(!1), u = W(""), c = W(!0), y = Fe(), p = jt(y.getWorkflowConfig), S = Ot(), V = G(() => {
2341
- if (!n.purchaseOrder)
2342
- return [];
2343
- const r = p.result.value;
2344
- if (r.state === dt.loading)
2345
- return [];
2346
- const m = {
2347
- user: O.value,
2348
- executedAt: s.locations.computeFirst(
2349
- (k) => {
2350
- var H;
2351
- return k.dbName === ((H = s._currentLocation) == null ? void 0 : H.dbName) ? k : null;
2352
- }
2353
- ),
2354
- purchaseOrderRequest: n.poRequest,
2355
- purchaseOrder: n.purchaseOrder
2356
- };
2357
- let T = [];
2358
- try {
2359
- r.state === dt.error ? (console.error("Error fetching workflow config:", r.error), T = et.getAvailableActions({
2360
- ...m,
2361
- orderConfig: et.getDefaultConfig()
2362
- }).actions.filter(
2363
- (k) => (
2364
- // TODO: create receiveStock & processRequest dialog
2365
- // to create their payload
2366
- k !== P.enum.receiveStock && k !== P.enum.processRequest && k !== P.enum.closeRequest
2367
- )
2368
- )) : T = et.getAvailableActions({
2369
- ...m,
2370
- orderConfig: r.data
2371
- }).actions.filter(
2372
- (k) => k !== P.enum.receiveStock && k !== P.enum.processRequest && k !== P.enum.closeRequest
2373
- );
2374
- } catch (k) {
2375
- console.error("Error getting available actions:", k);
2376
- }
2377
- return n.scope === "approval" && (T = T.filter((k) => k !== P.enum.completeReceive)), T;
2378
- }), C = It(n, "show"), z = G(() => [
2379
- {
2380
- label: h("inventory.transfer.receiveRequest.details.overview"),
2381
- value: "overview"
2382
- },
2383
- {
2384
- label: h("inventory.transfer.receiveRequest.details.deliveryHistory"),
2385
- value: "deliveryHistory"
2386
- }
2387
- ]), ee = W(z.value[0]);
2388
- At(
2389
- () => n.show,
2390
- (r) => {
2391
- r && (ee.value = z.value[0]);
2392
- }
2393
- );
2394
- async function Y(r, m, T, k, H) {
2395
- return new Promise((j, re) => {
2396
- a.open({
2397
- closeButton: !1,
2398
- title: k.title,
2399
- message: k.message,
2400
- primaryActions: k.primaryActions,
2401
- secondaryActions: { text: "No", close: !1 }
2402
- }).onPrimary(async () => {
2403
- var L, Z, oe, E;
2404
- const g = [];
2405
- T === P.enum.approveRequest ? (g.push({
2406
- action: "approveRequest",
2407
- payload: null
2408
- }), m.fulfillment && g.push({
2409
- action: "processRequest",
2410
- payload: {
2411
- fulfillmentId: "",
2412
- deliveryOrderNumber: "",
2413
- deliveryRemark: null,
2414
- items: m.fulfillment.items,
2415
- createdBy: O.value
2416
- }
2417
- })) : T === P.enum.processRequest ? m.fulfillment && g.push({
2418
- action: "processRequest",
2419
- payload: {
2420
- fulfillmentId: "",
2421
- deliveryOrderNumber: "",
2422
- deliveryRemark: null,
2423
- items: m.fulfillment.items,
2424
- createdBy: O.value
2425
- }
2426
- }) : T === P.enum.rejectRequest ? g.push({
2427
- action: "rejectRequest",
2428
- payload: null
2429
- }) : T === P.enum.closeRequest && g.push({
2430
- action: "closeRequest",
2431
- payload: null
2432
- });
2433
- try {
2434
- await S({
2435
- operate: {
2436
- operation: T,
2437
- doc: r,
2438
- options: m
2439
- },
2440
- operateV2: {
2441
- _id: ((L = n.purchaseOrder) == null ? void 0 : L._id) ?? "",
2442
- _rev: ((Z = n.purchaseOrder) == null ? void 0 : Z._rev) ?? "",
2443
- action: T,
2444
- payloads: g
2445
- // add payload if action is receiveStock or processRequest
2446
- },
2447
- transferTo: (E = (oe = n.poRequest) == null ? void 0 : oe.to) == null ? void 0 : E.dbName
2448
- }).delayed(1e3), j("submitted");
2449
- } catch (le) {
2450
- re(le);
2451
- }
2452
- }).onSecondary(() => {
2453
- j("cancelled");
2454
- for (let g = 0; g < H + 2; g++)
2455
- a.close();
2456
- }).onClose(() => {
2457
- });
2458
- });
2459
- }
2460
- async function X(r) {
2461
- var H, j, re, g;
2462
- if (r === P.enum.receiveStock)
2463
- return;
2464
- const m = St[r];
2465
- if (!m) {
2466
- t.open({
2467
- title: "Something went wrong",
2468
- message: `Cannot process order: ${at(r)}`,
2469
- type: "error"
2470
- });
2471
- return;
2472
- }
2473
- const { successMessage: T, ...k } = m;
2474
- if (n.purchaseOrder) {
2475
- u.value = `${r}`, N.value = !0, c.value = !1;
2476
- const L = {};
2477
- let Z = 0;
2478
- if ((r === P.enum.confirmDraft || // auto receive for warehouse to warehouse
2479
- r === P.enum.completeReceive) && l.autoReceiveWarehouse)
2480
- L.autoReceive = !0;
2481
- else if ((r === P.enum.approveRequest || r === P.enum.processRequest) && l.acceptRequireFulfillment) {
2482
- const oe = (j = (H = n.poRequest) == null ? void 0 : H.from) == null ? void 0 : j.dbName, E = (g = (re = n.poRequest) == null ? void 0 : re.to) == null ? void 0 : g.dbName;
2483
- if (oe && E && (oe.startsWith("warehouse_") || E.startsWith("warehouse_"))) {
2484
- const le = await new Promise((ue, Re) => {
2485
- a.open({
2486
- closeButton: !1,
2487
- title: "Confirm transfer amount",
2488
- dialogComponent: Zt,
2489
- dialogComponentProps: {
2490
- purchaseOrder: n.purchaseOrder,
2491
- confirm: ue,
2492
- "onUpdate:show": (ke) => {
2493
- ke || (u.value = "", N.value = !1, c.value = !0, Z++, a.close()), Re("cancelled");
2494
- }
2495
- }
2496
- });
2497
- });
2498
- L.fulfillment = le;
2499
- }
2500
- }
2501
- try {
2502
- await Y(
2503
- n.purchaseOrder,
2504
- L,
2505
- r,
2506
- m,
2507
- Z
2508
- ) === "submitted" && (t.open({
2509
- title: "Success",
2510
- message: T,
2511
- type: "success"
2512
- }), f("update:show", !1), f("submitted"));
2513
- } catch (oe) {
2514
- t.open({
2515
- title: "Something went wrong",
2516
- message: "Please try again.",
2517
- type: "error"
2518
- }), console.error("Error when submitting PO operation", r, n.purchaseOrder, oe);
2519
- } finally {
2520
- u.value = "", N.value = !1, c.value = !0;
2521
- }
2522
- }
2523
- }
2524
- const be = G(() => {
2525
- var r, m;
2526
- return ((r = n.purchaseOrder) == null ? void 0 : r.status) === te.enum.RECEIVING || ((m = n.purchaseOrder) == null ? void 0 : m.status) === te.enum.COMPLETE;
2527
- }), pe = G(() => n.purchaseOrder ? Xe(n.purchaseOrder) : {}), $e = G(() => {
2528
- const r = n.purchaseOrder;
2529
- if (!r) return { status: "", statusClass: "" };
2530
- const { partial: m, over: T } = st(pe.value), k = ot(r.status, m, T);
2531
- let H = h(`inventory.transfer.status.${k}`), j = `${r.status}`.toLocaleLowerCase("en-us");
2532
- return k === te.enum.CLOSE && (H = `${h(`inventory.transfer.status.${te.enum.COMPLETE}`)}`), k === "PARTIAL_RECEIVED" && j === te.enum.PROCESSING.toLocaleLowerCase("en-us") && (j = te.enum.RECEIVING.toLocaleLowerCase("en-us")), {
2533
- status: H,
2534
- statusClass: `fm-status-badge fm-status-badge-${j}`
2535
- };
2536
- }), _e = G(() => {
2537
- var j, re;
2538
- const r = ((j = n.purchaseOrder) == null ? void 0 : j.deliveryOrder) ?? [], m = ((re = n.purchaseOrder) == null ? void 0 : re.deliveryFullfillment) ?? [], T = [
2539
- ...r.map((g) => ({
2540
- createdAt: g.createdAt,
2541
- type: "grn",
2542
- doc: g
2543
- })),
2544
- ...m.map((g) => ({
2545
- createdAt: g.createdAt,
2546
- type: "fulfillment",
2547
- doc: g
2548
- }))
2549
- ];
2550
- T.reverse().sort((g, L) => g.createdAt.localeCompare(L.createdAt));
2551
- function k(g) {
2552
- var oe, E, le, ue, Re, ke, J, ie, de, fe;
2553
- const L = m.findIndex((ae) => ae.id === g.fullfillmentId), Z = [
2554
- (E = (oe = m[L]) == null ? void 0 : oe.netSuite) != null && E.refNo ? {
2555
- label: "Fulfillment's ref no. (Netsuite)",
2556
- values: [(ue = (le = m[L]) == null ? void 0 : le.netSuite) == null ? void 0 : ue.refNo]
2557
- } : null,
2558
- (Re = g == null ? void 0 : g.netSuite) != null && Re.refNo ? {
2559
- label: "Netsuite ref no.",
2560
- values: [`${(ke = g == null ? void 0 : g.netSuite) == null ? void 0 : ke.refNo} (${((J = g == null ? void 0 : g.netSuite) == null ? void 0 : J.id) ?? "-"})`]
2561
- } : null,
2562
- (ie = g == null ? void 0 : g.netSuite) != null && ie.recordType ? {
2563
- label: "Netsuite Type",
2564
- values: [ht((de = g == null ? void 0 : g.netSuite) == null ? void 0 : de.recordType)]
2565
- } : null
2566
- ];
2567
- return {
2568
- header: "Received",
2569
- deliveryOrder: g,
2570
- date: Me(new Date(g.createdAt)),
2571
- info: [
2572
- {
2573
- label: "Adjustment date",
2574
- values: [
2575
- g.adjustment ? Me(new Date(Qe(g.adjustment))) : "-"
2576
- ]
2577
- },
2578
- {
2579
- label: "Received by",
2580
- values: [(fe = g.createdBy) == null ? void 0 : fe.name]
2581
- },
2582
- {
2583
- label: "Received items",
2584
- values: g.received.map((ae) => {
2585
- var ve;
2586
- return I("div", [
2587
- I(
2588
- "div",
2589
- {
2590
- class: "flex gap-4"
2591
- },
2592
- [
2593
- I(
2594
- "div",
2595
- {
2596
- class: "flex flex-col"
2597
- },
2598
- [
2599
- I(
2600
- "span",
2601
- {
2602
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
2603
- },
2604
- `${ae.sku.name}`
2605
- ),
2606
- I(
2607
- "span",
2608
- {
2609
- class: "fm-typo-en-body-md-400"
2610
- },
2611
- `${ae.sku.code} `
2612
- )
2613
- ]
2614
- ),
2615
- I(
2616
- "div",
2617
- {
2618
- class: "ml-auto flex flex-col"
2619
- },
2620
- [
2621
- I(
2622
- "div",
2623
- {
2624
- class: "ml-auto flex gap-1"
2625
- },
2626
- [
2627
- I(
2628
- "span",
2629
- {
2630
- class: "fm-typo-en-body-lg-600 self-end"
2631
- },
2632
- ye(ae.amount, !1)
2633
- ),
2634
- I(
2635
- "span",
2636
- {
2637
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2638
- },
2639
- ((ve = ae.measurement) == null ? void 0 : ve.abbrev) ?? ae.sku.unit.abbrev
2640
- )
2641
- ]
2642
- ),
2643
- I(
2644
- "div",
2645
- {
2646
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
2647
- },
2648
- `${ae.cost ? `(${Be(ae.cost)})` : ""}`
2649
- )
2650
- ]
2651
- )
2652
- ]
2653
- )
2654
- ]);
2655
- })
2656
- },
2657
- {
2658
- label: "Delivery order no.",
2659
- values: [g.deliveryOrderNumber || "N/A"]
2660
- },
2661
- {
2662
- label: "Remark",
2663
- values: [g.remark || "N/A"]
2664
- },
2665
- L > -1 ? {
2666
- label: "Fulfilment's sequence",
2667
- values: [`${L + 1}`]
2668
- } : null,
2669
- ...Z
2670
- ].filter((ae) => !!ae)
2671
- };
2672
- }
2673
- function H(g) {
2674
- var Z, oe;
2675
- const L = m.findIndex((E) => E.id === g.id);
2676
- return {
2677
- header: "Fulfillment",
2678
- date: Me(new Date(g.createdAt)),
2679
- info: [
2680
- {
2681
- label: "Sequence",
2682
- values: [String(L + 1)]
2683
- },
2684
- {
2685
- label: "Receiveable items",
2686
- values: g.items.map((E) => {
2687
- var le;
2688
- return I("div", [
2689
- I(
2690
- "div",
2691
- {
2692
- class: "flex gap-4"
2693
- },
2694
- [
2695
- I(
2696
- "div",
2697
- {
2698
- class: "flex flex-col"
2699
- },
2700
- [
2701
- I(
2702
- "span",
2703
- {
2704
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
2705
- },
2706
- `${E.sku.name}`
2707
- ),
2708
- I(
2709
- "span",
2710
- {
2711
- class: "fm-typo-en-body-md-400"
2712
- },
2713
- `${E.sku.code} `
2714
- )
2715
- ]
2716
- ),
2717
- I(
2718
- "div",
2719
- {
2720
- class: "ml-auto flex flex-col"
2721
- },
2722
- [
2723
- I(
2724
- "div",
2725
- {
2726
- class: "ml-auto flex gap-1"
2727
- },
2728
- [
2729
- I(
2730
- "span",
2731
- {
2732
- class: "fm-typo-en-body-lg-600 self-end"
2733
- },
2734
- ye(E.amount, !1)
2735
- ),
2736
- I(
2737
- "span",
2738
- {
2739
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2740
- },
2741
- ((le = E.measurement) == null ? void 0 : le.abbrev) ?? E.sku.unit.abbrev
2742
- )
2743
- ]
2744
- ),
2745
- I(
2746
- "div",
2747
- {
2748
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
2749
- },
2750
- `${E.cost ? `(${Be(E.cost)})` : ""}`
2751
- )
2752
- ]
2753
- )
2754
- ]
2755
- )
2756
- ]);
2757
- })
2758
- },
2759
- (Z = g.netSuite) != null && Z.refNo ? {
2760
- label: "Ref no. (Netsuite)",
2761
- values: [(oe = g.netSuite) == null ? void 0 : oe.refNo]
2762
- } : null
2763
- ].filter((E) => !!E)
2764
- };
2765
- }
2766
- return T.map((g) => {
2767
- switch (g.type) {
2768
- case "grn":
2769
- return k(g.doc);
2770
- case "fulfillment":
2771
- return H(g.doc);
2772
- }
2773
- });
2774
- }), B = G(() => {
2775
- var m;
2776
- const r = {
2777
- ...yt(0),
2778
- currency: we()
2779
- };
2780
- return ((m = n.purchaseOrder) == null ? void 0 : m.items.reduce((T, k) => ({
2781
- ...ft(T, k.totalCost ?? r),
2782
- currency: we()
2783
- }), r)) ?? r;
2784
- });
2785
- function M(r) {
2786
- var j;
2787
- const T = (((j = n.purchaseOrder) == null ? void 0 : j.version) ?? De.enum[1]) === De.enum[2] ? r.id : r.sku._id, k = n.receivedMap[T];
2788
- return `<span class="${ne(r)} fm-typo-en-body-lg-600">${Ne.toFormatString({ value: k.received })}</span>/${Et(r.quantity, r.sku.unit, r.measurement)}`;
2789
- }
2790
- function ne(r) {
2791
- var L;
2792
- const T = (((L = n.purchaseOrder) == null ? void 0 : L.version) ?? De.enum[1]) === De.enum[2] ? r.id : r.sku._id, k = n.receivedMap[T], { isPartialReceive: H, isNoReceive: j, isOverReceive: re, isFullReceive: g } = Ht(k);
2793
- return j ? "text-fm-color-typo-tertiary" : H ? "text-fm-color-system-warning-300" : re ? "text-fm-color-system-error-300" : g ? "text-fm-color-system-success-300" : "";
2794
- }
2795
- const D = G(() => {
2796
- var r, m, T;
2797
- return (r = n.purchaseOrder) != null && r.itemsAtSubmission ? ((m = n.purchaseOrder) == null ? void 0 : m.version) === De.enum[2] ? n.purchaseOrder.items.reduce((k, H) => {
2798
- var re, g;
2799
- const j = (g = (re = n.purchaseOrder) == null ? void 0 : re.itemsAtSubmission) == null ? void 0 : g.find(
2800
- (L) => L.id === H.id
2801
- );
2802
- return j && j.quantity !== H.quantity && k.set(H.sku.code, {
2803
- originalAmount: Number(Ne.toFormatString({ value: j.quantity })),
2804
- newAmount: Number(Ne.toFormatString({ value: H.quantity }))
2805
- }), k;
2806
- }, /* @__PURE__ */ new Map()) : (T = n.purchaseOrder) == null ? void 0 : T.items.reduce((k, H) => {
2807
- var L, Z;
2808
- const j = (Z = (L = n.purchaseOrder) == null ? void 0 : L.itemsAtSubmission) == null ? void 0 : Z.find(
2809
- (oe) => oe.sku._id === H.sku._id
2810
- ), re = j ? Number(Ne.toFormatString({ value: j.quantity })) : 0, g = Number(Ne.toFormatString({ value: H.quantity }));
2811
- return j && re !== g && k.set(H.sku.code, {
2812
- originalAmount: re,
2813
- newAmount: g
2814
- }), k;
2815
- }, /* @__PURE__ */ new Map()) : /* @__PURE__ */ new Map();
2816
- }), x = (r) => {
2817
- var T, k;
2818
- const m = D.value;
2819
- return ((T = n.purchaseOrder) == null ? void 0 : T.version) === De.enum[2] ? m.has(r.id) : m.has((k = r.sku) == null ? void 0 : k.code);
2820
- }, A = (r) => {
2821
- var T, k;
2822
- const m = D.value;
2823
- return ((T = n.purchaseOrder) == null ? void 0 : T.version) === De.enum[2] ? m.get(r.id) : m.get((k = r.sku) == null ? void 0 : k.code);
2824
- };
2825
- return (r, m) => {
2826
- const T = K("FmButton"), k = K("FmButtonGroup"), H = K("FmChip"), j = K("FmIcon"), re = K("FmMenuDivider"), g = K("FmCard"), L = K("FmTooltip"), Z = K("FmSpacer"), oe = K("FmSideSheet");
2827
- return d(), se(oe, {
2828
- modelValue: v(C),
2829
- "onUpdate:modelValue": m[8] || (m[8] = (E) => Tt(C) ? C.value = E : null),
2830
- "dismiss-away": c.value,
2831
- "max-width": 600,
2832
- "close-button": !1
2833
- }, {
2834
- "side-sheet-header": Q(() => {
2835
- var E, le;
2836
- return [
2837
- e("div", Us, [
2838
- e("div", Ms, [
2839
- e("div", js, $(v(h)("inventory.transfer.receiveRequest.details.title") + ((E = r.purchaseOrder) != null && E.seqNumber ? ` #${(le = r.purchaseOrder) == null ? void 0 : le.seqNumber}` : "")), 1),
2840
- q(T, {
2841
- class: "ml-auto -m-2",
2842
- variant: "tertiary",
2843
- "prepend-icon": "close",
2844
- onClick: m[0] || (m[0] = (ue) => f("update:show", !1))
2845
- })
2846
- ]),
2847
- q(k, {
2848
- items: z.value,
2849
- modelValue: ee.value,
2850
- "onUpdate:modelValue": m[1] || (m[1] = (ue) => ee.value = ue)
2851
- }, null, 8, ["items", "modelValue"]),
2852
- r.purchaseOrder && ee.value.value === "deliveryHistory" ? (d(), se(Ls, {
2853
- key: 0,
2854
- "purchase-order": r.purchaseOrder,
2855
- "received-info-map": pe.value,
2856
- onSubmitted: m[2] || (m[2] = () => {
2857
- f("update:show", !1), f("submitted");
2858
- })
2859
- }, null, 8, ["purchase-order", "received-info-map"])) : U("", !0)
2860
- ])
2861
- ];
2862
- }),
2863
- default: Q(() => {
2864
- var E, le, ue, Re, ke;
2865
- return [
2866
- e("div", Ks, [
2867
- ee.value.value === "overview" ? (d(), R(ce, { key: 0 }, [
2868
- e("div", null, [
2869
- q(g, {
2870
- variant: "outlined",
2871
- class: "flex flex-col gap-8 px-12 py-16"
2872
- }, {
2873
- default: Q(() => {
2874
- var J, ie, de, fe, ae, ve, He, qe, Ge;
2875
- return [
2876
- e("div", zs, [
2877
- e("div", Hs, $(v(h)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
2878
- e("div", Gs, [
2879
- q(Ae, null, {
2880
- default: Q(() => {
2881
- var it;
2882
- return [
2883
- Ce($((it = n.purchaseOrder) == null ? void 0 : it.status), 1)
2884
- ];
2885
- }),
2886
- _: 1
2887
- }),
2888
- q(H, {
2889
- label: $e.value.status,
2890
- class: Ue($e.value.statusClass),
2891
- compact: ""
2892
- }, null, 8, ["label", "class"]),
2893
- b.value ? (d(), R("div", Ws, [
2894
- q(j, {
2895
- name: "local_shipping",
2896
- color: "#666666"
2897
- }),
2898
- e("span", Ys, $(b.value), 1)
2899
- ])) : U("", !0)
2900
- ])
2901
- ]),
2902
- q(re),
2903
- e("div", Qs, [
2904
- e("div", Xs, [
2905
- e("div", Zs, [
2906
- e("div", Js, $(v(h)("inventory.transfer.receiveRequest.details.createdAt")), 1)
2907
- ]),
2908
- e("div", eo, $(v(We)(((J = r.purchaseOrder) == null ? void 0 : J._id) ?? "")), 1)
2909
- ]),
2910
- (ie = r.purchaseOrder) != null && ie.effectiveAt ? (d(), R("div", to, [
2911
- e("div", ro, $(v(h)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
2912
- e("div", so, $(v(vt)(new Date((de = r.purchaseOrder) == null ? void 0 : de.effectiveAt))), 1)
2913
- ])) : U("", !0),
2914
- e("div", oo, [
2915
- e("div", no, $(v(h)("inventory.transfer.receiveRequest.details.type.title")), 1),
2916
- e("div", ao, $(v(h)(
2917
- `inventory.transfer.receiveRequest.details.type.${F.value.toLocaleLowerCase("en-US")}`
2918
- )), 1)
2919
- ]),
2920
- (ae = (fe = r.purchaseOrder) == null ? void 0 : fe.supplier) != null && ae.name ? (d(), R("div", lo, [
2921
- e("div", io, $(v(h)("inventory.transfer.receiveRequest.details.from")), 1),
2922
- e("div", co, $((He = (ve = r.purchaseOrder) == null ? void 0 : ve.supplier) == null ? void 0 : He.name), 1)
2923
- ])) : U("", !0),
2924
- r.transferTo ? (d(), R("div", uo, [
2925
- e("div", mo, $(v(h)("inventory.transfer.receiveRequest.details.to")), 1),
2926
- e("div", po, $(r.transferTo), 1)
2927
- ])) : U("", !0),
2928
- (qe = r.purchaseOrder) != null && qe.ref ? (d(), R("div", fo, [
2929
- e("div", yo, $(v(h)("inventory.transfer.receiveRequest.details.reference")), 1),
2930
- e("div", vo, $(r.purchaseOrder.ref), 1)
2931
- ])) : U("", !0),
2932
- (Ge = r.purchaseOrder) != null && Ge.remark ? (d(), R("div", ho, [
2933
- e("div", bo, $(v(h)("inventory.transfer.receiveRequest.details.remark")), 1),
2934
- e("div", go, $(r.purchaseOrder.remark), 1)
2935
- ])) : U("", !0)
2936
- ])
2937
- ];
2938
- }),
2939
- _: 1
2940
- })
2941
- ]),
2942
- q(Yr, {
2943
- "po-request": r.poRequest,
2944
- purchaseOrder: r.purchaseOrder,
2945
- transferType: F.value,
2946
- transferToDbName: r.transferToDbName,
2947
- scope: r.scope
2948
- }, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
2949
- e("div", _o, [
2950
- e("div", So, [
2951
- e("div", Oo, [
2952
- e("span", wo, [
2953
- Ce($(be.value ? v(h)("inventory.transfer.receiveRequest.details.receivedItems") : v(h)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
2954
- (le = (E = r.purchaseOrder) == null ? void 0 : E.netSuite) != null && le.missingItems && ((Re = (ue = r.purchaseOrder) == null ? void 0 : ue.netSuite) == null ? void 0 : Re.missingItems.length) > 0 ? (d(), se(L, {
2955
- key: 0,
2956
- variant: "rich",
2957
- placement: "top",
2958
- "z-index": 51
2959
- }, {
2960
- content: Q(() => {
2961
- var J, ie;
2962
- return [
2963
- e("div", xo, [
2964
- (d(!0), R(ce, null, Se((ie = (J = r.purchaseOrder) == null ? void 0 : J.netSuite) == null ? void 0 : ie.missingItems, (de, fe) => (d(), R("div", {
2965
- class: "flex justify-center align-middle",
2966
- key: fe
2967
- }, [
2968
- q(j, {
2969
- name: "arrow_right",
2970
- size: "sm"
2971
- }),
2972
- Ce(" " + $(`(${de.netSuiteId}) ${de.name}: ${de.reason}`), 1)
2973
- ]))), 128))
2974
- ])
2975
- ];
2976
- }),
2977
- default: Q(() => [
2978
- q(j, {
2979
- name: "error",
2980
- color: "#ff2c2c",
2981
- size: "sm"
2982
- })
2983
- ]),
2984
- _: 1
2985
- })) : U("", !0)
2986
- ])
2987
- ]),
2988
- q(re),
2989
- (d(!0), R(ce, null, Se(((ke = r.purchaseOrder) == null ? void 0 : ke.items) ?? [], (J, ie) => {
2990
- var de;
2991
- return d(), R("div", {
2992
- key: ie,
2993
- class: "flex flex-col"
2994
- }, [
2995
- e("div", $o, [
2996
- e("div", Ro, [
2997
- Ce($(J.name) + " ", 1),
2998
- x(J) ? (d(), se(L, {
2999
- key: 0,
3000
- variant: "rich",
3001
- placement: "top",
3002
- "z-index": 51
3003
- }, {
3004
- content: Q(() => {
3005
- var fe, ae;
3006
- return [
3007
- e("div", ko, [
3008
- m[9] || (m[9] = e("div", { class: "font-semibold" }, "Submission changes", -1)),
3009
- e("div", null, "Original Amount: " + $((fe = A(J)) == null ? void 0 : fe.originalAmount), 1),
3010
- e("div", null, " New Amount: " + $((ae = A(J)) == null ? void 0 : ae.newAmount), 1)
3011
- ])
3012
- ];
3013
- }),
3014
- default: Q(() => [
3015
- q(j, {
3016
- name: "error",
3017
- color: "#ff9500",
3018
- size: "sm"
3019
- })
3020
- ]),
3021
- _: 2
3022
- }, 1024)) : U("", !0)
3023
- ]),
3024
- e("div", Do, [
3025
- e("span", {
3026
- innerHTML: M(J)
3027
- }, null, 8, No)
3028
- ])
3029
- ]),
3030
- e("div", Co, [
3031
- e("div", Ao, $(J.code), 1),
3032
- (de = J.totalCost) != null && de.amount && v(l).enableTotalCost ? (d(), R("div", To, " (" + $(v(Be)(J.totalCost)) + ") ", 1)) : U("", !0)
3033
- ])
3034
- ]);
3035
- }), 128)),
3036
- +v(ye)(B.value) ? (d(), R(ce, { key: 0 }, [
3037
- e("div", Fo, [
3038
- q(re)
3039
- ]),
3040
- e("div", qo, [
3041
- m[10] || (m[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
3042
- e("div", Io, $(v(Be)(B.value)), 1)
3043
- ])
3044
- ], 64)) : U("", !0)
3045
- ])
3046
- ])
3047
- ], 64)) : ee.value.value === "deliveryHistory" ? (d(), R("div", Po, [
3048
- _e.value.length ? (d(), R("div", Uo, [
3049
- (d(!0), R(ce, null, Se(_e.value, (J, ie) => {
3050
- var de, fe, ae;
3051
- return d(), R(ce, { key: ie }, [
3052
- e("div", Mo, [
3053
- e("div", jo, [
3054
- e("div", Ko, [
3055
- e("div", {
3056
- class: Ue([
3057
- {
3058
- "bg-fm-color-primary": ie !== 0,
3059
- "bg-white": ie === 0
3060
- },
3061
- "w-[2px] h-full"
3062
- ])
3063
- }, null, 2)
3064
- ]),
3065
- e("div", zo, [
3066
- J.header === "Received" ? (d(), se(j, {
3067
- key: 0,
3068
- name: "local_shipping",
3069
- outline: "",
3070
- color: "#ffffff"
3071
- })) : U("", !0)
3072
- ]),
3073
- e("div", Ho, [
3074
- e("div", {
3075
- class: Ue([
3076
- {
3077
- "bg-fm-color-primary": ie < _e.value.length - 1,
3078
- "bg-white": ie >= _e.value.length - 1
3079
- },
3080
- "w-[2px] h-full"
3081
- ])
3082
- }, null, 2)
3083
- ])
3084
- ]),
3085
- e("div", Go, [
3086
- e("div", Wo, [
3087
- e("div", Yo, $(J.header), 1),
3088
- e("div", Qo, $(J.date), 1)
3089
- ]),
3090
- e("div", Xo, [
3091
- J.header === "Received" && J.deliveryOrder && r.purchaseOrder ? (d(), se(fs, {
3092
- key: 0,
3093
- deliveryOrder: J.deliveryOrder,
3094
- purchaseOrder: r.purchaseOrder,
3095
- onSubmitted: m[3] || (m[3] = () => {
3096
- f("update:show", !1), f("submitted");
3097
- })
3098
- }, null, 8, ["deliveryOrder", "purchaseOrder"])) : U("", !0),
3099
- r.purchaseOrder && ((de = J.deliveryOrder) != null && de.id) ? (d(), se(Bs, {
3100
- key: 1,
3101
- "purchase-order-id": (fe = r.purchaseOrder) == null ? void 0 : fe._id,
3102
- "delivery-order-id": (ae = J.deliveryOrder) == null ? void 0 : ae.id
3103
- }, null, 8, ["purchase-order-id", "delivery-order-id"])) : U("", !0)
3104
- ])
3105
- ])
3106
- ]),
3107
- e("div", Zo, [
3108
- e("div", Jo, [
3109
- e("div", en, [
3110
- e("div", {
3111
- class: Ue([
3112
- {
3113
- "bg-fm-color-primary": ie < _e.value.length - 1,
3114
- "bg-white": ie >= _e.value.length - 1
3115
- },
3116
- "w-[2px] h-full"
3117
- ])
3118
- }, null, 2)
3119
- ])
3120
- ]),
3121
- e("div", tn, [
3122
- q(g, {
3123
- variant: "outlined",
3124
- class: "py-12 px-16"
3125
- }, {
3126
- default: Q(() => [
3127
- e("div", rn, [
3128
- (d(!0), R(ce, null, Se(J.info, (ve, He) => (d(), R("div", {
3129
- key: He,
3130
- class: "flex flex-col gap-4"
3131
- }, [
3132
- e("div", sn, $(ve == null ? void 0 : ve.label), 1),
3133
- e("div", on, [
3134
- (d(!0), R(ce, null, Se(ve == null ? void 0 : ve.values, (qe, Ge) => (d(), R("div", {
3135
- key: Ge,
3136
- class: "fm-typo-en-body-lg-600"
3137
- }, [
3138
- typeof qe == "string" ? (d(), R(ce, { key: 0 }, [
3139
- Ce($(qe), 1)
3140
- ], 64)) : (d(), se(Ft(qe), { key: 1 }))
3141
- ]))), 128))
3142
- ])
3143
- ]))), 128))
3144
- ])
3145
- ]),
3146
- _: 2
3147
- }, 1024)
3148
- ])
3149
- ])
3150
- ], 64);
3151
- }), 128))
3152
- ])) : (d(), R("div", Vo, [
3153
- q(Z),
3154
- e("div", null, [
3155
- e("img", {
3156
- src: v(Lt),
3157
- alt: "List is empty"
3158
- }, null, 8, Eo)
3159
- ]),
3160
- e("div", Lo, $(v(h)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
3161
- e("div", Bo, $(v(h)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
3162
- q(Z),
3163
- q(Z)
3164
- ]))
3165
- ])) : U("", !0)
3166
- ])
3167
- ];
3168
- }),
3169
- "side-sheet-footer": Q(() => [
3170
- e("div", nn, [
3171
- (d(!0), R(ce, null, Se(V.value, (E) => (d(), R(ce, null, [
3172
- v(rt)[E].available != !1 ? (d(), se(T, {
3173
- key: E,
3174
- label: v(h)(v(rt)[E].translationKey),
3175
- onClick: (le) => X(E),
3176
- loading: u.value === E,
3177
- disabled: u.value !== E && N.value,
3178
- variant: v(rt)[E].buttonVariant
3179
- }, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : U("", !0)
3180
- ], 64))), 256)),
3181
- v(w).ableToMarkReceived(r.purchaseOrder) && !V.value.includes("completeReceive") ? (d(), se(T, {
3182
- key: 0,
3183
- label: v(h)("inventory.transfer.receiveRequest.actions.completeReceive"),
3184
- onClick: m[4] || (m[4] = (E) => X("completeReceive")),
3185
- loading: u.value === "completeReceive",
3186
- disabled: u.value !== "completeReceive" && N.value
3187
- }, null, 8, ["label", "loading", "disabled"])) : U("", !0),
3188
- v(w).ableToMarkApproved(r.purchaseOrder) && r.canApprove && !V.value.includes("approveRequest") ? (d(), se(T, {
3189
- key: 1,
3190
- label: v(h)("inventory.transfer.approval.actions.approveRequest"),
3191
- onClick: m[5] || (m[5] = (E) => X("approveRequest")),
3192
- loading: u.value === "approveRequest",
3193
- disabled: u.value !== "approveRequest" && N.value
3194
- }, null, 8, ["label", "loading", "disabled"])) : U("", !0),
3195
- v(w).ableToCreateFulfillment(r.purchaseOrder, r.poRequest) && n.scope === "approval" ? (d(), se(T, {
3196
- key: 2,
3197
- label: v(h)("inventory.transfer.receiveRequest.actions.processRequest"),
3198
- onClick: m[6] || (m[6] = (E) => X("processRequest")),
3199
- loading: u.value === "processRequest",
3200
- disabled: u.value !== "processRequest" && N.value
3201
- }, null, 8, ["label", "loading", "disabled"])) : U("", !0),
3202
- q(T, {
3203
- label: v(h)("common.close"),
3204
- variant: "tertiary",
3205
- onClick: m[7] || (m[7] = (E) => f("update:show", !1))
3206
- }, null, 8, ["label"])
3207
- ])
3208
- ]),
3209
- _: 1
3210
- }, 8, ["modelValue", "dismiss-away"]);
3211
- };
3212
- }
3213
- });
3214
- export {
3215
- nt as P,
3216
- gn as _,
3217
- hn as a,
3218
- bn as b,
3219
- Gt as g,
3220
- Fe as u
3221
- };