@feedmepos/mf-inventory-portal 0.0.25-dev.25 → 0.0.25-dev.26

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