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