@feedmepos/mf-inventory-portal 0.0.5 → 0.0.7-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 (74) hide show
  1. package/dist/{ApprovalView-CTQdDgGH.js → ApprovalView-BYZcvkso.js} +6 -6
  2. package/dist/BindingsDialog-pdS86VDU.js +94 -0
  3. package/dist/{BindingsPicker-CQIGhTCR.js → BindingsPicker-D891Cfzu.js} +2 -2
  4. package/dist/{BindingsTable-Da4BLkvc.js → BindingsTable-tmr6QwLk.js} +30 -31
  5. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DcixBOcX.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-Bss0q2Zt.js} +7 -7
  6. package/dist/{FmMultiselectDialog.vue_vue_type_script_setup_true_lang-BXU7x6di.js → FmMultiselectDialog.vue_vue_type_script_setup_true_lang-BHcLUkdm.js} +19 -20
  7. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CD89qCIa.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BIww2Noe.js} +1 -1
  8. package/dist/IngredientsView-BH6G7830.js +819 -0
  9. package/dist/{IntegrationView-BRWYO3VE.js → IntegrationView-CfJn6Fzn.js} +3 -3
  10. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-39U8Iavr.js +258 -0
  11. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DBK7mpQS.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-nDxqau1g.js} +1 -1
  12. package/dist/{PurchaseOrderPrintPreview-CH9gVYDg.js → PurchaseOrderPrintPreview-Db2U_IQL.js} +1 -1
  13. package/dist/ReceiveRequestView-CgVfcS8C.js +1483 -0
  14. package/dist/{RecipeView-DFG9Wkx-.js → RecipeView-C9_Y_A9b.js} +58 -58
  15. package/dist/StockView-CoUI3Faj.js +1916 -0
  16. package/dist/SupplierView-CNq6wVfN.js +818 -0
  17. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Ffe9bhq8.js → TransferDetails.vue_vue_type_script_setup_true_lang-Cmajrg-9.js} +5 -5
  18. package/dist/{UnitView-C3XVSbJY.js → UnitView-Buyp4Gnc.js} +190 -177
  19. package/dist/{WarehouseView-BntzAdz3.js → WarehouseView-DbUib0PR.js} +56 -56
  20. package/dist/api/inventory.d.ts +33 -0
  21. package/dist/api/stock-estimate.d.ts +16 -0
  22. package/dist/api/stock.d.ts +8 -0
  23. package/dist/app-DM4Thqjw.js +42756 -0
  24. package/dist/app.js +1 -1
  25. package/dist/components/StockForecast.vue.d.ts +12 -0
  26. package/dist/components/StockForecastProps.d.ts +3 -0
  27. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +16 -0
  28. package/dist/components/shell/inventory/binding-ui.vue.d.ts +16 -0
  29. package/dist/core.d.ts +3 -2
  30. package/dist/date2-DpU4LDaP.js +199 -0
  31. package/dist/dayjs.min-D4Q_pHH9.js +13556 -0
  32. package/dist/{decimal-D3a0BwVj.js → decimal-M4vjE6Br.js} +1 -1
  33. package/dist/{fuzzy-BW8ZYsDG.js → fuzzy-fD_FTJWH.js} +1 -1
  34. package/dist/helper/number.d.ts +1 -0
  35. package/dist/{init-date-range-M3Q03-Fd.js → init-date-range-DJ1Nl5TB.js} +1 -1
  36. package/dist/{layout-BvUjg6JS.js → layout-kY567oHX.js} +1 -1
  37. package/dist/{rules-DHfAMDW3.js → rules-CVxh5XVG.js} +3 -3
  38. package/dist/stock-estimate-lkaYlz7I.js +90 -0
  39. package/dist/stores/api.d.ts +1 -0
  40. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  41. package/dist/stores/inventory.d.ts +64 -0
  42. package/dist/stores/stock-estimate.d.ts +11 -0
  43. package/dist/stores/supplier.d.ts +19 -1
  44. package/dist/style.css +1 -1
  45. package/dist/{supplier-DTiiOLtg.js → supplier-evd71Y1H.js} +3 -3
  46. package/dist/tsconfig.app.tsbuildinfo +1 -1
  47. package/dist/{use-inventory-binding-dialog-B6JO7050.js → use-inventory-binding-dialog-CGuXojFC.js} +2 -2
  48. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +32 -0
  49. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +16 -0
  50. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +23 -0
  51. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +213 -7
  52. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +102 -2
  53. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +306 -6
  54. package/dist/views/stock/components/StockRecalculateDialog.vue.d.ts +9 -0
  55. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +32 -0
  56. package/dist/views/stock/type.d.ts +1 -0
  57. package/dist/views/supplier/components/SupplierForm.vue.d.ts +38 -2
  58. package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +45 -0
  59. package/dist/views/supplier/composables/use-supplier-table.d.ts +19 -1
  60. package/dist/{xlsx-BljO4Lx2.js → xlsx-DpBw8KA4.js} +1010 -1010
  61. package/package.json +13 -7
  62. package/dist/BindingsDialog-DvX_DRsO.js +0 -82
  63. package/dist/IngredientsView-2ZKdzsgI.js +0 -739
  64. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CnsDmPTe.js +0 -240
  65. package/dist/ReceiveRequestView-DQBqc3GF.js +0 -1298
  66. package/dist/StockView-DLWMp_I5.js +0 -1733
  67. package/dist/SupplierView-CZhM2ie3.js +0 -607
  68. package/dist/app-BzDhmCVx.js +0 -36639
  69. package/dist/components/shell/inventory/binding-ui.test.d.ts +0 -1
  70. package/dist/components/ui-library/FmSpecialChip.vue.d.ts +0 -79
  71. package/dist/date2-C7HiAWQG.js +0 -209
  72. package/dist/dayjs.min-Db57WhI9.js +0 -282
  73. package/dist/id-to-date-ReZIpUDw.js +0 -30
  74. package/dist/index-D46it8Rk.js +0 -12956
@@ -1,739 +0,0 @@
1
- import { ref as B, defineComponent as J, computed as d, resolveComponent as b, openBlock as k, createBlock as R, withCtx as x, createVNode as i, createElementBlock as z, Fragment as j, createElementVNode as D, createCommentVNode as G, onMounted as pe, watch as ve, unref as h, normalizeClass as fe, createTextVNode as ge, toDisplayString as be, renderList as Ve, isRef as ee, normalizeStyle as _e, Teleport as ye, normalizeProps as Fe, guardReactiveProps as he } from "vue";
2
- import { u as Q, c as ae, S as Se, F as L, a as ne, b as ke } from "./app-BzDhmCVx.js";
3
- import { useDialog as we, useSnackbar as se, useProxiedModel as te, useBreakpoints as Ie } from "@feedmepos/ui-library";
4
- import { i as xe, _ as Ce } from "./is-linked-ingredient-error-C6AghEwR.js";
5
- import { F as I, D as le, R as Y } from "./row-action.enum-BwQbURNh.js";
6
- import { c as Ee, _ as Me, F as oe, u as Ae } from "./layout-BvUjg6JS.js";
7
- import { _ as De } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CFjO4TPG.js";
8
- import { R as X, U as Ue } from "./rules-DHfAMDW3.js";
9
- import { g as Re } from "./use-inventory-binding-dialog-B6JO7050.js";
10
- import { _ as $e } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-CnsDmPTe.js";
11
- import { _ as Z } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-CD89qCIa.js";
12
- function Te() {
13
- const C = we(), y = se(), p = Q(), t = B(!1), l = B();
14
- function o() {
15
- const s = {
16
- unit: {},
17
- mode: I.CREATE,
18
- show: !0,
19
- "onUpdate:show"(v) {
20
- l.value.show = v;
21
- }
22
- };
23
- l.value = s;
24
- }
25
- async function m(s) {
26
- const v = {
27
- unit: ae(s),
28
- mode: I.UPDATE,
29
- show: !0,
30
- "onUpdate:show"(u) {
31
- l.value.show = u;
32
- }
33
- };
34
- l.value = v;
35
- }
36
- async function w(s) {
37
- t.value = !0;
38
- try {
39
- await p.deleteSku(s), y.open({
40
- title: "Success",
41
- message: `Deleted ${s.name}`,
42
- type: "success"
43
- });
44
- } catch (v) {
45
- v instanceof Se && xe(v) ? C.open({
46
- title: "Cannot delete ingredient",
47
- contentComponent: Ce,
48
- contentComponentProps: {
49
- subject: (s == null ? void 0 : s.name) ?? "",
50
- items: v.errorResponse.message
51
- },
52
- secondaryActions: {
53
- text: "Close",
54
- close: !0
55
- }
56
- }) : console.log("unable to delete ingredient", v), y.open({
57
- title: `Cannot delete ${s.name}`,
58
- message: "Please try again.",
59
- type: "error"
60
- }), console.error("failed to delete ingredient", v);
61
- } finally {
62
- t.value = !1;
63
- }
64
- }
65
- function E(s) {
66
- C.open({
67
- title: `Delete ${(s == null ? void 0 : s.name) ?? "ingredient"}?`,
68
- closeButton: !1,
69
- message: "You may not be able to delete this ingredient if it is linked in any of the inventory modules.",
70
- primaryActions: {
71
- text: "Delete",
72
- close: !0,
73
- variant: "destructive"
74
- },
75
- secondaryActions: {
76
- text: "Cancel",
77
- close: !0
78
- }
79
- }).onPrimary(() => w(s));
80
- }
81
- return {
82
- createIngredient: o,
83
- updateIngredient: m,
84
- deleteIngredient: E,
85
- ingredientDialogProps: l,
86
- ingredientViewLoading: t
87
- };
88
- }
89
- function Be({
90
- updateIngredient: C,
91
- deleteIngredient: y
92
- }) {
93
- async function p(l, o) {
94
- const m = ae(o);
95
- if (l === Y.Edit) {
96
- await C(m);
97
- return;
98
- }
99
- if (l === Y.Delete) {
100
- await y(m);
101
- return;
102
- }
103
- }
104
- return { columnDefs: [
105
- {
106
- accessorKey: "code",
107
- header: "Code",
108
- enableSorting: !0,
109
- size: 300
110
- },
111
- {
112
- accessorKey: "name",
113
- header: "Name",
114
- enableSorting: !0,
115
- size: 300
116
- },
117
- {
118
- accessorFn: (l) => {
119
- var o;
120
- if (l.trackingMeasurement) {
121
- const m = (o = l.unit.measurements) == null ? void 0 : o.find(
122
- (w) => w.id === l.trackingMeasurement
123
- );
124
- if (m)
125
- return `${m.name} (${m.abbrev})`;
126
- }
127
- return `${l.unit.name} (${l.unit.abbrev})`;
128
- },
129
- header: "Unit",
130
- enableSorting: !1,
131
- size: "auto"
132
- },
133
- {
134
- id: "action",
135
- header: "",
136
- cell(l) {
137
- return Ee(
138
- [le[Y.Edit], le[Y.Delete]],
139
- (o) => {
140
- p(o, l.row.original);
141
- }
142
- );
143
- },
144
- enableSorting: !1,
145
- size: 40,
146
- meta: {
147
- cellClass: "",
148
- headerClass: ""
149
- }
150
- }
151
- ] };
152
- }
153
- const Pe = /* @__PURE__ */ J({
154
- __name: "ConvertForm",
155
- props: {
156
- modelValue: {},
157
- rootValue: {},
158
- disabled: { type: Boolean }
159
- },
160
- emits: ["update:modelValue"],
161
- setup(C, { emit: y }) {
162
- const p = C, t = d(() => {
163
- var u;
164
- return (u = p.rootValue) == null ? void 0 : u.unit;
165
- }), l = d(() => {
166
- var u;
167
- return (u = p.rootValue) == null ? void 0 : u._id;
168
- }), o = y, m = d({
169
- get() {
170
- return !!p.modelValue;
171
- },
172
- set(u) {
173
- u ? o("update:modelValue", {
174
- measurement: null,
175
- inventoryBindings: []
176
- }) : o("update:modelValue", null);
177
- }
178
- }), w = d(() => Re(t.value));
179
- function E(u) {
180
- const c = p.modelValue ?? {};
181
- c.measurement = u ? `${u}` : null, o("update:modelValue", c);
182
- }
183
- function s(u) {
184
- const c = p.modelValue ?? {};
185
- c.inventoryBindings = u, o("update:modelValue", c);
186
- }
187
- const v = d(() => {
188
- if (!p.modelValue) return null;
189
- const u = p.modelValue;
190
- return u.measurement ? w.value.find((c) => c.value === u.measurement) ?? null : w.value.find((c) => c.value === null) ?? null;
191
- });
192
- return (u, c) => {
193
- const $ = b("FmSwitch"), V = b("FmSelect"), _ = b("FmCard");
194
- return k(), R(_, {
195
- variant: "outlined",
196
- class: "p-16 flex flex-col gap-16"
197
- }, {
198
- default: x(() => {
199
- var M, S;
200
- return [
201
- i($, {
202
- value: "",
203
- "model-value": m.value,
204
- "onUpdate:modelValue": c[0] || (c[0] = (F) => m.value = F),
205
- label: "Convertible",
206
- sublabel: "Convertible from other recipe or ingredients",
207
- labelPlacement: "right"
208
- }, null, 8, ["model-value"]),
209
- m.value ? (k(), z(j, { key: 0 }, [
210
- D("div", null, [
211
- i(V, {
212
- label: "Recipes and ingredients convert to",
213
- modelValue: (M = v.value) == null ? void 0 : M.value,
214
- "onUpdate:modelValue": E,
215
- items: w.value
216
- }, null, 8, ["modelValue", "items"])
217
- ]),
218
- i($e, {
219
- id: l.value,
220
- "model-value": ((S = u.modelValue) == null ? void 0 : S.inventoryBindings) ?? [],
221
- "onUpdate:modelValue": s,
222
- "exclude-binding-id": l.value
223
- }, null, 8, ["id", "model-value", "exclude-binding-id"])
224
- ], 64)) : G("", !0)
225
- ];
226
- }),
227
- _: 1
228
- });
229
- };
230
- }
231
- }), Oe = { class: "col-span-2 mt-16" }, Le = {
232
- key: 0,
233
- class: "col-span-2 mt-16 border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
234
- }, Ne = /* @__PURE__ */ J({
235
- __name: "IngredientForm",
236
- props: {
237
- mode: {},
238
- modelValue: {},
239
- disabled: { type: Boolean }
240
- },
241
- emits: ["update:modelValue", "click:submit"],
242
- setup(C, { expose: y, emit: p }) {
243
- var O;
244
- const t = C, l = p, o = Q();
245
- function m(e) {
246
- if (e.length === 0) return;
247
- const n = e[0], a = t.modelValue ?? {
248
- unit: o.units.find((r) => r)
249
- };
250
- a.unit || (a.unit = n, l("update:modelValue", a));
251
- }
252
- pe(() => {
253
- m(o.units);
254
- }), ve([() => o.units], ([e]) => {
255
- m(e);
256
- });
257
- function w() {
258
- l("click:submit");
259
- }
260
- const E = d({
261
- get() {
262
- var e;
263
- return ((e = t.modelValue) == null ? void 0 : e.code) ?? "";
264
- },
265
- set(e) {
266
- const n = t.modelValue ? {
267
- ...t.modelValue
268
- } : {};
269
- n.code = e, l("update:modelValue", n);
270
- }
271
- }), s = d({
272
- get() {
273
- var e;
274
- return ((e = t.modelValue) == null ? void 0 : e.name) ?? "";
275
- },
276
- set(e) {
277
- const n = t.modelValue ? {
278
- ...t.modelValue
279
- } : {};
280
- n.name = e, l("update:modelValue", n);
281
- }
282
- }), v = d(() => {
283
- var n, a, r;
284
- const e = ((n = t.modelValue) == null ? void 0 : n.unit) ?? o.units.find((f) => f);
285
- return e ? {
286
- _id: e._id,
287
- measurement: (a = t.modelValue) == null ? void 0 : a.trackingMeasurement,
288
- name: ((r = e.measurements.find((f) => {
289
- var g;
290
- return f.id === ((g = t.modelValue) == null ? void 0 : g.trackingMeasurement);
291
- })) == null ? void 0 : r.name) ?? e.name
292
- } : null;
293
- }), u = d(
294
- () => o.units.flatMap(({ name: e, _id: n, abbrev: a, measurements: r }) => [
295
- {
296
- label: `${e}`,
297
- value: null,
298
- displayAsSection: !0
299
- },
300
- {
301
- label: `${e} (${a})`,
302
- value: { _id: n },
303
- displayAsSection: !1
304
- },
305
- ...r.map(({ id: f, name: g, abbrev: N }) => ({
306
- label: `${g} (${N})`,
307
- value: { _id: n, measurement: f },
308
- displayAsSection: !1
309
- }))
310
- ])
311
- );
312
- function c(e) {
313
- var n, a, r, f, g;
314
- return ((a = (n = t.modelValue) == null ? void 0 : n.unit) == null ? void 0 : a._id) === ((r = e.value) == null ? void 0 : r._id) && ((f = t.modelValue) == null ? void 0 : f.trackingMeasurement) === ((g = e.value) == null ? void 0 : g.measurement);
315
- }
316
- function $(e) {
317
- if (!e) return;
318
- const { _id: n, measurement: a } = e, r = a || void 0, f = o.units.find((N) => N._id === n);
319
- if (!f)
320
- return;
321
- const g = t.modelValue ?? {};
322
- g.unit = f, g.trackingMeasurement = r, g.convert && (g.convert.measurement = r || null), l("update:modelValue", g);
323
- }
324
- const V = d({
325
- get() {
326
- var e;
327
- return ((e = t.modelValue) == null ? void 0 : e.convert) ?? null;
328
- },
329
- set(e) {
330
- const n = t.modelValue ? {
331
- ...t.modelValue
332
- } : {};
333
- e ? n.convert = e : n.convert = null, l("update:modelValue", n);
334
- }
335
- }), _ = d(() => L.options.filter(
336
- (e) => e === L.enum.FIFO || e === L.enum.WAVG
337
- ).map((e) => {
338
- function n(a) {
339
- switch (a) {
340
- case L.enum.WAVG:
341
- return "Weighted Average (WAVG)";
342
- case L.enum.FIFO:
343
- return "First In First Out (FIFO)";
344
- case L.enum.LIFO:
345
- return "Last In First Out (LIFO)";
346
- case L.enum.FEFO:
347
- return "First Expired First Out (FEFO)";
348
- }
349
- return "";
350
- }
351
- return {
352
- label: n(e),
353
- value: e
354
- };
355
- })), M = d({
356
- get() {
357
- var e;
358
- return ((e = t.modelValue) == null ? void 0 : e.valuation) ?? "WAVG";
359
- },
360
- set(e) {
361
- const n = t.modelValue ? {
362
- ...t.modelValue
363
- } : {};
364
- n.valuation = e, l("update:modelValue", n);
365
- }
366
- }), S = B();
367
- y({
368
- validateInputs: () => {
369
- var e, n;
370
- (n = (e = S.value) == null ? void 0 : e.validateInputs) == null || n.call(e);
371
- },
372
- resetInputsValidation: () => {
373
- var e, n;
374
- (n = (e = S.value) == null ? void 0 : e.resetInputsValidation) == null || n.call(e);
375
- },
376
- resetInputs: () => {
377
- var e, n;
378
- (n = (e = S.value) == null ? void 0 : e.resetInputs) == null || n.call(e);
379
- }
380
- });
381
- const F = B(!1), q = d(
382
- () => {
383
- var e, n, a;
384
- return (e = t.modelValue) != null && e._id ? ((a = o.menu.bindedBySkuId[(n = t.modelValue) == null ? void 0 : n._id]) == null ? void 0 : a.filter(
385
- (r) => r.from === "INGREDIENT"
386
- )) ?? [] : [];
387
- }
388
- ), T = d(
389
- () => {
390
- var e, n, a;
391
- return (e = t.modelValue) != null && e._id ? ((a = o.menu.bindedBySkuId[(n = t.modelValue) == null ? void 0 : n._id]) == null ? void 0 : a.filter(
392
- (r) => r.from === "RECIPE"
393
- )) ?? [] : [];
394
- }
395
- ), P = d(
396
- () => {
397
- var e, n, a;
398
- return (e = t.modelValue) != null && e._id ? ((a = o.menu.bindedBySkuId[(n = t.modelValue) == null ? void 0 : n._id]) == null ? void 0 : a.filter((r) => r.from === "MENU")) ?? [] : [];
399
- }
400
- ), H = d(
401
- () => o.skus.map((e) => ({ label: e.name, value: e.code }))
402
- ), W = B((O = t.modelValue) == null ? void 0 : O.code);
403
- function K(e) {
404
- var a;
405
- const n = e.el;
406
- n && ((a = n.querySelector("[x-should-scroll-into=true]")) == null || a.scrollIntoView());
407
- }
408
- return (e, n) => {
409
- const a = b("FmTextField"), r = b("FmSelect"), f = b("FmLabel"), g = b("FmField"), N = b("FmMenuHeader"), ue = b("FmMenuDivider"), re = b("FmMenuItem"), ie = b("FmMenu"), de = b("FmFormGroup"), me = b("FmSwitch"), ce = b("FmForm");
410
- return k(), R(ce, {
411
- disabled: e.disabled,
412
- ref_key: "formRef",
413
- ref: S,
414
- class: "grid grid-cols-2 gap-24",
415
- onValidationSuccess: w
416
- }, {
417
- default: x(() => [
418
- i(a, {
419
- label: "Code",
420
- "model-value": E.value,
421
- "onUpdate:modelValue": n[0] || (n[0] = (A) => E.value = A),
422
- rules: [h(X)(), h(Ue)(H.value, W.value)],
423
- "label-mark": "required"
424
- }, null, 8, ["model-value", "rules"]),
425
- i(a, {
426
- label: "Name",
427
- "model-value": s.value,
428
- "onUpdate:modelValue": n[1] || (n[1] = (A) => s.value = A),
429
- rules: [h(X)()],
430
- "label-mark": "required"
431
- }, null, 8, ["model-value", "rules"]),
432
- i(r, {
433
- class: "col-span-2",
434
- "model-value": M.value,
435
- "onUpdate:modelValue": n[2] || (n[2] = (A) => M.value = A),
436
- label: "Valuation Method",
437
- items: _.value
438
- }, null, 8, ["model-value", "items"]),
439
- i(de, {
440
- class: "col-span-2",
441
- "model-value": v.value,
442
- rules: [h(X)()],
443
- "label-mark": "required"
444
- }, {
445
- label: x(() => [
446
- i(f, { label: "Unit" })
447
- ]),
448
- default: x(({ invalid: A }) => [
449
- i(ie, null, {
450
- "menu-button": x(() => [
451
- i(g, {
452
- class: fe([
453
- "fm-typo-en-body-lg-400",
454
- {
455
- "text-fm-color-typo-primary": !e.disabled,
456
- "text-fm-color-typo-disabled": e.disabled
457
- }
458
- ]),
459
- invalid: A,
460
- "append-icon": "expand_more"
461
- }, {
462
- default: x(() => {
463
- var U;
464
- return [
465
- ge(be((U = v.value) == null ? void 0 : U.name), 1)
466
- ];
467
- }),
468
- _: 2
469
- }, 1032, ["class", "invalid"])
470
- ]),
471
- default: x(() => [
472
- D("div", {
473
- class: "overflow-x-hidden overflow-y-auto max-h-[300px]",
474
- onVnodeMounted: K
475
- }, [
476
- (k(!0), z(j, null, Ve(u.value, (U) => (k(), z(j, {
477
- key: U.label
478
- }, [
479
- U.displayAsSection ? (k(), z(j, { key: 0 }, [
480
- i(N, {
481
- label: U.label
482
- }, null, 8, ["label"]),
483
- i(ue)
484
- ], 64)) : (k(), R(re, {
485
- key: 1,
486
- label: U.label,
487
- "model-value": c(U),
488
- onClick: (Je) => $(U.value),
489
- "x-should-scroll-into": `${c(U)}`
490
- }, null, 8, ["label", "model-value", "onClick", "x-should-scroll-into"]))
491
- ], 64))), 128))
492
- ], 512)
493
- ]),
494
- _: 2
495
- }, 1024)
496
- ]),
497
- _: 1
498
- }, 8, ["model-value", "rules"]),
499
- D("div", Oe, [
500
- i(Pe, {
501
- "model-value": V.value,
502
- "onUpdate:modelValue": n[3] || (n[3] = (A) => V.value = A),
503
- "root-value": e.modelValue
504
- }, null, 8, ["model-value", "root-value"])
505
- ]),
506
- e.mode !== h(I).CREATE ? (k(), z("div", Le, [
507
- D("div", null, [
508
- i(me, {
509
- label: "Show binded items",
510
- modelValue: F.value,
511
- "onUpdate:modelValue": n[4] || (n[4] = (A) => F.value = A),
512
- "label-placement": "right"
513
- }, null, 8, ["modelValue"])
514
- ]),
515
- F.value && q.value.length ? (k(), R(Z, {
516
- key: 0,
517
- name: "Ingredient",
518
- bindings: q.value
519
- }, null, 8, ["bindings"])) : G("", !0),
520
- F.value && T.value.length ? (k(), R(Z, {
521
- key: 1,
522
- name: "Recipe",
523
- bindings: T.value
524
- }, null, 8, ["bindings"])) : G("", !0),
525
- F.value && P.value.length ? (k(), R(Z, {
526
- key: 2,
527
- name: "Menu",
528
- bindings: P.value
529
- }, null, 8, ["bindings"])) : G("", !0)
530
- ])) : G("", !0)
531
- ]),
532
- _: 1
533
- }, 8, ["disabled"]);
534
- };
535
- }
536
- }), ze = { class: "flex gap-4" }, Ge = /* @__PURE__ */ J({
537
- __name: "IngredientDialog",
538
- props: {
539
- show: { type: Boolean },
540
- unit: {},
541
- mode: { default: I.READ }
542
- },
543
- emits: ["update:show"],
544
- setup(C) {
545
- const y = C, p = Q(), t = se(), l = te(y, "show"), o = te(y, "unit"), m = d(() => {
546
- switch (y.mode) {
547
- case I.READ:
548
- return "View Ingredient";
549
- case I.UPDATE:
550
- return "Edit Ingredient";
551
- case I.CREATE:
552
- return "Add Ingredient";
553
- }
554
- return "";
555
- }), w = d(() => {
556
- switch (y.mode) {
557
- case I.READ:
558
- return "";
559
- case I.UPDATE:
560
- return "Save";
561
- case I.CREATE:
562
- return "Add";
563
- }
564
- return "";
565
- }), E = B(), s = B(!1);
566
- async function v() {
567
- s.value = !0;
568
- try {
569
- await p.createSku(o.value), l.value = !1, t.open({
570
- title: "Success",
571
- message: "Created " + o.value.name,
572
- type: "success"
573
- });
574
- } catch (V) {
575
- V instanceof ne || t.open({
576
- title: "Failed to create ingredient",
577
- message: "Please try again",
578
- type: "error"
579
- });
580
- } finally {
581
- s.value = !1;
582
- }
583
- }
584
- async function u() {
585
- s.value = !0;
586
- try {
587
- await p.updateSku(o.value), s.value = !1, l.value = !1, t.open({
588
- title: "Success",
589
- message: "Updated " + o.value.name,
590
- type: "success"
591
- });
592
- } catch (V) {
593
- V instanceof ne || t.open({
594
- title: "Failed to update ingredient",
595
- message: "Please try again",
596
- type: "error"
597
- });
598
- } finally {
599
- s.value = !1;
600
- }
601
- }
602
- function c() {
603
- var V, _;
604
- (_ = (V = E.value) == null ? void 0 : V.validateInputs) == null || _.call(V);
605
- }
606
- function $() {
607
- switch (y.mode) {
608
- case I.READ:
609
- return;
610
- case I.UPDATE:
611
- return u();
612
- case I.CREATE:
613
- return v();
614
- }
615
- }
616
- return (V, _) => {
617
- const M = b("FmButton"), S = b("FmSideSheet");
618
- return k(), R(S, {
619
- "model-value": h(l),
620
- "onUpdate:modelValue": _[3] || (_[3] = (F) => ee(l) ? l.value = F : null),
621
- header: m.value,
622
- "close-button": "",
623
- "dismiss-away": "",
624
- "max-width": 500
625
- }, {
626
- "side-sheet-footer": x(() => [
627
- D("div", ze, [
628
- i(M, {
629
- loading: s.value,
630
- label: w.value,
631
- onClick: c
632
- }, null, 8, ["loading", "label"]),
633
- i(M, {
634
- disabled: s.value,
635
- label: "Close",
636
- variant: "tertiary",
637
- onClick: _[2] || (_[2] = (F) => l.value = !1)
638
- }, null, 8, ["disabled"])
639
- ])
640
- ]),
641
- default: x(() => [
642
- i(Ne, {
643
- class: "w-full",
644
- ref_key: "hasValidationExpose",
645
- ref: E,
646
- modelValue: h(o),
647
- "onUpdate:modelValue": _[0] || (_[0] = (F) => ee(o) ? o.value = F : null),
648
- mode: V.mode,
649
- disabled: s.value,
650
- "onClick:submit": _[1] || (_[1] = (F) => $())
651
- }, null, 8, ["modelValue", "mode", "disabled"])
652
- ]),
653
- _: 1
654
- }, 8, ["model-value", "header"]);
655
- };
656
- }
657
- }), qe = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, He = { class: "px-8 flex items-center xs:gap-0 xs:flex-col-reverse sm:gap-0 sm:flex-col-reverse" }, We = { class: "flex-1 w-full" }, Ke = { class: "flex flex-col py-8" }, Ye = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, je = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, rn = /* @__PURE__ */ J({
658
- __name: "IngredientsView",
659
- setup(C) {
660
- const y = Q(), p = d(() => y.skus), t = ke(), {
661
- createIngredient: l,
662
- updateIngredient: o,
663
- deleteIngredient: m,
664
- ingredientDialogProps: w,
665
- ingredientViewLoading: E
666
- } = Te(), { columnDefs: s } = Be({ updateIngredient: o, deleteIngredient: m });
667
- function v(M) {
668
- M === "add" && l();
669
- }
670
- const u = B(""), c = d(() => E.value), { breakpoints: $ } = Ie(), V = d(() => $.value.xs || $.value.sm ? 10 : 20), _ = Ae();
671
- return (M, S) => {
672
- const F = b("FmTableToolbar"), q = b("FmTable");
673
- return k(), R(De, {
674
- title: "Ingredient",
675
- actions: [{ label: "Add ingredient", value: "add", isPrimary: !0, prependIcon: "add" }],
676
- "onClick:action": v
677
- }, {
678
- default: x(() => [
679
- D("div", qe, [
680
- D("div", He, [
681
- D("div", We, [
682
- i(F, {
683
- searchable: "",
684
- "search-model": u.value,
685
- "onUpdate:searchModel": S[0] || (S[0] = (T) => u.value = T)
686
- }, null, 8, ["search-model"])
687
- ])
688
- ]),
689
- i(q, {
690
- style: _e(h(_).tableHeight),
691
- "column-defs": h(s),
692
- "row-data": p.value,
693
- "search-value": u.value,
694
- loading: !h(t)._currentLocation || c.value,
695
- onRowClick: S[1] || (S[1] = (T) => h(o)(T.original)),
696
- "page-size": V.value
697
- }, {
698
- "list-row": x((T) => [
699
- i(Me, {
700
- row: T,
701
- onRowClick: h(o)
702
- }, {
703
- default: x((P) => {
704
- var H, W, K, O, e, n, a, r, f, g;
705
- return [
706
- D("div", Ke, [
707
- D("div", Ye, [
708
- i(h(oe), {
709
- render: (K = (W = (H = P.code) == null ? void 0 : H.column) == null ? void 0 : W.columnDef) == null ? void 0 : K.cell,
710
- props: (e = (O = P.code) == null ? void 0 : O.getContext) == null ? void 0 : e.call(O)
711
- }, null, 8, ["render", "props"])
712
- ]),
713
- D("div", je, [
714
- i(h(oe), {
715
- render: (r = (a = (n = P.name) == null ? void 0 : n.column) == null ? void 0 : a.columnDef) == null ? void 0 : r.cell,
716
- props: (g = (f = P.name) == null ? void 0 : f.getContext) == null ? void 0 : g.call(f)
717
- }, null, 8, ["render", "props"])
718
- ])
719
- ])
720
- ];
721
- }),
722
- _: 2
723
- }, 1032, ["row", "onRowClick"])
724
- ]),
725
- _: 1
726
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
727
- ]),
728
- (k(), R(ye, { to: "body" }, [
729
- i(Ge, Fe(he(h(w))), null, 16)
730
- ]))
731
- ]),
732
- _: 1
733
- });
734
- };
735
- }
736
- });
737
- export {
738
- rn as default
739
- };