@feedmepos/mf-inventory-portal 0.0.19-dev.10 → 0.0.19-dev.11

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 (43) hide show
  1. package/dist/{ApprovalView-BgTTFiOw.js → ApprovalView-BtgtZgDY.js} +5 -5
  2. package/dist/{BindingsDialog-BROnpXEI.js → BindingsDialog-DDqu7p2z.js} +1 -1
  3. package/dist/{BindingsPicker-aQHfS_vY.js → BindingsPicker-BDhn5Do7.js} +1 -1
  4. package/dist/{BindingsTable-DvtIQMFk.js → BindingsTable-C5R7orsB.js} +1 -1
  5. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DR9YAhaJ.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0sbKAX9.js} +1 -1
  6. package/dist/{IngredientsView-BgAQCCD-.js → IngredientsView-Ac52Wd12.js} +5 -5
  7. package/dist/{IntegrationView-DEBb_X5K.js → IntegrationView-6mJtJK-d.js} +2 -2
  8. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-VF3PDSzP.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C2BFaTg-.js} +1 -1
  9. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BIRzNfFN.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CL0RBLOF.js} +1 -1
  10. package/dist/{PurchaseOrderPrintPreview-D2zNGZhx.js → PurchaseOrderPrintPreview-UzrsJ0AN.js} +10 -10
  11. package/dist/{ReceiveRequestView-Dc5JlUMC.js → ReceiveRequestView-DW9u9TJZ.js} +7 -7
  12. package/dist/{RecipeView-C1DBn8pW.js → RecipeView-W15pCZKU.js} +5 -5
  13. package/dist/{StockView-6wi6BEOE.js → StockView-BqEe-OIX.js} +167 -167
  14. package/dist/{SupplierView-CS7YdL5Q.js → SupplierView-CGr2N-e7.js} +5 -5
  15. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DupNA58V.js +739 -0
  16. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-COVncBoC.js +1676 -0
  17. package/dist/TransferTemplateView-HgaSR8L8.js +1101 -0
  18. package/dist/{UnitView-BUdKTKch.js → UnitView-C07Yrynl.js} +6 -6
  19. package/dist/{WarehouseView-BbreEn79.js → WarehouseView-DL-8j9vX.js} +4 -4
  20. package/dist/{app-B3oV5Muh.js → app-B1MZZxUg.js} +97 -22
  21. package/dist/app.d.ts +74 -0
  22. package/dist/app.js +1 -1
  23. package/dist/components/row-action.enum.d.ts +3 -1
  24. package/dist/{decimal-DzjRPmPY.js → decimal-BXf_WdLk.js} +1 -1
  25. package/dist/{id-to-date-CG1QobkF.js → id-to-date-Dlovyec6.js} +1 -1
  26. package/dist/layout-BJjS48J5.js +151 -0
  27. package/dist/{purchase-order-transaction-type-D-GMrgDp.js → purchase-order-transaction-type-CMIu0jrP.js} +92 -87
  28. package/dist/row-action.enum-PMKMRrZR.js +50 -0
  29. package/dist/{supplier-BE_AQA4h.js → supplier-IDQmZ4VM.js} +1 -1
  30. package/dist/tsconfig.app.tsbuildinfo +1 -1
  31. package/dist/views/stock/helper/stock-row-action.d.ts +2 -2
  32. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +20 -0
  33. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +9 -0
  34. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -0
  35. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +445 -1
  36. package/dist/{xlsx-BGXLmGtO.js → xlsx-CfdXcS72.js} +1 -1
  37. package/dist/{xlsx.util-DxU-P-ww.js → xlsx.util-C5Wx4IUs.js} +2 -2
  38. package/package.json +2 -2
  39. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CBbbXOhl.js +0 -745
  40. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-CWEypKBc.js +0 -1662
  41. package/dist/TransferTemplateView-C1hmdeKM.js +0 -933
  42. package/dist/layout-qEWDq5Vs.js +0 -147
  43. package/dist/row-action.enum-7jVyol1k.js +0 -36
@@ -0,0 +1,1101 @@
1
+ import { reactive as Le, onMounted as Be, computed as E, h as D, defineComponent as ne, resolveComponent as O, openBlock as F, createElementBlock as z, createElementVNode as s, toDisplayString as k, createVNode as m, unref as e, withCtx as I, watch as Fe, ref as Q, createBlock as H, normalizeClass as Ne, isRef as Ae, createCommentVNode as oe, Fragment as De, renderList as ze, normalizeStyle as He, Teleport as je, mergeProps as ge, normalizeProps as Qe, guardReactiveProps as Ye } from "vue";
2
+ import { _ as Ke, a as Ge } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0sbKAX9.js";
3
+ import { useI18n as Y } from "@feedmepos/mf-common";
4
+ import { c as le, d as Je, u as We, a as Xe, b as xe, e as Ze, _ as et } from "./TransferDialog.vue_vue_type_script_setup_true_lang-COVncBoC.js";
5
+ import { F as ae, R as Ce } from "./row-action.enum-PMKMRrZR.js";
6
+ import { D as ke, R as de, $ as Te, a0 as tt, a as ue, r as we, a1 as st, l as Se, A as me, M as $e, G as Oe, a2 as ot, a3 as Re, b as Ve, u as at, j as Ie, y as lt, a4 as nt, a5 as rt } from "./app-B1MZZxUg.js";
7
+ import { F as U, _ as Me, u as it } from "./layout-BJjS48J5.js";
8
+ import { useBreakpoints as Pe, components as j, FmButtonVariant as ut, useDialog as dt, useSnackbar as mt, useProxiedModel as Ue } from "@feedmepos/ui-library";
9
+ import { storeToRefs as ct } from "pinia";
10
+ import { P as V, f as pt, a as ft } from "./purchase-order-transaction-type-CMIu0jrP.js";
11
+ import { _ as Ee } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-CL0RBLOF.js";
12
+ import { useRouter as yt } from "vue-router";
13
+ import { u as vt } from "./supplier-IDQmZ4VM.js";
14
+ var $ = /* @__PURE__ */ ((u) => (u.Code = "Code", u.Name = "Name", u.DefaultAmount = "DefaultAmount", u.MinimumAmount = "MinimumAmount", u.Step = "Step", u.Cost = "Cost", u.Delete = "Delete", u))($ || {});
15
+ const _t = () => {
16
+ const { t: u } = Y();
17
+ return D(
18
+ Ee,
19
+ {
20
+ zIndex: 50,
21
+ class: "whitespace-nowrap"
22
+ },
23
+ u("inventory.transfer.form.items.table.Cost", [Re()])
24
+ );
25
+ };
26
+ function bt(u) {
27
+ const { t: T } = Y(), c = Le({}), { breakpoints: i } = Pe();
28
+ Be(() => {
29
+ for (const n of u.items) {
30
+ if (!n.totalCost)
31
+ continue;
32
+ const t = le(n.sku, n.quantity, n.measurement, {
33
+ supplier: u.supplier
34
+ }), d = n.totalCost ?? ke.reset();
35
+ t ? c[n.sku._id] = t.amount !== d.amount || t.precision !== d.precision : c[n.sku._id] = !0;
36
+ }
37
+ });
38
+ function f(n) {
39
+ var d, p, h, x, w, S, R;
40
+ return !!(((p = (d = n.defaultCost) == null ? void 0 : d.costPerUnit) == null ? void 0 : p.amount) ?? ((R = (S = (w = (x = (h = u.supplier) == null ? void 0 : h.supplyItems) == null ? void 0 : x.find((M) => M.skuId === n._id)) == null ? void 0 : w.defaultCost) == null ? void 0 : S.costPerUnit) == null ? void 0 : R.amount));
41
+ }
42
+ const v = [
43
+ {
44
+ id: "Code",
45
+ header: () => T("inventory.transfer.form.items.table.Code"),
46
+ accessorKey: "code",
47
+ size: 96,
48
+ cell(n) {
49
+ const t = n.row.original;
50
+ return D(j.FmTextField, {
51
+ modelValue: t.code,
52
+ "onUpdate:modelValue": (d) => {
53
+ u.updateItem({
54
+ ...t,
55
+ code: d
56
+ });
57
+ },
58
+ key: t.sku._id,
59
+ rules: [de()],
60
+ labelMark: "required"
61
+ });
62
+ },
63
+ enableSorting: !1
64
+ },
65
+ {
66
+ id: "Name",
67
+ header: () => T("inventory.transfer.form.items.table.Name"),
68
+ minSize: 300,
69
+ cell(n) {
70
+ const t = n.row.original;
71
+ return D(j.FmTextField, {
72
+ modelValue: t.name,
73
+ "onUpdate:modelValue": (d) => {
74
+ u.updateItem({
75
+ ...t,
76
+ name: d
77
+ });
78
+ },
79
+ key: t.sku._id,
80
+ rules: [de()],
81
+ labelMark: "required"
82
+ });
83
+ },
84
+ enableSorting: !1
85
+ },
86
+ {
87
+ id: "DefaultAmount",
88
+ header: () => T("inventory.transfer.form.items.table.DefaultAmount2"),
89
+ minSize: 150,
90
+ cell(n) {
91
+ const t = n.row.original;
92
+ return D(Te, {
93
+ style: {
94
+ flex: "1 1 0%"
95
+ },
96
+ modelValue: {
97
+ amount: t.quantity ?? { amount: 1, precision: 0 },
98
+ measurement: t.measurement ?? null
99
+ },
100
+ disabled: u.disabled,
101
+ key: t.sku._id,
102
+ unit: t.sku.unit,
103
+ "onUpdate:modelValue": (d) => {
104
+ u.updateItem({
105
+ ...t,
106
+ quantity: d.amount,
107
+ measurement: d.measurement
108
+ });
109
+ },
110
+ rules: [
111
+ tt(
112
+ +ue(
113
+ t.minimumQuantity ?? {
114
+ amount: 1,
115
+ precision: we(t.sku.unit, t.measurement)
116
+ }
117
+ )
118
+ )
119
+ ],
120
+ applyDefaultRules: !0
121
+ });
122
+ },
123
+ enableSorting: !1
124
+ },
125
+ {
126
+ id: "MinimumAmount",
127
+ header: () => T("inventory.transfer.form.items.table.MinimumAmount2"),
128
+ minSize: 124,
129
+ cell(n) {
130
+ const t = n.row.original;
131
+ return D(Te, {
132
+ style: {
133
+ flex: "1 1 0%"
134
+ },
135
+ modelValue: {
136
+ amount: t.minimumQuantity ?? {
137
+ amount: 1,
138
+ precision: we(t.sku.unit, t.measurement)
139
+ },
140
+ measurement: t.measurement ?? null
141
+ },
142
+ disabled: u.disabled,
143
+ key: t.sku._id,
144
+ unit: t.sku.unit,
145
+ "onUpdate:modelValue": (d) => {
146
+ u.updateItem({
147
+ ...t,
148
+ minimumQuantity: d.amount
149
+ });
150
+ },
151
+ rules: [st(0)],
152
+ disableUnit: !0,
153
+ applyDefaultRules: !0
154
+ });
155
+ },
156
+ enableSorting: !1
157
+ },
158
+ {
159
+ id: "Step",
160
+ header: () => T("inventory.transfer.form.items.table.Step"),
161
+ minSize: 100,
162
+ cell(n) {
163
+ const t = n.row.original;
164
+ return D(j.FmTextField, {
165
+ modelValue: ue(t.quantityStep ?? ke.reset(), !1),
166
+ key: t.sku._id,
167
+ "onUpdate:modelValue": (d) => {
168
+ u.updateItem({
169
+ ...t,
170
+ quantityStep: Se(+d)
171
+ });
172
+ },
173
+ rules: [me(0), $e(t.sku.unit, t.measurement)]
174
+ });
175
+ },
176
+ enableSorting: !1
177
+ },
178
+ {
179
+ id: "Cost",
180
+ header: _t,
181
+ size: 180,
182
+ cell(n) {
183
+ const t = n.row.original, d = f(t.sku), p = i.value.xs || i.value.sm;
184
+ return !c[t.sku._id] && d ? D(
185
+ "div",
186
+ {
187
+ class: "flex gap-4 fm-typo-en-body-md-400 items-center",
188
+ key: t.sku._id
189
+ },
190
+ [
191
+ D(j.FmButton, {
192
+ prependIcon: "edit",
193
+ variant: ut.Tertiary,
194
+ onClick() {
195
+ u.updateItem({
196
+ ...t,
197
+ totalCost: le(t.sku, t.quantity, t.measurement, {
198
+ supplier: u.supplier
199
+ })
200
+ }), c[t.sku._id] = !0;
201
+ },
202
+ disabled: u.disabled
203
+ }),
204
+ D(
205
+ "div",
206
+ {
207
+ class: "flex flex-col"
208
+ },
209
+ [
210
+ D(
211
+ "span",
212
+ {
213
+ class: [u.disabled ? "text-fm-color-typo-disabled" : ""]
214
+ },
215
+ p ? Oe(
216
+ le(t.sku, t.quantity, t.measurement, {
217
+ supplier: u.supplier
218
+ })
219
+ ) : ue(
220
+ le(t.sku, t.quantity, t.measurement, {
221
+ supplier: u.supplier
222
+ })
223
+ )
224
+ ),
225
+ D(
226
+ "span",
227
+ {
228
+ class: [
229
+ "fm-typo-en-body-sm-400",
230
+ u.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
231
+ ]
232
+ },
233
+ T("inventory.transfer.form.items.autoCalculated")
234
+ )
235
+ ]
236
+ )
237
+ ]
238
+ ) : D(
239
+ j.FmTextField,
240
+ {
241
+ modelValue: ue(t.totalCost ?? { amount: 0, precision: 0 }),
242
+ key: t.sku._id,
243
+ "onUpdate:modelValue": (h) => {
244
+ u.updateItem({
245
+ ...t,
246
+ totalCost: {
247
+ ...Se(+h),
248
+ currency: ot()
249
+ }
250
+ });
251
+ },
252
+ rules: [me(0), $e(2)]
253
+ },
254
+ {
255
+ prepend() {
256
+ return p ? D(
257
+ "div",
258
+ {
259
+ class: [
260
+ "text-fm-typo-en-body-lg-400",
261
+ u.disabled ? "text-fm-color-typo-disabled" : ""
262
+ ]
263
+ },
264
+ Re()
265
+ ) : null;
266
+ },
267
+ append() {
268
+ return d ? D(j.FmButton, {
269
+ prependIcon: "close",
270
+ variant: "tertiary",
271
+ onClick() {
272
+ u.updateItem({
273
+ ...t,
274
+ totalCost: null
275
+ }), c[t.sku._id] = !1;
276
+ },
277
+ disabled: u.disabled
278
+ }) : null;
279
+ }
280
+ }
281
+ );
282
+ },
283
+ enableSorting: !1
284
+ },
285
+ {
286
+ id: "Delete",
287
+ header: "",
288
+ cell(n) {
289
+ const t = n.row.original;
290
+ return D(j.FmButton, {
291
+ class: "delete-button",
292
+ key: t.sku._id,
293
+ type: "button",
294
+ icon: "delete",
295
+ variant: "tertiary",
296
+ size: "md",
297
+ disabled: u.disabled,
298
+ onClick: () => {
299
+ u.deleteItem(t);
300
+ }
301
+ });
302
+ },
303
+ enableSorting: !1,
304
+ size: 40,
305
+ meta: {
306
+ cellClass: "",
307
+ headerClass: ""
308
+ }
309
+ }
310
+ ];
311
+ return {
312
+ columnDefs: E(() => Ve().enableTotalCost && u.transferType === V.PURCHASE ? v : v.filter((t) => t.id !== "Cost"))
313
+ };
314
+ }
315
+ const ht = { class: "flex flex-col gap-8 py-16" }, gt = { class: "flex items-center" }, xt = { class: "flex-1 flex gap-1 items-center" }, Ct = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, kt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Tt = { class: "flex gap-8 w-full" }, wt = { class: "flex-1 flex flex-col gap-4" }, St = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), $t = { class: "flex-1 flex flex-col gap-4" }, Ft = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), At = { class: "flex gap-8 w-full" }, Dt = { class: "flex-1 flex flex-col gap-4" }, Ot = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Rt = { class: "flex-1 flex flex-col gap-4" }, Vt = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), It = { class: "flex gap-8 w-full" }, Mt = { class: "flex-1 flex flex-col gap-4" }, Pt = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Ut = { class: "flex-1 flex flex-col gap-4" }, Et = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), qt = /* @__PURE__ */ ne({
316
+ __name: "TransferTemplateItem",
317
+ props: {
318
+ cellByColId: {},
319
+ row: {}
320
+ },
321
+ setup(u) {
322
+ const { t: T } = Y();
323
+ return (c, i) => {
324
+ var v, g, n, t, d, p, h, x, w, S, R, M, q, a, l, o, r, C, _, y, A, b, P, L, K, G, J, W, B, X, Z, ee, te, N, se;
325
+ const f = O("FmLabel");
326
+ return F(), z("div", ht, [
327
+ s("div", gt, [
328
+ s("div", xt, [
329
+ s("span", Ct, " (" + k(c.row.original.sku.code) + ") ", 1),
330
+ s("span", kt, k(c.row.original.sku.name), 1)
331
+ ]),
332
+ s("div", null, [
333
+ m(e(U), {
334
+ render: (n = (g = (v = c.cellByColId.Delete) == null ? void 0 : v.column) == null ? void 0 : g.columnDef) == null ? void 0 : n.cell,
335
+ props: (d = (t = c.cellByColId.Delete) == null ? void 0 : t.getContext) == null ? void 0 : d.call(t)
336
+ }, null, 8, ["render", "props"])
337
+ ])
338
+ ]),
339
+ s("div", Tt, [
340
+ s("div", wt, [
341
+ m(f, {
342
+ label: e(T)(`inventory.transfer.form.items.table.${e($).Code}`)
343
+ }, null, 8, ["label"]),
344
+ m(e(U), {
345
+ render: (x = (h = (p = c.cellByColId[e($).Code]) == null ? void 0 : p.column) == null ? void 0 : h.columnDef) == null ? void 0 : x.cell,
346
+ props: (S = (w = c.cellByColId[e($).Code]) == null ? void 0 : w.getContext) == null ? void 0 : S.call(w)
347
+ }, null, 8, ["render", "props"]),
348
+ St
349
+ ]),
350
+ s("div", $t, [
351
+ m(f, {
352
+ label: e(T)(`inventory.transfer.form.items.table.${e($).Name}`)
353
+ }, null, 8, ["label"]),
354
+ m(e(U), {
355
+ render: (q = (M = (R = c.cellByColId[e($).Name]) == null ? void 0 : R.column) == null ? void 0 : M.columnDef) == null ? void 0 : q.cell,
356
+ props: (l = (a = c.cellByColId[e($).Name]) == null ? void 0 : a.getContext) == null ? void 0 : l.call(a)
357
+ }, null, 8, ["render", "props"]),
358
+ Ft
359
+ ])
360
+ ]),
361
+ s("div", At, [
362
+ s("div", Dt, [
363
+ m(f, {
364
+ label: e(T)(`inventory.transfer.form.items.table.${e($).MinimumAmount}`)
365
+ }, null, 8, ["label"]),
366
+ m(e(U), {
367
+ render: (C = (r = (o = c.cellByColId[e($).MinimumAmount]) == null ? void 0 : o.column) == null ? void 0 : r.columnDef) == null ? void 0 : C.cell,
368
+ props: (y = (_ = c.cellByColId[e($).MinimumAmount]) == null ? void 0 : _.getContext) == null ? void 0 : y.call(_)
369
+ }, null, 8, ["render", "props"]),
370
+ Ot
371
+ ]),
372
+ s("div", Rt, [
373
+ m(f, {
374
+ label: e(T)(`inventory.transfer.form.items.table.${e($).Step}`)
375
+ }, null, 8, ["label"]),
376
+ m(e(U), {
377
+ render: (P = (b = (A = c.cellByColId[e($).Step]) == null ? void 0 : A.column) == null ? void 0 : b.columnDef) == null ? void 0 : P.cell,
378
+ props: (K = (L = c.cellByColId[e($).Step]) == null ? void 0 : L.getContext) == null ? void 0 : K.call(L)
379
+ }, null, 8, ["render", "props"]),
380
+ Vt
381
+ ])
382
+ ]),
383
+ s("div", It, [
384
+ s("div", Mt, [
385
+ m(f, {
386
+ label: e(T)(`inventory.transfer.form.items.table.${e($).DefaultAmount}`)
387
+ }, null, 8, ["label"]),
388
+ m(e(U), {
389
+ render: (W = (J = (G = c.cellByColId[e($).DefaultAmount]) == null ? void 0 : G.column) == null ? void 0 : J.columnDef) == null ? void 0 : W.cell,
390
+ props: (X = (B = c.cellByColId[e($).DefaultAmount]) == null ? void 0 : B.getContext) == null ? void 0 : X.call(B)
391
+ }, null, 8, ["render", "props"]),
392
+ Pt
393
+ ]),
394
+ s("div", Ut, [
395
+ m(Ee, { "z-index": 50 }, {
396
+ default: I(() => [
397
+ m(f, {
398
+ label: e(T)(`inventory.transfer.form.items.table.${e($).Cost}2`)
399
+ }, null, 8, ["label"])
400
+ ]),
401
+ _: 1
402
+ }),
403
+ m(e(U), {
404
+ render: (te = (ee = (Z = c.cellByColId[e($).Cost]) == null ? void 0 : Z.column) == null ? void 0 : ee.columnDef) == null ? void 0 : te.cell,
405
+ props: (se = (N = c.cellByColId[e($).Cost]) == null ? void 0 : N.getContext) == null ? void 0 : se.call(N)
406
+ }, null, 8, ["render", "props"]),
407
+ Et
408
+ ])
409
+ ])
410
+ ]);
411
+ };
412
+ }
413
+ }), Lt = { class: "flex flex-col gap-16" }, Bt = { class: "flex flex-col gap-24" }, Nt = { class: "flex flex-col gap-16" }, zt = { class: "flex" }, Ht = { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, jt = /* @__PURE__ */ ne({
414
+ __name: "TransferTemplateForm",
415
+ props: {
416
+ modelValue: {},
417
+ disabled: { type: Boolean }
418
+ },
419
+ setup(u, { expose: T }) {
420
+ const c = u, i = Je(), { t: f } = Y(), v = Ie(), g = at(), n = vt();
421
+ Fe(
422
+ () => c.modelValue,
423
+ (a) => {
424
+ console.log("TransferTemplateForm.model", a);
425
+ }
426
+ ), v.watchLocation(async () => {
427
+ location && (i.purchaseOrder.supplier || (i.purchaseOrder.supplier = n.suppliers.find((a) => a) ?? i.purchaseOrder.supplier));
428
+ });
429
+ const t = dt(), d = We(
430
+ () => i.purchaseOrder,
431
+ (a) => {
432
+ i.purchaseOrder = {
433
+ ...i.purchaseOrder,
434
+ ...a
435
+ };
436
+ }
437
+ ), p = E({
438
+ get() {
439
+ var a, l;
440
+ return typeof ((l = (a = i.purchaseOrder) == null ? void 0 : a.supplier) == null ? void 0 : l.internal) == "string" ? V.TRANSFER : V.PURCHASE;
441
+ },
442
+ set(a) {
443
+ var o, r;
444
+ const l = typeof ((r = (o = i.purchaseOrder) == null ? void 0 : o.supplier) == null ? void 0 : r.internal) == "string" ? V.TRANSFER : V.PURCHASE;
445
+ a !== l && (i.purchaseOrder.supplier = a === V.PURCHASE ? d.locationOptionsTypePurchase.value[0] : d.locationOptionsTypeTransfer.value[0]);
446
+ }
447
+ }), h = E(() => d.transferLocationOptions.value), x = E({
448
+ get() {
449
+ return i.purchaseOrder.supplier._id;
450
+ },
451
+ set(a) {
452
+ d.transferLocationModel.value = a;
453
+ }
454
+ }), w = E({
455
+ get() {
456
+ return i.purchaseOrder.remark ?? void 0;
457
+ },
458
+ set(a) {
459
+ i.purchaseOrder.remark = a;
460
+ }
461
+ }), S = Q();
462
+ T({
463
+ validateInputs: () => {
464
+ var a, l;
465
+ (l = (a = S.value) == null ? void 0 : a.validateInputs) == null || l.call(a);
466
+ },
467
+ resetInputsValidation: () => {
468
+ var a, l;
469
+ (l = (a = S.value) == null ? void 0 : a.resetInputsValidation) == null || l.call(a);
470
+ },
471
+ resetInputs: () => {
472
+ var a, l;
473
+ (l = (a = S.value) == null ? void 0 : a.resetInputs) == null || l.call(a);
474
+ }
475
+ });
476
+ const R = bt({
477
+ updateItem: (a) => {
478
+ i.purchaseOrder.items = i.purchaseOrder.items.map((l) => l.sku._id !== a.sku._id ? l : a);
479
+ },
480
+ deleteItem: (a) => {
481
+ i.purchaseOrder.items = i.purchaseOrder.items.filter(
482
+ (l) => l.sku._id !== a.sku._id
483
+ );
484
+ },
485
+ get supplier() {
486
+ return i.purchaseOrder.supplier;
487
+ },
488
+ get items() {
489
+ return i.purchaseOrder.items;
490
+ },
491
+ get transferType() {
492
+ return p.value;
493
+ },
494
+ get disabled() {
495
+ return c.disabled;
496
+ }
497
+ }), M = E(() => R.columnDefs.value);
498
+ function q() {
499
+ const a = g.skus.map((o) => ({
500
+ label: o.name,
501
+ sublabel: o.code,
502
+ value: o
503
+ })), l = a.filter((o) => {
504
+ var r;
505
+ return (r = i.purchaseOrder.items) == null ? void 0 : r.find((C) => C.sku._id === o.value._id);
506
+ }).map((o) => o.value);
507
+ t.open({
508
+ title: "Select item",
509
+ closeButton: !0,
510
+ contentComponent: lt,
511
+ contentComponentProps: {
512
+ modelValue: l,
513
+ items: a
514
+ },
515
+ primaryActions: {
516
+ text: "Confirm",
517
+ close: !0
518
+ },
519
+ secondaryActions: {
520
+ text: "Close",
521
+ close: !0,
522
+ variant: "tertiary"
523
+ }
524
+ }).onPrimary((o) => {
525
+ const r = i.purchaseOrder.items ?? [], C = o.map((_) => {
526
+ const y = r.find((b) => b.sku._id === _._id);
527
+ if (y)
528
+ return y;
529
+ const A = {
530
+ sku: _,
531
+ code: _.code,
532
+ name: _.name,
533
+ quantity: {
534
+ amount: 1,
535
+ precision: 0
536
+ }
537
+ };
538
+ return p.value == V.PURCHASE && (A.totalCost = le(
539
+ A.sku,
540
+ A.quantity,
541
+ A.measurement,
542
+ {
543
+ supplier: i.purchaseOrder.supplier
544
+ }
545
+ )), A;
546
+ });
547
+ C.sort((_, y) => _.sku.code.localeCompare(y.sku.code)), i.purchaseOrder.items = C;
548
+ });
549
+ }
550
+ return (a, l) => {
551
+ const o = O("FmTextField"), r = O("FmSelect"), C = O("FmTextarea"), _ = O("FmButton"), y = O("FmTable"), A = O("FmForm");
552
+ return F(), H(A, {
553
+ ref_key: "formRef",
554
+ ref: S,
555
+ class: "flex flex-col gap-32",
556
+ disabled: a.disabled
557
+ }, {
558
+ default: I(() => [
559
+ s("div", Lt, [
560
+ s("div", Bt, [
561
+ m(o, {
562
+ label: e(f)("inventory.transfer.form.name"),
563
+ "label-mark": "required",
564
+ modelValue: e(i).name,
565
+ "onUpdate:modelValue": l[0] || (l[0] = (b) => e(i).name = b),
566
+ rules: [e(de)()]
567
+ }, null, 8, ["label", "modelValue", "rules"]),
568
+ m(r, {
569
+ label: e(f)("inventory.transfer.form.type.title"),
570
+ "model-value": p.value,
571
+ "onUpdate:modelValue": l[1] || (l[1] = (b) => p.value = b),
572
+ items: [
573
+ {
574
+ label: e(f)(
575
+ `inventory.transfer.form.type.${e(V).PURCHASE.toLocaleLowerCase()}`
576
+ ),
577
+ value: e(V).PURCHASE,
578
+ disabled: !e(d).locationOptionsTypePurchase.value.length,
579
+ sublabel: e(d).locationOptionsTypePurchase.value.length ? void 0 : e(f)("inventory.transfer.form.noSupplierAvailable")
580
+ },
581
+ {
582
+ label: e(f)(
583
+ `inventory.transfer.form.type.${e(V).TRANSFER.toLocaleLowerCase()}`
584
+ ),
585
+ value: e(V).TRANSFER,
586
+ disabled: !e(d).locationOptionsTypeTransfer.value.length,
587
+ sublabel: e(d).locationOptionsTypeTransfer.value.length ? void 0 : e(f)("inventory.transfer.form.noLocationAvailable")
588
+ }
589
+ ],
590
+ rules: [e(me)(1)(h.value)]
591
+ }, null, 8, ["label", "model-value", "items", "rules"]),
592
+ m(r, {
593
+ label: p.value === e(V).PURCHASE ? e(f)("inventory.transfer.form.purchaseFrom") : e(f)("inventory.transfer.form.transferFrom"),
594
+ modelValue: x.value,
595
+ "onUpdate:modelValue": l[2] || (l[2] = (b) => x.value = b),
596
+ items: h.value
597
+ }, null, 8, ["label", "modelValue", "items"]),
598
+ m(o, {
599
+ label: e(f)("inventory.transfer.form.reference"),
600
+ "label-mark": "optional",
601
+ modelValue: e(i).purchaseOrder.ref,
602
+ "onUpdate:modelValue": l[3] || (l[3] = (b) => e(i).purchaseOrder.ref = b)
603
+ }, null, 8, ["label", "modelValue"]),
604
+ m(C, {
605
+ label: e(f)("inventory.transfer.form.remark"),
606
+ "label-mark": "optional",
607
+ "max-length": 240,
608
+ modelValue: w.value,
609
+ "onUpdate:modelValue": l[4] || (l[4] = (b) => w.value = b),
610
+ class: Ne({ "text-fm-color-typo-disabled": a.disabled })
611
+ }, null, 8, ["label", "modelValue", "class"])
612
+ ])
613
+ ]),
614
+ s("div", Nt, [
615
+ s("div", zt, [
616
+ s("div", Ht, k(e(f)("inventory.transfer.form.items.title")), 1),
617
+ m(_, {
618
+ disabled: a.disabled,
619
+ label: e(f)("inventory.transfer.form.items.addItem"),
620
+ "prepend-icon": "add",
621
+ variant: "plain",
622
+ class: "border-2 rounded-lg border-fm-color-primary",
623
+ onClick: l[5] || (l[5] = (b) => q()),
624
+ size: "md"
625
+ }, null, 8, ["disabled", "label"])
626
+ ]),
627
+ (F(), H(y, {
628
+ "column-defs": M.value,
629
+ "row-data": e(i).purchaseOrder.items,
630
+ key: e(i).purchaseOrder.items.map((b) => b.sku._id).join("."),
631
+ "hide-footer": ""
632
+ }, {
633
+ "list-row": I((b) => [
634
+ (F(), H(Me, {
635
+ row: b,
636
+ key: e(i).purchaseOrder.items.map((P) => P.sku._id).join(".")
637
+ }, {
638
+ default: I((P) => [
639
+ m(qt, {
640
+ row: b,
641
+ "cell-by-col-id": P
642
+ }, null, 8, ["row", "cell-by-col-id"])
643
+ ]),
644
+ _: 2
645
+ }, 1032, ["row"]))
646
+ ]),
647
+ _: 1
648
+ }, 8, ["column-defs", "row-data"]))
649
+ ])
650
+ ]),
651
+ _: 1
652
+ }, 8, ["disabled"]);
653
+ };
654
+ }
655
+ }), Qt = { class: "flex items-center" }, Yt = { class: "fm-typo-en-title-md-800" }, Kt = { class: "flex gap-4" }, Gt = /* @__PURE__ */ ne({
656
+ __name: "TransferTemplateDialog",
657
+ props: {
658
+ mode: {},
659
+ modelValue: {},
660
+ show: { type: Boolean }
661
+ },
662
+ emits: ["update:show", "submitted"],
663
+ setup(u, { expose: T, emit: c }) {
664
+ var l;
665
+ const i = u, f = c, v = Xe(), g = mt(), { t: n } = Y(), t = Ue(i, "show");
666
+ function d() {
667
+ return {
668
+ _id: "",
669
+ name: "",
670
+ purchaseOrder: {
671
+ remark: void 0,
672
+ ref: void 0,
673
+ stockSnapshotId: void 0,
674
+ effectiveAt: void 0,
675
+ items: [],
676
+ supplier: {
677
+ _rev: void 0,
678
+ email: void 0,
679
+ internal: void 0,
680
+ contactName: void 0,
681
+ phoneNumber: void 0,
682
+ registrationNumber: void 0,
683
+ supplyItems: void 0,
684
+ _id: "",
685
+ name: "",
686
+ address: {
687
+ line2: void 0,
688
+ line1: "",
689
+ state: "",
690
+ city: "",
691
+ postcode: "",
692
+ country: ""
693
+ }
694
+ }
695
+ }
696
+ };
697
+ }
698
+ const p = Q(i.modelValue ?? d()), h = Q(((l = i.modelValue) == null ? void 0 : l._id) ?? `${Math.random()}`);
699
+ Fe(
700
+ () => i.show,
701
+ (o) => {
702
+ var r;
703
+ o && (p.value = i.modelValue ?? d(), h.value = ((r = i.modelValue) == null ? void 0 : r._id) ?? `${Math.random()}`);
704
+ }
705
+ );
706
+ const x = Q(!1), w = E(() => {
707
+ switch (i.mode) {
708
+ case ae.READ:
709
+ return "";
710
+ case ae.CREATE:
711
+ return n("inventory.transfer.template.create.title");
712
+ case ae.UPDATE:
713
+ return n("inventory.transfer.template.update.title");
714
+ }
715
+ return "";
716
+ }), S = Q();
717
+ T({
718
+ validateInputs: () => {
719
+ var o, r;
720
+ (r = (o = S.value) == null ? void 0 : o.validateInputs) == null || r.call(o);
721
+ },
722
+ resetInputsValidation: () => {
723
+ var o, r;
724
+ (r = (o = S.value) == null ? void 0 : o.resetInputsValidation) == null || r.call(o);
725
+ },
726
+ resetInputs: () => {
727
+ var o, r;
728
+ (r = (o = S.value) == null ? void 0 : o.resetInputs) == null || r.call(o);
729
+ }
730
+ });
731
+ async function R() {
732
+ const o = p.value;
733
+ if (o) {
734
+ x.value = !0, (o.purchaseOrder.supplier.internal === "warehouse" || o.purchaseOrder.supplier.internal === "restaurant") && (o.purchaseOrder.items = o.purchaseOrder.items.map(
735
+ ({ totalCost: r, ...C }) => C
736
+ ));
737
+ try {
738
+ await v.createTemplate(o), await new Promise((r) => setTimeout(r, 1e3)), g.open({
739
+ title: n("inventory.transfer.template.create.success"),
740
+ message: n("inventory.transfer.template.create.successMessage"),
741
+ type: "success"
742
+ }), f("update:show", !1), f("submitted");
743
+ } catch (r) {
744
+ g.open({
745
+ title: n("inventory.transfer.template.create.error"),
746
+ message: n("inventory.transfer.template.create.errorMessage"),
747
+ type: "error"
748
+ }), console.error("Error in creating transfer template", r);
749
+ } finally {
750
+ x.value = !1;
751
+ }
752
+ }
753
+ }
754
+ async function M() {
755
+ const o = p.value;
756
+ if (o) {
757
+ x.value = !0, (o.purchaseOrder.supplier.internal === "warehouse" || o.purchaseOrder.supplier.internal === "restaurant") && (o.purchaseOrder.items = o.purchaseOrder.items.map(
758
+ ({ totalCost: r, ...C }) => C
759
+ ));
760
+ try {
761
+ await v.updateTemplate(o), await new Promise((r) => setTimeout(r, 1e3)), g.open({
762
+ title: n("inventory.transfer.template.update.success"),
763
+ message: n("inventory.transfer.template.update.successMessage"),
764
+ type: "success"
765
+ }), f("update:show", !1), f("submitted");
766
+ } catch (r) {
767
+ g.open({
768
+ title: n("inventory.transfer.template.update.error"),
769
+ message: n("inventory.transfer.template.update.errorMessage"),
770
+ type: "error"
771
+ }), console.error("Error in updating transfer template", r);
772
+ } finally {
773
+ x.value = !1;
774
+ }
775
+ }
776
+ }
777
+ function q() {
778
+ switch (i.mode) {
779
+ case ae.CREATE:
780
+ return R();
781
+ case ae.UPDATE:
782
+ return M();
783
+ }
784
+ }
785
+ function a() {
786
+ var o, r;
787
+ (r = (o = S.value) == null ? void 0 : o.validateInputs) == null || r.call(o);
788
+ }
789
+ return (o, r) => {
790
+ const C = O("FmButton"), _ = O("FmSideSheet");
791
+ return F(), H(_, {
792
+ modelValue: e(t),
793
+ "onUpdate:modelValue": r[2] || (r[2] = (y) => Ae(t) ? t.value = y : null),
794
+ "dismiss-away": "",
795
+ "close-button": "",
796
+ "max-width": 900
797
+ }, {
798
+ "side-sheet-header": I(() => [
799
+ s("div", Qt, [
800
+ s("div", Yt, k(w.value), 1)
801
+ ])
802
+ ]),
803
+ default: I(() => [
804
+ (F(), H(jt, {
805
+ class: "w-full",
806
+ ref_key: "formRef",
807
+ ref: S,
808
+ onValidationSuccess: q,
809
+ "model-value": p.value,
810
+ "onUpdate:modelValue": r[0] || (r[0] = (y) => p.value = y),
811
+ disabled: x.value,
812
+ key: h.value
813
+ }, null, 8, ["model-value", "disabled"]))
814
+ ]),
815
+ "side-sheet-footer": I(() => [
816
+ s("div", Kt, [
817
+ m(C, {
818
+ loading: x.value,
819
+ label: e(n)("common.save"),
820
+ onClick: a
821
+ }, null, 8, ["loading", "label"]),
822
+ m(C, {
823
+ disabled: x.value,
824
+ variant: "tertiary",
825
+ label: e(n)("common.close"),
826
+ onClick: r[1] || (r[1] = (y) => f("update:show", !1))
827
+ }, null, 8, ["disabled", "label"])
828
+ ])
829
+ ]),
830
+ _: 1
831
+ }, 8, ["modelValue"]);
832
+ };
833
+ }
834
+ }), Jt = { class: "flex flex-col gap-16 w-full h-full" }, Wt = { class: "flex justify-between" }, Xt = { class: "fm-typo-en-body-lg-600" }, Zt = { class: "flex flex-col gap-8" }, es = { class: "flex flex-col gap-4" }, ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ss = { class: "flex gap-1" }, os = { class: "fm-typo-en-body-lg-600" }, as = {
835
+ key: 0,
836
+ class: "flex flex-col gap-4"
837
+ }, ls = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ns = { class: "fm-typo-en-body-lg-600" }, rs = { class: "flex flex-col gap-4" }, is = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, us = { class: "fm-typo-en-body-lg-600" }, ds = {
838
+ key: 1,
839
+ class: "flex flex-col gap-4"
840
+ }, ms = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, cs = { class: "fm-typo-en-body-lg-600" }, ps = {
841
+ key: 2,
842
+ class: "flex flex-col gap-4"
843
+ }, fs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ys = { class: "fm-typo-en-body-lg-600" }, vs = {
844
+ key: 3,
845
+ class: "flex flex-col gap-4"
846
+ }, _s = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, bs = { class: "fm-typo-en-body-lg-600" }, hs = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, gs = { class: "flex flex-col gap-8" }, xs = { class: "fm-typo-en-body-lg-600" }, Cs = { class: "flex w-full gap-4" }, ks = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, Ts = /* @__PURE__ */ s("div", { class: "flex-1 min-w-32" }, null, -1), ws = { class: "fm-typo-en-body-lg-600 shrink-0" }, Ss = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, $s = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Fs = {
847
+ key: 0,
848
+ class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
849
+ }, As = { class: "flex gap-8 xs:flex-col" }, Ds = /* @__PURE__ */ ne({
850
+ __name: "TransferTemplateDetails",
851
+ props: {
852
+ template: {},
853
+ show: { type: Boolean }
854
+ },
855
+ emits: ["update:show", "action:use", "action:edit"],
856
+ setup(u, { emit: T }) {
857
+ const c = u, i = T, f = Ve(), { t: v } = Y(), g = E(() => {
858
+ var p;
859
+ return (p = c.template) == null ? void 0 : p.purchaseOrder;
860
+ }), n = E(
861
+ () => {
862
+ var p, h, x, w;
863
+ return ((h = (p = g.value) == null ? void 0 : p.supplier) == null ? void 0 : h.internal) === "restaurant" || ((w = (x = g.value) == null ? void 0 : x.supplier) == null ? void 0 : w.internal) === "warehouse" ? V.TRANSFER : V.PURCHASE;
864
+ }
865
+ ), t = Q(!0), d = Ue(c, "show");
866
+ return (p, h) => {
867
+ var q;
868
+ const x = O("FmChip"), w = O("FmMenuDivider"), S = O("FmCard"), R = O("FmButton"), M = O("FmSideSheet");
869
+ return F(), H(M, {
870
+ header: e(v)("inventory.transfer.template.details.view", { template: (q = p.template) == null ? void 0 : q.name }),
871
+ modelValue: e(d),
872
+ "onUpdate:modelValue": h[2] || (h[2] = (a) => Ae(d) ? d.value = a : null),
873
+ "dismiss-away": t.value,
874
+ "close-button": "",
875
+ "max-width": 500
876
+ }, {
877
+ default: I(() => {
878
+ var a;
879
+ return [
880
+ s("div", Jt, [
881
+ m(S, {
882
+ variant: "outlined",
883
+ class: "flex flex-col gap-8 px-12 py-16"
884
+ }, {
885
+ default: I(() => {
886
+ var l, o, r, C, _, y, A, b, P;
887
+ return [
888
+ s("div", Wt, [
889
+ s("div", Xt, k(e(v)("inventory.transfer.template.details.templateSummary")), 1),
890
+ s("div", null, [
891
+ m(x, {
892
+ label: e(v)(
893
+ `inventory.transfer.receiveRequest.details.type.${n.value.toLocaleLowerCase()}`
894
+ ),
895
+ class: "fm-chip-transfer-info",
896
+ compact: ""
897
+ }, null, 8, ["label"])
898
+ ])
899
+ ]),
900
+ m(w),
901
+ s("div", Zt, [
902
+ s("div", es, [
903
+ s("div", ts, [
904
+ s("div", ss, k(e(v)("inventory.transfer.receiveRequest.details.createdAt")), 1)
905
+ ]),
906
+ s("div", os, k(e(pt)(((l = p.template) == null ? void 0 : l._id) ?? "")), 1)
907
+ ]),
908
+ (o = g.value) != null && o.effectiveAt ? (F(), z("div", as, [
909
+ s("div", ls, k(e(v)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
910
+ s("div", ns, k(e(nt)(new Date((r = g.value) == null ? void 0 : r.effectiveAt))), 1)
911
+ ])) : oe("", !0),
912
+ s("div", rs, [
913
+ s("div", is, k(e(v)("inventory.transfer.receiveRequest.details.type.title")), 1),
914
+ s("div", us, k(e(v)(
915
+ `inventory.transfer.receiveRequest.details.type.${n.value.toLocaleLowerCase("en-US")}`
916
+ )), 1)
917
+ ]),
918
+ (_ = (C = g.value) == null ? void 0 : C.supplier) != null && _.name ? (F(), z("div", ds, [
919
+ s("div", ms, k(e(v)("inventory.transfer.receiveRequest.details.from")), 1),
920
+ s("div", cs, k((A = (y = g.value) == null ? void 0 : y.supplier) == null ? void 0 : A.name), 1)
921
+ ])) : oe("", !0),
922
+ (b = g.value) != null && b.ref ? (F(), z("div", ps, [
923
+ s("div", fs, k(e(v)("inventory.transfer.receiveRequest.details.reference")), 1),
924
+ s("div", ys, k(g.value.ref), 1)
925
+ ])) : oe("", !0),
926
+ (P = g.value) != null && P.remark ? (F(), z("div", vs, [
927
+ s("div", _s, k(e(v)("inventory.transfer.receiveRequest.details.remark")), 1),
928
+ s("div", bs, k(g.value.remark), 1)
929
+ ])) : oe("", !0)
930
+ ])
931
+ ];
932
+ }),
933
+ _: 1
934
+ }),
935
+ s("div", hs, [
936
+ s("div", gs, [
937
+ s("div", xs, k(e(v)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
938
+ (F(!0), z(De, null, ze(((a = g.value) == null ? void 0 : a.items) ?? [], (l) => (F(), z("div", {
939
+ key: l.code,
940
+ class: "flex flex-col"
941
+ }, [
942
+ s("div", Cs, [
943
+ s("div", ks, k(l.name), 1),
944
+ Ts,
945
+ s("div", ws, k(e(ft)(l.quantity, l.sku.unit, l.measurement)), 1)
946
+ ]),
947
+ s("div", Ss, [
948
+ s("div", $s, k(l.code), 1),
949
+ l.totalCost && e(f).enableTotalCost ? (F(), z("div", Fs, " (" + k(e(Oe)(l.totalCost)) + ") ", 1)) : oe("", !0)
950
+ ])
951
+ ]))), 128))
952
+ ])
953
+ ])
954
+ ])
955
+ ];
956
+ }),
957
+ "side-sheet-footer": I(() => [
958
+ s("div", As, [
959
+ m(R, {
960
+ label: e(v)("inventory.transfer.template.use"),
961
+ onClick: h[0] || (h[0] = (a) => i("action:use"))
962
+ }, null, 8, ["label"]),
963
+ m(R, {
964
+ label: e(v)("common.edit"),
965
+ onClick: h[1] || (h[1] = (a) => i("action:edit")),
966
+ variant: "tertiary"
967
+ }, null, 8, ["label"])
968
+ ])
969
+ ]),
970
+ _: 1
971
+ }, 8, ["header", "modelValue", "dismiss-away"]);
972
+ };
973
+ }
974
+ }), Os = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 h-full" }, Rs = { class: "flex-1 flex flex-col gap-8" }, Vs = { class: "flex flex-col" }, Is = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ms = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ps = { class: "fm-typo-en-body-lg-400" }, Us = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, Es = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Xs = /* @__PURE__ */ ne({
975
+ __name: "TransferTemplateView",
976
+ setup(u) {
977
+ const { t: T } = Y(), { createTemplate: c, viewTemplate: i } = xe(), { templateDialogProps: f, transferFormDialogProps: v, templateDetailsProps: g } = ct(
978
+ xe()
979
+ ), n = Ze(), t = it(), d = Ie(), { breakpoints: p } = Pe();
980
+ d.watchLocation(n.fetchTemplates);
981
+ const h = E(
982
+ () => n.loading.value || !d._currentLocation
983
+ ), x = E(() => n.templates.value), w = Q(""), S = E(() => p.value.xs || p.value.sm ? 10 : 20);
984
+ function R(l) {
985
+ switch (l) {
986
+ case Ce.Add:
987
+ return c();
988
+ }
989
+ }
990
+ const M = yt();
991
+ function q() {
992
+ M.push({ name: rt.RECEIVE_REQUEST });
993
+ }
994
+ function a(l) {
995
+ return l;
996
+ }
997
+ return (l, o) => {
998
+ const r = O("FmTable");
999
+ return F(), z(De, null, [
1000
+ m(Ke, {
1001
+ title: e(T)("inventory.transfer.template.title2"),
1002
+ actions: [
1003
+ {
1004
+ label: e(T)("inventory.transfer.template.create.title"),
1005
+ value: e(Ce).Add,
1006
+ isPrimary: !0,
1007
+ prependIcon: "add"
1008
+ }
1009
+ ],
1010
+ "onClick:action": R
1011
+ }, {
1012
+ default: I(() => {
1013
+ var C;
1014
+ return [
1015
+ s("div", Os, [
1016
+ m(Ge, {
1017
+ searchable: "",
1018
+ "change-location": "",
1019
+ search: w.value,
1020
+ "onUpdate:search": o[0] || (o[0] = (_) => w.value = _),
1021
+ actions: [{ icon: "refresh", onClick: e(n).fetchTemplates }]
1022
+ }, null, 8, ["search", "actions"]),
1023
+ (F(), H(r, {
1024
+ style: He(e(t).tableHeight),
1025
+ "column-defs": e(n).columnDefs,
1026
+ "row-data": x.value,
1027
+ "search-value": w.value,
1028
+ loading: h.value,
1029
+ key: (C = e(d)._currentLocation) == null ? void 0 : C.dbName,
1030
+ onRowClick: o[1] || (o[1] = (_) => e(i)(_.original)),
1031
+ "page-size": S.value
1032
+ }, {
1033
+ "list-row": I((_) => [
1034
+ m(Me, {
1035
+ row: _,
1036
+ onRowClick: (y) => e(i)(y)
1037
+ }, {
1038
+ default: I((y) => {
1039
+ var A, b, P, L, K, G, J, W, B, X, Z, ee, te, N, se, ce, pe, fe, re, ye, ve, _e, be, ie, he;
1040
+ return [
1041
+ s("div", Rs, [
1042
+ s("div", Vs, [
1043
+ s("div", Is, [
1044
+ m(e(U), {
1045
+ render: (P = (b = (A = y._id) == null ? void 0 : A.column) == null ? void 0 : b.columnDef) == null ? void 0 : P.cell,
1046
+ props: (K = (L = y._id) == null ? void 0 : L.getContext) == null ? void 0 : K.call(L)
1047
+ }, null, 8, ["render", "props"])
1048
+ ]),
1049
+ s("div", Ms, [
1050
+ m(e(U), {
1051
+ render: (W = (J = (G = y.name) == null ? void 0 : G.column) == null ? void 0 : J.columnDef) == null ? void 0 : W.cell,
1052
+ props: (X = (B = y.name) == null ? void 0 : B.getContext) == null ? void 0 : X.call(B)
1053
+ }, null, 8, ["render", "props"])
1054
+ ]),
1055
+ s("div", Ps, [
1056
+ m(e(U), {
1057
+ render: (te = (ee = (Z = y.supplier) == null ? void 0 : Z.column) == null ? void 0 : ee.columnDef) == null ? void 0 : te.cell,
1058
+ props: (se = (N = y.supplier) == null ? void 0 : N.getContext) == null ? void 0 : se.call(N)
1059
+ }, null, 8, ["render", "props"])
1060
+ ]),
1061
+ s("div", Us, k(_.original.purchaseOrder.items.length ? _.original.purchaseOrder.items.map((qe) => qe.name).join(", ") : "No items"), 1),
1062
+ s("div", Es, [
1063
+ m(e(U), {
1064
+ render: (fe = (pe = (ce = y.ref) == null ? void 0 : ce.column) == null ? void 0 : pe.columnDef) == null ? void 0 : fe.cell,
1065
+ props: (ye = (re = y.ref) == null ? void 0 : re.getContext) == null ? void 0 : ye.call(re)
1066
+ }, null, 8, ["render", "props"])
1067
+ ])
1068
+ ]),
1069
+ s("div", null, [
1070
+ m(e(U), {
1071
+ render: (be = (_e = (ve = y.type) == null ? void 0 : ve.column) == null ? void 0 : _e.columnDef) == null ? void 0 : be.cell,
1072
+ props: (he = (ie = y.type) == null ? void 0 : ie.getContext) == null ? void 0 : he.call(ie)
1073
+ }, null, 8, ["render", "props"])
1074
+ ])
1075
+ ])
1076
+ ];
1077
+ }),
1078
+ _: 2
1079
+ }, 1032, ["row", "onRowClick"])
1080
+ ]),
1081
+ _: 1
1082
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1083
+ ])
1084
+ ];
1085
+ }),
1086
+ _: 1
1087
+ }, 8, ["title", "actions"]),
1088
+ (F(), H(je, { to: "body" }, [
1089
+ m(et, ge(e(v), { onSubmitted: q }), null, 16),
1090
+ m(Ds, Qe(Ye(e(g))), null, 16),
1091
+ m(Gt, ge(e(f), {
1092
+ onSubmitted: o[2] || (o[2] = (C) => e(n).fetchTemplates())
1093
+ }), null, 16)
1094
+ ]))
1095
+ ], 64);
1096
+ };
1097
+ }
1098
+ });
1099
+ export {
1100
+ Xs as default
1101
+ };