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