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

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