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

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