@feedmepos/mf-inventory-portal 0.0.23-dev.5 → 0.0.23-dev.7

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