@feedmepos/mf-inventory-portal 1.2.12-dev.2 → 1.2.12

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 (74) hide show
  1. package/dist/{App-T4sL7Sy4.js → App-CP0Qx_82.js} +40 -44
  2. package/dist/{ApprovalView-CfmNwkYs.js → ApprovalView-D8_PzEpZ.js} +30 -30
  3. package/dist/{BindingsDialog-DDYAQsNs.js → BindingsDialog-BbpKhb0L.js} +2 -2
  4. package/dist/{BindingsPicker-CXZhlZ4b.js → BindingsPicker-DzDxisHj.js} +1 -1
  5. package/dist/{BindingsTable-LQ59h-NA.js → BindingsTable-DCXXSY8e.js} +1 -1
  6. package/dist/{ClosingDraftView-B1J4RCvY.js → ClosingDraftView-CkF-9An8.js} +129 -129
  7. package/dist/{ClosingTemplateView-6NoqcDMF.js → ClosingTemplateView-Ce1l7n0x.js} +28 -28
  8. package/dist/{DeliveryOrderPrintPreview--XMB1yg_.js → DeliveryOrderPrintPreview-CFzsECiK.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BXxGymbF.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-ZSERZzyn.js} +3 -3
  10. package/dist/{FmMultiselectDialog-DPPNjHO8.js → FmMultiselectDialog-DP992D0Q.js} +1 -1
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CSgYZv-j.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CzUvuj_c.js} +45 -45
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-tUefDFh2.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DsYwSn0d.js} +1 -1
  13. package/dist/{IngredientGroupView-BjtjeGay.js → IngredientGroupView-DUiKKpvF.js} +32 -31
  14. package/dist/IngredientsView-C3ozIXV8.js +2475 -0
  15. package/dist/{IntegrationView-D8HiAM5K.js → IntegrationView-CydpIwrf.js} +57 -57
  16. package/dist/{InventoryBindingForm-DCtBdWkM.js → InventoryBindingForm-BVd2FzOW.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-RxoPehX0.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CYp_JSBb.js} +31 -31
  18. package/dist/{InventoryBindingSummary-DGLMoDKd.js → InventoryBindingSummary-Dthool-6.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-D0ElZcnn.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DR0_Qtyc.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BNm3V8o4.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BLfGb7mm.js} +1 -1
  21. package/dist/{PublishView-DQcrQkVJ.js → PublishView-BE_aIhZ6.js} +15 -15
  22. package/dist/{PurchaseOrderPrintPreview-1NMEozJD.js → PurchaseOrderPrintPreview-CGeqqFg-.js} +1 -1
  23. package/dist/{ReceiveRequestView-BFs8VYre.js → ReceiveRequestView-Bul9Esf1.js} +63 -62
  24. package/dist/RecipeView-B9AGELV7.js +621 -0
  25. package/dist/{StockView-B80E0r1r.js → StockView-fpJrx4Bd.js} +166 -165
  26. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CFFDw9Mj.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DeOEgJ1N.js} +1 -1
  27. package/dist/{SupplierView-E_fX8cgQ.js → SupplierView-cfZTJqef.js} +492 -490
  28. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-m5o77oG-.js +3057 -0
  29. package/dist/{TransferTemplateView-B-uBdQgp.js → TransferTemplateView-PZ8Mad4D.js} +48 -48
  30. package/dist/UnitView-C3gJq1Mt.js +667 -0
  31. package/dist/{WarehouseView-DZSetx-S.js → WarehouseView-CWGQjwJm.js} +32 -32
  32. package/dist/api/inventory.d.ts +0 -306
  33. package/dist/api/purchase-order.d.ts +0 -1
  34. package/dist/{app-CLG8lnmY.js → app-D5PlbdVa.js} +8475 -8810
  35. package/dist/app.d.ts +0 -169
  36. package/dist/app.js +1 -1
  37. package/dist/array-Ca8T3f_G.js +44 -0
  38. package/dist/{closing-template-CHz79DOu.js → closing-template-C4FizLUw.js} +1 -1
  39. package/dist/{decimal-BNFgzHyV.js → decimal-Cv7FZ14q.js} +1 -1
  40. package/dist/{format-unit-display-DYY0F6KV.js → format-unit-display-B0NO6FLh.js} +25 -25
  41. package/dist/helper/number.d.ts +0 -1
  42. package/dist/{index-Bu7FmfHi.js → index-BCo2jtpG.js} +1 -1
  43. package/dist/{index-DiYSFnk1.js → index-DaJ92t7D.js} +1 -1
  44. package/dist/{purchase-order-template-DtfKTZLV.js → purchase-order-template-DLkR7Mva.js} +1 -1
  45. package/dist/router/name.d.ts +0 -1
  46. package/dist/{stock-RE6RExO9.js → stock-AUSAF9Ij.js} +1 -1
  47. package/dist/stores/feature.d.ts +0 -2
  48. package/dist/stores/inventory.d.ts +199 -26
  49. package/dist/{supplier-DkLAGLl7.js → supplier-DBXoP2UX.js} +1 -1
  50. package/dist/tsconfig.app.tsbuildinfo +1 -1
  51. package/dist/{use-ingredient-select-dialog-Bg_kT9z-.js → use-ingredient-select-dialog-DZQR6jfi.js} +1 -1
  52. package/dist/{use-inventory-binding-dialog-CpS4GfwM.js → use-inventory-binding-dialog-8PZ37vLV.js} +1 -1
  53. package/dist/views/ingredients/helper/import-export.helper.d.ts +1 -3
  54. package/dist/views/recipe/RecipeView.vue.d.ts +0 -1
  55. package/dist/views/unit/UnitView.vue.d.ts +0 -1
  56. package/package.json +1 -1
  57. package/dist/ImportView-ClHIcxRw.js +0 -1195
  58. package/dist/IngredientsView-BA6Y-uhX.js +0 -2240
  59. package/dist/RecipeView-DgF_kShy.js +0 -636
  60. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Bxl2Gege.js +0 -3221
  61. package/dist/UnitView-DOIy_8oz.js +0 -674
  62. package/dist/import-export.helper-uZNU9S1q.js +0 -243
  63. package/dist/views/import/ImportView.vue.d.ts +0 -3
  64. package/dist/views/import/components/ImportDialog.vue.d.ts +0 -2
  65. package/dist/views/import/helper/import-export.helper.d.ts +0 -4
  66. package/dist/views/receive-request/components/delivery-order-form/SystemTrailDialog.vue.d.ts +0 -17
  67. package/dist/views/recipe/components/import-recipes/ImportRecipeItem.vue.d.ts +0 -16
  68. package/dist/views/recipe/components/import-recipes/ImportRecipes.vue.d.ts +0 -2
  69. package/dist/views/recipe/helper/import-recipe.d.ts +0 -48
  70. package/dist/views/unit/components/import-units/ImportUnitItem.vue.d.ts +0 -12
  71. package/dist/views/unit/components/import-units/ImportUnitItemProps.d.ts +0 -6
  72. package/dist/views/unit/components/import-units/ImportUnits.vue.d.ts +0 -9
  73. package/dist/views/unit/components/import-units/ImportUnitsProps.d.ts +0 -5
  74. package/dist/views/unit/helper/import-export.helper.d.ts +0 -40
@@ -1,674 +0,0 @@
1
- import { defineComponent as Y, computed as b, openBlock as v, createElementBlock as w, createElementVNode as s, Fragment as G, renderList as K, toDisplayString as h, createCommentVNode as Z, ref as I, watch as oe, resolveComponent as $, createBlock as T, withCtx as A, createVNode as f, unref as i, isRef as le, normalizeClass as me, normalizeStyle as ce, Teleport as pe, normalizeProps as ve, guardReactiveProps as fe } from "vue";
2
- import { a as J, e as U, S as ye, i as be, D as se, j as q, f as ie, Y as ge, p as H, A as xe, l as Q, Z as _e, $ as he, w as ae, u as Ve, b as Ue, C as we, E as Ce, G as Se, I as ke, J as Ee } from "./app-CLG8lnmY.js";
3
- import { useDialog as ue, useSnackbar as X, useProxiedModel as re, useBreakpoints as Fe } from "@feedmepos/ui-library";
4
- import { i as $e, _ as Ie } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
- import { defineStore as Ae, storeToRefs as De } from "pinia";
6
- import { useI18n as O } from "@feedmepos/mf-common";
7
- import { F as Re } from "./decimal-BNFgzHyV.js";
8
- import { _ as Me } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-D0ElZcnn.js";
9
- const Pe = { class: "flex flex-col gap-8" }, Te = {
10
- key: 0,
11
- class: "flex flex-col"
12
- }, Be = { class: "flex-1 py-8 px-16" }, Le = {
13
- class: "flex-0 py-8 px-16",
14
- style: { "flex-basis": "240px" }
15
- }, Ne = {
16
- key: 1,
17
- class: "flex flex-col"
18
- }, ze = { class: "flex-1 py-8 px-16" }, je = {
19
- class: "flex-0 py-8 px-16",
20
- style: { "flex-basis": "240px" }
21
- }, qe = {
22
- key: 2,
23
- class: "flex flex-col"
24
- }, He = { class: "flex-1 py-8 px-16" }, Ge = {
25
- class: "flex-0 py-8 px-16",
26
- style: { "flex-basis": "240px" }
27
- }, Ke = /* @__PURE__ */ Y({
28
- __name: "UnitUsedBy",
29
- props: {
30
- unit: {}
31
- },
32
- setup(S) {
33
- const c = S, g = J(), m = b(() => g.validateUnitUsage(c.unit)), l = b(() => m.value.filter((n) => n.from === "INGREDIENT")), a = b(() => m.value.filter((n) => n.from === "RECIPE")), d = b(() => m.value.filter((n) => n.from === "MENU"));
34
- return (n, p) => (v(), w("div", Pe, [
35
- p[3] || (p[3] = s("div", { class: "fm-typo-en-body-md-400" }, "Sorry, this unit is used in the following modules:", -1)),
36
- l.value.length ? (v(), w("div", Te, [
37
- p[0] || (p[0] = s("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" }, [
38
- s("div", { class: "flex-1 py-8 px-16" }, "Ingredient"),
39
- s("div", {
40
- class: "flex-0 py-8 px-16",
41
- style: { "flex-basis": "240px" }
42
- }, "Used in")
43
- ], -1)),
44
- (v(!0), w(G, null, K(l.value, (r) => {
45
- var t;
46
- return v(), w("div", {
47
- key: r.code,
48
- class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
49
- }, [
50
- s("div", Be, h(r.code) + " " + h(r.name), 1),
51
- s("div", Le, h((t = r.bindedIngredient) != null && t.length ? "Convert binding" : "Item unit"), 1)
52
- ]);
53
- }), 128))
54
- ])) : Z("", !0),
55
- a.value.length ? (v(), w("div", Ne, [
56
- p[1] || (p[1] = s("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" }, [
57
- s("div", { class: "flex-1 py-8 px-16" }, "Recipe"),
58
- s("div", {
59
- class: "flex-0 py-8 px-16",
60
- style: { "flex-basis": "240px" }
61
- }, "Used in")
62
- ], -1)),
63
- (v(!0), w(G, null, K(a.value, (r) => {
64
- var t, u, y;
65
- return v(), w("div", {
66
- key: r.code,
67
- class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
68
- }, [
69
- s("div", ze, h(r.code) + " " + h(r.name), 1),
70
- s("div", je, h((t = r.bindedIngredient) == null ? void 0 : t.slice(0, 3).map((k) => k.code).join(", ")) + " " + h(r.bindedIngredient && ((u = r.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((y = r.bindedIngredient) == null ? void 0 : y.length) - 3} more` : ""), 1)
71
- ]);
72
- }), 128))
73
- ])) : Z("", !0),
74
- d.value.length ? (v(), w("div", qe, [
75
- p[2] || (p[2] = s("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" }, [
76
- s("div", { class: "flex-1 py-8 px-16" }, "Menu"),
77
- s("div", {
78
- class: "flex-0 py-8 px-16",
79
- style: { "flex-basis": "240px" }
80
- }, "Used in")
81
- ], -1)),
82
- (v(!0), w(G, null, K(d.value, (r) => {
83
- var t, u, y;
84
- return v(), w("div", {
85
- key: r.code,
86
- class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
87
- }, [
88
- s("div", He, h(r.code) + " " + h(r.name), 1),
89
- s("div", Ge, h((t = r.bindedIngredient) == null ? void 0 : t.slice(0, 3).map((k) => k.code).join(", ")) + " " + h(r.bindedIngredient && ((u = r.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((y = r.bindedIngredient) == null ? void 0 : y.length) - 3} more` : ""), 1)
90
- ]);
91
- }), 128))
92
- ])) : Z("", !0)
93
- ]));
94
- }
95
- }), W = Ae("unitForm", function() {
96
- const c = ue(), g = X(), m = J(), l = I(!1), a = I();
97
- function d() {
98
- const t = {
99
- unit: {},
100
- mode: U.CREATE,
101
- show: !0,
102
- "onUpdate:show"(u) {
103
- a.value.show = u;
104
- }
105
- };
106
- a.value = t;
107
- }
108
- async function n(t) {
109
- const u = {
110
- unit: t,
111
- mode: U.UPDATE,
112
- show: !0,
113
- "onUpdate:show"(y) {
114
- a.value.show = y;
115
- }
116
- };
117
- a.value = u;
118
- }
119
- async function p(t) {
120
- l.value = !0;
121
- try {
122
- await m.deleteUnit(t), g.open({
123
- title: "Success",
124
- message: `Deleted ${t.name}`,
125
- type: "success"
126
- });
127
- } catch (u) {
128
- u instanceof ye && $e(u) ? c.open({
129
- title: "Cannot delete unit",
130
- contentComponent: Ie,
131
- contentComponentProps: {
132
- subject: (t == null ? void 0 : t.name) ?? "",
133
- items: u.errorResponse.message
134
- },
135
- secondaryActions: {
136
- text: "Close",
137
- close: !0
138
- }
139
- }) : console.log("unable to delete unit", u), g.open({
140
- title: `Cannot delete ${t.name}`,
141
- message: "Please try again.",
142
- type: "error"
143
- }), console.error("failed to delete unit", u);
144
- } finally {
145
- l.value = !1;
146
- }
147
- }
148
- function r(t) {
149
- if (m.validateUnitUsage(t).length) {
150
- c.open({
151
- title: `Cannot delete ${(t == null ? void 0 : t.name) ?? "unit"}`,
152
- overlay: !0,
153
- dismissAway: !0,
154
- closeButton: !0,
155
- contentComponent: Ke,
156
- contentComponentProps: {
157
- unit: t
158
- },
159
- primaryActions: {
160
- text: "Confirm",
161
- close: !0
162
- }
163
- });
164
- return;
165
- }
166
- c.open({
167
- title: `Delete ${(t == null ? void 0 : t.name) ?? "unit"}?`,
168
- closeButton: !1,
169
- message: "You may not be able to delete this unit if it is linked in any of the inventory modules.",
170
- primaryActions: {
171
- text: "Delete",
172
- close: !0,
173
- variant: "destructive"
174
- },
175
- secondaryActions: {
176
- text: "Cancel",
177
- close: !0
178
- }
179
- }).onPrimary(() => p(t));
180
- }
181
- return {
182
- createUnit: d,
183
- updateUnit: n,
184
- deleteUnit: r,
185
- unitDialogProps: a,
186
- unitViewLoading: l
187
- };
188
- });
189
- function Ye() {
190
- const { updateUnit: S, deleteUnit: c } = W(), { t: g } = O();
191
- async function m(a, d) {
192
- const n = ie(d);
193
- if (a === q.Edit) {
194
- await S(n);
195
- return;
196
- }
197
- if (a === q.Delete) {
198
- await c(n);
199
- return;
200
- }
201
- }
202
- return { columnDefs: [
203
- {
204
- accessorKey: "name",
205
- header: g("inventory.unit.table.name"),
206
- enableSorting: !0,
207
- size: 300
208
- },
209
- {
210
- accessorKey: "abbrev",
211
- header: g("inventory.unit.table.symbol"),
212
- enableSorting: !1,
213
- size: "auto"
214
- },
215
- {
216
- id: "action",
217
- header: "",
218
- cell(a) {
219
- return be(
220
- [se[q.Edit], se[q.Delete]],
221
- (d) => {
222
- m(d, a.row.original);
223
- }
224
- );
225
- },
226
- enableSorting: !1,
227
- size: 40,
228
- meta: {
229
- cellClass: "",
230
- headerClass: ""
231
- }
232
- }
233
- ] };
234
- }
235
- const Je = { class: "flex flex-col gap-24" }, Oe = { class: "flex gap-24" }, Ze = { class: "flex-1" }, Qe = { class: "flex-1" }, We = { class: "flex" }, Xe = { class: "flex items-center" }, et = { class: "fm-typo-en-body-lg-600 flex-grow" }, tt = { class: "flex flex-col gap-24" }, nt = { class: "flex gap-24" }, ot = { class: "flex-1" }, lt = { class: "flex-1" }, st = /* @__PURE__ */ Y({
236
- __name: "UnitForm",
237
- props: {
238
- mode: {},
239
- modelValue: {},
240
- disabled: { type: Boolean }
241
- },
242
- emits: ["update:modelValue", "click:submit"],
243
- setup(S, { expose: c, emit: g }) {
244
- const m = S, l = g, { t: a } = O();
245
- function d() {
246
- l("click:submit");
247
- }
248
- const n = I(m.modelValue);
249
- oe(
250
- () => m.modelValue,
251
- (e) => {
252
- n.value = e;
253
- }
254
- );
255
- const p = b({
256
- get() {
257
- var e;
258
- return ((e = n.value) == null ? void 0 : e.name) ?? "";
259
- },
260
- set(e) {
261
- n.value.name = e, l("update:modelValue", n.value);
262
- }
263
- }), r = b({
264
- get() {
265
- var e;
266
- return ((e = n.value) == null ? void 0 : e.abbrev) ?? "";
267
- },
268
- set(e) {
269
- n.value.abbrev = e, l("update:modelValue", n.value);
270
- }
271
- }), t = b({
272
- get() {
273
- var e;
274
- return ((e = n.value) == null ? void 0 : e.precision) ?? 0;
275
- },
276
- set(e) {
277
- n.value.precision = e, l("update:modelValue", n.value);
278
- }
279
- }), u = b({
280
- get() {
281
- var e;
282
- return ((e = n.value) == null ? void 0 : e.measurements) ?? [];
283
- },
284
- set(e) {
285
- n.value.measurements = e, l("update:modelValue", n.value);
286
- }
287
- });
288
- oe(
289
- () => t.value,
290
- (e) => {
291
- if (typeof e == "number" && !isNaN(e)) {
292
- const o = u.value.map((V) => ({
293
- ...V,
294
- conversion: ge.convertPrecision({
295
- value: V.conversion,
296
- precision: e
297
- })
298
- }));
299
- n.value.measurements = o, l("update:modelValue", n.value);
300
- }
301
- },
302
- { immediate: !0 }
303
- );
304
- function y() {
305
- const e = n.value.measurements ?? [];
306
- n.value.measurements = [
307
- ...e,
308
- {
309
- id: `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
310
- name: "",
311
- abbrev: "",
312
- conversion: {
313
- amount: 1,
314
- precision: 0
315
- }
316
- }
317
- ], l("update:modelValue", n.value);
318
- }
319
- function k(e) {
320
- const o = n.value.measurements ?? [];
321
- o.splice(e, 1), n.value.measurements = o, l("update:modelValue", n.value);
322
- }
323
- const F = I();
324
- return c({
325
- validateInputs: () => {
326
- var e, o;
327
- (o = (e = F.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
328
- },
329
- resetInputsValidation: () => {
330
- var e, o;
331
- (o = (e = F.value) == null ? void 0 : e.resetInputsValidation) == null || o.call(e);
332
- },
333
- resetInputs: () => {
334
- var e, o;
335
- (o = (e = F.value) == null ? void 0 : e.resetInputs) == null || o.call(e);
336
- }
337
- }), (e, o) => {
338
- const V = $("FmTextField"), R = $("FmStepperField"), C = $("FmButton"), M = $("FmCard"), D = $("FmForm");
339
- return v(), T(D, {
340
- ref_key: "formRef",
341
- ref: F,
342
- class: "flex flex-col gap-40",
343
- onValidationSuccess: d
344
- }, {
345
- default: A(() => {
346
- var B;
347
- return [
348
- s("div", Je, [
349
- s("div", Oe, [
350
- s("div", Ze, [
351
- f(V, {
352
- disabled: e.disabled,
353
- label: i(a)("inventory.unit.name"),
354
- modelValue: p.value,
355
- "onUpdate:modelValue": o[0] || (o[0] = (x) => p.value = x),
356
- rules: [i(H)()],
357
- "label-mark": "required"
358
- }, null, 8, ["disabled", "label", "modelValue", "rules"])
359
- ]),
360
- s("div", Qe, [
361
- f(V, {
362
- disabled: e.disabled,
363
- label: i(a)("inventory.unit.symbol"),
364
- modelValue: r.value,
365
- "onUpdate:modelValue": o[1] || (o[1] = (x) => r.value = x),
366
- rules: [i(H)()],
367
- "label-mark": "required"
368
- }, null, 8, ["disabled", "label", "modelValue", "rules"])
369
- ])
370
- ]),
371
- s("div", null, [
372
- f(R, {
373
- disabled: e.disabled,
374
- class: "col-span-3",
375
- label: i(a)("inventory.unit.precision"),
376
- modelValue: t.value,
377
- "onUpdate:modelValue": o[2] || (o[2] = (x) => t.value = x),
378
- rules: [i(xe)(0)]
379
- }, null, 8, ["disabled", "label", "modelValue", "rules"])
380
- ])
381
- ]),
382
- s("div", We, [
383
- f(C, {
384
- disabled: e.disabled,
385
- type: "button",
386
- "prepend-icon": "add",
387
- label: i(a)("inventory.unit.measurement.addMeasurement"),
388
- variant: "plain",
389
- onClick: y
390
- }, null, 8, ["disabled", "label"])
391
- ]),
392
- (v(!0), w(G, null, K((B = e.modelValue) == null ? void 0 : B.measurements, (x, _) => (v(), T(M, {
393
- class: "flex flex-col gap-16 p-16",
394
- variant: "outlined",
395
- key: x.id
396
- }, {
397
- default: A(() => [
398
- s("div", Xe, [
399
- s("div", et, h(i(a)("inventory.unit.measurement.measurementDefault", [_ + 1])), 1),
400
- f(C, {
401
- disabled: e.disabled,
402
- variant: "tertiary",
403
- "prepend-icon": "delete",
404
- onClick: (E) => k(_)
405
- }, null, 8, ["disabled", "onClick"])
406
- ]),
407
- s("div", tt, [
408
- s("div", nt, [
409
- s("div", ot, [
410
- f(V, {
411
- disabled: e.disabled,
412
- class: "col-span-2",
413
- label: i(a)("inventory.unit.measurement.name"),
414
- modelValue: e.modelValue.measurements[_].name,
415
- "onUpdate:modelValue": (E) => e.modelValue.measurements[_].name = E,
416
- rules: [i(H)()],
417
- "label-mark": "required"
418
- }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
419
- ]),
420
- s("div", lt, [
421
- f(V, {
422
- disabled: e.disabled,
423
- label: i(a)("inventory.unit.measurement.symbol"),
424
- modelValue: e.modelValue.measurements[_].abbrev,
425
- "onUpdate:modelValue": (E) => e.modelValue.measurements[_].abbrev = E,
426
- rules: [i(H)()],
427
- "label-mark": "required"
428
- }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
429
- ])
430
- ]),
431
- f(Me, {
432
- disabled: e.disabled,
433
- class: "col-span-3",
434
- label: i(a)("inventory.unit.measurement.conversion"),
435
- "model-value": +i(Q)(e.modelValue.measurements[_].conversion),
436
- "onUpdate:modelValue": (E) => u.value = u.value.map(
437
- (P, L) => L === _ ? {
438
- ...P,
439
- conversion: i(Re).toPrecision(
440
- i(_e)(E),
441
- t.value
442
- )
443
- } : P
444
- ),
445
- rules: [i(he)(0)],
446
- step: +i(Q)({ amount: 1, precision: t.value }),
447
- "helper-text": i(a)("inventory.unit.measurement.conversionHelper", {
448
- measurementSymbol: e.modelValue.measurements[_].name || " measurement unit",
449
- conversion: +i(Q)(e.modelValue.measurements[_].conversion),
450
- unitSymbol: r.value || "base unit"
451
- })
452
- }, null, 8, ["disabled", "label", "model-value", "onUpdate:modelValue", "rules", "step", "helper-text"])
453
- ])
454
- ]),
455
- _: 2
456
- }, 1024))), 128))
457
- ];
458
- }),
459
- _: 1
460
- }, 512);
461
- };
462
- }
463
- }), at = { class: "flex gap-4" }, rt = /* @__PURE__ */ Y({
464
- __name: "UnitDialog",
465
- props: {
466
- show: { type: Boolean },
467
- unit: {},
468
- mode: { default: U.READ }
469
- },
470
- emits: ["update:show"],
471
- setup(S) {
472
- const c = S, g = J(), m = X(), { t: l } = O(), a = re(c, "show"), d = re(c, "unit"), n = b(() => {
473
- switch (c.mode) {
474
- case U.READ:
475
- return "";
476
- case U.UPDATE:
477
- return l("inventory.unit.update.title");
478
- case U.CREATE:
479
- return l("inventory.unit.create.title");
480
- }
481
- return "";
482
- }), p = b(() => {
483
- switch (c.mode) {
484
- case U.READ:
485
- return "";
486
- case U.UPDATE:
487
- return l("common.save");
488
- case U.CREATE:
489
- return l("common.add");
490
- }
491
- return "";
492
- }), r = I(), t = I(!1);
493
- async function u() {
494
- t.value = !0;
495
- try {
496
- const e = ie(d.value);
497
- e.precision ?? (e.precision = 0), e.measurements ?? (e.measurements = []), await g.createUnit(e), a.value = !1, m.open({
498
- title: l("inventory.common.success"),
499
- message: l("inventory.unit.create.success", { name: d.value.name }),
500
- type: "success"
501
- });
502
- } catch (e) {
503
- e instanceof ae || m.open({
504
- title: l("inventory.unit.create.error.title"),
505
- message: l("inventory.unit.create.error.message"),
506
- type: "error"
507
- });
508
- } finally {
509
- t.value = !1;
510
- }
511
- }
512
- async function y() {
513
- t.value = !0;
514
- try {
515
- await g.updateUnit(d.value), a.value = !1, m.open({
516
- title: l("inventory.common.success"),
517
- message: l("inventory.unit.update.success", { name: d.value.name }),
518
- type: "success"
519
- });
520
- } catch (e) {
521
- e instanceof ae || m.open({
522
- title: l("inventory.unit.update.error.title"),
523
- message: l("inventory.unit.update.error.message"),
524
- type: "error"
525
- });
526
- } finally {
527
- t.value = !1;
528
- }
529
- }
530
- function k() {
531
- var e, o;
532
- (o = (e = r.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
533
- }
534
- function F() {
535
- switch (c.mode) {
536
- case U.READ:
537
- return;
538
- case U.UPDATE:
539
- return y();
540
- case U.CREATE:
541
- return u();
542
- }
543
- }
544
- return (e, o) => {
545
- const V = $("FmButton"), R = $("FmSideSheet");
546
- return v(), T(R, {
547
- "model-value": i(a),
548
- "onUpdate:modelValue": o[3] || (o[3] = (C) => le(a) ? a.value = C : null),
549
- header: n.value,
550
- "close-button": "",
551
- "dismiss-away": "",
552
- "max-width": 500
553
- }, {
554
- "side-sheet-footer": A(() => [
555
- s("div", at, [
556
- f(V, {
557
- loading: t.value,
558
- label: p.value,
559
- onClick: k
560
- }, null, 8, ["loading", "label"]),
561
- f(V, {
562
- disabled: t.value,
563
- label: i(l)("common.close"),
564
- variant: "tertiary",
565
- onClick: o[2] || (o[2] = (C) => a.value = !1)
566
- }, null, 8, ["disabled", "label"])
567
- ])
568
- ]),
569
- default: A(() => [
570
- f(st, {
571
- class: "w-full",
572
- ref_key: "hasValidationExpose",
573
- ref: r,
574
- modelValue: i(d),
575
- "onUpdate:modelValue": o[0] || (o[0] = (C) => le(d) ? d.value = C : null),
576
- mode: e.mode,
577
- disabled: t.value,
578
- "onClick:submit": o[1] || (o[1] = (C) => F())
579
- }, null, 8, ["modelValue", "mode", "disabled"])
580
- ]),
581
- _: 1
582
- }, 8, ["model-value", "header"]);
583
- };
584
- }
585
- }), it = { class: "flex flex-col py-8" }, ut = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xt = /* @__PURE__ */ Y({
586
- __name: "UnitView",
587
- setup(S) {
588
- const c = J(), g = Ve(), m = Ue();
589
- ue(), X();
590
- const { t: l } = O(), a = b(() => c.units), { createUnit: d, updateUnit: n } = W(), { unitDialogProps: p, unitViewLoading: r } = De(W()), { columnDefs: t } = Ye();
591
- function u(M) {
592
- switch (M) {
593
- case "add":
594
- return m.isEnabled ? void 0 : d();
595
- }
596
- }
597
- const y = I(""), k = I(!1), F = b(() => k.value || r.value), { breakpoints: e } = Fe(), o = b(() => e.value.xs || e.value.sm), V = b(() => o.value ? 10 : 20), R = we(), C = b(() => [
598
- ...m.isEnabled ? [] : [
599
- {
600
- label: l("inventory.unit.create.title"),
601
- value: "add",
602
- isPrimary: !0,
603
- prependIcon: "add"
604
- }
605
- ]
606
- ]);
607
- return (M, D) => {
608
- const B = $("FmTable");
609
- return v(), T(Ce, {
610
- title: i(l)("inventory.unit.title"),
611
- actions: C.value,
612
- "onClick:action": u
613
- }, {
614
- default: A(() => [
615
- s("div", {
616
- class: me([
617
- "flex flex-col gap-8 max-h-full",
618
- {
619
- "p-0": o.value,
620
- "px-24 ": !o.value
621
- }
622
- ])
623
- }, [
624
- f(Se, {
625
- searchable: "",
626
- search: y.value,
627
- "onUpdate:search": D[0] || (D[0] = (x) => y.value = x)
628
- }, null, 8, ["search"]),
629
- f(B, {
630
- style: ce(i(R).tableHeight),
631
- "column-defs": i(t),
632
- "row-data": a.value,
633
- "search-value": y.value,
634
- loading: !i(g)._currentLocation || F.value,
635
- onRowClick: D[1] || (D[1] = (x) => i(n)(x.original)),
636
- "page-size": V.value
637
- }, {
638
- "list-row": A((x) => [
639
- f(ke, {
640
- row: x,
641
- onRowClick: i(n)
642
- }, {
643
- default: A((_) => {
644
- var E, P, L, N, ee, z, te, j, ne;
645
- return [
646
- s("div", it, [
647
- s("div", ut, [
648
- f(i(Ee), {
649
- render: (L = (P = (E = _.name) == null ? void 0 : E.column) == null ? void 0 : P.columnDef) == null ? void 0 : L.cell,
650
- props: (ee = (N = _.name) == null ? void 0 : N.getContext) == null ? void 0 : ee.call(N)
651
- }, null, 8, ["render", "props"])
652
- ]),
653
- s("div", dt, h((ne = (j = (te = (z = x.original.measurements) == null ? void 0 : z.map) == null ? void 0 : te.call(z, (de) => de.name)) == null ? void 0 : j.join) == null ? void 0 : ne.call(j, ", ")), 1)
654
- ])
655
- ];
656
- }),
657
- _: 2
658
- }, 1032, ["row", "onRowClick"])
659
- ]),
660
- _: 1
661
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
662
- ], 2),
663
- (v(), T(pe, { to: "body" }, [
664
- f(rt, ve(fe(i(p))), null, 16)
665
- ]))
666
- ]),
667
- _: 1
668
- }, 8, ["title", "actions"]);
669
- };
670
- }
671
- });
672
- export {
673
- xt as default
674
- };