@feedmepos/mf-inventory-portal 0.0.22-dev.46 → 0.0.22-dev.48

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 (50) hide show
  1. package/dist/{ApprovalView-CjK-fcvU.js → ApprovalView-Bq8HizIk.js} +3 -3
  2. package/dist/{BindingsDialog-DWRDuKnY.js → BindingsDialog-B5B9LNjS.js} +1 -1
  3. package/dist/{BindingsPicker-DtgCTWo5.js → BindingsPicker-BiiBXcfu.js} +8 -8
  4. package/dist/{BindingsTable-QevLem81.js → BindingsTable-CRUkZ1ou.js} +1 -1
  5. package/dist/ClosingTemplateView-DIdaXdId.js +1829 -0
  6. package/dist/{FmDroppableField-DHF0MZls.js → FmDroppableField-Bl1XIyOu.js} +1 -1
  7. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CPhXgsQD.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CdZuOJ4V.js} +3 -3
  8. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Bl-BsJNP.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CmfjbJ0t.js} +1 -1
  9. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-B7dq1XS-.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BuNop0gk.js} +7 -7
  10. package/dist/IngredientGroupView-DD90Fmrx.js +608 -0
  11. package/dist/{IngredientsView-9xhWEl17.js → IngredientsView-Bp4GZox8.js} +5 -5
  12. package/dist/{IntegrationView-D7916Kg2.js → IntegrationView-B_f-yMDb.js} +2 -2
  13. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-ZBxeayIl.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang--RjTe01A.js} +1 -1
  14. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-Dp_JLw2L.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DkEyqrlM.js} +2 -2
  15. package/dist/{PurchaseOrderPrintPreview-U-M3r5H9.js → PurchaseOrderPrintPreview-CjRMox7T.js} +1 -1
  16. package/dist/{ReceiveRequestView-BzChY8ca.js → ReceiveRequestView-DqppWyj-.js} +288 -288
  17. package/dist/{RecipeView-GrwiLQkW.js → RecipeView-CHsDHwoo.js} +22 -22
  18. package/dist/{StockView-CMvG-CIC.js → StockView-ACFikzri.js} +5 -5
  19. package/dist/{SupplierView-BmqzK7D6.js → SupplierView-zdJEksIO.js} +418 -415
  20. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CE1aYr3I.js → TransferDetails.vue_vue_type_script_setup_true_lang-Boqgacto.js} +51 -51
  21. package/dist/{TransferTemplateView-CBPSaIJs.js → TransferTemplateView-BB9qQ71s.js} +8 -8
  22. package/dist/{UnitView-4JKlaXtj.js → UnitView-Ta-Vt5dh.js} +4 -4
  23. package/dist/{WarehouseView-B5qLIIAQ.js → WarehouseView-DCCyFVlT.js} +2 -2
  24. package/dist/{app-B0BJjpJ5.js → app-BqLAVk-L.js} +19173 -19122
  25. package/dist/app.d.ts +3 -0
  26. package/dist/app.js +1 -1
  27. package/dist/components/FmMultiselectDialogProps.d.ts +0 -2
  28. package/dist/{decimal-CDTaG5jr.js → decimal-D1NE-J_K.js} +1 -1
  29. package/dist/{defineDeepModel-9-wLB59o.js → defineDeepModel-Bh0i7x-r.js} +1 -1
  30. package/dist/extensions/array.d.ts +1 -1
  31. package/dist/{format-time-from-id-Bwq0tn09.js → format-time-from-id-plSsZrYn.js} +1 -1
  32. package/dist/{format-unit-display-BImgcRNp.js → format-unit-display-Dzdy7cNO.js} +49 -49
  33. package/dist/router/name.d.ts +1 -0
  34. package/dist/stores/inventory.d.ts +71 -0
  35. package/dist/style.css +1 -1
  36. package/dist/{supplier-D9s1N_M7.js → supplier-aIh1pXP3.js} +1 -1
  37. package/dist/tsconfig.app.tsbuildinfo +1 -1
  38. package/dist/{use-template-enabled-locations-2-BQSfU_U_.js → use-template-enabled-locations-2-Cpg220vD.js} +1 -1
  39. package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +3 -0
  40. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +31 -0
  41. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +12 -0
  42. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +20 -0
  43. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +12 -0
  44. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +24 -0
  45. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +215 -0
  46. package/dist/views/supplier/helpers/import-export.helper.d.ts +1 -1
  47. package/dist/{xlsx-A9JiF_qH.js → xlsx-D2Zb812D.js} +1 -1
  48. package/dist/{xlsx.util-J1g7CG7t.js → xlsx.util-BlUzHgYg.js} +1 -1
  49. package/package.json +3 -3
  50. package/dist/ClosingTemplateView-Cdbp7nYn.js +0 -1812
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as U, ref as d, computed as y, resolveComponent as k, openBlock as s, createElementBlock as c, createElementVNode as p, createCommentVNode as S, renderSlot as u, createBlock as C, normalizeClass as f, toDisplayString as F, unref as B } from "vue";
2
2
  import { useI18n as W } from "@feedmepos/mf-common";
3
- import { X } from "./app-B0BJjpJ5.js";
3
+ import { X } from "./app-BqLAVk-L.js";
4
4
  const q = {
5
5
  key: 0,
6
6
  class: "relative"
@@ -1,6 +1,6 @@
1
- import { a as P, t as B, a7 as A, i as D, ad as R, am as H, an as V } from "./app-B0BJjpJ5.js";
2
- import { u as j } from "./supplier-D9s1N_M7.js";
3
- import { P as S } from "./format-unit-display-BImgcRNp.js";
1
+ import { a as P, t as B, a7 as A, i as D, ad as R, am as H, an as V } from "./app-BqLAVk-L.js";
2
+ import { u as j } from "./supplier-aIh1pXP3.js";
3
+ import { P as S } from "./format-unit-display-Dzdy7cNO.js";
4
4
  import { computed as y, defineComponent as $, mergeModels as W, useModel as J, resolveComponent as w, openBlock as F, createElementBlock as I, normalizeStyle as K, createElementVNode as N, createVNode as Q, withCtx as X, createBlock as x, createCommentVNode as E, Fragment as Y, renderList as Z, unref as M } from "vue";
5
5
  function ne(c, i, t, s) {
6
6
  var b, g, u;
@@ -1,6 +1,6 @@
1
1
  import { reactive as W, onUnmounted as q, defineComponent as T, ref as H, computed as _, resolveComponent as k, openBlock as o, createElementBlock as w, Fragment as V, createElementVNode as f, normalizeClass as D, unref as g, toDisplayString as R, createCommentVNode as b, createBlock as d, withCtx as I, createVNode as M, renderList as S, renderSlot as G, Teleport as z, watch as J, mergeModels as K, useModel as P } from "vue";
2
2
  import { useBreakpoints as Y } from "@feedmepos/ui-library";
3
- import { i as j, V as O } from "./app-B0BJjpJ5.js";
3
+ import { i as j, V as O } from "./app-BqLAVk-L.js";
4
4
  import { useCoreStore as X, useI18n as Q } from "@feedmepos/mf-common";
5
5
  const N = W({});
6
6
  function E() {
@@ -1,5 +1,5 @@
1
- import { defineComponent as p, openBlock as s, createElementBlock as n, createElementVNode as r, toDisplayString as o, unref as l, Fragment as d, renderList as x } from "vue";
2
- import { a, k as y } from "./app-B0BJjpJ5.js";
1
+ import { defineComponent as p, openBlock as s, createElementBlock as n, createElementVNode as r, toDisplayString as o, unref as i, Fragment as d, renderList as x } from "vue";
2
+ import { a, l as y } from "./app-BqLAVk-L.js";
3
3
  import { useI18n as _ } from "@feedmepos/mf-common";
4
4
  const v = { class: "flex flex-col" }, g = { 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" }, h = { class: "flex-1 py-8 px-16" }, b = {
5
5
  class: "flex-0 py-8 px-16",
@@ -20,28 +20,28 @@ const v = { class: "flex flex-col" }, g = { class: "flex flex-row fm-typo-en-bod
20
20
  },
21
21
  setup($) {
22
22
  const { t: m } = _();
23
- function c(e, i) {
23
+ function c(e, l) {
24
24
  var t;
25
25
  if (e.measurement) {
26
26
  const u = y(e.amount, e.measurement.conversion);
27
27
  return `${a(u, !1)} ${(t = e.measurement) == null ? void 0 : t.abbrev}`;
28
28
  }
29
- return `${a(e.amount, !1)} ${i.abbrev}`;
29
+ return `${a(e.amount, !1)} ${l.abbrev}`;
30
30
  }
31
31
  function f(e) {
32
32
  return e.unit !== void 0;
33
33
  }
34
- return (e, i) => (s(), n("div", v, [
34
+ return (e, l) => (s(), n("div", v, [
35
35
  r("div", g, [
36
36
  r("div", h, o(e.name), 1),
37
- r("div", b, o(l(m)("inventory.ingredient.bindedItems.amount")), 1)
37
+ r("div", b, o(i(m)("inventory.ingredient.bindedItems.amount")), 1)
38
38
  ]),
39
39
  (s(!0), n(d, null, x(e.bindings, (t) => (s(), n("div", {
40
40
  key: t.id,
41
41
  class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
42
42
  }, [
43
43
  r("div", k, o(t.name), 1),
44
- f(t) ? (s(), n("div", B, o(c(t, t.unit)), 1)) : (s(), n("div", I, o(l(a)(t.amount, !1)), 1))
44
+ f(t) ? (s(), n("div", B, o(c(t, t.unit)), 1)) : (s(), n("div", I, o(i(a)(t.amount, !1)), 1))
45
45
  ]))), 128))
46
46
  ]));
47
47
  }
@@ -0,0 +1,608 @@
1
+ import { ref as C, computed as I, 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 H, 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 { u as J, c as B, R as ye, A as be, j as oe, e as ne, i as _e } from "./app-BqLAVk-L.js";
3
+ import { useDialog as le, useSnackbar as Z, useProxiedModel as xe, useBreakpoints as ke } from "@feedmepos/ui-library";
4
+ import { F as h, D as se, R as Q } from "./row-action.enum-PMKMRrZR.js";
5
+ import { useI18n as W } from "@feedmepos/mf-common";
6
+ import { defineStore as ie, storeToRefs as ae } from "pinia";
7
+ import "vue-router";
8
+ import { c as he, _ as we, F as re } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
9
+ import { u as Se, _ as Fe, a as Ie } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CmfjbJ0t.js";
10
+ import { d as Ce } from "./defineDeepModel-Bh0i7x-r.js";
11
+ const X = ie(
12
+ "ingredientGroupactions",
13
+ function() {
14
+ const c = le(), w = Z(), o = J(), { t: r } = W(), i = C();
15
+ function p() {
16
+ const d = {
17
+ modelValue: {},
18
+ mode: h.CREATE,
19
+ show: !0,
20
+ "onUpdate:show"(a) {
21
+ i.value.show = a;
22
+ }
23
+ };
24
+ i.value = d;
25
+ }
26
+ async function v(d) {
27
+ const a = {
28
+ modelValue: B(d),
29
+ mode: h.UPDATE,
30
+ show: !0,
31
+ "onUpdate:show"(s) {
32
+ i.value.show = s;
33
+ }
34
+ };
35
+ i.value = a;
36
+ }
37
+ async function f(d, a, s) {
38
+ a.value = !0;
39
+ try {
40
+ await o.deleteSkuGroup(d), w.open({
41
+ title: "Success",
42
+ message: `Deleted ${d.name}`,
43
+ type: "success"
44
+ });
45
+ } catch (n) {
46
+ w.open({
47
+ title: `Cannot delete ${d.name}`,
48
+ message: "Please try again.",
49
+ type: "error"
50
+ }), console.error("failed to delete ingredient", n);
51
+ } finally {
52
+ a.value = !1, s();
53
+ }
54
+ }
55
+ function y(d, a, s) {
56
+ c.open({
57
+ title: r("inventory.ingredient.delete.title", [(d == null ? void 0 : d.name) ?? ""]),
58
+ closeButton: !1,
59
+ message: r("inventory.ingredient.delete.message"),
60
+ primaryActions: {
61
+ text: r("common.delete"),
62
+ close: !0,
63
+ variant: "destructive"
64
+ },
65
+ secondaryActions: {
66
+ text: r("common.cancel"),
67
+ close: !0
68
+ }
69
+ }).onPrimary(() => f(d, a, s));
70
+ }
71
+ function A() {
72
+ }
73
+ function b() {
74
+ }
75
+ return {
76
+ createIngredientGroup: p,
77
+ updateIngredientGroup: v,
78
+ deleteIngredientGroup: y,
79
+ importIngredientGroups: A,
80
+ exportIngredientGroups: b,
81
+ ingredientGroupDialogProps: i
82
+ };
83
+ }
84
+ ), Ae = ie(
85
+ "ingredientGroupTable",
86
+ function() {
87
+ const c = C(!1), w = Z(), o = J(), r = X();
88
+ async function i() {
89
+ c.value = !0;
90
+ try {
91
+ await o.readInventory();
92
+ } catch (f) {
93
+ console.error("error on reading inventory", f), w.open({
94
+ title: "Error",
95
+ message: "Something went wrong, please try again.",
96
+ type: "error"
97
+ });
98
+ } finally {
99
+ c.value = !1;
100
+ }
101
+ }
102
+ function p(f, y) {
103
+ switch (y = B(y), f) {
104
+ case Q.Edit:
105
+ return r.updateIngredientGroup(y);
106
+ case Q.Delete:
107
+ return r.deleteIngredientGroup(
108
+ y,
109
+ c,
110
+ () => i()
111
+ );
112
+ }
113
+ }
114
+ const v = I(() => [
115
+ {
116
+ accessorKey: "name",
117
+ header: () => "Name"
118
+ },
119
+ {
120
+ accessorKey: "skus.length",
121
+ header: () => "No. of items"
122
+ },
123
+ {
124
+ accessorKey: "ref",
125
+ header: () => "Reference"
126
+ },
127
+ {
128
+ id: "action",
129
+ header: "",
130
+ cell(f) {
131
+ return he(
132
+ [se[Q.Edit], se[Q.Delete]],
133
+ (y) => {
134
+ p(y, f.row.original);
135
+ }
136
+ );
137
+ },
138
+ enableSorting: !1,
139
+ size: 40,
140
+ meta: {
141
+ cellClass: "",
142
+ headerClass: ""
143
+ }
144
+ }
145
+ ]);
146
+ return {
147
+ fetchIngredientGroups: i,
148
+ loading: c,
149
+ columnDefs: v
150
+ };
151
+ }
152
+ ), De = { class: "flex flex-col gap-16" }, Ge = { class: "flex flex-col gap-8 cursor-pointer" }, Ve = {
153
+ key: 0,
154
+ class: "text-fm-color-typo-primary fm-typo-en-body-lg-400 line-clamp-1 break-all"
155
+ }, Ee = { class: "text-fm-color-typo-secondary" }, Re = {
156
+ key: 1,
157
+ class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 line-clamp-1 break-all"
158
+ }, 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({
159
+ __name: "IngredientGroupForm",
160
+ props: {
161
+ mode: {},
162
+ disabled: { type: Boolean },
163
+ modelValue: {}
164
+ },
165
+ emits: ["validation-success"],
166
+ setup(U, { expose: c, emit: w }) {
167
+ const o = Ce("modelValue"), r = w, i = J(), p = le(), { t: v } = W(), f = C();
168
+ c({
169
+ validateInputs: () => {
170
+ var a;
171
+ return (a = f.value) == null ? void 0 : a.validateInputs();
172
+ },
173
+ resetInputsValidation: () => {
174
+ var a;
175
+ return (a = f.value) == null ? void 0 : a.resetInputsValidation();
176
+ },
177
+ resetInputs: () => {
178
+ var a;
179
+ return (a = f.value) == null ? void 0 : a.resetInputs();
180
+ }
181
+ });
182
+ const y = I(() => i.skus.groupBy((a) => a.unit._id));
183
+ function A() {
184
+ var s;
185
+ const a = i.skus.filter((n) => {
186
+ var t;
187
+ return (((t = y.value.get(n.unit._id)) == null ? void 0 : t.length) ?? 0) > 1;
188
+ }).map((n) => ({
189
+ label: n.name,
190
+ sublabel: n.code,
191
+ value: n
192
+ })).sort((n, t) => {
193
+ var e, u, _, m;
194
+ 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);
195
+ });
196
+ p.open({
197
+ title: v("inventory.closing.form.items.selectItem"),
198
+ closeButton: !0,
199
+ contentComponent: oe,
200
+ contentComponentProps: {
201
+ modelValue: [(s = o.skus) == null ? void 0 : s[0]],
202
+ items: a,
203
+ singleSelect: !0,
204
+ virtualScroll: !0
205
+ },
206
+ primaryActions: {
207
+ text: v("common.confirm"),
208
+ close: !0
209
+ },
210
+ secondaryActions: {
211
+ text: v("common.close"),
212
+ close: !0,
213
+ variant: "tertiary"
214
+ }
215
+ }).onPrimary((n) => {
216
+ var t;
217
+ o.skus = n.map((e) => B(e)), o.unit = ((t = n[0]) == null ? void 0 : t.unit) ?? o.unit;
218
+ });
219
+ }
220
+ function b() {
221
+ const a = i.skus.filter((n) => {
222
+ var t, e, u;
223
+ 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);
224
+ }).map((n) => ({
225
+ label: n.name,
226
+ sublabel: n.code,
227
+ value: n
228
+ })).sort((n, t) => {
229
+ var e, u, _, m;
230
+ 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);
231
+ }), s = a.filter((n) => {
232
+ var t;
233
+ return (t = o.skus) == null ? void 0 : t.find((e) => (e == null ? void 0 : e._id) === n.value._id);
234
+ }).map((n) => n.value);
235
+ p.open({
236
+ title: v("inventory.closing.form.items.selectItem"),
237
+ closeButton: !0,
238
+ contentComponent: oe,
239
+ contentComponentProps: {
240
+ modelValue: s,
241
+ items: a,
242
+ virtualScroll: !0
243
+ },
244
+ primaryActions: {
245
+ text: v("common.confirm"),
246
+ close: !0
247
+ },
248
+ secondaryActions: {
249
+ text: v("common.close"),
250
+ close: !0,
251
+ variant: "tertiary"
252
+ }
253
+ }).onPrimary((n) => {
254
+ var u, _;
255
+ const t = ((u = o.skus) == null ? void 0 : u.slice(1)) ?? [], e = n.map((m) => {
256
+ const D = t.find((G) => (G == null ? void 0 : G._id) === m._id);
257
+ return D || B(m, ["unit"]);
258
+ });
259
+ o.skus = [(_ = o.skus) == null ? void 0 : _[0], ...e];
260
+ });
261
+ }
262
+ const d = [
263
+ {
264
+ accessorKey: "code",
265
+ header: () => "Code",
266
+ enableSorting: !1
267
+ },
268
+ {
269
+ accessorKey: "name",
270
+ header: () => "Name",
271
+ enableSorting: !1
272
+ }
273
+ ];
274
+ return (a, s) => {
275
+ const n = S("FmTextField"), t = S("FmLabel"), e = S("FmField"), u = S("FmFormGroup"), _ = S("FmButton"), m = S("FmTable"), D = S("FmForm");
276
+ return M(), O(D, {
277
+ onValidationSuccess: s[5] || (s[5] = (F) => r("validation-success")),
278
+ ref_key: "formRef",
279
+ ref: f,
280
+ class: "flex flex-col gap-32"
281
+ }, {
282
+ default: R(() => {
283
+ var F, G, V, T, L;
284
+ return [
285
+ x("div", De, [
286
+ g(n, {
287
+ label: "Name",
288
+ "label-mark": "required",
289
+ rules: [l(ye)()],
290
+ modelValue: l(o).name,
291
+ "onUpdate:modelValue": s[0] || (s[0] = (k) => l(o).name = k)
292
+ }, null, 8, ["rules", "modelValue"]),
293
+ g(n, {
294
+ label: "Reference",
295
+ "label-mark": "optional",
296
+ modelValue: l(o).ref,
297
+ "onUpdate:modelValue": s[1] || (s[1] = (k) => l(o).ref = k)
298
+ }, null, 8, ["modelValue"]),
299
+ x("div", Ge, [
300
+ g(t, {
301
+ label: "Main ingredient",
302
+ required: ""
303
+ }),
304
+ g(e, {
305
+ onClick: s[2] || (s[2] = (k) => A())
306
+ }, {
307
+ default: R(() => {
308
+ var k, E, $, z, N, K, q, P, j;
309
+ return [
310
+ ($ = (E = (k = l(o)) == null ? void 0 : k.skus) == null ? void 0 : E[0]) != null && $.name ? (M(), ee("span", Ve, [
311
+ x("span", Ee, "[" + H((K = (N = (z = l(o)) == null ? void 0 : z.skus) == null ? void 0 : N[0]) == null ? void 0 : K.code) + "]", 1),
312
+ te(" " + H((j = (P = (q = l(o)) == null ? void 0 : q.skus) == null ? void 0 : P[0]) == null ? void 0 : j.name), 1)
313
+ ])) : (M(), ee("span", Re, H("Click to select main item")))
314
+ ];
315
+ }),
316
+ _: 1
317
+ }),
318
+ x("div", Te, [
319
+ s[6] || (s[6] = te(H("Select a main item to filter out substitutable items with same unit.") + " ")),
320
+ g(u, {
321
+ "model-value": ((F = l(o)) == null ? void 0 : F.skus) ?? [],
322
+ rules: [l(be)(1, "Required")]
323
+ }, null, 8, ["model-value", "rules"])
324
+ ])
325
+ ])
326
+ ]),
327
+ x("div", $e, [
328
+ x("div", Pe, [
329
+ s[7] || (s[7] = x("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Substitutables", -1)),
330
+ x("div", null, [
331
+ g(_, {
332
+ label: "Add items",
333
+ disabled: (((V = (G = l(o)) == null ? void 0 : G.skus) == null ? void 0 : V.length) ?? 0) < 1,
334
+ onClick: s[3] || (s[3] = (k) => b()),
335
+ "prepend-icon": "add",
336
+ variant: "secondary",
337
+ "text-color": "primary",
338
+ "bg-color": "transparent",
339
+ "border-color": "primary"
340
+ }, null, 8, ["disabled"])
341
+ ])
342
+ ]),
343
+ g(m, {
344
+ "shrink-at": 9999,
345
+ "column-defs": d,
346
+ "row-data": (T = l(o).skus) == null ? void 0 : T.slice(1),
347
+ onDndChanged: s[4] || (s[4] = (k) => {
348
+ var E;
349
+ return l(o).skus = [(E = l(o).skus) == null ? void 0 : E[0], ...k];
350
+ }),
351
+ draggable: "",
352
+ "hide-footer": "",
353
+ "page-size": ((L = l(o).skus) == null ? void 0 : L.length) ?? 0
354
+ }, null, 8, ["row-data", "page-size"])
355
+ ])
356
+ ];
357
+ }),
358
+ _: 1
359
+ }, 512);
360
+ };
361
+ }
362
+ }), Be = { class: "flex gap-4" }, Ue = /* @__PURE__ */ Y({
363
+ __name: "IngredientGroupDialog",
364
+ props: {
365
+ show: { type: Boolean },
366
+ mode: { default: h.READ },
367
+ modelValue: {}
368
+ },
369
+ emits: ["update:show"],
370
+ setup(U) {
371
+ const c = U, w = J(), o = Z(), { t: r } = W(), i = xe(c, "show"), p = C({}), v = C(`${Math.random()}`);
372
+ ue(
373
+ () => c.show,
374
+ (t) => {
375
+ t && (Object.keys(p.value).forEach((e) => {
376
+ delete p.value[e];
377
+ }), Object.keys(c.modelValue ?? {}).forEach((e) => {
378
+ var u;
379
+ p.value[e] = (u = c.modelValue) == null ? void 0 : u[e];
380
+ }), v.value = `${Math.random()}`);
381
+ }
382
+ );
383
+ const f = I(() => {
384
+ switch (c.mode) {
385
+ case h.READ:
386
+ return "";
387
+ case h.UPDATE:
388
+ return r("inventory.ingredient.update.title");
389
+ case h.CREATE:
390
+ return r("inventory.ingredient.create.title");
391
+ }
392
+ return "";
393
+ }), y = I(() => {
394
+ switch (c.mode) {
395
+ case h.READ:
396
+ return "";
397
+ case h.UPDATE:
398
+ return r("common.save");
399
+ case h.CREATE:
400
+ return r("common.add");
401
+ }
402
+ return "";
403
+ }), A = C(), b = C(!1);
404
+ async function d() {
405
+ b.value = !0;
406
+ const t = B(p.value);
407
+ try {
408
+ await w.createSkuGroup(t), i.value = !1, o.open({
409
+ title: r("inventory.common.success"),
410
+ message: r("inventory.ingredient.create.success", { name: t.name }),
411
+ type: "success"
412
+ });
413
+ } catch (e) {
414
+ e instanceof ne || o.open({
415
+ title: r("inventory.ingredient.create.error.title"),
416
+ message: r("inventory.ingredient.create.error.message"),
417
+ type: "error"
418
+ });
419
+ } finally {
420
+ b.value = !1;
421
+ }
422
+ }
423
+ async function a() {
424
+ b.value = !0;
425
+ const t = B(p.value);
426
+ try {
427
+ await w.updateSkuGroup(t), b.value = !1, i.value = !1, o.open({
428
+ title: r("inventory.common.success"),
429
+ message: r("inventory.ingredient.update.success", { name: t.name }),
430
+ type: "success"
431
+ });
432
+ } catch (e) {
433
+ e instanceof ne || o.open({
434
+ title: r("inventory.ingredient.update.error.title"),
435
+ message: r("inventory.ingredient.update.error.message"),
436
+ type: "error"
437
+ });
438
+ } finally {
439
+ b.value = !1;
440
+ }
441
+ }
442
+ function s() {
443
+ var t, e;
444
+ (e = (t = A.value) == null ? void 0 : t.validateInputs) == null || e.call(t);
445
+ }
446
+ function n() {
447
+ switch (c.mode) {
448
+ case h.READ:
449
+ return;
450
+ case h.UPDATE:
451
+ return a();
452
+ case h.CREATE:
453
+ return d();
454
+ }
455
+ }
456
+ return (t, e) => {
457
+ const u = S("FmButton"), _ = S("FmSideSheet");
458
+ return M(), O(_, {
459
+ "model-value": l(i),
460
+ "onUpdate:modelValue": e[3] || (e[3] = (m) => ce(i) ? i.value = m : null),
461
+ header: f.value,
462
+ "close-button": "",
463
+ "dismiss-away": "",
464
+ "max-width": 500
465
+ }, {
466
+ "side-sheet-footer": R(() => [
467
+ x("div", Be, [
468
+ g(u, {
469
+ loading: b.value,
470
+ label: y.value,
471
+ onClick: s
472
+ }, null, 8, ["loading", "label"]),
473
+ g(u, {
474
+ disabled: b.value,
475
+ label: l(r)("common.close"),
476
+ variant: "tertiary",
477
+ onClick: e[2] || (e[2] = (m) => i.value = !1)
478
+ }, null, 8, ["disabled", "label"])
479
+ ])
480
+ ]),
481
+ default: R(() => [
482
+ (M(), O(Me, {
483
+ class: "w-full",
484
+ ref_key: "hasValidationExpose",
485
+ ref: A,
486
+ key: v.value,
487
+ "model-value": p.value,
488
+ "onUpdate:modelValue": e[0] || (e[0] = (m) => p.value = m),
489
+ mode: t.mode,
490
+ disabled: b.value,
491
+ onValidationSuccess: e[1] || (e[1] = (m) => n())
492
+ }, null, 8, ["model-value", "mode", "disabled"]))
493
+ ]),
494
+ _: 1
495
+ }, 8, ["model-value", "header"]);
496
+ };
497
+ }
498
+ }), Le = { class: "flex flex-col py-8" }, ze = { 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" }, Ze = /* @__PURE__ */ Y({
499
+ __name: "IngredientGroupView",
500
+ setup(U) {
501
+ const c = J(), w = I(() => c.skuGroups), o = _e(), { t: r } = W(), {
502
+ createIngredientGroup: i,
503
+ updateIngredientGroup: p,
504
+ importIngredientGroups: v,
505
+ exportIngredientGroups: f
506
+ } = X(), { columnDefs: y, loading: A } = ae(Ae()), { ingredientGroupDialogProps: b } = ae(X());
507
+ function d(D) {
508
+ switch (D) {
509
+ case "add":
510
+ return i();
511
+ case "import":
512
+ return v();
513
+ case "export":
514
+ return f();
515
+ }
516
+ }
517
+ const a = C(""), s = C(!1), n = I(() => s.value || A.value), { breakpoints: t } = ke(), e = I(() => t.value.xs || t.value.sm), u = I(() => e.value ? 10 : 20), _ = Se(), m = I(() => [
518
+ {
519
+ label: r("inventory.ingredient.create.title"),
520
+ value: "add",
521
+ isPrimary: !0,
522
+ prependIcon: "add"
523
+ },
524
+ { label: r("common.import"), value: "import" },
525
+ { label: r("common.export"), value: "export" }
526
+ ]);
527
+ return (D, F) => {
528
+ const G = S("FmTable");
529
+ return M(), O(Fe, {
530
+ title: l(r)("inventory.ingredientGroup.title"),
531
+ actions: m.value,
532
+ "onClick:action": d
533
+ }, {
534
+ default: R(() => [
535
+ x("div", {
536
+ class: de([
537
+ "flex flex-col gap-8 max-h-full",
538
+ {
539
+ "p-0": e.value,
540
+ "px-24 ": !e.value
541
+ }
542
+ ])
543
+ }, [
544
+ g(Ie, {
545
+ searchable: "",
546
+ search: a.value,
547
+ "onUpdate:search": F[0] || (F[0] = (V) => a.value = V)
548
+ }, null, 8, ["search"]),
549
+ g(G, {
550
+ style: me(l(_).tableHeight),
551
+ "column-defs": l(y),
552
+ "row-data": w.value,
553
+ "search-value": a.value,
554
+ loading: !l(o)._currentLocation || n.value,
555
+ "loading-text": "Loading",
556
+ onRowClick: F[1] || (F[1] = (V) => l(p)(V.original)),
557
+ "page-size": u.value
558
+ }, {
559
+ "list-row": R((V) => [
560
+ g(we, {
561
+ row: V,
562
+ onRowClick: l(p)
563
+ }, pe({
564
+ default: R((T) => {
565
+ var L, k, E, $, z, N, K, q, P, j;
566
+ return [
567
+ x("div", Le, [
568
+ x("div", ze, [
569
+ g(l(re), {
570
+ render: (E = (k = (L = T.code) == null ? void 0 : L.column) == null ? void 0 : k.columnDef) == null ? void 0 : E.cell,
571
+ props: (z = ($ = T.code) == null ? void 0 : $.getContext) == null ? void 0 : z.call($)
572
+ }, null, 8, ["render", "props"])
573
+ ]),
574
+ x("div", Ne, [
575
+ g(l(re), {
576
+ render: (q = (K = (N = T.name) == null ? void 0 : N.column) == null ? void 0 : K.columnDef) == null ? void 0 : q.cell,
577
+ props: (j = (P = T.name) == null ? void 0 : P.getContext) == null ? void 0 : j.call(P)
578
+ }, null, 8, ["render", "props"])
579
+ ])
580
+ ])
581
+ ];
582
+ }),
583
+ _: 2
584
+ }, [
585
+ s.value ? {
586
+ name: "loading-text",
587
+ fn: R(() => [
588
+ x("div", null, H(l(r)("inventory.ingredient.table.importing")), 1)
589
+ ]),
590
+ key: "0"
591
+ } : void 0
592
+ ]), 1032, ["row", "onRowClick"])
593
+ ]),
594
+ _: 1
595
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
596
+ ], 2),
597
+ (M(), O(fe, { to: "body" }, [
598
+ g(Ue, ve(ge(l(b))), null, 16)
599
+ ]))
600
+ ]),
601
+ _: 1
602
+ }, 8, ["title", "actions"]);
603
+ };
604
+ }
605
+ });
606
+ export {
607
+ Ze as default
608
+ };