@feedmepos/mf-inventory-portal 1.0.5-dev → 1.0.6

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 (46) hide show
  1. package/dist/{App-HiQFjdJ-.js → App-CoFxgBe6.js} +1 -1
  2. package/dist/{ApprovalView-CynLDEVc.js → ApprovalView-Cc6FbL1t.js} +2 -2
  3. package/dist/{BindingsDialog-Bnp9wpfo.js → BindingsDialog-DwX1uG0q.js} +2 -2
  4. package/dist/{BindingsPicker-d0mYW8dg.js → BindingsPicker-Ddyllxs3.js} +1 -1
  5. package/dist/{BindingsTable-DTqY2ksc.js → BindingsTable-DJeGXgwh.js} +1 -1
  6. package/dist/{ClosingDraftView-CWioP0pS.js → ClosingDraftView-DUHqCjNZ.js} +2 -2
  7. package/dist/{ClosingTemplateView-BQrAl5fV.js → ClosingTemplateView-DpEXlCuQ.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-BDF8lY7Y.js → DeliveryOrderPrintPreview-BgsMqWD5.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BN_xp-N6.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Cuh74MI8.js} +3 -3
  10. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-BN3RjN2t.js +338 -0
  11. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-XhFhN0MD.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-IoATloO4.js} +1 -1
  12. package/dist/{IngredientGroupView-CyjtkSE4.js → IngredientGroupView-mR_Fh2We.js} +1 -1
  13. package/dist/{IngredientsView-DcTIYA5r.js → IngredientsView-DMa2lYUP.js} +3 -3
  14. package/dist/{IntegrationView-Jeh9aw2u.js → IntegrationView-D5uhvmsc.js} +3 -3
  15. package/dist/{InventoryBindingForm-dlNXDnnO.js → InventoryBindingForm-Bkjr3X5G.js} +1 -1
  16. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BeUd7kC6.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-iZUW6DvO.js} +3 -3
  17. package/dist/{InventoryBindingSummary-BPvSql2a.js → InventoryBindingSummary-DfzOlfQC.js} +1 -1
  18. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DFofvMkD.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DnqRUERc.js} +1 -1
  19. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CaBtx2ad.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BRKa7jgK.js} +1 -1
  20. package/dist/{PublishView-4Mh9EtfQ.js → PublishView-JP1UeJ0A.js} +2 -2
  21. package/dist/{PurchaseOrderPrintPreview-DFNVxR7Q.js → PurchaseOrderPrintPreview-CiUpBdP6.js} +1 -1
  22. package/dist/{ReceiveRequestView-DGfyfwbS.js → ReceiveRequestView-BMH8q9q8.js} +507 -498
  23. package/dist/{RecipeView-D-M9rodW.js → RecipeView-ChONTHZN.js} +3 -3
  24. package/dist/{StockView-Dmy2nTn9.js → StockView-DnEsw6hb.js} +6 -6
  25. package/dist/{SupplierView-dwayUuSs.js → SupplierView-CsGiwMgL.js} +3 -3
  26. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-dC5nYDyp.js +1746 -0
  27. package/dist/{TransferTemplateView-zl-E8FWk.js → TransferTemplateView-CUzzrvUS.js} +6 -6
  28. package/dist/{UnitView-DlgkMRfA.js → UnitView-Yl8tKI01.js} +3 -3
  29. package/dist/{WarehouseView-Cwm2w_Li.js → WarehouseView-CQrBCdvI.js} +1 -1
  30. package/dist/{app-7jcARtWe.js → app-CvwyJqea.js} +5743 -5602
  31. package/dist/app.js +1 -1
  32. package/dist/{decimal-Df15BvRp.js → decimal-CVFTM-79.js} +1 -1
  33. package/dist/{format-unit-display-CEjqAYMQ.js → format-unit-display-BwsXChSY.js} +2 -2
  34. package/dist/{index-D76OeHWL.js → index-Crb4nQMG.js} +1 -1
  35. package/dist/{index-D1mi5w82.js → index-DzeAemtp.js} +1 -1
  36. package/dist/{stock-C2o7RYsv.js → stock-BCn9m46h.js} +1 -1
  37. package/dist/{supplier-DX4BGHJ3.js → supplier-BNxILiCw.js} +1 -1
  38. package/dist/tsconfig.app.tsbuildinfo +1 -1
  39. package/dist/{use-ingredient-select-dialog-BQq-zLGA.js → use-ingredient-select-dialog-MoaS1fog.js} +1 -1
  40. package/dist/{use-inventory-binding-dialog-NM2fZkBw.js → use-inventory-binding-dialog-9QPChBOp.js} +1 -1
  41. package/dist/views/receive-request/components/transfer-details/FulfillmentForm.vue.d.ts +5 -1
  42. package/dist/views/receive-request/components/transfer-details/usePurchaseOrderFn.d.ts +4 -0
  43. package/dist/{vue-i18n-BRmzzMWS.js → vue-i18n-D47nKBtV.js} +2 -2
  44. package/package.json +1 -1
  45. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-BWUrzPyM.js +0 -328
  46. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DtrWgdXq.js +0 -1723
@@ -0,0 +1,1746 @@
1
+ import { Y as We, u as ve, aI as T, a3 as Je, a5 as Xe, a6 as Ze, aJ as et, e as Fe, f as Me, ar as M, W as je, c as Ve, aK as tt, $ as ke, L as _e, j as ie, aL as Ke, aa as Se, h as Ue, i as H, D as Z, b as ze, a4 as st, ao as Be, a2 as be, aM as rt, af as xe, as as at } from "./app-CvwyJqea.js";
2
+ import { ref as z, computed as J, h as D, defineComponent as we, onMounted as Ge, unref as l, openBlock as b, createElementBlock as k, createElementVNode as e, toDisplayString as _, createCommentVNode as I, resolveComponent as W, createVNode as B, reactive as nt, createBlock as X, withCtx as ce, watch as ot, isRef as lt, Fragment as se, normalizeClass as ge, createTextVNode as Re, renderList as pe, resolveDynamicComponent as it } from "vue";
3
+ import { F as ct } from "./decimal-CVFTM-79.js";
4
+ import { b as ut, u as dt, f as He, P as le } from "./format-unit-display-BwsXChSY.js";
5
+ import { useCoreStore as mt, useI18n as Qe } from "@feedmepos/mf-common";
6
+ import { E as ft } from "./empty-placeholder-wf6-BWE8.js";
7
+ import { useDialog as Ae, useSnackbar as Ne, components as Le, useProxiedModel as pt } from "@feedmepos/ui-library";
8
+ import { u as yt } from "./index-DzeAemtp.js";
9
+ import { _ as vt, F as ht, a as bt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-BN3RjN2t.js";
10
+ const Te = We((n, y) => {
11
+ const i = ve();
12
+ return {
13
+ async readRequests(d) {
14
+ const g = d ?? i.currentLocationDBName, m = `${n.inventoryBackendUrl}/${g}/purchase-request`;
15
+ return await y.get(m);
16
+ },
17
+ async getPurchaseOrders({
18
+ start: d,
19
+ end: g
20
+ }) {
21
+ const m = i.currentLocationDBName, q = `${n.inventoryBackendUrl}/${m}/purchase-order`;
22
+ return await y.get(`${q}?start=${d}&end=${g}`);
23
+ },
24
+ async getLatestPurchaseOrderRequest(d) {
25
+ const g = i.currentLocationDBName, m = `${n.inventoryBackendUrl}/${g}/purchase-request/find-by-purchase-order-id`;
26
+ return await y.get(`${m}/${d}`);
27
+ },
28
+ async getPurchaseOrderById(d) {
29
+ const g = i.currentLocationDBName, m = `${n.inventoryBackendUrl}/${g}/purchase-order`;
30
+ return await y.get(`${m}/${d}`);
31
+ },
32
+ async processPurchaseOrder(d, g) {
33
+ const m = i.currentLocationDBName, q = g || m, S = `${n.inventoryBackendUrl}/${q}/purchase-order/run-operation`;
34
+ return await y.put(S, d);
35
+ },
36
+ async createPurchaseOrder(d) {
37
+ const g = i.currentLocationDBName, m = `${n.inventoryBackendUrl}/${g}/purchase-order`;
38
+ return await y.post(m, d);
39
+ },
40
+ async updatePurchaseOrder(d) {
41
+ const g = i.currentLocationDBName, m = `${n.inventoryBackendUrl}/${g}/purchase-order`;
42
+ return await y.put(m, d);
43
+ },
44
+ async importFromXilnex(d) {
45
+ const g = i.currentLocationDBName, m = `${n.inventoryBackendUrl}/${g}/purchase-order/import-from-xilnex`;
46
+ return await y.post(m, d);
47
+ }
48
+ };
49
+ }), Ye = {
50
+ [T.enum.confirmDraft]: {
51
+ primaryActions: {
52
+ text: "Confirm draft",
53
+ close: !0
54
+ },
55
+ title: "Confirm draft?",
56
+ message: "Purchase order cannot be changed after confirm draft.",
57
+ successMessage: "Purchase order draft has been confirmed"
58
+ },
59
+ [T.enum.cancelDraft]: {
60
+ primaryActions: {
61
+ text: "Cancel draft",
62
+ close: !0,
63
+ variant: "destructive"
64
+ },
65
+ title: "Cancel draft?",
66
+ message: "Purchase order cannot be changed after cancelled draft.",
67
+ successMessage: "Purchase order draft has been cancelled"
68
+ },
69
+ [T.enum.submitRequest]: {
70
+ primaryActions: {
71
+ text: "Submit request",
72
+ close: !0
73
+ },
74
+ title: "Confirm draft?",
75
+ message: "Purchase order cannot be changed after confirm draft.",
76
+ successMessage: "Purchase order draft has been submitted"
77
+ },
78
+ [T.enum.completeReceive]: {
79
+ primaryActions: {
80
+ text: "Mark received",
81
+ close: !0
82
+ },
83
+ title: "Mark as received",
84
+ message: "Purchase order cannot be changed after it has complete receiving.",
85
+ successMessage: "Purchase order has been marked as received"
86
+ },
87
+ [T.enum.approveRequest]: {
88
+ primaryActions: {
89
+ text: "Accept request",
90
+ close: !0
91
+ },
92
+ title: "Accept request?",
93
+ message: "Transfer out request will be accepted.",
94
+ successMessage: "Transfer out request has been approved"
95
+ },
96
+ [T.enum.rejectRequest]: {
97
+ primaryActions: {
98
+ text: "Reject request",
99
+ close: !0,
100
+ variant: "destructive"
101
+ },
102
+ title: "Reject request?",
103
+ message: "Purchase order will be rejected.",
104
+ successMessage: "Purchase order has been rejected"
105
+ }
106
+ };
107
+ var De = /* @__PURE__ */ ((n) => (n.RECEIVE_REQUEST = "receive/request", n.APPROVAL = "approval", n))(De || {});
108
+ const ye = z(), Oe = z();
109
+ function ur(n, y) {
110
+ const i = Ae(), d = ve(), g = Ve(), m = ut(), q = dt(), S = z(!1), o = Ne(), t = Te(), u = z(new Array()), v = z(
111
+ y != null && y.startDate && (y != null && y.endDate) ? y : Je()
112
+ ), r = J(() => {
113
+ const h = new Date(v.value.startDate), f = new Date(v.value.endDate);
114
+ return {
115
+ start: Xe(h).toISOString(),
116
+ end: Ze(f).toISOString()
117
+ };
118
+ }), c = z(new Array()), x = et(), O = z(null);
119
+ async function C(h) {
120
+ function f(a) {
121
+ const w = {
122
+ mode: Fe.CREATE,
123
+ modelValue: h || void 0,
124
+ show: !0,
125
+ "onUpdate:show"(R) {
126
+ ye.value.show = R;
127
+ },
128
+ templateId: a,
129
+ lastClosingDate: O.value
130
+ };
131
+ ye.value = w;
132
+ }
133
+ let N;
134
+ g.mustUsePoTemplate && !(h != null && h.template) ? i.open({
135
+ title: "Create transfer",
136
+ message: "",
137
+ primaryActions: {
138
+ text: "Select a template",
139
+ close: !0
140
+ },
141
+ secondaryActions: {
142
+ text: "Outlet to Outlet",
143
+ variant: "secondary",
144
+ close: !0
145
+ }
146
+ }).onPrimary(async () => {
147
+ N = await m.getTemplateId(), N && f(N);
148
+ }).onSecondary(() => {
149
+ f(void 0);
150
+ }) : f(N);
151
+ }
152
+ function F(h) {
153
+ const f = {
154
+ mode: Fe.UPDATE,
155
+ modelValue: Me(h),
156
+ show: !0,
157
+ "onUpdate:show"(N) {
158
+ ye.value.show = N;
159
+ },
160
+ lastClosingDate: O.value
161
+ };
162
+ ye.value = f;
163
+ }
164
+ async function G() {
165
+ u.value = [], S.value = !0;
166
+ try {
167
+ u.value = await t.getPurchaseOrders(r.value).then((N) => N.sort((a, w) => w._id.localeCompare(a._id)));
168
+ const h = await x.readCurrentLocationLastClosing(!0), f = h == null ? void 0 : h._id;
169
+ f && (O.value = tt(f)), g.mustUsePoTemplate && await q.fetchTemplates();
170
+ } catch {
171
+ o.open({
172
+ title: "Something went wrong",
173
+ message: "Error at fetching purchase orders",
174
+ type: "error"
175
+ });
176
+ } finally {
177
+ S.value = !1;
178
+ }
179
+ }
180
+ async function j() {
181
+ c.value = [], S.value = !0;
182
+ try {
183
+ c.value = await t.readRequests().then((h) => h.reverse());
184
+ } catch {
185
+ o.open({
186
+ title: "Something went wrong",
187
+ message: "Error at fetching purchase requests",
188
+ type: "error"
189
+ });
190
+ } finally {
191
+ S.value = !1;
192
+ }
193
+ }
194
+ function te() {
195
+ switch (n) {
196
+ case "receive/request":
197
+ return G();
198
+ case "approval":
199
+ return j();
200
+ }
201
+ }
202
+ function ue(h, f) {
203
+ v.value = {
204
+ startDate: h,
205
+ endDate: f
206
+ }, te();
207
+ }
208
+ d.watchLocation(async (h) => {
209
+ if (!h) {
210
+ u.value = [];
211
+ return;
212
+ }
213
+ await te();
214
+ });
215
+ const V = z(), re = z(Math.random().toString());
216
+ async function s(h, f) {
217
+ var R, K;
218
+ const N = Math.random().toString();
219
+ re.value = N;
220
+ const a = n === "receive/request" ? d.currentLocation : f == null ? void 0 : f.to, w = {
221
+ poRequest: f,
222
+ purchaseOrder: h,
223
+ transferTo: a == null ? void 0 : a.name,
224
+ transferToDbName: a == null ? void 0 : a.dbName,
225
+ show: !0,
226
+ canResubmit: !1,
227
+ canApprove: n === "approval",
228
+ "onUpdate:show"(E) {
229
+ V.value.show = E;
230
+ },
231
+ scope: n
232
+ };
233
+ if (V.value = w, !(f || h.status !== M.enum.REQUESTING)) {
234
+ try {
235
+ f = (await t.readRequests(
236
+ `${h.supplier.internal}_${h.supplier._id}`
237
+ )).find((Q) => Q.purchaseOrderId === h._id);
238
+ } catch {
239
+ console.error("Error at fetching po request to check");
240
+ }
241
+ N === re.value && f && (V.value.canResubmit = !f, V.value.transferTo = (R = f == null ? void 0 : f.to) == null ? void 0 : R.name, V.value.transferToDbName = (K = f == null ? void 0 : f.to) == null ? void 0 : K.dbName);
242
+ }
243
+ }
244
+ async function p(h, f, N, a) {
245
+ S.value = !0;
246
+ try {
247
+ await t.processPurchaseOrder(
248
+ {
249
+ operation: f,
250
+ doc: h,
251
+ options: (
252
+ // auto receive for supplier to warehouse
253
+ (f === T.enum.confirmDraft || // auto receive for warehouse to warehouse
254
+ f === T.enum.completeReceive) && g.autoReceiveWarehouse ? {
255
+ autoReceive: !0
256
+ } : void 0
257
+ )
258
+ },
259
+ a
260
+ ), await new Promise((K) => setTimeout(K, 1e3));
261
+ const R = ve().currentLocationDBName.startsWith("restaurant_");
262
+ f === T.enum.confirmDraft && h.effectiveAt && R ? o.open({
263
+ title: "Success",
264
+ message: `${N}. The backdate will be reflected once your POS has received this change.`,
265
+ type: "success"
266
+ }) : o.open({
267
+ title: "Success",
268
+ message: N,
269
+ type: "success"
270
+ });
271
+ } catch (w) {
272
+ o.open({
273
+ title: "Something went wrong",
274
+ message: "Please try again.",
275
+ type: "error"
276
+ }), console.error("Error when submitting PO operation", f, h, w);
277
+ } finally {
278
+ S.value = !1, te();
279
+ }
280
+ }
281
+ async function L(h, f, N) {
282
+ const a = Ye[f];
283
+ if (!a) {
284
+ o.open({
285
+ title: "Something went wrong",
286
+ message: `Cannot process order: ${je(f)}`,
287
+ type: "error"
288
+ });
289
+ return;
290
+ }
291
+ const { successMessage: w, ...R } = a;
292
+ i.open({
293
+ title: R.title,
294
+ message: R.message,
295
+ primaryActions: R.primaryActions
296
+ }).onPrimary(() => {
297
+ p(h, f, w, N);
298
+ });
299
+ }
300
+ async function U() {
301
+ i.open({
302
+ title: "Upload Transfer",
303
+ primaryActions: {
304
+ text: "Xilnex transfer note",
305
+ close: !0
306
+ },
307
+ secondaryActions: {
308
+ text: "Cancel",
309
+ close: !0
310
+ }
311
+ }).onPrimary(() => {
312
+ const h = {
313
+ show: !0,
314
+ "onUpdate:show"(f) {
315
+ Oe.value.show = f;
316
+ }
317
+ };
318
+ Oe.value = h;
319
+ });
320
+ }
321
+ return {
322
+ purchaseOrders: u,
323
+ purchaseRequests: c,
324
+ updateDateRange: ue,
325
+ fetchData: te,
326
+ loading: S,
327
+ transferDialogProps: ye,
328
+ promptCreateTransferDialog: C,
329
+ promptUpdateTransferDialog: F,
330
+ transferDetailsProps: V,
331
+ promptShowTransferDetails: s,
332
+ submitAction: L,
333
+ xilnexImportDialogProps: Oe,
334
+ promptUploadTransferDialog: U
335
+ };
336
+ }
337
+ function gt(n, y) {
338
+ return y.reduce(
339
+ (d, g) => {
340
+ const m = g.received.find((q) => q.sku._id === n._id);
341
+ return m && (d = ke(d, m.amount)), d;
342
+ },
343
+ ct.toPrecision(_e(0), n.unit.precision)
344
+ );
345
+ }
346
+ function _t(n, y, i, d) {
347
+ const { name: g, address: m, regNo: q } = y.doc.profile, S = {
348
+ name: g,
349
+ registrationNumber: q,
350
+ line1: m == null ? void 0 : m.line1,
351
+ line2: m == null ? void 0 : m.line2,
352
+ postcode: m == null ? void 0 : m.postcode,
353
+ city: m == null ? void 0 : m.city,
354
+ state: m == null ? void 0 : m.state,
355
+ country: m == null ? void 0 : m.country
356
+ }, o = {
357
+ name: n.supplier.name,
358
+ phoneNumber: n.supplier.phoneNumber,
359
+ registrationNumber: n.supplier.registrationNumber,
360
+ line1: n.supplier.address.line1,
361
+ line2: n.supplier.address.line2,
362
+ postcode: n.supplier.address.postcode,
363
+ city: n.supplier.address.city,
364
+ state: n.supplier.address.state,
365
+ country: n.supplier.address.country
366
+ }, t = n.items.map((x) => {
367
+ const { sku: O, measurement: C } = x, F = ie(
368
+ gt(x.sku, n.deliveryOrder || []),
369
+ !1
370
+ );
371
+ return {
372
+ code: O.code,
373
+ description: O.name,
374
+ quantity: He(x.quantity, O.unit, x.measurement),
375
+ unit: (C == null ? void 0 : C.abbrev) || O.unit.abbrev,
376
+ received: F
377
+ };
378
+ }), u = n.deliveryOrder.map((x) => ({
379
+ createdAt: Ke(new Date(x.createdAt)),
380
+ ref: x.deliveryOrderNumber,
381
+ remark: x.remark || "",
382
+ items: x.received.map((O) => {
383
+ var C;
384
+ return {
385
+ code: O.sku.code,
386
+ description: O.sku.name,
387
+ quantity: ie(O.amount),
388
+ unit: ((C = O.measurement) == null ? void 0 : C.abbrev) || O.sku.unit.abbrev
389
+ };
390
+ })
391
+ })), v = {
392
+ businessName: i == null ? void 0 : i.name,
393
+ logo: i == null ? void 0 : i.thumbnail,
394
+ orderNumber: n.seqNumber.toString(),
395
+ createdAt: Se(n._id),
396
+ ref: n.ref || "",
397
+ remark: n.remark || "",
398
+ buyer: S,
399
+ supplier: o,
400
+ items: t,
401
+ status: n.status,
402
+ deliveryOrders: u
403
+ }, r = new URL(window.location.href), c = d && (n.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
404
+ r.pathname = r.hostname.includes("portal.feedme") ? `/inventory/${c}` : `/${c}`, r.searchParams.append("data", JSON.stringify(v)), window.open(r.href, "_blank", "noreferrer");
405
+ }
406
+ const fe = {
407
+ submitRequest: {
408
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
409
+ color: "text-fm-color-typo-primary",
410
+ value: T.enum.submitRequest
411
+ },
412
+ confirmDraft: {
413
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
414
+ color: "text-fm-color-typo-primary",
415
+ value: T.enum.confirmDraft
416
+ },
417
+ cancelDraft: {
418
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
419
+ color: "text-fm-color-typo-error",
420
+ value: T.enum.cancelDraft
421
+ },
422
+ approveRequest: {
423
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
424
+ color: "text-fm-color-typo-primary",
425
+ value: T.enum.approveRequest
426
+ },
427
+ rejectRequest: {
428
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
429
+ color: "text-fm-color-typo-error",
430
+ value: T.enum.rejectRequest
431
+ },
432
+ processRequest: {
433
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
434
+ color: "text-fm-color-typo-primary",
435
+ value: T.enum.processRequest
436
+ },
437
+ receiveStock: {
438
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
439
+ color: "text-fm-color-typo-primary",
440
+ value: T.enum.receiveStock
441
+ },
442
+ completeReceive: {
443
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
444
+ color: "text-fm-color-typo-primary",
445
+ value: T.enum.completeReceive
446
+ }
447
+ };
448
+ function dr(n, y) {
449
+ ve();
450
+ const i = mt(), { t: d } = Qe();
451
+ function g(u) {
452
+ switch (u.status) {
453
+ case "DRAFT":
454
+ return [
455
+ Z[H.Update],
456
+ Z[H.Details],
457
+ u.supplier.internal === "restaurant" || u.supplier.internal === "warehouse" ? fe[T.enum.submitRequest] : fe[T.enum.confirmDraft],
458
+ fe[T.enum.cancelDraft]
459
+ ];
460
+ case "RECEIVING":
461
+ return [
462
+ fe[T.enum.completeReceive],
463
+ Z[H.Details],
464
+ Z[H.Print]
465
+ ];
466
+ case "REQUESTING":
467
+ return n === "receive/request" ? [Z[H.Details], Z[H.Print]] : [
468
+ fe[T.enum.approveRequest],
469
+ fe[T.enum.rejectRequest],
470
+ Z[H.Details]
471
+ // DefaultRowActions[RowActionEnum.Print]
472
+ ];
473
+ case "PROCESSING":
474
+ return [Z[H.Details], Z[H.Print]];
475
+ case "COMPLETE":
476
+ case "CANCEL":
477
+ default:
478
+ return [Z[H.Details], Z[H.Print]];
479
+ }
480
+ }
481
+ function m(u) {
482
+ return Object.values(T.enum).includes(u);
483
+ }
484
+ async function q(u, v, r) {
485
+ var x, O, C, F;
486
+ const c = Me(v);
487
+ if (u === H.Print) {
488
+ const G = (r == null ? void 0 : r.toInventoryLocation) ?? {
489
+ name: "",
490
+ type: "restaurant",
491
+ acceptRequest: !0,
492
+ dbName: "",
493
+ doc: {
494
+ _id: "",
495
+ businessId: "",
496
+ profile: {}
497
+ }
498
+ };
499
+ c.ref = [((x = r == null ? void 0 : r.netSuite) == null ? void 0 : x.refNo) || ((O = c.netSuite) == null ? void 0 : O.refNo)].filter((j) => j).join(" "), _t(c, G, i.currentBusiness.value, n === "approval");
500
+ return;
501
+ }
502
+ if (u === H.Details) {
503
+ y.promptShowTransferDetails(c, r);
504
+ return;
505
+ }
506
+ if (u === H.Update) {
507
+ (C = y.promptUpdateTransferDialog) == null || C.call(y, c);
508
+ return;
509
+ }
510
+ if (m(u)) {
511
+ y.submitAction(v, u, (F = r == null ? void 0 : r.to) == null ? void 0 : F.dbName);
512
+ return;
513
+ }
514
+ }
515
+ function S() {
516
+ return [
517
+ {
518
+ accessorKey: "seqNumber",
519
+ header: () => d("inventory.transfer.table.seqNo"),
520
+ enableSorting: !0,
521
+ size: 80,
522
+ sortUndefined: "last"
523
+ },
524
+ {
525
+ accessorKey: "_id",
526
+ header: () => d("inventory.transfer.table.createdAt"),
527
+ cell(u) {
528
+ return Se(`${u.getValue()}`);
529
+ },
530
+ enableSorting: !0
531
+ },
532
+ {
533
+ accessorKey: "supplier.name",
534
+ header: () => d("inventory.transfer.table.transferFrom"),
535
+ enableSorting: !0,
536
+ size: 200
537
+ },
538
+ {
539
+ accessorKey: "items.length",
540
+ header: () => d("inventory.transfer.table.noOfItems"),
541
+ enableSorting: !1,
542
+ meta: {
543
+ width: "10rem"
544
+ }
545
+ },
546
+ {
547
+ accessorKey: "ref",
548
+ header: () => d("inventory.transfer.table.reference"),
549
+ enableSorting: !1,
550
+ size: "auto"
551
+ },
552
+ {
553
+ accessorKey: "status",
554
+ header: () => d("inventory.transfer.table.status"),
555
+ cell(u) {
556
+ const v = d(`inventory.transfer.status.${u.getValue() ?? ""}`), r = `${u.getValue() ?? ""}`.toLocaleLowerCase("en-us");
557
+ return D(
558
+ "div",
559
+ {
560
+ class: "flex"
561
+ },
562
+ D(
563
+ "div",
564
+ {
565
+ class: `fm-status-badge fm-status-badge-${r}`
566
+ },
567
+ v
568
+ )
569
+ );
570
+ },
571
+ enableSorting: !0,
572
+ size: 200
573
+ },
574
+ {
575
+ id: "action",
576
+ cell(u) {
577
+ const v = u.row.original, r = g(v);
578
+ return Ue(r, (c) => q(c, v));
579
+ },
580
+ enableSorting: !1,
581
+ size: 40,
582
+ meta: {
583
+ cellClass: "",
584
+ headerClass: ""
585
+ }
586
+ }
587
+ ];
588
+ }
589
+ function o() {
590
+ return [
591
+ {
592
+ accessorKey: "purchaseOrder.seqNumber",
593
+ header: () => d("inventory.transfer.table.seqNo"),
594
+ enableSorting: !0,
595
+ size: 80,
596
+ sortUndefined: "last"
597
+ },
598
+ {
599
+ accessorKey: "purchaseOrder._id",
600
+ header: () => d("inventory.transfer.table.createdAt"),
601
+ cell(u) {
602
+ return Se(`${u.getValue()}`);
603
+ },
604
+ enableSorting: !0
605
+ },
606
+ {
607
+ accessorKey: "to.name",
608
+ header: () => d("inventory.transfer.table.transferTo"),
609
+ enableSorting: !1,
610
+ size: 200
611
+ },
612
+ {
613
+ accessorKey: "purchaseOrder.items.length",
614
+ header: () => d("inventory.transfer.table.noOfItems"),
615
+ enableSorting: !1
616
+ },
617
+ {
618
+ accessorKey: "purchaseOrder.ref",
619
+ header: () => d("inventory.transfer.table.reference"),
620
+ enableSorting: !1,
621
+ size: "auto"
622
+ },
623
+ {
624
+ accessorKey: "purchaseOrder.status",
625
+ header: () => d("inventory.transfer.table.status"),
626
+ cell(u) {
627
+ const v = d(`inventory.transfer.status.${u.getValue() ?? ""}`), r = `${u.getValue() ?? ""}`.toLocaleLowerCase("en-us");
628
+ return D(
629
+ "div",
630
+ {
631
+ class: "flex"
632
+ },
633
+ D(
634
+ "div",
635
+ {
636
+ class: `fm-status-badge fm-status-badge-${r}`
637
+ },
638
+ v
639
+ )
640
+ );
641
+ },
642
+ enableSorting: !0
643
+ },
644
+ {
645
+ id: "action",
646
+ cell(u) {
647
+ const v = u.row.original, c = (v.purchaseOrder ? g(v.purchaseOrder) : []).map((x) => x.value === H.Print ? {
648
+ ...x,
649
+ translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
650
+ } : x);
651
+ return Ue(
652
+ c,
653
+ (x) => v.purchaseOrder ? q(x, v.purchaseOrder, v) : void 0
654
+ );
655
+ },
656
+ enableSorting: !1,
657
+ size: 40,
658
+ meta: {
659
+ cellClass: "",
660
+ headerClass: ""
661
+ }
662
+ }
663
+ ];
664
+ }
665
+ const t = J(() => n === "receive/request" ? S() : o());
666
+ return {
667
+ get columnDefs() {
668
+ return t.value;
669
+ }
670
+ };
671
+ }
672
+ const St = {
673
+ key: 0,
674
+ class: "flex flex-col gap-8"
675
+ }, wt = { class: "flex flex-col gap-4" }, xt = { class: "fm-typo-en-body-lg-600" }, Rt = {
676
+ key: 0,
677
+ class: "flex flex-col gap-4"
678
+ }, Ot = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, kt = { class: "fm-typo-en-body-lg-600" }, Dt = { key: 0 }, At = { key: 1 }, Nt = {
679
+ key: 1,
680
+ class: "flex flex-col gap-4"
681
+ }, Tt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qt = { class: "fm-typo-en-body-lg-600" }, $t = { key: 0 }, Ct = { key: 1 }, Pt = {
682
+ key: 2,
683
+ class: "flex flex-col gap-4"
684
+ }, Et = { class: "fm-typo-en-body-lg-600" }, It = {
685
+ key: 3,
686
+ class: "flex flex-col gap-4"
687
+ }, Ft = { class: "fm-typo-en-body-lg-600" }, Ut = /* @__PURE__ */ we({
688
+ __name: "NetSuiteInfo",
689
+ props: {
690
+ transferType: {},
691
+ transferToDbName: {},
692
+ poRequest: {},
693
+ purchaseOrder: {},
694
+ isTransferBetweenOutlets: { type: Boolean },
695
+ scope: {}
696
+ },
697
+ setup(n) {
698
+ const y = n, i = ze(), d = Te(), g = z(y.poRequest);
699
+ Ge(async () => {
700
+ var o;
701
+ if (!y.poRequest && ((o = y.purchaseOrder) != null && o._id)) {
702
+ const t = await d.getLatestPurchaseOrderRequest(y.purchaseOrder._id);
703
+ g.value = t;
704
+ }
705
+ });
706
+ const m = J(
707
+ () => {
708
+ var o, t, u, v, r, c;
709
+ return i.getSubsidiaryFullName(
710
+ ((u = (t = (o = y.purchaseOrder) == null ? void 0 : o.netSuite) == null ? void 0 : t.subsidiary) == null ? void 0 : u.id) || ((c = (r = (v = y.poRequest) == null ? void 0 : v.netSuite) == null ? void 0 : r.subsidiary) == null ? void 0 : c.id)
711
+ ).fullName;
712
+ }
713
+ ), q = J(() => {
714
+ var o, t, u, v, r, c, x, O, C, F, G, j;
715
+ return (u = (t = (o = y.purchaseOrder) == null ? void 0 : o.netSuite) == null ? void 0 : t.additionalInfo) != null && u.transactionnumber ? (c = (r = (v = y.purchaseOrder) == null ? void 0 : v.netSuite) == null ? void 0 : r.additionalInfo) == null ? void 0 : c.transactionnumber : (C = (O = (x = g.value) == null ? void 0 : x.netSuite) == null ? void 0 : O.additionalInfo) != null && C.transactionnumber ? (j = (G = (F = g.value) == null ? void 0 : F.netSuite) == null ? void 0 : G.additionalInfo) == null ? void 0 : j.transactionnumber : null;
716
+ }), S = J(() => {
717
+ var o, t, u, v, r, c;
718
+ return (t = (o = y.purchaseOrder) == null ? void 0 : o.deliveryFullfillment) != null && t.length && ((v = (u = y.purchaseOrder) == null ? void 0 : u.deliveryFullfillment) == null ? void 0 : v.length) > 0 ? (c = (r = y.purchaseOrder) == null ? void 0 : r.deliveryFullfillment) == null ? void 0 : c.map((x) => {
719
+ var O;
720
+ return (O = x.netSuite) == null ? void 0 : O.refNo;
721
+ }).join(", ") : "N/A";
722
+ });
723
+ return (o, t) => {
724
+ var u, v, r, c, x, O, C, F, G, j, te, ue, V, re;
725
+ return l(i).isEnabled ? (b(), k("div", St, [
726
+ e("div", wt, [
727
+ t[0] || (t[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
728
+ e("div", xt, _(m.value || "N/A"), 1)
729
+ ]),
730
+ !o.isTransferBetweenOutlets && ((u = o.purchaseOrder) == null ? void 0 : u.status) !== l(M).Enum.REQUESTING && o.scope === l(De).RECEIVE_REQUEST ? (b(), k("div", Rt, [
731
+ e("div", Ot, " NetSuite " + _(o.transferType === l(le).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
732
+ e("div", kt, [
733
+ (r = (v = o.purchaseOrder) == null ? void 0 : v.netSuite) != null && r.id ? (b(), k("span", Dt, _((x = (c = o.purchaseOrder) == null ? void 0 : c.netSuite) == null ? void 0 : x.refNo) + " (" + _((C = (O = o.purchaseOrder) == null ? void 0 : O.netSuite) == null ? void 0 : C.id) + ") ", 1)) : (b(), k("span", At, "N/A"))
734
+ ])
735
+ ])) : I("", !0),
736
+ !o.isTransferBetweenOutlets && g.value && ((F = o.purchaseOrder) == null ? void 0 : F.status) === l(M).Enum.REQUESTING || o.scope === l(De).APPROVAL ? (b(), k("div", Nt, [
737
+ e("div", Tt, " (Request) NetSuite " + _(o.transferType === l(le).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
738
+ e("div", qt, [
739
+ (j = (G = g.value) == null ? void 0 : G.netSuite) != null && j.id ? (b(), k("span", $t, _((ue = (te = g.value) == null ? void 0 : te.netSuite) == null ? void 0 : ue.refNo) + " (" + _((re = (V = g.value) == null ? void 0 : V.netSuite) == null ? void 0 : re.id) + ") ", 1)) : (b(), k("span", Ct, "N/A"))
740
+ ])
741
+ ])) : I("", !0),
742
+ q.value ? (b(), k("div", Pt, [
743
+ t[1] || (t[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
744
+ e("div", Et, _(q.value), 1)
745
+ ])) : I("", !0),
746
+ l(i).isEnabled && o.transferType === l(le).TRANSFER && !o.isTransferBetweenOutlets ? (b(), k("div", It, [
747
+ t[2] || (t[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
748
+ e("div", Ft, _(S.value), 1)
749
+ ])) : I("", !0)
750
+ ])) : I("", !0);
751
+ };
752
+ }
753
+ }), Bt = { class: "flex flex-row-reverse" }, Lt = /* @__PURE__ */ we({
754
+ __name: "NetSuiteSync",
755
+ props: {
756
+ poRequest: {},
757
+ purchaseOrder: {},
758
+ isTransferBetweenOutlets: { type: Boolean }
759
+ },
760
+ setup(n) {
761
+ const y = n, i = ze(), d = Ne(), g = Ae(), m = z(!1);
762
+ J(() => {
763
+ var u, v, r, c;
764
+ let S = !0;
765
+ i.isEnabled || (S = !1);
766
+ const o = y.purchaseOrder, t = y.poRequest;
767
+ return o && ((u = o == null ? void 0 : o.supplier) != null && u.internal ? (!t && o.status == M.enum.DRAFT && (S = !1), t && !((v = t == null ? void 0 : t.netSuite) != null && v.id) && (S = !1), y.isTransferBetweenOutlets && (S = !1)) : ((o == null ? void 0 : o.status) !== M.enum.REQUESTING && o.supplier.internal && (S = !1), !t && !((r = o == null ? void 0 : o.netSuite) != null && r.id) && (S = !1), !t && ((c = o == null ? void 0 : o.netSuite) != null && c.id) && (o == null ? void 0 : o.status) == M.enum.REQUESTING && (S = !1))), S;
768
+ });
769
+ async function q() {
770
+ m.value || g.open({
771
+ title: "Sync with NetSuite",
772
+ contentComponent: D("div", [
773
+ D("p", "Are you sure you want to sync now?"),
774
+ D("br"),
775
+ D(
776
+ "p",
777
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
778
+ "Please wait a moment before syncing manually to avoid unnecessary actions."
779
+ )
780
+ ]),
781
+ primaryActions: {
782
+ text: "Sync",
783
+ close: !0,
784
+ variant: "destructive"
785
+ },
786
+ secondaryActions: { text: "Not now", close: !0 }
787
+ }).onPrimary(async () => {
788
+ var S, o;
789
+ try {
790
+ m.value = !0;
791
+ const t = ((S = y.purchaseOrder) == null ? void 0 : S._id) || ((o = y.poRequest) == null ? void 0 : o.purchaseOrderId) || "";
792
+ await i.syncPurchaseOrder(t), d.open({
793
+ title: "Sync with NetSuite",
794
+ message: "Requested to sync with NetSuite. Please wait a moment.",
795
+ type: "success"
796
+ });
797
+ } catch {
798
+ d.open({
799
+ title: "Error",
800
+ message: "Failed to sync with NetSuite",
801
+ type: "error"
802
+ });
803
+ }
804
+ setTimeout(() => {
805
+ m.value = !1;
806
+ }, 5e3);
807
+ });
808
+ }
809
+ return (S, o) => {
810
+ const t = W("FmButton");
811
+ return b(), k("div", Bt, [
812
+ B(t, {
813
+ "prepend-icon": "sync",
814
+ variant: "secondary",
815
+ label: "Sync",
816
+ loading: m.value,
817
+ onClick: q,
818
+ "text-color": "primary",
819
+ "bg-color": "transparent",
820
+ "border-color": "primary"
821
+ }, null, 8, ["loading"])
822
+ ]);
823
+ };
824
+ }
825
+ }), Mt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, jt = { class: "flex flex-col gap-8" }, Vt = { class: "flex w-full justify-end gap-16" }, Kt = /* @__PURE__ */ we({
826
+ __name: "FulfillmentForm",
827
+ props: {
828
+ purchaseOrder: {},
829
+ confirm: { type: Function }
830
+ },
831
+ emits: ["update:show"],
832
+ setup(n, { emit: y }) {
833
+ const i = n, d = nt({
834
+ id: "",
835
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
836
+ items: []
837
+ }), g = z(), m = y;
838
+ return Ge(() => {
839
+ i.purchaseOrder && (console.log("props", i.purchaseOrder), d.items = i.purchaseOrder.items.map((q) => ({
840
+ id: q.id,
841
+ sku: q.sku,
842
+ measurement: q.measurement,
843
+ amount: q.quantity ?? { amount: 1, precision: 0 }
844
+ })));
845
+ }), (q, S) => {
846
+ const o = W("FmTable"), t = W("FmButton"), u = W("FmForm");
847
+ return b(), X(u, {
848
+ ref_key: "formRef",
849
+ ref: g,
850
+ class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
851
+ onValidationFailed: console.log,
852
+ onValidationSuccess: S[1] || (S[1] = () => i.confirm(d))
853
+ }, {
854
+ default: ce(() => [
855
+ S[2] || (S[2] = e("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
856
+ e("div", Mt, [
857
+ e("div", jt, [
858
+ B(o, {
859
+ "column-defs": [
860
+ {
861
+ header: "Code",
862
+ cell: (v) => {
863
+ const r = i.purchaseOrder.items.find((c) => c.id === v.row.original.id || c.sku._id === v.row.original.sku._id);
864
+ return D(
865
+ l(Le).FmTooltip,
866
+ {
867
+ content: r.code,
868
+ placement: "top",
869
+ variant: "plain",
870
+ zIndex: 50
871
+ },
872
+ D(
873
+ "span",
874
+ {
875
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
876
+ },
877
+ r.code
878
+ )
879
+ );
880
+ }
881
+ },
882
+ {
883
+ header: "Name",
884
+ cell: (v) => {
885
+ const r = i.purchaseOrder.items.find((c) => c.id === v.row.original.id || c.sku._id === v.row.original.sku._id);
886
+ return D(
887
+ l(Le).FmTooltip,
888
+ {
889
+ content: r.name,
890
+ placement: "top",
891
+ variant: "plain",
892
+ zIndex: 50
893
+ },
894
+ D(
895
+ "span",
896
+ {
897
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
898
+ },
899
+ r.name
900
+ )
901
+ );
902
+ }
903
+ },
904
+ {
905
+ header: "Amount",
906
+ cell: (v) => {
907
+ const r = v.row.original, c = i.purchaseOrder.items.find((O) => O.id === r.id || O.sku._id === r.sku._id), x = r.amount ?? {
908
+ amount: 1,
909
+ precision: 0
910
+ };
911
+ return D(vt, {
912
+ style: {
913
+ flex: "1 1 0%"
914
+ },
915
+ modelValue: {
916
+ amount: x,
917
+ measurement: r.measurement ?? null
918
+ },
919
+ key: r.id ?? r.sku._id,
920
+ unit: r.sku.unit,
921
+ "onUpdate:modelValue": (O) => {
922
+ if (!O) return;
923
+ const C = d.items.find((F) => F.id === r.id || F.sku._id === r.sku._id);
924
+ C && (C.amount = O.amount);
925
+ },
926
+ disableUnit: !0,
927
+ rules: [
928
+ l(ht)(
929
+ +l(ie)({ amount: 0, precision: 0 })
930
+ ),
931
+ l(bt)(+l(ie)(c.quantity))
932
+ ],
933
+ applyDefaultRules: !0
934
+ });
935
+ }
936
+ }
937
+ ],
938
+ "row-data": d.items,
939
+ "hide-footer": !0
940
+ }, null, 8, ["column-defs", "row-data"])
941
+ ])
942
+ ]),
943
+ e("div", Vt, [
944
+ B(t, {
945
+ class: "px-16",
946
+ label: "Confirm",
947
+ size: "md",
948
+ variant: "primary",
949
+ type: "submit"
950
+ }),
951
+ B(t, {
952
+ class: "px-16",
953
+ label: "Cancel",
954
+ size: "md",
955
+ variant: "secondary",
956
+ onClick: S[0] || (S[0] = () => m("update:show", !1))
957
+ })
958
+ ])
959
+ ]),
960
+ _: 1
961
+ }, 8, ["onValidationFailed"]);
962
+ };
963
+ }
964
+ });
965
+ function zt() {
966
+ return {
967
+ ableToMarkReceived(n) {
968
+ if (!n || n.status !== M.enum.RECEIVING)
969
+ return !1;
970
+ const i = ve().currentLocationDBName;
971
+ return `${n.supplier.internal}_${n.supplier._id}` !== i;
972
+ },
973
+ ableToMarkApproved(n) {
974
+ return !(!n || (n == null ? void 0 : n.status) !== M.enum.REQUESTING && (n == null ? void 0 : n.status) !== M.enum.PROCESSING);
975
+ }
976
+ };
977
+ }
978
+ const Gt = { class: "flex flex-col gap-16 w-full h-full" }, Ht = { class: "flex justify-between" }, Qt = { class: "fm-typo-en-body-lg-600" }, Yt = { class: "flex flex-col gap-8" }, Wt = { class: "flex flex-col gap-4" }, Jt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xt = { class: "flex gap-1" }, Zt = { class: "fm-typo-en-body-lg-600" }, es = {
979
+ key: 0,
980
+ class: "flex flex-col gap-4"
981
+ }, ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ss = { class: "fm-typo-en-body-lg-600" }, rs = { class: "flex flex-col gap-4" }, as = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ns = { class: "fm-typo-en-body-lg-600" }, os = {
982
+ key: 1,
983
+ class: "flex flex-col gap-4"
984
+ }, ls = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, is = { class: "fm-typo-en-body-lg-600" }, cs = {
985
+ key: 2,
986
+ class: "flex flex-col gap-4"
987
+ }, us = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ds = { class: "fm-typo-en-body-lg-600" }, ms = {
988
+ key: 3,
989
+ class: "flex flex-col gap-4"
990
+ }, fs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ps = { class: "fm-typo-en-body-lg-600" }, ys = {
991
+ key: 4,
992
+ class: "flex flex-col gap-4"
993
+ }, vs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, hs = { class: "fm-typo-en-body-lg-600" }, bs = {
994
+ key: 0,
995
+ class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
996
+ }, gs = { class: "flex gap-8 items-center" }, _s = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Ss = { class: "flex flex-col gap-8" }, ws = { class: "flex gap-8 items-center" }, xs = { class: "flex-1 fm-typo-en-body-lg-600" }, Rs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, Os = { class: "flex w-full gap-4" }, ks = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Ds = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, As = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Ns = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, Ts = {
997
+ key: 0,
998
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
999
+ }, qs = { class: "py-8" }, $s = { class: "flex justify-end gap-4 items-center" }, Cs = { class: "fm-typo-en-body-lg-600" }, Ps = {
1000
+ key: 1,
1001
+ class: "flex-1 xs:w-screen xs:max-w-full"
1002
+ }, Es = {
1003
+ key: 0,
1004
+ class: "flex flex-col items-center gap-8 h-full"
1005
+ }, Is = ["src"], Fs = { class: "fm-typo-en-body-lg-600" }, Us = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Bs = {
1006
+ key: 1,
1007
+ class: "px-4 flex flex-col"
1008
+ }, Ls = { class: "flex gap-12 content-stretch" }, Ms = {
1009
+ class: "flex flex-col w-24",
1010
+ name: "circles"
1011
+ }, js = { class: "flex-1 flex flex-col items-center" }, Vs = { class: "flex-1 flex flex-col items-center" }, Ks = {
1012
+ class: "py-12 flex flex-col gap-4",
1013
+ name: "received-at header"
1014
+ }, zs = { class: "fm-typo-en-body-lg-400" }, Gs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Hs = { class: "flex gap-12 content-stretch" }, Qs = {
1015
+ class: "flex flex-col w-24",
1016
+ name: "circles"
1017
+ }, Ys = { class: "flex-1 flex flex-col items-center" }, Ws = {
1018
+ class: "py-12 flex flex-col gap-4 flex-1",
1019
+ name: "delivery details"
1020
+ }, Js = { class: "flex flex-col gap-8" }, Xs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Zs = { class: "flex flex-col gap-4" }, er = { class: "flex gap-8 xs:flex-col" }, mr = /* @__PURE__ */ we({
1021
+ __name: "TransferDetails",
1022
+ props: {
1023
+ poRequest: {},
1024
+ purchaseOrder: {},
1025
+ transferTo: {},
1026
+ transferToDbName: {},
1027
+ show: { type: Boolean },
1028
+ canResubmit: { type: Boolean },
1029
+ canApprove: { type: Boolean },
1030
+ scope: {}
1031
+ },
1032
+ emits: ["update:show", "submitted"],
1033
+ setup(n, { emit: y }) {
1034
+ const i = n, d = y, g = Ae(), m = Ne(), q = Ve(), S = yt(), o = zt(), { t } = Qe(), u = J(
1035
+ () => {
1036
+ var s, p, L, U;
1037
+ return ((p = (s = i.purchaseOrder) == null ? void 0 : s.supplier) == null ? void 0 : p.internal) === "restaurant" || ((U = (L = i.purchaseOrder) == null ? void 0 : L.supplier) == null ? void 0 : U.internal) === "warehouse" ? le.TRANSFER : le.PURCHASE;
1038
+ }
1039
+ ), v = J(() => {
1040
+ var s, p, L;
1041
+ return u.value === le.TRANSFER && ((s = i.transferToDbName) == null ? void 0 : s.startsWith("restaurant")) && ((L = (p = i.purchaseOrder) == null ? void 0 : p.supplier) == null ? void 0 : L.internal) === "restaurant";
1042
+ }), r = z(!1), c = z(""), x = z(!0), O = Te(), C = pt(i, "show"), F = J(() => [
1043
+ {
1044
+ label: t("inventory.transfer.receiveRequest.details.overview"),
1045
+ value: "overview"
1046
+ },
1047
+ {
1048
+ label: t("inventory.transfer.receiveRequest.details.deliveryHistory"),
1049
+ value: "deliveryHistory"
1050
+ }
1051
+ ]), G = z(F.value[0]);
1052
+ ot(
1053
+ () => i.show,
1054
+ (s) => {
1055
+ s && (G.value = F.value[0]);
1056
+ }
1057
+ );
1058
+ async function j(s) {
1059
+ if (s === T.enum.receiveStock)
1060
+ return;
1061
+ const p = Ye[s];
1062
+ if (!p) {
1063
+ m.open({
1064
+ title: "Something went wrong",
1065
+ message: `Cannot process order: ${je(s)}`,
1066
+ type: "error"
1067
+ });
1068
+ return;
1069
+ }
1070
+ const { successMessage: L, ...U } = p;
1071
+ if (i.purchaseOrder) {
1072
+ c.value = `${s}`, r.value = !0, x.value = !1;
1073
+ let h = {}, f = 0;
1074
+ (s === T.enum.confirmDraft || // auto receive for warehouse to warehouse
1075
+ s === T.enum.completeReceive) && q.autoReceiveWarehouse ? h = {
1076
+ autoReceive: !0
1077
+ } : s === T.enum.approveRequest && q.acceptRequireFulfillment && (h = {
1078
+ fulfillment: await new Promise((a, w) => {
1079
+ g.open({
1080
+ closeButton: !1,
1081
+ title: "Confirm transfer amount",
1082
+ dialogComponent: Kt,
1083
+ dialogComponentProps: {
1084
+ purchaseOrder: i.purchaseOrder,
1085
+ confirm: a,
1086
+ "onUpdate:show": (R) => {
1087
+ R || (c.value = "", r.value = !1, x.value = !0, f++, g.close()), w("cancelled");
1088
+ }
1089
+ }
1090
+ });
1091
+ })
1092
+ });
1093
+ try {
1094
+ await new Promise((a, w) => {
1095
+ g.open({
1096
+ closeButton: !1,
1097
+ title: U.title,
1098
+ message: U.message,
1099
+ primaryActions: U.primaryActions,
1100
+ secondaryActions: { text: "No", close: !1 }
1101
+ }).onPrimary(async () => {
1102
+ await O.processPurchaseOrder(
1103
+ {
1104
+ operation: s,
1105
+ doc: i.purchaseOrder,
1106
+ options: h
1107
+ },
1108
+ i.transferToDbName
1109
+ ).delayed(500), a("submitted");
1110
+ }).onSecondary(async () => {
1111
+ for (let R = 0; R < f + 2; R++)
1112
+ g.close();
1113
+ a("cancelled");
1114
+ });
1115
+ }) === "submitted" && (m.open({
1116
+ title: "Success",
1117
+ message: L,
1118
+ type: "success"
1119
+ }), d("update:show", !1), d("submitted"));
1120
+ } catch (N) {
1121
+ m.open({
1122
+ title: "Something went wrong",
1123
+ message: "Please try again.",
1124
+ type: "error"
1125
+ }), console.error("Error when submitting PO operation", s, i.purchaseOrder, N);
1126
+ } finally {
1127
+ c.value = "", r.value = !1, x.value = !0;
1128
+ }
1129
+ }
1130
+ }
1131
+ const te = J(() => {
1132
+ var s, p;
1133
+ return ((s = i.purchaseOrder) == null ? void 0 : s.status) === M.enum.RECEIVING || ((p = i.purchaseOrder) == null ? void 0 : p.status) === M.enum.COMPLETE;
1134
+ }), ue = J(() => {
1135
+ var f, N, a;
1136
+ const L = (((f = i.purchaseOrder) == null ? void 0 : f.deliveryOrder) ?? []).flatMap((w) => w.received ?? []).reduce(
1137
+ (w, R) => {
1138
+ const K = w[R.sku._id] ?? [];
1139
+ return w[R.sku._id] = [...K, R], w;
1140
+ },
1141
+ {}
1142
+ ), U = Object.entries(L).reduce(
1143
+ (w, [R, K]) => {
1144
+ const E = K.reduce((Q, Y) => {
1145
+ const ee = st(
1146
+ Q,
1147
+ Math.max(Q.precision, Y.amount.precision)
1148
+ );
1149
+ return ke(ee, Y.amount);
1150
+ }, _e(0));
1151
+ return w[R] = E, w;
1152
+ },
1153
+ {}
1154
+ ), h = ((N = i.purchaseOrder) == null ? void 0 : N.items) ?? [];
1155
+ for (const w of h)
1156
+ U[a = w.sku._id] ?? (U[a] = _e(0));
1157
+ return U;
1158
+ }), V = J(() => {
1159
+ var f, N;
1160
+ const s = ((f = i.purchaseOrder) == null ? void 0 : f.deliveryOrder) ?? [], p = ((N = i.purchaseOrder) == null ? void 0 : N.deliveryFullfillment) ?? [], L = [
1161
+ ...s.map((a) => ({
1162
+ createdAt: a.createdAt,
1163
+ type: "grn",
1164
+ doc: a
1165
+ })),
1166
+ ...p.map((a) => ({
1167
+ createdAt: a.createdAt,
1168
+ type: "fulfillment",
1169
+ doc: a
1170
+ }))
1171
+ ];
1172
+ L.reverse().sort((a, w) => a.createdAt.localeCompare(w.createdAt));
1173
+ function U(a) {
1174
+ var K, E, Q, Y, ee, ae, ne, oe, $;
1175
+ const w = p.findIndex((A) => A.id === a.fullfillmentId), R = [
1176
+ (E = (K = p[w]) == null ? void 0 : K.netSuite) != null && E.refNo ? {
1177
+ label: "Fulfillment's ref no. (Netsuite)",
1178
+ values: [(Y = (Q = p[w]) == null ? void 0 : Q.netSuite) == null ? void 0 : Y.refNo]
1179
+ } : null,
1180
+ (ee = a == null ? void 0 : a.netSuite) != null && ee.refNo ? {
1181
+ label: "Netsuite ref no.",
1182
+ values: [(ae = a == null ? void 0 : a.netSuite) == null ? void 0 : ae.refNo]
1183
+ } : null,
1184
+ (ne = a == null ? void 0 : a.netSuite) != null && ne.recordType ? {
1185
+ label: "Netsuite Type",
1186
+ values: [rt((oe = a == null ? void 0 : a.netSuite) == null ? void 0 : oe.recordType)]
1187
+ } : null
1188
+ ];
1189
+ return {
1190
+ header: "Received",
1191
+ date: xe(new Date(a.createdAt)),
1192
+ info: [
1193
+ {
1194
+ label: "Adjustment date",
1195
+ values: [
1196
+ a.adjustment ? xe(new Date(at(a.adjustment))) : "-"
1197
+ ]
1198
+ },
1199
+ {
1200
+ label: "Received by",
1201
+ values: [($ = a.createdBy) == null ? void 0 : $.name]
1202
+ },
1203
+ {
1204
+ label: "Received items",
1205
+ values: a.received.map((A) => {
1206
+ var P;
1207
+ return D("div", [
1208
+ D(
1209
+ "div",
1210
+ {
1211
+ class: "flex gap-4"
1212
+ },
1213
+ [
1214
+ D(
1215
+ "div",
1216
+ {
1217
+ class: "flex flex-col"
1218
+ },
1219
+ [
1220
+ D(
1221
+ "span",
1222
+ {
1223
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1224
+ },
1225
+ `${A.sku.name}`
1226
+ ),
1227
+ D(
1228
+ "span",
1229
+ {
1230
+ class: "fm-typo-en-body-md-400"
1231
+ },
1232
+ `${A.sku.code} `
1233
+ )
1234
+ ]
1235
+ ),
1236
+ D(
1237
+ "div",
1238
+ {
1239
+ class: "ml-auto flex flex-col"
1240
+ },
1241
+ [
1242
+ D(
1243
+ "div",
1244
+ {
1245
+ class: "ml-auto flex gap-1"
1246
+ },
1247
+ [
1248
+ D(
1249
+ "span",
1250
+ {
1251
+ class: "fm-typo-en-body-lg-600 self-end"
1252
+ },
1253
+ ie(A.amount, !1)
1254
+ ),
1255
+ D(
1256
+ "span",
1257
+ {
1258
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1259
+ },
1260
+ ((P = A.measurement) == null ? void 0 : P.abbrev) ?? A.sku.unit.abbrev
1261
+ )
1262
+ ]
1263
+ ),
1264
+ D(
1265
+ "div",
1266
+ {
1267
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1268
+ },
1269
+ `${A.cost ? `(${be(A.cost)})` : ""}`
1270
+ )
1271
+ ]
1272
+ )
1273
+ ]
1274
+ )
1275
+ ]);
1276
+ })
1277
+ },
1278
+ a.deliveryOrderNumber ? {
1279
+ label: "Delivery order no.",
1280
+ values: [a.deliveryOrderNumber]
1281
+ } : null,
1282
+ a.remark ? {
1283
+ label: "Remark",
1284
+ values: [a.remark]
1285
+ } : null,
1286
+ w > -1 ? {
1287
+ label: "Fulfilment's sequence",
1288
+ values: [`${w + 1}`]
1289
+ } : null,
1290
+ ...R
1291
+ ].filter((A) => A)
1292
+ };
1293
+ }
1294
+ function h(a) {
1295
+ var R, K;
1296
+ const w = p.findIndex((E) => E.id === a.id);
1297
+ return {
1298
+ header: "Fulfillment",
1299
+ date: xe(new Date(a.createdAt)),
1300
+ info: [
1301
+ {
1302
+ label: "Sequence",
1303
+ values: [String(w + 1)]
1304
+ },
1305
+ {
1306
+ label: "Receiveable items",
1307
+ values: a.items.map((E) => {
1308
+ var Q;
1309
+ return D("div", [
1310
+ D(
1311
+ "div",
1312
+ {
1313
+ class: "flex gap-4"
1314
+ },
1315
+ [
1316
+ D(
1317
+ "div",
1318
+ {
1319
+ class: "flex flex-col"
1320
+ },
1321
+ [
1322
+ D(
1323
+ "span",
1324
+ {
1325
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1326
+ },
1327
+ `${E.sku.name}`
1328
+ ),
1329
+ D(
1330
+ "span",
1331
+ {
1332
+ class: "fm-typo-en-body-md-400"
1333
+ },
1334
+ `${E.sku.code} `
1335
+ )
1336
+ ]
1337
+ ),
1338
+ D(
1339
+ "div",
1340
+ {
1341
+ class: "ml-auto flex flex-col"
1342
+ },
1343
+ [
1344
+ D(
1345
+ "div",
1346
+ {
1347
+ class: "ml-auto flex gap-1"
1348
+ },
1349
+ [
1350
+ D(
1351
+ "span",
1352
+ {
1353
+ class: "fm-typo-en-body-lg-600 self-end"
1354
+ },
1355
+ ie(E.amount, !1)
1356
+ ),
1357
+ D(
1358
+ "span",
1359
+ {
1360
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1361
+ },
1362
+ ((Q = E.measurement) == null ? void 0 : Q.abbrev) ?? E.sku.unit.abbrev
1363
+ )
1364
+ ]
1365
+ ),
1366
+ D(
1367
+ "div",
1368
+ {
1369
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1370
+ },
1371
+ `${E.cost ? `(${be(E.cost)})` : ""}`
1372
+ )
1373
+ ]
1374
+ )
1375
+ ]
1376
+ )
1377
+ ]);
1378
+ })
1379
+ },
1380
+ (R = a.netSuite) != null && R.refNo ? {
1381
+ label: "Ref no. (Netsuite)",
1382
+ values: [(K = a.netSuite) == null ? void 0 : K.refNo]
1383
+ } : null
1384
+ ].filter((E) => E)
1385
+ };
1386
+ }
1387
+ return L.map((a) => {
1388
+ switch (a.type) {
1389
+ case "grn":
1390
+ return U(a.doc);
1391
+ case "fulfillment":
1392
+ return h(a.doc);
1393
+ }
1394
+ });
1395
+ }), re = J(() => {
1396
+ var p;
1397
+ const s = {
1398
+ ..._e(0),
1399
+ currency: Be()
1400
+ };
1401
+ return ((p = i.purchaseOrder) == null ? void 0 : p.items.reduce((L, U) => ({
1402
+ ...ke(L, U.totalCost ?? s),
1403
+ currency: Be()
1404
+ }), s)) ?? s;
1405
+ });
1406
+ return (s, p) => {
1407
+ var E, Q;
1408
+ const L = W("FmButtonGroup"), U = W("FmChip"), h = W("FmMenuDivider"), f = W("FmCard"), N = W("FmIcon"), a = W("FmTooltip"), w = W("FmSpacer"), R = W("FmButton"), K = W("FmSideSheet");
1409
+ return b(), X(K, {
1410
+ header: l(t)("inventory.transfer.receiveRequest.details.title") + ((E = s.purchaseOrder) != null && E.seqNumber ? ` #${(Q = s.purchaseOrder) == null ? void 0 : Q.seqNumber}` : ""),
1411
+ modelValue: l(C),
1412
+ "onUpdate:modelValue": p[9] || (p[9] = (Y) => lt(C) ? C.value = Y : null),
1413
+ "dismiss-away": x.value,
1414
+ "close-button": "",
1415
+ "max-width": 600
1416
+ }, {
1417
+ default: ce(() => {
1418
+ var Y, ee, ae, ne, oe;
1419
+ return [
1420
+ e("div", Gt, [
1421
+ e("div", null, [
1422
+ B(L, {
1423
+ items: F.value,
1424
+ modelValue: G.value,
1425
+ "onUpdate:modelValue": p[0] || (p[0] = ($) => G.value = $)
1426
+ }, null, 8, ["items", "modelValue"])
1427
+ ]),
1428
+ G.value.value === "overview" ? (b(), k(se, { key: 0 }, [
1429
+ e("div", null, [
1430
+ B(f, {
1431
+ variant: "outlined",
1432
+ class: "flex flex-col gap-8 px-12 py-16"
1433
+ }, {
1434
+ default: ce(() => {
1435
+ var $, A, P, de, me, he, qe, $e, Ce, Pe, Ee, Ie;
1436
+ return [
1437
+ e("div", Ht, [
1438
+ e("div", Qt, _(l(t)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
1439
+ e("div", null, [
1440
+ B(U, {
1441
+ label: l(t)(`inventory.transfer.status.${($ = s.purchaseOrder) == null ? void 0 : $.status}`),
1442
+ class: ge(`fm-status-badge fm-status-badge-${(P = (A = s.purchaseOrder) == null ? void 0 : A.status) == null ? void 0 : P.toLocaleLowerCase("en-us")}`),
1443
+ compact: ""
1444
+ }, null, 8, ["label", "class"])
1445
+ ])
1446
+ ]),
1447
+ B(h),
1448
+ e("div", Yt, [
1449
+ e("div", Wt, [
1450
+ e("div", Jt, [
1451
+ e("div", Xt, _(l(t)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1452
+ ]),
1453
+ e("div", Zt, _(l(Se)(((de = s.purchaseOrder) == null ? void 0 : de._id) ?? "")), 1)
1454
+ ]),
1455
+ (me = s.purchaseOrder) != null && me.effectiveAt ? (b(), k("div", es, [
1456
+ e("div", ts, _(l(t)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
1457
+ e("div", ss, _(l(Ke)(new Date((he = s.purchaseOrder) == null ? void 0 : he.effectiveAt))), 1)
1458
+ ])) : I("", !0),
1459
+ e("div", rs, [
1460
+ e("div", as, _(l(t)("inventory.transfer.receiveRequest.details.type.title")), 1),
1461
+ e("div", ns, _(l(t)(
1462
+ `inventory.transfer.receiveRequest.details.type.${u.value.toLocaleLowerCase("en-US")}`
1463
+ )), 1)
1464
+ ]),
1465
+ ($e = (qe = s.purchaseOrder) == null ? void 0 : qe.supplier) != null && $e.name ? (b(), k("div", os, [
1466
+ e("div", ls, _(l(t)("inventory.transfer.receiveRequest.details.from")), 1),
1467
+ e("div", is, _((Pe = (Ce = s.purchaseOrder) == null ? void 0 : Ce.supplier) == null ? void 0 : Pe.name), 1)
1468
+ ])) : I("", !0),
1469
+ s.transferTo ? (b(), k("div", cs, [
1470
+ e("div", us, _(l(t)("inventory.transfer.receiveRequest.details.to")), 1),
1471
+ e("div", ds, _(s.transferTo), 1)
1472
+ ])) : I("", !0),
1473
+ (Ee = s.purchaseOrder) != null && Ee.ref ? (b(), k("div", ms, [
1474
+ e("div", fs, _(l(t)("inventory.transfer.receiveRequest.details.reference")), 1),
1475
+ e("div", ps, _(s.purchaseOrder.ref), 1)
1476
+ ])) : I("", !0),
1477
+ (Ie = s.purchaseOrder) != null && Ie.remark ? (b(), k("div", ys, [
1478
+ e("div", vs, _(l(t)("inventory.transfer.receiveRequest.details.remark")), 1),
1479
+ e("div", hs, _(s.purchaseOrder.remark), 1)
1480
+ ])) : I("", !0)
1481
+ ])
1482
+ ];
1483
+ }),
1484
+ _: 1
1485
+ })
1486
+ ]),
1487
+ l(S).isNetSuiteEnabled && !v.value ? (b(), k("div", bs, [
1488
+ e("div", gs, [
1489
+ p[10] || (p[10] = e("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1490
+ e("div", null, [
1491
+ B(Lt, {
1492
+ "po-request": s.poRequest,
1493
+ "purchase-order": s.purchaseOrder,
1494
+ "is-transfer-between-outlets": v.value
1495
+ }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets"])
1496
+ ])
1497
+ ]),
1498
+ B(h),
1499
+ B(Ut, {
1500
+ "po-request": s.poRequest,
1501
+ "purchase-order": s.purchaseOrder,
1502
+ "transfer-type": u.value,
1503
+ "transfer-to-db-name": s.transferToDbName,
1504
+ "is-transfer-between-outlets": v.value,
1505
+ scope: s.scope
1506
+ }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1507
+ ])) : I("", !0),
1508
+ e("div", _s, [
1509
+ e("div", Ss, [
1510
+ e("div", ws, [
1511
+ e("span", xs, [
1512
+ Re(_(te.value ? l(t)("inventory.transfer.receiveRequest.details.receivedItems") : l(t)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
1513
+ (ee = (Y = s.purchaseOrder) == null ? void 0 : Y.netSuite) != null && ee.missingItems && ((ne = (ae = s.purchaseOrder) == null ? void 0 : ae.netSuite) == null ? void 0 : ne.missingItems.length) > 0 ? (b(), X(a, {
1514
+ key: 0,
1515
+ variant: "rich",
1516
+ placement: "top",
1517
+ "z-index": 51
1518
+ }, {
1519
+ content: ce(() => {
1520
+ var $, A;
1521
+ return [
1522
+ e("div", Rs, [
1523
+ (b(!0), k(se, null, pe((A = ($ = s.purchaseOrder) == null ? void 0 : $.netSuite) == null ? void 0 : A.missingItems, (P, de) => (b(), k("div", {
1524
+ class: "flex justify-center align-middle",
1525
+ key: de
1526
+ }, [
1527
+ B(N, {
1528
+ name: "arrow_right",
1529
+ size: "sm"
1530
+ }),
1531
+ Re(" " + _(`(${P.netSuiteId}) ${P.name}: ${P.reason}`), 1)
1532
+ ]))), 128))
1533
+ ])
1534
+ ];
1535
+ }),
1536
+ default: ce(() => [
1537
+ B(N, {
1538
+ name: "error",
1539
+ color: "#ff2c2c",
1540
+ size: "sm"
1541
+ })
1542
+ ]),
1543
+ _: 1
1544
+ })) : I("", !0)
1545
+ ])
1546
+ ]),
1547
+ B(h),
1548
+ (b(!0), k(se, null, pe(((oe = s.purchaseOrder) == null ? void 0 : oe.items) ?? [], ($) => {
1549
+ var A;
1550
+ return b(), k("div", {
1551
+ key: $.code,
1552
+ class: "flex flex-col"
1553
+ }, [
1554
+ e("div", Os, [
1555
+ e("div", ks, _($.name), 1),
1556
+ e("div", Ds, _(l(ie)(ue.value[$.sku._id], !1)) + "/" + _(l(He)($.quantity, $.sku.unit, $.measurement)), 1)
1557
+ ]),
1558
+ e("div", As, [
1559
+ e("div", Ns, _($.code), 1),
1560
+ (A = $.totalCost) != null && A.amount && l(q).enableTotalCost ? (b(), k("div", Ts, " (" + _(l(be)($.totalCost)) + ") ", 1)) : I("", !0)
1561
+ ])
1562
+ ]);
1563
+ }), 128)),
1564
+ +l(ie)(re.value) ? (b(), k(se, { key: 0 }, [
1565
+ e("div", qs, [
1566
+ B(h)
1567
+ ]),
1568
+ e("div", $s, [
1569
+ p[11] || (p[11] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
1570
+ e("div", Cs, _(l(be)(re.value)), 1)
1571
+ ])
1572
+ ], 64)) : I("", !0)
1573
+ ])
1574
+ ])
1575
+ ], 64)) : G.value.value === "deliveryHistory" ? (b(), k("div", Ps, [
1576
+ V.value.length ? (b(), k("div", Bs, [
1577
+ (b(!0), k(se, null, pe(V.value, ($, A) => (b(), k(se, { key: A }, [
1578
+ e("div", Ls, [
1579
+ e("div", Ms, [
1580
+ e("div", js, [
1581
+ e("div", {
1582
+ class: ge([
1583
+ {
1584
+ "bg-fm-color-primary": A !== 0,
1585
+ "bg-white": A === 0
1586
+ },
1587
+ "w-[2px] h-full"
1588
+ ])
1589
+ }, null, 2)
1590
+ ]),
1591
+ p[12] || (p[12] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1592
+ e("div", Vs, [
1593
+ e("div", {
1594
+ class: ge([
1595
+ {
1596
+ "bg-fm-color-primary": A < V.value.length - 1,
1597
+ "bg-white": A >= V.value.length - 1
1598
+ },
1599
+ "w-[2px] h-full"
1600
+ ])
1601
+ }, null, 2)
1602
+ ])
1603
+ ]),
1604
+ e("div", Ks, [
1605
+ e("div", zs, _($.header), 1),
1606
+ e("div", Gs, _($.date), 1)
1607
+ ])
1608
+ ]),
1609
+ e("div", Hs, [
1610
+ e("div", Qs, [
1611
+ e("div", Ys, [
1612
+ e("div", {
1613
+ class: ge([
1614
+ {
1615
+ "bg-fm-color-primary": A < V.value.length - 1,
1616
+ "bg-white": A >= V.value.length - 1
1617
+ },
1618
+ "w-[2px] h-full"
1619
+ ])
1620
+ }, null, 2)
1621
+ ])
1622
+ ]),
1623
+ e("div", Ws, [
1624
+ B(f, {
1625
+ variant: "outlined",
1626
+ class: "py-12 px-16"
1627
+ }, {
1628
+ default: ce(() => [
1629
+ e("div", Js, [
1630
+ (b(!0), k(se, null, pe($.info, (P, de) => (b(), k("div", {
1631
+ key: de,
1632
+ class: "flex flex-col gap-4"
1633
+ }, [
1634
+ e("div", Xs, _(P == null ? void 0 : P.label), 1),
1635
+ e("div", Zs, [
1636
+ (b(!0), k(se, null, pe(P == null ? void 0 : P.values, (me, he) => (b(), k("div", {
1637
+ key: he,
1638
+ class: "fm-typo-en-body-lg-600"
1639
+ }, [
1640
+ typeof me == "string" ? (b(), k(se, { key: 0 }, [
1641
+ Re(_(me), 1)
1642
+ ], 64)) : (b(), X(it(me), { key: 1 }))
1643
+ ]))), 128))
1644
+ ])
1645
+ ]))), 128))
1646
+ ])
1647
+ ]),
1648
+ _: 2
1649
+ }, 1024)
1650
+ ])
1651
+ ])
1652
+ ], 64))), 128))
1653
+ ])) : (b(), k("div", Es, [
1654
+ B(w),
1655
+ e("div", null, [
1656
+ e("img", {
1657
+ src: l(ft),
1658
+ alt: "List is empty"
1659
+ }, null, 8, Is)
1660
+ ]),
1661
+ e("div", Fs, _(l(t)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
1662
+ e("div", Us, _(l(t)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
1663
+ B(w),
1664
+ B(w)
1665
+ ]))
1666
+ ])) : I("", !0)
1667
+ ])
1668
+ ];
1669
+ }),
1670
+ "side-sheet-footer": ce(() => {
1671
+ var Y, ee, ae, ne, oe, $, A;
1672
+ return [
1673
+ e("div", er, [
1674
+ ((Y = s.purchaseOrder) == null ? void 0 : Y.status) === l(M).enum.DRAFT && u.value === l(le).PURCHASE ? (b(), X(R, {
1675
+ key: 0,
1676
+ label: l(t)("inventory.transfer.receiveRequest.actions.confirmDraft"),
1677
+ onClick: p[1] || (p[1] = (P) => j("confirmDraft")),
1678
+ loading: c.value === "confirmDraft",
1679
+ disabled: c.value !== "confirmDraft" && r.value
1680
+ }, null, 8, ["label", "loading", "disabled"])) : I("", !0),
1681
+ ((ee = s.purchaseOrder) == null ? void 0 : ee.status) === l(M).enum.DRAFT && u.value === l(le).TRANSFER ? (b(), X(R, {
1682
+ key: 1,
1683
+ label: l(t)("inventory.transfer.receiveRequest.actions.submitRequest"),
1684
+ onClick: p[2] || (p[2] = (P) => j("submitRequest")),
1685
+ loading: c.value === "submitRequest",
1686
+ disabled: c.value !== "submitRequest" && r.value
1687
+ }, null, 8, ["label", "loading", "disabled"])) : I("", !0),
1688
+ ((ae = s.purchaseOrder) == null ? void 0 : ae.status) === l(M).enum.DRAFT ? (b(), X(R, {
1689
+ key: 2,
1690
+ label: l(t)("inventory.transfer.receiveRequest.actions.cancelDraft"),
1691
+ onClick: p[3] || (p[3] = (P) => j("cancelDraft")),
1692
+ loading: c.value === "cancelDraft",
1693
+ disabled: c.value !== "cancelDraft" && r.value,
1694
+ variant: "destructive"
1695
+ }, null, 8, ["label", "loading", "disabled"])) : I("", !0),
1696
+ l(o).ableToMarkReceived(s.purchaseOrder) ? (b(), X(R, {
1697
+ key: 3,
1698
+ label: l(t)("inventory.transfer.receiveRequest.actions.completeReceive"),
1699
+ onClick: p[4] || (p[4] = (P) => j("completeReceive")),
1700
+ loading: c.value === "completeReceive",
1701
+ disabled: c.value !== "completeReceive" && r.value
1702
+ }, null, 8, ["label", "loading", "disabled"])) : I("", !0),
1703
+ s.canResubmit ? (b(), X(R, {
1704
+ key: 4,
1705
+ label: l(t)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
1706
+ onClick: p[5] || (p[5] = (P) => j("submitRequest")),
1707
+ loading: c.value === "submitRequest",
1708
+ disabled: c.value !== "submitRequest" && r.value
1709
+ }, null, 8, ["label", "loading", "disabled"])) : I("", !0),
1710
+ l(o).ableToMarkApproved(s.purchaseOrder) && s.canApprove ? (b(), X(R, {
1711
+ key: 5,
1712
+ label: l(t)("inventory.transfer.approval.actions.approveRequest"),
1713
+ onClick: p[6] || (p[6] = (P) => j("approveRequest")),
1714
+ loading: c.value === "approveRequest",
1715
+ disabled: c.value !== "approveRequest" && r.value
1716
+ }, null, 8, ["label", "loading", "disabled"])) : I("", !0),
1717
+ ((ne = s.purchaseOrder) == null ? void 0 : ne.status) === l(M).enum.REQUESTING && s.canApprove ? (b(), X(R, {
1718
+ key: 6,
1719
+ label: l(t)("inventory.transfer.approval.actions.rejectRequest"),
1720
+ onClick: p[7] || (p[7] = (P) => j("rejectRequest")),
1721
+ loading: c.value === "rejectRequest",
1722
+ disabled: c.value !== "rejectRequest" && r.value,
1723
+ variant: "destructive"
1724
+ }, null, 8, ["label", "loading", "disabled"])) : I("", !0),
1725
+ ((oe = s.purchaseOrder) == null ? void 0 : oe.status) !== l(M).enum.COMPLETE && (($ = s.purchaseOrder) == null ? void 0 : $.status) !== l(M).enum.CANCEL && (((A = s.purchaseOrder) == null ? void 0 : A.status) !== l(M).enum.REQUESTING || s.canApprove) ? (b(), X(R, {
1726
+ key: 7,
1727
+ label: l(t)("common.close"),
1728
+ variant: "tertiary",
1729
+ onClick: p[8] || (p[8] = (P) => d("update:show", !1))
1730
+ }, null, 8, ["label"])) : I("", !0)
1731
+ ])
1732
+ ];
1733
+ }),
1734
+ _: 1
1735
+ }, 8, ["header", "modelValue", "dismiss-away"]);
1736
+ };
1737
+ }
1738
+ });
1739
+ export {
1740
+ De as P,
1741
+ mr as _,
1742
+ ur as a,
1743
+ dr as b,
1744
+ gt as g,
1745
+ Te as u
1746
+ };