@feedmepos/mf-inventory-portal 1.2.2-dev.1 → 1.2.2-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/{App-C9XQOsrP.js → App-DAab61Y3.js} +1 -1
  2. package/dist/{ApprovalView-1GBi8VK8.js → ApprovalView-BDt_IdgV.js} +2 -2
  3. package/dist/{BindingsDialog-D1jgrgHp.js → BindingsDialog-FF8USPP4.js} +2 -2
  4. package/dist/{BindingsPicker-BWpkVmRH.js → BindingsPicker-KFcppldz.js} +1 -1
  5. package/dist/{BindingsTable-C3a5rQsU.js → BindingsTable-jwQ801Fk.js} +1 -1
  6. package/dist/{ClosingDraftView-M1VZ7Ubp.js → ClosingDraftView-CYPkcKxk.js} +2 -2
  7. package/dist/{ClosingTemplateView-ubVOShkx.js → ClosingTemplateView-1UuB2aef.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-D8k7olwU.js → DeliveryOrderPrintPreview-NnfinFpy.js} +1 -1
  9. package/dist/FmAdminBadge-wjcRz0_J.js +44 -0
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BzWLBxUC.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CUlu-YXe.js} +3 -3
  11. package/dist/{FmMultiselectDialog-DZlmvlH-.js → FmMultiselectDialog-Bum2P_DE.js} +1 -1
  12. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-qJ57T17v.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CnIQI968.js} +1 -1
  13. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BmWJSWWs.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CqGPRyAt.js} +1 -1
  14. package/dist/{IngredientGroupView-Lc4juIpn.js → IngredientGroupView-C7Z3zbzK.js} +2 -2
  15. package/dist/{IngredientsView-B7ilCUo1.js → IngredientsView-C8vAKCQU.js} +4 -4
  16. package/dist/{IntegrationView-CBbQi9eX.js → IntegrationView-BB-_EU26.js} +1282 -1267
  17. package/dist/{InventoryBindingForm-BYDnLY-B.js → InventoryBindingForm-Rjs3yODh.js} +1 -1
  18. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DB_91rQK.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-D9vjJDxP.js} +3 -3
  19. package/dist/{InventoryBindingSummary-CLk6_myJ.js → InventoryBindingSummary-BNy7uiUu.js} +1 -1
  20. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-TERMQx9m.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BApjHkbC.js} +1 -1
  21. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DMS_1RZd.js → PremiumBadge.vue_vue_type_script_setup_true_lang-C7wG_6bX.js} +1 -1
  22. package/dist/{PublishView-BzYVIzVH.js → PublishView-Btmo1Exg.js} +8 -8
  23. package/dist/{PurchaseOrderPrintPreview-DkhYCWlU.js → PurchaseOrderPrintPreview-DahOAnSq.js} +1 -1
  24. package/dist/{ReceiveRequestView-DYfMcV1P.js → ReceiveRequestView-DpLlm9By.js} +8 -8
  25. package/dist/{RecipeView-0v-PiaZL.js → RecipeView-BS3oR694.js} +3 -3
  26. package/dist/{StockView-DmVv6yZd.js → StockView-A1vau_vI.js} +837 -838
  27. package/dist/{SupplierView-EFvZjuXh.js → SupplierView-A-m1kPUl.js} +3 -3
  28. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BgOY6LqL.js +2494 -0
  29. package/dist/{TransferTemplateView-B6dh3lAb.js → TransferTemplateView-BZMpQ0E_.js} +6 -6
  30. package/dist/{UnitView-Dwg-DzVw.js → UnitView-Bn6Kx8tl.js} +3 -3
  31. package/dist/{WarehouseView-DL0AMn3R.js → WarehouseView-0nCmwtBo.js} +1 -1
  32. package/dist/api/food-market-hub.d.ts +1 -1
  33. package/dist/api/inventory.d.ts +18 -18
  34. package/dist/api/netsuite.d.ts +19 -18
  35. package/dist/app-FwO7QbKs.js +153774 -0
  36. package/dist/app.d.ts +8 -8
  37. package/dist/app.js +1 -1
  38. package/dist/components/FmAdminBadge.vue.d.ts +1 -4
  39. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +7 -7
  40. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
  41. package/dist/components/shell/inventory/binding-ui.vue.d.ts +4 -4
  42. package/dist/{decimal-eRlOd74V.js → decimal-CRt-kBvR.js} +1 -1
  43. package/dist/{format-unit-display-CYusbGmI.js → format-unit-display-C9RjXfAz.js} +2 -2
  44. package/dist/{index-BxmvJ-ui.js → index-B18gU7C5.js} +1 -1
  45. package/dist/{index-khYeCDt1.js → index-B8xXPx48.js} +1 -1
  46. package/dist/{stock-B0suhBSW.js → stock-CJ8thbAt.js} +1 -1
  47. package/dist/stores/integration/foodmarkethub.d.ts +1 -1
  48. package/dist/stores/integration/netsuite.d.ts +9 -9
  49. package/dist/stores/inventory.d.ts +37 -37
  50. package/dist/stores/supplier.d.ts +24 -24
  51. package/dist/stores/warehouse.d.ts +1 -2
  52. package/dist/style.css +1 -1
  53. package/dist/{supplier-JDcv1lRx.js → supplier-Ci3-VSI6.js} +1 -1
  54. package/dist/tsconfig.app.tsbuildinfo +1 -1
  55. package/dist/{use-ingredient-select-dialog-w6dHX9B4.js → use-ingredient-select-dialog-B4k3p-nd.js} +1 -1
  56. package/dist/{use-inventory-binding-dialog--7QT5_-Q.js → use-inventory-binding-dialog-B7HiDfIi.js} +1 -1
  57. package/dist/views/adjustment-template/wastage-template/actions.d.ts +12 -12
  58. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +2 -2
  59. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +1 -1
  60. package/dist/views/adjustment-template/wastage-template/table.d.ts +12 -12
  61. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +32 -32
  62. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +96 -96
  63. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +3 -3
  64. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +36 -36
  65. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +36 -36
  66. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
  67. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +6 -6
  68. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +4 -4
  69. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +3 -3
  70. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +2 -2
  71. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +2 -2
  72. package/dist/views/integration/components/netsuite/InventoryTransfer.vue.d.ts +2 -2
  73. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +10 -10
  74. package/dist/views/integration/components/netsuite/PurchaseOrder.vue.d.ts +2 -2
  75. package/dist/views/integration/components/netsuite/TransferOrder.vue.d.ts +2 -2
  76. package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +6 -6
  77. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +2 -2
  78. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +450 -94
  79. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +10 -10
  80. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +20 -20
  81. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +5 -5
  82. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +111 -22
  83. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +669 -135
  84. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +780 -157
  85. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
  86. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +10 -10
  87. package/dist/views/stock/components/dialog/AmendAdjustmentForm.vue.d.ts +4 -4
  88. package/dist/views/supplier/components/SupplierForm.vue.d.ts +2 -2
  89. package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +2 -2
  90. package/dist/views/supplier/composables/use-supplier-table.d.ts +1 -1
  91. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +12 -12
  92. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +8 -8
  93. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +10 -10
  94. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +4 -4
  95. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +5 -5
  96. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +15 -15
  97. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +72 -72
  98. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +72 -72
  99. package/dist/views/unit/components/unit-form/UnitForm.vue.d.ts +2 -2
  100. package/dist/views/unit/components/unit-summary/UnitSummary.vue.d.ts +2 -2
  101. package/dist/views/unit/composables/use-unit-table.d.ts +1 -1
  102. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +2 -4
  103. package/package.json +1 -1
  104. package/dist/FmAdminBadge-BFDkedmh.js +0 -34
  105. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-B7Y2vAlL.js +0 -2336
  106. package/dist/app-D6kqZa_9.js +0 -130114
@@ -0,0 +1,2494 @@
1
+ import { a3 as gt, u as ge, aS as k, aT as Be, aA as W, c as Ve, b as Ue, ab as _t, ad as St, ae as wt, aU as Rt, e as nt, f as ct, a0 as Je, aV as xt, a8 as ut, T as dt, j as be, a6 as Ot, aW as mt, ai as Le, h as at, i as oe, D as ce, aX as ft, aY as pt, aZ as Ae, a_ as ze, ay as it, a$ as Se, Q as De, aa as Fe, a4 as Ge, a5 as Nt } from "./app-FwO7QbKs.js";
2
+ import { ref as z, computed as re, h as C, defineComponent as Re, reactive as $t, onMounted as yt, resolveComponent as Z, openBlock as y, createBlock as ue, withCtx as se, createElementVNode as e, createVNode as F, unref as S, createElementBlock as R, toDisplayString as w, createCommentVNode as H, Fragment as ae, renderList as he, createTextVNode as Ne, normalizeClass as Te, watch as kt, isRef as Ct, resolveDynamicComponent as At } from "vue";
3
+ import { F as Dt } from "./decimal-CRt-kBvR.js";
4
+ import { useCoreStore as Me, useI18n as vt } from "@feedmepos/mf-common";
5
+ import { useDialog as et, useSnackbar as Ke, components as Ye, FmButtonVariant as le, useProxiedModel as qt } from "@feedmepos/ui-library";
6
+ import { F as $e } from "./FmAdminBadge-wjcRz0_J.js";
7
+ import { b as Tt, u as Pt, P as we, f as It } from "./format-unit-display-C9RjXfAz.js";
8
+ import { E as Ft } from "./empty-placeholder-wf6-BWE8.js";
9
+ import { _ as Lt, F as Et, a as Bt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-CnIQI968.js";
10
+ import { u as Vt, R as lt } from "./usePromise-CbVUCxhj.js";
11
+ import { u as Ut } from "./index-B18gU7C5.js";
12
+ const je = gt((h, t) => {
13
+ const s = ge(), _ = Me();
14
+ return {
15
+ async readRequests(i, r, d) {
16
+ const n = i ?? s.currentLocationDBName, o = `${h.inventoryBackendUrl}/${n}/purchase-request`;
17
+ return r && d ? await t.get(`${o}?startDate=${r}&endDate=${d}`) : await t.get(o);
18
+ },
19
+ async readRequestById(i, r) {
20
+ const d = r ?? s.currentLocationDBName, n = `${h.inventoryBackendUrl}/${d}/purchase-request/${i}`;
21
+ return await t.get(n);
22
+ },
23
+ async readRequestByIds(i, r) {
24
+ const d = r ?? s.currentLocationDBName, n = `${h.inventoryBackendUrl}/${d}/purchase-request/find`;
25
+ return await t.post(n, { requestIds: i });
26
+ },
27
+ async getPurchaseOrders({
28
+ start: i,
29
+ end: r
30
+ }) {
31
+ const d = s.currentLocationDBName, n = `${h.inventoryBackendUrl}/${d}/purchase-order`;
32
+ return await t.get(`${n}?start=${i}&end=${r}`);
33
+ },
34
+ async getLatestPurchaseOrderRequest(i) {
35
+ const r = s.currentLocationDBName, d = `${h.inventoryBackendUrl}/${r}/purchase-request/find-by-purchase-order-id`;
36
+ return await t.get(`${d}/${i}`);
37
+ },
38
+ async getPurchaseOrderById(i) {
39
+ const r = s.currentLocationDBName, d = `${h.inventoryBackendUrl}/${r}/purchase-order`;
40
+ return await t.get(`${d}/${i}`);
41
+ },
42
+ /**
43
+ * @deprecated Use `processPurchaseOrderV2` instead.
44
+ */
45
+ async processPurchaseOrder(i, r) {
46
+ const d = s.currentLocationDBName, n = r || d, o = `${h.inventoryBackendUrl}/${n}/purchase-order/run-operation`;
47
+ return await t.put(o, i);
48
+ },
49
+ async createPurchaseOrder(i) {
50
+ const r = s.currentLocationDBName, d = `${h.inventoryBackendUrl}/${r}/purchase-order`;
51
+ return await t.post(d, i);
52
+ },
53
+ async updatePurchaseOrder(i) {
54
+ const r = s.currentLocationDBName, d = `${h.inventoryBackendUrl}/${r}/purchase-order`;
55
+ return await t.put(d, i);
56
+ },
57
+ async importFromXilnex(i) {
58
+ const r = s.currentLocationDBName, d = `${h.inventoryBackendUrl}/${r}/purchase-order/import-from-xilnex`;
59
+ return await t.post(d, i);
60
+ },
61
+ async processPurchaseOrderV2(i, r) {
62
+ const d = s.currentLocationDBName, n = r || d, o = `${h.inventoryBackendUrl}/${n}/v2/purchase-order/run-operation`;
63
+ return await t.put(o, i);
64
+ },
65
+ async getWorkflowConfig() {
66
+ var n;
67
+ const r = `business_${(n = _.currentBusiness.value) == null ? void 0 : n._id}`, d = `${h.inventoryBackendUrl}/${r}/v2/purchase-order/workflow-config`;
68
+ return await t.get(d);
69
+ }
70
+ };
71
+ }), ht = {
72
+ [k.enum.confirmDraft]: {
73
+ primaryActions: {
74
+ text: "Confirm draft",
75
+ close: !0
76
+ },
77
+ title: "Confirm draft?",
78
+ message: "Purchase order cannot be changed after confirm draft.",
79
+ successMessage: "Purchase order draft has been confirmed"
80
+ },
81
+ [k.enum.cancelDraft]: {
82
+ primaryActions: {
83
+ text: "Cancel draft",
84
+ close: !0,
85
+ variant: "destructive"
86
+ },
87
+ title: "Cancel draft?",
88
+ message: "Purchase order cannot be changed after cancelled draft.",
89
+ successMessage: "Purchase order draft has been cancelled"
90
+ },
91
+ [k.enum.submitRequest]: {
92
+ primaryActions: {
93
+ text: "Submit request",
94
+ close: !0
95
+ },
96
+ title: "Confirm draft?",
97
+ message: "Purchase order cannot be changed after confirm draft.",
98
+ successMessage: "Purchase order draft has been submitted"
99
+ },
100
+ [k.enum.completeReceive]: {
101
+ primaryActions: {
102
+ text: "Mark received",
103
+ close: !0
104
+ },
105
+ title: "Mark as received",
106
+ message: "Purchase order cannot be changed after it has complete receiving.",
107
+ successMessage: "Purchase order has been marked as received"
108
+ },
109
+ [k.enum.approveRequest]: {
110
+ primaryActions: {
111
+ text: "Accept request",
112
+ close: !0
113
+ },
114
+ title: "Accept request?",
115
+ message: "Transfer out request will be accepted.",
116
+ successMessage: "Transfer out request has been approved"
117
+ },
118
+ [k.enum.rejectRequest]: {
119
+ primaryActions: {
120
+ text: "Reject request",
121
+ close: !0,
122
+ variant: "destructive"
123
+ },
124
+ title: "Reject request?",
125
+ message: "Purchase order will be rejected.",
126
+ successMessage: "Purchase order has been rejected"
127
+ },
128
+ [k.enum.processRequest]: {
129
+ primaryActions: {
130
+ text: "Process request",
131
+ close: !0,
132
+ variant: "destructive"
133
+ },
134
+ title: "Process request?",
135
+ message: "Purchase order will be processed.",
136
+ successMessage: "Purchase order has been processed"
137
+ }
138
+ };
139
+ function Ee(h) {
140
+ return Be.generatedPOReceivedMap({
141
+ purchaseOrder: h
142
+ });
143
+ }
144
+ function Mt(h) {
145
+ return Be.validatePOItemReceivedStatus({
146
+ dto: h
147
+ });
148
+ }
149
+ function Qe(h) {
150
+ return Be.validatePOReceivedStatus({
151
+ receivedMap: h
152
+ });
153
+ }
154
+ function Xe(h, t, s) {
155
+ if (!W.safeParse(h).success)
156
+ throw new Error(`Invalid purchase order status: ${h}`);
157
+ const _ = W.parse(h);
158
+ return Be.orderStatusCombination({
159
+ status: _,
160
+ isPOPartialReceive: t,
161
+ isPOOverReceive: s
162
+ });
163
+ }
164
+ function bt() {
165
+ const h = ge(), t = je(), s = Ve();
166
+ async function _(r, d) {
167
+ const n = h.currentLocationDBName;
168
+ return r.doc.supplier.internal && r.operation === k.enum.confirmDraft && (r.operation = k.enum.submitRequest), await t.processPurchaseOrder(r, d || n);
169
+ }
170
+ async function i(r, d) {
171
+ const n = h.currentLocationDBName;
172
+ return await t.processPurchaseOrderV2(r, d || n);
173
+ }
174
+ return (r) => s.useOperatePurchaseOrderV2 ? i(r.operateV2, r.transferTo) : _(r.operate, r.transferTo);
175
+ }
176
+ var Ze = /* @__PURE__ */ ((h) => (h.RECEIVE_REQUEST = "receive/request", h.APPROVAL = "approval", h))(Ze || {});
177
+ const qe = z(), He = z();
178
+ function po(h, t) {
179
+ const s = et(), _ = ge(), i = Ve();
180
+ Ue();
181
+ const r = Tt(), d = Pt(), n = z(!1), o = Ke(), v = je(), x = z(new Array()), g = z(
182
+ t != null && t.startDate && (t != null && t.endDate) ? t : _t()
183
+ ), b = re(() => {
184
+ const D = new Date(g.value.startDate), I = new Date(g.value.endDate);
185
+ return {
186
+ start: St(D).toISOString(),
187
+ end: wt(I).toISOString()
188
+ };
189
+ }), p = z(new Array()), l = Rt(), c = z(null);
190
+ async function u(D) {
191
+ function I(G) {
192
+ const ne = {
193
+ mode: nt.CREATE,
194
+ modelValue: D || void 0,
195
+ show: !0,
196
+ "onUpdate:show"(J) {
197
+ qe.value.show = J;
198
+ },
199
+ templateId: G,
200
+ lastClosingDate: c.value
201
+ };
202
+ qe.value = ne;
203
+ }
204
+ let te;
205
+ i.mustUsePoTemplate && !(D != null && D.template) ? s.open({
206
+ title: "Create transfer",
207
+ message: "",
208
+ primaryActions: {
209
+ text: "Select a template",
210
+ close: !0
211
+ },
212
+ secondaryActions: {
213
+ text: "Outlet to Outlet",
214
+ variant: "secondary",
215
+ close: !0
216
+ }
217
+ }).onPrimary(async () => {
218
+ te = await r.getTemplateId(), te && I(te);
219
+ }).onSecondary(() => {
220
+ I(void 0);
221
+ }) : I(te);
222
+ }
223
+ function O(D) {
224
+ const I = {
225
+ mode: nt.UPDATE,
226
+ modelValue: ct(D),
227
+ show: !0,
228
+ "onUpdate:show"(te) {
229
+ qe.value.show = te;
230
+ },
231
+ lastClosingDate: c.value
232
+ };
233
+ qe.value = I;
234
+ }
235
+ async function q() {
236
+ x.value = [], n.value = !0;
237
+ try {
238
+ x.value = await v.getPurchaseOrders(b.value).then((G) => G.sort((ne, J) => J._id.localeCompare(ne._id)));
239
+ const D = await l.readCurrentLocationLastClosing(!0), I = D == null ? void 0 : D._id;
240
+ I && (c.value = xt(I)), await i.awaitFeatureLoaded(() => i.mustUsePoTemplate) && await d.fetchTemplates();
241
+ const te = x.value.map((G) => {
242
+ var ne;
243
+ return ((ne = G.request) == null ? void 0 : ne.id) ?? "";
244
+ }).filter((G) => G);
245
+ p.value = await v.readRequestByIds(te);
246
+ } catch {
247
+ o.open({
248
+ title: "Something went wrong",
249
+ message: "Error at fetching purchase orders",
250
+ type: "error"
251
+ });
252
+ } finally {
253
+ n.value = !1;
254
+ }
255
+ }
256
+ async function T() {
257
+ p.value = [], n.value = !0;
258
+ try {
259
+ p.value = await v.readRequests(
260
+ void 0,
261
+ b.value.start,
262
+ b.value.end
263
+ ).then((D) => D.reverse());
264
+ } catch {
265
+ o.open({
266
+ title: "Something went wrong",
267
+ message: "Error at fetching purchase requests",
268
+ type: "error"
269
+ });
270
+ } finally {
271
+ n.value = !1;
272
+ }
273
+ }
274
+ function P() {
275
+ switch (h) {
276
+ case "receive/request":
277
+ return q();
278
+ case "approval":
279
+ return T();
280
+ }
281
+ }
282
+ function $(D, I) {
283
+ g.value = {
284
+ startDate: D,
285
+ endDate: I
286
+ }, P();
287
+ }
288
+ _.watchLocation(async (D) => {
289
+ if (!D) {
290
+ x.value = [];
291
+ return;
292
+ }
293
+ await P();
294
+ });
295
+ const U = z(), pe = z(Math.random().toString());
296
+ async function de(D, I) {
297
+ const te = Math.random().toString();
298
+ pe.value = te, I ?? (I = p.value.computeFirst(
299
+ (J) => J.purchaseOrderId === D._id ? J : null
300
+ ) ?? void 0);
301
+ const G = h === "receive/request" ? _.currentLocation : I == null ? void 0 : I.to, ne = {
302
+ poRequest: I,
303
+ purchaseOrder: D,
304
+ transferTo: G == null ? void 0 : G.name,
305
+ transferToDbName: G == null ? void 0 : G.dbName,
306
+ show: !0,
307
+ canResubmit: !1,
308
+ canApprove: h === "approval",
309
+ "onUpdate:show"(J) {
310
+ U.value.show = J;
311
+ },
312
+ scope: h,
313
+ receivedMap: Ee(D) ?? {}
314
+ };
315
+ U.value = ne;
316
+ }
317
+ async function xe(D, I, te, G) {
318
+ const ne = bt();
319
+ n.value = !0;
320
+ try {
321
+ await ne({
322
+ operate: {
323
+ operation: I,
324
+ doc: D,
325
+ options: (
326
+ // auto receive for supplier to warehouse
327
+ (I === k.enum.confirmDraft || // auto receive for warehouse to warehouse
328
+ I === k.enum.completeReceive) && i.autoReceiveWarehouse ? {
329
+ autoReceive: !0
330
+ } : void 0
331
+ )
332
+ },
333
+ operateV2: {
334
+ _id: D._id,
335
+ _rev: D._rev ?? "",
336
+ action: I,
337
+ payloads: []
338
+ },
339
+ transferTo: G
340
+ }), await new Promise((m) => setTimeout(m, 1e3));
341
+ const a = ge().currentLocationDBName.startsWith("restaurant_");
342
+ I === k.enum.confirmDraft && D.effectiveAt && a ? o.open({
343
+ title: "Success",
344
+ message: `${te}. The backdate will be reflected once your POS has received this change.`,
345
+ type: "success"
346
+ }) : o.open({
347
+ title: "Success",
348
+ message: te,
349
+ type: "success"
350
+ });
351
+ } catch (J) {
352
+ o.open({
353
+ title: "Something went wrong",
354
+ message: "Please try again.",
355
+ type: "error"
356
+ }), console.error("Error when submitting PO operation", I, D, J);
357
+ } finally {
358
+ n.value = !1, P();
359
+ }
360
+ }
361
+ async function Pe(D, I, te) {
362
+ const G = ht[I];
363
+ if (!G) {
364
+ o.open({
365
+ title: "Something went wrong",
366
+ message: `Cannot process order: ${Je(I)}`,
367
+ type: "error"
368
+ });
369
+ return;
370
+ }
371
+ const { successMessage: ne, ...J } = G;
372
+ s.open({
373
+ title: J.title,
374
+ message: J.message,
375
+ primaryActions: J.primaryActions
376
+ }).onPrimary(() => {
377
+ xe(D, I, ne, te);
378
+ });
379
+ }
380
+ async function ye() {
381
+ s.open({
382
+ title: "Upload Transfer",
383
+ primaryActions: {
384
+ text: "Xilnex transfer note",
385
+ close: !0
386
+ },
387
+ secondaryActions: {
388
+ text: "Cancel",
389
+ close: !0
390
+ }
391
+ }).onPrimary(() => {
392
+ const D = {
393
+ show: !0,
394
+ "onUpdate:show"(I) {
395
+ He.value.show = I;
396
+ }
397
+ };
398
+ He.value = D;
399
+ });
400
+ }
401
+ return {
402
+ purchaseOrders: x,
403
+ purchaseRequests: p,
404
+ updateDateRange: $,
405
+ fetchData: P,
406
+ loading: n,
407
+ transferDialogProps: qe,
408
+ promptCreateTransferDialog: u,
409
+ promptUpdateTransferDialog: O,
410
+ transferDetailsProps: U,
411
+ promptShowTransferDetails: de,
412
+ submitAction: Pe,
413
+ xilnexImportDialogProps: He,
414
+ promptUploadTransferDialog: ye
415
+ };
416
+ }
417
+ function Kt(h, t) {
418
+ return t.reduce(
419
+ (_, i) => {
420
+ const r = i.received.find((d) => d.sku._id === h._id);
421
+ return r && (_ = ut(_, r.amount)), _;
422
+ },
423
+ Dt.toPrecision(dt(0), h.unit.precision)
424
+ );
425
+ }
426
+ function jt(h) {
427
+ const { po: t, currentLocation: s, business: _, fulfilling: i, por: r } = h, { name: d, address: n, regNo: o } = s.doc.profile, v = {
428
+ name: d,
429
+ registrationNumber: o,
430
+ line1: n == null ? void 0 : n.line1,
431
+ line2: n == null ? void 0 : n.line2,
432
+ postcode: n == null ? void 0 : n.postcode,
433
+ city: n == null ? void 0 : n.city,
434
+ state: n == null ? void 0 : n.state,
435
+ country: n == null ? void 0 : n.country
436
+ }, x = {
437
+ name: t.supplier.name,
438
+ phoneNumber: t.supplier.phoneNumber,
439
+ registrationNumber: t.supplier.registrationNumber,
440
+ line1: t.supplier.address.line1,
441
+ line2: t.supplier.address.line2,
442
+ postcode: t.supplier.address.postcode,
443
+ city: t.supplier.address.city,
444
+ state: t.supplier.address.state,
445
+ country: t.supplier.address.country
446
+ }, g = t.items.map((T) => {
447
+ const { sku: P, measurement: $ } = T, U = be(
448
+ Kt(T.sku, t.deliveryOrder || []),
449
+ !1
450
+ );
451
+ return {
452
+ code: P.code,
453
+ description: P.name,
454
+ quantity: be(T.quantity, !1),
455
+ unit: ($ == null ? void 0 : $.abbrev) || P.unit.abbrev,
456
+ received: U,
457
+ cost: T.totalCost ? `${T.totalCost.currency} ${Ot.toFormatString({
458
+ value: T.totalCost
459
+ })}` : void 0
460
+ };
461
+ }), b = t.deliveryOrder.map((T) => ({
462
+ createdAt: mt(new Date(T.createdAt)),
463
+ ref: T.deliveryOrderNumber,
464
+ remark: T.remark || "",
465
+ items: T.received.map((P) => {
466
+ var $;
467
+ return {
468
+ code: P.sku.code,
469
+ description: P.sku.name,
470
+ quantity: be(P.amount),
471
+ unit: (($ = P.measurement) == null ? void 0 : $.abbrev) || P.sku.unit.abbrev
472
+ };
473
+ })
474
+ })), p = [
475
+ // Production
476
+ "67ca5d2c80bd0e001c5bf5bc",
477
+ // Dev
478
+ "6880b36a3054c5001db19218"
479
+ ];
480
+ let l = "Inventory Receive Note";
481
+ if (t.supplier.internal ? (l = "Inventory Transfer Note", p.includes((_ == null ? void 0 : _._id) || "") && (l = "Stock Request")) : l = "Purchase Order", r) {
482
+ const T = r.from.dbName;
483
+ s.dbName === T || (l = "Inventory Receive Note");
484
+ }
485
+ const u = {
486
+ title: l,
487
+ businessName: _ == null ? void 0 : _.name,
488
+ logo: _ == null ? void 0 : _.thumbnail,
489
+ orderNumber: t.seqNumber.toString(),
490
+ createdAt: Le(t._id),
491
+ ref: t.ref || "",
492
+ remark: t.remark || "",
493
+ buyer: v,
494
+ supplier: x,
495
+ items: g,
496
+ status: t.status,
497
+ deliveryOrders: b
498
+ }, O = new URL(window.location.href), q = i && (t.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
499
+ O.pathname = O.hostname.includes("portal.feedme") ? `/inventory/${q}` : `/${q}`, O.searchParams.append("data", JSON.stringify(u)), window.open(O.href, "_blank", "noreferrer");
500
+ }
501
+ const Oe = {
502
+ submitRequest: {
503
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
504
+ color: "text-fm-color-typo-primary",
505
+ value: k.enum.submitRequest
506
+ },
507
+ confirmDraft: {
508
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
509
+ color: "text-fm-color-typo-primary",
510
+ value: k.enum.confirmDraft
511
+ },
512
+ cancelDraft: {
513
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
514
+ color: "text-fm-color-typo-error",
515
+ value: k.enum.cancelDraft
516
+ },
517
+ approveRequest: {
518
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
519
+ color: "text-fm-color-typo-primary",
520
+ value: k.enum.approveRequest
521
+ },
522
+ rejectRequest: {
523
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
524
+ color: "text-fm-color-typo-error",
525
+ value: k.enum.rejectRequest
526
+ },
527
+ processRequest: {
528
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
529
+ color: "text-fm-color-typo-primary",
530
+ value: k.enum.processRequest
531
+ },
532
+ receiveStock: {
533
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
534
+ color: "text-fm-color-typo-primary",
535
+ value: k.enum.receiveStock
536
+ },
537
+ completeReceive: {
538
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
539
+ color: "text-fm-color-typo-primary",
540
+ value: k.enum.completeReceive
541
+ },
542
+ closeRequest: {
543
+ translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
544
+ color: "system-error-300",
545
+ value: k.enum.closeRequest
546
+ },
547
+ approveDraft: {
548
+ translationKey: "",
549
+ color: "",
550
+ value: void 0
551
+ },
552
+ rejectDraft: {
553
+ translationKey: "",
554
+ color: "",
555
+ value: void 0
556
+ },
557
+ returnStock: {
558
+ translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
559
+ color: "text-fm-color-typo-primary",
560
+ value: k.enum.returnStock
561
+ }
562
+ };
563
+ function yo(h, t) {
564
+ const s = ge(), _ = Ue(), i = Me(), { t: r } = vt();
565
+ function d(b) {
566
+ switch (b.status) {
567
+ case "DRAFT":
568
+ return [
569
+ ce[oe.Update],
570
+ ce[oe.Details],
571
+ b.supplier.internal === "restaurant" || b.supplier.internal === "warehouse" ? Oe[k.enum.submitRequest] : Oe[k.enum.confirmDraft],
572
+ Oe[k.enum.cancelDraft]
573
+ ];
574
+ case "RECEIVING":
575
+ return [
576
+ Oe[k.enum.completeReceive],
577
+ ce[oe.Details],
578
+ ce[oe.Print]
579
+ ];
580
+ case "REQUESTING":
581
+ return h === "receive/request" ? [ce[oe.Details], ce[oe.Print]] : [
582
+ Oe[k.enum.approveRequest],
583
+ Oe[k.enum.rejectRequest],
584
+ ce[oe.Details]
585
+ // DefaultRowActions[RowActionEnum.Print]
586
+ ];
587
+ case "PROCESSING":
588
+ return [ce[oe.Details], ce[oe.Print]];
589
+ case "COMPLETE":
590
+ case "CANCEL":
591
+ default:
592
+ return [ce[oe.Details], ce[oe.Print]];
593
+ }
594
+ }
595
+ function n(b) {
596
+ return Object.values(k.enum).includes(b);
597
+ }
598
+ async function o(b, p, l) {
599
+ var u, O, q, T, P, $;
600
+ const c = ct(p);
601
+ if (b === oe.Print) {
602
+ const U = (l == null ? void 0 : l.toInventoryLocation) ?? s.currentLocation;
603
+ ((u = l == null ? void 0 : l.netSuite) != null && u.refNo || (O = c.netSuite) != null && O.refNo) && (c.ref = [((q = l == null ? void 0 : l.netSuite) == null ? void 0 : q.refNo) || ((T = c.netSuite) == null ? void 0 : T.refNo)].filter((pe) => pe).join(" ")), jt({
604
+ po: c,
605
+ currentLocation: U,
606
+ business: i.currentBusiness.value,
607
+ fulfilling: h === "approval",
608
+ por: l
609
+ });
610
+ return;
611
+ }
612
+ if (b === oe.Details) {
613
+ t.promptShowTransferDetails(c, l);
614
+ return;
615
+ }
616
+ if (b === oe.Update) {
617
+ (P = t.promptUpdateTransferDialog) == null || P.call(t, c);
618
+ return;
619
+ }
620
+ if (n(b)) {
621
+ t.submitAction(p, b, ($ = l == null ? void 0 : l.to) == null ? void 0 : $.dbName);
622
+ return;
623
+ }
624
+ }
625
+ function v() {
626
+ var p;
627
+ const b = [
628
+ {
629
+ accessorKey: "seqNumber",
630
+ header: () => r("inventory.transfer.table.seqNo"),
631
+ enableSorting: !0,
632
+ size: 80,
633
+ sortUndefined: "last"
634
+ },
635
+ {
636
+ accessorKey: "_id",
637
+ header: () => r("inventory.transfer.table.createdAt"),
638
+ cell(l) {
639
+ return Le(`${l.getValue()}`);
640
+ },
641
+ enableSorting: !0
642
+ },
643
+ {
644
+ accessorKey: "supplier.name",
645
+ header: () => r("inventory.transfer.table.transferFrom"),
646
+ enableSorting: !0,
647
+ size: 200
648
+ },
649
+ {
650
+ accessorKey: "items.length",
651
+ header: () => r("inventory.transfer.table.noOfItems"),
652
+ cell: (l) => {
653
+ const c = l.row.original.version || "1", u = l.getValue();
654
+ return C("div", { class: "flex items-center gap-2" }, [
655
+ u,
656
+ c !== "1" ? C(
657
+ "div",
658
+ { class: "py-3" },
659
+ C(
660
+ $e,
661
+ C(
662
+ "div",
663
+ {
664
+ class: ["fm-status-badge", "fm-status-badge-draft"].join(" ")
665
+ },
666
+ `v${c}`
667
+ )
668
+ )
669
+ ) : null
670
+ ]);
671
+ },
672
+ enableSorting: !1,
673
+ meta: {
674
+ width: "10rem"
675
+ }
676
+ },
677
+ {
678
+ accessorKey: "ref",
679
+ header: () => r("inventory.transfer.table.reference"),
680
+ enableSorting: !1,
681
+ size: "auto"
682
+ },
683
+ ...(p = i.sessionUser.value) != null && p.role.isAdmin ? [
684
+ {
685
+ id: "statusForAdmin",
686
+ header: () => C($e, {}, () => `${r("inventory.transfer.table.status")}`),
687
+ cell(l) {
688
+ return l.row.original.status;
689
+ },
690
+ enableSorting: !0,
691
+ size: 200
692
+ }
693
+ ] : [],
694
+ {
695
+ accessorKey: "status",
696
+ header: () => r("inventory.transfer.table.status"),
697
+ cell(l) {
698
+ const c = l.getValue(), u = Ee(l.row.original), { partial: O, over: q } = Qe(u), T = Xe(c ?? "", O, q);
699
+ let P = r(`inventory.transfer.status.${T}`), $ = `${c ?? ""}`.toLocaleLowerCase("en-us");
700
+ return T === W.enum.CLOSE && (P = `${r(`inventory.transfer.status.${W.enum.COMPLETE}`)}`), T === "PARTIAL_RECEIVED" && $ === W.enum.PROCESSING.toLocaleLowerCase("en-us") && ($ = W.enum.RECEIVING.toLocaleLowerCase("en-us")), C(
701
+ "div",
702
+ {
703
+ class: "flex"
704
+ },
705
+ C(
706
+ "div",
707
+ {
708
+ class: [
709
+ "fm-status-badge",
710
+ `fm-status-badge-${$}`,
711
+ q && "fm-status-badge-error"
712
+ ].filter(Boolean).join(" ")
713
+ },
714
+ `${P}`
715
+ )
716
+ );
717
+ },
718
+ enableSorting: !0,
719
+ size: 200
720
+ },
721
+ {
722
+ id: "action",
723
+ cell(l) {
724
+ const c = l.row.original, u = d(c);
725
+ return at(u, (O) => o(O, c));
726
+ },
727
+ enableSorting: !1,
728
+ size: 40,
729
+ meta: {
730
+ cellClass: "",
731
+ headerClass: ""
732
+ }
733
+ }
734
+ ];
735
+ if (_.isEnabled) {
736
+ const l = [
737
+ {
738
+ id: "netsuiteTransferOrder",
739
+ accessorFn: (c) => {
740
+ var u;
741
+ return (u = c.netSuite) != null && u.id ? `${c.netSuite.refNo} (${c.netSuite.id})` : "N/A";
742
+ },
743
+ header: () => "NetSuite Order (ID)",
744
+ cell(c) {
745
+ var O;
746
+ const u = c.row.original;
747
+ return (O = u.netSuite) != null && O.id ? `${u.netSuite.refNo} (${u.netSuite.id})` : "N/A";
748
+ },
749
+ enableSorting: !1,
750
+ size: 200,
751
+ meta: {
752
+ cellClass: "",
753
+ headerClass: ""
754
+ }
755
+ },
756
+ {
757
+ id: "netsuiteTransactionNumber",
758
+ accessorFn: (c) => {
759
+ var u, O;
760
+ return ((O = (u = c.netSuite) == null ? void 0 : u.additionalInfo) == null ? void 0 : O.transactionnumber) ?? "N/A";
761
+ },
762
+ header: () => "NetSuite Transaction No.",
763
+ cell(c) {
764
+ var O, q;
765
+ return ((q = (O = c.row.original.netSuite) == null ? void 0 : O.additionalInfo) == null ? void 0 : q.transactionnumber) ?? "N/A";
766
+ },
767
+ enableSorting: !1,
768
+ size: 200,
769
+ meta: {
770
+ cellClass: "",
771
+ headerClass: ""
772
+ }
773
+ }
774
+ ];
775
+ b.splice(b.length - 1, 0, ...l);
776
+ }
777
+ return b;
778
+ }
779
+ function x() {
780
+ var p;
781
+ const b = [
782
+ {
783
+ accessorKey: "purchaseOrder.seqNumber",
784
+ header: () => r("inventory.transfer.table.seqNo"),
785
+ enableSorting: !0,
786
+ size: 80,
787
+ sortUndefined: "last"
788
+ },
789
+ {
790
+ accessorKey: "purchaseOrder._id",
791
+ header: () => r("inventory.transfer.table.createdAt"),
792
+ cell(l) {
793
+ return Le(`${l.getValue()}`);
794
+ },
795
+ enableSorting: !0
796
+ },
797
+ {
798
+ accessorKey: "to.name",
799
+ header: () => r("inventory.transfer.table.transferTo"),
800
+ enableSorting: !1,
801
+ size: 200
802
+ },
803
+ {
804
+ accessorKey: "purchaseOrder.items.length",
805
+ header: () => r("inventory.transfer.table.noOfItems"),
806
+ enableSorting: !1
807
+ },
808
+ {
809
+ accessorKey: "purchaseOrder.ref",
810
+ header: () => r("inventory.transfer.table.reference"),
811
+ enableSorting: !1,
812
+ size: "auto"
813
+ },
814
+ ...(p = i.sessionUser.value) != null && p.role.isAdmin ? [
815
+ {
816
+ id: "statusForAdmin",
817
+ header: () => C($e, {}, () => `${r("inventory.transfer.table.status")}`),
818
+ cell(l) {
819
+ return l.row.original.status;
820
+ },
821
+ enableSorting: !0,
822
+ size: 200
823
+ }
824
+ ] : [],
825
+ {
826
+ accessorKey: "purchaseOrder.status",
827
+ header: () => r("inventory.transfer.table.status"),
828
+ cell(l) {
829
+ const c = l.row.original, u = l.getValue();
830
+ if (!c.purchaseOrder)
831
+ return C(Ye.FmChip, {
832
+ label: "N/A",
833
+ compact: !0
834
+ });
835
+ const O = Ee(c.purchaseOrder), { partial: q, over: T } = Qe(O), P = Xe(u ?? "", q, T);
836
+ let $ = r(`inventory.transfer.status.${P}`), U = `${u ?? ""}`.toLocaleLowerCase("en-us");
837
+ return P === W.enum.CLOSE && ($ = `${r(`inventory.transfer.status.${W.enum.COMPLETE}`)}`), P === "PARTIAL_RECEIVED" && U === W.enum.PROCESSING.toLocaleLowerCase("en-us") && (U = W.enum.RECEIVING.toLocaleLowerCase("en-us")), C(
838
+ "div",
839
+ {
840
+ class: "flex"
841
+ },
842
+ C(
843
+ "div",
844
+ {
845
+ class: [
846
+ "fm-status-badge",
847
+ `fm-status-badge-${U}`,
848
+ T && "fm-status-badge-error"
849
+ ].filter(Boolean).join(" ")
850
+ },
851
+ `${$}`
852
+ )
853
+ );
854
+ },
855
+ enableSorting: !0
856
+ },
857
+ {
858
+ id: "action",
859
+ cell(l) {
860
+ const c = l.row.original, O = (c.purchaseOrder ? d(c.purchaseOrder) : []).map((q) => q.value === oe.Print ? {
861
+ ...q,
862
+ translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
863
+ } : q);
864
+ return at(
865
+ O,
866
+ (q) => c.purchaseOrder ? o(q, c.purchaseOrder, c) : void 0
867
+ );
868
+ },
869
+ enableSorting: !1,
870
+ size: 40,
871
+ meta: {
872
+ cellClass: "",
873
+ headerClass: ""
874
+ }
875
+ }
876
+ ];
877
+ if (_.isEnabled) {
878
+ const l = [
879
+ {
880
+ id: "netsuiteTransferOrder",
881
+ accessorFn: (c) => {
882
+ var u;
883
+ return (u = c.netSuite) != null && u.id ? `${c.netSuite.refNo} (${c.netSuite.id})` : "N/A";
884
+ },
885
+ header: () => "NetSuite Order (ID)",
886
+ cell(c) {
887
+ var O;
888
+ const u = c.row.original;
889
+ return (O = u.netSuite) != null && O.id ? `${u.netSuite.refNo} (${u.netSuite.id})` : "N/A";
890
+ },
891
+ enableSorting: !1,
892
+ size: 200,
893
+ meta: {
894
+ cellClass: "",
895
+ headerClass: ""
896
+ }
897
+ },
898
+ {
899
+ id: "netsuiteTransactionNumber",
900
+ accessorFn: (c) => {
901
+ var u, O;
902
+ return ((O = (u = c.netSuite) == null ? void 0 : u.additionalInfo) == null ? void 0 : O.transactionnumber) ?? "N/A";
903
+ },
904
+ header: () => "NetSuite Transaction No.",
905
+ cell(c) {
906
+ var O, q;
907
+ return ((q = (O = c.row.original.netSuite) == null ? void 0 : O.additionalInfo) == null ? void 0 : q.transactionnumber) ?? "N/A";
908
+ },
909
+ enableSorting: !1,
910
+ size: 200,
911
+ meta: {
912
+ cellClass: "",
913
+ headerClass: ""
914
+ }
915
+ }
916
+ ];
917
+ b.splice(b.length - 2, 0, ...l);
918
+ }
919
+ return b;
920
+ }
921
+ return {
922
+ columnDefs: re(() => h === "receive/request" ? v() : x())
923
+ };
924
+ }
925
+ const zt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Gt = { class: "flex flex-col gap-8" }, Ht = { class: "flex w-full justify-end gap-16" }, Wt = /* @__PURE__ */ Re({
926
+ __name: "FulfillmentForm",
927
+ props: {
928
+ purchaseOrder: {},
929
+ confirm: { type: Function }
930
+ },
931
+ emits: ["update:show"],
932
+ setup(h, { emit: t }) {
933
+ const s = h, _ = $t({
934
+ id: "",
935
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
936
+ items: []
937
+ }), i = z(), r = t;
938
+ yt(() => {
939
+ s.purchaseOrder && (_.items = s.purchaseOrder.items.map((n) => ({
940
+ id: n.id,
941
+ sku: n.sku,
942
+ measurement: n.measurement,
943
+ amount: n.quantity ?? { amount: 1, precision: 0 }
944
+ })));
945
+ });
946
+ const d = re(() => _.items.length <= 10);
947
+ return (n, o) => {
948
+ const v = Z("FmTable"), x = Z("FmButton"), g = Z("FmForm");
949
+ return y(), ue(g, {
950
+ ref_key: "formRef",
951
+ ref: i,
952
+ class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
953
+ onValidationFailed: console.log,
954
+ onValidationSuccess: o[1] || (o[1] = () => s.confirm(_))
955
+ }, {
956
+ default: se(() => [
957
+ o[2] || (o[2] = e("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
958
+ e("div", zt, [
959
+ e("div", Gt, [
960
+ F(v, {
961
+ "column-defs": [
962
+ {
963
+ header: "Code",
964
+ cell: (b) => {
965
+ const p = s.purchaseOrder.items.find((l) => l.id === b.row.original.id || l.sku._id === b.row.original.sku._id);
966
+ return C(
967
+ S(Ye).FmTooltip,
968
+ {
969
+ content: p.code,
970
+ placement: "top",
971
+ variant: "plain",
972
+ zIndex: 50
973
+ },
974
+ C(
975
+ "span",
976
+ {
977
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
978
+ },
979
+ p.code
980
+ )
981
+ );
982
+ }
983
+ },
984
+ {
985
+ header: "Name",
986
+ cell: (b) => {
987
+ const p = s.purchaseOrder.items.find((l) => l.id === b.row.original.id || l.sku._id === b.row.original.sku._id);
988
+ return C(
989
+ S(Ye).FmTooltip,
990
+ {
991
+ content: p.name,
992
+ placement: "top",
993
+ variant: "plain",
994
+ zIndex: 50
995
+ },
996
+ C(
997
+ "span",
998
+ {
999
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
1000
+ },
1001
+ p.name
1002
+ )
1003
+ );
1004
+ }
1005
+ },
1006
+ {
1007
+ header: "Amount",
1008
+ cell: (b) => {
1009
+ const p = b.row.original, l = s.purchaseOrder.items.find((u) => u.id === p.id || u.sku._id === p.sku._id), c = p.amount ?? {
1010
+ amount: 1,
1011
+ precision: 0
1012
+ };
1013
+ return C(Lt, {
1014
+ style: {
1015
+ flex: "1 1 0%"
1016
+ },
1017
+ modelValue: {
1018
+ amount: c,
1019
+ measurement: p.measurement ?? null
1020
+ },
1021
+ key: p.id ?? p.sku._id,
1022
+ unit: p.sku.unit,
1023
+ "onUpdate:modelValue": (u) => {
1024
+ if (!u) return;
1025
+ const O = _.items.find((q) => q.id === p.id || q.sku._id === p.sku._id);
1026
+ O && (O.amount = u.amount);
1027
+ },
1028
+ disableUnit: !0,
1029
+ rules: [
1030
+ S(Et)(
1031
+ +S(be)({ amount: 0, precision: 0 })
1032
+ ),
1033
+ S(Bt)(+S(be)(l.quantity))
1034
+ ],
1035
+ applyDefaultRules: !0
1036
+ });
1037
+ }
1038
+ }
1039
+ ],
1040
+ "row-data": _.items,
1041
+ "hide-footer": d.value
1042
+ }, null, 8, ["column-defs", "row-data", "hide-footer"])
1043
+ ])
1044
+ ]),
1045
+ e("div", Ht, [
1046
+ F(x, {
1047
+ class: "px-16",
1048
+ label: "Confirm",
1049
+ size: "md",
1050
+ variant: "primary",
1051
+ type: "submit"
1052
+ }),
1053
+ F(x, {
1054
+ class: "px-16",
1055
+ label: "Cancel",
1056
+ size: "md",
1057
+ variant: "secondary",
1058
+ onClick: o[0] || (o[0] = () => r("update:show", !1))
1059
+ })
1060
+ ])
1061
+ ]),
1062
+ _: 1
1063
+ }, 8, ["onValidationFailed"]);
1064
+ };
1065
+ }
1066
+ }), We = {
1067
+ submitRequest: {
1068
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
1069
+ color: "primary",
1070
+ buttonVariant: le.Primary
1071
+ },
1072
+ confirmDraft: {
1073
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
1074
+ color: "primary",
1075
+ buttonVariant: le.Primary
1076
+ },
1077
+ cancelDraft: {
1078
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
1079
+ color: "system-error-300",
1080
+ buttonVariant: le.Destructive
1081
+ },
1082
+ approveDraft: {
1083
+ translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
1084
+ color: "primary",
1085
+ buttonVariant: le.Primary
1086
+ },
1087
+ rejectDraft: {
1088
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
1089
+ color: "system-error-300",
1090
+ buttonVariant: le.Destructive
1091
+ },
1092
+ approveRequest: {
1093
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
1094
+ color: "primary",
1095
+ buttonVariant: le.Primary
1096
+ },
1097
+ processRequest: {
1098
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
1099
+ color: "primary",
1100
+ buttonVariant: le.Primary
1101
+ },
1102
+ receiveStock: {
1103
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
1104
+ color: "primary",
1105
+ buttonVariant: le.Primary,
1106
+ available: !1
1107
+ },
1108
+ completeReceive: {
1109
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
1110
+ color: "primary",
1111
+ buttonVariant: le.Plain
1112
+ },
1113
+ rejectRequest: {
1114
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
1115
+ color: "system-error-300",
1116
+ buttonVariant: le.Destructive
1117
+ },
1118
+ closeRequest: {
1119
+ translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
1120
+ color: "system-error-300",
1121
+ buttonVariant: le.Destructive,
1122
+ available: !1
1123
+ },
1124
+ returnStock: {
1125
+ translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
1126
+ color: "primary",
1127
+ buttonVariant: le.Primary,
1128
+ available: !1
1129
+ }
1130
+ };
1131
+ function Yt() {
1132
+ const h = Ve();
1133
+ return {
1134
+ ableToMarkReceived(t) {
1135
+ if (!t || t.status !== W.enum.RECEIVING)
1136
+ return !1;
1137
+ const _ = ge().currentLocationDBName;
1138
+ return `${t.supplier.internal}_${t.supplier._id}` !== _;
1139
+ },
1140
+ ableToMarkApproved(t) {
1141
+ return !(!t || (t == null ? void 0 : t.status) !== W.enum.REQUESTING);
1142
+ },
1143
+ ableToCreateFulfillment(t, s) {
1144
+ var r, d;
1145
+ if (!h.acceptRequireFulfillment || !t || !s || t.status !== W.enum.PROCESSING || !s.processedAt)
1146
+ return !1;
1147
+ const _ = (r = s == null ? void 0 : s.from) == null ? void 0 : r.dbName, i = (d = s == null ? void 0 : s.to) == null ? void 0 : d.dbName;
1148
+ return !(_.startsWith("restaurant_") && i.startsWith("restaurant_"));
1149
+ }
1150
+ };
1151
+ }
1152
+ const Qt = { class: "flex flex-row-reverse" }, Xt = /* @__PURE__ */ Re({
1153
+ __name: "NetSuiteSync",
1154
+ props: {
1155
+ poRequest: {},
1156
+ purchaseOrder: {},
1157
+ isTransferBetweenOutlets: { type: Boolean },
1158
+ scope: {}
1159
+ },
1160
+ setup(h) {
1161
+ const t = h, s = Ue(), _ = Ke(), i = et(), r = z(!1);
1162
+ re(() => {
1163
+ var x, g, b, p;
1164
+ let n = !0;
1165
+ s.isEnabled || (n = !1);
1166
+ const o = t.purchaseOrder, v = t.poRequest;
1167
+ return o && ((x = o == null ? void 0 : o.supplier) != null && x.internal ? (!v && o.status == W.enum.DRAFT && (n = !1), v && !((g = v == null ? void 0 : v.netSuite) != null && g.id) && (n = !1), t.isTransferBetweenOutlets && (n = !1)) : ((o == null ? void 0 : o.status) !== W.enum.REQUESTING && o.supplier.internal && (n = !1), !v && !((b = o == null ? void 0 : o.netSuite) != null && b.id) && (n = !1), !v && ((p = o == null ? void 0 : o.netSuite) != null && p.id) && (o == null ? void 0 : o.status) == W.enum.REQUESTING && (n = !1))), n;
1168
+ });
1169
+ async function d() {
1170
+ r.value || i.open({
1171
+ title: "Sync with NetSuite",
1172
+ contentComponent: C("div", [
1173
+ C("p", "Are you sure you want to sync now?"),
1174
+ C("br"),
1175
+ C(
1176
+ "p",
1177
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1178
+ "Please wait a moment before syncing manually to avoid unnecessary actions."
1179
+ )
1180
+ ]),
1181
+ primaryActions: {
1182
+ text: "Sync",
1183
+ close: !0,
1184
+ variant: "destructive"
1185
+ },
1186
+ secondaryActions: { text: "Not now", close: !0 }
1187
+ }).onPrimary(async () => {
1188
+ var n, o, v;
1189
+ try {
1190
+ r.value = !0;
1191
+ const x = ((n = t.purchaseOrder) == null ? void 0 : n._id) || ((o = t.poRequest) == null ? void 0 : o.purchaseOrderId) || "", g = (v = t.poRequest) == null ? void 0 : v.to.dbName;
1192
+ await s.syncPurchaseOrder(
1193
+ x,
1194
+ t.scope === "approval" ? g : void 0
1195
+ ), _.open({
1196
+ title: "Sync with NetSuite",
1197
+ message: "Requested to sync with NetSuite. Please wait a moment.",
1198
+ type: "success"
1199
+ }), await new Promise((b) => setTimeout(b, 5e3)), r.value = !1;
1200
+ } catch {
1201
+ _.open({
1202
+ title: "Error",
1203
+ message: "Failed to sync with NetSuite",
1204
+ type: "error"
1205
+ }), r.value = !1;
1206
+ }
1207
+ });
1208
+ }
1209
+ return (n, o) => {
1210
+ const v = Z("FmButton");
1211
+ return y(), R("div", Qt, [
1212
+ F(v, {
1213
+ "prepend-icon": "sync",
1214
+ variant: "secondary",
1215
+ label: "Sync",
1216
+ loading: r.value,
1217
+ onClick: d,
1218
+ "text-color": "primary",
1219
+ "bg-color": "transparent",
1220
+ "border-color": "primary"
1221
+ }, null, 8, ["loading"])
1222
+ ]);
1223
+ };
1224
+ }
1225
+ }), Zt = {
1226
+ key: 0,
1227
+ class: "flex flex-col gap-8"
1228
+ }, Jt = { class: "flex flex-col gap-4" }, er = { class: "fm-typo-en-body-lg-600" }, tr = {
1229
+ key: 0,
1230
+ class: "flex flex-col gap-4"
1231
+ }, rr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, sr = { class: "fm-typo-en-body-lg-600" }, or = { key: 0 }, nr = { key: 1 }, ar = {
1232
+ key: 1,
1233
+ class: "flex flex-col gap-4"
1234
+ }, ir = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lr = { class: "fm-typo-en-body-lg-600" }, cr = { key: 0 }, ur = { key: 1 }, dr = {
1235
+ key: 2,
1236
+ class: "flex flex-col gap-4"
1237
+ }, mr = { class: "fm-typo-en-body-lg-600" }, fr = {
1238
+ key: 3,
1239
+ class: "flex flex-col gap-4"
1240
+ }, pr = { class: "fm-typo-en-body-lg-600" }, yr = /* @__PURE__ */ Re({
1241
+ __name: "NetSuiteInfo",
1242
+ props: {
1243
+ transferType: {},
1244
+ transferToDbName: {},
1245
+ poRequest: {},
1246
+ purchaseOrder: {},
1247
+ isTransferBetweenOutlets: { type: Boolean },
1248
+ scope: {}
1249
+ },
1250
+ setup(h) {
1251
+ const t = h, s = Ue(), _ = je(), i = z(t.poRequest);
1252
+ yt(async () => {
1253
+ var o;
1254
+ if (!t.poRequest && ((o = t.purchaseOrder) != null && o._id)) {
1255
+ const v = await _.getLatestPurchaseOrderRequest(t.purchaseOrder._id);
1256
+ i.value = v;
1257
+ }
1258
+ });
1259
+ const r = re(
1260
+ () => {
1261
+ var o, v, x, g, b, p;
1262
+ return s.getSubsidiaryFullName(
1263
+ ((x = (v = (o = t.purchaseOrder) == null ? void 0 : o.netSuite) == null ? void 0 : v.subsidiary) == null ? void 0 : x.id) || ((p = (b = (g = t.poRequest) == null ? void 0 : g.netSuite) == null ? void 0 : b.subsidiary) == null ? void 0 : p.id)
1264
+ ).fullName;
1265
+ }
1266
+ ), d = re(() => {
1267
+ var o, v, x, g, b, p, l, c, u, O, q, T;
1268
+ return (x = (v = (o = t.purchaseOrder) == null ? void 0 : o.netSuite) == null ? void 0 : v.additionalInfo) != null && x.transactionnumber ? (p = (b = (g = t.purchaseOrder) == null ? void 0 : g.netSuite) == null ? void 0 : b.additionalInfo) == null ? void 0 : p.transactionnumber : (u = (c = (l = i.value) == null ? void 0 : l.netSuite) == null ? void 0 : c.additionalInfo) != null && u.transactionnumber ? (T = (q = (O = i.value) == null ? void 0 : O.netSuite) == null ? void 0 : q.additionalInfo) == null ? void 0 : T.transactionnumber : null;
1269
+ }), n = re(() => {
1270
+ var o, v, x, g, b, p;
1271
+ return (v = (o = t.purchaseOrder) == null ? void 0 : o.deliveryFullfillment) != null && v.length && ((g = (x = t.purchaseOrder) == null ? void 0 : x.deliveryFullfillment) == null ? void 0 : g.length) > 0 ? (p = (b = t.purchaseOrder) == null ? void 0 : b.deliveryFullfillment) == null ? void 0 : p.map((l) => {
1272
+ var c;
1273
+ return (c = l.netSuite) == null ? void 0 : c.refNo;
1274
+ }).join(", ") : "N/A";
1275
+ });
1276
+ return (o, v) => {
1277
+ var x, g, b, p, l, c, u, O, q, T, P, $, U, pe, de, xe;
1278
+ return S(s).isEnabled ? (y(), R("div", Zt, [
1279
+ e("div", Jt, [
1280
+ v[0] || (v[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
1281
+ e("div", er, w(r.value || "N/A"), 1)
1282
+ ]),
1283
+ !o.isTransferBetweenOutlets && o.scope === S(Ze).RECEIVE_REQUEST ? (y(), R("div", tr, [
1284
+ e("div", rr, " NetSuite " + w((g = (x = o.purchaseOrder) == null ? void 0 : x.netSuite) != null && g.recordType ? S(ft)((p = (b = o.purchaseOrder) == null ? void 0 : b.netSuite) == null ? void 0 : p.recordType) : o.transferType === S(we).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1285
+ e("div", sr, [
1286
+ (c = (l = o.purchaseOrder) == null ? void 0 : l.netSuite) != null && c.id ? (y(), R("span", or, w((O = (u = o.purchaseOrder) == null ? void 0 : u.netSuite) == null ? void 0 : O.refNo) + " (" + w((T = (q = o.purchaseOrder) == null ? void 0 : q.netSuite) == null ? void 0 : T.id) + ") ", 1)) : (y(), R("span", nr, "N/A"))
1287
+ ])
1288
+ ])) : H("", !0),
1289
+ !o.isTransferBetweenOutlets && i.value || o.scope === S(Ze).APPROVAL ? (y(), R("div", ar, [
1290
+ e("div", ir, " (Request) NetSuite " + w(o.transferType === S(we).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1291
+ e("div", lr, [
1292
+ ($ = (P = i.value) == null ? void 0 : P.netSuite) != null && $.id ? (y(), R("span", cr, w((pe = (U = i.value) == null ? void 0 : U.netSuite) == null ? void 0 : pe.refNo) + " (" + w((xe = (de = i.value) == null ? void 0 : de.netSuite) == null ? void 0 : xe.id) + ") ", 1)) : (y(), R("span", ur, "N/A"))
1293
+ ])
1294
+ ])) : H("", !0),
1295
+ d.value ? (y(), R("div", dr, [
1296
+ v[1] || (v[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
1297
+ e("div", mr, w(d.value), 1)
1298
+ ])) : H("", !0),
1299
+ S(s).isEnabled && o.transferType === S(we).TRANSFER && !o.isTransferBetweenOutlets ? (y(), R("div", fr, [
1300
+ v[2] || (v[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1301
+ e("div", pr, w(n.value), 1)
1302
+ ])) : H("", !0)
1303
+ ])) : H("", !0);
1304
+ };
1305
+ }
1306
+ }), vr = { class: "flex flex-row-reverse" }, hr = /* @__PURE__ */ Re({
1307
+ __name: "NetSuiteLog",
1308
+ props: {
1309
+ netsuiteId: {},
1310
+ purchaseOrderId: {}
1311
+ },
1312
+ setup(h) {
1313
+ const t = Ke(), s = pt();
1314
+ async function _(i, r) {
1315
+ const d = [];
1316
+ if (i && d.push(`body.message:*${i}*`), r) {
1317
+ const x = r.replace(/:/g, "\\:");
1318
+ d.push(`${x}`);
1319
+ }
1320
+ if (d.length === 0) {
1321
+ t.open({
1322
+ message: "Cannot open logs without valid filters.",
1323
+ type: "error"
1324
+ });
1325
+ return;
1326
+ }
1327
+ const o = `attributes.pod:netsuite* AND (${d.join(" OR ")})`, { url: v } = await s.getSyncLogs(o);
1328
+ t.open(
1329
+ {
1330
+ message: "Opening NetSuite logs...",
1331
+ type: "info"
1332
+ },
1333
+ 800
1334
+ ), await new Promise((x) => setTimeout(x, 800)), window.open(v, "_blank");
1335
+ }
1336
+ return (i, r) => {
1337
+ const d = Z("FmButton");
1338
+ return y(), R("div", vr, [
1339
+ F(d, {
1340
+ "prepend-icon": "history",
1341
+ variant: "secondary",
1342
+ label: "Logs",
1343
+ onClick: r[0] || (r[0] = (n) => _(i.netsuiteId, i.purchaseOrderId)),
1344
+ "text-color": "primary",
1345
+ "bg-color": "transparent",
1346
+ "border-color": "primary"
1347
+ })
1348
+ ]);
1349
+ };
1350
+ }
1351
+ }), br = { class: "flex flex-row-reverse" }, gr = { key: 0 }, _r = { key: 1 }, Sr = { class: "mb-6" }, wr = { class: "fm-typo-en-body-md-400" }, Rr = { key: 0 }, xr = { key: 1 }, Or = { key: 0 }, Nr = {
1352
+ key: 1,
1353
+ class: "border-t pt-6"
1354
+ }, $r = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, kr = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, Cr = { class: "w-full" }, Ar = {
1355
+ class: "p-3 fm-typo-en-body-sm-600",
1356
+ style: { "min-width": "130px" }
1357
+ }, Dr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, qr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Tr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Pr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ir = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Fr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Lr = { class: "p-3 fm-typo-en-body-sm-600" }, Er = { key: 2 }, Br = { key: 1 }, Vr = /* @__PURE__ */ Re({
1358
+ __name: "NetSuiteLatestInfo",
1359
+ props: {
1360
+ netsuiteId: {},
1361
+ purchaseOrderId: {}
1362
+ },
1363
+ setup(h) {
1364
+ const t = h, s = pt(), _ = z(!1), i = ge(), r = z(!0), d = z(!1), n = z(!1), o = z(!1), v = z(null), x = z([]);
1365
+ async function g() {
1366
+ if (!v.value) {
1367
+ _.value = !0;
1368
+ try {
1369
+ r.value = !0;
1370
+ const c = await s.getMoreInfo(
1371
+ i.currentLocation.dbName,
1372
+ t.purchaseOrderId
1373
+ );
1374
+ v.value = c, d.value = !1;
1375
+ } catch {
1376
+ d.value = !0;
1377
+ } finally {
1378
+ r.value = !1;
1379
+ }
1380
+ await b();
1381
+ }
1382
+ }
1383
+ async function b() {
1384
+ if (!(x.value.length > 0))
1385
+ try {
1386
+ n.value = !0;
1387
+ const c = await s.getChangeLogs(t.netsuiteId);
1388
+ x.value = c, o.value = !1;
1389
+ } catch {
1390
+ o.value = !0;
1391
+ } finally {
1392
+ n.value = !1;
1393
+ }
1394
+ }
1395
+ function p(c) {
1396
+ switch (c) {
1397
+ case Ae.Create:
1398
+ return "text-green-600 bg-green-100";
1399
+ case Ae.Set:
1400
+ return "text-blue-600 bg-blue-100";
1401
+ case Ae.Change:
1402
+ return "text-yellow-600 bg-yellow-100";
1403
+ case Ae.Unset:
1404
+ return "text-red-600 bg-red-100";
1405
+ default:
1406
+ return "text-gray-600 bg-gray-100";
1407
+ }
1408
+ }
1409
+ function l(c) {
1410
+ return new Date(c).toLocaleDateString("en-US", {
1411
+ year: "numeric",
1412
+ month: "short",
1413
+ day: "numeric",
1414
+ hour: "2-digit",
1415
+ minute: "2-digit"
1416
+ });
1417
+ }
1418
+ return (c, u) => {
1419
+ const O = Z("FmButton"), q = Z("FmLabel"), T = Z("FmIcon"), P = Z("FmDialog");
1420
+ return y(), R("div", br, [
1421
+ F(P, {
1422
+ modelValue: _.value,
1423
+ "onUpdate:modelValue": u[2] || (u[2] = ($) => _.value = $),
1424
+ overlay: !0,
1425
+ "max-width": 800
1426
+ }, {
1427
+ "dialog-button": se(() => [
1428
+ F(O, {
1429
+ "prepend-icon": "info",
1430
+ variant: "secondary",
1431
+ label: "Latest Info",
1432
+ onClick: u[0] || (u[0] = ($) => g()),
1433
+ "text-color": "primary",
1434
+ "bg-color": "transparent",
1435
+ "border-color": "primary"
1436
+ })
1437
+ ]),
1438
+ "dialog-header": se(() => u[3] || (u[3] = [
1439
+ e("div", null, "NetSuite latest info", -1)
1440
+ ])),
1441
+ default: se(() => [
1442
+ r.value ? (y(), R("div", gr, "Loading...")) : (y(), R("div", _r, [
1443
+ d.value ? (y(), R("p", Br, "Something went wrong.")) : (y(), R(ae, { key: 0 }, [
1444
+ e("div", Sr, [
1445
+ u[4] || (u[4] = e("h3", { class: "fm-typo-en-body-lg-600 mb-4" }, "NetSuite Order Details", -1)),
1446
+ (y(!0), R(ae, null, he(v.value, ($, U) => (y(), R("div", {
1447
+ key: U,
1448
+ class: "mb-2"
1449
+ }, [
1450
+ e("div", null, [
1451
+ F(q, {
1452
+ label: S(Je)(U)
1453
+ }, null, 8, ["label"]),
1454
+ e("div", wr, [
1455
+ Array.isArray($) ? (y(), R("span", Rr, w($.length > 0 ? $.join(", ") : "N/A"), 1)) : (y(), R("span", xr, w($), 1))
1456
+ ])
1457
+ ])
1458
+ ]))), 128))
1459
+ ]),
1460
+ n.value ? (y(), R("div", Or, "Change Log Loading...")) : H("", !0),
1461
+ !n.value && x.value.length > 0 ? (y(), R("div", Nr, [
1462
+ e("h3", $r, [
1463
+ F(T, {
1464
+ name: "error",
1465
+ color: "#ff9500",
1466
+ size: "sm"
1467
+ }),
1468
+ u[5] || (u[5] = Ne(" Change Logs "))
1469
+ ]),
1470
+ e("div", kr, [
1471
+ e("table", Cr, [
1472
+ u[6] || (u[6] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
1473
+ e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
1474
+ e("th", {
1475
+ class: "text-left p-3 fm-typo-en-body-md-600",
1476
+ style: { "min-width": "130px" }
1477
+ }, " Date "),
1478
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
1479
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
1480
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
1481
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
1482
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
1483
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
1484
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
1485
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
1486
+ ])
1487
+ ], -1)),
1488
+ e("tbody", null, [
1489
+ (y(!0), R(ae, null, he(x.value, ($, U) => (y(), R("tr", {
1490
+ key: U,
1491
+ class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
1492
+ }, [
1493
+ e("td", Ar, w(l($._dateiso8601)), 1),
1494
+ e("td", Dr, w($._rolename), 1),
1495
+ e("td", qr, w($._employeename), 1),
1496
+ e("td", Tr, w($._contextname), 1),
1497
+ e("td", {
1498
+ class: Te(`p-3 fm-typo-en-body-sm-600 ${p(Number($.type) - 1)}`)
1499
+ }, w(S(Ae)[Number($.type) - 1]), 3),
1500
+ e("td", Pr, w($.lineid || ""), 1),
1501
+ e("td", Ir, w($._fieldname), 1),
1502
+ e("td", Fr, w($.oldvalue || ""), 1),
1503
+ e("td", Lr, w($.newvalue || ""), 1)
1504
+ ]))), 128))
1505
+ ])
1506
+ ])
1507
+ ])
1508
+ ])) : (y(), R("div", Er, u[7] || (u[7] = [
1509
+ e("p", null, "No change logs available.", -1)
1510
+ ])))
1511
+ ], 64))
1512
+ ]))
1513
+ ]),
1514
+ "dialog-footer": se(() => [
1515
+ F(O, {
1516
+ class: "ml-auto sm:w-full xs:w-full",
1517
+ label: "Close",
1518
+ size: "md",
1519
+ variant: "primary",
1520
+ onClick: u[1] || (u[1] = ($) => _.value = !1)
1521
+ })
1522
+ ]),
1523
+ _: 1
1524
+ }, 8, ["modelValue"])
1525
+ ]);
1526
+ };
1527
+ }
1528
+ }), Ur = {
1529
+ key: 0,
1530
+ class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
1531
+ }, Mr = { class: "flex gap-8 items-center" }, Kr = { class: "ml-auto" }, jr = { class: "flex gap-3" }, zr = /* @__PURE__ */ Re({
1532
+ __name: "NetSuitePanel",
1533
+ props: {
1534
+ poRequest: {},
1535
+ purchaseOrder: {},
1536
+ transferType: {},
1537
+ transferToDbName: {},
1538
+ scope: {}
1539
+ },
1540
+ setup(h) {
1541
+ const t = h, s = Ut();
1542
+ Me();
1543
+ const _ = re(() => {
1544
+ var n, o, v, x, g, b, p;
1545
+ const i = ((n = t.transferToDbName) == null ? void 0 : n.startsWith("restaurant")) && ((v = (o = t.purchaseOrder) == null ? void 0 : o.supplier) == null ? void 0 : v.internal) === "restaurant", r = t.transferType === we.PURCHASE, d = t.transferType === we.TRANSFER;
1546
+ return r || d && !i || ((g = (x = t.purchaseOrder) == null ? void 0 : x.netSuite) == null ? void 0 : g.id) || ((p = (b = t.poRequest) == null ? void 0 : b.netSuite) == null ? void 0 : p.id);
1547
+ });
1548
+ return (i, r) => {
1549
+ const d = Z("FmMenuDivider");
1550
+ return S(s).isNetSuiteEnabled && _.value ? (y(), R("div", Ur, [
1551
+ e("div", Mr, [
1552
+ r[0] || (r[0] = e("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1553
+ e("div", Kr, [
1554
+ e("div", jr, [
1555
+ F($e, null, {
1556
+ default: se(() => {
1557
+ var n, o, v, x, g;
1558
+ return [
1559
+ (o = (n = t.purchaseOrder) == null ? void 0 : n.netSuite) != null && o.id ? (y(), ue(Vr, {
1560
+ key: 0,
1561
+ "netsuite-id": (x = (v = i.purchaseOrder) == null ? void 0 : v.netSuite) == null ? void 0 : x.id,
1562
+ "purchase-order-id": (g = i.purchaseOrder) == null ? void 0 : g._id
1563
+ }, null, 8, ["netsuite-id", "purchase-order-id"])) : H("", !0)
1564
+ ];
1565
+ }),
1566
+ _: 1
1567
+ }),
1568
+ F($e, null, {
1569
+ default: se(() => {
1570
+ var n, o, v;
1571
+ return [
1572
+ F(hr, {
1573
+ "netsuite-id": (o = (n = i.purchaseOrder) == null ? void 0 : n.netSuite) == null ? void 0 : o.id,
1574
+ "purchase-order-id": (v = i.purchaseOrder) == null ? void 0 : v._id
1575
+ }, null, 8, ["netsuite-id", "purchase-order-id"])
1576
+ ];
1577
+ }),
1578
+ _: 1
1579
+ }),
1580
+ F(Xt, {
1581
+ "po-request": i.poRequest,
1582
+ "purchase-order": i.purchaseOrder,
1583
+ "is-transfer-between-outlets": !_.value,
1584
+ scope: i.scope
1585
+ }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
1586
+ ])
1587
+ ])
1588
+ ]),
1589
+ F(d),
1590
+ F(yr, {
1591
+ "po-request": i.poRequest,
1592
+ "purchase-order": i.purchaseOrder,
1593
+ "transfer-type": i.transferType,
1594
+ "transfer-to-db-name": i.transferToDbName,
1595
+ "is-transfer-between-outlets": !_.value,
1596
+ scope: i.scope
1597
+ }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1598
+ ])) : H("", !0);
1599
+ };
1600
+ }
1601
+ }), Gr = { class: "flex flex-col gap-16 w-full h-full" }, Hr = { class: "flex justify-between" }, Wr = { class: "fm-typo-en-body-lg-600" }, Yr = { class: "flex gap-5" }, Qr = { class: "flex flex-col gap-8" }, Xr = { class: "flex flex-col gap-4" }, Zr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Jr = { class: "flex gap-1" }, es = { class: "fm-typo-en-body-lg-600" }, ts = {
1602
+ key: 0,
1603
+ class: "flex flex-col gap-4"
1604
+ }, rs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ss = { class: "fm-typo-en-body-lg-600" }, os = { class: "flex flex-col gap-4" }, ns = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, as = { class: "fm-typo-en-body-lg-600" }, is = {
1605
+ key: 1,
1606
+ class: "flex flex-col gap-4"
1607
+ }, ls = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, cs = { class: "fm-typo-en-body-lg-600" }, us = {
1608
+ key: 2,
1609
+ class: "flex flex-col gap-4"
1610
+ }, ds = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ms = { class: "fm-typo-en-body-lg-600" }, fs = {
1611
+ key: 3,
1612
+ class: "flex flex-col gap-4"
1613
+ }, ps = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ys = { class: "fm-typo-en-body-lg-600" }, vs = {
1614
+ key: 4,
1615
+ class: "flex flex-col gap-4"
1616
+ }, hs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, bs = { class: "fm-typo-en-body-lg-600" }, gs = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, _s = { class: "flex flex-col gap-8" }, Ss = { class: "flex gap-8 items-center" }, ws = { class: "flex-1 fm-typo-en-body-lg-600" }, Rs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, xs = { class: "flex w-full gap-4" }, Os = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2 flex items-center gap-2" }, Ns = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-2" }, $s = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, ks = ["innerHTML"], Cs = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, As = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, Ds = {
1617
+ key: 0,
1618
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1619
+ }, qs = { class: "py-8" }, Ts = { class: "flex justify-end gap-4 items-center" }, Ps = { class: "fm-typo-en-body-lg-600" }, Is = {
1620
+ key: 1,
1621
+ class: "flex-1 xs:w-screen xs:max-w-full"
1622
+ }, Fs = {
1623
+ key: 0,
1624
+ class: "flex flex-col items-center gap-8 h-full"
1625
+ }, Ls = ["src"], Es = { class: "fm-typo-en-body-lg-600" }, Bs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Vs = {
1626
+ key: 1,
1627
+ class: "px-4 flex flex-col"
1628
+ }, Us = { class: "flex gap-12 content-stretch" }, Ms = {
1629
+ class: "flex flex-col w-24",
1630
+ name: "circles"
1631
+ }, Ks = { class: "flex-1 flex flex-col items-center" }, js = { class: "flex-1 flex flex-col items-center" }, zs = {
1632
+ class: "py-12 flex flex-col gap-4",
1633
+ name: "received-at header"
1634
+ }, Gs = { class: "fm-typo-en-body-lg-400" }, Hs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ws = { class: "flex gap-12 content-stretch" }, Ys = {
1635
+ class: "flex flex-col w-24",
1636
+ name: "circles"
1637
+ }, Qs = { class: "flex-1 flex flex-col items-center" }, Xs = {
1638
+ class: "py-12 flex flex-col gap-4 flex-1",
1639
+ name: "delivery details"
1640
+ }, Zs = { class: "flex flex-col gap-8" }, Js = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, eo = { class: "flex flex-col gap-4" }, to = { class: "flex gap-8 xs:flex-col" }, vo = /* @__PURE__ */ Re({
1641
+ __name: "TransferDetails",
1642
+ props: {
1643
+ poRequest: {},
1644
+ purchaseOrder: {},
1645
+ transferTo: {},
1646
+ transferToDbName: {},
1647
+ show: { type: Boolean },
1648
+ canResubmit: { type: Boolean },
1649
+ canApprove: { type: Boolean },
1650
+ scope: {},
1651
+ receivedMap: {}
1652
+ },
1653
+ emits: ["update:show", "submitted"],
1654
+ setup(h, { emit: t }) {
1655
+ const s = h, _ = t, i = et(), r = Ke(), d = Ve(), n = ge(), o = Me(), v = re(
1656
+ () => {
1657
+ var a, m;
1658
+ return {
1659
+ id: ((a = o.sessionUser.value) == null ? void 0 : a.id) ?? "",
1660
+ name: ((m = o.sessionUser.value) == null ? void 0 : m.displayName) ?? ""
1661
+ };
1662
+ }
1663
+ ), x = Yt(), { t: g } = vt(), b = re(
1664
+ () => {
1665
+ var a, m, A, N;
1666
+ return ((m = (a = s.purchaseOrder) == null ? void 0 : a.supplier) == null ? void 0 : m.internal) === "restaurant" || ((N = (A = s.purchaseOrder) == null ? void 0 : A.supplier) == null ? void 0 : N.internal) === "warehouse" ? we.TRANSFER : we.PURCHASE;
1667
+ }
1668
+ ), p = z(!1), l = z(""), c = z(!0), u = je(), O = Vt(u.getWorkflowConfig), q = bt(), T = re(() => {
1669
+ if (!s.purchaseOrder)
1670
+ return [];
1671
+ const a = O.result.value;
1672
+ if (a.state === lt.loading)
1673
+ return [];
1674
+ const m = {
1675
+ user: v.value,
1676
+ executedAt: n.locations.computeFirst(
1677
+ (N) => {
1678
+ var L;
1679
+ return N.dbName === ((L = n._currentLocation) == null ? void 0 : L.dbName) ? N : null;
1680
+ }
1681
+ ),
1682
+ purchaseOrderRequest: s.poRequest,
1683
+ purchaseOrder: s.purchaseOrder
1684
+ };
1685
+ let A = [];
1686
+ try {
1687
+ a.state === lt.error ? (console.error("Error fetching workflow config:", a.error), A = ze.getAvailableActions({
1688
+ ...m,
1689
+ orderConfig: ze.getDefaultConfig()
1690
+ }).actions.filter(
1691
+ (N) => (
1692
+ // TODO: create receiveStock & processRequest dialog
1693
+ // to create their payload
1694
+ N !== k.enum.receiveStock && N !== k.enum.processRequest && N !== k.enum.closeRequest
1695
+ )
1696
+ )) : A = ze.getAvailableActions({
1697
+ ...m,
1698
+ orderConfig: a.data
1699
+ }).actions.filter(
1700
+ (N) => N !== k.enum.receiveStock && N !== k.enum.processRequest && N !== k.enum.closeRequest
1701
+ );
1702
+ } catch (N) {
1703
+ console.error("Error getting available actions:", N);
1704
+ }
1705
+ return s.scope === "approval" && (A = A.filter((N) => N !== k.enum.completeReceive)), A;
1706
+ }), P = qt(s, "show"), $ = re(() => [
1707
+ {
1708
+ label: g("inventory.transfer.receiveRequest.details.overview"),
1709
+ value: "overview"
1710
+ },
1711
+ {
1712
+ label: g("inventory.transfer.receiveRequest.details.deliveryHistory"),
1713
+ value: "deliveryHistory"
1714
+ }
1715
+ ]), U = z($.value[0]);
1716
+ kt(
1717
+ () => s.show,
1718
+ (a) => {
1719
+ a && (U.value = $.value[0]);
1720
+ }
1721
+ );
1722
+ async function pe(a, m, A, N, L) {
1723
+ return new Promise((E, M) => {
1724
+ i.open({
1725
+ closeButton: !1,
1726
+ title: N.title,
1727
+ message: N.message,
1728
+ primaryActions: N.primaryActions,
1729
+ secondaryActions: { text: "No", close: !1 }
1730
+ }).onPrimary(async () => {
1731
+ var B, Q, ee, K;
1732
+ const f = [];
1733
+ A === k.enum.approveRequest ? (f.push({
1734
+ action: "approveRequest",
1735
+ payload: null
1736
+ }), m.fulfillment && f.push({
1737
+ action: "processRequest",
1738
+ payload: {
1739
+ fulfillmentId: "",
1740
+ deliveryOrderNumber: "",
1741
+ deliveryRemark: null,
1742
+ items: m.fulfillment.items,
1743
+ createdBy: v.value
1744
+ }
1745
+ })) : A === k.enum.processRequest ? m.fulfillment && f.push({
1746
+ action: "processRequest",
1747
+ payload: {
1748
+ fulfillmentId: "",
1749
+ deliveryOrderNumber: "",
1750
+ deliveryRemark: null,
1751
+ items: m.fulfillment.items,
1752
+ createdBy: v.value
1753
+ }
1754
+ }) : A === k.enum.rejectRequest ? f.push({
1755
+ action: "rejectRequest",
1756
+ payload: null
1757
+ }) : A === k.enum.closeRequest && f.push({
1758
+ action: "closeRequest",
1759
+ payload: null
1760
+ });
1761
+ try {
1762
+ await q({
1763
+ operate: {
1764
+ operation: A,
1765
+ doc: a,
1766
+ options: m
1767
+ },
1768
+ operateV2: {
1769
+ _id: ((B = s.purchaseOrder) == null ? void 0 : B._id) ?? "",
1770
+ _rev: ((Q = s.purchaseOrder) == null ? void 0 : Q._rev) ?? "",
1771
+ action: A,
1772
+ payloads: f
1773
+ // add payload if action is receiveStock or processRequest
1774
+ },
1775
+ transferTo: (K = (ee = s.poRequest) == null ? void 0 : ee.to) == null ? void 0 : K.dbName
1776
+ }).delayed(1e3), E("submitted");
1777
+ } catch (ie) {
1778
+ M(ie);
1779
+ }
1780
+ }).onSecondary(() => {
1781
+ E("cancelled");
1782
+ for (let f = 0; f < L + 2; f++)
1783
+ i.close();
1784
+ }).onClose(() => {
1785
+ });
1786
+ });
1787
+ }
1788
+ async function de(a) {
1789
+ var L, E, M, f;
1790
+ if (a === k.enum.receiveStock)
1791
+ return;
1792
+ const m = ht[a];
1793
+ if (!m) {
1794
+ r.open({
1795
+ title: "Something went wrong",
1796
+ message: `Cannot process order: ${Je(a)}`,
1797
+ type: "error"
1798
+ });
1799
+ return;
1800
+ }
1801
+ const { successMessage: A, ...N } = m;
1802
+ if (s.purchaseOrder) {
1803
+ l.value = `${a}`, p.value = !0, c.value = !1;
1804
+ const B = {};
1805
+ let Q = 0;
1806
+ if ((a === k.enum.confirmDraft || // auto receive for warehouse to warehouse
1807
+ a === k.enum.completeReceive) && d.autoReceiveWarehouse)
1808
+ B.autoReceive = !0;
1809
+ else if ((a === k.enum.approveRequest || a === k.enum.processRequest) && d.acceptRequireFulfillment) {
1810
+ const ee = (E = (L = s.poRequest) == null ? void 0 : L.from) == null ? void 0 : E.dbName, K = (f = (M = s.poRequest) == null ? void 0 : M.to) == null ? void 0 : f.dbName;
1811
+ if (ee && K && (ee.startsWith("warehouse_") || K.startsWith("warehouse_"))) {
1812
+ const ie = await new Promise((Y, ve) => {
1813
+ i.open({
1814
+ closeButton: !1,
1815
+ title: "Confirm transfer amount",
1816
+ dialogComponent: Wt,
1817
+ dialogComponentProps: {
1818
+ purchaseOrder: s.purchaseOrder,
1819
+ confirm: Y,
1820
+ "onUpdate:show": (_e) => {
1821
+ _e || (l.value = "", p.value = !1, c.value = !0, Q++, i.close()), ve("cancelled");
1822
+ }
1823
+ }
1824
+ });
1825
+ });
1826
+ B.fulfillment = ie;
1827
+ }
1828
+ }
1829
+ try {
1830
+ await pe(
1831
+ s.purchaseOrder,
1832
+ B,
1833
+ a,
1834
+ m,
1835
+ Q
1836
+ ) === "submitted" && (r.open({
1837
+ title: "Success",
1838
+ message: A,
1839
+ type: "success"
1840
+ }), _("update:show", !1), _("submitted"));
1841
+ } catch (ee) {
1842
+ r.open({
1843
+ title: "Something went wrong",
1844
+ message: "Please try again.",
1845
+ type: "error"
1846
+ }), console.error("Error when submitting PO operation", a, s.purchaseOrder, ee);
1847
+ } finally {
1848
+ l.value = "", p.value = !1, c.value = !0;
1849
+ }
1850
+ }
1851
+ }
1852
+ const xe = re(() => {
1853
+ var a, m;
1854
+ return ((a = s.purchaseOrder) == null ? void 0 : a.status) === W.enum.RECEIVING || ((m = s.purchaseOrder) == null ? void 0 : m.status) === W.enum.COMPLETE;
1855
+ }), Pe = re(() => {
1856
+ const a = s.purchaseOrder;
1857
+ if (!a) return { status: "", statusClass: "" };
1858
+ const m = Ee(a), { partial: A, over: N } = Qe(m), L = Xe(a.status, A, N);
1859
+ let E = g(`inventory.transfer.status.${L}`), M = `${a.status}`.toLocaleLowerCase("en-us");
1860
+ return L === W.enum.CLOSE && (E = `${g(`inventory.transfer.status.${W.enum.COMPLETE}`)}`), L === "PARTIAL_RECEIVED" && M === W.enum.PROCESSING.toLocaleLowerCase("en-us") && (M = W.enum.RECEIVING.toLocaleLowerCase("en-us")), {
1861
+ status: E,
1862
+ statusClass: `fm-status-badge fm-status-badge-${M}`
1863
+ };
1864
+ }), ye = re(() => {
1865
+ var E, M;
1866
+ const a = ((E = s.purchaseOrder) == null ? void 0 : E.deliveryOrder) ?? [], m = ((M = s.purchaseOrder) == null ? void 0 : M.deliveryFullfillment) ?? [], A = [
1867
+ ...a.map((f) => ({
1868
+ createdAt: f.createdAt,
1869
+ type: "grn",
1870
+ doc: f
1871
+ })),
1872
+ ...m.map((f) => ({
1873
+ createdAt: f.createdAt,
1874
+ type: "fulfillment",
1875
+ doc: f
1876
+ }))
1877
+ ];
1878
+ A.reverse().sort((f, B) => f.createdAt.localeCompare(B.createdAt));
1879
+ function N(f) {
1880
+ var ee, K, ie, Y, ve, _e, ke, Ce, j;
1881
+ const B = m.findIndex((V) => V.id === f.fullfillmentId), Q = [
1882
+ (K = (ee = m[B]) == null ? void 0 : ee.netSuite) != null && K.refNo ? {
1883
+ label: "Fulfillment's ref no. (Netsuite)",
1884
+ values: [(Y = (ie = m[B]) == null ? void 0 : ie.netSuite) == null ? void 0 : Y.refNo]
1885
+ } : null,
1886
+ (ve = f == null ? void 0 : f.netSuite) != null && ve.refNo ? {
1887
+ label: "Netsuite ref no.",
1888
+ values: [(_e = f == null ? void 0 : f.netSuite) == null ? void 0 : _e.refNo]
1889
+ } : null,
1890
+ (ke = f == null ? void 0 : f.netSuite) != null && ke.recordType ? {
1891
+ label: "Netsuite Type",
1892
+ values: [ft((Ce = f == null ? void 0 : f.netSuite) == null ? void 0 : Ce.recordType)]
1893
+ } : null
1894
+ ];
1895
+ return {
1896
+ header: "Received",
1897
+ date: Ge(new Date(f.createdAt)),
1898
+ info: [
1899
+ {
1900
+ label: "Adjustment date",
1901
+ values: [
1902
+ f.adjustment ? Ge(new Date(Nt(f.adjustment))) : "-"
1903
+ ]
1904
+ },
1905
+ {
1906
+ label: "Received by",
1907
+ values: [(j = f.createdBy) == null ? void 0 : j.name]
1908
+ },
1909
+ {
1910
+ label: "Received items",
1911
+ values: f.received.map((V) => {
1912
+ var X;
1913
+ return C("div", [
1914
+ C(
1915
+ "div",
1916
+ {
1917
+ class: "flex gap-4"
1918
+ },
1919
+ [
1920
+ C(
1921
+ "div",
1922
+ {
1923
+ class: "flex flex-col"
1924
+ },
1925
+ [
1926
+ C(
1927
+ "span",
1928
+ {
1929
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1930
+ },
1931
+ `${V.sku.name}`
1932
+ ),
1933
+ C(
1934
+ "span",
1935
+ {
1936
+ class: "fm-typo-en-body-md-400"
1937
+ },
1938
+ `${V.sku.code} `
1939
+ )
1940
+ ]
1941
+ ),
1942
+ C(
1943
+ "div",
1944
+ {
1945
+ class: "ml-auto flex flex-col"
1946
+ },
1947
+ [
1948
+ C(
1949
+ "div",
1950
+ {
1951
+ class: "ml-auto flex gap-1"
1952
+ },
1953
+ [
1954
+ C(
1955
+ "span",
1956
+ {
1957
+ class: "fm-typo-en-body-lg-600 self-end"
1958
+ },
1959
+ be(V.amount, !1)
1960
+ ),
1961
+ C(
1962
+ "span",
1963
+ {
1964
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1965
+ },
1966
+ ((X = V.measurement) == null ? void 0 : X.abbrev) ?? V.sku.unit.abbrev
1967
+ )
1968
+ ]
1969
+ ),
1970
+ C(
1971
+ "div",
1972
+ {
1973
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1974
+ },
1975
+ `${V.cost ? `(${Fe(V.cost)})` : ""}`
1976
+ )
1977
+ ]
1978
+ )
1979
+ ]
1980
+ )
1981
+ ]);
1982
+ })
1983
+ },
1984
+ f.deliveryOrderNumber ? {
1985
+ label: "Delivery order no.",
1986
+ values: [f.deliveryOrderNumber]
1987
+ } : null,
1988
+ f.remark ? {
1989
+ label: "Remark",
1990
+ values: [f.remark]
1991
+ } : null,
1992
+ B > -1 ? {
1993
+ label: "Fulfilment's sequence",
1994
+ values: [`${B + 1}`]
1995
+ } : null,
1996
+ ...Q
1997
+ ].filter((V) => V)
1998
+ };
1999
+ }
2000
+ function L(f) {
2001
+ var Q, ee;
2002
+ const B = m.findIndex((K) => K.id === f.id);
2003
+ return {
2004
+ header: "Fulfillment",
2005
+ date: Ge(new Date(f.createdAt)),
2006
+ info: [
2007
+ {
2008
+ label: "Sequence",
2009
+ values: [String(B + 1)]
2010
+ },
2011
+ {
2012
+ label: "Receiveable items",
2013
+ values: f.items.map((K) => {
2014
+ var ie;
2015
+ return C("div", [
2016
+ C(
2017
+ "div",
2018
+ {
2019
+ class: "flex gap-4"
2020
+ },
2021
+ [
2022
+ C(
2023
+ "div",
2024
+ {
2025
+ class: "flex flex-col"
2026
+ },
2027
+ [
2028
+ C(
2029
+ "span",
2030
+ {
2031
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
2032
+ },
2033
+ `${K.sku.name}`
2034
+ ),
2035
+ C(
2036
+ "span",
2037
+ {
2038
+ class: "fm-typo-en-body-md-400"
2039
+ },
2040
+ `${K.sku.code} `
2041
+ )
2042
+ ]
2043
+ ),
2044
+ C(
2045
+ "div",
2046
+ {
2047
+ class: "ml-auto flex flex-col"
2048
+ },
2049
+ [
2050
+ C(
2051
+ "div",
2052
+ {
2053
+ class: "ml-auto flex gap-1"
2054
+ },
2055
+ [
2056
+ C(
2057
+ "span",
2058
+ {
2059
+ class: "fm-typo-en-body-lg-600 self-end"
2060
+ },
2061
+ be(K.amount, !1)
2062
+ ),
2063
+ C(
2064
+ "span",
2065
+ {
2066
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2067
+ },
2068
+ ((ie = K.measurement) == null ? void 0 : ie.abbrev) ?? K.sku.unit.abbrev
2069
+ )
2070
+ ]
2071
+ ),
2072
+ C(
2073
+ "div",
2074
+ {
2075
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
2076
+ },
2077
+ `${K.cost ? `(${Fe(K.cost)})` : ""}`
2078
+ )
2079
+ ]
2080
+ )
2081
+ ]
2082
+ )
2083
+ ]);
2084
+ })
2085
+ },
2086
+ (Q = f.netSuite) != null && Q.refNo ? {
2087
+ label: "Ref no. (Netsuite)",
2088
+ values: [(ee = f.netSuite) == null ? void 0 : ee.refNo]
2089
+ } : null
2090
+ ].filter((K) => K)
2091
+ };
2092
+ }
2093
+ return A.map((f) => {
2094
+ switch (f.type) {
2095
+ case "grn":
2096
+ return N(f.doc);
2097
+ case "fulfillment":
2098
+ return L(f.doc);
2099
+ }
2100
+ });
2101
+ }), D = re(() => {
2102
+ var m;
2103
+ const a = {
2104
+ ...dt(0),
2105
+ currency: it()
2106
+ };
2107
+ return ((m = s.purchaseOrder) == null ? void 0 : m.items.reduce((A, N) => ({
2108
+ ...ut(A, N.totalCost ?? a),
2109
+ currency: it()
2110
+ }), a)) ?? a;
2111
+ });
2112
+ function I(a) {
2113
+ var E;
2114
+ const A = (((E = s.purchaseOrder) == null ? void 0 : E.version) ?? Se.enum[1]) === Se.enum[2] ? a.id : a.sku._id, N = s.receivedMap[A];
2115
+ return `<span class="${te(a)} fm-typo-en-body-lg-600">${De.toFormatString({ value: N.received })}</span>/${It(a.quantity, a.sku.unit, a.measurement)}`;
2116
+ }
2117
+ function te(a) {
2118
+ var B;
2119
+ const A = (((B = s.purchaseOrder) == null ? void 0 : B.version) ?? Se.enum[1]) === Se.enum[2] ? a.id : a.sku._id, N = s.receivedMap[A], { isPartialReceive: L, isNoReceive: E, isOverReceive: M, isFullReceive: f } = Mt(N);
2120
+ return E ? "text-fm-color-typo-tertiary" : L ? "text-fm-color-system-warning-300" : M ? "text-fm-color-system-error-300" : f ? "text-fm-color-system-success-300" : "";
2121
+ }
2122
+ const G = re(() => {
2123
+ var a, m, A;
2124
+ return (a = s.purchaseOrder) != null && a.itemsAtSubmission ? ((m = s.purchaseOrder) == null ? void 0 : m.version) === Se.enum[2] ? s.purchaseOrder.items.reduce((N, L) => {
2125
+ var M, f;
2126
+ const E = (f = (M = s.purchaseOrder) == null ? void 0 : M.itemsAtSubmission) == null ? void 0 : f.find(
2127
+ (B) => B.id === L.id
2128
+ );
2129
+ return E && E.quantity !== L.quantity && N.set(L.sku.code, {
2130
+ originalAmount: Number(De.toFormatString({ value: E.quantity })),
2131
+ newAmount: Number(De.toFormatString({ value: L.quantity }))
2132
+ }), N;
2133
+ }, /* @__PURE__ */ new Map()) : (A = s.purchaseOrder) == null ? void 0 : A.items.reduce((N, L) => {
2134
+ var B, Q;
2135
+ const E = (Q = (B = s.purchaseOrder) == null ? void 0 : B.itemsAtSubmission) == null ? void 0 : Q.find(
2136
+ (ee) => ee.sku._id === L.sku._id
2137
+ ), M = E ? Number(De.toFormatString({ value: E.quantity })) : 0, f = Number(De.toFormatString({ value: L.quantity }));
2138
+ return E && M !== f && N.set(L.sku.code, {
2139
+ originalAmount: M,
2140
+ newAmount: f
2141
+ }), N;
2142
+ }, /* @__PURE__ */ new Map()) : /* @__PURE__ */ new Map();
2143
+ }), ne = (a) => {
2144
+ var A, N;
2145
+ const m = G.value;
2146
+ return ((A = s.purchaseOrder) == null ? void 0 : A.version) === Se.enum[2] ? m.has(a.id) : m.has((N = a.sku) == null ? void 0 : N.code);
2147
+ }, J = (a) => {
2148
+ var A, N;
2149
+ const m = G.value;
2150
+ return ((A = s.purchaseOrder) == null ? void 0 : A.version) === Se.enum[2] ? m.get(a.id) : m.get((N = a.sku) == null ? void 0 : N.code);
2151
+ };
2152
+ return (a, m) => {
2153
+ var K, ie;
2154
+ const A = Z("FmButtonGroup"), N = Z("FmChip"), L = Z("FmMenuDivider"), E = Z("FmCard"), M = Z("FmIcon"), f = Z("FmTooltip"), B = Z("FmSpacer"), Q = Z("FmButton"), ee = Z("FmSideSheet");
2155
+ return y(), ue(ee, {
2156
+ header: S(g)("inventory.transfer.receiveRequest.details.title") + ((K = a.purchaseOrder) != null && K.seqNumber ? ` #${(ie = a.purchaseOrder) == null ? void 0 : ie.seqNumber}` : ""),
2157
+ modelValue: S(P),
2158
+ "onUpdate:modelValue": m[5] || (m[5] = (Y) => Ct(P) ? P.value = Y : null),
2159
+ "dismiss-away": c.value,
2160
+ "close-button": "",
2161
+ "max-width": 600
2162
+ }, {
2163
+ default: se(() => {
2164
+ var Y, ve, _e, ke, Ce;
2165
+ return [
2166
+ e("div", Gr, [
2167
+ e("div", null, [
2168
+ F(A, {
2169
+ items: $.value,
2170
+ modelValue: U.value,
2171
+ "onUpdate:modelValue": m[0] || (m[0] = (j) => U.value = j)
2172
+ }, null, 8, ["items", "modelValue"])
2173
+ ]),
2174
+ U.value.value === "overview" ? (y(), R(ae, { key: 0 }, [
2175
+ e("div", null, [
2176
+ F(E, {
2177
+ variant: "outlined",
2178
+ class: "flex flex-col gap-8 px-12 py-16"
2179
+ }, {
2180
+ default: se(() => {
2181
+ var j, V, X, me, fe, Ie, tt, rt, st;
2182
+ return [
2183
+ e("div", Hr, [
2184
+ e("div", Wr, w(S(g)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
2185
+ e("div", Yr, [
2186
+ F($e, null, {
2187
+ default: se(() => {
2188
+ var ot;
2189
+ return [
2190
+ Ne(w((ot = s.purchaseOrder) == null ? void 0 : ot.status), 1)
2191
+ ];
2192
+ }),
2193
+ _: 1
2194
+ }),
2195
+ F(N, {
2196
+ label: Pe.value.status,
2197
+ class: Te(Pe.value.statusClass),
2198
+ compact: ""
2199
+ }, null, 8, ["label", "class"])
2200
+ ])
2201
+ ]),
2202
+ F(L),
2203
+ e("div", Qr, [
2204
+ e("div", Xr, [
2205
+ e("div", Zr, [
2206
+ e("div", Jr, w(S(g)("inventory.transfer.receiveRequest.details.createdAt")), 1)
2207
+ ]),
2208
+ e("div", es, w(S(Le)(((j = a.purchaseOrder) == null ? void 0 : j._id) ?? "")), 1)
2209
+ ]),
2210
+ (V = a.purchaseOrder) != null && V.effectiveAt ? (y(), R("div", ts, [
2211
+ e("div", rs, w(S(g)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
2212
+ e("div", ss, w(S(mt)(new Date((X = a.purchaseOrder) == null ? void 0 : X.effectiveAt))), 1)
2213
+ ])) : H("", !0),
2214
+ e("div", os, [
2215
+ e("div", ns, w(S(g)("inventory.transfer.receiveRequest.details.type.title")), 1),
2216
+ e("div", as, w(S(g)(
2217
+ `inventory.transfer.receiveRequest.details.type.${b.value.toLocaleLowerCase("en-US")}`
2218
+ )), 1)
2219
+ ]),
2220
+ (fe = (me = a.purchaseOrder) == null ? void 0 : me.supplier) != null && fe.name ? (y(), R("div", is, [
2221
+ e("div", ls, w(S(g)("inventory.transfer.receiveRequest.details.from")), 1),
2222
+ e("div", cs, w((tt = (Ie = a.purchaseOrder) == null ? void 0 : Ie.supplier) == null ? void 0 : tt.name), 1)
2223
+ ])) : H("", !0),
2224
+ a.transferTo ? (y(), R("div", us, [
2225
+ e("div", ds, w(S(g)("inventory.transfer.receiveRequest.details.to")), 1),
2226
+ e("div", ms, w(a.transferTo), 1)
2227
+ ])) : H("", !0),
2228
+ (rt = a.purchaseOrder) != null && rt.ref ? (y(), R("div", fs, [
2229
+ e("div", ps, w(S(g)("inventory.transfer.receiveRequest.details.reference")), 1),
2230
+ e("div", ys, w(a.purchaseOrder.ref), 1)
2231
+ ])) : H("", !0),
2232
+ (st = a.purchaseOrder) != null && st.remark ? (y(), R("div", vs, [
2233
+ e("div", hs, w(S(g)("inventory.transfer.receiveRequest.details.remark")), 1),
2234
+ e("div", bs, w(a.purchaseOrder.remark), 1)
2235
+ ])) : H("", !0)
2236
+ ])
2237
+ ];
2238
+ }),
2239
+ _: 1
2240
+ })
2241
+ ]),
2242
+ F(zr, {
2243
+ "po-request": a.poRequest,
2244
+ purchaseOrder: a.purchaseOrder,
2245
+ transferType: b.value,
2246
+ transferToDbName: a.transferToDbName,
2247
+ scope: a.scope
2248
+ }, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
2249
+ e("div", gs, [
2250
+ e("div", _s, [
2251
+ e("div", Ss, [
2252
+ e("span", ws, [
2253
+ Ne(w(xe.value ? S(g)("inventory.transfer.receiveRequest.details.receivedItems") : S(g)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
2254
+ (ve = (Y = a.purchaseOrder) == null ? void 0 : Y.netSuite) != null && ve.missingItems && ((ke = (_e = a.purchaseOrder) == null ? void 0 : _e.netSuite) == null ? void 0 : ke.missingItems.length) > 0 ? (y(), ue(f, {
2255
+ key: 0,
2256
+ variant: "rich",
2257
+ placement: "top",
2258
+ "z-index": 51
2259
+ }, {
2260
+ content: se(() => {
2261
+ var j, V;
2262
+ return [
2263
+ e("div", Rs, [
2264
+ (y(!0), R(ae, null, he((V = (j = a.purchaseOrder) == null ? void 0 : j.netSuite) == null ? void 0 : V.missingItems, (X, me) => (y(), R("div", {
2265
+ class: "flex justify-center align-middle",
2266
+ key: me
2267
+ }, [
2268
+ F(M, {
2269
+ name: "arrow_right",
2270
+ size: "sm"
2271
+ }),
2272
+ Ne(" " + w(`(${X.netSuiteId}) ${X.name}: ${X.reason}`), 1)
2273
+ ]))), 128))
2274
+ ])
2275
+ ];
2276
+ }),
2277
+ default: se(() => [
2278
+ F(M, {
2279
+ name: "error",
2280
+ color: "#ff2c2c",
2281
+ size: "sm"
2282
+ })
2283
+ ]),
2284
+ _: 1
2285
+ })) : H("", !0)
2286
+ ])
2287
+ ]),
2288
+ F(L),
2289
+ (y(!0), R(ae, null, he(((Ce = a.purchaseOrder) == null ? void 0 : Ce.items) ?? [], (j, V) => {
2290
+ var X;
2291
+ return y(), R("div", {
2292
+ key: V,
2293
+ class: "flex flex-col"
2294
+ }, [
2295
+ e("div", xs, [
2296
+ e("div", Os, [
2297
+ Ne(w(j.name) + " ", 1),
2298
+ ne(j) ? (y(), ue(f, {
2299
+ key: 0,
2300
+ variant: "rich",
2301
+ placement: "top",
2302
+ "z-index": 51
2303
+ }, {
2304
+ content: se(() => {
2305
+ var me, fe;
2306
+ return [
2307
+ e("div", Ns, [
2308
+ m[6] || (m[6] = e("div", { class: "font-semibold" }, "Submission changes", -1)),
2309
+ e("div", null, "Original Amount: " + w((me = J(j)) == null ? void 0 : me.originalAmount), 1),
2310
+ e("div", null, " New Amount: " + w((fe = J(j)) == null ? void 0 : fe.newAmount), 1)
2311
+ ])
2312
+ ];
2313
+ }),
2314
+ default: se(() => [
2315
+ F(M, {
2316
+ name: "error",
2317
+ color: "#ff9500",
2318
+ size: "sm"
2319
+ })
2320
+ ]),
2321
+ _: 2
2322
+ }, 1024)) : H("", !0)
2323
+ ]),
2324
+ e("div", $s, [
2325
+ e("span", {
2326
+ innerHTML: I(j)
2327
+ }, null, 8, ks)
2328
+ ])
2329
+ ]),
2330
+ e("div", Cs, [
2331
+ e("div", As, w(j.code), 1),
2332
+ (X = j.totalCost) != null && X.amount && S(d).enableTotalCost ? (y(), R("div", Ds, " (" + w(S(Fe)(j.totalCost)) + ") ", 1)) : H("", !0)
2333
+ ])
2334
+ ]);
2335
+ }), 128)),
2336
+ +S(be)(D.value) ? (y(), R(ae, { key: 0 }, [
2337
+ e("div", qs, [
2338
+ F(L)
2339
+ ]),
2340
+ e("div", Ts, [
2341
+ m[7] || (m[7] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
2342
+ e("div", Ps, w(S(Fe)(D.value)), 1)
2343
+ ])
2344
+ ], 64)) : H("", !0)
2345
+ ])
2346
+ ])
2347
+ ], 64)) : U.value.value === "deliveryHistory" ? (y(), R("div", Is, [
2348
+ ye.value.length ? (y(), R("div", Vs, [
2349
+ (y(!0), R(ae, null, he(ye.value, (j, V) => (y(), R(ae, { key: V }, [
2350
+ e("div", Us, [
2351
+ e("div", Ms, [
2352
+ e("div", Ks, [
2353
+ e("div", {
2354
+ class: Te([
2355
+ {
2356
+ "bg-fm-color-primary": V !== 0,
2357
+ "bg-white": V === 0
2358
+ },
2359
+ "w-[2px] h-full"
2360
+ ])
2361
+ }, null, 2)
2362
+ ]),
2363
+ m[8] || (m[8] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
2364
+ e("div", js, [
2365
+ e("div", {
2366
+ class: Te([
2367
+ {
2368
+ "bg-fm-color-primary": V < ye.value.length - 1,
2369
+ "bg-white": V >= ye.value.length - 1
2370
+ },
2371
+ "w-[2px] h-full"
2372
+ ])
2373
+ }, null, 2)
2374
+ ])
2375
+ ]),
2376
+ e("div", zs, [
2377
+ e("div", Gs, w(j.header), 1),
2378
+ e("div", Hs, w(j.date), 1)
2379
+ ])
2380
+ ]),
2381
+ e("div", Ws, [
2382
+ e("div", Ys, [
2383
+ e("div", Qs, [
2384
+ e("div", {
2385
+ class: Te([
2386
+ {
2387
+ "bg-fm-color-primary": V < ye.value.length - 1,
2388
+ "bg-white": V >= ye.value.length - 1
2389
+ },
2390
+ "w-[2px] h-full"
2391
+ ])
2392
+ }, null, 2)
2393
+ ])
2394
+ ]),
2395
+ e("div", Xs, [
2396
+ F(E, {
2397
+ variant: "outlined",
2398
+ class: "py-12 px-16"
2399
+ }, {
2400
+ default: se(() => [
2401
+ e("div", Zs, [
2402
+ (y(!0), R(ae, null, he(j.info, (X, me) => (y(), R("div", {
2403
+ key: me,
2404
+ class: "flex flex-col gap-4"
2405
+ }, [
2406
+ e("div", Js, w(X == null ? void 0 : X.label), 1),
2407
+ e("div", eo, [
2408
+ (y(!0), R(ae, null, he(X == null ? void 0 : X.values, (fe, Ie) => (y(), R("div", {
2409
+ key: Ie,
2410
+ class: "fm-typo-en-body-lg-600"
2411
+ }, [
2412
+ typeof fe == "string" ? (y(), R(ae, { key: 0 }, [
2413
+ Ne(w(fe), 1)
2414
+ ], 64)) : (y(), ue(At(fe), { key: 1 }))
2415
+ ]))), 128))
2416
+ ])
2417
+ ]))), 128))
2418
+ ])
2419
+ ]),
2420
+ _: 2
2421
+ }, 1024)
2422
+ ])
2423
+ ])
2424
+ ], 64))), 128))
2425
+ ])) : (y(), R("div", Fs, [
2426
+ F(B),
2427
+ e("div", null, [
2428
+ e("img", {
2429
+ src: S(Ft),
2430
+ alt: "List is empty"
2431
+ }, null, 8, Ls)
2432
+ ]),
2433
+ e("div", Es, w(S(g)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
2434
+ e("div", Bs, w(S(g)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
2435
+ F(B),
2436
+ F(B)
2437
+ ]))
2438
+ ])) : H("", !0)
2439
+ ])
2440
+ ];
2441
+ }),
2442
+ "side-sheet-footer": se(() => [
2443
+ e("div", to, [
2444
+ (y(!0), R(ae, null, he(T.value, (Y) => (y(), R(ae, null, [
2445
+ S(We)[Y].available != !1 ? (y(), ue(Q, {
2446
+ key: Y,
2447
+ label: S(g)(S(We)[Y].translationKey),
2448
+ onClick: (ve) => de(Y),
2449
+ loading: l.value === Y,
2450
+ disabled: l.value !== Y && p.value,
2451
+ variant: S(We)[Y].buttonVariant
2452
+ }, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : H("", !0)
2453
+ ], 64))), 256)),
2454
+ S(x).ableToMarkReceived(a.purchaseOrder) && !T.value.includes("completeReceive") ? (y(), ue(Q, {
2455
+ key: 0,
2456
+ label: S(g)("inventory.transfer.receiveRequest.actions.completeReceive"),
2457
+ onClick: m[1] || (m[1] = (Y) => de("completeReceive")),
2458
+ loading: l.value === "completeReceive",
2459
+ disabled: l.value !== "completeReceive" && p.value
2460
+ }, null, 8, ["label", "loading", "disabled"])) : H("", !0),
2461
+ S(x).ableToMarkApproved(a.purchaseOrder) && a.canApprove && !T.value.includes("approveRequest") ? (y(), ue(Q, {
2462
+ key: 1,
2463
+ label: S(g)("inventory.transfer.approval.actions.approveRequest"),
2464
+ onClick: m[2] || (m[2] = (Y) => de("approveRequest")),
2465
+ loading: l.value === "approveRequest",
2466
+ disabled: l.value !== "approveRequest" && p.value
2467
+ }, null, 8, ["label", "loading", "disabled"])) : H("", !0),
2468
+ S(x).ableToCreateFulfillment(a.purchaseOrder, a.poRequest) && s.scope === "approval" ? (y(), ue(Q, {
2469
+ key: 2,
2470
+ label: S(g)("inventory.transfer.receiveRequest.actions.processRequest"),
2471
+ onClick: m[3] || (m[3] = (Y) => de("processRequest")),
2472
+ loading: l.value === "processRequest",
2473
+ disabled: l.value !== "processRequest" && p.value
2474
+ }, null, 8, ["label", "loading", "disabled"])) : H("", !0),
2475
+ F(Q, {
2476
+ label: S(g)("common.close"),
2477
+ variant: "tertiary",
2478
+ onClick: m[4] || (m[4] = (Y) => _("update:show", !1))
2479
+ }, null, 8, ["label"])
2480
+ ])
2481
+ ]),
2482
+ _: 1
2483
+ }, 8, ["header", "modelValue", "dismiss-away"]);
2484
+ };
2485
+ }
2486
+ });
2487
+ export {
2488
+ Ze as P,
2489
+ vo as _,
2490
+ po as a,
2491
+ yo as b,
2492
+ Kt as g,
2493
+ je as u
2494
+ };