@feedmepos/mf-inventory-portal 1.2.36-dev.2 → 1.2.36-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 (69) hide show
  1. package/dist/{App-q1zovT23.js → App-Dk4bx9YE.js} +3 -3
  2. package/dist/{ApprovalView-DzeSiTK5.js → ApprovalView-C3eHTbPb.js} +5 -5
  3. package/dist/{BindingsDialog-B5yVxOjz.js → BindingsDialog-CS9JntXl.js} +2 -2
  4. package/dist/{BindingsPicker-1j_99KHr.js → BindingsPicker-DmFs8me8.js} +2 -2
  5. package/dist/{BindingsTable-O5dVjf8X.js → BindingsTable-CAEwKXBP.js} +3 -3
  6. package/dist/{ClosingDraftView-DxOmWVTS.js → ClosingDraftView-DyllabtM.js} +8 -8
  7. package/dist/{ClosingHistoryView-CUGgd5zn.js → ClosingHistoryView-Jza2jQ98.js} +3 -3
  8. package/dist/{ClosingTemplateView-BIPhpaQq.js → ClosingTemplateView-CDCWwsuv.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-DV27jhx9.js → DeliveryOrderPrintPreview-B_QyEk_n.js} +1 -1
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-ByOkF7L5.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-U3sZmO_d.js} +5 -5
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DpbYOmJX.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CGFkMlwB.js} +2 -2
  12. package/dist/{FmMultiselectDialog-Ca0w1egK.js → FmMultiselectDialog-CUmWp52E.js} +1 -1
  13. package/dist/{FmMultiselectDialog-DjUNG_QU.js → FmMultiselectDialog-DFyR5_V_.js} +2 -2
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DYbNeQjm.js → FmUnitInput.vue_vue_type_script_setup_true_lang-B9r9hbPI.js} +3 -3
  15. package/dist/{ImportView-1cbm5Ihw.js → ImportView-KPnEUkSL.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BwioQjH1.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CyCVP5IO.js} +1 -1
  17. package/dist/{IngredientGroupView-C_OacA1S.js → IngredientGroupView-Cyl_Htpa.js} +5 -5
  18. package/dist/{IngredientsView-C7wn2KeJ.js → IngredientsView-ChKtjsID.js} +14 -14
  19. package/dist/{IntegrationView-DMezTIiB.js → IntegrationView-SHJajaVL.js} +12 -12
  20. package/dist/{InventoryBindingForm-Cjb-NCMC.js → InventoryBindingForm-Gg9GMUON.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DlCtFPTn.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CujcrTQK.js} +4 -4
  22. package/dist/{InventoryBindingSummary-DvQl_NKt.js → InventoryBindingSummary-CzUw4Z5R.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B7RswJEF.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B7_g2VLs.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-W7QwNo0m.js → PremiumBadge.vue_vue_type_script_setup_true_lang-abTvWo1O.js} +2 -2
  25. package/dist/{PublishView-B-c5vqLC.js → PublishView-B0PhUA5g.js} +3 -3
  26. package/dist/{PurchaseOrderPrintPreview-Bm2HHOjy.js → PurchaseOrderPrintPreview-BIXrpY2d.js} +1 -1
  27. package/dist/ReceiveRequestView-C66PYMCJ.js +2821 -0
  28. package/dist/{RecipeView-C_EZC4aS.js → RecipeView-7DIhX9iE.js} +8 -8
  29. package/dist/{StockView-CUHPfS2r.js → StockView-DG-TIArb.js} +15 -15
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Dv4t7iml.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-zwIHzMeM.js} +1 -1
  31. package/dist/{SupplierView-DMLBGGTz.js → SupplierView-C7qPY1ed.js} +11 -11
  32. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CefmL0M9.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-rLlr1MK8.js} +2 -2
  33. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BzSnQuUT.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Dq2sCf7i.js} +1 -1
  34. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DpXjATop.js → TransferDetails.vue_vue_type_script_setup_true_lang-Doq7onUi.js} +14 -14
  35. package/dist/{TransferTemplateView-C_jHPkih.js → TransferTemplateView-CRTLolky.js} +17 -20
  36. package/dist/{UnitView-Dtt64UBK.js → UnitView-_CysyVEU.js} +6 -6
  37. package/dist/{WarehouseView-3rbyqSiO.js → WarehouseView-CMSWlARl.js} +5 -5
  38. package/dist/{WastageTemplateView-DpTEZSPu.js → WastageTemplateView-BcfZwXp7.js} +14 -14
  39. package/dist/{app-5_CNg2cC.js → app-Cz_95Y7H.js} +25 -7
  40. package/dist/app.d.ts +18 -0
  41. package/dist/app.js +1 -1
  42. package/dist/{closing-template-fZDhXn0g.js → closing-template-DwPAOWty.js} +1 -1
  43. package/dist/{date2-RFEAT3Hi.js → date2-DcPQN9hp.js} +1 -1
  44. package/dist/{dayjs.min-laIF0-Ey.js → dayjs.min-oTTJ5dBa.js} +1 -1
  45. package/dist/{decimal-B4l1R82v.js → decimal-BzprbxhQ.js} +2 -2
  46. package/dist/{defineDeepModel-dQurFqp0.js → defineDeepModel-2XXNcHR1.js} +1 -1
  47. package/dist/{duplicate-template-Baq8J49L.js → duplicate-template-C2rpMs6B.js} +1 -1
  48. package/dist/{feature-CYaTw4sS.js → feature-fgw4lVmd.js} +2 -2
  49. package/dist/{format-time-from-id-BmDX3gdu.js → format-time-from-id-CL8NKZYC.js} +1 -1
  50. package/dist/{format-unit-display-7aBUP2IP.js → format-unit-display-nJdBXGJR.js} +10 -10
  51. package/dist/{import-export.helper-Cp32rfLh.js → import-export.helper-y15RU1Bj.js} +5 -5
  52. package/dist/{index-Cs5Pj087.js → index-AGHYWCpl.js} +1 -1
  53. package/dist/{index-DV_xYBzF.js → index-B2uZxK0b.js} +3 -3
  54. package/dist/{index-DpqxYa0a.js → index-BlxyBttJ.js} +1 -1
  55. package/dist/{lodash-DaMmZ3uK.js → lodash-yKQO91ms.js} +1 -1
  56. package/dist/{netsuite-DSZaQJtE.js → netsuite-cHoXCmbU.js} +3 -3
  57. package/dist/{purchase-order-template-CUWZJHh2.js → purchase-order-template-DEsQFDu1.js} +1 -1
  58. package/dist/{rules-CzW2gAjK.js → rules-TPkpbB5A.js} +3 -3
  59. package/dist/{stock-CH1IUWLW.js → stock--rIKFZLZ.js} +3 -3
  60. package/dist/{stock-C7kDqigB.js → stock-l-BKSuZ_.js} +1 -1
  61. package/dist/{supplier-BUF6lO6w.js → supplier-DF6BzlTX.js} +2 -2
  62. package/dist/{use-ingredient-select-dialog-bVTqJksj.js → use-ingredient-select-dialog-De3TZvBg.js} +2 -2
  63. package/dist/{use-inventory-binding-dialog-CRvM6umN.js → use-inventory-binding-dialog-CEaLAoDE.js} +2 -2
  64. package/dist/{use-template-enabled-locations-2-Cr5M0EPK.js → use-template-enabled-locations-2-9YvlVFrz.js} +2 -2
  65. package/dist/{vue-i18n-DjXSAUP5.js → vue-i18n-Dim359gM.js} +158 -158
  66. package/dist/{xlsx-DHum7mwx.js → xlsx-Dl5iXg3Z.js} +398 -398
  67. package/dist/{xlsx.util-CYTjxIN0.js → xlsx.util-CvB_PNva.js} +1 -1
  68. package/package.json +1 -1
  69. package/dist/ReceiveRequestView-BoPHoq22.js +0 -2764
@@ -1,2764 +0,0 @@
1
- import { reactive as gt, onMounted as Ke, watch as be, computed as N, h as L, defineComponent as me, openBlock as w, createElementBlock as T, Fragment as de, renderList as Se, createElementVNode as n, toDisplayString as M, unref as s, resolveComponent as $, createVNode as y, withCtx as A, createCommentVNode as j, ref as q, createBlock as W, normalizeClass as J, normalizeStyle as _t, createTextVNode as Te, nextTick as It, mergeProps as Ge, isRef as xe, createSlots as $t, Teleport as Tt, normalizeProps as Dt, guardReactiveProps as Pt } from "vue";
2
- import { s as Je, G as Vt, f as ht, J as Rt, z as At, u as We, a as et, K as Et, L as Ot, t as Mt, m as Ye } from "./app-5_CNg2cC.js";
3
- import { i as ft, _ as qt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DpbYOmJX.js";
4
- import { u as Ut, P as Ze, a as Nt, _ as Bt, g as zt } from "./TransferDetails.vue_vue_type_script_setup_true_lang-DpXjATop.js";
5
- import { R as Me, a as Ce, e as Qe, d as Lt, A as qe, M as Ht, B as jt } from "./rules-CzW2gAjK.js";
6
- import { _ as kt, u as Yt, i as Qt, e as Kt } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-W7QwNo0m.js";
7
- import { d as vt } from "./dayjs.min-laIF0-Ey.js";
8
- import { u as Xt } from "./useTabStorage-BkIVScW_.js";
9
- import { u as Zt, _ as Gt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
10
- import { useBreakpoints as tt, components as ye, FmButtonVariant as Jt, useSnackbar as De, useDialog as Wt, useProxiedModel as xt } from "@feedmepos/ui-library";
11
- import { F as Oe } from "./form-mode.enum-BKiNVH6A.js";
12
- import { P as ae, a as Ct } from "./format-unit-display-7aBUP2IP.js";
13
- import { _ as es, a as ts, b as ss, F as os } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-DYbNeQjm.js";
14
- import { u as st, P as as } from "./feature-CYaTw4sS.js";
15
- import { u as Ue } from "./netsuite-DSZaQJtE.js";
16
- import { c as $e, u as ns, _ as rs } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-ByOkF7L5.js";
17
- import { useI18n as ge } from "@feedmepos/mf-common";
18
- import "./FmMultiselectDialog-Ca0w1egK.js";
19
- import { u as ot } from "./supplier-BUF6lO6w.js";
20
- import { a as ls } from "./FmMultiselectDialog-DjUNG_QU.js";
21
- import { d as St } from "./defineDeepModel-dQurFqp0.js";
22
- import { F as fe, _ as wt } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
23
- import { d as at, e as is, g as us, b as ds } from "./date2-RFEAT3Hi.js";
24
- import { _ as ms } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
25
- import { u as nt } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-CefmL0M9.js";
26
- import { u as cs } from "./vue-i18n-DjXSAUP5.js";
27
- import { s as ps, r as fs } from "./xlsx.util-CYTjxIN0.js";
28
- import { F as vs } from "./FmDroppableField-J0xUsOTV.js";
29
- import { N as ys, H as bs } from "./app-uBuHtW8m.js";
30
- var te = /* @__PURE__ */ ((g) => (g.Code = "Code", g.Name = "Name", g.TemplateName = "TemplateName", g.Amount = "Amount", g.Cost = "Cost", g.TotalCost = "TotalCost", g.Delete = "Delete", g))(te || {});
31
- const gs = () => (ge(), L(
32
- kt,
33
- {
34
- zIndex: 50,
35
- class: "whitespace-nowrap"
36
- },
37
- `Total (${ht()})`
38
- ));
39
- function _s(g) {
40
- const { t: C } = ge(), l = gt({}), { breakpoints: p } = tt(), x = st(), t = Ue();
41
- Ke(() => {
42
- for (const v of g.items) {
43
- if (!v.totalCost)
44
- continue;
45
- const { cost: e } = $e(
46
- v.sku,
47
- v.quantity,
48
- v.measurement,
49
- {
50
- supplier: g.supplier
51
- }
52
- ), u = v.totalCost ?? Je.reset();
53
- e ? l[v.sku._id] = e.amount !== u.amount || e.precision !== u.precision : l[v.sku._id] = !0;
54
- }
55
- }), be([() => g.supplier], ([v]) => {
56
- for (const e of g.items) {
57
- if (!e.totalCost || l[e.sku._id] || !f(e.sku))
58
- continue;
59
- const { cost: u } = $e(
60
- e.sku,
61
- e.quantity,
62
- e.measurement,
63
- {
64
- supplier: v
65
- }
66
- );
67
- g.updateItem({ ...e, totalCost: u });
68
- }
69
- });
70
- function f(v) {
71
- var u, k, a, i, h, _, S;
72
- return !!(((k = (u = v.defaultCost) == null ? void 0 : u.costPerUnit) == null ? void 0 : k.amount) ?? ((S = (_ = (h = (i = (a = g.supplier) == null ? void 0 : a.supplyItems) == null ? void 0 : i.find((r) => r.skuId === v._id)) == null ? void 0 : h.defaultCost) == null ? void 0 : _.costPerUnit) == null ? void 0 : S.amount));
73
- }
74
- const F = [
75
- {
76
- id: "Code",
77
- header: () => C("inventory.transfer.form.items.table.Code"),
78
- accessorKey: "code",
79
- size: 200,
80
- cell(v) {
81
- const e = v.row.original;
82
- return t.isEnabled ? L(
83
- ye.FmTooltip,
84
- {
85
- content: e.code,
86
- placement: "top",
87
- variant: "plain",
88
- zIndex: 50
89
- },
90
- L(
91
- "span",
92
- {
93
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
94
- },
95
- e.code
96
- )
97
- ) : L(ye.FmTextField, {
98
- modelValue: e.code,
99
- "onUpdate:modelValue": (u) => {
100
- g.updateItem({
101
- ...e,
102
- code: u
103
- });
104
- },
105
- key: e.sku._id,
106
- rules: [Me()],
107
- labelMark: "required"
108
- });
109
- },
110
- enableSorting: !1
111
- },
112
- {
113
- id: "Name",
114
- header: () => C("inventory.transfer.form.items.table.Name"),
115
- minSize: 300,
116
- cell(v) {
117
- const e = v.row.original;
118
- return t.isEnabled ? L(
119
- ye.FmTooltip,
120
- {
121
- content: e.name,
122
- placement: "top",
123
- variant: "plain",
124
- zIndex: 50
125
- },
126
- L(
127
- "span",
128
- {
129
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
130
- },
131
- e.name
132
- )
133
- ) : L(ye.FmTextField, {
134
- modelValue: e.name,
135
- "onUpdate:modelValue": (u) => {
136
- g.updateItem({
137
- ...e,
138
- name: u
139
- });
140
- },
141
- key: e.sku._id,
142
- rules: [Me()],
143
- labelMark: "required"
144
- });
145
- },
146
- enableSorting: !1
147
- },
148
- {
149
- id: "TemplateName",
150
- header: () => C("inventory.transfer.form.items.table.Name"),
151
- minSize: 300,
152
- enableSorting: !1,
153
- cell(v) {
154
- const e = v.row.original, u = e.code, k = e.name;
155
- return L(
156
- ye.FmTooltip,
157
- { zIndex: 50 },
158
- {
159
- default() {
160
- return L("div", { class: "flex flex-col w-full" }, [
161
- L(
162
- "div",
163
- { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
164
- k
165
- ),
166
- L(
167
- "div",
168
- {
169
- class: "line-clamp-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary"
170
- },
171
- u
172
- )
173
- ]);
174
- },
175
- content() {
176
- return k;
177
- }
178
- }
179
- );
180
- }
181
- },
182
- {
183
- id: "Amount",
184
- header: () => C("inventory.transfer.form.items.table.Amount"),
185
- minSize: 200,
186
- cell(v) {
187
- var i, h, _, S, r;
188
- const e = v.row.original, u = (i = g.forecastAmounts) == null ? void 0 : i.find((m) => m.skuId === e.sku._id), k = u ? u.helperState === "error" ? `Predicted: ${u.amount} (out of range)` : `Predicted: ${u.amount}` : void 0, a = (S = (_ = (h = g.template) == null ? void 0 : h.purchaseOrder) == null ? void 0 : _.items) == null ? void 0 : S.find(
189
- (m) => m.sku._id === e.sku._id
190
- );
191
- return L(es, {
192
- style: {
193
- flex: "1 1 0%"
194
- },
195
- modelValue: {
196
- amount: e.quantity ?? { amount: 1, precision: 0 },
197
- measurement: e.measurement ?? null
198
- },
199
- key: e.sku._id,
200
- unit: e.sku.unit,
201
- helperText: k,
202
- helperState: u == null ? void 0 : u.helperState,
203
- "onUpdate:modelValue": (m) => {
204
- if (!m) return;
205
- const D = {
206
- ...e,
207
- quantity: m.amount,
208
- measurement: m.measurement
209
- };
210
- if (x.enableTotalCost) {
211
- const { cost: B } = $e(
212
- D.sku,
213
- D.quantity,
214
- D.measurement,
215
- {
216
- supplier: g.supplier,
217
- // NOTE: set undefined here if `manualTotalCost[updatedRow.sku._id] = false`, so that the function
218
- // will return the auto calculated default cost instead of the manual total cost
219
- manualTotalCost: l[D.sku._id] ? D.totalCost : void 0
220
- }
221
- );
222
- D.totalCost = B;
223
- }
224
- g.updateItem(D);
225
- },
226
- stepper: a == null ? void 0 : a.quantityStep,
227
- disableUnit: !!a,
228
- disabled: g.disabled,
229
- rules: [
230
- ts(
231
- +Ce(
232
- ((r = e.quantity) == null ? void 0 : r.amount) === 0 ? { amount: 0, precision: 0 } : (a == null ? void 0 : a.minimumQuantity) ?? { amount: 0, precision: 0 }
233
- )
234
- ),
235
- ss(
236
- a != null && a.maximumQuantity ? +Ce(a == null ? void 0 : a.maximumQuantity) : 1 / 0
237
- ),
238
- ...a != null && a.quantityStep ? [os(a.quantityStep)] : []
239
- ],
240
- applyDefaultRules: !0
241
- });
242
- },
243
- enableSorting: !1
244
- },
245
- {
246
- id: "Cost",
247
- header: gs,
248
- size: 180,
249
- cell(v) {
250
- const e = v.row.original, u = f(e.sku), k = p.value.xs || p.value.sm;
251
- if (!l[e.sku._id] && u) {
252
- const { cost: a, supplierOverrideCost: i } = $e(
253
- e.sku,
254
- e.quantity,
255
- e.measurement,
256
- {
257
- supplier: g.supplier
258
- }
259
- );
260
- return L(
261
- "div",
262
- {
263
- class: [
264
- "flex gap-4 fm-typo-en-body-md-400 items-center",
265
- g.disabled ? "text-fm-color-typo-disabled" : ""
266
- ],
267
- key: e.sku._id
268
- },
269
- [
270
- L(ye.FmButton, {
271
- prependIcon: "edit",
272
- variant: Jt.Tertiary,
273
- disabled: g.disabled,
274
- onClick() {
275
- g.updateItem({
276
- ...e,
277
- totalCost: a
278
- }), l[e.sku._id] = !0;
279
- }
280
- }),
281
- L(
282
- "div",
283
- {
284
- class: "flex flex-col"
285
- },
286
- [
287
- L(
288
- "span",
289
- k ? Qe(a) : Ce(a)
290
- ),
291
- L(
292
- "span",
293
- {
294
- class: [
295
- "fm-typo-en-body-sm-400",
296
- g.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
297
- ]
298
- },
299
- C("inventory.transfer.form.items.autoCalculated")
300
- ),
301
- i ? L(
302
- "span",
303
- {
304
- class: [
305
- "fm-typo-en-body-sm-400",
306
- g.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
307
- ]
308
- },
309
- [
310
- Qe(i.costPerUnit),
311
- "/",
312
- i.measurement ? L(
313
- "span",
314
- { class: "text-blue-500 font-semibold" },
315
- i.measurement.abbrev
316
- ) : L("span", { class: "text-green-500 font-bold" }, e.sku.unit.abbrev)
317
- // base unit style
318
- ]
319
- ) : null
320
- ]
321
- )
322
- ]
323
- );
324
- }
325
- return L(
326
- ye.FmTextField,
327
- {
328
- modelValue: Ce(e.totalCost ?? { amount: 0, precision: 0 }),
329
- key: e.sku._id,
330
- "onUpdate:modelValue": (a) => {
331
- g.updateItem({
332
- ...e,
333
- totalCost: {
334
- ...Lt(+a),
335
- currency: Vt()
336
- }
337
- });
338
- },
339
- rules: [qe(0), Ht(2)]
340
- },
341
- {
342
- prepend() {
343
- return k ? L(
344
- "div",
345
- {
346
- class: [
347
- "text-fm-typo-en-body-lg-400",
348
- g.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
349
- ]
350
- },
351
- ht()
352
- ) : null;
353
- },
354
- append() {
355
- return u ? L(ye.FmButton, {
356
- prependIcon: "close",
357
- variant: "tertiary",
358
- disabled: g.disabled,
359
- onClick() {
360
- const { cost: a } = $e(
361
- e.sku,
362
- e.quantity,
363
- e.measurement,
364
- {
365
- supplier: g.supplier
366
- }
367
- );
368
- g.updateItem({
369
- ...e,
370
- // NOTE: different from PO template, if a default cost is reenabled,
371
- // the total cost will automatically assigned
372
- totalCost: a
373
- }), l[e.sku._id] = !1;
374
- }
375
- }) : null;
376
- }
377
- }
378
- );
379
- },
380
- enableSorting: !1
381
- },
382
- {
383
- id: "Delete",
384
- header: "",
385
- cell(v) {
386
- const e = v.row.original;
387
- return L("div", { class: "flex justify-end" }, [
388
- L(ye.FmButton, {
389
- key: e.sku._id,
390
- class: "delete-button",
391
- type: "button",
392
- icon: "delete",
393
- variant: "tertiary",
394
- size: "md",
395
- disabled: g.disabled,
396
- onClick: () => {
397
- g.deleteItem(e);
398
- }
399
- })
400
- ]);
401
- },
402
- enableSorting: !1,
403
- size: 40,
404
- meta: {
405
- cellClass: "",
406
- headerClass: ""
407
- }
408
- }
409
- ];
410
- return {
411
- columnDefs: N(() => x.enableTotalCost && g.transferType === ae.PURCHASE ? F : F.filter(
412
- (v) => v.id !== "Cost"
413
- /* Cost */
414
- ))
415
- };
416
- }
417
- const hs = { class: "flex flex-col gap-8 px-16 xs:px-4 sm:px-4 py-4 items-center" }, ks = { class: "fm-typo-en-body-lg-600 xs:fm-typo-en-body-md-600 mr-auto xs:w-full" }, xs = { class: "w-[450px] xs:w-full flex" }, Cs = { class: "fm-typo-en-body-md-400 whitespace-nowrap" }, Ss = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ft = /* @__PURE__ */ me({
418
- __name: "SupplierPriceHistory",
419
- props: {
420
- prices: {}
421
- },
422
- setup(g) {
423
- const C = ot();
424
- function l(p) {
425
- return C.suppliers.find((x) => x._id === p);
426
- }
427
- return (p, x) => (w(), T("div", hs, [
428
- (w(!0), T(de, null, Se(Object.keys(p.prices), (t) => {
429
- var f;
430
- return w(), T("div", {
431
- key: t,
432
- class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
433
- }, [
434
- n("div", ks, M((f = l(t)) == null ? void 0 : f.name), 1),
435
- n("div", xs, [
436
- (w(!0), T(de, null, Se(p.prices[t].slice(0, 3), (F) => {
437
- var I;
438
- return w(), T("div", {
439
- key: F.date,
440
- class: "flex flex-col w-[150px] xs:flex-1 text-ellipsis cursor-pointer"
441
- }, [
442
- n("div", Cs, [
443
- n("span", null, M(F.totalCost ? s(Qe)(F.totalCost) : "No data"), 1),
444
- x[0] || (x[0] = n("span", { class: "text-fm-color-typo-secondary" }, "/", -1)),
445
- n("span", null, M(s(Ce)(F.totalUnit, !1)), 1),
446
- n("span", null, M(((I = F.measurement) == null ? void 0 : I.abbrev) ?? F.unit.abbrev), 1)
447
- ]),
448
- n("div", Ss, [
449
- n("span", null, "(#" + M(F.seqNumber) + ")", 1),
450
- x[1] || (x[1] = n("span", null, M(" "), -1)),
451
- n("span", null, M(s(at)(new Date(F.date))), 1)
452
- ])
453
- ]);
454
- }), 128))
455
- ])
456
- ]);
457
- }), 128))
458
- ]));
459
- }
460
- }), ws = { class: "flex flex-col gap-8 py-16" }, Fs = { class: "flex items-center" }, Is = { class: "flex-1 flex gap-1 items-center" }, $s = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ts = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ds = { class: "flex gap-8 w-full" }, Ps = { class: "flex-1 flex flex-col gap-4" }, Vs = { class: "flex-1 flex flex-col gap-4" }, Rs = { class: "flex gap-8 w-full" }, As = { class: "flex-1 flex flex-col gap-4" }, Es = {
461
- key: 0,
462
- class: "flex-1 flex flex-col gap-4"
463
- }, Os = /* @__PURE__ */ me({
464
- __name: "TransferItem",
465
- props: {
466
- cellByColId: {},
467
- comparePriceBySku: {},
468
- showComparePrice: { type: Boolean },
469
- row: {}
470
- },
471
- setup(g) {
472
- const { t: C } = ge();
473
- return (l, p) => {
474
- var f, F, I, v, e, u, k, a, i, h, _, S, r, m, D, B, Y, Q, K, O, U, V, d, b, R, X, Z;
475
- const x = $("FmLabel"), t = $("FmSpacer");
476
- return w(), T("div", ws, [
477
- n("div", Fs, [
478
- n("div", Is, [
479
- n("span", $s, " (" + M(l.row.original.sku.code) + ") ", 1),
480
- n("span", Ts, M(l.row.original.sku.name), 1)
481
- ]),
482
- n("div", null, [
483
- y(s(fe), {
484
- render: (I = (F = (f = l.cellByColId.Delete) == null ? void 0 : f.column) == null ? void 0 : F.columnDef) == null ? void 0 : I.cell,
485
- props: (e = (v = l.cellByColId.Delete) == null ? void 0 : v.getContext) == null ? void 0 : e.call(v)
486
- }, null, 8, ["render", "props"])
487
- ])
488
- ]),
489
- n("div", Ds, [
490
- n("div", Ps, [
491
- y(x, {
492
- label: s(C)(`inventory.transfer.form.items.table.${s(te).Code}`)
493
- }, null, 8, ["label"]),
494
- y(s(fe), {
495
- render: (a = (k = (u = l.cellByColId[s(te).Code]) == null ? void 0 : u.column) == null ? void 0 : k.columnDef) == null ? void 0 : a.cell,
496
- props: (h = (i = l.cellByColId[s(te).Code]) == null ? void 0 : i.getContext) == null ? void 0 : h.call(i)
497
- }, null, 8, ["render", "props"]),
498
- p[0] || (p[0] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
499
- ]),
500
- n("div", Vs, [
501
- y(x, {
502
- label: s(C)(`inventory.transfer.form.items.table.${s(te).Name}`)
503
- }, null, 8, ["label"]),
504
- y(s(fe), {
505
- render: (r = (S = (_ = l.cellByColId[s(te).Name]) == null ? void 0 : _.column) == null ? void 0 : S.columnDef) == null ? void 0 : r.cell,
506
- props: (D = (m = l.cellByColId[s(te).Name]) == null ? void 0 : m.getContext) == null ? void 0 : D.call(m)
507
- }, null, 8, ["render", "props"]),
508
- p[1] || (p[1] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
509
- ])
510
- ]),
511
- n("div", Rs, [
512
- n("div", As, [
513
- y(x, {
514
- label: s(C)(`inventory.transfer.form.items.table.${s(te).Amount}`)
515
- }, null, 8, ["label"]),
516
- y(s(fe), {
517
- render: (Q = (Y = (B = l.cellByColId[s(te).Amount]) == null ? void 0 : B.column) == null ? void 0 : Y.columnDef) == null ? void 0 : Q.cell,
518
- props: (O = (K = l.cellByColId[s(te).Amount]) == null ? void 0 : K.getContext) == null ? void 0 : O.call(K)
519
- }, null, 8, ["render", "props"]),
520
- p[2] || (p[2] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
521
- ]),
522
- l.cellByColId[s(te).Cost] ? (w(), T("div", Es, [
523
- y(kt, { "z-index": 50 }, {
524
- default: A(() => [
525
- y(x, {
526
- label: s(C)(`inventory.transfer.form.items.table.${s(te).Cost}2`)
527
- }, null, 8, ["label"])
528
- ]),
529
- _: 1
530
- }),
531
- y(s(fe), {
532
- render: (d = (V = (U = l.cellByColId[s(te).Cost]) == null ? void 0 : U.column) == null ? void 0 : V.columnDef) == null ? void 0 : d.cell,
533
- props: (R = (b = l.cellByColId[s(te).Cost]) == null ? void 0 : b.getContext) == null ? void 0 : R.call(b)
534
- }, null, 8, ["render", "props"]),
535
- p[3] || (p[3] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
536
- ])) : j("", !0)
537
- ]),
538
- l.showComparePrice && Object.keys(l.comparePriceBySku[(X = l.row.original.sku) == null ? void 0 : X._id] ?? {}).length > 0 ? (w(), T(de, { key: 0 }, [
539
- y(t, { class: "h-8" }),
540
- y(Ft, {
541
- prices: l.comparePriceBySku[(Z = l.row.original.sku) == null ? void 0 : Z._id]
542
- }, null, 8, ["prices"])
543
- ], 64)) : j("", !0)
544
- ]);
545
- };
546
- }
547
- });
548
- function Ms(g) {
549
- const C = N({
550
- get() {
551
- const t = g.getEffectiveAt();
552
- return t ? new Date(t) : null;
553
- },
554
- set(t) {
555
- g.setEffectiveAt((t == null ? void 0 : t.toISOString()) ?? null);
556
- }
557
- }), l = N({
558
- get() {
559
- return !!C.value;
560
- },
561
- set(t) {
562
- t ? C.value = /* @__PURE__ */ new Date() : C.value = null;
563
- }
564
- }), p = N({
565
- get() {
566
- return C.value === null ? "" : at(C.value);
567
- },
568
- set(t) {
569
- t ? C.value = /* @__PURE__ */ new Date(`${t} ${x.value}`) : C.value = null;
570
- }
571
- }), x = N({
572
- get() {
573
- return C.value === null ? "" : is(C.value);
574
- },
575
- set(t) {
576
- t ? C.value = /* @__PURE__ */ new Date(`${p.value} ${t}`) : C.value = null;
577
- }
578
- });
579
- return {
580
- backdatePo: C,
581
- backdateSwitch: l,
582
- backdateModel: p,
583
- backdateTimeModel: x
584
- };
585
- }
586
- const qs = {
587
- width: "24",
588
- height: "24",
589
- viewBox: "0 0 24 24",
590
- fill: "none",
591
- xmlns: "http://www.w3.org/2000/svg"
592
- }, Us = ["fill"], Ns = ["fill"], Bs = ["stroke"], zs = ["stroke"], Ls = /* @__PURE__ */ me({
593
- __name: "SparkIcon",
594
- props: {
595
- size: {
596
- type: Number,
597
- default: 24
598
- },
599
- color: {
600
- type: String,
601
- default: "#c7c7cc"
602
- }
603
- },
604
- setup(g) {
605
- return (C, l) => (w(), T("svg", qs, [
606
- n("path", {
607
- d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
608
- fill: g.color
609
- }, null, 8, Us),
610
- n("path", {
611
- d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
612
- fill: g.color
613
- }, null, 8, Ns),
614
- n("path", {
615
- d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
616
- stroke: g.color,
617
- "stroke-width": "1.5",
618
- "stroke-linecap": "round",
619
- "stroke-linejoin": "round"
620
- }, null, 8, Bs),
621
- n("path", {
622
- d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
623
- stroke: g.color,
624
- "stroke-width": "1.5",
625
- "stroke-linecap": "round",
626
- "stroke-linejoin": "round"
627
- }, null, 8, zs)
628
- ]));
629
- }
630
- }), Hs = { class: "flex gap-8 items-center" }, js = { class: "fm-typo-en-body-lg-600 line-clamp-1" }, Ys = { class: "w-[343px] px-24 py-16 rounded-lg shadow-light-300 flex flex-col gap-[20px]" }, Qs = { class: "flex items-center w-full" }, Ks = { class: "flex-1" }, Xs = { class: "fm-typo-en-title-sm-800" }, Zs = { class: "flex items-start gap-8" }, Gs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Js = { class: "flex gap-1" }, Ws = /* @__PURE__ */ me({
631
- __name: "ForecastStock",
632
- props: {
633
- templateId: {},
634
- disabled: { type: Boolean },
635
- poItems: {},
636
- templateItems: {}
637
- },
638
- emits: ["update:poItems", "update:forecastAmounts"],
639
- setup(g, { emit: C }) {
640
- const l = g, p = C, x = q(!1), t = q(7), f = Yt(), F = De(), { t: I } = ge();
641
- function v(a, i, h) {
642
- return i != null && a < i && (a = i), h != null && a > h && (a = h), a;
643
- }
644
- function e(a) {
645
- if (!((a == null ? void 0 : a.amount) == null || (a == null ? void 0 : a.precision) == null))
646
- return a.amount / Math.pow(10, a.precision);
647
- }
648
- function u({
649
- sku: a,
650
- code: i,
651
- name: h,
652
- baseAmount: _,
653
- measurement: S,
654
- min: r,
655
- max: m
656
- }) {
657
- if (S) {
658
- const D = S.conversion.amount;
659
- let B = Math.ceil(_ / D);
660
- return B = v(B, r, m), {
661
- sku: a,
662
- code: i,
663
- name: h,
664
- quantity: { amount: B, precision: 0 },
665
- measurement: S
666
- };
667
- } else {
668
- const D = Math.ceil(v(_, r, m));
669
- return {
670
- sku: a,
671
- code: i,
672
- name: h,
673
- quantity: { amount: D, precision: 0 },
674
- measurement: null
675
- };
676
- }
677
- }
678
- async function k() {
679
- if (t.value < 1) return;
680
- x.value = !1, await f.readPurchaseOrder(t.value, l.templateId);
681
- const a = f.purchaseOrderForecast.skus;
682
- if (a.length === 0) {
683
- F.open({
684
- message: I("inventory.transfer.form.items.forecastStock.notAvailable"),
685
- type: "info"
686
- });
687
- return;
688
- }
689
- const i = l.templateItems.reduce((_, S) => {
690
- var B;
691
- const r = (B = l.poItems) == null ? void 0 : B.find((Y) => Y.sku._id === S.sku._id), m = a.find((Y) => Y.id === S.sku._id);
692
- if (!m)
693
- return r && _.push(r), _;
694
- if (!l.templateId && m.amount <= 0) return _;
695
- const D = m.amount ?? e(r == null ? void 0 : r.quantity) ?? 0;
696
- return _.push(
697
- u({
698
- sku: S.sku,
699
- code: S.code,
700
- name: S.name,
701
- baseAmount: D,
702
- measurement: S.measurement || null,
703
- min: e(S.minimumQuantity),
704
- max: e(S.maximumQuantity)
705
- })
706
- ), _;
707
- }, []), h = a.map((_) => {
708
- const S = l.templateItems.find((Q) => Q.sku._id === _.id);
709
- let r = _.amount, m = 0;
710
- if (S != null && S.measurement) {
711
- const Q = e(S.measurement.conversion) ?? 1;
712
- r = Math.ceil(_.amount / Q);
713
- } else
714
- r = Math.ceil(_.amount);
715
- const D = e(S == null ? void 0 : S.minimumQuantity) ?? 0, B = e(S == null ? void 0 : S.maximumQuantity) ?? 1 / 0, Y = r < D || r > B ? "error" : "success";
716
- return { skuId: _.id, amount: r, precision: m, helperState: Y };
717
- });
718
- p("update:poItems", i), p("update:forecastAmounts", h);
719
- }
720
- return (a, i) => {
721
- const h = $("FmButton"), _ = $("FmIcon"), S = $("FmStepperField"), r = $("FmPopover");
722
- return w(), W(r, {
723
- disabled: a.disabled,
724
- class: "flex",
725
- "show-popover": x.value,
726
- onPopoverChanged: i[3] || (i[3] = (m) => x.value = m)
727
- }, {
728
- "popover-button": A(() => [
729
- y(h, {
730
- label: "unused",
731
- variant: "secondary",
732
- "text-color": a.disabled ? "disabled" : "primary",
733
- "bg-color": "transparent",
734
- "border-color": a.disabled ? "disabled" : "primary",
735
- disabled: a.disabled
736
- }, {
737
- default: A(() => [
738
- n("div", Hs, [
739
- y(Ls, {
740
- size: 24,
741
- color: a.disabled ? "#c7c7cc" : "#ff7823"
742
- }, null, 8, ["color"]),
743
- n("div", js, M(s(I)("inventory.transfer.form.items.forecastStock.title")), 1)
744
- ])
745
- ]),
746
- _: 1
747
- }, 8, ["text-color", "border-color", "disabled"])
748
- ]),
749
- default: A(() => [
750
- n("div", Ys, [
751
- n("div", Qs, [
752
- n("div", Ks, [
753
- y(ms, { "z-index": 99 }, {
754
- default: A(() => [
755
- n("p", Xs, M(s(I)("inventory.transfer.form.items.forecastStock.title")), 1)
756
- ]),
757
- _: 1
758
- })
759
- ]),
760
- y(h, {
761
- icon: "close",
762
- size: "md",
763
- variant: "tertiary",
764
- onClick: i[0] || (i[0] = (m) => x.value = !1)
765
- })
766
- ]),
767
- y(S, {
768
- modelValue: t.value,
769
- "onUpdate:modelValue": i[1] || (i[1] = (m) => t.value = m),
770
- label: s(I)("inventory.transfer.form.items.forecastStock.days"),
771
- rules: [s(qe)(1)]
772
- }, {
773
- "helper-text": A(() => [
774
- n("div", Zs, [
775
- y(_, {
776
- name: "warning",
777
- size: "sm",
778
- class: "text-fm-color-system-warning-300"
779
- }),
780
- n("div", Gs, M(s(I)("inventory.transfer.form.items.forecastStock.replace")), 1)
781
- ])
782
- ]),
783
- _: 1
784
- }, 8, ["modelValue", "label", "rules"]),
785
- n("div", Js, [
786
- i[4] || (i[4] = n("div", { class: "grow" }, null, -1)),
787
- y(h, {
788
- label: s(I)("common.cancel"),
789
- variant: "tertiary",
790
- onClick: i[2] || (i[2] = (m) => x.value = !1)
791
- }, null, 8, ["label"]),
792
- y(h, {
793
- label: s(I)("inventory.transfer.form.items.forecastStock.generate"),
794
- onClick: k
795
- }, null, 8, ["label"])
796
- ])
797
- ])
798
- ]),
799
- _: 1
800
- }, 8, ["disabled", "show-popover"]);
801
- };
802
- }
803
- });
804
- function eo() {
805
- const g = De(), C = nt(), l = q(!1);
806
- be(l, (f) => {
807
- f && (x.value = !0, p().finally(() => {
808
- x.value = !1;
809
- }));
810
- });
811
- async function p() {
812
- try {
813
- const { startDate: f, endDate: F } = us(6), e = (await C.getPurchaseOrders({ start: f, end: F })).filter(
814
- (u) => {
815
- var k, a;
816
- return u.status === Rt.enum.COMPLETE && ((k = u.supplier) == null ? void 0 : k.internal) !== "warehouse" && ((a = u.supplier) == null ? void 0 : a.internal) !== "restaurant";
817
- }
818
- ).reduce((u, k) => {
819
- const a = new Date(At(k._id)), i = k.supplier._id;
820
- for (const h of k.items) {
821
- if (!h.totalCost) continue;
822
- const _ = u[h.sku._id] ?? {}, S = _[i] ?? [];
823
- S.push({
824
- date: a.toISOString(),
825
- totalUnit: h.quantity,
826
- totalCost: h.totalCost,
827
- unit: h.sku.unit,
828
- measurement: h.measurement,
829
- seqNumber: k.seqNumber
830
- }), _[i] = S, u[h.sku._id] = _;
831
- }
832
- return u;
833
- }, {});
834
- t.value = e;
835
- } catch {
836
- g.open({
837
- title: "Something went wrong",
838
- message: "Cannot retrieve supplier purchase history. Please try again."
839
- }), l.value = !1;
840
- }
841
- }
842
- const x = q(!1), t = q({});
843
- return {
844
- comparePricesToggle: l,
845
- comparePriceFetching: x,
846
- comparePriceBySku: t
847
- };
848
- }
849
- const to = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, so = { key: 0 }, oo = ["colspan"], ao = /* @__PURE__ */ me({
850
- __name: "TransferItemTable",
851
- props: {
852
- templateItem: {},
853
- row: {},
854
- comparePriceBySku: {},
855
- showComparePrice: { type: Boolean },
856
- disabled: { type: Boolean }
857
- },
858
- emits: ["update:item"],
859
- setup(g) {
860
- function C(l) {
861
- return l.column.columnDef.meta;
862
- }
863
- return (l, p) => {
864
- var x, t;
865
- return w(), T(de, null, [
866
- n("tr", {
867
- class: J(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
868
- "bg-fm-color-neutral-gray-100": l.row.getIsSelected()
869
- }])
870
- }, [
871
- (w(!0), T(de, null, Se(l.row.getVisibleCells(), (f) => {
872
- var F, I, v, e;
873
- return w(), T("td", {
874
- key: f.id,
875
- class: J(["h-[56px] text-fm-color-typo-primary", ((F = C(f)) == null ? void 0 : F.cellClass) ?? "px-16"]),
876
- style: _t({
877
- width: (I = C(f)) == null ? void 0 : I.width,
878
- maxWidth: (v = C(f)) == null ? void 0 : v.maxWidth,
879
- textAlign: ((e = C(f)) == null ? void 0 : e.textAlign) ?? "left"
880
- })
881
- }, [
882
- n("span", to, [
883
- y(s(fe), {
884
- render: f.column.columnDef.cell,
885
- props: f.getContext()
886
- }, null, 8, ["render", "props"])
887
- ])
888
- ], 6);
889
- }), 128))
890
- ], 2),
891
- l.showComparePrice && Object.keys(l.comparePriceBySku[(x = l.row.original.sku) == null ? void 0 : x._id] ?? {}).length > 0 ? (w(), T("tr", so, [
892
- n("td", {
893
- colspan: l.row.getVisibleCells().length
894
- }, [
895
- y(Ft, {
896
- prices: l.comparePriceBySku[(t = l.row.original.sku) == null ? void 0 : t._id]
897
- }, null, 8, ["prices"])
898
- ], 8, oo)
899
- ])) : j("", !0)
900
- ], 64);
901
- };
902
- }
903
- }), no = {
904
- key: 0,
905
- class: "flex flex-col gap-8"
906
- }, ro = { class: "flex flex-col gap-4" }, lo = { class: "flex items-center gap-4" }, io = {
907
- key: 0,
908
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-error"
909
- }, uo = /* @__PURE__ */ me({
910
- __name: "NetSuiteField",
911
- props: {
912
- required: { type: Boolean },
913
- disabled: { type: Boolean },
914
- supplier: {},
915
- setting: {},
916
- items: {},
917
- onChange: { type: Function }
918
- },
919
- emits: ["netsuite:ready"],
920
- setup(g, { emit: C }) {
921
- const l = Ue(), p = g, x = C, { t } = cs(), f = q(!1), F = q();
922
- Ke(() => {
923
- var u, k, a, i;
924
- let e = {
925
- id: "",
926
- subsidiary: { id: "", name: "" },
927
- errors: []
928
- };
929
- if (!l.isEnabled || !p.required) {
930
- x("netsuite:ready", e);
931
- return;
932
- }
933
- try {
934
- const h = l.currentLocationSubsidiary();
935
- p.setting ? e = {
936
- ...p.setting,
937
- subsidiary: {
938
- id: h.id || "",
939
- name: h.name
940
- }
941
- } : e = {
942
- ...e,
943
- subsidiary: {
944
- id: h.id || "",
945
- name: h.name
946
- }
947
- };
948
- const _ = l.getAvailableItems(h.id), S = p.items.filter((r) => {
949
- if (r.measurement != null) {
950
- const m = l.getAvailableMeasurements(
951
- r.sku._id,
952
- h.id
953
- );
954
- return _.includes(r.sku._id) && m.includes(r.measurement.id);
955
- }
956
- return _.includes(r.sku._id);
957
- }).map((r) => r.sku._id);
958
- p.onChange(
959
- p.items.filter((r) => S.includes(r.sku._id)),
960
- e
961
- );
962
- } finally {
963
- p.supplier.internal ? F.value = l.getNetSuiteLocation(
964
- `${p.supplier.internal}_${p.supplier._id}`
965
- ) : F.value = l.getNetSuiteVendor(p.supplier._id);
966
- const h = p.supplier.internal ? l.getLocationSubsidiary((u = F.value) == null ? void 0 : u.netSuiteId).id : (k = F.value) == null ? void 0 : k.subsidiaryId, _ = p.supplier.internal ? (a = l.currentLocationSubsidiary()) == null ? void 0 : a.id : (i = l.currentVendorSubsidiary(p.supplier._id)) == null ? void 0 : i.id;
967
- !l.isEnabled || h && l.isEnabled && h == _ ? x("netsuite:ready", e) : f.value = !0;
968
- }
969
- });
970
- const I = N(
971
- () => p.supplier.internal ? l.currentLocationSubsidiary() : l.currentVendorSubsidiary(p.supplier._id)
972
- ), v = N(() => {
973
- var e, u;
974
- return F.value == null ? `Cannot find the NetSuite location for "${p.supplier.name}"` : `The subsidiary of the request
975
- location is ${(u = l.getLocationSubsidiary((e = F.value) == null ? void 0 : e.netSuiteId)) == null ? void 0 : u.fullName}`;
976
- });
977
- return (e, u) => {
978
- const k = $("FmLabel"), a = $("FmIcon"), i = $("FmField"), h = $("FmTooltip");
979
- return s(l).isEnabled && p.required ? (w(), T("div", no, [
980
- y(k, {
981
- label: `NetSuite ${s(t)("inventory.transfer.form.netsuite.subsidiary")}`
982
- }, null, 8, ["label"]),
983
- n("div", ro, [
984
- y(h, {
985
- "z-index": 51,
986
- placement: "left",
987
- disabled: e.disabled
988
- }, {
989
- content: A(() => u[0] || (u[0] = [
990
- Te("This field is locked and based on the location of the request.")
991
- ])),
992
- default: A(() => [
993
- y(i, null, {
994
- default: A(() => {
995
- var _;
996
- return [
997
- n("div", lo, [
998
- y(a, {
999
- name: "lock_outline",
1000
- size: "sm",
1001
- color: e.disabled ? "neutral-gray-200" : "neutral-gray-400"
1002
- }, null, 8, ["color"]),
1003
- n("div", {
1004
- class: J([e.disabled ? "text-fm-color-typo-disabled" : ""])
1005
- }, M((_ = I.value) == null ? void 0 : _.fullName), 3)
1006
- ])
1007
- ];
1008
- }),
1009
- _: 1
1010
- })
1011
- ]),
1012
- _: 1
1013
- }, 8, ["disabled"]),
1014
- f.value ? (w(), T("div", io, M(v.value), 1)) : j("", !0)
1015
- ])
1016
- ])) : j("", !0);
1017
- };
1018
- }
1019
- }), mo = { class: "flex flex-col gap-4" }, co = { class: "flex items-center gap-8 overflow-x-auto pb-12" }, po = { class: "flex flex-col gap-16" }, fo = { class: "flex flex-col gap-24" }, vo = { class: "flex flex-col gap-8" }, yo = { class: "flex flex-col gap-4" }, bo = { class: "flex items-center gap-4" }, go = { class: "flex flex-col gap-8" }, _o = { class: "flex flex-col gap-4" }, ho = { class: "flex items-center gap-4" }, ko = {
1020
- key: 3,
1021
- class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col"
1022
- }, xo = {
1023
- key: 0,
1024
- class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
1025
- }, Co = { class: "flex-1" }, So = { class: "flex-1" }, wo = {
1026
- key: 1,
1027
- class: "flex items-center gap-4"
1028
- }, Fo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary translate-y-[1px]" }, Io = { class: "flex flex-col gap-16" }, $o = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, To = { class: "flex gap-8" }, Do = { key: 0 }, Po = /* @__PURE__ */ me({
1029
- __name: "TransferForm2",
1030
- props: {
1031
- modelValue: {},
1032
- request: {},
1033
- disabled: { type: Boolean },
1034
- suppliers: {},
1035
- skus: {},
1036
- lastClosingDate: {}
1037
- },
1038
- emits: ["validation-success", "form:ready"],
1039
- setup(g, { expose: C, emit: l }) {
1040
- const p = g, x = l, t = St(), { t: f } = ge(), F = We(), I = et(), v = Ue(), e = ot(), u = st(), k = Ct(), { breakpoints: a } = tt(), i = N(() => a.value.xs || a.value.sm), h = gt({
1041
- value: !1
1042
- }), _ = q(!1), S = q(0), r = q([]), m = N(
1043
- () => {
1044
- var o;
1045
- return ((o = p.modelValue) == null ? void 0 : o.templateDoc) ?? k.templates.find((c) => c._id === t.template);
1046
- }
1047
- ), D = N(() => t.status === "DRAFT" || !t._rev);
1048
- be(m, (o) => {
1049
- var c, E;
1050
- if (o) {
1051
- if (o && !o.purchaseOrder.supplier)
1052
- throw new Error("Template order must have a source location");
1053
- if (D.value) {
1054
- const H = (c = o.purchaseOrder) == null ? void 0 : c.supplier.internal;
1055
- if (H && (H == "restaurant" || H == "warehouse")) {
1056
- const ne = (E = o.purchaseOrder) == null ? void 0 : E.supplier._id, ce = `${H}_${ne}`, G = F.allLocations.find(
1057
- (re) => re.type === H && re.dbName === ce
1058
- );
1059
- if (G) {
1060
- const re = {
1061
- ...o.purchaseOrder.supplier,
1062
- name: G.doc.profile.name,
1063
- contactName: G.doc.profile.name,
1064
- email: G.doc.profile.email,
1065
- phoneNumber: G.doc.profile.phoneNo,
1066
- registrationNumber: G.doc.profile.regNo,
1067
- address: G.doc.profile.address,
1068
- preparationTime: G.preparationTime
1069
- };
1070
- t.supplier = re;
1071
- }
1072
- } else {
1073
- const ne = e.suppliers.find(
1074
- (ce) => {
1075
- var G;
1076
- return ce._id === ((G = o.purchaseOrder.supplier) == null ? void 0 : G._id);
1077
- }
1078
- );
1079
- t.supplier = ne ?? t.supplier;
1080
- }
1081
- if (!t.supplier)
1082
- throw new Error("Unable to resolve supplier from template");
1083
- }
1084
- }
1085
- }), Ke(() => {
1086
- var o;
1087
- try {
1088
- const c = I.skuById;
1089
- let E = t.items.map((H) => ({ ...H, id: H.id ?? H.sku._id }));
1090
- t.template && (t.items.length || (E = ((o = m.value) == null ? void 0 : o.purchaseOrder.items) ?? [])), t.items = E.filter((H) => !c[H.sku._id].isInactive && H.quantity.amount > 0);
1091
- } finally {
1092
- _.value = !0;
1093
- }
1094
- }), be([_, h], ([o, c], [E, H]) => {
1095
- c.value && H.value && x("form:ready");
1096
- });
1097
- const B = N(
1098
- () => F.currentLocation.type === Et.restaurant
1099
- );
1100
- F.watchLocation(async () => {
1101
- location && (t.supplier || (t.supplier = e.suppliers.find((o) => o) ?? t.supplier));
1102
- });
1103
- const Y = Wt(), Q = ns(
1104
- () => t,
1105
- (o) => {
1106
- Object.assign(t, o);
1107
- },
1108
- !0,
1109
- !0
1110
- ), K = N({
1111
- get() {
1112
- var o;
1113
- return typeof ((o = t == null ? void 0 : t.supplier) == null ? void 0 : o.internal) == "string" ? ae.TRANSFER : ae.PURCHASE;
1114
- },
1115
- set(o) {
1116
- var E;
1117
- const c = typeof ((E = t == null ? void 0 : t.supplier) == null ? void 0 : E.internal) == "string" ? ae.TRANSFER : ae.PURCHASE;
1118
- o !== c && (t.supplier = o === ae.PURCHASE ? Q.locationOptionsTypePurchase.value[0] : Q.locationOptionsTypeTransfer.value[0]);
1119
- }
1120
- });
1121
- be(
1122
- () => {
1123
- var o;
1124
- return (o = p.modelValue) == null ? void 0 : o.template;
1125
- },
1126
- (o) => {
1127
- u.mustUsePoTemplate && !o && It(() => {
1128
- var c, E;
1129
- t.supplier = ((E = (c = Q.locationOptionsTypeTransfer.value) == null ? void 0 : c.filter(
1130
- (H) => H.internal === "restaurant"
1131
- )) == null ? void 0 : E[0]) ?? t.supplier;
1132
- });
1133
- },
1134
- { immediate: !0 }
1135
- );
1136
- const O = N(() => {
1137
- let o = Q.transferLocationOptions.value;
1138
- return u.mustUsePoTemplate && !t.template && (o = o.filter((c) => {
1139
- var E;
1140
- return (E = c.sublabel) == null ? void 0 : E.startsWith("restaurant");
1141
- })), o;
1142
- }), U = N({
1143
- get() {
1144
- var o;
1145
- return (o = t.supplier) == null ? void 0 : o._id;
1146
- },
1147
- set(o) {
1148
- Q.transferLocationModel.value = o;
1149
- }
1150
- }), V = N({
1151
- get() {
1152
- return t.remark ?? void 0;
1153
- },
1154
- set(o) {
1155
- t.remark = o;
1156
- }
1157
- }), { backdatePo: d, backdateSwitch: b, backdateModel: R, backdateTimeModel: X } = Ms({
1158
- getEffectiveAt() {
1159
- return t.effectiveAt;
1160
- },
1161
- setEffectiveAt(o) {
1162
- t.effectiveAt = o;
1163
- }
1164
- }), { comparePricesToggle: Z, comparePriceFetching: he, comparePriceBySku: ke } = eo(), le = q();
1165
- C({
1166
- validateInputs: () => {
1167
- var o, c;
1168
- (c = (o = le.value) == null ? void 0 : o.validateInputs) == null || c.call(o);
1169
- },
1170
- resetInputsValidation: () => {
1171
- var o, c;
1172
- (c = (o = le.value) == null ? void 0 : o.resetInputsValidation) == null || c.call(o);
1173
- },
1174
- resetInputs: () => {
1175
- var o, c;
1176
- (c = (o = le.value) == null ? void 0 : o.resetInputs) == null || c.call(o);
1177
- }
1178
- });
1179
- const we = N(() => ({
1180
- updateItem: (o) => {
1181
- const c = Ot.parse(o);
1182
- t.items = t.items.map((E) => E.id && E.id !== o.id || !E.id && E.sku._id !== o.sku._id ? E : c);
1183
- },
1184
- deleteItem: (o) => {
1185
- t.items = t.items.filter(
1186
- (c) => c.id ? c.id !== o.id : c.sku._id !== o.sku._id
1187
- );
1188
- }
1189
- })), Ne = _s({
1190
- updateItem: (o) => we.value.updateItem(o),
1191
- deleteItem: (o) => we.value.deleteItem(o),
1192
- get supplier() {
1193
- return t.supplier;
1194
- },
1195
- get items() {
1196
- return t.items;
1197
- },
1198
- get transferType() {
1199
- return K.value;
1200
- },
1201
- get template() {
1202
- return m.value;
1203
- },
1204
- get disabled() {
1205
- return p.disabled;
1206
- },
1207
- get forecastAmounts() {
1208
- return r.value;
1209
- }
1210
- }), Be = N(() => Ne.columnDefs.value);
1211
- function ze() {
1212
- var re, Fe, He, Ae, je;
1213
- const o = (He = (Fe = (re = m.value) == null ? void 0 : re.purchaseOrder) == null ? void 0 : Fe.items) == null ? void 0 : He.groupBy((z) => z.sku._id), c = v.isEnabled ? v.getAvailableItems((je = (Ae = t.netSuite) == null ? void 0 : Ae.subsidiary) == null ? void 0 : je.id) : [], E = o != null && o.size ? I.skus.filter((z) => o.has(z._id)) : I.skus, H = v.isEnabled ? E.filter((z) => {
1214
- var ie, se, ue, pe;
1215
- const ee = (se = (ie = m.value) == null ? void 0 : ie.purchaseOrder) == null ? void 0 : se.items.find(
1216
- (ve) => ve.sku._id === z._id
1217
- );
1218
- if (ee != null && ee.measurement != null) {
1219
- const ve = v.getAvailableMeasurements(
1220
- ee.sku._id,
1221
- (pe = (ue = t.netSuite) == null ? void 0 : ue.subsidiary) == null ? void 0 : pe.id
1222
- );
1223
- return c.includes(ee.sku._id) && ve.includes(ee.measurement.id);
1224
- }
1225
- return c.includes(z._id);
1226
- }).map((z) => z._id) : E.map((z) => z._id), ne = E.map(
1227
- (z) => {
1228
- var ee, ie, se, ue;
1229
- return {
1230
- label: ((ie = (ee = o == null ? void 0 : o.get(z._id)) == null ? void 0 : ee[0]) == null ? void 0 : ie.name) ?? z.name,
1231
- sublabel: ((ue = (se = o == null ? void 0 : o.get(z._id)) == null ? void 0 : se[0]) == null ? void 0 : ue.code) ?? z.code,
1232
- value: z,
1233
- disabled: !!(!H.includes(z._id) || z.isInactive),
1234
- tags: z.isInactive ? ["Inactive"] : ["Active"]
1235
- };
1236
- }
1237
- ), ce = ne.filter((z) => {
1238
- var ee;
1239
- return (ee = t.items) == null ? void 0 : ee.find((ie) => ie.sku._id === z.value._id);
1240
- }).map((z) => z.value), G = [
1241
- {
1242
- type: "string",
1243
- key: "tags",
1244
- entity: "item",
1245
- values: ["Inactive", "Active"]
1246
- }
1247
- ];
1248
- Y.open({
1249
- title: f("inventory.transfer.form.items.selectItem"),
1250
- closeButton: !0,
1251
- contentComponent: ls,
1252
- contentComponentProps: {
1253
- modelValue: ce,
1254
- items: ne,
1255
- virtualScroll: !0,
1256
- filterAttributes: G
1257
- },
1258
- primaryActions: {
1259
- text: f("common.confirm"),
1260
- close: !0
1261
- },
1262
- secondaryActions: {
1263
- text: f("common.close"),
1264
- close: !0,
1265
- variant: "tertiary"
1266
- }
1267
- }).onPrimary((z) => {
1268
- const ee = t.items ?? [], ie = z.map((se) => {
1269
- var ve, Ie;
1270
- const ue = ee.find((_e) => _e.sku._id === se._id);
1271
- if (ue)
1272
- return ue;
1273
- const pe = ((Ie = (ve = m.value) == null ? void 0 : ve.purchaseOrder.items) == null ? void 0 : Ie.find(
1274
- (_e) => _e.sku._id === se._id
1275
- )) ?? {
1276
- sku: se,
1277
- code: se.code,
1278
- name: se.name,
1279
- quantity: {
1280
- amount: 1,
1281
- precision: 0
1282
- }
1283
- };
1284
- if (K.value == ae.PURCHASE) {
1285
- const { cost: _e } = $e(
1286
- pe.sku,
1287
- pe.quantity,
1288
- pe.measurement,
1289
- {
1290
- supplier: t.supplier
1291
- }
1292
- );
1293
- pe.totalCost = _e;
1294
- }
1295
- return pe;
1296
- });
1297
- ie.sort((se, ue) => se.sku.code.localeCompare(ue.sku.code)), t.items = ie;
1298
- });
1299
- }
1300
- function Pe(o) {
1301
- return o;
1302
- }
1303
- const Le = N(() => {
1304
- var o;
1305
- return m.value ? ((o = m.value) == null ? void 0 : o.purchaseOrder.items) || [] : I.skus.map((c) => ({
1306
- quantity: {
1307
- amount: 0,
1308
- precision: 0
1309
- },
1310
- name: c.name,
1311
- code: c.code,
1312
- sku: c,
1313
- quantityStep: {
1314
- amount: 0,
1315
- precision: 0
1316
- },
1317
- measurement: c.trackingMeasurement ? c.unit.measurements.find((E) => E.id === c.trackingMeasurement) : null
1318
- }));
1319
- }), Ve = N(() => {
1320
- const o = [];
1321
- return (!u.mustUsePoTemplate || u.mustUsePoTemplate && t.template) && o.push({
1322
- label: f("inventory.transfer.form.type.purchase"),
1323
- value: ae.PURCHASE
1324
- }), o.push({
1325
- label: f("inventory.transfer.form.type.transfer"),
1326
- value: ae.TRANSFER
1327
- }), o;
1328
- }), Re = N(() => {
1329
- var o;
1330
- return (o = p.modelValue) == null ? void 0 : o.items.every((c) => c.quantity.amount <= 0);
1331
- });
1332
- return (o, c) => {
1333
- var pe, ve;
1334
- const E = $("FmChip"), H = $("FmLabel"), ne = $("FmIcon"), ce = $("FmField"), G = $("FmTooltip"), re = $("FmSelect"), Fe = $("FmTextField"), He = $("FmTextarea"), Ae = $("FmSwitch"), je = $("FmDatePicker"), z = $("FmTimePicker"), ee = $("FmFormGroup"), ie = $("FmButton"), se = $("FmTable"), ue = $("FmForm");
1335
- return w(), T("div", mo, [
1336
- n("div", co, [
1337
- (pe = p.modelValue) != null && pe.template ? (w(), W(E, {
1338
- key: 0,
1339
- variant: o.disabled ? "warning" : void 0,
1340
- label: `${s(f)("inventory.transfer.template.title")}: ${((ve = m.value) == null ? void 0 : ve.name) ?? s(f)("inventory.transfer.form.loading")}`,
1341
- icon: "summarize",
1342
- compact: ""
1343
- }, null, 8, ["variant", "label"])) : j("", !0),
1344
- y(E, {
1345
- label: s(F).currentLocation.name,
1346
- icon: "storefront",
1347
- compact: ""
1348
- }, null, 8, ["label"]),
1349
- o.lastClosingDate ? (w(), W(E, {
1350
- key: 1,
1351
- label: `${s(f)("inventory.transfer.form.lastClosing")}: ${s(at)(o.lastClosingDate)} ${s(ds)(o.lastClosingDate)}`,
1352
- icon: "calendar_month",
1353
- compact: ""
1354
- }, null, 8, ["label"])) : j("", !0)
1355
- ]),
1356
- y(ue, {
1357
- ref_key: "formRef",
1358
- ref: le,
1359
- class: "flex flex-col gap-32",
1360
- disabled: o.disabled,
1361
- onValidationFailed: console.log,
1362
- onValidationSuccess: c[14] || (c[14] = (Ie) => x("validation-success"))
1363
- }, {
1364
- default: A(() => {
1365
- var Ie, _e, rt, lt, it, ut, dt, mt;
1366
- return [
1367
- n("div", po, [
1368
- n("div", fo, [
1369
- (Ie = p.modelValue) != null && Ie.template ? (w(), T(de, { key: 0 }, [
1370
- n("div", vo, [
1371
- y(H, {
1372
- label: s(f)("inventory.transfer.form.type.title")
1373
- }, null, 8, ["label"]),
1374
- n("div", yo, [
1375
- y(G, {
1376
- "z-index": 51,
1377
- placement: "left",
1378
- disabled: o.disabled
1379
- }, {
1380
- content: A(() => c[15] || (c[15] = [
1381
- Te("This field is locked from template.")
1382
- ])),
1383
- default: A(() => [
1384
- y(ce, null, {
1385
- default: A(() => [
1386
- n("div", bo, [
1387
- y(ne, {
1388
- name: "lock_outline",
1389
- size: "sm",
1390
- color: o.disabled ? "neutral-gray-200" : "neutral-gray-400"
1391
- }, null, 8, ["color"]),
1392
- n("div", {
1393
- class: J({ "text-fm-color-typo-disabled": o.disabled })
1394
- }, M(s(f)(`inventory.transfer.form.type.${K.value.toLocaleLowerCase("en-us")}`)), 3)
1395
- ])
1396
- ]),
1397
- _: 1
1398
- })
1399
- ]),
1400
- _: 1
1401
- }, 8, ["disabled"]),
1402
- n("div", {
1403
- class: J([
1404
- "fm-typo-en-body-sm-400",
1405
- o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
1406
- ])
1407
- }, null, 2)
1408
- ])
1409
- ]),
1410
- n("div", go, [
1411
- y(H, {
1412
- label: K.value === s(ae).PURCHASE ? s(f)("inventory.transfer.form.purchaseFrom") : s(f)("inventory.transfer.form.transferFrom")
1413
- }, null, 8, ["label"]),
1414
- n("div", _o, [
1415
- y(G, {
1416
- "z-index": 51,
1417
- placement: "left",
1418
- disabled: o.disabled
1419
- }, {
1420
- content: A(() => c[16] || (c[16] = [
1421
- Te("This field is locked from template.")
1422
- ])),
1423
- default: A(() => [
1424
- y(ce, null, {
1425
- default: A(() => {
1426
- var P;
1427
- return [
1428
- n("div", ho, [
1429
- y(ne, {
1430
- name: "lock_outline",
1431
- size: "sm",
1432
- color: o.disabled ? "neutral-gray-200" : "neutral-gray-400"
1433
- }, null, 8, ["color"]),
1434
- n("div", {
1435
- class: J({ "text-fm-color-typo-disabled": o.disabled })
1436
- }, M((P = O.value.find((oe) => oe.value === U.value)) == null ? void 0 : P.label), 3)
1437
- ])
1438
- ];
1439
- }),
1440
- _: 1
1441
- })
1442
- ]),
1443
- _: 1
1444
- }, 8, ["disabled"])
1445
- ])
1446
- ])
1447
- ], 64)) : (w(), T(de, { key: 1 }, [
1448
- y(re, {
1449
- label: s(f)("inventory.transfer.form.type.title"),
1450
- "label-mark": "required",
1451
- modelValue: K.value,
1452
- "onUpdate:modelValue": c[0] || (c[0] = (P) => K.value = P),
1453
- items: Ve.value,
1454
- rules: [s(qe)(1)(Ve.value)]
1455
- }, {
1456
- default: A(() => [
1457
- n("span", {
1458
- class: J([
1459
- "line-clamp-1 fm-typo-en-body-lg-400",
1460
- o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
1461
- ])
1462
- }, M(s(Mt)(K.value)), 3)
1463
- ]),
1464
- _: 1
1465
- }, 8, ["label", "modelValue", "items", "rules"]),
1466
- y(re, {
1467
- label: K.value === s(ae).PURCHASE ? s(f)("inventory.transfer.form.purchaseFrom") : s(f)("inventory.transfer.form.transferFrom"),
1468
- "label-mark": "required",
1469
- modelValue: U.value,
1470
- "onUpdate:modelValue": c[1] || (c[1] = (P) => U.value = P),
1471
- items: O.value,
1472
- rules: [s(qe)(1)(O.value)]
1473
- }, {
1474
- "menu-wrapper": A((P) => {
1475
- var oe, Ee;
1476
- return [
1477
- y(rs, Ge(P, {
1478
- items: O.value,
1479
- "model-value": (Ee = (oe = o.modelValue) == null ? void 0 : oe.supplier) == null ? void 0 : Ee._id
1480
- }), null, 16, ["items", "model-value"])
1481
- ];
1482
- }),
1483
- default: A(() => {
1484
- var P;
1485
- return [
1486
- n("span", {
1487
- class: J([
1488
- "line-clamp-1 fm-typo-en-body-lg-400",
1489
- o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
1490
- ])
1491
- }, M((P = O.value.find((oe) => oe.value === U.value)) == null ? void 0 : P.label), 3)
1492
- ];
1493
- }),
1494
- _: 1
1495
- }, 8, ["label", "modelValue", "items", "rules"])
1496
- ], 64)),
1497
- y(Fe, {
1498
- label: s(f)("inventory.transfer.form.reference"),
1499
- "label-mark": "optional",
1500
- modelValue: s(t).ref,
1501
- "onUpdate:modelValue": c[2] || (c[2] = (P) => s(t).ref = P)
1502
- }, null, 8, ["label", "modelValue"]),
1503
- y(He, {
1504
- label: s(f)("inventory.transfer.form.remark"),
1505
- "label-mark": "optional",
1506
- "max-length": 240,
1507
- modelValue: V.value,
1508
- "onUpdate:modelValue": c[3] || (c[3] = (P) => V.value = P),
1509
- class: J([o.disabled ? "text-fm-color-typo-disabled " : ""])
1510
- }, null, 8, ["label", "modelValue", "class"]),
1511
- _.value ? (w(), W(uo, {
1512
- key: 2,
1513
- required: s(t).template != null,
1514
- disabled: o.disabled,
1515
- supplier: s(t).supplier,
1516
- setting: s(t).netSuite,
1517
- items: s(t).items,
1518
- onChange: (P, oe) => {
1519
- s(t).items = P, s(t).netSuite = oe;
1520
- },
1521
- "onNetsuite:ready": c[4] || (c[4] = (P) => {
1522
- h.value = !0;
1523
- })
1524
- }, null, 8, ["required", "disabled", "supplier", "setting", "items", "onChange"])) : j("", !0),
1525
- s(u).enableBackdatePo ? (w(), T("div", ko, [
1526
- n("div", {
1527
- class: J([
1528
- "flex",
1529
- {
1530
- "flex-col": i.value
1531
- }
1532
- ])
1533
- }, [
1534
- y(Ae, {
1535
- modelValue: s(b),
1536
- "onUpdate:modelValue": c[5] || (c[5] = (P) => xe(b) ? b.value = P : null),
1537
- label: s(f)("inventory.transfer.form.backdate.title"),
1538
- sublabel: s(f)("inventory.transfer.form.backdate.subtitle"),
1539
- "label-placement": "right",
1540
- disabled: B.value && !o.lastClosingDate || o.disabled
1541
- }, null, 8, ["modelValue", "label", "sublabel", "disabled"]),
1542
- n("div", {
1543
- class: J({ hidden: i.value, "w-16": !i.value })
1544
- }, null, 2),
1545
- s(b) ? (w(), T("div", xo, [
1546
- n("div", Co, [
1547
- y(je, {
1548
- modelValue: s(R),
1549
- "onUpdate:modelValue": c[6] || (c[6] = (P) => xe(R) ? R.value = P : null)
1550
- }, null, 8, ["modelValue"])
1551
- ]),
1552
- n("div", So, [
1553
- y(z, {
1554
- modelValue: s(X),
1555
- "onUpdate:modelValue": c[7] || (c[7] = (P) => xe(X) ? X.value = P : null)
1556
- }, null, 8, ["modelValue"])
1557
- ])
1558
- ])) : j("", !0)
1559
- ], 2),
1560
- s(d) ? (w(), W(ee, {
1561
- key: 0,
1562
- modelValue: s(d),
1563
- "onUpdate:modelValue": c[8] || (c[8] = (P) => xe(d) ? d.value = P : null),
1564
- rules: [s(jt)(new Date(o.lastClosingDate), /* @__PURE__ */ new Date())]
1565
- }, null, 8, ["modelValue", "rules"])) : j("", !0),
1566
- B.value && !o.lastClosingDate ? (w(), T("div", wo, [
1567
- y(ne, {
1568
- name: "error",
1569
- size: "sm",
1570
- class: "text-fm-color-typo-warning"
1571
- }),
1572
- n("span", Fo, M(s(f)("inventory.transfer.form.backdate.error")), 1)
1573
- ])) : j("", !0)
1574
- ])) : j("", !0)
1575
- ])
1576
- ]),
1577
- n("div", Io, [
1578
- y(ee, {
1579
- "model-value": s(t).items,
1580
- rules: [s(qe)(1)]
1581
- }, null, 8, ["model-value", "rules"]),
1582
- n("div", {
1583
- class: J([
1584
- "flex gap-16",
1585
- {
1586
- "flex-col items-start": i.value,
1587
- "items-center": !i.value
1588
- }
1589
- ])
1590
- }, [
1591
- n("div", $o, M(s(f)("inventory.transfer.form.items.title")), 1),
1592
- n("div", To, [
1593
- y(ie, {
1594
- disabled: o.disabled,
1595
- label: s(f)("inventory.transfer.form.items.addItem"),
1596
- "prepend-icon": "add",
1597
- variant: "secondary",
1598
- "text-color": "primary",
1599
- "bg-color": "transparent",
1600
- "border-color": "primary",
1601
- onClick: c[9] || (c[9] = (P) => ze()),
1602
- size: "md"
1603
- }, null, 8, ["disabled", "label"]),
1604
- y(Ws, {
1605
- "template-id": s(t).template || void 0,
1606
- "template-items": Le.value,
1607
- "po-items": s(t).items,
1608
- "onUpdate:forecastAmounts": c[10] || (c[10] = (P) => {
1609
- r.value = P;
1610
- }),
1611
- "onUpdate:poItems": c[11] || (c[11] = (P) => {
1612
- s(t).items = P, S.value++;
1613
- })
1614
- }, null, 8, ["template-id", "template-items", "po-items"])
1615
- ])
1616
- ], 2),
1617
- K.value === s(ae).PURCHASE && D.value && s(u).enableTotalCost && ((_e = o.modelValue) != null && _e.items.length) ? (w(), T("div", Do, [
1618
- y(Ae, {
1619
- label: s(he) ? s(f)("inventory.transfer.form.items.fetchingData") : s(f)("inventory.transfer.form.items.comparePriceHistory"),
1620
- "prepend-icon": "compare_arrows",
1621
- "label-placement": "right",
1622
- "model-value": s(Z),
1623
- "onUpdate:modelValue": c[12] || (c[12] = (P) => xe(Z) ? Z.value = P : null),
1624
- disabled: s(he) || o.disabled
1625
- }, null, 8, ["label", "model-value", "disabled"])
1626
- ])) : j("", !0),
1627
- y(ee, {
1628
- "model-value": Re.value,
1629
- rules: [() => Re.value ? "Must have at least one non-zero item" : !0]
1630
- }, null, 8, ["model-value", "rules"]),
1631
- (w(), W(se, {
1632
- "column-defs": Be.value,
1633
- "column-visibility": {
1634
- [s(te).Code]: !(((rt = o.modelValue) == null ? void 0 : rt.template) ?? ((lt = o.modelValue) == null ? void 0 : lt.templateDoc)),
1635
- [s(te).Name]: !(((it = o.modelValue) == null ? void 0 : it.template) ?? ((ut = o.modelValue) == null ? void 0 : ut.templateDoc)),
1636
- [s(te).TemplateName]: !!(((dt = o.modelValue) == null ? void 0 : dt.template) ?? ((mt = o.modelValue) == null ? void 0 : mt.templateDoc))
1637
- },
1638
- "row-data": s(t).items,
1639
- key: S.value,
1640
- "hide-footer": "",
1641
- "page-size": s(t).items.length
1642
- }, {
1643
- "table-row": A((P) => {
1644
- var oe, Ee, ct, pt;
1645
- return [
1646
- y(ao, {
1647
- "compare-price-by-sku": s(ke),
1648
- "show-compare-price": K.value === s(ae).PURCHASE && s(Z),
1649
- row: P,
1650
- "template-item": (pt = (ct = (Ee = (oe = o.modelValue) == null ? void 0 : oe.templateDoc) == null ? void 0 : Ee.purchaseOrder) == null ? void 0 : ct.items) == null ? void 0 : pt.find(
1651
- (Xe) => Xe.sku._id === P.original.sku._id
1652
- ),
1653
- "onUpdate:item": c[13] || (c[13] = (Xe) => we.value.updateItem(Xe)),
1654
- disabled: o.disabled
1655
- }, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "template-item", "disabled"])
1656
- ];
1657
- }),
1658
- "list-row": A((P) => [
1659
- (w(), W(wt, {
1660
- row: P,
1661
- key: s(t).items.map((oe) => oe.sku._id).join(".")
1662
- }, {
1663
- default: A((oe) => [
1664
- y(Os, {
1665
- "compare-price-by-sku": s(ke),
1666
- "show-compare-price": K.value === s(ae).PURCHASE && s(Z),
1667
- row: P,
1668
- "cell-by-col-id": oe
1669
- }, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "cell-by-col-id"])
1670
- ]),
1671
- _: 2
1672
- }, 1032, ["row"]))
1673
- ]),
1674
- _: 1
1675
- }, 8, ["column-defs", "column-visibility", "row-data", "page-size"]))
1676
- ])
1677
- ];
1678
- }),
1679
- _: 1
1680
- }, 8, ["disabled", "onValidationFailed"])
1681
- ]);
1682
- };
1683
- }
1684
- }), Vo = { class: "flex items-center" }, Ro = { class: "fm-typo-en-title-md-800" }, Ao = { class: "flex gap-4" }, Eo = /* @__PURE__ */ me({
1685
- __name: "TransferDialog",
1686
- props: {
1687
- mode: {},
1688
- modelValue: {},
1689
- templateId: {},
1690
- show: { type: Boolean },
1691
- lastClosingDate: {}
1692
- },
1693
- emits: ["update:show", "submitted"],
1694
- setup(g, { expose: C, emit: l }) {
1695
- var V;
1696
- const p = g, x = l, t = nt(), f = Ct(), F = De(), I = ot(), v = et(), e = We(), { t: u } = ge(), k = q(!1), a = q(!1), i = q(!1);
1697
- async function h(d) {
1698
- if (d) {
1699
- a.value = !1;
1700
- try {
1701
- await I.readSuppliers(), a.value = !0;
1702
- } catch {
1703
- F.open({
1704
- title: u("inventory.transfer.form.unableToFetchListOfSuppliers.title"),
1705
- message: u("inventory.transfer.form.unableToFetchListOfSuppliers.message"),
1706
- type: "error"
1707
- });
1708
- }
1709
- }
1710
- }
1711
- e.watchLocation(h);
1712
- function _() {
1713
- return {
1714
- remark: void 0,
1715
- ref: void 0,
1716
- stockSnapshotId: void 0,
1717
- effectiveAt: void 0,
1718
- items: [],
1719
- supplier: {
1720
- _rev: void 0,
1721
- email: void 0,
1722
- internal: void 0,
1723
- contactName: void 0,
1724
- phoneNumber: void 0,
1725
- registrationNumber: void 0,
1726
- supplyItems: void 0,
1727
- _id: "",
1728
- name: "",
1729
- address: {
1730
- line2: void 0,
1731
- line1: "",
1732
- state: "",
1733
- city: "",
1734
- postcode: "",
1735
- country: ""
1736
- }
1737
- },
1738
- status: "DRAFT",
1739
- _id: "",
1740
- seqNumber: 0,
1741
- deliveryOrder: [],
1742
- template: p.templateId,
1743
- templateDoc: f.templates.find((b) => b._id === p.templateId)
1744
- };
1745
- }
1746
- const S = xt(p, "show"), r = q(p.modelValue ?? _()), m = q(((V = p.modelValue) == null ? void 0 : V._id) ?? `${Math.random()}`);
1747
- be(
1748
- () => p.show,
1749
- (d) => {
1750
- var b;
1751
- d && (i.value = !1, r.value = p.modelValue ?? _(), m.value = ((b = p.modelValue) == null ? void 0 : b._id) ?? `${Math.random()}`);
1752
- }
1753
- );
1754
- const D = N(() => !a.value || !i.value), B = N(() => {
1755
- switch (p.mode) {
1756
- case Oe.READ:
1757
- return "View transfer";
1758
- case Oe.CREATE:
1759
- return u("inventory.transfer.receiveRequest.create.title");
1760
- case Oe.UPDATE:
1761
- return u("inventory.transfer.receiveRequest.update.title");
1762
- }
1763
- return "";
1764
- }), Y = q();
1765
- C({
1766
- validateInputs: () => {
1767
- var d, b;
1768
- (b = (d = Y.value) == null ? void 0 : d.validateInputs) == null || b.call(d);
1769
- },
1770
- resetInputsValidation: () => {
1771
- var d, b;
1772
- (b = (d = Y.value) == null ? void 0 : d.resetInputsValidation) == null || b.call(d);
1773
- },
1774
- resetInputs: () => {
1775
- var d, b;
1776
- (b = (d = Y.value) == null ? void 0 : d.resetInputs) == null || b.call(d);
1777
- }
1778
- });
1779
- async function Q() {
1780
- const d = r.value;
1781
- if (k.value = !0, d.items = d.items.filter((b) => b.quantity.amount > 0), !d.items.length) {
1782
- F.open({
1783
- title: "Cannot create order",
1784
- message: "There are no items with non-zero amount in your request.",
1785
- type: "error"
1786
- });
1787
- return;
1788
- }
1789
- (d.supplier.internal === "warehouse" || d.supplier.internal === "restaurant") && (d.items = d.items.map(({ totalCost: b, ...R }) => R));
1790
- try {
1791
- await t.createPurchaseOrder(d), await new Promise((b) => setTimeout(b, 1e3)), F.open({
1792
- title: u("inventory.transfer.receiveRequest.create.success"),
1793
- message: u("inventory.transfer.receiveRequest.create.successMessage"),
1794
- type: "success"
1795
- }), x("update:show", !1), x("submitted");
1796
- } catch (b) {
1797
- F.open({
1798
- title: u("inventory.transfer.receiveRequest.create.error.title"),
1799
- message: u("inventory.transfer.receiveRequest.create.error.message"),
1800
- type: "error"
1801
- }), console.error("Error in creating purchase order", b);
1802
- } finally {
1803
- k.value = !1;
1804
- }
1805
- }
1806
- async function K() {
1807
- const d = r.value;
1808
- if (k.value = !0, d.items = d.items.filter((b) => b.quantity.amount > 0), !d.items.length) {
1809
- F.open({
1810
- title: "Cannot create order",
1811
- message: "There are no items with non-zero amount in your request.",
1812
- type: "error"
1813
- });
1814
- return;
1815
- }
1816
- (d.supplier.internal === "warehouse" || d.supplier.internal === "restaurant") && (d.items = d.items.map(({ totalCost: b, ...R }) => R));
1817
- try {
1818
- await t.updatePurchaseOrder(d), await new Promise((b) => setTimeout(b, 1e3)), F.open({
1819
- title: u("inventory.transfer.receiveRequest.update.success"),
1820
- message: u("inventory.transfer.receiveRequest.update.successMessage"),
1821
- type: "success"
1822
- }), x("update:show", !1), x("submitted");
1823
- } catch (b) {
1824
- F.open({
1825
- title: u("inventory.transfer.receiveRequest.update.error.title"),
1826
- message: u("inventory.transfer.receiveRequest.update.error.message"),
1827
- type: "error"
1828
- }), console.error("Error in updating purchase order", b);
1829
- } finally {
1830
- k.value = !1;
1831
- }
1832
- }
1833
- function O() {
1834
- switch (p.mode) {
1835
- case Oe.CREATE:
1836
- return Q();
1837
- case Oe.UPDATE:
1838
- return K();
1839
- }
1840
- }
1841
- function U() {
1842
- var R, X;
1843
- const d = as.validatePurchaseOrderItems({
1844
- skusById: v.skuById ?? {},
1845
- items: r.value.items ?? []
1846
- }), b = Object.values(d).flat();
1847
- if (b.length > 0) {
1848
- const Z = b[0];
1849
- F.open({
1850
- title: `[Row ${Z.index + 1}] "${Z.poItem.sku.name}"`,
1851
- message: `${Z.message}`,
1852
- type: "error"
1853
- });
1854
- return;
1855
- }
1856
- (X = (R = Y.value) == null ? void 0 : R.validateInputs) == null || X.call(R);
1857
- }
1858
- return (d, b) => {
1859
- const R = $("FmButton"), X = $("FmSideSheet");
1860
- return w(), W(X, {
1861
- modelValue: s(S),
1862
- "onUpdate:modelValue": b[3] || (b[3] = (Z) => xe(S) ? S.value = Z : null),
1863
- "dismiss-away": "",
1864
- "close-button": "",
1865
- "max-width": 900
1866
- }, {
1867
- "side-sheet-header": A(() => [
1868
- n("div", Vo, [
1869
- n("div", Ro, M(B.value), 1)
1870
- ])
1871
- ]),
1872
- default: A(() => [
1873
- (w(), W(Po, {
1874
- class: "w-full",
1875
- ref_key: "formRef",
1876
- ref: Y,
1877
- "onForm:ready": b[0] || (b[0] = () => i.value = !0),
1878
- onValidationSuccess: O,
1879
- modelValue: r.value,
1880
- "onUpdate:modelValue": b[1] || (b[1] = (Z) => r.value = Z),
1881
- disabled: k.value || D.value,
1882
- suppliers: s(I).suppliers,
1883
- skus: s(v).skus,
1884
- key: m.value,
1885
- "last-closing-date": d.lastClosingDate
1886
- }, null, 8, ["modelValue", "disabled", "suppliers", "skus", "last-closing-date"]))
1887
- ]),
1888
- "side-sheet-footer": A(() => [
1889
- n("div", Ao, [
1890
- y(R, {
1891
- loading: k.value,
1892
- disabled: D.value,
1893
- label: s(u)("common.save"),
1894
- onClick: U
1895
- }, null, 8, ["loading", "disabled", "label"]),
1896
- y(R, {
1897
- disabled: D.value,
1898
- variant: "tertiary",
1899
- label: s(u)("common.close"),
1900
- onClick: b[2] || (b[2] = (Z) => x("update:show", !1))
1901
- }, null, 8, ["disabled", "label"])
1902
- ])
1903
- ]),
1904
- _: 1
1905
- }, 8, ["modelValue"]);
1906
- };
1907
- }
1908
- });
1909
- function Oo(g) {
1910
- const [C, l, p, ...x] = ps(g), t = p.map((v) => v.toLowerCase().trim().replace(/ /g, "_")), F = ["item_name", "transfer_quantity(uom)", "uom", "scanned_code"].filter((v) => !t.includes(v));
1911
- if (F.length)
1912
- throw new Error(
1913
- `Missing headers (${F.join()}). Excel file does not come from the template.`
1914
- );
1915
- return x.map((v, e) => {
1916
- const u = {};
1917
- for (const k in t) {
1918
- const a = t[k];
1919
- Object.assign(u, { [a]: v[k] });
1920
- }
1921
- return {
1922
- index: e,
1923
- data: u
1924
- };
1925
- });
1926
- }
1927
- function Mo(g) {
1928
- const C = g.SheetNames;
1929
- try {
1930
- return C.reduce(
1931
- (p, x) => {
1932
- const t = new Array(), f = g.Sheets[x], F = et(), I = Oo(f), v = [];
1933
- for (const { index: u, data: k } of I) {
1934
- k.scanned_code === "" && t.push(`Row ${u + 1}: Scanned code is empty`), k.item_name === "" && t.push(`Row ${u + 1}: Item name is empty`), k.uom === "" && t.push(`Row ${u + 1}: UOM is empty`), k["transfer_quantity(uom)"] === "" && t.push(`Row ${u + 1}: Transfer quantity is empty`);
1935
- const a = F.skus.find((_) => _.code === k.scanned_code);
1936
- if (!a) {
1937
- t.push(`Row ${u + 1}: SKU not found`);
1938
- continue;
1939
- }
1940
- const i = a.unit.abbrev === k.uom;
1941
- let h = null;
1942
- if (!i) {
1943
- const _ = a.unit.measurements.find((S) => S.abbrev === k.uom);
1944
- if (!_) {
1945
- t.push(`Row ${u + 1}: Measurement not found`);
1946
- continue;
1947
- }
1948
- h = _;
1949
- }
1950
- v.push({
1951
- sku: a,
1952
- code: k.scanned_code,
1953
- name: k.item_name,
1954
- quantity: Je.fromNumber(Number(k["transfer_quantity(uom)"])),
1955
- measurement: h
1956
- });
1957
- }
1958
- const e = {
1959
- type: "create",
1960
- poItems: v,
1961
- excelSheetName: x,
1962
- errors: t
1963
- };
1964
- return p.importCreateResult.push(e), p;
1965
- },
1966
- {
1967
- invalidExcel: !1,
1968
- importCreateResult: new Array()
1969
- }
1970
- );
1971
- } catch (l) {
1972
- return {
1973
- invalidExcel: !0,
1974
- invalidExcelMessage: (l == null ? void 0 : l.message) ?? "Invalid excel",
1975
- importCreateResult: []
1976
- };
1977
- }
1978
- }
1979
- const qo = { class: "flex flex-col flex-1" }, Uo = { class: "flex flex-col" }, No = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Bo = {
1980
- key: 0,
1981
- class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
1982
- }, zo = { key: 0 }, Lo = {
1983
- class: /* @__PURE__ */ J(["fm-typo-en-body-lg-600"])
1984
- }, Ho = { class: "flex-1" }, jo = { class: "flex-auto line-clamp-2 text-ellipsis break-all fm-typo-en-body-sm-400" }, Yo = { class: "flex-auto line-clamp-2 text-ellipsis break-all" }, Qo = { class: "text-fm-color-typo-primary" }, Ko = { class: "ml-auto" }, Xo = { key: 0 }, Zo = /* @__PURE__ */ me({
1985
- __name: "XilnexResult",
1986
- props: {
1987
- type: {},
1988
- name: {},
1989
- items: {},
1990
- errors: {}
1991
- },
1992
- setup(g) {
1993
- const C = g, { t: l } = ge(), p = q(!1), x = () => {
1994
- C.errors.length && (p.value = !p.value);
1995
- };
1996
- return (t, f) => {
1997
- var v;
1998
- const F = $("FmIcon"), I = $("FmTooltip");
1999
- return w(), T("div", qo, [
2000
- n("div", {
2001
- onClick: x,
2002
- class: J({
2003
- "cursor-pointer": t.errors.length
2004
- })
2005
- }, [
2006
- n("div", Uo, [
2007
- n("div", No, [
2008
- n("div", {
2009
- class: J({
2010
- "text-fm-color-system-error-300": t.errors.length
2011
- })
2012
- }, [
2013
- Te(M(t.name) + " ", 1),
2014
- t.type === "create" ? (w(), T("span", Bo, "(" + M(s(l)("inventory.closing.template.import.new")) + ")", 1)) : j("", !0)
2015
- ], 2),
2016
- t.errors.length ? (w(), T("div", zo, [
2017
- y(F, {
2018
- name: "error",
2019
- size: "sm",
2020
- color: "system-error-300"
2021
- })
2022
- ])) : j("", !0)
2023
- ]),
2024
- f[0] || (f[0] = n("hr", { class: "my-2" }, null, -1)),
2025
- n("div", Lo, [
2026
- (v = t.items) != null && v.length ? (w(!0), T(de, { key: 0 }, Se(t.items, (e, u) => (w(), T("div", {
2027
- key: u,
2028
- class: "flex gap-4 mt-2 items-center"
2029
- }, [
2030
- n("div", Ho, [
2031
- y(I, {
2032
- content: e.code,
2033
- placement: "top",
2034
- "z-index": 51
2035
- }, {
2036
- default: A(() => [
2037
- n("span", jo, M(e.code), 1)
2038
- ]),
2039
- _: 2
2040
- }, 1032, ["content"]),
2041
- y(I, {
2042
- content: e.name,
2043
- placement: "top",
2044
- "z-index": 51
2045
- }, {
2046
- default: A(() => [
2047
- n("span", Yo, M(e.name), 1)
2048
- ]),
2049
- _: 2
2050
- }, 1032, ["content"])
2051
- ]),
2052
- n("div", null, [
2053
- n("span", Qo, M(s(Je).toFormatString({
2054
- value: e.quantity
2055
- })), 1),
2056
- Te(" " + M(e.measurement ? e.measurement.abbrev : e.sku.unit.abbrev), 1)
2057
- ])
2058
- ]))), 128)) : j("", !0)
2059
- ])
2060
- ]),
2061
- n("div", Ko, [
2062
- t.errors.length ? (w(), W(F, {
2063
- key: 0,
2064
- name: p.value ? "keyboard_arrow_up" : "keyboard_arrow_down",
2065
- size: "md"
2066
- }, null, 8, ["name"])) : j("", !0)
2067
- ])
2068
- ], 2),
2069
- p.value ? (w(), T("div", {
2070
- key: 0,
2071
- class: J(["flex flex-col gap-4 pl-8 fm-typo-en-body-sm-400", {
2072
- "text-fm-color-typo-secondary": !t.errors.length,
2073
- "text-fm-color-system-error-300": t.errors.length
2074
- }])
2075
- }, [
2076
- t.errors.length ? (w(), T("div", Xo, [
2077
- n("ol", null, [
2078
- (w(!0), T(de, null, Se(t.errors, (e, u) => (w(), T("li", { key: u }, M(e), 1))), 128))
2079
- ])
2080
- ])) : j("", !0)
2081
- ], 2)) : j("", !0)
2082
- ]);
2083
- };
2084
- }
2085
- }), Go = { class: "flex flex-col gap-24" }, Jo = {
2086
- key: 0,
2087
- class: "flex items-center gap-8"
2088
- }, Wo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ea = { class: "flex flex-col gap-8" }, ta = { class: "line-clamp-2 text-ellipsis break-all" }, sa = {
2089
- key: 2,
2090
- class: "shrink-0"
2091
- }, oa = {
2092
- key: 0,
2093
- class: "flex flex-col"
2094
- }, aa = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, na = {
2095
- key: 0,
2096
- class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
2097
- }, ra = { class: "fm-typo-en-body-lg-600" }, yt = "Transfer note", la = /* @__PURE__ */ me({
2098
- __name: "XilnexImportForm",
2099
- setup(g, { expose: C }) {
2100
- const l = q(null), p = De(), x = q(!1), t = q(!1), f = St(), F = q(!1), I = Ue();
2101
- q([]);
2102
- const v = N({
2103
- get() {
2104
- var r;
2105
- return ((r = f.supplier) == null ? void 0 : r.name) ?? "";
2106
- },
2107
- set(r) {
2108
- r && (f.supplier = {
2109
- name: r,
2110
- registrationNumber: "",
2111
- _id: "xilnex",
2112
- internal: "restaurant",
2113
- address: {
2114
- line1: "",
2115
- line2: "",
2116
- city: "",
2117
- state: "",
2118
- country: "",
2119
- postcode: ""
2120
- }
2121
- });
2122
- }
2123
- });
2124
- Ke(async () => {
2125
- const r = await I.getNetSuiteLocations();
2126
- console.log(r), F.value = !0;
2127
- });
2128
- const e = N({
2129
- get() {
2130
- return "";
2131
- },
2132
- set(r) {
2133
- if (r) {
2134
- const m = f.effectiveAt ? new Date(f.effectiveAt) : /* @__PURE__ */ new Date(), [D, B, Y] = r.split("-");
2135
- m.setFullYear(parseInt(D)), m.setMonth(parseInt(B) - 1), m.setDate(parseInt(Y)), f.effectiveAt = m.toISOString();
2136
- }
2137
- }
2138
- }), u = N({
2139
- get() {
2140
- return null;
2141
- },
2142
- set(r) {
2143
- if (r) {
2144
- const m = f.effectiveAt ? new Date(f.effectiveAt) : /* @__PURE__ */ new Date(), [D, B] = r.split(":");
2145
- m.setMinutes(parseInt(D)), m.setSeconds(parseInt(B)), f.effectiveAt = m.toISOString();
2146
- }
2147
- }
2148
- }), k = q(new Array()), a = q([]), i = N(
2149
- () => !!k.value.length || a.value.some((r) => r.errors.length)
2150
- ), h = q();
2151
- C({
2152
- validateInputs: () => {
2153
- var r, m;
2154
- (m = (r = h.value) == null ? void 0 : r.validateInputs) == null || m.call(r);
2155
- },
2156
- resetInputsValidation: () => {
2157
- var r, m;
2158
- (m = (r = h.value) == null ? void 0 : r.resetInputsValidation) == null || m.call(r);
2159
- },
2160
- resetInputs: () => {
2161
- var r, m;
2162
- (m = (r = h.value) == null ? void 0 : r.resetInputs) == null || m.call(r);
2163
- }
2164
- });
2165
- const { t: _ } = ge();
2166
- async function S(r) {
2167
- k.value = [], a.value = [];
2168
- try {
2169
- x.value = !0;
2170
- const [m] = await Promise.all([
2171
- fs(r),
2172
- // fake buffer
2173
- new Promise((B) => setTimeout(B, 1e3))
2174
- ]), D = Mo(m);
2175
- if (D.invalidExcel) {
2176
- k.value.push(
2177
- D.invalidExcelMessage ?? _("inventory.ingredient.import.fileError.invalidExcel")
2178
- );
2179
- return;
2180
- }
2181
- if (a.value = D.importCreateResult, !a.value.length) {
2182
- k.value.push(_("inventory.ingredient.import.fileError.noData"));
2183
- return;
2184
- }
2185
- f.items = a.value.map((B) => B.poItems).flat();
2186
- } catch (m) {
2187
- p.open({
2188
- title: _("inventory.ingredient.import.fileError.unableToRead"),
2189
- message: m == null ? void 0 : m.message,
2190
- type: "error"
2191
- }), console.error("Error in reading file", m);
2192
- } finally {
2193
- k.value.length && p.open({
2194
- title: _("inventory.ingredient.import.fileError.invalidExcel"),
2195
- type: "error"
2196
- }), x.value = !1;
2197
- }
2198
- }
2199
- return be(l, (r) => {
2200
- r && S(r);
2201
- }), (r, m) => {
2202
- const D = $("FmSelect"), B = $("FmDatePicker"), Y = $("FmTimePicker"), Q = $("FmCircularProgress"), K = $("FmLabel"), O = $("FmIcon"), U = $("FmButton"), V = $("FmForm");
2203
- return w(), W(V, {
2204
- ref_key: "formRef",
2205
- ref: h
2206
- }, {
2207
- default: A(() => [
2208
- n("div", Go, [
2209
- y(D, {
2210
- modelValue: v.value,
2211
- "onUpdate:modelValue": m[0] || (m[0] = (d) => v.value = d),
2212
- label: "Transfer from",
2213
- searchable: "",
2214
- searchTarget: "label",
2215
- items: [
2216
- { label: "Object", value: null },
2217
- { label: "Array", value: ["array", "1"] },
2218
- { label: "Number", value: 3 },
2219
- { label: "String", value: "4" },
2220
- { label: "1", value: "5" },
2221
- { label: "2", value: "6" }
2222
- ],
2223
- "helper-text": "Helper",
2224
- rules: [s(Me)()]
2225
- }, null, 8, ["modelValue", "rules"]),
2226
- y(B, {
2227
- modelValue: e.value,
2228
- "onUpdate:modelValue": m[1] || (m[1] = (d) => e.value = d),
2229
- label: "Transfer date",
2230
- rules: [s(Me)()]
2231
- }, null, 8, ["modelValue", "rules"]),
2232
- y(Y, {
2233
- modelValue: u.value,
2234
- "onUpdate:modelValue": m[2] || (m[2] = (d) => u.value = d),
2235
- label: "Transfer time",
2236
- rules: [s(Me)()]
2237
- }, null, 8, ["modelValue", "rules"]),
2238
- t.value ? (w(), T("div", Jo, [
2239
- n("div", null, [
2240
- y(Q, {
2241
- size: "md",
2242
- color: "neutral-gray-200"
2243
- })
2244
- ]),
2245
- n("div", Wo, M(s(_)("inventory.formField.loading")), 1)
2246
- ])) : (w(), T(de, { key: 1 }, [
2247
- y(vs, {
2248
- "max-file-size": 5,
2249
- class: J({
2250
- "w-full": !0,
2251
- "h-[200px]": !l.value
2252
- }),
2253
- accept: ".xlsx,.xls",
2254
- label: yt,
2255
- onFileUpload: m[3] || (m[3] = (d) => l.value = d),
2256
- "button-label": s(_)("inventory.ingredient.import.selectFile")
2257
- }, $t({ _: 2 }, [
2258
- l.value ? {
2259
- name: "default",
2260
- fn: A(({ openFileDialog: d }) => [
2261
- y(K, null, {
2262
- default: A(() => [
2263
- Te(M(yt))
2264
- ]),
2265
- _: 1
2266
- }),
2267
- n("div", ea, [
2268
- n("div", {
2269
- class: J([
2270
- "fm-corner-radius-md p-16 flex items-center gap-16",
2271
- {
2272
- "border border-fm-color-neutral-gray-100": x.value,
2273
- "border border-fm-color-neutral-gray-200": !x.value && !i.value,
2274
- "border border-fm-color-system-error-200": i.value
2275
- }
2276
- ])
2277
- }, [
2278
- x.value ? (w(), W(Q, {
2279
- key: 0,
2280
- size: "md",
2281
- color: "neutral-gray-200"
2282
- })) : (w(), W(O, {
2283
- key: 1,
2284
- name: i.value ? "error" : "attach_file",
2285
- outline: "",
2286
- color: i.value ? "system-error-300" : void 0
2287
- }, null, 8, ["name", "color"])),
2288
- n("div", {
2289
- class: J([
2290
- "fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
2291
- {
2292
- "text-fm-color-typo-disabled": x.value,
2293
- "text-fm-color-typo-primary": !x.value
2294
- }
2295
- ])
2296
- }, [
2297
- n("div", ta, M(l.value.name), 1)
2298
- ], 2),
2299
- x.value ? j("", !0) : (w(), T("div", sa, [
2300
- y(U, {
2301
- label: s(_)("inventory.ingredient.import.replaceFile"),
2302
- variant: i.value ? "destructive" : "secondary",
2303
- "prepend-icon": i.value ? void 0 : "autorenew",
2304
- onClick: d
2305
- }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
2306
- ]))
2307
- ], 2),
2308
- k.value.length ? (w(), T("div", oa, [
2309
- (w(!0), T(de, null, Se(k.value, (b, R) => (w(), T("div", {
2310
- key: R,
2311
- class: "flex gap-8 items-center"
2312
- }, [
2313
- y(O, {
2314
- name: "error",
2315
- size: "sm",
2316
- color: "system-error-300"
2317
- }),
2318
- n("div", aa, M(b), 1)
2319
- ]))), 128))
2320
- ])) : j("", !0)
2321
- ])
2322
- ]),
2323
- key: "0"
2324
- } : void 0
2325
- ]), 1032, ["class", "button-label"]),
2326
- l.value ? (w(), T("div", na, [
2327
- n("div", ra, M(s(_)("inventory.ingredient.import.summary")), 1),
2328
- (w(!0), T(de, null, Se(a.value, (d, b) => (w(), W(Zo, {
2329
- key: b,
2330
- name: `Transfer Note ${b + 1}`,
2331
- items: d.poItems,
2332
- errors: d.errors,
2333
- type: "create"
2334
- }, null, 8, ["name", "items", "errors"]))), 128))
2335
- ])) : j("", !0)
2336
- ], 64))
2337
- ])
2338
- ]),
2339
- _: 1
2340
- }, 512);
2341
- };
2342
- }
2343
- }), ia = { class: "w-[480px]" }, ua = /* @__PURE__ */ me({
2344
- __name: "XilnexImportDialog",
2345
- props: {
2346
- show: { type: Boolean }
2347
- },
2348
- emits: ["update:show", "submitted"],
2349
- setup(g, { expose: C, emit: l }) {
2350
- const p = l, t = xt(g, "show"), f = De(), F = nt(), I = q(!1), v = q(), e = q();
2351
- C({
2352
- validateInputs: () => {
2353
- var a, i;
2354
- (i = (a = v.value) == null ? void 0 : a.validateInputs) == null || i.call(a);
2355
- },
2356
- resetInputsValidation: () => {
2357
- var a, i;
2358
- (i = (a = v.value) == null ? void 0 : a.resetInputsValidation) == null || i.call(a);
2359
- },
2360
- resetInputs: () => {
2361
- var a, i;
2362
- (i = (a = v.value) == null ? void 0 : a.resetInputs) == null || i.call(a);
2363
- }
2364
- });
2365
- function u() {
2366
- var a, i;
2367
- (i = (a = v.value) == null ? void 0 : a.validateInputs) == null || i.call(a);
2368
- }
2369
- async function k() {
2370
- var i, h, _, S, r;
2371
- if (!((h = (i = e.value) == null ? void 0 : i.supplier) != null && h.name)) {
2372
- f.open({
2373
- title: "Upload failed",
2374
- message: "Location is required",
2375
- type: "error"
2376
- });
2377
- return;
2378
- }
2379
- if (!((_ = e.value) != null && _.items) || ((r = (S = e.value) == null ? void 0 : S.items) == null ? void 0 : r.length) === 0) {
2380
- f.open({
2381
- title: "Upload failed",
2382
- message: "No data to upload",
2383
- type: "error"
2384
- });
2385
- return;
2386
- }
2387
- const a = e.value.effectiveAt ? new Date(e.value.effectiveAt) : null;
2388
- if (!a) {
2389
- f.open({
2390
- title: "Invalid date",
2391
- message: "Transfer date is required",
2392
- type: "error"
2393
- });
2394
- return;
2395
- }
2396
- if (a.getTime() > (/* @__PURE__ */ new Date()).getTime()) {
2397
- f.open({
2398
- title: "Invalid date",
2399
- message: "Transfer date cannot be in the future",
2400
- type: "error"
2401
- });
2402
- return;
2403
- }
2404
- I.value = !0;
2405
- try {
2406
- await F.importFromXilnex(e.value), p("update:show", !1);
2407
- } catch (m) {
2408
- await new Promise((D) => setTimeout(D, 1e3)), f.open({
2409
- title: "Upload failed",
2410
- message: m == null ? void 0 : m.message,
2411
- type: "error"
2412
- });
2413
- } finally {
2414
- I.value = !1;
2415
- }
2416
- }
2417
- return (a, i) => {
2418
- const h = $("FmSpacer"), _ = $("FmButton"), S = $("FmDialog");
2419
- return w(), W(S, {
2420
- modelValue: s(t),
2421
- "onUpdate:modelValue": i[2] || (i[2] = (r) => xe(t) ? t.value = r : null),
2422
- overlay: !0,
2423
- "close-button": !1
2424
- }, {
2425
- "dialog-header": A(() => i[3] || (i[3] = [
2426
- n("div", null, "Xilnex transfer order", -1)
2427
- ])),
2428
- "dialog-footer": A(() => [
2429
- y(h, { class: "sm:hidden xs:hidden" }),
2430
- y(_, {
2431
- disabled: I.value,
2432
- class: "sm:w-full xs:w-full",
2433
- label: "Cancel",
2434
- size: "md",
2435
- variant: "tertiary",
2436
- onClick: i[1] || (i[1] = (r) => p("update:show", !1))
2437
- }, null, 8, ["disabled"]),
2438
- y(_, {
2439
- disabled: I.value,
2440
- loading: I.value,
2441
- class: "sm:w-full xs:w-full",
2442
- label: "Upload",
2443
- size: "md",
2444
- variant: "primary",
2445
- onClick: u
2446
- }, null, 8, ["disabled", "loading"])
2447
- ]),
2448
- default: A(() => [
2449
- n("div", ia, [
2450
- y(la, {
2451
- ref_key: "formRef",
2452
- ref: v,
2453
- onValidationSuccess: k,
2454
- modelValue: e.value,
2455
- "onUpdate:modelValue": i[0] || (i[0] = (r) => e.value = r)
2456
- }, null, 8, ["modelValue"])
2457
- ])
2458
- ]),
2459
- _: 1
2460
- }, 8, ["modelValue"]);
2461
- };
2462
- }
2463
- }), da = { class: "flex flex-col py-8" }, ma = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ca = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, pa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1" }, fa = {
2464
- key: 0,
2465
- class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1"
2466
- }, va = { class: "pt-8" }, bt = "ReceiveRequestViewSearchCriteria", ja = /* @__PURE__ */ me({
2467
- __name: "ReceiveRequestView",
2468
- setup(g) {
2469
- const { t: C } = ge(), l = De();
2470
- Ye.object({
2471
- name: Ye.string().optional().nullable(),
2472
- startDate: Ye.string().optional().nullable(),
2473
- endDate: Ye.string().optional().nullable()
2474
- });
2475
- const p = N(
2476
- () => !k._currentLocation || e.loading.value
2477
- ), x = Xt(), t = st(), f = Ue();
2478
- function F() {
2479
- const O = {
2480
- name: "",
2481
- ...ft()
2482
- }, U = x.getItem(bt);
2483
- if (!U)
2484
- return O;
2485
- try {
2486
- return JSON.parse(U);
2487
- } catch {
2488
- return O;
2489
- }
2490
- }
2491
- function I() {
2492
- x.setItem(bt, JSON.stringify(v.value));
2493
- }
2494
- const v = q(F()), e = Ut(
2495
- Ze.RECEIVE_REQUEST,
2496
- v.value
2497
- ), { columnDefs: u } = Nt(
2498
- Ze.RECEIVE_REQUEST,
2499
- e,
2500
- e.shipments
2501
- ), k = We();
2502
- async function a() {
2503
- const O = `inventory-record_${vt(v.value.startDate).format("DD-MM-YYYY_HH-mm")}-${vt(v.value.endDate).format("DD-MM-YYYY_HH-mm")}.xlsx`, U = e.purchaseOrders.value.flatMap(
2504
- (d) => d.items.map((b) => {
2505
- var le;
2506
- const R = new Date(Qt(d._id) ?? ""), X = d.effectiveAt ? new Date(d.effectiveAt) : void 0, Z = Ce(
2507
- zt(b.sku, d.deliveryOrder || [])
2508
- ), he = Ce(b.quantity), ke = ((le = b == null ? void 0 : b.measurement) == null ? void 0 : le.abbrev) || b.sku.unit.abbrev;
2509
- return {
2510
- "SKU code": b.code,
2511
- "SKU name": b.name,
2512
- "PO #": d.seqNumber,
2513
- "Effective at": X,
2514
- Date: R,
2515
- Status: d.status,
2516
- Reference: d.ref ?? "",
2517
- "Received quantity": Z,
2518
- "Ordered quantity": he,
2519
- Unit: ke,
2520
- "Total cost": b.totalCost ? Qe(b.totalCost) : null
2521
- };
2522
- })
2523
- ), V = [
2524
- "SKU code",
2525
- "SKU name",
2526
- "PO #",
2527
- "Date",
2528
- "Status",
2529
- "Reference",
2530
- "Received quantity",
2531
- "Ordered quantity",
2532
- "Unit"
2533
- ];
2534
- t.enableBackdatePo && V.insert("Effective at", 4), t.enableTotalCost && V.push("Total cost"), await Kt(
2535
- [
2536
- {
2537
- name: "purchases",
2538
- data: U,
2539
- columns: V
2540
- }
2541
- ],
2542
- O
2543
- ), l.open({
2544
- title: C("inventory.transfer.receiveRequest.export.success"),
2545
- message: C("inventory.transfer.receiveRequest.export.message", [O]),
2546
- type: "success"
2547
- });
2548
- }
2549
- const i = q(ft()), h = q("");
2550
- be([() => i.value], ([O]) => {
2551
- !O.startDate || !O.endDate || (v.value.startDate = O.startDate, v.value.endDate = O.endDate, e.updateDateRange(
2552
- v.value.startDate,
2553
- v.value.endDate
2554
- ), I());
2555
- }), be([() => h.value], () => {
2556
- I();
2557
- });
2558
- function _(O) {
2559
- if (O === "create") {
2560
- if (p.value) {
2561
- l.open({
2562
- title: "Loading data...",
2563
- message: "Please wait.",
2564
- type: "info"
2565
- });
2566
- return;
2567
- }
2568
- return e.promptCreateTransferDialog();
2569
- }
2570
- if (O === "upload" && t.enableXilnexTransferNote)
2571
- return e.promptUploadTransferDialog();
2572
- if (O === "refresh")
2573
- return e.fetchData();
2574
- if (O === "export")
2575
- return a();
2576
- }
2577
- const { breakpoints: S } = tt(), r = N(() => S.value.xs || S.value.sm), m = N(() => r.value ? 10 : 20), D = Zt(), B = N(() => [
2578
- {
2579
- label: C("inventory.transfer.receiveRequest.actions.create"),
2580
- value: "create",
2581
- isPrimary: !0,
2582
- prependIcon: "add"
2583
- },
2584
- ...t.enableXilnexTransferNote ? [
2585
- {
2586
- label: C("inventory.common.upload"),
2587
- value: "upload"
2588
- }
2589
- ] : [],
2590
- {
2591
- label: C("inventory.common.refresh"),
2592
- value: "refresh"
2593
- },
2594
- {
2595
- label: C("inventory.common.export"),
2596
- value: "export"
2597
- }
2598
- ]), Y = N(() => {
2599
- const O = [
2600
- {
2601
- type: "string",
2602
- key: "status",
2603
- entity: "purchaseOrder",
2604
- values: Array.from(
2605
- new Set(e.purchaseOrders.value.map((V) => V.status))
2606
- )
2607
- }
2608
- ], U = [
2609
- {
2610
- type: "string",
2611
- key: "netsuiteTransactionNumber",
2612
- entity: "purchaseOrder",
2613
- values: e.purchaseOrders.value.map((V) => {
2614
- var d, b;
2615
- return (b = (d = V.netSuite) == null ? void 0 : d.additionalInfo) == null ? void 0 : b.transactionnumber;
2616
- }).filter((V) => V != null)
2617
- },
2618
- {
2619
- type: "string",
2620
- key: "netsuiteOrderNo",
2621
- entity: "purchaseOrder",
2622
- values: e.purchaseOrders.value.map((V) => {
2623
- var d;
2624
- return (d = V.netSuite) == null ? void 0 : d.refNo;
2625
- }).filter((V) => V != null)
2626
- },
2627
- {
2628
- type: "string",
2629
- key: "netsuiteOrderId",
2630
- entity: "purchaseOrder",
2631
- values: e.purchaseOrders.value.map((V) => {
2632
- var d;
2633
- return (d = V.netSuite) == null ? void 0 : d.id;
2634
- }).filter((V) => V != null)
2635
- }
2636
- ];
2637
- return [...O, ...f.isEnabled ? U : []];
2638
- }), Q = q(null), K = N(() => {
2639
- if (!Q.value)
2640
- return e.purchaseOrders.value;
2641
- const O = ys.build(Q.value);
2642
- return e.purchaseOrders.value.filter((U) => {
2643
- var V, d, b, R;
2644
- return bs(
2645
- {
2646
- netsuiteTransactionNumber: (d = (V = U.netSuite) == null ? void 0 : V.additionalInfo) == null ? void 0 : d.transactionnumber,
2647
- netsuiteOrderNo: (b = U.netSuite) == null ? void 0 : b.refNo,
2648
- netsuiteOrderId: (R = U.netSuite) == null ? void 0 : R.id,
2649
- status: U.status
2650
- },
2651
- O
2652
- );
2653
- });
2654
- });
2655
- return (O, U) => {
2656
- const V = $("FmTable");
2657
- return w(), W(Gt, {
2658
- title: s(C)("inventory.transfer.receiveRequest.title2"),
2659
- actions: B.value,
2660
- "onClick:action": _
2661
- }, {
2662
- default: A(() => {
2663
- var d, b;
2664
- return [
2665
- n("div", {
2666
- class: J([
2667
- "flex flex-col gap-8 max-h-full",
2668
- {
2669
- "p-0": r.value,
2670
- "px-24 ": !r.value
2671
- }
2672
- ])
2673
- }, [
2674
- y(qt, {
2675
- "date-range-query": "",
2676
- "date-range": i.value,
2677
- "onUpdate:dateRange": U[0] || (U[0] = (R) => i.value = R),
2678
- searchable: "",
2679
- "change-location": "",
2680
- search: h.value,
2681
- "onUpdate:search": U[1] || (U[1] = (R) => h.value = R),
2682
- filterable: "",
2683
- "filter-attributes": Y.value,
2684
- filter: Q.value,
2685
- "onUpdate:filter": U[2] || (U[2] = (R) => Q.value = R)
2686
- }, null, 8, ["date-range", "search", "filter-attributes", "filter"]),
2687
- (w(), W(V, {
2688
- style: _t(s(D).tableHeight),
2689
- "column-defs": s(u),
2690
- "row-data": K.value,
2691
- "search-value": h.value,
2692
- loading: p.value,
2693
- onRowClick: U[3] || (U[3] = (R) => s(e).promptShowTransferDetails(R.original)),
2694
- key: (d = s(k)._currentLocation) == null ? void 0 : d.dbName,
2695
- "page-size": m.value
2696
- }, {
2697
- "list-row": A((R) => [
2698
- y(wt, {
2699
- row: R,
2700
- onRowClick: s(e).promptShowTransferDetails
2701
- }, {
2702
- default: A((X) => {
2703
- var Z, he, ke, le, we, Ne, Be, ze, Pe, Le, Ve, Re, o, c, E, H, ne, ce, G, re;
2704
- return [
2705
- n("div", da, [
2706
- n("div", ma, [
2707
- y(s(fe), {
2708
- render: (ke = (he = (Z = X._id) == null ? void 0 : Z.column) == null ? void 0 : he.columnDef) == null ? void 0 : ke.cell,
2709
- props: (we = (le = X._id) == null ? void 0 : le.getContext) == null ? void 0 : we.call(le)
2710
- }, null, 8, ["render", "props"])
2711
- ]),
2712
- n("div", ca, [
2713
- y(s(fe), {
2714
- render: (ze = (Be = (Ne = X.supplier_name) == null ? void 0 : Ne.column) == null ? void 0 : Be.columnDef) == null ? void 0 : ze.cell,
2715
- props: (Le = (Pe = X.supplier_name) == null ? void 0 : Pe.getContext) == null ? void 0 : Le.call(Pe)
2716
- }, null, 8, ["render", "props"])
2717
- ]),
2718
- n("div", pa, M(R.original.items.map((Fe) => `${Fe.name}`).join(", ")), 1),
2719
- R.original.ref ? (w(), T("div", fa, [
2720
- y(s(fe), {
2721
- render: (o = (Re = (Ve = X.ref) == null ? void 0 : Ve.column) == null ? void 0 : Re.columnDef) == null ? void 0 : o.cell,
2722
- props: (E = (c = X.ref) == null ? void 0 : c.getContext) == null ? void 0 : E.call(c)
2723
- }, null, 8, ["render", "props"])
2724
- ])) : j("", !0),
2725
- n("div", va, [
2726
- y(s(fe), {
2727
- render: (ce = (ne = (H = X.status) == null ? void 0 : H.column) == null ? void 0 : ne.columnDef) == null ? void 0 : ce.cell,
2728
- props: (re = (G = X.status) == null ? void 0 : G.getContext) == null ? void 0 : re.call(G)
2729
- }, null, 8, ["render", "props"])
2730
- ])
2731
- ])
2732
- ];
2733
- }),
2734
- _: 2
2735
- }, 1032, ["row", "onRowClick"])
2736
- ]),
2737
- _: 1
2738
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
2739
- ], 2),
2740
- (w(), W(Tt, { to: "body" }, [
2741
- y(Eo, Ge(s(e).transferDialogProps.value, {
2742
- onSubmitted: s(e).fetchData
2743
- }), null, 16, ["onSubmitted"]),
2744
- y(Bt, Ge({
2745
- scope: s(Ze).RECEIVE_REQUEST
2746
- }, {
2747
- ...s(e).transferDetailsProps.value,
2748
- receivedMap: ((b = s(e).transferDetailsProps.value) == null ? void 0 : b.receivedMap) ?? {},
2749
- shipments: s(e).shipments.value ?? []
2750
- }, {
2751
- onSubmitted: s(e).fetchData
2752
- }), null, 16, ["scope", "onSubmitted"]),
2753
- y(ua, Dt(Pt(s(e).xilnexImportDialogProps.value)), null, 16)
2754
- ]))
2755
- ];
2756
- }),
2757
- _: 1
2758
- }, 8, ["title", "actions"]);
2759
- };
2760
- }
2761
- });
2762
- export {
2763
- ja as default
2764
- };