@feedmepos/mf-inventory-portal 0.0.23-dev.17 → 0.0.23-dev.18

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