@feedmepos/mf-inventory-portal 0.0.19-dev.2 → 0.0.19-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.
- package/dist/{ApprovalView-DU7oB2Zk.js → ApprovalView-CT8w22Ga.js} +16 -17
- package/dist/{BindingsDialog-BgfV0G46.js → BindingsDialog-CrB5aA3X.js} +5 -6
- package/dist/{BindingsPicker-tUI5WYBk.js → BindingsPicker-jBTfZ4vJ.js} +6 -7
- package/dist/{BindingsTable-8G-Nc4pC.js → BindingsTable-DaZ3Vxpn.js} +14 -17
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DaHXKF1s.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BWFoHqPU.js} +16 -17
- package/dist/IngredientsView-DOoXPJop.js +1750 -0
- package/dist/IntegrationView-BX1nvP-k.js +1172 -0
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BKlWhMnB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CFConGe4.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-YFcOtdfJ.js → PurchaseOrderPrintPreview-DSXXSlof.js} +13 -13
- package/dist/{ReceiveRequestView-bIXyVVX9.js → ReceiveRequestView-5nXXoRL_.js} +165 -172
- package/dist/RecipeView-DtoX2e_9.js +572 -0
- package/dist/StockView-DTnY8LfO.js +1876 -0
- package/dist/{SupplierView-BiSqTXnz.js → SupplierView-CzWM2tH4.js} +34 -37
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CvbKNb0C.js → TransferDetails.vue_vue_type_script_setup_true_lang-DIc2G2jF.js} +34 -36
- package/dist/UnitView-Bk-OLoW2.js +638 -0
- package/dist/{WarehouseView-B8UxxAL6.js → WarehouseView-C3F_YWO-.js} +49 -50
- package/dist/app-YOcJA0qj.js +66729 -0
- package/dist/app.d.ts +30 -0
- package/dist/app.js +5 -3
- package/dist/{decimal-BtIn4K57.js → decimal-Cr-8e35u.js} +1 -1
- package/dist/{stock-estimate-C4PL0Fcz.js → id-to-date-9OvJMyEX.js} +12 -13
- package/dist/{layout-ITqYtCVu.js → layout-DCDPTIlR.js} +14 -14
- package/dist/router/name.d.ts +1 -2
- package/dist/{supplier-CA0OR3DU.js → supplier-Bos9ifGc.js} +3 -3
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/views/ingredients/composables/use-ingredient-form.d.ts +14 -2
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -2
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +12 -12
- package/dist/views/recipe/composables/use-recipe-form.d.ts +14 -2
- package/dist/views/recipe/composables/use-recipe-table.d.ts +1 -2
- package/dist/views/stock/composables/use-stock-action.d.ts +26 -0
- package/dist/views/stock/composables/use-stock-table.d.ts +1 -8
- package/dist/views/unit/composables/use-unit-form.d.ts +14 -2
- package/dist/views/unit/composables/use-unit-table.d.ts +1 -2
- package/dist/{xlsx-DAVatAlv.js → xlsx-CUjMCYbh.js} +660 -660
- package/dist/{xlsx.util-BsZI2tNE.js → xlsx.util-ByRzckFP.js} +2 -2
- package/package.json +2 -2
- package/dist/FmMultiselectDialog.vue_vue_type_script_setup_true_lang-CxOk5ule.js +0 -143
- package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-D-vJDMKb.js +0 -236
- package/dist/IngredientsView-CAh7D4tL.js +0 -1760
- package/dist/IntegrationView-Bf7yHuS8.js +0 -1166
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-BdVrpR9J.js +0 -277
- package/dist/RecipeView-BD0mvxCg.js +0 -575
- package/dist/StockView-BCq37bGl.js +0 -1865
- package/dist/UnitView-DSdn__9m.js +0 -643
- package/dist/app-RVyC2D4O.js +0 -43892
- package/dist/date2-C2PfOqbB.js +0 -95
- package/dist/dayjs.min-0pzT_dbr.js +0 -282
- package/dist/fuzzy-yzIM5KUK.js +0 -41
- package/dist/index-l87_vggM.js +0 -21515
- package/dist/number-B5d98l0m.js +0 -97
- package/dist/rules-CCwuHe8Y.js +0 -85
- package/dist/use-inventory-binding-dialog-CTriImiV.js +0 -93
|
@@ -1,575 +0,0 @@
|
|
|
1
|
-
import { defineComponent as N, ref as x, onMounted as se, resolveComponent as k, openBlock as R, createElementBlock as A, Fragment as le, createElementVNode as h, toDisplayString as re, createVNode as p, createCommentVNode as j, computed as S, watch as ie, createBlock as M, withCtx as I, unref as y, isRef as X, normalizeStyle as ce, Teleport as ue, normalizeProps as de, guardReactiveProps as me } from "vue";
|
|
2
|
-
import { u as P, c as K, S as pe, b as Z, f as fe } from "./app-RVyC2D4O.js";
|
|
3
|
-
import { useDialog as ve, useSnackbar as ne, useProxiedModel as ee, useBreakpoints as ye } from "@feedmepos/ui-library";
|
|
4
|
-
import { i as _e, _ as ge } from "./is-linked-ingredient-error-C6AghEwR.js";
|
|
5
|
-
import { F as w, D as te, R as z } from "./row-action.enum-BwQbURNh.js";
|
|
6
|
-
import { _ as ae, t as be, d as he } from "./xlsx.util-BsZI2tNE.js";
|
|
7
|
-
import { c as we, _ as Re, F as oe, u as xe } from "./layout-ITqYtCVu.js";
|
|
8
|
-
import { a as q } from "./number-B5d98l0m.js";
|
|
9
|
-
import { useI18n as Y } from "@feedmepos/mf-common";
|
|
10
|
-
import { _ as Ce, a as Ee } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DaHXKF1s.js";
|
|
11
|
-
import { R as ke, U as Ve } from "./rules-CCwuHe8Y.js";
|
|
12
|
-
import { _ as Fe } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-BdVrpR9J.js";
|
|
13
|
-
import { f as De } from "./date2-C2PfOqbB.js";
|
|
14
|
-
const Se = {
|
|
15
|
-
key: 0,
|
|
16
|
-
class: "flex flex-col items-center w-full h-full gap-24"
|
|
17
|
-
}, $e = /* @__PURE__ */ h("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1), Ae = { key: 1 }, Ie = /* @__PURE__ */ h("br", null, null, -1), Pe = { key: 0 }, Te = /* @__PURE__ */ h("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1), Me = /* @__PURE__ */ N({
|
|
18
|
-
__name: "DeleteDialog",
|
|
19
|
-
props: {
|
|
20
|
-
type: {},
|
|
21
|
-
data: {},
|
|
22
|
-
message: {},
|
|
23
|
-
bindedItems: {}
|
|
24
|
-
},
|
|
25
|
-
setup(_) {
|
|
26
|
-
const d = _, f = x(d.bindedItems || []), s = x(!1);
|
|
27
|
-
se(() => {
|
|
28
|
-
n();
|
|
29
|
-
});
|
|
30
|
-
async function n() {
|
|
31
|
-
var u, l;
|
|
32
|
-
!s.value && ((u = d.data) != null && u._id) && (s.value = !0, f.value = await P().getAffectedMenu((l = d.data) == null ? void 0 : l._id), s.value = !1);
|
|
33
|
-
}
|
|
34
|
-
return (u, l) => {
|
|
35
|
-
const c = k("FmSpacer"), m = k("FmCircularProgress");
|
|
36
|
-
return R(), A(le, null, [
|
|
37
|
-
h("p", null, re(u.message), 1),
|
|
38
|
-
s.value ? (R(), A("div", Se, [
|
|
39
|
-
p(c),
|
|
40
|
-
h("div", null, [
|
|
41
|
-
p(m, { size: "xl" })
|
|
42
|
-
]),
|
|
43
|
-
$e,
|
|
44
|
-
p(c)
|
|
45
|
-
])) : (R(), A("div", Ae, [
|
|
46
|
-
Ie,
|
|
47
|
-
f.value.length > 0 ? (R(), A("div", Pe, [
|
|
48
|
-
Te,
|
|
49
|
-
p(ae, {
|
|
50
|
-
name: "Menu",
|
|
51
|
-
bindings: f.value
|
|
52
|
-
}, null, 8, ["bindings"])
|
|
53
|
-
])) : j("", !0)
|
|
54
|
-
]))
|
|
55
|
-
], 64);
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
function Ue() {
|
|
60
|
-
const _ = ve(), d = ne(), f = P(), s = x(!1), n = x();
|
|
61
|
-
function u() {
|
|
62
|
-
const t = {
|
|
63
|
-
recipe: {},
|
|
64
|
-
mode: w.CREATE,
|
|
65
|
-
show: !0,
|
|
66
|
-
"onUpdate:show"(a) {
|
|
67
|
-
n.value.show = a;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
n.value = t;
|
|
71
|
-
}
|
|
72
|
-
async function l(t) {
|
|
73
|
-
const a = {
|
|
74
|
-
recipe: K(t),
|
|
75
|
-
mode: w.UPDATE,
|
|
76
|
-
show: !0,
|
|
77
|
-
"onUpdate:show"(b) {
|
|
78
|
-
n.value.show = b;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
n.value = a;
|
|
82
|
-
}
|
|
83
|
-
async function c(t) {
|
|
84
|
-
s.value = !0;
|
|
85
|
-
try {
|
|
86
|
-
await f.deleteRecipe(t), d.open({
|
|
87
|
-
title: "Success",
|
|
88
|
-
message: `Deleted ${t.name}`,
|
|
89
|
-
type: "success"
|
|
90
|
-
});
|
|
91
|
-
} catch (a) {
|
|
92
|
-
a instanceof pe && _e(a) ? _.open({
|
|
93
|
-
title: "Cannot delete recipe",
|
|
94
|
-
contentComponent: ge,
|
|
95
|
-
contentComponentProps: {
|
|
96
|
-
subject: (t == null ? void 0 : t.name) ?? "",
|
|
97
|
-
items: a.errorResponse.message
|
|
98
|
-
},
|
|
99
|
-
secondaryActions: {
|
|
100
|
-
text: "Close",
|
|
101
|
-
close: !0
|
|
102
|
-
}
|
|
103
|
-
}) : console.log("unable to delete recipe", a), d.open({
|
|
104
|
-
title: `Cannot delete ${t == null ? void 0 : t.name}`,
|
|
105
|
-
message: "Please try again.",
|
|
106
|
-
type: "error"
|
|
107
|
-
}), console.error("failed to delete recipe", a);
|
|
108
|
-
} finally {
|
|
109
|
-
s.value = !1;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function m(t) {
|
|
113
|
-
_.open({
|
|
114
|
-
title: `Delete ${(t == null ? void 0 : t.name) ?? "recipe"}?`,
|
|
115
|
-
closeButton: !1,
|
|
116
|
-
primaryActions: {
|
|
117
|
-
text: "Delete",
|
|
118
|
-
close: !0,
|
|
119
|
-
variant: "destructive"
|
|
120
|
-
},
|
|
121
|
-
secondaryActions: {
|
|
122
|
-
text: "Cancel",
|
|
123
|
-
close: !0
|
|
124
|
-
},
|
|
125
|
-
contentComponent: Me,
|
|
126
|
-
contentComponentProps: {
|
|
127
|
-
type: "menu",
|
|
128
|
-
data: t,
|
|
129
|
-
message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
|
|
130
|
-
}
|
|
131
|
-
}).onPrimary(() => c(t));
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
createRecipe: u,
|
|
135
|
-
updateRecipe: l,
|
|
136
|
-
deleteRecipe: m,
|
|
137
|
-
recipeDialogProps: n,
|
|
138
|
-
recipeViewLoading: s
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function Be({
|
|
142
|
-
updateRecipe: _,
|
|
143
|
-
deleteRecipe: d
|
|
144
|
-
}) {
|
|
145
|
-
const { t: f } = Y();
|
|
146
|
-
async function s(l, c) {
|
|
147
|
-
const m = K(c);
|
|
148
|
-
if (l === z.Edit) {
|
|
149
|
-
await _(m);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (l === z.Delete) {
|
|
153
|
-
await d(m);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
const n = [
|
|
158
|
-
{
|
|
159
|
-
accessorKey: "recipe",
|
|
160
|
-
header: f("inventory.recipe.name"),
|
|
161
|
-
size: 400
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
accessorKey: "ingredients",
|
|
165
|
-
header: f("inventory.recipe.ingredients"),
|
|
166
|
-
size: "auto"
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
id: "action",
|
|
170
|
-
header: "",
|
|
171
|
-
cell(l) {
|
|
172
|
-
return we(
|
|
173
|
-
[te[z.Edit], te[z.Delete]],
|
|
174
|
-
(c) => {
|
|
175
|
-
s(c, l.row.original.original);
|
|
176
|
-
}
|
|
177
|
-
);
|
|
178
|
-
},
|
|
179
|
-
enableSorting: !1,
|
|
180
|
-
size: 40,
|
|
181
|
-
meta: {
|
|
182
|
-
cellClass: "",
|
|
183
|
-
headerClass: ""
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
];
|
|
187
|
-
function u(l) {
|
|
188
|
-
const c = P();
|
|
189
|
-
return l.map((m) => ({
|
|
190
|
-
recipe: m.name,
|
|
191
|
-
ingredients: m.contains.map((t) => {
|
|
192
|
-
var b, i;
|
|
193
|
-
const a = c.skuById[t.id];
|
|
194
|
-
return a ? `${a.name} (${q(t.amount)}${((b = t.measurement) == null ? void 0 : b.abbrev) ?? ((i = a == null ? void 0 : a.unit) == null ? void 0 : i.abbrev)})` : null;
|
|
195
|
-
}).filter((t) => t).join(", "),
|
|
196
|
-
original: m
|
|
197
|
-
}));
|
|
198
|
-
}
|
|
199
|
-
return { columnDefs: n, formatRowData: u };
|
|
200
|
-
}
|
|
201
|
-
const Le = { class: "flex flex-col gap-40" }, ze = {
|
|
202
|
-
key: 0,
|
|
203
|
-
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"
|
|
204
|
-
}, Ne = {
|
|
205
|
-
key: 0,
|
|
206
|
-
class: "flex flex-col items-center w-full h-full gap-24"
|
|
207
|
-
}, Ye = /* @__PURE__ */ h("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1), He = { key: 1 }, je = /* @__PURE__ */ N({
|
|
208
|
-
__name: "RecipeForm",
|
|
209
|
-
props: {
|
|
210
|
-
mode: {},
|
|
211
|
-
modelValue: {},
|
|
212
|
-
disabled: { type: Boolean }
|
|
213
|
-
},
|
|
214
|
-
emits: ["update:modelValue", "click:submit"],
|
|
215
|
-
setup(_, { expose: d, emit: f }) {
|
|
216
|
-
var V;
|
|
217
|
-
const s = _, n = f, { t: u } = Y(), l = S({
|
|
218
|
-
get() {
|
|
219
|
-
var e;
|
|
220
|
-
return ((e = s.modelValue) == null ? void 0 : e.name) ?? "";
|
|
221
|
-
},
|
|
222
|
-
set(e) {
|
|
223
|
-
const o = s.modelValue ?? {};
|
|
224
|
-
o.name = e, n("update:modelValue", o);
|
|
225
|
-
}
|
|
226
|
-
}), c = S({
|
|
227
|
-
get() {
|
|
228
|
-
var e;
|
|
229
|
-
return ((e = s.modelValue) == null ? void 0 : e.contains) ?? [];
|
|
230
|
-
},
|
|
231
|
-
set(e) {
|
|
232
|
-
const o = s.modelValue ?? {};
|
|
233
|
-
o.contains = e, n("update:modelValue", o);
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
function m() {
|
|
237
|
-
n("click:submit");
|
|
238
|
-
}
|
|
239
|
-
const t = x();
|
|
240
|
-
d({
|
|
241
|
-
validateInputs: () => {
|
|
242
|
-
var e, o;
|
|
243
|
-
(o = (e = t.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
|
|
244
|
-
},
|
|
245
|
-
resetInputsValidation: () => {
|
|
246
|
-
var e, o;
|
|
247
|
-
(o = (e = t.value) == null ? void 0 : e.resetInputsValidation) == null || o.call(e);
|
|
248
|
-
},
|
|
249
|
-
resetInputs: () => {
|
|
250
|
-
var e, o;
|
|
251
|
-
(o = (e = t.value) == null ? void 0 : e.resetInputs) == null || o.call(e);
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
const a = P(), b = x([]), i = x(!1), g = x(!1);
|
|
255
|
-
ie(i, async (e) => {
|
|
256
|
-
C(e);
|
|
257
|
-
});
|
|
258
|
-
async function C(e) {
|
|
259
|
-
var o, F;
|
|
260
|
-
e && !g.value && ((o = s.modelValue) != null && o._id) && (g.value = !0, b.value = await a.getAffectedMenu((F = s.modelValue) == null ? void 0 : F._id), g.value = !1);
|
|
261
|
-
}
|
|
262
|
-
const r = S(
|
|
263
|
-
() => a.recipes.map((e) => ({ label: e.name, value: e.name }))
|
|
264
|
-
), v = x((V = s.modelValue) == null ? void 0 : V.name);
|
|
265
|
-
return (e, o) => {
|
|
266
|
-
const F = k("FmTextField"), H = k("FmCard"), $ = k("FmSwitch"), D = k("FmSpacer"), U = k("FmCircularProgress"), B = k("FmForm");
|
|
267
|
-
return R(), M(B, {
|
|
268
|
-
ref_key: "formRef",
|
|
269
|
-
ref: t,
|
|
270
|
-
onValidationSuccess: m
|
|
271
|
-
}, {
|
|
272
|
-
default: I(() => [
|
|
273
|
-
h("div", Le, [
|
|
274
|
-
p(F, {
|
|
275
|
-
disabled: e.disabled,
|
|
276
|
-
label: y(u)("inventory.recipe.name"),
|
|
277
|
-
"model-value": l.value,
|
|
278
|
-
"onUpdate:modelValue": o[0] || (o[0] = (E) => l.value = E),
|
|
279
|
-
rules: [
|
|
280
|
-
y(ke)(),
|
|
281
|
-
y(Ve)(r.value, v.value, (E) => `[${E.value}] already exists`)
|
|
282
|
-
],
|
|
283
|
-
"label-mark": "required"
|
|
284
|
-
}, null, 8, ["disabled", "label", "model-value", "rules"]),
|
|
285
|
-
p(H, {
|
|
286
|
-
variant: "outlined",
|
|
287
|
-
class: "p-16"
|
|
288
|
-
}, {
|
|
289
|
-
default: I(() => {
|
|
290
|
-
var E;
|
|
291
|
-
return [
|
|
292
|
-
p(Fe, {
|
|
293
|
-
id: (E = e.modelValue) == null ? void 0 : E._id,
|
|
294
|
-
disabled: e.disabled,
|
|
295
|
-
"model-value": c.value,
|
|
296
|
-
"onUpdate:modelValue": o[1] || (o[1] = (T) => c.value = T)
|
|
297
|
-
}, null, 8, ["id", "disabled", "model-value"])
|
|
298
|
-
];
|
|
299
|
-
}),
|
|
300
|
-
_: 1
|
|
301
|
-
})
|
|
302
|
-
]),
|
|
303
|
-
e.mode !== y(w).CREATE ? (R(), A("div", ze, [
|
|
304
|
-
h("div", null, [
|
|
305
|
-
p($, {
|
|
306
|
-
label: "Show binded items",
|
|
307
|
-
modelValue: i.value,
|
|
308
|
-
"onUpdate:modelValue": o[2] || (o[2] = (E) => i.value = E),
|
|
309
|
-
"label-placement": "right",
|
|
310
|
-
disabled: g.value
|
|
311
|
-
}, null, 8, ["modelValue", "disabled"])
|
|
312
|
-
]),
|
|
313
|
-
g.value ? (R(), A("div", Ne, [
|
|
314
|
-
p(D),
|
|
315
|
-
h("div", null, [
|
|
316
|
-
p(U, { size: "xl" })
|
|
317
|
-
]),
|
|
318
|
-
Ye,
|
|
319
|
-
p(D)
|
|
320
|
-
])) : (R(), A("div", He, [
|
|
321
|
-
i.value && b.value.length ? (R(), M(ae, {
|
|
322
|
-
key: 0,
|
|
323
|
-
name: "Menu",
|
|
324
|
-
bindings: b.value
|
|
325
|
-
}, null, 8, ["bindings"])) : j("", !0)
|
|
326
|
-
]))
|
|
327
|
-
])) : j("", !0)
|
|
328
|
-
]),
|
|
329
|
-
_: 1
|
|
330
|
-
}, 512);
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
}), qe = { class: "flex gap-4" }, Ke = /* @__PURE__ */ N({
|
|
334
|
-
__name: "RecipeDialog",
|
|
335
|
-
props: {
|
|
336
|
-
show: { type: Boolean },
|
|
337
|
-
recipe: {},
|
|
338
|
-
mode: { default: w.READ }
|
|
339
|
-
},
|
|
340
|
-
emits: ["update:show"],
|
|
341
|
-
setup(_) {
|
|
342
|
-
const d = _, f = P(), s = ne(), { t: n } = Y(), u = ee(d, "show"), l = ee(d, "recipe"), c = S(() => {
|
|
343
|
-
switch (d.mode) {
|
|
344
|
-
case w.READ:
|
|
345
|
-
return "";
|
|
346
|
-
case w.UPDATE:
|
|
347
|
-
return n("inventory.recipe.update.title");
|
|
348
|
-
case w.CREATE:
|
|
349
|
-
return n("inventory.recipe.create.title");
|
|
350
|
-
}
|
|
351
|
-
return "";
|
|
352
|
-
}), m = S(() => {
|
|
353
|
-
switch (d.mode) {
|
|
354
|
-
case w.READ:
|
|
355
|
-
return "";
|
|
356
|
-
case w.UPDATE:
|
|
357
|
-
return n("common.save");
|
|
358
|
-
case w.CREATE:
|
|
359
|
-
return n("common.add");
|
|
360
|
-
}
|
|
361
|
-
return "";
|
|
362
|
-
}), t = x(), a = x(!1);
|
|
363
|
-
async function b() {
|
|
364
|
-
a.value = !0;
|
|
365
|
-
try {
|
|
366
|
-
const r = K(l.value);
|
|
367
|
-
r.precision ?? (r.precision = 0), r.measurements ?? (r.measurements = []), await f.createRecipe(r), u.value = !1, s.open({
|
|
368
|
-
title: n("common.success"),
|
|
369
|
-
message: n("inventory.recipe.create.success", { name: l.value.name }),
|
|
370
|
-
type: "success"
|
|
371
|
-
});
|
|
372
|
-
} catch (r) {
|
|
373
|
-
r instanceof Z || s.open({
|
|
374
|
-
title: n("inventory.recipe.create.error.title"),
|
|
375
|
-
message: n("inventory.recipe.create.error.message"),
|
|
376
|
-
type: "error"
|
|
377
|
-
});
|
|
378
|
-
} finally {
|
|
379
|
-
a.value = !1;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
async function i() {
|
|
383
|
-
a.value = !0;
|
|
384
|
-
try {
|
|
385
|
-
await f.updateRecipe(l.value), u.value = !1, s.open({
|
|
386
|
-
title: n("common.success"),
|
|
387
|
-
message: n("inventory.recipe.update.success", { name: l.value.name }),
|
|
388
|
-
type: "success"
|
|
389
|
-
});
|
|
390
|
-
} catch (r) {
|
|
391
|
-
r instanceof Z || s.open({
|
|
392
|
-
title: n("inventory.recipe.update.error.title"),
|
|
393
|
-
message: n("inventory.recipe.update.error.message"),
|
|
394
|
-
type: "error"
|
|
395
|
-
});
|
|
396
|
-
} finally {
|
|
397
|
-
a.value = !1;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
function g() {
|
|
401
|
-
var r, v;
|
|
402
|
-
(v = (r = t.value) == null ? void 0 : r.validateInputs) == null || v.call(r);
|
|
403
|
-
}
|
|
404
|
-
function C() {
|
|
405
|
-
switch (d.mode) {
|
|
406
|
-
case w.READ:
|
|
407
|
-
return;
|
|
408
|
-
case w.UPDATE:
|
|
409
|
-
return i();
|
|
410
|
-
case w.CREATE:
|
|
411
|
-
return b();
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
return (r, v) => {
|
|
415
|
-
const V = k("FmButton"), e = k("FmSideSheet");
|
|
416
|
-
return R(), M(e, {
|
|
417
|
-
"model-value": y(u),
|
|
418
|
-
"onUpdate:modelValue": v[3] || (v[3] = (o) => X(u) ? u.value = o : null),
|
|
419
|
-
header: c.value,
|
|
420
|
-
"close-button": "",
|
|
421
|
-
"dismiss-away": "",
|
|
422
|
-
"max-width": 500
|
|
423
|
-
}, {
|
|
424
|
-
"side-sheet-footer": I(() => [
|
|
425
|
-
h("div", qe, [
|
|
426
|
-
p(V, {
|
|
427
|
-
loading: a.value,
|
|
428
|
-
label: m.value,
|
|
429
|
-
onClick: g
|
|
430
|
-
}, null, 8, ["loading", "label"]),
|
|
431
|
-
p(V, {
|
|
432
|
-
disabled: a.value,
|
|
433
|
-
label: y(n)("common.close"),
|
|
434
|
-
variant: "tertiary",
|
|
435
|
-
onClick: v[2] || (v[2] = (o) => u.value = !1)
|
|
436
|
-
}, null, 8, ["disabled", "label"])
|
|
437
|
-
])
|
|
438
|
-
]),
|
|
439
|
-
default: I(() => [
|
|
440
|
-
p(je, {
|
|
441
|
-
class: "w-full",
|
|
442
|
-
ref_key: "hasValidationExpose",
|
|
443
|
-
ref: t,
|
|
444
|
-
modelValue: y(l),
|
|
445
|
-
"onUpdate:modelValue": v[0] || (v[0] = (o) => X(l) ? l.value = o : null),
|
|
446
|
-
mode: r.mode,
|
|
447
|
-
disabled: a.value,
|
|
448
|
-
"onClick:submit": v[1] || (v[1] = (o) => C())
|
|
449
|
-
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
450
|
-
]),
|
|
451
|
-
_: 1
|
|
452
|
-
}, 8, ["model-value", "header"]);
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
function Ge() {
|
|
457
|
-
const _ = P(), d = _.recipes, f = _.recipeById, s = _.skuById, n = d.flatMap((c, m) => {
|
|
458
|
-
var t;
|
|
459
|
-
if ((t = c.contains) != null && t.length) {
|
|
460
|
-
const a = c.contains.filter((i) => i.type === "RECIPE"), b = c.contains.filter((i) => i.type === "SKU");
|
|
461
|
-
return [
|
|
462
|
-
...m === 0 ? [] : [["", "", "", "", "", ""]],
|
|
463
|
-
...a.map(
|
|
464
|
-
(i, g) => {
|
|
465
|
-
var C;
|
|
466
|
-
return [
|
|
467
|
-
g === 0 ? c.name : "",
|
|
468
|
-
"RECIPE",
|
|
469
|
-
"",
|
|
470
|
-
(C = f[i.id]) == null ? void 0 : C.name,
|
|
471
|
-
q(i.amount),
|
|
472
|
-
"UNIT"
|
|
473
|
-
];
|
|
474
|
-
}
|
|
475
|
-
),
|
|
476
|
-
...b.map(
|
|
477
|
-
(i, g) => {
|
|
478
|
-
var C, r, v, V;
|
|
479
|
-
return [
|
|
480
|
-
!a.length && g === 0 ? c.name : "",
|
|
481
|
-
"INGREDIENT",
|
|
482
|
-
(C = s[i.id]) == null ? void 0 : C.code,
|
|
483
|
-
(r = s[i.id]) == null ? void 0 : r.name,
|
|
484
|
-
q(i.amount),
|
|
485
|
-
i.measurement ? i.measurement.abbrev : (V = (v = s[i.id]) == null ? void 0 : v.unit) == null ? void 0 : V.abbrev
|
|
486
|
-
];
|
|
487
|
-
}
|
|
488
|
-
)
|
|
489
|
-
];
|
|
490
|
-
}
|
|
491
|
-
return [
|
|
492
|
-
...m === 0 ? [] : [["", "", "", "", "", ""]],
|
|
493
|
-
[c.name, "No bindings", "", "", "", ""]
|
|
494
|
-
];
|
|
495
|
-
}), l = be(n, ["Name", "Type", "Code", "Item", "Amount", "Unit"]);
|
|
496
|
-
he(l, `RECIPE_${De(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
|
|
497
|
-
}
|
|
498
|
-
const Je = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, Oe = { class: "flex flex-col py-8" }, Qe = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, We = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, dt = /* @__PURE__ */ N({
|
|
499
|
-
__name: "RecipeView",
|
|
500
|
-
setup(_) {
|
|
501
|
-
const d = P(), f = S(() => d.recipes), s = fe(), { createRecipe: n, updateRecipe: u, deleteRecipe: l, recipeDialogProps: c, recipeViewLoading: m } = Ue(), { columnDefs: t, formatRowData: a } = Be({
|
|
502
|
-
updateRecipe: u,
|
|
503
|
-
deleteRecipe: l
|
|
504
|
-
}), b = S(() => a(f.value));
|
|
505
|
-
function i(o) {
|
|
506
|
-
o === "add" && n();
|
|
507
|
-
}
|
|
508
|
-
const g = x(""), C = S(() => m.value), { breakpoints: r } = ye(), v = S(() => r.value.xs || r.value.sm ? 10 : 20), V = xe(), { t: e } = Y();
|
|
509
|
-
return (o, F) => {
|
|
510
|
-
const H = k("FmTable");
|
|
511
|
-
return R(), M(Ce, {
|
|
512
|
-
title: y(e)("inventory.recipe.title"),
|
|
513
|
-
actions: [{ label: y(e)("inventory.recipe.create.title"), value: "add", isPrimary: !0, prependIcon: "add" }],
|
|
514
|
-
"onClick:action": i
|
|
515
|
-
}, {
|
|
516
|
-
default: I(() => [
|
|
517
|
-
h("div", Je, [
|
|
518
|
-
p(Ee, {
|
|
519
|
-
searchable: "",
|
|
520
|
-
search: g.value,
|
|
521
|
-
"onUpdate:search": F[0] || (F[0] = ($) => g.value = $),
|
|
522
|
-
actions: [{ icon: "ios_share", onClick: y(Ge) }]
|
|
523
|
-
}, null, 8, ["search", "actions"]),
|
|
524
|
-
(R(), M(H, {
|
|
525
|
-
style: ce(y(V).tableHeight),
|
|
526
|
-
"column-defs": y(t),
|
|
527
|
-
"row-data": b.value,
|
|
528
|
-
"search-value": g.value,
|
|
529
|
-
loading: !y(s)._currentLocation || C.value,
|
|
530
|
-
onRowClick: F[1] || (F[1] = ($) => y(u)($.original.original)),
|
|
531
|
-
key: f.value.length,
|
|
532
|
-
"page-size": v.value
|
|
533
|
-
}, {
|
|
534
|
-
"list-row": I(($) => [
|
|
535
|
-
p(Re, {
|
|
536
|
-
row: $,
|
|
537
|
-
onRowClick: (D) => y(u)(D.original)
|
|
538
|
-
}, {
|
|
539
|
-
default: I((D) => {
|
|
540
|
-
var U, B, E, T, G, J, O, Q, L, W;
|
|
541
|
-
return [
|
|
542
|
-
h("div", Oe, [
|
|
543
|
-
h("div", Qe, [
|
|
544
|
-
p(y(oe), {
|
|
545
|
-
render: (E = (B = (U = D.recipe) == null ? void 0 : U.column) == null ? void 0 : B.columnDef) == null ? void 0 : E.cell,
|
|
546
|
-
props: (G = (T = D.recipe) == null ? void 0 : T.getContext) == null ? void 0 : G.call(T)
|
|
547
|
-
}, null, 8, ["render", "props"])
|
|
548
|
-
]),
|
|
549
|
-
h("div", We, [
|
|
550
|
-
p(y(oe), {
|
|
551
|
-
render: (Q = (O = (J = D.ingredients) == null ? void 0 : J.column) == null ? void 0 : O.columnDef) == null ? void 0 : Q.cell,
|
|
552
|
-
props: (W = (L = D.ingredients) == null ? void 0 : L.getContext) == null ? void 0 : W.call(L)
|
|
553
|
-
}, null, 8, ["render", "props"])
|
|
554
|
-
])
|
|
555
|
-
])
|
|
556
|
-
];
|
|
557
|
-
}),
|
|
558
|
-
_: 2
|
|
559
|
-
}, 1032, ["row", "onRowClick"])
|
|
560
|
-
]),
|
|
561
|
-
_: 1
|
|
562
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
563
|
-
]),
|
|
564
|
-
(R(), M(ue, { to: "body" }, [
|
|
565
|
-
p(Ke, de(me(y(c))), null, 16)
|
|
566
|
-
]))
|
|
567
|
-
]),
|
|
568
|
-
_: 1
|
|
569
|
-
}, 8, ["title", "actions"]);
|
|
570
|
-
};
|
|
571
|
-
}
|
|
572
|
-
});
|
|
573
|
-
export {
|
|
574
|
-
dt as default
|
|
575
|
-
};
|