@feedmepos/mf-inventory-portal 0.0.23-dev.19 → 0.0.23-dev.2

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 (95) hide show
  1. package/dist/{App-DY01VbHo.js → App-DRE3c1lJ.js} +31 -36
  2. package/dist/{ApprovalView-DtwXb5T7.js → ApprovalView-B4ZYcS3B.js} +4 -4
  3. package/dist/{BindingsDialog-ClnnwUTV.js → BindingsDialog-Df1yrWHU.js} +2 -2
  4. package/dist/{BindingsPicker-DbdkXiHx.js → BindingsPicker-BERMWh4w.js} +2 -2
  5. package/dist/{BindingsTable-Cqh3Ku0d.js → BindingsTable-DRIapOWW.js} +6 -6
  6. package/dist/{ClosingTemplateView-CVQlOya4.js → ClosingTemplateView-CbFn3Sdy.js} +31 -32
  7. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-7JYNssTm.js +267 -0
  8. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-m92y5x0G.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-KbYSywk2.js} +2 -2
  9. package/dist/{FmMultiselectDialog-Jr9uL_z_.js → FmMultiselectDialog-Da9JMCYa.js} +15 -15
  10. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-BHSGZyJL.js +326 -0
  11. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-D7uvrzFU.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DH5IQchQ.js} +1 -1
  12. package/dist/{IngredientGroupView-DgDZnggI.js → IngredientGroupView-DoETcEvV.js} +11 -12
  13. package/dist/IngredientsView-DHAhj9pV.js +1613 -0
  14. package/dist/{IntegrationView-CZQoHCkX.js → IntegrationView-D1HeBiGF.js} +50 -50
  15. package/dist/{InventoryBindingForm-C-E3EINv.js → InventoryBindingForm-Dmz9BQ37.js} +1 -1
  16. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B3nsmCuj.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DoyqVBOd.js} +13 -13
  17. package/dist/{InventoryBindingSummary-DNiOKfO8.js → InventoryBindingSummary-DrpwiRGZ.js} +1 -1
  18. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdYa8Pv2.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-yNEswIEI.js} +1 -1
  19. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BwxgZ-vM.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Br4_VUza.js} +2 -2
  20. package/dist/{PurchaseOrderPrintPreview-C6i2S9L-.js → PurchaseOrderPrintPreview-cp671yWE.js} +1 -1
  21. package/dist/ReceiveRequestView-C1WBlpho.js +4082 -0
  22. package/dist/{RecipeView-CoMcIuHu.js → RecipeView-CD_dAWLo.js} +10 -11
  23. package/dist/{StockView-DhJshtaj.js → StockView-DfUzFC1b.js} +1457 -1356
  24. package/dist/{SupplierView-hQtDIQzE.js → SupplierView-DB-zrNxh.js} +783 -2352
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-2mzqFGCz.js +1144 -0
  26. package/dist/TransferTemplateView-CaAJrqU6.js +1262 -0
  27. package/dist/{UnitView-CRMF6RWu.js → UnitView-BlC9-WOA.js} +80 -81
  28. package/dist/{WarehouseView-AVEDff0v.js → WarehouseView-CgEY87Lo.js} +24 -25
  29. package/dist/api/bill.d.ts +2 -2
  30. package/dist/api/closing.d.ts +0 -1
  31. package/dist/api/netsuite.d.ts +0 -69
  32. package/dist/{app-ww5ibHkL.js → app-CAyFhmAz.js} +3343 -3426
  33. package/dist/app.d.ts +0 -5
  34. package/dist/app.js +1 -1
  35. package/dist/components/FmMinMaxInputRules.d.ts +1 -4
  36. package/dist/components/row-action.enum.d.ts +0 -1
  37. package/dist/{date2-D5MTVjlP.js → date2-D9i5izMt.js} +1 -1
  38. package/dist/{dayjs.min-7pwGJ2aW.js → dayjs.min-SJKP9zBL.js} +17 -17
  39. package/dist/{decimal-N5ymnwhP.js → decimal-D7BCubZO.js} +1 -1
  40. package/dist/{defineDeepModel-DJODEpcR.js → defineDeepModel-DS4Shctf.js} +1 -1
  41. package/dist/{feature-Bfq8yWgS.js → feature-BR-MsGYt.js} +9 -23
  42. package/dist/{format-time-from-id-0UkRUr39.js → format-time-from-id-CUby60uW.js} +1 -1
  43. package/dist/format-unit-display-D25Al2JZ.js +1198 -0
  44. package/dist/{fuzzy-DdOiOd-q.js → fuzzy-BryBtMz_.js} +1 -1
  45. package/dist/{index-Cin_fxtb.js → index-ByJbUSIQ.js} +1 -1
  46. package/dist/index-CFA_VFyX.js +10545 -0
  47. package/dist/{index-gvJJ-xRY.js → index-CTvgBOum.js} +25 -28
  48. package/dist/netsuite-D0G4B60k.js +146 -0
  49. package/dist/normalizeArguments-DP7Hrren.js +1552 -0
  50. package/dist/router/name.d.ts +0 -1
  51. package/dist/{row-action.enum-7rGLGZ5v.js → row-action.enum-PMKMRrZR.js} +5 -10
  52. package/dist/{rules-C83wiSGb.js → rules-DxVY0b7F.js} +35 -40
  53. package/dist/stores/feature.d.ts +0 -2
  54. package/dist/stores/integration/netsuite.d.ts +0 -81
  55. package/dist/stores/inventory.d.ts +4 -1
  56. package/dist/style.css +1 -1
  57. package/dist/{supplier-CSzla-9I.js → supplier-aBuwVukl.js} +22 -22
  58. package/dist/tsconfig.app.tsbuildinfo +1 -1
  59. package/dist/{use-inventory-binding-dialog-BFqxWNzX.js → use-inventory-binding-dialog-CLQ0LUmW.js} +2 -2
  60. package/dist/{use-template-enabled-locations-2-CUkqC-cd.js → use-template-enabled-locations-2-BgTiwy_3.js} +2 -2
  61. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +192 -24
  62. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +192 -24
  63. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +34 -34
  64. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +0 -1
  65. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +54 -54
  66. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +54 -54
  67. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  68. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +8 -8
  69. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +96 -96
  70. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +96 -96
  71. package/dist/{xlsx-C3L2eW52.js → xlsx-BbtURTDy.js} +1 -1
  72. package/dist/{xlsx.util-CJKLCuWK.js → xlsx.util-zYS4OJFi.js} +1 -1
  73. package/package.json +3 -3
  74. package/dist/ClosingDraftView-CzuMTeC1.js +0 -1122
  75. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BO1wCa9i.js +0 -283
  76. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-sgvBxxkn.js +0 -329
  77. package/dist/IngredientsView-SuCckJrj.js +0 -1666
  78. package/dist/ReceiveRequestView-BABjGvIn.js +0 -4195
  79. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DsJUSZsm.js +0 -1235
  80. package/dist/TransferTemplateView-GzwT4hp-.js +0 -1275
  81. package/dist/api/closing-draft.d.ts +0 -6
  82. package/dist/form-mode.enum-BKiNVH6A.js +0 -4
  83. package/dist/format-unit-display-CXawcmvj.js +0 -1217
  84. package/dist/index-CcCqc9jx.js +0 -12087
  85. package/dist/netsuite-DX6L1oLu.js +0 -251
  86. package/dist/stock-Btlxmf8R.js +0 -111
  87. package/dist/views/closing-draft/ClosingDraftView.vue.d.ts +0 -2
  88. package/dist/views/closing-draft/components/closing-draft-action/ClosingDraftAction.vue.d.ts +0 -22
  89. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +0 -451
  90. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +0 -25
  91. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +0 -2601
  92. package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +0 -1
  93. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +0 -19
  94. package/dist/views/closing-draft/helpers/get-calculated-total.helper.d.ts +0 -4
  95. package/dist/views/receive-request/helper/check-netsuite-subsidiary.helper.d.ts +0 -1
@@ -1,1235 +0,0 @@
1
- import { ref as B, computed as V, h as ee, defineComponent as We, resolveComponent as te, openBlock as y, createBlock as J, unref as n, isRef as Je, withCtx as pe, createElementVNode as r, createElementBlock as D, createVNode as Q, createCommentVNode as q, Fragment as re, toDisplayString as v, normalizeClass as ve, renderList as ye } from "vue";
2
- import { i as Ze } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-m92y5x0G.js";
3
- import { k as Xe, u as be, G as R, q as et, c as Le, y as F, s as je, w as $e } from "./app-ww5ibHkL.js";
4
- import { t as tt, b as rt, h as Be, d as Ie } from "./date2-D5MTVjlP.js";
5
- import { F as Fe } from "./form-mode.enum-BKiNVH6A.js";
6
- import { useDialog as Ke, useSnackbar as Ve, useProxiedModel as st } from "@feedmepos/ui-library";
7
- import { p as at, f as ge } from "./format-time-from-id-0UkRUr39.js";
8
- import { u as Ge } from "./feature-Bfq8yWgS.js";
9
- import { b as nt, u as ot, f as He, P as se } from "./format-unit-display-CXawcmvj.js";
10
- import { c as Me } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
11
- import { D as j, R as I } from "./row-action.enum-7rGLGZ5v.js";
12
- import { i as Oe, c as he, a as le, k as lt, j as Ue } from "./rules-C83wiSGb.js";
13
- import { F as it } from "./decimal-N5ymnwhP.js";
14
- import { useI18n as ze } from "@feedmepos/mf-common";
15
- import { E as ct } from "./empty-placeholder-wf6-BWE8.js";
16
- import { u as ut } from "./netsuite-DX6L1oLu.js";
17
- const Ye = Xe((m, _) => {
18
- const u = be();
19
- return {
20
- async readRequests(s) {
21
- const w = s ?? u.currentLocationDBName, S = `${m.inventoryBackendUrl}/${w}/purchase-request`;
22
- return await _.get(S);
23
- },
24
- async getPurchaseOrders({
25
- start: s,
26
- end: w
27
- }) {
28
- const S = u.currentLocationDBName, N = `${m.inventoryBackendUrl}/${S}/purchase-order`;
29
- return await _.get(`${N}?start=${s}&end=${w}`);
30
- },
31
- async getPurchaseOrderById(s) {
32
- const w = u.currentLocationDBName, S = `${m.inventoryBackendUrl}/${w}/purchase-order`;
33
- return await _.get(`${S}/${s}`);
34
- },
35
- async processPurchaseOrder(s, w) {
36
- const S = u.currentLocationDBName, N = w || S, $ = `${m.inventoryBackendUrl}/${N}/purchase-order/run-operation`;
37
- return await _.put($, s);
38
- },
39
- async createPurchaseOrder(s) {
40
- const w = u.currentLocationDBName, S = `${m.inventoryBackendUrl}/${w}/purchase-order`;
41
- return await _.post(S, s);
42
- },
43
- async updatePurchaseOrder(s) {
44
- const w = u.currentLocationDBName, S = `${m.inventoryBackendUrl}/${w}/purchase-order`;
45
- return await _.put(S, s);
46
- }
47
- };
48
- }), Qe = {
49
- [R.enum.confirmDraft]: {
50
- primaryActions: {
51
- text: "Confirm draft",
52
- close: !0
53
- },
54
- title: "Confirm draft?",
55
- message: "Purchase order cannot be changed after confirm draft.",
56
- successMessage: "Purchase order draft has been confirmed"
57
- },
58
- [R.enum.cancelDraft]: {
59
- primaryActions: {
60
- text: "Cancel draft",
61
- close: !0,
62
- variant: "destructive"
63
- },
64
- title: "Cancel draft?",
65
- message: "Purchase order cannot be changed after cancelled draft.",
66
- successMessage: "Purchase order draft has been cancelled"
67
- },
68
- [R.enum.submitRequest]: {
69
- primaryActions: {
70
- text: "Submit request",
71
- close: !0
72
- },
73
- title: "Confirm draft?",
74
- message: "Purchase order cannot be changed after confirm draft.",
75
- successMessage: "Purchase order draft has been submitted"
76
- },
77
- [R.enum.completeReceive]: {
78
- primaryActions: {
79
- text: "Mark received",
80
- close: !0
81
- },
82
- title: "Mark as received",
83
- message: "Purchase order cannot be changed after it has complete receiving.",
84
- successMessage: "Purchase order has been marked as received"
85
- },
86
- [R.enum.approveRequest]: {
87
- primaryActions: {
88
- text: "Approve request",
89
- close: !0
90
- },
91
- title: "Approve request?",
92
- message: "Purchase order will be approved.",
93
- successMessage: "Purchase order has been approved"
94
- },
95
- [R.enum.rejectRequest]: {
96
- primaryActions: {
97
- text: "Reject request",
98
- close: !0,
99
- variant: "destructive"
100
- },
101
- title: "Reject request?",
102
- message: "Purchase order will be rejected.",
103
- successMessage: "Purchase order has been rejected"
104
- }
105
- }, me = B();
106
- function Br(m, _) {
107
- const u = Ke(), s = be(), w = Ge(), S = nt(), N = ot(), $ = B(!1), d = Ve(), M = Ye(), i = B(new Array()), p = B(
108
- _ != null && _.startDate && (_ != null && _.endDate) ? _ : Ze()
109
- ), h = V(() => {
110
- const f = new Date(p.value.startDate), c = new Date(p.value.endDate);
111
- return {
112
- start: tt(f).toISOString(),
113
- end: rt(c).toISOString()
114
- };
115
- }), g = B(new Array()), O = et(), G = B(null);
116
- async function Se(f) {
117
- let c;
118
- if (w.mustUsePoTemplate && !(f != null && f.template) && (c = await S.getTemplateId(), !c))
119
- return;
120
- const t = {
121
- mode: Fe.CREATE,
122
- modelValue: f || void 0,
123
- show: !0,
124
- "onUpdate:show"(e) {
125
- me.value.show = e;
126
- },
127
- templateId: c,
128
- lastClosingDate: G.value
129
- };
130
- me.value = t;
131
- }
132
- function ie(f) {
133
- const c = {
134
- mode: Fe.UPDATE,
135
- modelValue: Le(f),
136
- show: !0,
137
- "onUpdate:show"(t) {
138
- me.value.show = t;
139
- },
140
- lastClosingDate: G.value
141
- };
142
- me.value = c;
143
- }
144
- async function _e() {
145
- i.value = [], $.value = !0;
146
- try {
147
- i.value = await M.getPurchaseOrders(h.value).then((t) => t.sort((e, a) => a._id.localeCompare(e._id)));
148
- const f = await O.readLastClosing(!0), c = f == null ? void 0 : f._id;
149
- c && (G.value = at(c)), w.mustUsePoTemplate && await N.fetchTemplates();
150
- } catch {
151
- d.open({
152
- title: "Something went wrong",
153
- message: "Error at fetching purchase orders",
154
- type: "error"
155
- });
156
- } finally {
157
- $.value = !1;
158
- }
159
- }
160
- async function W() {
161
- g.value = [], $.value = !0;
162
- try {
163
- g.value = await M.readRequests().then((f) => f.reverse());
164
- } catch {
165
- d.open({
166
- title: "Something went wrong",
167
- message: "Error at fetching purchase requests",
168
- type: "error"
169
- });
170
- } finally {
171
- $.value = !1;
172
- }
173
- }
174
- function ae() {
175
- switch (m) {
176
- case "receive/request":
177
- return _e();
178
- case "approval":
179
- return W();
180
- }
181
- }
182
- function Re(f, c) {
183
- p.value = {
184
- startDate: f,
185
- endDate: c
186
- }, ae();
187
- }
188
- s.watchLocation(async (f) => {
189
- if (!f) {
190
- i.value = [];
191
- return;
192
- }
193
- await ae();
194
- });
195
- const Z = B(), fe = B(Math.random().toString());
196
- async function X(f, c) {
197
- var o, P;
198
- const t = Math.random().toString();
199
- fe.value = t;
200
- const e = m === "receive/request" ? s.currentLocation : c == null ? void 0 : c.to, a = {
201
- poRequest: c,
202
- purchaseOrder: f,
203
- transferTo: e == null ? void 0 : e.name,
204
- transferToDbName: e == null ? void 0 : e.dbName,
205
- show: !0,
206
- canResubmit: !1,
207
- canApprove: m === "approval",
208
- "onUpdate:show"(A) {
209
- Z.value.show = A;
210
- }
211
- };
212
- if (Z.value = a, !(c || f.status !== F.enum.REQUESTING)) {
213
- try {
214
- c = (await M.readRequests(
215
- `${f.supplier.internal}_${f.supplier._id}`
216
- )).find((U) => U.purchaseOrderId === f._id);
217
- } catch {
218
- console.error("Error at fetching po request to check");
219
- }
220
- t === fe.value && (Z.value.canResubmit = !c, Z.value.transferTo = (o = c == null ? void 0 : c.to) == null ? void 0 : o.name, Z.value.transferToDbName = (P = c == null ? void 0 : c.to) == null ? void 0 : P.dbName);
221
- }
222
- }
223
- async function ne(f, c, t, e) {
224
- $.value = !0;
225
- try {
226
- await M.processPurchaseOrder(
227
- {
228
- operation: c,
229
- doc: f,
230
- options: (
231
- // auto receive for supplier to warehouse
232
- (c === R.enum.confirmDraft || // auto receive for warehouse to warehouse
233
- c === R.enum.completeReceive) && w.autoReceiveWarehouse ? {
234
- autoReceive: !0
235
- } : void 0
236
- )
237
- },
238
- e
239
- ), await new Promise((P) => setTimeout(P, 1e3));
240
- const o = be().currentLocationDBName.startsWith("restaurant_");
241
- c === R.enum.confirmDraft && f.effectiveAt && o ? d.open({
242
- title: "Success",
243
- message: `${t}. The backdate will be reflected once your POS has received this change.`,
244
- type: "success"
245
- }) : d.open({
246
- title: "Success",
247
- message: t,
248
- type: "success"
249
- });
250
- } catch (a) {
251
- d.open({
252
- title: "Something went wrong",
253
- message: "Please try again.",
254
- type: "error"
255
- }), console.error("Error when submitting PO operation", c, f, a);
256
- } finally {
257
- $.value = !1, ae();
258
- }
259
- }
260
- async function we(f, c, t) {
261
- const e = Qe[c];
262
- if (!e) {
263
- d.open({
264
- title: "Something went wrong",
265
- message: `Cannot process order: ${je(c)}`,
266
- type: "error"
267
- });
268
- return;
269
- }
270
- const { successMessage: a, ...o } = e;
271
- u.open({
272
- title: o.title,
273
- message: o.message,
274
- primaryActions: o.primaryActions
275
- }).onPrimary(() => {
276
- ne(f, c, a, t);
277
- });
278
- }
279
- return {
280
- purchaseOrders: i,
281
- purchaseRequests: g,
282
- updateDateRange: Re,
283
- fetchData: ae,
284
- loading: $,
285
- transferDialogProps: me,
286
- promptCreateTransferDialog: Se,
287
- promptUpdateTransferDialog: ie,
288
- transferDetailsProps: Z,
289
- promptShowTransferDetails: X,
290
- submitAction: we
291
- };
292
- }
293
- function dt(m, _) {
294
- return _.reduce(
295
- (s, w) => {
296
- const S = w.received.find((N) => N.sku._id === m._id);
297
- return S && (s = Oe(s, S.amount)), s;
298
- },
299
- it.toPrecision(he(0), m.unit.precision)
300
- );
301
- }
302
- function mt(m, _) {
303
- const { name: u, address: s, regNo: w } = _.doc.profile, S = {
304
- name: u,
305
- registrationNumber: w,
306
- line1: s == null ? void 0 : s.line1,
307
- line2: s == null ? void 0 : s.line2,
308
- postcode: s == null ? void 0 : s.postcode,
309
- city: s == null ? void 0 : s.city,
310
- state: s == null ? void 0 : s.state,
311
- country: s == null ? void 0 : s.country
312
- }, N = {
313
- name: m.supplier.name,
314
- registrationNumber: m.supplier.registrationNumber,
315
- line1: m.supplier.address.line1,
316
- line2: m.supplier.address.line2,
317
- postcode: m.supplier.address.postcode,
318
- city: m.supplier.address.city,
319
- state: m.supplier.address.state,
320
- country: m.supplier.address.country
321
- }, $ = m.items.map((p) => {
322
- const { sku: h, measurement: g } = p, O = le(
323
- dt(p.sku, m.deliveryOrder || []),
324
- !1
325
- );
326
- return {
327
- code: h.code,
328
- description: h.name,
329
- quantity: He(p.quantity, h.unit, p.measurement),
330
- unit: (g == null ? void 0 : g.abbrev) || h.unit.abbrev,
331
- received: O
332
- };
333
- }), d = m.deliveryOrder.map((p) => ({
334
- createdAt: Be(new Date(p.createdAt)),
335
- ref: p.deliveryOrderNumber,
336
- remark: p.remark || "",
337
- items: p.received.map((h) => {
338
- var g;
339
- return {
340
- code: h.sku.code,
341
- description: h.sku.name,
342
- quantity: le(h.amount),
343
- unit: ((g = h.measurement) == null ? void 0 : g.abbrev) || h.sku.unit.abbrev
344
- };
345
- })
346
- })), M = {
347
- orderNumber: m.seqNumber.toString(),
348
- createdAt: ge(m._id),
349
- ref: m.ref || "",
350
- remark: m.remark || "",
351
- buyer: S,
352
- supplier: N,
353
- items: $,
354
- status: m.status,
355
- deliveryOrders: d
356
- }, i = new URL(window.location.href);
357
- i.pathname = i.hostname.includes("inventory.feedme") ? "/receive-request/print-preview" : "/inventory/receive-request/print-preview", i.searchParams.append("data", JSON.stringify(M)), window.open(i.href, "_blank", "noreferrer");
358
- }
359
- const oe = {
360
- submitRequest: {
361
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
362
- color: "text-fm-color-typo-primary",
363
- value: R.enum.submitRequest
364
- },
365
- confirmDraft: {
366
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
367
- color: "text-fm-color-typo-primary",
368
- value: R.enum.confirmDraft
369
- },
370
- cancelDraft: {
371
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
372
- color: "text-fm-color-typo-error",
373
- value: R.enum.cancelDraft
374
- },
375
- approveRequest: {
376
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
377
- color: "text-fm-color-typo-primary",
378
- value: R.enum.approveRequest
379
- },
380
- rejectRequest: {
381
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
382
- color: "text-fm-color-typo-error",
383
- value: R.enum.rejectRequest
384
- },
385
- processRequest: {
386
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
387
- color: "text-fm-color-typo-primary",
388
- value: R.enum.processRequest
389
- },
390
- receiveStock: {
391
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
392
- color: "text-fm-color-typo-primary",
393
- value: R.enum.receiveStock
394
- },
395
- completeReceive: {
396
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
397
- color: "text-fm-color-typo-primary",
398
- value: R.enum.completeReceive
399
- }
400
- };
401
- function Kr(m, _) {
402
- const u = be(), { t: s } = ze();
403
- function w(i) {
404
- switch (i.status) {
405
- case "DRAFT":
406
- return [
407
- j[I.Update],
408
- j[I.Details],
409
- i.supplier.internal === "restaurant" || i.supplier.internal === "warehouse" ? oe[R.enum.submitRequest] : oe[R.enum.confirmDraft],
410
- oe[R.enum.cancelDraft],
411
- j[I.Print]
412
- ];
413
- case "RECEIVING":
414
- return [
415
- oe[R.enum.completeReceive],
416
- j[I.Details],
417
- j[I.Print]
418
- ];
419
- case "REQUESTING":
420
- return m === "receive/request" ? [j[I.Details], j[I.Print]] : [
421
- oe[R.enum.approveRequest],
422
- oe[R.enum.rejectRequest],
423
- j[I.Details],
424
- j[I.Print]
425
- ];
426
- case "PROCESSING":
427
- return [j[I.Details], j[I.Print]];
428
- case "COMPLETE":
429
- case "CANCEL":
430
- default:
431
- return [j[I.Details], j[I.Print]];
432
- }
433
- }
434
- function S(i) {
435
- return Object.values(R.enum).includes(i);
436
- }
437
- async function N(i, p, h) {
438
- var O, G;
439
- const g = Le(p);
440
- if (i === I.Print) {
441
- mt(g, u.currentLocation);
442
- return;
443
- }
444
- if (i === I.Details) {
445
- _.promptShowTransferDetails(g, h);
446
- return;
447
- }
448
- if (i === I.Update) {
449
- (O = _.promptUpdateTransferDialog) == null || O.call(_, g);
450
- return;
451
- }
452
- if (S(i)) {
453
- _.submitAction(p, i, (G = h == null ? void 0 : h.to) == null ? void 0 : G.dbName);
454
- return;
455
- }
456
- }
457
- function $() {
458
- return [
459
- {
460
- accessorKey: "seqNumber",
461
- header: () => s("inventory.transfer.table.seqNo"),
462
- enableSorting: !0,
463
- size: 80,
464
- sortUndefined: "last"
465
- },
466
- {
467
- accessorKey: "_id",
468
- header: () => s("inventory.transfer.table.createdAt"),
469
- cell(i) {
470
- return ge(`${i.getValue()}`);
471
- },
472
- enableSorting: !0
473
- },
474
- {
475
- accessorKey: "supplier.name",
476
- header: () => s("inventory.transfer.table.transferFrom"),
477
- enableSorting: !0,
478
- size: 200
479
- },
480
- {
481
- accessorKey: "items.length",
482
- header: () => s("inventory.transfer.table.noOfItems"),
483
- enableSorting: !1,
484
- meta: {
485
- width: "10rem"
486
- }
487
- },
488
- {
489
- accessorKey: "ref",
490
- header: () => s("inventory.transfer.table.reference"),
491
- enableSorting: !1,
492
- size: "auto"
493
- },
494
- {
495
- accessorKey: "status",
496
- header: () => s("inventory.transfer.table.status"),
497
- cell(i) {
498
- const p = s(`inventory.transfer.status.${i.getValue() ?? ""}`), h = `${i.getValue() ?? ""}`.toLocaleLowerCase("en-us");
499
- return ee(
500
- "div",
501
- {
502
- class: "flex"
503
- },
504
- ee(
505
- "div",
506
- {
507
- class: `fm-status-badge fm-status-badge-${h}`
508
- },
509
- p
510
- )
511
- );
512
- },
513
- enableSorting: !0,
514
- size: 200
515
- },
516
- {
517
- id: "action",
518
- cell(i) {
519
- const p = i.row.original, h = w(p);
520
- return Me(h, (g) => N(g, p));
521
- },
522
- enableSorting: !1,
523
- size: 40,
524
- meta: {
525
- cellClass: "",
526
- headerClass: ""
527
- }
528
- }
529
- ];
530
- }
531
- function d() {
532
- return [
533
- {
534
- accessorKey: "purchaseOrder.seqNumber",
535
- header: () => s("inventory.transfer.table.seqNo"),
536
- enableSorting: !0,
537
- size: 80,
538
- sortUndefined: "last"
539
- },
540
- {
541
- accessorKey: "purchaseOrder._id",
542
- header: () => s("inventory.transfer.table.createdAt"),
543
- cell(i) {
544
- return ge(`${i.getValue()}`);
545
- },
546
- enableSorting: !0
547
- },
548
- {
549
- accessorKey: "to.name",
550
- header: () => s("inventory.transfer.table.transferTo"),
551
- enableSorting: !1,
552
- size: 200
553
- },
554
- {
555
- accessorKey: "purchaseOrder.items.length",
556
- header: () => s("inventory.transfer.table.noOfItems"),
557
- enableSorting: !1
558
- },
559
- {
560
- accessorKey: "purchaseOrder.ref",
561
- header: () => s("inventory.transfer.table.reference"),
562
- enableSorting: !1,
563
- size: "auto"
564
- },
565
- {
566
- accessorKey: "purchaseOrder.status",
567
- header: () => s("inventory.transfer.table.status"),
568
- cell(i) {
569
- const p = s(`inventory.transfer.status.${i.getValue() ?? ""}`), h = `${i.getValue() ?? ""}`.toLocaleLowerCase("en-us");
570
- return ee(
571
- "div",
572
- {
573
- class: "flex"
574
- },
575
- ee(
576
- "div",
577
- {
578
- class: `fm-status-badge fm-status-badge-${h}`
579
- },
580
- p
581
- )
582
- );
583
- },
584
- enableSorting: !0
585
- },
586
- {
587
- id: "action",
588
- cell(i) {
589
- const p = i.row.original, h = p.purchaseOrder ? w(p.purchaseOrder) : [];
590
- return Me(
591
- h,
592
- (g) => p.purchaseOrder ? N(g, p.purchaseOrder, p) : void 0
593
- );
594
- },
595
- enableSorting: !1,
596
- size: 40,
597
- meta: {
598
- cellClass: "",
599
- headerClass: ""
600
- }
601
- }
602
- ];
603
- }
604
- const M = V(() => m === "receive/request" ? $() : d());
605
- return {
606
- get columnDefs() {
607
- return M.value;
608
- }
609
- };
610
- }
611
- const ft = { class: "flex flex-col gap-16 w-full h-full" }, pt = {
612
- key: 0,
613
- class: "flex flex-row-reverse"
614
- }, vt = { class: "flex justify-between" }, yt = { class: "fm-typo-en-body-lg-600" }, ht = { class: "flex flex-col gap-8" }, bt = { class: "flex flex-col gap-4" }, gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, St = { class: "flex gap-1" }, _t = { class: "fm-typo-en-body-lg-600" }, Rt = {
615
- key: 0,
616
- class: "flex flex-col gap-4"
617
- }, wt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ot = { class: "fm-typo-en-body-lg-600" }, Dt = { class: "flex flex-col gap-4" }, kt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, At = { class: "fm-typo-en-body-lg-600" }, xt = {
618
- key: 1,
619
- class: "flex flex-col gap-4"
620
- }, qt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Nt = { class: "fm-typo-en-body-lg-600" }, Pt = {
621
- key: 2,
622
- class: "flex flex-col gap-4"
623
- }, Tt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ct = { class: "fm-typo-en-body-lg-600" }, Et = {
624
- key: 3,
625
- class: "flex flex-col gap-4"
626
- }, $t = { class: "fm-typo-en-body-lg-600" }, It = {
627
- key: 4,
628
- class: "flex flex-col gap-4"
629
- }, Ft = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Mt = { class: "fm-typo-en-body-lg-600" }, Ut = {
630
- key: 5,
631
- class: "flex flex-col gap-4"
632
- }, Lt = { class: "fm-typo-en-body-lg-600" }, jt = {
633
- key: 6,
634
- class: "flex flex-col gap-4"
635
- }, Bt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Kt = { class: "fm-typo-en-body-lg-600" }, Vt = {
636
- key: 7,
637
- class: "flex flex-col gap-4"
638
- }, Gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ht = { class: "fm-typo-en-body-lg-600" }, zt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Yt = { class: "flex flex-col gap-8" }, Qt = { class: "fm-typo-en-body-lg-600" }, Wt = { class: "flex w-full gap-4" }, Jt = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Zt = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, Xt = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, er = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, tr = {
639
- key: 0,
640
- class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
641
- }, rr = { class: "py-8" }, sr = { class: "flex justify-end gap-4 items-center" }, ar = { class: "fm-typo-en-body-lg-600" }, nr = {
642
- key: 2,
643
- class: "flex-1 xs:w-screen xs:max-w-full"
644
- }, or = {
645
- key: 0,
646
- class: "flex flex-col items-center gap-8 h-full"
647
- }, lr = ["src"], ir = { class: "fm-typo-en-body-lg-600" }, cr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, ur = {
648
- key: 1,
649
- class: "px-4 flex flex-col"
650
- }, dr = { class: "flex gap-12 content-stretch" }, mr = {
651
- class: "flex flex-col w-24",
652
- name: "circles"
653
- }, fr = { class: "flex-1 flex flex-col items-center" }, pr = { class: "flex-1 flex flex-col items-center" }, vr = {
654
- class: "py-12 flex flex-col gap-4",
655
- name: "received-at header"
656
- }, yr = { class: "fm-typo-en-body-lg-400" }, hr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, br = { class: "flex gap-12 content-stretch" }, gr = {
657
- class: "flex flex-col w-24",
658
- name: "circles"
659
- }, Sr = { class: "flex-1 flex flex-col items-center" }, _r = {
660
- class: "py-12 flex flex-col gap-4 flex-1",
661
- name: "delivery details"
662
- }, Rr = { class: "flex flex-col gap-8" }, wr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Or = { class: "flex flex-col gap-4" }, Dr = { class: "flex gap-8 xs:flex-col" }, Vr = /* @__PURE__ */ We({
663
- __name: "TransferDetails",
664
- props: {
665
- poRequest: {},
666
- purchaseOrder: {},
667
- transferTo: {},
668
- transferToDbName: {},
669
- show: { type: Boolean },
670
- canResubmit: { type: Boolean },
671
- canApprove: { type: Boolean }
672
- },
673
- emits: ["update:show", "submitted"],
674
- setup(m, { emit: _ }) {
675
- const u = m, s = _, w = Ke(), S = Ve(), N = ut(), $ = Ge(), { t: d } = ze(), M = V(
676
- () => {
677
- var t, e, a, o;
678
- return ((e = (t = u.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : e.internal) === "restaurant" || ((o = (a = u.purchaseOrder) == null ? void 0 : a.supplier) == null ? void 0 : o.internal) === "warehouse" ? se.TRANSFER : se.PURCHASE;
679
- }
680
- ), i = V(() => {
681
- var t, e, a;
682
- return M.value === se.TRANSFER && ((t = u.transferToDbName) == null ? void 0 : t.startsWith("restaurant")) && ((a = (e = u.purchaseOrder) == null ? void 0 : e.supplier) == null ? void 0 : a.internal) === "restaurant";
683
- }), p = [
684
- {
685
- label: d("inventory.transfer.receiveRequest.details.overview"),
686
- value: "overview"
687
- },
688
- {
689
- label: d("inventory.transfer.receiveRequest.details.deliveryHistory"),
690
- value: "deliveryHistory"
691
- }
692
- ], h = B(p[0]), g = B(!1), O = B(""), G = B(!0), Se = Ye(), ie = st(u, "show");
693
- async function _e(t, e, a) {
694
- O.value = e, g.value = !0, G.value = !1;
695
- try {
696
- await Se.processPurchaseOrder(
697
- {
698
- operation: e,
699
- doc: t,
700
- options: (
701
- // auto receive for supplier to warehouse
702
- (e === R.enum.confirmDraft || // auto receive for warehouse to warehouse
703
- e === R.enum.completeReceive) && $.autoReceiveWarehouse ? {
704
- autoReceive: !0
705
- } : void 0
706
- )
707
- },
708
- u.transferToDbName
709
- ), await new Promise((o) => setTimeout(o, 1e3)), S.open({
710
- title: "Success",
711
- message: a,
712
- type: "success"
713
- }), s("update:show", !1), s("submitted");
714
- } catch (o) {
715
- S.open({
716
- title: "Something went wrong",
717
- message: "Please try again.",
718
- type: "error"
719
- }), console.error("Error when submitting PO operation", e, t, o);
720
- } finally {
721
- O.value = "", g.value = !1, G.value = !0;
722
- }
723
- }
724
- async function W(t) {
725
- const e = Qe[t];
726
- if (!e) {
727
- S.open({
728
- title: "Something went wrong",
729
- message: `Cannot process order: ${je(t)}`,
730
- type: "error"
731
- });
732
- return;
733
- }
734
- const { successMessage: a, ...o } = e;
735
- w.open({
736
- title: o.title,
737
- message: o.message,
738
- primaryActions: o.primaryActions
739
- }).onPrimary(() => {
740
- u.purchaseOrder && _e(u.purchaseOrder, t, a);
741
- });
742
- }
743
- const ae = V(() => {
744
- var t, e;
745
- return ((t = u.purchaseOrder) == null ? void 0 : t.status) === F.enum.RECEIVING || ((e = u.purchaseOrder) == null ? void 0 : e.status) === F.enum.COMPLETE;
746
- }), Re = V(
747
- () => {
748
- var t, e, a, o, P, A;
749
- return N.getLocationSubsidiary(
750
- ((a = (e = (t = u.purchaseOrder) == null ? void 0 : t.netSuite) == null ? void 0 : e.subsidiary) == null ? void 0 : a.id) || ((A = (P = (o = u.poRequest) == null ? void 0 : o.netSuite) == null ? void 0 : P.subsidiary) == null ? void 0 : A.id)
751
- ).fullName;
752
- }
753
- ), Z = V(() => {
754
- var t, e, a, o, P, A;
755
- return (e = (t = u.purchaseOrder) == null ? void 0 : t.deliveryFullfillment) != null && e.length && ((o = (a = u.purchaseOrder) == null ? void 0 : a.deliveryFullfillment) == null ? void 0 : o.length) > 0 ? (A = (P = u.purchaseOrder) == null ? void 0 : P.deliveryFullfillment) == null ? void 0 : A.map((U) => {
756
- var l;
757
- return (l = U.netSuite) == null ? void 0 : l.refNo;
758
- }).join(", ") : "-";
759
- }), fe = V(() => {
760
- var A, U, l;
761
- const a = (((A = u.purchaseOrder) == null ? void 0 : A.deliveryOrder) ?? []).flatMap((x) => x.received ?? []).reduce(
762
- (x, L) => {
763
- const K = x[L.sku._id] ?? [];
764
- return x[L.sku._id] = [...K, L], x;
765
- },
766
- {}
767
- ), o = Object.entries(a).reduce(
768
- (x, [L, K]) => {
769
- const k = K.reduce((b, T) => {
770
- const C = lt(
771
- b,
772
- Math.max(b.precision, T.amount.precision)
773
- );
774
- return Oe(C, T.amount);
775
- }, he(0));
776
- return x[L] = k, x;
777
- },
778
- {}
779
- ), P = ((U = u.purchaseOrder) == null ? void 0 : U.items) ?? [];
780
- for (const x of P)
781
- o[l = x.sku._id] ?? (o[l] = he(0));
782
- return o;
783
- }), X = V(() => {
784
- var A, U;
785
- const t = ((A = u.purchaseOrder) == null ? void 0 : A.deliveryOrder) ?? [], e = ((U = u.purchaseOrder) == null ? void 0 : U.deliveryFullfillment) ?? [], a = [
786
- ...t.map((l) => ({
787
- createdAt: l.createdAt,
788
- type: "grn",
789
- doc: l
790
- })),
791
- ...e.map((l) => ({
792
- createdAt: l.createdAt,
793
- type: "fulfillment",
794
- doc: l
795
- }))
796
- ];
797
- a.reverse().sort((l, x) => l.createdAt.localeCompare(x.createdAt));
798
- function o(l) {
799
- var L, K, k, b, T, C, H;
800
- const x = e.findIndex((E) => E.id === l.fullfillmentId);
801
- return {
802
- header: "Received",
803
- date: Ie(new Date(l.createdAt)),
804
- info: [
805
- {
806
- label: "Received by",
807
- values: [(L = l.createdBy) == null ? void 0 : L.name]
808
- },
809
- {
810
- label: "Received items",
811
- values: l.received.map((E) => {
812
- var z;
813
- return `(${E.sku.code}) ${E.sku.name}: ${le(E.amount, !1)} ${((z = E.measurement) == null ? void 0 : z.abbrev) ?? E.sku.unit.abbrev}`;
814
- })
815
- },
816
- l.deliveryOrderNumber ? {
817
- label: "Delivery order no.",
818
- values: [l.deliveryOrderNumber]
819
- } : null,
820
- l.remark ? {
821
- label: "Remark",
822
- values: [l.remark]
823
- } : null,
824
- x > -1 ? {
825
- label: "Fulfilment's sequence",
826
- values: [`${x + 1}`]
827
- } : null,
828
- (k = (K = e[x]) == null ? void 0 : K.netSuite) != null && k.refNo ? {
829
- label: "Fulfillment's ref no. (Netsuite)",
830
- values: [(T = (b = e[x]) == null ? void 0 : b.netSuite) == null ? void 0 : T.refNo]
831
- } : null,
832
- (C = l == null ? void 0 : l.netSuite) != null && C.refNo ? {
833
- label: "Item receipt (Netsuite)",
834
- values: [(H = l == null ? void 0 : l.netSuite) == null ? void 0 : H.refNo]
835
- } : null
836
- ].filter((E) => E)
837
- };
838
- }
839
- function P(l) {
840
- var L, K;
841
- const x = e.findIndex((k) => k.id === l.id);
842
- return {
843
- header: "Fulfillment",
844
- date: Ie(new Date(l.createdAt)),
845
- info: [
846
- {
847
- label: "Sequence",
848
- values: [String(x + 1)]
849
- },
850
- {
851
- label: "Receiveable items",
852
- values: l.items.map((k) => {
853
- var b;
854
- return `(${k.sku.code}) ${k.sku.name}: ${le(k.amount, !1)} ${((b = k.measurement) == null ? void 0 : b.abbrev) ?? k.sku.unit.abbrev}`;
855
- })
856
- },
857
- (L = l.netSuite) != null && L.refNo ? {
858
- label: "Ref no. (Netsuite)",
859
- values: [(K = l.netSuite) == null ? void 0 : K.refNo]
860
- } : null
861
- ].filter((k) => k)
862
- };
863
- }
864
- return a.map((l) => {
865
- switch (l.type) {
866
- case "grn":
867
- return o(l.doc);
868
- case "fulfillment":
869
- return P(l.doc);
870
- }
871
- });
872
- }), ne = B(!1), we = V(() => {
873
- var o, P, A, U;
874
- let t = !0;
875
- N.isEnabled || (t = !1);
876
- const e = u.purchaseOrder, a = u.poRequest;
877
- return e && ((o = e == null ? void 0 : e.supplier) != null && o.internal ? (!a && e.status == F.enum.DRAFT && (t = !1), a && !((P = a == null ? void 0 : a.netSuite) != null && P.id) && (t = !1), i.value && (t = !1)) : ((e == null ? void 0 : e.status) !== F.enum.REQUESTING && e.supplier.internal && (t = !1), !a && !((A = e == null ? void 0 : e.netSuite) != null && A.id) && (t = !1), !a && ((U = e == null ? void 0 : e.netSuite) != null && U.id) && (e == null ? void 0 : e.status) == F.enum.REQUESTING && (t = !1))), t;
878
- });
879
- async function f() {
880
- ne.value || w.open({
881
- title: "Sync with NetSuite",
882
- contentComponent: ee("div", [
883
- ee("p", "Are you sure you want to sync now?"),
884
- ee("br"),
885
- ee(
886
- "p",
887
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
888
- "Please wait a moment before syncing manually to avoid unnecessary actions."
889
- )
890
- ]),
891
- primaryActions: {
892
- text: "Sync",
893
- close: !0,
894
- variant: "destructive"
895
- },
896
- secondaryActions: { text: "Not now", close: !0 }
897
- }).onPrimary(async () => {
898
- var t;
899
- try {
900
- ne.value = !0;
901
- const e = u.purchaseOrder, a = u.poRequest;
902
- let o = "purchaseOrder";
903
- if ((t = e == null ? void 0 : e.supplier) != null && t.internal && (o = "purchaseOrderRequest"), !(e != null && e._id)) {
904
- S.open({
905
- title: "Error",
906
- message: "Invalid sync ID",
907
- type: "error"
908
- });
909
- return;
910
- }
911
- await N.syncTransferOrder(o, e == null ? void 0 : e._id, a == null ? void 0 : a._id), S.open({
912
- title: "Sync with NetSuite",
913
- message: "Requested to sync with NetSuite. Please wait a moment.",
914
- type: "success"
915
- });
916
- } catch {
917
- S.open({
918
- title: "Error",
919
- message: "Failed to sync with NetSuite",
920
- type: "error"
921
- });
922
- }
923
- setTimeout(() => {
924
- ne.value = !1;
925
- }, 5e3);
926
- });
927
- }
928
- const c = V(() => {
929
- var e;
930
- const t = {
931
- ...he(0),
932
- currency: $e()
933
- };
934
- return ((e = u.purchaseOrder) == null ? void 0 : e.items.reduce((a, o) => ({
935
- ...Oe(a, o.totalCost ?? t),
936
- currency: $e()
937
- }), t)) ?? t;
938
- });
939
- return (t, e) => {
940
- var L, K;
941
- const a = te("FmButton"), o = te("FmButtonGroup"), P = te("FmChip"), A = te("FmMenuDivider"), U = te("FmCard"), l = te("FmSpacer"), x = te("FmSideSheet");
942
- return y(), J(x, {
943
- header: n(d)("inventory.transfer.receiveRequest.details.title") + ((L = t.purchaseOrder) != null && L.seqNumber ? ` #${(K = t.purchaseOrder) == null ? void 0 : K.seqNumber}` : ""),
944
- modelValue: n(ie),
945
- "onUpdate:modelValue": e[9] || (e[9] = (k) => Je(ie) ? ie.value = k : null),
946
- "dismiss-away": G.value,
947
- "close-button": "",
948
- "max-width": 600
949
- }, {
950
- default: pe(() => {
951
- var k;
952
- return [
953
- r("div", ft, [
954
- we.value ? (y(), D("div", pt, [
955
- Q(a, {
956
- "prepend-icon": "sync",
957
- variant: "primary",
958
- label: "NetSuite",
959
- loading: ne.value,
960
- onClick: f
961
- }, null, 8, ["loading"])
962
- ])) : q("", !0),
963
- r("div", null, [
964
- Q(o, {
965
- items: p,
966
- modelValue: h.value,
967
- "onUpdate:modelValue": e[0] || (e[0] = (b) => h.value = b)
968
- }, null, 8, ["modelValue"])
969
- ]),
970
- h.value.value === "overview" ? (y(), D(re, { key: 1 }, [
971
- r("div", null, [
972
- Q(U, {
973
- variant: "outlined",
974
- class: "flex flex-col gap-8 px-12 py-16"
975
- }, {
976
- default: pe(() => {
977
- var b, T, C, H, E, z, ce, ue, de, Y, De, ke, Ae, xe, qe, Ne, Pe, Te, Ce, Ee;
978
- return [
979
- r("div", vt, [
980
- r("div", yt, v(n(d)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
981
- r("div", null, [
982
- Q(P, {
983
- label: n(d)(`inventory.transfer.status.${(b = t.purchaseOrder) == null ? void 0 : b.status}`),
984
- class: ve(`fm-status-badge fm-status-badge-${(C = (T = t.purchaseOrder) == null ? void 0 : T.status) == null ? void 0 : C.toLocaleLowerCase("en-us")}`),
985
- compact: ""
986
- }, null, 8, ["label", "class"])
987
- ])
988
- ]),
989
- Q(A),
990
- r("div", ht, [
991
- r("div", bt, [
992
- r("div", gt, [
993
- r("div", St, v(n(d)("inventory.transfer.receiveRequest.details.createdAt")), 1)
994
- ]),
995
- r("div", _t, v(n(ge)(((H = t.purchaseOrder) == null ? void 0 : H._id) ?? "")), 1)
996
- ]),
997
- (E = t.purchaseOrder) != null && E.effectiveAt ? (y(), D("div", Rt, [
998
- r("div", wt, v(n(d)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
999
- r("div", Ot, v(n(Be)(new Date((z = t.purchaseOrder) == null ? void 0 : z.effectiveAt))), 1)
1000
- ])) : q("", !0),
1001
- r("div", Dt, [
1002
- r("div", kt, v(n(d)("inventory.transfer.receiveRequest.details.type.title")), 1),
1003
- r("div", At, v(n(d)(
1004
- `inventory.transfer.receiveRequest.details.type.${M.value.toLocaleLowerCase("en-US")}`
1005
- )), 1)
1006
- ]),
1007
- (ue = (ce = t.purchaseOrder) == null ? void 0 : ce.supplier) != null && ue.name ? (y(), D("div", xt, [
1008
- r("div", qt, v(n(d)("inventory.transfer.receiveRequest.details.from")), 1),
1009
- r("div", Nt, v((Y = (de = t.purchaseOrder) == null ? void 0 : de.supplier) == null ? void 0 : Y.name), 1)
1010
- ])) : q("", !0),
1011
- t.transferTo ? (y(), D("div", Pt, [
1012
- r("div", Tt, v(n(d)("inventory.transfer.receiveRequest.details.to")), 1),
1013
- r("div", Ct, v(t.transferTo), 1)
1014
- ])) : q("", !0),
1015
- n(N).isEnabled ? (y(), D("div", Et, [
1016
- e[10] || (e[10] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite subsidiary ", -1)),
1017
- r("div", $t, v(Re.value || "-"), 1)
1018
- ])) : q("", !0),
1019
- n(N).isEnabled && !i.value ? (y(), D("div", It, [
1020
- r("div", Ft, " NetSuite " + v(M.value === n(se).PURCHASE ? "Purchase order" : "Transfer order") + " (ID) ", 1),
1021
- r("div", Mt, v(t.poRequest ? (ke = (De = t.poRequest) == null ? void 0 : De.netSuite) == null ? void 0 : ke.refNo : (xe = (Ae = t.purchaseOrder) == null ? void 0 : Ae.netSuite) == null ? void 0 : xe.refNo) + " (" + v(t.poRequest ? (Ne = (qe = t.poRequest) == null ? void 0 : qe.netSuite) == null ? void 0 : Ne.id : (Te = (Pe = t.purchaseOrder) == null ? void 0 : Pe.netSuite) == null ? void 0 : Te.id) + ") ", 1)
1022
- ])) : q("", !0),
1023
- n(N).isEnabled && M.value === n(se).TRANSFER && !i.value ? (y(), D("div", Ut, [
1024
- e[11] || (e[11] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1025
- r("div", Lt, v(Z.value), 1)
1026
- ])) : q("", !0),
1027
- (Ce = t.purchaseOrder) != null && Ce.ref ? (y(), D("div", jt, [
1028
- r("div", Bt, v(n(d)("inventory.transfer.receiveRequest.details.reference")), 1),
1029
- r("div", Kt, v(t.purchaseOrder.ref), 1)
1030
- ])) : q("", !0),
1031
- (Ee = t.purchaseOrder) != null && Ee.remark ? (y(), D("div", Vt, [
1032
- r("div", Gt, v(n(d)("inventory.transfer.receiveRequest.details.remark")), 1),
1033
- r("div", Ht, v(t.purchaseOrder.remark), 1)
1034
- ])) : q("", !0)
1035
- ])
1036
- ];
1037
- }),
1038
- _: 1
1039
- })
1040
- ]),
1041
- r("div", zt, [
1042
- r("div", Yt, [
1043
- r("div", Qt, v(ae.value ? n(d)("inventory.transfer.receiveRequest.details.receivedItems") : n(d)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
1044
- (y(!0), D(re, null, ye(((k = t.purchaseOrder) == null ? void 0 : k.items) ?? [], (b) => (y(), D("div", {
1045
- key: b.code,
1046
- class: "flex flex-col"
1047
- }, [
1048
- r("div", Wt, [
1049
- r("div", Jt, v(b.name), 1),
1050
- r("div", Zt, v(n(le)(fe.value[b.sku._id], !1)) + "/" + v(n(He)(b.quantity, b.sku.unit, b.measurement)), 1)
1051
- ]),
1052
- r("div", Xt, [
1053
- r("div", er, v(b.code), 1),
1054
- b.totalCost && n($).enableTotalCost ? (y(), D("div", tr, " (" + v(n(Ue)(b.totalCost)) + ") ", 1)) : q("", !0)
1055
- ])
1056
- ]))), 128)),
1057
- +n(le)(c.value) ? (y(), D(re, { key: 0 }, [
1058
- r("div", rr, [
1059
- Q(A)
1060
- ]),
1061
- r("div", sr, [
1062
- e[12] || (e[12] = r("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
1063
- r("div", ar, v(n(Ue)(c.value)), 1)
1064
- ])
1065
- ], 64)) : q("", !0)
1066
- ])
1067
- ])
1068
- ], 64)) : q("", !0),
1069
- h.value.value === "deliveryHistory" ? (y(), D("div", nr, [
1070
- X.value.length ? (y(), D("div", ur, [
1071
- (y(!0), D(re, null, ye(X.value, (b, T) => (y(), D(re, { key: T }, [
1072
- r("div", dr, [
1073
- r("div", mr, [
1074
- r("div", fr, [
1075
- r("div", {
1076
- class: ve([
1077
- {
1078
- "bg-fm-color-primary": T !== 0,
1079
- "bg-white": T === 0
1080
- },
1081
- "w-[2px] h-full"
1082
- ])
1083
- }, null, 2)
1084
- ]),
1085
- e[13] || (e[13] = r("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1086
- r("div", pr, [
1087
- r("div", {
1088
- class: ve([
1089
- {
1090
- "bg-fm-color-primary": T < X.value.length - 1,
1091
- "bg-white": T >= X.value.length - 1
1092
- },
1093
- "w-[2px] h-full"
1094
- ])
1095
- }, null, 2)
1096
- ])
1097
- ]),
1098
- r("div", vr, [
1099
- r("div", yr, v(b.header), 1),
1100
- r("div", hr, v(b.date), 1)
1101
- ])
1102
- ]),
1103
- r("div", br, [
1104
- r("div", gr, [
1105
- r("div", Sr, [
1106
- r("div", {
1107
- class: ve([
1108
- {
1109
- "bg-fm-color-primary": T < X.value.length - 1,
1110
- "bg-white": T >= X.value.length - 1
1111
- },
1112
- "w-[2px] h-full"
1113
- ])
1114
- }, null, 2)
1115
- ])
1116
- ]),
1117
- r("div", _r, [
1118
- Q(U, {
1119
- variant: "outlined",
1120
- class: "py-12 px-16"
1121
- }, {
1122
- default: pe(() => [
1123
- r("div", Rr, [
1124
- (y(!0), D(re, null, ye(b.info, (C, H) => (y(), D("div", {
1125
- key: H,
1126
- class: "flex flex-col gap-4"
1127
- }, [
1128
- r("div", wr, v(C == null ? void 0 : C.label), 1),
1129
- r("div", Or, [
1130
- (y(!0), D(re, null, ye(C == null ? void 0 : C.values, (E, z) => (y(), D("div", {
1131
- key: z,
1132
- class: "fm-typo-en-body-lg-600"
1133
- }, v(E), 1))), 128))
1134
- ])
1135
- ]))), 128))
1136
- ])
1137
- ]),
1138
- _: 2
1139
- }, 1024)
1140
- ])
1141
- ])
1142
- ], 64))), 128))
1143
- ])) : (y(), D("div", or, [
1144
- Q(l),
1145
- r("div", null, [
1146
- r("img", {
1147
- src: n(ct),
1148
- alt: "List is empty"
1149
- }, null, 8, lr)
1150
- ]),
1151
- r("div", ir, v(n(d)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
1152
- r("div", cr, v(n(d)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
1153
- Q(l),
1154
- Q(l)
1155
- ]))
1156
- ])) : q("", !0)
1157
- ])
1158
- ];
1159
- }),
1160
- "side-sheet-footer": pe(() => {
1161
- var k, b, T, C, H, E, z, ce, ue, de;
1162
- return [
1163
- r("div", Dr, [
1164
- ((k = t.purchaseOrder) == null ? void 0 : k.status) === n(F).enum.DRAFT && M.value === n(se).PURCHASE ? (y(), J(a, {
1165
- key: 0,
1166
- label: n(d)("inventory.transfer.receiveRequest.actions.confirmDraft"),
1167
- onClick: e[1] || (e[1] = (Y) => W("confirmDraft")),
1168
- loading: O.value === "confirmDraft",
1169
- disabled: O.value !== "confirmDraft" && g.value
1170
- }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1171
- ((b = t.purchaseOrder) == null ? void 0 : b.status) === n(F).enum.DRAFT && M.value === n(se).TRANSFER ? (y(), J(a, {
1172
- key: 1,
1173
- label: n(d)("inventory.transfer.receiveRequest.actions.submitRequest"),
1174
- onClick: e[2] || (e[2] = (Y) => W("submitRequest")),
1175
- loading: O.value === "submitRequest",
1176
- disabled: O.value !== "submitRequest" && g.value
1177
- }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1178
- ((T = t.purchaseOrder) == null ? void 0 : T.status) === n(F).enum.DRAFT ? (y(), J(a, {
1179
- key: 2,
1180
- label: n(d)("inventory.transfer.receiveRequest.actions.cancelDraft"),
1181
- onClick: e[3] || (e[3] = (Y) => W("cancelDraft")),
1182
- loading: O.value === "cancelDraft",
1183
- disabled: O.value !== "cancelDraft" && g.value,
1184
- variant: "destructive"
1185
- }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1186
- ((C = t.purchaseOrder) == null ? void 0 : C.status) === n(F).enum.RECEIVING ? (y(), J(a, {
1187
- key: 3,
1188
- label: n(d)("inventory.transfer.receiveRequest.actions.completeReceive"),
1189
- onClick: e[4] || (e[4] = (Y) => W("completeReceive")),
1190
- loading: O.value === "completeReceive",
1191
- disabled: O.value !== "completeReceive" && g.value
1192
- }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1193
- t.canResubmit ? (y(), J(a, {
1194
- key: 4,
1195
- label: n(d)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
1196
- onClick: e[5] || (e[5] = (Y) => W("submitRequest")),
1197
- loading: O.value === "submitRequest",
1198
- disabled: O.value !== "submitRequest" && g.value
1199
- }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1200
- (((H = t.purchaseOrder) == null ? void 0 : H.status) === n(F).enum.REQUESTING || ((E = t.purchaseOrder) == null ? void 0 : E.status) === n(F).enum.PROCESSING) && t.canApprove ? (y(), J(a, {
1201
- key: 5,
1202
- label: n(d)("inventory.transfer.approval.actions.approveRequest"),
1203
- onClick: e[6] || (e[6] = (Y) => W("approveRequest")),
1204
- loading: O.value === "approveRequest",
1205
- disabled: O.value !== "approveRequest" && g.value
1206
- }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1207
- ((z = t.purchaseOrder) == null ? void 0 : z.status) === n(F).enum.REQUESTING && t.canApprove ? (y(), J(a, {
1208
- key: 6,
1209
- label: n(d)("inventory.transfer.approval.actions.rejectRequest"),
1210
- onClick: e[7] || (e[7] = (Y) => W("rejectRequest")),
1211
- loading: O.value === "rejectRequest",
1212
- disabled: O.value !== "rejectRequest" && g.value,
1213
- variant: "destructive"
1214
- }, null, 8, ["label", "loading", "disabled"])) : q("", !0),
1215
- ((ce = t.purchaseOrder) == null ? void 0 : ce.status) !== n(F).enum.COMPLETE && ((ue = t.purchaseOrder) == null ? void 0 : ue.status) !== n(F).enum.CANCEL && (((de = t.purchaseOrder) == null ? void 0 : de.status) !== n(F).enum.REQUESTING || t.canApprove) ? (y(), J(a, {
1216
- key: 7,
1217
- label: n(d)("common.close"),
1218
- variant: "tertiary",
1219
- onClick: e[8] || (e[8] = (Y) => s("update:show", !1))
1220
- }, null, 8, ["label"])) : q("", !0)
1221
- ])
1222
- ];
1223
- }),
1224
- _: 1
1225
- }, 8, ["header", "modelValue", "dismiss-away"]);
1226
- };
1227
- }
1228
- });
1229
- export {
1230
- Vr as _,
1231
- Br as a,
1232
- Kr as b,
1233
- dt as g,
1234
- Ye as u
1235
- };