@feedmepos/mf-inventory-portal 1.5.9 → 1.5.11-dev.1
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-D_elK-3W.js → App-D4rysNfh.js} +4 -4
- package/dist/{ApprovalView-WdSQEpGQ.js → ApprovalView-DpYJmgiG.js} +7 -7
- package/dist/{BindingsDialog-CkqhKrrD.js → BindingsDialog-C7z0HH48.js} +2 -2
- package/dist/{BindingsPicker-HPjbSTJd.js → BindingsPicker-C5IKp9CT.js} +2 -2
- package/dist/{BindingsTable-BF4WTUsf.js → BindingsTable-BRDooCs4.js} +3 -3
- package/dist/{ClosingDraftView-CTEaBuhS.js → ClosingDraftView-CSCbfIFE.js} +159 -158
- package/dist/ClosingHistoryView-DCIJ5ONT.js +1114 -0
- package/dist/{ClosingTemplateView-DMtIj04r.js → ClosingTemplateView-D1n9_dFc.js} +14 -14
- package/dist/{DefaultView-v-32G42G.js → DefaultView-Llrh9ufI.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-DHD9kykc.js → DeliveryOrderPrintPreview-DSkU-sqv.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-FRe1RX5T.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DL6AKT9H.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-KTtYD7qS.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-JHabBWJb.js} +2 -2
- package/dist/{FmMultiselectDialog-BTNJvhnt.js → FmMultiselectDialog-BWujDEnX.js} +2 -2
- package/dist/{FmMultiselectDialog-LmjSdrn3.js → FmMultiselectDialog-C0lCYHla.js} +1 -1
- package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-CjCNHugK.js +388 -0
- package/dist/{ImportView-DoHL35I-.js → ImportView-C6q4gB3S.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-D8JocFRD.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Df7B8ZEG.js} +1 -1
- package/dist/{IngredientGroupView-CVhShbuq.js → IngredientGroupView-DO8OKEVU.js} +5 -5
- package/dist/{IngredientsView-XOTuP5ZI.js → IngredientsView-CD2YtXPJ.js} +15 -15
- package/dist/{IntegrationExplorerView-BsY4Ca2E.js → IntegrationExplorerView-CZCMnwZG.js} +352 -352
- package/dist/{IntegrationView-C_Y3_I_8.js → IntegrationView--3nVS_X6.js} +13 -13
- package/dist/{InventoryBindingForm-CHsrJSnp.js → InventoryBindingForm-FjFTiN7R.js} +1 -1
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CcF5cko8.js +441 -0
- package/dist/{InventoryBindingSummary-C9UE6Zh2.js → InventoryBindingSummary-D90hAi96.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DFj3HtnZ.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-1iDUXU2T.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-oNk0zO9K.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DTYnX8kn.js} +1 -1
- package/dist/{PublishView-DVk0ZUlG.js → PublishView-BtcGl7zM.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-poHk4RMP.js → PurchaseOrderPrintPreview-DvkMQv1w.js} +2 -2
- package/dist/{ReceiveRequestView-CaPoxKBs.js → ReceiveRequestView-DSfj36r3.js} +9631 -9552
- package/dist/{RecipeView-bbhd-mNL.js → RecipeView-DkDSr3LN.js} +1304 -1267
- package/dist/{SettingsView-DxiMiFpz.js → SettingsView-iRqUoEPg.js} +4 -4
- package/dist/{StockView-Dc4ICHq3.js → StockView-DxUXHYD_.js} +279 -278
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cn3NL6mQ.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-WJ0Fz21v.js} +1 -1
- package/dist/{SupplierView-6fETAO2h.js → SupplierView-BYQjWeU7.js} +12 -12
- package/dist/{SurchargeView-7ucdobpg.js → SurchargeView-CyhTe1B8.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-C4EeNPwc.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CBM8jJqP.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D-PqQ3Mi.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DM9Cg0uk.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-D-nG9kcq.js → TransferDetails.vue_vue_type_script_setup_true_lang-D2MztVse.js} +20 -20
- package/dist/{TransferTemplateView-CDD_5s5s.js → TransferTemplateView-FNI6jVh0.js} +18 -18
- package/dist/{UnitCostHistoryView-BrYXJWz0.js → UnitCostHistoryView-sGxNtk0Y.js} +4 -4
- package/dist/UnitDisplayControl.vue_vue_type_script_setup_true_lang-Cn6q11Ts.js +160 -0
- package/dist/{UnitView-CMXUZZvZ.js → UnitView-P8jU14k8.js} +7 -7
- package/dist/{WarehouseView-CUgJ4YGF.js → WarehouseView-NILk42Zj.js} +5 -5
- package/dist/{WastageTemplateView-Di6ffpTU.js → WastageTemplateView-DNrKoK3S.js} +14 -14
- package/dist/{app-D3gm3Lsw.js → app-DIOXPCfI.js} +23 -11
- package/dist/app.d.ts +12 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-BiSW9398.js → closing-template-DAlwSsqC.js} +1 -1
- package/dist/{date2-DJotzNeB.js → date2-DBIy5hnh.js} +1 -1
- package/dist/{dayjs.min-DxOA6M7_.js → dayjs.min-B2EqUP7W.js} +1 -1
- package/dist/{decimal-BPZo97WQ.js → decimal-e6enR5yT.js} +2 -2
- package/dist/{defineDeepModel-BMU9Poed.js → defineDeepModel-CwqnmttS.js} +1 -1
- package/dist/{duplicate-template-4bkTBQu0.js → duplicate-template-DRtq-b-P.js} +1 -1
- package/dist/{feature-WVA_2Jx-.js → feature-BCSp38rL.js} +2 -2
- package/dist/{format-time-from-id-gcRrHjjv.js → format-time-from-id-CTWNRFSC.js} +1 -1
- package/dist/{format-unit-display-BXkR_Hu0.js → format-unit-display-BFP12VU7.js} +11 -11
- package/dist/{import-export.helper-5AEiNKim.js → import-export.helper-Dr7R0Zql.js} +6 -6
- package/dist/{index-DkCy3EG9.js → index-BhS1AhF-.js} +1 -1
- package/dist/{index-YVMa0U0j.js → index-C2MhE26a.js} +3 -3
- package/dist/{index-DU4iyU3D.js → index-Df-NlbKu.js} +1 -1
- package/dist/{inventory-core-dart.default-B7xHV5Y6.js → inventory-core-dart.default-CW9d8gJh.js} +1 -1
- package/dist/{lz-string-BtgOc0yQ.js → lz-string-BHfmMoLE.js} +1 -1
- package/dist/{netsuite-DmXOUJo-.js → netsuite-BSEnJOMn.js} +2 -2
- package/dist/{number-BfNWSAkN.js → number-B1buZ_S4.js} +3 -3
- package/dist/{predefined-templates-BKxLIZg6.js → predefined-templates-BIFClpKf.js} +1 -1
- package/dist/{purchase-order-template-7iNDStWd.js → purchase-order-template-BCt-pDW-.js} +1 -1
- package/dist/{recalculationUtils-BVuC0H2j.js → recalculationUtils-CASVCqt7.js} +1 -1
- package/dist/{rules-BK8yTx5p.js → rules-C60UHyIn.js} +2 -2
- package/dist/{stock-BSA86fOX.js → stock-CkWMLoi7.js} +1 -1
- package/dist/{supplier-DA3y7WoU.js → supplier-CiW6zfX_.js} +2 -2
- package/dist/{surcharge-BiYvWPv-.js → surcharge-B9FUKx0L.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-BxHGqiP7.js → uom-rules-DXiQ0ZIA.js} +1 -1
- package/dist/{use-ingredient-select-dialog-CPiX95uf.js → use-ingredient-select-dialog-Bn8C8IG1.js} +2 -2
- package/dist/{use-inventory-binding-dialog-CxKLW2Xh.js → use-inventory-binding-dialog-DZQ1WG1S.js} +2 -2
- package/dist/{use-template-enabled-locations-CrwOCxDu.js → use-template-enabled-locations-B9YKq5YY.js} +2 -2
- package/dist/{use-transfer-locations-CNY1m-5P.js → use-transfer-locations-D0mDjUMQ.js} +2 -2
- package/dist/{useHrmPermission-YEdf2QFW.js → useHrmPermission-BTkOHa4h.js} +1 -1
- package/dist/{useNavigationMenu-Bz5AabkY.js → useNavigationMenu-CSfM_5Wy.js} +2 -2
- package/dist/{useSseClient-BWrz2czP.js → useSseClient-DwJXBOEF.js} +3 -3
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +2 -0
- package/dist/views/receive-request/components/transfer-form/composables/use-stock-balance-toggle.d.ts +3 -0
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +4 -0
- package/dist/{vue-i18n-DyHvEzel.js → vue-i18n-BWe-vqm2.js} +287 -287
- package/dist/{xlsx-DQfBpM_Q.js → xlsx-BT7Z_gt_.js} +1 -1
- package/dist/{xlsx.util-XLH11fha.js → xlsx.util-Bm6lJRyh.js} +3 -3
- package/package.json +5 -5
- package/dist/ClosingHistoryView-DL9g4naX.js +0 -1108
- package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-CvUDKcli.js +0 -362
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DMGMZ556.js +0 -404
- package/dist/UnitDisplayControl.vue_vue_type_script_setup_true_lang-Cj15fCG9.js +0 -137
- package/dist/export-BS0TrI3Q.js +0 -26
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { a as ne, c as Oe, S as _t, F as be, u as tt, t as kt, v as ht, i as Je } from "./app-
|
|
1
|
+
import { defineComponent as le, ref as W, onMounted as pt, resolveComponent as G, openBlock as y, createElementBlock as E, Fragment as X, createElementVNode as v, toDisplayString as U, createVNode as h, createCommentVNode as T, computed as A, watch as ue, unref as n, normalizeClass as Ce, withCtx as J, h as de, createBlock as Y, renderList as me, isRef as De, mergeProps as we, createTextVNode as mt, withModifiers as ft, normalizeStyle as vt, Teleport as yt, normalizeProps as bt, guardReactiveProps as gt } from "vue";
|
|
2
|
+
import { a as ne, c as Oe, S as _t, F as be, u as tt, t as kt, v as ht, i as Je } from "./app-DIOXPCfI.js";
|
|
3
3
|
import { useDialog as Le, useSnackbar as je, components as _e, useProxiedModel as Ge, useBreakpoints as xt } from "@feedmepos/ui-library";
|
|
4
4
|
import { i as $t, _ as It, m as wt } from "./menu-usage-module-D7cxkbEk.js";
|
|
5
5
|
import { F as se } from "./form-mode.enum-BKiNVH6A.js";
|
|
6
|
-
import { _ as nt } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-
|
|
6
|
+
import { _ as nt } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-Df7B8ZEG.js";
|
|
7
7
|
import { defineStore as ot, storeToRefs as Et } from "pinia";
|
|
8
8
|
import { D as He, R as Ve } from "./row-action.enum-DQ9bJ_uv.js";
|
|
9
9
|
import { c as Vt } from "./component-kqxARxvM.js";
|
|
10
|
-
import { a as Q, c as Ke } from "./number-
|
|
11
|
-
import { useI18n as
|
|
12
|
-
import { u as
|
|
13
|
-
import { b as it, c as qe, I as Ft, A as Ne, U as lt, R as Rt } from "./rules-
|
|
14
|
-
import { _ as At } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-
|
|
15
|
-
import { a as Pe } from "./FmMultiselectDialog-
|
|
16
|
-
import { d as
|
|
10
|
+
import { a as Q, c as Ke } from "./number-B1buZ_S4.js";
|
|
11
|
+
import { useI18n as ie, useCoreStore as St } from "@feedmepos/mf-common";
|
|
12
|
+
import { u as Ct, _ as Bt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
|
|
13
|
+
import { b as it, c as qe, I as Ft, A as Ne, U as lt, R as Rt } from "./rules-C60UHyIn.js";
|
|
14
|
+
import { _ as At } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-CcF5cko8.js";
|
|
15
|
+
import { a as Pe } from "./FmMultiselectDialog-BWujDEnX.js";
|
|
16
|
+
import { d as rt } from "./defineDeepModel-CwqnmttS.js";
|
|
17
17
|
import { L as Tt, P as Ut, D as Pt } from "./app-DiX-EfV6.js";
|
|
18
|
-
import { _ as
|
|
19
|
-
import { u as Gt } from "./FmMultiselectDialog-
|
|
20
|
-
import { u as Nt } from "./vue-i18n-
|
|
21
|
-
import { F as zt } from "./inventory-core-dart.default-
|
|
18
|
+
import { _ as Be, c as Mt, d as Dt, e as ye } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-CjCNHugK.js";
|
|
19
|
+
import { u as Gt } from "./FmMultiselectDialog-C0lCYHla.js";
|
|
20
|
+
import { u as Nt } from "./vue-i18n-BWe-vqm2.js";
|
|
21
|
+
import { F as zt } from "./inventory-core-dart.default-CW9d8gJh.js";
|
|
22
22
|
import { _ as Ot } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
|
|
23
|
-
import { u as We } from "./feature-
|
|
24
|
-
import { F as he } from "./decimal-
|
|
25
|
-
import { _ as Fe } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-
|
|
26
|
-
import { b as
|
|
27
|
-
import { f as dt } from "./date2-
|
|
23
|
+
import { u as We } from "./feature-BCSp38rL.js";
|
|
24
|
+
import { F as he } from "./decimal-e6enR5yT.js";
|
|
25
|
+
import { _ as Fe } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DL6AKT9H.js";
|
|
26
|
+
import { b as at, d as st } from "./xlsx.util-Bm6lJRyh.js";
|
|
27
|
+
import { f as dt } from "./date2-DBIy5hnh.js";
|
|
28
28
|
import { _ as Lt, F as Qe } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
29
|
-
import { _ as jt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-
|
|
29
|
+
import { _ as jt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-JHabBWJb.js";
|
|
30
30
|
const Kt = {
|
|
31
31
|
key: 0,
|
|
32
32
|
class: "flex flex-col items-center w-full h-full gap-24"
|
|
33
|
-
}, qt = { key: 1 }, Wt = { key: 0 }, Yt = /* @__PURE__ */
|
|
33
|
+
}, qt = { key: 1 }, Wt = { key: 0 }, Yt = /* @__PURE__ */ le({
|
|
34
34
|
__name: "DeleteDialog",
|
|
35
35
|
props: {
|
|
36
36
|
type: {},
|
|
@@ -39,68 +39,68 @@ const Kt = {
|
|
|
39
39
|
bindedItems: {}
|
|
40
40
|
},
|
|
41
41
|
setup(m) {
|
|
42
|
-
const d = m, l =
|
|
42
|
+
const d = m, l = W(d.bindedItems || []), t = W(!1);
|
|
43
43
|
pt(() => {
|
|
44
44
|
i();
|
|
45
45
|
});
|
|
46
46
|
async function i() {
|
|
47
|
-
var
|
|
48
|
-
!t.value && ((
|
|
47
|
+
var r, x;
|
|
48
|
+
!t.value && ((r = d.data) != null && r._id) && (t.value = !0, l.value = await ne().getAffectedMenu((x = d.data) == null ? void 0 : x._id), t.value = !1);
|
|
49
49
|
}
|
|
50
|
-
return (
|
|
50
|
+
return (r, x) => {
|
|
51
51
|
const u = G("FmSpacer"), o = G("FmCircularProgress");
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
t.value ? (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
return y(), E(X, null, [
|
|
53
|
+
v("p", null, U(r.message), 1),
|
|
54
|
+
t.value ? (y(), E("div", Kt, [
|
|
55
|
+
h(u),
|
|
56
|
+
v("div", null, [
|
|
57
|
+
h(o, { size: "xl" })
|
|
58
58
|
]),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
])) : (
|
|
62
|
-
|
|
63
|
-
l.value.length > 0 ? (
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
x[0] || (x[0] = v("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
60
|
+
h(u)
|
|
61
|
+
])) : (y(), E("div", qt, [
|
|
62
|
+
x[2] || (x[2] = v("br", null, null, -1)),
|
|
63
|
+
l.value.length > 0 ? (y(), E("div", Wt, [
|
|
64
|
+
x[1] || (x[1] = v("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
|
|
65
|
+
h(nt, {
|
|
66
66
|
name: "Menu",
|
|
67
67
|
bindings: l.value
|
|
68
68
|
}, null, 8, ["bindings"])
|
|
69
|
-
])) :
|
|
69
|
+
])) : T("", !0)
|
|
70
70
|
]))
|
|
71
71
|
], 64);
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
}), ze = ot("recipeForm", function() {
|
|
75
|
-
const d = Le(), l = je(), t = ne(), i =
|
|
76
|
-
function
|
|
77
|
-
const
|
|
75
|
+
const d = Le(), l = je(), t = ne(), i = W(!1), r = W();
|
|
76
|
+
function x() {
|
|
77
|
+
const a = {
|
|
78
78
|
recipe: {},
|
|
79
79
|
mode: se.CREATE,
|
|
80
80
|
show: !0,
|
|
81
81
|
"onUpdate:show"(p) {
|
|
82
|
-
|
|
82
|
+
r.value.show = p;
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
|
-
|
|
85
|
+
r.value = a;
|
|
86
86
|
}
|
|
87
|
-
async function u(
|
|
87
|
+
async function u(a) {
|
|
88
88
|
const p = {
|
|
89
|
-
recipe: Oe(
|
|
89
|
+
recipe: Oe(a),
|
|
90
90
|
mode: se.UPDATE,
|
|
91
91
|
show: !0,
|
|
92
92
|
"onUpdate:show"($) {
|
|
93
|
-
|
|
93
|
+
r.value.show = $;
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
|
|
96
|
+
r.value = p;
|
|
97
97
|
}
|
|
98
|
-
async function o(
|
|
98
|
+
async function o(a) {
|
|
99
99
|
i.value = !0;
|
|
100
100
|
try {
|
|
101
|
-
await t.deleteRecipe(
|
|
101
|
+
await t.deleteRecipe(a), l.open({
|
|
102
102
|
title: "Success",
|
|
103
|
-
message: `Deleted ${
|
|
103
|
+
message: `Deleted ${a.name}`,
|
|
104
104
|
type: "success"
|
|
105
105
|
});
|
|
106
106
|
} catch (p) {
|
|
@@ -109,7 +109,7 @@ const Kt = {
|
|
|
109
109
|
title: "Cannot delete recipe",
|
|
110
110
|
contentComponent: It,
|
|
111
111
|
contentComponentProps: {
|
|
112
|
-
subject: (
|
|
112
|
+
subject: (a == null ? void 0 : a.name) ?? "",
|
|
113
113
|
items: p.errorResponse.errors.map(($) => {
|
|
114
114
|
var C;
|
|
115
115
|
return {
|
|
@@ -130,7 +130,7 @@ const Kt = {
|
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
l.open({
|
|
133
|
-
title: `Cannot delete ${
|
|
133
|
+
title: `Cannot delete ${a == null ? void 0 : a.name}`,
|
|
134
134
|
message: "Please try again.",
|
|
135
135
|
type: "error"
|
|
136
136
|
}), console.error("failed to delete recipe", p);
|
|
@@ -138,9 +138,9 @@ const Kt = {
|
|
|
138
138
|
i.value = !1;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
function s(
|
|
141
|
+
function s(a) {
|
|
142
142
|
d.open({
|
|
143
|
-
title: `Delete ${(
|
|
143
|
+
title: `Delete ${(a == null ? void 0 : a.name) ?? "recipe"}?`,
|
|
144
144
|
closeButton: !1,
|
|
145
145
|
primaryActions: {
|
|
146
146
|
text: "Delete",
|
|
@@ -154,45 +154,45 @@ const Kt = {
|
|
|
154
154
|
contentComponent: Yt,
|
|
155
155
|
contentComponentProps: {
|
|
156
156
|
type: "menu",
|
|
157
|
-
data:
|
|
157
|
+
data: a,
|
|
158
158
|
message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
|
|
159
159
|
}
|
|
160
|
-
}).onPrimary(() => o(
|
|
160
|
+
}).onPrimary(() => o(a));
|
|
161
161
|
}
|
|
162
162
|
return {
|
|
163
|
-
createRecipe:
|
|
163
|
+
createRecipe: x,
|
|
164
164
|
updateRecipe: u,
|
|
165
165
|
deleteRecipe: s,
|
|
166
|
-
recipeDialogProps:
|
|
166
|
+
recipeDialogProps: r,
|
|
167
167
|
recipeViewLoading: i
|
|
168
168
|
};
|
|
169
169
|
});
|
|
170
170
|
function Jt() {
|
|
171
|
-
const { updateRecipe: m, deleteRecipe: d } = ze(), l = ne(), { t } =
|
|
171
|
+
const { updateRecipe: m, deleteRecipe: d } = ze(), l = ne(), { t } = ie();
|
|
172
172
|
async function i(o, s) {
|
|
173
|
-
const
|
|
173
|
+
const a = Oe(s);
|
|
174
174
|
if (o === Ve.Edit) {
|
|
175
|
-
await m(
|
|
175
|
+
await m(a);
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
178
|
if (o === Ve.Delete) {
|
|
179
|
-
await d(
|
|
179
|
+
await d(a);
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
const
|
|
183
|
+
function r(o, s) {
|
|
184
|
+
const a = o.filter((C) => C.type === be.enum.SKU), p = o.filter(
|
|
185
185
|
(C) => C.type === be.enum.SKU_GROUP
|
|
186
186
|
), $ = o.filter((C) => C.type === be.enum.RECIPE);
|
|
187
187
|
return [
|
|
188
|
-
...
|
|
188
|
+
...a.map((C) => ({ ...C, recipeIds: [...s] })),
|
|
189
189
|
...p.map((C) => ({ ...C, isGroup: !0, recipeIds: [...s] })),
|
|
190
190
|
...$.filter((C) => l.recipeById[C.id] && !s.has(C.id)).flatMap(
|
|
191
|
-
(C) =>
|
|
191
|
+
(C) => r(l.recipeById[C.id].contains, /* @__PURE__ */ new Set([...s, C.id]))
|
|
192
192
|
)
|
|
193
193
|
];
|
|
194
194
|
}
|
|
195
|
-
const
|
|
195
|
+
const x = [
|
|
196
196
|
{
|
|
197
197
|
accessorKey: "recipe",
|
|
198
198
|
header: () => t("inventory.recipe.name"),
|
|
@@ -224,38 +224,38 @@ function Jt() {
|
|
|
224
224
|
];
|
|
225
225
|
function u(o) {
|
|
226
226
|
const s = ne();
|
|
227
|
-
return o.map((
|
|
228
|
-
recipe:
|
|
229
|
-
ingredients: a
|
|
230
|
-
var C, I, f,
|
|
227
|
+
return o.map((a) => ({
|
|
228
|
+
recipe: a.name,
|
|
229
|
+
ingredients: r(a.contains, /* @__PURE__ */ new Set([a._id])).map((p) => {
|
|
230
|
+
var C, I, f, k, S, b;
|
|
231
231
|
if (p.isGroup) {
|
|
232
232
|
const e = s.skuGroupById[p.id];
|
|
233
233
|
return p.recipeIds.slice(1).length ? `(${(C = s.recipeById[p.recipeIds.at(-1) ?? ""]) == null ? void 0 : C.name}) ${e.name} (x ${Q(p.amount)})` : `${e.name} (x${Q(p.amount)})`;
|
|
234
234
|
}
|
|
235
235
|
const $ = s.skuById[p.id];
|
|
236
|
-
return $ ? p.recipeIds.slice(1).length ? `(${(I = s.recipeById[p.recipeIds.at(-1) ?? ""]) == null ? void 0 : I.name}) ${$.name} (${Q(p.amount)}${((f = p.measurement) == null ? void 0 : f.abbrev) ?? ((
|
|
236
|
+
return $ ? p.recipeIds.slice(1).length ? `(${(I = s.recipeById[p.recipeIds.at(-1) ?? ""]) == null ? void 0 : I.name}) ${$.name} (${Q(p.amount)}${((f = p.measurement) == null ? void 0 : f.abbrev) ?? ((k = $ == null ? void 0 : $.unit) == null ? void 0 : k.abbrev)})` : `${$.name} (${Q(p.amount)}${((S = p.measurement) == null ? void 0 : S.abbrev) ?? ((b = $ == null ? void 0 : $.unit) == null ? void 0 : b.abbrev)})` : null;
|
|
237
237
|
}).filter((p) => p).join(", "),
|
|
238
|
-
original:
|
|
238
|
+
original: a
|
|
239
239
|
}));
|
|
240
240
|
}
|
|
241
|
-
return { columnDefs:
|
|
241
|
+
return { columnDefs: x, formatRowData: u };
|
|
242
242
|
}
|
|
243
243
|
function Ht() {
|
|
244
244
|
const m = ne(), d = Le();
|
|
245
|
-
async function l(
|
|
245
|
+
async function l(r, x, u, o = []) {
|
|
246
246
|
var I, f;
|
|
247
|
-
const s =
|
|
247
|
+
const s = r.filter((k) => k.type === "SKU"), a = r.filter((k) => k.type !== "SKU"), p = /* @__PURE__ */ new Set();
|
|
248
248
|
if (u)
|
|
249
|
-
for (const
|
|
250
|
-
!o.some((
|
|
251
|
-
const $ = m.skus.map((
|
|
252
|
-
label:
|
|
253
|
-
sublabel: `${
|
|
254
|
-
value:
|
|
255
|
-
disabled: p.has(
|
|
249
|
+
for (const k of m.skus)
|
|
250
|
+
!o.some((b) => b === k._id) && k._id !== u && !((f = (I = k.convert) == null ? void 0 : I.inventoryBindings) != null && f.some((b) => b.id === u)) || p.add(k._id);
|
|
251
|
+
const $ = m.skus.map((k) => ({
|
|
252
|
+
label: k.name,
|
|
253
|
+
sublabel: `${k.code}${p.has(k._id) ? " (Cannot bind, will cause recursive binding)" : ""}`,
|
|
254
|
+
value: k,
|
|
255
|
+
disabled: p.has(k._id)
|
|
256
256
|
})), C = $.filter(
|
|
257
|
-
(
|
|
258
|
-
).map((
|
|
257
|
+
(k) => s.find((S) => S.id === k.value._id) && !p.has(k.value._id)
|
|
258
|
+
).map((k) => k.value);
|
|
259
259
|
d.open({
|
|
260
260
|
title: "Select ingredients",
|
|
261
261
|
contentComponent: Pe,
|
|
@@ -273,41 +273,41 @@ function Ht() {
|
|
|
273
273
|
close: !0,
|
|
274
274
|
variant: "tertiary"
|
|
275
275
|
}
|
|
276
|
-
}).onPrimary((
|
|
276
|
+
}).onPrimary((k) => {
|
|
277
277
|
const S = [
|
|
278
|
-
...
|
|
279
|
-
...
|
|
280
|
-
...
|
|
278
|
+
...a,
|
|
279
|
+
...r.filter((b) => k.find((e) => e._id === b.id)),
|
|
280
|
+
...k.filter((b) => !r.find((e) => e.id === b._id)).map((b) => ({
|
|
281
281
|
type: "SKU",
|
|
282
|
-
id:
|
|
282
|
+
id: b._id,
|
|
283
283
|
amount: {
|
|
284
284
|
amount: 1,
|
|
285
285
|
precision: 0
|
|
286
286
|
}
|
|
287
287
|
}))
|
|
288
288
|
];
|
|
289
|
-
|
|
289
|
+
x(S);
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
|
-
async function t(
|
|
292
|
+
async function t(r, x, u = []) {
|
|
293
293
|
var C;
|
|
294
|
-
const o =
|
|
294
|
+
const o = r.filter((I) => I.type === "RECIPE"), s = r.filter((I) => I.type !== "RECIPE"), a = /* @__PURE__ */ new Set();
|
|
295
295
|
if (u.length)
|
|
296
296
|
for (const I of m.recipes) {
|
|
297
|
-
const f = ((C = m.recipeBindingFlattenCache[I._id]) == null ? void 0 : C.inventoryBindings) ?? [],
|
|
297
|
+
const f = ((C = m.recipeBindingFlattenCache[I._id]) == null ? void 0 : C.inventoryBindings) ?? [], k = f.some(
|
|
298
298
|
(e) => e.bindingPaths.some((V) => u.some((c) => c === V.id))
|
|
299
299
|
), S = f.some(
|
|
300
300
|
(e) => "success" in e && u.includes(e.ingredient._id)
|
|
301
301
|
);
|
|
302
|
-
(u.some((e) => e === I._id) ||
|
|
302
|
+
(u.some((e) => e === I._id) || k || S) && a.add(I._id);
|
|
303
303
|
}
|
|
304
304
|
const p = m.recipes.filter((I) => !u.includes(I._id)).map((I) => ({
|
|
305
305
|
label: I.name,
|
|
306
|
-
sublabel:
|
|
306
|
+
sublabel: a.has(I._id) ? "(Cannot bind, will cause recursive binding)" : `${I.contains.length} inventory bindings`,
|
|
307
307
|
value: I,
|
|
308
|
-
disabled:
|
|
308
|
+
disabled: a.has(I._id)
|
|
309
309
|
})), $ = p.filter(
|
|
310
|
-
(I) => o.find((f) => f.id === I.value._id) && !
|
|
310
|
+
(I) => o.find((f) => f.id === I.value._id) && !a.has(I.value._id)
|
|
311
311
|
).map((I) => I.value);
|
|
312
312
|
d.open({
|
|
313
313
|
title: "Select recipes",
|
|
@@ -328,10 +328,10 @@ function Ht() {
|
|
|
328
328
|
}
|
|
329
329
|
}).onPrimary((I) => {
|
|
330
330
|
const f = [
|
|
331
|
-
...
|
|
332
|
-
...I.filter((
|
|
331
|
+
...r.filter((k) => I.find((S) => S._id === k.id)),
|
|
332
|
+
...I.filter((k) => !r.find((S) => S.id === k._id)).map((k) => ({
|
|
333
333
|
type: "RECIPE",
|
|
334
|
-
id:
|
|
334
|
+
id: k._id,
|
|
335
335
|
amount: {
|
|
336
336
|
amount: 1,
|
|
337
337
|
precision: 0
|
|
@@ -339,19 +339,19 @@ function Ht() {
|
|
|
339
339
|
})),
|
|
340
340
|
...s
|
|
341
341
|
];
|
|
342
|
-
|
|
342
|
+
x(f);
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
|
-
async function i(
|
|
346
|
-
const o =
|
|
345
|
+
async function i(r, x, u = []) {
|
|
346
|
+
const o = r.filter(($) => $.type === "SKU_GROUP"), s = r.filter(($) => $.type !== "SKU_GROUP"), a = m.skuGroups.filter(($) => !u.includes($._id)).map(($) => ({
|
|
347
347
|
label: $.name,
|
|
348
348
|
value: $
|
|
349
|
-
})), p =
|
|
349
|
+
})), p = a.filter(($) => o.find((C) => C.id === $.value._id)).map(($) => $.value);
|
|
350
350
|
d.open({
|
|
351
351
|
title: "Select ingredient group",
|
|
352
352
|
contentComponent: Pe,
|
|
353
353
|
contentComponentProps: {
|
|
354
|
-
items:
|
|
354
|
+
items: a,
|
|
355
355
|
modelValue: p,
|
|
356
356
|
virtualScroll: !0
|
|
357
357
|
},
|
|
@@ -366,8 +366,8 @@ function Ht() {
|
|
|
366
366
|
}
|
|
367
367
|
}).onPrimary(($) => {
|
|
368
368
|
const C = [
|
|
369
|
-
...
|
|
370
|
-
...$.filter((I) => !
|
|
369
|
+
...r.filter((I) => $.find((f) => f._id === I.id)),
|
|
370
|
+
...$.filter((I) => !r.find((f) => f.id === I._id)).map((I) => ({
|
|
371
371
|
type: "SKU_GROUP",
|
|
372
372
|
id: I._id,
|
|
373
373
|
amount: {
|
|
@@ -377,7 +377,7 @@ function Ht() {
|
|
|
377
377
|
})),
|
|
378
378
|
...s
|
|
379
379
|
];
|
|
380
|
-
|
|
380
|
+
x(C);
|
|
381
381
|
});
|
|
382
382
|
}
|
|
383
383
|
return {
|
|
@@ -386,7 +386,7 @@ function Ht() {
|
|
|
386
386
|
promptIngredientGroupsBinding: i
|
|
387
387
|
};
|
|
388
388
|
}
|
|
389
|
-
const Qt = { class: "flex flex-col" }, Xt = { class: "flex flex-col gap-4" }, Re = /* @__PURE__ */
|
|
389
|
+
const Qt = { class: "flex flex-col" }, Xt = { class: "flex flex-col gap-4" }, Re = /* @__PURE__ */ le({
|
|
390
390
|
__name: "InventoryBindingRule",
|
|
391
391
|
props: {
|
|
392
392
|
disabled: { type: Boolean },
|
|
@@ -396,14 +396,14 @@ const Qt = { class: "flex flex-col" }, Xt = { class: "flex flex-col gap-4" }, Re
|
|
|
396
396
|
},
|
|
397
397
|
emits: ["update:modelValue"],
|
|
398
398
|
setup(m, { emit: d }) {
|
|
399
|
-
const l = m, t = d, { t: i } =
|
|
399
|
+
const l = m, t = d, { t: i } = ie(), r = St(), x = tt(), u = A(() => {
|
|
400
400
|
var C;
|
|
401
|
-
const p = /* @__PURE__ */ new Map(), $ =
|
|
401
|
+
const p = /* @__PURE__ */ new Map(), $ = r.restaurants.value.map((I) => I.customAttributes ?? {});
|
|
402
402
|
for (const I of $)
|
|
403
|
-
for (const [f,
|
|
404
|
-
p.has(f) || p.set(f, /* @__PURE__ */ new Set()),
|
|
403
|
+
for (const [f, k] of Object.entries(I))
|
|
404
|
+
p.has(f) || p.set(f, /* @__PURE__ */ new Set()), k && ((C = p.get(f)) == null || C.add(k));
|
|
405
405
|
return p;
|
|
406
|
-
}), o =
|
|
406
|
+
}), o = A(() => [
|
|
407
407
|
...[...u.value.entries()].map(([$, C]) => ({
|
|
408
408
|
type: "string",
|
|
409
409
|
key: $,
|
|
@@ -415,45 +415,45 @@ const Qt = { class: "flex flex-col" }, Xt = { class: "flex flex-col gap-4" }, Re
|
|
|
415
415
|
key: "state",
|
|
416
416
|
entity: "restaurant",
|
|
417
417
|
values: [...new Set(
|
|
418
|
-
|
|
418
|
+
x.locations.map(($) => $.doc.profile.address.state).filter(Boolean)
|
|
419
419
|
)]
|
|
420
420
|
}
|
|
421
|
-
]), s =
|
|
422
|
-
let
|
|
421
|
+
]), s = W(null);
|
|
422
|
+
let a = null;
|
|
423
423
|
return ue(
|
|
424
424
|
() => l.modelValue,
|
|
425
425
|
(p) => {
|
|
426
|
-
JSON.stringify(p) !== JSON.stringify(
|
|
426
|
+
JSON.stringify(p) !== JSON.stringify(a) && (s.value = p ? Tt.build(p) : null);
|
|
427
427
|
},
|
|
428
428
|
{ immediate: !0 }
|
|
429
429
|
), ue(
|
|
430
430
|
s,
|
|
431
431
|
(p) => {
|
|
432
|
-
|
|
432
|
+
a = p ? Ut.build(p) : null, t("update:modelValue", a);
|
|
433
433
|
},
|
|
434
434
|
{ deep: !0 }
|
|
435
435
|
), (p, $) => {
|
|
436
436
|
const C = G("FmLabel"), I = G("FmFormGroup");
|
|
437
|
-
return
|
|
438
|
-
|
|
439
|
-
|
|
437
|
+
return y(), E("div", Qt, [
|
|
438
|
+
v("div", Xt, [
|
|
439
|
+
h(C, {
|
|
440
440
|
label: n(i)("inventory.ingredientGroup.form.rules.title"),
|
|
441
441
|
required: p.minCount != null && p.minCount > 0
|
|
442
442
|
}, null, 8, ["label", "required"]),
|
|
443
|
-
|
|
443
|
+
h(n(Pt), {
|
|
444
444
|
modelValue: s.value,
|
|
445
445
|
"onUpdate:modelValue": $[0] || ($[0] = (f) => s.value = f),
|
|
446
446
|
attributes: o.value
|
|
447
447
|
}, null, 8, ["modelValue", "attributes"])
|
|
448
448
|
]),
|
|
449
|
-
|
|
449
|
+
h(I, {
|
|
450
450
|
"model-value": s.value,
|
|
451
451
|
rules: [
|
|
452
452
|
(f) => {
|
|
453
|
-
const
|
|
454
|
-
return l.minCount !== void 0 &&
|
|
453
|
+
const k = f ? 1 : 0;
|
|
454
|
+
return l.minCount !== void 0 && k < l.minCount ? n(i)("inventory.ingredientGroup.form.rules.validation.minCount", {
|
|
455
455
|
count: l.minCount
|
|
456
|
-
}) : l.maxCount !== void 0 &&
|
|
456
|
+
}) : l.maxCount !== void 0 && k > l.maxCount ? n(i)("inventory.ingredientGroup.form.rules.validation.maxCount", {
|
|
457
457
|
count: l.maxCount
|
|
458
458
|
}) : !0;
|
|
459
459
|
}
|
|
@@ -465,13 +465,13 @@ const Qt = { class: "flex flex-col" }, Xt = { class: "flex flex-col gap-4" }, Re
|
|
|
465
465
|
}), Zt = { class: "border-1 mx-3 my-1 rounded-md" }, en = { class: "flex flex-col w-full border-b border-fm-color-neutral-gray-100" }, tn = {
|
|
466
466
|
class: "flex items-center",
|
|
467
467
|
style: { "min-height": "48px" }
|
|
468
|
-
}, nn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, on = { class: "flex flex-col" }, ln = { class: "line-clamp-1" },
|
|
468
|
+
}, nn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, on = { class: "flex flex-col" }, ln = { class: "line-clamp-1" }, rn = { class: "w-[200px]" }, an = {
|
|
469
469
|
key: 0,
|
|
470
470
|
class: "w-[52px]"
|
|
471
471
|
}, sn = {
|
|
472
472
|
key: 0,
|
|
473
473
|
class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400 px-8"
|
|
474
|
-
}, dn = { class: "px-12 pb-4" }, un = /* @__PURE__ */
|
|
474
|
+
}, dn = { class: "px-12 pb-4" }, un = /* @__PURE__ */ le({
|
|
475
475
|
__name: "InventoryRecipeBindingV2Field",
|
|
476
476
|
props: {
|
|
477
477
|
disabled: { type: Boolean },
|
|
@@ -482,85 +482,85 @@ const Qt = { class: "flex flex-col" }, Xt = { class: "flex flex-col gap-4" }, Re
|
|
|
482
482
|
},
|
|
483
483
|
emits: ["update:modelValue", "delete", "settings"],
|
|
484
484
|
setup(m, { emit: d }) {
|
|
485
|
-
const l = d, { t } =
|
|
485
|
+
const l = d, { t } = ie(), i = rt("modelValue"), r = W(""), x = A(() => +Q(i.amount));
|
|
486
486
|
ue(
|
|
487
487
|
() => i.amount,
|
|
488
488
|
(s) => {
|
|
489
|
-
const
|
|
490
|
-
|
|
489
|
+
const a = Q(s);
|
|
490
|
+
r.value !== a && (r.value = a);
|
|
491
491
|
},
|
|
492
492
|
{ immediate: !0 }
|
|
493
493
|
);
|
|
494
494
|
let u = null;
|
|
495
495
|
function o(s) {
|
|
496
|
-
|
|
497
|
-
const
|
|
498
|
-
s.length > 0 && isFinite(
|
|
496
|
+
r.value = s, u && clearTimeout(u), u = setTimeout(() => {
|
|
497
|
+
const a = +s;
|
|
498
|
+
s.length > 0 && isFinite(a) ? i.amount = Ke(a) : i.amount = { amount: 0, precision: 0 };
|
|
499
499
|
}, 300);
|
|
500
500
|
}
|
|
501
|
-
return (s,
|
|
501
|
+
return (s, a) => {
|
|
502
502
|
const p = G("FmTooltip"), $ = G("FmTextField"), C = G("FmButton"), I = G("FmIcon"), f = G("FmFormGroup");
|
|
503
|
-
return
|
|
504
|
-
|
|
505
|
-
class:
|
|
503
|
+
return y(), E("div", Zt, [
|
|
504
|
+
h(f, {
|
|
505
|
+
class: Ce(["mb-2"]),
|
|
506
506
|
disabled: s.disabled,
|
|
507
|
-
modelValue:
|
|
507
|
+
modelValue: x.value,
|
|
508
508
|
rules: [n(it)(0), n(qe)(-1)]
|
|
509
509
|
}, {
|
|
510
|
-
default: J(({ invalid:
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
510
|
+
default: J(({ invalid: k }) => [
|
|
511
|
+
v("div", en, [
|
|
512
|
+
v("div", tn, [
|
|
513
|
+
v("div", nn, [
|
|
514
|
+
v("div", on, [
|
|
515
|
+
h(p, {
|
|
516
516
|
zIndex: 51,
|
|
517
517
|
variant: "plain",
|
|
518
518
|
placement: "top",
|
|
519
519
|
content: s.displayName
|
|
520
520
|
}, {
|
|
521
521
|
default: J(() => [
|
|
522
|
-
|
|
522
|
+
v("span", ln, U(s.displayName), 1)
|
|
523
523
|
]),
|
|
524
524
|
_: 1
|
|
525
525
|
}, 8, ["content"])
|
|
526
526
|
])
|
|
527
527
|
]),
|
|
528
|
-
|
|
529
|
-
|
|
528
|
+
v("div", rn, [
|
|
529
|
+
h($, {
|
|
530
530
|
class: "w-full",
|
|
531
531
|
disabled: s.disabled,
|
|
532
|
-
modelValue:
|
|
533
|
-
"onUpdate:modelValue":
|
|
534
|
-
invalid:
|
|
532
|
+
modelValue: r.value,
|
|
533
|
+
"onUpdate:modelValue": a[0] || (a[0] = (S) => o(S)),
|
|
534
|
+
invalid: k
|
|
535
535
|
}, null, 8, ["disabled", "modelValue", "invalid"])
|
|
536
536
|
]),
|
|
537
|
-
s.readonly ?
|
|
538
|
-
|
|
537
|
+
s.readonly ? T("", !0) : (y(), E("div", an, [
|
|
538
|
+
h(C, {
|
|
539
539
|
disabled: s.disabled,
|
|
540
540
|
type: "button",
|
|
541
541
|
variant: "plain",
|
|
542
542
|
icon: "delete",
|
|
543
543
|
"icon-color": "#000000",
|
|
544
|
-
onClick:
|
|
544
|
+
onClick: a[1] || (a[1] = () => l("delete", n(i).id))
|
|
545
545
|
}, null, 8, ["disabled"])
|
|
546
546
|
]))
|
|
547
547
|
]),
|
|
548
|
-
s.showError ? (
|
|
549
|
-
|
|
548
|
+
s.showError ? (y(), E("div", sn, [
|
|
549
|
+
h(I, {
|
|
550
550
|
name: "error",
|
|
551
551
|
color: "system-error-300",
|
|
552
552
|
size: "sm"
|
|
553
553
|
}),
|
|
554
|
-
|
|
555
|
-
])) :
|
|
554
|
+
v("div", null, U(n(t)("inventory.inventoryBindings.circularError")), 1)
|
|
555
|
+
])) : T("", !0)
|
|
556
556
|
])
|
|
557
557
|
]),
|
|
558
558
|
_: 1
|
|
559
559
|
}, 8, ["disabled", "modelValue", "rules"]),
|
|
560
|
-
|
|
561
|
-
|
|
560
|
+
v("div", dn, [
|
|
561
|
+
h(Re, {
|
|
562
562
|
modelValue: n(i).rules,
|
|
563
|
-
"onUpdate:modelValue":
|
|
563
|
+
"onUpdate:modelValue": a[2] || (a[2] = (k) => n(i).rules = k),
|
|
564
564
|
disabled: s.disabled
|
|
565
565
|
}, null, 8, ["modelValue", "disabled"])
|
|
566
566
|
])
|
|
@@ -569,7 +569,7 @@ const Qt = { class: "flex flex-col" }, Xt = { class: "flex flex-col gap-4" }, Re
|
|
|
569
569
|
}
|
|
570
570
|
});
|
|
571
571
|
function cn(m) {
|
|
572
|
-
const d = Gt(), { t: l } = Nt(), t = ne(), i =
|
|
572
|
+
const d = Gt(), { t: l } = Nt(), t = ne(), i = A(() => [
|
|
573
573
|
{
|
|
574
574
|
id: "delete",
|
|
575
575
|
header: "",
|
|
@@ -652,18 +652,18 @@ function cn(m) {
|
|
|
652
652
|
sublabel: o.unit.abbrev,
|
|
653
653
|
value: null
|
|
654
654
|
},
|
|
655
|
-
...o.unit.measurements.map((
|
|
656
|
-
label: `${
|
|
655
|
+
...o.unit.measurements.map((a) => ({
|
|
656
|
+
label: `${a.name} (${a.abbrev})`,
|
|
657
657
|
sublabel: l("inventory.inventoryBindings.alternativeTable.measurementOption"),
|
|
658
|
-
value:
|
|
658
|
+
value: a.id
|
|
659
659
|
}))
|
|
660
|
-
].filter((
|
|
660
|
+
].filter((a) => !a.label.toLowerCase().includes("inactive"));
|
|
661
661
|
return de(_e.FmSelect, {
|
|
662
662
|
modelValue: u.row.original.trackingMeasurement ?? null,
|
|
663
663
|
items: s,
|
|
664
664
|
disabled: m.disabled ?? !1,
|
|
665
|
-
"onUpdate:modelValue": (
|
|
666
|
-
m.bindingAlternatives = m.bindingAlternatives.map((p) => p._id === u.row.original._id ? { ...p, trackingMeasurement:
|
|
665
|
+
"onUpdate:modelValue": (a) => {
|
|
666
|
+
m.bindingAlternatives = m.bindingAlternatives.map((p) => p._id === u.row.original._id ? { ...p, trackingMeasurement: a } : p);
|
|
667
667
|
}
|
|
668
668
|
});
|
|
669
669
|
},
|
|
@@ -683,17 +683,17 @@ function cn(m) {
|
|
|
683
683
|
Ne(1),
|
|
684
684
|
lt(
|
|
685
685
|
m.bindingAlternatives.filter((s) => s._id !== o._id).map((s) => {
|
|
686
|
-
const
|
|
686
|
+
const a = t.skuById[s._id];
|
|
687
687
|
return {
|
|
688
|
-
label:
|
|
688
|
+
label: a == null ? void 0 : a.name,
|
|
689
689
|
value: s.priority
|
|
690
690
|
};
|
|
691
691
|
})
|
|
692
692
|
)
|
|
693
693
|
],
|
|
694
694
|
"onUpdate:modelValue": (s) => {
|
|
695
|
-
const
|
|
696
|
-
isNaN(
|
|
695
|
+
const a = Number(s);
|
|
696
|
+
isNaN(a) || (m.bindingAlternatives = m.bindingAlternatives.map((p) => p._id === u.row.original._id ? { ...p, priority: a } : p));
|
|
697
697
|
}
|
|
698
698
|
});
|
|
699
699
|
}
|
|
@@ -734,10 +734,10 @@ function cn(m) {
|
|
|
734
734
|
size: "md",
|
|
735
735
|
disabled: m.disabled ?? !1,
|
|
736
736
|
onClick: () => {
|
|
737
|
-
const s = [...m.bindingAlternatives],
|
|
738
|
-
if (
|
|
739
|
-
const p = s[
|
|
740
|
-
s[
|
|
737
|
+
const s = [...m.bindingAlternatives], a = s.findIndex((p) => p._id === o._id);
|
|
738
|
+
if (a > 0) {
|
|
739
|
+
const p = s[a - 1];
|
|
740
|
+
s[a - 1] = o, s[a] = p;
|
|
741
741
|
}
|
|
742
742
|
m.bindingAlternatives = [...s];
|
|
743
743
|
}
|
|
@@ -750,10 +750,10 @@ function cn(m) {
|
|
|
750
750
|
size: "md",
|
|
751
751
|
disabled: m.disabled ?? !1,
|
|
752
752
|
onClick: () => {
|
|
753
|
-
const s = [...m.bindingAlternatives],
|
|
754
|
-
if (
|
|
755
|
-
const p = s[
|
|
756
|
-
s[
|
|
753
|
+
const s = [...m.bindingAlternatives], a = s.findIndex((p) => p._id === o._id);
|
|
754
|
+
if (a < s.length - 1) {
|
|
755
|
+
const p = s[a + 1];
|
|
756
|
+
s[a + 1] = o, s[a] = p;
|
|
757
757
|
}
|
|
758
758
|
m.bindingAlternatives = [...s];
|
|
759
759
|
}
|
|
@@ -772,22 +772,22 @@ function cn(m) {
|
|
|
772
772
|
get columnDefs() {
|
|
773
773
|
return i.value;
|
|
774
774
|
},
|
|
775
|
-
promptAddIngredient: async (
|
|
775
|
+
promptAddIngredient: async (x) => {
|
|
776
776
|
const u = [];
|
|
777
|
-
for (const
|
|
778
|
-
|
|
779
|
-
label:
|
|
780
|
-
sublabel:
|
|
781
|
-
value:
|
|
782
|
-
disabled:
|
|
777
|
+
for (const a of t.skus)
|
|
778
|
+
x.includes(a._id) || u.push({
|
|
779
|
+
label: a.name,
|
|
780
|
+
sublabel: a.code,
|
|
781
|
+
value: a._id,
|
|
782
|
+
disabled: x.includes(a._id)
|
|
783
783
|
});
|
|
784
|
-
const o = (m.bindingAlternatives ?? []).map((
|
|
785
|
-
var $, C, I, f,
|
|
786
|
-
const p = ($ = m.bindingAlternatives) == null ? void 0 : $.findIndex((
|
|
784
|
+
const o = (m.bindingAlternatives ?? []).map((a) => a._id), s = await d.multiSelect(u, o, (a) => {
|
|
785
|
+
var $, C, I, f, k, S;
|
|
786
|
+
const p = ($ = m.bindingAlternatives) == null ? void 0 : $.findIndex((b) => b._id === a);
|
|
787
787
|
return {
|
|
788
|
-
_id:
|
|
789
|
-
trackingMeasurement: typeof p != "number" || p == -1 ? (C = t.skuById[
|
|
790
|
-
priority: ((S = (
|
|
788
|
+
_id: a,
|
|
789
|
+
trackingMeasurement: typeof p != "number" || p == -1 ? (C = t.skuById[a]) == null ? void 0 : C.trackingMeasurement : (f = (I = m.bindingAlternatives) == null ? void 0 : I[p]) == null ? void 0 : f.trackingMeasurement,
|
|
790
|
+
priority: ((S = (k = m.bindingAlternatives) == null ? void 0 : k[p]) == null ? void 0 : S.priority) ?? m.bindingAlternatives.length,
|
|
791
791
|
default: !1
|
|
792
792
|
};
|
|
793
793
|
});
|
|
@@ -805,7 +805,7 @@ function cn(m) {
|
|
|
805
805
|
}
|
|
806
806
|
};
|
|
807
807
|
}
|
|
808
|
-
const pn = { class: "flex flex-col gap-16" }, mn = { class: "flex flex-col" }, fn = { class: "flex justify-between items-center px-2" }, Se = /* @__PURE__ */
|
|
808
|
+
const pn = { class: "flex flex-col gap-16" }, mn = { class: "flex flex-col" }, fn = { class: "flex justify-between items-center px-2" }, Se = /* @__PURE__ */ le({
|
|
809
809
|
__name: "InventoryBindingAlternative",
|
|
810
810
|
props: {
|
|
811
811
|
disabled: { type: Boolean },
|
|
@@ -814,7 +814,7 @@ const pn = { class: "flex flex-col gap-16" }, mn = { class: "flex flex-col" }, f
|
|
|
814
814
|
},
|
|
815
815
|
emits: ["update:modelValue"],
|
|
816
816
|
setup(m, { emit: d }) {
|
|
817
|
-
const l = m, t = d, { t: i } =
|
|
817
|
+
const l = m, t = d, { t: i } = ie(), r = cn({
|
|
818
818
|
get disabled() {
|
|
819
819
|
return l.disabled ?? !1;
|
|
820
820
|
},
|
|
@@ -824,36 +824,36 @@ const pn = { class: "flex flex-col gap-16" }, mn = { class: "flex flex-col" }, f
|
|
|
824
824
|
set bindingAlternatives(o) {
|
|
825
825
|
t("update:modelValue", o);
|
|
826
826
|
}
|
|
827
|
-
}),
|
|
827
|
+
}), x = (o) => o && o.some((s) => l.filterIngredientIds.includes(s._id)) ? "Contains invalid ingredient" : !0, u = (o) => o && o.length > 5 ? i("inventory.binding.alternative.maximumExceeded", { max: 5 }) : !0;
|
|
828
828
|
return (o, s) => {
|
|
829
829
|
var I;
|
|
830
|
-
const
|
|
831
|
-
return
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
830
|
+
const a = G("FmLabel"), p = G("FmButton"), $ = G("FmFormGroup"), C = G("FmTable");
|
|
831
|
+
return y(), E("div", pn, [
|
|
832
|
+
v("div", mn, [
|
|
833
|
+
v("div", fn, [
|
|
834
|
+
h(a, {
|
|
835
835
|
label: n(i)("inventory.alternatives")
|
|
836
836
|
}, null, 8, ["label"]),
|
|
837
|
-
|
|
837
|
+
h(p, {
|
|
838
838
|
disabled: o.disabled,
|
|
839
839
|
"prepend-icon": "link",
|
|
840
840
|
variant: "primary",
|
|
841
841
|
class: "border-1 rounded-lg border-fm-color-primary",
|
|
842
|
-
onClick: s[0] || (s[0] = (f) => n(
|
|
842
|
+
onClick: s[0] || (s[0] = (f) => n(r).promptAddIngredient(o.filterIngredientIds)),
|
|
843
843
|
size: "md"
|
|
844
844
|
}, null, 8, ["disabled"])
|
|
845
845
|
]),
|
|
846
|
-
|
|
846
|
+
h($, {
|
|
847
847
|
"model-value": o.modelValue,
|
|
848
|
-
rules: [
|
|
848
|
+
rules: [x, u]
|
|
849
849
|
}, null, 8, ["model-value", "rules"])
|
|
850
850
|
]),
|
|
851
|
-
|
|
851
|
+
h(C, {
|
|
852
852
|
"row-data": o.modelValue ?? [],
|
|
853
|
-
"column-defs": n(
|
|
853
|
+
"column-defs": n(r).columnDefs,
|
|
854
854
|
"page-size": ((I = o.modelValue) == null ? void 0 : I.length) || 0,
|
|
855
855
|
"shrink-at": 9999,
|
|
856
|
-
"column-visibility": n(
|
|
856
|
+
"column-visibility": n(r).columnVisibility,
|
|
857
857
|
"hide-footer": ""
|
|
858
858
|
}, null, 8, ["row-data", "column-defs", "page-size", "column-visibility"])
|
|
859
859
|
]);
|
|
@@ -865,7 +865,7 @@ const pn = { class: "flex flex-col gap-16" }, mn = { class: "flex flex-col" }, f
|
|
|
865
865
|
}, gn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, _n = { class: "line-clamp-1 w-full" }, kn = { class: "w-[150px]" }, hn = {
|
|
866
866
|
key: 0,
|
|
867
867
|
class: "w-[52px]"
|
|
868
|
-
}, xn = { class: "flex flex-col px-12 pb-4" }, $n = /* @__PURE__ */
|
|
868
|
+
}, xn = { class: "flex flex-col px-12 pb-4" }, $n = /* @__PURE__ */ le({
|
|
869
869
|
__name: "InventorySkuBindingV2Field",
|
|
870
870
|
props: {
|
|
871
871
|
disabled: { type: Boolean },
|
|
@@ -879,11 +879,11 @@ const pn = { class: "flex flex-col gap-16" }, mn = { class: "flex flex-col" }, f
|
|
|
879
879
|
},
|
|
880
880
|
emits: ["update:modelValue", "delete", "settings"],
|
|
881
881
|
setup(m, { emit: d }) {
|
|
882
|
-
const l = d, { t } =
|
|
883
|
-
function
|
|
882
|
+
const l = d, { t } = ie(), i = rt("modelValue");
|
|
883
|
+
function r(u) {
|
|
884
884
|
u && (i.amount = u.amount, i.measurement = u.measurement);
|
|
885
885
|
}
|
|
886
|
-
function
|
|
886
|
+
function x() {
|
|
887
887
|
return {
|
|
888
888
|
modelValue: {
|
|
889
889
|
amount: i.amount,
|
|
@@ -895,35 +895,35 @@ const pn = { class: "flex flex-col gap-16" }, mn = { class: "flex flex-col" }, f
|
|
|
895
895
|
};
|
|
896
896
|
}
|
|
897
897
|
return (u, o) => {
|
|
898
|
-
const s = G("FmTooltip"),
|
|
899
|
-
return
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
898
|
+
const s = G("FmTooltip"), a = G("FmButton"), p = G("FmFormGroup");
|
|
899
|
+
return y(), E("div", vn, [
|
|
900
|
+
v("div", yn, [
|
|
901
|
+
v("div", bn, [
|
|
902
|
+
v("div", gn, [
|
|
903
|
+
h(s, {
|
|
904
904
|
zIndex: 51,
|
|
905
905
|
variant: "plain",
|
|
906
906
|
placement: "top",
|
|
907
907
|
content: u.displayName
|
|
908
908
|
}, {
|
|
909
909
|
default: J(() => [
|
|
910
|
-
|
|
910
|
+
v("span", _n, U(u.displayName), 1)
|
|
911
911
|
]),
|
|
912
912
|
_: 1
|
|
913
913
|
}, 8, ["content"])
|
|
914
914
|
]),
|
|
915
|
-
|
|
916
|
-
|
|
915
|
+
v("div", kn, [
|
|
916
|
+
h(Be, {
|
|
917
917
|
"model-value": { amount: n(i).amount, measurement: n(i).measurement },
|
|
918
|
-
"onUpdate:modelValue":
|
|
918
|
+
"onUpdate:modelValue": r,
|
|
919
919
|
unit: u.unit,
|
|
920
920
|
placement: "bottom",
|
|
921
921
|
"convert-amount-on-change-unit": "",
|
|
922
922
|
disabled: u.readonly
|
|
923
923
|
}, null, 8, ["model-value", "unit", "disabled"])
|
|
924
924
|
]),
|
|
925
|
-
u.readonly ?
|
|
926
|
-
|
|
925
|
+
u.readonly ? T("", !0) : (y(), E("div", hn, [
|
|
926
|
+
h(a, {
|
|
927
927
|
disabled: u.disabled,
|
|
928
928
|
type: "button",
|
|
929
929
|
variant: "tertiary",
|
|
@@ -932,13 +932,13 @@ const pn = { class: "flex flex-col gap-16" }, mn = { class: "flex flex-col" }, f
|
|
|
932
932
|
}, null, 8, ["disabled"])
|
|
933
933
|
]))
|
|
934
934
|
]),
|
|
935
|
-
|
|
936
|
-
|
|
935
|
+
v("div", xn, [
|
|
936
|
+
h(p, {
|
|
937
937
|
modelValue: n(i).amount,
|
|
938
938
|
rules: [n(qe)(0)]
|
|
939
939
|
}, null, 8, ["modelValue", "rules"]),
|
|
940
|
-
|
|
941
|
-
modelValue:
|
|
940
|
+
h(p, {
|
|
941
|
+
modelValue: x(),
|
|
942
942
|
rules: [
|
|
943
943
|
n(Mt)(),
|
|
944
944
|
n(Dt)(u.unit),
|
|
@@ -946,19 +946,19 @@ const pn = { class: "flex flex-col gap-16" }, mn = { class: "flex flex-col" }, f
|
|
|
946
946
|
]
|
|
947
947
|
}, null, 8, ["modelValue", "rules"])
|
|
948
948
|
]),
|
|
949
|
-
u.ableToApplyRules ? (
|
|
949
|
+
u.ableToApplyRules ? (y(), Y(Re, {
|
|
950
950
|
key: 0,
|
|
951
951
|
modelValue: n(i).rules,
|
|
952
952
|
"onUpdate:modelValue": o[1] || (o[1] = ($) => n(i).rules = $),
|
|
953
953
|
disabled: u.disabled
|
|
954
|
-
}, null, 8, ["modelValue", "disabled"])) :
|
|
955
|
-
u.ableToConfigureAlternative ? (
|
|
954
|
+
}, null, 8, ["modelValue", "disabled"])) : T("", !0),
|
|
955
|
+
u.ableToConfigureAlternative ? (y(), Y(Se, {
|
|
956
956
|
key: 1,
|
|
957
957
|
modelValue: n(i).alternatives,
|
|
958
958
|
"onUpdate:modelValue": o[2] || (o[2] = ($) => n(i).alternatives = $),
|
|
959
959
|
disabled: u.disabled,
|
|
960
960
|
filterIngredientIds: [n(i).id]
|
|
961
|
-
}, null, 8, ["modelValue", "disabled", "filterIngredientIds"])) :
|
|
961
|
+
}, null, 8, ["modelValue", "disabled", "filterIngredientIds"])) : T("", !0)
|
|
962
962
|
])
|
|
963
963
|
]);
|
|
964
964
|
};
|
|
@@ -968,7 +968,7 @@ exports.FfCalculator;
|
|
|
968
968
|
const In = { class: "flex flex-col gap-24" }, wn = {
|
|
969
969
|
key: 0,
|
|
970
970
|
class: "flex flex-col gap-16"
|
|
971
|
-
}, En = { class: "flex items-center" }, Vn = { class: "flex-1 fm-typo-en-title-sm-600" }, Sn = { class: "flex flex-col" },
|
|
971
|
+
}, En = { class: "flex items-center" }, Vn = { class: "flex-1 fm-typo-en-title-sm-600" }, Sn = { class: "flex flex-col" }, Cn = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, Bn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Fn = {
|
|
972
972
|
key: 0,
|
|
973
973
|
class: "w-[52px]"
|
|
974
974
|
}, Rn = {
|
|
@@ -989,7 +989,16 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
989
989
|
}, qn = { class: "flex flex-col gap-16" }, Wn = { class: "flex items-center" }, Yn = { class: "flex-1 fm-typo-en-title-sm-600" }, Jn = { class: "flex flex-col" }, Hn = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, Qn = { class: "flex-1 fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Xn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary w-[150px] px-16" }, Zn = {
|
|
990
990
|
key: 0,
|
|
991
991
|
class: "w-[52px]"
|
|
992
|
-
}, eo =
|
|
992
|
+
}, eo = {
|
|
993
|
+
key: 0,
|
|
994
|
+
class: "flex flex-col border-b border-fm-color-neutral-gray-100"
|
|
995
|
+
}, to = {
|
|
996
|
+
class: "flex items-center w-full",
|
|
997
|
+
style: { "min-height": "48px" }
|
|
998
|
+
}, no = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12 text-fm-color-typo-secondary line-clamp-1" }, oo = {
|
|
999
|
+
key: 0,
|
|
1000
|
+
class: "w-[52px]"
|
|
1001
|
+
}, io = { class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400 px-12 pb-4" }, lo = /* @__PURE__ */ le({
|
|
993
1002
|
__name: "InventoryBindingFormV2",
|
|
994
1003
|
props: {
|
|
995
1004
|
id: {},
|
|
@@ -1009,7 +1018,7 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1009
1018
|
},
|
|
1010
1019
|
emits: ["update:modelValue", "click:pick-inventory-bindings"],
|
|
1011
1020
|
setup(m, { emit: d }) {
|
|
1012
|
-
const { t: l } =
|
|
1021
|
+
const { t: l } = ie(), t = ne(), i = A(() => t.recipeById), r = A(() => t.skuById), x = A(() => t.skuGroupById), u = m, o = d, s = A(() => kt({
|
|
1013
1022
|
parentId: u.id,
|
|
1014
1023
|
bindings: u.modelValue,
|
|
1015
1024
|
recipes: t.recipes.map((F) => F._id === u.id ? {
|
|
@@ -1023,12 +1032,12 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1023
1032
|
}
|
|
1024
1033
|
} : F),
|
|
1025
1034
|
skuGroups: t.skuGroups
|
|
1026
|
-
}).inventoryBindings.filter((F) => "error" in F && F.error).map((F) => F).filter((F) => F.reason === ht.enum.circularDependency)),
|
|
1027
|
-
() => new Set(s.value.map((
|
|
1028
|
-
var
|
|
1029
|
-
return (
|
|
1035
|
+
}).inventoryBindings.filter((F) => "error" in F && F.error).map((F) => F).filter((F) => F.reason === ht.enum.circularDependency)), a = A(
|
|
1036
|
+
() => new Set(s.value.map((g) => {
|
|
1037
|
+
var B;
|
|
1038
|
+
return (B = g.bindingPaths[0]) == null ? void 0 : B.id;
|
|
1030
1039
|
}))
|
|
1031
|
-
), p =
|
|
1040
|
+
), p = A(() => u.modelValue.filter((g) => g.type === "RECIPE")), { promptIngredientsBinding: $, promptRecipesBinding: C, promptIngredientGroupsBinding: I } = Ht();
|
|
1032
1041
|
async function f() {
|
|
1033
1042
|
if (u.iframeMode) {
|
|
1034
1043
|
o("click:pick-inventory-bindings", "RECIPE");
|
|
@@ -1036,24 +1045,24 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1036
1045
|
}
|
|
1037
1046
|
C(
|
|
1038
1047
|
u.modelValue,
|
|
1039
|
-
(
|
|
1048
|
+
(g) => o("update:modelValue", g),
|
|
1040
1049
|
u.id ? [u.id] : []
|
|
1041
1050
|
);
|
|
1042
1051
|
}
|
|
1043
|
-
const
|
|
1052
|
+
const k = A(() => u.modelValue.filter((g) => g.type === "SKU_GROUP"));
|
|
1044
1053
|
async function S() {
|
|
1045
1054
|
I(
|
|
1046
1055
|
u.modelValue,
|
|
1047
|
-
(
|
|
1056
|
+
(g) => o("update:modelValue", g),
|
|
1048
1057
|
u.id ? [u.id] : []
|
|
1049
1058
|
);
|
|
1050
1059
|
}
|
|
1051
|
-
function
|
|
1052
|
-
const
|
|
1053
|
-
let
|
|
1054
|
-
|
|
1060
|
+
function b(g, B, F) {
|
|
1061
|
+
const R = +B;
|
|
1062
|
+
let P = F;
|
|
1063
|
+
B.length > 0 && isFinite(R) ? P = F.map((K) => (K.id !== g || (K.amount = Ke(R)), K)) : P = F.map((K) => (K.id !== g || (K.amount = { amount: 0, precision: 0 }), K)), o("update:modelValue", P);
|
|
1055
1064
|
}
|
|
1056
|
-
const e =
|
|
1065
|
+
const e = A(() => u.modelValue.filter((g) => g.type === "SKU") ?? []);
|
|
1057
1066
|
async function V() {
|
|
1058
1067
|
if (u.iframeMode) {
|
|
1059
1068
|
o("click:pick-inventory-bindings", "SKU");
|
|
@@ -1061,48 +1070,51 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1061
1070
|
}
|
|
1062
1071
|
$(
|
|
1063
1072
|
u.modelValue,
|
|
1064
|
-
(
|
|
1073
|
+
(g) => o("update:modelValue", g),
|
|
1065
1074
|
u.excludeBindingId,
|
|
1066
1075
|
u.id ? [u.id] : []
|
|
1067
1076
|
);
|
|
1068
1077
|
}
|
|
1069
|
-
function c(
|
|
1070
|
-
const
|
|
1071
|
-
o("update:modelValue",
|
|
1078
|
+
function c(g) {
|
|
1079
|
+
const B = u.modelValue.map((F) => F.id === g.id ? g : F);
|
|
1080
|
+
o("update:modelValue", B);
|
|
1072
1081
|
}
|
|
1073
|
-
function g
|
|
1074
|
-
const
|
|
1075
|
-
o("update:modelValue",
|
|
1082
|
+
function _(g) {
|
|
1083
|
+
const B = u.modelValue.filter((F) => F.id !== g);
|
|
1084
|
+
o("update:modelValue", B);
|
|
1076
1085
|
}
|
|
1077
|
-
function
|
|
1078
|
-
var F,
|
|
1079
|
-
if (
|
|
1086
|
+
function N(g) {
|
|
1087
|
+
var F, R;
|
|
1088
|
+
if (g.type !== be.enum.SKU)
|
|
1080
1089
|
throw new Error("Non-SKU binding does not have unit");
|
|
1081
|
-
if (!((F =
|
|
1082
|
-
throw new Error(`Cannot find ingredient: ${
|
|
1083
|
-
return (
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1090
|
+
if (!((F = r.value[g.id]) == null ? void 0 : F.unit))
|
|
1091
|
+
throw new Error(`Cannot find ingredient: ${g.id}`);
|
|
1092
|
+
return (R = r.value[g.id]) == null ? void 0 : R.unit;
|
|
1093
|
+
}
|
|
1094
|
+
function z(g) {
|
|
1095
|
+
return !r.value[g.id];
|
|
1096
|
+
}
|
|
1097
|
+
return (g, B) => {
|
|
1098
|
+
var H, ee, O;
|
|
1099
|
+
const F = G("FmFormGroup"), R = G("FmButton"), P = G("FmIcon"), K = G("FmTextField");
|
|
1100
|
+
return y(), E("div", In, [
|
|
1101
|
+
h(F, {
|
|
1102
|
+
disabled: g.disabled,
|
|
1103
|
+
"model-value": g.modelValue,
|
|
1092
1104
|
rules: [
|
|
1093
|
-
...
|
|
1105
|
+
...g.rules,
|
|
1094
1106
|
() => s.value.length ? "There is a binding error in your configuration" : !0
|
|
1095
1107
|
]
|
|
1096
1108
|
}, {
|
|
1097
|
-
label: J(() =>
|
|
1098
|
-
|
|
1109
|
+
label: J(() => B[4] || (B[4] = [
|
|
1110
|
+
v("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Define the inventory bindings for this recipe or ingredient. ", -1)
|
|
1099
1111
|
])),
|
|
1100
1112
|
_: 1
|
|
1101
1113
|
}, 8, ["disabled", "model-value", "rules"]),
|
|
1102
|
-
((
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1114
|
+
((H = g.recipeBindingConfig) == null ? void 0 : H.enabled) !== !1 ? (y(), E("div", wn, [
|
|
1115
|
+
v("div", En, [
|
|
1116
|
+
v("div", Vn, U(n(l)("inventory.inventoryBindings.recipe")), 1),
|
|
1117
|
+
g.readonly ? T("", !0) : (y(), Y(R, {
|
|
1106
1118
|
key: 0,
|
|
1107
1119
|
variant: "secondary",
|
|
1108
1120
|
"text-color": "primary",
|
|
@@ -1112,32 +1124,32 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1112
1124
|
onClick: f
|
|
1113
1125
|
}, null, 8, ["label"]))
|
|
1114
1126
|
]),
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1127
|
+
v("div", Sn, [
|
|
1128
|
+
v("div", Cn, [
|
|
1129
|
+
v("div", Bn, U(n(l)("inventory.inventoryBindings.recipe")), 1),
|
|
1130
|
+
B[5] || (B[5] = v("div", { class: "w-[200px]" }, null, -1)),
|
|
1131
|
+
g.recipeBindingConfig.ableToApplyRules ? (y(), E("div", Fn)) : T("", !0),
|
|
1132
|
+
g.readonly ? T("", !0) : (y(), E("div", Rn))
|
|
1121
1133
|
]),
|
|
1122
|
-
(
|
|
1134
|
+
(y(!0), E(X, null, me(p.value, (M) => {
|
|
1123
1135
|
var L;
|
|
1124
|
-
return
|
|
1125
|
-
key:
|
|
1126
|
-
"model-value":
|
|
1127
|
-
"display-name": (L = i.value[
|
|
1128
|
-
"show-error":
|
|
1129
|
-
readonly:
|
|
1130
|
-
disabled:
|
|
1131
|
-
"onUpdate:modelValue":
|
|
1132
|
-
onDelete:
|
|
1136
|
+
return y(), Y(un, {
|
|
1137
|
+
key: M.id,
|
|
1138
|
+
"model-value": M,
|
|
1139
|
+
"display-name": (L = i.value[M.id]) == null ? void 0 : L.name,
|
|
1140
|
+
"show-error": a.value.has(M.id),
|
|
1141
|
+
readonly: g.readonly,
|
|
1142
|
+
disabled: g.disabled,
|
|
1143
|
+
"onUpdate:modelValue": B[0] || (B[0] = (q) => c(q)),
|
|
1144
|
+
onDelete: B[1] || (B[1] = (q) => _(q))
|
|
1133
1145
|
}, null, 8, ["model-value", "display-name", "show-error", "readonly", "disabled"]);
|
|
1134
1146
|
}), 128))
|
|
1135
1147
|
])
|
|
1136
|
-
])) :
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1148
|
+
])) : T("", !0),
|
|
1149
|
+
g.enableIngredientGroup ? (y(), E("div", An, [
|
|
1150
|
+
v("div", Tn, [
|
|
1151
|
+
v("div", Un, U(n(l)("inventory.inventoryBindings.ingredientGroup")), 1),
|
|
1152
|
+
g.readonly ? T("", !0) : (y(), Y(R, {
|
|
1141
1153
|
key: 0,
|
|
1142
1154
|
variant: "secondary",
|
|
1143
1155
|
"text-color": "primary",
|
|
@@ -1147,51 +1159,51 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1147
1159
|
onClick: S
|
|
1148
1160
|
}, null, 8, ["label"]))
|
|
1149
1161
|
]),
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1162
|
+
v("div", Pn, [
|
|
1163
|
+
v("div", Mn, [
|
|
1164
|
+
v("div", Dn, U(n(l)("inventory.inventoryBindings.ingredientGroup")), 1),
|
|
1165
|
+
B[6] || (B[6] = v("div", { class: "w-[200px]" }, null, -1)),
|
|
1166
|
+
B[7] || (B[7] = v("div", { class: "w-[52px]" }, null, -1))
|
|
1155
1167
|
]),
|
|
1156
|
-
(
|
|
1157
|
-
key:
|
|
1158
|
-
disabled:
|
|
1159
|
-
modelValue: +n(Q)(
|
|
1168
|
+
(y(!0), E(X, null, me(k.value, (M) => (y(), Y(F, {
|
|
1169
|
+
key: M.id,
|
|
1170
|
+
disabled: g.disabled,
|
|
1171
|
+
modelValue: +n(Q)(M.amount ?? { amount: 1, precision: 0 }),
|
|
1160
1172
|
rules: [n(it)(0), n(qe)(0)]
|
|
1161
1173
|
}, {
|
|
1162
1174
|
default: J(({ invalid: L }) => {
|
|
1163
|
-
var
|
|
1175
|
+
var q;
|
|
1164
1176
|
return [
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1177
|
+
v("div", Gn, [
|
|
1178
|
+
a.value.has(M.id) ? (y(), E("div", Nn, [
|
|
1179
|
+
h(P, {
|
|
1168
1180
|
name: "error",
|
|
1169
1181
|
color: "system-error-300",
|
|
1170
1182
|
size: "sm"
|
|
1171
1183
|
}),
|
|
1172
|
-
|
|
1173
|
-
])) :
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1184
|
+
v("div", null, U(n(l)("inventory.inventoryBindings.circularError")), 1)
|
|
1185
|
+
])) : T("", !0),
|
|
1186
|
+
v("div", zn, [
|
|
1187
|
+
v("div", On, [
|
|
1188
|
+
v("div", Ln, U((q = x.value[M.id]) == null ? void 0 : q.name), 1)
|
|
1177
1189
|
]),
|
|
1178
|
-
|
|
1179
|
-
|
|
1190
|
+
v("div", jn, [
|
|
1191
|
+
h(K, {
|
|
1180
1192
|
class: "w-full",
|
|
1181
|
-
disabled:
|
|
1182
|
-
modelValue: +n(Q)(
|
|
1183
|
-
"onUpdate:modelValue": (
|
|
1193
|
+
disabled: g.disabled,
|
|
1194
|
+
modelValue: +n(Q)(M.amount ?? { amount: 1, precision: 0 }),
|
|
1195
|
+
"onUpdate:modelValue": (oe) => b(M.id, oe, g.modelValue),
|
|
1184
1196
|
invalid: L
|
|
1185
1197
|
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"])
|
|
1186
1198
|
]),
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
disabled:
|
|
1199
|
+
g.readonly ? T("", !0) : (y(), E("div", Kn, [
|
|
1200
|
+
h(R, {
|
|
1201
|
+
disabled: g.disabled,
|
|
1190
1202
|
type: "button",
|
|
1191
1203
|
variant: "plain",
|
|
1192
1204
|
icon: "delete",
|
|
1193
1205
|
"icon-color": "#000000",
|
|
1194
|
-
onClick: (
|
|
1206
|
+
onClick: (oe) => _(M.id)
|
|
1195
1207
|
}, null, 8, ["disabled", "onClick"])
|
|
1196
1208
|
]))
|
|
1197
1209
|
])
|
|
@@ -1201,11 +1213,11 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1201
1213
|
_: 2
|
|
1202
1214
|
}, 1032, ["disabled", "modelValue", "rules"]))), 128))
|
|
1203
1215
|
])
|
|
1204
|
-
])) :
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1216
|
+
])) : T("", !0),
|
|
1217
|
+
v("div", qn, [
|
|
1218
|
+
v("div", Wn, [
|
|
1219
|
+
v("div", Yn, U(n(l)("inventory.inventoryBindings.ingredient")), 1),
|
|
1220
|
+
g.readonly ? T("", !0) : (y(), Y(R, {
|
|
1209
1221
|
key: 0,
|
|
1210
1222
|
variant: "secondary",
|
|
1211
1223
|
"text-color": "primary",
|
|
@@ -1215,44 +1227,69 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1215
1227
|
onClick: V
|
|
1216
1228
|
}, null, 8, ["label"]))
|
|
1217
1229
|
]),
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
(
|
|
1230
|
+
v("div", Jn, [
|
|
1231
|
+
v("div", Hn, [
|
|
1232
|
+
v("div", Qn, U(n(l)("inventory.inventoryBindings.ingredient")), 1),
|
|
1233
|
+
v("div", Xn, U(n(l)("inventory.inventoryBindings.amount")), 1),
|
|
1234
|
+
B[8] || (B[8] = v("div", { class: "w-[52px]" }, null, -1)),
|
|
1235
|
+
(ee = g.skuBindingConfig) != null && ee.ableToApplyRules || (O = g.skuBindingConfig) != null && O.ableToConfigureAlternative ? (y(), E("div", Zn)) : T("", !0)
|
|
1224
1236
|
]),
|
|
1225
|
-
(
|
|
1226
|
-
var L,
|
|
1227
|
-
return
|
|
1228
|
-
key:
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1237
|
+
(y(!0), E(X, null, me(e.value, (M) => {
|
|
1238
|
+
var L, q, oe;
|
|
1239
|
+
return y(), E(X, {
|
|
1240
|
+
key: M.id
|
|
1241
|
+
}, [
|
|
1242
|
+
z(M) ? (y(), E("div", eo, [
|
|
1243
|
+
v("div", to, [
|
|
1244
|
+
v("div", no, U(M.id), 1),
|
|
1245
|
+
g.readonly ? T("", !0) : (y(), E("div", oo, [
|
|
1246
|
+
h(R, {
|
|
1247
|
+
disabled: g.disabled,
|
|
1248
|
+
type: "button",
|
|
1249
|
+
variant: "tertiary",
|
|
1250
|
+
icon: "delete",
|
|
1251
|
+
onClick: () => _(M.id)
|
|
1252
|
+
}, null, 8, ["disabled", "onClick"])
|
|
1253
|
+
]))
|
|
1254
|
+
]),
|
|
1255
|
+
v("div", io, [
|
|
1256
|
+
h(P, {
|
|
1257
|
+
name: "error",
|
|
1258
|
+
color: "system-error-300",
|
|
1259
|
+
size: "sm"
|
|
1260
|
+
}),
|
|
1261
|
+
v("div", null, U(n(l)("inventory.inventoryBindings.missingIngredient")), 1)
|
|
1262
|
+
])
|
|
1263
|
+
])) : (y(), Y($n, {
|
|
1264
|
+
key: 1,
|
|
1265
|
+
"model-value": M,
|
|
1266
|
+
"display-name": (L = r.value[M.id]) == null ? void 0 : L.name,
|
|
1267
|
+
unit: N(M),
|
|
1268
|
+
"show-error": a.value.has(M.id),
|
|
1269
|
+
"able-to-apply-rules": ((q = g.skuBindingConfig) == null ? void 0 : q.ableToApplyRules) === !0,
|
|
1270
|
+
"able-to-configure-alternative": ((oe = g.skuBindingConfig) == null ? void 0 : oe.ableToConfigureAlternative) === !0,
|
|
1271
|
+
readonly: g.readonly,
|
|
1272
|
+
disabled: g.disabled,
|
|
1273
|
+
"onUpdate:modelValue": B[2] || (B[2] = (Z) => c(Z)),
|
|
1274
|
+
onDelete: B[3] || (B[3] = (Z) => _(Z))
|
|
1275
|
+
}, null, 8, ["model-value", "display-name", "unit", "show-error", "able-to-apply-rules", "able-to-configure-alternative", "readonly", "disabled"]))
|
|
1276
|
+
], 64);
|
|
1240
1277
|
}), 128))
|
|
1241
1278
|
])
|
|
1242
1279
|
])
|
|
1243
1280
|
]);
|
|
1244
1281
|
};
|
|
1245
1282
|
}
|
|
1246
|
-
}),
|
|
1283
|
+
}), ro = { class: "flex flex-col gap-40" }, ao = {
|
|
1247
1284
|
key: 0,
|
|
1248
1285
|
class: "flex flex-col gap-16"
|
|
1249
|
-
},
|
|
1286
|
+
}, so = {
|
|
1250
1287
|
key: 0,
|
|
1251
1288
|
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"
|
|
1252
|
-
},
|
|
1289
|
+
}, uo = {
|
|
1253
1290
|
key: 0,
|
|
1254
1291
|
class: "flex flex-col items-center w-full h-full gap-24"
|
|
1255
|
-
},
|
|
1292
|
+
}, co = { key: 1 }, po = { class: "mt-32" }, mo = /* @__PURE__ */ le({
|
|
1256
1293
|
__name: "RecipeForm",
|
|
1257
1294
|
props: {
|
|
1258
1295
|
mode: {},
|
|
@@ -1261,175 +1298,175 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1261
1298
|
},
|
|
1262
1299
|
emits: ["update:modelValue", "click:submit"],
|
|
1263
1300
|
setup(m, { expose: d, emit: l }) {
|
|
1264
|
-
const t = m, i = l,
|
|
1301
|
+
const t = m, i = l, r = We(), { t: x } = ie(), u = A({
|
|
1265
1302
|
get() {
|
|
1266
1303
|
var c;
|
|
1267
1304
|
return ((c = t.modelValue) == null ? void 0 : c.name) ?? "";
|
|
1268
1305
|
},
|
|
1269
1306
|
set(c) {
|
|
1270
|
-
const
|
|
1271
|
-
|
|
1307
|
+
const _ = t.modelValue ?? {};
|
|
1308
|
+
_.name = c, i("update:modelValue", _);
|
|
1272
1309
|
}
|
|
1273
|
-
}), o =
|
|
1310
|
+
}), o = A({
|
|
1274
1311
|
get() {
|
|
1275
1312
|
var c;
|
|
1276
1313
|
return ((c = t.modelValue) == null ? void 0 : c.contains) ?? [];
|
|
1277
1314
|
},
|
|
1278
1315
|
set(c) {
|
|
1279
|
-
const
|
|
1280
|
-
|
|
1316
|
+
const _ = t.modelValue ?? {};
|
|
1317
|
+
_.contains = c, i("update:modelValue", _);
|
|
1281
1318
|
}
|
|
1282
|
-
}), s =
|
|
1319
|
+
}), s = A({
|
|
1283
1320
|
get() {
|
|
1284
1321
|
var c;
|
|
1285
1322
|
return ((c = t.modelValue) == null ? void 0 : c.customAttributes) ?? {};
|
|
1286
1323
|
},
|
|
1287
1324
|
set(c) {
|
|
1288
|
-
const
|
|
1325
|
+
const _ = t.modelValue ? {
|
|
1289
1326
|
...t.modelValue
|
|
1290
1327
|
} : {};
|
|
1291
|
-
|
|
1328
|
+
_.customAttributes = c, i("update:modelValue", _);
|
|
1292
1329
|
}
|
|
1293
|
-
}),
|
|
1330
|
+
}), a = A({
|
|
1294
1331
|
get() {
|
|
1295
1332
|
var c;
|
|
1296
1333
|
return ((c = t.modelValue) == null ? void 0 : c.version) ?? null;
|
|
1297
1334
|
},
|
|
1298
1335
|
set(c) {
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1336
|
+
const _ = t.modelValue ? { ...t.modelValue } : {};
|
|
1337
|
+
_.version = c, i("update:modelValue", _);
|
|
1301
1338
|
}
|
|
1302
|
-
}), p =
|
|
1339
|
+
}), p = A({
|
|
1303
1340
|
get() {
|
|
1304
|
-
return
|
|
1341
|
+
return a.value === "v2";
|
|
1305
1342
|
},
|
|
1306
1343
|
set(c) {
|
|
1307
|
-
|
|
1344
|
+
a.value = c ? "v2" : null;
|
|
1308
1345
|
}
|
|
1309
1346
|
});
|
|
1310
1347
|
function $() {
|
|
1311
1348
|
i("click:submit");
|
|
1312
1349
|
}
|
|
1313
|
-
const C =
|
|
1350
|
+
const C = W();
|
|
1314
1351
|
d({
|
|
1315
1352
|
validateInputs: () => {
|
|
1316
|
-
var c,
|
|
1317
|
-
(
|
|
1353
|
+
var c, _;
|
|
1354
|
+
(_ = (c = C.value) == null ? void 0 : c.validateInputs) == null || _.call(c);
|
|
1318
1355
|
},
|
|
1319
1356
|
resetInputsValidation: () => {
|
|
1320
|
-
var c,
|
|
1321
|
-
(
|
|
1357
|
+
var c, _;
|
|
1358
|
+
(_ = (c = C.value) == null ? void 0 : c.resetInputsValidation) == null || _.call(c);
|
|
1322
1359
|
},
|
|
1323
1360
|
resetInputs: () => {
|
|
1324
|
-
var c,
|
|
1325
|
-
(
|
|
1361
|
+
var c, _;
|
|
1362
|
+
(_ = (c = C.value) == null ? void 0 : c.resetInputs) == null || _.call(c);
|
|
1326
1363
|
}
|
|
1327
1364
|
});
|
|
1328
|
-
const I = ne(), f =
|
|
1329
|
-
ue(
|
|
1330
|
-
|
|
1365
|
+
const I = ne(), f = W([]), k = W(!1), S = W(!1);
|
|
1366
|
+
ue(k, async (c) => {
|
|
1367
|
+
b(c);
|
|
1331
1368
|
});
|
|
1332
|
-
async function
|
|
1333
|
-
var
|
|
1334
|
-
c && !S.value && ((
|
|
1369
|
+
async function b(c) {
|
|
1370
|
+
var _, N;
|
|
1371
|
+
c && !S.value && ((_ = t.modelValue) != null && _._id) && (S.value = !0, f.value = await I.getAffectedMenu((N = t.modelValue) == null ? void 0 : N._id).delayed(500), S.value = !1);
|
|
1335
1372
|
}
|
|
1336
|
-
const e =
|
|
1373
|
+
const e = A(
|
|
1337
1374
|
() => I.recipes.map((c) => ({ label: c.name, value: c.name }))
|
|
1338
|
-
), V =
|
|
1375
|
+
), V = A(() => {
|
|
1339
1376
|
var c;
|
|
1340
1377
|
return ((c = t.modelValue) == null ? void 0 : c.name) ?? "";
|
|
1341
1378
|
});
|
|
1342
|
-
return (c,
|
|
1343
|
-
const
|
|
1344
|
-
return
|
|
1379
|
+
return (c, _) => {
|
|
1380
|
+
const N = G("FmTextField"), z = G("FmSwitch"), g = G("FmCard"), B = G("FmSpacer"), F = G("FmCircularProgress"), R = G("FmForm");
|
|
1381
|
+
return y(), Y(R, {
|
|
1345
1382
|
ref_key: "formRef",
|
|
1346
1383
|
ref: C,
|
|
1347
1384
|
onValidationSuccess: $
|
|
1348
1385
|
}, {
|
|
1349
1386
|
default: J(() => [
|
|
1350
|
-
|
|
1351
|
-
|
|
1387
|
+
v("div", ro, [
|
|
1388
|
+
h(N, {
|
|
1352
1389
|
disabled: c.disabled,
|
|
1353
|
-
label: n(
|
|
1390
|
+
label: n(x)("inventory.recipe.name"),
|
|
1354
1391
|
"model-value": u.value,
|
|
1355
|
-
"onUpdate:modelValue":
|
|
1392
|
+
"onUpdate:modelValue": _[0] || (_[0] = (P) => u.value = P),
|
|
1356
1393
|
rules: [
|
|
1357
1394
|
n(Rt)(),
|
|
1358
1395
|
n(lt)(e.value, V.value, (P) => `[${P.value}] already exists`)
|
|
1359
1396
|
],
|
|
1360
1397
|
"label-mark": "required"
|
|
1361
1398
|
}, null, 8, ["disabled", "label", "model-value", "rules"]),
|
|
1362
|
-
n(
|
|
1363
|
-
|
|
1399
|
+
n(r).enableRecipeV2 ? (y(), E("div", ao, [
|
|
1400
|
+
h(z, {
|
|
1364
1401
|
modelValue: p.value,
|
|
1365
|
-
"onUpdate:modelValue":
|
|
1402
|
+
"onUpdate:modelValue": _[1] || (_[1] = (P) => p.value = P),
|
|
1366
1403
|
value: !0,
|
|
1367
|
-
label: n(
|
|
1404
|
+
label: n(x)("inventory.recipe.enableRecipeV2"),
|
|
1368
1405
|
"label-placement": "right",
|
|
1369
1406
|
disabled: c.disabled,
|
|
1370
|
-
sublabel: n(
|
|
1407
|
+
sublabel: n(x)("inventory.recipe.recipeV2Warning")
|
|
1371
1408
|
}, null, 8, ["modelValue", "label", "disabled", "sublabel"])
|
|
1372
|
-
])) :
|
|
1373
|
-
|
|
1409
|
+
])) : T("", !0),
|
|
1410
|
+
h(g, {
|
|
1374
1411
|
variant: "outlined",
|
|
1375
1412
|
class: "p-16"
|
|
1376
1413
|
}, {
|
|
1377
1414
|
default: J(() => {
|
|
1378
|
-
var P,
|
|
1415
|
+
var P, K;
|
|
1379
1416
|
return [
|
|
1380
|
-
n(
|
|
1417
|
+
n(r).enableRecipeV2 ? (y(), Y(lo, {
|
|
1381
1418
|
key: 0,
|
|
1382
1419
|
id: (P = c.modelValue) == null ? void 0 : P._id,
|
|
1383
1420
|
disabled: c.disabled,
|
|
1384
1421
|
"model-value": o.value,
|
|
1385
|
-
"onUpdate:modelValue":
|
|
1422
|
+
"onUpdate:modelValue": _[2] || (_[2] = (H) => o.value = H),
|
|
1386
1423
|
rules: [n(Ne)(1)],
|
|
1387
|
-
"enable-ingredient-group": n(
|
|
1424
|
+
"enable-ingredient-group": n(r).enableIngredientGroup,
|
|
1388
1425
|
"recipe-binding-config": { enabled: !p.value, ableToApplyRules: p.value },
|
|
1389
1426
|
"sku-binding-config": {
|
|
1390
1427
|
ableToConfigureAlternative: p.value
|
|
1391
1428
|
}
|
|
1392
|
-
}, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group", "recipe-binding-config", "sku-binding-config"])) : (
|
|
1429
|
+
}, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group", "recipe-binding-config", "sku-binding-config"])) : (y(), Y(At, {
|
|
1393
1430
|
key: 1,
|
|
1394
|
-
id: (
|
|
1431
|
+
id: (K = c.modelValue) == null ? void 0 : K._id,
|
|
1395
1432
|
disabled: c.disabled,
|
|
1396
1433
|
"model-value": o.value,
|
|
1397
|
-
"onUpdate:modelValue":
|
|
1434
|
+
"onUpdate:modelValue": _[3] || (_[3] = (H) => o.value = H),
|
|
1398
1435
|
rules: [n(Ne)(1)],
|
|
1399
|
-
"enable-ingredient-group": n(
|
|
1436
|
+
"enable-ingredient-group": n(r).enableIngredientGroup
|
|
1400
1437
|
}, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group"]))
|
|
1401
1438
|
];
|
|
1402
1439
|
}),
|
|
1403
1440
|
_: 1
|
|
1404
1441
|
})
|
|
1405
1442
|
]),
|
|
1406
|
-
c.mode !== n(se).CREATE ? (
|
|
1407
|
-
|
|
1443
|
+
c.mode !== n(se).CREATE ? (y(), E("div", so, [
|
|
1444
|
+
h(z, {
|
|
1408
1445
|
label: "Show binded items",
|
|
1409
|
-
modelValue:
|
|
1410
|
-
"onUpdate:modelValue":
|
|
1446
|
+
modelValue: k.value,
|
|
1447
|
+
"onUpdate:modelValue": _[4] || (_[4] = (P) => k.value = P),
|
|
1411
1448
|
"label-placement": "right",
|
|
1412
1449
|
disabled: S.value
|
|
1413
1450
|
}, null, 8, ["modelValue", "disabled"]),
|
|
1414
|
-
S.value ? (
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1451
|
+
S.value ? (y(), E("div", uo, [
|
|
1452
|
+
h(B),
|
|
1453
|
+
v("div", null, [
|
|
1454
|
+
h(F, { size: "xl" })
|
|
1418
1455
|
]),
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
])) :
|
|
1422
|
-
|
|
1456
|
+
_[6] || (_[6] = v("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
1457
|
+
h(B)
|
|
1458
|
+
])) : k.value && f.value.length ? (y(), E("div", co, [
|
|
1459
|
+
h(nt, {
|
|
1423
1460
|
name: "Menu",
|
|
1424
1461
|
bindings: f.value
|
|
1425
1462
|
}, null, 8, ["bindings"])
|
|
1426
|
-
])) :
|
|
1427
|
-
])) :
|
|
1428
|
-
|
|
1429
|
-
|
|
1463
|
+
])) : T("", !0)
|
|
1464
|
+
])) : T("", !0),
|
|
1465
|
+
v("div", po, [
|
|
1466
|
+
h(Ot, {
|
|
1430
1467
|
entity: "inventoryRecipe",
|
|
1431
1468
|
modelValue: s.value,
|
|
1432
|
-
"onUpdate:modelValue":
|
|
1469
|
+
"onUpdate:modelValue": _[5] || (_[5] = (P) => s.value = P)
|
|
1433
1470
|
}, null, 8, ["modelValue"])
|
|
1434
1471
|
])
|
|
1435
1472
|
]),
|
|
@@ -1437,7 +1474,7 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1437
1474
|
}, 512);
|
|
1438
1475
|
};
|
|
1439
1476
|
}
|
|
1440
|
-
}),
|
|
1477
|
+
}), fo = { class: "flex gap-4" }, vo = /* @__PURE__ */ le({
|
|
1441
1478
|
__name: "RecipeDialog",
|
|
1442
1479
|
props: {
|
|
1443
1480
|
show: { type: Boolean },
|
|
@@ -1446,7 +1483,7 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1446
1483
|
},
|
|
1447
1484
|
emits: ["update:show"],
|
|
1448
1485
|
setup(m) {
|
|
1449
|
-
const d = m, l = ne(), t = je(), { t: i } =
|
|
1486
|
+
const d = m, l = ne(), t = je(), { t: i } = ie(), r = Ge(d, "show"), x = Ge(d, "recipe"), u = A(() => {
|
|
1450
1487
|
switch (d.mode) {
|
|
1451
1488
|
case se.READ:
|
|
1452
1489
|
return "";
|
|
@@ -1456,7 +1493,7 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1456
1493
|
return i("inventory.recipe.create.title");
|
|
1457
1494
|
}
|
|
1458
1495
|
return "";
|
|
1459
|
-
}), o =
|
|
1496
|
+
}), o = A(() => {
|
|
1460
1497
|
switch (d.mode) {
|
|
1461
1498
|
case se.READ:
|
|
1462
1499
|
return "";
|
|
@@ -1466,14 +1503,14 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1466
1503
|
return i("common.add");
|
|
1467
1504
|
}
|
|
1468
1505
|
return "";
|
|
1469
|
-
}), s =
|
|
1506
|
+
}), s = W(), a = W(!1);
|
|
1470
1507
|
async function p() {
|
|
1471
|
-
|
|
1508
|
+
a.value = !0;
|
|
1472
1509
|
try {
|
|
1473
|
-
const f = Oe(
|
|
1474
|
-
f.precision ?? (f.precision = 0), f.measurements ?? (f.measurements = []), await l.createRecipe(f),
|
|
1510
|
+
const f = Oe(x.value);
|
|
1511
|
+
f.precision ?? (f.precision = 0), f.measurements ?? (f.measurements = []), await l.createRecipe(f), r.value = !1, t.open({
|
|
1475
1512
|
title: i("inventory.common.success"),
|
|
1476
|
-
message: i("inventory.recipe.create.success", { name:
|
|
1513
|
+
message: i("inventory.recipe.create.success", { name: x.value.name }),
|
|
1477
1514
|
type: "success"
|
|
1478
1515
|
});
|
|
1479
1516
|
} catch (f) {
|
|
@@ -1483,15 +1520,15 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1483
1520
|
type: "error"
|
|
1484
1521
|
});
|
|
1485
1522
|
} finally {
|
|
1486
|
-
|
|
1523
|
+
a.value = !1;
|
|
1487
1524
|
}
|
|
1488
1525
|
}
|
|
1489
1526
|
async function $() {
|
|
1490
|
-
|
|
1527
|
+
a.value = !0;
|
|
1491
1528
|
try {
|
|
1492
|
-
await l.updateRecipe(
|
|
1529
|
+
await l.updateRecipe(x.value), r.value = !1, t.open({
|
|
1493
1530
|
title: i("inventory.common.success"),
|
|
1494
|
-
message: i("inventory.recipe.update.success", { name:
|
|
1531
|
+
message: i("inventory.recipe.update.success", { name: x.value.name }),
|
|
1495
1532
|
type: "success"
|
|
1496
1533
|
});
|
|
1497
1534
|
} catch (f) {
|
|
@@ -1501,12 +1538,12 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1501
1538
|
type: "error"
|
|
1502
1539
|
});
|
|
1503
1540
|
} finally {
|
|
1504
|
-
|
|
1541
|
+
a.value = !1;
|
|
1505
1542
|
}
|
|
1506
1543
|
}
|
|
1507
1544
|
function C() {
|
|
1508
|
-
var f,
|
|
1509
|
-
(
|
|
1545
|
+
var f, k;
|
|
1546
|
+
(k = (f = s.value) == null ? void 0 : f.validateInputs) == null || k.call(f);
|
|
1510
1547
|
}
|
|
1511
1548
|
function I() {
|
|
1512
1549
|
switch (d.mode) {
|
|
@@ -1518,41 +1555,41 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1518
1555
|
return p();
|
|
1519
1556
|
}
|
|
1520
1557
|
}
|
|
1521
|
-
return (f,
|
|
1522
|
-
const S = G("FmButton"),
|
|
1523
|
-
return
|
|
1524
|
-
"model-value": n(
|
|
1525
|
-
"onUpdate:modelValue":
|
|
1558
|
+
return (f, k) => {
|
|
1559
|
+
const S = G("FmButton"), b = G("FmSideSheet");
|
|
1560
|
+
return y(), Y(b, {
|
|
1561
|
+
"model-value": n(r),
|
|
1562
|
+
"onUpdate:modelValue": k[3] || (k[3] = (e) => De(r) ? r.value = e : null),
|
|
1526
1563
|
header: u.value,
|
|
1527
1564
|
"close-button": "",
|
|
1528
1565
|
"dismiss-away": "",
|
|
1529
1566
|
"max-width": 800
|
|
1530
1567
|
}, {
|
|
1531
1568
|
"side-sheet-footer": J(() => [
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
loading:
|
|
1569
|
+
v("div", fo, [
|
|
1570
|
+
h(S, {
|
|
1571
|
+
loading: a.value,
|
|
1535
1572
|
label: o.value,
|
|
1536
1573
|
onClick: C
|
|
1537
1574
|
}, null, 8, ["loading", "label"]),
|
|
1538
|
-
|
|
1539
|
-
disabled:
|
|
1575
|
+
h(S, {
|
|
1576
|
+
disabled: a.value,
|
|
1540
1577
|
label: n(i)("common.close"),
|
|
1541
1578
|
variant: "tertiary",
|
|
1542
|
-
onClick:
|
|
1579
|
+
onClick: k[2] || (k[2] = (e) => r.value = !1)
|
|
1543
1580
|
}, null, 8, ["disabled", "label"])
|
|
1544
1581
|
])
|
|
1545
1582
|
]),
|
|
1546
1583
|
default: J(() => [
|
|
1547
|
-
|
|
1584
|
+
h(mo, {
|
|
1548
1585
|
class: "w-full",
|
|
1549
1586
|
ref_key: "hasValidationExpose",
|
|
1550
1587
|
ref: s,
|
|
1551
|
-
modelValue: n(
|
|
1552
|
-
"onUpdate:modelValue":
|
|
1588
|
+
modelValue: n(x),
|
|
1589
|
+
"onUpdate:modelValue": k[0] || (k[0] = (e) => De(x) ? x.value = e : null),
|
|
1553
1590
|
mode: f.mode,
|
|
1554
|
-
disabled:
|
|
1555
|
-
"onClick:submit":
|
|
1591
|
+
disabled: a.value,
|
|
1592
|
+
"onClick:submit": k[1] || (k[1] = (e) => I())
|
|
1556
1593
|
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
1557
1594
|
]),
|
|
1558
1595
|
_: 1
|
|
@@ -1568,14 +1605,14 @@ function ke(m, d, l) {
|
|
|
1568
1605
|
else if (i.type === be.enum.SKU_GROUP)
|
|
1569
1606
|
t.push({ ...i, isGroup: !0, recipeIds: [...d] });
|
|
1570
1607
|
else if (i.type === be.enum.RECIPE) {
|
|
1571
|
-
const
|
|
1572
|
-
|
|
1573
|
-
...ke(
|
|
1608
|
+
const r = l[i.id];
|
|
1609
|
+
r && !d.has(i.id) && t.push(
|
|
1610
|
+
...ke(r.contains, /* @__PURE__ */ new Set([...d, i.id]), l)
|
|
1574
1611
|
);
|
|
1575
1612
|
}
|
|
1576
1613
|
return t;
|
|
1577
1614
|
}
|
|
1578
|
-
function
|
|
1615
|
+
function yo(m, d) {
|
|
1579
1616
|
return he.equal(m, d);
|
|
1580
1617
|
}
|
|
1581
1618
|
function Ae(m) {
|
|
@@ -1596,115 +1633,115 @@ function Xe(m) {
|
|
|
1596
1633
|
return m.measurement ? he.multiplyDecimal(m.amount, m.measurement.conversion) : m.amount;
|
|
1597
1634
|
}
|
|
1598
1635
|
function Me(m, d) {
|
|
1599
|
-
var i,
|
|
1600
|
-
if (m.type !== d.type || m.id !== d.id || !
|
|
1601
|
-
const l = ((i = m.measurement) == null ? void 0 : i.id) ?? null, t = ((
|
|
1636
|
+
var i, r;
|
|
1637
|
+
if (m.type !== d.type || m.id !== d.id || !yo(Xe(m), Xe(d))) return !1;
|
|
1638
|
+
const l = ((i = m.measurement) == null ? void 0 : i.id) ?? null, t = ((r = d.measurement) == null ? void 0 : r.id) ?? null;
|
|
1602
1639
|
return !(l !== t || Ae(m.rules) !== Ae(d.rules) || Te(m.alternatives) !== Te(d.alternatives));
|
|
1603
1640
|
}
|
|
1604
1641
|
function Ze(m, d) {
|
|
1605
1642
|
return m.type === d.type && m.id === d.id;
|
|
1606
1643
|
}
|
|
1607
|
-
function
|
|
1644
|
+
function bo(m, d) {
|
|
1608
1645
|
const l = [];
|
|
1609
1646
|
let t = [...m.contains];
|
|
1610
|
-
for (const
|
|
1611
|
-
switch (
|
|
1647
|
+
for (const r of d)
|
|
1648
|
+
switch (r.type) {
|
|
1612
1649
|
case "remove-binding": {
|
|
1613
|
-
const
|
|
1614
|
-
(u) => u.type ===
|
|
1650
|
+
const x = t.findIndex(
|
|
1651
|
+
(u) => u.type === r.target.type && u.id === r.target.id
|
|
1615
1652
|
);
|
|
1616
|
-
|
|
1653
|
+
x === -1 ? l.push({ change: r, outcome: "ignored", reason: "Source binding not found in target" }) : (t = [...t.slice(0, x), ...t.slice(x + 1)], l.push({ change: r, outcome: "applied" }));
|
|
1617
1654
|
break;
|
|
1618
1655
|
}
|
|
1619
1656
|
case "add-binding": {
|
|
1620
|
-
if (t.find((o) => Me(o,
|
|
1621
|
-
l.push({ change:
|
|
1657
|
+
if (t.find((o) => Me(o, r.binding))) {
|
|
1658
|
+
l.push({ change: r, outcome: "already-satisfied", reason: "Exact binding already present" });
|
|
1622
1659
|
break;
|
|
1623
1660
|
}
|
|
1624
|
-
if (t.find((o) => Ze(o,
|
|
1625
|
-
l.push({ change:
|
|
1661
|
+
if (t.find((o) => Ze(o, r.binding))) {
|
|
1662
|
+
l.push({ change: r, outcome: "blocked", reason: "A similar but non-exact binding already exists" });
|
|
1626
1663
|
break;
|
|
1627
1664
|
}
|
|
1628
|
-
if (m.version === "v2" &&
|
|
1629
|
-
l.push({ change:
|
|
1665
|
+
if (m.version === "v2" && r.binding.type === "RECIPE") {
|
|
1666
|
+
l.push({ change: r, outcome: "blocked", reason: "Cannot add RECIPE binding to a V2 recipe" });
|
|
1630
1667
|
break;
|
|
1631
1668
|
}
|
|
1632
|
-
if (m.version !== "v2" && (
|
|
1633
|
-
l.push({ change:
|
|
1669
|
+
if (m.version !== "v2" && (r.binding.alternatives ?? []).length > 0) {
|
|
1670
|
+
l.push({ change: r, outcome: "blocked", reason: "Cannot add a binding with alternatives to a non-V2 recipe" });
|
|
1634
1671
|
break;
|
|
1635
1672
|
}
|
|
1636
|
-
t = [...t,
|
|
1673
|
+
t = [...t, r.binding], l.push({ change: r, outcome: "applied" });
|
|
1637
1674
|
break;
|
|
1638
1675
|
}
|
|
1639
1676
|
case "replace-binding": {
|
|
1640
|
-
const
|
|
1641
|
-
(s) => s.type ===
|
|
1642
|
-
), u = t.find((s) => Me(s,
|
|
1643
|
-
if (
|
|
1644
|
-
u ? l.push({ change:
|
|
1677
|
+
const x = t.findIndex(
|
|
1678
|
+
(s) => s.type === r.from.type && s.id === r.from.id
|
|
1679
|
+
), u = t.find((s) => Me(s, r.to)), o = t.find((s, a) => a !== x && Ze(s, r.to) && !Me(s, r.to));
|
|
1680
|
+
if (x === -1) {
|
|
1681
|
+
u ? l.push({ change: r, outcome: "already-satisfied", reason: "Target already has exact replacement" }) : l.push({ change: r, outcome: "ignored", reason: "Source binding not found in target" });
|
|
1645
1682
|
break;
|
|
1646
1683
|
}
|
|
1647
|
-
if (m.version === "v2" &&
|
|
1648
|
-
l.push({ change:
|
|
1684
|
+
if (m.version === "v2" && r.to.type === "RECIPE") {
|
|
1685
|
+
l.push({ change: r, outcome: "blocked", reason: "Cannot add RECIPE binding to a V2 recipe" });
|
|
1649
1686
|
break;
|
|
1650
1687
|
}
|
|
1651
|
-
if (m.version !== "v2" && (
|
|
1652
|
-
l.push({ change:
|
|
1688
|
+
if (m.version !== "v2" && (r.to.alternatives ?? []).length > 0) {
|
|
1689
|
+
l.push({ change: r, outcome: "blocked", reason: "Cannot apply a binding with alternatives to a non-V2 recipe" });
|
|
1653
1690
|
break;
|
|
1654
1691
|
}
|
|
1655
1692
|
if (o) {
|
|
1656
|
-
l.push({ change:
|
|
1693
|
+
l.push({ change: r, outcome: "blocked", reason: "A similar but non-exact replacement binding already exists" });
|
|
1657
1694
|
break;
|
|
1658
1695
|
}
|
|
1659
|
-
u ? (t = [...t.slice(0,
|
|
1660
|
-
...t.slice(0,
|
|
1661
|
-
|
|
1662
|
-
...t.slice(
|
|
1663
|
-
], l.push({ change:
|
|
1696
|
+
u ? (t = [...t.slice(0, x), ...t.slice(x + 1)], l.push({ change: r, outcome: "applied", reason: "Source removed; replacement already present" })) : (t = [
|
|
1697
|
+
...t.slice(0, x),
|
|
1698
|
+
r.to,
|
|
1699
|
+
...t.slice(x + 1)
|
|
1700
|
+
], l.push({ change: r, outcome: "applied" }));
|
|
1664
1701
|
break;
|
|
1665
1702
|
}
|
|
1666
1703
|
case "update-binding-rule": {
|
|
1667
|
-
const
|
|
1668
|
-
(
|
|
1704
|
+
const x = t.findIndex(
|
|
1705
|
+
(a) => a.type === r.target.type && a.id === r.target.id
|
|
1669
1706
|
);
|
|
1670
|
-
if (
|
|
1671
|
-
l.push({ change:
|
|
1707
|
+
if (x === -1) {
|
|
1708
|
+
l.push({ change: r, outcome: "ignored", reason: "Binding not found in target" });
|
|
1672
1709
|
break;
|
|
1673
1710
|
}
|
|
1674
|
-
const u = t[
|
|
1711
|
+
const u = t[x], o = u.rules ?? null, s = r.rule ?? null;
|
|
1675
1712
|
if (Ae(o) === Ae(s)) {
|
|
1676
|
-
l.push({ change:
|
|
1713
|
+
l.push({ change: r, outcome: "already-satisfied", reason: "Rule already matches" });
|
|
1677
1714
|
break;
|
|
1678
1715
|
}
|
|
1679
1716
|
t = [
|
|
1680
|
-
...t.slice(0,
|
|
1717
|
+
...t.slice(0, x),
|
|
1681
1718
|
{ ...u, rules: s },
|
|
1682
|
-
...t.slice(
|
|
1683
|
-
], l.push({ change:
|
|
1719
|
+
...t.slice(x + 1)
|
|
1720
|
+
], l.push({ change: r, outcome: "applied" });
|
|
1684
1721
|
break;
|
|
1685
1722
|
}
|
|
1686
1723
|
case "update-alternatives": {
|
|
1687
1724
|
if (m.version !== "v2") {
|
|
1688
|
-
l.push({ change:
|
|
1725
|
+
l.push({ change: r, outcome: "blocked", reason: "Cannot update alternatives on a non-V2 recipe" });
|
|
1689
1726
|
break;
|
|
1690
1727
|
}
|
|
1691
|
-
const
|
|
1692
|
-
(
|
|
1728
|
+
const x = t.findIndex(
|
|
1729
|
+
(a) => a.type === r.target.type && a.id === r.target.id
|
|
1693
1730
|
);
|
|
1694
|
-
if (
|
|
1695
|
-
l.push({ change:
|
|
1731
|
+
if (x === -1) {
|
|
1732
|
+
l.push({ change: r, outcome: "ignored", reason: "Binding not found in target" });
|
|
1696
1733
|
break;
|
|
1697
1734
|
}
|
|
1698
|
-
const u = t[
|
|
1735
|
+
const u = t[x], o = Te(u.alternatives), s = Te(r.alternatives);
|
|
1699
1736
|
if (o === s) {
|
|
1700
|
-
l.push({ change:
|
|
1737
|
+
l.push({ change: r, outcome: "already-satisfied", reason: "Alternatives already match" });
|
|
1701
1738
|
break;
|
|
1702
1739
|
}
|
|
1703
1740
|
t = [
|
|
1704
|
-
...t.slice(0,
|
|
1705
|
-
{ ...u, alternatives:
|
|
1706
|
-
...t.slice(
|
|
1707
|
-
], l.push({ change:
|
|
1741
|
+
...t.slice(0, x),
|
|
1742
|
+
{ ...u, alternatives: r.alternatives },
|
|
1743
|
+
...t.slice(x + 1)
|
|
1744
|
+
], l.push({ change: r, outcome: "applied" });
|
|
1708
1745
|
break;
|
|
1709
1746
|
}
|
|
1710
1747
|
}
|
|
@@ -1724,17 +1761,17 @@ function et(m) {
|
|
|
1724
1761
|
return m.target.id !== "";
|
|
1725
1762
|
}
|
|
1726
1763
|
}
|
|
1727
|
-
function
|
|
1764
|
+
function go(m) {
|
|
1728
1765
|
if (m.length === 0) return "no-applicable-changes";
|
|
1729
1766
|
let d = 0, l = 0, t = 0, i = 0;
|
|
1730
|
-
for (const
|
|
1731
|
-
|
|
1767
|
+
for (const r of m)
|
|
1768
|
+
r.outcome === "applied" ? d++ : r.outcome === "blocked" ? l++ : r.outcome === "ignored" ? t++ : r.outcome === "already-satisfied" && i++;
|
|
1732
1769
|
return l > 0 && d === 0 ? "blocked" : i === m.length ? "already-satisfied" : d > 0 && (t > 0 || l > 0) ? "partially-ignored" : d > 0 ? "will-update" : "no-applicable-changes";
|
|
1733
1770
|
}
|
|
1734
|
-
let
|
|
1735
|
-
function
|
|
1771
|
+
let _o = 0;
|
|
1772
|
+
function ko(m = null) {
|
|
1736
1773
|
return {
|
|
1737
|
-
id: String(++
|
|
1774
|
+
id: String(++_o),
|
|
1738
1775
|
type: m,
|
|
1739
1776
|
itemId: null,
|
|
1740
1777
|
amountModel: ye()
|
|
@@ -1745,60 +1782,60 @@ function ut(m, d, l, t) {
|
|
|
1745
1782
|
if (i.type === "RECIPE") {
|
|
1746
1783
|
if (i.id === d) return !0;
|
|
1747
1784
|
if (!l.has(i.id)) {
|
|
1748
|
-
const
|
|
1749
|
-
if (
|
|
1785
|
+
const r = t[i.id];
|
|
1786
|
+
if (r && ut(r.contains, d, /* @__PURE__ */ new Set([...l, i.id]), t))
|
|
1750
1787
|
return !0;
|
|
1751
1788
|
}
|
|
1752
1789
|
}
|
|
1753
1790
|
return !1;
|
|
1754
1791
|
}
|
|
1755
1792
|
const ge = ot("recipeBulkEditor", function() {
|
|
1756
|
-
const d = ne(), l = je(), { t } =
|
|
1757
|
-
let
|
|
1758
|
-
const
|
|
1759
|
-
if (
|
|
1760
|
-
const
|
|
1761
|
-
|
|
1762
|
-
}
|
|
1763
|
-
if (
|
|
1764
|
-
const
|
|
1765
|
-
for (const q of
|
|
1766
|
-
|
|
1793
|
+
const d = ne(), l = je(), { t } = ie(), i = W(!1), r = W(1), x = W(null), u = W(/* @__PURE__ */ new Set()), o = W([]), s = W({}), a = W(!1), p = W(/* @__PURE__ */ new Map()), $ = W(""), C = W([]), I = A(() => {
|
|
1794
|
+
let O = d.recipes;
|
|
1795
|
+
const M = x.value;
|
|
1796
|
+
if (M != null && M.nameSearch) {
|
|
1797
|
+
const L = M.nameSearch.trim().toLowerCase();
|
|
1798
|
+
L && (O = O.filter((q) => q.name.toLowerCase().includes(L)));
|
|
1799
|
+
}
|
|
1800
|
+
if (M != null && M.filters && M.filters.length > 0) {
|
|
1801
|
+
const L = /* @__PURE__ */ new Map();
|
|
1802
|
+
for (const q of O)
|
|
1803
|
+
L.set(
|
|
1767
1804
|
q._id,
|
|
1768
1805
|
ke(q.contains, /* @__PURE__ */ new Set([q._id]), d.recipeById)
|
|
1769
1806
|
);
|
|
1770
|
-
for (const q of
|
|
1807
|
+
for (const q of M.filters)
|
|
1771
1808
|
if (q.type === "ingredient") {
|
|
1772
|
-
const { itemId:
|
|
1773
|
-
|
|
1809
|
+
const { itemId: oe, amount: Z, measurementId: ae } = q;
|
|
1810
|
+
O = O.filter((fe) => (L.get(fe._id) ?? []).some((re) => {
|
|
1774
1811
|
var ce;
|
|
1775
|
-
if (
|
|
1776
|
-
if (
|
|
1777
|
-
if (
|
|
1778
|
-
const Ue =
|
|
1779
|
-
if (!he.equal(Ue,
|
|
1812
|
+
if (re.type !== "SKU" || re.id !== oe) return !1;
|
|
1813
|
+
if (re.recipeIds.length === 1) {
|
|
1814
|
+
if (Z != null) {
|
|
1815
|
+
const Ue = re.measurement ? he.multiplyDecimal(re.amount, re.measurement.conversion) : re.amount;
|
|
1816
|
+
if (!he.equal(Ue, Z)) return !1;
|
|
1780
1817
|
}
|
|
1781
|
-
if (
|
|
1818
|
+
if (ae != null && (((ce = re.measurement) == null ? void 0 : ce.id) ?? null) !== ae)
|
|
1782
1819
|
return !1;
|
|
1783
1820
|
}
|
|
1784
1821
|
return !0;
|
|
1785
1822
|
}));
|
|
1786
1823
|
} else if (q.type === "recipe") {
|
|
1787
|
-
const
|
|
1788
|
-
|
|
1789
|
-
(
|
|
1824
|
+
const oe = q.itemId;
|
|
1825
|
+
O = O.filter(
|
|
1826
|
+
(Z) => ut(Z.contains, oe, /* @__PURE__ */ new Set([Z._id]), d.recipeById)
|
|
1790
1827
|
);
|
|
1791
1828
|
}
|
|
1792
1829
|
}
|
|
1793
|
-
return
|
|
1794
|
-
}), f =
|
|
1795
|
-
() => I.value.filter((
|
|
1796
|
-
),
|
|
1797
|
-
const
|
|
1798
|
-
if (
|
|
1799
|
-
const
|
|
1830
|
+
return O;
|
|
1831
|
+
}), f = A(
|
|
1832
|
+
() => I.value.filter((O) => !u.value.has(O._id))
|
|
1833
|
+
), k = A(() => f.value.length > 0), S = A(() => {
|
|
1834
|
+
const O = o.value.filter(et);
|
|
1835
|
+
if (O.length === 0) {
|
|
1836
|
+
const L = {};
|
|
1800
1837
|
for (const q of f.value)
|
|
1801
|
-
|
|
1838
|
+
L[q._id] = {
|
|
1802
1839
|
recipeId: q._id,
|
|
1803
1840
|
recipeName: q.name,
|
|
1804
1841
|
original: q,
|
|
@@ -1807,27 +1844,27 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
1807
1844
|
changes: [],
|
|
1808
1845
|
counts: { applied: 0, ignored: 0, blocked: 0, satisfied: 0 }
|
|
1809
1846
|
};
|
|
1810
|
-
return
|
|
1811
|
-
}
|
|
1812
|
-
const
|
|
1813
|
-
for (const
|
|
1814
|
-
const q = JSON.parse(JSON.stringify(
|
|
1815
|
-
let fe = 0, xe = 0,
|
|
1816
|
-
for (const ce of
|
|
1817
|
-
ce.outcome === "applied" ? fe++ : ce.outcome === "ignored" ? xe++ : ce.outcome === "blocked" ?
|
|
1818
|
-
L
|
|
1819
|
-
recipeId:
|
|
1820
|
-
recipeName:
|
|
1847
|
+
return L;
|
|
1848
|
+
}
|
|
1849
|
+
const M = {};
|
|
1850
|
+
for (const L of f.value) {
|
|
1851
|
+
const q = JSON.parse(JSON.stringify(L)), { projected: oe, results: Z } = bo(q, O), ae = go(Z);
|
|
1852
|
+
let fe = 0, xe = 0, re = 0, ve = 0;
|
|
1853
|
+
for (const ce of Z)
|
|
1854
|
+
ce.outcome === "applied" ? fe++ : ce.outcome === "ignored" ? xe++ : ce.outcome === "blocked" ? re++ : ce.outcome === "already-satisfied" && ve++;
|
|
1855
|
+
M[L._id] = {
|
|
1856
|
+
recipeId: L._id,
|
|
1857
|
+
recipeName: L.name,
|
|
1821
1858
|
original: q,
|
|
1822
|
-
projected:
|
|
1823
|
-
status:
|
|
1824
|
-
changes:
|
|
1825
|
-
counts: { applied: fe, ignored: xe, blocked:
|
|
1859
|
+
projected: ae === "will-update" || ae === "partially-ignored" ? oe : null,
|
|
1860
|
+
status: ae,
|
|
1861
|
+
changes: Z,
|
|
1862
|
+
counts: { applied: fe, ignored: xe, blocked: re, satisfied: ve }
|
|
1826
1863
|
};
|
|
1827
1864
|
}
|
|
1828
|
-
return
|
|
1829
|
-
}),
|
|
1830
|
-
(
|
|
1865
|
+
return M;
|
|
1866
|
+
}), b = A(() => o.value.some(et) ? Object.values(S.value).some(
|
|
1867
|
+
(O) => O.status === "will-update" || O.status === "partially-ignored"
|
|
1831
1868
|
) : !1);
|
|
1832
1869
|
function e() {
|
|
1833
1870
|
c(), i.value = !0;
|
|
@@ -1836,61 +1873,61 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
1836
1873
|
i.value = !1;
|
|
1837
1874
|
}
|
|
1838
1875
|
function c() {
|
|
1839
|
-
|
|
1876
|
+
r.value = 1, x.value = null, u.value = /* @__PURE__ */ new Set(), o.value = [], s.value = {}, a.value = !1, p.value = /* @__PURE__ */ new Map(), $.value = "", C.value = [];
|
|
1840
1877
|
}
|
|
1841
|
-
function
|
|
1842
|
-
|
|
1878
|
+
function _(O) {
|
|
1879
|
+
x.value = O;
|
|
1843
1880
|
}
|
|
1844
|
-
function
|
|
1845
|
-
const
|
|
1846
|
-
|
|
1881
|
+
function N(O) {
|
|
1882
|
+
const M = new Set(u.value);
|
|
1883
|
+
M.add(O), u.value = M;
|
|
1847
1884
|
}
|
|
1848
|
-
function
|
|
1885
|
+
function z() {
|
|
1849
1886
|
u.value = /* @__PURE__ */ new Set();
|
|
1850
1887
|
}
|
|
1851
|
-
function
|
|
1852
|
-
o.value = [...o.value,
|
|
1888
|
+
function g(O) {
|
|
1889
|
+
o.value = [...o.value, O];
|
|
1853
1890
|
}
|
|
1854
|
-
function
|
|
1855
|
-
const
|
|
1856
|
-
O
|
|
1891
|
+
function B(O, M) {
|
|
1892
|
+
const L = [...o.value];
|
|
1893
|
+
L[O] = M, o.value = L;
|
|
1857
1894
|
}
|
|
1858
|
-
function
|
|
1859
|
-
o.value = o.value.filter((
|
|
1895
|
+
function F(O) {
|
|
1896
|
+
o.value = o.value.filter((M, L) => L !== O);
|
|
1860
1897
|
}
|
|
1861
|
-
function
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1898
|
+
function R(O, M) {
|
|
1899
|
+
const L = [...o.value], [q] = L.splice(O, 1);
|
|
1900
|
+
L.splice(M, 0, q), o.value = L;
|
|
1864
1901
|
}
|
|
1865
1902
|
function P() {
|
|
1866
|
-
s.value = { ...S.value },
|
|
1903
|
+
s.value = { ...S.value }, r.value = 3;
|
|
1867
1904
|
}
|
|
1868
|
-
function
|
|
1869
|
-
s.value = {},
|
|
1905
|
+
function K() {
|
|
1906
|
+
s.value = {}, r.value = 2;
|
|
1870
1907
|
}
|
|
1871
1908
|
function H() {
|
|
1872
1909
|
return Object.values(s.value).filter(
|
|
1873
|
-
(
|
|
1874
|
-
).map((
|
|
1910
|
+
(O) => (O.status === "will-update" || O.status === "partially-ignored") && O.projected != null
|
|
1911
|
+
).map((O) => O.projected);
|
|
1875
1912
|
}
|
|
1876
|
-
async function
|
|
1877
|
-
if (!
|
|
1878
|
-
|
|
1913
|
+
async function ee() {
|
|
1914
|
+
if (!a.value) {
|
|
1915
|
+
a.value = !0, p.value = /* @__PURE__ */ new Map();
|
|
1879
1916
|
try {
|
|
1880
|
-
const
|
|
1917
|
+
const O = H(), M = await d.importRecipes({
|
|
1881
1918
|
create: [],
|
|
1882
|
-
update:
|
|
1883
|
-
}),
|
|
1884
|
-
if (
|
|
1919
|
+
update: O
|
|
1920
|
+
}), L = (M == null ? void 0 : M.errors) ?? [];
|
|
1921
|
+
if (L.length > 0) {
|
|
1885
1922
|
const q = /* @__PURE__ */ new Map();
|
|
1886
|
-
for (const { data:
|
|
1887
|
-
const
|
|
1888
|
-
q.set(
|
|
1923
|
+
for (const { data: oe, error: Z } of L) {
|
|
1924
|
+
const ae = typeof Z == "string" ? Z : (Z == null ? void 0 : Z.message) ?? t("inventory.recipe.bulkEditor.step3.unknownError");
|
|
1925
|
+
q.set(oe._id, ae);
|
|
1889
1926
|
}
|
|
1890
1927
|
p.value = q, l.open({
|
|
1891
1928
|
title: t("inventory.recipe.bulkEditor.step3.partialErrorTitle"),
|
|
1892
1929
|
message: t("inventory.recipe.bulkEditor.step3.partialErrorMessage", {
|
|
1893
|
-
count:
|
|
1930
|
+
count: L.length
|
|
1894
1931
|
}),
|
|
1895
1932
|
type: "warning"
|
|
1896
1933
|
});
|
|
@@ -1898,30 +1935,30 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
1898
1935
|
l.open({
|
|
1899
1936
|
title: t("inventory.recipe.bulkEditor.step3.successTitle"),
|
|
1900
1937
|
message: t("inventory.recipe.bulkEditor.step3.successMessage", {
|
|
1901
|
-
count:
|
|
1938
|
+
count: O.length
|
|
1902
1939
|
}),
|
|
1903
1940
|
type: "success"
|
|
1904
1941
|
}), i.value = !1, c();
|
|
1905
|
-
} catch (
|
|
1942
|
+
} catch (O) {
|
|
1906
1943
|
l.open({
|
|
1907
1944
|
title: t("inventory.recipe.bulkEditor.step3.errorTitle"),
|
|
1908
1945
|
message: t("inventory.recipe.bulkEditor.step3.errorMessage"),
|
|
1909
1946
|
type: "error"
|
|
1910
|
-
}), console.error("confirmAndApply failed",
|
|
1947
|
+
}), console.error("confirmAndApply failed", O);
|
|
1911
1948
|
} finally {
|
|
1912
|
-
|
|
1949
|
+
a.value = !1;
|
|
1913
1950
|
}
|
|
1914
1951
|
}
|
|
1915
1952
|
}
|
|
1916
1953
|
return {
|
|
1917
1954
|
// state
|
|
1918
1955
|
show: i,
|
|
1919
|
-
currentStep:
|
|
1920
|
-
query:
|
|
1956
|
+
currentStep: r,
|
|
1957
|
+
query: x,
|
|
1921
1958
|
excludedRecipeIds: u,
|
|
1922
1959
|
modifications: o,
|
|
1923
1960
|
entries: s,
|
|
1924
|
-
isSaving:
|
|
1961
|
+
isSaving: a,
|
|
1925
1962
|
applyErrors: p,
|
|
1926
1963
|
nameSearch: $,
|
|
1927
1964
|
filterRows: C,
|
|
@@ -1929,257 +1966,257 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
1929
1966
|
matchedRecipes: I,
|
|
1930
1967
|
selectedRecipes: f,
|
|
1931
1968
|
livePreviewEntries: S,
|
|
1932
|
-
canGoToStep2:
|
|
1933
|
-
canGoToStep3:
|
|
1969
|
+
canGoToStep2: k,
|
|
1970
|
+
canGoToStep3: b,
|
|
1934
1971
|
// actions
|
|
1935
1972
|
openDialog: e,
|
|
1936
1973
|
closeDialog: V,
|
|
1937
1974
|
reset: c,
|
|
1938
|
-
updateQuery:
|
|
1939
|
-
removeRecipe:
|
|
1940
|
-
restoreAllRecipes:
|
|
1941
|
-
addModification:
|
|
1942
|
-
updateModification:
|
|
1943
|
-
removeModification:
|
|
1944
|
-
reorderModification:
|
|
1975
|
+
updateQuery: _,
|
|
1976
|
+
removeRecipe: N,
|
|
1977
|
+
restoreAllRecipes: z,
|
|
1978
|
+
addModification: g,
|
|
1979
|
+
updateModification: B,
|
|
1980
|
+
removeModification: F,
|
|
1981
|
+
reorderModification: R,
|
|
1945
1982
|
goToStep3: P,
|
|
1946
|
-
backToStep2:
|
|
1983
|
+
backToStep2: K,
|
|
1947
1984
|
buildPayload: H,
|
|
1948
|
-
confirmAndApply:
|
|
1985
|
+
confirmAndApply: ee
|
|
1949
1986
|
};
|
|
1950
|
-
}),
|
|
1987
|
+
}), ho = { class: "flex flex-col h-full" }, xo = { class: "px-16 pt-16 pb-8 shrink-0 flex items-center justify-between" }, $o = { class: "fm-typo-en-heading-sm-700 text-fm-color-typo-primary" }, Io = { class: "px-16 pt-12 pb-16 border-b border-fm-color-border-default bg-fm-color-surface-default flex flex-col gap-12 shrink-0" }, wo = {
|
|
1951
1988
|
key: 0,
|
|
1952
1989
|
class: "flex flex-wrap items-center gap-8"
|
|
1953
|
-
},
|
|
1990
|
+
}, Eo = {
|
|
1954
1991
|
type: "button",
|
|
1955
1992
|
class: "inline-flex items-center gap-4 h-[30px] pl-8 pr-6 rounded-l-md border border-r-0 border-fm-color-border-default bg-fm-color-surface-secondary hover:bg-fm-color-surface-hover cursor-pointer select-none transition-colors"
|
|
1956
|
-
},
|
|
1993
|
+
}, Vo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-primary" }, So = { class: "flex flex-col gap-8 p-12 min-w-[260px]" }, Co = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary" }, Bo = {
|
|
1957
1994
|
key: 0,
|
|
1958
1995
|
class: "flex flex-col gap-4"
|
|
1959
|
-
},
|
|
1996
|
+
}, Fo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ro = { class: "text-fm-color-typo-placeholder ml-4" }, Ao = ["title", "onClick"], To = { class: "flex-1 overflow-y-auto" }, Uo = {
|
|
1960
1997
|
key: 0,
|
|
1961
1998
|
class: "flex flex-col items-center justify-center h-full gap-8 px-24 text-center"
|
|
1962
|
-
},
|
|
1999
|
+
}, Po = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Mo = {
|
|
1963
2000
|
key: 1,
|
|
1964
2001
|
class: "divide-y divide-fm-color-border-default"
|
|
1965
|
-
},
|
|
2002
|
+
}, Do = { class: "flex-1 min-w-0" }, Go = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary truncate" }, No = {
|
|
1966
2003
|
key: 0,
|
|
1967
2004
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-1 whitespace-normal break-words"
|
|
1968
|
-
},
|
|
2005
|
+
}, zo = { class: "flex items-center gap-4 mt-2" }, Oo = /* @__PURE__ */ le({
|
|
1969
2006
|
__name: "RecipeBulkEditorStep1",
|
|
1970
2007
|
setup(m) {
|
|
1971
|
-
const { t: d } =
|
|
2008
|
+
const { t: d } = ie(), l = ne(), t = ge(), i = A({
|
|
1972
2009
|
get: () => t.nameSearch,
|
|
1973
|
-
set: (
|
|
1974
|
-
t.nameSearch =
|
|
2010
|
+
set: (b) => {
|
|
2011
|
+
t.nameSearch = b;
|
|
1975
2012
|
}
|
|
1976
|
-
}),
|
|
1977
|
-
function u(
|
|
1978
|
-
return
|
|
1979
|
-
}
|
|
1980
|
-
function o(
|
|
1981
|
-
|
|
1982
|
-
}
|
|
1983
|
-
const s =
|
|
1984
|
-
() => l.skus.map((
|
|
1985
|
-
label:
|
|
1986
|
-
sublabel:
|
|
1987
|
-
value:
|
|
2013
|
+
}), r = A(() => t.filterRows), x = W({});
|
|
2014
|
+
function u(b) {
|
|
2015
|
+
return x.value[b] ?? !1;
|
|
2016
|
+
}
|
|
2017
|
+
function o(b, e) {
|
|
2018
|
+
x.value = { ...x.value, [b]: e };
|
|
2019
|
+
}
|
|
2020
|
+
const s = A(
|
|
2021
|
+
() => l.skus.map((b) => ({
|
|
2022
|
+
label: b.name,
|
|
2023
|
+
sublabel: b.code,
|
|
2024
|
+
value: b._id
|
|
1988
2025
|
}))
|
|
1989
|
-
),
|
|
1990
|
-
() => l.recipes.map((
|
|
1991
|
-
label:
|
|
1992
|
-
value:
|
|
2026
|
+
), a = A(
|
|
2027
|
+
() => l.recipes.map((b) => ({
|
|
2028
|
+
label: b.name,
|
|
2029
|
+
value: b._id
|
|
1993
2030
|
}))
|
|
1994
2031
|
);
|
|
1995
|
-
function p(
|
|
1996
|
-
return
|
|
2032
|
+
function p(b) {
|
|
2033
|
+
return b.type !== "ingredient" || !b.itemId ? null : l.skuById[b.itemId] ?? null;
|
|
1997
2034
|
}
|
|
1998
|
-
function $(
|
|
2035
|
+
function $(b) {
|
|
1999
2036
|
var e;
|
|
2000
|
-
if (!
|
|
2001
|
-
if (
|
|
2002
|
-
if (!
|
|
2003
|
-
const V = l.skuById[
|
|
2037
|
+
if (!b.type) return d("inventory.recipe.bulkEditor.step1.filter");
|
|
2038
|
+
if (b.type === "ingredient") {
|
|
2039
|
+
if (!b.itemId) return d("inventory.recipe.bulkEditor.step1.filterTypeIngredient");
|
|
2040
|
+
const V = l.skuById[b.itemId];
|
|
2004
2041
|
if (!V) return d("inventory.recipe.bulkEditor.step1.filterTypeIngredient");
|
|
2005
|
-
const { amount: c, measurement:
|
|
2042
|
+
const { amount: c, measurement: _ } = b.amountModel;
|
|
2006
2043
|
if (!(c != null && c.amount > 0)) return V.name;
|
|
2007
|
-
const
|
|
2008
|
-
return `${V.name} (${
|
|
2044
|
+
const z = (_ == null ? void 0 : _.abbrev) ?? ((e = V.unit) == null ? void 0 : e.abbrev) ?? "", g = Q(c);
|
|
2045
|
+
return `${V.name} (${g}${z})`;
|
|
2009
2046
|
}
|
|
2010
|
-
if (
|
|
2011
|
-
if (!
|
|
2012
|
-
const V = l.recipeById[
|
|
2047
|
+
if (b.type === "recipe") {
|
|
2048
|
+
if (!b.itemId) return d("inventory.recipe.bulkEditor.step1.filterTypeRecipe");
|
|
2049
|
+
const V = l.recipeById[b.itemId];
|
|
2013
2050
|
return V ? V.name : d("inventory.recipe.bulkEditor.step1.filterTypeRecipe");
|
|
2014
2051
|
}
|
|
2015
2052
|
return "";
|
|
2016
2053
|
}
|
|
2017
|
-
function C(
|
|
2018
|
-
const e =
|
|
2054
|
+
function C(b) {
|
|
2055
|
+
const e = ko(b);
|
|
2019
2056
|
t.filterRows.push(e), o(e.id, !0);
|
|
2020
2057
|
}
|
|
2021
|
-
function I(
|
|
2022
|
-
t.filterRows = t.filterRows.filter((V) => V.id !==
|
|
2023
|
-
const e = { ...
|
|
2024
|
-
delete e[
|
|
2058
|
+
function I(b) {
|
|
2059
|
+
t.filterRows = t.filterRows.filter((V) => V.id !== b);
|
|
2060
|
+
const e = { ...x.value };
|
|
2061
|
+
delete e[b], x.value = e;
|
|
2025
2062
|
}
|
|
2026
|
-
function f(
|
|
2027
|
-
|
|
2063
|
+
function f(b) {
|
|
2064
|
+
b.amountModel = ye(), o(b.id, !0);
|
|
2028
2065
|
}
|
|
2029
2066
|
ue(
|
|
2030
|
-
[i,
|
|
2067
|
+
[i, r],
|
|
2031
2068
|
() => {
|
|
2032
|
-
const
|
|
2033
|
-
for (const c of
|
|
2069
|
+
const b = [];
|
|
2070
|
+
for (const c of r.value)
|
|
2034
2071
|
if (!(!c.type || !c.itemId))
|
|
2035
2072
|
if (c.type === "ingredient") {
|
|
2036
|
-
const
|
|
2037
|
-
let
|
|
2038
|
-
|
|
2073
|
+
const _ = p(c), { amount: N, measurement: z } = c.amountModel, g = N != null && N.amount > 0;
|
|
2074
|
+
let B, F;
|
|
2075
|
+
_ && g && (B = z ? he.multiplyDecimal(N, z.conversion) : N, F = (z == null ? void 0 : z.id) ?? null), b.push({
|
|
2039
2076
|
id: c.id,
|
|
2040
2077
|
type: "ingredient",
|
|
2041
2078
|
itemId: c.itemId,
|
|
2042
|
-
amount:
|
|
2043
|
-
measurementId:
|
|
2079
|
+
amount: B ?? null,
|
|
2080
|
+
measurementId: F
|
|
2044
2081
|
});
|
|
2045
|
-
} else c.type === "recipe" &&
|
|
2082
|
+
} else c.type === "recipe" && b.push({
|
|
2046
2083
|
id: c.id,
|
|
2047
2084
|
type: "recipe",
|
|
2048
2085
|
itemId: c.itemId
|
|
2049
2086
|
});
|
|
2050
2087
|
t.updateQuery({
|
|
2051
2088
|
nameSearch: i.value,
|
|
2052
|
-
filters:
|
|
2089
|
+
filters: b
|
|
2053
2090
|
});
|
|
2054
|
-
const e = i.value.trim().length > 0, V =
|
|
2091
|
+
const e = i.value.trim().length > 0, V = b.length > 0;
|
|
2055
2092
|
!e && !V && t.restoreAllRecipes();
|
|
2056
2093
|
},
|
|
2057
2094
|
{ deep: !0, immediate: !0 }
|
|
2058
2095
|
);
|
|
2059
|
-
function
|
|
2060
|
-
var
|
|
2061
|
-
if (
|
|
2062
|
-
const
|
|
2063
|
-
if (!
|
|
2064
|
-
const
|
|
2065
|
-
return
|
|
2096
|
+
function k(b) {
|
|
2097
|
+
var _, N, z, g;
|
|
2098
|
+
if (b.isGroup) {
|
|
2099
|
+
const B = l.skuGroupById[b.id];
|
|
2100
|
+
if (!B) return null;
|
|
2101
|
+
const F = `x${Q(b.amount)}`;
|
|
2102
|
+
return b.recipeIds.slice(1).length ? `(${((_ = l.recipeById[b.recipeIds.at(-1) ?? ""]) == null ? void 0 : _.name) ?? ""}) ${B.name} (${F})` : `${B.name} (${F})`;
|
|
2066
2103
|
}
|
|
2067
|
-
const e = l.skuById[
|
|
2104
|
+
const e = l.skuById[b.id];
|
|
2068
2105
|
if (!e) return null;
|
|
2069
|
-
const V = ((
|
|
2070
|
-
return
|
|
2106
|
+
const V = ((N = b.measurement) == null ? void 0 : N.abbrev) ?? ((z = e.unit) == null ? void 0 : z.abbrev) ?? "", c = `${Q(b.amount)}${V}`;
|
|
2107
|
+
return b.recipeIds.slice(1).length ? `(${((g = l.recipeById[b.recipeIds.at(-1) ?? ""]) == null ? void 0 : g.name) ?? ""}) ${e.name} (${c})` : `${e.name} (${c})`;
|
|
2071
2108
|
}
|
|
2072
|
-
function S(
|
|
2073
|
-
return ke(
|
|
2109
|
+
function S(b) {
|
|
2110
|
+
return ke(b.contains, /* @__PURE__ */ new Set([b._id]), l.recipeById).map(k).filter((e) => e !== null).join(", ");
|
|
2074
2111
|
}
|
|
2075
|
-
return (
|
|
2076
|
-
const V = G("FmButton"), c = G("FmSearch"),
|
|
2077
|
-
return
|
|
2078
|
-
|
|
2079
|
-
|
|
2112
|
+
return (b, e) => {
|
|
2113
|
+
const V = G("FmButton"), c = G("FmSearch"), _ = G("FmSelect"), N = G("FmPopover"), z = G("FmIcon"), g = G("FmMenuItem"), B = G("FmMenu"), F = G("FmChip");
|
|
2114
|
+
return y(), E("div", ho, [
|
|
2115
|
+
v("div", xo, [
|
|
2116
|
+
v("span", $o, U(n(d)("inventory.recipe.bulkEditor.step1.selectedCount", {
|
|
2080
2117
|
count: n(t).selectedRecipes.length
|
|
2081
2118
|
})), 1),
|
|
2082
|
-
n(t).excludedRecipeIds.size > 0 ? (
|
|
2119
|
+
n(t).excludedRecipeIds.size > 0 ? (y(), Y(V, {
|
|
2083
2120
|
key: 0,
|
|
2084
2121
|
label: n(d)("inventory.recipe.bulkEditor.step1.restoreAll"),
|
|
2085
2122
|
variant: "tertiary",
|
|
2086
2123
|
size: "md",
|
|
2087
|
-
onClick: e[0] || (e[0] = (
|
|
2088
|
-
}, null, 8, ["label"])) :
|
|
2124
|
+
onClick: e[0] || (e[0] = (R) => n(t).restoreAllRecipes())
|
|
2125
|
+
}, null, 8, ["label"])) : T("", !0)
|
|
2089
2126
|
]),
|
|
2090
|
-
|
|
2091
|
-
|
|
2127
|
+
v("div", Io, [
|
|
2128
|
+
h(c, {
|
|
2092
2129
|
modelValue: i.value,
|
|
2093
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
2130
|
+
"onUpdate:modelValue": e[1] || (e[1] = (R) => i.value = R),
|
|
2094
2131
|
placeholder: n(d)("inventory.recipe.bulkEditor.query.nameSearchPlaceholder")
|
|
2095
2132
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
2096
|
-
|
|
2097
|
-
(
|
|
2098
|
-
key:
|
|
2133
|
+
r.value.length > 0 ? (y(), E("div", wo, [
|
|
2134
|
+
(y(!0), E(X, null, me(r.value, (R) => (y(), E("div", {
|
|
2135
|
+
key: R.id,
|
|
2099
2136
|
class: "flex items-center"
|
|
2100
2137
|
}, [
|
|
2101
|
-
|
|
2102
|
-
"show-popover": u(
|
|
2138
|
+
h(N, {
|
|
2139
|
+
"show-popover": u(R.id),
|
|
2103
2140
|
"exclude-el-from-click-outside": ["fm-menu"],
|
|
2104
2141
|
placement: "bottom-start",
|
|
2105
|
-
onPopoverChanged: (P) => o(
|
|
2142
|
+
onPopoverChanged: (P) => o(R.id, P)
|
|
2106
2143
|
}, {
|
|
2107
2144
|
"popover-button": J(() => [
|
|
2108
|
-
|
|
2109
|
-
|
|
2145
|
+
v("button", Eo, [
|
|
2146
|
+
v("span", Vo, U($(R)), 1)
|
|
2110
2147
|
])
|
|
2111
2148
|
]),
|
|
2112
2149
|
default: J(() => [
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
modelValue:
|
|
2118
|
-
"onUpdate:modelValue": [(P) =>
|
|
2150
|
+
v("div", So, [
|
|
2151
|
+
v("p", Co, U(R.type === "ingredient" ? n(d)("inventory.recipe.bulkEditor.step1.filterTypeIngredient") : n(d)("inventory.recipe.bulkEditor.step1.filterTypeRecipe")), 1),
|
|
2152
|
+
R.type === "ingredient" ? (y(), E(X, { key: 0 }, [
|
|
2153
|
+
h(_, {
|
|
2154
|
+
modelValue: R.itemId,
|
|
2155
|
+
"onUpdate:modelValue": [(P) => R.itemId = P, (P) => f(R)],
|
|
2119
2156
|
items: s.value,
|
|
2120
2157
|
placeholder: n(d)("inventory.recipe.bulkEditor.step1.selectIngredient"),
|
|
2121
2158
|
clearable: ""
|
|
2122
2159
|
}, {
|
|
2123
2160
|
"menu-wrapper": J((P) => [
|
|
2124
|
-
|
|
2161
|
+
h(Fe, we({ ref_for: !0 }, P, {
|
|
2125
2162
|
items: s.value,
|
|
2126
|
-
"model-value":
|
|
2163
|
+
"model-value": R.itemId
|
|
2127
2164
|
}), null, 16, ["items", "model-value"])
|
|
2128
2165
|
]),
|
|
2129
2166
|
_: 2
|
|
2130
2167
|
}, 1032, ["modelValue", "onUpdate:modelValue", "items", "placeholder"]),
|
|
2131
|
-
p(
|
|
2132
|
-
|
|
2133
|
-
mt(
|
|
2134
|
-
|
|
2168
|
+
p(R) ? (y(), E("div", Bo, [
|
|
2169
|
+
v("span", Fo, [
|
|
2170
|
+
mt(U(n(d)("inventory.recipe.bulkEditor.step1.amountLabel")) + " ", 1),
|
|
2171
|
+
v("span", Ro, U(n(d)("inventory.recipe.bulkEditor.step1.amountOptional")), 1)
|
|
2135
2172
|
]),
|
|
2136
|
-
|
|
2137
|
-
modelValue:
|
|
2138
|
-
"onUpdate:modelValue": (P) =>
|
|
2139
|
-
unit: p(
|
|
2173
|
+
h(Be, {
|
|
2174
|
+
modelValue: R.amountModel,
|
|
2175
|
+
"onUpdate:modelValue": (P) => R.amountModel = P,
|
|
2176
|
+
unit: p(R).unit,
|
|
2140
2177
|
placeholder: n(d)("inventory.recipe.bulkEditor.step1.amountPlaceholder"),
|
|
2141
2178
|
"convert-amount-on-change-unit": ""
|
|
2142
2179
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "unit", "placeholder"])
|
|
2143
|
-
])) :
|
|
2144
|
-
], 64)) :
|
|
2180
|
+
])) : T("", !0)
|
|
2181
|
+
], 64)) : R.type === "recipe" ? (y(), Y(_, {
|
|
2145
2182
|
key: 1,
|
|
2146
|
-
modelValue:
|
|
2147
|
-
"onUpdate:modelValue": [(P) =>
|
|
2148
|
-
items:
|
|
2183
|
+
modelValue: R.itemId,
|
|
2184
|
+
"onUpdate:modelValue": [(P) => R.itemId = P, (P) => f(R)],
|
|
2185
|
+
items: a.value,
|
|
2149
2186
|
placeholder: n(d)("inventory.recipe.bulkEditor.step1.selectRecipe"),
|
|
2150
2187
|
clearable: ""
|
|
2151
2188
|
}, {
|
|
2152
2189
|
"menu-wrapper": J((P) => [
|
|
2153
|
-
|
|
2154
|
-
items:
|
|
2155
|
-
"model-value":
|
|
2190
|
+
h(Fe, we({ ref_for: !0 }, P, {
|
|
2191
|
+
items: a.value,
|
|
2192
|
+
"model-value": R.itemId
|
|
2156
2193
|
}), null, 16, ["items", "model-value"])
|
|
2157
2194
|
]),
|
|
2158
2195
|
_: 2
|
|
2159
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "items", "placeholder"])) :
|
|
2196
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "items", "placeholder"])) : T("", !0)
|
|
2160
2197
|
])
|
|
2161
2198
|
]),
|
|
2162
2199
|
_: 2
|
|
2163
2200
|
}, 1032, ["show-popover", "onPopoverChanged"]),
|
|
2164
|
-
|
|
2201
|
+
v("button", {
|
|
2165
2202
|
type: "button",
|
|
2166
2203
|
class: "inline-flex items-center justify-center h-[30px] w-[26px] rounded-r-md border border-l-0 border-fm-color-border-default bg-fm-color-surface-secondary hover:bg-fm-color-surface-hover text-fm-color-typo-secondary hover:text-fm-color-typo-primary cursor-pointer transition-colors",
|
|
2167
2204
|
title: n(d)("inventory.recipe.bulkEditor.step1.removeFilter"),
|
|
2168
|
-
onClick: (P) => I(
|
|
2205
|
+
onClick: (P) => I(R.id)
|
|
2169
2206
|
}, [
|
|
2170
|
-
|
|
2207
|
+
h(z, {
|
|
2171
2208
|
name: "close",
|
|
2172
2209
|
size: "sm"
|
|
2173
2210
|
})
|
|
2174
|
-
], 8,
|
|
2211
|
+
], 8, Ao)
|
|
2175
2212
|
]))), 128))
|
|
2176
|
-
])) :
|
|
2177
|
-
|
|
2213
|
+
])) : T("", !0),
|
|
2214
|
+
h(B, {
|
|
2178
2215
|
"close-on-click": !0,
|
|
2179
2216
|
placement: "bottom-start"
|
|
2180
2217
|
}, {
|
|
2181
2218
|
"menu-button": J(() => [
|
|
2182
|
-
|
|
2219
|
+
h(V, {
|
|
2183
2220
|
label: n(d)("inventory.recipe.bulkEditor.step1.filter"),
|
|
2184
2221
|
variant: "secondary",
|
|
2185
2222
|
size: "md",
|
|
@@ -2188,50 +2225,50 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2188
2225
|
}, null, 8, ["label"])
|
|
2189
2226
|
]),
|
|
2190
2227
|
default: J(() => [
|
|
2191
|
-
|
|
2228
|
+
h(g, {
|
|
2192
2229
|
label: n(d)("inventory.recipe.bulkEditor.step1.filterTypeIngredient"),
|
|
2193
2230
|
icon: "inventory_2",
|
|
2194
|
-
onClick: e[2] || (e[2] = (
|
|
2231
|
+
onClick: e[2] || (e[2] = (R) => C("ingredient"))
|
|
2195
2232
|
}, null, 8, ["label"]),
|
|
2196
|
-
|
|
2233
|
+
h(g, {
|
|
2197
2234
|
label: n(d)("inventory.recipe.bulkEditor.step1.filterTypeRecipe"),
|
|
2198
2235
|
icon: "restaurant_menu",
|
|
2199
|
-
onClick: e[3] || (e[3] = (
|
|
2236
|
+
onClick: e[3] || (e[3] = (R) => C("recipe"))
|
|
2200
2237
|
}, null, 8, ["label"])
|
|
2201
2238
|
]),
|
|
2202
2239
|
_: 1
|
|
2203
2240
|
})
|
|
2204
2241
|
]),
|
|
2205
|
-
|
|
2206
|
-
n(t).selectedRecipes.length === 0 ? (
|
|
2207
|
-
|
|
2242
|
+
v("div", To, [
|
|
2243
|
+
n(t).selectedRecipes.length === 0 ? (y(), E("div", Uo, [
|
|
2244
|
+
h(z, {
|
|
2208
2245
|
name: "search_off",
|
|
2209
2246
|
size: "lg",
|
|
2210
2247
|
class: "text-fm-color-typo-placeholder"
|
|
2211
2248
|
}),
|
|
2212
|
-
|
|
2213
|
-
])) : (
|
|
2214
|
-
(
|
|
2215
|
-
key:
|
|
2249
|
+
v("p", Po, U(n(d)("inventory.recipe.bulkEditor.query.noResults")), 1)
|
|
2250
|
+
])) : (y(), E("div", Mo, [
|
|
2251
|
+
(y(!0), E(X, null, me(n(t).selectedRecipes, (R) => (y(), E("div", {
|
|
2252
|
+
key: R._id,
|
|
2216
2253
|
class: "flex items-center gap-12 px-16 py-12 hover:bg-fm-color-surface-hover transition-colors"
|
|
2217
2254
|
}, [
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2255
|
+
v("div", Do, [
|
|
2256
|
+
v("div", Go, U(R.name), 1),
|
|
2257
|
+
R.contains.length > 0 ? (y(), E("div", No, U(S(R)), 1)) : T("", !0),
|
|
2258
|
+
v("div", zo, [
|
|
2259
|
+
R.version === "v2" ? (y(), Y(F, {
|
|
2223
2260
|
key: 0,
|
|
2224
2261
|
size: "sm",
|
|
2225
2262
|
label: "V2",
|
|
2226
2263
|
variant: "info"
|
|
2227
|
-
})) :
|
|
2264
|
+
})) : T("", !0)
|
|
2228
2265
|
])
|
|
2229
2266
|
]),
|
|
2230
|
-
|
|
2267
|
+
h(V, {
|
|
2231
2268
|
variant: "tertiary",
|
|
2232
2269
|
icon: "do_not_disturb_on",
|
|
2233
2270
|
title: n(d)("inventory.recipe.bulkEditor.step1.removeRecipeTooltip"),
|
|
2234
|
-
onClick: (P) => n(t).removeRecipe(
|
|
2271
|
+
onClick: (P) => n(t).removeRecipe(R._id)
|
|
2235
2272
|
}, null, 8, ["title", "onClick"])
|
|
2236
2273
|
]))), 128))
|
|
2237
2274
|
]))
|
|
@@ -2239,16 +2276,16 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2239
2276
|
]);
|
|
2240
2277
|
};
|
|
2241
2278
|
}
|
|
2242
|
-
}),
|
|
2279
|
+
}), Lo = { class: "flex flex-col gap-0 rounded-lg border border-fm-color-border-default bg-fm-color-surface-default overflow-hidden" }, jo = { class: "flex items-start gap-12 px-16 py-12" }, Ko = { class: "flex-1" }, qo = { class: "flex-1" }, Wo = {
|
|
2243
2280
|
key: 0,
|
|
2244
2281
|
class: "border-t border-fm-color-border-default px-16 py-10 flex items-center gap-10"
|
|
2245
|
-
},
|
|
2282
|
+
}, Yo = {
|
|
2246
2283
|
key: 1,
|
|
2247
2284
|
class: "border-t border-fm-color-border-default px-16 py-10 flex items-start gap-8 bg-fm-color-surface-warning"
|
|
2248
|
-
},
|
|
2285
|
+
}, Jo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-warning" }, Ho = {
|
|
2249
2286
|
key: 2,
|
|
2250
2287
|
class: "border-t border-fm-color-border-default px-16 py-12 flex flex-col gap-12"
|
|
2251
|
-
},
|
|
2288
|
+
}, Qo = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary -mb-4" }, Xo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Zo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ei = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-warning" }, ti = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary -mt-8" }, ni = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary -mb-4" }, oi = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ii = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, li = /* @__PURE__ */ le({
|
|
2252
2289
|
__name: "ModificationCard",
|
|
2253
2290
|
props: {
|
|
2254
2291
|
modelValue: {},
|
|
@@ -2256,20 +2293,20 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2256
2293
|
},
|
|
2257
2294
|
emits: ["update:modelValue"],
|
|
2258
2295
|
setup(m, { emit: d }) {
|
|
2259
|
-
const l = m, t = d, { t: i } =
|
|
2260
|
-
function u(
|
|
2261
|
-
const
|
|
2262
|
-
return
|
|
2296
|
+
const l = m, t = d, { t: i } = ie(), r = ne(), x = We();
|
|
2297
|
+
function u(w) {
|
|
2298
|
+
const D = w.type === "replace-binding" ? w.from.type : w.type === "remove-binding" || w.type === "update-binding-rule" || w.type === "update-alternatives" ? w.target.type : w.type === "add-binding" ? w.binding.type : null;
|
|
2299
|
+
return D ? D === "RECIPE" ? "recipe" : "ingredient" : null;
|
|
2263
2300
|
}
|
|
2264
|
-
function o(
|
|
2265
|
-
return
|
|
2301
|
+
function o(w) {
|
|
2302
|
+
return w.type === "update-alternatives" ? !0 : w.type === "add-binding" ? (w.binding.alternatives ?? []).length > 0 : w.type === "replace-binding" ? (w.to.alternatives ?? []).length > 0 : !1;
|
|
2266
2303
|
}
|
|
2267
|
-
function s(
|
|
2268
|
-
switch (
|
|
2304
|
+
function s(w) {
|
|
2305
|
+
switch (w.type) {
|
|
2269
2306
|
case "add-binding":
|
|
2270
2307
|
return "link";
|
|
2271
2308
|
case "replace-binding":
|
|
2272
|
-
return
|
|
2309
|
+
return w.from.id === w.to.id ? "update" : null;
|
|
2273
2310
|
case "remove-binding":
|
|
2274
2311
|
return "remove";
|
|
2275
2312
|
case "update-binding-rule":
|
|
@@ -2278,358 +2315,358 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2278
2315
|
return "alts";
|
|
2279
2316
|
}
|
|
2280
2317
|
}
|
|
2281
|
-
function
|
|
2282
|
-
return
|
|
2318
|
+
function a(w) {
|
|
2319
|
+
return w.type === "replace-binding" ? w.from.id || null : (w.type === "remove-binding" || w.type === "update-binding-rule" || w.type === "update-alternatives") && w.target.id || null;
|
|
2283
2320
|
}
|
|
2284
|
-
function p(
|
|
2285
|
-
return
|
|
2321
|
+
function p(w) {
|
|
2322
|
+
return w.type === "add-binding" && w.binding.id || null;
|
|
2286
2323
|
}
|
|
2287
|
-
function $(
|
|
2288
|
-
const
|
|
2289
|
-
return
|
|
2324
|
+
function $(w) {
|
|
2325
|
+
const D = w.type === "replace-binding" ? w.to : w.type === "add-binding" ? w.binding : null;
|
|
2326
|
+
return D ? { amount: D.amount, measurement: D.measurement ?? null } : ye();
|
|
2290
2327
|
}
|
|
2291
|
-
function C(
|
|
2292
|
-
return
|
|
2328
|
+
function C(w) {
|
|
2329
|
+
return w.type === "replace-binding" ? w.to.rules ?? null : w.type === "add-binding" ? w.binding.rules ?? null : null;
|
|
2293
2330
|
}
|
|
2294
|
-
function I(
|
|
2295
|
-
return
|
|
2331
|
+
function I(w) {
|
|
2332
|
+
return w.type === "update-alternatives" ? w.alternatives ?? [] : w.type === "add-binding" ? w.binding.alternatives ?? [] : [];
|
|
2296
2333
|
}
|
|
2297
|
-
const f =
|
|
2334
|
+
const f = W(u(l.modelValue)), k = W(s(l.modelValue)), S = W(o(l.modelValue)), b = W(a(l.modelValue)), e = W(p(l.modelValue)), V = W($(l.modelValue)), c = W(C(l.modelValue)), _ = W(I(l.modelValue)), N = W(
|
|
2298
2335
|
(() => {
|
|
2299
|
-
const
|
|
2300
|
-
return
|
|
2336
|
+
const w = $(l.modelValue);
|
|
2337
|
+
return w.amount ? Q(w.amount) : "";
|
|
2301
2338
|
})()
|
|
2302
2339
|
);
|
|
2303
|
-
let
|
|
2304
|
-
function w
|
|
2305
|
-
|
|
2306
|
-
const
|
|
2340
|
+
let z = null;
|
|
2341
|
+
function g(w) {
|
|
2342
|
+
N.value = w, z && clearTimeout(z), z = setTimeout(() => {
|
|
2343
|
+
const D = +w;
|
|
2307
2344
|
V.value = {
|
|
2308
|
-
amount:
|
|
2345
|
+
amount: w.length > 0 && isFinite(D) ? Ke(D) : { amount: 0, precision: 0 },
|
|
2309
2346
|
measurement: null
|
|
2310
2347
|
};
|
|
2311
2348
|
}, 300);
|
|
2312
2349
|
}
|
|
2313
2350
|
ue(f, () => {
|
|
2314
|
-
|
|
2315
|
-
}), ue(
|
|
2316
|
-
|
|
2317
|
-
}), ue(S, (
|
|
2318
|
-
|
|
2351
|
+
k.value = null, S.value = !1, b.value = null, e.value = null, V.value = ye(), c.value = null, _.value = [], N.value = "";
|
|
2352
|
+
}), ue(k, () => {
|
|
2353
|
+
b.value = null, e.value = null, V.value = ye(), c.value = null, _.value = [], N.value = "";
|
|
2354
|
+
}), ue(S, (w) => {
|
|
2355
|
+
w || (_.value = [], k.value === "alts" && (k.value = null));
|
|
2319
2356
|
});
|
|
2320
|
-
const
|
|
2357
|
+
const B = A(() => [
|
|
2321
2358
|
{ label: i("inventory.recipe.bulkEditor.step2.fieldIngredient"), value: "ingredient" },
|
|
2322
2359
|
{ label: i("inventory.recipe.bulkEditor.step2.fieldRecipe"), value: "recipe" }
|
|
2323
|
-
]),
|
|
2324
|
-
const
|
|
2360
|
+
]), F = A(() => {
|
|
2361
|
+
const w = [
|
|
2325
2362
|
{ label: i("inventory.recipe.bulkEditor.step2.actionLink"), value: "link" },
|
|
2326
2363
|
{ label: i("inventory.recipe.bulkEditor.step2.actionUpdate"), value: "update" },
|
|
2327
2364
|
{ label: i("inventory.recipe.bulkEditor.step2.actionRemove"), value: "remove" }
|
|
2328
2365
|
];
|
|
2329
|
-
return f.value === "ingredient" && S.value &&
|
|
2330
|
-
}),
|
|
2331
|
-
() =>
|
|
2332
|
-
),
|
|
2333
|
-
() =>
|
|
2334
|
-
), H =
|
|
2335
|
-
() =>
|
|
2336
|
-
),
|
|
2337
|
-
() => f.value === "ingredient" && S.value &&
|
|
2338
|
-
),
|
|
2339
|
-
() =>
|
|
2340
|
-
),
|
|
2341
|
-
() =>
|
|
2342
|
-
),
|
|
2343
|
-
const
|
|
2344
|
-
return
|
|
2345
|
-
}), fe =
|
|
2346
|
-
(
|
|
2347
|
-
).length : 0), xe =
|
|
2366
|
+
return f.value === "ingredient" && S.value && x.enableRecipeV2 && w.push({ label: i("inventory.recipe.bulkEditor.step2.actionAlts"), value: "alts" }), w;
|
|
2367
|
+
}), R = A(() => f.value !== null && k.value !== null), P = A(
|
|
2368
|
+
() => k.value === "update" || k.value === "remove" || k.value === "alts"
|
|
2369
|
+
), K = A(
|
|
2370
|
+
() => k.value === "link"
|
|
2371
|
+
), H = A(
|
|
2372
|
+
() => k.value === "update" && b.value !== null
|
|
2373
|
+
), ee = A(
|
|
2374
|
+
() => f.value === "ingredient" && S.value && x.enableRecipeV2
|
|
2375
|
+
), O = A(
|
|
2376
|
+
() => r.skus.map((w) => ({ label: w.name, sublabel: w.code, value: w._id }))
|
|
2377
|
+
), M = A(
|
|
2378
|
+
() => r.recipes.map((w) => ({ label: w.name, value: w._id }))
|
|
2379
|
+
), L = A(() => f.value === "recipe" ? M.value : O.value), q = A(() => f.value === "recipe" ? M.value : O.value), oe = A(() => f.value !== "ingredient" || !e.value ? null : r.skuById[e.value] ?? null), Z = A(() => f.value !== "ingredient" || !b.value ? null : r.skuById[b.value] ?? null), ae = A(() => {
|
|
2380
|
+
const w = b.value ?? e.value;
|
|
2381
|
+
return w ? [w] : [];
|
|
2382
|
+
}), fe = A(() => ee.value ? Object.values(l.livePreviewEntries).filter(
|
|
2383
|
+
(w) => w.original.version !== "v2"
|
|
2384
|
+
).length : 0), xe = A(() => Object.values(l.livePreviewEntries).length);
|
|
2348
2385
|
ue(
|
|
2349
|
-
() => [
|
|
2350
|
-
([
|
|
2351
|
-
if (
|
|
2352
|
-
if (!
|
|
2353
|
-
|
|
2386
|
+
() => [k.value, b.value],
|
|
2387
|
+
([w, D], [te, pe]) => {
|
|
2388
|
+
if (w !== "alts" || D === pe) return;
|
|
2389
|
+
if (!D) {
|
|
2390
|
+
_.value = [];
|
|
2354
2391
|
return;
|
|
2355
2392
|
}
|
|
2356
2393
|
const $e = Object.values(l.livePreviewEntries).find(
|
|
2357
|
-
(j) => j.original.version === "v2" && j.original.contains.some((Ie) => Ie.type === "SKU" && Ie.id ===
|
|
2394
|
+
(j) => j.original.version === "v2" && j.original.contains.some((Ie) => Ie.type === "SKU" && Ie.id === D)
|
|
2358
2395
|
);
|
|
2359
2396
|
if ($e) {
|
|
2360
|
-
const j = $e.original.contains.find((Ie) => Ie.type === "SKU" && Ie.id ===
|
|
2361
|
-
|
|
2397
|
+
const j = $e.original.contains.find((Ie) => Ie.type === "SKU" && Ie.id === D);
|
|
2398
|
+
_.value = j != null && j.alternatives ? [...j.alternatives] : [];
|
|
2362
2399
|
} else
|
|
2363
|
-
|
|
2400
|
+
_.value = [];
|
|
2364
2401
|
}
|
|
2365
2402
|
);
|
|
2366
|
-
const
|
|
2367
|
-
(
|
|
2403
|
+
const re = A(() => k.value !== "alts" || !b.value ? 0 : Object.values(l.livePreviewEntries).filter(
|
|
2404
|
+
(w) => w.original.version === "v2" && w.original.contains.some((D) => D.type === "SKU" && D.id === b.value)
|
|
2368
2405
|
).length);
|
|
2369
2406
|
function ve() {
|
|
2370
2407
|
return f.value === "recipe" ? "RECIPE" : "SKU";
|
|
2371
2408
|
}
|
|
2372
2409
|
function ce() {
|
|
2373
|
-
const
|
|
2374
|
-
type:
|
|
2410
|
+
const w = ve(), D = ye().amount, te = {
|
|
2411
|
+
type: w,
|
|
2375
2412
|
id: "",
|
|
2376
|
-
amount:
|
|
2413
|
+
amount: D,
|
|
2377
2414
|
measurement: null,
|
|
2378
2415
|
rules: null,
|
|
2379
2416
|
alternatives: []
|
|
2380
2417
|
};
|
|
2381
|
-
switch (
|
|
2418
|
+
switch (k.value) {
|
|
2382
2419
|
case "update":
|
|
2383
|
-
return { type: "replace-binding", from: { type:
|
|
2420
|
+
return { type: "replace-binding", from: { type: w, id: "" }, to: te };
|
|
2384
2421
|
case "remove":
|
|
2385
|
-
return { type: "remove-binding", target: { type:
|
|
2422
|
+
return { type: "remove-binding", target: { type: w, id: "" } };
|
|
2386
2423
|
case "alts":
|
|
2387
|
-
return { type: "update-alternatives", target: { type:
|
|
2424
|
+
return { type: "update-alternatives", target: { type: w, id: "" }, alternatives: [] };
|
|
2388
2425
|
case "link":
|
|
2389
2426
|
default:
|
|
2390
2427
|
return { type: "add-binding", binding: te };
|
|
2391
2428
|
}
|
|
2392
2429
|
}
|
|
2393
2430
|
function Ue() {
|
|
2394
|
-
return
|
|
2431
|
+
return b.value ? { type: ve(), id: b.value } : null;
|
|
2395
2432
|
}
|
|
2396
|
-
function Ye(
|
|
2397
|
-
const
|
|
2398
|
-
if (!
|
|
2433
|
+
function Ye(w = !1) {
|
|
2434
|
+
const D = w ? b.value : e.value;
|
|
2435
|
+
if (!D) return null;
|
|
2399
2436
|
const { amount: te, measurement: pe } = V.value, Ee = pe ? he.multiplyDecimal(te, pe.conversion) : te;
|
|
2400
2437
|
return {
|
|
2401
2438
|
type: ve(),
|
|
2402
|
-
id:
|
|
2439
|
+
id: D,
|
|
2403
2440
|
amount: Ee,
|
|
2404
2441
|
measurement: pe ?? null,
|
|
2405
2442
|
rules: f.value === "recipe" ? c.value ?? null : null,
|
|
2406
|
-
alternatives:
|
|
2443
|
+
alternatives: ee.value ? _.value : []
|
|
2407
2444
|
};
|
|
2408
2445
|
}
|
|
2409
2446
|
function ct() {
|
|
2410
2447
|
if (!f.value) return;
|
|
2411
|
-
if (!
|
|
2448
|
+
if (!k.value) {
|
|
2412
2449
|
t("update:modelValue", ce());
|
|
2413
2450
|
return;
|
|
2414
2451
|
}
|
|
2415
|
-
const
|
|
2452
|
+
const w = Ue(), D = Ye(!1);
|
|
2416
2453
|
let te = null;
|
|
2417
|
-
switch (
|
|
2454
|
+
switch (k.value) {
|
|
2418
2455
|
case "link":
|
|
2419
|
-
|
|
2456
|
+
D && (te = { type: "add-binding", binding: D });
|
|
2420
2457
|
break;
|
|
2421
2458
|
case "update": {
|
|
2422
2459
|
const pe = Ye(!0);
|
|
2423
|
-
|
|
2460
|
+
w && pe && (te = { type: "replace-binding", from: w, to: pe });
|
|
2424
2461
|
break;
|
|
2425
2462
|
}
|
|
2426
2463
|
case "remove":
|
|
2427
|
-
|
|
2464
|
+
w && (te = { type: "remove-binding", target: w });
|
|
2428
2465
|
break;
|
|
2429
2466
|
case "alts":
|
|
2430
|
-
|
|
2467
|
+
w && (te = { type: "update-alternatives", target: w, alternatives: _.value });
|
|
2431
2468
|
break;
|
|
2432
2469
|
}
|
|
2433
2470
|
t("update:modelValue", te ?? ce());
|
|
2434
2471
|
}
|
|
2435
2472
|
return ue(
|
|
2436
|
-
[f,
|
|
2473
|
+
[f, k, S, b, e, V, c, _],
|
|
2437
2474
|
() => ct(),
|
|
2438
2475
|
{ deep: !0 }
|
|
2439
|
-
), (
|
|
2476
|
+
), (w, D) => {
|
|
2440
2477
|
const te = G("FmSelect"), pe = G("FmSwitch"), Ee = G("FmIcon"), $e = G("FmTextField");
|
|
2441
|
-
return
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2478
|
+
return y(), E("div", Lo, [
|
|
2479
|
+
v("div", jo, [
|
|
2480
|
+
v("div", Ko, [
|
|
2481
|
+
h(te, {
|
|
2445
2482
|
modelValue: f.value,
|
|
2446
|
-
"onUpdate:modelValue":
|
|
2447
|
-
items:
|
|
2483
|
+
"onUpdate:modelValue": D[0] || (D[0] = (j) => f.value = j),
|
|
2484
|
+
items: B.value,
|
|
2448
2485
|
label: n(i)("inventory.recipe.bulkEditor.step2.sectionField"),
|
|
2449
2486
|
placeholder: n(i)("inventory.recipe.bulkEditor.step2.sectionField")
|
|
2450
2487
|
}, null, 8, ["modelValue", "items", "label", "placeholder"])
|
|
2451
2488
|
]),
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
modelValue:
|
|
2455
|
-
"onUpdate:modelValue":
|
|
2456
|
-
items:
|
|
2489
|
+
v("div", qo, [
|
|
2490
|
+
h(te, {
|
|
2491
|
+
modelValue: k.value,
|
|
2492
|
+
"onUpdate:modelValue": D[1] || (D[1] = (j) => k.value = j),
|
|
2493
|
+
items: F.value,
|
|
2457
2494
|
label: n(i)("inventory.recipe.bulkEditor.step2.sectionAction"),
|
|
2458
2495
|
placeholder: n(i)("inventory.recipe.bulkEditor.step2.sectionAction")
|
|
2459
2496
|
}, null, 8, ["modelValue", "items", "label", "placeholder"])
|
|
2460
2497
|
])
|
|
2461
2498
|
]),
|
|
2462
|
-
f.value === "ingredient" && n(
|
|
2463
|
-
|
|
2499
|
+
f.value === "ingredient" && n(x).enableRecipeV2 ? (y(), E("div", Wo, [
|
|
2500
|
+
h(pe, {
|
|
2464
2501
|
modelValue: S.value,
|
|
2465
|
-
"onUpdate:modelValue":
|
|
2502
|
+
"onUpdate:modelValue": D[2] || (D[2] = (j) => S.value = j),
|
|
2466
2503
|
label: n(i)("inventory.recipe.bulkEditor.step2.includeAlternativesToggle")
|
|
2467
2504
|
}, null, 8, ["modelValue", "label"])
|
|
2468
|
-
])) :
|
|
2469
|
-
|
|
2470
|
-
|
|
2505
|
+
])) : T("", !0),
|
|
2506
|
+
ee.value && fe.value > 0 ? (y(), E("div", Yo, [
|
|
2507
|
+
h(Ee, {
|
|
2471
2508
|
name: "warning",
|
|
2472
2509
|
size: "sm",
|
|
2473
2510
|
class: "text-fm-color-typo-warning mt-1 shrink-0"
|
|
2474
2511
|
}),
|
|
2475
|
-
|
|
2512
|
+
v("p", Jo, U(n(i)("inventory.recipe.bulkEditor.step2.v1AlternativesWarning", {
|
|
2476
2513
|
v1Count: fe.value,
|
|
2477
2514
|
total: xe.value
|
|
2478
2515
|
})), 1)
|
|
2479
|
-
])) :
|
|
2480
|
-
|
|
2481
|
-
P.value ? (
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
modelValue:
|
|
2485
|
-
"onUpdate:modelValue":
|
|
2486
|
-
items:
|
|
2516
|
+
])) : T("", !0),
|
|
2517
|
+
R.value ? (y(), E("div", Ho, [
|
|
2518
|
+
P.value ? (y(), E(X, { key: 0 }, [
|
|
2519
|
+
v("p", Qo, U(n(i)("inventory.recipe.bulkEditor.addModification.targetLabel")), 1),
|
|
2520
|
+
h(te, {
|
|
2521
|
+
modelValue: b.value,
|
|
2522
|
+
"onUpdate:modelValue": D[3] || (D[3] = (j) => b.value = j),
|
|
2523
|
+
items: L.value,
|
|
2487
2524
|
placeholder: f.value === "recipe" ? n(i)("inventory.recipe.bulkEditor.addModification.recipePlaceholder") : n(i)("inventory.recipe.bulkEditor.addModification.skuPlaceholder"),
|
|
2488
2525
|
clearable: ""
|
|
2489
2526
|
}, {
|
|
2490
2527
|
"menu-wrapper": J((j) => [
|
|
2491
|
-
|
|
2492
|
-
items:
|
|
2493
|
-
"model-value":
|
|
2528
|
+
h(Fe, we(j, {
|
|
2529
|
+
items: L.value,
|
|
2530
|
+
"model-value": b.value
|
|
2494
2531
|
}), null, 16, ["items", "model-value"])
|
|
2495
2532
|
]),
|
|
2496
2533
|
_: 1
|
|
2497
2534
|
}, 8, ["modelValue", "items", "placeholder"]),
|
|
2498
|
-
H.value ? (
|
|
2499
|
-
f.value === "ingredient" &&
|
|
2535
|
+
H.value ? (y(), E(X, { key: 0 }, [
|
|
2536
|
+
f.value === "ingredient" && Z.value ? (y(), Y(Be, {
|
|
2500
2537
|
key: 0,
|
|
2501
2538
|
modelValue: V.value,
|
|
2502
|
-
"onUpdate:modelValue":
|
|
2503
|
-
unit:
|
|
2539
|
+
"onUpdate:modelValue": D[4] || (D[4] = (j) => V.value = j),
|
|
2540
|
+
unit: Z.value.unit,
|
|
2504
2541
|
placeholder: n(i)("inventory.recipe.bulkEditor.query.amountPlaceholder"),
|
|
2505
2542
|
"convert-amount-on-change-unit": ""
|
|
2506
|
-
}, null, 8, ["modelValue", "unit", "placeholder"])) : f.value === "recipe" ? (
|
|
2543
|
+
}, null, 8, ["modelValue", "unit", "placeholder"])) : f.value === "recipe" ? (y(), Y($e, {
|
|
2507
2544
|
key: 1,
|
|
2508
|
-
"model-value":
|
|
2545
|
+
"model-value": N.value,
|
|
2509
2546
|
label: n(i)("inventory.recipe.bulkEditor.addModification.amountLabel"),
|
|
2510
2547
|
type: "number",
|
|
2511
|
-
"onUpdate:modelValue":
|
|
2512
|
-
}, null, 8, ["model-value", "label"])) :
|
|
2513
|
-
f.value === "recipe" ? (
|
|
2514
|
-
|
|
2515
|
-
|
|
2548
|
+
"onUpdate:modelValue": D[5] || (D[5] = (j) => g(j))
|
|
2549
|
+
}, null, 8, ["model-value", "label"])) : T("", !0),
|
|
2550
|
+
f.value === "recipe" ? (y(), E(X, { key: 2 }, [
|
|
2551
|
+
v("p", Xo, U(n(i)("inventory.recipe.bulkEditor.addModification.optionalRuleLabel")), 1),
|
|
2552
|
+
h(Re, {
|
|
2516
2553
|
modelValue: c.value,
|
|
2517
|
-
"onUpdate:modelValue":
|
|
2554
|
+
"onUpdate:modelValue": D[6] || (D[6] = (j) => c.value = j)
|
|
2518
2555
|
}, null, 8, ["modelValue"])
|
|
2519
|
-
], 64)) :
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
modelValue:
|
|
2524
|
-
"onUpdate:modelValue":
|
|
2525
|
-
"filter-ingredient-ids":
|
|
2556
|
+
], 64)) : T("", !0),
|
|
2557
|
+
ee.value ? (y(), E(X, { key: 3 }, [
|
|
2558
|
+
v("p", Zo, U(n(i)("inventory.recipe.bulkEditor.addModification.optionalAlternativesLabel")), 1),
|
|
2559
|
+
h(Se, {
|
|
2560
|
+
modelValue: _.value,
|
|
2561
|
+
"onUpdate:modelValue": D[7] || (D[7] = (j) => _.value = j),
|
|
2562
|
+
"filter-ingredient-ids": ae.value
|
|
2526
2563
|
}, null, 8, ["modelValue", "filter-ingredient-ids"])
|
|
2527
|
-
], 64)) :
|
|
2528
|
-
], 64)) :
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
modelValue:
|
|
2534
|
-
"onUpdate:modelValue":
|
|
2535
|
-
"filter-ingredient-ids":
|
|
2564
|
+
], 64)) : T("", !0)
|
|
2565
|
+
], 64)) : T("", !0),
|
|
2566
|
+
k.value === "alts" && b.value ? (y(), E(X, { key: 1 }, [
|
|
2567
|
+
v("p", ei, U(re.value > 0 ? n(i)("inventory.recipe.bulkEditor.addModification.altsOverwriteWarning", { count: re.value }) : n(i)("inventory.recipe.bulkEditor.addModification.altsNotFoundWarning")), 1),
|
|
2568
|
+
v("p", ti, U(n(i)("inventory.recipe.bulkEditor.addModification.altsClearNote")), 1),
|
|
2569
|
+
h(Se, {
|
|
2570
|
+
modelValue: _.value,
|
|
2571
|
+
"onUpdate:modelValue": D[8] || (D[8] = (j) => _.value = j),
|
|
2572
|
+
"filter-ingredient-ids": ae.value
|
|
2536
2573
|
}, null, 8, ["modelValue", "filter-ingredient-ids"])
|
|
2537
|
-
], 64)) :
|
|
2538
|
-
], 64)) :
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2574
|
+
], 64)) : T("", !0)
|
|
2575
|
+
], 64)) : T("", !0),
|
|
2576
|
+
K.value ? (y(), E(X, { key: 1 }, [
|
|
2577
|
+
v("p", ni, U(n(i)("inventory.recipe.bulkEditor.addModification.bindingLabel")), 1),
|
|
2578
|
+
h(te, {
|
|
2542
2579
|
modelValue: e.value,
|
|
2543
|
-
"onUpdate:modelValue":
|
|
2580
|
+
"onUpdate:modelValue": D[9] || (D[9] = (j) => e.value = j),
|
|
2544
2581
|
items: q.value,
|
|
2545
2582
|
placeholder: f.value === "recipe" ? n(i)("inventory.recipe.bulkEditor.addModification.recipePlaceholder") : n(i)("inventory.recipe.bulkEditor.addModification.skuPlaceholder"),
|
|
2546
2583
|
clearable: ""
|
|
2547
2584
|
}, {
|
|
2548
2585
|
"menu-wrapper": J((j) => [
|
|
2549
|
-
|
|
2586
|
+
h(Fe, we(j, {
|
|
2550
2587
|
items: q.value,
|
|
2551
2588
|
"model-value": e.value
|
|
2552
2589
|
}), null, 16, ["items", "model-value"])
|
|
2553
2590
|
]),
|
|
2554
2591
|
_: 1
|
|
2555
2592
|
}, 8, ["modelValue", "items", "placeholder"]),
|
|
2556
|
-
e.value ? (
|
|
2557
|
-
f.value === "ingredient" &&
|
|
2593
|
+
e.value ? (y(), E(X, { key: 0 }, [
|
|
2594
|
+
f.value === "ingredient" && oe.value ? (y(), Y(Be, {
|
|
2558
2595
|
key: 0,
|
|
2559
2596
|
modelValue: V.value,
|
|
2560
|
-
"onUpdate:modelValue":
|
|
2561
|
-
unit:
|
|
2597
|
+
"onUpdate:modelValue": D[10] || (D[10] = (j) => V.value = j),
|
|
2598
|
+
unit: oe.value.unit,
|
|
2562
2599
|
placeholder: n(i)("inventory.recipe.bulkEditor.query.amountPlaceholder"),
|
|
2563
2600
|
"convert-amount-on-change-unit": ""
|
|
2564
|
-
}, null, 8, ["modelValue", "unit", "placeholder"])) : f.value === "recipe" ? (
|
|
2601
|
+
}, null, 8, ["modelValue", "unit", "placeholder"])) : f.value === "recipe" ? (y(), Y($e, {
|
|
2565
2602
|
key: 1,
|
|
2566
|
-
"model-value":
|
|
2603
|
+
"model-value": N.value,
|
|
2567
2604
|
label: n(i)("inventory.recipe.bulkEditor.addModification.amountLabel"),
|
|
2568
2605
|
type: "number",
|
|
2569
|
-
"onUpdate:modelValue":
|
|
2570
|
-
}, null, 8, ["model-value", "label"])) :
|
|
2571
|
-
f.value === "recipe" ? (
|
|
2572
|
-
|
|
2573
|
-
|
|
2606
|
+
"onUpdate:modelValue": D[11] || (D[11] = (j) => g(j))
|
|
2607
|
+
}, null, 8, ["model-value", "label"])) : T("", !0),
|
|
2608
|
+
f.value === "recipe" ? (y(), E(X, { key: 2 }, [
|
|
2609
|
+
v("p", oi, U(n(i)("inventory.recipe.bulkEditor.addModification.optionalRuleLabel")), 1),
|
|
2610
|
+
h(Re, {
|
|
2574
2611
|
modelValue: c.value,
|
|
2575
|
-
"onUpdate:modelValue":
|
|
2612
|
+
"onUpdate:modelValue": D[12] || (D[12] = (j) => c.value = j)
|
|
2576
2613
|
}, null, 8, ["modelValue"])
|
|
2577
|
-
], 64)) :
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
modelValue:
|
|
2582
|
-
"onUpdate:modelValue":
|
|
2583
|
-
"filter-ingredient-ids":
|
|
2614
|
+
], 64)) : T("", !0),
|
|
2615
|
+
ee.value ? (y(), E(X, { key: 3 }, [
|
|
2616
|
+
v("p", ii, U(n(i)("inventory.recipe.bulkEditor.addModification.optionalAlternativesLabel")), 1),
|
|
2617
|
+
h(Se, {
|
|
2618
|
+
modelValue: _.value,
|
|
2619
|
+
"onUpdate:modelValue": D[13] || (D[13] = (j) => _.value = j),
|
|
2620
|
+
"filter-ingredient-ids": ae.value
|
|
2584
2621
|
}, null, 8, ["modelValue", "filter-ingredient-ids"])
|
|
2585
|
-
], 64)) :
|
|
2586
|
-
], 64)) :
|
|
2587
|
-
], 64)) :
|
|
2588
|
-
])) :
|
|
2622
|
+
], 64)) : T("", !0)
|
|
2623
|
+
], 64)) : T("", !0)
|
|
2624
|
+
], 64)) : T("", !0)
|
|
2625
|
+
])) : T("", !0)
|
|
2589
2626
|
]);
|
|
2590
2627
|
};
|
|
2591
2628
|
}
|
|
2592
|
-
}),
|
|
2629
|
+
}), ri = { class: "flex flex-col gap-8" }, ai = { class: "flex flex-wrap items-center gap-12 px-4" }, si = {
|
|
2593
2630
|
key: 0,
|
|
2594
2631
|
class: "flex items-center gap-6"
|
|
2595
|
-
},
|
|
2632
|
+
}, di = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ui = {
|
|
2596
2633
|
key: 1,
|
|
2597
2634
|
class: "flex items-center gap-6"
|
|
2598
|
-
},
|
|
2635
|
+
}, ci = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, pi = {
|
|
2599
2636
|
key: 2,
|
|
2600
2637
|
class: "flex items-center gap-6"
|
|
2601
|
-
},
|
|
2638
|
+
}, mi = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, fi = { class: "rounded-lg border border-fm-color-border-default overflow-hidden" }, vi = {
|
|
2602
2639
|
key: 0,
|
|
2603
2640
|
class: "px-16 py-12 text-center fm-typo-en-body-sm-400 text-fm-color-typo-placeholder"
|
|
2604
|
-
},
|
|
2641
|
+
}, yi = {
|
|
2605
2642
|
key: 1,
|
|
2606
2643
|
class: "divide-y divide-fm-color-border-default"
|
|
2607
|
-
},
|
|
2644
|
+
}, bi = { class: "flex items-center gap-12" }, gi = { class: "flex-1 fm-typo-en-body-sm-600 text-fm-color-typo-primary truncate" }, _i = {
|
|
2608
2645
|
key: 0,
|
|
2609
2646
|
class: "flex flex-col gap-4 pl-8"
|
|
2610
|
-
},
|
|
2647
|
+
}, ki = { class: "flex-1 fm-typo-en-body-xs-400 text-fm-color-typo-secondary font-mono truncate" }, hi = /* @__PURE__ */ le({
|
|
2611
2648
|
__name: "LivePreviewTable",
|
|
2612
2649
|
setup(m) {
|
|
2613
|
-
const { t: d } =
|
|
2650
|
+
const { t: d } = ie(), l = ge(), t = ne(), i = {
|
|
2614
2651
|
"will-update": 0,
|
|
2615
2652
|
"partially-ignored": 1,
|
|
2616
2653
|
"already-satisfied": 2,
|
|
2617
2654
|
blocked: 3,
|
|
2618
2655
|
"no-applicable-changes": 4
|
|
2619
|
-
},
|
|
2656
|
+
}, r = A(
|
|
2620
2657
|
() => Object.values(l.livePreviewEntries).sort(
|
|
2621
2658
|
(e, V) => i[e.status] - i[V.status]
|
|
2622
2659
|
)
|
|
2623
|
-
),
|
|
2624
|
-
() =>
|
|
2625
|
-
), u =
|
|
2626
|
-
() =>
|
|
2627
|
-
), o =
|
|
2628
|
-
() =>
|
|
2629
|
-
), s =
|
|
2630
|
-
() =>
|
|
2660
|
+
), x = A(
|
|
2661
|
+
() => r.value.filter((e) => e.status === "will-update").length
|
|
2662
|
+
), u = A(
|
|
2663
|
+
() => r.value.filter((e) => e.status === "partially-ignored").length
|
|
2664
|
+
), o = A(
|
|
2665
|
+
() => r.value.filter((e) => e.status === "already-satisfied").length
|
|
2666
|
+
), s = A(
|
|
2667
|
+
() => r.value.filter((e) => e.status === "blocked").length
|
|
2631
2668
|
);
|
|
2632
|
-
function
|
|
2669
|
+
function a(e) {
|
|
2633
2670
|
switch (e) {
|
|
2634
2671
|
case "will-update":
|
|
2635
2672
|
return d("inventory.recipe.bulkEditor.status.willUpdate");
|
|
@@ -2662,15 +2699,15 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2662
2699
|
}
|
|
2663
2700
|
}
|
|
2664
2701
|
function $(e, V) {
|
|
2665
|
-
var c,
|
|
2666
|
-
return e === "SKU" ? ((c = t.skuById[V]) == null ? void 0 : c.name) ?? V : e === "SKU_GROUP" ? ((
|
|
2702
|
+
var c, _, N;
|
|
2703
|
+
return e === "SKU" ? ((c = t.skuById[V]) == null ? void 0 : c.name) ?? V : e === "SKU_GROUP" ? ((_ = t.skuGroupById[V]) == null ? void 0 : _.name) ?? V : e === "RECIPE" ? ((N = t.recipeById[V]) == null ? void 0 : N.name) ?? V : V;
|
|
2667
2704
|
}
|
|
2668
2705
|
function C(e) {
|
|
2669
|
-
var c,
|
|
2706
|
+
var c, _;
|
|
2670
2707
|
const V = $(e.type, e.id);
|
|
2671
2708
|
if (e.type === "SKU") {
|
|
2672
|
-
const
|
|
2673
|
-
return `${V} (${Q(e.amount)} ${
|
|
2709
|
+
const N = t.skuById[e.id], z = ((c = e.measurement) == null ? void 0 : c.abbrev) ?? ((_ = N == null ? void 0 : N.unit) == null ? void 0 : _.abbrev) ?? "";
|
|
2710
|
+
return `${V} (${Q(e.amount)} ${z})`.trim();
|
|
2674
2711
|
}
|
|
2675
2712
|
return e.type === "RECIPE" ? `${V} ×${Q(e.amount)}` : V;
|
|
2676
2713
|
}
|
|
@@ -2678,10 +2715,10 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2678
2715
|
return $(e.type, e.id);
|
|
2679
2716
|
}
|
|
2680
2717
|
function f(e, V) {
|
|
2681
|
-
const c = V.contains.find((
|
|
2718
|
+
const c = V.contains.find((_) => _.type === e.type && _.id === e.id);
|
|
2682
2719
|
return c ? C(c) : I(e);
|
|
2683
2720
|
}
|
|
2684
|
-
function
|
|
2721
|
+
function k(e, V) {
|
|
2685
2722
|
switch (e.type) {
|
|
2686
2723
|
case "add-binding":
|
|
2687
2724
|
return `+ ${C(e.binding)}`;
|
|
@@ -2709,7 +2746,7 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2709
2746
|
return "neutral";
|
|
2710
2747
|
}
|
|
2711
2748
|
}
|
|
2712
|
-
function
|
|
2749
|
+
function b(e) {
|
|
2713
2750
|
switch (e) {
|
|
2714
2751
|
case "applied":
|
|
2715
2752
|
return d("inventory.recipe.bulkEditor.livePreview.outcomeApplied");
|
|
@@ -2725,76 +2762,76 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2725
2762
|
}
|
|
2726
2763
|
return (e, V) => {
|
|
2727
2764
|
const c = G("FmChip");
|
|
2728
|
-
return
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2765
|
+
return y(), E("div", ri, [
|
|
2766
|
+
v("div", ai, [
|
|
2767
|
+
x.value + u.value > 0 ? (y(), E("div", si, [
|
|
2768
|
+
h(c, {
|
|
2732
2769
|
size: "sm",
|
|
2733
|
-
label: String(
|
|
2770
|
+
label: String(x.value + u.value),
|
|
2734
2771
|
variant: "success"
|
|
2735
2772
|
}, null, 8, ["label"]),
|
|
2736
|
-
|
|
2737
|
-
])) :
|
|
2738
|
-
o.value > 0 ? (
|
|
2739
|
-
|
|
2773
|
+
v("span", di, U(n(d)("inventory.recipe.bulkEditor.livePreview.willUpdate")), 1)
|
|
2774
|
+
])) : T("", !0),
|
|
2775
|
+
o.value > 0 ? (y(), E("div", ui, [
|
|
2776
|
+
h(c, {
|
|
2740
2777
|
size: "sm",
|
|
2741
2778
|
label: String(o.value),
|
|
2742
2779
|
variant: "info"
|
|
2743
2780
|
}, null, 8, ["label"]),
|
|
2744
|
-
|
|
2745
|
-
])) :
|
|
2746
|
-
s.value > 0 ? (
|
|
2747
|
-
|
|
2781
|
+
v("span", ci, U(n(d)("inventory.recipe.bulkEditor.livePreview.alreadySatisfied")), 1)
|
|
2782
|
+
])) : T("", !0),
|
|
2783
|
+
s.value > 0 ? (y(), E("div", pi, [
|
|
2784
|
+
h(c, {
|
|
2748
2785
|
size: "sm",
|
|
2749
2786
|
label: String(s.value),
|
|
2750
2787
|
variant: "critical"
|
|
2751
2788
|
}, null, 8, ["label"]),
|
|
2752
|
-
|
|
2753
|
-
])) :
|
|
2789
|
+
v("span", mi, U(n(d)("inventory.recipe.bulkEditor.livePreview.blocked")), 1)
|
|
2790
|
+
])) : T("", !0)
|
|
2754
2791
|
]),
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
(
|
|
2758
|
-
key:
|
|
2792
|
+
v("div", fi, [
|
|
2793
|
+
r.value.length === 0 ? (y(), E("div", vi, U(n(d)("inventory.recipe.bulkEditor.livePreview.noRecipes")), 1)) : (y(), E("div", yi, [
|
|
2794
|
+
(y(!0), E(X, null, me(r.value, (_) => (y(), E("div", {
|
|
2795
|
+
key: _.recipeId,
|
|
2759
2796
|
class: "flex flex-col gap-6 px-16 py-10"
|
|
2760
2797
|
}, [
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2798
|
+
v("div", bi, [
|
|
2799
|
+
v("span", gi, U(_.recipeName), 1),
|
|
2800
|
+
h(c, {
|
|
2764
2801
|
size: "sm",
|
|
2765
|
-
label:
|
|
2766
|
-
variant: p(
|
|
2802
|
+
label: a(_.status),
|
|
2803
|
+
variant: p(_.status)
|
|
2767
2804
|
}, null, 8, ["label", "variant"])
|
|
2768
2805
|
]),
|
|
2769
|
-
|
|
2770
|
-
(
|
|
2771
|
-
key:
|
|
2806
|
+
_.changes.length > 0 ? (y(), E("div", _i, [
|
|
2807
|
+
(y(!0), E(X, null, me(_.changes, (N, z) => (y(), E("div", {
|
|
2808
|
+
key: z,
|
|
2772
2809
|
class: "flex items-center gap-8"
|
|
2773
2810
|
}, [
|
|
2774
|
-
|
|
2775
|
-
|
|
2811
|
+
v("span", ki, U(k(N.change, _.original)), 1),
|
|
2812
|
+
h(c, {
|
|
2776
2813
|
size: "sm",
|
|
2777
|
-
label:
|
|
2778
|
-
variant: S(
|
|
2814
|
+
label: b(N.outcome),
|
|
2815
|
+
variant: S(N.outcome)
|
|
2779
2816
|
}, null, 8, ["label", "variant"])
|
|
2780
2817
|
]))), 128))
|
|
2781
|
-
])) :
|
|
2818
|
+
])) : T("", !0)
|
|
2782
2819
|
]))), 128))
|
|
2783
2820
|
]))
|
|
2784
2821
|
])
|
|
2785
2822
|
]);
|
|
2786
2823
|
};
|
|
2787
2824
|
}
|
|
2788
|
-
}),
|
|
2825
|
+
}), xi = { class: "flex flex-col h-full overflow-hidden" }, $i = { class: "flex flex-col min-h-0 shrink-0" }, Ii = { class: "flex items-center gap-8 px-16 pt-12 border-b border-fm-color-border-default" }, wi = { class: "flex-1 overflow-x-auto min-w-0" }, Ei = {
|
|
2789
2826
|
class: "px-16 py-14 overflow-y-auto",
|
|
2790
2827
|
style: { "max-height": "45vh" }
|
|
2791
|
-
},
|
|
2828
|
+
}, Vi = {
|
|
2792
2829
|
key: 0,
|
|
2793
2830
|
class: "flex flex-col items-center justify-center py-40 gap-8 text-center rounded-lg border border-dashed border-fm-color-border-default"
|
|
2794
|
-
},
|
|
2831
|
+
}, Si = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ci = { class: "flex-1 overflow-y-auto px-16 py-14 flex flex-col gap-12 min-h-0" }, Bi = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary shrink-0" }, Fi = /* @__PURE__ */ le({
|
|
2795
2832
|
__name: "RecipeBulkEditorStep2",
|
|
2796
2833
|
setup(m) {
|
|
2797
|
-
const { t: d } =
|
|
2834
|
+
const { t: d } = ie(), l = ge(), t = W(null);
|
|
2798
2835
|
ue(
|
|
2799
2836
|
() => l.modifications.length,
|
|
2800
2837
|
(o) => {
|
|
@@ -2803,16 +2840,16 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2803
2840
|
{ immediate: !0 }
|
|
2804
2841
|
);
|
|
2805
2842
|
function i(o, s) {
|
|
2806
|
-
const
|
|
2807
|
-
return
|
|
2843
|
+
const a = o.type === "replace-binding" ? o.from.type : o.type === "remove-binding" || o.type === "update-binding-rule" || o.type === "update-alternatives" ? o.target.type : o.type === "add-binding" ? o.binding.type : null;
|
|
2844
|
+
return a === "RECIPE" ? d("inventory.recipe.bulkEditor.step2.fieldRecipe") : a === "SKU" || a === "SKU_GROUP" ? d("inventory.recipe.bulkEditor.step2.fieldIngredient") : d("inventory.recipe.bulkEditor.step2.tabLabel", { n: s + 1 });
|
|
2808
2845
|
}
|
|
2809
|
-
const
|
|
2846
|
+
const r = A(
|
|
2810
2847
|
() => l.modifications.map((o, s) => ({
|
|
2811
2848
|
label: i(o, s),
|
|
2812
2849
|
value: s
|
|
2813
2850
|
}))
|
|
2814
2851
|
);
|
|
2815
|
-
function
|
|
2852
|
+
function x() {
|
|
2816
2853
|
const s = {
|
|
2817
2854
|
type: "add-binding",
|
|
2818
2855
|
binding: {
|
|
@@ -2830,24 +2867,24 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2830
2867
|
l.removeModification(o);
|
|
2831
2868
|
}
|
|
2832
2869
|
return (o, s) => {
|
|
2833
|
-
const
|
|
2834
|
-
return
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2870
|
+
const a = G("FmButton"), p = G("FmTab"), $ = G("FmTabs"), C = G("FmIcon");
|
|
2871
|
+
return y(), E("div", xi, [
|
|
2872
|
+
v("div", $i, [
|
|
2873
|
+
v("div", Ii, [
|
|
2874
|
+
v("div", wi, [
|
|
2875
|
+
r.value.length > 0 ? (y(), Y($, {
|
|
2839
2876
|
key: 0,
|
|
2840
2877
|
"model-value": t.value,
|
|
2841
|
-
items:
|
|
2878
|
+
items: r.value,
|
|
2842
2879
|
"onUpdate:modelValue": s[1] || (s[1] = (I) => t.value = I)
|
|
2843
2880
|
}, {
|
|
2844
2881
|
default: J((I) => [
|
|
2845
|
-
|
|
2882
|
+
h(p, we(I, {
|
|
2846
2883
|
"model-value": t.value,
|
|
2847
2884
|
"onUpdate:modelValue": s[0] || (s[0] = (f) => t.value = f)
|
|
2848
2885
|
}), {
|
|
2849
2886
|
append: J(() => [
|
|
2850
|
-
|
|
2887
|
+
h(a, {
|
|
2851
2888
|
variant: "tertiary",
|
|
2852
2889
|
icon: "close",
|
|
2853
2890
|
size: "md",
|
|
@@ -2858,213 +2895,213 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2858
2895
|
}, 1040, ["model-value"])
|
|
2859
2896
|
]),
|
|
2860
2897
|
_: 1
|
|
2861
|
-
}, 8, ["model-value", "items"])) :
|
|
2898
|
+
}, 8, ["model-value", "items"])) : T("", !0)
|
|
2862
2899
|
]),
|
|
2863
|
-
|
|
2900
|
+
h(a, {
|
|
2864
2901
|
label: n(d)("inventory.recipe.bulkEditor.step2.addModification"),
|
|
2865
2902
|
variant: "secondary",
|
|
2866
2903
|
size: "md",
|
|
2867
2904
|
"prepend-icon": "add",
|
|
2868
2905
|
class: "shrink-0",
|
|
2869
|
-
onClick:
|
|
2906
|
+
onClick: x
|
|
2870
2907
|
}, null, 8, ["label"])
|
|
2871
2908
|
]),
|
|
2872
|
-
|
|
2873
|
-
n(l).modifications.length === 0 ? (
|
|
2874
|
-
|
|
2909
|
+
v("div", Ei, [
|
|
2910
|
+
n(l).modifications.length === 0 ? (y(), E("div", Vi, [
|
|
2911
|
+
h(C, {
|
|
2875
2912
|
name: "edit_note",
|
|
2876
2913
|
size: "lg",
|
|
2877
2914
|
class: "text-fm-color-typo-placeholder"
|
|
2878
2915
|
}),
|
|
2879
|
-
|
|
2880
|
-
])) : t.value !== null && n(l).modifications[t.value] ? (
|
|
2916
|
+
v("p", Si, U(n(d)("inventory.recipe.bulkEditor.step2.emptyState")), 1)
|
|
2917
|
+
])) : t.value !== null && n(l).modifications[t.value] ? (y(), Y(li, {
|
|
2881
2918
|
key: t.value,
|
|
2882
2919
|
"model-value": n(l).modifications[t.value],
|
|
2883
2920
|
"live-preview-entries": n(l).livePreviewEntries,
|
|
2884
2921
|
"onUpdate:modelValue": s[2] || (s[2] = (I) => n(l).updateModification(t.value, I))
|
|
2885
|
-
}, null, 8, ["model-value", "live-preview-entries"])) :
|
|
2922
|
+
}, null, 8, ["model-value", "live-preview-entries"])) : T("", !0)
|
|
2886
2923
|
])
|
|
2887
2924
|
]),
|
|
2888
|
-
s[3] || (s[3] =
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2925
|
+
s[3] || (s[3] = v("div", { class: "border-t border-fm-color-border-default shrink-0" }, null, -1)),
|
|
2926
|
+
v("div", Ci, [
|
|
2927
|
+
v("span", Bi, U(n(d)("inventory.recipe.bulkEditor.step2.livePreviewTitle")), 1),
|
|
2928
|
+
h(hi)
|
|
2892
2929
|
])
|
|
2893
2930
|
]);
|
|
2894
2931
|
};
|
|
2895
2932
|
}
|
|
2896
2933
|
});
|
|
2897
|
-
function
|
|
2934
|
+
function Ri(m) {
|
|
2898
2935
|
return !m || Object.keys(m).length === 0 ? "" : Object.entries(m).map(([d, l]) => `${d}: ${l}`).join(", ");
|
|
2899
2936
|
}
|
|
2900
|
-
function
|
|
2901
|
-
const m = ne(), d = ge(), l = m.skuById, t = m.recipeById, i = m.skuGroupById,
|
|
2937
|
+
function Ai() {
|
|
2938
|
+
const m = ne(), d = ge(), l = m.skuById, t = m.recipeById, i = m.skuGroupById, x = Object.values(d.entries).filter(
|
|
2902
2939
|
(s) => s.status === "will-update" || s.status === "partially-ignored"
|
|
2903
|
-
).flatMap((s,
|
|
2940
|
+
).flatMap((s, a) => {
|
|
2904
2941
|
var C;
|
|
2905
|
-
const p = s.projected ?? s.original, $ =
|
|
2942
|
+
const p = s.projected ?? s.original, $ = Ri(p.customAttributes);
|
|
2906
2943
|
if ((C = p.contains) != null && C.length) {
|
|
2907
|
-
const I = p.contains.filter((S) => S.type === "RECIPE"), f = p.contains.filter((S) => S.type === "SKU"),
|
|
2944
|
+
const I = p.contains.filter((S) => S.type === "RECIPE"), f = p.contains.filter((S) => S.type === "SKU"), k = p.contains.filter((S) => S.type === "SKU_GROUP");
|
|
2908
2945
|
return [
|
|
2909
|
-
...
|
|
2946
|
+
...a === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
2910
2947
|
...I.map(
|
|
2911
|
-
(S,
|
|
2948
|
+
(S, b) => {
|
|
2912
2949
|
var e;
|
|
2913
2950
|
return [
|
|
2914
|
-
|
|
2951
|
+
b === 0 ? p.name : "",
|
|
2915
2952
|
"RECIPE",
|
|
2916
2953
|
"",
|
|
2917
2954
|
((e = t[S.id]) == null ? void 0 : e.name) ?? S.id,
|
|
2918
2955
|
Q(S.amount),
|
|
2919
2956
|
"UNIT",
|
|
2920
|
-
|
|
2957
|
+
b === 0 ? $ : ""
|
|
2921
2958
|
];
|
|
2922
2959
|
}
|
|
2923
2960
|
),
|
|
2924
2961
|
...f.map(
|
|
2925
|
-
(S,
|
|
2926
|
-
var e, V, c,
|
|
2962
|
+
(S, b) => {
|
|
2963
|
+
var e, V, c, _;
|
|
2927
2964
|
return [
|
|
2928
|
-
!I.length &&
|
|
2965
|
+
!I.length && b === 0 ? p.name : "",
|
|
2929
2966
|
"INGREDIENT",
|
|
2930
2967
|
((e = l[S.id]) == null ? void 0 : e.code) ?? "",
|
|
2931
2968
|
((V = l[S.id]) == null ? void 0 : V.name) ?? S.id,
|
|
2932
2969
|
Q(S.amount),
|
|
2933
|
-
S.measurement ? S.measurement.abbrev : ((
|
|
2934
|
-
!I.length &&
|
|
2970
|
+
S.measurement ? S.measurement.abbrev : ((_ = (c = l[S.id]) == null ? void 0 : c.unit) == null ? void 0 : _.abbrev) ?? "",
|
|
2971
|
+
!I.length && b === 0 ? $ : ""
|
|
2935
2972
|
];
|
|
2936
2973
|
}
|
|
2937
2974
|
),
|
|
2938
|
-
...
|
|
2939
|
-
(S,
|
|
2975
|
+
...k.map(
|
|
2976
|
+
(S, b) => {
|
|
2940
2977
|
var e, V;
|
|
2941
2978
|
return [
|
|
2942
|
-
I.length === 0 && f.length === 0 &&
|
|
2979
|
+
I.length === 0 && f.length === 0 && b === 0 ? p.name : "",
|
|
2943
2980
|
"SKU_GROUP",
|
|
2944
2981
|
((e = i[S.id]) == null ? void 0 : e.ref) ?? "",
|
|
2945
2982
|
((V = i[S.id]) == null ? void 0 : V.name) ?? S.id,
|
|
2946
2983
|
Q(S.amount),
|
|
2947
2984
|
"UNIT",
|
|
2948
|
-
I.length === 0 && f.length === 0 &&
|
|
2985
|
+
I.length === 0 && f.length === 0 && b === 0 ? $ : ""
|
|
2949
2986
|
];
|
|
2950
2987
|
}
|
|
2951
2988
|
)
|
|
2952
2989
|
];
|
|
2953
2990
|
}
|
|
2954
2991
|
return [
|
|
2955
|
-
...
|
|
2992
|
+
...a === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
2956
2993
|
[p.name, "No bindings", "", "", "", "", $]
|
|
2957
2994
|
];
|
|
2958
|
-
}), o =
|
|
2995
|
+
}), o = at(x, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
|
|
2959
2996
|
st(o, `RECIPE_BULK_EDIT_${dt(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
|
|
2960
2997
|
}
|
|
2961
|
-
const
|
|
2998
|
+
const Ti = { class: "flex flex-col gap-16" }, Ui = { class: "rounded-lg border border-fm-color-border-default bg-fm-color-surface-secondary p-16" }, Pi = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary mb-8" }, Mi = { class: "flex flex-wrap gap-12" }, Di = { class: "flex items-center gap-6" }, Gi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ni = {
|
|
2962
2999
|
key: 0,
|
|
2963
3000
|
class: "flex items-center gap-6"
|
|
2964
|
-
},
|
|
3001
|
+
}, zi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Oi = {
|
|
2965
3002
|
key: 1,
|
|
2966
3003
|
class: "flex items-center gap-6"
|
|
2967
|
-
},
|
|
3004
|
+
}, Li = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ji = {
|
|
2968
3005
|
key: 2,
|
|
2969
3006
|
class: "flex items-center gap-6"
|
|
2970
|
-
},
|
|
3007
|
+
}, Ki = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qi = {
|
|
2971
3008
|
key: 3,
|
|
2972
3009
|
class: "flex items-center gap-6"
|
|
2973
|
-
},
|
|
3010
|
+
}, Wi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Yi = { class: "mt-12" }, Ji = ["onClick"], Hi = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary flex-1 truncate" }, Qi = {
|
|
2974
3011
|
key: 0,
|
|
2975
3012
|
class: "px-12 py-8 border-b border-fm-color-border-default"
|
|
2976
|
-
},
|
|
3013
|
+
}, Xi = { class: "px-12 py-10 leading-relaxed" }, Zi = {
|
|
2977
3014
|
key: 2,
|
|
2978
3015
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-placeholder italic"
|
|
2979
|
-
},
|
|
3016
|
+
}, el = { class: "flex items-center gap-12 px-12 py-8 border-t border-fm-color-border-default bg-fm-color-surface-secondary text-fm-color-typo-secondary fm-typo-en-body-xs-400" }, tl = { key: 0 }, nl = { key: 1 }, ol = {
|
|
2980
3017
|
key: 2,
|
|
2981
3018
|
class: "text-fm-color-warning"
|
|
2982
|
-
},
|
|
3019
|
+
}, il = {
|
|
2983
3020
|
key: 3,
|
|
2984
3021
|
class: "text-fm-color-error"
|
|
2985
|
-
},
|
|
3022
|
+
}, ll = {
|
|
2986
3023
|
key: 4,
|
|
2987
3024
|
class: "text-fm-color-typo-placeholder"
|
|
2988
|
-
},
|
|
3025
|
+
}, rl = /* @__PURE__ */ le({
|
|
2989
3026
|
__name: "RecipeBulkEditorSummaryStep",
|
|
2990
3027
|
setup(m) {
|
|
2991
|
-
const { t: d } =
|
|
3028
|
+
const { t: d } = ie(), l = ne(), t = ge(), i = A(() => Object.values(t.entries)), r = A(
|
|
2992
3029
|
() => i.value.filter((e) => e.status === "will-update").length
|
|
2993
|
-
),
|
|
3030
|
+
), x = A(
|
|
2994
3031
|
() => i.value.filter((e) => e.status === "partially-ignored").length
|
|
2995
|
-
), u =
|
|
3032
|
+
), u = A(
|
|
2996
3033
|
() => i.value.filter((e) => e.status === "already-satisfied").length
|
|
2997
|
-
), o =
|
|
3034
|
+
), o = A(
|
|
2998
3035
|
() => i.value.filter((e) => e.status === "blocked").length
|
|
2999
|
-
), s =
|
|
3036
|
+
), s = A(
|
|
3000
3037
|
() => i.value.filter((e) => e.status === "no-applicable-changes").length
|
|
3001
|
-
),
|
|
3038
|
+
), a = W(/* @__PURE__ */ new Set());
|
|
3002
3039
|
function p(e) {
|
|
3003
|
-
return
|
|
3040
|
+
return a.value.has(e);
|
|
3004
3041
|
}
|
|
3005
3042
|
function $(e) {
|
|
3006
|
-
const V = new Set(
|
|
3007
|
-
V.has(e) ? V.delete(e) : V.add(e),
|
|
3043
|
+
const V = new Set(a.value);
|
|
3044
|
+
V.has(e) ? V.delete(e) : V.add(e), a.value = V;
|
|
3008
3045
|
}
|
|
3009
3046
|
function C(e) {
|
|
3010
|
-
var
|
|
3047
|
+
var _, N, z;
|
|
3011
3048
|
const V = [], c = ke(e.contains, /* @__PURE__ */ new Set([e._id]), l.recipeById);
|
|
3012
|
-
for (let
|
|
3013
|
-
const
|
|
3049
|
+
for (let g = 0; g < c.length; g++) {
|
|
3050
|
+
const B = c[g], F = B.recipeIds.slice(1).length > 0, R = F ? ((_ = l.recipeById[B.recipeIds.at(-1) ?? ""]) == null ? void 0 : _.name) ?? "" : "";
|
|
3014
3051
|
let P;
|
|
3015
|
-
if (
|
|
3016
|
-
const
|
|
3017
|
-
if (!
|
|
3018
|
-
const H = `x${Q(
|
|
3019
|
-
P =
|
|
3052
|
+
if (B.isGroup) {
|
|
3053
|
+
const K = l.skuGroupById[B.id];
|
|
3054
|
+
if (!K) continue;
|
|
3055
|
+
const H = `x${Q(B.amount)}`;
|
|
3056
|
+
P = F ? `(${R}) ${K.name} (${H})` : `${K.name} (${H})`;
|
|
3020
3057
|
} else {
|
|
3021
|
-
const
|
|
3022
|
-
if (!
|
|
3023
|
-
const H = ((
|
|
3024
|
-
P =
|
|
3058
|
+
const K = l.skuById[B.id];
|
|
3059
|
+
if (!K) continue;
|
|
3060
|
+
const H = ((N = B.measurement) == null ? void 0 : N.abbrev) ?? ((z = K.unit) == null ? void 0 : z.abbrev) ?? "", ee = `${Q(B.amount)}${H}`;
|
|
3061
|
+
P = F ? `(${R}) ${K.name} (${ee})` : `${K.name} (${ee})`;
|
|
3025
3062
|
}
|
|
3026
|
-
|
|
3063
|
+
g > 0 && V.push({ text: ", " }), V.push({ text: P });
|
|
3027
3064
|
}
|
|
3028
3065
|
return V;
|
|
3029
3066
|
}
|
|
3030
3067
|
function I(e) {
|
|
3031
|
-
var
|
|
3068
|
+
var g, B, F, R;
|
|
3032
3069
|
if (e.isGroup) {
|
|
3033
3070
|
const P = l.skuGroupById[e.id];
|
|
3034
3071
|
if (!P) return "";
|
|
3035
|
-
const
|
|
3036
|
-
return
|
|
3072
|
+
const K = e.recipeIds.slice(1).length > 0, H = K ? ((g = l.recipeById[e.recipeIds.at(-1) ?? ""]) == null ? void 0 : g.name) ?? "" : "", ee = `x${Q(e.amount)}`;
|
|
3073
|
+
return K ? `(${H}) ${P.name} (${ee})` : `${P.name} (${ee})`;
|
|
3037
3074
|
}
|
|
3038
3075
|
const V = l.skuById[e.id];
|
|
3039
3076
|
if (!V) return "";
|
|
3040
|
-
const c = e.recipeIds.slice(1).length > 0,
|
|
3041
|
-
return c ? `(${
|
|
3077
|
+
const c = e.recipeIds.slice(1).length > 0, _ = c ? ((B = l.recipeById[e.recipeIds.at(-1) ?? ""]) == null ? void 0 : B.name) ?? "" : "", N = ((F = e.measurement) == null ? void 0 : F.abbrev) ?? ((R = V.unit) == null ? void 0 : R.abbrev) ?? "", z = `${Q(e.amount)}${N}`;
|
|
3078
|
+
return c ? `(${_}) ${V.name} (${z})` : `${V.name} (${z})`;
|
|
3042
3079
|
}
|
|
3043
3080
|
function f(e) {
|
|
3044
3081
|
if (!e.projected) return [];
|
|
3045
|
-
const V = ke(e.original.contains, /* @__PURE__ */ new Set([e.recipeId]), l.recipeById), c = ke(e.projected.contains, /* @__PURE__ */ new Set([e.recipeId]), l.recipeById),
|
|
3046
|
-
for (const
|
|
3047
|
-
const
|
|
3048
|
-
for (const
|
|
3049
|
-
const
|
|
3050
|
-
let
|
|
3051
|
-
function F
|
|
3052
|
-
|
|
3082
|
+
const V = ke(e.original.contains, /* @__PURE__ */ new Set([e.recipeId]), l.recipeById), c = ke(e.projected.contains, /* @__PURE__ */ new Set([e.recipeId]), l.recipeById), _ = /* @__PURE__ */ new Map();
|
|
3083
|
+
for (const F of V) _.set(`${F.type}:${F.id}`, F);
|
|
3084
|
+
const N = /* @__PURE__ */ new Map();
|
|
3085
|
+
for (const F of c) N.set(`${F.type}:${F.id}`, F);
|
|
3086
|
+
const z = [];
|
|
3087
|
+
let g = !0;
|
|
3088
|
+
function B(F, R) {
|
|
3089
|
+
R && (g || z.push({ kind: "unchanged", text: ", " }), z.push({ kind: F, text: R }), g = !1);
|
|
3053
3090
|
}
|
|
3054
|
-
for (const [
|
|
3055
|
-
const P =
|
|
3091
|
+
for (const [F, R] of _) {
|
|
3092
|
+
const P = N.get(F);
|
|
3056
3093
|
if (!P)
|
|
3057
|
-
|
|
3094
|
+
B("removed", I(R));
|
|
3058
3095
|
else {
|
|
3059
|
-
const
|
|
3060
|
-
|
|
3096
|
+
const K = I(R), H = I(P);
|
|
3097
|
+
K === H ? B("unchanged", K) : (B("removed", K), B("added", H));
|
|
3061
3098
|
}
|
|
3062
3099
|
}
|
|
3063
|
-
for (const [
|
|
3064
|
-
|
|
3065
|
-
return
|
|
3100
|
+
for (const [F, R] of N)
|
|
3101
|
+
_.has(F) || B("added", I(R));
|
|
3102
|
+
return z;
|
|
3066
3103
|
}
|
|
3067
|
-
const
|
|
3104
|
+
const k = A(() => {
|
|
3068
3105
|
const e = /* @__PURE__ */ new Map();
|
|
3069
3106
|
for (const V of i.value)
|
|
3070
3107
|
e.set(V.recipeId, f(V));
|
|
@@ -3086,7 +3123,7 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3086
3123
|
return "";
|
|
3087
3124
|
}
|
|
3088
3125
|
}
|
|
3089
|
-
function
|
|
3126
|
+
function b(e) {
|
|
3090
3127
|
switch (e) {
|
|
3091
3128
|
case "will-update":
|
|
3092
3129
|
return "success";
|
|
@@ -3103,153 +3140,153 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3103
3140
|
}
|
|
3104
3141
|
}
|
|
3105
3142
|
return (e, V) => {
|
|
3106
|
-
const c = G("FmChip"),
|
|
3107
|
-
return
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3143
|
+
const c = G("FmChip"), _ = G("FmButton"), N = G("FmBanner"), z = G("FmIcon");
|
|
3144
|
+
return y(), E("div", Ti, [
|
|
3145
|
+
v("div", Ui, [
|
|
3146
|
+
v("p", Pi, U(n(d)("inventory.recipe.bulkEditor.summary.title")), 1),
|
|
3147
|
+
v("div", Mi, [
|
|
3148
|
+
v("div", Di, [
|
|
3149
|
+
h(c, {
|
|
3113
3150
|
size: "sm",
|
|
3114
|
-
label: String(
|
|
3151
|
+
label: String(r.value),
|
|
3115
3152
|
variant: "success"
|
|
3116
3153
|
}, null, 8, ["label"]),
|
|
3117
|
-
|
|
3154
|
+
v("span", Gi, U(n(d)("inventory.recipe.bulkEditor.summary.countWillUpdate")), 1)
|
|
3118
3155
|
]),
|
|
3119
|
-
|
|
3120
|
-
|
|
3156
|
+
x.value > 0 ? (y(), E("div", Ni, [
|
|
3157
|
+
h(c, {
|
|
3121
3158
|
size: "sm",
|
|
3122
|
-
label: String(
|
|
3159
|
+
label: String(x.value),
|
|
3123
3160
|
variant: "warning"
|
|
3124
3161
|
}, null, 8, ["label"]),
|
|
3125
|
-
|
|
3126
|
-
])) :
|
|
3127
|
-
u.value > 0 ? (
|
|
3128
|
-
|
|
3162
|
+
v("span", zi, U(n(d)("inventory.recipe.bulkEditor.summary.countPartiallyIgnored")), 1)
|
|
3163
|
+
])) : T("", !0),
|
|
3164
|
+
u.value > 0 ? (y(), E("div", Oi, [
|
|
3165
|
+
h(c, {
|
|
3129
3166
|
size: "sm",
|
|
3130
3167
|
label: String(u.value),
|
|
3131
3168
|
variant: "info"
|
|
3132
3169
|
}, null, 8, ["label"]),
|
|
3133
|
-
|
|
3134
|
-
])) :
|
|
3135
|
-
o.value > 0 ? (
|
|
3136
|
-
|
|
3170
|
+
v("span", Li, U(n(d)("inventory.recipe.bulkEditor.summary.countAlreadySatisfied")), 1)
|
|
3171
|
+
])) : T("", !0),
|
|
3172
|
+
o.value > 0 ? (y(), E("div", ji, [
|
|
3173
|
+
h(c, {
|
|
3137
3174
|
size: "sm",
|
|
3138
3175
|
label: String(o.value),
|
|
3139
3176
|
variant: "critical"
|
|
3140
3177
|
}, null, 8, ["label"]),
|
|
3141
|
-
|
|
3142
|
-
])) :
|
|
3143
|
-
s.value > 0 ? (
|
|
3144
|
-
|
|
3178
|
+
v("span", Ki, U(n(d)("inventory.recipe.bulkEditor.summary.countBlocked")), 1)
|
|
3179
|
+
])) : T("", !0),
|
|
3180
|
+
s.value > 0 ? (y(), E("div", qi, [
|
|
3181
|
+
h(c, {
|
|
3145
3182
|
size: "sm",
|
|
3146
3183
|
label: String(s.value),
|
|
3147
3184
|
variant: "neutral"
|
|
3148
3185
|
}, null, 8, ["label"]),
|
|
3149
|
-
|
|
3150
|
-
])) :
|
|
3186
|
+
v("span", Wi, U(n(d)("inventory.recipe.bulkEditor.summary.countNoChanges")), 1)
|
|
3187
|
+
])) : T("", !0)
|
|
3151
3188
|
]),
|
|
3152
|
-
|
|
3153
|
-
|
|
3189
|
+
v("div", Yi, [
|
|
3190
|
+
h(_, {
|
|
3154
3191
|
label: n(d)("common.export"),
|
|
3155
3192
|
variant: "secondary",
|
|
3156
3193
|
size: "md",
|
|
3157
|
-
onClick: n(
|
|
3194
|
+
onClick: n(Ai)
|
|
3158
3195
|
}, null, 8, ["label", "onClick"])
|
|
3159
3196
|
]),
|
|
3160
|
-
|
|
3197
|
+
r.value === 0 && x.value === 0 ? (y(), Y(N, {
|
|
3161
3198
|
key: 0,
|
|
3162
3199
|
class: "mt-12",
|
|
3163
3200
|
type: "warning",
|
|
3164
3201
|
message: n(d)("inventory.recipe.bulkEditor.summary.nothingToSubmit")
|
|
3165
|
-
}, null, 8, ["message"])) :
|
|
3202
|
+
}, null, 8, ["message"])) : T("", !0)
|
|
3166
3203
|
]),
|
|
3167
|
-
(
|
|
3168
|
-
key:
|
|
3204
|
+
(y(!0), E(X, null, me(i.value, (g) => (y(), E("div", {
|
|
3205
|
+
key: g.recipeId,
|
|
3169
3206
|
class: "rounded-lg border border-fm-color-border-default overflow-hidden"
|
|
3170
3207
|
}, [
|
|
3171
|
-
|
|
3208
|
+
v("button", {
|
|
3172
3209
|
type: "button",
|
|
3173
|
-
class:
|
|
3174
|
-
onClick: (
|
|
3210
|
+
class: Ce(["w-full flex items-center gap-8 px-12 py-10 bg-fm-color-surface-secondary border-b border-fm-color-border-default text-left cursor-pointer", { "border-b-0": !p(g.recipeId) }]),
|
|
3211
|
+
onClick: (B) => $(g.recipeId)
|
|
3175
3212
|
}, [
|
|
3176
|
-
|
|
3177
|
-
name: p(
|
|
3213
|
+
h(z, {
|
|
3214
|
+
name: p(g.recipeId) ? "expand_less" : "expand_more",
|
|
3178
3215
|
size: "sm",
|
|
3179
3216
|
class: "text-fm-color-typo-secondary flex-shrink-0"
|
|
3180
3217
|
}, null, 8, ["name"]),
|
|
3181
|
-
|
|
3182
|
-
|
|
3218
|
+
v("span", Hi, U(g.recipeName), 1),
|
|
3219
|
+
g.original.version === "v2" ? (y(), Y(c, {
|
|
3183
3220
|
key: 0,
|
|
3184
3221
|
size: "sm",
|
|
3185
3222
|
label: "V2",
|
|
3186
3223
|
variant: "info"
|
|
3187
|
-
})) :
|
|
3188
|
-
|
|
3224
|
+
})) : T("", !0),
|
|
3225
|
+
h(c, {
|
|
3189
3226
|
size: "sm",
|
|
3190
|
-
label: S(
|
|
3191
|
-
variant:
|
|
3227
|
+
label: S(g.status),
|
|
3228
|
+
variant: b(g.status)
|
|
3192
3229
|
}, null, 8, ["label", "variant"])
|
|
3193
|
-
], 10,
|
|
3194
|
-
p(
|
|
3195
|
-
n(t).applyErrors.has(
|
|
3196
|
-
|
|
3230
|
+
], 10, Ji),
|
|
3231
|
+
p(g.recipeId) ? (y(), E(X, { key: 0 }, [
|
|
3232
|
+
n(t).applyErrors.has(g.recipeId) ? (y(), E("div", Qi, [
|
|
3233
|
+
h(N, {
|
|
3197
3234
|
type: "error",
|
|
3198
|
-
message: n(t).applyErrors.get(
|
|
3235
|
+
message: n(t).applyErrors.get(g.recipeId)
|
|
3199
3236
|
}, null, 8, ["message"])
|
|
3200
|
-
])) :
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
key:
|
|
3204
|
-
class:
|
|
3205
|
-
"text-fm-color-typo-secondary":
|
|
3206
|
-
"line-through text-fm-color-error font-medium":
|
|
3207
|
-
"text-fm-color-success font-medium":
|
|
3237
|
+
])) : T("", !0),
|
|
3238
|
+
v("div", Xi, [
|
|
3239
|
+
g.projected ? (k.value.get(g.recipeId) ?? []).length > 0 ? (y(!0), E(X, { key: 1 }, me(k.value.get(g.recipeId), (B, F) => (y(), E("span", {
|
|
3240
|
+
key: F,
|
|
3241
|
+
class: Ce(["fm-typo-en-body-sm-400", {
|
|
3242
|
+
"text-fm-color-typo-secondary": B.kind === "unchanged",
|
|
3243
|
+
"line-through text-fm-color-error font-medium": B.kind === "removed",
|
|
3244
|
+
"text-fm-color-success font-medium": B.kind === "added"
|
|
3208
3245
|
}])
|
|
3209
|
-
},
|
|
3210
|
-
key:
|
|
3246
|
+
}, U(B.text), 3))), 128)) : (y(), E("span", Zi, U(n(d)("inventory.recipe.bulkEditor.summary.emptyBindings")), 1)) : (y(!0), E(X, { key: 0 }, me(C(g.original), (B, F) => (y(), E("span", {
|
|
3247
|
+
key: F,
|
|
3211
3248
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-placeholder"
|
|
3212
|
-
},
|
|
3249
|
+
}, U(B.text), 1))), 128))
|
|
3213
3250
|
]),
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3251
|
+
v("div", el, [
|
|
3252
|
+
g.counts.applied > 0 ? (y(), E("span", tl, U(n(d)("inventory.recipe.bulkEditor.summary.footerApplied", { count: g.counts.applied })), 1)) : T("", !0),
|
|
3253
|
+
g.counts.satisfied > 0 ? (y(), E("span", nl, U(n(d)("inventory.recipe.bulkEditor.summary.footerSatisfied", { count: g.counts.satisfied })), 1)) : T("", !0),
|
|
3254
|
+
g.counts.ignored > 0 ? (y(), E("span", ol, U(n(d)("inventory.recipe.bulkEditor.summary.footerIgnored", { count: g.counts.ignored })), 1)) : T("", !0),
|
|
3255
|
+
g.counts.blocked > 0 ? (y(), E("span", il, U(n(d)("inventory.recipe.bulkEditor.summary.footerBlocked", { count: g.counts.blocked })), 1)) : T("", !0),
|
|
3256
|
+
g.counts.applied === 0 && g.counts.satisfied === 0 && g.counts.ignored === 0 && g.counts.blocked === 0 ? (y(), E("span", ll, U(n(d)("inventory.recipe.bulkEditor.summary.noChangesDetail")), 1)) : T("", !0)
|
|
3220
3257
|
])
|
|
3221
|
-
], 64)) :
|
|
3258
|
+
], 64)) : T("", !0)
|
|
3222
3259
|
]))), 128))
|
|
3223
3260
|
]);
|
|
3224
3261
|
};
|
|
3225
3262
|
}
|
|
3226
|
-
}),
|
|
3263
|
+
}), al = { class: "flex items-center gap-12" }, sl = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, dl = {
|
|
3227
3264
|
key: 0,
|
|
3228
3265
|
class: "h-[calc(98vh-120px)] overflow-hidden flex flex-col"
|
|
3229
|
-
},
|
|
3266
|
+
}, ul = {
|
|
3230
3267
|
key: 1,
|
|
3231
3268
|
class: "h-[calc(98vh-120px)] overflow-hidden flex flex-col"
|
|
3232
|
-
},
|
|
3269
|
+
}, cl = {
|
|
3233
3270
|
key: 2,
|
|
3234
3271
|
class: "h-[calc(98vh-120px)] overflow-y-auto px-24 py-20"
|
|
3235
|
-
},
|
|
3272
|
+
}, pl = {
|
|
3236
3273
|
key: 0,
|
|
3237
3274
|
class: "flex items-center gap-8 px-4"
|
|
3238
|
-
},
|
|
3275
|
+
}, ml = {
|
|
3239
3276
|
key: 1,
|
|
3240
3277
|
class: "flex items-center gap-8 px-4"
|
|
3241
|
-
},
|
|
3278
|
+
}, fl = {
|
|
3242
3279
|
key: 2,
|
|
3243
3280
|
class: "flex items-center gap-8 px-4"
|
|
3244
|
-
},
|
|
3281
|
+
}, vl = /* @__PURE__ */ le({
|
|
3245
3282
|
__name: "RecipeBulkEditorDialog",
|
|
3246
3283
|
props: {
|
|
3247
3284
|
show: { type: Boolean }
|
|
3248
3285
|
},
|
|
3249
3286
|
emits: ["update:show"],
|
|
3250
3287
|
setup(m, { emit: d }) {
|
|
3251
|
-
const l = m, { t } =
|
|
3252
|
-
function
|
|
3288
|
+
const l = m, { t } = ie(), i = ge(), r = Ge(l, "show"), x = Le(), u = A(() => i.currentStep === 1), o = A(() => i.currentStep === 2), s = A(() => i.currentStep === 3);
|
|
3289
|
+
function a() {
|
|
3253
3290
|
i.currentStep = 2;
|
|
3254
3291
|
}
|
|
3255
3292
|
function p() {
|
|
@@ -3262,7 +3299,7 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3262
3299
|
i.backToStep2();
|
|
3263
3300
|
}
|
|
3264
3301
|
function I() {
|
|
3265
|
-
|
|
3302
|
+
x.open({
|
|
3266
3303
|
title: t("inventory.recipe.bulkEditor.step3.confirmTitle"),
|
|
3267
3304
|
message: t("inventory.recipe.bulkEditor.step3.confirmMessage"),
|
|
3268
3305
|
primaryActions: {
|
|
@@ -3279,14 +3316,14 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3279
3316
|
});
|
|
3280
3317
|
}
|
|
3281
3318
|
function f() {
|
|
3282
|
-
|
|
3319
|
+
r.value = !1, i.reset();
|
|
3283
3320
|
}
|
|
3284
|
-
return (
|
|
3285
|
-
const
|
|
3286
|
-
return
|
|
3287
|
-
modelValue: n(
|
|
3321
|
+
return (k, S) => {
|
|
3322
|
+
const b = G("FmChip"), e = G("FmButton"), V = G("FmDialog");
|
|
3323
|
+
return y(), Y(V, {
|
|
3324
|
+
modelValue: n(r),
|
|
3288
3325
|
"onUpdate:modelValue": [
|
|
3289
|
-
S[0] || (S[0] = (c) => De(
|
|
3326
|
+
S[0] || (S[0] = (c) => De(r) ? r.value = c : null),
|
|
3290
3327
|
S[1] || (S[1] = (c) => {
|
|
3291
3328
|
c || n(i).reset();
|
|
3292
3329
|
})
|
|
@@ -3297,9 +3334,9 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3297
3334
|
"max-height": "98vh"
|
|
3298
3335
|
}, {
|
|
3299
3336
|
"dialog-header": J(() => [
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3337
|
+
v("div", al, [
|
|
3338
|
+
v("span", sl, U(n(t)("inventory.recipe.bulkEditor.title")), 1),
|
|
3339
|
+
h(b, {
|
|
3303
3340
|
size: "sm",
|
|
3304
3341
|
label: n(t)("inventory.recipe.bulkEditor.stepIndicator", { step: n(i).currentStep, total: 3 }),
|
|
3305
3342
|
variant: "neutral"
|
|
@@ -3307,118 +3344,118 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3307
3344
|
])
|
|
3308
3345
|
]),
|
|
3309
3346
|
"dialog-footer": J(() => [
|
|
3310
|
-
u.value ? (
|
|
3311
|
-
|
|
3347
|
+
u.value ? (y(), E("div", pl, [
|
|
3348
|
+
h(e, {
|
|
3312
3349
|
label: n(t)("common.next"),
|
|
3313
3350
|
disabled: !n(i).canGoToStep2,
|
|
3314
|
-
onClick:
|
|
3351
|
+
onClick: a
|
|
3315
3352
|
}, null, 8, ["label", "disabled"]),
|
|
3316
|
-
|
|
3353
|
+
h(e, {
|
|
3317
3354
|
label: n(t)("common.close"),
|
|
3318
3355
|
variant: "tertiary",
|
|
3319
3356
|
onClick: f
|
|
3320
3357
|
}, null, 8, ["label"])
|
|
3321
|
-
])) : o.value ? (
|
|
3322
|
-
|
|
3358
|
+
])) : o.value ? (y(), E("div", ml, [
|
|
3359
|
+
h(e, {
|
|
3323
3360
|
label: n(t)("inventory.recipe.bulkEditor.step2.reviewButton"),
|
|
3324
3361
|
disabled: !n(i).canGoToStep3,
|
|
3325
3362
|
onClick: $
|
|
3326
3363
|
}, null, 8, ["label", "disabled"]),
|
|
3327
|
-
|
|
3364
|
+
h(e, {
|
|
3328
3365
|
label: n(t)("common.back"),
|
|
3329
3366
|
variant: "secondary",
|
|
3330
3367
|
onClick: p
|
|
3331
3368
|
}, null, 8, ["label"]),
|
|
3332
|
-
|
|
3369
|
+
h(e, {
|
|
3333
3370
|
label: n(t)("common.close"),
|
|
3334
3371
|
variant: "tertiary",
|
|
3335
3372
|
onClick: f
|
|
3336
3373
|
}, null, 8, ["label"])
|
|
3337
|
-
])) : s.value ? (
|
|
3338
|
-
|
|
3374
|
+
])) : s.value ? (y(), E("div", fl, [
|
|
3375
|
+
h(e, {
|
|
3339
3376
|
label: n(t)("inventory.recipe.bulkEditor.step3.confirmButton"),
|
|
3340
3377
|
disabled: n(i).isSaving,
|
|
3341
3378
|
loading: n(i).isSaving,
|
|
3342
3379
|
onClick: I
|
|
3343
3380
|
}, null, 8, ["label", "disabled", "loading"]),
|
|
3344
|
-
|
|
3381
|
+
h(e, {
|
|
3345
3382
|
label: n(t)("common.back"),
|
|
3346
3383
|
variant: "secondary",
|
|
3347
3384
|
disabled: n(i).isSaving,
|
|
3348
3385
|
onClick: C
|
|
3349
3386
|
}, null, 8, ["label", "disabled"]),
|
|
3350
|
-
|
|
3387
|
+
h(e, {
|
|
3351
3388
|
label: n(t)("common.close"),
|
|
3352
3389
|
variant: "tertiary",
|
|
3353
3390
|
disabled: n(i).isSaving,
|
|
3354
3391
|
onClick: f
|
|
3355
3392
|
}, null, 8, ["label", "disabled"])
|
|
3356
|
-
])) :
|
|
3393
|
+
])) : T("", !0)
|
|
3357
3394
|
]),
|
|
3358
3395
|
default: J(() => [
|
|
3359
|
-
u.value ? (
|
|
3360
|
-
|
|
3361
|
-
])) : o.value ? (
|
|
3362
|
-
|
|
3363
|
-
])) : s.value ? (
|
|
3364
|
-
|
|
3365
|
-
])) :
|
|
3396
|
+
u.value ? (y(), E("div", dl, [
|
|
3397
|
+
h(Oo)
|
|
3398
|
+
])) : o.value ? (y(), E("div", ul, [
|
|
3399
|
+
h(Fi)
|
|
3400
|
+
])) : s.value ? (y(), E("div", cl, [
|
|
3401
|
+
h(rl)
|
|
3402
|
+
])) : T("", !0)
|
|
3366
3403
|
]),
|
|
3367
3404
|
_: 1
|
|
3368
3405
|
}, 8, ["modelValue"]);
|
|
3369
3406
|
};
|
|
3370
3407
|
}
|
|
3371
3408
|
});
|
|
3372
|
-
function
|
|
3409
|
+
function yl(m) {
|
|
3373
3410
|
return !m || Object.keys(m).length === 0 ? "" : Object.entries(m).map(([d, l]) => `${d}: ${l}`).join(", ");
|
|
3374
3411
|
}
|
|
3375
|
-
function
|
|
3376
|
-
const m = ne(), d = m.recipes, l = m.recipeById, t = m.skuById, i = m.skuGroupById,
|
|
3412
|
+
function bl() {
|
|
3413
|
+
const m = ne(), d = m.recipes, l = m.recipeById, t = m.skuById, i = m.skuGroupById, r = d.flatMap((o, s) => {
|
|
3377
3414
|
var p;
|
|
3378
|
-
const
|
|
3415
|
+
const a = yl(o.customAttributes);
|
|
3379
3416
|
if ((p = o.contains) != null && p.length) {
|
|
3380
3417
|
const $ = o.contains.filter((f) => f.type === "RECIPE"), C = o.contains.filter((f) => f.type === "SKU"), I = o.contains.filter((f) => f.type === "SKU_GROUP");
|
|
3381
3418
|
return [
|
|
3382
3419
|
...s === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
3383
3420
|
...$.map(
|
|
3384
|
-
(f,
|
|
3421
|
+
(f, k) => {
|
|
3385
3422
|
var S;
|
|
3386
3423
|
return [
|
|
3387
|
-
|
|
3424
|
+
k === 0 ? o.name : "",
|
|
3388
3425
|
"RECIPE",
|
|
3389
3426
|
"",
|
|
3390
3427
|
(S = l[f.id]) == null ? void 0 : S.name,
|
|
3391
3428
|
Q(f.amount),
|
|
3392
3429
|
"UNIT",
|
|
3393
|
-
|
|
3430
|
+
k === 0 ? a : ""
|
|
3394
3431
|
];
|
|
3395
3432
|
}
|
|
3396
3433
|
),
|
|
3397
3434
|
...C.map(
|
|
3398
|
-
(f,
|
|
3399
|
-
var S,
|
|
3435
|
+
(f, k) => {
|
|
3436
|
+
var S, b, e, V;
|
|
3400
3437
|
return [
|
|
3401
|
-
!$.length &&
|
|
3438
|
+
!$.length && k === 0 ? o.name : "",
|
|
3402
3439
|
"INGREDIENT",
|
|
3403
3440
|
(S = t[f.id]) == null ? void 0 : S.code,
|
|
3404
|
-
(
|
|
3441
|
+
(b = t[f.id]) == null ? void 0 : b.name,
|
|
3405
3442
|
Q(f.amount),
|
|
3406
3443
|
f.measurement ? f.measurement.abbrev : (V = (e = t[f.id]) == null ? void 0 : e.unit) == null ? void 0 : V.abbrev,
|
|
3407
|
-
!$.length &&
|
|
3444
|
+
!$.length && k === 0 ? a : ""
|
|
3408
3445
|
];
|
|
3409
3446
|
}
|
|
3410
3447
|
),
|
|
3411
3448
|
...I.map(
|
|
3412
|
-
(f,
|
|
3413
|
-
var S,
|
|
3449
|
+
(f, k) => {
|
|
3450
|
+
var S, b;
|
|
3414
3451
|
return [
|
|
3415
|
-
$.length === 0 && C.length === 0 &&
|
|
3452
|
+
$.length === 0 && C.length === 0 && k === 0 ? o.name : "",
|
|
3416
3453
|
"SKU_GROUP",
|
|
3417
3454
|
((S = i[f.id]) == null ? void 0 : S.ref) || "",
|
|
3418
|
-
(
|
|
3455
|
+
(b = i[f.id]) == null ? void 0 : b.name,
|
|
3419
3456
|
Q(f.amount),
|
|
3420
3457
|
"UNIT",
|
|
3421
|
-
$.length === 0 && C.length === 0 &&
|
|
3458
|
+
$.length === 0 && C.length === 0 && k === 0 ? a : ""
|
|
3422
3459
|
];
|
|
3423
3460
|
}
|
|
3424
3461
|
)
|
|
@@ -3426,27 +3463,27 @@ function pl() {
|
|
|
3426
3463
|
}
|
|
3427
3464
|
return [
|
|
3428
3465
|
...s === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
3429
|
-
[o.name, "No bindings", "", "", "", "",
|
|
3466
|
+
[o.name, "No bindings", "", "", "", "", a]
|
|
3430
3467
|
];
|
|
3431
|
-
}), u =
|
|
3468
|
+
}), u = at(r, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
|
|
3432
3469
|
st(u, `RECIPE_${dt(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
|
|
3433
3470
|
}
|
|
3434
|
-
const
|
|
3471
|
+
const gl = { class: "flex flex-col py-8" }, _l = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, kl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Hl = /* @__PURE__ */ le({
|
|
3435
3472
|
__name: "RecipeView",
|
|
3436
3473
|
setup(m) {
|
|
3437
|
-
const d = ne(), l =
|
|
3438
|
-
|
|
3474
|
+
const d = ne(), l = A(() => d.recipes), t = tt(), { createRecipe: i, updateRecipe: r } = ze(), { recipeDialogProps: x, recipeViewLoading: u } = Et(ze()), { columnDefs: o, formatRowData: s } = Jt(), a = A(() => s(l.value)), p = ge(), $ = We();
|
|
3475
|
+
W(!1);
|
|
3439
3476
|
function C(c) {
|
|
3440
3477
|
if (c === "add")
|
|
3441
3478
|
return i();
|
|
3442
3479
|
if (c === "export")
|
|
3443
|
-
return
|
|
3480
|
+
return bl();
|
|
3444
3481
|
c === "bulk-edit" && p.openDialog();
|
|
3445
3482
|
}
|
|
3446
|
-
const I =
|
|
3447
|
-
return (c,
|
|
3448
|
-
const
|
|
3449
|
-
return
|
|
3483
|
+
const I = W(""), f = A(() => u.value), { breakpoints: k } = xt(), S = A(() => k.value.xs || k.value.sm), b = A(() => S.value ? 10 : 20), e = Ct(), { t: V } = ie();
|
|
3484
|
+
return (c, _) => {
|
|
3485
|
+
const N = G("FmTable");
|
|
3486
|
+
return y(), Y(Bt, {
|
|
3450
3487
|
title: n(V)("inventory.recipe.title"),
|
|
3451
3488
|
actions: [
|
|
3452
3489
|
{
|
|
@@ -3461,8 +3498,8 @@ const ml = { class: "flex flex-col py-8" }, fl = { class: "fm-typo-en-body-lg-60
|
|
|
3461
3498
|
"onClick:action": C
|
|
3462
3499
|
}, {
|
|
3463
3500
|
default: J(() => [
|
|
3464
|
-
|
|
3465
|
-
class:
|
|
3501
|
+
v("div", {
|
|
3502
|
+
class: Ce([
|
|
3466
3503
|
"flex flex-col gap-8 max-h-full",
|
|
3467
3504
|
{
|
|
3468
3505
|
"p-0": S.value,
|
|
@@ -3470,40 +3507,40 @@ const ml = { class: "flex flex-col py-8" }, fl = { class: "fm-typo-en-body-lg-60
|
|
|
3470
3507
|
}
|
|
3471
3508
|
])
|
|
3472
3509
|
}, [
|
|
3473
|
-
|
|
3510
|
+
h(jt, {
|
|
3474
3511
|
searchable: "",
|
|
3475
3512
|
search: I.value,
|
|
3476
|
-
"onUpdate:search":
|
|
3513
|
+
"onUpdate:search": _[0] || (_[0] = (z) => I.value = z)
|
|
3477
3514
|
}, null, 8, ["search"]),
|
|
3478
|
-
(
|
|
3515
|
+
(y(), Y(N, {
|
|
3479
3516
|
style: vt(n(e).tableHeight),
|
|
3480
3517
|
"column-defs": n(o),
|
|
3481
|
-
"row-data":
|
|
3518
|
+
"row-data": a.value,
|
|
3482
3519
|
"search-value": I.value,
|
|
3483
3520
|
loading: !n(t)._currentLocation || f.value,
|
|
3484
|
-
onRowClick:
|
|
3521
|
+
onRowClick: _[1] || (_[1] = (z) => n(r)(z.original.original)),
|
|
3485
3522
|
key: l.value.length,
|
|
3486
|
-
"page-size":
|
|
3523
|
+
"page-size": b.value
|
|
3487
3524
|
}, {
|
|
3488
|
-
"list-row": J((
|
|
3489
|
-
|
|
3490
|
-
row:
|
|
3491
|
-
onRowClick: (
|
|
3525
|
+
"list-row": J((z) => [
|
|
3526
|
+
h(Lt, {
|
|
3527
|
+
row: z,
|
|
3528
|
+
onRowClick: (g) => n(r)(g.original)
|
|
3492
3529
|
}, {
|
|
3493
|
-
default: J((
|
|
3494
|
-
var
|
|
3530
|
+
default: J((g) => {
|
|
3531
|
+
var B, F, R, P, K, H, ee, O, M, L;
|
|
3495
3532
|
return [
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
render: (
|
|
3500
|
-
props: (
|
|
3533
|
+
v("div", gl, [
|
|
3534
|
+
v("div", _l, [
|
|
3535
|
+
h(n(Qe), {
|
|
3536
|
+
render: (R = (F = (B = g.recipe) == null ? void 0 : B.column) == null ? void 0 : F.columnDef) == null ? void 0 : R.cell,
|
|
3537
|
+
props: (K = (P = g.recipe) == null ? void 0 : P.getContext) == null ? void 0 : K.call(P)
|
|
3501
3538
|
}, null, 8, ["render", "props"])
|
|
3502
3539
|
]),
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
render: (
|
|
3506
|
-
props: (
|
|
3540
|
+
v("div", kl, [
|
|
3541
|
+
h(n(Qe), {
|
|
3542
|
+
render: (O = (ee = (H = g.ingredients) == null ? void 0 : H.column) == null ? void 0 : ee.columnDef) == null ? void 0 : O.cell,
|
|
3543
|
+
props: (L = (M = g.ingredients) == null ? void 0 : M.getContext) == null ? void 0 : L.call(M)
|
|
3507
3544
|
}, null, 8, ["render", "props"])
|
|
3508
3545
|
])
|
|
3509
3546
|
])
|
|
@@ -3515,13 +3552,13 @@ const ml = { class: "flex flex-col py-8" }, fl = { class: "fm-typo-en-body-lg-60
|
|
|
3515
3552
|
_: 1
|
|
3516
3553
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
3517
3554
|
], 2),
|
|
3518
|
-
(
|
|
3519
|
-
|
|
3520
|
-
n($).enableBulkEditRecipes ? (
|
|
3555
|
+
(y(), Y(yt, { to: "body" }, [
|
|
3556
|
+
h(vo, bt(gt(n(x))), null, 16),
|
|
3557
|
+
n($).enableBulkEditRecipes ? (y(), Y(vl, {
|
|
3521
3558
|
key: 0,
|
|
3522
3559
|
show: n(p).show,
|
|
3523
|
-
"onUpdate:show":
|
|
3524
|
-
}, null, 8, ["show"])) :
|
|
3560
|
+
"onUpdate:show": _[2] || (_[2] = (z) => n(p).show = z)
|
|
3561
|
+
}, null, 8, ["show"])) : T("", !0)
|
|
3525
3562
|
]))
|
|
3526
3563
|
]),
|
|
3527
3564
|
_: 1
|
|
@@ -3530,5 +3567,5 @@ const ml = { class: "flex flex-col py-8" }, fl = { class: "fm-typo-en-body-lg-60
|
|
|
3530
3567
|
}
|
|
3531
3568
|
});
|
|
3532
3569
|
export {
|
|
3533
|
-
|
|
3570
|
+
Hl as default
|
|
3534
3571
|
};
|