@feedmepos/mf-inventory-portal 1.0.12-dev.1 → 1.0.12-dev.2
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.
- package/dist/{App-Cicsptfk.js → App-Byn7tHre.js} +37 -37
- package/dist/{ApprovalView-oRqJ-z0x.js → ApprovalView-C_B6Ud1v.js} +2 -2
- package/dist/{BindingsDialog-BOIsLkdn.js → BindingsDialog-DpM-rpFr.js} +2 -2
- package/dist/{BindingsPicker-Co4UtTLT.js → BindingsPicker-CCKlnHQ8.js} +1 -1
- package/dist/{BindingsTable-DLsppTGt.js → BindingsTable-m3Z7ozrU.js} +1 -1
- package/dist/{ClosingDraftView-CQ0s4iL_.js → ClosingDraftView-Dm8eo0Vz.js} +2 -2
- package/dist/{ClosingTemplateView-B0q2VTDz.js → ClosingTemplateView-C0kKeAKu.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-BVR-8Wuk.js → DeliveryOrderPrintPreview-BiFBV9NI.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DozsNol6.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-bBhR9dWX.js} +3 -3
- package/dist/{FmMultiselectDialog-cp5Eu4lS.js → FmMultiselectDialog-Cg-plZjp.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BLqmn5u9.js → FmUnitInput.vue_vue_type_script_setup_true_lang-B0DdbgR8.js} +1 -1
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Di-N8CUr.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DNkyBsYX.js} +1 -1
- package/dist/IngredientGroupView-oRzzQrxP.js +8779 -0
- package/dist/{IngredientsView-Bqs24FKe.js → IngredientsView-UYr-9ckX.js} +5 -5
- package/dist/{IntegrationView-B5UglyZs.js → IntegrationView-Nb0j9Myn.js} +5 -5
- package/dist/{InventoryBindingForm-CNHEIU--.js → InventoryBindingForm-CfV17fI5.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CXs6G1yw.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-LZRjwQEB.js} +4 -4
- package/dist/{InventoryBindingSummary-Y_t0JvQf.js → InventoryBindingSummary-B2rDd4KS.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BtpbycMa.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-O3oG04C3.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-Bv_4XhnW.js → PremiumBadge.vue_vue_type_script_setup_true_lang-C9P0w1Yo.js} +1 -1
- package/dist/{PublishView-CwZCF0a5.js → PublishView-lKWxaVGi.js} +2 -2
- package/dist/{PurchaseOrderPrintPreview-CSYvISrP.js → PurchaseOrderPrintPreview-C3pE7pKw.js} +1 -1
- package/dist/{ReceiveRequestView-CTuh_NZ_.js → ReceiveRequestView-Cntcdt7e.js} +11 -11
- package/dist/RecipeView-bzu1U9Gq.js +620 -0
- package/dist/{StockView-Cg1jE2Zw.js → StockView-R5AjS5ZP.js} +8 -8
- package/dist/{SupplierView-EknM6vks.js → SupplierView-BP_67SXq.js} +4 -4
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Dkk3gKIY.js → TransferDetails.vue_vue_type_script_setup_true_lang-BvgmrVSD.js} +6 -6
- package/dist/{TransferTemplateView-Ciwc17PA.js → TransferTemplateView-BJLK64th.js} +7 -7
- package/dist/{UnitView-B2mpu5IV.js → UnitView--wdY45MB.js} +3 -3
- package/dist/{WarehouseView-DpZzsLzE.js → WarehouseView-iSOrBTnq.js} +1 -1
- package/dist/api/inventory.d.ts +0 -66
- package/dist/{app-C_s8CpzV.js → app-kveWTQjE.js} +3154 -3245
- package/dist/app.js +1 -1
- package/dist/{array-hChJVZLE.js → array-Ca8T3f_G.js} +7 -6
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +0 -22
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +0 -22
- package/dist/{decimal-D6jyMGK9.js → decimal-DY8OyZOE.js} +1 -1
- package/dist/{feature-BGozj4cq.js → feature-C0TlUzuT.js} +2 -2
- package/dist/{format-unit-display-WWMXXaOF.js → format-unit-display-Q_edRr_A.js} +2 -2
- package/dist/{index-ChkhtUlV.js → index-B-ZEfBgj.js} +2 -2
- package/dist/{index-D1dhDInI.js → index-BMpOpRCf.js} +1 -1
- package/dist/{stock-5qJE0ApW.js → stock-C40mVN4W.js} +1 -1
- package/dist/stores/inventory.d.ts +0 -88
- package/dist/{supplier-CxTBVGVa.js → supplier-DvZ8SCGg.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-Cxn_cX8W.js → use-ingredient-select-dialog-CeK0rLZb.js} +1 -1
- package/dist/{use-inventory-binding-dialog--nqAQCSl.js → use-inventory-binding-dialog-BV-rxXkP.js} +1 -1
- package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +0 -44
- package/dist/{vue-i18n-DDOrxu8s.js → vue-i18n-CYoGKQoJ.js} +201 -201
- package/package.json +3 -3
- package/dist/IngredientGroupView-DbkNqoE2.js +0 -898
- package/dist/RecipeView-OMZcKOQh.js +0 -767
- package/dist/app-YTo31ukE.js +0 -7888
- package/dist/views/recipe/components/recipe-override-form-field/RecipeOverrideFormField.vue.d.ts +0 -61
- package/dist/views/recipe/composables/use-recipe-overrides-form-field.d.ts +0 -10
|
@@ -1,767 +0,0 @@
|
|
|
1
|
-
import { defineComponent as z, ref as E, onMounted as pe, resolveComponent as x, openBlock as h, createElementBlock as D, Fragment as le, createElementVNode as g, toDisplayString as re, createVNode as c, createCommentVNode as Q, computed as S, unref as u, withCtx as B, watch as ve, createBlock as N, renderList as fe, isRef as ee, normalizeClass as ye, normalizeStyle as be, Teleport as ge, normalizeProps as _e, guardReactiveProps as Ve } from "vue";
|
|
2
|
-
import { a as $, d as C, e as X, S as Re, f as we, D as te, h as G, i as H, F as ne, G as xe, l as ie, A as de, U as Fe, p as oe, q as he, s as ke, r as Ce, u as Se, z as Ee, _ as Ie, B as De, C as $e, E as ae } from "./app-C_s8CpzV.js";
|
|
3
|
-
import { useDialog as Ae, useSnackbar as ue, useProxiedModel as se, useBreakpoints as Be } from "@feedmepos/ui-library";
|
|
4
|
-
import { i as Ue, _ as Pe } from "./is-linked-ingredient-error-fJ2TJb3z.js";
|
|
5
|
-
import { _ as ce } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-Di-N8CUr.js";
|
|
6
|
-
import { defineStore as Te, storeToRefs as Me } from "pinia";
|
|
7
|
-
import { useI18n as K } from "@feedmepos/mf-common";
|
|
8
|
-
import { _ as me } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-CXs6G1yw.js";
|
|
9
|
-
import { _ as Oe } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
|
|
10
|
-
import { b as Le } from "./app-YTo31ukE.js";
|
|
11
|
-
const Ne = {
|
|
12
|
-
key: 0,
|
|
13
|
-
class: "flex flex-col items-center w-full h-full gap-24"
|
|
14
|
-
}, ze = { key: 1 }, qe = { key: 0 }, Ye = /* @__PURE__ */ z({
|
|
15
|
-
__name: "DeleteDialog",
|
|
16
|
-
props: {
|
|
17
|
-
type: {},
|
|
18
|
-
data: {},
|
|
19
|
-
message: {},
|
|
20
|
-
bindedItems: {}
|
|
21
|
-
},
|
|
22
|
-
setup(p) {
|
|
23
|
-
const v = p, b = E(v.bindedItems || []), o = E(!1);
|
|
24
|
-
pe(() => {
|
|
25
|
-
n();
|
|
26
|
-
});
|
|
27
|
-
async function n() {
|
|
28
|
-
var a, d;
|
|
29
|
-
!o.value && ((a = v.data) != null && a._id) && (o.value = !0, b.value = await $().getAffectedMenu((d = v.data) == null ? void 0 : d._id), o.value = !1);
|
|
30
|
-
}
|
|
31
|
-
return (a, d) => {
|
|
32
|
-
const f = x("FmSpacer"), y = x("FmCircularProgress");
|
|
33
|
-
return h(), D(le, null, [
|
|
34
|
-
g("p", null, re(a.message), 1),
|
|
35
|
-
o.value ? (h(), D("div", Ne, [
|
|
36
|
-
c(f),
|
|
37
|
-
g("div", null, [
|
|
38
|
-
c(y, { size: "xl" })
|
|
39
|
-
]),
|
|
40
|
-
d[0] || (d[0] = g("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
41
|
-
c(f)
|
|
42
|
-
])) : (h(), D("div", ze, [
|
|
43
|
-
d[2] || (d[2] = g("br", null, null, -1)),
|
|
44
|
-
b.value.length > 0 ? (h(), D("div", qe, [
|
|
45
|
-
d[1] || (d[1] = g("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
|
|
46
|
-
c(ce, {
|
|
47
|
-
name: "Menu",
|
|
48
|
-
bindings: b.value
|
|
49
|
-
}, null, 8, ["bindings"])
|
|
50
|
-
])) : Q("", !0)
|
|
51
|
-
]))
|
|
52
|
-
], 64);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}), W = Te("recipeForm", function() {
|
|
56
|
-
const v = Ae(), b = ue(), o = $(), n = E(!1), a = E();
|
|
57
|
-
function d() {
|
|
58
|
-
const t = {
|
|
59
|
-
recipe: {},
|
|
60
|
-
mode: C.CREATE,
|
|
61
|
-
show: !0,
|
|
62
|
-
"onUpdate:show"(l) {
|
|
63
|
-
a.value.show = l;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
a.value = t;
|
|
67
|
-
}
|
|
68
|
-
async function f(t) {
|
|
69
|
-
const l = {
|
|
70
|
-
recipe: X(t),
|
|
71
|
-
mode: C.UPDATE,
|
|
72
|
-
show: !0,
|
|
73
|
-
"onUpdate:show"(i) {
|
|
74
|
-
a.value.show = i;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
a.value = l;
|
|
78
|
-
}
|
|
79
|
-
async function y(t) {
|
|
80
|
-
n.value = !0;
|
|
81
|
-
try {
|
|
82
|
-
await o.deleteRecipe(t), b.open({
|
|
83
|
-
title: "Success",
|
|
84
|
-
message: `Deleted ${t.name}`,
|
|
85
|
-
type: "success"
|
|
86
|
-
});
|
|
87
|
-
} catch (l) {
|
|
88
|
-
l instanceof Re && Ue(l) ? v.open({
|
|
89
|
-
title: "Cannot delete recipe",
|
|
90
|
-
contentComponent: Pe,
|
|
91
|
-
contentComponentProps: {
|
|
92
|
-
subject: (t == null ? void 0 : t.name) ?? "",
|
|
93
|
-
items: l.errorResponse.message
|
|
94
|
-
},
|
|
95
|
-
secondaryActions: {
|
|
96
|
-
text: "Close",
|
|
97
|
-
close: !0
|
|
98
|
-
}
|
|
99
|
-
}) : console.log("unable to delete recipe", l), b.open({
|
|
100
|
-
title: `Cannot delete ${t == null ? void 0 : t.name}`,
|
|
101
|
-
message: "Please try again.",
|
|
102
|
-
type: "error"
|
|
103
|
-
}), console.error("failed to delete recipe", l);
|
|
104
|
-
} finally {
|
|
105
|
-
n.value = !1;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
function m(t) {
|
|
109
|
-
v.open({
|
|
110
|
-
title: `Delete ${(t == null ? void 0 : t.name) ?? "recipe"}?`,
|
|
111
|
-
closeButton: !1,
|
|
112
|
-
primaryActions: {
|
|
113
|
-
text: "Delete",
|
|
114
|
-
close: !0,
|
|
115
|
-
variant: "destructive"
|
|
116
|
-
},
|
|
117
|
-
secondaryActions: {
|
|
118
|
-
text: "Cancel",
|
|
119
|
-
close: !0
|
|
120
|
-
},
|
|
121
|
-
contentComponent: Ye,
|
|
122
|
-
contentComponentProps: {
|
|
123
|
-
type: "menu",
|
|
124
|
-
data: t,
|
|
125
|
-
message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
|
|
126
|
-
}
|
|
127
|
-
}).onPrimary(() => y(t));
|
|
128
|
-
}
|
|
129
|
-
return {
|
|
130
|
-
createRecipe: d,
|
|
131
|
-
updateRecipe: f,
|
|
132
|
-
deleteRecipe: m,
|
|
133
|
-
recipeDialogProps: a,
|
|
134
|
-
recipeViewLoading: n
|
|
135
|
-
};
|
|
136
|
-
});
|
|
137
|
-
function je() {
|
|
138
|
-
const { updateRecipe: p, deleteRecipe: v } = W(), b = $(), { t: o } = K();
|
|
139
|
-
async function n(y, m) {
|
|
140
|
-
const t = X(m);
|
|
141
|
-
if (y === G.Edit) {
|
|
142
|
-
await p(t);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
if (y === G.Delete) {
|
|
146
|
-
await v(t);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function a(y, m) {
|
|
151
|
-
const t = y.filter((i) => i.type === ne.enum.SKU), l = y.filter((i) => i.type === ne.enum.RECIPE);
|
|
152
|
-
return [
|
|
153
|
-
...t.map((i) => ({ ...i, recipeIds: [...m] })),
|
|
154
|
-
...l.filter((i) => b.recipeById[i.id] && !m.has(i.id)).flatMap(
|
|
155
|
-
(i) => a(b.recipeById[i.id].contains, /* @__PURE__ */ new Set([...m, i.id]))
|
|
156
|
-
)
|
|
157
|
-
];
|
|
158
|
-
}
|
|
159
|
-
const d = [
|
|
160
|
-
{
|
|
161
|
-
accessorKey: "recipe",
|
|
162
|
-
header: () => o("inventory.recipe.name"),
|
|
163
|
-
size: 400
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
accessorKey: "ingredients",
|
|
167
|
-
header: () => o("inventory.recipe.ingredients"),
|
|
168
|
-
size: "auto"
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
id: "action",
|
|
172
|
-
header: "",
|
|
173
|
-
cell(y) {
|
|
174
|
-
return we(
|
|
175
|
-
[te[G.Edit], te[G.Delete]],
|
|
176
|
-
(m) => {
|
|
177
|
-
n(m, y.row.original.original);
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
},
|
|
181
|
-
enableSorting: !1,
|
|
182
|
-
size: 40,
|
|
183
|
-
meta: {
|
|
184
|
-
cellClass: "",
|
|
185
|
-
headerClass: ""
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
];
|
|
189
|
-
function f(y) {
|
|
190
|
-
const m = $();
|
|
191
|
-
return y.map((t) => ({
|
|
192
|
-
recipe: t.name,
|
|
193
|
-
ingredients: a(t.contains, /* @__PURE__ */ new Set([t._id])).map((l) => {
|
|
194
|
-
var V, w, r, _, F;
|
|
195
|
-
const i = m.skuById[l.id];
|
|
196
|
-
return i ? l.recipeIds.slice(1).length ? `(linked recipe ${(V = m.recipeById[l.recipeIds.at(-1) ?? ""]) == null ? void 0 : V.name}) ${i.name} (${H(l.amount)}${((w = l.measurement) == null ? void 0 : w.abbrev) ?? ((r = i == null ? void 0 : i.unit) == null ? void 0 : r.abbrev)})` : `${i.name} (${H(l.amount)}${((_ = l.measurement) == null ? void 0 : _.abbrev) ?? ((F = i == null ? void 0 : i.unit) == null ? void 0 : F.abbrev)})` : null;
|
|
197
|
-
}).filter((l) => l).join(", "),
|
|
198
|
-
original: t
|
|
199
|
-
}));
|
|
200
|
-
}
|
|
201
|
-
return { columnDefs: d, formatRowData: f };
|
|
202
|
-
}
|
|
203
|
-
function Ge(p) {
|
|
204
|
-
return {
|
|
205
|
-
addOverride: () => {
|
|
206
|
-
const n = {
|
|
207
|
-
id: crypto.randomUUID(),
|
|
208
|
-
rule: null,
|
|
209
|
-
name: "",
|
|
210
|
-
override: []
|
|
211
|
-
};
|
|
212
|
-
p.overrides = [...p.overrides, n];
|
|
213
|
-
},
|
|
214
|
-
updateOverride: (n) => {
|
|
215
|
-
n && (p.overrides = p.overrides.map((a) => a.id === n.id ? n : a));
|
|
216
|
-
},
|
|
217
|
-
removeOverride: (n) => {
|
|
218
|
-
p.overrides = p.overrides.filter((a) => a.id !== n.id);
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
const He = { class: "flex flex-col gap-8" }, Ke = { class: "flex flex-col gap-4" }, Je = /* @__PURE__ */ z({
|
|
223
|
-
__name: "RecipeOverrideFormField",
|
|
224
|
-
props: {
|
|
225
|
-
disabled: { type: Boolean },
|
|
226
|
-
modelValue: {},
|
|
227
|
-
recipeId: {}
|
|
228
|
-
},
|
|
229
|
-
setup(p) {
|
|
230
|
-
const v = $(), b = S(() => {
|
|
231
|
-
const n = [
|
|
232
|
-
{
|
|
233
|
-
type: "string",
|
|
234
|
-
key: "Restaurant subsidiary",
|
|
235
|
-
entity: "restaurant",
|
|
236
|
-
values: ["Subsidiary 1", "Subsidiary 2", "Subsidiary 3"]
|
|
237
|
-
}
|
|
238
|
-
], a = {
|
|
239
|
-
type: "string",
|
|
240
|
-
key: "Ingredient code",
|
|
241
|
-
entity: "inventorySku",
|
|
242
|
-
values: v.skus.map((f) => f.code)
|
|
243
|
-
}, d = {
|
|
244
|
-
type: "number",
|
|
245
|
-
key: "Ingredient tracking balance",
|
|
246
|
-
entity: "inventorySku"
|
|
247
|
-
};
|
|
248
|
-
return [...n, a, d];
|
|
249
|
-
}), o = xe("modelValue");
|
|
250
|
-
return (n, a) => {
|
|
251
|
-
const d = x("FmTextField"), f = x("FmLabel"), y = x("FmFormGroup"), m = x("FmCard");
|
|
252
|
-
return h(), D("div", He, [
|
|
253
|
-
c(d, {
|
|
254
|
-
label: "Name",
|
|
255
|
-
modelValue: u(o).name,
|
|
256
|
-
"onUpdate:modelValue": a[0] || (a[0] = (t) => u(o).name = t),
|
|
257
|
-
rule: [u(ie)],
|
|
258
|
-
"label-mark": "required"
|
|
259
|
-
}, null, 8, ["modelValue", "rule"]),
|
|
260
|
-
g("div", Ke, [
|
|
261
|
-
c(f, {
|
|
262
|
-
label: "Rule",
|
|
263
|
-
required: ""
|
|
264
|
-
}),
|
|
265
|
-
c(u(Le), {
|
|
266
|
-
modelValue: u(o).rule,
|
|
267
|
-
"onUpdate:modelValue": a[1] || (a[1] = (t) => u(o).rule = t),
|
|
268
|
-
attributes: b.value
|
|
269
|
-
}, null, 8, ["modelValue", "attributes"])
|
|
270
|
-
]),
|
|
271
|
-
c(y, {
|
|
272
|
-
"model-value": u(o).rule,
|
|
273
|
-
rules: [
|
|
274
|
-
(t) => {
|
|
275
|
-
var l;
|
|
276
|
-
return !!((l = t == null ? void 0 : t.rules) != null && l.length) || "At least one rule is required";
|
|
277
|
-
}
|
|
278
|
-
]
|
|
279
|
-
}, null, 8, ["model-value", "rules"]),
|
|
280
|
-
c(m, {
|
|
281
|
-
variant: "outlined",
|
|
282
|
-
class: "p-16"
|
|
283
|
-
}, {
|
|
284
|
-
default: B(() => [
|
|
285
|
-
c(me, {
|
|
286
|
-
id: n.recipeId,
|
|
287
|
-
disabled: n.disabled,
|
|
288
|
-
"model-value": u(o).override,
|
|
289
|
-
"onUpdate:modelValue": a[2] || (a[2] = (t) => u(o).override = t),
|
|
290
|
-
rules: [u(de)(1)]
|
|
291
|
-
}, null, 8, ["id", "disabled", "model-value", "rules"])
|
|
292
|
-
]),
|
|
293
|
-
_: 1
|
|
294
|
-
})
|
|
295
|
-
]);
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
}), Qe = { class: "flex flex-col gap-40" }, We = {
|
|
299
|
-
key: 0,
|
|
300
|
-
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"
|
|
301
|
-
}, Xe = {
|
|
302
|
-
key: 0,
|
|
303
|
-
class: "flex flex-col items-center w-full h-full gap-24"
|
|
304
|
-
}, Ze = { key: 1 }, et = { class: "mt-32" }, tt = { class: "flex flex-col gap-16" }, nt = { class: "flex items-center" }, ot = { class: "flex-1 fm-typo-en-body-lg-600" }, at = { class: "mt-32" }, st = /* @__PURE__ */ z({
|
|
305
|
-
__name: "RecipeForm",
|
|
306
|
-
props: {
|
|
307
|
-
mode: {},
|
|
308
|
-
modelValue: {},
|
|
309
|
-
disabled: { type: Boolean }
|
|
310
|
-
},
|
|
311
|
-
emits: ["update:modelValue", "click:submit"],
|
|
312
|
-
setup(p, { expose: v, emit: b }) {
|
|
313
|
-
var A;
|
|
314
|
-
const o = p, n = b, { t: a } = K(), d = S({
|
|
315
|
-
get() {
|
|
316
|
-
var e;
|
|
317
|
-
return ((e = o.modelValue) == null ? void 0 : e.name) ?? "";
|
|
318
|
-
},
|
|
319
|
-
set(e) {
|
|
320
|
-
const s = o.modelValue ?? {};
|
|
321
|
-
s.name = e, n("update:modelValue", s);
|
|
322
|
-
}
|
|
323
|
-
}), f = S({
|
|
324
|
-
get() {
|
|
325
|
-
var e;
|
|
326
|
-
return ((e = o.modelValue) == null ? void 0 : e.contains) ?? [];
|
|
327
|
-
},
|
|
328
|
-
set(e) {
|
|
329
|
-
const s = o.modelValue ?? {};
|
|
330
|
-
s.contains = e, n("update:modelValue", s);
|
|
331
|
-
}
|
|
332
|
-
}), y = S({
|
|
333
|
-
get() {
|
|
334
|
-
var e;
|
|
335
|
-
return ((e = o.modelValue) == null ? void 0 : e.customAttributes) ?? {};
|
|
336
|
-
},
|
|
337
|
-
set(e) {
|
|
338
|
-
const s = o.modelValue ? {
|
|
339
|
-
...o.modelValue
|
|
340
|
-
} : {};
|
|
341
|
-
s.customAttributes = e, n("update:modelValue", s);
|
|
342
|
-
}
|
|
343
|
-
}), m = S({
|
|
344
|
-
get() {
|
|
345
|
-
var e;
|
|
346
|
-
return ((e = o.modelValue) == null ? void 0 : e.overrides) ?? [];
|
|
347
|
-
},
|
|
348
|
-
set(e) {
|
|
349
|
-
const s = o.modelValue ? {
|
|
350
|
-
...o.modelValue
|
|
351
|
-
} : {};
|
|
352
|
-
s.overrides = e, n("update:modelValue", s);
|
|
353
|
-
}
|
|
354
|
-
}), { addOverride: t, updateOverride: l, removeOverride: i } = Ge({
|
|
355
|
-
get overrides() {
|
|
356
|
-
return m.value;
|
|
357
|
-
},
|
|
358
|
-
set overrides(e) {
|
|
359
|
-
m.value = e;
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
function V() {
|
|
363
|
-
n("click:submit");
|
|
364
|
-
}
|
|
365
|
-
const w = E();
|
|
366
|
-
v({
|
|
367
|
-
validateInputs: () => {
|
|
368
|
-
var e, s;
|
|
369
|
-
(s = (e = w.value) == null ? void 0 : e.validateInputs) == null || s.call(e);
|
|
370
|
-
},
|
|
371
|
-
resetInputsValidation: () => {
|
|
372
|
-
var e, s;
|
|
373
|
-
(s = (e = w.value) == null ? void 0 : e.resetInputsValidation) == null || s.call(e);
|
|
374
|
-
},
|
|
375
|
-
resetInputs: () => {
|
|
376
|
-
var e, s;
|
|
377
|
-
(s = (e = w.value) == null ? void 0 : e.resetInputs) == null || s.call(e);
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
const r = $(), _ = E([]), F = E(!1), k = E(!1);
|
|
381
|
-
ve(F, async (e) => {
|
|
382
|
-
I(e);
|
|
383
|
-
});
|
|
384
|
-
async function I(e) {
|
|
385
|
-
var s, U;
|
|
386
|
-
e && !k.value && ((s = o.modelValue) != null && s._id) && (k.value = !0, _.value = await r.getAffectedMenu((U = o.modelValue) == null ? void 0 : U._id).delayed(500), k.value = !1);
|
|
387
|
-
}
|
|
388
|
-
const P = S(
|
|
389
|
-
() => r.recipes.map((e) => ({ label: e.name, value: e.name }))
|
|
390
|
-
), J = E((A = o.modelValue) == null ? void 0 : A.name);
|
|
391
|
-
return (e, s) => {
|
|
392
|
-
const U = x("FmTextField"), q = x("FmCard"), T = x("FmSwitch"), O = x("FmSpacer"), Y = x("FmCircularProgress"), L = x("FmButton"), j = x("FmForm");
|
|
393
|
-
return h(), N(j, {
|
|
394
|
-
ref_key: "formRef",
|
|
395
|
-
ref: w,
|
|
396
|
-
onValidationSuccess: V
|
|
397
|
-
}, {
|
|
398
|
-
default: B(() => [
|
|
399
|
-
g("div", Qe, [
|
|
400
|
-
c(U, {
|
|
401
|
-
disabled: e.disabled,
|
|
402
|
-
label: u(a)("inventory.recipe.name"),
|
|
403
|
-
"model-value": d.value,
|
|
404
|
-
"onUpdate:modelValue": s[0] || (s[0] = (R) => d.value = R),
|
|
405
|
-
rules: [
|
|
406
|
-
u(ie)(),
|
|
407
|
-
u(Fe)(P.value, J.value, (R) => `[${R.value}] already exists`)
|
|
408
|
-
],
|
|
409
|
-
"label-mark": "required"
|
|
410
|
-
}, null, 8, ["disabled", "label", "model-value", "rules"]),
|
|
411
|
-
c(q, {
|
|
412
|
-
variant: "outlined",
|
|
413
|
-
class: "p-16"
|
|
414
|
-
}, {
|
|
415
|
-
default: B(() => {
|
|
416
|
-
var R;
|
|
417
|
-
return [
|
|
418
|
-
c(me, {
|
|
419
|
-
id: (R = e.modelValue) == null ? void 0 : R._id,
|
|
420
|
-
disabled: e.disabled,
|
|
421
|
-
"model-value": f.value,
|
|
422
|
-
"onUpdate:modelValue": s[1] || (s[1] = (M) => f.value = M),
|
|
423
|
-
rules: [u(de)(1)]
|
|
424
|
-
}, null, 8, ["id", "disabled", "model-value", "rules"])
|
|
425
|
-
];
|
|
426
|
-
}),
|
|
427
|
-
_: 1
|
|
428
|
-
})
|
|
429
|
-
]),
|
|
430
|
-
e.mode !== u(C).CREATE ? (h(), D("div", We, [
|
|
431
|
-
c(T, {
|
|
432
|
-
label: "Show binded items",
|
|
433
|
-
modelValue: F.value,
|
|
434
|
-
"onUpdate:modelValue": s[2] || (s[2] = (R) => F.value = R),
|
|
435
|
-
"label-placement": "right",
|
|
436
|
-
disabled: k.value
|
|
437
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
438
|
-
k.value ? (h(), D("div", Xe, [
|
|
439
|
-
c(O),
|
|
440
|
-
g("div", null, [
|
|
441
|
-
c(Y, { size: "xl" })
|
|
442
|
-
]),
|
|
443
|
-
s[4] || (s[4] = g("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
444
|
-
c(O)
|
|
445
|
-
])) : F.value && _.value.length ? (h(), D("div", Ze, [
|
|
446
|
-
c(ce, {
|
|
447
|
-
name: "Menu",
|
|
448
|
-
bindings: _.value
|
|
449
|
-
}, null, 8, ["bindings"])
|
|
450
|
-
])) : Q("", !0)
|
|
451
|
-
])) : Q("", !0),
|
|
452
|
-
g("div", et, [
|
|
453
|
-
g("div", tt, [
|
|
454
|
-
s[5] || (s[5] = g("div", { class: "flex flex-col gap-4" }, [
|
|
455
|
-
g("div", { class: "fm-typo-en-title-sm-600" }, "Overrides"),
|
|
456
|
-
g("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Overrides allow you to set different deduction based on certain requirements. ")
|
|
457
|
-
], -1)),
|
|
458
|
-
(h(!0), D(le, null, fe(m.value, (R, M) => {
|
|
459
|
-
var Z;
|
|
460
|
-
return h(), D("div", {
|
|
461
|
-
key: R.id,
|
|
462
|
-
class: "flex flex-col gap-12"
|
|
463
|
-
}, [
|
|
464
|
-
g("div", nt, [
|
|
465
|
-
g("div", ot, "Override " + re(M + 1), 1),
|
|
466
|
-
c(L, {
|
|
467
|
-
variant: "tertiary",
|
|
468
|
-
icon: "delete",
|
|
469
|
-
onClick: (pt) => u(i)(R)
|
|
470
|
-
}, null, 8, ["onClick"])
|
|
471
|
-
]),
|
|
472
|
-
g("div", null, [
|
|
473
|
-
c(Je, {
|
|
474
|
-
recipeId: ((Z = e.modelValue) == null ? void 0 : Z._id) ?? "",
|
|
475
|
-
"model-value": R,
|
|
476
|
-
"onUpdate:modelValue": u(l),
|
|
477
|
-
disabled: e.disabled
|
|
478
|
-
}, null, 8, ["recipeId", "model-value", "onUpdate:modelValue", "disabled"])
|
|
479
|
-
])
|
|
480
|
-
]);
|
|
481
|
-
}), 128)),
|
|
482
|
-
g("div", null, [
|
|
483
|
-
c(L, {
|
|
484
|
-
variant: "plain",
|
|
485
|
-
icon: "add",
|
|
486
|
-
label: "Add",
|
|
487
|
-
onClick: u(t)
|
|
488
|
-
}, null, 8, ["onClick"])
|
|
489
|
-
])
|
|
490
|
-
])
|
|
491
|
-
]),
|
|
492
|
-
g("div", at, [
|
|
493
|
-
c(Oe, {
|
|
494
|
-
entity: "inventoryRecipe",
|
|
495
|
-
modelValue: y.value,
|
|
496
|
-
"onUpdate:modelValue": s[3] || (s[3] = (R) => y.value = R)
|
|
497
|
-
}, null, 8, ["modelValue"])
|
|
498
|
-
])
|
|
499
|
-
]),
|
|
500
|
-
_: 1
|
|
501
|
-
}, 512);
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
}), lt = { class: "flex gap-4" }, rt = /* @__PURE__ */ z({
|
|
505
|
-
__name: "RecipeDialog",
|
|
506
|
-
props: {
|
|
507
|
-
show: { type: Boolean },
|
|
508
|
-
recipe: {},
|
|
509
|
-
mode: { default: C.READ }
|
|
510
|
-
},
|
|
511
|
-
emits: ["update:show"],
|
|
512
|
-
setup(p) {
|
|
513
|
-
const v = p, b = $(), o = ue(), { t: n } = K(), a = se(v, "show"), d = se(v, "recipe"), f = S(() => {
|
|
514
|
-
switch (v.mode) {
|
|
515
|
-
case C.READ:
|
|
516
|
-
return "";
|
|
517
|
-
case C.UPDATE:
|
|
518
|
-
return n("inventory.recipe.update.title");
|
|
519
|
-
case C.CREATE:
|
|
520
|
-
return n("inventory.recipe.create.title");
|
|
521
|
-
}
|
|
522
|
-
return "";
|
|
523
|
-
}), y = S(() => {
|
|
524
|
-
switch (v.mode) {
|
|
525
|
-
case C.READ:
|
|
526
|
-
return "";
|
|
527
|
-
case C.UPDATE:
|
|
528
|
-
return n("common.save");
|
|
529
|
-
case C.CREATE:
|
|
530
|
-
return n("common.add");
|
|
531
|
-
}
|
|
532
|
-
return "";
|
|
533
|
-
}), m = E(), t = E(!1);
|
|
534
|
-
async function l() {
|
|
535
|
-
t.value = !0;
|
|
536
|
-
try {
|
|
537
|
-
const r = X(d.value);
|
|
538
|
-
r.precision ?? (r.precision = 0), r.measurements ?? (r.measurements = []), await b.createRecipe(r), a.value = !1, o.open({
|
|
539
|
-
title: n("inventory.common.success"),
|
|
540
|
-
message: n("inventory.recipe.create.success", { name: d.value.name }),
|
|
541
|
-
type: "success"
|
|
542
|
-
});
|
|
543
|
-
} catch (r) {
|
|
544
|
-
r instanceof oe || o.open({
|
|
545
|
-
title: n("inventory.recipe.create.error.title"),
|
|
546
|
-
message: n("inventory.recipe.create.error.message"),
|
|
547
|
-
type: "error"
|
|
548
|
-
});
|
|
549
|
-
} finally {
|
|
550
|
-
t.value = !1;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
async function i() {
|
|
554
|
-
t.value = !0;
|
|
555
|
-
try {
|
|
556
|
-
await b.updateRecipe(d.value), a.value = !1, o.open({
|
|
557
|
-
title: n("inventory.common.success"),
|
|
558
|
-
message: n("inventory.recipe.update.success", { name: d.value.name }),
|
|
559
|
-
type: "success"
|
|
560
|
-
});
|
|
561
|
-
} catch (r) {
|
|
562
|
-
r instanceof oe || o.open({
|
|
563
|
-
title: n("inventory.recipe.update.error.title"),
|
|
564
|
-
message: n("inventory.recipe.update.error.message"),
|
|
565
|
-
type: "error"
|
|
566
|
-
});
|
|
567
|
-
} finally {
|
|
568
|
-
t.value = !1;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
function V() {
|
|
572
|
-
var r, _;
|
|
573
|
-
(_ = (r = m.value) == null ? void 0 : r.validateInputs) == null || _.call(r);
|
|
574
|
-
}
|
|
575
|
-
function w() {
|
|
576
|
-
switch (v.mode) {
|
|
577
|
-
case C.READ:
|
|
578
|
-
return;
|
|
579
|
-
case C.UPDATE:
|
|
580
|
-
return i();
|
|
581
|
-
case C.CREATE:
|
|
582
|
-
return l();
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
return (r, _) => {
|
|
586
|
-
const F = x("FmButton"), k = x("FmSideSheet");
|
|
587
|
-
return h(), N(k, {
|
|
588
|
-
"model-value": u(a),
|
|
589
|
-
"onUpdate:modelValue": _[3] || (_[3] = (I) => ee(a) ? a.value = I : null),
|
|
590
|
-
header: f.value,
|
|
591
|
-
"close-button": "",
|
|
592
|
-
"dismiss-away": "",
|
|
593
|
-
"max-width": 500
|
|
594
|
-
}, {
|
|
595
|
-
"side-sheet-footer": B(() => [
|
|
596
|
-
g("div", lt, [
|
|
597
|
-
c(F, {
|
|
598
|
-
loading: t.value,
|
|
599
|
-
label: y.value,
|
|
600
|
-
onClick: V
|
|
601
|
-
}, null, 8, ["loading", "label"]),
|
|
602
|
-
c(F, {
|
|
603
|
-
disabled: t.value,
|
|
604
|
-
label: u(n)("common.close"),
|
|
605
|
-
variant: "tertiary",
|
|
606
|
-
onClick: _[2] || (_[2] = (I) => a.value = !1)
|
|
607
|
-
}, null, 8, ["disabled", "label"])
|
|
608
|
-
])
|
|
609
|
-
]),
|
|
610
|
-
default: B(() => [
|
|
611
|
-
c(st, {
|
|
612
|
-
class: "w-full",
|
|
613
|
-
ref_key: "hasValidationExpose",
|
|
614
|
-
ref: m,
|
|
615
|
-
modelValue: u(d),
|
|
616
|
-
"onUpdate:modelValue": _[0] || (_[0] = (I) => ee(d) ? d.value = I : null),
|
|
617
|
-
mode: r.mode,
|
|
618
|
-
disabled: t.value,
|
|
619
|
-
"onClick:submit": _[1] || (_[1] = (I) => w())
|
|
620
|
-
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
621
|
-
]),
|
|
622
|
-
_: 1
|
|
623
|
-
}, 8, ["model-value", "header"]);
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
function it(p) {
|
|
628
|
-
return !p || Object.keys(p).length === 0 ? "" : Object.entries(p).map(([v, b]) => `${v}: ${b}`).join(", ");
|
|
629
|
-
}
|
|
630
|
-
function dt() {
|
|
631
|
-
const p = $(), v = p.recipes, b = p.recipeById, o = p.skuById, n = v.flatMap((f, y) => {
|
|
632
|
-
var t;
|
|
633
|
-
const m = it(f.customAttributes);
|
|
634
|
-
if ((t = f.contains) != null && t.length) {
|
|
635
|
-
const l = f.contains.filter((V) => V.type === "RECIPE"), i = f.contains.filter((V) => V.type === "SKU");
|
|
636
|
-
return [
|
|
637
|
-
...y === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
638
|
-
...l.map(
|
|
639
|
-
(V, w) => {
|
|
640
|
-
var r;
|
|
641
|
-
return [
|
|
642
|
-
w === 0 ? f.name : "",
|
|
643
|
-
"RECIPE",
|
|
644
|
-
"",
|
|
645
|
-
(r = b[V.id]) == null ? void 0 : r.name,
|
|
646
|
-
H(V.amount),
|
|
647
|
-
"UNIT",
|
|
648
|
-
w === 0 ? m : ""
|
|
649
|
-
];
|
|
650
|
-
}
|
|
651
|
-
),
|
|
652
|
-
...i.map(
|
|
653
|
-
(V, w) => {
|
|
654
|
-
var r, _, F, k;
|
|
655
|
-
return [
|
|
656
|
-
!l.length && w === 0 ? f.name : "",
|
|
657
|
-
"INGREDIENT",
|
|
658
|
-
(r = o[V.id]) == null ? void 0 : r.code,
|
|
659
|
-
(_ = o[V.id]) == null ? void 0 : _.name,
|
|
660
|
-
H(V.amount),
|
|
661
|
-
V.measurement ? V.measurement.abbrev : (k = (F = o[V.id]) == null ? void 0 : F.unit) == null ? void 0 : k.abbrev,
|
|
662
|
-
!l.length && w === 0 ? m : ""
|
|
663
|
-
];
|
|
664
|
-
}
|
|
665
|
-
)
|
|
666
|
-
];
|
|
667
|
-
}
|
|
668
|
-
return [
|
|
669
|
-
...y === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
670
|
-
[f.name, "No bindings", "", "", "", "", m]
|
|
671
|
-
];
|
|
672
|
-
}), d = he(n, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
|
|
673
|
-
ke(d, `RECIPE_${Ce(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
|
|
674
|
-
}
|
|
675
|
-
const ut = { class: "flex flex-col py-8" }, ct = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ft = /* @__PURE__ */ z({
|
|
676
|
-
__name: "RecipeView",
|
|
677
|
-
setup(p) {
|
|
678
|
-
const v = $(), b = S(() => v.recipes), o = Se(), { createRecipe: n, updateRecipe: a } = W(), { recipeDialogProps: d, recipeViewLoading: f } = Me(W()), { columnDefs: y, formatRowData: m } = je(), t = S(() => m(b.value));
|
|
679
|
-
function l(I) {
|
|
680
|
-
if (I === "add")
|
|
681
|
-
return n();
|
|
682
|
-
if (I === "export")
|
|
683
|
-
return dt();
|
|
684
|
-
}
|
|
685
|
-
const i = E(""), V = S(() => f.value), { breakpoints: w } = Be(), r = S(() => w.value.xs || w.value.sm), _ = S(() => r.value ? 10 : 20), F = Ee(), { t: k } = K();
|
|
686
|
-
return (I, P) => {
|
|
687
|
-
const J = x("FmTable");
|
|
688
|
-
return h(), N(Ie, {
|
|
689
|
-
title: u(k)("inventory.recipe.title"),
|
|
690
|
-
actions: [
|
|
691
|
-
{
|
|
692
|
-
label: u(k)("inventory.recipe.create.title"),
|
|
693
|
-
value: "add",
|
|
694
|
-
isPrimary: !0,
|
|
695
|
-
prependIcon: "add"
|
|
696
|
-
},
|
|
697
|
-
{ label: u(k)("common.export"), value: "export", isPrimary: !1 }
|
|
698
|
-
],
|
|
699
|
-
"onClick:action": l
|
|
700
|
-
}, {
|
|
701
|
-
default: B(() => [
|
|
702
|
-
g("div", {
|
|
703
|
-
class: ye([
|
|
704
|
-
"flex flex-col gap-8 max-h-full",
|
|
705
|
-
{
|
|
706
|
-
"p-0": r.value,
|
|
707
|
-
"px-24 ": !r.value
|
|
708
|
-
}
|
|
709
|
-
])
|
|
710
|
-
}, [
|
|
711
|
-
c(De, {
|
|
712
|
-
searchable: "",
|
|
713
|
-
search: i.value,
|
|
714
|
-
"onUpdate:search": P[0] || (P[0] = (A) => i.value = A)
|
|
715
|
-
}, null, 8, ["search"]),
|
|
716
|
-
(h(), N(J, {
|
|
717
|
-
style: be(u(F).tableHeight),
|
|
718
|
-
"column-defs": u(y),
|
|
719
|
-
"row-data": t.value,
|
|
720
|
-
"search-value": i.value,
|
|
721
|
-
loading: !u(o)._currentLocation || V.value,
|
|
722
|
-
onRowClick: P[1] || (P[1] = (A) => u(a)(A.original.original)),
|
|
723
|
-
key: b.value.length,
|
|
724
|
-
"page-size": _.value
|
|
725
|
-
}, {
|
|
726
|
-
"list-row": B((A) => [
|
|
727
|
-
c($e, {
|
|
728
|
-
row: A,
|
|
729
|
-
onRowClick: (e) => u(a)(e.original)
|
|
730
|
-
}, {
|
|
731
|
-
default: B((e) => {
|
|
732
|
-
var s, U, q, T, O, Y, L, j, R, M;
|
|
733
|
-
return [
|
|
734
|
-
g("div", ut, [
|
|
735
|
-
g("div", ct, [
|
|
736
|
-
c(u(ae), {
|
|
737
|
-
render: (q = (U = (s = e.recipe) == null ? void 0 : s.column) == null ? void 0 : U.columnDef) == null ? void 0 : q.cell,
|
|
738
|
-
props: (O = (T = e.recipe) == null ? void 0 : T.getContext) == null ? void 0 : O.call(T)
|
|
739
|
-
}, null, 8, ["render", "props"])
|
|
740
|
-
]),
|
|
741
|
-
g("div", mt, [
|
|
742
|
-
c(u(ae), {
|
|
743
|
-
render: (j = (L = (Y = e.ingredients) == null ? void 0 : Y.column) == null ? void 0 : L.columnDef) == null ? void 0 : j.cell,
|
|
744
|
-
props: (M = (R = e.ingredients) == null ? void 0 : R.getContext) == null ? void 0 : M.call(R)
|
|
745
|
-
}, null, 8, ["render", "props"])
|
|
746
|
-
])
|
|
747
|
-
])
|
|
748
|
-
];
|
|
749
|
-
}),
|
|
750
|
-
_: 2
|
|
751
|
-
}, 1032, ["row", "onRowClick"])
|
|
752
|
-
]),
|
|
753
|
-
_: 1
|
|
754
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
755
|
-
], 2),
|
|
756
|
-
(h(), N(ge, { to: "body" }, [
|
|
757
|
-
c(rt, _e(Ve(u(d))), null, 16)
|
|
758
|
-
]))
|
|
759
|
-
]),
|
|
760
|
-
_: 1
|
|
761
|
-
}, 8, ["title", "actions"]);
|
|
762
|
-
};
|
|
763
|
-
}
|
|
764
|
-
});
|
|
765
|
-
export {
|
|
766
|
-
Ft as default
|
|
767
|
-
};
|