@feedmepos/mf-inventory-portal 0.0.22-dev.32 → 0.0.22-dev.33

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