@feedmepos/mf-inventory-portal 1.0.15-dev.2 → 1.0.15-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/{App-CgxrN-aD.js → App-C2-uZBjX.js} +2 -2
- package/dist/ApprovalView-BYSG24mC.js +213 -0
- package/dist/{BindingsDialog-B_ZMDl-b.js → BindingsDialog-BVgAl7QB.js} +2 -2
- package/dist/{BindingsPicker-B84BG8zT.js → BindingsPicker-CTqO6MTh.js} +1 -1
- package/dist/{BindingsTable-DrvoykYc.js → BindingsTable-DAkGh7yD.js} +1 -1
- package/dist/{ClosingDraftView-Ds9sI2Eg.js → ClosingDraftView-CJe3za1B.js} +41 -41
- package/dist/{ClosingTemplateView-BhZ1OXkD.js → ClosingTemplateView-CzuyG1NM.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-Yuxf-jCh.js → DeliveryOrderPrintPreview-DC-S5Jkp.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D6ktiUO5.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BIR8hIIx.js} +43 -43
- package/dist/{FmMultiselectDialog-4lVsA2Rn.js → FmMultiselectDialog-CyhyAmUf.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-XmTRSHn_.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DbASoXHB.js} +57 -57
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-B3PvtR0j.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BNcVcxkw.js} +1 -1
- package/dist/IngredientGroupView-CoVSqi7W.js +977 -0
- package/dist/IngredientsView-auG4thna.js +1778 -0
- package/dist/{IntegrationView-BnrCkjWt.js → IntegrationView-BCGzax4k.js} +5 -5
- package/dist/{InventoryBindingForm-uyHh2TI_.js → InventoryBindingForm-BlpwH-je.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CECDj9Pw.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DJxy3D57.js} +46 -46
- package/dist/{InventoryBindingSummary-DyHCqgIe.js → InventoryBindingSummary-B1dzBf4n.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Dx2lMf6h.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BqxFQWOu.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BCX3vlmU.js → PremiumBadge.vue_vue_type_script_setup_true_lang-COUgrdWW.js} +15 -15
- package/dist/{PublishView-BVGyY6nn.js → PublishView-DRiyZ8D8.js} +13 -13
- package/dist/{PurchaseOrderPrintPreview-pbYIFiOG.js → PurchaseOrderPrintPreview-DQjCaQ1U.js} +4 -4
- package/dist/ReceiveRequestView-B88Nfuck.js +2576 -0
- package/dist/{RecipeView-DcgoCf4g.js → RecipeView-B-PR_bJO.js} +4 -4
- package/dist/{StockView-zO2uL662.js → StockView-DWZ9OiPc.js} +108 -108
- package/dist/{SupplierView-I5bqiX_2.js → SupplierView-BXLJkj_P.js} +37 -37
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-GMAU4wTt.js +2090 -0
- package/dist/{TransferTemplateView-BDOt17yc.js → TransferTemplateView-BU4CJAi6.js} +149 -149
- package/dist/{UnitView-BVY5S6-3.js → UnitView-6Z2MUNL0.js} +32 -32
- package/dist/{WarehouseView-m6MKrtYq.js → WarehouseView-TVrrr6uJ.js} +26 -26
- package/dist/api/inventory.d.ts +12 -0
- package/dist/{app-DtICLubM.js → app-BFIrvTDw.js} +33844 -25682
- package/dist/app.d.ts +1 -0
- package/dist/app.js +5 -5
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +36 -0
- package/dist/{decimal-C1dAcCf3.js → decimal-wpLnNWZL.js} +1 -1
- package/dist/{feature-Y7qzvbl4.js → feature-BvpauT6E.js} +79 -79
- package/dist/{format-unit-display-CPqfS4vp.js → format-unit-display-BbK1Rcd3.js} +48 -48
- package/dist/helper/rules.d.ts +1 -1
- package/dist/{index-DIEdSG3y.js → index-C2nfh-Rm.js} +1 -1
- package/dist/{index-0qsqwB0T.js → index-DI7DUbNm.js} +4 -4
- package/dist/{stock-CowNp_xM.js → stock-DkHVa1PB.js} +1 -1
- package/dist/stores/inventory.d.ts +16 -0
- package/dist/{supplier-JVTTlQNL.js → supplier-BiJ-_4RN.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-Df59lld2.js → use-ingredient-select-dialog-Bkt9TvKm.js} +5 -5
- package/dist/{use-inventory-binding-dialog-Bxxb93Kz.js → use-inventory-binding-dialog-ClzflO2S.js} +1 -1
- package/dist/views/ingredient-group/components/ingredient-group-rule-field/IngredientGroupRuleField.vue.d.ts +4 -0
- package/dist/views/ingredient-group/composables/use-ingredient-group-rule-item.d.ts +5 -0
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +12 -0
- package/dist/{vue-i18n-DJOdRwc3.js → vue-i18n-Bvbu7J8Z.js} +153 -153
- package/package.json +4 -4
- package/dist/ApprovalView-DNGhkVc9.js +0 -147
- package/dist/IngredientGroupView-usK9stxT.js +0 -8779
- package/dist/IngredientsView-DPx8Z2zo.js +0 -1749
- package/dist/ReceiveRequestView-DZAgH2_u.js +0 -2516
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-NyQg_yR9.js +0 -2020
|
@@ -0,0 +1,977 @@
|
|
|
1
|
+
import { ref as A, computed as F, h as C, defineComponent as j, watch as re, resolveComponent as R, openBlock as G, createElementBlock as U, createVNode as b, unref as l, createElementVNode as c, toDisplayString as $, createBlock as M, withCtx as T, Fragment as pe, renderList as ve, createTextVNode as ye, createCommentVNode as se, isRef as ge, normalizeClass as _e, normalizeStyle as be, createSlots as ke, Teleport as xe, normalizeProps as he, guardReactiveProps as we } from "vue";
|
|
2
|
+
import { a as L, d as S, e as z, f as Re, D as oe, h as K, I as Ie, A as Se, U as Ge, G as ue, J as Fe, N as Ve, l as de, K as Ce, p as ae, u as De, z as Ae, _ as $e, B as Te, C as Ee, E as le } from "./app-BFIrvTDw.js";
|
|
3
|
+
import { useDialog as Me, useSnackbar as J, components as B, useProxiedModel as Be, useBreakpoints as Ue } from "@feedmepos/ui-library";
|
|
4
|
+
import { useI18n as P, useCoreStore as ze } from "@feedmepos/mf-common";
|
|
5
|
+
import { defineStore as ce, storeToRefs as ie } from "pinia";
|
|
6
|
+
import "./array-Ca8T3f_G.js";
|
|
7
|
+
import { u as Le } from "./FmMultiselectDialog-CyhyAmUf.js";
|
|
8
|
+
import { r as me } from "./random-CSbEbElR.js";
|
|
9
|
+
import { u as Pe, R as Ne } from "./usePromise-CbVUCxhj.js";
|
|
10
|
+
const H = ce(
|
|
11
|
+
"ingredientGroupactions",
|
|
12
|
+
function() {
|
|
13
|
+
const _ = Me(), f = J(), k = L(), { t: i } = P(), v = A();
|
|
14
|
+
function e() {
|
|
15
|
+
const u = {
|
|
16
|
+
modelValue: {},
|
|
17
|
+
mode: S.CREATE,
|
|
18
|
+
show: !0,
|
|
19
|
+
"onUpdate:show"(m) {
|
|
20
|
+
v.value.show = m;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
v.value = u;
|
|
24
|
+
}
|
|
25
|
+
async function a(u) {
|
|
26
|
+
const m = {
|
|
27
|
+
modelValue: z(u),
|
|
28
|
+
mode: S.UPDATE,
|
|
29
|
+
show: !0,
|
|
30
|
+
"onUpdate:show"(r) {
|
|
31
|
+
v.value.show = r;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
v.value = m;
|
|
35
|
+
}
|
|
36
|
+
async function t(u, m, r) {
|
|
37
|
+
m.value = !0;
|
|
38
|
+
try {
|
|
39
|
+
await k.deleteSkuGroup(u), f.open({
|
|
40
|
+
title: "Success",
|
|
41
|
+
message: `Deleted ${u.name}`,
|
|
42
|
+
type: "success"
|
|
43
|
+
});
|
|
44
|
+
} catch (y) {
|
|
45
|
+
f.open({
|
|
46
|
+
title: `Cannot delete ${u.name}`,
|
|
47
|
+
message: "Please try again.",
|
|
48
|
+
type: "error"
|
|
49
|
+
}), console.error("failed to delete ingredient", y);
|
|
50
|
+
} finally {
|
|
51
|
+
m.value = !1, r();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function n(u, m, r) {
|
|
55
|
+
_.open({
|
|
56
|
+
title: i("inventory.ingredient.delete.title", [(u == null ? void 0 : u.name) ?? ""]),
|
|
57
|
+
closeButton: !1,
|
|
58
|
+
message: i("inventory.ingredient.delete.message"),
|
|
59
|
+
primaryActions: {
|
|
60
|
+
text: i("common.delete"),
|
|
61
|
+
close: !0,
|
|
62
|
+
variant: "destructive"
|
|
63
|
+
},
|
|
64
|
+
secondaryActions: {
|
|
65
|
+
text: i("common.cancel"),
|
|
66
|
+
close: !0
|
|
67
|
+
}
|
|
68
|
+
}).onPrimary(() => t(u, m, r));
|
|
69
|
+
}
|
|
70
|
+
function s() {
|
|
71
|
+
}
|
|
72
|
+
function g() {
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
createIngredientGroup: e,
|
|
76
|
+
updateIngredientGroup: a,
|
|
77
|
+
deleteIngredientGroup: n,
|
|
78
|
+
importIngredientGroups: s,
|
|
79
|
+
exportIngredientGroups: g,
|
|
80
|
+
ingredientGroupDialogProps: v
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
), Oe = ce(
|
|
84
|
+
"ingredientGroupTable",
|
|
85
|
+
function() {
|
|
86
|
+
const _ = A(!1), f = J(), k = L(), i = H();
|
|
87
|
+
async function v() {
|
|
88
|
+
_.value = !0;
|
|
89
|
+
try {
|
|
90
|
+
await k.readInventory();
|
|
91
|
+
} catch (t) {
|
|
92
|
+
console.error("error on reading inventory", t), f.open({
|
|
93
|
+
title: "Error",
|
|
94
|
+
message: "Something went wrong, please try again.",
|
|
95
|
+
type: "error"
|
|
96
|
+
});
|
|
97
|
+
} finally {
|
|
98
|
+
_.value = !1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function e(t, n) {
|
|
102
|
+
switch (n = z(n), t) {
|
|
103
|
+
case K.Edit:
|
|
104
|
+
return i.updateIngredientGroup(n);
|
|
105
|
+
case K.Delete:
|
|
106
|
+
return i.deleteIngredientGroup(
|
|
107
|
+
n,
|
|
108
|
+
_,
|
|
109
|
+
() => v()
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const a = F(() => [
|
|
114
|
+
{
|
|
115
|
+
accessorKey: "name",
|
|
116
|
+
header: () => "Name"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
accessorKey: "skuRefs.length",
|
|
120
|
+
header: () => "No. of items"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
accessorKey: "ref",
|
|
124
|
+
header: () => "Reference"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: "action",
|
|
128
|
+
header: "",
|
|
129
|
+
cell(t) {
|
|
130
|
+
return Re(
|
|
131
|
+
[oe[K.Edit], oe[K.Delete]],
|
|
132
|
+
(n) => {
|
|
133
|
+
e(n, t.row.original);
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
},
|
|
137
|
+
enableSorting: !1,
|
|
138
|
+
size: 40,
|
|
139
|
+
meta: {
|
|
140
|
+
cellClass: "",
|
|
141
|
+
headerClass: ""
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
]);
|
|
145
|
+
return {
|
|
146
|
+
fetchIngredientGroups: v,
|
|
147
|
+
loading: _,
|
|
148
|
+
columnDefs: a
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
function qe(o) {
|
|
153
|
+
return {
|
|
154
|
+
addItem: () => {
|
|
155
|
+
const i = o.create();
|
|
156
|
+
o.items = [...o.items, i];
|
|
157
|
+
},
|
|
158
|
+
updateItem: (i) => {
|
|
159
|
+
i && (o.items = o.items.map(
|
|
160
|
+
(v) => o.id(v) === o.id(i) ? i : v
|
|
161
|
+
));
|
|
162
|
+
},
|
|
163
|
+
removeItem: (i) => {
|
|
164
|
+
o.items = o.items.filter((v) => o.id(v) !== o.id(i));
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function fe(o) {
|
|
169
|
+
const _ = Le(), f = L(), k = F(() => [
|
|
170
|
+
{
|
|
171
|
+
id: "delete",
|
|
172
|
+
header: "",
|
|
173
|
+
cell(e) {
|
|
174
|
+
const a = e.row.original;
|
|
175
|
+
return C(
|
|
176
|
+
"div",
|
|
177
|
+
{ class: "w-full flex justify-end" },
|
|
178
|
+
C(B.FmButton, {
|
|
179
|
+
class: "delete-button",
|
|
180
|
+
key: a._id,
|
|
181
|
+
type: "button",
|
|
182
|
+
icon: "delete",
|
|
183
|
+
variant: "tertiary",
|
|
184
|
+
size: "md",
|
|
185
|
+
disabled: o.disabled ?? !1,
|
|
186
|
+
onClick: () => {
|
|
187
|
+
o.skuRefs = o.skuRefs.filter((t) => t._id !== a._id);
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
);
|
|
191
|
+
},
|
|
192
|
+
enableSorting: !1,
|
|
193
|
+
size: 40,
|
|
194
|
+
meta: {
|
|
195
|
+
cellClass: "",
|
|
196
|
+
headerClass: ""
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "skuRef",
|
|
201
|
+
header: () => "Ingredient",
|
|
202
|
+
accessorFn: (e) => {
|
|
203
|
+
var a, t;
|
|
204
|
+
return `${((a = f.skuById[e._id]) == null ? void 0 : a.name) ?? ""} (${((t = f.skuById[e._id]) == null ? void 0 : t.code) ?? ""})`;
|
|
205
|
+
},
|
|
206
|
+
cell: ({ row: e }) => {
|
|
207
|
+
const a = f.skuById[e.original._id];
|
|
208
|
+
return C(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
class: "w-full flex flex-col"
|
|
212
|
+
},
|
|
213
|
+
[
|
|
214
|
+
C("div", { class: "fm-typo-en-body-lg-400 line-clamp-1" }, a.name),
|
|
215
|
+
C(
|
|
216
|
+
"div",
|
|
217
|
+
{ class: "fm-typo-en-body-md-400 line-clamp-1 text-fm-color-typo-secondary" },
|
|
218
|
+
a.code
|
|
219
|
+
)
|
|
220
|
+
]
|
|
221
|
+
);
|
|
222
|
+
},
|
|
223
|
+
size: "auto",
|
|
224
|
+
enableSorting: !1
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: "unit",
|
|
228
|
+
header: () => "Unit",
|
|
229
|
+
accessorFn: (e) => {
|
|
230
|
+
const a = f.skuById[e._id];
|
|
231
|
+
return a.unit.measurements.computeFirst(
|
|
232
|
+
(t) => t.id === e.trackingMeasurement ? t.name : null
|
|
233
|
+
) ?? a.unit.name;
|
|
234
|
+
},
|
|
235
|
+
enableSorting: !1
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: "unitOption",
|
|
239
|
+
header: () => "Unit",
|
|
240
|
+
accessorKey: "trackingMeasurement",
|
|
241
|
+
cell(e) {
|
|
242
|
+
const a = f.skuById[e.row.original._id];
|
|
243
|
+
if (!a) return null;
|
|
244
|
+
const t = [
|
|
245
|
+
{
|
|
246
|
+
label: a.unit.name,
|
|
247
|
+
sublabel: a.unit.abbrev,
|
|
248
|
+
value: null
|
|
249
|
+
},
|
|
250
|
+
...a.unit.measurements.map((n) => ({
|
|
251
|
+
label: n.name,
|
|
252
|
+
sublabel: n.abbrev,
|
|
253
|
+
value: n.id
|
|
254
|
+
}))
|
|
255
|
+
].filter((n) => !n.label.toLowerCase().includes("inactive"));
|
|
256
|
+
return C(B.FmSelect, {
|
|
257
|
+
modelValue: e.row.original.trackingMeasurement ?? null,
|
|
258
|
+
items: t,
|
|
259
|
+
disabled: o.disabled ?? !1,
|
|
260
|
+
"onUpdate:modelValue": (n) => {
|
|
261
|
+
o.skuRefs = o.skuRefs.map((s) => s._id === e.row.original._id ? { ...s, trackingMeasurement: n } : s);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
enableSorting: !1
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: "priority",
|
|
269
|
+
header: () => "Priority",
|
|
270
|
+
accessorKey: "priority",
|
|
271
|
+
enableSorting: !0,
|
|
272
|
+
cell(e) {
|
|
273
|
+
const a = e.row.original;
|
|
274
|
+
return C(B.FmTextField, {
|
|
275
|
+
modelValue: a.priority ?? e.row.index + 1,
|
|
276
|
+
rules: [
|
|
277
|
+
Ie(),
|
|
278
|
+
Se(1),
|
|
279
|
+
Ge(
|
|
280
|
+
o.skuRefs.filter((t) => t._id !== a._id).map((t) => {
|
|
281
|
+
const n = f.skuById[t._id];
|
|
282
|
+
return {
|
|
283
|
+
label: n == null ? void 0 : n.name,
|
|
284
|
+
value: t.priority
|
|
285
|
+
};
|
|
286
|
+
})
|
|
287
|
+
)
|
|
288
|
+
],
|
|
289
|
+
"onUpdate:modelValue": (t) => {
|
|
290
|
+
const n = Number(t);
|
|
291
|
+
isNaN(n) || (o.skuRefs = o.skuRefs.map((s) => s._id === e.row.original._id ? { ...s, priority: n } : s));
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
id: "default",
|
|
298
|
+
header: () => "",
|
|
299
|
+
accessorKey: "default",
|
|
300
|
+
cell(e) {
|
|
301
|
+
const a = f.skuById[e.row.original._id];
|
|
302
|
+
return a ? C(B.FmCheckbox, {
|
|
303
|
+
modelValue: e.row.original.default ?? !1,
|
|
304
|
+
value: a._id,
|
|
305
|
+
disabled: o.disabled ?? !1,
|
|
306
|
+
"onUpdate:modelValue": () => {
|
|
307
|
+
o.skuRefs = o.skuRefs.map((t) => t._id === e.row.original._id ? { ...t, default: !0 } : { ...t, default: !1 });
|
|
308
|
+
}
|
|
309
|
+
}) : null;
|
|
310
|
+
},
|
|
311
|
+
enableSorting: !1,
|
|
312
|
+
size: 40,
|
|
313
|
+
meta: {
|
|
314
|
+
cellClass: "",
|
|
315
|
+
headerClass: ""
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
id: "move",
|
|
320
|
+
header: "",
|
|
321
|
+
cell(e) {
|
|
322
|
+
const a = e.row.original;
|
|
323
|
+
return C("div", { class: "w-full flex justify-end" }, [
|
|
324
|
+
C(B.FmButton, {
|
|
325
|
+
key: a._id,
|
|
326
|
+
type: "button",
|
|
327
|
+
icon: "keyboard_arrow_up",
|
|
328
|
+
variant: "tertiary",
|
|
329
|
+
size: "md",
|
|
330
|
+
disabled: o.disabled ?? !1,
|
|
331
|
+
onClick: () => {
|
|
332
|
+
const t = [...o.skuRefs], n = t.findIndex((s) => s._id === a._id);
|
|
333
|
+
if (n > 0) {
|
|
334
|
+
const s = t[n - 1];
|
|
335
|
+
t[n - 1] = a, t[n] = s;
|
|
336
|
+
}
|
|
337
|
+
o.skuRefs = [...t];
|
|
338
|
+
}
|
|
339
|
+
}),
|
|
340
|
+
C(B.FmButton, {
|
|
341
|
+
key: a._id,
|
|
342
|
+
type: "button",
|
|
343
|
+
icon: "keyboard_arrow_down",
|
|
344
|
+
variant: "tertiary",
|
|
345
|
+
size: "md",
|
|
346
|
+
disabled: o.disabled ?? !1,
|
|
347
|
+
onClick: () => {
|
|
348
|
+
const t = [...o.skuRefs], n = t.findIndex((s) => s._id === a._id);
|
|
349
|
+
if (n < t.length - 1) {
|
|
350
|
+
const s = t[n + 1];
|
|
351
|
+
t[n + 1] = a, t[n] = s;
|
|
352
|
+
}
|
|
353
|
+
o.skuRefs = [...t];
|
|
354
|
+
}
|
|
355
|
+
})
|
|
356
|
+
]);
|
|
357
|
+
},
|
|
358
|
+
enableSorting: !1,
|
|
359
|
+
size: 40,
|
|
360
|
+
meta: {
|
|
361
|
+
cellClass: "",
|
|
362
|
+
headerClass: ""
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
]);
|
|
366
|
+
return {
|
|
367
|
+
get columnDefs() {
|
|
368
|
+
return k.value;
|
|
369
|
+
},
|
|
370
|
+
promptAddIngredient: async () => {
|
|
371
|
+
if (!o.isDefaultList && !o.allowOverride)
|
|
372
|
+
return _.alert("Not allowed", "You cannot add ingredients to this list.");
|
|
373
|
+
const v = f.skus.map((t) => ({
|
|
374
|
+
label: t.name,
|
|
375
|
+
sublabel: t.code,
|
|
376
|
+
value: t._id
|
|
377
|
+
})), e = (o.skuRefs ?? []).map((t) => t._id), a = await _.multiSelect(v, e, (t) => {
|
|
378
|
+
var s, g, u, m, r, y;
|
|
379
|
+
const n = (s = o.skuRefs) == null ? void 0 : s.findIndex((w) => w._id === t);
|
|
380
|
+
return {
|
|
381
|
+
_id: t,
|
|
382
|
+
trackingMeasurement: typeof n != "number" || n == -1 ? (g = f.skuById[t]) == null ? void 0 : g.trackingMeasurement : (m = (u = o.skuRefs) == null ? void 0 : u[n]) == null ? void 0 : m.trackingMeasurement,
|
|
383
|
+
priority: ((y = (r = o.skuRefs) == null ? void 0 : r[n]) == null ? void 0 : y.priority) ?? o.skuRefs.length,
|
|
384
|
+
default: !1
|
|
385
|
+
};
|
|
386
|
+
});
|
|
387
|
+
o.skuRefs = a ?? o.skuRefs;
|
|
388
|
+
},
|
|
389
|
+
columnVisibility: {
|
|
390
|
+
delete: o.isDefaultList || !!o.allowOverride,
|
|
391
|
+
unit: !o.isDefaultList && !o.allowOverride,
|
|
392
|
+
unitOption: o.isDefaultList || !!o.allowOverride,
|
|
393
|
+
// previous demo: sort priority by moving sku element in the array,
|
|
394
|
+
// new demo: sort priority using priority field.
|
|
395
|
+
// can reenable if this use case is requested to be restored
|
|
396
|
+
move: !1
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
const Ke = { class: "flex flex-col gap-16" }, je = { class: "flex flex-col" }, He = { class: "flex flex-col gap-4" }, Je = { class: "flex flex-col gap-16" }, Ye = { class: "flex flex-col" }, Qe = { class: "flex flex-col gap-4" }, We = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xe = /* @__PURE__ */ j({
|
|
401
|
+
__name: "IngredientGroupRuleField",
|
|
402
|
+
props: {
|
|
403
|
+
disabled: { type: Boolean },
|
|
404
|
+
modelValue: {}
|
|
405
|
+
},
|
|
406
|
+
setup(o) {
|
|
407
|
+
const _ = o, { t: f } = P(), k = ze(), i = F(() => {
|
|
408
|
+
var g;
|
|
409
|
+
const n = /* @__PURE__ */ new Map(), s = k.restaurants.value.map((u) => u.customAttributes ?? {});
|
|
410
|
+
for (const u of s)
|
|
411
|
+
for (const [m, r] of Object.entries(u))
|
|
412
|
+
n.has(m) || n.set(m, /* @__PURE__ */ new Set()), r && ((g = n.get(m)) == null || g.add(r));
|
|
413
|
+
return n;
|
|
414
|
+
}), v = F(() => [
|
|
415
|
+
...[...i.value.entries()].map(([s, g]) => ({
|
|
416
|
+
type: "string",
|
|
417
|
+
key: s,
|
|
418
|
+
entity: "restaurant",
|
|
419
|
+
values: [...g]
|
|
420
|
+
}))
|
|
421
|
+
]), e = ue("modelValue", {
|
|
422
|
+
get default() {
|
|
423
|
+
return {
|
|
424
|
+
_id: `skuGroupRule_${(/* @__PURE__ */ new Date()).toISOString()}_${me(4)}`,
|
|
425
|
+
name: "",
|
|
426
|
+
rule: null,
|
|
427
|
+
skuRefs: []
|
|
428
|
+
};
|
|
429
|
+
},
|
|
430
|
+
watchProps: !0
|
|
431
|
+
}), a = A(e.rule ? Fe.build(e.rule) : null);
|
|
432
|
+
re(
|
|
433
|
+
a,
|
|
434
|
+
(n) => {
|
|
435
|
+
e.rule = n ? Ve.build(n) : null;
|
|
436
|
+
},
|
|
437
|
+
{ deep: !0, immediate: !0 }
|
|
438
|
+
);
|
|
439
|
+
const t = fe({
|
|
440
|
+
get disabled() {
|
|
441
|
+
return _.disabled ?? !1;
|
|
442
|
+
},
|
|
443
|
+
get skuRefs() {
|
|
444
|
+
return e.skuRefs ?? [];
|
|
445
|
+
},
|
|
446
|
+
set skuRefs(n) {
|
|
447
|
+
e.skuRefs = n;
|
|
448
|
+
},
|
|
449
|
+
isDefaultList: !1,
|
|
450
|
+
allowOverride: !1
|
|
451
|
+
});
|
|
452
|
+
return (n, s) => {
|
|
453
|
+
const g = R("FmTextField"), u = R("FmLabel"), m = R("FmFormGroup"), r = R("FmTable");
|
|
454
|
+
return G(), U("div", Ke, [
|
|
455
|
+
b(g, {
|
|
456
|
+
modelValue: l(e).name,
|
|
457
|
+
"onUpdate:modelValue": s[0] || (s[0] = (y) => l(e).name = y),
|
|
458
|
+
label: l(f)("inventory.ingredientGroup.form.rules.name"),
|
|
459
|
+
"label-mark": "required",
|
|
460
|
+
rules: [l(de)()]
|
|
461
|
+
}, null, 8, ["modelValue", "label", "rules"]),
|
|
462
|
+
c("div", je, [
|
|
463
|
+
c("div", He, [
|
|
464
|
+
b(u, {
|
|
465
|
+
label: l(f)("inventory.ingredientGroup.form.rules.title"),
|
|
466
|
+
required: ""
|
|
467
|
+
}, null, 8, ["label"]),
|
|
468
|
+
b(l(Ce), {
|
|
469
|
+
modelValue: a.value,
|
|
470
|
+
"onUpdate:modelValue": s[1] || (s[1] = (y) => a.value = y),
|
|
471
|
+
attributes: v.value
|
|
472
|
+
}, null, 8, ["modelValue", "attributes"])
|
|
473
|
+
]),
|
|
474
|
+
b(m, {
|
|
475
|
+
"model-value": a.value,
|
|
476
|
+
rules: [
|
|
477
|
+
(y) => {
|
|
478
|
+
var w;
|
|
479
|
+
return !!((w = y == null ? void 0 : y.rules) != null && w.length) || "At least one rule is required";
|
|
480
|
+
}
|
|
481
|
+
]
|
|
482
|
+
}, null, 8, ["model-value", "rules"])
|
|
483
|
+
]),
|
|
484
|
+
c("div", Je, [
|
|
485
|
+
c("div", Ye, [
|
|
486
|
+
c("div", Qe, [
|
|
487
|
+
c("div", null, [
|
|
488
|
+
b(u, {
|
|
489
|
+
label: l(f)("inventory.ingredientGroup.form.rules.ingredients"),
|
|
490
|
+
required: ""
|
|
491
|
+
}, null, 8, ["label"])
|
|
492
|
+
])
|
|
493
|
+
]),
|
|
494
|
+
b(m, {
|
|
495
|
+
"model-value": l(e).skuRefs,
|
|
496
|
+
rules: [
|
|
497
|
+
(y) => !!(y != null && y.length) || "At least one ingredient is required"
|
|
498
|
+
]
|
|
499
|
+
}, null, 8, ["model-value", "rules"])
|
|
500
|
+
]),
|
|
501
|
+
b(r, {
|
|
502
|
+
"row-data": l(e).skuRefs,
|
|
503
|
+
"column-defs": l(t).columnDefs,
|
|
504
|
+
"page-size": l(e).skuRefs.length,
|
|
505
|
+
"shrink-at": 9999,
|
|
506
|
+
"column-visibility": l(t).columnVisibility,
|
|
507
|
+
"hide-footer": ""
|
|
508
|
+
}, null, 8, ["row-data", "column-defs", "page-size", "column-visibility"])
|
|
509
|
+
]),
|
|
510
|
+
c("div", We, $(l(f)("inventory.ingredientGroup.form.defaultRule.defaultCheckbox")), 1)
|
|
511
|
+
]);
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
}), Ze = { class: "flex flex-col gap-16" }, et = { class: "flex flex-col gap-16" }, tt = { class: "flex flex-col" }, nt = { class: "flex items-center" }, st = { class: "flex-1" }, ot = { class: "flex flex-col gap-8" }, at = { class: "flex-1 fm-typo-en-title-sm-600" }, lt = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary px-4" }, it = { class: "flex flex-col gap-16" }, rt = { class: "flex flex-col gap-8" }, ut = { class: "flex-1 fm-typo-en-title-sm-600" }, dt = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ct = { class: "flex flex-col gap-12" }, mt = { class: "flex items-center" }, ft = { class: "flex-1 fm-typo-en-body-lg-600 line-clamp-1" }, pt = { key: 0 }, vt = {
|
|
515
|
+
key: 1,
|
|
516
|
+
class: "fm-typo-en-body-lg-400"
|
|
517
|
+
}, yt = /* @__PURE__ */ j({
|
|
518
|
+
__name: "IngredientGroupForm",
|
|
519
|
+
props: {
|
|
520
|
+
mode: {},
|
|
521
|
+
disabled: { type: Boolean },
|
|
522
|
+
modelValue: {},
|
|
523
|
+
menu: {}
|
|
524
|
+
},
|
|
525
|
+
emits: ["validation-success"],
|
|
526
|
+
setup(o, { expose: _, emit: f }) {
|
|
527
|
+
const k = o, i = ue("modelValue", {
|
|
528
|
+
watchProps: !0
|
|
529
|
+
}), v = f, { t: e } = P(), a = qe({
|
|
530
|
+
get items() {
|
|
531
|
+
return i.rules ?? [];
|
|
532
|
+
},
|
|
533
|
+
set items(s) {
|
|
534
|
+
i.rules = s;
|
|
535
|
+
},
|
|
536
|
+
create: function() {
|
|
537
|
+
var s;
|
|
538
|
+
return {
|
|
539
|
+
_id: `skuGroupRule_${(/* @__PURE__ */ new Date()).toISOString()}_${me(4)}`,
|
|
540
|
+
name: "",
|
|
541
|
+
rule: null,
|
|
542
|
+
skuRefs: ((s = k.modelValue) == null ? void 0 : s.defaultSkuRefs) ?? []
|
|
543
|
+
};
|
|
544
|
+
},
|
|
545
|
+
id: function(s) {
|
|
546
|
+
return s._id;
|
|
547
|
+
}
|
|
548
|
+
}), t = fe({
|
|
549
|
+
get disabled() {
|
|
550
|
+
return k.disabled;
|
|
551
|
+
},
|
|
552
|
+
get skuRefs() {
|
|
553
|
+
return i.defaultSkuRefs ?? [];
|
|
554
|
+
},
|
|
555
|
+
set skuRefs(s) {
|
|
556
|
+
i.defaultSkuRefs = s;
|
|
557
|
+
const g = s.map((r) => r._id), u = i.rules;
|
|
558
|
+
if (!u) return;
|
|
559
|
+
const m = s.groupBy(
|
|
560
|
+
(r) => r._id,
|
|
561
|
+
(r) => r.trackingMeasurement
|
|
562
|
+
);
|
|
563
|
+
for (const r of u) {
|
|
564
|
+
const y = r.skuRefs.filter((x) => g.includes(x._id)), w = s.filter(
|
|
565
|
+
(x) => !y.some((I) => I._id === x._id)
|
|
566
|
+
);
|
|
567
|
+
r.skuRefs = [...y, ...w].map((x) => {
|
|
568
|
+
var I;
|
|
569
|
+
return {
|
|
570
|
+
...x,
|
|
571
|
+
trackingMeasurement: ((I = m.get(x._id)) == null ? void 0 : I[0]) ?? null
|
|
572
|
+
};
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
i.rules = [...u];
|
|
576
|
+
},
|
|
577
|
+
isDefaultList: !0
|
|
578
|
+
}), n = A();
|
|
579
|
+
return _({
|
|
580
|
+
validateInputs: () => {
|
|
581
|
+
var s;
|
|
582
|
+
return (s = n.value) == null ? void 0 : s.validateInputs();
|
|
583
|
+
},
|
|
584
|
+
resetInputsValidation: () => {
|
|
585
|
+
var s;
|
|
586
|
+
return (s = n.value) == null ? void 0 : s.resetInputsValidation();
|
|
587
|
+
},
|
|
588
|
+
resetInputs: () => {
|
|
589
|
+
var s;
|
|
590
|
+
return (s = n.value) == null ? void 0 : s.resetInputs();
|
|
591
|
+
}
|
|
592
|
+
}), (s, g) => {
|
|
593
|
+
const u = R("FmTextField"), m = R("FmButton"), r = R("FmFormGroup"), y = R("FmTable"), w = R("FmCard"), x = R("FmForm");
|
|
594
|
+
return G(), M(x, {
|
|
595
|
+
onValidationSuccess: g[2] || (g[2] = (I) => v("validation-success")),
|
|
596
|
+
ref_key: "formRef",
|
|
597
|
+
ref: n,
|
|
598
|
+
class: "flex flex-col gap-64"
|
|
599
|
+
}, {
|
|
600
|
+
default: T(() => {
|
|
601
|
+
var I;
|
|
602
|
+
return [
|
|
603
|
+
c("div", Ze, [
|
|
604
|
+
b(u, {
|
|
605
|
+
label: l(e)("inventory.ingredientGroup.form.name"),
|
|
606
|
+
"label-mark": "required",
|
|
607
|
+
rules: [l(de)()],
|
|
608
|
+
modelValue: l(i).name,
|
|
609
|
+
"onUpdate:modelValue": g[0] || (g[0] = (d) => l(i).name = d)
|
|
610
|
+
}, null, 8, ["label", "rules", "modelValue"]),
|
|
611
|
+
b(u, {
|
|
612
|
+
label: l(e)("inventory.ingredientGroup.form.ref"),
|
|
613
|
+
"label-mark": "optional",
|
|
614
|
+
modelValue: l(i).ref,
|
|
615
|
+
"onUpdate:modelValue": g[1] || (g[1] = (d) => l(i).ref = d)
|
|
616
|
+
}, null, 8, ["label", "modelValue"])
|
|
617
|
+
]),
|
|
618
|
+
c("div", et, [
|
|
619
|
+
c("div", tt, [
|
|
620
|
+
c("div", nt, [
|
|
621
|
+
c("div", st, [
|
|
622
|
+
c("div", ot, [
|
|
623
|
+
c("div", at, $(l(e)("inventory.ingredientGroup.form.defaultRule.title")), 1)
|
|
624
|
+
])
|
|
625
|
+
]),
|
|
626
|
+
c("div", null, [
|
|
627
|
+
b(m, {
|
|
628
|
+
disabled: s.disabled,
|
|
629
|
+
label: "Add ingredient",
|
|
630
|
+
"prepend-icon": "link",
|
|
631
|
+
variant: "plain",
|
|
632
|
+
class: "border-1 rounded-lg border-fm-color-primary",
|
|
633
|
+
onClick: l(t).promptAddIngredient,
|
|
634
|
+
size: "md"
|
|
635
|
+
}, null, 8, ["disabled", "onClick"])
|
|
636
|
+
])
|
|
637
|
+
]),
|
|
638
|
+
b(r, {
|
|
639
|
+
"model-value": l(i).defaultSkuRefs,
|
|
640
|
+
rules: [
|
|
641
|
+
(d) => !!(d != null && d.length) || "At least one ingredient is required"
|
|
642
|
+
]
|
|
643
|
+
}, null, 8, ["model-value", "rules"])
|
|
644
|
+
]),
|
|
645
|
+
c("div", null, [
|
|
646
|
+
b(y, {
|
|
647
|
+
"row-data": l(i).defaultSkuRefs ?? [],
|
|
648
|
+
"column-defs": l(t).columnDefs,
|
|
649
|
+
"column-visibility": l(t).columnVisibility,
|
|
650
|
+
"page-size": (I = l(i).defaultSkuRefs) == null ? void 0 : I.length,
|
|
651
|
+
"shrink-at": 9999,
|
|
652
|
+
"hide-footer": ""
|
|
653
|
+
}, null, 8, ["row-data", "column-defs", "column-visibility", "page-size"])
|
|
654
|
+
]),
|
|
655
|
+
c("div", lt, $(l(e)("inventory.ingredientGroup.form.defaultRule.defaultCheckbox")), 1)
|
|
656
|
+
]),
|
|
657
|
+
c("div", it, [
|
|
658
|
+
c("div", rt, [
|
|
659
|
+
c("div", ut, $(l(e)("inventory.ingredientGroup.form.rules.title")), 1),
|
|
660
|
+
c("div", dt, $(l(e)("inventory.ingredientGroup.form.rules.description")), 1)
|
|
661
|
+
]),
|
|
662
|
+
(G(!0), U(pe, null, ve(l(i).rules, (d, p) => (G(), M(w, {
|
|
663
|
+
key: d.id,
|
|
664
|
+
variant: "outlined",
|
|
665
|
+
class: "p-16"
|
|
666
|
+
}, {
|
|
667
|
+
default: T(() => [
|
|
668
|
+
c("div", ct, [
|
|
669
|
+
c("div", mt, [
|
|
670
|
+
c("div", ft, [
|
|
671
|
+
ye($(l(e)("inventory.ingredientGroup.form.rules.rule_N", [p + 1])), 1),
|
|
672
|
+
d.name ? (G(), U("span", pt, ": ")) : se("", !0),
|
|
673
|
+
d.name ? (G(), U("span", vt, $(d.name), 1)) : se("", !0)
|
|
674
|
+
]),
|
|
675
|
+
b(m, {
|
|
676
|
+
variant: "tertiary",
|
|
677
|
+
icon: "delete",
|
|
678
|
+
onClick: (h) => l(a).removeItem(d)
|
|
679
|
+
}, null, 8, ["onClick"])
|
|
680
|
+
]),
|
|
681
|
+
c("div", null, [
|
|
682
|
+
(G(), M(Xe, {
|
|
683
|
+
key: d._id,
|
|
684
|
+
"model-value": d,
|
|
685
|
+
"onUpdate:modelValue": l(a).updateItem,
|
|
686
|
+
disabled: s.disabled,
|
|
687
|
+
menu: s.menu
|
|
688
|
+
}, null, 8, ["model-value", "onUpdate:modelValue", "disabled", "menu"]))
|
|
689
|
+
])
|
|
690
|
+
])
|
|
691
|
+
]),
|
|
692
|
+
_: 2
|
|
693
|
+
}, 1024))), 128)),
|
|
694
|
+
c("div", null, [
|
|
695
|
+
b(m, {
|
|
696
|
+
variant: "plain",
|
|
697
|
+
icon: "add",
|
|
698
|
+
label: l(e)("inventory.ingredientGroup.form.rules.addRule"),
|
|
699
|
+
onClick: l(a).addItem
|
|
700
|
+
}, null, 8, ["label", "onClick"])
|
|
701
|
+
])
|
|
702
|
+
])
|
|
703
|
+
];
|
|
704
|
+
}),
|
|
705
|
+
_: 1
|
|
706
|
+
}, 512);
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
}), gt = {
|
|
710
|
+
key: 0,
|
|
711
|
+
class: "text-fm-color-typo-primary fm-typo-en-body-lg-400"
|
|
712
|
+
}, _t = { class: "flex gap-4" }, bt = /* @__PURE__ */ j({
|
|
713
|
+
__name: "IngredientGroupDialog",
|
|
714
|
+
props: {
|
|
715
|
+
show: { type: Boolean },
|
|
716
|
+
mode: { default: S.READ },
|
|
717
|
+
modelValue: {}
|
|
718
|
+
},
|
|
719
|
+
emits: ["update:show"],
|
|
720
|
+
setup(o) {
|
|
721
|
+
const _ = o, f = L(), k = Pe(() => f.readCachedMenu()), i = F(
|
|
722
|
+
() => k.result.value.state === Ne.success ? k.result.value.data : void 0
|
|
723
|
+
), v = J(), { t: e } = P(), a = Be(_, "show");
|
|
724
|
+
function t() {
|
|
725
|
+
return {
|
|
726
|
+
_id: "",
|
|
727
|
+
name: "",
|
|
728
|
+
rules: []
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
const n = A(t()), s = A(`${Math.random()}`);
|
|
732
|
+
re(
|
|
733
|
+
() => _.show,
|
|
734
|
+
(d) => {
|
|
735
|
+
if (!d) return;
|
|
736
|
+
let p = z(_.modelValue ?? t());
|
|
737
|
+
p.defaultSkuRefs && (p.defaultSkuRefs = p.defaultSkuRefs.map((h, V) => ({
|
|
738
|
+
...h,
|
|
739
|
+
priority: h.priority ?? V + 1
|
|
740
|
+
})));
|
|
741
|
+
for (let h = 0; p.rules && h < p.rules.length; h++) {
|
|
742
|
+
const V = p.rules[h];
|
|
743
|
+
V.skuRefs = V.skuRefs.map((D, E) => ({
|
|
744
|
+
...D,
|
|
745
|
+
priority: D.priority ?? E + 1
|
|
746
|
+
}));
|
|
747
|
+
}
|
|
748
|
+
n.value = p, s.value = p._id || `${Math.random()}`;
|
|
749
|
+
}
|
|
750
|
+
);
|
|
751
|
+
const g = F(() => {
|
|
752
|
+
switch (_.mode) {
|
|
753
|
+
case S.READ:
|
|
754
|
+
return "";
|
|
755
|
+
case S.UPDATE:
|
|
756
|
+
return e("inventory.ingredientGroup.update.title");
|
|
757
|
+
case S.CREATE:
|
|
758
|
+
return e("inventory.ingredientGroup.create.title");
|
|
759
|
+
}
|
|
760
|
+
return "";
|
|
761
|
+
}), u = F(() => {
|
|
762
|
+
switch (_.mode) {
|
|
763
|
+
case S.READ:
|
|
764
|
+
return "";
|
|
765
|
+
case S.UPDATE:
|
|
766
|
+
return e("common.save");
|
|
767
|
+
case S.CREATE:
|
|
768
|
+
return e("common.add");
|
|
769
|
+
}
|
|
770
|
+
return "";
|
|
771
|
+
}), m = A(), r = A(!1);
|
|
772
|
+
async function y() {
|
|
773
|
+
r.value = !0;
|
|
774
|
+
const d = z(n.value);
|
|
775
|
+
try {
|
|
776
|
+
await f.createSkuGroup(d), a.value = !1, v.open({
|
|
777
|
+
title: e("inventory.common.success"),
|
|
778
|
+
message: e("inventory.ingredientGroup.create.success", { name: d.name }),
|
|
779
|
+
type: "success"
|
|
780
|
+
});
|
|
781
|
+
} catch (p) {
|
|
782
|
+
p instanceof ae || v.open({
|
|
783
|
+
title: e("inventory.ingredientGroup.create.error.title"),
|
|
784
|
+
message: e("inventory.ingredientGroup.create.error.message"),
|
|
785
|
+
type: "error"
|
|
786
|
+
});
|
|
787
|
+
} finally {
|
|
788
|
+
r.value = !1;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
async function w() {
|
|
792
|
+
r.value = !0;
|
|
793
|
+
const d = z(n.value);
|
|
794
|
+
try {
|
|
795
|
+
await f.updateSkuGroup(d), r.value = !1, a.value = !1, v.open({
|
|
796
|
+
title: e("inventory.common.success"),
|
|
797
|
+
message: e("inventory.ingredientGroup.update.success", { name: d.name }),
|
|
798
|
+
type: "success"
|
|
799
|
+
});
|
|
800
|
+
} catch (p) {
|
|
801
|
+
p instanceof ae || v.open({
|
|
802
|
+
title: e("inventory.ingredientGroup.update.error.title"),
|
|
803
|
+
message: e("inventory.ingredientGroup.update.error.message"),
|
|
804
|
+
type: "error"
|
|
805
|
+
});
|
|
806
|
+
} finally {
|
|
807
|
+
r.value = !1;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
function x() {
|
|
811
|
+
var d, p;
|
|
812
|
+
(p = (d = m.value) == null ? void 0 : d.validateInputs) == null || p.call(d);
|
|
813
|
+
}
|
|
814
|
+
function I() {
|
|
815
|
+
switch (_.mode) {
|
|
816
|
+
case S.READ:
|
|
817
|
+
return;
|
|
818
|
+
case S.UPDATE:
|
|
819
|
+
return w();
|
|
820
|
+
case S.CREATE:
|
|
821
|
+
return y();
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
return (d, p) => {
|
|
825
|
+
const h = R("FmButton"), V = R("FmSideSheet");
|
|
826
|
+
return G(), M(V, {
|
|
827
|
+
"model-value": l(a),
|
|
828
|
+
"onUpdate:modelValue": p[3] || (p[3] = (D) => ge(a) ? a.value = D : null),
|
|
829
|
+
header: g.value,
|
|
830
|
+
"close-button": "",
|
|
831
|
+
"dismiss-away": "",
|
|
832
|
+
"max-width": 800
|
|
833
|
+
}, {
|
|
834
|
+
"side-sheet-footer": T(() => [
|
|
835
|
+
c("div", _t, [
|
|
836
|
+
b(h, {
|
|
837
|
+
loading: r.value,
|
|
838
|
+
label: u.value,
|
|
839
|
+
onClick: x
|
|
840
|
+
}, null, 8, ["loading", "label"]),
|
|
841
|
+
b(h, {
|
|
842
|
+
disabled: r.value,
|
|
843
|
+
label: l(e)("common.close"),
|
|
844
|
+
variant: "tertiary",
|
|
845
|
+
onClick: p[2] || (p[2] = (D) => a.value = !1)
|
|
846
|
+
}, null, 8, ["disabled", "label"])
|
|
847
|
+
])
|
|
848
|
+
]),
|
|
849
|
+
default: T(() => [
|
|
850
|
+
i.value ? (G(), M(yt, {
|
|
851
|
+
menu: i.value,
|
|
852
|
+
class: "w-full",
|
|
853
|
+
ref_key: "hasValidationExpose",
|
|
854
|
+
ref: m,
|
|
855
|
+
key: s.value,
|
|
856
|
+
"model-value": n.value,
|
|
857
|
+
"onUpdate:modelValue": p[0] || (p[0] = (D) => n.value = D),
|
|
858
|
+
mode: d.mode,
|
|
859
|
+
disabled: r.value,
|
|
860
|
+
onValidationSuccess: p[1] || (p[1] = (D) => I())
|
|
861
|
+
}, null, 8, ["menu", "model-value", "mode", "disabled"])) : (G(), U("div", gt, "Loading.."))
|
|
862
|
+
]),
|
|
863
|
+
_: 1
|
|
864
|
+
}, 8, ["model-value", "header"]);
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
}), kt = { class: "flex flex-col py-8" }, xt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ht = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, At = /* @__PURE__ */ j({
|
|
868
|
+
__name: "IngredientGroupView",
|
|
869
|
+
setup(o) {
|
|
870
|
+
const _ = L(), f = F(() => _.skuGroups), k = De(), { t: i } = P(), {
|
|
871
|
+
createIngredientGroup: v,
|
|
872
|
+
updateIngredientGroup: e,
|
|
873
|
+
importIngredientGroups: a,
|
|
874
|
+
exportIngredientGroups: t
|
|
875
|
+
} = H(), { columnDefs: n, loading: s } = ie(Oe()), { ingredientGroupDialogProps: g } = ie(H());
|
|
876
|
+
function u(h) {
|
|
877
|
+
switch (h) {
|
|
878
|
+
case "add":
|
|
879
|
+
return v();
|
|
880
|
+
case "import":
|
|
881
|
+
return a();
|
|
882
|
+
case "export":
|
|
883
|
+
return t();
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
const m = A(""), r = A(!1), y = F(() => r.value || s.value), { breakpoints: w } = Ue(), x = F(() => w.value.xs || w.value.sm), I = F(() => x.value ? 10 : 20), d = Ae(), p = F(() => [
|
|
887
|
+
{
|
|
888
|
+
label: i("inventory.ingredient.create.title"),
|
|
889
|
+
value: "add",
|
|
890
|
+
isPrimary: !0,
|
|
891
|
+
prependIcon: "add"
|
|
892
|
+
},
|
|
893
|
+
{ label: i("common.import"), value: "import" },
|
|
894
|
+
{ label: i("common.export"), value: "export" }
|
|
895
|
+
]);
|
|
896
|
+
return (h, V) => {
|
|
897
|
+
const D = R("FmTable");
|
|
898
|
+
return G(), M($e, {
|
|
899
|
+
title: l(i)("inventory.ingredientGroup.title"),
|
|
900
|
+
actions: p.value,
|
|
901
|
+
"onClick:action": u
|
|
902
|
+
}, {
|
|
903
|
+
default: T(() => [
|
|
904
|
+
c("div", {
|
|
905
|
+
class: _e([
|
|
906
|
+
"flex flex-col gap-8 max-h-full",
|
|
907
|
+
{
|
|
908
|
+
"p-0": x.value,
|
|
909
|
+
"px-24 ": !x.value
|
|
910
|
+
}
|
|
911
|
+
])
|
|
912
|
+
}, [
|
|
913
|
+
b(Te, {
|
|
914
|
+
searchable: "",
|
|
915
|
+
search: m.value,
|
|
916
|
+
"onUpdate:search": V[0] || (V[0] = (E) => m.value = E)
|
|
917
|
+
}, null, 8, ["search"]),
|
|
918
|
+
b(D, {
|
|
919
|
+
style: be(l(d).tableHeight),
|
|
920
|
+
"column-defs": l(n),
|
|
921
|
+
"row-data": f.value,
|
|
922
|
+
"search-value": m.value,
|
|
923
|
+
loading: !l(k)._currentLocation || y.value,
|
|
924
|
+
"loading-text": "Loading",
|
|
925
|
+
onRowClick: V[1] || (V[1] = (E) => l(e)(E.original)),
|
|
926
|
+
"page-size": I.value
|
|
927
|
+
}, {
|
|
928
|
+
"list-row": T((E) => [
|
|
929
|
+
b(Ee, {
|
|
930
|
+
row: E,
|
|
931
|
+
onRowClick: l(e)
|
|
932
|
+
}, ke({
|
|
933
|
+
default: T((N) => {
|
|
934
|
+
var Y, Q, W, O, X, Z, ee, te, q, ne;
|
|
935
|
+
return [
|
|
936
|
+
c("div", kt, [
|
|
937
|
+
c("div", xt, [
|
|
938
|
+
b(l(le), {
|
|
939
|
+
render: (W = (Q = (Y = N.code) == null ? void 0 : Y.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
|
|
940
|
+
props: (X = (O = N.code) == null ? void 0 : O.getContext) == null ? void 0 : X.call(O)
|
|
941
|
+
}, null, 8, ["render", "props"])
|
|
942
|
+
]),
|
|
943
|
+
c("div", ht, [
|
|
944
|
+
b(l(le), {
|
|
945
|
+
render: (te = (ee = (Z = N.name) == null ? void 0 : Z.column) == null ? void 0 : ee.columnDef) == null ? void 0 : te.cell,
|
|
946
|
+
props: (ne = (q = N.name) == null ? void 0 : q.getContext) == null ? void 0 : ne.call(q)
|
|
947
|
+
}, null, 8, ["render", "props"])
|
|
948
|
+
])
|
|
949
|
+
])
|
|
950
|
+
];
|
|
951
|
+
}),
|
|
952
|
+
_: 2
|
|
953
|
+
}, [
|
|
954
|
+
r.value ? {
|
|
955
|
+
name: "loading-text",
|
|
956
|
+
fn: T(() => [
|
|
957
|
+
c("div", null, $(l(i)("inventory.ingredient.table.importing")), 1)
|
|
958
|
+
]),
|
|
959
|
+
key: "0"
|
|
960
|
+
} : void 0
|
|
961
|
+
]), 1032, ["row", "onRowClick"])
|
|
962
|
+
]),
|
|
963
|
+
_: 1
|
|
964
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
965
|
+
], 2),
|
|
966
|
+
(G(), M(xe, { to: "body" }, [
|
|
967
|
+
b(bt, he(we(l(g))), null, 16)
|
|
968
|
+
]))
|
|
969
|
+
]),
|
|
970
|
+
_: 1
|
|
971
|
+
}, 8, ["title", "actions"]);
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
export {
|
|
976
|
+
At as default
|
|
977
|
+
};
|