@feedmepos/mf-inventory-portal 0.0.19-dev.15 → 0.0.19-dev.17

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 (48) hide show
  1. package/dist/{ApprovalView-CRHU3Bv0.js → ApprovalView-YVJ8rI2M.js} +5 -5
  2. package/dist/{BindingsDialog-ChIRg0d3.js → BindingsDialog-C7ZO5bXe.js} +9 -9
  3. package/dist/{BindingsPicker-BJAbeiDf.js → BindingsPicker-BDsVbM3L.js} +1 -1
  4. package/dist/{BindingsTable-5MxWD_qa.js → BindingsTable-BiVQ4mvK.js} +1 -1
  5. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-vuSl8LVG.js +308 -0
  6. package/dist/{IngredientsView-qXrDtzSK.js → IngredientsView-CKDZsR2e.js} +5 -5
  7. package/dist/{IntegrationView-D6yFqod1.js → IntegrationView-DQZeJKul.js} +2 -2
  8. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DGurlvYg.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DDcFEUcz.js} +1 -1
  9. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-2Ady4pB4.js → PremiumBadge.vue_vue_type_script_setup_true_lang-6plo8rnV.js} +1 -1
  10. package/dist/{PurchaseOrderPrintPreview-BWwjMRqb.js → PurchaseOrderPrintPreview-Df-gYZFA.js} +1 -1
  11. package/dist/{ReceiveRequestView-C94SWDaj.js → ReceiveRequestView-CxW1ONAk.js} +8 -8
  12. package/dist/{RecipeView-CG9H_ZOo.js → RecipeView-B8eIaR2f.js} +4 -4
  13. package/dist/{StockView-BdXGfDNl.js → StockView-CqgqPyvI.js} +8 -8
  14. package/dist/SupplierView-CPHQT1Hn.js +817 -0
  15. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DktBkwCx.js → TransferDetails.vue_vue_type_script_setup_true_lang-CBmoU3pN.js} +4 -4
  16. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-DV6IxKMM.js +1435 -0
  17. package/dist/TransferTemplateView-BR2-tTiQ.js +1290 -0
  18. package/dist/{UnitView-Dx2vWJXi.js → UnitView-vUCf46QM.js} +5 -5
  19. package/dist/{WarehouseView-UkmUZnqH.js → WarehouseView-B3D5kkAU.js} +3 -3
  20. package/dist/api/purchase-order-template.d.ts +4 -0
  21. package/dist/api/supplier.d.ts +6 -4
  22. package/dist/{app-BLzTa0Ut.js → app-Ds9lsiAo.js} +5542 -5522
  23. package/dist/app.js +1 -1
  24. package/dist/{array-AvWd53LI.js → array-ClJzD_Lt.js} +3 -3
  25. package/dist/components/ChangeLocationComponent.vue.d.ts +14 -11
  26. package/dist/components/FmInventoryTableToolbar.vue.d.ts +0 -2
  27. package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
  28. package/dist/{decimal-DLYVb_I_.js → decimal-BZJuYjv-.js} +1 -1
  29. package/dist/format-unit-display-Dw4iQUDG.js +707 -0
  30. package/dist/{id-to-date-CKplrnj_.js → id-to-date-CLG4t5Zp.js} +1 -1
  31. package/dist/layout/SingleColumnLayout.vue.d.ts +1 -0
  32. package/dist/{layout-B9sdKjL9.js → layout-b03Lvqhx.js} +1 -1
  33. package/dist/stores/feature.d.ts +1 -0
  34. package/dist/stores/location.d.ts +1 -0
  35. package/dist/stores/supplier.d.ts +9 -9
  36. package/dist/supplier-C9OQNEl0.js +69 -0
  37. package/dist/tsconfig.app.tsbuildinfo +1 -1
  38. package/dist/views/supplier/components/SupplierDialogProps.d.ts +0 -1
  39. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +583 -1
  40. package/dist/{xlsx-C3AV6UrJ.js → xlsx-B5RUBjKV.js} +1209 -1209
  41. package/dist/{xlsx.util-slrhXhsk.js → xlsx.util-H2UkpLte.js} +4 -4
  42. package/package.json +3 -3
  43. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0j4VOis.js +0 -306
  44. package/dist/SupplierView-ClL2oc8K.js +0 -813
  45. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-BE95F9r1.js +0 -1437
  46. package/dist/TransferTemplateView-BXrNS8pg.js +0 -1279
  47. package/dist/format-unit-display-D_Z4TNZd.js +0 -668
  48. package/dist/supplier-BZ6HZcYB.js +0 -60
@@ -1,1279 +0,0 @@
1
- import { defineComponent as W, onMounted as Ve, computed as M, ref as U, watch as ye, inject as Ge, resolveComponent as I, openBlock as R, createElementBlock as N, createElementVNode as a, createVNode as c, withCtx as B, renderSlot as we, withDirectives as Te, normalizeClass as ce, vModelText as Fe, reactive as Ye, h as D, toDisplayString as F, unref as e, createBlock as Q, isRef as Oe, createCommentVNode as ae, Fragment as Pe, renderList as We, normalizeStyle as Ke, Teleport as Ze, mergeProps as $e, normalizeProps as Je, guardReactiveProps as Xe } from "vue";
2
- import { _ as et, a as tt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0j4VOis.js";
3
- import { useI18n as Y } from "@feedmepos/mf-common";
4
- import { P, a as ot, f as st, b as nt, c as Se, d as at } from "./format-unit-display-D_Z4TNZd.js";
5
- import { F as le, R as Re } from "./row-action.enum-PMKMRrZR.js";
6
- import { $ as me, t as Ie, I as lt, a0 as rt, a1 as it, a as E, D as Me, R as pe, a2 as ut, a3 as dt, r as de, a4 as mt, l as De, A as fe, M as Ae, G as Be, a5 as ct, a6 as Le, b as Ue, u as pt, j as qe, y as ft, a7 as yt, a8 as vt } from "./app-BLzTa0Ut.js";
7
- import { F as q, _ as Ee, u as bt } from "./layout-B9sdKjL9.js";
8
- import { useBreakpoints as Ne, components as G, FmButtonVariant as _t, useDialog as xt, useSnackbar as ht, useProxiedModel as ze } from "@feedmepos/ui-library";
9
- import { storeToRefs as gt } from "pinia";
10
- import { d as He, c as re, u as kt, _ as Ct } from "./TransferDialog.vue_vue_type_script_setup_true_lang-BE95F9r1.js";
11
- import { _ as je } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-2Ady4pB4.js";
12
- import { useRouter as wt } from "vue-router";
13
- import { u as Tt } from "./supplier-BZ6HZcYB.js";
14
- const Ft = { class: "flex flex-col" }, $t = { class: "flex flex-col" }, St = { class: "flex-1" }, Rt = { class: "flex items-center" }, It = { class: "flex-1" }, Mt = { class: "flex-1" }, Dt = /* @__PURE__ */ W({
15
- __name: "FmMinMaxInput",
16
- props: {
17
- rules: {},
18
- label: {},
19
- minPlaceholder: {},
20
- maxPlaceholder: {},
21
- modelValue: {},
22
- precision: {},
23
- minLength: {},
24
- maxLength: {},
25
- inputmode: {},
26
- type: {},
27
- readonly: { type: Boolean },
28
- labelMark: {},
29
- prependIcon: {},
30
- appendIcon: {},
31
- showValidBorder: { type: Boolean },
32
- labelInfo: {},
33
- showWordCount: { type: Boolean },
34
- invalid: { type: Boolean },
35
- autofocus: { type: Boolean },
36
- formatter: { type: Function },
37
- decimal: {},
38
- datalist: {},
39
- shiftDatalist: { type: Boolean },
40
- datalistMaxHeight: {},
41
- datalistMinHeight: {},
42
- offsetDatalist: {},
43
- datalistPlacement: {},
44
- datalistZIndex: {},
45
- datalistWidth: {},
46
- disabled: { type: Boolean },
47
- focused: { type: Boolean },
48
- helperText: {},
49
- helperState: {}
50
- },
51
- setup(u) {
52
- const b = u, m = He("modelValue"), l = lt();
53
- Ve(() => {
54
- const { min: n, max: t } = m ?? {};
55
- if (!(!n || !t) && n.precision !== t.precision) {
56
- const o = Math.max(n.precision, t.precision), r = me(n, o), h = me(t, o);
57
- m.min = r, m.max = h;
58
- }
59
- });
60
- const f = M(() => {
61
- const { min: n, max: t } = m ?? {};
62
- return Math.max((n == null ? void 0 : n.precision) ?? 0, (t == null ? void 0 : t.precision) ?? 0, b.precision ?? 0);
63
- }), g = M(() => ({
64
- ...m
65
- })), k = (n) => {
66
- if (!n) return "";
67
- const t = rt(n), o = f.value, r = me(t, o);
68
- return it(
69
- +E(r),
70
- r.precision
71
- );
72
- }, i = U(k(m.min)), s = U(k(m.max));
73
- ye([i, s], ([n, t]) => {
74
- const o = m ?? {}, r = l(n), h = l(t), y = f.value;
75
- if (n !== "" && r === !0) {
76
- const v = Ie(+n, y);
77
- o.min = v;
78
- } else
79
- o.min = null;
80
- if (t !== "" && h === !0) {
81
- const v = Ie(+t, y);
82
- o.max = v;
83
- } else
84
- o.max = null;
85
- m.min = o.min, m.max = o.max;
86
- });
87
- const d = Symbol.for("fm:form-state"), p = Ge(d, null), _ = M(() => b.disabled ?? (p == null ? void 0 : p.getDisabled()) ?? !1), C = U(), T = U(), w = U(!1), S = U(!1), A = M(() => w.value || S.value), L = M(() => [...[
88
- function() {
89
- return typeof l(i.value) == "string" || typeof l(s.value) == "string" ? "Must be a number" : !0;
90
- },
91
- function(o) {
92
- return !o || !o.min || !o.max ? !0 : +E(o.min) > +E(o.max) ? "Min must be less than or equal to max" : !0;
93
- }
94
- ], ...b.rules ?? []]);
95
- return (n, t) => {
96
- const o = I("FmLabel"), r = I("FmField"), h = I("FmFormGroup");
97
- return R(), N("div", Ft, [
98
- a("div", $t, [
99
- a("div", St, [
100
- c(o, {
101
- label: n.label,
102
- disabled: n.disabled,
103
- required: n.labelMark === "required",
104
- optional: n.labelMark === "optional"
105
- }, null, 8, ["label", "disabled", "required", "optional"])
106
- ]),
107
- c(r, { focused: A.value }, {
108
- default: B(() => [
109
- a("div", Rt, [
110
- we(n.$slots, "prepend"),
111
- t[6] || (t[6] = a("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Min.", -1)),
112
- a("div", It, [
113
- Te(a("input", {
114
- type: "text",
115
- ref_key: "minInputRef",
116
- ref: C,
117
- onFocus: t[0] || (t[0] = () => w.value = !0),
118
- onBlur: t[1] || (t[1] = () => w.value = !1),
119
- "onUpdate:modelValue": t[2] || (t[2] = (y) => i.value = y),
120
- class: ce({
121
- "fm-text-field--input fm-typo-en-body-lg-400": !0,
122
- "text-fm-color-typo-primary": !_.value,
123
- "text-fm-color-typo-disabled": _.value
124
- })
125
- }, null, 34), [
126
- [Fe, i.value]
127
- ])
128
- ]),
129
- t[7] || (t[7] = a("div", { class: "block h-32 mx-4 w-[1px] bg-fm-color-neutral-gray-200" }, null, -1)),
130
- t[8] || (t[8] = a("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Max.", -1)),
131
- a("div", Mt, [
132
- Te(a("input", {
133
- type: "text",
134
- ref_key: "maxInputRef",
135
- ref: T,
136
- onFocus: t[3] || (t[3] = () => S.value = !0),
137
- onBlur: t[4] || (t[4] = () => S.value = !1),
138
- "onUpdate:modelValue": t[5] || (t[5] = (y) => s.value = y),
139
- class: ce({
140
- "fm-text-field--input fm-typo-en-body-lg-400": !0,
141
- "text-fm-color-typo-primary": !_.value,
142
- "text-fm-color-typo-disabled": _.value
143
- })
144
- }, null, 34), [
145
- [Fe, s.value]
146
- ])
147
- ]),
148
- we(n.$slots, "append")
149
- ])
150
- ]),
151
- _: 3
152
- }, 8, ["focused"])
153
- ]),
154
- c(h, {
155
- class: "flex-1",
156
- "model-value": g.value,
157
- info: n.labelInfo,
158
- rules: L.value,
159
- "helper-text": n.helperText,
160
- "helper-state": n.helperState
161
- }, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
162
- ]);
163
- };
164
- }
165
- });
166
- function At() {
167
- return function(b) {
168
- return !b || !b.min || !b.max ? "Required" : !0;
169
- };
170
- }
171
- function Vt(u, b) {
172
- return function(l) {
173
- return !l || !l.min || !l.max ? !0 : +E(l.min) < u ? `Must be between ${u} and ${b}` : +E(l.max) > b ? `Must be between ${u} and ${b}` : !0;
174
- };
175
- }
176
- var $ = /* @__PURE__ */ ((u) => (u.Code = "Code", u.Name = "Name", u.DefaultAmount = "DefaultAmount", u.Limit = "Limit", u.MinimumAmount = "MinimumAmount", u.Step = "Step", u.Cost = "Cost", u.Delete = "Delete", u))($ || {});
177
- const Ot = () => {
178
- const { t: u } = Y();
179
- return D(
180
- je,
181
- {
182
- zIndex: 50,
183
- class: "whitespace-nowrap"
184
- },
185
- u("inventory.transfer.form.items.table.Cost", [Le()])
186
- );
187
- };
188
- function Pt(u) {
189
- const { t: b } = Y(), m = Ye({}), { breakpoints: l } = Ne();
190
- Ve(() => {
191
- for (const i of u.items) {
192
- if (!i.totalCost)
193
- continue;
194
- const s = re(i.sku, i.quantity, i.measurement, {
195
- supplier: u.supplier
196
- }), d = i.totalCost ?? Me.reset();
197
- s ? m[i.sku._id] = s.amount !== d.amount || s.precision !== d.precision : m[i.sku._id] = !0;
198
- }
199
- });
200
- function f(i) {
201
- var d, p, _, C, T, w, S;
202
- return !!(((p = (d = i.defaultCost) == null ? void 0 : d.costPerUnit) == null ? void 0 : p.amount) ?? ((S = (w = (T = (C = (_ = u.supplier) == null ? void 0 : _.supplyItems) == null ? void 0 : C.find((A) => A.skuId === i._id)) == null ? void 0 : T.defaultCost) == null ? void 0 : w.costPerUnit) == null ? void 0 : S.amount));
203
- }
204
- const g = [
205
- {
206
- id: "Code",
207
- header: () => b("inventory.transfer.form.items.table.Code"),
208
- accessorKey: "code",
209
- size: 96,
210
- cell(i) {
211
- const s = i.row.original;
212
- return D(G.FmTextField, {
213
- modelValue: s.code,
214
- "onUpdate:modelValue": (d) => {
215
- u.updateItem({
216
- ...s,
217
- code: d
218
- });
219
- },
220
- key: s.sku._id,
221
- rules: [pe()],
222
- labelMark: "required"
223
- });
224
- },
225
- enableSorting: !1
226
- },
227
- {
228
- id: "Name",
229
- header: () => b("inventory.transfer.form.items.table.Name"),
230
- minSize: 300,
231
- cell(i) {
232
- const s = i.row.original;
233
- return D(G.FmTextField, {
234
- modelValue: s.name,
235
- "onUpdate:modelValue": (d) => {
236
- u.updateItem({
237
- ...s,
238
- name: d
239
- });
240
- },
241
- key: s.sku._id,
242
- rules: [pe()],
243
- labelMark: "required"
244
- });
245
- },
246
- enableSorting: !1
247
- },
248
- {
249
- id: "DefaultAmount",
250
- header: () => b("inventory.transfer.form.items.table.DefaultAmount2"),
251
- minSize: 150,
252
- cell(i) {
253
- const s = i.row.original;
254
- return D(ut, {
255
- style: {
256
- flex: "1 1 0%"
257
- },
258
- modelValue: {
259
- amount: s.quantity ?? { amount: 1, precision: 0 },
260
- measurement: s.measurement ?? null
261
- },
262
- disabled: u.disabled,
263
- key: s.sku._id,
264
- unit: s.sku.unit,
265
- "onUpdate:modelValue": (d) => {
266
- u.updateItem({
267
- ...s,
268
- quantity: d.amount,
269
- measurement: d.measurement
270
- });
271
- },
272
- rules: [
273
- dt(
274
- +E(
275
- s.minimumQuantity ?? {
276
- amount: 1,
277
- precision: de(s.sku.unit, s.measurement)
278
- }
279
- )
280
- ),
281
- mt(
282
- s.maximumQuantity ? +E(s.maximumQuantity) : 1 / 0
283
- )
284
- ],
285
- applyDefaultRules: !0
286
- });
287
- },
288
- enableSorting: !1
289
- },
290
- {
291
- id: "Limit",
292
- header: () => "Limit",
293
- // TODO: i18n,
294
- minSize: 250,
295
- cell(i) {
296
- const s = i.row.original;
297
- return D(Dt, {
298
- style: {
299
- flex: "1 1 0%"
300
- },
301
- modelValue: {
302
- min: s.minimumQuantity,
303
- max: s.maximumQuantity
304
- },
305
- disabled: u.disabled,
306
- key: s.sku._id,
307
- unit: s.sku.unit,
308
- "onUpdate:modelValue": (d) => {
309
- const p = { ...s };
310
- d != null && d.min && (p.minimumQuantity = d.min), d != null && d.max && (p.maximumQuantity = d.max), u.updateItem(p);
311
- },
312
- rules: [
313
- At(),
314
- Vt(
315
- +E({
316
- amount: 1,
317
- precision: de(s.sku.unit, s.measurement)
318
- }),
319
- 1 / 0
320
- )
321
- ],
322
- disableUnit: !0,
323
- applyDefaultRules: !0
324
- });
325
- }
326
- },
327
- {
328
- id: "Step",
329
- header: () => b("inventory.transfer.form.items.table.Step"),
330
- minSize: 100,
331
- cell(i) {
332
- const s = i.row.original;
333
- return D(G.FmTextField, {
334
- modelValue: E(s.quantityStep ?? Me.reset(), !1),
335
- key: s.sku._id,
336
- "onUpdate:modelValue": (d) => {
337
- u.updateItem({
338
- ...s,
339
- quantityStep: De(+d)
340
- });
341
- },
342
- rules: [
343
- fe({
344
- amount: 1,
345
- precision: de(s.sku.unit, s.measurement)
346
- }),
347
- Ae(s.sku.unit, s.measurement)
348
- ]
349
- });
350
- },
351
- enableSorting: !1
352
- },
353
- {
354
- id: "Cost",
355
- header: Ot,
356
- size: 180,
357
- cell(i) {
358
- const s = i.row.original, d = f(s.sku), p = l.value.xs || l.value.sm;
359
- return !m[s.sku._id] && d ? D(
360
- "div",
361
- {
362
- class: "flex gap-4 fm-typo-en-body-md-400 items-center",
363
- key: s.sku._id
364
- },
365
- [
366
- D(G.FmButton, {
367
- prependIcon: "edit",
368
- variant: _t.Tertiary,
369
- onClick() {
370
- u.updateItem({
371
- ...s,
372
- totalCost: re(s.sku, s.quantity, s.measurement, {
373
- supplier: u.supplier
374
- })
375
- }), m[s.sku._id] = !0;
376
- },
377
- disabled: u.disabled
378
- }),
379
- D(
380
- "div",
381
- {
382
- class: "flex flex-col"
383
- },
384
- [
385
- D(
386
- "span",
387
- {
388
- class: [u.disabled ? "text-fm-color-typo-disabled" : ""]
389
- },
390
- p ? Be(
391
- re(s.sku, s.quantity, s.measurement, {
392
- supplier: u.supplier
393
- })
394
- ) : E(
395
- re(s.sku, s.quantity, s.measurement, {
396
- supplier: u.supplier
397
- })
398
- )
399
- ),
400
- D(
401
- "span",
402
- {
403
- class: [
404
- "fm-typo-en-body-sm-400",
405
- u.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
406
- ]
407
- },
408
- b("inventory.transfer.form.items.autoCalculated")
409
- )
410
- ]
411
- )
412
- ]
413
- ) : D(
414
- G.FmTextField,
415
- {
416
- modelValue: E(s.totalCost ?? { amount: 0, precision: 0 }),
417
- key: s.sku._id,
418
- "onUpdate:modelValue": (_) => {
419
- u.updateItem({
420
- ...s,
421
- totalCost: {
422
- ...De(+_),
423
- currency: ct()
424
- }
425
- });
426
- },
427
- rules: [fe(0), Ae(2)]
428
- },
429
- {
430
- prepend() {
431
- return p ? D(
432
- "div",
433
- {
434
- class: [
435
- "text-fm-typo-en-body-lg-400",
436
- u.disabled ? "text-fm-color-typo-disabled" : ""
437
- ]
438
- },
439
- Le()
440
- ) : null;
441
- },
442
- append() {
443
- return d ? D(G.FmButton, {
444
- prependIcon: "close",
445
- variant: "tertiary",
446
- onClick() {
447
- u.updateItem({
448
- ...s,
449
- totalCost: null
450
- }), m[s.sku._id] = !1;
451
- },
452
- disabled: u.disabled
453
- }) : null;
454
- }
455
- }
456
- );
457
- },
458
- enableSorting: !1
459
- },
460
- {
461
- id: "Delete",
462
- header: "",
463
- cell(i) {
464
- const s = i.row.original;
465
- return D(G.FmButton, {
466
- class: "delete-button",
467
- key: s.sku._id,
468
- type: "button",
469
- icon: "delete",
470
- variant: "tertiary",
471
- size: "md",
472
- disabled: u.disabled,
473
- onClick: () => {
474
- u.deleteItem(s);
475
- }
476
- });
477
- },
478
- enableSorting: !1,
479
- size: 40,
480
- meta: {
481
- cellClass: "",
482
- headerClass: ""
483
- }
484
- }
485
- ];
486
- return {
487
- columnDefs: M(() => Ue().enableTotalCost && u.transferType === P.PURCHASE ? g : g.filter((s) => s.id !== "Cost"))
488
- };
489
- }
490
- const Bt = { class: "flex flex-col gap-8 py-16" }, Lt = { class: "flex items-center" }, Ut = { class: "flex-1 flex gap-1 items-center" }, qt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Et = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Nt = { class: "flex gap-8 w-full" }, zt = { class: "flex-1 flex flex-col gap-4" }, Ht = { class: "flex-1 flex flex-col gap-4" }, jt = { class: "flex gap-8 w-full" }, Qt = { class: "flex-1 flex flex-col gap-4" }, Gt = { class: "flex-1 flex flex-col gap-4" }, Yt = { class: "flex gap-8 w-full" }, Wt = { class: "flex-1 flex flex-col gap-4" }, Kt = { class: "flex-1 flex flex-col gap-4" }, Zt = /* @__PURE__ */ W({
491
- __name: "TransferTemplateItem",
492
- props: {
493
- cellByColId: {},
494
- row: {}
495
- },
496
- setup(u) {
497
- const { t: b } = Y();
498
- return (m, l) => {
499
- var g, k, i, s, d, p, _, C, T, w, S, A, L, n, t, o, r, h, y, v, V, x, O, z, K, Z, J, X, H, ee, te, oe, se, j, ne;
500
- const f = I("FmLabel");
501
- return R(), N("div", Bt, [
502
- a("div", Lt, [
503
- a("div", Ut, [
504
- a("span", qt, " (" + F(m.row.original.sku.code) + ") ", 1),
505
- a("span", Et, F(m.row.original.sku.name), 1)
506
- ]),
507
- a("div", null, [
508
- c(e(q), {
509
- render: (i = (k = (g = m.cellByColId.Delete) == null ? void 0 : g.column) == null ? void 0 : k.columnDef) == null ? void 0 : i.cell,
510
- props: (d = (s = m.cellByColId.Delete) == null ? void 0 : s.getContext) == null ? void 0 : d.call(s)
511
- }, null, 8, ["render", "props"])
512
- ])
513
- ]),
514
- a("div", Nt, [
515
- a("div", zt, [
516
- c(f, {
517
- label: e(b)(`inventory.transfer.form.items.table.${e($).Code}`)
518
- }, null, 8, ["label"]),
519
- c(e(q), {
520
- render: (C = (_ = (p = m.cellByColId[e($).Code]) == null ? void 0 : p.column) == null ? void 0 : _.columnDef) == null ? void 0 : C.cell,
521
- props: (w = (T = m.cellByColId[e($).Code]) == null ? void 0 : T.getContext) == null ? void 0 : w.call(T)
522
- }, null, 8, ["render", "props"]),
523
- l[0] || (l[0] = a("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
524
- ]),
525
- a("div", Ht, [
526
- c(f, {
527
- label: e(b)(`inventory.transfer.form.items.table.${e($).Name}`)
528
- }, null, 8, ["label"]),
529
- c(e(q), {
530
- render: (L = (A = (S = m.cellByColId[e($).Name]) == null ? void 0 : S.column) == null ? void 0 : A.columnDef) == null ? void 0 : L.cell,
531
- props: (t = (n = m.cellByColId[e($).Name]) == null ? void 0 : n.getContext) == null ? void 0 : t.call(n)
532
- }, null, 8, ["render", "props"]),
533
- l[1] || (l[1] = a("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
534
- ])
535
- ]),
536
- a("div", jt, [
537
- a("div", Qt, [
538
- c(f, {
539
- label: e(b)(`inventory.transfer.form.items.table.${e($).Limit}`)
540
- }, null, 8, ["label"]),
541
- c(e(q), {
542
- render: (h = (r = (o = m.cellByColId[e($).Limit]) == null ? void 0 : o.column) == null ? void 0 : r.columnDef) == null ? void 0 : h.cell,
543
- props: (v = (y = m.cellByColId[e($).Limit]) == null ? void 0 : y.getContext) == null ? void 0 : v.call(y)
544
- }, null, 8, ["render", "props"]),
545
- l[2] || (l[2] = a("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
546
- ]),
547
- a("div", Gt, [
548
- c(f, {
549
- label: e(b)(`inventory.transfer.form.items.table.${e($).Step}`)
550
- }, null, 8, ["label"]),
551
- c(e(q), {
552
- render: (O = (x = (V = m.cellByColId[e($).Step]) == null ? void 0 : V.column) == null ? void 0 : x.columnDef) == null ? void 0 : O.cell,
553
- props: (K = (z = m.cellByColId[e($).Step]) == null ? void 0 : z.getContext) == null ? void 0 : K.call(z)
554
- }, null, 8, ["render", "props"]),
555
- l[3] || (l[3] = a("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
556
- ])
557
- ]),
558
- a("div", Yt, [
559
- a("div", Wt, [
560
- c(f, {
561
- label: e(b)(`inventory.transfer.form.items.table.${e($).DefaultAmount}`)
562
- }, null, 8, ["label"]),
563
- c(e(q), {
564
- render: (X = (J = (Z = m.cellByColId[e($).DefaultAmount]) == null ? void 0 : Z.column) == null ? void 0 : J.columnDef) == null ? void 0 : X.cell,
565
- props: (ee = (H = m.cellByColId[e($).DefaultAmount]) == null ? void 0 : H.getContext) == null ? void 0 : ee.call(H)
566
- }, null, 8, ["render", "props"]),
567
- l[4] || (l[4] = a("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
568
- ]),
569
- a("div", Kt, [
570
- c(je, { "z-index": 50 }, {
571
- default: B(() => [
572
- c(f, {
573
- label: e(b)(`inventory.transfer.form.items.table.${e($).Cost}2`)
574
- }, null, 8, ["label"])
575
- ]),
576
- _: 1
577
- }),
578
- c(e(q), {
579
- render: (se = (oe = (te = m.cellByColId[e($).Cost]) == null ? void 0 : te.column) == null ? void 0 : oe.columnDef) == null ? void 0 : se.cell,
580
- props: (ne = (j = m.cellByColId[e($).Cost]) == null ? void 0 : j.getContext) == null ? void 0 : ne.call(j)
581
- }, null, 8, ["render", "props"]),
582
- l[5] || (l[5] = a("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
583
- ])
584
- ])
585
- ]);
586
- };
587
- }
588
- }), Jt = { class: "flex flex-col gap-16" }, Xt = { class: "flex flex-col gap-24" }, eo = { class: "flex flex-col gap-16" }, to = { class: "flex" }, oo = { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, so = /* @__PURE__ */ W({
589
- __name: "TransferTemplateForm",
590
- props: {
591
- modelValue: {},
592
- disabled: { type: Boolean }
593
- },
594
- setup(u, { expose: b }) {
595
- const m = u, l = He(), { t: f } = Y(), g = qe(), k = pt(), i = Tt();
596
- ye(
597
- () => m.modelValue,
598
- (n) => {
599
- console.log("TransferTemplateForm.model", n);
600
- }
601
- ), g.watchLocation(async () => {
602
- location && (l.purchaseOrder.supplier || (l.purchaseOrder.supplier = i.suppliers.find((n) => n) ?? l.purchaseOrder.supplier));
603
- });
604
- const s = xt(), d = kt(
605
- () => l.purchaseOrder,
606
- (n) => {
607
- l.purchaseOrder = {
608
- ...l.purchaseOrder,
609
- ...n
610
- };
611
- }
612
- ), p = M({
613
- get() {
614
- var n, t;
615
- return typeof ((t = (n = l.purchaseOrder) == null ? void 0 : n.supplier) == null ? void 0 : t.internal) == "string" ? P.TRANSFER : P.PURCHASE;
616
- },
617
- set(n) {
618
- var o, r;
619
- const t = typeof ((r = (o = l.purchaseOrder) == null ? void 0 : o.supplier) == null ? void 0 : r.internal) == "string" ? P.TRANSFER : P.PURCHASE;
620
- n !== t && (l.purchaseOrder.supplier = n === P.PURCHASE ? d.locationOptionsTypePurchase.value[0] : d.locationOptionsTypeTransfer.value[0]);
621
- }
622
- }), _ = M(() => d.transferLocationOptions.value), C = M({
623
- get() {
624
- return l.purchaseOrder.supplier._id;
625
- },
626
- set(n) {
627
- d.transferLocationModel.value = n;
628
- }
629
- }), T = M({
630
- get() {
631
- return l.purchaseOrder.remark ?? void 0;
632
- },
633
- set(n) {
634
- l.purchaseOrder.remark = n;
635
- }
636
- }), w = U();
637
- b({
638
- validateInputs: () => {
639
- var n, t;
640
- (t = (n = w.value) == null ? void 0 : n.validateInputs) == null || t.call(n);
641
- },
642
- resetInputsValidation: () => {
643
- var n, t;
644
- (t = (n = w.value) == null ? void 0 : n.resetInputsValidation) == null || t.call(n);
645
- },
646
- resetInputs: () => {
647
- var n, t;
648
- (t = (n = w.value) == null ? void 0 : n.resetInputs) == null || t.call(n);
649
- }
650
- });
651
- const S = Pt({
652
- updateItem: (n) => {
653
- l.purchaseOrder.items = l.purchaseOrder.items.map((t) => t.sku._id !== n.sku._id ? t : n);
654
- },
655
- deleteItem: (n) => {
656
- l.purchaseOrder.items = l.purchaseOrder.items.filter(
657
- (t) => t.sku._id !== n.sku._id
658
- );
659
- },
660
- get supplier() {
661
- return l.purchaseOrder.supplier;
662
- },
663
- get items() {
664
- return l.purchaseOrder.items;
665
- },
666
- get transferType() {
667
- return p.value;
668
- },
669
- get disabled() {
670
- return m.disabled;
671
- }
672
- }), A = M(() => S.columnDefs.value);
673
- function L() {
674
- const n = k.skus.map((o) => ({
675
- label: o.name,
676
- sublabel: o.code,
677
- value: o
678
- })), t = n.filter((o) => {
679
- var r;
680
- return (r = l.purchaseOrder.items) == null ? void 0 : r.find((h) => h.sku._id === o.value._id);
681
- }).map((o) => o.value);
682
- s.open({
683
- title: f("inventory.transfer.form.items.selectItem"),
684
- closeButton: !0,
685
- contentComponent: ft,
686
- contentComponentProps: {
687
- modelValue: t,
688
- items: n
689
- },
690
- primaryActions: {
691
- text: f("common.confirm"),
692
- close: !0
693
- },
694
- secondaryActions: {
695
- text: f("common.close"),
696
- close: !0,
697
- variant: "tertiary"
698
- }
699
- }).onPrimary((o) => {
700
- const r = l.purchaseOrder.items ?? [], h = o.map((y) => {
701
- const v = r.find((O) => O.sku._id === y._id);
702
- if (v)
703
- return v;
704
- const V = { amount: 1, precision: de(y.unit) }, x = {
705
- sku: y,
706
- code: y.code,
707
- name: y.name,
708
- quantity: {
709
- amount: 1,
710
- precision: 0
711
- },
712
- minimumQuantity: V,
713
- maximumQuantity: V,
714
- quantityStep: V
715
- };
716
- return p.value == P.PURCHASE && (x.totalCost = re(
717
- x.sku,
718
- x.quantity,
719
- x.measurement,
720
- {
721
- supplier: l.purchaseOrder.supplier
722
- }
723
- )), x;
724
- });
725
- h.sort((y, v) => y.sku.code.localeCompare(v.sku.code)), l.purchaseOrder.items = h;
726
- });
727
- }
728
- return (n, t) => {
729
- const o = I("FmTextField"), r = I("FmSelect"), h = I("FmTextarea"), y = I("FmButton"), v = I("FmTable"), V = I("FmForm");
730
- return R(), Q(V, {
731
- ref_key: "formRef",
732
- ref: w,
733
- class: "flex flex-col gap-32",
734
- disabled: n.disabled
735
- }, {
736
- default: B(() => [
737
- a("div", Jt, [
738
- a("div", Xt, [
739
- c(o, {
740
- label: e(f)("inventory.transfer.form.name"),
741
- "label-mark": "required",
742
- modelValue: e(l).name,
743
- "onUpdate:modelValue": t[0] || (t[0] = (x) => e(l).name = x),
744
- rules: [e(pe)()]
745
- }, null, 8, ["label", "modelValue", "rules"]),
746
- c(r, {
747
- label: e(f)("inventory.transfer.form.type.title"),
748
- "model-value": p.value,
749
- "onUpdate:modelValue": t[1] || (t[1] = (x) => p.value = x),
750
- items: [
751
- {
752
- label: e(f)(
753
- `inventory.transfer.form.type.${e(P).PURCHASE.toLocaleLowerCase()}`
754
- ),
755
- value: e(P).PURCHASE,
756
- disabled: !e(d).locationOptionsTypePurchase.value.length,
757
- sublabel: e(d).locationOptionsTypePurchase.value.length ? void 0 : e(f)("inventory.transfer.form.noSupplierAvailable")
758
- },
759
- {
760
- label: e(f)(
761
- `inventory.transfer.form.type.${e(P).TRANSFER.toLocaleLowerCase()}`
762
- ),
763
- value: e(P).TRANSFER,
764
- disabled: !e(d).locationOptionsTypeTransfer.value.length,
765
- sublabel: e(d).locationOptionsTypeTransfer.value.length ? void 0 : e(f)("inventory.transfer.form.noLocationAvailable")
766
- }
767
- ],
768
- rules: [e(fe)(1)(_.value)]
769
- }, null, 8, ["label", "model-value", "items", "rules"]),
770
- c(r, {
771
- label: p.value === e(P).PURCHASE ? e(f)("inventory.transfer.form.purchaseFrom") : e(f)("inventory.transfer.form.transferFrom"),
772
- modelValue: C.value,
773
- "onUpdate:modelValue": t[2] || (t[2] = (x) => C.value = x),
774
- items: _.value
775
- }, null, 8, ["label", "modelValue", "items"]),
776
- c(o, {
777
- label: e(f)("inventory.transfer.form.reference"),
778
- "label-mark": "optional",
779
- modelValue: e(l).purchaseOrder.ref,
780
- "onUpdate:modelValue": t[3] || (t[3] = (x) => e(l).purchaseOrder.ref = x)
781
- }, null, 8, ["label", "modelValue"]),
782
- c(h, {
783
- label: e(f)("inventory.transfer.form.remark"),
784
- "label-mark": "optional",
785
- "max-length": 240,
786
- modelValue: T.value,
787
- "onUpdate:modelValue": t[4] || (t[4] = (x) => T.value = x),
788
- class: ce({ "text-fm-color-typo-disabled": n.disabled })
789
- }, null, 8, ["label", "modelValue", "class"])
790
- ])
791
- ]),
792
- a("div", eo, [
793
- a("div", to, [
794
- a("div", oo, F(e(f)("inventory.transfer.form.items.title")), 1),
795
- c(y, {
796
- disabled: n.disabled,
797
- label: e(f)("inventory.transfer.form.items.addItem"),
798
- "prepend-icon": "add",
799
- variant: "plain",
800
- class: "border-2 rounded-lg border-fm-color-primary",
801
- onClick: t[5] || (t[5] = (x) => L()),
802
- size: "md"
803
- }, null, 8, ["disabled", "label"])
804
- ]),
805
- (R(), Q(v, {
806
- "column-defs": A.value,
807
- "row-data": e(l).purchaseOrder.items,
808
- key: e(l).purchaseOrder.items.map((x) => x.sku._id).join("."),
809
- "hide-footer": ""
810
- }, {
811
- "list-row": B((x) => [
812
- (R(), Q(Ee, {
813
- row: x,
814
- key: e(l).purchaseOrder.items.map((O) => O.sku._id).join(".")
815
- }, {
816
- default: B((O) => [
817
- c(Zt, {
818
- row: x,
819
- "cell-by-col-id": O
820
- }, null, 8, ["row", "cell-by-col-id"])
821
- ]),
822
- _: 2
823
- }, 1032, ["row"]))
824
- ]),
825
- _: 1
826
- }, 8, ["column-defs", "row-data"]))
827
- ])
828
- ]),
829
- _: 1
830
- }, 8, ["disabled"]);
831
- };
832
- }
833
- }), no = { class: "flex items-center" }, ao = { class: "fm-typo-en-title-md-800" }, lo = { class: "flex gap-4" }, ro = /* @__PURE__ */ W({
834
- __name: "TransferTemplateDialog",
835
- props: {
836
- mode: {},
837
- modelValue: {},
838
- show: { type: Boolean }
839
- },
840
- emits: ["update:show", "submitted"],
841
- setup(u, { expose: b, emit: m }) {
842
- var t;
843
- const l = u, f = m, g = ot(), k = ht(), { t: i } = Y(), s = ze(l, "show");
844
- function d() {
845
- return {
846
- _id: "",
847
- name: "",
848
- purchaseOrder: {
849
- remark: void 0,
850
- ref: void 0,
851
- stockSnapshotId: void 0,
852
- effectiveAt: void 0,
853
- items: [],
854
- supplier: {
855
- _rev: void 0,
856
- email: void 0,
857
- internal: void 0,
858
- contactName: void 0,
859
- phoneNumber: void 0,
860
- registrationNumber: void 0,
861
- supplyItems: void 0,
862
- _id: "",
863
- name: "",
864
- address: {
865
- line2: void 0,
866
- line1: "",
867
- state: "",
868
- city: "",
869
- postcode: "",
870
- country: ""
871
- }
872
- }
873
- }
874
- };
875
- }
876
- const p = U(l.modelValue ?? d()), _ = U(((t = l.modelValue) == null ? void 0 : t._id) ?? `${Math.random()}`);
877
- ye(
878
- () => l.show,
879
- (o) => {
880
- var r;
881
- o && (p.value = l.modelValue ?? d(), _.value = ((r = l.modelValue) == null ? void 0 : r._id) ?? `${Math.random()}`);
882
- }
883
- );
884
- const C = U(!1), T = M(() => {
885
- switch (l.mode) {
886
- case le.READ:
887
- return "";
888
- case le.CREATE:
889
- return i("inventory.transfer.template.create.title");
890
- case le.UPDATE:
891
- return i("inventory.transfer.template.update.title");
892
- }
893
- return "";
894
- }), w = U();
895
- b({
896
- validateInputs: () => {
897
- var o, r;
898
- (r = (o = w.value) == null ? void 0 : o.validateInputs) == null || r.call(o);
899
- },
900
- resetInputsValidation: () => {
901
- var o, r;
902
- (r = (o = w.value) == null ? void 0 : o.resetInputsValidation) == null || r.call(o);
903
- },
904
- resetInputs: () => {
905
- var o, r;
906
- (r = (o = w.value) == null ? void 0 : o.resetInputs) == null || r.call(o);
907
- }
908
- });
909
- async function S() {
910
- const o = p.value;
911
- if (o) {
912
- C.value = !0, (o.purchaseOrder.supplier.internal === "warehouse" || o.purchaseOrder.supplier.internal === "restaurant") && (o.purchaseOrder.items = o.purchaseOrder.items.map(
913
- ({ totalCost: r, ...h }) => h
914
- ));
915
- try {
916
- await g.createTemplate(o), await new Promise((r) => setTimeout(r, 1e3)), k.open({
917
- title: i("inventory.transfer.template.create.success"),
918
- message: i("inventory.transfer.template.create.successMessage"),
919
- type: "success"
920
- }), f("update:show", !1), f("submitted");
921
- } catch (r) {
922
- k.open({
923
- title: i("inventory.transfer.template.create.error"),
924
- message: i("inventory.transfer.template.create.errorMessage"),
925
- type: "error"
926
- }), console.error("Error in creating transfer template", r);
927
- } finally {
928
- C.value = !1;
929
- }
930
- }
931
- }
932
- async function A() {
933
- const o = p.value;
934
- if (o) {
935
- C.value = !0, (o.purchaseOrder.supplier.internal === "warehouse" || o.purchaseOrder.supplier.internal === "restaurant") && (o.purchaseOrder.items = o.purchaseOrder.items.map(
936
- ({ totalCost: r, ...h }) => h
937
- ));
938
- try {
939
- await g.updateTemplate(o), await new Promise((r) => setTimeout(r, 1e3)), k.open({
940
- title: i("inventory.transfer.template.update.success"),
941
- message: i("inventory.transfer.template.update.successMessage"),
942
- type: "success"
943
- }), f("update:show", !1), f("submitted");
944
- } catch (r) {
945
- k.open({
946
- title: i("inventory.transfer.template.update.error"),
947
- message: i("inventory.transfer.template.update.errorMessage"),
948
- type: "error"
949
- }), console.error("Error in updating transfer template", r);
950
- } finally {
951
- C.value = !1;
952
- }
953
- }
954
- }
955
- function L() {
956
- switch (l.mode) {
957
- case le.CREATE:
958
- return S();
959
- case le.UPDATE:
960
- return A();
961
- }
962
- }
963
- function n() {
964
- var o, r;
965
- (r = (o = w.value) == null ? void 0 : o.validateInputs) == null || r.call(o);
966
- }
967
- return (o, r) => {
968
- const h = I("FmButton"), y = I("FmSideSheet");
969
- return R(), Q(y, {
970
- modelValue: e(s),
971
- "onUpdate:modelValue": r[2] || (r[2] = (v) => Oe(s) ? s.value = v : null),
972
- "dismiss-away": "",
973
- "close-button": "",
974
- "max-width": 900
975
- }, {
976
- "side-sheet-header": B(() => [
977
- a("div", no, [
978
- a("div", ao, F(T.value), 1)
979
- ])
980
- ]),
981
- default: B(() => [
982
- (R(), Q(so, {
983
- class: "w-full",
984
- ref_key: "formRef",
985
- ref: w,
986
- onValidationSuccess: L,
987
- "model-value": p.value,
988
- "onUpdate:modelValue": r[0] || (r[0] = (v) => p.value = v),
989
- disabled: C.value,
990
- key: _.value
991
- }, null, 8, ["model-value", "disabled"]))
992
- ]),
993
- "side-sheet-footer": B(() => [
994
- a("div", lo, [
995
- c(h, {
996
- loading: C.value,
997
- label: e(i)("common.save"),
998
- onClick: n
999
- }, null, 8, ["loading", "label"]),
1000
- c(h, {
1001
- disabled: C.value,
1002
- variant: "tertiary",
1003
- label: e(i)("common.close"),
1004
- onClick: r[1] || (r[1] = (v) => f("update:show", !1))
1005
- }, null, 8, ["disabled", "label"])
1006
- ])
1007
- ]),
1008
- _: 1
1009
- }, 8, ["modelValue"]);
1010
- };
1011
- }
1012
- }), io = { class: "flex flex-col gap-16 w-full h-full" }, uo = { class: "flex justify-between" }, mo = { class: "fm-typo-en-body-lg-600" }, co = { class: "flex flex-col gap-8" }, po = { class: "flex flex-col gap-4" }, fo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yo = { class: "flex gap-1" }, vo = { class: "fm-typo-en-body-lg-600" }, bo = {
1013
- key: 0,
1014
- class: "flex flex-col gap-4"
1015
- }, _o = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xo = { class: "fm-typo-en-body-lg-600" }, ho = { class: "flex flex-col gap-4" }, go = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ko = { class: "fm-typo-en-body-lg-600" }, Co = {
1016
- key: 1,
1017
- class: "flex flex-col gap-4"
1018
- }, wo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, To = { class: "fm-typo-en-body-lg-600" }, Fo = {
1019
- key: 2,
1020
- class: "flex flex-col gap-4"
1021
- }, $o = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, So = { class: "fm-typo-en-body-lg-600" }, Ro = {
1022
- key: 3,
1023
- class: "flex flex-col gap-4"
1024
- }, Io = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Mo = { class: "fm-typo-en-body-lg-600" }, Do = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Ao = { class: "flex flex-col gap-8" }, Vo = { class: "fm-typo-en-body-lg-600" }, Oo = { class: "flex w-full gap-4" }, Po = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, Bo = { class: "fm-typo-en-body-lg-600 shrink-0" }, Lo = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Uo = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, qo = {
1025
- key: 0,
1026
- class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1027
- }, Eo = { class: "flex gap-8 xs:flex-col" }, No = /* @__PURE__ */ W({
1028
- __name: "TransferTemplateDetails",
1029
- props: {
1030
- template: {},
1031
- show: { type: Boolean }
1032
- },
1033
- emits: ["update:show", "action:use", "action:edit"],
1034
- setup(u, { emit: b }) {
1035
- const m = u, l = b, f = Ue(), { t: g } = Y(), k = M(() => {
1036
- var p;
1037
- return (p = m.template) == null ? void 0 : p.purchaseOrder;
1038
- }), i = M(
1039
- () => {
1040
- var p, _, C, T;
1041
- return ((_ = (p = k.value) == null ? void 0 : p.supplier) == null ? void 0 : _.internal) === "restaurant" || ((T = (C = k.value) == null ? void 0 : C.supplier) == null ? void 0 : T.internal) === "warehouse" ? P.TRANSFER : P.PURCHASE;
1042
- }
1043
- ), s = U(!0), d = ze(m, "show");
1044
- return (p, _) => {
1045
- var L;
1046
- const C = I("FmChip"), T = I("FmMenuDivider"), w = I("FmCard"), S = I("FmButton"), A = I("FmSideSheet");
1047
- return R(), Q(A, {
1048
- header: e(g)("inventory.transfer.template.details.view", { template: (L = p.template) == null ? void 0 : L.name }),
1049
- modelValue: e(d),
1050
- "onUpdate:modelValue": _[2] || (_[2] = (n) => Oe(d) ? d.value = n : null),
1051
- "dismiss-away": s.value,
1052
- "close-button": "",
1053
- "max-width": 500
1054
- }, {
1055
- default: B(() => {
1056
- var n;
1057
- return [
1058
- a("div", io, [
1059
- c(w, {
1060
- variant: "outlined",
1061
- class: "flex flex-col gap-8 px-12 py-16"
1062
- }, {
1063
- default: B(() => {
1064
- var t, o, r, h, y, v, V, x, O;
1065
- return [
1066
- a("div", uo, [
1067
- a("div", mo, F(e(g)("inventory.transfer.template.details.templateSummary")), 1),
1068
- a("div", null, [
1069
- c(C, {
1070
- label: e(g)(
1071
- `inventory.transfer.receiveRequest.details.type.${i.value.toLocaleLowerCase()}`
1072
- ),
1073
- class: "fm-chip-transfer-info",
1074
- compact: ""
1075
- }, null, 8, ["label"])
1076
- ])
1077
- ]),
1078
- c(T),
1079
- a("div", co, [
1080
- a("div", po, [
1081
- a("div", fo, [
1082
- a("div", yo, F(e(g)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1083
- ]),
1084
- a("div", vo, F(e(st)(((t = p.template) == null ? void 0 : t._id) ?? "")), 1)
1085
- ]),
1086
- (o = k.value) != null && o.effectiveAt ? (R(), N("div", bo, [
1087
- a("div", _o, F(e(g)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
1088
- a("div", xo, F(e(yt)(new Date((r = k.value) == null ? void 0 : r.effectiveAt))), 1)
1089
- ])) : ae("", !0),
1090
- a("div", ho, [
1091
- a("div", go, F(e(g)("inventory.transfer.receiveRequest.details.type.title")), 1),
1092
- a("div", ko, F(e(g)(
1093
- `inventory.transfer.receiveRequest.details.type.${i.value.toLocaleLowerCase("en-US")}`
1094
- )), 1)
1095
- ]),
1096
- (y = (h = k.value) == null ? void 0 : h.supplier) != null && y.name ? (R(), N("div", Co, [
1097
- a("div", wo, F(e(g)("inventory.transfer.receiveRequest.details.from")), 1),
1098
- a("div", To, F((V = (v = k.value) == null ? void 0 : v.supplier) == null ? void 0 : V.name), 1)
1099
- ])) : ae("", !0),
1100
- (x = k.value) != null && x.ref ? (R(), N("div", Fo, [
1101
- a("div", $o, F(e(g)("inventory.transfer.receiveRequest.details.reference")), 1),
1102
- a("div", So, F(k.value.ref), 1)
1103
- ])) : ae("", !0),
1104
- (O = k.value) != null && O.remark ? (R(), N("div", Ro, [
1105
- a("div", Io, F(e(g)("inventory.transfer.receiveRequest.details.remark")), 1),
1106
- a("div", Mo, F(k.value.remark), 1)
1107
- ])) : ae("", !0)
1108
- ])
1109
- ];
1110
- }),
1111
- _: 1
1112
- }),
1113
- a("div", Do, [
1114
- a("div", Ao, [
1115
- a("div", Vo, F(e(g)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
1116
- (R(!0), N(Pe, null, We(((n = k.value) == null ? void 0 : n.items) ?? [], (t) => (R(), N("div", {
1117
- key: t.code,
1118
- class: "flex flex-col"
1119
- }, [
1120
- a("div", Oo, [
1121
- a("div", Po, F(t.name), 1),
1122
- _[3] || (_[3] = a("div", { class: "flex-1 min-w-32" }, null, -1)),
1123
- a("div", Bo, F(e(nt)(t.quantity, t.sku.unit, t.measurement)), 1)
1124
- ]),
1125
- a("div", Lo, [
1126
- a("div", Uo, F(t.code), 1),
1127
- t.totalCost && e(f).enableTotalCost ? (R(), N("div", qo, " (" + F(e(Be)(t.totalCost)) + ") ", 1)) : ae("", !0)
1128
- ])
1129
- ]))), 128))
1130
- ])
1131
- ])
1132
- ])
1133
- ];
1134
- }),
1135
- "side-sheet-footer": B(() => [
1136
- a("div", Eo, [
1137
- c(S, {
1138
- label: e(g)("inventory.transfer.template.use"),
1139
- onClick: _[0] || (_[0] = (n) => l("action:use"))
1140
- }, null, 8, ["label"]),
1141
- c(S, {
1142
- label: e(g)("common.edit"),
1143
- onClick: _[1] || (_[1] = (n) => l("action:edit")),
1144
- variant: "tertiary"
1145
- }, null, 8, ["label"])
1146
- ])
1147
- ]),
1148
- _: 1
1149
- }, 8, ["header", "modelValue", "dismiss-away"]);
1150
- };
1151
- }
1152
- }), zo = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 h-full" }, Ho = { class: "flex-1 flex flex-col gap-8" }, jo = { class: "flex flex-col" }, Qo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Go = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Yo = { class: "fm-typo-en-body-lg-400" }, Wo = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, Ko = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, ds = /* @__PURE__ */ W({
1153
- __name: "TransferTemplateView",
1154
- setup(u) {
1155
- const { t: b } = Y(), { createTemplate: m, viewTemplate: l } = Se(), { templateDialogProps: f, transferFormDialogProps: g, templateDetailsProps: k } = gt(
1156
- Se()
1157
- ), i = at(), s = bt(), d = qe(), { breakpoints: p } = Ne();
1158
- d.watchLocation(i.fetchTemplates);
1159
- const _ = M(
1160
- () => i.loading.value || !d._currentLocation
1161
- ), C = M(() => i.templates.value), T = U(""), w = M(() => p.value.xs || p.value.sm ? 10 : 20);
1162
- function S(t) {
1163
- switch (t) {
1164
- case Re.Add:
1165
- return m();
1166
- }
1167
- }
1168
- const A = wt();
1169
- function L() {
1170
- A.push({ name: vt.RECEIVE_REQUEST });
1171
- }
1172
- function n(t) {
1173
- return t;
1174
- }
1175
- return (t, o) => {
1176
- const r = I("FmTable");
1177
- return R(), N(Pe, null, [
1178
- c(et, {
1179
- title: e(b)("inventory.transfer.template.title2"),
1180
- actions: [
1181
- {
1182
- label: e(b)("inventory.transfer.template.create.title"),
1183
- value: e(Re).Add,
1184
- isPrimary: !0,
1185
- prependIcon: "add"
1186
- }
1187
- ],
1188
- "onClick:action": S
1189
- }, {
1190
- default: B(() => {
1191
- var h;
1192
- return [
1193
- a("div", zo, [
1194
- c(tt, {
1195
- searchable: "",
1196
- "change-location": "",
1197
- search: T.value,
1198
- "onUpdate:search": o[0] || (o[0] = (y) => T.value = y),
1199
- actions: [{ icon: "refresh", onClick: e(i).fetchTemplates }]
1200
- }, null, 8, ["search", "actions"]),
1201
- (R(), Q(r, {
1202
- style: Ke(e(s).tableHeight),
1203
- "column-defs": e(i).columnDefs,
1204
- "row-data": C.value,
1205
- "search-value": T.value,
1206
- loading: _.value,
1207
- key: (h = e(d)._currentLocation) == null ? void 0 : h.dbName,
1208
- onRowClick: o[1] || (o[1] = (y) => e(l)(y.original)),
1209
- "page-size": w.value
1210
- }, {
1211
- "list-row": B((y) => [
1212
- c(Ee, {
1213
- row: y,
1214
- onRowClick: (v) => e(l)(v)
1215
- }, {
1216
- default: B((v) => {
1217
- var V, x, O, z, K, Z, J, X, H, ee, te, oe, se, j, ne, ve, be, _e, ie, xe, he, ge, ke, ue, Ce;
1218
- return [
1219
- a("div", Ho, [
1220
- a("div", jo, [
1221
- a("div", Qo, [
1222
- c(e(q), {
1223
- render: (O = (x = (V = v._id) == null ? void 0 : V.column) == null ? void 0 : x.columnDef) == null ? void 0 : O.cell,
1224
- props: (K = (z = v._id) == null ? void 0 : z.getContext) == null ? void 0 : K.call(z)
1225
- }, null, 8, ["render", "props"])
1226
- ]),
1227
- a("div", Go, [
1228
- c(e(q), {
1229
- render: (X = (J = (Z = v.name) == null ? void 0 : Z.column) == null ? void 0 : J.columnDef) == null ? void 0 : X.cell,
1230
- props: (ee = (H = v.name) == null ? void 0 : H.getContext) == null ? void 0 : ee.call(H)
1231
- }, null, 8, ["render", "props"])
1232
- ]),
1233
- a("div", Yo, [
1234
- c(e(q), {
1235
- render: (se = (oe = (te = v.supplier) == null ? void 0 : te.column) == null ? void 0 : oe.columnDef) == null ? void 0 : se.cell,
1236
- props: (ne = (j = v.supplier) == null ? void 0 : j.getContext) == null ? void 0 : ne.call(j)
1237
- }, null, 8, ["render", "props"])
1238
- ]),
1239
- a("div", Wo, F(y.original.purchaseOrder.items.length ? y.original.purchaseOrder.items.map((Qe) => Qe.name).join(", ") : "No items"), 1),
1240
- a("div", Ko, [
1241
- c(e(q), {
1242
- render: (_e = (be = (ve = v.ref) == null ? void 0 : ve.column) == null ? void 0 : be.columnDef) == null ? void 0 : _e.cell,
1243
- props: (xe = (ie = v.ref) == null ? void 0 : ie.getContext) == null ? void 0 : xe.call(ie)
1244
- }, null, 8, ["render", "props"])
1245
- ])
1246
- ]),
1247
- a("div", null, [
1248
- c(e(q), {
1249
- render: (ke = (ge = (he = v.type) == null ? void 0 : he.column) == null ? void 0 : ge.columnDef) == null ? void 0 : ke.cell,
1250
- props: (Ce = (ue = v.type) == null ? void 0 : ue.getContext) == null ? void 0 : Ce.call(ue)
1251
- }, null, 8, ["render", "props"])
1252
- ])
1253
- ])
1254
- ];
1255
- }),
1256
- _: 2
1257
- }, 1032, ["row", "onRowClick"])
1258
- ]),
1259
- _: 1
1260
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1261
- ])
1262
- ];
1263
- }),
1264
- _: 1
1265
- }, 8, ["title", "actions"]),
1266
- (R(), Q(Ze, { to: "body" }, [
1267
- c(Ct, $e(e(g), { onSubmitted: L }), null, 16),
1268
- c(No, Je(Xe(e(k))), null, 16),
1269
- c(ro, $e(e(f), {
1270
- onSubmitted: o[2] || (o[2] = (h) => e(i).fetchTemplates())
1271
- }), null, 16)
1272
- ]))
1273
- ], 64);
1274
- };
1275
- }
1276
- });
1277
- export {
1278
- ds as default
1279
- };