@feedmepos/mf-inventory-portal 1.0.9-dev.2 → 1.0.9-dev.4

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 (60) hide show
  1. package/dist/{App-DfxhucPn.js → App-BOKGVcoO.js} +2 -2
  2. package/dist/{ApprovalView-BUYgTb8S.js → ApprovalView-Bo-4fnEU.js} +2 -2
  3. package/dist/{BindingsDialog-Cbs9aVch.js → BindingsDialog-DM2b4GN4.js} +2 -2
  4. package/dist/{BindingsPicker-BH9bil6g.js → BindingsPicker-CJKBXA0c.js} +3 -3
  5. package/dist/{BindingsTable-DBsS_9yb.js → BindingsTable-BxCEEJfb.js} +1 -1
  6. package/dist/{ClosingDraftView-CcQssDLY.js → ClosingDraftView-bQxPF18V.js} +2 -2
  7. package/dist/{ClosingTemplateView-BHPqi-bL.js → ClosingTemplateView-DLkp9Qt8.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-DlTLtZ1f.js → DeliveryOrderPrintPreview-CK3HdYVb.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CtJSPDCo.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DvCBsPdI.js} +3 -3
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-B-erI7fq.js → FmUnitInput.vue_vue_type_script_setup_true_lang-R8f-Q9Nk.js} +20 -20
  11. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DT4nyE8i.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BOyqgaik.js} +1 -1
  12. package/dist/{IngredientsView-BCEznLxB.js → IngredientsView-DmKCy_JQ.js} +4 -4
  13. package/dist/{IntegrationView-COSJuqnB.js → IntegrationView-B1dzt8WK.js} +4 -4
  14. package/dist/{InventoryBindingForm-B3C8gktf.js → InventoryBindingForm-CeTlH0U1.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Bn2X1jxB.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DsM2bCNe.js} +92 -87
  16. package/dist/{InventoryBindingSummary-BF1OtGum.js → InventoryBindingSummary-QVSD87YL.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BMTXHa4I.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C-lgLo2e.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CZR7wF6-.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CEMRfo1C.js} +1 -1
  19. package/dist/{PublishView-Cp5tpVb0.js → PublishView-BYGKLC9D.js} +2 -2
  20. package/dist/{PurchaseOrderPrintPreview-DWOcxCH8.js → PurchaseOrderPrintPreview-CEVjGeom.js} +1 -1
  21. package/dist/{ReceiveRequestView-CRuhm8r1.js → ReceiveRequestView-D5PcGCLv.js} +42 -42
  22. package/dist/RecipeView-DmTDCsvk.js +8493 -0
  23. package/dist/{StockView-CuK8s5rt.js → StockView-EmTqUcP1.js} +7 -7
  24. package/dist/{SupplierView-Bwpe9RoM.js → SupplierView-BaLnW761.js} +4 -4
  25. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DDAZMTzq.js → TransferDetails.vue_vue_type_script_setup_true_lang-B3ew6mc5.js} +36 -36
  26. package/dist/{TransferTemplateView-BlluEiV-.js → TransferTemplateView-DoeLAFmJ.js} +114 -114
  27. package/dist/{UnitView-BWGQHOWP.js → UnitView-6Kobe5di.js} +18 -18
  28. package/dist/{WarehouseView-dOCu22dg.js → WarehouseView-BBMS14jU.js} +1 -1
  29. package/dist/api/inventory.d.ts +66 -207
  30. package/dist/{app-BkIAyhP-.js → app-CUTIQqG_.js} +7318 -7360
  31. package/dist/app.js +1 -1
  32. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +22 -0
  33. package/dist/components/shell/inventory/binding-ui.vue.d.ts +22 -0
  34. package/dist/{decimal-BiC7uGww.js → decimal-Bb7Chjpr.js} +1 -1
  35. package/dist/{feature-CCDDWpq8.js → feature-D5GLIW5h.js} +84 -89
  36. package/dist/{format-unit-display-CLa0op_h.js → format-unit-display-CqqBiewI.js} +29 -29
  37. package/dist/{index-UgbyiGok.js → index-B7QMXzGe.js} +2739 -2823
  38. package/dist/{index-BbFvsU1Z.js → index-DiEdX1Bs.js} +2 -2
  39. package/dist/main.d.ts +1 -0
  40. package/dist/{stock-SxO4bxTm.js → stock-CO0XWh8j.js} +1 -1
  41. package/dist/stores/feature.d.ts +0 -2
  42. package/dist/stores/inventory.d.ts +89 -211
  43. package/dist/{supplier-BVdCk7nI.js → supplier-C877x7mU.js} +1 -1
  44. package/dist/tsconfig.app.tsbuildinfo +1 -1
  45. package/dist/{use-ingredient-select-dialog-CDeGXhur.js → use-ingredient-select-dialog-ClufUFeU.js} +1 -1
  46. package/dist/{use-inventory-binding-dialog-CeRKqMy7.js → use-inventory-binding-dialog-BuRe6QNp.js} +1 -1
  47. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +44 -0
  48. package/dist/views/recipe/components/recipe-override-form-field/RecipeOverrideFormField.vue.d.ts +61 -0
  49. package/dist/views/recipe/composables/use-recipe-overrides-form-field.d.ts +10 -0
  50. package/dist/{vue-i18n-3Mh8tKq8.js → vue-i18n-CxuQa0ds.js} +337 -337
  51. package/package.json +4 -3
  52. package/dist/IngredientGroupView-DE15kdqH.js +0 -604
  53. package/dist/RecipeView-BTS1LBKZ.js +0 -616
  54. package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +0 -3
  55. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +0 -31
  56. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +0 -12
  57. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +0 -20
  58. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +0 -12
  59. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +0 -24
  60. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +0 -218
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-inventory-portal",
3
- "version": "1.0.9-dev.2",
3
+ "version": "1.0.9-dev.4",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -15,10 +15,11 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@feedmepos/core": "2.14.11",
18
+ "@feedmepos/custom-attributes": "0.0.0-rc.7",
18
19
  "@feedmepos/feature-flag": "^0.0.15",
19
20
  "@feedmepos/menu": "1.0.34",
20
- "@feedmepos/mf-common": "1.26.7",
21
- "@feedmepos/ui-library": "1.6.7",
21
+ "@feedmepos/mf-common": "1.26.8-beta.2",
22
+ "@feedmepos/ui-library": "1.6.9",
22
23
  "@tanstack/vue-table": "^8.17.3",
23
24
  "@types/dinero.js": "^1.9.4",
24
25
  "@typescript-eslint/typescript-estree": "^8.21.0",
@@ -1,604 +0,0 @@
1
- import { ref as F, computed as C, defineComponent as Y, resolveComponent as S, openBlock as M, createBlock as O, withCtx as R, createElementVNode as x, createVNode as g, unref as l, createElementBlock as ee, toDisplayString as j, createTextVNode as te, watch as ue, isRef as ce, normalizeClass as de, normalizeStyle as me, createSlots as pe, Teleport as fe, normalizeProps as ve, guardReactiveProps as ge } from "vue";
2
- import { a as J, d as h, e as B, f as ye, D as oe, h as Q, G as be, l as _e, A as xe, H as ne, p as se, u as ke, z as he, _ as we, B as Se, C as Ie, E as ae } from "./app-BkIAyhP-.js";
3
- import { useDialog as le, useSnackbar as Z, useProxiedModel as Ce, useBreakpoints as Fe } from "@feedmepos/ui-library";
4
- import { useI18n as W } from "@feedmepos/mf-common";
5
- import { defineStore as ie, storeToRefs as re } from "pinia";
6
- import "./array-hChJVZLE.js";
7
- const X = ie(
8
- "ingredientGroupactions",
9
- function() {
10
- const c = le(), w = Z(), o = J(), { t: r } = W(), i = F();
11
- function p() {
12
- const d = {
13
- modelValue: {},
14
- mode: h.CREATE,
15
- show: !0,
16
- "onUpdate:show"(a) {
17
- i.value.show = a;
18
- }
19
- };
20
- i.value = d;
21
- }
22
- async function v(d) {
23
- const a = {
24
- modelValue: B(d),
25
- mode: h.UPDATE,
26
- show: !0,
27
- "onUpdate:show"(s) {
28
- i.value.show = s;
29
- }
30
- };
31
- i.value = a;
32
- }
33
- async function f(d, a, s) {
34
- a.value = !0;
35
- try {
36
- await o.deleteSkuGroup(d), w.open({
37
- title: "Success",
38
- message: `Deleted ${d.name}`,
39
- type: "success"
40
- });
41
- } catch (n) {
42
- w.open({
43
- title: `Cannot delete ${d.name}`,
44
- message: "Please try again.",
45
- type: "error"
46
- }), console.error("failed to delete ingredient", n);
47
- } finally {
48
- a.value = !1, s();
49
- }
50
- }
51
- function y(d, a, s) {
52
- c.open({
53
- title: r("inventory.ingredient.delete.title", [(d == null ? void 0 : d.name) ?? ""]),
54
- closeButton: !1,
55
- message: r("inventory.ingredient.delete.message"),
56
- primaryActions: {
57
- text: r("common.delete"),
58
- close: !0,
59
- variant: "destructive"
60
- },
61
- secondaryActions: {
62
- text: r("common.cancel"),
63
- close: !0
64
- }
65
- }).onPrimary(() => f(d, a, s));
66
- }
67
- function G() {
68
- }
69
- function b() {
70
- }
71
- return {
72
- createIngredientGroup: p,
73
- updateIngredientGroup: v,
74
- deleteIngredientGroup: y,
75
- importIngredientGroups: G,
76
- exportIngredientGroups: b,
77
- ingredientGroupDialogProps: i
78
- };
79
- }
80
- ), Ge = ie(
81
- "ingredientGroupTable",
82
- function() {
83
- const c = F(!1), w = Z(), o = J(), r = X();
84
- async function i() {
85
- c.value = !0;
86
- try {
87
- await o.readInventory();
88
- } catch (f) {
89
- console.error("error on reading inventory", f), w.open({
90
- title: "Error",
91
- message: "Something went wrong, please try again.",
92
- type: "error"
93
- });
94
- } finally {
95
- c.value = !1;
96
- }
97
- }
98
- function p(f, y) {
99
- switch (y = B(y), f) {
100
- case Q.Edit:
101
- return r.updateIngredientGroup(y);
102
- case Q.Delete:
103
- return r.deleteIngredientGroup(
104
- y,
105
- c,
106
- () => i()
107
- );
108
- }
109
- }
110
- const v = C(() => [
111
- {
112
- accessorKey: "name",
113
- header: () => "Name"
114
- },
115
- {
116
- accessorKey: "skus.length",
117
- header: () => "No. of items"
118
- },
119
- {
120
- accessorKey: "ref",
121
- header: () => "Reference"
122
- },
123
- {
124
- id: "action",
125
- header: "",
126
- cell(f) {
127
- return ye(
128
- [oe[Q.Edit], oe[Q.Delete]],
129
- (y) => {
130
- p(y, f.row.original);
131
- }
132
- );
133
- },
134
- enableSorting: !1,
135
- size: 40,
136
- meta: {
137
- cellClass: "",
138
- headerClass: ""
139
- }
140
- }
141
- ]);
142
- return {
143
- fetchIngredientGroups: i,
144
- loading: c,
145
- columnDefs: v
146
- };
147
- }
148
- ), Ae = { class: "flex flex-col gap-16" }, De = { class: "flex flex-col gap-8 cursor-pointer" }, Ve = {
149
- key: 0,
150
- class: "text-fm-color-typo-primary fm-typo-en-body-lg-400 line-clamp-1 break-all"
151
- }, Ee = { class: "text-fm-color-typo-secondary" }, Re = {
152
- key: 1,
153
- class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 line-clamp-1 break-all"
154
- }, Te = { class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400 flex flex-col gap-4" }, $e = { class: "flex flex-col gap-16" }, Pe = { class: "flex items-center" }, Me = /* @__PURE__ */ Y({
155
- __name: "IngredientGroupForm",
156
- props: {
157
- mode: {},
158
- disabled: { type: Boolean },
159
- modelValue: {}
160
- },
161
- emits: ["validation-success"],
162
- setup(U, { expose: c, emit: w }) {
163
- const o = be("modelValue"), r = w, i = J(), p = le(), { t: v } = W(), f = F();
164
- c({
165
- validateInputs: () => {
166
- var a;
167
- return (a = f.value) == null ? void 0 : a.validateInputs();
168
- },
169
- resetInputsValidation: () => {
170
- var a;
171
- return (a = f.value) == null ? void 0 : a.resetInputsValidation();
172
- },
173
- resetInputs: () => {
174
- var a;
175
- return (a = f.value) == null ? void 0 : a.resetInputs();
176
- }
177
- });
178
- const y = C(() => i.skus.groupBy((a) => a.unit._id));
179
- function G() {
180
- var s;
181
- const a = i.skus.filter((n) => {
182
- var t;
183
- return (((t = y.value.get(n.unit._id)) == null ? void 0 : t.length) ?? 0) > 1;
184
- }).map((n) => ({
185
- label: n.name,
186
- sublabel: n.code,
187
- value: n
188
- })).sort((n, t) => {
189
- var e, u, _, m;
190
- return (m = (e = n.value) == null ? void 0 : e.unit) == null ? void 0 : m.abbrev.localeCompare((_ = (u = t.value) == null ? void 0 : u.unit) == null ? void 0 : _.abbrev);
191
- });
192
- p.open({
193
- title: v("inventory.closing.form.items.selectItem"),
194
- closeButton: !0,
195
- contentComponent: ne,
196
- contentComponentProps: {
197
- modelValue: [(s = o.skus) == null ? void 0 : s[0]],
198
- items: a,
199
- singleSelect: !0,
200
- virtualScroll: !0
201
- },
202
- primaryActions: {
203
- text: v("common.confirm"),
204
- close: !0
205
- },
206
- secondaryActions: {
207
- text: v("common.close"),
208
- close: !0,
209
- variant: "tertiary"
210
- }
211
- }).onPrimary((n) => {
212
- var t;
213
- o.skus = n.map((e) => B(e)), o.unit = ((t = n[0]) == null ? void 0 : t.unit) ?? o.unit;
214
- });
215
- }
216
- function b() {
217
- const a = i.skus.filter((n) => {
218
- var t, e, u;
219
- return n.unit._id === ((t = o == null ? void 0 : o.unit) == null ? void 0 : t._id) && n._id !== ((u = (e = o.skus) == null ? void 0 : e[0]) == null ? void 0 : u._id);
220
- }).map((n) => ({
221
- label: n.name,
222
- sublabel: n.code,
223
- value: n
224
- })).sort((n, t) => {
225
- var e, u, _, m;
226
- return (m = (e = n.value) == null ? void 0 : e.unit) == null ? void 0 : m.abbrev.localeCompare((_ = (u = t.value) == null ? void 0 : u.unit) == null ? void 0 : _.abbrev);
227
- }), s = a.filter((n) => {
228
- var t;
229
- return (t = o.skus) == null ? void 0 : t.find((e) => (e == null ? void 0 : e._id) === n.value._id);
230
- }).map((n) => n.value);
231
- p.open({
232
- title: v("inventory.closing.form.items.selectItem"),
233
- closeButton: !0,
234
- contentComponent: ne,
235
- contentComponentProps: {
236
- modelValue: s,
237
- items: a,
238
- virtualScroll: !0
239
- },
240
- primaryActions: {
241
- text: v("common.confirm"),
242
- close: !0
243
- },
244
- secondaryActions: {
245
- text: v("common.close"),
246
- close: !0,
247
- variant: "tertiary"
248
- }
249
- }).onPrimary((n) => {
250
- var u, _;
251
- const t = ((u = o.skus) == null ? void 0 : u.slice(1)) ?? [], e = n.map((m) => {
252
- const A = t.find((D) => (D == null ? void 0 : D._id) === m._id);
253
- return A || B(m, ["unit"]);
254
- });
255
- o.skus = [(_ = o.skus) == null ? void 0 : _[0], ...e];
256
- });
257
- }
258
- const d = [
259
- {
260
- accessorKey: "code",
261
- header: () => "Code",
262
- enableSorting: !1
263
- },
264
- {
265
- accessorKey: "name",
266
- header: () => "Name",
267
- enableSorting: !1
268
- }
269
- ];
270
- return (a, s) => {
271
- const n = S("FmTextField"), t = S("FmLabel"), e = S("FmField"), u = S("FmFormGroup"), _ = S("FmButton"), m = S("FmTable"), A = S("FmForm");
272
- return M(), O(A, {
273
- onValidationSuccess: s[5] || (s[5] = (I) => r("validation-success")),
274
- ref_key: "formRef",
275
- ref: f,
276
- class: "flex flex-col gap-32"
277
- }, {
278
- default: R(() => {
279
- var I, D, V, T, z;
280
- return [
281
- x("div", Ae, [
282
- g(n, {
283
- label: "Name",
284
- "label-mark": "required",
285
- rules: [l(_e)()],
286
- modelValue: l(o).name,
287
- "onUpdate:modelValue": s[0] || (s[0] = (k) => l(o).name = k)
288
- }, null, 8, ["rules", "modelValue"]),
289
- g(n, {
290
- label: "Reference",
291
- "label-mark": "optional",
292
- modelValue: l(o).ref,
293
- "onUpdate:modelValue": s[1] || (s[1] = (k) => l(o).ref = k)
294
- }, null, 8, ["modelValue"]),
295
- x("div", De, [
296
- g(t, {
297
- label: "Main ingredient",
298
- required: ""
299
- }),
300
- g(e, {
301
- onClick: s[2] || (s[2] = (k) => G())
302
- }, {
303
- default: R(() => {
304
- var k, E, $, L, N, K, q, P, H;
305
- return [
306
- ($ = (E = (k = l(o)) == null ? void 0 : k.skus) == null ? void 0 : E[0]) != null && $.name ? (M(), ee("span", Ve, [
307
- x("span", Ee, "[" + j((K = (N = (L = l(o)) == null ? void 0 : L.skus) == null ? void 0 : N[0]) == null ? void 0 : K.code) + "]", 1),
308
- te(" " + j((H = (P = (q = l(o)) == null ? void 0 : q.skus) == null ? void 0 : P[0]) == null ? void 0 : H.name), 1)
309
- ])) : (M(), ee("span", Re, j("Click to select main item")))
310
- ];
311
- }),
312
- _: 1
313
- }),
314
- x("div", Te, [
315
- s[6] || (s[6] = te(j("Select a main item to filter out substitutable items with same unit.") + " ")),
316
- g(u, {
317
- "model-value": ((I = l(o)) == null ? void 0 : I.skus) ?? [],
318
- rules: [l(xe)(1, "Required")]
319
- }, null, 8, ["model-value", "rules"])
320
- ])
321
- ])
322
- ]),
323
- x("div", $e, [
324
- x("div", Pe, [
325
- s[7] || (s[7] = x("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Substitutables", -1)),
326
- x("div", null, [
327
- g(_, {
328
- label: "Add items",
329
- disabled: (((V = (D = l(o)) == null ? void 0 : D.skus) == null ? void 0 : V.length) ?? 0) < 1,
330
- onClick: s[3] || (s[3] = (k) => b()),
331
- "prepend-icon": "add",
332
- variant: "secondary",
333
- "text-color": "primary",
334
- "bg-color": "transparent",
335
- "border-color": "primary"
336
- }, null, 8, ["disabled"])
337
- ])
338
- ]),
339
- g(m, {
340
- "shrink-at": 9999,
341
- "column-defs": d,
342
- "row-data": (T = l(o).skus) == null ? void 0 : T.slice(1),
343
- onDndChanged: s[4] || (s[4] = (k) => {
344
- var E;
345
- return l(o).skus = [(E = l(o).skus) == null ? void 0 : E[0], ...k];
346
- }),
347
- draggable: "",
348
- "hide-footer": "",
349
- "page-size": ((z = l(o).skus) == null ? void 0 : z.length) ?? 0
350
- }, null, 8, ["row-data", "page-size"])
351
- ])
352
- ];
353
- }),
354
- _: 1
355
- }, 512);
356
- };
357
- }
358
- }), Be = { class: "flex gap-4" }, Ue = /* @__PURE__ */ Y({
359
- __name: "IngredientGroupDialog",
360
- props: {
361
- show: { type: Boolean },
362
- mode: { default: h.READ },
363
- modelValue: {}
364
- },
365
- emits: ["update:show"],
366
- setup(U) {
367
- const c = U, w = J(), o = Z(), { t: r } = W(), i = Ce(c, "show"), p = F({}), v = F(`${Math.random()}`);
368
- ue(
369
- () => c.show,
370
- (t) => {
371
- t && (Object.keys(p.value).forEach((e) => {
372
- delete p.value[e];
373
- }), Object.keys(c.modelValue ?? {}).forEach((e) => {
374
- var u;
375
- p.value[e] = (u = c.modelValue) == null ? void 0 : u[e];
376
- }), v.value = `${Math.random()}`);
377
- }
378
- );
379
- const f = C(() => {
380
- switch (c.mode) {
381
- case h.READ:
382
- return "";
383
- case h.UPDATE:
384
- return r("inventory.ingredient.update.title");
385
- case h.CREATE:
386
- return r("inventory.ingredient.create.title");
387
- }
388
- return "";
389
- }), y = C(() => {
390
- switch (c.mode) {
391
- case h.READ:
392
- return "";
393
- case h.UPDATE:
394
- return r("common.save");
395
- case h.CREATE:
396
- return r("common.add");
397
- }
398
- return "";
399
- }), G = F(), b = F(!1);
400
- async function d() {
401
- b.value = !0;
402
- const t = B(p.value);
403
- try {
404
- await w.createSkuGroup(t), i.value = !1, o.open({
405
- title: r("inventory.common.success"),
406
- message: r("inventory.ingredient.create.success", { name: t.name }),
407
- type: "success"
408
- });
409
- } catch (e) {
410
- e instanceof se || o.open({
411
- title: r("inventory.ingredient.create.error.title"),
412
- message: r("inventory.ingredient.create.error.message"),
413
- type: "error"
414
- });
415
- } finally {
416
- b.value = !1;
417
- }
418
- }
419
- async function a() {
420
- b.value = !0;
421
- const t = B(p.value);
422
- try {
423
- await w.updateSkuGroup(t), b.value = !1, i.value = !1, o.open({
424
- title: r("inventory.common.success"),
425
- message: r("inventory.ingredient.update.success", { name: t.name }),
426
- type: "success"
427
- });
428
- } catch (e) {
429
- e instanceof se || o.open({
430
- title: r("inventory.ingredient.update.error.title"),
431
- message: r("inventory.ingredient.update.error.message"),
432
- type: "error"
433
- });
434
- } finally {
435
- b.value = !1;
436
- }
437
- }
438
- function s() {
439
- var t, e;
440
- (e = (t = G.value) == null ? void 0 : t.validateInputs) == null || e.call(t);
441
- }
442
- function n() {
443
- switch (c.mode) {
444
- case h.READ:
445
- return;
446
- case h.UPDATE:
447
- return a();
448
- case h.CREATE:
449
- return d();
450
- }
451
- }
452
- return (t, e) => {
453
- const u = S("FmButton"), _ = S("FmSideSheet");
454
- return M(), O(_, {
455
- "model-value": l(i),
456
- "onUpdate:modelValue": e[3] || (e[3] = (m) => ce(i) ? i.value = m : null),
457
- header: f.value,
458
- "close-button": "",
459
- "dismiss-away": "",
460
- "max-width": 500
461
- }, {
462
- "side-sheet-footer": R(() => [
463
- x("div", Be, [
464
- g(u, {
465
- loading: b.value,
466
- label: y.value,
467
- onClick: s
468
- }, null, 8, ["loading", "label"]),
469
- g(u, {
470
- disabled: b.value,
471
- label: l(r)("common.close"),
472
- variant: "tertiary",
473
- onClick: e[2] || (e[2] = (m) => i.value = !1)
474
- }, null, 8, ["disabled", "label"])
475
- ])
476
- ]),
477
- default: R(() => [
478
- (M(), O(Me, {
479
- class: "w-full",
480
- ref_key: "hasValidationExpose",
481
- ref: G,
482
- key: v.value,
483
- "model-value": p.value,
484
- "onUpdate:modelValue": e[0] || (e[0] = (m) => p.value = m),
485
- mode: t.mode,
486
- disabled: b.value,
487
- onValidationSuccess: e[1] || (e[1] = (m) => n())
488
- }, null, 8, ["model-value", "mode", "disabled"]))
489
- ]),
490
- _: 1
491
- }, 8, ["model-value", "header"]);
492
- };
493
- }
494
- }), ze = { class: "flex flex-col py-8" }, Le = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ne = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Qe = /* @__PURE__ */ Y({
495
- __name: "IngredientGroupView",
496
- setup(U) {
497
- const c = J(), w = C(() => c.skuGroups), o = ke(), { t: r } = W(), {
498
- createIngredientGroup: i,
499
- updateIngredientGroup: p,
500
- importIngredientGroups: v,
501
- exportIngredientGroups: f
502
- } = X(), { columnDefs: y, loading: G } = re(Ge()), { ingredientGroupDialogProps: b } = re(X());
503
- function d(A) {
504
- switch (A) {
505
- case "add":
506
- return i();
507
- case "import":
508
- return v();
509
- case "export":
510
- return f();
511
- }
512
- }
513
- const a = F(""), s = F(!1), n = C(() => s.value || G.value), { breakpoints: t } = Fe(), e = C(() => t.value.xs || t.value.sm), u = C(() => e.value ? 10 : 20), _ = he(), m = C(() => [
514
- {
515
- label: r("inventory.ingredient.create.title"),
516
- value: "add",
517
- isPrimary: !0,
518
- prependIcon: "add"
519
- },
520
- { label: r("common.import"), value: "import" },
521
- { label: r("common.export"), value: "export" }
522
- ]);
523
- return (A, I) => {
524
- const D = S("FmTable");
525
- return M(), O(we, {
526
- title: l(r)("inventory.ingredientGroup.title"),
527
- actions: m.value,
528
- "onClick:action": d
529
- }, {
530
- default: R(() => [
531
- x("div", {
532
- class: de([
533
- "flex flex-col gap-8 max-h-full",
534
- {
535
- "p-0": e.value,
536
- "px-24 ": !e.value
537
- }
538
- ])
539
- }, [
540
- g(Se, {
541
- searchable: "",
542
- search: a.value,
543
- "onUpdate:search": I[0] || (I[0] = (V) => a.value = V)
544
- }, null, 8, ["search"]),
545
- g(D, {
546
- style: me(l(_).tableHeight),
547
- "column-defs": l(y),
548
- "row-data": w.value,
549
- "search-value": a.value,
550
- loading: !l(o)._currentLocation || n.value,
551
- "loading-text": "Loading",
552
- onRowClick: I[1] || (I[1] = (V) => l(p)(V.original)),
553
- "page-size": u.value
554
- }, {
555
- "list-row": R((V) => [
556
- g(Ie, {
557
- row: V,
558
- onRowClick: l(p)
559
- }, pe({
560
- default: R((T) => {
561
- var z, k, E, $, L, N, K, q, P, H;
562
- return [
563
- x("div", ze, [
564
- x("div", Le, [
565
- g(l(ae), {
566
- render: (E = (k = (z = T.code) == null ? void 0 : z.column) == null ? void 0 : k.columnDef) == null ? void 0 : E.cell,
567
- props: (L = ($ = T.code) == null ? void 0 : $.getContext) == null ? void 0 : L.call($)
568
- }, null, 8, ["render", "props"])
569
- ]),
570
- x("div", Ne, [
571
- g(l(ae), {
572
- render: (q = (K = (N = T.name) == null ? void 0 : N.column) == null ? void 0 : K.columnDef) == null ? void 0 : q.cell,
573
- props: (H = (P = T.name) == null ? void 0 : P.getContext) == null ? void 0 : H.call(P)
574
- }, null, 8, ["render", "props"])
575
- ])
576
- ])
577
- ];
578
- }),
579
- _: 2
580
- }, [
581
- s.value ? {
582
- name: "loading-text",
583
- fn: R(() => [
584
- x("div", null, j(l(r)("inventory.ingredient.table.importing")), 1)
585
- ]),
586
- key: "0"
587
- } : void 0
588
- ]), 1032, ["row", "onRowClick"])
589
- ]),
590
- _: 1
591
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
592
- ], 2),
593
- (M(), O(fe, { to: "body" }, [
594
- g(Ue, ve(ge(l(b))), null, 16)
595
- ]))
596
- ]),
597
- _: 1
598
- }, 8, ["title", "actions"]);
599
- };
600
- }
601
- });
602
- export {
603
- Qe as default
604
- };