@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
@@ -1,933 +0,0 @@
1
- import { reactive as Re, onMounted as $e, computed as P, h as T, defineComponent as ne, resolveComponent as $, openBlock as E, createElementBlock as we, createElementVNode as n, toDisplayString as re, createVNode as m, unref as o, withCtx as U, watch as Se, ref as Q, createBlock as j, isRef as Pe, Fragment as Ue, normalizeStyle as Ee, Teleport as Me, mergeProps as _e } from "vue";
2
- import { _ as Be, a as Ne } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DR9YAhaJ.js";
3
- import { useI18n as oe } from "@feedmepos/mf-common";
4
- import { c as te, d as Le, u as ze, a as qe, b as he, e as He, _ as je } from "./TransferDialog.vue_vue_type_script_setup_true_lang-CWEypKBc.js";
5
- import { F as ee, R as be } from "./row-action.enum-7jVyol1k.js";
6
- import { D as ge, R as ie, $ as Ce, a0 as Qe, a as se, r as xe, a1 as Ke, l as Te, A as ue, M as ke, G as Ye, a2 as Ge, a3 as Ae, b as Je, u as We, j as Fe, y as Xe, a4 as Ze } from "./app-B3oV5Muh.js";
7
- import { F as D, _ as Oe, u as et } from "./layout-qEWDq5Vs.js";
8
- import { useBreakpoints as De, components as H, FmButtonVariant as tt, useDialog as ot, useSnackbar as at, useProxiedModel as lt } from "@feedmepos/ui-library";
9
- import { storeToRefs as st } from "pinia";
10
- import { P as O } from "./purchase-order-transaction-type-D-GMrgDp.js";
11
- import { _ as Ve } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-BIRzNfFN.js";
12
- import { useRouter as rt } from "vue-router";
13
- import { u as nt } from "./supplier-BE_AQA4h.js";
14
- var g = /* @__PURE__ */ ((u) => (u.Code = "Code", u.Name = "Name", u.DefaultAmount = "DefaultAmount", u.MinimumAmount = "MinimumAmount", u.Step = "Step", u.Cost = "Cost", u.Delete = "Delete", u))(g || {});
15
- const it = () => {
16
- const { t: u } = oe();
17
- return T(
18
- Ve,
19
- {
20
- zIndex: 50,
21
- class: "whitespace-nowrap"
22
- },
23
- u("inventory.transfer.form.items.table.Cost", [Ae()])
24
- );
25
- };
26
- function ut(u) {
27
- const { t: _ } = oe(), p = Re({}), { breakpoints: s } = De();
28
- $e(() => {
29
- for (const i of u.items) {
30
- if (!i.totalCost)
31
- continue;
32
- const t = te(i.sku, i.quantity, i.measurement, {
33
- supplier: u.supplier
34
- }), r = i.totalCost ?? ge.reset();
35
- t ? p[i.sku._id] = t.amount !== r.amount || t.precision !== r.precision : p[i.sku._id] = !0;
36
- }
37
- });
38
- function y(i) {
39
- var r, h, v, k, C, w, V;
40
- return !!(((h = (r = i.defaultCost) == null ? void 0 : r.costPerUnit) == null ? void 0 : h.amount) ?? ((V = (w = (C = (k = (v = u.supplier) == null ? void 0 : v.supplyItems) == null ? void 0 : k.find((R) => R.skuId === i._id)) == null ? void 0 : C.defaultCost) == null ? void 0 : w.costPerUnit) == null ? void 0 : V.amount));
41
- }
42
- const A = [
43
- {
44
- id: "Code",
45
- header: () => _("inventory.transfer.form.items.table.Code"),
46
- accessorKey: "code",
47
- size: 96,
48
- cell(i) {
49
- const t = i.row.original;
50
- return T(H.FmTextField, {
51
- modelValue: t.code,
52
- "onUpdate:modelValue": (r) => {
53
- u.updateItem({
54
- ...t,
55
- code: r
56
- });
57
- },
58
- key: t.sku._id,
59
- rules: [ie()],
60
- labelMark: "required"
61
- });
62
- },
63
- enableSorting: !1
64
- },
65
- {
66
- id: "Name",
67
- header: () => _("inventory.transfer.form.items.table.Name"),
68
- minSize: 300,
69
- cell(i) {
70
- const t = i.row.original;
71
- return T(H.FmTextField, {
72
- modelValue: t.name,
73
- "onUpdate:modelValue": (r) => {
74
- u.updateItem({
75
- ...t,
76
- name: r
77
- });
78
- },
79
- key: t.sku._id,
80
- rules: [ie()],
81
- labelMark: "required"
82
- });
83
- },
84
- enableSorting: !1
85
- },
86
- {
87
- id: "DefaultAmount",
88
- header: () => _("inventory.transfer.form.items.table.DefaultAmount2"),
89
- minSize: 150,
90
- cell(i) {
91
- const t = i.row.original;
92
- return T(Ce, {
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
- key: t.sku._id,
101
- unit: t.sku.unit,
102
- "onUpdate:modelValue": (r) => {
103
- u.updateItem({
104
- ...t,
105
- quantity: r.amount,
106
- measurement: r.measurement
107
- });
108
- },
109
- rules: [
110
- Qe(
111
- +se(
112
- t.minimumQuantity ?? {
113
- amount: 1,
114
- precision: xe(t.sku.unit, t.measurement)
115
- }
116
- )
117
- )
118
- ],
119
- applyDefaultRules: !0
120
- });
121
- },
122
- enableSorting: !1
123
- },
124
- {
125
- id: "MinimumAmount",
126
- header: () => _("inventory.transfer.form.items.table.MinimumAmount2"),
127
- minSize: 124,
128
- cell(i) {
129
- const t = i.row.original;
130
- return T(Ce, {
131
- style: {
132
- flex: "1 1 0%"
133
- },
134
- modelValue: {
135
- amount: t.minimumQuantity ?? {
136
- amount: 1,
137
- precision: xe(t.sku.unit, t.measurement)
138
- },
139
- measurement: t.measurement ?? null
140
- },
141
- key: t.sku._id,
142
- unit: t.sku.unit,
143
- "onUpdate:modelValue": (r) => {
144
- u.updateItem({
145
- ...t,
146
- minimumQuantity: r.amount
147
- });
148
- },
149
- rules: [Ke(0)],
150
- disableUnit: !0,
151
- applyDefaultRules: !0
152
- });
153
- },
154
- enableSorting: !1
155
- },
156
- {
157
- id: "Step",
158
- header: () => _("inventory.transfer.form.items.table.Step"),
159
- minSize: 100,
160
- cell(i) {
161
- const t = i.row.original;
162
- return T(H.FmTextField, {
163
- modelValue: se(t.quantityStep ?? ge.reset(), !1),
164
- key: t.sku._id,
165
- "onUpdate:modelValue": (r) => {
166
- u.updateItem({
167
- ...t,
168
- quantityStep: Te(+r)
169
- });
170
- },
171
- rules: [ue(0), ke(t.sku.unit, t.measurement)]
172
- });
173
- },
174
- enableSorting: !1
175
- },
176
- {
177
- id: "Cost",
178
- header: it,
179
- size: 180,
180
- cell(i) {
181
- const t = i.row.original, r = y(t.sku), h = s.value.xs || s.value.sm;
182
- return !p[t.sku._id] && r ? T(
183
- "div",
184
- {
185
- class: "flex gap-4 fm-typo-en-body-md-400 items-center",
186
- key: t.sku._id
187
- },
188
- [
189
- T(H.FmButton, {
190
- prependIcon: "edit",
191
- variant: tt.Tertiary,
192
- onClick() {
193
- u.updateItem({
194
- ...t,
195
- totalCost: te(t.sku, t.quantity, t.measurement, {
196
- supplier: u.supplier
197
- })
198
- }), p[t.sku._id] = !0;
199
- }
200
- }),
201
- T(
202
- "div",
203
- {
204
- class: "flex flex-col"
205
- },
206
- [
207
- T(
208
- "span",
209
- h ? Ye(
210
- te(t.sku, t.quantity, t.measurement, {
211
- supplier: u.supplier
212
- })
213
- ) : se(
214
- te(t.sku, t.quantity, t.measurement, {
215
- supplier: u.supplier
216
- })
217
- )
218
- ),
219
- T(
220
- "span",
221
- {
222
- class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400"
223
- },
224
- "Auto-calculated"
225
- )
226
- ]
227
- )
228
- ]
229
- ) : T(
230
- H.FmTextField,
231
- {
232
- modelValue: se(t.totalCost ?? { amount: 0, precision: 0 }),
233
- key: t.sku._id,
234
- "onUpdate:modelValue": (v) => {
235
- u.updateItem({
236
- ...t,
237
- totalCost: {
238
- ...Te(+v),
239
- currency: Ge()
240
- }
241
- });
242
- },
243
- rules: [ue(0), ke(2)]
244
- },
245
- {
246
- prepend() {
247
- return h ? T("div", { class: "text-fm-typo-en-body-lg-400" }, Ae()) : null;
248
- },
249
- append() {
250
- return r ? T(H.FmButton, {
251
- prependIcon: "close",
252
- variant: "tertiary",
253
- onClick() {
254
- u.updateItem({
255
- ...t,
256
- totalCost: null
257
- }), p[t.sku._id] = !1;
258
- }
259
- }) : null;
260
- }
261
- }
262
- );
263
- },
264
- enableSorting: !1
265
- },
266
- {
267
- id: "Delete",
268
- header: "",
269
- cell(i) {
270
- const t = i.row.original;
271
- return T(H.FmButton, {
272
- class: "delete-button",
273
- key: t.sku._id,
274
- type: "button",
275
- icon: "delete",
276
- variant: "tertiary",
277
- size: "md",
278
- onClick: () => {
279
- u.deleteItem(t);
280
- }
281
- });
282
- },
283
- enableSorting: !1,
284
- size: 40,
285
- meta: {
286
- cellClass: "",
287
- headerClass: ""
288
- }
289
- }
290
- ];
291
- return {
292
- columnDefs: P(() => Je().enableTotalCost && u.transferType === O.PURCHASE ? A : A.filter((t) => t.id !== "Cost"))
293
- };
294
- }
295
- const mt = { class: "flex flex-col gap-8 py-16" }, dt = { class: "flex items-center" }, pt = { class: "flex-1 flex gap-1 items-center" }, ct = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ft = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, yt = { class: "flex gap-8 w-full" }, vt = { class: "flex-1 flex flex-col gap-4" }, _t = /* @__PURE__ */ n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), ht = { class: "flex-1 flex flex-col gap-4" }, bt = /* @__PURE__ */ n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), gt = { class: "flex gap-8 w-full" }, Ct = { class: "flex-1 flex flex-col gap-4" }, xt = /* @__PURE__ */ n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Tt = { class: "flex-1 flex flex-col gap-4" }, kt = /* @__PURE__ */ n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), wt = { class: "flex gap-8 w-full" }, St = { class: "flex-1 flex flex-col gap-4" }, At = /* @__PURE__ */ n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Ft = { class: "flex-1 flex flex-col gap-4" }, Ot = /* @__PURE__ */ n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Dt = /* @__PURE__ */ ne({
296
- __name: "TransferTemplateItem",
297
- props: {
298
- cellByColId: {},
299
- row: {}
300
- },
301
- setup(u) {
302
- const { t: _ } = oe();
303
- return (p, s) => {
304
- var A, x, i, t, r, h, v, k, C, w, V, R, M, a, e, l, c, b, d, F, S, f, I, B, K, Y, G, N, L, J, W, X, z, q, Z;
305
- const y = $("FmLabel");
306
- return E(), we("div", mt, [
307
- n("div", dt, [
308
- n("div", pt, [
309
- n("span", ct, " (" + re(p.row.original.sku.code) + ") ", 1),
310
- n("span", ft, re(p.row.original.sku.name), 1)
311
- ]),
312
- n("div", null, [
313
- m(o(D), {
314
- render: (i = (x = (A = p.cellByColId.Delete) == null ? void 0 : A.column) == null ? void 0 : x.columnDef) == null ? void 0 : i.cell,
315
- props: (r = (t = p.cellByColId.Delete) == null ? void 0 : t.getContext) == null ? void 0 : r.call(t)
316
- }, null, 8, ["render", "props"])
317
- ])
318
- ]),
319
- n("div", yt, [
320
- n("div", vt, [
321
- m(y, {
322
- label: o(_)(`inventory.transfer.form.items.table.${o(g).Code}`)
323
- }, null, 8, ["label"]),
324
- m(o(D), {
325
- render: (k = (v = (h = p.cellByColId[o(g).Code]) == null ? void 0 : h.column) == null ? void 0 : v.columnDef) == null ? void 0 : k.cell,
326
- props: (w = (C = p.cellByColId[o(g).Code]) == null ? void 0 : C.getContext) == null ? void 0 : w.call(C)
327
- }, null, 8, ["render", "props"]),
328
- _t
329
- ]),
330
- n("div", ht, [
331
- m(y, {
332
- label: o(_)(`inventory.transfer.form.items.table.${o(g).Name}`)
333
- }, null, 8, ["label"]),
334
- m(o(D), {
335
- render: (M = (R = (V = p.cellByColId[o(g).Name]) == null ? void 0 : V.column) == null ? void 0 : R.columnDef) == null ? void 0 : M.cell,
336
- props: (e = (a = p.cellByColId[o(g).Name]) == null ? void 0 : a.getContext) == null ? void 0 : e.call(a)
337
- }, null, 8, ["render", "props"]),
338
- bt
339
- ])
340
- ]),
341
- n("div", gt, [
342
- n("div", Ct, [
343
- m(y, {
344
- label: o(_)(`inventory.transfer.form.items.table.${o(g).MinimumAmount}`)
345
- }, null, 8, ["label"]),
346
- m(o(D), {
347
- render: (b = (c = (l = p.cellByColId[o(g).MinimumAmount]) == null ? void 0 : l.column) == null ? void 0 : c.columnDef) == null ? void 0 : b.cell,
348
- props: (F = (d = p.cellByColId[o(g).MinimumAmount]) == null ? void 0 : d.getContext) == null ? void 0 : F.call(d)
349
- }, null, 8, ["render", "props"]),
350
- xt
351
- ]),
352
- n("div", Tt, [
353
- m(y, {
354
- label: o(_)(`inventory.transfer.form.items.table.${o(g).Step}`)
355
- }, null, 8, ["label"]),
356
- m(o(D), {
357
- render: (I = (f = (S = p.cellByColId[o(g).Step]) == null ? void 0 : S.column) == null ? void 0 : f.columnDef) == null ? void 0 : I.cell,
358
- props: (K = (B = p.cellByColId[o(g).Step]) == null ? void 0 : B.getContext) == null ? void 0 : K.call(B)
359
- }, null, 8, ["render", "props"]),
360
- kt
361
- ])
362
- ]),
363
- n("div", wt, [
364
- n("div", St, [
365
- m(y, {
366
- label: o(_)(`inventory.transfer.form.items.table.${o(g).DefaultAmount}`)
367
- }, null, 8, ["label"]),
368
- m(o(D), {
369
- render: (N = (G = (Y = p.cellByColId[o(g).DefaultAmount]) == null ? void 0 : Y.column) == null ? void 0 : G.columnDef) == null ? void 0 : N.cell,
370
- props: (J = (L = p.cellByColId[o(g).DefaultAmount]) == null ? void 0 : L.getContext) == null ? void 0 : J.call(L)
371
- }, null, 8, ["render", "props"]),
372
- At
373
- ]),
374
- n("div", Ft, [
375
- m(Ve, { "z-index": 50 }, {
376
- default: U(() => [
377
- m(y, {
378
- label: o(_)(`inventory.transfer.form.items.table.${o(g).Cost}2`)
379
- }, null, 8, ["label"])
380
- ]),
381
- _: 1
382
- }),
383
- m(o(D), {
384
- render: (z = (X = (W = p.cellByColId[o(g).Cost]) == null ? void 0 : W.column) == null ? void 0 : X.columnDef) == null ? void 0 : z.cell,
385
- props: (Z = (q = p.cellByColId[o(g).Cost]) == null ? void 0 : q.getContext) == null ? void 0 : Z.call(q)
386
- }, null, 8, ["render", "props"]),
387
- Ot
388
- ])
389
- ])
390
- ]);
391
- };
392
- }
393
- }), Vt = { class: "flex flex-col gap-16" }, It = { class: "flex flex-col gap-24" }, Rt = { class: "flex flex-col gap-16" }, $t = { class: "flex" }, Pt = /* @__PURE__ */ n("div", { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, "Transfer items", -1), Ut = /* @__PURE__ */ ne({
394
- __name: "TransferTemplateForm",
395
- props: {
396
- modelValue: {},
397
- disabled: { type: Boolean }
398
- },
399
- setup(u, { expose: _ }) {
400
- const p = u, s = Le(), { t: y } = oe(), A = Fe(), x = We(), i = nt();
401
- Se(
402
- () => p.modelValue,
403
- (a) => {
404
- console.log("TransferTemplateForm.model", a);
405
- }
406
- ), A.watchLocation(async () => {
407
- location && (s.purchaseOrder.supplier || (s.purchaseOrder.supplier = i.suppliers.find((a) => a) ?? s.purchaseOrder.supplier));
408
- });
409
- const t = ot(), r = ze(
410
- () => s.purchaseOrder,
411
- (a) => {
412
- s.purchaseOrder = {
413
- ...s.purchaseOrder,
414
- ...a
415
- };
416
- }
417
- ), h = P({
418
- get() {
419
- var a, e;
420
- return typeof ((e = (a = s.purchaseOrder) == null ? void 0 : a.supplier) == null ? void 0 : e.internal) == "string" ? O.TRANSFER : O.PURCHASE;
421
- },
422
- set(a) {
423
- var l, c;
424
- const e = typeof ((c = (l = s.purchaseOrder) == null ? void 0 : l.supplier) == null ? void 0 : c.internal) == "string" ? O.TRANSFER : O.PURCHASE;
425
- a !== e && (s.purchaseOrder.supplier = a === O.PURCHASE ? r.locationOptionsTypePurchase.value[0] : r.locationOptionsTypeTransfer.value[0]);
426
- }
427
- }), v = P(() => r.transferLocationOptions.value), k = P({
428
- get() {
429
- return s.purchaseOrder.supplier._id;
430
- },
431
- set(a) {
432
- r.transferLocationModel.value = a;
433
- }
434
- }), C = P({
435
- get() {
436
- return s.purchaseOrder.remark ?? void 0;
437
- },
438
- set(a) {
439
- s.purchaseOrder.remark = a;
440
- }
441
- }), w = Q();
442
- _({
443
- validateInputs: () => {
444
- var a, e;
445
- (e = (a = w.value) == null ? void 0 : a.validateInputs) == null || e.call(a);
446
- },
447
- resetInputsValidation: () => {
448
- var a, e;
449
- (e = (a = w.value) == null ? void 0 : a.resetInputsValidation) == null || e.call(a);
450
- },
451
- resetInputs: () => {
452
- var a, e;
453
- (e = (a = w.value) == null ? void 0 : a.resetInputs) == null || e.call(a);
454
- }
455
- });
456
- const V = ut({
457
- updateItem: (a) => {
458
- s.purchaseOrder.items = s.purchaseOrder.items.map((e) => e.sku._id !== a.sku._id ? e : a);
459
- },
460
- deleteItem: (a) => {
461
- s.purchaseOrder.items = s.purchaseOrder.items.filter(
462
- (e) => e.sku._id !== a.sku._id
463
- );
464
- },
465
- get supplier() {
466
- return s.purchaseOrder.supplier;
467
- },
468
- get items() {
469
- return s.purchaseOrder.items;
470
- },
471
- get transferType() {
472
- return h.value;
473
- }
474
- }), R = P(() => V.columnDefs.value);
475
- function M() {
476
- const a = x.skus.map((l) => ({
477
- label: l.name,
478
- sublabel: l.code,
479
- value: l
480
- })), e = a.filter((l) => {
481
- var c;
482
- return (c = s.purchaseOrder.items) == null ? void 0 : c.find((b) => b.sku._id === l.value._id);
483
- }).map((l) => l.value);
484
- t.open({
485
- title: "Select item",
486
- closeButton: !0,
487
- contentComponent: Xe,
488
- contentComponentProps: {
489
- modelValue: e,
490
- items: a
491
- },
492
- primaryActions: {
493
- text: "Confirm",
494
- close: !0
495
- },
496
- secondaryActions: {
497
- text: "Close",
498
- close: !0,
499
- variant: "tertiary"
500
- }
501
- }).onPrimary((l) => {
502
- const c = s.purchaseOrder.items ?? [], b = l.map((d) => {
503
- const F = c.find((f) => f.sku._id === d._id);
504
- if (F)
505
- return F;
506
- const S = {
507
- sku: d,
508
- code: d.code,
509
- name: d.name,
510
- quantity: {
511
- amount: 1,
512
- precision: 0
513
- }
514
- };
515
- return h.value == O.PURCHASE && (S.totalCost = te(
516
- S.sku,
517
- S.quantity,
518
- S.measurement,
519
- {
520
- supplier: s.purchaseOrder.supplier
521
- }
522
- )), S;
523
- });
524
- b.sort((d, F) => d.sku.code.localeCompare(F.sku.code)), s.purchaseOrder.items = b;
525
- });
526
- }
527
- return (a, e) => {
528
- const l = $("FmTextField"), c = $("FmSelect"), b = $("FmTextarea"), d = $("FmButton"), F = $("FmTable"), S = $("FmForm");
529
- return E(), j(S, {
530
- ref_key: "formRef",
531
- ref: w,
532
- class: "flex flex-col gap-32"
533
- }, {
534
- default: U(() => [
535
- n("div", Vt, [
536
- n("div", It, [
537
- m(l, {
538
- label: o(y)("inventory.transfer.form.name"),
539
- "label-mark": "required",
540
- modelValue: o(s).name,
541
- "onUpdate:modelValue": e[0] || (e[0] = (f) => o(s).name = f),
542
- rules: [o(ie)()]
543
- }, null, 8, ["label", "modelValue", "rules"]),
544
- m(c, {
545
- label: o(y)("inventory.transfer.form.type.title"),
546
- "model-value": h.value,
547
- "onUpdate:modelValue": e[1] || (e[1] = (f) => h.value = f),
548
- items: [
549
- {
550
- label: o(y)(
551
- `inventory.transfer.form.type.${o(O).PURCHASE.toLocaleLowerCase()}`
552
- ),
553
- value: o(O).PURCHASE,
554
- disabled: !o(r).locationOptionsTypePurchase.value.length,
555
- sublabel: o(r).locationOptionsTypePurchase.value.length ? void 0 : "No supplier available"
556
- },
557
- {
558
- label: o(y)(
559
- `inventory.transfer.form.type.${o(O).TRANSFER.toLocaleLowerCase()}`
560
- ),
561
- value: o(O).TRANSFER,
562
- disabled: !o(r).locationOptionsTypeTransfer.value.length,
563
- sublabel: o(r).locationOptionsTypeTransfer.value.length ? void 0 : "No location available"
564
- }
565
- ],
566
- rules: [o(ue)(1)(v.value)]
567
- }, null, 8, ["label", "model-value", "items", "rules"]),
568
- m(c, {
569
- label: h.value === o(O).PURCHASE ? "Purchase from" : "Transfer from",
570
- modelValue: k.value,
571
- "onUpdate:modelValue": e[2] || (e[2] = (f) => k.value = f),
572
- items: v.value
573
- }, null, 8, ["label", "modelValue", "items"]),
574
- m(l, {
575
- label: "Reference",
576
- "label-mark": "optional",
577
- modelValue: o(s).purchaseOrder.ref,
578
- "onUpdate:modelValue": e[3] || (e[3] = (f) => o(s).purchaseOrder.ref = f)
579
- }, null, 8, ["modelValue"]),
580
- m(b, {
581
- label: "Remark",
582
- "label-mark": "optional",
583
- "max-length": 240,
584
- modelValue: C.value,
585
- "onUpdate:modelValue": e[4] || (e[4] = (f) => C.value = f)
586
- }, null, 8, ["modelValue"])
587
- ])
588
- ]),
589
- n("div", Rt, [
590
- n("div", $t, [
591
- Pt,
592
- m(d, {
593
- disabled: a.disabled,
594
- label: "Add Item",
595
- "prepend-icon": "add",
596
- variant: "plain",
597
- class: "border-2 rounded-lg border-fm-color-primary",
598
- onClick: e[5] || (e[5] = (f) => M()),
599
- size: "md"
600
- }, null, 8, ["disabled"])
601
- ]),
602
- (E(), j(F, {
603
- "column-defs": R.value,
604
- "row-data": o(s).purchaseOrder.items,
605
- key: o(s).purchaseOrder.items.map((f) => f.sku._id).join("."),
606
- "hide-footer": ""
607
- }, {
608
- "list-row": U((f) => [
609
- (E(), j(Oe, {
610
- row: f,
611
- key: o(s).purchaseOrder.items.map((I) => I.sku._id).join(".")
612
- }, {
613
- default: U((I) => [
614
- m(Dt, {
615
- row: f,
616
- "cell-by-col-id": I
617
- }, null, 8, ["row", "cell-by-col-id"])
618
- ]),
619
- _: 2
620
- }, 1032, ["row"]))
621
- ]),
622
- _: 1
623
- }, 8, ["column-defs", "row-data"]))
624
- ])
625
- ]),
626
- _: 1
627
- }, 512);
628
- };
629
- }
630
- }), Et = { class: "flex items-center" }, Mt = { class: "fm-typo-en-title-md-800" }, Bt = { class: "flex gap-4" }, Nt = /* @__PURE__ */ ne({
631
- __name: "TransferTemplateDialog",
632
- props: {
633
- mode: {},
634
- modelValue: {},
635
- show: { type: Boolean }
636
- },
637
- emits: ["update:show", "submitted"],
638
- setup(u, { expose: _, emit: p }) {
639
- var a;
640
- const s = u, y = p, A = qe(), x = at(), i = lt(s, "show");
641
- function t() {
642
- return {
643
- _id: "",
644
- name: "",
645
- purchaseOrder: {
646
- remark: void 0,
647
- ref: void 0,
648
- stockSnapshotId: void 0,
649
- effectiveAt: void 0,
650
- items: [],
651
- supplier: {
652
- _rev: void 0,
653
- email: void 0,
654
- internal: void 0,
655
- contactName: void 0,
656
- phoneNumber: void 0,
657
- registrationNumber: void 0,
658
- supplyItems: void 0,
659
- _id: "",
660
- name: "",
661
- address: {
662
- line2: void 0,
663
- line1: "",
664
- state: "",
665
- city: "",
666
- postcode: "",
667
- country: ""
668
- }
669
- }
670
- }
671
- };
672
- }
673
- const r = Q(s.modelValue ?? t()), h = Q(((a = s.modelValue) == null ? void 0 : a._id) ?? `${Math.random()}`);
674
- Se(
675
- () => s.show,
676
- (e) => {
677
- var l;
678
- e && (r.value = s.modelValue ?? t(), h.value = ((l = s.modelValue) == null ? void 0 : l._id) ?? `${Math.random()}`);
679
- }
680
- );
681
- const v = Q(!1), k = P(() => {
682
- switch (s.mode) {
683
- case ee.READ:
684
- return "View template";
685
- case ee.CREATE:
686
- return "Add template";
687
- case ee.UPDATE:
688
- return "Edit template";
689
- }
690
- return "";
691
- }), C = Q();
692
- _({
693
- validateInputs: () => {
694
- var e, l;
695
- (l = (e = C.value) == null ? void 0 : e.validateInputs) == null || l.call(e);
696
- },
697
- resetInputsValidation: () => {
698
- var e, l;
699
- (l = (e = C.value) == null ? void 0 : e.resetInputsValidation) == null || l.call(e);
700
- },
701
- resetInputs: () => {
702
- var e, l;
703
- (l = (e = C.value) == null ? void 0 : e.resetInputs) == null || l.call(e);
704
- }
705
- });
706
- async function w() {
707
- const e = r.value;
708
- if (e) {
709
- v.value = !0, (e.purchaseOrder.supplier.internal === "warehouse" || e.purchaseOrder.supplier.internal === "restaurant") && (e.purchaseOrder.items = e.purchaseOrder.items.map(
710
- ({ totalCost: l, ...c }) => c
711
- ));
712
- try {
713
- await A.createTemplate(e), await new Promise((l) => setTimeout(l, 1e3)), x.open({
714
- title: "Created",
715
- message: "Your transfer template has been created!",
716
- type: "success"
717
- }), y("update:show", !1), y("submitted");
718
- } catch (l) {
719
- x.open({
720
- title: "Cannot create transfer template",
721
- message: "Report to system administrator for troubleshooting.",
722
- type: "error"
723
- }), console.error("Error in creating transfer template", l);
724
- } finally {
725
- v.value = !1;
726
- }
727
- }
728
- }
729
- async function V() {
730
- const e = r.value;
731
- if (e) {
732
- v.value = !0, (e.purchaseOrder.supplier.internal === "warehouse" || e.purchaseOrder.supplier.internal === "restaurant") && (e.purchaseOrder.items = e.purchaseOrder.items.map(
733
- ({ totalCost: l, ...c }) => c
734
- ));
735
- try {
736
- await A.updateTemplate(e), await new Promise((l) => setTimeout(l, 1e3)), x.open({
737
- title: "Updated",
738
- message: "Your transfer template has been updated!",
739
- type: "success"
740
- }), y("update:show", !1), y("submitted");
741
- } catch (l) {
742
- x.open({
743
- title: "Cannot update transfer template",
744
- message: "Report to system administrator for troubleshooting.",
745
- type: "error"
746
- }), console.error("Error in updating transfer template", l);
747
- } finally {
748
- v.value = !1;
749
- }
750
- }
751
- }
752
- function R() {
753
- switch (s.mode) {
754
- case ee.CREATE:
755
- return w();
756
- case ee.UPDATE:
757
- return V();
758
- }
759
- }
760
- function M() {
761
- var e, l;
762
- (l = (e = C.value) == null ? void 0 : e.validateInputs) == null || l.call(e);
763
- }
764
- return (e, l) => {
765
- const c = $("FmButton"), b = $("FmSideSheet");
766
- return E(), j(b, {
767
- modelValue: o(i),
768
- "onUpdate:modelValue": l[2] || (l[2] = (d) => Pe(i) ? i.value = d : null),
769
- "dismiss-away": "",
770
- "close-button": "",
771
- "max-width": 900
772
- }, {
773
- "side-sheet-header": U(() => [
774
- n("div", Et, [
775
- n("div", Mt, re(k.value), 1)
776
- ])
777
- ]),
778
- default: U(() => [
779
- (E(), j(Ut, {
780
- class: "w-full",
781
- ref_key: "formRef",
782
- ref: C,
783
- onValidationSuccess: R,
784
- "model-value": r.value,
785
- "onUpdate:modelValue": l[0] || (l[0] = (d) => r.value = d),
786
- disabled: v.value,
787
- key: h.value
788
- }, null, 8, ["model-value", "disabled"]))
789
- ]),
790
- "side-sheet-footer": U(() => [
791
- n("div", Bt, [
792
- m(c, {
793
- loading: v.value,
794
- label: "Save",
795
- onClick: M
796
- }, null, 8, ["loading"]),
797
- m(c, {
798
- disabled: v.value,
799
- variant: "tertiary",
800
- label: "Close",
801
- onClick: l[1] || (l[1] = (d) => y("update:show", !1))
802
- }, null, 8, ["disabled"])
803
- ])
804
- ]),
805
- _: 1
806
- }, 8, ["modelValue"]);
807
- };
808
- }
809
- }), Lt = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 h-full" }, zt = { class: "flex-1 flex flex-col gap-8" }, qt = { class: "flex flex-col" }, Ht = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, jt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Qt = { class: "fm-typo-en-body-lg-400" }, Kt = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, Yt = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, io = /* @__PURE__ */ ne({
810
- __name: "TransferTemplateView",
811
- setup(u) {
812
- const { t: _ } = oe(), { createTemplate: p, viewTemplate: s } = he(), { templateDialogProps: y, transferFormDialogProps: A } = st(he()), x = He(), i = et(), t = Fe(), { breakpoints: r } = De();
813
- t.watchLocation(x.fetchTemplates);
814
- const h = P(
815
- () => x.loading.value || !t._currentLocation
816
- ), v = P(() => x.templates.value), k = Q(""), C = P(() => r.value.xs || r.value.sm ? 10 : 20);
817
- function w(a) {
818
- switch (a) {
819
- case be.Add:
820
- return p();
821
- }
822
- }
823
- const V = rt();
824
- function R() {
825
- V.push({ name: Ze.RECEIVE_REQUEST });
826
- }
827
- function M(a) {
828
- return a;
829
- }
830
- return (a, e) => {
831
- const l = $("FmTable");
832
- return E(), we(Ue, null, [
833
- m(Be, {
834
- title: o(_)("inventory.transfer.template.title2"),
835
- actions: [
836
- {
837
- label: o(_)("inventory.transfer.template.create.title"),
838
- value: o(be).Add,
839
- isPrimary: !0,
840
- prependIcon: "add"
841
- }
842
- ],
843
- "onClick:action": w
844
- }, {
845
- default: U(() => {
846
- var c;
847
- return [
848
- n("div", Lt, [
849
- m(Ne, {
850
- searchable: "",
851
- "change-location": "",
852
- search: k.value,
853
- "onUpdate:search": e[0] || (e[0] = (b) => k.value = b),
854
- actions: [{ icon: "refresh", onClick: o(x).fetchTemplates }]
855
- }, null, 8, ["search", "actions"]),
856
- (E(), j(l, {
857
- style: Ee(o(i).tableHeight),
858
- "column-defs": o(x).columnDefs,
859
- "row-data": v.value,
860
- "search-value": k.value,
861
- loading: h.value,
862
- key: (c = o(t)._currentLocation) == null ? void 0 : c.dbName,
863
- onRowClick: e[1] || (e[1] = (b) => o(s)(b.original)),
864
- "page-size": C.value
865
- }, {
866
- "list-row": U((b) => [
867
- m(Oe, {
868
- row: b,
869
- onRowClick: (d) => o(s)(d)
870
- }, {
871
- default: U((d) => {
872
- var F, S, f, I, B, K, Y, G, N, L, J, W, X, z, q, Z, me, de, ae, pe, ce, fe, ye, le, ve;
873
- return [
874
- n("div", zt, [
875
- n("div", qt, [
876
- n("div", Ht, [
877
- m(o(D), {
878
- render: (f = (S = (F = d._id) == null ? void 0 : F.column) == null ? void 0 : S.columnDef) == null ? void 0 : f.cell,
879
- props: (B = (I = d._id) == null ? void 0 : I.getContext) == null ? void 0 : B.call(I)
880
- }, null, 8, ["render", "props"])
881
- ]),
882
- n("div", jt, [
883
- m(o(D), {
884
- render: (G = (Y = (K = d.name) == null ? void 0 : K.column) == null ? void 0 : Y.columnDef) == null ? void 0 : G.cell,
885
- props: (L = (N = d.name) == null ? void 0 : N.getContext) == null ? void 0 : L.call(N)
886
- }, null, 8, ["render", "props"])
887
- ]),
888
- n("div", Qt, [
889
- m(o(D), {
890
- render: (X = (W = (J = d.supplier) == null ? void 0 : J.column) == null ? void 0 : W.columnDef) == null ? void 0 : X.cell,
891
- props: (q = (z = d.supplier) == null ? void 0 : z.getContext) == null ? void 0 : q.call(z)
892
- }, null, 8, ["render", "props"])
893
- ]),
894
- n("div", Kt, re(b.original.purchaseOrder.items.length ? b.original.purchaseOrder.items.map((Ie) => Ie.name).join(", ") : "No items"), 1),
895
- n("div", Yt, [
896
- m(o(D), {
897
- render: (de = (me = (Z = d.ref) == null ? void 0 : Z.column) == null ? void 0 : me.columnDef) == null ? void 0 : de.cell,
898
- props: (pe = (ae = d.ref) == null ? void 0 : ae.getContext) == null ? void 0 : pe.call(ae)
899
- }, null, 8, ["render", "props"])
900
- ])
901
- ]),
902
- n("div", null, [
903
- m(o(D), {
904
- render: (ye = (fe = (ce = d.type) == null ? void 0 : ce.column) == null ? void 0 : fe.columnDef) == null ? void 0 : ye.cell,
905
- props: (ve = (le = d.type) == null ? void 0 : le.getContext) == null ? void 0 : ve.call(le)
906
- }, null, 8, ["render", "props"])
907
- ])
908
- ])
909
- ];
910
- }),
911
- _: 2
912
- }, 1032, ["row", "onRowClick"])
913
- ]),
914
- _: 1
915
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
916
- ])
917
- ];
918
- }),
919
- _: 1
920
- }, 8, ["title", "actions"]),
921
- (E(), j(Me, { to: "body" }, [
922
- m(je, _e(o(A), { onSubmitted: R }), null, 16),
923
- m(Nt, _e(o(y), {
924
- onSubmitted: e[2] || (e[2] = (c) => o(x).fetchTemplates())
925
- }), null, 16)
926
- ]))
927
- ], 64);
928
- };
929
- }
930
- });
931
- export {
932
- io as default
933
- };