@feedmepos/mf-inventory-portal 1.2.61-dev.1 → 1.2.63-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/{App-Dj4TFhg1.js → App-BHssUobV.js} +3 -3
  2. package/dist/{ApprovalView-Cpbfph-H.js → ApprovalView-DRGCQeGY.js} +5 -5
  3. package/dist/{BindingsDialog-CUbU9tih.js → BindingsDialog-CWl3LpdO.js} +2 -2
  4. package/dist/{BindingsPicker-CMlAGOJT.js → BindingsPicker-BcASw3JJ.js} +2 -2
  5. package/dist/{BindingsTable-DvOE5QM2.js → BindingsTable-BiKiLiVY.js} +3 -3
  6. package/dist/{ClosingDraftView-DKv-ehO_.js → ClosingDraftView-mh5Kw46x.js} +10 -10
  7. package/dist/{ClosingHistoryView-DIl78iH9.js → ClosingHistoryView-C-ZrFei9.js} +3 -3
  8. package/dist/{ClosingTemplateView-DPDh_geQ.js → ClosingTemplateView-DBNRH0Tt.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-Bi3xgagw.js → DeliveryOrderPrintPreview-Dv3JZ3yr.js} +1 -1
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B_5_SxUn.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CfL1adhx.js} +14 -14
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-B3Kl8YBw.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Db0JeXbc.js} +2 -2
  12. package/dist/{FmMultiselectDialog-BSOTemHV.js → FmMultiselectDialog-D9g07F_c.js} +1 -1
  13. package/dist/{FmMultiselectDialog-1IUxEPwt.js → FmMultiselectDialog-DuYKQng9.js} +2 -2
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BMK8Az4J.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CeXRT7Lf.js} +4 -4
  15. package/dist/{ImportView-CkitDDEU.js → ImportView-DoMyJ1NE.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DZUQavPo.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CqJQcOBK.js} +1 -1
  17. package/dist/{IngredientGroupView-ogDZwQFL.js → IngredientGroupView-D_Cl4kJy.js} +5 -5
  18. package/dist/{IngredientsView-B5AWPQhS.js → IngredientsView-CG6wUGzt.js} +15 -15
  19. package/dist/{IntegrationView-DIx6B_wR.js → IntegrationView-BIWPp1JH.js} +13 -13
  20. package/dist/{InventoryBindingForm-CAs2PaKF.js → InventoryBindingForm-BrL6-2He.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-D62U_Ewm.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-M3uVquEq.js} +5 -5
  22. package/dist/{InventoryBindingSummary-DNWMJUDR.js → InventoryBindingSummary-mnlQU1Mp.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-flGJ-4xe.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-ByPOKZRm.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CwcKHn69.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DHwXNoTs.js} +2 -2
  25. package/dist/{PublishView-IYCGQZF7.js → PublishView-B4iVMq25.js} +3 -3
  26. package/dist/{PurchaseOrderPrintPreview-CQ-J1uJn.js → PurchaseOrderPrintPreview-ws-SKrEC.js} +1 -1
  27. package/dist/ReceiveRequestView-deSiORNX.js +2807 -0
  28. package/dist/{RecipeView-KZV269Yw.js → RecipeView-EEK7PiKl.js} +15 -15
  29. package/dist/{StockView-F7oGArF7.js → StockView-6j_t2Kf1.js} +15 -15
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-j6pS_g4o.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CgAMsW8n.js} +1 -1
  31. package/dist/{SupplierView-DaDXVRF6.js → SupplierView-D5tSOECx.js} +12 -12
  32. package/dist/{SurchargeView-CBkF-szL.js → SurchargeView-CP81Q4dW.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BDxbVt07.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-Bmuw4PTO.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DnoutmMc.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D1FuB-kv.js} +1 -1
  35. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Canrz2ri.js +3493 -0
  36. package/dist/{TransferTemplateView-BlyMl_7M.js → TransferTemplateView-CRI_Lexa.js} +16 -16
  37. package/dist/{UnitCostHistoryView-B6mco57v.js → UnitCostHistoryView-CT-4QDK8.js} +4 -4
  38. package/dist/{UnitView-JRqgYWbI.js → UnitView-BZmfd-aw.js} +6 -6
  39. package/dist/{WarehouseView-Cb5Dj6f4.js → WarehouseView-BcmSyjA0.js} +5 -5
  40. package/dist/{WastageTemplateView-DoyXkHM6.js → WastageTemplateView-CNsdu0ga.js} +14 -14
  41. package/dist/{app-DMbbrEyL.js → app-ayv5Jw7D.js} +362 -358
  42. package/dist/app.js +1 -1
  43. package/dist/{closing-template-B68c4BCg.js → closing-template-D9UR8sMo.js} +1 -1
  44. package/dist/{date2-WSrIZrGN.js → date2-GNP-79dA.js} +1 -1
  45. package/dist/{dayjs.min-BEzS3oNC.js → dayjs.min-Bg_wgP2J.js} +1 -1
  46. package/dist/{defineDeepModel-B7GuNHyt.js → defineDeepModel-Co03tZfS.js} +1 -1
  47. package/dist/{duplicate-template-BTdZ25aR.js → duplicate-template-BiPU4Z2Y.js} +1 -1
  48. package/dist/{feature-DJFFmYSS.js → feature-BGeFfaiX.js} +1366 -1256
  49. package/dist/{format-time-from-id-BEqcrmTR.js → format-time-from-id-ByV0VX1x.js} +1 -1
  50. package/dist/{format-unit-display-DIqyPFuN.js → format-unit-display-r1Hb4DfH.js} +11 -11
  51. package/dist/{import-export.helper-Dnvx2Wa0.js → import-export.helper-PB9pPO3m.js} +6 -6
  52. package/dist/{index-J3wFLjDN.js → index-ClbYCYSU.js} +3 -3
  53. package/dist/{index-BNBtrozQ.js → index-DMqOVOHw.js} +1 -1
  54. package/dist/{index-dh2P5FKl.js → index-DWWlEK_r.js} +1 -1
  55. package/dist/{lodash-DoqYeksT.js → lodash-BbWPSHMM.js} +1 -1
  56. package/dist/{netsuite-C87QvoFY.js → netsuite-VGghPz8h.js} +37 -37
  57. package/dist/{number-nN9jCKom.js → number-DPuTdA-J.js} +2 -2
  58. package/dist/{purchase-order-template-CbRmEHxi.js → purchase-order-template-BMNxJR59.js} +1 -1
  59. package/dist/{rules-Dbz4JyZU.js → rules-CyF-4tvp.js} +2 -2
  60. package/dist/{stock-ChSl_QOD.js → stock-D1SElOsp.js} +3 -3
  61. package/dist/{stock-DrdiXQFX.js → stock-b7nNc6ko.js} +1 -1
  62. package/dist/{supplier-DWophRmk.js → supplier-Dm-bxVXL.js} +2 -2
  63. package/dist/{surcharge-Ds9TtpDs.js → surcharge-ZM-_XIvY.js} +1 -1
  64. package/dist/tsconfig.app.tsbuildinfo +1 -1
  65. package/dist/{use-ingredient-select-dialog-CPugamev.js → use-ingredient-select-dialog-BYxTRqif.js} +2 -2
  66. package/dist/{use-inventory-binding-dialog-Vj7T-h-w.js → use-inventory-binding-dialog-Dg9Mp0Vk.js} +2 -2
  67. package/dist/{use-template-enabled-locations-2-DfKY5avH.js → use-template-enabled-locations-2-BmgcViqJ.js} +2 -2
  68. package/dist/{vue-i18n-Td4-wYd2.js → vue-i18n-BwxQzDKn.js} +128 -128
  69. package/dist/{xlsx-DFL__z5b.js → xlsx-dJMIfias.js} +398 -398
  70. package/dist/{xlsx.util-Bi7Vb-wa.js → xlsx.util-dclbjq8C.js} +1 -1
  71. package/package.json +2 -2
  72. package/dist/ReceiveRequestView-NOIHVxoI.js +0 -2916
  73. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-B_u8kuNh.js +0 -3354
@@ -0,0 +1,3493 @@
1
+ import { p as qt, f as Ze } from "./format-time-from-id-ByV0VX1x.js";
2
+ import { defineComponent as Re, ref as J, watch as et, openBlock as l, createElementBlock as h, toDisplayString as y, createCommentVNode as L, createElementVNode as e, unref as f, withDirectives as Vt, vModelText as Et, computed as W, h as U, toRaw as Lt, shallowRef as gt, onUnmounted as Ut, triggerRef as Mt, reactive as jt, onMounted as Ct, resolveComponent as K, createBlock as ae, withCtx as re, createVNode as T, Fragment as ce, renderList as we, createTextVNode as Ie, normalizeClass as Ke, isRef as Bt, resolveDynamicComponent as zt } from "vue";
3
+ import { c as bt } from "./component-DpCUABT3.js";
4
+ import { R as me, D as be } from "./row-action.enum-BcW_L_nE.js";
5
+ import { o as Kt, u as Ae, U as F, V as nt, O as se, H as Gt, c as Rt, v as yt, a as Ht, W as _t, X as Wt, Y as Yt, Z as $t, t as Ye, s as Ce, D as tt, y as Le, E as Ee } from "./app-ayv5Jw7D.js";
6
+ import { k as Dt, F as Qt, c as kt, a as _e, t as rt, d as ze } from "./number-DPuTdA-J.js";
7
+ import { t as Jt, c as Xt, h as At, a as Qe } from "./date2-GNP-79dA.js";
8
+ import { u as Me, F as Zt, c as er, a as it } from "./feature-BGeFfaiX.js";
9
+ import { useI18n as at, useCoreStore as vt } from "@feedmepos/mf-common";
10
+ import { u as Je, a as ht, S as De } from "./netsuite-VGghPz8h.js";
11
+ import { useDialog as lt, useSnackbar as Ge, components as st, FmButtonVariant as Se, useProxiedModel as tr } from "@feedmepos/ui-library";
12
+ import { F as Ue } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
13
+ import { E as rr } from "./empty-placeholder-wf6-BWE8.js";
14
+ import { u as sr, a as or, f as nr } from "./format-unit-display-r1Hb4DfH.js";
15
+ import { u as He, _ as ar } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-Bmuw4PTO.js";
16
+ import { _ as lr, a as ir, b as cr } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-CeXRT7Lf.js";
17
+ import { u as ur, R as St } from "./usePromise-CbVUCxhj.js";
18
+ import { c as dr } from "./index-ClbYCYSU.js";
19
+ import { i as mr } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Db0JeXbc.js";
20
+ import { F as Ot } from "./form-mode.enum-BKiNVH6A.js";
21
+ import { d as Nt } from "./defineDeepModel-Co03tZfS.js";
22
+ import { u as pr } from "./vue-i18n-BwxQzDKn.js";
23
+ import { u as fr } from "./supplier-Dm-bxVXL.js";
24
+ import { u as yr } from "./surcharge-ZM-_XIvY.js";
25
+ const vr = Kt((b, r) => {
26
+ const s = Ae();
27
+ return {
28
+ async getShipments({
29
+ start: u,
30
+ end: v
31
+ }) {
32
+ const a = s.currentLocationDBName, g = `${b.inventoryBackendUrl}/${a}/shipments`;
33
+ return await r.get(`${g}?start=${u}&end=${v}`);
34
+ },
35
+ async getShipmentsByIds(u) {
36
+ if (u.length === 0)
37
+ return [];
38
+ const v = s.currentLocationDBName, a = `${b.inventoryBackendUrl}/${v}/shipments/get`;
39
+ return await r.post(a, { shipmentIds: u });
40
+ }
41
+ };
42
+ }), Ft = {
43
+ [F.enum.confirmDraft]: {
44
+ primaryActions: {
45
+ text: "Confirm draft",
46
+ close: !0
47
+ },
48
+ title: "Confirm draft?",
49
+ message: "Purchase order cannot be changed after confirm draft.",
50
+ successMessage: "Purchase order draft has been confirmed"
51
+ },
52
+ [F.enum.cancelDraft]: {
53
+ primaryActions: {
54
+ text: "Cancel draft",
55
+ close: !0,
56
+ variant: "destructive"
57
+ },
58
+ title: "Cancel draft?",
59
+ message: "Purchase order cannot be changed after cancelled draft.",
60
+ successMessage: "Purchase order draft has been cancelled"
61
+ },
62
+ [F.enum.approveDraft]: {
63
+ primaryActions: {
64
+ text: "Approve draft",
65
+ close: !0
66
+ },
67
+ title: "Approve draft?",
68
+ message: "Purchase order request will be accepted.",
69
+ successMessage: "Purchase order has been approved"
70
+ },
71
+ [F.enum.rejectDraft]: {
72
+ primaryActions: {
73
+ text: "Reject draft",
74
+ close: !0
75
+ },
76
+ title: "Reject draft?",
77
+ message: "Purchase order request will be rejected. You may provide an optional reason for rejection.",
78
+ successMessage: "Purchase order has been rejected"
79
+ },
80
+ [F.enum.submitRequest]: {
81
+ primaryActions: {
82
+ text: "Submit request",
83
+ close: !0
84
+ },
85
+ title: "Confirm draft?",
86
+ message: "Purchase order cannot be changed after confirm draft.",
87
+ successMessage: "Purchase order draft has been submitted"
88
+ },
89
+ [F.enum.completeReceive]: {
90
+ primaryActions: {
91
+ text: "Mark received",
92
+ close: !0
93
+ },
94
+ title: "Mark as received",
95
+ message: "Purchase order cannot be changed after it has complete receiving.",
96
+ successMessage: "Purchase order has been marked as received"
97
+ },
98
+ [F.enum.approveRequest]: {
99
+ primaryActions: {
100
+ text: "Accept request",
101
+ close: !0
102
+ },
103
+ title: "Accept request?",
104
+ message: "Transfer out request will be accepted.",
105
+ successMessage: "Transfer out request has been approved"
106
+ },
107
+ [F.enum.rejectRequest]: {
108
+ primaryActions: {
109
+ text: "Reject request",
110
+ close: !0,
111
+ variant: "destructive"
112
+ },
113
+ title: "Reject request?",
114
+ message: "Purchase order will be rejected.",
115
+ successMessage: "Purchase order has been rejected"
116
+ },
117
+ [F.enum.processRequest]: {
118
+ primaryActions: {
119
+ text: "Process request",
120
+ close: !0,
121
+ variant: "destructive"
122
+ },
123
+ title: "Process request?",
124
+ message: "Purchase order will be processed.",
125
+ successMessage: "Purchase order has been processed"
126
+ }
127
+ }, hr = { class: "p-4" }, gr = {
128
+ key: 0,
129
+ class: "fm-typo-en-body-md-400 mb-3"
130
+ }, br = { class: "fm-typo-en-body-md-400" }, Tt = /* @__PURE__ */ Re({
131
+ __name: "RejectDraftForm",
132
+ props: {
133
+ message: {},
134
+ confirm: { type: Function },
135
+ onChange: { type: Function }
136
+ },
137
+ setup(b) {
138
+ const r = b, { t: s } = at(), u = J("");
139
+ et(u, (a) => {
140
+ var g;
141
+ (g = r.onChange) == null || g.call(r, a ?? "");
142
+ });
143
+ function v() {
144
+ u.value = "";
145
+ }
146
+ return (a, g) => (l(), h("div", hr, [
147
+ r.message ? (l(), h("div", gr, y(r.message), 1)) : L("", !0),
148
+ e("label", br, y(f(s)("inventory.transfer.receiveRequest.details.rejectionReason")) + " (" + y(f(s)("inventory.common.optional")) + ")", 1),
149
+ Vt(e("textarea", {
150
+ "onUpdate:modelValue": g[0] || (g[0] = (t) => u.value = t),
151
+ rows: "4",
152
+ class: "w-full mt-2 p-2 border rounded"
153
+ }, null, 512), [
154
+ [Et, u.value]
155
+ ]),
156
+ e("div", { class: "mt-3 flex gap-2" }, [
157
+ e("button", {
158
+ type: "button",
159
+ class: "fm-btn fm-btn-tertiary",
160
+ onClick: v
161
+ }, "Clear")
162
+ ])
163
+ ]));
164
+ }
165
+ });
166
+ function ot(b) {
167
+ return nt.generatedPOReceivedMap({
168
+ purchaseOrder: b
169
+ });
170
+ }
171
+ function _r(b) {
172
+ return nt.validatePOItemReceivedStatus({
173
+ dto: b
174
+ });
175
+ }
176
+ function mt(b) {
177
+ return nt.validatePOReceivedStatus({
178
+ receivedMap: b
179
+ });
180
+ }
181
+ function pt(b, r, s) {
182
+ if (!se.safeParse(b).success)
183
+ throw new Error(`Invalid purchase order status: ${b}`);
184
+ const u = se.parse(b);
185
+ return nt.orderStatusCombination({
186
+ status: u,
187
+ isPOPartialReceive: r,
188
+ isPOOverReceive: s
189
+ });
190
+ }
191
+ function Pt() {
192
+ const b = Ae(), r = He(), s = Me();
193
+ async function u(a, g) {
194
+ const t = b.currentLocationDBName;
195
+ return a.doc.supplier.internal && a.operation === F.enum.confirmDraft && (a.operation = F.enum.submitRequest), await r.processPurchaseOrder(a, g || t);
196
+ }
197
+ async function v(a, g) {
198
+ const t = b.currentLocationDBName;
199
+ return await r.processPurchaseOrderV2(a, g || t);
200
+ }
201
+ return (a) => s.useOperatePurchaseOrderV2 ? v(a.operateV2, a.transferTo) : u(a.operate, a.transferTo);
202
+ }
203
+ var ft = /* @__PURE__ */ ((b) => (b.RECEIVE_REQUEST = "receive/request", b.APPROVAL = "approval", b))(ft || {});
204
+ const We = J(), ct = J();
205
+ function wa(b, r) {
206
+ const s = lt(), u = Ae(), v = Me();
207
+ Je();
208
+ const a = sr(), g = or(), t = J(!1), i = Ge(), _ = He(), w = vr(), C = J(new Array()), c = J(new Array()), R = J(
209
+ r != null && r.startDate && (r != null && r.endDate) ? r : mr()
210
+ ), $ = W(() => {
211
+ const M = new Date(R.value.startDate), j = new Date(R.value.endDate);
212
+ return {
213
+ start: Jt(M).toISOString(),
214
+ end: Xt(j).toISOString()
215
+ };
216
+ }), D = J(new Array()), n = Gt(), m = J(null);
217
+ async function d(M) {
218
+ function j(A) {
219
+ const O = {
220
+ mode: Ot.CREATE,
221
+ modelValue: M || void 0,
222
+ show: !0,
223
+ "onUpdate:show"(I) {
224
+ We.value.show = I;
225
+ },
226
+ templateId: A,
227
+ lastClosingDate: m.value
228
+ };
229
+ We.value = O;
230
+ }
231
+ let oe;
232
+ v.mustUsePoTemplate && !(M != null && M.template) ? s.open({
233
+ title: "Create transfer",
234
+ message: "",
235
+ primaryActions: {
236
+ text: "Select a template",
237
+ close: !0
238
+ },
239
+ secondaryActions: {
240
+ text: "Outlet to Outlet",
241
+ variant: "secondary",
242
+ close: !0
243
+ }
244
+ }).onPrimary(async () => {
245
+ oe = await a.getTemplateId(), oe && j(oe);
246
+ }).onSecondary(() => {
247
+ j(void 0);
248
+ }) : j(oe);
249
+ }
250
+ function S(M) {
251
+ const j = {
252
+ mode: Ot.UPDATE,
253
+ modelValue: Rt(M),
254
+ show: !0,
255
+ "onUpdate:show"(oe) {
256
+ We.value.show = oe;
257
+ },
258
+ lastClosingDate: m.value
259
+ };
260
+ We.value = j;
261
+ }
262
+ async function k() {
263
+ C.value = [], c.value = [], t.value = !0;
264
+ try {
265
+ const M = await _.getPurchaseOrders($.value);
266
+ C.value = M.sort((B, le) => le._id.localeCompare(B._id));
267
+ const j = M.flatMap((B) => B.shipmentIds || []).filter(Boolean), oe = j.length > 0 ? await w.getShipmentsByIds(j) : [];
268
+ c.value = oe;
269
+ const A = await n.readCurrentLocationLastClosing(!0), O = A == null ? void 0 : A._id;
270
+ O && (m.value = qt(O)), await v.awaitFeatureLoaded(() => v.mustUsePoTemplate) && await g.fetchTemplates();
271
+ const I = C.value.map((B) => {
272
+ var le;
273
+ return ((le = B.request) == null ? void 0 : le.id) ?? "";
274
+ }).filter((B) => B);
275
+ D.value = await _.readRequestByIds(I);
276
+ } catch {
277
+ i.open({
278
+ title: "Something went wrong",
279
+ message: "Error at fetching purchase orders",
280
+ type: "error"
281
+ });
282
+ } finally {
283
+ t.value = !1;
284
+ }
285
+ }
286
+ async function G() {
287
+ D.value = [], t.value = !0;
288
+ try {
289
+ D.value = await _.readRequests(
290
+ void 0,
291
+ $.value.start,
292
+ $.value.end
293
+ ).then((M) => M.reverse());
294
+ } catch {
295
+ i.open({
296
+ title: "Something went wrong",
297
+ message: "Error at fetching purchase requests",
298
+ type: "error"
299
+ });
300
+ } finally {
301
+ t.value = !1;
302
+ }
303
+ }
304
+ function N() {
305
+ switch (b) {
306
+ case "receive/request":
307
+ return k();
308
+ case "approval":
309
+ return G();
310
+ }
311
+ }
312
+ function ee(M, j) {
313
+ R.value = {
314
+ startDate: M,
315
+ endDate: j
316
+ }, N();
317
+ }
318
+ u.watchLocation(async (M) => {
319
+ if (!M) {
320
+ C.value = [];
321
+ return;
322
+ }
323
+ await N();
324
+ });
325
+ const z = J(), H = J(Math.random().toString());
326
+ async function he(M, j) {
327
+ const oe = Math.random().toString();
328
+ H.value = oe, j ?? (j = D.value.computeFirst(
329
+ (B) => B.purchaseOrderId === M._id ? B : null
330
+ ) ?? void 0);
331
+ const A = b === "receive/request" ? u.currentLocation : j == null ? void 0 : j.to, O = b === "approval", I = {
332
+ poRequest: j,
333
+ purchaseOrder: {
334
+ ...M,
335
+ status: O && (j != null && j.rejectedAt) ? se.Enum.REJECT : M.status
336
+ },
337
+ transferTo: A == null ? void 0 : A.name,
338
+ transferToDbName: A == null ? void 0 : A.dbName,
339
+ show: !0,
340
+ canResubmit: !1,
341
+ canApprove: O,
342
+ "onUpdate:show"(B) {
343
+ z.value.show = B;
344
+ },
345
+ scope: b,
346
+ receivedMap: ot(M) ?? {},
347
+ shipments: c.value
348
+ };
349
+ z.value = I;
350
+ }
351
+ async function fe(M, j, oe, A, O) {
352
+ const I = Pt();
353
+ t.value = !0;
354
+ try {
355
+ await I({
356
+ operate: {
357
+ operation: j,
358
+ doc: M,
359
+ options: (
360
+ // auto receive for supplier to warehouse
361
+ (j === F.enum.confirmDraft || // auto receive for warehouse to warehouse
362
+ j === F.enum.completeReceive) && v.autoReceiveWarehouse ? {
363
+ autoReceive: !0
364
+ } : void 0
365
+ )
366
+ },
367
+ operateV2: {
368
+ _id: M._id,
369
+ _rev: M._rev ?? "",
370
+ action: j,
371
+ payloads: O ?? []
372
+ },
373
+ transferTo: A
374
+ }), await new Promise((Ne) => setTimeout(Ne, 1e3));
375
+ const le = Ae().currentLocationDBName.startsWith("restaurant_");
376
+ j === F.enum.confirmDraft && M.effectiveAt && le ? i.open({
377
+ title: "Success",
378
+ message: `${oe}. The backdate will be reflected once your POS has received this change.`,
379
+ type: "success"
380
+ }) : i.open({
381
+ title: "Success",
382
+ message: oe,
383
+ type: "success"
384
+ });
385
+ } catch (B) {
386
+ i.open({
387
+ title: "Something went wrong",
388
+ message: "Please try again.",
389
+ type: "error"
390
+ }), console.error("Error when submitting PO operation", j, M, B);
391
+ } finally {
392
+ t.value = !1, N();
393
+ }
394
+ }
395
+ async function $e(M, j, oe) {
396
+ const A = Ft[j];
397
+ if (!A) {
398
+ i.open({
399
+ title: "Something went wrong",
400
+ message: `Cannot process order: ${yt(j)}`,
401
+ type: "error"
402
+ });
403
+ return;
404
+ }
405
+ const { successMessage: O, ...I } = A;
406
+ if (j === F.enum.rejectDraft) {
407
+ let B = "";
408
+ s.open({
409
+ title: I.title,
410
+ message: I.message,
411
+ primaryActions: I.primaryActions,
412
+ contentComponent: Tt,
413
+ contentComponentProps: {
414
+ message: I.message,
415
+ onChange: (le) => B = le
416
+ }
417
+ }).onPrimary(() => {
418
+ const le = [];
419
+ le.push({
420
+ action: "rejectDraft",
421
+ payload: {
422
+ rejectReason: B
423
+ }
424
+ }), fe(M, j, O, oe, le);
425
+ });
426
+ return;
427
+ }
428
+ s.open({
429
+ title: I.title,
430
+ message: I.message,
431
+ primaryActions: I.primaryActions
432
+ }).onPrimary(() => {
433
+ fe(M, j, O, oe);
434
+ });
435
+ }
436
+ async function je() {
437
+ s.open({
438
+ title: "Upload Transfer",
439
+ primaryActions: {
440
+ text: "Xilnex transfer note",
441
+ close: !0
442
+ },
443
+ secondaryActions: {
444
+ text: "Cancel",
445
+ close: !0
446
+ }
447
+ }).onPrimary(() => {
448
+ const M = {
449
+ show: !0,
450
+ "onUpdate:show"(j) {
451
+ ct.value.show = j;
452
+ }
453
+ };
454
+ ct.value = M;
455
+ });
456
+ }
457
+ return {
458
+ purchaseOrders: C,
459
+ shipments: c,
460
+ purchaseRequests: D,
461
+ updateDateRange: ee,
462
+ fetchData: N,
463
+ loading: t,
464
+ transferDialogProps: We,
465
+ promptCreateTransferDialog: d,
466
+ promptUpdateTransferDialog: S,
467
+ transferDetailsProps: z,
468
+ promptShowTransferDetails: he,
469
+ submitAction: $e,
470
+ xilnexImportDialogProps: ct,
471
+ promptUploadTransferDialog: je
472
+ };
473
+ }
474
+ function Sr(b, r) {
475
+ return r.reduce(
476
+ (u, v) => {
477
+ const a = v.received.find((g) => g.sku._id === b._id);
478
+ return a && (u = Dt(u, a.amount)), u;
479
+ },
480
+ Qt.toPrecision(kt(0), b.unit.precision)
481
+ );
482
+ }
483
+ function Or(b) {
484
+ const { po: r, currentLocation: s, business: u, fulfilling: v, por: a } = b, { name: g, address: t, regNo: i, legalName: _ } = s.doc.profile, w = {
485
+ name: g,
486
+ legalName: _,
487
+ registrationNumber: i,
488
+ line1: t == null ? void 0 : t.line1,
489
+ line2: t == null ? void 0 : t.line2,
490
+ postcode: t == null ? void 0 : t.postcode,
491
+ city: t == null ? void 0 : t.city,
492
+ state: t == null ? void 0 : t.state,
493
+ country: t == null ? void 0 : t.country
494
+ }, C = {
495
+ name: r.supplier.name,
496
+ phoneNumber: r.supplier.phoneNumber,
497
+ registrationNumber: r.supplier.registrationNumber,
498
+ line1: r.supplier.address.line1,
499
+ line2: r.supplier.address.line2,
500
+ postcode: r.supplier.address.postcode,
501
+ city: r.supplier.address.city,
502
+ state: r.supplier.address.state,
503
+ country: r.supplier.address.country
504
+ }, c = r.items.map((k) => {
505
+ const { sku: G, measurement: N } = k, ee = _e(
506
+ Sr(k.sku, r.deliveryOrder || []),
507
+ !1
508
+ );
509
+ return {
510
+ code: G.code,
511
+ description: G.name,
512
+ quantity: _e(k.quantity, !1),
513
+ unit: (N == null ? void 0 : N.abbrev) || G.unit.abbrev,
514
+ received: ee,
515
+ cost: k.totalCost ? `${k.totalCost.currency} ${Zt.toFormatString({
516
+ value: k.totalCost
517
+ })}` : void 0
518
+ };
519
+ }), R = r.deliveryOrder.map((k) => ({
520
+ createdAt: At(new Date(k.createdAt)),
521
+ ref: k.deliveryOrderNumber,
522
+ remark: k.remark || "",
523
+ items: k.received.map((G) => {
524
+ var N;
525
+ return {
526
+ code: G.sku.code,
527
+ description: G.sku.name,
528
+ quantity: _e(G.amount),
529
+ unit: ((N = G.measurement) == null ? void 0 : N.abbrev) || G.sku.unit.abbrev
530
+ };
531
+ })
532
+ })), $ = [
533
+ // Production
534
+ "67ca5d2c80bd0e001c5bf5bc",
535
+ // Dev
536
+ "6880b36a3054c5001db19218"
537
+ ];
538
+ let D = "Inventory Receive Note";
539
+ if (r.supplier.internal ? (D = "Inventory Transfer Note", $.includes((u == null ? void 0 : u._id) || "") && (D = "Stock Request")) : D = "Purchase Order", a) {
540
+ const k = a.from.dbName;
541
+ s.dbName === k || (D = "Inventory Receive Note");
542
+ }
543
+ const m = {
544
+ title: D,
545
+ businessName: u == null ? void 0 : u.name,
546
+ logo: u == null ? void 0 : u.thumbnail,
547
+ orderNumber: r.seqNumber.toString(),
548
+ createdAt: Ze(r._id),
549
+ ref: r.ref || "",
550
+ remark: r.remark || "",
551
+ buyer: w,
552
+ supplier: C,
553
+ items: c,
554
+ status: r.status,
555
+ deliveryOrders: R
556
+ }, d = new URL(window.location.href), S = v && (r.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
557
+ d.pathname = d.hostname.includes("portal.feedme") ? `/inventory/${S}` : `/${S}`, d.searchParams.append("data", JSON.stringify(m)), window.open(d.href, "_blank", "noreferrer");
558
+ }
559
+ const Te = {
560
+ submitRequest: {
561
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
562
+ color: "text-fm-color-typo-primary",
563
+ value: F.enum.submitRequest
564
+ },
565
+ confirmDraft: {
566
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
567
+ color: "text-fm-color-typo-primary",
568
+ value: F.enum.confirmDraft
569
+ },
570
+ cancelDraft: {
571
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
572
+ color: "text-fm-color-typo-error",
573
+ value: F.enum.cancelDraft
574
+ },
575
+ approveRequest: {
576
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
577
+ color: "text-fm-color-typo-primary",
578
+ value: F.enum.approveRequest
579
+ },
580
+ rejectRequest: {
581
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
582
+ color: "text-fm-color-typo-error",
583
+ value: F.enum.rejectRequest
584
+ },
585
+ processRequest: {
586
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
587
+ color: "text-fm-color-typo-primary",
588
+ value: F.enum.processRequest
589
+ },
590
+ receiveStock: {
591
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
592
+ color: "text-fm-color-typo-primary",
593
+ value: F.enum.receiveStock
594
+ },
595
+ completeReceive: {
596
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
597
+ color: "text-fm-color-typo-primary",
598
+ value: F.enum.completeReceive
599
+ },
600
+ closeRequest: {
601
+ translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
602
+ color: "system-error-300",
603
+ value: F.enum.closeRequest
604
+ },
605
+ approveDraft: {
606
+ translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
607
+ color: "text-fm-color-typo-primary",
608
+ value: F.enum.approveDraft
609
+ },
610
+ rejectDraft: {
611
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
612
+ color: "text-fm-color-typo-error",
613
+ value: F.enum.rejectDraft
614
+ },
615
+ returnStock: {
616
+ translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
617
+ color: "text-fm-color-typo-primary",
618
+ value: F.enum.returnStock
619
+ }
620
+ };
621
+ function It() {
622
+ const b = Me();
623
+ return {
624
+ ableToMarkReceived(r) {
625
+ if (!r || r.status !== se.enum.RECEIVING || b.useOperatePurchaseOrderV2) return !1;
626
+ const u = Ae().currentLocationDBName;
627
+ return `${r.supplier.internal}_${r.supplier._id}` !== u;
628
+ },
629
+ ableToMarkApproved(r) {
630
+ return !(!r || (r == null ? void 0 : r.status) !== se.enum.REQUESTING);
631
+ },
632
+ ableToCreateFulfillment(r, s) {
633
+ var a, g;
634
+ if (!b.acceptRequireFulfillment || !r || !s || r.status !== se.enum.PROCESSING || !s.processedAt)
635
+ return !1;
636
+ const u = (a = s == null ? void 0 : s.from) == null ? void 0 : a.dbName, v = (g = s == null ? void 0 : s.to) == null ? void 0 : g.dbName;
637
+ return !(u.startsWith("restaurant_") && v.startsWith("restaurant_"));
638
+ }
639
+ };
640
+ }
641
+ function Ca(b, r, s) {
642
+ const u = Ae(), v = Je(), a = vt(), g = It(), { t } = at();
643
+ function i($) {
644
+ switch ($.status) {
645
+ case "DRAFT":
646
+ return [
647
+ be[me.Update],
648
+ be[me.Details],
649
+ $.supplier.internal === "restaurant" || $.supplier.internal === "warehouse" ? Te[F.enum.submitRequest] : Te[F.enum.confirmDraft],
650
+ Te[F.enum.cancelDraft]
651
+ ];
652
+ case "RECEIVING":
653
+ return [
654
+ ...g.ableToMarkReceived($) ? [Te[F.enum.completeReceive]] : [],
655
+ be[me.Details],
656
+ be[me.Print]
657
+ ];
658
+ case "PENDING_APPROVAL":
659
+ return [
660
+ be[me.Update],
661
+ be[me.Details],
662
+ Te[F.enum.approveDraft],
663
+ Te[F.enum.rejectDraft]
664
+ ];
665
+ case "REQUESTING":
666
+ return b === "receive/request" ? [be[me.Details], be[me.Print]] : [
667
+ Te[F.enum.approveRequest],
668
+ Te[F.enum.rejectRequest],
669
+ be[me.Details]
670
+ // DefaultRowActions[RowActionEnum.Print]
671
+ ];
672
+ case "PROCESSING":
673
+ return [be[me.Details], be[me.Print]];
674
+ case "COMPLETE":
675
+ case "CANCEL":
676
+ default:
677
+ return [be[me.Details], be[me.Print]];
678
+ }
679
+ }
680
+ function _($) {
681
+ return Object.values(F.enum).includes($);
682
+ }
683
+ async function w($, D, n) {
684
+ var d, S, k, G, N, ee;
685
+ const m = Rt(D);
686
+ if ($ === me.Print) {
687
+ const z = (n == null ? void 0 : n.toInventoryLocation) ?? u.currentLocation;
688
+ if (z.type === "restaurant") {
689
+ const H = u.locationRestaurantFromCore(z.doc._id);
690
+ H !== null && (z.doc = H);
691
+ }
692
+ ((d = n == null ? void 0 : n.netSuite) != null && d.refNo || (S = m.netSuite) != null && S.refNo) && (m.ref = [((k = n == null ? void 0 : n.netSuite) == null ? void 0 : k.refNo) || ((G = m.netSuite) == null ? void 0 : G.refNo)].filter((H) => H).join(" ")), Or({
693
+ po: m,
694
+ currentLocation: z,
695
+ business: a.currentBusiness.value,
696
+ fulfilling: b === "approval",
697
+ por: n
698
+ });
699
+ return;
700
+ }
701
+ if ($ === me.Details) {
702
+ r.promptShowTransferDetails(m, n);
703
+ return;
704
+ }
705
+ if ($ === me.Update) {
706
+ (N = r.promptUpdateTransferDialog) == null || N.call(r, m);
707
+ return;
708
+ }
709
+ if (_($)) {
710
+ r.submitAction(D, $, (ee = n == null ? void 0 : n.to) == null ? void 0 : ee.dbName);
711
+ return;
712
+ }
713
+ }
714
+ function C() {
715
+ var D;
716
+ const $ = [
717
+ {
718
+ accessorKey: "seqNumber",
719
+ header: () => t("inventory.transfer.table.seqNo"),
720
+ enableSorting: !0,
721
+ size: 80,
722
+ sortUndefined: "last"
723
+ },
724
+ {
725
+ accessorKey: "_id",
726
+ header: () => t("inventory.transfer.table.createdAt"),
727
+ cell(n) {
728
+ return Ze(`${n.getValue()}`);
729
+ },
730
+ enableSorting: !0
731
+ },
732
+ {
733
+ accessorKey: "supplier.name",
734
+ header: () => t("inventory.transfer.table.transferFrom"),
735
+ enableSorting: !0,
736
+ size: 200
737
+ },
738
+ {
739
+ accessorKey: "items.length",
740
+ header: () => t("inventory.transfer.table.noOfItems"),
741
+ cell: (n) => {
742
+ const m = n.row.original.version || "1", d = n.getValue();
743
+ return U("div", { class: "flex items-center gap-2" }, [
744
+ d,
745
+ m !== "1" ? U(
746
+ "div",
747
+ { class: "py-3" },
748
+ U(
749
+ Ue,
750
+ U(
751
+ "div",
752
+ {
753
+ class: ["fm-status-badge", "fm-status-badge-draft"].join(" ")
754
+ },
755
+ `v${m}`
756
+ )
757
+ )
758
+ ) : null
759
+ ]);
760
+ },
761
+ enableSorting: !1,
762
+ meta: {
763
+ width: "10rem"
764
+ }
765
+ },
766
+ {
767
+ accessorKey: "ref",
768
+ header: () => t("inventory.transfer.table.reference"),
769
+ enableSorting: !1,
770
+ size: "auto"
771
+ },
772
+ ...(D = a.sessionUser.value) != null && D.role.isAdmin ? [
773
+ {
774
+ id: "statusForAdmin",
775
+ header: () => U(Ue, {}, () => `${t("inventory.transfer.table.status")}`),
776
+ cell(n) {
777
+ return n.row.original.status;
778
+ },
779
+ enableSorting: !0,
780
+ size: 200
781
+ }
782
+ ] : [],
783
+ {
784
+ accessorKey: "status",
785
+ header: () => t("inventory.transfer.table.status"),
786
+ cell(n) {
787
+ const m = n.getValue(), d = ot(n.row.original), { partial: S, over: k } = mt(d), G = pt(m ?? "", S, k);
788
+ let N = t(`inventory.transfer.status.${G}`), ee = `${m ?? ""}`.toLocaleLowerCase("en-us");
789
+ G === se.enum.CLOSE && (N = `${t(`inventory.transfer.status.${se.enum.COMPLETE}`)}`), G === "PARTIAL_RECEIVED" && ee === se.enum.PROCESSING.toLocaleLowerCase("en-us") && (ee = se.enum.RECEIVING.toLocaleLowerCase("en-us"));
790
+ let z = null;
791
+ const H = s.value.find((he) => he.ref === n.row.original._id);
792
+ if (H != null && H.milestones && H.milestones.length > 0) {
793
+ const he = H.milestones[H.milestones.length - 1];
794
+ if (he.estimatedTime) {
795
+ const fe = new Date(he.estimatedTime), $e = fe.getDate().toString().padStart(2, "0");
796
+ z = `${fe.toLocaleString("en-US", { month: "short" })} ${$e}`;
797
+ }
798
+ }
799
+ return U(
800
+ "div",
801
+ {
802
+ class: "flex"
803
+ },
804
+ [
805
+ U(
806
+ "div",
807
+ { class: "flex items-center" },
808
+ U(
809
+ "div",
810
+ {
811
+ class: [
812
+ "fm-status-badge",
813
+ `fm-status-badge-${ee}`,
814
+ k && "fm-status-badge-error"
815
+ ].filter(Boolean).join(" ")
816
+ },
817
+ `${N}`
818
+ )
819
+ ),
820
+ ...z ? [
821
+ U(
822
+ "div",
823
+ {
824
+ class: "flex items-center gap-1 ml-2"
825
+ },
826
+ [
827
+ U(st.FmIcon, {
828
+ name: "local_shipping",
829
+ size: "md",
830
+ color: "neutral-gray-400"
831
+ }),
832
+ U(
833
+ "span",
834
+ { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
835
+ z
836
+ )
837
+ ]
838
+ )
839
+ ] : []
840
+ ]
841
+ );
842
+ },
843
+ enableSorting: !0,
844
+ size: 150
845
+ },
846
+ {
847
+ id: "action",
848
+ cell(n) {
849
+ const m = n.row.original, d = i(m);
850
+ return bt(d, (S) => w(S, m));
851
+ },
852
+ enableSorting: !1,
853
+ size: 40,
854
+ meta: {
855
+ cellClass: "",
856
+ headerClass: ""
857
+ }
858
+ }
859
+ ];
860
+ if (v.isEnabled) {
861
+ const n = [
862
+ {
863
+ id: "netsuiteTransferOrder",
864
+ accessorFn: (m) => {
865
+ var d;
866
+ return (d = m.netSuite) != null && d.id ? `${m.netSuite.refNo} (${m.netSuite.id})` : "N/A";
867
+ },
868
+ header: () => "NetSuite Order (ID)",
869
+ cell(m) {
870
+ var S;
871
+ const d = m.row.original;
872
+ return (S = d.netSuite) != null && S.id ? `${d.netSuite.refNo} (${d.netSuite.id})` : "N/A";
873
+ },
874
+ enableSorting: !1,
875
+ size: 200,
876
+ meta: {
877
+ cellClass: "",
878
+ headerClass: ""
879
+ }
880
+ },
881
+ {
882
+ id: "netsuiteTransactionNumber",
883
+ accessorFn: (m) => {
884
+ var d, S;
885
+ return ((S = (d = m.netSuite) == null ? void 0 : d.additionalInfo) == null ? void 0 : S.transactionnumber) ?? "N/A";
886
+ },
887
+ header: () => "NetSuite Transaction No.",
888
+ cell(m) {
889
+ var S, k;
890
+ return ((k = (S = m.row.original.netSuite) == null ? void 0 : S.additionalInfo) == null ? void 0 : k.transactionnumber) ?? "N/A";
891
+ },
892
+ enableSorting: !1,
893
+ size: 200,
894
+ meta: {
895
+ cellClass: "",
896
+ headerClass: ""
897
+ }
898
+ }
899
+ ];
900
+ $.splice($.length - 1, 0, ...n);
901
+ }
902
+ return $;
903
+ }
904
+ function c() {
905
+ var D;
906
+ const $ = [
907
+ {
908
+ accessorKey: "purchaseOrder.seqNumber",
909
+ header: () => t("inventory.transfer.table.seqNo"),
910
+ enableSorting: !0,
911
+ size: 80,
912
+ sortUndefined: "last"
913
+ },
914
+ {
915
+ accessorKey: "purchaseOrder._id",
916
+ header: () => t("inventory.transfer.table.createdAt"),
917
+ cell(n) {
918
+ return Ze(`${n.getValue()}`);
919
+ },
920
+ enableSorting: !0
921
+ },
922
+ {
923
+ accessorKey: "to.name",
924
+ header: () => t("inventory.transfer.table.transferTo"),
925
+ enableSorting: !1,
926
+ size: 200
927
+ },
928
+ {
929
+ accessorKey: "purchaseOrder.items.length",
930
+ header: () => t("inventory.transfer.table.noOfItems"),
931
+ enableSorting: !1
932
+ },
933
+ {
934
+ accessorKey: "purchaseOrder.ref",
935
+ header: () => t("inventory.transfer.table.reference"),
936
+ enableSorting: !1,
937
+ size: "auto"
938
+ },
939
+ ...(D = a.sessionUser.value) != null && D.role.isAdmin ? [
940
+ {
941
+ id: "statusForAdmin",
942
+ header: () => U(Ue, {}, () => `${t("inventory.transfer.table.status")}`),
943
+ cell(n) {
944
+ return n.row.original.status;
945
+ },
946
+ enableSorting: !0,
947
+ size: 200
948
+ }
949
+ ] : [],
950
+ {
951
+ accessorKey: "purchaseOrder.status",
952
+ header: () => t("inventory.transfer.table.status"),
953
+ cell(n) {
954
+ const m = n.row.original, d = n.getValue();
955
+ if (!m.purchaseOrder)
956
+ return U(st.FmChip, {
957
+ label: "N/A",
958
+ compact: !0
959
+ });
960
+ const S = ot(m.purchaseOrder), { partial: k, over: G } = mt(S), N = pt(d ?? "", k, G);
961
+ let ee = t(`inventory.transfer.status.${N}`), z = `${d ?? ""}`.toLocaleLowerCase("en-us");
962
+ return N === se.enum.CLOSE && (ee = `${t(`inventory.transfer.status.${se.enum.COMPLETE}`)}`), N === "PARTIAL_RECEIVED" && z === se.enum.PROCESSING.toLocaleLowerCase("en-us") && (z = se.enum.RECEIVING.toLocaleLowerCase("en-us")), m.rejectedAt && (ee = t("inventory.transfer.status.REJECT"), z = se.enum.REJECT.toLocaleLowerCase("en-us")), U(
963
+ "div",
964
+ {
965
+ class: "flex"
966
+ },
967
+ U(
968
+ "div",
969
+ {
970
+ class: [
971
+ "fm-status-badge",
972
+ `fm-status-badge-${z}`,
973
+ G && "fm-status-badge-error"
974
+ ].filter(Boolean).join(" ")
975
+ },
976
+ `${ee}`
977
+ )
978
+ );
979
+ },
980
+ enableSorting: !0
981
+ },
982
+ {
983
+ id: "action",
984
+ cell(n) {
985
+ const m = n.row.original, S = (m.purchaseOrder ? i(m.purchaseOrder) : []).map((k) => k.value === me.Print ? {
986
+ ...k,
987
+ translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
988
+ } : k);
989
+ return bt(
990
+ S,
991
+ (k) => m.purchaseOrder ? w(k, m.purchaseOrder, m) : void 0
992
+ );
993
+ },
994
+ enableSorting: !1,
995
+ size: 40,
996
+ meta: {
997
+ cellClass: "",
998
+ headerClass: ""
999
+ }
1000
+ }
1001
+ ];
1002
+ if (v.isEnabled) {
1003
+ const n = [
1004
+ {
1005
+ id: "netsuiteTransferOrder",
1006
+ accessorFn: (m) => {
1007
+ var d;
1008
+ return (d = m.netSuite) != null && d.id ? `${m.netSuite.refNo} (${m.netSuite.id})` : "N/A";
1009
+ },
1010
+ header: () => "NetSuite Order (ID)",
1011
+ cell(m) {
1012
+ var S;
1013
+ const d = m.row.original;
1014
+ return (S = d.netSuite) != null && S.id ? `${d.netSuite.refNo} (${d.netSuite.id})` : "N/A";
1015
+ },
1016
+ enableSorting: !1,
1017
+ size: 200,
1018
+ meta: {
1019
+ cellClass: "",
1020
+ headerClass: ""
1021
+ }
1022
+ },
1023
+ {
1024
+ id: "netsuiteTransactionNumber",
1025
+ accessorFn: (m) => {
1026
+ var d, S;
1027
+ return ((S = (d = m.netSuite) == null ? void 0 : d.additionalInfo) == null ? void 0 : S.transactionnumber) ?? "N/A";
1028
+ },
1029
+ header: () => "NetSuite Transaction No.",
1030
+ cell(m) {
1031
+ var S, k;
1032
+ return ((k = (S = m.row.original.netSuite) == null ? void 0 : S.additionalInfo) == null ? void 0 : k.transactionnumber) ?? "N/A";
1033
+ },
1034
+ enableSorting: !1,
1035
+ size: 200,
1036
+ meta: {
1037
+ cellClass: "",
1038
+ headerClass: ""
1039
+ }
1040
+ }
1041
+ ];
1042
+ $.splice($.length - 2, 0, ...n);
1043
+ }
1044
+ return $;
1045
+ }
1046
+ return {
1047
+ columnDefs: W(() => b === "receive/request" ? C() : c())
1048
+ };
1049
+ }
1050
+ function Pe(b) {
1051
+ const r = Lt(b);
1052
+ if (Array.isArray(r))
1053
+ return r.map(Pe);
1054
+ if (r !== null && typeof r == "object") {
1055
+ const s = {};
1056
+ for (const u in r)
1057
+ Object.prototype.hasOwnProperty.call(r, u) && (s[u] = Pe(r[u]));
1058
+ return s;
1059
+ }
1060
+ return r;
1061
+ }
1062
+ const ut = {
1063
+ set: "set",
1064
+ add: "add",
1065
+ delete: "delete"
1066
+ };
1067
+ function xt(b) {
1068
+ return {
1069
+ dbName: b.dbName,
1070
+ type: b.type,
1071
+ name: b.name,
1072
+ acceptRequest: b.acceptRequest ?? !1,
1073
+ doc: b.doc
1074
+ };
1075
+ }
1076
+ function wt(b, r, s, u, v) {
1077
+ const a = Pe(b.suppliers ?? []), g = Pe(r.allLocations ?? []).map(xt), t = r._currentLocation ? xt(Pe(r._currentLocation)) : null, i = s.inventory ? [Pe(s.inventory)] : [], _ = u.state.setting ? Pe(u.state.setting) : null, w = Pe(v.surcharges ?? []);
1078
+ return {
1079
+ suppliers: a,
1080
+ locations: g,
1081
+ currentLocation: t,
1082
+ inventoryDoc: i,
1083
+ netSuiteSetting: _,
1084
+ surcharges: w
1085
+ };
1086
+ }
1087
+ function xr() {
1088
+ const b = fr(), r = Ae(), s = Ht(), u = Je(), v = yr(), a = wt(
1089
+ b,
1090
+ r,
1091
+ s,
1092
+ u,
1093
+ v
1094
+ ), g = gt(er({ env: a }));
1095
+ g.value.setUsePartialUpdates(!0);
1096
+ const t = gt(g.value.state()), i = (c) => {
1097
+ t.value = c;
1098
+ };
1099
+ g.value.addListener(i);
1100
+ const _ = (c, R, $) => {
1101
+ switch (c) {
1102
+ case ut.set:
1103
+ _t(t.value, R, $);
1104
+ break;
1105
+ case ut.add:
1106
+ Yt(t.value, R, $);
1107
+ break;
1108
+ case ut.delete:
1109
+ Wt(t.value, R);
1110
+ break;
1111
+ default:
1112
+ console.warn(`Unknown partial update operation: ${c}, falling back to 'set'`), _t(t.value, R, $);
1113
+ }
1114
+ R !== "remark" && R !== "ref" && Mt(t);
1115
+ };
1116
+ g.value.addPartialListener(_);
1117
+ function w() {
1118
+ const c = wt(
1119
+ b,
1120
+ r,
1121
+ s,
1122
+ u,
1123
+ v
1124
+ );
1125
+ g.value.updateFullEnv(c), t.value = g.value.state();
1126
+ }
1127
+ et(
1128
+ [
1129
+ () => b.suppliers,
1130
+ () => r.allLocations,
1131
+ () => r._currentLocation,
1132
+ () => s.inventory,
1133
+ () => u.state.setting,
1134
+ () => v.surcharges
1135
+ ],
1136
+ () => {
1137
+ w();
1138
+ },
1139
+ { deep: !0 }
1140
+ ), Ut(() => {
1141
+ g.value.removeListener(i), g.value.removePartialListener(_);
1142
+ });
1143
+ function C(c) {
1144
+ var R;
1145
+ if (c != null && c._id) {
1146
+ g.value.loadPurchaseOrder(c);
1147
+ return;
1148
+ }
1149
+ if (!Me().mustUsePoTemplate) {
1150
+ g.value.init();
1151
+ return;
1152
+ }
1153
+ c != null && c.template && ((R = c.templateDoc) != null && R.purchaseOrder) ? (c.items = c.templateDoc.purchaseOrder.items, g.value.initFromTemplate(c)) : g.value.initOutletToOutlet();
1154
+ }
1155
+ return {
1156
+ controller: g,
1157
+ state: t,
1158
+ init: C
1159
+ };
1160
+ }
1161
+ const wr = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Cr = { class: "flex flex-col gap-8" }, Rr = { class: "flex w-full justify-end gap-16" }, $r = /* @__PURE__ */ Re({
1162
+ __name: "FulfillmentForm",
1163
+ props: {
1164
+ purchaseOrder: {},
1165
+ confirm: { type: Function }
1166
+ },
1167
+ emits: ["update:show"],
1168
+ setup(b, { emit: r }) {
1169
+ const s = b, u = jt({
1170
+ id: "",
1171
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1172
+ items: []
1173
+ }), v = J(), a = r;
1174
+ Ct(() => {
1175
+ s.purchaseOrder && (u.items = s.purchaseOrder.items.map((t) => ({
1176
+ id: t.id,
1177
+ sku: t.sku,
1178
+ measurement: t.measurement,
1179
+ amount: t.quantity ?? { amount: 1, precision: 0 }
1180
+ })));
1181
+ });
1182
+ const g = W(() => u.items.length <= 10);
1183
+ return (t, i) => {
1184
+ const _ = K("FmTable"), w = K("FmButton"), C = K("FmForm");
1185
+ return l(), ae(C, {
1186
+ ref_key: "formRef",
1187
+ ref: v,
1188
+ class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
1189
+ onValidationFailed: console.log,
1190
+ onValidationSuccess: i[1] || (i[1] = () => s.confirm(u))
1191
+ }, {
1192
+ default: re(() => [
1193
+ i[2] || (i[2] = e("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
1194
+ e("div", wr, [
1195
+ e("div", Cr, [
1196
+ T(_, {
1197
+ "column-defs": [
1198
+ {
1199
+ header: "Code",
1200
+ cell: (c) => {
1201
+ const R = s.purchaseOrder.items.find(($) => $.id === c.row.original.id || $.sku._id === c.row.original.sku._id);
1202
+ return U(
1203
+ f(st).FmTooltip,
1204
+ {
1205
+ content: R.code,
1206
+ placement: "top",
1207
+ variant: "plain",
1208
+ zIndex: 50
1209
+ },
1210
+ U(
1211
+ "span",
1212
+ {
1213
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
1214
+ },
1215
+ R.code
1216
+ )
1217
+ );
1218
+ }
1219
+ },
1220
+ {
1221
+ header: "Name",
1222
+ cell: (c) => {
1223
+ const R = s.purchaseOrder.items.find(($) => $.id === c.row.original.id || $.sku._id === c.row.original.sku._id);
1224
+ return U(
1225
+ f(st).FmTooltip,
1226
+ {
1227
+ content: R.name,
1228
+ placement: "top",
1229
+ variant: "plain",
1230
+ zIndex: 50
1231
+ },
1232
+ U(
1233
+ "span",
1234
+ {
1235
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
1236
+ },
1237
+ R.name
1238
+ )
1239
+ );
1240
+ }
1241
+ },
1242
+ {
1243
+ header: "Amount",
1244
+ cell: (c) => {
1245
+ const R = c.row.original, $ = s.purchaseOrder.items.find((n) => n.id === R.id || n.sku._id === R.sku._id), D = R.amount ?? {
1246
+ amount: 1,
1247
+ precision: 0
1248
+ };
1249
+ return U(lr, {
1250
+ style: {
1251
+ flex: "1 1 0%"
1252
+ },
1253
+ modelValue: {
1254
+ amount: D,
1255
+ measurement: R.measurement ?? null
1256
+ },
1257
+ key: R.id ?? R.sku._id,
1258
+ unit: R.sku.unit,
1259
+ "onUpdate:modelValue": (n) => {
1260
+ if (!n) return;
1261
+ const m = u.items.find((d) => d.id === R.id || d.sku._id === R.sku._id);
1262
+ m && (m.amount = n.amount);
1263
+ },
1264
+ disableUnit: !0,
1265
+ rules: [
1266
+ f(ir)(
1267
+ +f(_e)({ amount: 0, precision: 0 })
1268
+ ),
1269
+ f(cr)(+f(_e)($.quantity))
1270
+ ],
1271
+ applyDefaultRules: !0
1272
+ });
1273
+ }
1274
+ }
1275
+ ],
1276
+ "row-data": u.items,
1277
+ "hide-footer": g.value
1278
+ }, null, 8, ["column-defs", "row-data", "hide-footer"])
1279
+ ])
1280
+ ]),
1281
+ e("div", Rr, [
1282
+ T(w, {
1283
+ class: "px-16",
1284
+ label: "Confirm",
1285
+ size: "md",
1286
+ variant: "primary",
1287
+ type: "submit"
1288
+ }),
1289
+ T(w, {
1290
+ class: "px-16",
1291
+ label: "Cancel",
1292
+ size: "md",
1293
+ variant: "secondary",
1294
+ onClick: i[0] || (i[0] = () => a("update:show", !1))
1295
+ })
1296
+ ])
1297
+ ]),
1298
+ _: 1
1299
+ }, 8, ["onValidationFailed"]);
1300
+ };
1301
+ }
1302
+ }), dt = {
1303
+ submitRequest: {
1304
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
1305
+ color: "primary",
1306
+ buttonVariant: Se.Primary
1307
+ },
1308
+ confirmDraft: {
1309
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
1310
+ color: "primary",
1311
+ buttonVariant: Se.Primary
1312
+ },
1313
+ cancelDraft: {
1314
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
1315
+ color: "system-error-300",
1316
+ buttonVariant: Se.Destructive
1317
+ },
1318
+ approveDraft: {
1319
+ translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
1320
+ color: "primary",
1321
+ buttonVariant: Se.Primary
1322
+ },
1323
+ rejectDraft: {
1324
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
1325
+ color: "system-error-300",
1326
+ buttonVariant: Se.Destructive
1327
+ },
1328
+ approveRequest: {
1329
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
1330
+ color: "primary",
1331
+ buttonVariant: Se.Primary
1332
+ },
1333
+ processRequest: {
1334
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
1335
+ color: "primary",
1336
+ buttonVariant: Se.Primary
1337
+ },
1338
+ receiveStock: {
1339
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
1340
+ color: "primary",
1341
+ buttonVariant: Se.Primary,
1342
+ available: !1
1343
+ },
1344
+ completeReceive: {
1345
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
1346
+ color: "primary",
1347
+ buttonVariant: Se.Plain
1348
+ },
1349
+ rejectRequest: {
1350
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
1351
+ color: "system-error-300",
1352
+ buttonVariant: Se.Destructive
1353
+ },
1354
+ closeRequest: {
1355
+ translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
1356
+ color: "system-error-300",
1357
+ buttonVariant: Se.Destructive,
1358
+ available: !1
1359
+ },
1360
+ returnStock: {
1361
+ translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
1362
+ color: "primary",
1363
+ buttonVariant: Se.Primary,
1364
+ available: !1
1365
+ }
1366
+ }, Dr = { class: "flex flex-row-reverse" }, kr = /* @__PURE__ */ Re({
1367
+ __name: "NetSuiteSync",
1368
+ props: {
1369
+ poRequest: {},
1370
+ purchaseOrder: {},
1371
+ isTransferBetweenOutlets: { type: Boolean },
1372
+ scope: {}
1373
+ },
1374
+ setup(b) {
1375
+ const r = b, s = Je(), u = Ge(), v = lt(), a = J(!1);
1376
+ W(() => {
1377
+ var w, C, c, R;
1378
+ let t = !0;
1379
+ s.isEnabled || (t = !1);
1380
+ const i = r.purchaseOrder, _ = r.poRequest;
1381
+ return i && ((w = i == null ? void 0 : i.supplier) != null && w.internal ? (!_ && i.status == se.enum.DRAFT && (t = !1), _ && !((C = _ == null ? void 0 : _.netSuite) != null && C.id) && (t = !1), r.isTransferBetweenOutlets && (t = !1)) : ((i == null ? void 0 : i.status) !== se.enum.REQUESTING && i.supplier.internal && (t = !1), !_ && !((c = i == null ? void 0 : i.netSuite) != null && c.id) && (t = !1), !_ && ((R = i == null ? void 0 : i.netSuite) != null && R.id) && (i == null ? void 0 : i.status) == se.enum.REQUESTING && (t = !1))), t;
1382
+ });
1383
+ async function g() {
1384
+ a.value || v.open({
1385
+ title: "Sync with NetSuite",
1386
+ contentComponent: U("div", [
1387
+ U("p", "Are you sure you want to sync now?"),
1388
+ U("br"),
1389
+ U(
1390
+ "p",
1391
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1392
+ "Please wait a moment before syncing manually to avoid unnecessary actions."
1393
+ )
1394
+ ]),
1395
+ primaryActions: {
1396
+ text: "Sync",
1397
+ close: !0,
1398
+ variant: "destructive"
1399
+ },
1400
+ secondaryActions: { text: "Not now", close: !0 }
1401
+ }).onPrimary(async () => {
1402
+ var t, i, _;
1403
+ try {
1404
+ a.value = !0;
1405
+ const w = ((t = r.purchaseOrder) == null ? void 0 : t._id) || ((i = r.poRequest) == null ? void 0 : i.purchaseOrderId) || "", C = (_ = r.poRequest) == null ? void 0 : _.to.dbName;
1406
+ await s.syncPurchaseOrder(
1407
+ w,
1408
+ r.scope === "approval" ? C : void 0
1409
+ ), u.open({
1410
+ title: "Sync with NetSuite",
1411
+ message: "Requested to sync with NetSuite. Please wait a moment.",
1412
+ type: "success"
1413
+ }), await new Promise((c) => setTimeout(c, 5e3)), a.value = !1;
1414
+ } catch {
1415
+ u.open({
1416
+ title: "Error",
1417
+ message: "Failed to sync with NetSuite",
1418
+ type: "error"
1419
+ }), a.value = !1;
1420
+ }
1421
+ });
1422
+ }
1423
+ return (t, i) => {
1424
+ const _ = K("FmButton");
1425
+ return l(), h("div", Dr, [
1426
+ T(_, {
1427
+ "prepend-icon": "sync",
1428
+ variant: "secondary",
1429
+ label: "Sync",
1430
+ loading: a.value,
1431
+ onClick: g,
1432
+ "text-color": "primary",
1433
+ "bg-color": "transparent",
1434
+ "border-color": "primary"
1435
+ }, null, 8, ["loading"])
1436
+ ]);
1437
+ };
1438
+ }
1439
+ }), Ar = {
1440
+ key: 0,
1441
+ class: "flex flex-col gap-8"
1442
+ }, Nr = { class: "flex flex-col gap-4" }, Fr = { class: "fm-typo-en-body-lg-600" }, Tr = {
1443
+ key: 0,
1444
+ class: "flex flex-col gap-4"
1445
+ }, Pr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ir = { class: "fm-typo-en-body-lg-600" }, qr = { key: 0 }, Vr = { key: 1 }, Er = {
1446
+ key: 1,
1447
+ class: "flex flex-col gap-4"
1448
+ }, Lr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ur = { class: "fm-typo-en-body-lg-600" }, Mr = { key: 0 }, jr = { key: 1 }, Br = {
1449
+ key: 2,
1450
+ class: "flex flex-col gap-4"
1451
+ }, zr = { class: "fm-typo-en-body-lg-600" }, Kr = {
1452
+ key: 3,
1453
+ class: "flex flex-col gap-4"
1454
+ }, Gr = { class: "fm-typo-en-body-lg-600" }, Hr = /* @__PURE__ */ Re({
1455
+ __name: "NetSuiteInfo",
1456
+ props: {
1457
+ transferType: {},
1458
+ transferToDbName: {},
1459
+ poRequest: {},
1460
+ purchaseOrder: {},
1461
+ isTransferBetweenOutlets: { type: Boolean },
1462
+ scope: {}
1463
+ },
1464
+ setup(b) {
1465
+ const r = b, s = Je(), u = He(), v = J(r.poRequest);
1466
+ Ct(async () => {
1467
+ var i;
1468
+ if (!r.poRequest && ((i = r.purchaseOrder) != null && i._id)) {
1469
+ const _ = await u.getLatestPurchaseOrderRequest(r.purchaseOrder._id);
1470
+ v.value = _;
1471
+ }
1472
+ });
1473
+ const a = W(
1474
+ () => {
1475
+ var i, _, w, C, c, R;
1476
+ return s.getSubsidiaryFullName(
1477
+ ((w = (_ = (i = r.purchaseOrder) == null ? void 0 : i.netSuite) == null ? void 0 : _.subsidiary) == null ? void 0 : w.id) || ((R = (c = (C = r.poRequest) == null ? void 0 : C.netSuite) == null ? void 0 : c.subsidiary) == null ? void 0 : R.id)
1478
+ ).fullName;
1479
+ }
1480
+ ), g = W(() => {
1481
+ var i, _, w, C, c, R, $, D, n, m, d, S;
1482
+ return (w = (_ = (i = r.purchaseOrder) == null ? void 0 : i.netSuite) == null ? void 0 : _.additionalInfo) != null && w.transactionnumber ? (R = (c = (C = r.purchaseOrder) == null ? void 0 : C.netSuite) == null ? void 0 : c.additionalInfo) == null ? void 0 : R.transactionnumber : (n = (D = ($ = v.value) == null ? void 0 : $.netSuite) == null ? void 0 : D.additionalInfo) != null && n.transactionnumber ? (S = (d = (m = v.value) == null ? void 0 : m.netSuite) == null ? void 0 : d.additionalInfo) == null ? void 0 : S.transactionnumber : null;
1483
+ }), t = W(() => {
1484
+ var i, _, w, C, c, R;
1485
+ return (_ = (i = r.purchaseOrder) == null ? void 0 : i.deliveryFullfillment) != null && _.length && ((C = (w = r.purchaseOrder) == null ? void 0 : w.deliveryFullfillment) == null ? void 0 : C.length) > 0 ? (R = (c = r.purchaseOrder) == null ? void 0 : c.deliveryFullfillment) == null ? void 0 : R.map(($) => {
1486
+ var D;
1487
+ return (D = $.netSuite) == null ? void 0 : D.refNo;
1488
+ }).join(", ") : "N/A";
1489
+ });
1490
+ return (i, _) => {
1491
+ var w, C, c, R, $, D, n, m, d, S, k, G, N, ee, z, H;
1492
+ return f(s).isEnabled ? (l(), h("div", Ar, [
1493
+ e("div", Nr, [
1494
+ _[0] || (_[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
1495
+ e("div", Fr, y(a.value || "N/A"), 1)
1496
+ ]),
1497
+ !i.isTransferBetweenOutlets && i.scope === f(ft).RECEIVE_REQUEST ? (l(), h("div", Tr, [
1498
+ e("div", Pr, " NetSuite " + y((C = (w = i.purchaseOrder) == null ? void 0 : w.netSuite) != null && C.recordType ? f($t)((R = (c = i.purchaseOrder) == null ? void 0 : c.netSuite) == null ? void 0 : R.recordType) : i.transferType === f(Ye).enum.purchase ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1499
+ e("div", Ir, [
1500
+ (D = ($ = i.purchaseOrder) == null ? void 0 : $.netSuite) != null && D.id ? (l(), h("span", qr, y((m = (n = i.purchaseOrder) == null ? void 0 : n.netSuite) == null ? void 0 : m.refNo) + " (" + y((S = (d = i.purchaseOrder) == null ? void 0 : d.netSuite) == null ? void 0 : S.id) + ") ", 1)) : (l(), h("span", Vr, "N/A"))
1501
+ ])
1502
+ ])) : L("", !0),
1503
+ !i.isTransferBetweenOutlets && v.value || i.scope === f(ft).APPROVAL ? (l(), h("div", Er, [
1504
+ e("div", Lr, " (Request) NetSuite " + y(i.transferType === f(Ye).enum.purchase ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1505
+ e("div", Ur, [
1506
+ (G = (k = v.value) == null ? void 0 : k.netSuite) != null && G.id ? (l(), h("span", Mr, y((ee = (N = v.value) == null ? void 0 : N.netSuite) == null ? void 0 : ee.refNo) + " (" + y((H = (z = v.value) == null ? void 0 : z.netSuite) == null ? void 0 : H.id) + ") ", 1)) : (l(), h("span", jr, "N/A"))
1507
+ ])
1508
+ ])) : L("", !0),
1509
+ g.value ? (l(), h("div", Br, [
1510
+ _[1] || (_[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
1511
+ e("div", zr, y(g.value), 1)
1512
+ ])) : L("", !0),
1513
+ f(s).isEnabled && i.transferType === f(Ye).enum.transfer && !i.isTransferBetweenOutlets ? (l(), h("div", Kr, [
1514
+ _[2] || (_[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1515
+ e("div", Gr, y(t.value), 1)
1516
+ ])) : L("", !0)
1517
+ ])) : L("", !0);
1518
+ };
1519
+ }
1520
+ }), Wr = { class: "flex flex-row-reverse" }, Yr = /* @__PURE__ */ Re({
1521
+ __name: "NetSuiteLog",
1522
+ props: {
1523
+ netsuiteId: {},
1524
+ purchaseOrderId: {}
1525
+ },
1526
+ setup(b) {
1527
+ const r = Ge(), s = ht();
1528
+ async function u(v, a) {
1529
+ const g = [];
1530
+ if (v && g.push(`body.message:*${v}*`), a) {
1531
+ const w = a.replace(/:/g, "\\:");
1532
+ g.push(`${w}`);
1533
+ }
1534
+ if (g.length === 0) {
1535
+ r.open({
1536
+ message: "Cannot open logs without valid filters.",
1537
+ type: "error"
1538
+ });
1539
+ return;
1540
+ }
1541
+ const i = `attributes.pod:netsuite* AND (${g.join(" OR ")})`, { url: _ } = await s.getSyncLogs(i);
1542
+ r.open(
1543
+ {
1544
+ message: "Opening NetSuite logs...",
1545
+ type: "info"
1546
+ },
1547
+ 800
1548
+ ), await new Promise((w) => setTimeout(w, 800)), window.open(_, "_blank");
1549
+ }
1550
+ return (v, a) => {
1551
+ const g = K("FmButton");
1552
+ return l(), h("div", Wr, [
1553
+ T(g, {
1554
+ "prepend-icon": "history",
1555
+ variant: "secondary",
1556
+ label: "Logs",
1557
+ onClick: a[0] || (a[0] = (t) => u(v.netsuiteId, v.purchaseOrderId)),
1558
+ "text-color": "primary",
1559
+ "bg-color": "transparent",
1560
+ "border-color": "primary"
1561
+ })
1562
+ ]);
1563
+ };
1564
+ }
1565
+ }), Qr = { class: "flex flex-row-reverse" }, Jr = { key: 0 }, Xr = { key: 1 }, Zr = { class: "mb-6" }, es = { class: "fm-typo-en-body-md-400" }, ts = { key: 0 }, rs = { key: 1 }, ss = {
1566
+ key: 0,
1567
+ class: "flex"
1568
+ }, os = {
1569
+ key: 1,
1570
+ class: "border-t pt-6"
1571
+ }, ns = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, as = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, ls = { class: "w-full" }, is = {
1572
+ class: "p-3 fm-typo-en-body-sm-600",
1573
+ style: { "min-width": "130px" }
1574
+ }, cs = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, us = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ds = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ms = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ps = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, fs = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ys = { class: "p-3 fm-typo-en-body-sm-600" }, vs = { key: 2 }, hs = { key: 1 }, gs = /* @__PURE__ */ Re({
1575
+ __name: "NetSuiteLatestInfo",
1576
+ props: {
1577
+ netsuiteId: {},
1578
+ purchaseOrderId: {}
1579
+ },
1580
+ setup(b) {
1581
+ const r = b, s = ht(), u = J(!1), v = Ae(), a = J(!0), g = J(!1), t = J(!1), i = J(!1), _ = J(null), w = J([]);
1582
+ async function C() {
1583
+ if (!_.value) {
1584
+ u.value = !0;
1585
+ try {
1586
+ a.value = !0;
1587
+ const D = await s.getMoreInfo(
1588
+ v.currentLocation.dbName,
1589
+ r.purchaseOrderId
1590
+ );
1591
+ _.value = D, g.value = !1;
1592
+ } catch {
1593
+ g.value = !0;
1594
+ } finally {
1595
+ a.value = !1;
1596
+ }
1597
+ await c();
1598
+ }
1599
+ }
1600
+ async function c() {
1601
+ if (!(w.value.length > 0))
1602
+ try {
1603
+ t.value = !0;
1604
+ const D = await s.getChangeLogs(r.netsuiteId);
1605
+ w.value = D, i.value = !1;
1606
+ } catch {
1607
+ i.value = !0;
1608
+ } finally {
1609
+ t.value = !1;
1610
+ }
1611
+ }
1612
+ function R(D) {
1613
+ switch (D) {
1614
+ case De.Create:
1615
+ return "text-green-600 bg-green-100";
1616
+ case De.Set:
1617
+ return "text-blue-600 bg-blue-100";
1618
+ case De.Change:
1619
+ return "text-yellow-600 bg-yellow-100";
1620
+ case De.Unset:
1621
+ return "text-red-600 bg-red-100";
1622
+ default:
1623
+ return "text-gray-600 bg-gray-100";
1624
+ }
1625
+ }
1626
+ function $(D) {
1627
+ return new Date(D).toLocaleDateString("en-US", {
1628
+ year: "numeric",
1629
+ month: "short",
1630
+ day: "numeric",
1631
+ hour: "2-digit",
1632
+ minute: "2-digit"
1633
+ });
1634
+ }
1635
+ return (D, n) => {
1636
+ const m = K("FmButton"), d = K("FmLabel"), S = K("FmCircularProgress"), k = K("FmIcon"), G = K("FmDialog");
1637
+ return l(), h("div", Qr, [
1638
+ T(G, {
1639
+ modelValue: u.value,
1640
+ "onUpdate:modelValue": n[2] || (n[2] = (N) => u.value = N),
1641
+ overlay: !0,
1642
+ "max-width": 800
1643
+ }, {
1644
+ "dialog-button": re(() => [
1645
+ T(m, {
1646
+ "prepend-icon": "info",
1647
+ variant: "secondary",
1648
+ label: "Latest Info",
1649
+ onClick: n[0] || (n[0] = (N) => C()),
1650
+ "text-color": "primary",
1651
+ "bg-color": "transparent",
1652
+ "border-color": "primary"
1653
+ })
1654
+ ]),
1655
+ "dialog-header": re(() => n[3] || (n[3] = [
1656
+ e("div", null, "NetSuite latest info", -1)
1657
+ ])),
1658
+ default: re(() => [
1659
+ a.value ? (l(), h("div", Jr, "Loading...")) : (l(), h("div", Xr, [
1660
+ g.value ? (l(), h("p", hs, "Something went wrong.")) : (l(), h(ce, { key: 0 }, [
1661
+ e("div", Zr, [
1662
+ n[4] || (n[4] = e("h3", { class: "fm-typo-en-body-lg-600 mb-4" }, "NetSuite Order Details", -1)),
1663
+ (l(!0), h(ce, null, we(_.value, (N, ee) => (l(), h("div", {
1664
+ key: ee,
1665
+ class: "mb-2"
1666
+ }, [
1667
+ e("div", null, [
1668
+ T(d, {
1669
+ label: f(yt)(ee)
1670
+ }, null, 8, ["label"]),
1671
+ e("div", es, [
1672
+ Array.isArray(N) ? (l(), h("span", ts, y(N.length > 0 ? N.join(", ") : "N/A"), 1)) : (l(), h("span", rs, y(N), 1))
1673
+ ])
1674
+ ])
1675
+ ]))), 128))
1676
+ ]),
1677
+ t.value ? (l(), h("div", ss, [
1678
+ n[5] || (n[5] = e("span", null, "Change Log Loading...", -1)),
1679
+ T(S, { size: "md" })
1680
+ ])) : L("", !0),
1681
+ !t.value && w.value.length > 0 ? (l(), h("div", os, [
1682
+ e("h3", ns, [
1683
+ T(k, {
1684
+ name: "error",
1685
+ color: "#ff9500",
1686
+ size: "sm"
1687
+ }),
1688
+ n[6] || (n[6] = Ie(" Change Logs "))
1689
+ ]),
1690
+ e("div", as, [
1691
+ e("table", ls, [
1692
+ n[7] || (n[7] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
1693
+ e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
1694
+ e("th", {
1695
+ class: "text-left p-3 fm-typo-en-body-md-600",
1696
+ style: { "min-width": "130px" }
1697
+ }, " Date "),
1698
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
1699
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
1700
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
1701
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
1702
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
1703
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
1704
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
1705
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
1706
+ ])
1707
+ ], -1)),
1708
+ e("tbody", null, [
1709
+ (l(!0), h(ce, null, we(w.value, (N, ee) => (l(), h("tr", {
1710
+ key: ee,
1711
+ class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
1712
+ }, [
1713
+ e("td", is, y($(N._dateiso8601)), 1),
1714
+ e("td", cs, y(N._rolename), 1),
1715
+ e("td", us, y(N._employeename), 1),
1716
+ e("td", ds, y(N._contextname), 1),
1717
+ e("td", {
1718
+ class: Ke(`p-3 fm-typo-en-body-sm-600 ${R(Number(N.type) - 1)}`)
1719
+ }, y(f(De)[Number(N.type) - 1]), 3),
1720
+ e("td", ms, y(N.lineid || ""), 1),
1721
+ e("td", ps, y(N._fieldname), 1),
1722
+ e("td", fs, y(N.oldvalue || ""), 1),
1723
+ e("td", ys, y(N.newvalue || ""), 1)
1724
+ ]))), 128))
1725
+ ])
1726
+ ])
1727
+ ])
1728
+ ])) : (l(), h("div", vs, n[8] || (n[8] = [
1729
+ e("p", null, "No change logs available.", -1)
1730
+ ])))
1731
+ ], 64))
1732
+ ]))
1733
+ ]),
1734
+ "dialog-footer": re(() => [
1735
+ T(m, {
1736
+ class: "ml-auto sm:w-full xs:w-full",
1737
+ label: "Close",
1738
+ size: "md",
1739
+ variant: "primary",
1740
+ onClick: n[1] || (n[1] = (N) => u.value = !1)
1741
+ })
1742
+ ]),
1743
+ _: 1
1744
+ }, 8, ["modelValue"])
1745
+ ]);
1746
+ };
1747
+ }
1748
+ }), bs = {
1749
+ key: 0,
1750
+ class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
1751
+ }, _s = { class: "flex gap-8 items-center" }, Ss = { class: "ml-auto" }, Os = { class: "flex gap-3" }, xs = /* @__PURE__ */ Re({
1752
+ __name: "NetSuitePanel",
1753
+ props: {
1754
+ poRequest: {},
1755
+ purchaseOrder: {},
1756
+ transferType: {},
1757
+ transferToDbName: {},
1758
+ scope: {}
1759
+ },
1760
+ setup(b) {
1761
+ const r = b, s = dr(), u = W(() => s.isNetSuiteEnabled);
1762
+ return (v, a) => {
1763
+ var t, i;
1764
+ const g = K("FmMenuDivider");
1765
+ return u.value ? (l(), h("div", bs, [
1766
+ e("div", _s, [
1767
+ a[0] || (a[0] = e("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1768
+ e("div", Ss, [
1769
+ e("div", Os, [
1770
+ (i = (t = r.purchaseOrder) == null ? void 0 : t.netSuite) != null && i.id ? (l(), ae(Ue, { key: 0 }, {
1771
+ default: re(() => {
1772
+ var _, w, C;
1773
+ return [
1774
+ T(gs, {
1775
+ "netsuite-id": (w = (_ = v.purchaseOrder) == null ? void 0 : _.netSuite) == null ? void 0 : w.id,
1776
+ "purchase-order-id": (C = v.purchaseOrder) == null ? void 0 : C._id
1777
+ }, null, 8, ["netsuite-id", "purchase-order-id"])
1778
+ ];
1779
+ }),
1780
+ _: 1
1781
+ })) : L("", !0),
1782
+ T(Ue, null, {
1783
+ default: re(() => {
1784
+ var _, w, C;
1785
+ return [
1786
+ T(Yr, {
1787
+ "netsuite-id": (w = (_ = v.purchaseOrder) == null ? void 0 : _.netSuite) == null ? void 0 : w.id,
1788
+ "purchase-order-id": (C = v.purchaseOrder) == null ? void 0 : C._id
1789
+ }, null, 8, ["netsuite-id", "purchase-order-id"])
1790
+ ];
1791
+ }),
1792
+ _: 1
1793
+ }),
1794
+ T(kr, {
1795
+ "po-request": v.poRequest,
1796
+ "purchase-order": v.purchaseOrder,
1797
+ "is-transfer-between-outlets": !u.value,
1798
+ scope: v.scope
1799
+ }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
1800
+ ])
1801
+ ])
1802
+ ]),
1803
+ T(g),
1804
+ T(Hr, {
1805
+ "po-request": v.poRequest,
1806
+ "purchase-order": v.purchaseOrder,
1807
+ "transfer-type": v.transferType,
1808
+ "transfer-to-db-name": v.transferToDbName,
1809
+ "is-transfer-between-outlets": !u.value,
1810
+ scope: v.scope
1811
+ }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1812
+ ])) : L("", !0);
1813
+ };
1814
+ }
1815
+ }), ws = { class: "flex flex-col gap-3" }, Cs = { class: "flex flex-col gap-4" }, Rs = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, $s = { class: "flex flex-col gap-4" }, Ds = { class: "flex justify-between items-center py-1 gap-4" }, ks = { class: "flex flex-col" }, As = { class: "fm-typo-en-body-lg-600" }, Ns = { class: "fm-typo-en-body-md-400" }, Fs = { class: "flex flex-col gap-2 items-end" }, Ts = { class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ps = {
1816
+ key: 0,
1817
+ class: "flex items-center gap-2"
1818
+ }, Is = {
1819
+ key: 0,
1820
+ class: "border-b border-fm-color-stroke-secondary"
1821
+ }, qs = { class: "flex flex-col gap-4" }, Vs = { class: "flex flex-col gap-4" }, Es = { class: "flex flex-col gap-4" }, Ls = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Us = {
1822
+ key: 0,
1823
+ class: "flex flex-col gap-4"
1824
+ }, Ms = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, js = /* @__PURE__ */ Re({
1825
+ __name: "EditForm",
1826
+ props: {
1827
+ purchaseOrder: {},
1828
+ deliveryOrder: {}
1829
+ },
1830
+ emits: ["submitted"],
1831
+ setup(b, { emit: r }) {
1832
+ pr();
1833
+ const s = Me(), u = Ge(), v = J(!1), a = b, g = r, t = Nt("deliveryOrder"), i = He(), _ = W(
1834
+ () => {
1835
+ var m;
1836
+ return ((m = a.purchaseOrder.deliveryFullfillment) == null ? void 0 : m.findIndex(
1837
+ (d) => a.deliveryOrder.fullfillmentId && d.id === a.deliveryOrder.fullfillmentId
1838
+ )) ?? -1;
1839
+ }
1840
+ ), w = s.enablePurchaseOrderReceiveWithCustomCost, C = s.enablePortalDeliveryOrderWrite, c = J({}), R = W(() => a.purchaseOrder.items.map((m, d) => W({
1841
+ get: () => {
1842
+ var k;
1843
+ const S = (k = t.received[d]) == null ? void 0 : k.cost;
1844
+ return S ? +_e(S) : 0;
1845
+ },
1846
+ set: (S) => {
1847
+ t.received[d].cost = {
1848
+ currency: Ce(),
1849
+ ...rt(S, 4)
1850
+ };
1851
+ }
1852
+ }))), $ = W(() => a.deliveryOrder.received.map((m, d) => W({
1853
+ get: () => {
1854
+ var k;
1855
+ const S = (k = t.received[d]) == null ? void 0 : k.amount;
1856
+ return S ? +_e(S) : 0;
1857
+ },
1858
+ set: (S) => {
1859
+ t.received[d].amount = rt(S, 2);
1860
+ }
1861
+ })));
1862
+ function D(m) {
1863
+ const d = !c.value[m];
1864
+ if (c.value[m] = d, d) {
1865
+ const S = a.deliveryOrder.received[m];
1866
+ S.cost ? t.received[m].cost = {
1867
+ currency: S.cost.currency,
1868
+ amount: S.cost.amount,
1869
+ precision: S.cost.precision
1870
+ } : t.received[m].cost = {
1871
+ currency: Ce(),
1872
+ amount: 0,
1873
+ precision: 4
1874
+ };
1875
+ } else
1876
+ delete t.received[m].cost;
1877
+ }
1878
+ function n() {
1879
+ i.updateDeliveryOrder({
1880
+ deliveryOrder: {
1881
+ ...a.deliveryOrder,
1882
+ ...t
1883
+ },
1884
+ purchaseOrderId: a.purchaseOrder._id,
1885
+ purchaseOrderRev: a.purchaseOrder._rev
1886
+ }).then(() => {
1887
+ u.open(
1888
+ {
1889
+ title: "Success",
1890
+ message: `PO# ${a.purchaseOrder.seqNumber} Changes have been saved`,
1891
+ type: "success"
1892
+ },
1893
+ 1e4
1894
+ ), v.value = !1, g("submitted");
1895
+ });
1896
+ }
1897
+ return (m, d) => {
1898
+ const S = K("FmButton"), k = K("FmStepperField"), G = K("FmSwitch"), N = K("FmTextField"), ee = K("FmDialog");
1899
+ return l(), ae(ee, {
1900
+ modelValue: v.value,
1901
+ "onUpdate:modelValue": d[1] || (d[1] = (z) => v.value = z),
1902
+ overlay: !0
1903
+ }, {
1904
+ "dialog-button": re(() => [
1905
+ f(C) ? (l(), ae(S, {
1906
+ key: 0,
1907
+ variant: "plain",
1908
+ label: "Edit",
1909
+ size: "md",
1910
+ "prepend-icon": "edit"
1911
+ })) : L("", !0)
1912
+ ]),
1913
+ "dialog-header": re(() => [
1914
+ e("div", null, "Received on " + y(f(Qe)(a.deliveryOrder.createdAt)), 1)
1915
+ ]),
1916
+ "dialog-footer": re(() => [
1917
+ T(S, {
1918
+ class: "ml-auto",
1919
+ label: "Apply changes",
1920
+ size: "md",
1921
+ variant: "destructive",
1922
+ onClick: n
1923
+ })
1924
+ ]),
1925
+ default: re(() => [
1926
+ e("div", null, [
1927
+ e("div", ws, [
1928
+ e("div", Cs, [
1929
+ d[2] || (d[2] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Adjustment date", -1)),
1930
+ e("div", Rs, y(a.deliveryOrder.adjustment ? f(Qe)(new Date(f(tt)(a.deliveryOrder.adjustment))) : "-"), 1)
1931
+ ]),
1932
+ e("div", $s, [
1933
+ d[4] || (d[4] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received items", -1)),
1934
+ (l(!0), h(ce, null, we(a.deliveryOrder.received, (z, H) => {
1935
+ var he;
1936
+ return l(), h("div", { key: H }, [
1937
+ e("div", Ds, [
1938
+ e("div", ks, [
1939
+ e("span", As, y(z.sku.name), 1),
1940
+ e("span", Ns, y(z.sku.code), 1)
1941
+ ]),
1942
+ e("div", Fs, [
1943
+ T(k, {
1944
+ label: "Receive Quantity",
1945
+ modelValue: $.value[H].value,
1946
+ "onUpdate:modelValue": (fe) => $.value[H].value = fe,
1947
+ min: 0,
1948
+ "append-text": ((he = z.measurement) == null ? void 0 : he.abbrev) ?? z.sku.unit.abbrev
1949
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"]),
1950
+ e("div", Ts, y(`${z.cost ? `${f(ze)(z.cost)}` : ""}`), 1),
1951
+ f(w) ? (l(), h("div", Ps, [
1952
+ T(G, {
1953
+ "model-value": c.value[H],
1954
+ "onUpdate:modelValue": (fe) => D(H),
1955
+ size: "sm"
1956
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
1957
+ d[3] || (d[3] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
1958
+ ])) : L("", !0),
1959
+ f(w) && c.value[H] ? (l(), ae(k, {
1960
+ key: 1,
1961
+ modelValue: R.value[H].value,
1962
+ "onUpdate:modelValue": (fe) => R.value[H].value = fe,
1963
+ label: "Total Cost",
1964
+ step: 1e-4,
1965
+ min: 0,
1966
+ placeholder: "0.0000",
1967
+ size: "sm",
1968
+ "append-text": f(Ce)()
1969
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : L("", !0)
1970
+ ])
1971
+ ]),
1972
+ H < a.purchaseOrder.items.length - 1 ? (l(), h("div", Is)) : L("", !0)
1973
+ ]);
1974
+ }), 128))
1975
+ ]),
1976
+ e("div", qs, [
1977
+ d[5] || (d[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
1978
+ e("div", Vs, [
1979
+ T(N, {
1980
+ modelValue: f(t).deliveryOrderNumber,
1981
+ "onUpdate:modelValue": d[0] || (d[0] = (z) => f(t).deliveryOrderNumber = z),
1982
+ size: "md",
1983
+ placeholder: a.deliveryOrder.deliveryOrderNumber
1984
+ }, null, 8, ["modelValue", "placeholder"])
1985
+ ])
1986
+ ]),
1987
+ e("div", Es, [
1988
+ d[6] || (d[6] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
1989
+ e("div", Ls, y(a.deliveryOrder.remark || "N/A"), 1)
1990
+ ]),
1991
+ _.value >= 0 ? (l(), h("div", Us, [
1992
+ d[7] || (d[7] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fulfilment's sequence ", -1)),
1993
+ e("div", Ms, y(_.value + 1), 1)
1994
+ ])) : L("", !0)
1995
+ ])
1996
+ ])
1997
+ ]),
1998
+ _: 1
1999
+ }, 8, ["modelValue"]);
2000
+ };
2001
+ }
2002
+ }), Bs = { class: "flex flex-col gap-3" }, zs = { class: "flex flex-col gap-4" }, Ks = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Gs = {
2003
+ key: 0,
2004
+ class: "flex flex-col gap-4"
2005
+ }, Hs = { class: "flex items-center justify-between" }, Ws = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ys = {
2006
+ key: 0,
2007
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
2008
+ }, Qs = { class: "flex gap-4" }, Js = { class: "flex-1" }, Xs = { class: "flex-1" }, Zs = {
2009
+ key: 0,
2010
+ class: "flex items-center text-fm-color-system-error-300"
2011
+ }, eo = { class: "fm-typo-en-body-md-400" }, to = { class: "flex flex-col gap-4" }, ro = { class: "flex justify-between items-center py-1 gap-4" }, so = { class: "flex flex-col" }, oo = { class: "fm-typo-en-body-lg-600" }, no = { class: "fm-typo-en-body-md-400" }, ao = { class: "flex flex-col gap-2 items-end" }, lo = {
2012
+ key: 0,
2013
+ class: "flex items-center gap-2"
2014
+ }, io = {
2015
+ key: 0,
2016
+ class: "border-b border-fm-color-stroke-secondary"
2017
+ }, co = { class: "flex flex-col gap-4" }, uo = { class: "flex flex-col gap-4" }, mo = { class: "flex flex-col gap-4" }, po = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, fo = /* @__PURE__ */ Re({
2018
+ __name: "CreateForm",
2019
+ props: {
2020
+ purchaseOrder: {},
2021
+ receivedInfoMap: {}
2022
+ },
2023
+ emits: ["submitted"],
2024
+ setup(b, { emit: r }) {
2025
+ var M, j, oe;
2026
+ const { t: s } = at(), u = J(!1), v = vt(), a = b, g = r, t = Nt("", {
2027
+ default: {
2028
+ deliveryOrderNumber: "",
2029
+ remark: "",
2030
+ received: a.purchaseOrder.items.map((A) => ({
2031
+ sku: A.sku,
2032
+ amount: Le.fromNumber(0),
2033
+ measurement: A.measurement
2034
+ })),
2035
+ createdBy: {
2036
+ id: ((M = v.sessionUser.value) == null ? void 0 : M.id) || "",
2037
+ name: ((j = v.sessionUser.value) == null ? void 0 : j.displayName) || ""
2038
+ },
2039
+ createdAt: ""
2040
+ }
2041
+ }), i = He(), _ = lt(), w = Me(), C = ((oe = a.purchaseOrder) == null ? void 0 : oe.supplier.internal) != null, c = C && w.enablePOSTransferRequireFulfillment, R = w.enablePortalDeliveryOrderWrite && (a.purchaseOrder.status === se.Enum.RECEIVING || a.purchaseOrder.status === se.Enum.COMPLETE) && (C ? !c : !0), $ = w.enablePurchaseOrderReceiveWithCustomCost, D = w.enableBackdateReceive, n = J({}), m = Ge(), d = W({
2042
+ get() {
2043
+ if (!t.createdAt) return "";
2044
+ const A = new Date(t.createdAt), O = A.getFullYear(), I = String(A.getMonth() + 1).padStart(2, "0"), B = String(A.getDate()).padStart(2, "0");
2045
+ return `${O}-${I}-${B}`;
2046
+ },
2047
+ set(A) {
2048
+ if (A) {
2049
+ const O = t.createdAt ? new Date(t.createdAt) : /* @__PURE__ */ new Date(), [I, B, le] = A.split("-");
2050
+ O.setFullYear(parseInt(I)), O.setMonth(parseInt(B) - 1), O.setDate(parseInt(le)), t.createdAt = O.toISOString();
2051
+ }
2052
+ }
2053
+ }), S = W({
2054
+ get() {
2055
+ if (!t.createdAt) return "";
2056
+ const A = new Date(t.createdAt), O = String(A.getHours()).padStart(2, "0"), I = String(A.getMinutes()).padStart(2, "0");
2057
+ return `${O}:${I}`;
2058
+ },
2059
+ set(A) {
2060
+ if (A) {
2061
+ const O = t.createdAt ? new Date(t.createdAt) : /* @__PURE__ */ new Date(), [I, B] = A.split(":");
2062
+ O.setHours(parseInt(I)), O.setMinutes(parseInt(B)), t.createdAt = O.toISOString();
2063
+ }
2064
+ }
2065
+ }), k = W(() => {
2066
+ const A = tt(a.purchaseOrder._id);
2067
+ if (!A) return "";
2068
+ const O = new Date(A), I = O.getFullYear(), B = String(O.getMonth() + 1).padStart(2, "0"), le = String(O.getDate()).padStart(2, "0");
2069
+ return `${I}-${B}-${le}`;
2070
+ }), G = W(() => {
2071
+ const A = tt(a.purchaseOrder._id);
2072
+ return A ? new Date(A) : null;
2073
+ }), N = W(() => {
2074
+ if (!d.value || !S.value || !G.value) return null;
2075
+ if (/* @__PURE__ */ new Date(`${d.value}T${S.value}:00`) < G.value) {
2076
+ const O = k.value, I = G.value.getHours(), B = G.value.getMinutes(), le = I >= 12 ? "PM" : "AM", Ne = I % 12 || 12, Fe = `${String(Ne).padStart(2, "0")}:${String(B).padStart(2, "0")} ${le}`;
2077
+ return `Delivery date & time cannot be earlier than order creation (${O} ${Fe})`;
2078
+ }
2079
+ return null;
2080
+ }), ee = W(() => N.value ? !1 : t.received.some((O) => {
2081
+ const I = O.amount;
2082
+ return I ? +_e(I) > 0 : !1;
2083
+ }));
2084
+ function z() {
2085
+ t.createdAt = "";
2086
+ }
2087
+ const H = W(() => a.purchaseOrder.items.map((A, O) => W({
2088
+ get: () => {
2089
+ var B;
2090
+ const I = (B = t.received[O]) == null ? void 0 : B.amount;
2091
+ return I ? +_e(I) : 0;
2092
+ },
2093
+ set: (I) => {
2094
+ t.received[O].amount = rt(I, 2);
2095
+ }
2096
+ })));
2097
+ function he(A) {
2098
+ const O = !n.value[A];
2099
+ if (n.value[A] = O, O) {
2100
+ const I = a.purchaseOrder.items[A];
2101
+ I.totalCost ? t.received[A].cost = {
2102
+ currency: I.totalCost.currency,
2103
+ amount: I.totalCost.amount,
2104
+ precision: 4
2105
+ // Standardize to 4 decimals
2106
+ } : t.received[A].cost = {
2107
+ currency: Ce(),
2108
+ amount: 0,
2109
+ precision: 4
2110
+ };
2111
+ } else
2112
+ delete t.received[A].cost;
2113
+ }
2114
+ const fe = W(() => a.purchaseOrder.items.map((A, O) => W({
2115
+ get: () => {
2116
+ var B;
2117
+ const I = (B = t.received[O]) == null ? void 0 : B.cost;
2118
+ return I ? +_e(I) : 0;
2119
+ },
2120
+ set: (I) => {
2121
+ t.received[O].cost = {
2122
+ currency: Ce(),
2123
+ ...rt(I, 4)
2124
+ };
2125
+ }
2126
+ })));
2127
+ function $e() {
2128
+ _.open({
2129
+ title: "Confirm Create Delivery Order",
2130
+ message: `Are you sure you want to create delivery order for PO# ${a.purchaseOrder.seqNumber}?`,
2131
+ primaryActions: {
2132
+ text: "Create",
2133
+ close: !0,
2134
+ variant: "primary"
2135
+ },
2136
+ secondaryActions: {
2137
+ text: "Cancel",
2138
+ close: !0
2139
+ }
2140
+ }).onPrimary(() => je());
2141
+ }
2142
+ function je() {
2143
+ i.createDeliveryOrder({
2144
+ deliveryOrder: t,
2145
+ purchaseOrderId: a.purchaseOrder._id,
2146
+ purchaseOrderRev: a.purchaseOrder._rev,
2147
+ currency: Ce()
2148
+ }).then(() => {
2149
+ m.open(
2150
+ {
2151
+ title: "Success",
2152
+ message: `New delivery order created for PO# ${a.purchaseOrder.seqNumber}`,
2153
+ type: "success"
2154
+ },
2155
+ 1e4
2156
+ ), u.value = !1, g("submitted");
2157
+ });
2158
+ }
2159
+ return (A, O) => {
2160
+ const I = K("FmButton"), B = K("FmDatePicker"), le = K("FmTimePicker"), Ne = K("FmIcon"), Fe = K("FmStepperField"), o = K("FmSwitch"), p = K("FmTextField"), P = K("FmDialog");
2161
+ return l(), ae(P, {
2162
+ modelValue: u.value,
2163
+ "onUpdate:modelValue": O[4] || (O[4] = (q) => u.value = q),
2164
+ overlay: !0,
2165
+ "min-width": 800
2166
+ }, {
2167
+ "dialog-button": re(() => [
2168
+ f(R) ? (l(), ae(I, {
2169
+ key: 0,
2170
+ variant: "primary",
2171
+ label: "Create",
2172
+ size: "md",
2173
+ "prepend-icon": "add",
2174
+ class: "w-full"
2175
+ })) : L("", !0)
2176
+ ]),
2177
+ "dialog-header": re(() => [
2178
+ e("div", null, "Order #" + y(a.purchaseOrder.seqNumber) + " (New Delivery Order)", 1)
2179
+ ]),
2180
+ "dialog-footer": re(() => [
2181
+ T(I, {
2182
+ class: "ml-auto",
2183
+ label: "Create",
2184
+ size: "md",
2185
+ variant: "destructive",
2186
+ disabled: !ee.value,
2187
+ onClick: $e
2188
+ }, null, 8, ["disabled"])
2189
+ ]),
2190
+ default: re(() => {
2191
+ var q;
2192
+ return [
2193
+ e("div", Bs, [
2194
+ e("div", zs, [
2195
+ O[5] || (O[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received by", -1)),
2196
+ e("div", Ks, y((q = f(v).sessionUser.value) == null ? void 0 : q.displayName), 1)
2197
+ ]),
2198
+ f(D) ? (l(), h("div", Gs, [
2199
+ e("div", Hs, [
2200
+ e("div", Ws, [
2201
+ O[6] || (O[6] = Ie(" Delivery Date & Time ")),
2202
+ !d.value && !S.value ? (l(), h("div", Ys, " Leave blank to use current date & time ")) : L("", !0)
2203
+ ]),
2204
+ d.value || S.value ? (l(), ae(I, {
2205
+ key: 0,
2206
+ variant: "tertiary",
2207
+ label: "Clear",
2208
+ "prepend-icon": "close",
2209
+ onClick: z
2210
+ })) : L("", !0)
2211
+ ]),
2212
+ e("div", Qs, [
2213
+ e("div", Js, [
2214
+ T(B, {
2215
+ modelValue: d.value,
2216
+ "onUpdate:modelValue": O[0] || (O[0] = (V) => d.value = V)
2217
+ }, null, 8, ["modelValue"])
2218
+ ]),
2219
+ e("div", Xs, [
2220
+ T(le, {
2221
+ modelValue: S.value,
2222
+ "onUpdate:modelValue": O[1] || (O[1] = (V) => S.value = V)
2223
+ }, null, 8, ["modelValue"])
2224
+ ])
2225
+ ]),
2226
+ N.value ? (l(), h("div", Zs, [
2227
+ T(Ne, {
2228
+ name: "error",
2229
+ class: "inline-block mr-1",
2230
+ size: "sm"
2231
+ }),
2232
+ e("div", eo, y(N.value), 1)
2233
+ ])) : L("", !0)
2234
+ ])) : L("", !0),
2235
+ e("div", to, [
2236
+ O[8] || (O[8] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Items going to receive ", -1)),
2237
+ (l(!0), h(ce, null, we(a.purchaseOrder.items, (V, E) => {
2238
+ var Y, x, X;
2239
+ return l(), h("div", { key: E }, [
2240
+ e("div", ro, [
2241
+ e("div", so, [
2242
+ e("span", oo, y(V.sku.name), 1),
2243
+ e("span", no, y(V.sku.code), 1)
2244
+ ]),
2245
+ e("div", ao, [
2246
+ T(Fe, {
2247
+ label: "Receive Quantity",
2248
+ modelValue: H.value[E].value,
2249
+ "onUpdate:modelValue": (Q) => H.value[E].value = Q,
2250
+ "helper-text": `${f(s)("inventory.transfer.receiveRequest.details.received")} ${f(Le).toFormatString(
2251
+ {
2252
+ value: (Y = A.receivedInfoMap[V.sku._id]) == null ? void 0 : Y.received
2253
+ }
2254
+ )} ${((x = V.measurement) == null ? void 0 : x.abbrev) ?? V.sku.unit.abbrev}`,
2255
+ min: 0,
2256
+ "append-text": ((X = V.measurement) == null ? void 0 : X.abbrev) ?? V.sku.unit.abbrev
2257
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "helper-text", "append-text"]),
2258
+ f($) ? (l(), h("div", lo, [
2259
+ T(o, {
2260
+ "model-value": n.value[E],
2261
+ "onUpdate:modelValue": (Q) => he(E),
2262
+ size: "sm"
2263
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
2264
+ O[7] || (O[7] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
2265
+ ])) : L("", !0),
2266
+ f($) && n.value[E] ? (l(), ae(Fe, {
2267
+ key: 1,
2268
+ modelValue: fe.value[E].value,
2269
+ "onUpdate:modelValue": (Q) => fe.value[E].value = Q,
2270
+ label: "Total Cost",
2271
+ step: 1e-4,
2272
+ min: 0,
2273
+ placeholder: "0.0000",
2274
+ size: "sm",
2275
+ "append-text": f(Ce)()
2276
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : L("", !0)
2277
+ ])
2278
+ ]),
2279
+ E < a.purchaseOrder.items.length - 1 ? (l(), h("div", io)) : L("", !0)
2280
+ ]);
2281
+ }), 128))
2282
+ ]),
2283
+ e("div", co, [
2284
+ O[9] || (O[9] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
2285
+ e("div", uo, [
2286
+ T(p, {
2287
+ modelValue: f(t).deliveryOrderNumber,
2288
+ "onUpdate:modelValue": O[2] || (O[2] = (V) => f(t).deliveryOrderNumber = V),
2289
+ size: "md"
2290
+ }, null, 8, ["modelValue"])
2291
+ ])
2292
+ ]),
2293
+ e("div", mo, [
2294
+ O[10] || (O[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
2295
+ e("div", po, [
2296
+ T(p, {
2297
+ modelValue: f(t).remark,
2298
+ "onUpdate:modelValue": O[3] || (O[3] = (V) => f(t).remark = V),
2299
+ size: "md"
2300
+ }, null, 8, ["modelValue"])
2301
+ ])
2302
+ ])
2303
+ ])
2304
+ ];
2305
+ }),
2306
+ _: 1
2307
+ }, 8, ["modelValue"]);
2308
+ };
2309
+ }
2310
+ }), yo = { class: "flex flex-row-reverse" }, vo = {
2311
+ key: 0,
2312
+ class: "flex"
2313
+ }, ho = {
2314
+ key: 1,
2315
+ class: "border-t pt-6"
2316
+ }, go = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, bo = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, _o = { class: "w-full" }, So = {
2317
+ class: "p-3 fm-typo-en-body-sm-600",
2318
+ style: { "min-width": "130px" }
2319
+ }, Oo = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, xo = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, wo = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Co = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ro = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, $o = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Do = { class: "p-3 fm-typo-en-body-sm-600" }, ko = { key: 2 }, Ao = /* @__PURE__ */ Re({
2320
+ __name: "NetSuiteTransactionChangeLog",
2321
+ props: {
2322
+ netsuiteId: {}
2323
+ },
2324
+ setup(b) {
2325
+ const r = b, s = ht(), u = J(!1), v = J(!1), a = J(!1), g = J([]);
2326
+ async function t() {
2327
+ if (!(g.value.length > 0))
2328
+ try {
2329
+ v.value = !0;
2330
+ const w = await s.getChangeLogs(r.netsuiteId);
2331
+ g.value = w, a.value = !1;
2332
+ } catch {
2333
+ a.value = !0;
2334
+ } finally {
2335
+ v.value = !1;
2336
+ }
2337
+ }
2338
+ function i(w) {
2339
+ switch (w) {
2340
+ case De.Create:
2341
+ return "text-green-600 bg-green-100";
2342
+ case De.Set:
2343
+ return "text-blue-600 bg-blue-100";
2344
+ case De.Change:
2345
+ return "text-yellow-600 bg-yellow-100";
2346
+ case De.Unset:
2347
+ return "text-red-600 bg-red-100";
2348
+ default:
2349
+ return "text-gray-600 bg-gray-100";
2350
+ }
2351
+ }
2352
+ function _(w) {
2353
+ return new Date(w).toLocaleDateString("en-US", {
2354
+ year: "numeric",
2355
+ month: "short",
2356
+ day: "numeric",
2357
+ hour: "2-digit",
2358
+ minute: "2-digit"
2359
+ });
2360
+ }
2361
+ return (w, C) => {
2362
+ const c = K("FmButton"), R = K("FmCircularProgress"), $ = K("FmIcon"), D = K("FmDialog");
2363
+ return l(), h("div", yo, [
2364
+ T(D, {
2365
+ modelValue: u.value,
2366
+ "onUpdate:modelValue": C[2] || (C[2] = (n) => u.value = n),
2367
+ overlay: !0,
2368
+ "max-width": 800
2369
+ }, {
2370
+ "dialog-button": re(() => [
2371
+ T(c, {
2372
+ "prepend-icon": "info",
2373
+ variant: "secondary",
2374
+ label: "NetSuite",
2375
+ onClick: C[0] || (C[0] = (n) => t()),
2376
+ "text-color": "primary",
2377
+ "bg-color": "transparent",
2378
+ "border-color": "primary"
2379
+ })
2380
+ ]),
2381
+ "dialog-header": re(() => C[3] || (C[3] = [
2382
+ e("div", null, "NetSuite info", -1)
2383
+ ])),
2384
+ default: re(() => [
2385
+ v.value ? (l(), h("div", vo, [
2386
+ C[4] || (C[4] = e("span", null, "Change Log Loading...", -1)),
2387
+ T(R, { size: "md" })
2388
+ ])) : L("", !0),
2389
+ !v.value && g.value.length > 0 ? (l(), h("div", ho, [
2390
+ e("h3", go, [
2391
+ T($, {
2392
+ name: "error",
2393
+ color: "#ff9500",
2394
+ size: "sm"
2395
+ }),
2396
+ C[5] || (C[5] = Ie(" Change Logs "))
2397
+ ]),
2398
+ e("div", bo, [
2399
+ e("table", _o, [
2400
+ C[6] || (C[6] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
2401
+ e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
2402
+ e("th", {
2403
+ class: "text-left p-3 fm-typo-en-body-md-600",
2404
+ style: { "min-width": "130px" }
2405
+ }, " Date "),
2406
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
2407
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
2408
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
2409
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
2410
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
2411
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
2412
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
2413
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
2414
+ ])
2415
+ ], -1)),
2416
+ e("tbody", null, [
2417
+ (l(!0), h(ce, null, we(g.value, (n, m) => (l(), h("tr", {
2418
+ key: m,
2419
+ class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
2420
+ }, [
2421
+ e("td", So, y(_(n._dateiso8601)), 1),
2422
+ e("td", Oo, y(n._rolename), 1),
2423
+ e("td", xo, y(n._employeename), 1),
2424
+ e("td", wo, y(n._contextname), 1),
2425
+ e("td", {
2426
+ class: Ke(`p-3 fm-typo-en-body-sm-600 ${i(Number(n.type) - 1)}`)
2427
+ }, y(f(De)[Number(n.type) - 1]), 3),
2428
+ e("td", Co, y(n.lineid || ""), 1),
2429
+ e("td", Ro, y(n._fieldname), 1),
2430
+ e("td", $o, y(n.oldvalue || ""), 1),
2431
+ e("td", Do, y(n.newvalue || ""), 1)
2432
+ ]))), 128))
2433
+ ])
2434
+ ])
2435
+ ])
2436
+ ])) : (l(), h("div", ko, C[7] || (C[7] = [
2437
+ e("p", null, "No change logs available.", -1)
2438
+ ])))
2439
+ ]),
2440
+ "dialog-footer": re(() => [
2441
+ T(c, {
2442
+ class: "ml-auto sm:w-full xs:w-full",
2443
+ label: "Close",
2444
+ size: "md",
2445
+ variant: "primary",
2446
+ onClick: C[1] || (C[1] = (n) => u.value = !1)
2447
+ })
2448
+ ]),
2449
+ _: 1
2450
+ }, 8, ["modelValue"])
2451
+ ]);
2452
+ };
2453
+ }
2454
+ }), No = { class: "flex flex-col w-full gap-3" }, Fo = { class: "flex" }, To = { class: "fm-typo-en-title-md-600 text-fm-color-typo-primary" }, Po = { class: "flex flex-col gap-16 w-full h-full" }, Io = { class: "flex justify-between" }, qo = { class: "fm-typo-en-body-lg-600" }, Vo = { class: "flex gap-2" }, Eo = {
2455
+ key: 0,
2456
+ class: "flex items-center gap-1"
2457
+ }, Lo = { class: "fm-typo-en-body-md-400" }, Uo = { class: "flex flex-col gap-8" }, Mo = { class: "flex flex-col gap-4" }, jo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bo = { class: "flex gap-1" }, zo = { class: "fm-typo-en-body-lg-600" }, Ko = {
2458
+ key: 0,
2459
+ class: "flex flex-col gap-4"
2460
+ }, Go = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ho = { class: "fm-typo-en-body-lg-600" }, Wo = { class: "flex flex-col gap-4" }, Yo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Qo = { class: "fm-typo-en-body-lg-600" }, Jo = {
2461
+ key: 1,
2462
+ class: "flex flex-col gap-4"
2463
+ }, Xo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Zo = { class: "fm-typo-en-body-lg-600" }, en = {
2464
+ key: 2,
2465
+ class: "flex flex-col gap-4"
2466
+ }, tn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rn = { class: "fm-typo-en-body-lg-600" }, sn = {
2467
+ key: 3,
2468
+ class: "flex flex-col gap-4"
2469
+ }, on = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, nn = { class: "fm-typo-en-body-lg-600" }, an = {
2470
+ key: 4,
2471
+ class: "flex flex-col gap-4"
2472
+ }, ln = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, cn = { class: "fm-typo-en-body-lg-600" }, un = {
2473
+ key: 5,
2474
+ class: "flex flex-col gap-4"
2475
+ }, dn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, mn = { class: "fm-typo-en-body-lg-600" }, pn = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, fn = { class: "flex flex-col gap-8" }, yn = { class: "flex gap-8 items-center" }, vn = { class: "flex-1 fm-typo-en-body-lg-600" }, hn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, gn = { class: "flex w-full gap-4" }, bn = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2 flex items-center gap-2" }, _n = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-2" }, Sn = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, On = ["innerHTML"], xn = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, wn = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, Cn = {
2476
+ key: 0,
2477
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2478
+ }, Rn = {
2479
+ key: 0,
2480
+ class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400"
2481
+ }, $n = { class: "py-8" }, Dn = { class: "flex justify-end gap-4 items-center" }, kn = { class: "fm-typo-en-body-lg-600" }, An = {
2482
+ key: 1,
2483
+ class: "flex-1 xs:w-screen xs:max-w-full"
2484
+ }, Nn = {
2485
+ key: 0,
2486
+ class: "flex flex-col items-center gap-8 h-full"
2487
+ }, Fn = ["src"], Tn = { class: "fm-typo-en-body-lg-600" }, Pn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, In = {
2488
+ key: 1,
2489
+ class: "px-4 flex flex-col"
2490
+ }, qn = { class: "flex gap-12 content-stretch" }, Vn = {
2491
+ class: "flex flex-col w-40",
2492
+ name: "circles"
2493
+ }, En = { class: "flex-1 flex flex-col items-center" }, Ln = { class: "h-40 w-40 bg-fm-color-primary rounded-full flex items-center justify-center" }, Un = { class: "flex-1 flex flex-col items-center" }, Mn = { class: "flex w-full items-center gap-4" }, jn = {
2494
+ class: "py-12 flex flex-col gap-4",
2495
+ name: "received-at header"
2496
+ }, Bn = { class: "fm-typo-en-body-lg-400" }, zn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Kn = { class: "ml-auto flex gap-1" }, Gn = { class: "flex gap-12 content-stretch" }, Hn = {
2497
+ class: "flex flex-col w-40",
2498
+ name: "circles"
2499
+ }, Wn = { class: "flex-1 flex flex-col items-center" }, Yn = {
2500
+ class: "py-12 flex flex-col gap-4 flex-1",
2501
+ name: "delivery details"
2502
+ }, Qn = { class: "flex flex-col gap-8" }, Jn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Xn = { class: "flex flex-col gap-4" }, Zn = { class: "flex gap-8 xs:flex-col" }, Ra = /* @__PURE__ */ Re({
2503
+ __name: "TransferDetails",
2504
+ props: {
2505
+ poRequest: {},
2506
+ purchaseOrder: {},
2507
+ transferTo: {},
2508
+ transferToDbName: {},
2509
+ show: { type: Boolean },
2510
+ canResubmit: { type: Boolean },
2511
+ canApprove: { type: Boolean },
2512
+ scope: {},
2513
+ receivedMap: {},
2514
+ shipments: {}
2515
+ },
2516
+ emits: ["update:show", "submitted"],
2517
+ setup(b, { emit: r }) {
2518
+ const s = b, u = r, v = lt(), a = Ge(), g = Me(), t = Ae(), i = vt(), _ = xr();
2519
+ et(
2520
+ () => s.purchaseOrder,
2521
+ (o) => {
2522
+ _.init(o);
2523
+ },
2524
+ { immediate: !0 }
2525
+ );
2526
+ const w = W(
2527
+ () => {
2528
+ var o, p;
2529
+ return {
2530
+ id: ((o = i.sessionUser.value) == null ? void 0 : o.id) ?? "",
2531
+ name: ((p = i.sessionUser.value) == null ? void 0 : p.displayName) ?? ""
2532
+ };
2533
+ }
2534
+ ), C = It(), { t: c } = at(), R = W(
2535
+ () => {
2536
+ var o, p, P, q;
2537
+ return ((p = (o = s.purchaseOrder) == null ? void 0 : o.supplier) == null ? void 0 : p.internal) === "restaurant" || ((q = (P = s.purchaseOrder) == null ? void 0 : P.supplier) == null ? void 0 : q.internal) === "warehouse" ? Ye.enum.transfer : Ye.enum.purchase;
2538
+ }
2539
+ ), $ = W(() => {
2540
+ var P;
2541
+ const o = (P = s.shipments) == null ? void 0 : P.find((q) => {
2542
+ var V;
2543
+ return q.ref === ((V = s.purchaseOrder) == null ? void 0 : V._id);
2544
+ });
2545
+ let p = null;
2546
+ if (o != null && o.milestones && o.milestones.length > 0) {
2547
+ const q = o.milestones[o.milestones.length - 1];
2548
+ if (q.estimatedTime) {
2549
+ const V = new Date(q.estimatedTime), E = V.getDate().toString().padStart(2, "0");
2550
+ p = `${V.toLocaleString("en-US", { month: "short" })} ${E}`;
2551
+ }
2552
+ }
2553
+ return p;
2554
+ }), D = J(!1), n = J(""), m = J(!0), d = He(), S = ur(d.getWorkflowConfig), k = Pt(), G = [
2555
+ F.enum.receiveStock,
2556
+ F.enum.processRequest,
2557
+ F.enum.closeRequest
2558
+ ], N = W(() => {
2559
+ if (!s.purchaseOrder)
2560
+ return [];
2561
+ const o = S.result.value;
2562
+ if (o.state === St.loading)
2563
+ return [];
2564
+ const p = {
2565
+ user: w.value,
2566
+ executedAt: t.locations.computeFirst(
2567
+ (Y) => {
2568
+ var x;
2569
+ return Y.dbName === ((x = t._currentLocation) == null ? void 0 : x.dbName) ? Y : null;
2570
+ }
2571
+ ),
2572
+ purchaseOrderRequest: s.poRequest,
2573
+ purchaseOrder: s.purchaseOrder
2574
+ }, P = g.useOperatePurchaseOrderV2, q = g.poWorkflowAllowToMarkCompleted, V = [...G];
2575
+ P && !q && V.push(F.enum.completeReceive);
2576
+ let E = [];
2577
+ try {
2578
+ o.state === St.error ? (console.error("Error fetching workflow config:", o.error), E = it.getAvailableActions({
2579
+ ...p,
2580
+ orderConfig: it.getDefaultConfig()
2581
+ }).actions.filter((Y) => !V.includes(Y))) : E = it.getAvailableActions({
2582
+ ...p,
2583
+ orderConfig: o.data
2584
+ }).actions.filter((Y) => !V.includes(Y));
2585
+ } catch (Y) {
2586
+ console.error("Error getting available actions:", Y);
2587
+ }
2588
+ return s.scope === "approval" && (E = E.filter((Y) => Y !== F.enum.completeReceive)), E;
2589
+ }), ee = tr(s, "show"), z = W(() => [
2590
+ {
2591
+ label: c("inventory.transfer.receiveRequest.details.overview"),
2592
+ value: "overview"
2593
+ },
2594
+ {
2595
+ label: c("inventory.transfer.receiveRequest.details.deliveryHistory"),
2596
+ value: "deliveryHistory"
2597
+ }
2598
+ ]), H = J(z.value[0]);
2599
+ et(
2600
+ () => s.show,
2601
+ (o) => {
2602
+ o && (H.value = z.value[0]);
2603
+ }
2604
+ );
2605
+ function he(o) {
2606
+ return o.map((p) => ({
2607
+ ...p,
2608
+ amount: {
2609
+ ...p.amount,
2610
+ amount: -Math.abs(p.amount.amount)
2611
+ }
2612
+ }));
2613
+ }
2614
+ async function fe(o, p, P, q, V) {
2615
+ return new Promise((E, Y) => {
2616
+ const x = {
2617
+ closeButton: !1,
2618
+ title: q.title,
2619
+ message: q.message,
2620
+ primaryActions: q.primaryActions,
2621
+ secondaryActions: { text: "No", close: !1 }
2622
+ };
2623
+ let X = p.rejectReason ?? "";
2624
+ P === F.enum.rejectDraft && (x.contentComponent = Tt, x.contentComponentProps = {
2625
+ message: q.message,
2626
+ onChange: (Q) => {
2627
+ X = Q ?? "";
2628
+ }
2629
+ }), v.open(x).onPrimary(async () => {
2630
+ var ie, Z, ne, pe;
2631
+ const Q = [];
2632
+ P === F.enum.confirmDraft ? Q.push({
2633
+ action: "confirmDraft",
2634
+ payload: {
2635
+ items: p.items
2636
+ }
2637
+ }) : P === F.enum.approveRequest ? (Q.push({
2638
+ action: "approveRequest",
2639
+ payload: null
2640
+ }), p.fulfillment && Q.push({
2641
+ action: "processRequest",
2642
+ payload: {
2643
+ fulfillmentId: "",
2644
+ deliveryOrderNumber: "",
2645
+ deliveryRemark: null,
2646
+ items: he(p.fulfillment.items),
2647
+ createdBy: w.value
2648
+ }
2649
+ })) : P === F.enum.processRequest ? p.fulfillment && Q.push({
2650
+ action: "processRequest",
2651
+ payload: {
2652
+ fulfillmentId: "",
2653
+ deliveryOrderNumber: "",
2654
+ deliveryRemark: null,
2655
+ items: he(p.fulfillment.items),
2656
+ createdBy: w.value
2657
+ }
2658
+ }) : P === F.enum.rejectRequest ? Q.push({
2659
+ action: "rejectRequest",
2660
+ payload: null
2661
+ }) : P === F.enum.closeRequest ? Q.push({
2662
+ action: "closeRequest",
2663
+ payload: null
2664
+ }) : P === F.enum.rejectDraft && Q.push({
2665
+ action: "rejectDraft",
2666
+ payload: {
2667
+ rejectReason: X ?? ""
2668
+ }
2669
+ });
2670
+ try {
2671
+ await k({
2672
+ operate: {
2673
+ operation: P,
2674
+ doc: o,
2675
+ options: p
2676
+ },
2677
+ operateV2: {
2678
+ _id: ((ie = s.purchaseOrder) == null ? void 0 : ie._id) ?? "",
2679
+ _rev: ((Z = s.purchaseOrder) == null ? void 0 : Z._rev) ?? "",
2680
+ action: P,
2681
+ payloads: Q
2682
+ // add payload if action is receiveStock or processRequest
2683
+ },
2684
+ transferTo: (pe = (ne = s.poRequest) == null ? void 0 : ne.to) == null ? void 0 : pe.dbName
2685
+ }).delayed(1e3), E("submitted");
2686
+ } catch (ke) {
2687
+ Y(ke);
2688
+ }
2689
+ }).onSecondary(() => {
2690
+ E("cancelled");
2691
+ for (let Q = 0; Q < V + 2; Q++)
2692
+ v.close();
2693
+ }).onClose(() => {
2694
+ });
2695
+ });
2696
+ }
2697
+ async function $e(o) {
2698
+ var V, E, Y, x;
2699
+ if (o === F.enum.receiveStock)
2700
+ return;
2701
+ const p = Ft[o];
2702
+ if (!p) {
2703
+ a.open({
2704
+ title: "Something went wrong",
2705
+ message: `Cannot process order: ${yt(o)}`,
2706
+ type: "error"
2707
+ });
2708
+ return;
2709
+ }
2710
+ const { successMessage: P, ...q } = p;
2711
+ if (s.purchaseOrder) {
2712
+ n.value = `${o}`, D.value = !0, m.value = !1;
2713
+ const X = {};
2714
+ let Q = 0;
2715
+ if (o === F.enum.confirmDraft && (X.items = s.purchaseOrder.items.map((ie) => ({
2716
+ ...ie,
2717
+ totalCost: _.controller.value.getItemCost(ie, Ce()).cost
2718
+ }))), (o === F.enum.confirmDraft || // auto receive for warehouse to warehouse
2719
+ o === F.enum.completeReceive) && g.autoReceiveWarehouse)
2720
+ X.autoReceive = !0;
2721
+ else if ((o === F.enum.approveRequest || o === F.enum.processRequest) && g.acceptRequireFulfillment) {
2722
+ const ie = (E = (V = s.poRequest) == null ? void 0 : V.from) == null ? void 0 : E.dbName, Z = (x = (Y = s.poRequest) == null ? void 0 : Y.to) == null ? void 0 : x.dbName;
2723
+ if (ie && Z && (ie.startsWith("warehouse_") || Z.startsWith("warehouse_"))) {
2724
+ const ne = await new Promise((pe, ke) => {
2725
+ v.open({
2726
+ closeButton: !1,
2727
+ title: "Confirm transfer amount",
2728
+ dialogComponent: $r,
2729
+ dialogComponentProps: {
2730
+ purchaseOrder: s.purchaseOrder,
2731
+ confirm: pe,
2732
+ "onUpdate:show": (qe) => {
2733
+ qe || (n.value = "", D.value = !1, m.value = !0, Q++, v.close()), ke("cancelled");
2734
+ }
2735
+ }
2736
+ });
2737
+ });
2738
+ X.fulfillment = ne;
2739
+ }
2740
+ }
2741
+ try {
2742
+ await fe(
2743
+ s.purchaseOrder,
2744
+ X,
2745
+ o,
2746
+ p,
2747
+ Q
2748
+ ) === "submitted" && (a.open({
2749
+ title: "Success",
2750
+ message: P,
2751
+ type: "success"
2752
+ }), u("update:show", !1), u("submitted"));
2753
+ } catch (ie) {
2754
+ a.open({
2755
+ title: "Something went wrong",
2756
+ message: "Please try again.",
2757
+ type: "error"
2758
+ }), console.error("Error when submitting PO operation", o, s.purchaseOrder, ie);
2759
+ } finally {
2760
+ n.value = "", D.value = !1, m.value = !0;
2761
+ }
2762
+ }
2763
+ }
2764
+ const je = W(() => {
2765
+ var o, p;
2766
+ return ((o = s.purchaseOrder) == null ? void 0 : o.status) === se.enum.RECEIVING || ((p = s.purchaseOrder) == null ? void 0 : p.status) === se.enum.COMPLETE;
2767
+ }), M = W(() => s.purchaseOrder ? ot(s.purchaseOrder) : {}), j = W(() => {
2768
+ const o = s.purchaseOrder;
2769
+ if (!o) return { status: "", statusClass: "" };
2770
+ const { partial: p, over: P } = mt(M.value), q = pt(o.status, p, P);
2771
+ let V = c(`inventory.transfer.status.${q}`), E = `${o.status}`.toLocaleLowerCase("en-us");
2772
+ return q === se.enum.CLOSE && (V = `${c(`inventory.transfer.status.${se.enum.COMPLETE}`)}`), q === "PARTIAL_RECEIVED" && E === se.enum.PROCESSING.toLocaleLowerCase("en-us") && (E = se.enum.RECEIVING.toLocaleLowerCase("en-us")), {
2773
+ status: V,
2774
+ statusClass: `fm-status-badge fm-status-badge-${E}`
2775
+ };
2776
+ }), oe = W(() => {
2777
+ var E, Y;
2778
+ const o = ((E = s.purchaseOrder) == null ? void 0 : E.deliveryOrder) ?? [], p = ((Y = s.purchaseOrder) == null ? void 0 : Y.deliveryFullfillment) ?? [], P = [
2779
+ ...o.map((x) => ({
2780
+ createdAt: x.createdAt,
2781
+ type: "grn",
2782
+ doc: x
2783
+ })),
2784
+ ...p.map((x) => ({
2785
+ createdAt: x.createdAt,
2786
+ type: "fulfillment",
2787
+ doc: x
2788
+ }))
2789
+ ];
2790
+ P.reverse().sort((x, X) => x.createdAt.localeCompare(X.createdAt));
2791
+ function q(x) {
2792
+ var ie, Z, ne, pe, ke, qe, te, ue, ye, ge, Oe, xe;
2793
+ const X = p.findIndex((de) => de.id === x.fullfillmentId), Q = [
2794
+ (Z = (ie = p[X]) == null ? void 0 : ie.netSuite) != null && Z.id ? {
2795
+ label: "Fulfillment's ref no. (Netsuite)",
2796
+ values: [
2797
+ `${((pe = (ne = p[X]) == null ? void 0 : ne.netSuite) == null ? void 0 : pe.refNo) ?? "N/A"} (${((qe = (ke = p[X]) == null ? void 0 : ke.netSuite) == null ? void 0 : qe.id) ?? "-"})`
2798
+ ]
2799
+ } : null,
2800
+ (te = x == null ? void 0 : x.netSuite) != null && te.id ? {
2801
+ label: "Netsuite ref no.",
2802
+ values: [`${((ue = x == null ? void 0 : x.netSuite) == null ? void 0 : ue.refNo) ?? "N/A"} (${((ye = x == null ? void 0 : x.netSuite) == null ? void 0 : ye.id) ?? "-"})`]
2803
+ } : null,
2804
+ (ge = x == null ? void 0 : x.netSuite) != null && ge.recordType ? {
2805
+ label: "Netsuite Type",
2806
+ values: [$t((Oe = x == null ? void 0 : x.netSuite) == null ? void 0 : Oe.recordType)]
2807
+ } : null
2808
+ ];
2809
+ return {
2810
+ header: "Received",
2811
+ deliveryOrder: x,
2812
+ date: Qe(new Date(x.createdAt)),
2813
+ info: [
2814
+ {
2815
+ label: "Adjustment date",
2816
+ values: [
2817
+ x.adjustment ? Qe(new Date(tt(x.adjustment))) : "-"
2818
+ ]
2819
+ },
2820
+ {
2821
+ label: "Received by",
2822
+ values: [(xe = x.createdBy) == null ? void 0 : xe.name]
2823
+ },
2824
+ {
2825
+ label: "Received items",
2826
+ values: x.received.map((de) => {
2827
+ var ve;
2828
+ return U("div", [
2829
+ U(
2830
+ "div",
2831
+ {
2832
+ class: "flex gap-4"
2833
+ },
2834
+ [
2835
+ U(
2836
+ "div",
2837
+ {
2838
+ class: "flex flex-col"
2839
+ },
2840
+ [
2841
+ U(
2842
+ "span",
2843
+ {
2844
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
2845
+ },
2846
+ `${de.sku.name}`
2847
+ ),
2848
+ U(
2849
+ "span",
2850
+ {
2851
+ class: "fm-typo-en-body-md-400"
2852
+ },
2853
+ `${de.sku.code} `
2854
+ )
2855
+ ]
2856
+ ),
2857
+ U(
2858
+ "div",
2859
+ {
2860
+ class: "ml-auto flex flex-col"
2861
+ },
2862
+ [
2863
+ U(
2864
+ "div",
2865
+ {
2866
+ class: "ml-auto flex gap-1"
2867
+ },
2868
+ [
2869
+ U(
2870
+ "span",
2871
+ {
2872
+ class: "fm-typo-en-body-lg-600 self-end"
2873
+ },
2874
+ _e(de.amount, !1)
2875
+ ),
2876
+ U(
2877
+ "span",
2878
+ {
2879
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2880
+ },
2881
+ ((ve = de.measurement) == null ? void 0 : ve.abbrev) ?? de.sku.unit.abbrev
2882
+ )
2883
+ ]
2884
+ ),
2885
+ U(
2886
+ "div",
2887
+ {
2888
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
2889
+ },
2890
+ `${de.cost ? `(${ze(de.cost)})` : ""}`
2891
+ )
2892
+ ]
2893
+ )
2894
+ ]
2895
+ )
2896
+ ]);
2897
+ })
2898
+ },
2899
+ {
2900
+ label: "Delivery order no.",
2901
+ values: [x.deliveryOrderNumber || "N/A"]
2902
+ },
2903
+ {
2904
+ label: "Remark",
2905
+ values: [x.remark || "N/A"]
2906
+ },
2907
+ X > -1 ? {
2908
+ label: "Fulfilment's sequence",
2909
+ values: [`${X + 1}`]
2910
+ } : null,
2911
+ ...Q
2912
+ ].filter((de) => !!de)
2913
+ };
2914
+ }
2915
+ function V(x) {
2916
+ var Q, ie, Z;
2917
+ const X = p.findIndex((ne) => ne.id === x.id);
2918
+ return {
2919
+ header: "Fulfillment",
2920
+ date: Qe(new Date(x.createdAt)),
2921
+ info: [
2922
+ {
2923
+ label: "Sequence",
2924
+ values: [String(X + 1)]
2925
+ },
2926
+ {
2927
+ label: "Receiveable items",
2928
+ values: x.items.map((ne) => {
2929
+ var pe;
2930
+ return U("div", [
2931
+ U(
2932
+ "div",
2933
+ {
2934
+ class: "flex gap-4"
2935
+ },
2936
+ [
2937
+ U(
2938
+ "div",
2939
+ {
2940
+ class: "flex flex-col"
2941
+ },
2942
+ [
2943
+ U(
2944
+ "span",
2945
+ {
2946
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
2947
+ },
2948
+ `${ne.sku.name}`
2949
+ ),
2950
+ U(
2951
+ "span",
2952
+ {
2953
+ class: "fm-typo-en-body-md-400"
2954
+ },
2955
+ `${ne.sku.code} `
2956
+ )
2957
+ ]
2958
+ ),
2959
+ U(
2960
+ "div",
2961
+ {
2962
+ class: "ml-auto flex flex-col"
2963
+ },
2964
+ [
2965
+ U(
2966
+ "div",
2967
+ {
2968
+ class: "ml-auto flex gap-1"
2969
+ },
2970
+ [
2971
+ U(
2972
+ "span",
2973
+ {
2974
+ class: "fm-typo-en-body-lg-600 self-end"
2975
+ },
2976
+ _e(ne.amount, !1)
2977
+ ),
2978
+ U(
2979
+ "span",
2980
+ {
2981
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2982
+ },
2983
+ ((pe = ne.measurement) == null ? void 0 : pe.abbrev) ?? ne.sku.unit.abbrev
2984
+ )
2985
+ ]
2986
+ ),
2987
+ U(
2988
+ "div",
2989
+ {
2990
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
2991
+ },
2992
+ `${ne.cost ? `(${ze(ne.cost)})` : ""}`
2993
+ )
2994
+ ]
2995
+ )
2996
+ ]
2997
+ )
2998
+ ]);
2999
+ })
3000
+ },
3001
+ (Q = x.netSuite) != null && Q.refNo ? {
3002
+ label: "Netsuite Ref no. (ID)",
3003
+ values: [`${(ie = x.netSuite) == null ? void 0 : ie.refNo} (${((Z = x.netSuite) == null ? void 0 : Z.id) ?? "-"})`]
3004
+ } : null
3005
+ ].filter((ne) => !!ne)
3006
+ };
3007
+ }
3008
+ return P.map((x) => {
3009
+ switch (x.type) {
3010
+ case "grn":
3011
+ return q(x.doc);
3012
+ case "fulfillment":
3013
+ return V(x.doc);
3014
+ }
3015
+ });
3016
+ }), A = W(() => {
3017
+ var p;
3018
+ const o = {
3019
+ ...kt(0),
3020
+ currency: Ce()
3021
+ };
3022
+ return ((p = s.purchaseOrder) == null ? void 0 : p.items.reduce((P, q) => ({
3023
+ ...Dt(P, q.totalCost ?? o),
3024
+ currency: Ce()
3025
+ }), o)) ?? o;
3026
+ });
3027
+ function O(o) {
3028
+ var E;
3029
+ const P = (((E = s.purchaseOrder) == null ? void 0 : E.version) ?? Ee.enum[1]) === Ee.enum[2] ? o.id : o.sku._id, q = s.receivedMap[P];
3030
+ return `<span class="${I(o)} fm-typo-en-body-lg-600">${Le.toFormatString({ value: q.received })}</span>/${nr(o.quantity, o.sku.unit, o.measurement)}`;
3031
+ }
3032
+ function I(o) {
3033
+ var X;
3034
+ const P = (((X = s.purchaseOrder) == null ? void 0 : X.version) ?? Ee.enum[1]) === Ee.enum[2] ? o.id : o.sku._id, q = s.receivedMap[P], { isPartialReceive: V, isNoReceive: E, isOverReceive: Y, isFullReceive: x } = _r(q);
3035
+ return E ? "text-fm-color-typo-tertiary" : V ? "text-fm-color-system-warning-300" : Y ? "text-fm-color-system-error-300" : x ? "text-fm-color-system-success-300" : "";
3036
+ }
3037
+ const B = W(() => {
3038
+ var o, p, P;
3039
+ return (o = s.purchaseOrder) != null && o.itemsAtSubmission ? ((p = s.purchaseOrder) == null ? void 0 : p.version) === Ee.enum[2] ? s.purchaseOrder.items.reduce((q, V) => {
3040
+ var Y, x;
3041
+ const E = (x = (Y = s.purchaseOrder) == null ? void 0 : Y.itemsAtSubmission) == null ? void 0 : x.find(
3042
+ (X) => X.id === V.id
3043
+ );
3044
+ return E && E.quantity !== V.quantity && q.set(V.sku.code, {
3045
+ originalAmount: Number(Le.toFormatString({ value: E.quantity })),
3046
+ newAmount: Number(Le.toFormatString({ value: V.quantity }))
3047
+ }), q;
3048
+ }, /* @__PURE__ */ new Map()) : (P = s.purchaseOrder) == null ? void 0 : P.items.reduce((q, V) => {
3049
+ var X, Q;
3050
+ const E = (Q = (X = s.purchaseOrder) == null ? void 0 : X.itemsAtSubmission) == null ? void 0 : Q.find(
3051
+ (ie) => ie.sku._id === V.sku._id
3052
+ ), Y = E ? Number(Le.toFormatString({ value: E.quantity })) : 0, x = Number(Le.toFormatString({ value: V.quantity }));
3053
+ return E && Y !== x && q.set(V.sku.code, {
3054
+ originalAmount: Y,
3055
+ newAmount: x
3056
+ }), q;
3057
+ }, /* @__PURE__ */ new Map()) : /* @__PURE__ */ new Map();
3058
+ }), le = (o) => {
3059
+ var P, q;
3060
+ const p = B.value;
3061
+ return ((P = s.purchaseOrder) == null ? void 0 : P.version) === Ee.enum[2] ? p.has(o.id) : p.has((q = o.sku) == null ? void 0 : q.code);
3062
+ }, Ne = (o) => {
3063
+ var P, q;
3064
+ const p = B.value;
3065
+ return ((P = s.purchaseOrder) == null ? void 0 : P.version) === Ee.enum[2] ? p.get(o.id) : p.get((q = o.sku) == null ? void 0 : q.code);
3066
+ }, Fe = W(() => {
3067
+ const o = s.purchaseOrder;
3068
+ if (!o) return "";
3069
+ const p = o.actionChangelogs ?? [], P = p.length ? p[p.length - 1] : null;
3070
+ if (P && P.action === "rejectDraft") {
3071
+ const q = P.remarks ?? "";
3072
+ return q && q.toString().trim() !== "" ? q.toString() : "-";
3073
+ }
3074
+ return "";
3075
+ });
3076
+ return (o, p) => {
3077
+ const P = K("FmButton"), q = K("FmButtonGroup"), V = K("FmChip"), E = K("FmIcon"), Y = K("FmMenuDivider"), x = K("FmCard"), X = K("FmTooltip"), Q = K("FmSpacer"), ie = K("FmSideSheet");
3078
+ return l(), ae(ie, {
3079
+ modelValue: f(ee),
3080
+ "onUpdate:modelValue": p[8] || (p[8] = (Z) => Bt(ee) ? ee.value = Z : null),
3081
+ "dismiss-away": m.value,
3082
+ "max-width": 600,
3083
+ "close-button": !1
3084
+ }, {
3085
+ "side-sheet-header": re(() => {
3086
+ var Z, ne;
3087
+ return [
3088
+ e("div", No, [
3089
+ e("div", Fo, [
3090
+ e("div", To, y(f(c)("inventory.transfer.receiveRequest.details.title") + ((Z = o.purchaseOrder) != null && Z.seqNumber ? ` #${(ne = o.purchaseOrder) == null ? void 0 : ne.seqNumber}` : "")), 1),
3091
+ T(P, {
3092
+ class: "ml-auto -m-2",
3093
+ variant: "tertiary",
3094
+ "prepend-icon": "close",
3095
+ onClick: p[0] || (p[0] = (pe) => u("update:show", !1))
3096
+ })
3097
+ ]),
3098
+ T(q, {
3099
+ items: z.value,
3100
+ modelValue: H.value,
3101
+ "onUpdate:modelValue": p[1] || (p[1] = (pe) => H.value = pe)
3102
+ }, null, 8, ["items", "modelValue"]),
3103
+ o.purchaseOrder && H.value.value === "deliveryHistory" ? (l(), ae(fo, {
3104
+ key: 0,
3105
+ "purchase-order": o.purchaseOrder,
3106
+ "received-info-map": M.value,
3107
+ onSubmitted: p[2] || (p[2] = () => {
3108
+ u("update:show", !1), u("submitted");
3109
+ })
3110
+ }, null, 8, ["purchase-order", "received-info-map"])) : L("", !0)
3111
+ ])
3112
+ ];
3113
+ }),
3114
+ default: re(() => {
3115
+ var Z, ne, pe, ke, qe;
3116
+ return [
3117
+ e("div", Po, [
3118
+ H.value.value === "overview" ? (l(), h(ce, { key: 0 }, [
3119
+ e("div", null, [
3120
+ T(x, {
3121
+ variant: "outlined",
3122
+ class: "flex flex-col gap-8 px-12 py-16"
3123
+ }, {
3124
+ default: re(() => {
3125
+ var te, ue, ye, ge, Oe, xe, de, ve, Ve, Be;
3126
+ return [
3127
+ e("div", Io, [
3128
+ e("div", qo, y(f(c)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
3129
+ e("div", Vo, [
3130
+ T(Ue, null, {
3131
+ default: re(() => {
3132
+ var Xe;
3133
+ return [
3134
+ Ie(y((Xe = s.purchaseOrder) == null ? void 0 : Xe.status), 1)
3135
+ ];
3136
+ }),
3137
+ _: 1
3138
+ }),
3139
+ T(V, {
3140
+ label: j.value.status,
3141
+ class: Ke(j.value.statusClass),
3142
+ compact: ""
3143
+ }, null, 8, ["label", "class"]),
3144
+ $.value ? (l(), h("div", Eo, [
3145
+ T(E, {
3146
+ name: "local_shipping",
3147
+ color: "#666666"
3148
+ }),
3149
+ e("span", Lo, y($.value), 1)
3150
+ ])) : L("", !0)
3151
+ ])
3152
+ ]),
3153
+ T(Y),
3154
+ e("div", Uo, [
3155
+ e("div", Mo, [
3156
+ e("div", jo, [
3157
+ e("div", Bo, y(f(c)("inventory.transfer.receiveRequest.details.createdAt")), 1)
3158
+ ]),
3159
+ e("div", zo, y(f(Ze)(((te = o.purchaseOrder) == null ? void 0 : te._id) ?? "")), 1)
3160
+ ]),
3161
+ (ue = o.purchaseOrder) != null && ue.effectiveAt ? (l(), h("div", Ko, [
3162
+ e("div", Go, y(f(c)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
3163
+ e("div", Ho, y(f(At)(new Date((ye = o.purchaseOrder) == null ? void 0 : ye.effectiveAt))), 1)
3164
+ ])) : L("", !0),
3165
+ e("div", Wo, [
3166
+ e("div", Yo, y(f(c)("inventory.transfer.receiveRequest.details.type.title")), 1),
3167
+ e("div", Qo, y(f(c)(
3168
+ `inventory.transfer.receiveRequest.details.type.${R.value.toLocaleLowerCase("en-US")}`
3169
+ )), 1)
3170
+ ]),
3171
+ (Oe = (ge = o.purchaseOrder) == null ? void 0 : ge.supplier) != null && Oe.name ? (l(), h("div", Jo, [
3172
+ e("div", Xo, y(f(c)("inventory.transfer.receiveRequest.details.from")), 1),
3173
+ e("div", Zo, y((de = (xe = o.purchaseOrder) == null ? void 0 : xe.supplier) == null ? void 0 : de.name), 1)
3174
+ ])) : L("", !0),
3175
+ o.transferTo ? (l(), h("div", en, [
3176
+ e("div", tn, y(f(c)("inventory.transfer.receiveRequest.details.to")), 1),
3177
+ e("div", rn, y(o.transferTo), 1)
3178
+ ])) : L("", !0),
3179
+ (ve = o.purchaseOrder) != null && ve.ref ? (l(), h("div", sn, [
3180
+ e("div", on, y(f(c)("inventory.transfer.receiveRequest.details.reference")), 1),
3181
+ e("div", nn, y(o.purchaseOrder.ref), 1)
3182
+ ])) : L("", !0),
3183
+ (Ve = o.purchaseOrder) != null && Ve.remark ? (l(), h("div", an, [
3184
+ e("div", ln, y(f(c)("inventory.transfer.receiveRequest.details.remark")), 1),
3185
+ e("div", cn, y(o.purchaseOrder.remark), 1)
3186
+ ])) : L("", !0),
3187
+ ((Be = o.purchaseOrder) == null ? void 0 : Be.status) === f(se).enum.DRAFT && Fe.value ? (l(), h("div", un, [
3188
+ e("div", dn, y(f(c)("inventory.transfer.receiveRequest.details.rejectionReason")), 1),
3189
+ e("div", mn, y(Fe.value !== "" ? Fe.value : "-"), 1)
3190
+ ])) : L("", !0)
3191
+ ])
3192
+ ];
3193
+ }),
3194
+ _: 1
3195
+ })
3196
+ ]),
3197
+ T(xs, {
3198
+ "po-request": o.poRequest,
3199
+ purchaseOrder: o.purchaseOrder,
3200
+ transferType: R.value,
3201
+ transferToDbName: o.transferToDbName,
3202
+ scope: o.scope
3203
+ }, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
3204
+ e("div", pn, [
3205
+ e("div", fn, [
3206
+ e("div", yn, [
3207
+ e("span", vn, [
3208
+ Ie(y(je.value ? f(c)("inventory.transfer.receiveRequest.details.receivedItems") : f(c)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
3209
+ (ne = (Z = o.purchaseOrder) == null ? void 0 : Z.netSuite) != null && ne.missingItems && ((ke = (pe = o.purchaseOrder) == null ? void 0 : pe.netSuite) == null ? void 0 : ke.missingItems.length) > 0 ? (l(), ae(X, {
3210
+ key: 0,
3211
+ variant: "rich",
3212
+ placement: "top",
3213
+ "z-index": 51
3214
+ }, {
3215
+ content: re(() => {
3216
+ var te, ue;
3217
+ return [
3218
+ e("div", hn, [
3219
+ (l(!0), h(ce, null, we((ue = (te = o.purchaseOrder) == null ? void 0 : te.netSuite) == null ? void 0 : ue.missingItems, (ye, ge) => (l(), h("div", {
3220
+ class: "flex justify-center align-middle",
3221
+ key: ge
3222
+ }, [
3223
+ T(E, {
3224
+ name: "arrow_right",
3225
+ size: "sm"
3226
+ }),
3227
+ Ie(" " + y(`(${ye.netSuiteId}) ${ye.name}: ${ye.reason}`), 1)
3228
+ ]))), 128))
3229
+ ])
3230
+ ];
3231
+ }),
3232
+ default: re(() => [
3233
+ T(E, {
3234
+ name: "error",
3235
+ color: "#ff2c2c",
3236
+ size: "sm"
3237
+ })
3238
+ ]),
3239
+ _: 1
3240
+ })) : L("", !0)
3241
+ ])
3242
+ ]),
3243
+ T(Y),
3244
+ (l(!0), h(ce, null, we(((qe = o.purchaseOrder) == null ? void 0 : qe.items) ?? [], (te, ue) => {
3245
+ var ye, ge;
3246
+ return l(), h("div", {
3247
+ key: ue,
3248
+ class: "flex flex-col"
3249
+ }, [
3250
+ e("div", gn, [
3251
+ e("div", bn, [
3252
+ Ie(y(te.name) + " ", 1),
3253
+ le(te) ? (l(), ae(X, {
3254
+ key: 0,
3255
+ variant: "rich",
3256
+ placement: "top",
3257
+ "z-index": 51
3258
+ }, {
3259
+ content: re(() => {
3260
+ var Oe, xe;
3261
+ return [
3262
+ e("div", _n, [
3263
+ p[9] || (p[9] = e("div", { class: "font-semibold" }, "Submission changes", -1)),
3264
+ e("div", null, "Original Amount: " + y((Oe = Ne(te)) == null ? void 0 : Oe.originalAmount), 1),
3265
+ e("div", null, " New Amount: " + y((xe = Ne(te)) == null ? void 0 : xe.newAmount), 1)
3266
+ ])
3267
+ ];
3268
+ }),
3269
+ default: re(() => [
3270
+ T(E, {
3271
+ name: "error",
3272
+ color: "#ff9500",
3273
+ size: "sm"
3274
+ })
3275
+ ]),
3276
+ _: 2
3277
+ }, 1024)) : L("", !0)
3278
+ ]),
3279
+ e("div", Sn, [
3280
+ e("span", {
3281
+ innerHTML: O(te)
3282
+ }, null, 8, On)
3283
+ ])
3284
+ ]),
3285
+ e("div", xn, [
3286
+ e("div", wn, y(te.code), 1),
3287
+ f(g).enableTotalCost ? (l(), h(ce, { key: 0 }, [
3288
+ (ye = te.totalCost) != null && ye.amount ? (l(), h("span", Cn, " (" + y(f(ze)(te.totalCost)) + ") ", 1)) : (l(), h(ce, { key: 1 }, [
3289
+ ((ge = o.purchaseOrder) == null ? void 0 : ge.status) === f(se).enum.DRAFT ? (l(), h("span", Rn, y(f(c)("inventory.transfer.form.items.autoCalculated")) + ": " + y(f(ze)(
3290
+ f(_).controller.value.getItemCost(te, f(Ce)()).cost
3291
+ )), 1)) : L("", !0)
3292
+ ], 64))
3293
+ ], 64)) : L("", !0)
3294
+ ])
3295
+ ]);
3296
+ }), 128)),
3297
+ +f(_e)(A.value) ? (l(), h(ce, { key: 0 }, [
3298
+ e("div", $n, [
3299
+ T(Y)
3300
+ ]),
3301
+ e("div", Dn, [
3302
+ p[10] || (p[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
3303
+ e("div", kn, y(f(ze)(A.value)), 1)
3304
+ ])
3305
+ ], 64)) : L("", !0)
3306
+ ])
3307
+ ])
3308
+ ], 64)) : H.value.value === "deliveryHistory" ? (l(), h("div", An, [
3309
+ oe.value.length ? (l(), h("div", In, [
3310
+ (l(!0), h(ce, null, we(oe.value, (te, ue) => {
3311
+ var ye, ge, Oe, xe, de;
3312
+ return l(), h(ce, { key: ue }, [
3313
+ e("div", qn, [
3314
+ e("div", Vn, [
3315
+ e("div", En, [
3316
+ e("div", {
3317
+ class: Ke([
3318
+ {
3319
+ "bg-fm-color-primary": ue !== 0,
3320
+ "bg-white": ue === 0
3321
+ },
3322
+ "w-[2px] h-full"
3323
+ ])
3324
+ }, null, 2)
3325
+ ]),
3326
+ e("div", Ln, [
3327
+ te.header === "Received" ? (l(), ae(E, {
3328
+ key: 0,
3329
+ name: "local_shipping",
3330
+ outline: "",
3331
+ color: "#ffffff"
3332
+ })) : L("", !0)
3333
+ ]),
3334
+ e("div", Un, [
3335
+ e("div", {
3336
+ class: Ke([
3337
+ {
3338
+ "bg-fm-color-primary": ue < oe.value.length - 1,
3339
+ "bg-white": ue >= oe.value.length - 1
3340
+ },
3341
+ "w-[2px] h-full"
3342
+ ])
3343
+ }, null, 2)
3344
+ ])
3345
+ ]),
3346
+ e("div", Mn, [
3347
+ e("div", jn, [
3348
+ e("div", Bn, y(te.header), 1),
3349
+ e("div", zn, y(te.date), 1)
3350
+ ]),
3351
+ e("div", Kn, [
3352
+ te.header === "Received" && te.deliveryOrder && o.purchaseOrder ? (l(), ae(js, {
3353
+ key: 0,
3354
+ deliveryOrder: te.deliveryOrder,
3355
+ purchaseOrder: o.purchaseOrder,
3356
+ onSubmitted: p[3] || (p[3] = () => {
3357
+ u("update:show", !1), u("submitted");
3358
+ })
3359
+ }, null, 8, ["deliveryOrder", "purchaseOrder"])) : L("", !0),
3360
+ (ge = (ye = te.deliveryOrder) == null ? void 0 : ye.netSuite) != null && ge.id ? (l(), ae(Ue, { key: 1 }, {
3361
+ default: re(() => {
3362
+ var ve, Ve;
3363
+ return [
3364
+ T(Ao, {
3365
+ "netsuite-id": (Ve = (ve = te.deliveryOrder) == null ? void 0 : ve.netSuite) == null ? void 0 : Ve.id
3366
+ }, null, 8, ["netsuite-id"])
3367
+ ];
3368
+ }),
3369
+ _: 2
3370
+ }, 1024)) : L("", !0),
3371
+ o.purchaseOrder && ((Oe = te.deliveryOrder) != null && Oe.id) ? (l(), ae(ar, {
3372
+ key: 2,
3373
+ "purchase-order-id": (xe = o.purchaseOrder) == null ? void 0 : xe._id,
3374
+ "delivery-order-id": (de = te.deliveryOrder) == null ? void 0 : de.id
3375
+ }, null, 8, ["purchase-order-id", "delivery-order-id"])) : L("", !0)
3376
+ ])
3377
+ ])
3378
+ ]),
3379
+ e("div", Gn, [
3380
+ e("div", Hn, [
3381
+ e("div", Wn, [
3382
+ e("div", {
3383
+ class: Ke([
3384
+ {
3385
+ "bg-fm-color-primary": ue < oe.value.length - 1,
3386
+ "bg-white": ue >= oe.value.length - 1
3387
+ },
3388
+ "w-[2px] h-full"
3389
+ ])
3390
+ }, null, 2)
3391
+ ])
3392
+ ]),
3393
+ e("div", Yn, [
3394
+ T(x, {
3395
+ variant: "outlined",
3396
+ class: "py-12 px-16"
3397
+ }, {
3398
+ default: re(() => [
3399
+ e("div", Qn, [
3400
+ (l(!0), h(ce, null, we(te.info, (ve, Ve) => (l(), h("div", {
3401
+ key: Ve,
3402
+ class: "flex flex-col gap-4"
3403
+ }, [
3404
+ e("div", Jn, y(ve == null ? void 0 : ve.label), 1),
3405
+ e("div", Xn, [
3406
+ (l(!0), h(ce, null, we(ve == null ? void 0 : ve.values, (Be, Xe) => (l(), h("div", {
3407
+ key: Xe,
3408
+ class: "fm-typo-en-body-lg-600"
3409
+ }, [
3410
+ typeof Be == "string" ? (l(), h(ce, { key: 0 }, [
3411
+ Ie(y(Be), 1)
3412
+ ], 64)) : (l(), ae(zt(Be), { key: 1 }))
3413
+ ]))), 128))
3414
+ ])
3415
+ ]))), 128))
3416
+ ])
3417
+ ]),
3418
+ _: 2
3419
+ }, 1024)
3420
+ ])
3421
+ ])
3422
+ ], 64);
3423
+ }), 128))
3424
+ ])) : (l(), h("div", Nn, [
3425
+ T(Q),
3426
+ e("div", null, [
3427
+ e("img", {
3428
+ src: f(rr),
3429
+ alt: "List is empty"
3430
+ }, null, 8, Fn)
3431
+ ]),
3432
+ e("div", Tn, y(f(c)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
3433
+ e("div", Pn, y(f(c)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
3434
+ T(Q),
3435
+ T(Q)
3436
+ ]))
3437
+ ])) : L("", !0)
3438
+ ])
3439
+ ];
3440
+ }),
3441
+ "side-sheet-footer": re(() => [
3442
+ e("div", Zn, [
3443
+ (l(!0), h(ce, null, we(N.value, (Z) => (l(), h(ce, null, [
3444
+ f(dt)[Z].available != !1 ? (l(), ae(P, {
3445
+ key: Z,
3446
+ label: f(c)(f(dt)[Z].translationKey),
3447
+ onClick: (ne) => $e(Z),
3448
+ loading: n.value === Z,
3449
+ disabled: n.value !== Z && D.value,
3450
+ variant: f(dt)[Z].buttonVariant
3451
+ }, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : L("", !0)
3452
+ ], 64))), 256)),
3453
+ f(C).ableToMarkReceived(o.purchaseOrder) && !N.value.includes("completeReceive") ? (l(), ae(P, {
3454
+ key: 0,
3455
+ label: f(c)("inventory.transfer.receiveRequest.actions.completeReceive"),
3456
+ onClick: p[4] || (p[4] = (Z) => $e("completeReceive")),
3457
+ loading: n.value === "completeReceive",
3458
+ disabled: n.value !== "completeReceive" && D.value
3459
+ }, null, 8, ["label", "loading", "disabled"])) : L("", !0),
3460
+ f(C).ableToMarkApproved(o.purchaseOrder) && o.canApprove && !N.value.includes("approveRequest") ? (l(), ae(P, {
3461
+ key: 1,
3462
+ label: f(c)("inventory.transfer.approval.actions.approveRequest"),
3463
+ onClick: p[5] || (p[5] = (Z) => $e("approveRequest")),
3464
+ loading: n.value === "approveRequest",
3465
+ disabled: n.value !== "approveRequest" && D.value
3466
+ }, null, 8, ["label", "loading", "disabled"])) : L("", !0),
3467
+ f(C).ableToCreateFulfillment(o.purchaseOrder, o.poRequest) && s.scope === "approval" ? (l(), ae(P, {
3468
+ key: 2,
3469
+ label: f(c)("inventory.transfer.receiveRequest.actions.processRequest"),
3470
+ onClick: p[6] || (p[6] = (Z) => $e("processRequest")),
3471
+ loading: n.value === "processRequest",
3472
+ disabled: n.value !== "processRequest" && D.value
3473
+ }, null, 8, ["label", "loading", "disabled"])) : L("", !0),
3474
+ T(P, {
3475
+ label: f(c)("common.close"),
3476
+ variant: "tertiary",
3477
+ onClick: p[7] || (p[7] = (Z) => u("update:show", !1))
3478
+ }, null, 8, ["label"])
3479
+ ])
3480
+ ]),
3481
+ _: 1
3482
+ }, 8, ["modelValue", "dismiss-away"]);
3483
+ };
3484
+ }
3485
+ });
3486
+ export {
3487
+ ft as P,
3488
+ Ra as _,
3489
+ wa as a,
3490
+ Ca as b,
3491
+ Sr as g,
3492
+ xr as u
3493
+ };