@feedmepos/mf-inventory-portal 0.0.25-dev.9 → 0.0.26-dev.1

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