@feedmepos/mf-inventory-portal 0.0.23-dev.10 → 0.0.23-dev.12

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 (56) hide show
  1. package/dist/{App-DDxwfi6I.js → App-DASBZyvh.js} +3 -3
  2. package/dist/{ApprovalView-7rpIigm0.js → ApprovalView-DHF6ZNbm.js} +4 -4
  3. package/dist/{BindingsDialog-DbyzX6mw.js → BindingsDialog-D9qKxyAg.js} +2 -2
  4. package/dist/{BindingsPicker-FZfhZr5O.js → BindingsPicker-CeBoqXz8.js} +2 -2
  5. package/dist/{BindingsTable-Bk2770OV.js → BindingsTable-Dd5xRj10.js} +4 -4
  6. package/dist/{ClosingDraftView-D9CnCwak.js → ClosingDraftView-TbFoEdiB.js} +221 -226
  7. package/dist/{ClosingTemplateView-DkpHmTtx.js → ClosingTemplateView-CSXAdVxc.js} +10 -10
  8. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DjBiov5r.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BST01iWL.js} +4 -4
  9. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CBC214tP.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BH2P7EWu.js} +2 -2
  10. package/dist/{FmMultiselectDialog-CK6xwOeG.js → FmMultiselectDialog-CS4NySsZ.js} +3 -3
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-IFTMUhET.js → FmUnitInput.vue_vue_type_script_setup_true_lang-C7jj8lh2.js} +2 -2
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-D0otwOX8.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-B_bOROW1.js} +1 -1
  13. package/dist/{IngredientGroupView-D5XtVfIQ.js → IngredientGroupView-D8YdtFuI.js} +5 -5
  14. package/dist/{IngredientsView-c7WnQiTv.js → IngredientsView-Dwi7AdEC.js} +9 -9
  15. package/dist/{IntegrationView-CHkhMxVM.js → IntegrationView-cRXTwH66.js} +4 -4
  16. package/dist/{InventoryBindingForm-BUZ9MS5V.js → InventoryBindingForm-Bn8LLL7Z.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-YIRre_Km.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-jXdc2zeS.js} +5 -5
  18. package/dist/{InventoryBindingSummary-BUi0mjeC.js → InventoryBindingSummary-eUAU5Z7o.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CpYtHPFH.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DP9gkO9u.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D8IH1X1o.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DjdvK5YG.js} +2 -2
  21. package/dist/{PurchaseOrderPrintPreview-BLuoVz5N.js → PurchaseOrderPrintPreview-RsvtuTgm.js} +1 -1
  22. package/dist/{ReceiveRequestView-BNM5JdQO.js → ReceiveRequestView-BVYXX41L.js} +1273 -1243
  23. package/dist/{RecipeView-DxRumcLY.js → RecipeView-BFj61pLR.js} +7 -7
  24. package/dist/{StockView-CZyeg3sX.js → StockView-B8DHNq-I.js} +13 -13
  25. package/dist/{SupplierView-C2XLbf27.js → SupplierView-DE5glObY.js} +10 -10
  26. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CAR2rHAz.js +1234 -0
  27. package/dist/TransferTemplateView-DaY-24XT.js +1275 -0
  28. package/dist/{UnitView-uGpE4txg.js → UnitView-Bqh-DD8a.js} +5 -5
  29. package/dist/{WarehouseView-DvQVmixr.js → WarehouseView-KOZF8E0j.js} +4 -4
  30. package/dist/{app-BaOENyRY.js → app-CCmjyIGj.js} +11 -9
  31. package/dist/app.d.ts +2 -0
  32. package/dist/app.js +1 -1
  33. package/dist/{date2-CfGU3sHq.js → date2-Bts8EH96.js} +1 -1
  34. package/dist/{dayjs.min-BMk-E1IO.js → dayjs.min-Bwx_xAqf.js} +1 -1
  35. package/dist/{decimal-BkLhxOFS.js → decimal-Cw3aj2HA.js} +1 -1
  36. package/dist/{defineDeepModel-Cy-_HBnw.js → defineDeepModel-DF4IooaB.js} +1 -1
  37. package/dist/{feature-GoxrdjJJ.js → feature-DUVlpk0T.js} +1 -1
  38. package/dist/{format-time-from-id-96hwVl9P.js → format-time-from-id-DRL6XFTy.js} +1 -1
  39. package/dist/{format-unit-display-Cp0DBbM8.js → format-unit-display-h-7i16En.js} +8 -8
  40. package/dist/{fuzzy-CBGiL1wK.js → fuzzy-Csk59ocn.js} +1 -1
  41. package/dist/{index-S7yfliEo.js → index-BUdfAMv8.js} +1 -1
  42. package/dist/{index-0HEhOwKT.js → index-C49C9tXF.js} +1 -1
  43. package/dist/{index-CoL8wxbn.js → index-rrLxN15a.js} +1 -1
  44. package/dist/{netsuite-D3VPLW8O.js → netsuite-Cgj-Fs7U.js} +88 -66
  45. package/dist/{rules-DxLLla7a.js → rules-CSQd5FJv.js} +2 -2
  46. package/dist/{stock-BbFKtx1y.js → stock-DOndmj1b.js} +2 -2
  47. package/dist/stores/integration/netsuite.d.ts +1 -0
  48. package/dist/{supplier-gGovyyjr.js → supplier-Bv3Jvn8o.js} +1 -1
  49. package/dist/tsconfig.app.tsbuildinfo +1 -1
  50. package/dist/{use-inventory-binding-dialog-DIBMf_9-.js → use-inventory-binding-dialog-C7br2QA4.js} +2 -2
  51. package/dist/{use-template-enabled-locations-2-Bof9JMYI.js → use-template-enabled-locations-2-eX5uS542.js} +2 -2
  52. package/dist/{xlsx-DOnDmayp.js → xlsx-wOJHnWy6.js} +1 -1
  53. package/dist/{xlsx.util-BqsQd9YP.js → xlsx.util-C4ZYbcNA.js} +1 -1
  54. package/package.json +1 -1
  55. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BQG6UzUU.js +0 -1229
  56. package/dist/TransferTemplateView-BCxZCU0i.js +0 -1262
@@ -0,0 +1,1234 @@
1
+ import { ref as B, computed as V, h as ee, defineComponent as We, resolveComponent as te, openBlock as y, createBlock as J, unref as n, isRef as Je, withCtx as pe, createElementVNode as r, createElementBlock as k, createVNode as Y, createCommentVNode as q, Fragment as re, toDisplayString as v, normalizeClass as ve, renderList as ye } from "vue";
2
+ import { i as Ze } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BH2P7EWu.js";
3
+ import { k as Xe, u as be, G as _, r as et, c as Le, y as F, s as je, w as $e } from "./app-CCmjyIGj.js";
4
+ import { t as tt, b as rt, h as Be, d as Ie } from "./date2-Bts8EH96.js";
5
+ import { F as Fe } from "./form-mode.enum-BKiNVH6A.js";
6
+ import { useDialog as Ke, useSnackbar as Ve, useProxiedModel as st } from "@feedmepos/ui-library";
7
+ import { p as at, f as ge } from "./format-time-from-id-DRL6XFTy.js";
8
+ import { u as Ge } from "./feature-DUVlpk0T.js";
9
+ import { b as nt, u as ot, f as He, P as se } from "./format-unit-display-h-7i16En.js";
10
+ import { c as Ue } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
11
+ import { D as j, R as I } from "./row-action.enum-7rGLGZ5v.js";
12
+ import { i as Oe, c as he, a as le, k as lt, j as Me } from "./rules-CSQd5FJv.js";
13
+ import { F as it } from "./decimal-Cw3aj2HA.js";
14
+ import { useI18n as ze } from "@feedmepos/mf-common";
15
+ import { E as ct } from "./empty-placeholder-wf6-BWE8.js";
16
+ import { u as ut } from "./netsuite-Cgj-Fs7U.js";
17
+ const Qe = Xe((m, R) => {
18
+ const i = be();
19
+ return {
20
+ async readRequests(s) {
21
+ const w = s ?? i.currentLocationDBName, S = `${m.inventoryBackendUrl}/${w}/purchase-request`;
22
+ return await R.get(S);
23
+ },
24
+ async getPurchaseOrders({
25
+ start: s,
26
+ end: w
27
+ }) {
28
+ const S = i.currentLocationDBName, P = `${m.inventoryBackendUrl}/${S}/purchase-order`;
29
+ return await R.get(`${P}?start=${s}&end=${w}`);
30
+ },
31
+ async getPurchaseOrderById(s) {
32
+ const w = i.currentLocationDBName, S = `${m.inventoryBackendUrl}/${w}/purchase-order`;
33
+ return await R.get(`${S}/${s}`);
34
+ },
35
+ async processPurchaseOrder(s, w) {
36
+ const S = i.currentLocationDBName, P = w || S, $ = `${m.inventoryBackendUrl}/${P}/purchase-order/run-operation`;
37
+ return await R.put($, s);
38
+ },
39
+ async createPurchaseOrder(s) {
40
+ const w = i.currentLocationDBName, S = `${m.inventoryBackendUrl}/${w}/purchase-order`;
41
+ return await R.post(S, s);
42
+ },
43
+ async updatePurchaseOrder(s) {
44
+ const w = i.currentLocationDBName, S = `${m.inventoryBackendUrl}/${w}/purchase-order`;
45
+ return await R.put(S, s);
46
+ }
47
+ };
48
+ }), Ye = {
49
+ [_.enum.confirmDraft]: {
50
+ primaryActions: {
51
+ text: "Confirm draft",
52
+ close: !0
53
+ },
54
+ title: "Confirm draft?",
55
+ message: "Purchase order cannot be changed after confirm draft.",
56
+ successMessage: "Purchase order draft has been confirmed"
57
+ },
58
+ [_.enum.cancelDraft]: {
59
+ primaryActions: {
60
+ text: "Cancel draft",
61
+ close: !0,
62
+ variant: "destructive"
63
+ },
64
+ title: "Cancel draft?",
65
+ message: "Purchase order cannot be changed after cancelled draft.",
66
+ successMessage: "Purchase order draft has been cancelled"
67
+ },
68
+ [_.enum.submitRequest]: {
69
+ primaryActions: {
70
+ text: "Submit request",
71
+ close: !0
72
+ },
73
+ title: "Confirm draft?",
74
+ message: "Purchase order cannot be changed after confirm draft.",
75
+ successMessage: "Purchase order draft has been submitted"
76
+ },
77
+ [_.enum.completeReceive]: {
78
+ primaryActions: {
79
+ text: "Mark received",
80
+ close: !0
81
+ },
82
+ title: "Mark as received",
83
+ message: "Purchase order cannot be changed after it has complete receiving.",
84
+ successMessage: "Purchase order has been marked as received"
85
+ },
86
+ [_.enum.approveRequest]: {
87
+ primaryActions: {
88
+ text: "Approve request",
89
+ close: !0
90
+ },
91
+ title: "Approve request?",
92
+ message: "Purchase order will be approved.",
93
+ successMessage: "Purchase order has been approved"
94
+ },
95
+ [_.enum.rejectRequest]: {
96
+ primaryActions: {
97
+ text: "Reject request",
98
+ close: !0,
99
+ variant: "destructive"
100
+ },
101
+ title: "Reject request?",
102
+ message: "Purchase order will be rejected.",
103
+ successMessage: "Purchase order has been rejected"
104
+ }
105
+ }, me = B();
106
+ function Br(m, R) {
107
+ const i = Ke(), s = be(), w = Ge(), S = nt(), P = ot(), $ = B(!1), d = Ve(), U = Qe(), c = B(new Array()), p = B(
108
+ R != null && R.startDate && (R != null && R.endDate) ? R : Ze()
109
+ ), h = V(() => {
110
+ const f = new Date(p.value.startDate), u = new Date(p.value.endDate);
111
+ return {
112
+ start: tt(f).toISOString(),
113
+ end: rt(u).toISOString()
114
+ };
115
+ }), g = B(new Array()), D = et(), G = B(null);
116
+ async function Se(f) {
117
+ let u;
118
+ if (w.mustUsePoTemplate && !(f != null && f.template) && (u = await S.getTemplateId(), !u))
119
+ return;
120
+ const t = {
121
+ mode: Fe.CREATE,
122
+ modelValue: f || void 0,
123
+ show: !0,
124
+ "onUpdate:show"(e) {
125
+ me.value.show = e;
126
+ },
127
+ templateId: u,
128
+ lastClosingDate: G.value
129
+ };
130
+ me.value = t;
131
+ }
132
+ function ie(f) {
133
+ const u = {
134
+ mode: Fe.UPDATE,
135
+ modelValue: Le(f),
136
+ show: !0,
137
+ "onUpdate:show"(t) {
138
+ me.value.show = t;
139
+ },
140
+ lastClosingDate: G.value
141
+ };
142
+ me.value = u;
143
+ }
144
+ async function Re() {
145
+ c.value = [], $.value = !0;
146
+ try {
147
+ c.value = await U.getPurchaseOrders(h.value).then((t) => t.sort((e, a) => a._id.localeCompare(e._id)));
148
+ const f = await D.readLastClosing(!0), u = f == null ? void 0 : f._id;
149
+ u && (G.value = at(u)), w.mustUsePoTemplate && await P.fetchTemplates();
150
+ } catch {
151
+ d.open({
152
+ title: "Something went wrong",
153
+ message: "Error at fetching purchase orders",
154
+ type: "error"
155
+ });
156
+ } finally {
157
+ $.value = !1;
158
+ }
159
+ }
160
+ async function W() {
161
+ g.value = [], $.value = !0;
162
+ try {
163
+ g.value = await U.readRequests().then((f) => f.reverse());
164
+ } catch {
165
+ d.open({
166
+ title: "Something went wrong",
167
+ message: "Error at fetching purchase requests",
168
+ type: "error"
169
+ });
170
+ } finally {
171
+ $.value = !1;
172
+ }
173
+ }
174
+ function ae() {
175
+ switch (m) {
176
+ case "receive/request":
177
+ return Re();
178
+ case "approval":
179
+ return W();
180
+ }
181
+ }
182
+ function _e(f, u) {
183
+ p.value = {
184
+ startDate: f,
185
+ endDate: u
186
+ }, ae();
187
+ }
188
+ s.watchLocation(async (f) => {
189
+ if (!f) {
190
+ c.value = [];
191
+ return;
192
+ }
193
+ await ae();
194
+ });
195
+ const Z = B(), fe = B(Math.random().toString());
196
+ async function X(f, u) {
197
+ var o, A;
198
+ const t = Math.random().toString();
199
+ fe.value = t;
200
+ const e = m === "receive/request" ? s.currentLocation : u == null ? void 0 : u.to, a = {
201
+ poRequest: u,
202
+ purchaseOrder: f,
203
+ transferTo: e == null ? void 0 : e.name,
204
+ transferToDbName: e == null ? void 0 : e.dbName,
205
+ show: !0,
206
+ canResubmit: !1,
207
+ canApprove: m === "approval",
208
+ "onUpdate:show"(O) {
209
+ Z.value.show = O;
210
+ }
211
+ };
212
+ if (Z.value = a, !(u || f.status !== F.enum.REQUESTING)) {
213
+ try {
214
+ u = (await U.readRequests(
215
+ `${f.supplier.internal}_${f.supplier._id}`
216
+ )).find((M) => M.purchaseOrderId === f._id);
217
+ } catch {
218
+ console.error("Error at fetching po request to check");
219
+ }
220
+ t === fe.value && (Z.value.canResubmit = !u, Z.value.transferTo = (o = u == null ? void 0 : u.to) == null ? void 0 : o.name, Z.value.transferToDbName = (A = u == null ? void 0 : u.to) == null ? void 0 : A.dbName);
221
+ }
222
+ }
223
+ async function ne(f, u, t, e) {
224
+ $.value = !0;
225
+ try {
226
+ await U.processPurchaseOrder(
227
+ {
228
+ operation: u,
229
+ doc: f,
230
+ options: (
231
+ // auto receive for supplier to warehouse
232
+ (u === _.enum.confirmDraft || // auto receive for warehouse to warehouse
233
+ u === _.enum.completeReceive) && w.autoReceiveWarehouse ? {
234
+ autoReceive: !0
235
+ } : void 0
236
+ )
237
+ },
238
+ e
239
+ ), await new Promise((A) => setTimeout(A, 1e3));
240
+ const o = be().currentLocationDBName.startsWith("restaurant_");
241
+ u === _.enum.confirmDraft && f.effectiveAt && o ? d.open({
242
+ title: "Success",
243
+ message: `${t}. The backdate will be reflected once your POS has received this change.`,
244
+ type: "success"
245
+ }) : d.open({
246
+ title: "Success",
247
+ message: t,
248
+ type: "success"
249
+ });
250
+ } catch (a) {
251
+ d.open({
252
+ title: "Something went wrong",
253
+ message: "Please try again.",
254
+ type: "error"
255
+ }), console.error("Error when submitting PO operation", u, f, a);
256
+ } finally {
257
+ $.value = !1, ae();
258
+ }
259
+ }
260
+ async function we(f, u, t) {
261
+ const e = Ye[u];
262
+ if (!e) {
263
+ d.open({
264
+ title: "Something went wrong",
265
+ message: `Cannot process order: ${je(u)}`,
266
+ type: "error"
267
+ });
268
+ return;
269
+ }
270
+ const { successMessage: a, ...o } = e;
271
+ i.open({
272
+ title: o.title,
273
+ message: o.message,
274
+ primaryActions: o.primaryActions
275
+ }).onPrimary(() => {
276
+ ne(f, u, a, t);
277
+ });
278
+ }
279
+ return {
280
+ purchaseOrders: c,
281
+ purchaseRequests: g,
282
+ updateDateRange: _e,
283
+ fetchData: ae,
284
+ loading: $,
285
+ transferDialogProps: me,
286
+ promptCreateTransferDialog: Se,
287
+ promptUpdateTransferDialog: ie,
288
+ transferDetailsProps: Z,
289
+ promptShowTransferDetails: X,
290
+ submitAction: we
291
+ };
292
+ }
293
+ function dt(m, R) {
294
+ return R.reduce(
295
+ (s, w) => {
296
+ const S = w.received.find((P) => P.sku._id === m._id);
297
+ return S && (s = Oe(s, S.amount)), s;
298
+ },
299
+ it.toPrecision(he(0), m.unit.precision)
300
+ );
301
+ }
302
+ function mt(m, R) {
303
+ const { name: i, address: s, regNo: w } = R.doc.profile, S = {
304
+ name: i,
305
+ registrationNumber: w,
306
+ line1: s == null ? void 0 : s.line1,
307
+ line2: s == null ? void 0 : s.line2,
308
+ postcode: s == null ? void 0 : s.postcode,
309
+ city: s == null ? void 0 : s.city,
310
+ state: s == null ? void 0 : s.state,
311
+ country: s == null ? void 0 : s.country
312
+ }, P = {
313
+ name: m.supplier.name,
314
+ registrationNumber: m.supplier.registrationNumber,
315
+ line1: m.supplier.address.line1,
316
+ line2: m.supplier.address.line2,
317
+ postcode: m.supplier.address.postcode,
318
+ city: m.supplier.address.city,
319
+ state: m.supplier.address.state,
320
+ country: m.supplier.address.country
321
+ }, $ = m.items.map((p) => {
322
+ const { sku: h, measurement: g } = p, D = le(
323
+ dt(p.sku, m.deliveryOrder || []),
324
+ !1
325
+ );
326
+ return {
327
+ code: h.code,
328
+ description: h.name,
329
+ quantity: He(p.quantity, h.unit, p.measurement),
330
+ unit: (g == null ? void 0 : g.abbrev) || h.unit.abbrev,
331
+ received: D
332
+ };
333
+ }), d = m.deliveryOrder.map((p) => ({
334
+ createdAt: Be(new Date(p.createdAt)),
335
+ ref: p.deliveryOrderNumber,
336
+ remark: p.remark || "",
337
+ items: p.received.map((h) => {
338
+ var g;
339
+ return {
340
+ code: h.sku.code,
341
+ description: h.sku.name,
342
+ quantity: le(h.amount),
343
+ unit: ((g = h.measurement) == null ? void 0 : g.abbrev) || h.sku.unit.abbrev
344
+ };
345
+ })
346
+ })), U = {
347
+ orderNumber: m.seqNumber.toString(),
348
+ createdAt: ge(m._id),
349
+ ref: m.ref || "",
350
+ remark: m.remark || "",
351
+ buyer: S,
352
+ supplier: P,
353
+ items: $,
354
+ status: m.status,
355
+ deliveryOrders: d
356
+ }, c = new URL(window.location.href);
357
+ c.pathname = c.hostname.includes("inventory.feedme") ? "/receive-request/print-preview" : "/inventory/receive-request/print-preview", c.searchParams.append("data", JSON.stringify(U)), window.open(c.href, "_blank", "noreferrer");
358
+ }
359
+ const oe = {
360
+ submitRequest: {
361
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
362
+ color: "text-fm-color-typo-primary",
363
+ value: _.enum.submitRequest
364
+ },
365
+ confirmDraft: {
366
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
367
+ color: "text-fm-color-typo-primary",
368
+ value: _.enum.confirmDraft
369
+ },
370
+ cancelDraft: {
371
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
372
+ color: "text-fm-color-typo-error",
373
+ value: _.enum.cancelDraft
374
+ },
375
+ approveRequest: {
376
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
377
+ color: "text-fm-color-typo-primary",
378
+ value: _.enum.approveRequest
379
+ },
380
+ rejectRequest: {
381
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
382
+ color: "text-fm-color-typo-error",
383
+ value: _.enum.rejectRequest
384
+ },
385
+ processRequest: {
386
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
387
+ color: "text-fm-color-typo-primary",
388
+ value: _.enum.processRequest
389
+ },
390
+ receiveStock: {
391
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
392
+ color: "text-fm-color-typo-primary",
393
+ value: _.enum.receiveStock
394
+ },
395
+ completeReceive: {
396
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
397
+ color: "text-fm-color-typo-primary",
398
+ value: _.enum.completeReceive
399
+ }
400
+ };
401
+ function Kr(m, R) {
402
+ const i = be(), { t: s } = ze();
403
+ function w(c) {
404
+ switch (c.status) {
405
+ case "DRAFT":
406
+ return [
407
+ j[I.Update],
408
+ j[I.Details],
409
+ c.supplier.internal === "restaurant" || c.supplier.internal === "warehouse" ? oe[_.enum.submitRequest] : oe[_.enum.confirmDraft],
410
+ oe[_.enum.cancelDraft],
411
+ j[I.Print]
412
+ ];
413
+ case "RECEIVING":
414
+ return [
415
+ oe[_.enum.completeReceive],
416
+ j[I.Details],
417
+ j[I.Print]
418
+ ];
419
+ case "REQUESTING":
420
+ return m === "receive/request" ? [j[I.Details], j[I.Print]] : [
421
+ oe[_.enum.approveRequest],
422
+ oe[_.enum.rejectRequest],
423
+ j[I.Details],
424
+ j[I.Print]
425
+ ];
426
+ case "PROCESSING":
427
+ return [j[I.Details], j[I.Print]];
428
+ case "COMPLETE":
429
+ case "CANCEL":
430
+ default:
431
+ return [j[I.Details], j[I.Print]];
432
+ }
433
+ }
434
+ function S(c) {
435
+ return Object.values(_.enum).includes(c);
436
+ }
437
+ async function P(c, p, h) {
438
+ var D, G;
439
+ const g = Le(p);
440
+ if (c === I.Print) {
441
+ mt(g, i.currentLocation);
442
+ return;
443
+ }
444
+ if (c === I.Details) {
445
+ R.promptShowTransferDetails(g, h);
446
+ return;
447
+ }
448
+ if (c === I.Update) {
449
+ (D = R.promptUpdateTransferDialog) == null || D.call(R, g);
450
+ return;
451
+ }
452
+ if (S(c)) {
453
+ R.submitAction(p, c, (G = h == null ? void 0 : h.to) == null ? void 0 : G.dbName);
454
+ return;
455
+ }
456
+ }
457
+ function $() {
458
+ return [
459
+ {
460
+ accessorKey: "seqNumber",
461
+ header: () => s("inventory.transfer.table.seqNo"),
462
+ enableSorting: !0,
463
+ size: 80,
464
+ sortUndefined: "last"
465
+ },
466
+ {
467
+ accessorKey: "_id",
468
+ header: () => s("inventory.transfer.table.createdAt"),
469
+ cell(c) {
470
+ return ge(`${c.getValue()}`);
471
+ },
472
+ enableSorting: !0
473
+ },
474
+ {
475
+ accessorKey: "supplier.name",
476
+ header: () => s("inventory.transfer.table.transferFrom"),
477
+ enableSorting: !0,
478
+ size: 200
479
+ },
480
+ {
481
+ accessorKey: "items.length",
482
+ header: () => s("inventory.transfer.table.noOfItems"),
483
+ enableSorting: !1,
484
+ meta: {
485
+ width: "10rem"
486
+ }
487
+ },
488
+ {
489
+ accessorKey: "ref",
490
+ header: () => s("inventory.transfer.table.reference"),
491
+ enableSorting: !1,
492
+ size: "auto"
493
+ },
494
+ {
495
+ accessorKey: "status",
496
+ header: () => s("inventory.transfer.table.status"),
497
+ cell(c) {
498
+ const p = s(`inventory.transfer.status.${c.getValue() ?? ""}`), h = `${c.getValue() ?? ""}`.toLocaleLowerCase("en-us");
499
+ return ee(
500
+ "div",
501
+ {
502
+ class: "flex"
503
+ },
504
+ ee(
505
+ "div",
506
+ {
507
+ class: `fm-status-badge fm-status-badge-${h}`
508
+ },
509
+ p
510
+ )
511
+ );
512
+ },
513
+ enableSorting: !0,
514
+ size: 200
515
+ },
516
+ {
517
+ id: "action",
518
+ cell(c) {
519
+ const p = c.row.original, h = w(p);
520
+ return Ue(h, (g) => P(g, p));
521
+ },
522
+ enableSorting: !1,
523
+ size: 40,
524
+ meta: {
525
+ cellClass: "",
526
+ headerClass: ""
527
+ }
528
+ }
529
+ ];
530
+ }
531
+ function d() {
532
+ return [
533
+ {
534
+ accessorKey: "purchaseOrder.seqNumber",
535
+ header: () => s("inventory.transfer.table.seqNo"),
536
+ enableSorting: !0,
537
+ size: 80,
538
+ sortUndefined: "last"
539
+ },
540
+ {
541
+ accessorKey: "purchaseOrder._id",
542
+ header: () => s("inventory.transfer.table.createdAt"),
543
+ cell(c) {
544
+ return ge(`${c.getValue()}`);
545
+ },
546
+ enableSorting: !0
547
+ },
548
+ {
549
+ accessorKey: "to.name",
550
+ header: () => s("inventory.transfer.table.transferTo"),
551
+ enableSorting: !1,
552
+ size: 200
553
+ },
554
+ {
555
+ accessorKey: "purchaseOrder.items.length",
556
+ header: () => s("inventory.transfer.table.noOfItems"),
557
+ enableSorting: !1
558
+ },
559
+ {
560
+ accessorKey: "purchaseOrder.ref",
561
+ header: () => s("inventory.transfer.table.reference"),
562
+ enableSorting: !1,
563
+ size: "auto"
564
+ },
565
+ {
566
+ accessorKey: "purchaseOrder.status",
567
+ header: () => s("inventory.transfer.table.status"),
568
+ cell(c) {
569
+ const p = s(`inventory.transfer.status.${c.getValue() ?? ""}`), h = `${c.getValue() ?? ""}`.toLocaleLowerCase("en-us");
570
+ return ee(
571
+ "div",
572
+ {
573
+ class: "flex"
574
+ },
575
+ ee(
576
+ "div",
577
+ {
578
+ class: `fm-status-badge fm-status-badge-${h}`
579
+ },
580
+ p
581
+ )
582
+ );
583
+ },
584
+ enableSorting: !0
585
+ },
586
+ {
587
+ id: "action",
588
+ cell(c) {
589
+ const p = c.row.original, h = p.purchaseOrder ? w(p.purchaseOrder) : [];
590
+ return Ue(
591
+ h,
592
+ (g) => p.purchaseOrder ? P(g, p.purchaseOrder, p) : void 0
593
+ );
594
+ },
595
+ enableSorting: !1,
596
+ size: 40,
597
+ meta: {
598
+ cellClass: "",
599
+ headerClass: ""
600
+ }
601
+ }
602
+ ];
603
+ }
604
+ const U = V(() => m === "receive/request" ? $() : d());
605
+ return {
606
+ get columnDefs() {
607
+ return U.value;
608
+ }
609
+ };
610
+ }
611
+ const ft = { class: "flex flex-col gap-16 w-full h-full" }, pt = {
612
+ key: 0,
613
+ class: "flex flex-row-reverse"
614
+ }, vt = { class: "flex justify-between" }, yt = { class: "fm-typo-en-body-lg-600" }, ht = { class: "flex flex-col gap-8" }, bt = { class: "flex flex-col gap-4" }, gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, St = { class: "flex gap-1" }, Rt = { class: "fm-typo-en-body-lg-600" }, _t = {
615
+ key: 0,
616
+ class: "flex flex-col gap-4"
617
+ }, wt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ot = { class: "fm-typo-en-body-lg-600" }, Dt = { class: "flex flex-col gap-4" }, kt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, At = { class: "fm-typo-en-body-lg-600" }, xt = {
618
+ key: 1,
619
+ class: "flex flex-col gap-4"
620
+ }, Nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qt = { class: "fm-typo-en-body-lg-600" }, Pt = {
621
+ key: 2,
622
+ class: "flex flex-col gap-4"
623
+ }, Tt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ct = { class: "fm-typo-en-body-lg-600" }, Et = {
624
+ key: 3,
625
+ class: "flex flex-col gap-4"
626
+ }, $t = { class: "fm-typo-en-body-lg-600" }, It = {
627
+ key: 4,
628
+ class: "flex flex-col gap-4"
629
+ }, Ft = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ut = { class: "fm-typo-en-body-lg-600" }, Mt = {
630
+ key: 5,
631
+ class: "flex flex-col gap-4"
632
+ }, Lt = { class: "fm-typo-en-body-lg-600" }, jt = {
633
+ key: 6,
634
+ class: "flex flex-col gap-4"
635
+ }, Bt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Kt = { class: "fm-typo-en-body-lg-600" }, Vt = {
636
+ key: 7,
637
+ class: "flex flex-col gap-4"
638
+ }, Gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ht = { class: "fm-typo-en-body-lg-600" }, zt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Qt = { class: "flex flex-col gap-8" }, Yt = { class: "fm-typo-en-body-lg-600" }, Wt = { class: "flex w-full gap-4" }, Jt = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Zt = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, Xt = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, er = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, tr = {
639
+ key: 0,
640
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
641
+ }, rr = { class: "py-8" }, sr = { class: "flex justify-end gap-4 items-center" }, ar = { class: "fm-typo-en-body-lg-600" }, nr = {
642
+ key: 2,
643
+ class: "flex-1 xs:w-screen xs:max-w-full"
644
+ }, or = {
645
+ key: 0,
646
+ class: "flex flex-col items-center gap-8 h-full"
647
+ }, lr = ["src"], ir = { class: "fm-typo-en-body-lg-600" }, cr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, ur = {
648
+ key: 1,
649
+ class: "px-4 flex flex-col"
650
+ }, dr = { class: "flex gap-12 content-stretch" }, mr = {
651
+ class: "flex flex-col w-24",
652
+ name: "circles"
653
+ }, fr = { class: "flex-1 flex flex-col items-center" }, pr = { class: "flex-1 flex flex-col items-center" }, vr = {
654
+ class: "py-12 flex flex-col gap-4",
655
+ name: "received-at header"
656
+ }, yr = { class: "fm-typo-en-body-lg-400" }, hr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, br = { class: "flex gap-12 content-stretch" }, gr = {
657
+ class: "flex flex-col w-24",
658
+ name: "circles"
659
+ }, Sr = { class: "flex-1 flex flex-col items-center" }, Rr = {
660
+ class: "py-12 flex flex-col gap-4 flex-1",
661
+ name: "delivery details"
662
+ }, _r = { class: "flex flex-col gap-8" }, wr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Or = { class: "flex flex-col gap-4" }, Dr = { class: "flex gap-8 xs:flex-col" }, Vr = /* @__PURE__ */ We({
663
+ __name: "TransferDetails",
664
+ props: {
665
+ poRequest: {},
666
+ purchaseOrder: {},
667
+ transferTo: {},
668
+ transferToDbName: {},
669
+ show: { type: Boolean },
670
+ canResubmit: { type: Boolean },
671
+ canApprove: { type: Boolean }
672
+ },
673
+ emits: ["update:show", "submitted"],
674
+ setup(m, { emit: R }) {
675
+ const i = m, s = R, w = Ke(), S = Ve(), P = ut(), $ = Ge(), { t: d } = ze(), U = V(
676
+ () => {
677
+ var t, e, a, o;
678
+ return ((e = (t = i.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : e.internal) === "restaurant" || ((o = (a = i.purchaseOrder) == null ? void 0 : a.supplier) == null ? void 0 : o.internal) === "warehouse" ? se.TRANSFER : se.PURCHASE;
679
+ }
680
+ ), c = V(() => {
681
+ var t, e, a;
682
+ return U.value === se.TRANSFER && ((t = i.transferToDbName) == null ? void 0 : t.startsWith("restaurant")) && ((a = (e = i.purchaseOrder) == null ? void 0 : e.supplier) == null ? void 0 : a.internal) === "restaurant";
683
+ }), p = [
684
+ {
685
+ label: d("inventory.transfer.receiveRequest.details.overview"),
686
+ value: "overview"
687
+ },
688
+ {
689
+ label: d("inventory.transfer.receiveRequest.details.deliveryHistory"),
690
+ value: "deliveryHistory"
691
+ }
692
+ ], h = B(p[0]), g = B(!1), D = B(""), G = B(!0), Se = Qe(), ie = st(i, "show");
693
+ async function Re(t, e, a) {
694
+ D.value = e, g.value = !0, G.value = !1;
695
+ try {
696
+ await Se.processPurchaseOrder(
697
+ {
698
+ operation: e,
699
+ doc: t,
700
+ options: (
701
+ // auto receive for supplier to warehouse
702
+ (e === _.enum.confirmDraft || // auto receive for warehouse to warehouse
703
+ e === _.enum.completeReceive) && $.autoReceiveWarehouse ? {
704
+ autoReceive: !0
705
+ } : void 0
706
+ )
707
+ },
708
+ i.transferToDbName
709
+ ), await new Promise((o) => setTimeout(o, 1e3)), S.open({
710
+ title: "Success",
711
+ message: a,
712
+ type: "success"
713
+ }), s("update:show", !1), s("submitted");
714
+ } catch (o) {
715
+ S.open({
716
+ title: "Something went wrong",
717
+ message: "Please try again.",
718
+ type: "error"
719
+ }), console.error("Error when submitting PO operation", e, t, o);
720
+ } finally {
721
+ D.value = "", g.value = !1, G.value = !0;
722
+ }
723
+ }
724
+ async function W(t) {
725
+ const e = Ye[t];
726
+ if (!e) {
727
+ S.open({
728
+ title: "Something went wrong",
729
+ message: `Cannot process order: ${je(t)}`,
730
+ type: "error"
731
+ });
732
+ return;
733
+ }
734
+ const { successMessage: a, ...o } = e;
735
+ w.open({
736
+ title: o.title,
737
+ message: o.message,
738
+ primaryActions: o.primaryActions
739
+ }).onPrimary(() => {
740
+ i.purchaseOrder && Re(i.purchaseOrder, t, a);
741
+ });
742
+ }
743
+ const ae = V(() => {
744
+ var t, e;
745
+ return ((t = i.purchaseOrder) == null ? void 0 : t.status) === F.enum.RECEIVING || ((e = i.purchaseOrder) == null ? void 0 : e.status) === F.enum.COMPLETE;
746
+ }), _e = V(
747
+ () => {
748
+ var t, e, a, o, A, O;
749
+ return P.getLocationSubsidiary(
750
+ ((a = (e = (t = i.purchaseOrder) == null ? void 0 : t.netSuite) == null ? void 0 : e.subsidiary) == null ? void 0 : a.id) || ((O = (A = (o = i.poRequest) == null ? void 0 : o.netSuite) == null ? void 0 : A.subsidiary) == null ? void 0 : O.id)
751
+ ).fullName;
752
+ }
753
+ ), Z = V(() => {
754
+ var t, e, a, o, A, O;
755
+ return (e = (t = i.purchaseOrder) == null ? void 0 : t.deliveryFullfillment) != null && e.length && ((o = (a = i.purchaseOrder) == null ? void 0 : a.deliveryFullfillment) == null ? void 0 : o.length) > 0 ? (O = (A = i.purchaseOrder) == null ? void 0 : A.deliveryFullfillment) == null ? void 0 : O.map((M) => {
756
+ var l;
757
+ return (l = M.netSuite) == null ? void 0 : l.refNo;
758
+ }).join(", ") : "-";
759
+ }), fe = V(() => {
760
+ var O, M, l;
761
+ const a = (((O = i.purchaseOrder) == null ? void 0 : O.deliveryOrder) ?? []).flatMap((N) => N.received ?? []).reduce(
762
+ (N, L) => {
763
+ const K = N[L.sku._id] ?? [];
764
+ return N[L.sku._id] = [...K, L], N;
765
+ },
766
+ {}
767
+ ), o = Object.entries(a).reduce(
768
+ (N, [L, K]) => {
769
+ const x = K.reduce((b, T) => {
770
+ const C = lt(
771
+ b,
772
+ Math.max(b.precision, T.amount.precision)
773
+ );
774
+ return Oe(C, T.amount);
775
+ }, he(0));
776
+ return N[L] = x, N;
777
+ },
778
+ {}
779
+ ), A = ((M = i.purchaseOrder) == null ? void 0 : M.items) ?? [];
780
+ for (const N of A)
781
+ o[l = N.sku._id] ?? (o[l] = he(0));
782
+ return o;
783
+ }), X = V(() => {
784
+ var O, M;
785
+ const t = ((O = i.purchaseOrder) == null ? void 0 : O.deliveryOrder) ?? [], e = ((M = i.purchaseOrder) == null ? void 0 : M.deliveryFullfillment) ?? [], a = [
786
+ ...t.map((l) => ({
787
+ createdAt: l.createdAt,
788
+ type: "grn",
789
+ doc: l
790
+ })),
791
+ ...e.map((l) => ({
792
+ createdAt: l.createdAt,
793
+ type: "fulfillment",
794
+ doc: l
795
+ }))
796
+ ];
797
+ a.reverse().sort((l, N) => l.createdAt.localeCompare(N.createdAt));
798
+ function o(l) {
799
+ var L, K, x, b, T, C, H;
800
+ const N = e.findIndex((E) => E.id === l.fullfillmentId);
801
+ return {
802
+ header: "Received",
803
+ date: Ie(new Date(l.createdAt)),
804
+ info: [
805
+ {
806
+ label: "Received by",
807
+ values: [(L = l.createdBy) == null ? void 0 : L.name]
808
+ },
809
+ {
810
+ label: "Received items",
811
+ values: l.received.map((E) => {
812
+ var z;
813
+ return `(${E.sku.code}) ${E.sku.name}: ${le(E.amount, !1)} ${((z = E.measurement) == null ? void 0 : z.abbrev) ?? E.sku.unit.abbrev}`;
814
+ })
815
+ },
816
+ l.deliveryOrderNumber ? {
817
+ label: "Delivery order no.",
818
+ values: [l.deliveryOrderNumber]
819
+ } : null,
820
+ l.remark ? {
821
+ label: "Remark",
822
+ values: [l.remark]
823
+ } : null,
824
+ N > -1 ? {
825
+ label: "Fulfilment's sequence",
826
+ values: [`${N + 1}`]
827
+ } : null,
828
+ (x = (K = e[N]) == null ? void 0 : K.netSuite) != null && x.refNo ? {
829
+ label: "Fulfillment's ref no. (Netsuite)",
830
+ values: [(T = (b = e[N]) == null ? void 0 : b.netSuite) == null ? void 0 : T.refNo]
831
+ } : null,
832
+ (C = l == null ? void 0 : l.netSuite) != null && C.refNo ? {
833
+ label: "Item receipt (Netsuite)",
834
+ values: [(H = l == null ? void 0 : l.netSuite) == null ? void 0 : H.refNo]
835
+ } : null
836
+ ].filter((E) => E)
837
+ };
838
+ }
839
+ function A(l) {
840
+ var L, K;
841
+ const N = e.findIndex((x) => x.id === l.id);
842
+ return {
843
+ header: "Fulfillment",
844
+ date: Ie(new Date(l.createdAt)),
845
+ info: [
846
+ {
847
+ label: "Sequence",
848
+ values: [String(N + 1)]
849
+ },
850
+ {
851
+ label: "Receiveable items",
852
+ values: l.items.map((x) => {
853
+ var b;
854
+ return `(${x.sku.code}) ${x.sku.name}: ${le(x.amount, !1)} ${((b = x.measurement) == null ? void 0 : b.abbrev) ?? x.sku.unit.abbrev}`;
855
+ })
856
+ },
857
+ (L = l.netSuite) != null && L.refNo ? {
858
+ label: "Ref no. (Netsuite)",
859
+ values: [(K = l.netSuite) == null ? void 0 : K.refNo]
860
+ } : null
861
+ ].filter((x) => x)
862
+ };
863
+ }
864
+ return a.map((l) => {
865
+ switch (l.type) {
866
+ case "grn":
867
+ return o(l.doc);
868
+ case "fulfillment":
869
+ return A(l.doc);
870
+ }
871
+ });
872
+ }), ne = B(!1), we = V(() => {
873
+ var o, A, O;
874
+ let t = !0;
875
+ P.isEnabled || (t = !1);
876
+ const e = i.purchaseOrder, a = i.poRequest;
877
+ return e && ((e == null ? void 0 : e.status) !== F.enum.REQUESTING && e.supplier.internal && (t = !1), !a && !((o = e == null ? void 0 : e.netSuite) != null && o.id) && (t = !1), !a && ((A = e == null ? void 0 : e.netSuite) != null && A.id) && (e == null ? void 0 : e.status) == F.enum.REQUESTING && (t = !1)), a && ((O = a == null ? void 0 : a.netSuite) != null && O.id || (t = !1)), c.value && (t = !1), t;
878
+ });
879
+ async function f() {
880
+ ne.value || w.open({
881
+ title: "Sync with NetSuite",
882
+ contentComponent: ee("div", [
883
+ ee("p", "Are you sure you want to sync now?"),
884
+ ee("br"),
885
+ ee(
886
+ "p",
887
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
888
+ "Please wait a moment before syncing manually to avoid unnecessary actions."
889
+ )
890
+ ]),
891
+ primaryActions: {
892
+ text: "Sync",
893
+ close: !0,
894
+ variant: "destructive"
895
+ },
896
+ secondaryActions: { text: "Not now", close: !0 }
897
+ }).onPrimary(async () => {
898
+ var t, e, a, o, A;
899
+ try {
900
+ ne.value = !0;
901
+ const O = (e = (t = i.purchaseOrder) == null ? void 0 : t.netSuite) != null && e.id && ((a = i.purchaseOrder) == null ? void 0 : a.status) !== F.enum.REQUESTING ? "purchaseOrder" : "purchaseOrderRequest", M = O === "purchaseOrder" ? (o = i.purchaseOrder) == null ? void 0 : o._id : (A = i.poRequest) == null ? void 0 : A._id;
902
+ if (!M) {
903
+ S.open({
904
+ title: "Error",
905
+ message: "Invalid sync ID",
906
+ type: "error"
907
+ });
908
+ return;
909
+ }
910
+ await P.syncTransferOrder(O, M), S.open({
911
+ title: "Sync with NetSuite",
912
+ message: "Requested to sync with NetSuite. Please wait a moment.",
913
+ type: "success"
914
+ });
915
+ } catch {
916
+ S.open({
917
+ title: "Error",
918
+ message: "Failed to sync with NetSuite",
919
+ type: "error"
920
+ });
921
+ }
922
+ setTimeout(() => {
923
+ ne.value = !1;
924
+ }, 5e3);
925
+ });
926
+ }
927
+ const u = V(() => {
928
+ var e;
929
+ const t = {
930
+ ...he(0),
931
+ currency: $e()
932
+ };
933
+ return ((e = i.purchaseOrder) == null ? void 0 : e.items.reduce((a, o) => ({
934
+ ...Oe(a, o.totalCost ?? t),
935
+ currency: $e()
936
+ }), t)) ?? t;
937
+ });
938
+ return (t, e) => {
939
+ var L, K;
940
+ const a = te("FmButton"), o = te("FmButtonGroup"), A = te("FmChip"), O = te("FmMenuDivider"), M = te("FmCard"), l = te("FmSpacer"), N = te("FmSideSheet");
941
+ return y(), J(N, {
942
+ header: n(d)("inventory.transfer.receiveRequest.details.title") + ((L = t.purchaseOrder) != null && L.seqNumber ? ` #${(K = t.purchaseOrder) == null ? void 0 : K.seqNumber}` : ""),
943
+ modelValue: n(ie),
944
+ "onUpdate:modelValue": e[9] || (e[9] = (x) => Je(ie) ? ie.value = x : null),
945
+ "dismiss-away": G.value,
946
+ "close-button": "",
947
+ "max-width": 600
948
+ }, {
949
+ default: pe(() => {
950
+ var x;
951
+ return [
952
+ r("div", ft, [
953
+ we.value ? (y(), k("div", pt, [
954
+ Y(a, {
955
+ "prepend-icon": "sync",
956
+ variant: "primary",
957
+ label: "NetSuite",
958
+ loading: ne.value,
959
+ onClick: f
960
+ }, null, 8, ["loading"])
961
+ ])) : q("", !0),
962
+ r("div", null, [
963
+ Y(o, {
964
+ items: p,
965
+ modelValue: h.value,
966
+ "onUpdate:modelValue": e[0] || (e[0] = (b) => h.value = b)
967
+ }, null, 8, ["modelValue"])
968
+ ]),
969
+ h.value.value === "overview" ? (y(), k(re, { key: 1 }, [
970
+ r("div", null, [
971
+ Y(M, {
972
+ variant: "outlined",
973
+ class: "flex flex-col gap-8 px-12 py-16"
974
+ }, {
975
+ default: pe(() => {
976
+ var b, T, C, H, E, z, ce, ue, de, Q, De, ke, Ae, xe, Ne, qe, Pe, Te, Ce, Ee;
977
+ return [
978
+ r("div", vt, [
979
+ r("div", yt, v(n(d)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
980
+ r("div", null, [
981
+ Y(A, {
982
+ label: n(d)(`inventory.transfer.status.${(b = t.purchaseOrder) == null ? void 0 : b.status}`),
983
+ class: ve(`fm-status-badge fm-status-badge-${(C = (T = t.purchaseOrder) == null ? void 0 : T.status) == null ? void 0 : C.toLocaleLowerCase("en-us")}`),
984
+ compact: ""
985
+ }, null, 8, ["label", "class"])
986
+ ])
987
+ ]),
988
+ Y(O),
989
+ r("div", ht, [
990
+ r("div", bt, [
991
+ r("div", gt, [
992
+ r("div", St, v(n(d)("inventory.transfer.receiveRequest.details.createdAt")), 1)
993
+ ]),
994
+ r("div", Rt, v(n(ge)(((H = t.purchaseOrder) == null ? void 0 : H._id) ?? "")), 1)
995
+ ]),
996
+ (E = t.purchaseOrder) != null && E.effectiveAt ? (y(), k("div", _t, [
997
+ r("div", wt, v(n(d)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
998
+ r("div", Ot, v(n(Be)(new Date((z = t.purchaseOrder) == null ? void 0 : z.effectiveAt))), 1)
999
+ ])) : q("", !0),
1000
+ r("div", Dt, [
1001
+ r("div", kt, v(n(d)("inventory.transfer.receiveRequest.details.type.title")), 1),
1002
+ r("div", At, v(n(d)(
1003
+ `inventory.transfer.receiveRequest.details.type.${U.value.toLocaleLowerCase("en-US")}`
1004
+ )), 1)
1005
+ ]),
1006
+ (ue = (ce = t.purchaseOrder) == null ? void 0 : ce.supplier) != null && ue.name ? (y(), k("div", xt, [
1007
+ r("div", Nt, v(n(d)("inventory.transfer.receiveRequest.details.from")), 1),
1008
+ r("div", qt, v((Q = (de = t.purchaseOrder) == null ? void 0 : de.supplier) == null ? void 0 : Q.name), 1)
1009
+ ])) : q("", !0),
1010
+ t.transferTo ? (y(), k("div", Pt, [
1011
+ r("div", Tt, v(n(d)("inventory.transfer.receiveRequest.details.to")), 1),
1012
+ r("div", Ct, v(t.transferTo), 1)
1013
+ ])) : q("", !0),
1014
+ n(P).isEnabled ? (y(), k("div", Et, [
1015
+ e[10] || (e[10] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite subsidiary ", -1)),
1016
+ r("div", $t, v(_e.value || "-"), 1)
1017
+ ])) : q("", !0),
1018
+ n(P).isEnabled && !c.value ? (y(), k("div", It, [
1019
+ r("div", Ft, " NetSuite " + v(U.value === n(se).PURCHASE ? "Purchase order" : "Transfer order") + " (ID) ", 1),
1020
+ r("div", Ut, v(t.poRequest ? (ke = (De = t.poRequest) == null ? void 0 : De.netSuite) == null ? void 0 : ke.refNo : (xe = (Ae = t.purchaseOrder) == null ? void 0 : Ae.netSuite) == null ? void 0 : xe.refNo) + " (" + v(t.poRequest ? (qe = (Ne = t.poRequest) == null ? void 0 : Ne.netSuite) == null ? void 0 : qe.id : (Te = (Pe = t.purchaseOrder) == null ? void 0 : Pe.netSuite) == null ? void 0 : Te.id) + ") ", 1)
1021
+ ])) : q("", !0),
1022
+ n(P).isEnabled && U.value === n(se).TRANSFER && !c.value ? (y(), k("div", Mt, [
1023
+ e[11] || (e[11] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1024
+ r("div", Lt, v(Z.value), 1)
1025
+ ])) : q("", !0),
1026
+ (Ce = t.purchaseOrder) != null && Ce.ref ? (y(), k("div", jt, [
1027
+ r("div", Bt, v(n(d)("inventory.transfer.receiveRequest.details.reference")), 1),
1028
+ r("div", Kt, v(t.purchaseOrder.ref), 1)
1029
+ ])) : q("", !0),
1030
+ (Ee = t.purchaseOrder) != null && Ee.remark ? (y(), k("div", Vt, [
1031
+ r("div", Gt, v(n(d)("inventory.transfer.receiveRequest.details.remark")), 1),
1032
+ r("div", Ht, v(t.purchaseOrder.remark), 1)
1033
+ ])) : q("", !0)
1034
+ ])
1035
+ ];
1036
+ }),
1037
+ _: 1
1038
+ })
1039
+ ]),
1040
+ r("div", zt, [
1041
+ r("div", Qt, [
1042
+ r("div", Yt, v(ae.value ? n(d)("inventory.transfer.receiveRequest.details.receivedItems") : n(d)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
1043
+ (y(!0), k(re, null, ye(((x = t.purchaseOrder) == null ? void 0 : x.items) ?? [], (b) => (y(), k("div", {
1044
+ key: b.code,
1045
+ class: "flex flex-col"
1046
+ }, [
1047
+ r("div", Wt, [
1048
+ r("div", Jt, v(b.name), 1),
1049
+ r("div", Zt, v(n(le)(fe.value[b.sku._id], !1)) + "/" + v(n(He)(b.quantity, b.sku.unit, b.measurement)), 1)
1050
+ ]),
1051
+ r("div", Xt, [
1052
+ r("div", er, v(b.code), 1),
1053
+ b.totalCost && n($).enableTotalCost ? (y(), k("div", tr, " (" + v(n(Me)(b.totalCost)) + ") ", 1)) : q("", !0)
1054
+ ])
1055
+ ]))), 128)),
1056
+ +n(le)(u.value) ? (y(), k(re, { key: 0 }, [
1057
+ r("div", rr, [
1058
+ Y(O)
1059
+ ]),
1060
+ r("div", sr, [
1061
+ e[12] || (e[12] = r("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
1062
+ r("div", ar, v(n(Me)(u.value)), 1)
1063
+ ])
1064
+ ], 64)) : q("", !0)
1065
+ ])
1066
+ ])
1067
+ ], 64)) : q("", !0),
1068
+ h.value.value === "deliveryHistory" ? (y(), k("div", nr, [
1069
+ X.value.length ? (y(), k("div", ur, [
1070
+ (y(!0), k(re, null, ye(X.value, (b, T) => (y(), k(re, { key: T }, [
1071
+ r("div", dr, [
1072
+ r("div", mr, [
1073
+ r("div", fr, [
1074
+ r("div", {
1075
+ class: ve([
1076
+ {
1077
+ "bg-fm-color-primary": T !== 0,
1078
+ "bg-white": T === 0
1079
+ },
1080
+ "w-[2px] h-full"
1081
+ ])
1082
+ }, null, 2)
1083
+ ]),
1084
+ e[13] || (e[13] = r("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1085
+ r("div", pr, [
1086
+ r("div", {
1087
+ class: ve([
1088
+ {
1089
+ "bg-fm-color-primary": T < X.value.length - 1,
1090
+ "bg-white": T >= X.value.length - 1
1091
+ },
1092
+ "w-[2px] h-full"
1093
+ ])
1094
+ }, null, 2)
1095
+ ])
1096
+ ]),
1097
+ r("div", vr, [
1098
+ r("div", yr, v(b.header), 1),
1099
+ r("div", hr, v(b.date), 1)
1100
+ ])
1101
+ ]),
1102
+ r("div", br, [
1103
+ r("div", gr, [
1104
+ r("div", Sr, [
1105
+ r("div", {
1106
+ class: ve([
1107
+ {
1108
+ "bg-fm-color-primary": T < X.value.length - 1,
1109
+ "bg-white": T >= X.value.length - 1
1110
+ },
1111
+ "w-[2px] h-full"
1112
+ ])
1113
+ }, null, 2)
1114
+ ])
1115
+ ]),
1116
+ r("div", Rr, [
1117
+ Y(M, {
1118
+ variant: "outlined",
1119
+ class: "py-12 px-16"
1120
+ }, {
1121
+ default: pe(() => [
1122
+ r("div", _r, [
1123
+ (y(!0), k(re, null, ye(b.info, (C, H) => (y(), k("div", {
1124
+ key: H,
1125
+ class: "flex flex-col gap-4"
1126
+ }, [
1127
+ r("div", wr, v(C == null ? void 0 : C.label), 1),
1128
+ r("div", Or, [
1129
+ (y(!0), k(re, null, ye(C == null ? void 0 : C.values, (E, z) => (y(), k("div", {
1130
+ key: z,
1131
+ class: "fm-typo-en-body-lg-600"
1132
+ }, v(E), 1))), 128))
1133
+ ])
1134
+ ]))), 128))
1135
+ ])
1136
+ ]),
1137
+ _: 2
1138
+ }, 1024)
1139
+ ])
1140
+ ])
1141
+ ], 64))), 128))
1142
+ ])) : (y(), k("div", or, [
1143
+ Y(l),
1144
+ r("div", null, [
1145
+ r("img", {
1146
+ src: n(ct),
1147
+ alt: "List is empty"
1148
+ }, null, 8, lr)
1149
+ ]),
1150
+ r("div", ir, v(n(d)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
1151
+ r("div", cr, v(n(d)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
1152
+ Y(l),
1153
+ Y(l)
1154
+ ]))
1155
+ ])) : q("", !0)
1156
+ ])
1157
+ ];
1158
+ }),
1159
+ "side-sheet-footer": pe(() => {
1160
+ var x, b, T, C, H, E, z, ce, ue, de;
1161
+ return [
1162
+ r("div", Dr, [
1163
+ ((x = t.purchaseOrder) == null ? void 0 : x.status) === n(F).enum.DRAFT && U.value === n(se).PURCHASE ? (y(), J(a, {
1164
+ key: 0,
1165
+ label: n(d)("inventory.transfer.receiveRequest.actions.confirmDraft"),
1166
+ onClick: e[1] || (e[1] = (Q) => W("confirmDraft")),
1167
+ loading: D.value === "confirmDraft",
1168
+ disabled: D.value !== "confirmDraft" && g.value
1169
+ }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1170
+ ((b = t.purchaseOrder) == null ? void 0 : b.status) === n(F).enum.DRAFT && U.value === n(se).TRANSFER ? (y(), J(a, {
1171
+ key: 1,
1172
+ label: n(d)("inventory.transfer.receiveRequest.actions.submitRequest"),
1173
+ onClick: e[2] || (e[2] = (Q) => W("submitRequest")),
1174
+ loading: D.value === "submitRequest",
1175
+ disabled: D.value !== "submitRequest" && g.value
1176
+ }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1177
+ ((T = t.purchaseOrder) == null ? void 0 : T.status) === n(F).enum.DRAFT ? (y(), J(a, {
1178
+ key: 2,
1179
+ label: n(d)("inventory.transfer.receiveRequest.actions.cancelDraft"),
1180
+ onClick: e[3] || (e[3] = (Q) => W("cancelDraft")),
1181
+ loading: D.value === "cancelDraft",
1182
+ disabled: D.value !== "cancelDraft" && g.value,
1183
+ variant: "destructive"
1184
+ }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1185
+ ((C = t.purchaseOrder) == null ? void 0 : C.status) === n(F).enum.RECEIVING ? (y(), J(a, {
1186
+ key: 3,
1187
+ label: n(d)("inventory.transfer.receiveRequest.actions.completeReceive"),
1188
+ onClick: e[4] || (e[4] = (Q) => W("completeReceive")),
1189
+ loading: D.value === "completeReceive",
1190
+ disabled: D.value !== "completeReceive" && g.value
1191
+ }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1192
+ t.canResubmit ? (y(), J(a, {
1193
+ key: 4,
1194
+ label: n(d)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
1195
+ onClick: e[5] || (e[5] = (Q) => W("submitRequest")),
1196
+ loading: D.value === "submitRequest",
1197
+ disabled: D.value !== "submitRequest" && g.value
1198
+ }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1199
+ (((H = t.purchaseOrder) == null ? void 0 : H.status) === n(F).enum.REQUESTING || ((E = t.purchaseOrder) == null ? void 0 : E.status) === n(F).enum.PROCESSING) && t.canApprove ? (y(), J(a, {
1200
+ key: 5,
1201
+ label: n(d)("inventory.transfer.approval.actions.approveRequest"),
1202
+ onClick: e[6] || (e[6] = (Q) => W("approveRequest")),
1203
+ loading: D.value === "approveRequest",
1204
+ disabled: D.value !== "approveRequest" && g.value
1205
+ }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1206
+ ((z = t.purchaseOrder) == null ? void 0 : z.status) === n(F).enum.REQUESTING && t.canApprove ? (y(), J(a, {
1207
+ key: 6,
1208
+ label: n(d)("inventory.transfer.approval.actions.rejectRequest"),
1209
+ onClick: e[7] || (e[7] = (Q) => W("rejectRequest")),
1210
+ loading: D.value === "rejectRequest",
1211
+ disabled: D.value !== "rejectRequest" && g.value,
1212
+ variant: "destructive"
1213
+ }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1214
+ ((ce = t.purchaseOrder) == null ? void 0 : ce.status) !== n(F).enum.COMPLETE && ((ue = t.purchaseOrder) == null ? void 0 : ue.status) !== n(F).enum.CANCEL && (((de = t.purchaseOrder) == null ? void 0 : de.status) !== n(F).enum.REQUESTING || t.canApprove) ? (y(), J(a, {
1215
+ key: 7,
1216
+ label: n(d)("common.close"),
1217
+ variant: "tertiary",
1218
+ onClick: e[8] || (e[8] = (Q) => s("update:show", !1))
1219
+ }, null, 8, ["label"])) : q("", !0)
1220
+ ])
1221
+ ];
1222
+ }),
1223
+ _: 1
1224
+ }, 8, ["header", "modelValue", "dismiss-away"]);
1225
+ };
1226
+ }
1227
+ });
1228
+ export {
1229
+ Vr as _,
1230
+ Br as a,
1231
+ Kr as b,
1232
+ dt as g,
1233
+ Qe as u
1234
+ };