@feedmepos/mf-inventory-portal 0.0.24-dev.3 → 0.0.24-dev.49

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