@feedmepos/mf-inventory-portal 0.0.19-dev.1 → 0.0.19-dev.2

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 (59) hide show
  1. package/dist/{ApprovalView-BTZwnKLf.js → ApprovalView-DU7oB2Zk.js} +42 -39
  2. package/dist/{BindingsDialog-DpC48bqK.js → BindingsDialog-BgfV0G46.js} +2 -2
  3. package/dist/{BindingsPicker-BU52g6zk.js → BindingsPicker-tUI5WYBk.js} +2 -2
  4. package/dist/{BindingsTable-aIuFdScv.js → BindingsTable-8G-Nc4pC.js} +18 -17
  5. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DaHXKF1s.js +273 -0
  6. package/dist/{FmMultiselectDialog.vue_vue_type_script_setup_true_lang-n09XXJZK.js → FmMultiselectDialog.vue_vue_type_script_setup_true_lang-CxOk5ule.js} +2 -2
  7. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-B-19iYaK.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D-vJDMKb.js} +3 -3
  8. package/dist/IngredientsView-CAh7D4tL.js +1760 -0
  9. package/dist/{IntegrationView-Dn_qL_vC.js → IntegrationView-Bf7yHuS8.js} +3 -3
  10. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-BdVrpR9J.js +277 -0
  11. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BuyM580N.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BKlWhMnB.js} +1 -1
  12. package/dist/{PurchaseOrderPrintPreview-EeKhENYH.js → PurchaseOrderPrintPreview-YFcOtdfJ.js} +1 -1
  13. package/dist/ReceiveRequestView-bIXyVVX9.js +1401 -0
  14. package/dist/RecipeView-BD0mvxCg.js +575 -0
  15. package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +59 -0
  16. package/dist/StockView-BCq37bGl.js +1865 -0
  17. package/dist/SupplierView-BiSqTXnz.js +804 -0
  18. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CvbKNb0C.js +1033 -0
  19. package/dist/UnitView-DSdn__9m.js +643 -0
  20. package/dist/WarehouseView-B8UxxAL6.js +1051 -0
  21. package/dist/api/bill.d.ts +2 -2
  22. package/dist/app-RVyC2D4O.js +43892 -0
  23. package/dist/app.d.ts +1002 -0
  24. package/dist/app.js +4 -3
  25. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  26. package/dist/{date2-Cvp5iJkI.js → date2-C2PfOqbB.js} +1 -1
  27. package/dist/{dayjs.min-D1_pOsO7.js → dayjs.min-0pzT_dbr.js} +1 -1
  28. package/dist/{decimal-BAZuuTcd.js → decimal-BtIn4K57.js} +1 -1
  29. package/dist/{fuzzy-0roCBvgC.js → fuzzy-yzIM5KUK.js} +1 -1
  30. package/dist/{index-B_aEOJsR.js → index-l87_vggM.js} +1 -1
  31. package/dist/{layout-BnTfCS_X.js → layout-ITqYtCVu.js} +1 -1
  32. package/dist/{number-DLj3W3RW.js → number-B5d98l0m.js} +1 -1
  33. package/dist/router/name.d.ts +2 -1
  34. package/dist/{rules-CCmXA0Yi.js → rules-CCwuHe8Y.js} +2 -2
  35. package/dist/{stock-estimate-CL4HShG8.js → stock-estimate-C4PL0Fcz.js} +2 -2
  36. package/dist/style.css +1 -1
  37. package/dist/{supplier-CjAH8O1y.js → supplier-CA0OR3DU.js} +1 -1
  38. package/dist/tsconfig.app.tsbuildinfo +1 -1
  39. package/dist/{use-inventory-binding-dialog-GkJOzE6V.js → use-inventory-binding-dialog-CTriImiV.js} +2 -2
  40. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  41. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  42. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
  43. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  44. package/dist/{xlsx-vUzm_udV.js → xlsx-DAVatAlv.js} +660 -660
  45. package/dist/xlsx.util-BsZI2tNE.js +109 -0
  46. package/package.json +6 -5
  47. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DjgmtvXU.js +0 -268
  48. package/dist/IngredientsView-DMyEGdik.js +0 -1767
  49. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DGTLUrb9.js +0 -276
  50. package/dist/ReceiveRequestView-BOdgbFFM.js +0 -1394
  51. package/dist/RecipeView-B1aNLDIK.js +0 -573
  52. package/dist/StockForecast.vue_vue_type_style_index_0_lang-B5EK101t.js +0 -58
  53. package/dist/StockView-C_Ur_jTg.js +0 -1862
  54. package/dist/SupplierView-CXfOoHTr.js +0 -796
  55. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-kjV5Eazv.js +0 -1028
  56. package/dist/UnitView-DHXfAsnq.js +0 -635
  57. package/dist/WarehouseView-DMwbxs1q.js +0 -1043
  58. package/dist/app-BkcO8oNJ.js +0 -66113
  59. package/dist/xlsx.util-B_bqymTM.js +0 -107
@@ -0,0 +1,643 @@
1
+ import { defineComponent as K, computed as x, openBlock as p, createElementBlock as U, Fragment as q, renderList as H, createElementVNode as l, toDisplayString as g, createCommentVNode as Y, ref as M, resolveComponent as I, createBlock as T, withCtx as R, createVNode as f, unref as a, isRef as X, normalizeStyle as se, Teleport as ae, normalizeProps as re, guardReactiveProps as ie } from "vue";
2
+ import { u as G, S as ue, c as oe, b as Z, f as de } from "./app-RVyC2D4O.js";
3
+ import { useDialog as me, useSnackbar as ne, useProxiedModel as ee, useBreakpoints as ce } from "@feedmepos/ui-library";
4
+ import { i as pe, _ as fe } from "./is-linked-ingredient-error-C6AghEwR.js";
5
+ import { F as V, D as te, R as N } from "./row-action.enum-BwQbURNh.js";
6
+ import { c as ve, _ as ye, F as be, u as _e } from "./layout-ITqYtCVu.js";
7
+ import { useI18n as O } from "@feedmepos/mf-common";
8
+ import { _ as ge, a as xe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DaHXKF1s.js";
9
+ import { R as j, A as he, a as Ve } from "./rules-CCwuHe8Y.js";
10
+ import { a as J, c as we } from "./number-B5d98l0m.js";
11
+ import { F as Ue } from "./decimal-BtIn4K57.js";
12
+ import { _ as Ce } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BKlWhMnB.js";
13
+ const ke = { class: "flex flex-col gap-8" }, $e = /* @__PURE__ */ l("div", { class: "fm-typo-en-body-md-400" }, "Sorry, this unit is used in the following modules:", -1), Se = {
14
+ key: 0,
15
+ class: "flex flex-col"
16
+ }, Fe = /* @__PURE__ */ l("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
17
+ /* @__PURE__ */ l("div", { class: "flex-1 py-8 px-16" }, "Ingredient"),
18
+ /* @__PURE__ */ l("div", {
19
+ class: "flex-0 py-8 px-16",
20
+ style: { "flex-basis": "240px" }
21
+ }, "Used in")
22
+ ], -1), Ee = { class: "flex-1 py-8 px-16" }, Ie = {
23
+ class: "flex-0 py-8 px-16",
24
+ style: { "flex-basis": "240px" }
25
+ }, De = {
26
+ key: 1,
27
+ class: "flex flex-col"
28
+ }, Ae = /* @__PURE__ */ l("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
29
+ /* @__PURE__ */ l("div", { class: "flex-1 py-8 px-16" }, "Recipe"),
30
+ /* @__PURE__ */ l("div", {
31
+ class: "flex-0 py-8 px-16",
32
+ style: { "flex-basis": "240px" }
33
+ }, "Used in")
34
+ ], -1), Re = { class: "flex-1 py-8 px-16" }, Me = {
35
+ class: "flex-0 py-8 px-16",
36
+ style: { "flex-basis": "240px" }
37
+ }, Pe = {
38
+ key: 2,
39
+ class: "flex flex-col"
40
+ }, Te = /* @__PURE__ */ l("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
41
+ /* @__PURE__ */ l("div", { class: "flex-1 py-8 px-16" }, "Menu"),
42
+ /* @__PURE__ */ l("div", {
43
+ class: "flex-0 py-8 px-16",
44
+ style: { "flex-basis": "240px" }
45
+ }, "Used in")
46
+ ], -1), Be = { class: "flex-1 py-8 px-16" }, Le = {
47
+ class: "flex-0 py-8 px-16",
48
+ style: { "flex-basis": "240px" }
49
+ }, ze = /* @__PURE__ */ K({
50
+ __name: "UnitUsedBy",
51
+ props: {
52
+ unit: {}
53
+ },
54
+ setup(h) {
55
+ const c = h, y = G(), i = x(() => y.validateUnitUsage(c.unit)), n = x(() => i.value.filter((m) => m.from === "INGREDIENT")), r = x(() => i.value.filter((m) => m.from === "RECIPE")), d = x(() => i.value.filter((m) => m.from === "MENU"));
56
+ return (m, k) => (p(), U("div", ke, [
57
+ $e,
58
+ n.value.length ? (p(), U("div", Se, [
59
+ Fe,
60
+ (p(!0), U(q, null, H(n.value, (o) => {
61
+ var s;
62
+ return p(), U("div", {
63
+ key: o.code,
64
+ class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
65
+ }, [
66
+ l("div", Ee, g(o.code) + " " + g(o.name), 1),
67
+ l("div", Ie, g((s = o.bindedIngredient) != null && s.length ? "Convert binding" : "Item unit"), 1)
68
+ ]);
69
+ }), 128))
70
+ ])) : Y("", !0),
71
+ r.value.length ? (p(), U("div", De, [
72
+ Ae,
73
+ (p(!0), U(q, null, H(r.value, (o) => {
74
+ var s, v, w;
75
+ return p(), U("div", {
76
+ key: o.code,
77
+ class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
78
+ }, [
79
+ l("div", Re, g(o.code) + " " + g(o.name), 1),
80
+ l("div", Me, g((s = o.bindedIngredient) == null ? void 0 : s.slice(0, 3).map((b) => b.code).join(", ")) + " " + g(o.bindedIngredient && ((v = o.bindedIngredient) == null ? void 0 : v.length) > 3 ? `and ${((w = o.bindedIngredient) == null ? void 0 : w.length) - 3} more` : ""), 1)
81
+ ]);
82
+ }), 128))
83
+ ])) : Y("", !0),
84
+ d.value.length ? (p(), U("div", Pe, [
85
+ Te,
86
+ (p(!0), U(q, null, H(d.value, (o) => {
87
+ var s, v, w;
88
+ return p(), U("div", {
89
+ key: o.code,
90
+ class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
91
+ }, [
92
+ l("div", Be, g(o.code) + " " + g(o.name), 1),
93
+ l("div", Le, g((s = o.bindedIngredient) == null ? void 0 : s.slice(0, 3).map((b) => b.code).join(", ")) + " " + g(o.bindedIngredient && ((v = o.bindedIngredient) == null ? void 0 : v.length) > 3 ? `and ${((w = o.bindedIngredient) == null ? void 0 : w.length) - 3} more` : ""), 1)
94
+ ]);
95
+ }), 128))
96
+ ])) : Y("", !0)
97
+ ]));
98
+ }
99
+ });
100
+ function Ne() {
101
+ const h = me(), c = ne(), y = G(), i = M(!1), n = M();
102
+ function r() {
103
+ const o = {
104
+ unit: {},
105
+ mode: V.CREATE,
106
+ show: !0,
107
+ "onUpdate:show"(s) {
108
+ n.value.show = s;
109
+ }
110
+ };
111
+ n.value = o;
112
+ }
113
+ async function d(o) {
114
+ const s = {
115
+ unit: o,
116
+ mode: V.UPDATE,
117
+ show: !0,
118
+ "onUpdate:show"(v) {
119
+ n.value.show = v;
120
+ }
121
+ };
122
+ n.value = s;
123
+ }
124
+ async function m(o) {
125
+ i.value = !0;
126
+ try {
127
+ await y.deleteUnit(o), c.open({
128
+ title: "Success",
129
+ message: `Deleted ${o.name}`,
130
+ type: "success"
131
+ });
132
+ } catch (s) {
133
+ s instanceof ue && pe(s) ? h.open({
134
+ title: "Cannot delete unit",
135
+ contentComponent: fe,
136
+ contentComponentProps: {
137
+ subject: (o == null ? void 0 : o.name) ?? "",
138
+ items: s.errorResponse.message
139
+ },
140
+ secondaryActions: {
141
+ text: "Close",
142
+ close: !0
143
+ }
144
+ }) : console.log("unable to delete unit", s), c.open({
145
+ title: `Cannot delete ${o.name}`,
146
+ message: "Please try again.",
147
+ type: "error"
148
+ }), console.error("failed to delete unit", s);
149
+ } finally {
150
+ i.value = !1;
151
+ }
152
+ }
153
+ function k(o) {
154
+ if (y.validateUnitUsage(o).length) {
155
+ h.open({
156
+ title: `Cannot delete ${(o == null ? void 0 : o.name) ?? "unit"}`,
157
+ overlay: !0,
158
+ dismissAway: !0,
159
+ closeButton: !0,
160
+ contentComponent: ze,
161
+ contentComponentProps: {
162
+ unit: o
163
+ },
164
+ primaryActions: {
165
+ text: "Confirm",
166
+ close: !0
167
+ }
168
+ });
169
+ return;
170
+ }
171
+ h.open({
172
+ title: `Delete ${(o == null ? void 0 : o.name) ?? "unit"}?`,
173
+ closeButton: !1,
174
+ message: "You may not be able to delete this unit if it is linked in any of the inventory modules.",
175
+ primaryActions: {
176
+ text: "Delete",
177
+ close: !0,
178
+ variant: "destructive"
179
+ },
180
+ secondaryActions: {
181
+ text: "Cancel",
182
+ close: !0
183
+ }
184
+ }).onPrimary(() => m(o));
185
+ }
186
+ return {
187
+ createUnit: r,
188
+ updateUnit: d,
189
+ deleteUnit: k,
190
+ unitDialogProps: n,
191
+ unitViewLoading: i
192
+ };
193
+ }
194
+ function je({
195
+ updateUnit: h,
196
+ deleteUnit: c
197
+ }) {
198
+ const { t: y } = O();
199
+ async function i(r, d) {
200
+ const m = oe(d);
201
+ if (r === N.Edit) {
202
+ await h(m);
203
+ return;
204
+ }
205
+ if (r === N.Delete) {
206
+ await c(m);
207
+ return;
208
+ }
209
+ }
210
+ return { columnDefs: [
211
+ {
212
+ accessorKey: "name",
213
+ header: y("inventory.unit.table.name"),
214
+ enableSorting: !0,
215
+ size: 300
216
+ },
217
+ {
218
+ accessorKey: "abbrev",
219
+ header: y("inventory.unit.table.symbol"),
220
+ enableSorting: !1,
221
+ size: "auto"
222
+ },
223
+ {
224
+ id: "action",
225
+ header: "",
226
+ cell(r) {
227
+ return ve(
228
+ [te[N.Edit], te[N.Delete]],
229
+ (d) => {
230
+ i(d, r.row.original);
231
+ }
232
+ );
233
+ },
234
+ enableSorting: !1,
235
+ size: 40,
236
+ meta: {
237
+ cellClass: "",
238
+ headerClass: ""
239
+ }
240
+ }
241
+ ] };
242
+ }
243
+ const qe = { class: "flex flex-col gap-24" }, He = { class: "flex gap-24" }, Ke = { class: "flex-1" }, Ge = { class: "flex-1" }, Oe = { class: "flex" }, Ye = { class: "flex items-center" }, Je = { class: "fm-typo-en-body-lg-600 flex-grow" }, Qe = { class: "flex flex-col gap-24" }, We = { class: "flex gap-24" }, Xe = { class: "flex-1" }, Ze = { class: "flex-1" }, et = /* @__PURE__ */ K({
244
+ __name: "UnitForm",
245
+ props: {
246
+ mode: {},
247
+ modelValue: {},
248
+ disabled: { type: Boolean }
249
+ },
250
+ emits: ["update:modelValue", "click:submit"],
251
+ setup(h, { expose: c, emit: y }) {
252
+ const i = h, n = y, { t: r } = O();
253
+ function d() {
254
+ n("click:submit");
255
+ }
256
+ const m = x({
257
+ get() {
258
+ var e;
259
+ return ((e = i.modelValue) == null ? void 0 : e.name) ?? "";
260
+ },
261
+ set(e) {
262
+ const t = i.modelValue ?? {};
263
+ t.name = e, n("update:modelValue", t);
264
+ }
265
+ }), k = x({
266
+ get() {
267
+ var e;
268
+ return ((e = i.modelValue) == null ? void 0 : e.abbrev) ?? "";
269
+ },
270
+ set(e) {
271
+ const t = i.modelValue ?? {};
272
+ t.abbrev = e, n("update:modelValue", t);
273
+ }
274
+ }), o = x({
275
+ get() {
276
+ var e;
277
+ return ((e = i.modelValue) == null ? void 0 : e.precision) ?? 0;
278
+ },
279
+ set(e) {
280
+ const t = i.modelValue ?? {};
281
+ t.precision = e, n("update:modelValue", t);
282
+ }
283
+ }), s = x({
284
+ get() {
285
+ var e;
286
+ return ((e = i.modelValue) == null ? void 0 : e.measurements) ?? [];
287
+ },
288
+ set(e) {
289
+ const t = i.modelValue ?? {};
290
+ t.measurements = e, n("update:modelValue", t);
291
+ }
292
+ });
293
+ function v() {
294
+ const e = i.modelValue ?? {}, t = e.measurements ?? [];
295
+ e.measurements = [
296
+ ...t,
297
+ {
298
+ id: `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
299
+ name: "",
300
+ abbrev: "",
301
+ conversion: {
302
+ amount: 1,
303
+ precision: 0
304
+ }
305
+ }
306
+ ], n("update:modelValue", e);
307
+ }
308
+ function w(e) {
309
+ const t = i.modelValue ?? {}, u = t.measurements ?? [];
310
+ u.splice(e, 1), t.measurements = u, n("update:modelValue", t);
311
+ }
312
+ const b = M();
313
+ return c({
314
+ validateInputs: () => {
315
+ var e, t;
316
+ (t = (e = b.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
317
+ },
318
+ resetInputsValidation: () => {
319
+ var e, t;
320
+ (t = (e = b.value) == null ? void 0 : e.resetInputsValidation) == null || t.call(e);
321
+ },
322
+ resetInputs: () => {
323
+ var e, t;
324
+ (t = (e = b.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
325
+ }
326
+ }), (e, t) => {
327
+ const u = I("FmTextField"), D = I("FmStepperField"), $ = I("FmButton"), S = I("FmCard"), E = I("FmForm");
328
+ return p(), T(E, {
329
+ ref_key: "formRef",
330
+ ref: b,
331
+ class: "flex flex-col gap-40",
332
+ onValidationSuccess: d
333
+ }, {
334
+ default: R(() => {
335
+ var P;
336
+ return [
337
+ l("div", qe, [
338
+ l("div", He, [
339
+ l("div", Ke, [
340
+ f(u, {
341
+ disabled: e.disabled,
342
+ label: a(r)("inventory.unit.name"),
343
+ modelValue: m.value,
344
+ "onUpdate:modelValue": t[0] || (t[0] = (C) => m.value = C),
345
+ rules: [a(j)()],
346
+ "label-mark": "required"
347
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
348
+ ]),
349
+ l("div", Ge, [
350
+ f(u, {
351
+ disabled: e.disabled,
352
+ label: a(r)("inventory.unit.symbol"),
353
+ modelValue: k.value,
354
+ "onUpdate:modelValue": t[1] || (t[1] = (C) => k.value = C),
355
+ rules: [a(j)()],
356
+ "label-mark": "required"
357
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
358
+ ])
359
+ ]),
360
+ l("div", null, [
361
+ f(D, {
362
+ disabled: e.disabled,
363
+ class: "col-span-3",
364
+ label: a(r)("inventory.unit.precision"),
365
+ modelValue: o.value,
366
+ "onUpdate:modelValue": t[2] || (t[2] = (C) => o.value = C),
367
+ rules: [a(he)(0)]
368
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
369
+ ])
370
+ ]),
371
+ l("div", Oe, [
372
+ f($, {
373
+ disabled: e.disabled,
374
+ type: "button",
375
+ "prepend-icon": "add",
376
+ label: a(r)("inventory.unit.measurement.addMeasurement"),
377
+ variant: "plain",
378
+ onClick: v
379
+ }, null, 8, ["disabled", "label"])
380
+ ]),
381
+ (p(!0), U(q, null, H((P = e.modelValue) == null ? void 0 : P.measurements, (C, _) => (p(), T(S, {
382
+ class: "flex flex-col gap-16 p-16",
383
+ variant: "outlined",
384
+ key: C.id
385
+ }, {
386
+ default: R(() => [
387
+ l("div", Ye, [
388
+ l("div", Je, g(a(r)("inventory.unit.measurement.measurementDefault", [_ + 1])), 1),
389
+ f($, {
390
+ disabled: e.disabled,
391
+ variant: "tertiary",
392
+ "prepend-icon": "delete",
393
+ onClick: (F) => w(_)
394
+ }, null, 8, ["disabled", "onClick"])
395
+ ]),
396
+ l("div", Qe, [
397
+ l("div", We, [
398
+ l("div", Xe, [
399
+ f(u, {
400
+ disabled: e.disabled,
401
+ class: "col-span-2",
402
+ label: a(r)("inventory.unit.measurement.name"),
403
+ modelValue: e.modelValue.measurements[_].name,
404
+ "onUpdate:modelValue": (F) => e.modelValue.measurements[_].name = F,
405
+ rules: [a(j)()],
406
+ "label-mark": "required"
407
+ }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
408
+ ]),
409
+ l("div", Ze, [
410
+ f(u, {
411
+ disabled: e.disabled,
412
+ label: a(r)("inventory.unit.measurement.symbol"),
413
+ modelValue: e.modelValue.measurements[_].abbrev,
414
+ "onUpdate:modelValue": (F) => e.modelValue.measurements[_].abbrev = F,
415
+ rules: [a(j)()],
416
+ "label-mark": "required"
417
+ }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
418
+ ])
419
+ ]),
420
+ f(Ce, {
421
+ disabled: e.disabled,
422
+ class: "col-span-3",
423
+ label: a(r)("inventory.unit.measurement.conversion"),
424
+ "model-value": +a(J)(e.modelValue.measurements[_].conversion),
425
+ "onUpdate:modelValue": (F) => s.value = s.value.map(
426
+ (A, B) => B === _ ? {
427
+ ...A,
428
+ conversion: a(Ue).toPrecision(
429
+ a(we)(F),
430
+ o.value
431
+ )
432
+ } : A
433
+ ),
434
+ rules: [a(Ve)(0)],
435
+ step: +a(J)({ amount: 1, precision: o.value }),
436
+ "helper-text": a(r)("inventory.unit.measurement.conversionHelper", {
437
+ measurementSymbol: e.modelValue.measurements[_].name || "measurement unit",
438
+ conversion: +a(J)(e.modelValue.measurements[_].conversion),
439
+ unitSymbol: m.value || "base unit"
440
+ })
441
+ }, null, 8, ["disabled", "label", "model-value", "onUpdate:modelValue", "rules", "step", "helper-text"])
442
+ ])
443
+ ]),
444
+ _: 2
445
+ }, 1024))), 128))
446
+ ];
447
+ }),
448
+ _: 1
449
+ }, 512);
450
+ };
451
+ }
452
+ }), tt = { class: "flex gap-4" }, ot = /* @__PURE__ */ K({
453
+ __name: "UnitDialog",
454
+ props: {
455
+ show: { type: Boolean },
456
+ unit: {},
457
+ mode: { default: V.READ }
458
+ },
459
+ emits: ["update:show"],
460
+ setup(h) {
461
+ const c = h, y = G(), i = ne(), { t: n } = O(), r = ee(c, "show"), d = ee(c, "unit"), m = x(() => {
462
+ switch (c.mode) {
463
+ case V.READ:
464
+ return "";
465
+ case V.UPDATE:
466
+ return n("inventory.unit.update.title");
467
+ case V.CREATE:
468
+ return n("inventory.unit.create.title");
469
+ }
470
+ return "";
471
+ }), k = x(() => {
472
+ switch (c.mode) {
473
+ case V.READ:
474
+ return "";
475
+ case V.UPDATE:
476
+ return n("common.save");
477
+ case V.CREATE:
478
+ return n("common.add");
479
+ }
480
+ return "";
481
+ }), o = M(), s = M(!1);
482
+ async function v() {
483
+ s.value = !0;
484
+ try {
485
+ const t = oe(d.value);
486
+ t.precision ?? (t.precision = 0), t.measurements ?? (t.measurements = []), await y.createUnit(t), r.value = !1, i.open({
487
+ title: n("common.success"),
488
+ message: n("inventory.unit.create.success", { name: d.value.name }),
489
+ type: "success"
490
+ });
491
+ } catch (t) {
492
+ t instanceof Z || i.open({
493
+ title: n("inventory.unit.create.error.title"),
494
+ message: n("inventory.unit.create.error.message"),
495
+ type: "error"
496
+ });
497
+ } finally {
498
+ s.value = !1;
499
+ }
500
+ }
501
+ async function w() {
502
+ s.value = !0;
503
+ try {
504
+ await y.updateUnit(d.value), r.value = !1, i.open({
505
+ title: n("common.success"),
506
+ message: n("inventory.unit.update.success", { name: d.value.name }),
507
+ type: "success"
508
+ });
509
+ } catch (t) {
510
+ t instanceof Z || i.open({
511
+ title: n("inventory.unit.update.error.title"),
512
+ message: n("inventory.unit.update.error.message"),
513
+ type: "error"
514
+ });
515
+ } finally {
516
+ s.value = !1;
517
+ }
518
+ }
519
+ function b() {
520
+ var t, u;
521
+ (u = (t = o.value) == null ? void 0 : t.validateInputs) == null || u.call(t);
522
+ }
523
+ function e() {
524
+ switch (c.mode) {
525
+ case V.READ:
526
+ return;
527
+ case V.UPDATE:
528
+ return w();
529
+ case V.CREATE:
530
+ return v();
531
+ }
532
+ }
533
+ return (t, u) => {
534
+ const D = I("FmButton"), $ = I("FmSideSheet");
535
+ return p(), T($, {
536
+ "model-value": a(r),
537
+ "onUpdate:modelValue": u[3] || (u[3] = (S) => X(r) ? r.value = S : null),
538
+ header: m.value,
539
+ "close-button": "",
540
+ "dismiss-away": "",
541
+ "max-width": 500
542
+ }, {
543
+ "side-sheet-footer": R(() => [
544
+ l("div", tt, [
545
+ f(D, {
546
+ loading: s.value,
547
+ label: k.value,
548
+ onClick: b
549
+ }, null, 8, ["loading", "label"]),
550
+ f(D, {
551
+ disabled: s.value,
552
+ label: a(n)("common.close"),
553
+ variant: "tertiary",
554
+ onClick: u[2] || (u[2] = (S) => r.value = !1)
555
+ }, null, 8, ["disabled", "label"])
556
+ ])
557
+ ]),
558
+ default: R(() => [
559
+ f(et, {
560
+ class: "w-full",
561
+ ref_key: "hasValidationExpose",
562
+ ref: o,
563
+ modelValue: a(d),
564
+ "onUpdate:modelValue": u[0] || (u[0] = (S) => X(d) ? d.value = S : null),
565
+ mode: t.mode,
566
+ disabled: s.value,
567
+ "onClick:submit": u[1] || (u[1] = (S) => e())
568
+ }, null, 8, ["modelValue", "mode", "disabled"])
569
+ ]),
570
+ _: 1
571
+ }, 8, ["model-value", "header"]);
572
+ };
573
+ }
574
+ }), nt = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, lt = { class: "flex flex-col py-8" }, st = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, at = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gt = /* @__PURE__ */ K({
575
+ __name: "UnitView",
576
+ setup(h) {
577
+ const c = G(), y = de(), i = x(() => c.units), { createUnit: n, updateUnit: r, deleteUnit: d, unitDialogProps: m, unitViewLoading: k } = Ne(), { columnDefs: o } = je({ updateUnit: r, deleteUnit: d });
578
+ function s(D) {
579
+ D === "add" && n();
580
+ }
581
+ const v = M(""), w = x(() => k.value), { breakpoints: b } = ce(), e = x(() => b.value.xs || b.value.sm ? 10 : 20), t = _e(), { t: u } = O();
582
+ return (D, $) => {
583
+ const S = I("FmTable");
584
+ return p(), T(ge, {
585
+ title: a(u)("inventory.unit.title"),
586
+ actions: [
587
+ { label: a(u)("inventory.unit.create.title"), value: "add", isPrimary: !0, prependIcon: "add" }
588
+ ],
589
+ "onClick:action": s
590
+ }, {
591
+ default: R(() => [
592
+ l("div", nt, [
593
+ f(xe, {
594
+ searchable: "",
595
+ search: v.value,
596
+ "onUpdate:search": $[0] || ($[0] = (E) => v.value = E)
597
+ }, null, 8, ["search"]),
598
+ f(S, {
599
+ style: se(a(t).tableHeight),
600
+ "column-defs": a(o),
601
+ "row-data": i.value,
602
+ "search-value": v.value,
603
+ loading: !a(y)._currentLocation || w.value,
604
+ onRowClick: $[1] || ($[1] = (E) => a(r)(E.original)),
605
+ "page-size": e.value
606
+ }, {
607
+ "list-row": R((E) => [
608
+ f(ye, {
609
+ row: E,
610
+ onRowClick: a(r)
611
+ }, {
612
+ default: R((P) => {
613
+ var C, _, F, A, B, L, Q, z, W;
614
+ return [
615
+ l("div", lt, [
616
+ l("div", st, [
617
+ f(a(be), {
618
+ render: (F = (_ = (C = P.name) == null ? void 0 : C.column) == null ? void 0 : _.columnDef) == null ? void 0 : F.cell,
619
+ props: (B = (A = P.name) == null ? void 0 : A.getContext) == null ? void 0 : B.call(A)
620
+ }, null, 8, ["render", "props"])
621
+ ]),
622
+ l("div", at, g((W = (z = (Q = (L = E.original.measurements) == null ? void 0 : L.map) == null ? void 0 : Q.call(L, (le) => le.name)) == null ? void 0 : z.join) == null ? void 0 : W.call(z, ", ")), 1)
623
+ ])
624
+ ];
625
+ }),
626
+ _: 2
627
+ }, 1032, ["row", "onRowClick"])
628
+ ]),
629
+ _: 1
630
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
631
+ ]),
632
+ (p(), T(ae, { to: "body" }, [
633
+ f(ot, re(ie(a(m))), null, 16)
634
+ ]))
635
+ ]),
636
+ _: 1
637
+ }, 8, ["title", "actions"]);
638
+ };
639
+ }
640
+ });
641
+ export {
642
+ gt as default
643
+ };