@feedmepos/mf-inventory-portal 0.0.22-dev.4 → 0.0.22-dev.40

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