@feedmepos/mf-inventory-portal 0.0.22-dev.29 → 0.0.22-dev.30

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