@feedmepos/mf-inventory-portal 0.0.25-dev.4 → 0.0.25-dev.42

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