@feedmepos/mf-inventory-portal 1.0.13 → 1.0.15-dev.1

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 (58) hide show
  1. package/dist/{App-D3tAuqoa.js → App-DtuHbzaj.js} +3 -3
  2. package/dist/{ApprovalView-CZSEkuxs.js → ApprovalView-C8gHcI4o.js} +2 -2
  3. package/dist/{BindingsDialog-BCw5xmh3.js → BindingsDialog-CLp5DbdF.js} +2 -2
  4. package/dist/{BindingsPicker-B--B9aT5.js → BindingsPicker-ChB_dM_r.js} +1 -1
  5. package/dist/{BindingsTable-z4ohAK-T.js → BindingsTable-usQiwRyf.js} +1 -1
  6. package/dist/{ClosingDraftView-5fVFzVpD.js → ClosingDraftView-C7mlsyK5.js} +20 -20
  7. package/dist/{ClosingTemplateView-BuJtrXgC.js → ClosingTemplateView-C3csSJ5x.js} +10 -10
  8. package/dist/{DeliveryOrderPrintPreview-DPlR2qhc.js → DeliveryOrderPrintPreview-DGI0Mk4p.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-P1dvKMS3.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D8iQyzaJ.js} +3 -3
  10. package/dist/{FmMultiselectDialog-CVNqlp0n.js → FmMultiselectDialog-B3MYE2b7.js} +1 -1
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-ublLlB16.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DFidOxdU.js} +12 -12
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-MSbWAo1i.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CIKQ6nC1.js} +1 -1
  13. package/dist/{IngredientGroupView-CgNdkuae.js → IngredientGroupView-91WE1P4g.js} +2 -2
  14. package/dist/{IngredientsView-Bg9XhCNT.js → IngredientsView-CLZX2W7Y.js} +4 -4
  15. package/dist/{IntegrationView-DKzLjZig.js → IntegrationView-D8VbNV6H.js} +1009 -1000
  16. package/dist/{InventoryBindingForm-CZl0uidf.js → InventoryBindingForm-rGVDi4T8.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BhxHbT2g.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Dx4rHyb5.js} +24 -24
  18. package/dist/{InventoryBindingSummary-BTO2qsNW.js → InventoryBindingSummary-BGLbSQRD.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B4GyfLV-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CJ5FPRac.js} +26 -20
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-Cfup6M3u.js → PremiumBadge.vue_vue_type_script_setup_true_lang-qUWKfasI.js} +1 -1
  21. package/dist/{PublishView-CjmtkaiI.js → PublishView-ClqhWcBu.js} +8 -8
  22. package/dist/{PurchaseOrderPrintPreview-KG9VkV-7.js → PurchaseOrderPrintPreview-s2TN-ZJL.js} +1 -1
  23. package/dist/{ReceiveRequestView-Og_mkJHQ.js → ReceiveRequestView-0r85gHww.js} +63 -63
  24. package/dist/{RecipeView-SvMt9zdS.js → RecipeView-FRHv7v2K.js} +4 -4
  25. package/dist/{StockView-DjO6wmxl.js → StockView-DeE60k1a.js} +7 -7
  26. package/dist/{SupplierView-CMatOKL0.js → SupplierView-DQSYItBZ.js} +37 -37
  27. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Bm9lLcf5.js +2020 -0
  28. package/dist/{TransferTemplateView-CNZtqhhI.js → TransferTemplateView-rPjPeB7z.js} +88 -88
  29. package/dist/UnitView-BLfRD-MZ.js +667 -0
  30. package/dist/{WarehouseView-C9Yi9nQV.js → WarehouseView-DmzmdKUj.js} +12 -12
  31. package/dist/api/netsuite.d.ts +3 -0
  32. package/dist/api/purchase-order.d.ts +1 -1
  33. package/dist/{app-9KyslrXV.js → app-BmrQUin8.js} +4445 -4396
  34. package/dist/app.d.ts +1 -0
  35. package/dist/app.js +1 -1
  36. package/dist/{decimal-CX0eUEB3.js → decimal-Ba0cFNkn.js} +1 -1
  37. package/dist/{feature-CmWqoog1.js → feature-CAfGclDp.js} +1856 -965
  38. package/dist/{format-unit-display-UiaVS36D.js → format-unit-display-6JZPqi0z.js} +29 -29
  39. package/dist/{index-CKAZMrqi.js → index-0LAqB9Nf.js} +2 -2
  40. package/dist/{index-BRtGevm6.js → index-Df8rBaGT.js} +4070 -4049
  41. package/dist/{stock-CT3LESH2.js → stock-Ca2xlSi5.js} +1 -1
  42. package/dist/{supplier-BrQo7L81.js → supplier-BFRlDSmN.js} +2 -2
  43. package/dist/tsconfig.app.tsbuildinfo +1 -1
  44. package/dist/{use-ingredient-select-dialog-BLcnX7uY.js → use-ingredient-select-dialog-BleZLcKu.js} +1 -1
  45. package/dist/{use-inventory-binding-dialog-CegZeDD6.js → use-inventory-binding-dialog-C8-NZufG.js} +1 -1
  46. package/dist/views/receive-request/components/netsuite/NetSuiteLog.vue.d.ts +17 -0
  47. package/dist/views/receive-request/components/netsuite/NetSuitePanel.vue.d.ts +21 -0
  48. package/dist/views/receive-request/components/transfer-details/usePurchaseOrderFn.d.ts +1 -0
  49. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +4 -4
  50. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +6 -2
  51. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +6 -6
  52. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +6 -6
  53. package/dist/views/receive-request/constants/po-action-to-ui-style.d.ts +1 -0
  54. package/dist/views/unit/components/unit-form/UnitFormProps.d.ts +1 -1
  55. package/dist/{vue-i18n-C2C5um-s.js → vue-i18n-CLUATIwy.js} +222 -222
  56. package/package.json +3 -3
  57. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BDbUensL.js +0 -1898
  58. package/dist/UnitView-D75e_8B3.js +0 -648
@@ -1,648 +0,0 @@
1
- import { defineComponent as H, computed as g, openBlock as v, createElementBlock as C, createElementVNode as l, Fragment as j, renderList as q, toDisplayString as V, createCommentVNode as O, ref as M, resolveComponent as $, createBlock as T, withCtx as A, createVNode as y, unref as o, isRef as ee, normalizeClass as re, normalizeStyle as ie, Teleport as ue, normalizeProps as de, guardReactiveProps as me } from "vue";
2
- import { a as K, d as w, S as ce, f as pe, D as te, h as L, e as le, l as N, A as fe, i as Y, J as ve, K as ye, p as ne, u as be, b as ge, z as xe, _ as _e, B as he, C as Ve, E as Ue } from "./app-9KyslrXV.js";
3
- import { useDialog as we, useSnackbar as se, useProxiedModel as oe, useBreakpoints as Ce } from "@feedmepos/ui-library";
4
- import { i as Se, _ as ke } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
- import { defineStore as Ee, storeToRefs as Fe } from "pinia";
6
- import { useI18n as G } from "@feedmepos/mf-common";
7
- import { F as $e } from "./decimal-CX0eUEB3.js";
8
- import { _ as Ie } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B4GyfLV-.js";
9
- const De = { class: "flex flex-col gap-8" }, Ae = {
10
- key: 0,
11
- class: "flex flex-col"
12
- }, Re = { class: "flex-1 py-8 px-16" }, Me = {
13
- class: "flex-0 py-8 px-16",
14
- style: { "flex-basis": "240px" }
15
- }, Pe = {
16
- key: 1,
17
- class: "flex flex-col"
18
- }, Te = { class: "flex-1 py-8 px-16" }, Be = {
19
- class: "flex-0 py-8 px-16",
20
- style: { "flex-basis": "240px" }
21
- }, ze = {
22
- key: 2,
23
- class: "flex flex-col"
24
- }, Le = { class: "flex-1 py-8 px-16" }, Ne = {
25
- class: "flex-0 py-8 px-16",
26
- style: { "flex-basis": "240px" }
27
- }, je = /* @__PURE__ */ H({
28
- __name: "UnitUsedBy",
29
- props: {
30
- unit: {}
31
- },
32
- setup(k) {
33
- const f = k, b = K(), i = g(() => b.validateUnitUsage(f.unit)), r = g(() => i.value.filter((c) => c.from === "INGREDIENT")), s = g(() => i.value.filter((c) => c.from === "RECIPE")), d = g(() => i.value.filter((c) => c.from === "MENU"));
34
- return (c, p) => (v(), C("div", De, [
35
- p[3] || (p[3] = l("div", { class: "fm-typo-en-body-md-400" }, "Sorry, this unit is used in the following modules:", -1)),
36
- r.value.length ? (v(), C("div", Ae, [
37
- p[0] || (p[0] = 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" }, [
38
- l("div", { class: "flex-1 py-8 px-16" }, "Ingredient"),
39
- l("div", {
40
- class: "flex-0 py-8 px-16",
41
- style: { "flex-basis": "240px" }
42
- }, "Used in")
43
- ], -1)),
44
- (v(!0), C(j, null, q(r.value, (a) => {
45
- var n;
46
- return v(), C("div", {
47
- key: a.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
- l("div", Re, V(a.code) + " " + V(a.name), 1),
51
- l("div", Me, V((n = a.bindedIngredient) != null && n.length ? "Convert binding" : "Item unit"), 1)
52
- ]);
53
- }), 128))
54
- ])) : O("", !0),
55
- s.value.length ? (v(), C("div", Pe, [
56
- p[1] || (p[1] = 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" }, [
57
- l("div", { class: "flex-1 py-8 px-16" }, "Recipe"),
58
- l("div", {
59
- class: "flex-0 py-8 px-16",
60
- style: { "flex-basis": "240px" }
61
- }, "Used in")
62
- ], -1)),
63
- (v(!0), C(j, null, q(s.value, (a) => {
64
- var n, u, x;
65
- return v(), C("div", {
66
- key: a.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
- l("div", Te, V(a.code) + " " + V(a.name), 1),
70
- l("div", Be, V((n = a.bindedIngredient) == null ? void 0 : n.slice(0, 3).map((_) => _.code).join(", ")) + " " + V(a.bindedIngredient && ((u = a.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((x = a.bindedIngredient) == null ? void 0 : x.length) - 3} more` : ""), 1)
71
- ]);
72
- }), 128))
73
- ])) : O("", !0),
74
- d.value.length ? (v(), C("div", ze, [
75
- p[2] || (p[2] = 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" }, [
76
- l("div", { class: "flex-1 py-8 px-16" }, "Menu"),
77
- l("div", {
78
- class: "flex-0 py-8 px-16",
79
- style: { "flex-basis": "240px" }
80
- }, "Used in")
81
- ], -1)),
82
- (v(!0), C(j, null, q(d.value, (a) => {
83
- var n, u, x;
84
- return v(), C("div", {
85
- key: a.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
- l("div", Le, V(a.code) + " " + V(a.name), 1),
89
- l("div", Ne, V((n = a.bindedIngredient) == null ? void 0 : n.slice(0, 3).map((_) => _.code).join(", ")) + " " + V(a.bindedIngredient && ((u = a.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((x = a.bindedIngredient) == null ? void 0 : x.length) - 3} more` : ""), 1)
90
- ]);
91
- }), 128))
92
- ])) : O("", !0)
93
- ]));
94
- }
95
- }), Q = Ee("unitForm", function() {
96
- const f = we(), b = se(), i = K(), r = M(!1), s = M();
97
- function d() {
98
- const n = {
99
- unit: {},
100
- mode: w.CREATE,
101
- show: !0,
102
- "onUpdate:show"(u) {
103
- s.value.show = u;
104
- }
105
- };
106
- s.value = n;
107
- }
108
- async function c(n) {
109
- const u = {
110
- unit: n,
111
- mode: w.UPDATE,
112
- show: !0,
113
- "onUpdate:show"(x) {
114
- s.value.show = x;
115
- }
116
- };
117
- s.value = u;
118
- }
119
- async function p(n) {
120
- r.value = !0;
121
- try {
122
- await i.deleteUnit(n), b.open({
123
- title: "Success",
124
- message: `Deleted ${n.name}`,
125
- type: "success"
126
- });
127
- } catch (u) {
128
- u instanceof ce && Se(u) ? f.open({
129
- title: "Cannot delete unit",
130
- contentComponent: ke,
131
- contentComponentProps: {
132
- subject: (n == null ? void 0 : n.name) ?? "",
133
- items: u.errorResponse.message
134
- },
135
- secondaryActions: {
136
- text: "Close",
137
- close: !0
138
- }
139
- }) : console.log("unable to delete unit", u), b.open({
140
- title: `Cannot delete ${n.name}`,
141
- message: "Please try again.",
142
- type: "error"
143
- }), console.error("failed to delete unit", u);
144
- } finally {
145
- r.value = !1;
146
- }
147
- }
148
- function a(n) {
149
- if (i.validateUnitUsage(n).length) {
150
- f.open({
151
- title: `Cannot delete ${(n == null ? void 0 : n.name) ?? "unit"}`,
152
- overlay: !0,
153
- dismissAway: !0,
154
- closeButton: !0,
155
- contentComponent: je,
156
- contentComponentProps: {
157
- unit: n
158
- },
159
- primaryActions: {
160
- text: "Confirm",
161
- close: !0
162
- }
163
- });
164
- return;
165
- }
166
- f.open({
167
- title: `Delete ${(n == null ? void 0 : n.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(n));
180
- }
181
- return {
182
- createUnit: d,
183
- updateUnit: c,
184
- deleteUnit: a,
185
- unitDialogProps: s,
186
- unitViewLoading: r
187
- };
188
- });
189
- function qe() {
190
- const { updateUnit: k, deleteUnit: f } = Q(), { t: b } = G();
191
- async function i(s, d) {
192
- const c = le(d);
193
- if (s === L.Edit) {
194
- await k(c);
195
- return;
196
- }
197
- if (s === L.Delete) {
198
- await f(c);
199
- return;
200
- }
201
- }
202
- return { columnDefs: [
203
- {
204
- accessorKey: "name",
205
- header: b("inventory.unit.table.name"),
206
- enableSorting: !0,
207
- size: 300
208
- },
209
- {
210
- accessorKey: "abbrev",
211
- header: b("inventory.unit.table.symbol"),
212
- enableSorting: !1,
213
- size: "auto"
214
- },
215
- {
216
- id: "action",
217
- header: "",
218
- cell(s) {
219
- return pe(
220
- [te[L.Edit], te[L.Delete]],
221
- (d) => {
222
- i(d, s.row.original);
223
- }
224
- );
225
- },
226
- enableSorting: !1,
227
- size: 40,
228
- meta: {
229
- cellClass: "",
230
- headerClass: ""
231
- }
232
- }
233
- ] };
234
- }
235
- const He = { class: "flex flex-col gap-24" }, Ke = { class: "flex gap-24" }, Ge = { class: "flex-1" }, Je = { class: "flex-1" }, Oe = { class: "flex" }, Ye = { class: "flex items-center" }, Qe = { class: "fm-typo-en-body-lg-600 flex-grow" }, We = { class: "flex flex-col gap-24" }, Xe = { class: "flex gap-24" }, Ze = { class: "flex-1" }, et = { class: "flex-1" }, tt = /* @__PURE__ */ H({
236
- __name: "UnitForm",
237
- props: {
238
- mode: {},
239
- modelValue: {},
240
- disabled: { type: Boolean }
241
- },
242
- emits: ["update:modelValue", "click:submit"],
243
- setup(k, { expose: f, emit: b }) {
244
- const i = k, r = b, { t: s } = G();
245
- function d() {
246
- r("click:submit");
247
- }
248
- const c = g({
249
- get() {
250
- var e;
251
- return ((e = i.modelValue) == null ? void 0 : e.name) ?? "";
252
- },
253
- set(e) {
254
- const t = i.modelValue ?? {};
255
- t.name = e, r("update:modelValue", t);
256
- }
257
- }), p = g({
258
- get() {
259
- var e;
260
- return ((e = i.modelValue) == null ? void 0 : e.abbrev) ?? "";
261
- },
262
- set(e) {
263
- const t = i.modelValue ?? {};
264
- t.abbrev = e, r("update:modelValue", t);
265
- }
266
- }), a = g({
267
- get() {
268
- var e;
269
- return ((e = i.modelValue) == null ? void 0 : e.precision) ?? 0;
270
- },
271
- set(e) {
272
- const t = i.modelValue ?? {};
273
- t.precision = e, r("update:modelValue", t);
274
- }
275
- }), n = g({
276
- get() {
277
- var e;
278
- return ((e = i.modelValue) == null ? void 0 : e.measurements) ?? [];
279
- },
280
- set(e) {
281
- const t = i.modelValue ?? {};
282
- t.measurements = e, r("update:modelValue", t);
283
- }
284
- });
285
- function u() {
286
- const e = i.modelValue ?? {}, t = e.measurements ?? [];
287
- e.measurements = [
288
- ...t,
289
- {
290
- id: `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
291
- name: "",
292
- abbrev: "",
293
- conversion: {
294
- amount: 1,
295
- precision: 0
296
- }
297
- }
298
- ], r("update:modelValue", e);
299
- }
300
- function x(e) {
301
- const t = i.modelValue ?? {}, m = t.measurements ?? [];
302
- m.splice(e, 1), t.measurements = m, r("update:modelValue", t);
303
- }
304
- const _ = M();
305
- return f({
306
- validateInputs: () => {
307
- var e, t;
308
- (t = (e = _.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
309
- },
310
- resetInputsValidation: () => {
311
- var e, t;
312
- (t = (e = _.value) == null ? void 0 : e.resetInputsValidation) == null || t.call(e);
313
- },
314
- resetInputs: () => {
315
- var e, t;
316
- (t = (e = _.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
317
- }
318
- }), (e, t) => {
319
- const m = $("FmTextField"), I = $("FmStepperField"), D = $("FmButton"), U = $("FmCard"), J = $("FmForm");
320
- return v(), T(J, {
321
- ref_key: "formRef",
322
- ref: _,
323
- class: "flex flex-col gap-40",
324
- onValidationSuccess: d
325
- }, {
326
- default: A(() => {
327
- var E;
328
- return [
329
- l("div", He, [
330
- l("div", Ke, [
331
- l("div", Ge, [
332
- y(m, {
333
- disabled: e.disabled,
334
- label: o(s)("inventory.unit.name"),
335
- modelValue: c.value,
336
- "onUpdate:modelValue": t[0] || (t[0] = (S) => c.value = S),
337
- rules: [o(N)()],
338
- "label-mark": "required"
339
- }, null, 8, ["disabled", "label", "modelValue", "rules"])
340
- ]),
341
- l("div", Je, [
342
- y(m, {
343
- disabled: e.disabled,
344
- label: o(s)("inventory.unit.symbol"),
345
- modelValue: p.value,
346
- "onUpdate:modelValue": t[1] || (t[1] = (S) => p.value = S),
347
- rules: [o(N)()],
348
- "label-mark": "required"
349
- }, null, 8, ["disabled", "label", "modelValue", "rules"])
350
- ])
351
- ]),
352
- l("div", null, [
353
- y(I, {
354
- disabled: e.disabled,
355
- class: "col-span-3",
356
- label: o(s)("inventory.unit.precision"),
357
- modelValue: a.value,
358
- "onUpdate:modelValue": t[2] || (t[2] = (S) => a.value = S),
359
- rules: [o(fe)(0)]
360
- }, null, 8, ["disabled", "label", "modelValue", "rules"])
361
- ])
362
- ]),
363
- l("div", Oe, [
364
- y(D, {
365
- disabled: e.disabled,
366
- type: "button",
367
- "prepend-icon": "add",
368
- label: o(s)("inventory.unit.measurement.addMeasurement"),
369
- variant: "plain",
370
- onClick: u
371
- }, null, 8, ["disabled", "label"])
372
- ]),
373
- (v(!0), C(j, null, q((E = e.modelValue) == null ? void 0 : E.measurements, (S, h) => (v(), T(U, {
374
- class: "flex flex-col gap-16 p-16",
375
- variant: "outlined",
376
- key: S.id
377
- }, {
378
- default: A(() => [
379
- l("div", Ye, [
380
- l("div", Qe, V(o(s)("inventory.unit.measurement.measurementDefault", [h + 1])), 1),
381
- y(D, {
382
- disabled: e.disabled,
383
- variant: "tertiary",
384
- "prepend-icon": "delete",
385
- onClick: (F) => x(h)
386
- }, null, 8, ["disabled", "onClick"])
387
- ]),
388
- l("div", We, [
389
- l("div", Xe, [
390
- l("div", Ze, [
391
- y(m, {
392
- disabled: e.disabled,
393
- class: "col-span-2",
394
- label: o(s)("inventory.unit.measurement.name"),
395
- modelValue: e.modelValue.measurements[h].name,
396
- "onUpdate:modelValue": (F) => e.modelValue.measurements[h].name = F,
397
- rules: [o(N)()],
398
- "label-mark": "required"
399
- }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
400
- ]),
401
- l("div", et, [
402
- y(m, {
403
- disabled: e.disabled,
404
- label: o(s)("inventory.unit.measurement.symbol"),
405
- modelValue: e.modelValue.measurements[h].abbrev,
406
- "onUpdate:modelValue": (F) => e.modelValue.measurements[h].abbrev = F,
407
- rules: [o(N)()],
408
- "label-mark": "required"
409
- }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
410
- ])
411
- ]),
412
- y(Ie, {
413
- disabled: e.disabled,
414
- class: "col-span-3",
415
- label: o(s)("inventory.unit.measurement.conversion"),
416
- "model-value": +o(Y)(e.modelValue.measurements[h].conversion),
417
- "onUpdate:modelValue": (F) => n.value = n.value.map(
418
- (P, R) => R === h ? {
419
- ...P,
420
- conversion: o($e).toPrecision(
421
- o(ve)(F),
422
- a.value
423
- )
424
- } : P
425
- ),
426
- rules: [o(ye)(0)],
427
- step: +o(Y)({ amount: 1, precision: a.value }),
428
- "helper-text": o(s)("inventory.unit.measurement.conversionHelper", {
429
- measurementSymbol: e.modelValue.measurements[h].name || " measurement unit",
430
- conversion: +o(Y)(e.modelValue.measurements[h].conversion),
431
- unitSymbol: p.value || "base unit"
432
- })
433
- }, null, 8, ["disabled", "label", "model-value", "onUpdate:modelValue", "rules", "step", "helper-text"])
434
- ])
435
- ]),
436
- _: 2
437
- }, 1024))), 128))
438
- ];
439
- }),
440
- _: 1
441
- }, 512);
442
- };
443
- }
444
- }), nt = { class: "flex gap-4" }, ot = /* @__PURE__ */ H({
445
- __name: "UnitDialog",
446
- props: {
447
- show: { type: Boolean },
448
- unit: {},
449
- mode: { default: w.READ }
450
- },
451
- emits: ["update:show"],
452
- setup(k) {
453
- const f = k, b = K(), i = se(), { t: r } = G(), s = oe(f, "show"), d = oe(f, "unit"), c = g(() => {
454
- switch (f.mode) {
455
- case w.READ:
456
- return "";
457
- case w.UPDATE:
458
- return r("inventory.unit.update.title");
459
- case w.CREATE:
460
- return r("inventory.unit.create.title");
461
- }
462
- return "";
463
- }), p = g(() => {
464
- switch (f.mode) {
465
- case w.READ:
466
- return "";
467
- case w.UPDATE:
468
- return r("common.save");
469
- case w.CREATE:
470
- return r("common.add");
471
- }
472
- return "";
473
- }), a = M(), n = M(!1);
474
- async function u() {
475
- n.value = !0;
476
- try {
477
- const t = le(d.value);
478
- t.precision ?? (t.precision = 0), t.measurements ?? (t.measurements = []), await b.createUnit(t), s.value = !1, i.open({
479
- title: r("inventory.common.success"),
480
- message: r("inventory.unit.create.success", { name: d.value.name }),
481
- type: "success"
482
- });
483
- } catch (t) {
484
- t instanceof ne || i.open({
485
- title: r("inventory.unit.create.error.title"),
486
- message: r("inventory.unit.create.error.message"),
487
- type: "error"
488
- });
489
- } finally {
490
- n.value = !1;
491
- }
492
- }
493
- async function x() {
494
- n.value = !0;
495
- try {
496
- await b.updateUnit(d.value), s.value = !1, i.open({
497
- title: r("inventory.common.success"),
498
- message: r("inventory.unit.update.success", { name: d.value.name }),
499
- type: "success"
500
- });
501
- } catch (t) {
502
- t instanceof ne || i.open({
503
- title: r("inventory.unit.update.error.title"),
504
- message: r("inventory.unit.update.error.message"),
505
- type: "error"
506
- });
507
- } finally {
508
- n.value = !1;
509
- }
510
- }
511
- function _() {
512
- var t, m;
513
- (m = (t = a.value) == null ? void 0 : t.validateInputs) == null || m.call(t);
514
- }
515
- function e() {
516
- switch (f.mode) {
517
- case w.READ:
518
- return;
519
- case w.UPDATE:
520
- return x();
521
- case w.CREATE:
522
- return u();
523
- }
524
- }
525
- return (t, m) => {
526
- const I = $("FmButton"), D = $("FmSideSheet");
527
- return v(), T(D, {
528
- "model-value": o(s),
529
- "onUpdate:modelValue": m[3] || (m[3] = (U) => ee(s) ? s.value = U : null),
530
- header: c.value,
531
- "close-button": "",
532
- "dismiss-away": "",
533
- "max-width": 500
534
- }, {
535
- "side-sheet-footer": A(() => [
536
- l("div", nt, [
537
- y(I, {
538
- loading: n.value,
539
- label: p.value,
540
- onClick: _
541
- }, null, 8, ["loading", "label"]),
542
- y(I, {
543
- disabled: n.value,
544
- label: o(r)("common.close"),
545
- variant: "tertiary",
546
- onClick: m[2] || (m[2] = (U) => s.value = !1)
547
- }, null, 8, ["disabled", "label"])
548
- ])
549
- ]),
550
- default: A(() => [
551
- y(tt, {
552
- class: "w-full",
553
- ref_key: "hasValidationExpose",
554
- ref: a,
555
- modelValue: o(d),
556
- "onUpdate:modelValue": m[0] || (m[0] = (U) => ee(d) ? d.value = U : null),
557
- mode: t.mode,
558
- disabled: n.value,
559
- "onClick:submit": m[1] || (m[1] = (U) => e())
560
- }, null, 8, ["modelValue", "mode", "disabled"])
561
- ]),
562
- _: 1
563
- }, 8, ["model-value", "header"]);
564
- };
565
- }
566
- }), 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" }, vt = /* @__PURE__ */ H({
567
- __name: "UnitView",
568
- setup(k) {
569
- const f = K(), b = be(), i = ge(), r = g(() => f.units), { createUnit: s, updateUnit: d } = Q(), { unitDialogProps: c, unitViewLoading: p } = Fe(Q()), { columnDefs: a } = qe();
570
- function n(D) {
571
- D === "add" && s();
572
- }
573
- const u = M(""), x = g(() => p.value), { breakpoints: _ } = Ce(), e = g(() => _.value.xs || _.value.sm), t = g(() => e.value ? 10 : 20), m = xe(), { t: I } = G();
574
- return (D, U) => {
575
- const J = $("FmTable");
576
- return v(), T(_e, {
577
- title: o(I)("inventory.unit.title"),
578
- actions: o(i).isEnabled ? [] : [
579
- {
580
- label: o(I)("inventory.unit.create.title"),
581
- value: "add",
582
- isPrimary: !0,
583
- prependIcon: "add"
584
- }
585
- ],
586
- "onClick:action": n
587
- }, {
588
- default: A(() => [
589
- l("div", {
590
- class: re([
591
- "flex flex-col gap-8 max-h-full",
592
- {
593
- "p-0": e.value,
594
- "px-24 ": !e.value
595
- }
596
- ])
597
- }, [
598
- y(he, {
599
- searchable: "",
600
- search: u.value,
601
- "onUpdate:search": U[0] || (U[0] = (E) => u.value = E)
602
- }, null, 8, ["search"]),
603
- y(J, {
604
- style: ie(o(m).tableHeight),
605
- "column-defs": o(a),
606
- "row-data": r.value,
607
- "search-value": u.value,
608
- loading: !o(b)._currentLocation || x.value,
609
- onRowClick: U[1] || (U[1] = (E) => o(d)(E.original)),
610
- "page-size": t.value
611
- }, {
612
- "list-row": A((E) => [
613
- y(Ve, {
614
- row: E,
615
- onRowClick: o(d)
616
- }, {
617
- default: A((S) => {
618
- var h, F, P, R, W, B, X, z, Z;
619
- return [
620
- l("div", lt, [
621
- l("div", st, [
622
- y(o(Ue), {
623
- render: (P = (F = (h = S.name) == null ? void 0 : h.column) == null ? void 0 : F.columnDef) == null ? void 0 : P.cell,
624
- props: (W = (R = S.name) == null ? void 0 : R.getContext) == null ? void 0 : W.call(R)
625
- }, null, 8, ["render", "props"])
626
- ]),
627
- l("div", at, V((Z = (z = (X = (B = E.original.measurements) == null ? void 0 : B.map) == null ? void 0 : X.call(B, (ae) => ae.name)) == null ? void 0 : z.join) == null ? void 0 : Z.call(z, ", ")), 1)
628
- ])
629
- ];
630
- }),
631
- _: 2
632
- }, 1032, ["row", "onRowClick"])
633
- ]),
634
- _: 1
635
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
636
- ], 2),
637
- (v(), T(ue, { to: "body" }, [
638
- y(ot, de(me(o(c))), null, 16)
639
- ]))
640
- ]),
641
- _: 1
642
- }, 8, ["title", "actions"]);
643
- };
644
- }
645
- });
646
- export {
647
- vt as default
648
- };