@feedmepos/mf-inventory-portal 1.5.10 → 1.5.11-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-erqZSd0c.js → App-CquCiNsy.js} +4 -4
- package/dist/{ApprovalView-C2CGthqi.js → ApprovalView-CU-k06kj.js} +7 -7
- package/dist/{BindingsDialog-Cw6MdCbI.js → BindingsDialog-BPBKfeS6.js} +2 -2
- package/dist/{BindingsPicker-CcSrxhUo.js → BindingsPicker-DkBI7_0Y.js} +2 -2
- package/dist/{BindingsTable-C5nMju9L.js → BindingsTable-C22g1gV7.js} +3 -3
- package/dist/{ClosingDraftView-C_Loim5S.js → ClosingDraftView-DgHvcVne.js} +15 -15
- package/dist/ClosingHistoryView-Cjm39o7e.js +1114 -0
- package/dist/{ClosingTemplateView-PQdTcIFY.js → ClosingTemplateView-BfO_HZS-.js} +14 -14
- package/dist/{DefaultView-BIlFmXaB.js → DefaultView-Jl_IdT_Z.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-BhT1YxRZ.js → DeliveryOrderPrintPreview-CaWTHT6h.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DO7xvy5V.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BXmbD4jZ.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Bf6RHJdQ.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DWm36ZgX.js} +2 -2
- package/dist/{FmMultiselectDialog-cXV6Jo4B.js → FmMultiselectDialog-CEsqNTCq.js} +2 -2
- package/dist/{FmMultiselectDialog-B-X6WQXu.js → FmMultiselectDialog-D4gqa0tb.js} +1 -1
- package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-4NtlySGX.js +388 -0
- package/dist/{ImportView-B3jO8aU8.js → ImportView-GTiAyijj.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-GPVWrmed.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BHRq2v-2.js} +1 -1
- package/dist/{IngredientGroupView-BuUoHLDb.js → IngredientGroupView-Kk002hXi.js} +5 -5
- package/dist/{IngredientsView-Dq_YrtQ5.js → IngredientsView-8Dojrj1e.js} +15 -15
- package/dist/{IntegrationExplorerView-Dh5ZPJK-.js → IntegrationExplorerView-BVBqUc3k.js} +352 -352
- package/dist/{IntegrationView-DWbHZdc4.js → IntegrationView-eS-LnDeu.js} +13 -13
- package/dist/{InventoryBindingForm-D-EN8Tpz.js → InventoryBindingForm-DitsFH4v.js} +1 -1
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DncMbF6J.js +429 -0
- package/dist/{InventoryBindingSummary-BTagfxn1.js → InventoryBindingSummary-DIKZ_7lC.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BUBHDMNn.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DJV_hhgt.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D2B20Qv0.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Pjde4sd6.js} +1 -1
- package/dist/{PublishView-CpiWv2n6.js → PublishView-CTwkJWJj.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-Czi5Aip0.js → PurchaseOrderPrintPreview-BuP85XCw.js} +2 -2
- package/dist/{ReceiveRequestView-BVEU4j9p.js → ReceiveRequestView-CfWhi-qh.js} +9631 -9552
- package/dist/{RecipeView-OVmWTAt-.js → RecipeView-CaNmJwqf.js} +1316 -1291
- package/dist/{SettingsView-CMQLojRr.js → SettingsView-DiMxunWj.js} +4 -4
- package/dist/{StockView-DZeeZlJq.js → StockView-CWDb29Cp.js} +19 -19
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bf1b1rJK.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-0MNUfMmq.js} +1 -1
- package/dist/{SupplierView-BcmkfFvI.js → SupplierView-CLB-ASht.js} +12 -12
- package/dist/{SurchargeView-DhcatJUO.js → SurchargeView-C2clhhAW.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-D6bwhx8Z.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DF-LJ-3w.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-4Ti9w_wf.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Ga9lkrf8.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Dw1TIZVj.js → TransferDetails.vue_vue_type_script_setup_true_lang-R1t4S-6H.js} +20 -20
- package/dist/{TransferTemplateView-CRPvLRHd.js → TransferTemplateView-7lXzFWv2.js} +18 -18
- package/dist/{UnitCostHistoryView-B4pAplGT.js → UnitCostHistoryView-CZg_dxvk.js} +4 -4
- package/dist/UnitDisplayControl.vue_vue_type_script_setup_true_lang-BB3dV6Gh.js +160 -0
- package/dist/{UnitView-95-cARn9.js → UnitView-BnZ_3MwD.js} +7 -7
- package/dist/{WarehouseView-o1FxslRs.js → WarehouseView-D7j9qMqP.js} +5 -5
- package/dist/{WastageTemplateView-D3hu-bq0.js → WastageTemplateView-Cl_9lPqx.js} +14 -14
- package/dist/{app-BEJm79K1.js → app-DMMqtQts.js} +23 -11
- package/dist/app.d.ts +12 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-BotB3jos.js → closing-template-CiSNSKyE.js} +1 -1
- package/dist/{date2-CnEklTL8.js → date2-Db-IPmri.js} +1 -1
- package/dist/{dayjs.min-CUR65wqq.js → dayjs.min-DD2BO69F.js} +1 -1
- package/dist/{decimal-CV_OL7iL.js → decimal-Ds6h3ukt.js} +2 -2
- package/dist/{defineDeepModel-D7NJvnaz.js → defineDeepModel-BgonxmUi.js} +1 -1
- package/dist/{duplicate-template-DCaAVNSG.js → duplicate-template-L6x61phF.js} +1 -1
- package/dist/{feature-BpZTiO4W.js → feature-C0UUWbkT.js} +2 -2
- package/dist/{format-time-from-id-Awu23hHz.js → format-time-from-id-lrFC2RMu.js} +1 -1
- package/dist/{format-unit-display-B2_RGXzk.js → format-unit-display-CpwFmpcL.js} +11 -11
- package/dist/{import-export.helper-BuNDvFsc.js → import-export.helper-BtXLvHMF.js} +6 -6
- package/dist/{index-BBqEhoS9.js → index-Cej2xM-2.js} +1 -1
- package/dist/{index-BK75WSFH.js → index-CxALGEZr.js} +3 -3
- package/dist/{index-D_u-AkFp.js → index-mtJ1GhRU.js} +1 -1
- package/dist/{inventory-core-dart.default-D_hfcDPc.js → inventory-core-dart.default-CroeeGeI.js} +1 -1
- package/dist/{lz-string-K7l_8Og1.js → lz-string-TL3mT9nT.js} +1 -1
- package/dist/{netsuite-CPUKn7UQ.js → netsuite-DOpNemik.js} +2 -2
- package/dist/{number-DoYjk_zN.js → number-DlYhqTV5.js} +3 -3
- package/dist/{predefined-templates-CEDkdeWc.js → predefined-templates-DDpVS07Q.js} +1 -1
- package/dist/{purchase-order-template-ChZyiCwx.js → purchase-order-template-K6HvK5h0.js} +1 -1
- package/dist/{recalculationUtils-CEkm9-mp.js → recalculationUtils-BHomSQPu.js} +1 -1
- package/dist/{rules-DDjcQi_O.js → rules-r7ubhhR0.js} +2 -2
- package/dist/{stock-Voq2gMuS.js → stock-BcLy5Ilr.js} +1 -1
- package/dist/{supplier-DFopX4OU.js → supplier-rNHLA7rt.js} +2 -2
- package/dist/{surcharge-CjwbPJQi.js → surcharge-B5N4UzQl.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-CHnn3ILl.js → uom-rules-B51fYVj3.js} +1 -1
- package/dist/{use-ingredient-select-dialog-DS6__LXy.js → use-ingredient-select-dialog-C7NY9Kj6.js} +2 -2
- package/dist/{use-inventory-binding-dialog-DcJJo3Lr.js → use-inventory-binding-dialog-Ca4VaXkz.js} +2 -2
- package/dist/{use-template-enabled-locations-BVs_0JOA.js → use-template-enabled-locations-RiR-qhSs.js} +2 -2
- package/dist/{use-transfer-locations-Dzp5fj3Z.js → use-transfer-locations-csQ1Ar0m.js} +2 -2
- package/dist/{useHrmPermission-DQQ5MYsL.js → useHrmPermission-DHcinOeI.js} +1 -1
- package/dist/{useNavigationMenu-msCIV-Ux.js → useNavigationMenu-u8V59Vtc.js} +2 -2
- package/dist/{useSseClient-cer6d2VA.js → useSseClient-UQLgDoDc.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-BiedKAFs.js → vue-i18n-CD-rDdDv.js} +534 -534
- package/dist/{xlsx-DGn-BAF9.js → xlsx-BRq0kYfc.js} +1 -1
- package/dist/{xlsx.util-DXnaPoeW.js → xlsx.util-ylgVcZid.js} +3 -3
- package/package.json +2 -2
- package/dist/ClosingHistoryView-7TcMNjKb.js +0 -1108
- package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-BHazP1jS.js +0 -362
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CI4hutH2.js +0 -404
- package/dist/UnitDisplayControl.vue_vue_type_script_setup_true_lang-D3OGljNP.js +0 -137
- package/dist/export-HmzdllkU.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 b, createElementBlock as V, Fragment as X, createElementVNode as v, toDisplayString as U, createVNode as h, createCommentVNode as T, computed as R, watch as ue, unref as n, normalizeClass as Be, 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-DMMqtQts.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-BHRq2v-2.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
|
|
10
|
+
import { a as Q, c as Ke } from "./number-DlYhqTV5.js";
|
|
11
|
+
import { useI18n as ie, useCoreStore as St } from "@feedmepos/mf-common";
|
|
12
12
|
import { u as Bt, _ as Ct } 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-
|
|
14
|
-
import { _ as At } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-
|
|
15
|
-
import { a as Pe } from "./FmMultiselectDialog-
|
|
16
|
-
import { d as
|
|
13
|
+
import { b as it, c as qe, I as Ft, A as Ne, U as lt, R as Rt } from "./rules-r7ubhhR0.js";
|
|
14
|
+
import { _ as At } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-DncMbF6J.js";
|
|
15
|
+
import { a as Pe } from "./FmMultiselectDialog-CEsqNTCq.js";
|
|
16
|
+
import { d as rt } from "./defineDeepModel-BgonxmUi.js";
|
|
17
17
|
import { L as Tt, P as Ut, D as Pt } from "./app-DiX-EfV6.js";
|
|
18
|
-
import { _ as Ce, c as Mt, d as Dt, e as ye } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-
|
|
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 Ce, c as Mt, d as Dt, e as ye } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-4NtlySGX.js";
|
|
19
|
+
import { u as Gt } from "./FmMultiselectDialog-D4gqa0tb.js";
|
|
20
|
+
import { u as Nt } from "./vue-i18n-CD-rDdDv.js";
|
|
21
|
+
import { F as zt } from "./inventory-core-dart.default-CroeeGeI.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-C0UUWbkT.js";
|
|
24
|
+
import { F as he } from "./decimal-Ds6h3ukt.js";
|
|
25
|
+
import { _ as Fe } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BXmbD4jZ.js";
|
|
26
|
+
import { b as at, d as st } from "./xlsx.util-ylgVcZid.js";
|
|
27
|
+
import { f as dt } from "./date2-Db-IPmri.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-DWm36ZgX.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 b(),
|
|
53
|
-
|
|
54
|
-
t.value ? (b(),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
return b(), V(X, null, [
|
|
53
|
+
v("p", null, U(r.message), 1),
|
|
54
|
+
t.value ? (b(), V("div", Kt, [
|
|
55
|
+
h(u),
|
|
56
|
+
v("div", null, [
|
|
57
|
+
h(o, { size: "xl" })
|
|
58
58
|
]),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
])) : (b(),
|
|
62
|
-
|
|
63
|
-
l.value.length > 0 ? (b(),
|
|
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
|
+
])) : (b(), V("div", qt, [
|
|
62
|
+
x[2] || (x[2] = v("br", null, null, -1)),
|
|
63
|
+
l.value.length > 0 ? (b(), V("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,14 +109,14 @@ 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
|
-
var
|
|
114
|
+
var B;
|
|
115
115
|
return {
|
|
116
116
|
chain: [
|
|
117
117
|
{
|
|
118
118
|
itemName: $.name,
|
|
119
|
-
moduleKey: (
|
|
119
|
+
moduleKey: (B = $.message) != null && B.startsWith("modules.") ? wt($.message) : $.module
|
|
120
120
|
}
|
|
121
121
|
]
|
|
122
122
|
};
|
|
@@ -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
|
|
185
|
-
(
|
|
186
|
-
), $ = o.filter((
|
|
183
|
+
function r(o, s) {
|
|
184
|
+
const a = o.filter((B) => B.type === be.enum.SKU), p = o.filter(
|
|
185
|
+
(B) => B.type === be.enum.SKU_GROUP
|
|
186
|
+
), $ = o.filter((B) => B.type === be.enum.RECIPE);
|
|
187
187
|
return [
|
|
188
|
-
...
|
|
189
|
-
...p.map((
|
|
190
|
-
...$.filter((
|
|
191
|
-
(
|
|
188
|
+
...a.map((B) => ({ ...B, recipeIds: [...s] })),
|
|
189
|
+
...p.map((B) => ({ ...B, isGroup: !0, recipeIds: [...s] })),
|
|
190
|
+
...$.filter((B) => l.recipeById[B.id] && !s.has(B.id)).flatMap(
|
|
191
|
+
(B) => r(l.recipeById[B.id].contains, /* @__PURE__ */ new Set([...s, B.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,44 +224,44 @@ 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
|
|
227
|
+
return o.map((a) => ({
|
|
228
|
+
recipe: a.name,
|
|
229
|
+
ingredients: r(a.contains, /* @__PURE__ */ new Set([a._id])).map((p) => {
|
|
230
|
+
var B, I, f, k, S, y;
|
|
231
231
|
if (p.isGroup) {
|
|
232
232
|
const e = s.skuGroupById[p.id];
|
|
233
|
-
return p.recipeIds.slice(1).length ? `(${(
|
|
233
|
+
return p.recipeIds.slice(1).length ? `(${(B = s.recipeById[p.recipeIds.at(-1) ?? ""]) == null ? void 0 : B.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) ?? ((y = $ == null ? void 0 : $.unit) == null ? void 0 : y.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(
|
|
256
|
-
})),
|
|
257
|
-
(
|
|
258
|
-
).map((
|
|
249
|
+
for (const k of m.skus)
|
|
250
|
+
!o.some((y) => y === k._id) && k._id !== u && !((f = (I = k.convert) == null ? void 0 : I.inventoryBindings) != null && f.some((y) => y.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
|
+
})), B = $.filter(
|
|
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,
|
|
262
262
|
contentComponentProps: {
|
|
263
263
|
items: $,
|
|
264
|
-
modelValue:
|
|
264
|
+
modelValue: B,
|
|
265
265
|
virtualScroll: !0
|
|
266
266
|
},
|
|
267
267
|
primaryActions: {
|
|
@@ -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((y) => k.find((e) => e._id === y.id)),
|
|
280
|
+
...k.filter((y) => !r.find((e) => e.id === y._id)).map((y) => ({
|
|
281
281
|
type: "SKU",
|
|
282
|
-
id:
|
|
282
|
+
id: y._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(
|
|
293
|
-
var
|
|
294
|
-
const o =
|
|
292
|
+
async function t(r, x, u = []) {
|
|
293
|
+
var B;
|
|
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 = ((
|
|
298
|
-
(e) => e.bindingPaths.some((
|
|
297
|
+
const f = ((B = m.recipeBindingFlattenCache[I._id]) == null ? void 0 : B.inventoryBindings) ?? [], k = f.some(
|
|
298
|
+
(e) => e.bindingPaths.some((E) => u.some((c) => c === E.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((B) => B.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
|
},
|
|
@@ -365,9 +365,9 @@ function Ht() {
|
|
|
365
365
|
variant: "tertiary"
|
|
366
366
|
}
|
|
367
367
|
}).onPrimary(($) => {
|
|
368
|
-
const
|
|
369
|
-
...
|
|
370
|
-
...$.filter((I) => !
|
|
368
|
+
const B = [
|
|
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(B);
|
|
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,64 +396,64 @@ 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 } =
|
|
400
|
-
var
|
|
401
|
-
const p = /* @__PURE__ */ new Map(), $ =
|
|
399
|
+
const l = m, t = d, { t: i } = ie(), r = St(), x = tt(), u = R(() => {
|
|
400
|
+
var B;
|
|
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 && ((B = p.get(f)) == null || B.add(k));
|
|
405
405
|
return p;
|
|
406
406
|
}), o = R(() => [
|
|
407
|
-
...[...u.value.entries()].map(([$,
|
|
407
|
+
...[...u.value.entries()].map(([$, B]) => ({
|
|
408
408
|
type: "string",
|
|
409
409
|
key: $,
|
|
410
410
|
entity: "restaurant",
|
|
411
|
-
values: [...
|
|
411
|
+
values: [...B]
|
|
412
412
|
})),
|
|
413
413
|
{
|
|
414
414
|
type: "string",
|
|
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
|
-
const
|
|
437
|
-
return b(),
|
|
438
|
-
|
|
439
|
-
|
|
436
|
+
const B = G("FmLabel"), I = G("FmFormGroup");
|
|
437
|
+
return b(), V("div", Qt, [
|
|
438
|
+
v("div", Xt, [
|
|
439
|
+
h(B, {
|
|
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 = R(() => +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,
|
|
502
|
-
const p = G("FmTooltip"), $ = G("FmTextField"),
|
|
503
|
-
return b(),
|
|
504
|
-
|
|
501
|
+
return (s, a) => {
|
|
502
|
+
const p = G("FmTooltip"), $ = G("FmTextField"), B = G("FmButton"), I = G("FmIcon"), f = G("FmFormGroup");
|
|
503
|
+
return b(), V("div", Zt, [
|
|
504
|
+
h(f, {
|
|
505
505
|
class: Be(["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) : (b(), V("div", an, [
|
|
538
|
+
h(B, {
|
|
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 ? (b(),
|
|
549
|
-
|
|
548
|
+
s.showError ? (b(), V("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
|
])
|
|
@@ -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 $,
|
|
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 $, B, I, f, k, S;
|
|
786
|
+
const p = ($ = m.bindingAlternatives) == null ? void 0 : $.findIndex((y) => y._id === a);
|
|
787
787
|
return {
|
|
788
|
-
_id:
|
|
789
|
-
trackingMeasurement: typeof p != "number" || p == -1 ? (
|
|
790
|
-
priority: ((S = (
|
|
788
|
+
_id: a,
|
|
789
|
+
trackingMeasurement: typeof p != "number" || p == -1 ? (B = t.skuById[a]) == null ? void 0 : B.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 b(),
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
830
|
+
const a = G("FmLabel"), p = G("FmButton"), $ = G("FmFormGroup"), B = G("FmTable");
|
|
831
|
+
return b(), V("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(B, {
|
|
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 b(),
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
898
|
+
const s = G("FmTooltip"), a = G("FmButton"), p = G("FmFormGroup");
|
|
899
|
+
return b(), V("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(Ce, {
|
|
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) : (b(), V("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),
|
|
@@ -951,14 +951,14 @@ const pn = { class: "flex flex-col gap-16" }, mn = { class: "flex flex-col" }, f
|
|
|
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"])) :
|
|
954
|
+
}, null, 8, ["modelValue", "disabled"])) : T("", !0),
|
|
955
955
|
u.ableToConfigureAlternative ? (b(), 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
|
};
|
|
@@ -989,7 +989,13 @@ 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 = { class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400 px-12 pb-4" }, io = /* @__PURE__ */ le({
|
|
993
999
|
__name: "InventoryBindingFormV2",
|
|
994
1000
|
props: {
|
|
995
1001
|
id: {},
|
|
@@ -1009,7 +1015,7 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1009
1015
|
},
|
|
1010
1016
|
emits: ["update:modelValue", "click:pick-inventory-bindings"],
|
|
1011
1017
|
setup(m, { emit: d }) {
|
|
1012
|
-
const { t: l } =
|
|
1018
|
+
const { t: l } = ie(), t = ne(), i = R(() => t.recipeById), r = R(() => t.skuById), x = R(() => t.skuGroupById), u = m, o = d, s = R(() => kt({
|
|
1013
1019
|
parentId: u.id,
|
|
1014
1020
|
bindings: u.modelValue,
|
|
1015
1021
|
recipes: t.recipes.map((F) => F._id === u.id ? {
|
|
@@ -1023,86 +1029,89 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1023
1029
|
}
|
|
1024
1030
|
} : F),
|
|
1025
1031
|
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 (
|
|
1032
|
+
}).inventoryBindings.filter((F) => "error" in F && F.error).map((F) => F).filter((F) => F.reason === ht.enum.circularDependency)), a = R(
|
|
1033
|
+
() => new Set(s.value.map((g) => {
|
|
1034
|
+
var C;
|
|
1035
|
+
return (C = g.bindingPaths[0]) == null ? void 0 : C.id;
|
|
1030
1036
|
}))
|
|
1031
|
-
), p = R(() => u.modelValue.filter((
|
|
1037
|
+
), p = R(() => u.modelValue.filter((g) => g.type === "RECIPE")), { promptIngredientsBinding: $, promptRecipesBinding: B, promptIngredientGroupsBinding: I } = Ht();
|
|
1032
1038
|
async function f() {
|
|
1033
1039
|
if (u.iframeMode) {
|
|
1034
1040
|
o("click:pick-inventory-bindings", "RECIPE");
|
|
1035
1041
|
return;
|
|
1036
1042
|
}
|
|
1037
|
-
|
|
1043
|
+
B(
|
|
1038
1044
|
u.modelValue,
|
|
1039
|
-
(
|
|
1045
|
+
(g) => o("update:modelValue", g),
|
|
1040
1046
|
u.id ? [u.id] : []
|
|
1041
1047
|
);
|
|
1042
1048
|
}
|
|
1043
|
-
const
|
|
1049
|
+
const k = R(() => u.modelValue.filter((g) => g.type === "SKU_GROUP"));
|
|
1044
1050
|
async function S() {
|
|
1045
1051
|
I(
|
|
1046
1052
|
u.modelValue,
|
|
1047
|
-
(
|
|
1053
|
+
(g) => o("update:modelValue", g),
|
|
1048
1054
|
u.id ? [u.id] : []
|
|
1049
1055
|
);
|
|
1050
1056
|
}
|
|
1051
|
-
function
|
|
1052
|
-
const
|
|
1053
|
-
let
|
|
1054
|
-
|
|
1057
|
+
function y(g, C, F) {
|
|
1058
|
+
const A = +C;
|
|
1059
|
+
let P = F;
|
|
1060
|
+
C.length > 0 && isFinite(A) ? P = F.map((K) => (K.id !== g || (K.amount = Ke(A)), K)) : P = F.map((K) => (K.id !== g || (K.amount = { amount: 0, precision: 0 }), K)), o("update:modelValue", P);
|
|
1055
1061
|
}
|
|
1056
|
-
const e = R(() => u.modelValue.filter((
|
|
1057
|
-
async function
|
|
1062
|
+
const e = R(() => u.modelValue.filter((g) => g.type === "SKU") ?? []);
|
|
1063
|
+
async function E() {
|
|
1058
1064
|
if (u.iframeMode) {
|
|
1059
1065
|
o("click:pick-inventory-bindings", "SKU");
|
|
1060
1066
|
return;
|
|
1061
1067
|
}
|
|
1062
1068
|
$(
|
|
1063
1069
|
u.modelValue,
|
|
1064
|
-
(
|
|
1070
|
+
(g) => o("update:modelValue", g),
|
|
1065
1071
|
u.excludeBindingId,
|
|
1066
1072
|
u.id ? [u.id] : []
|
|
1067
1073
|
);
|
|
1068
1074
|
}
|
|
1069
|
-
function c(
|
|
1070
|
-
const
|
|
1071
|
-
o("update:modelValue",
|
|
1075
|
+
function c(g) {
|
|
1076
|
+
const C = u.modelValue.map((F) => F.id === g.id ? g : F);
|
|
1077
|
+
o("update:modelValue", C);
|
|
1072
1078
|
}
|
|
1073
|
-
function g
|
|
1074
|
-
const
|
|
1075
|
-
o("update:modelValue",
|
|
1079
|
+
function _(g) {
|
|
1080
|
+
const C = u.modelValue.filter((F) => F.id !== g);
|
|
1081
|
+
o("update:modelValue", C);
|
|
1076
1082
|
}
|
|
1077
|
-
function
|
|
1078
|
-
var F,
|
|
1079
|
-
if (
|
|
1083
|
+
function N(g) {
|
|
1084
|
+
var F, A;
|
|
1085
|
+
if (g.type !== be.enum.SKU)
|
|
1080
1086
|
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
|
-
|
|
1087
|
+
if (!((F = r.value[g.id]) == null ? void 0 : F.unit))
|
|
1088
|
+
throw new Error(`Cannot find ingredient: ${g.id}`);
|
|
1089
|
+
return (A = r.value[g.id]) == null ? void 0 : A.unit;
|
|
1090
|
+
}
|
|
1091
|
+
function z(g) {
|
|
1092
|
+
return !r.value[g.id];
|
|
1093
|
+
}
|
|
1094
|
+
return (g, C) => {
|
|
1095
|
+
var H, ee, O;
|
|
1096
|
+
const F = G("FmFormGroup"), A = G("FmButton"), P = G("FmIcon"), K = G("FmTextField");
|
|
1097
|
+
return b(), V("div", In, [
|
|
1098
|
+
h(F, {
|
|
1099
|
+
disabled: g.disabled,
|
|
1100
|
+
"model-value": g.modelValue,
|
|
1092
1101
|
rules: [
|
|
1093
|
-
...
|
|
1102
|
+
...g.rules,
|
|
1094
1103
|
() => s.value.length ? "There is a binding error in your configuration" : !0
|
|
1095
1104
|
]
|
|
1096
1105
|
}, {
|
|
1097
|
-
label: J(() =>
|
|
1098
|
-
|
|
1106
|
+
label: J(() => C[4] || (C[4] = [
|
|
1107
|
+
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
1108
|
])),
|
|
1100
1109
|
_: 1
|
|
1101
1110
|
}, 8, ["disabled", "model-value", "rules"]),
|
|
1102
|
-
((
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1111
|
+
((H = g.recipeBindingConfig) == null ? void 0 : H.enabled) !== !1 ? (b(), V("div", wn, [
|
|
1112
|
+
v("div", En, [
|
|
1113
|
+
v("div", Vn, U(n(l)("inventory.inventoryBindings.recipe")), 1),
|
|
1114
|
+
g.readonly ? T("", !0) : (b(), Y(A, {
|
|
1106
1115
|
key: 0,
|
|
1107
1116
|
variant: "secondary",
|
|
1108
1117
|
"text-color": "primary",
|
|
@@ -1112,32 +1121,32 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1112
1121
|
onClick: f
|
|
1113
1122
|
}, null, 8, ["label"]))
|
|
1114
1123
|
]),
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1124
|
+
v("div", Sn, [
|
|
1125
|
+
v("div", Bn, [
|
|
1126
|
+
v("div", Cn, U(n(l)("inventory.inventoryBindings.recipe")), 1),
|
|
1127
|
+
C[5] || (C[5] = v("div", { class: "w-[200px]" }, null, -1)),
|
|
1128
|
+
g.recipeBindingConfig.ableToApplyRules ? (b(), V("div", Fn)) : T("", !0),
|
|
1129
|
+
g.readonly ? T("", !0) : (b(), V("div", Rn))
|
|
1121
1130
|
]),
|
|
1122
|
-
(b(!0),
|
|
1131
|
+
(b(!0), V(X, null, me(p.value, (D) => {
|
|
1123
1132
|
var L;
|
|
1124
1133
|
return b(), Y(un, {
|
|
1125
|
-
key:
|
|
1126
|
-
"model-value":
|
|
1127
|
-
"display-name": (L = i.value[
|
|
1128
|
-
"show-error":
|
|
1129
|
-
readonly:
|
|
1130
|
-
disabled:
|
|
1131
|
-
"onUpdate:modelValue":
|
|
1132
|
-
onDelete:
|
|
1134
|
+
key: D.id,
|
|
1135
|
+
"model-value": D,
|
|
1136
|
+
"display-name": (L = i.value[D.id]) == null ? void 0 : L.name,
|
|
1137
|
+
"show-error": a.value.has(D.id),
|
|
1138
|
+
readonly: g.readonly,
|
|
1139
|
+
disabled: g.disabled,
|
|
1140
|
+
"onUpdate:modelValue": C[0] || (C[0] = (q) => c(q)),
|
|
1141
|
+
onDelete: C[1] || (C[1] = (q) => _(q))
|
|
1133
1142
|
}, null, 8, ["model-value", "display-name", "show-error", "readonly", "disabled"]);
|
|
1134
1143
|
}), 128))
|
|
1135
1144
|
])
|
|
1136
|
-
])) :
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1145
|
+
])) : T("", !0),
|
|
1146
|
+
g.enableIngredientGroup ? (b(), V("div", An, [
|
|
1147
|
+
v("div", Tn, [
|
|
1148
|
+
v("div", Un, U(n(l)("inventory.inventoryBindings.ingredientGroup")), 1),
|
|
1149
|
+
g.readonly ? T("", !0) : (b(), Y(A, {
|
|
1141
1150
|
key: 0,
|
|
1142
1151
|
variant: "secondary",
|
|
1143
1152
|
"text-color": "primary",
|
|
@@ -1147,51 +1156,51 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1147
1156
|
onClick: S
|
|
1148
1157
|
}, null, 8, ["label"]))
|
|
1149
1158
|
]),
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1159
|
+
v("div", Pn, [
|
|
1160
|
+
v("div", Mn, [
|
|
1161
|
+
v("div", Dn, U(n(l)("inventory.inventoryBindings.ingredientGroup")), 1),
|
|
1162
|
+
C[6] || (C[6] = v("div", { class: "w-[200px]" }, null, -1)),
|
|
1163
|
+
C[7] || (C[7] = v("div", { class: "w-[52px]" }, null, -1))
|
|
1155
1164
|
]),
|
|
1156
|
-
(b(!0),
|
|
1157
|
-
key:
|
|
1158
|
-
disabled:
|
|
1159
|
-
modelValue: +n(Q)(
|
|
1165
|
+
(b(!0), V(X, null, me(k.value, (D) => (b(), Y(F, {
|
|
1166
|
+
key: D.id,
|
|
1167
|
+
disabled: g.disabled,
|
|
1168
|
+
modelValue: +n(Q)(D.amount ?? { amount: 1, precision: 0 }),
|
|
1160
1169
|
rules: [n(it)(0), n(qe)(0)]
|
|
1161
1170
|
}, {
|
|
1162
1171
|
default: J(({ invalid: L }) => {
|
|
1163
|
-
var
|
|
1172
|
+
var q;
|
|
1164
1173
|
return [
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1174
|
+
v("div", Gn, [
|
|
1175
|
+
a.value.has(D.id) ? (b(), V("div", Nn, [
|
|
1176
|
+
h(P, {
|
|
1168
1177
|
name: "error",
|
|
1169
1178
|
color: "system-error-300",
|
|
1170
1179
|
size: "sm"
|
|
1171
1180
|
}),
|
|
1172
|
-
|
|
1173
|
-
])) :
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1181
|
+
v("div", null, U(n(l)("inventory.inventoryBindings.circularError")), 1)
|
|
1182
|
+
])) : T("", !0),
|
|
1183
|
+
v("div", zn, [
|
|
1184
|
+
v("div", On, [
|
|
1185
|
+
v("div", Ln, U((q = x.value[D.id]) == null ? void 0 : q.name), 1)
|
|
1177
1186
|
]),
|
|
1178
|
-
|
|
1179
|
-
|
|
1187
|
+
v("div", jn, [
|
|
1188
|
+
h(K, {
|
|
1180
1189
|
class: "w-full",
|
|
1181
|
-
disabled:
|
|
1182
|
-
modelValue: +n(Q)(
|
|
1183
|
-
"onUpdate:modelValue": (
|
|
1190
|
+
disabled: g.disabled,
|
|
1191
|
+
modelValue: +n(Q)(D.amount ?? { amount: 1, precision: 0 }),
|
|
1192
|
+
"onUpdate:modelValue": (oe) => y(D.id, oe, g.modelValue),
|
|
1184
1193
|
invalid: L
|
|
1185
1194
|
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"])
|
|
1186
1195
|
]),
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
disabled:
|
|
1196
|
+
g.readonly ? T("", !0) : (b(), V("div", Kn, [
|
|
1197
|
+
h(A, {
|
|
1198
|
+
disabled: g.disabled,
|
|
1190
1199
|
type: "button",
|
|
1191
1200
|
variant: "plain",
|
|
1192
1201
|
icon: "delete",
|
|
1193
1202
|
"icon-color": "#000000",
|
|
1194
|
-
onClick: (
|
|
1203
|
+
onClick: (oe) => _(D.id)
|
|
1195
1204
|
}, null, 8, ["disabled", "onClick"])
|
|
1196
1205
|
]))
|
|
1197
1206
|
])
|
|
@@ -1201,58 +1210,74 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1201
1210
|
_: 2
|
|
1202
1211
|
}, 1032, ["disabled", "modelValue", "rules"]))), 128))
|
|
1203
1212
|
])
|
|
1204
|
-
])) :
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1213
|
+
])) : T("", !0),
|
|
1214
|
+
v("div", qn, [
|
|
1215
|
+
v("div", Wn, [
|
|
1216
|
+
v("div", Yn, U(n(l)("inventory.inventoryBindings.ingredient")), 1),
|
|
1217
|
+
g.readonly ? T("", !0) : (b(), Y(A, {
|
|
1209
1218
|
key: 0,
|
|
1210
1219
|
variant: "secondary",
|
|
1211
1220
|
"text-color": "primary",
|
|
1212
1221
|
"border-color": "primary",
|
|
1213
1222
|
label: n(l)("inventory.inventoryBindings.linkIngredient"),
|
|
1214
1223
|
"prepend-icon": "link",
|
|
1215
|
-
onClick:
|
|
1224
|
+
onClick: E
|
|
1216
1225
|
}, null, 8, ["label"]))
|
|
1217
1226
|
]),
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
(
|
|
1227
|
+
v("div", Jn, [
|
|
1228
|
+
v("div", Hn, [
|
|
1229
|
+
v("div", Qn, U(n(l)("inventory.inventoryBindings.ingredient")), 1),
|
|
1230
|
+
v("div", Xn, U(n(l)("inventory.inventoryBindings.amount")), 1),
|
|
1231
|
+
C[8] || (C[8] = v("div", { class: "w-[52px]" }, null, -1)),
|
|
1232
|
+
(ee = g.skuBindingConfig) != null && ee.ableToApplyRules || (O = g.skuBindingConfig) != null && O.ableToConfigureAlternative ? (b(), V("div", Zn)) : T("", !0)
|
|
1224
1233
|
]),
|
|
1225
|
-
(b(!0),
|
|
1226
|
-
var L,
|
|
1227
|
-
return b(),
|
|
1228
|
-
key:
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1234
|
+
(b(!0), V(X, null, me(e.value, (D) => {
|
|
1235
|
+
var L, q, oe;
|
|
1236
|
+
return b(), V(X, {
|
|
1237
|
+
key: D.id
|
|
1238
|
+
}, [
|
|
1239
|
+
z(D) ? (b(), V("div", eo, [
|
|
1240
|
+
v("div", to, [
|
|
1241
|
+
v("div", no, U(D.id), 1)
|
|
1242
|
+
]),
|
|
1243
|
+
v("div", oo, [
|
|
1244
|
+
h(P, {
|
|
1245
|
+
name: "error",
|
|
1246
|
+
color: "system-error-300",
|
|
1247
|
+
size: "sm"
|
|
1248
|
+
}),
|
|
1249
|
+
v("div", null, U(n(l)("inventory.inventoryBindings.missingIngredient")), 1)
|
|
1250
|
+
])
|
|
1251
|
+
])) : (b(), Y($n, {
|
|
1252
|
+
key: 1,
|
|
1253
|
+
"model-value": D,
|
|
1254
|
+
"display-name": (L = r.value[D.id]) == null ? void 0 : L.name,
|
|
1255
|
+
unit: N(D),
|
|
1256
|
+
"show-error": a.value.has(D.id),
|
|
1257
|
+
"able-to-apply-rules": ((q = g.skuBindingConfig) == null ? void 0 : q.ableToApplyRules) === !0,
|
|
1258
|
+
"able-to-configure-alternative": ((oe = g.skuBindingConfig) == null ? void 0 : oe.ableToConfigureAlternative) === !0,
|
|
1259
|
+
readonly: g.readonly,
|
|
1260
|
+
disabled: g.disabled,
|
|
1261
|
+
"onUpdate:modelValue": C[2] || (C[2] = (Z) => c(Z)),
|
|
1262
|
+
onDelete: C[3] || (C[3] = (Z) => _(Z))
|
|
1263
|
+
}, null, 8, ["model-value", "display-name", "unit", "show-error", "able-to-apply-rules", "able-to-configure-alternative", "readonly", "disabled"]))
|
|
1264
|
+
], 64);
|
|
1240
1265
|
}), 128))
|
|
1241
1266
|
])
|
|
1242
1267
|
])
|
|
1243
1268
|
]);
|
|
1244
1269
|
};
|
|
1245
1270
|
}
|
|
1246
|
-
}),
|
|
1271
|
+
}), lo = { class: "flex flex-col gap-40" }, ro = {
|
|
1247
1272
|
key: 0,
|
|
1248
1273
|
class: "flex flex-col gap-16"
|
|
1249
|
-
},
|
|
1274
|
+
}, ao = {
|
|
1250
1275
|
key: 0,
|
|
1251
1276
|
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
|
-
},
|
|
1277
|
+
}, so = {
|
|
1253
1278
|
key: 0,
|
|
1254
1279
|
class: "flex flex-col items-center w-full h-full gap-24"
|
|
1255
|
-
},
|
|
1280
|
+
}, uo = { key: 1 }, co = { class: "mt-32" }, po = /* @__PURE__ */ le({
|
|
1256
1281
|
__name: "RecipeForm",
|
|
1257
1282
|
props: {
|
|
1258
1283
|
mode: {},
|
|
@@ -1261,14 +1286,14 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1261
1286
|
},
|
|
1262
1287
|
emits: ["update:modelValue", "click:submit"],
|
|
1263
1288
|
setup(m, { expose: d, emit: l }) {
|
|
1264
|
-
const t = m, i = l,
|
|
1289
|
+
const t = m, i = l, r = We(), { t: x } = ie(), u = R({
|
|
1265
1290
|
get() {
|
|
1266
1291
|
var c;
|
|
1267
1292
|
return ((c = t.modelValue) == null ? void 0 : c.name) ?? "";
|
|
1268
1293
|
},
|
|
1269
1294
|
set(c) {
|
|
1270
|
-
const
|
|
1271
|
-
|
|
1295
|
+
const _ = t.modelValue ?? {};
|
|
1296
|
+
_.name = c, i("update:modelValue", _);
|
|
1272
1297
|
}
|
|
1273
1298
|
}), o = R({
|
|
1274
1299
|
get() {
|
|
@@ -1276,8 +1301,8 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1276
1301
|
return ((c = t.modelValue) == null ? void 0 : c.contains) ?? [];
|
|
1277
1302
|
},
|
|
1278
1303
|
set(c) {
|
|
1279
|
-
const
|
|
1280
|
-
|
|
1304
|
+
const _ = t.modelValue ?? {};
|
|
1305
|
+
_.contains = c, i("update:modelValue", _);
|
|
1281
1306
|
}
|
|
1282
1307
|
}), s = R({
|
|
1283
1308
|
get() {
|
|
@@ -1285,151 +1310,151 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1285
1310
|
return ((c = t.modelValue) == null ? void 0 : c.customAttributes) ?? {};
|
|
1286
1311
|
},
|
|
1287
1312
|
set(c) {
|
|
1288
|
-
const
|
|
1313
|
+
const _ = t.modelValue ? {
|
|
1289
1314
|
...t.modelValue
|
|
1290
1315
|
} : {};
|
|
1291
|
-
|
|
1316
|
+
_.customAttributes = c, i("update:modelValue", _);
|
|
1292
1317
|
}
|
|
1293
|
-
}),
|
|
1318
|
+
}), a = R({
|
|
1294
1319
|
get() {
|
|
1295
1320
|
var c;
|
|
1296
1321
|
return ((c = t.modelValue) == null ? void 0 : c.version) ?? null;
|
|
1297
1322
|
},
|
|
1298
1323
|
set(c) {
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1324
|
+
const _ = t.modelValue ? { ...t.modelValue } : {};
|
|
1325
|
+
_.version = c, i("update:modelValue", _);
|
|
1301
1326
|
}
|
|
1302
1327
|
}), p = R({
|
|
1303
1328
|
get() {
|
|
1304
|
-
return
|
|
1329
|
+
return a.value === "v2";
|
|
1305
1330
|
},
|
|
1306
1331
|
set(c) {
|
|
1307
|
-
|
|
1332
|
+
a.value = c ? "v2" : null;
|
|
1308
1333
|
}
|
|
1309
1334
|
});
|
|
1310
1335
|
function $() {
|
|
1311
1336
|
i("click:submit");
|
|
1312
1337
|
}
|
|
1313
|
-
const
|
|
1338
|
+
const B = W();
|
|
1314
1339
|
d({
|
|
1315
1340
|
validateInputs: () => {
|
|
1316
|
-
var c,
|
|
1317
|
-
(
|
|
1341
|
+
var c, _;
|
|
1342
|
+
(_ = (c = B.value) == null ? void 0 : c.validateInputs) == null || _.call(c);
|
|
1318
1343
|
},
|
|
1319
1344
|
resetInputsValidation: () => {
|
|
1320
|
-
var c,
|
|
1321
|
-
(
|
|
1345
|
+
var c, _;
|
|
1346
|
+
(_ = (c = B.value) == null ? void 0 : c.resetInputsValidation) == null || _.call(c);
|
|
1322
1347
|
},
|
|
1323
1348
|
resetInputs: () => {
|
|
1324
|
-
var c,
|
|
1325
|
-
(
|
|
1349
|
+
var c, _;
|
|
1350
|
+
(_ = (c = B.value) == null ? void 0 : c.resetInputs) == null || _.call(c);
|
|
1326
1351
|
}
|
|
1327
1352
|
});
|
|
1328
|
-
const I = ne(), f =
|
|
1329
|
-
ue(
|
|
1330
|
-
|
|
1353
|
+
const I = ne(), f = W([]), k = W(!1), S = W(!1);
|
|
1354
|
+
ue(k, async (c) => {
|
|
1355
|
+
y(c);
|
|
1331
1356
|
});
|
|
1332
|
-
async function
|
|
1333
|
-
var
|
|
1334
|
-
c && !S.value && ((
|
|
1357
|
+
async function y(c) {
|
|
1358
|
+
var _, N;
|
|
1359
|
+
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
1360
|
}
|
|
1336
1361
|
const e = R(
|
|
1337
1362
|
() => I.recipes.map((c) => ({ label: c.name, value: c.name }))
|
|
1338
|
-
),
|
|
1363
|
+
), E = R(() => {
|
|
1339
1364
|
var c;
|
|
1340
1365
|
return ((c = t.modelValue) == null ? void 0 : c.name) ?? "";
|
|
1341
1366
|
});
|
|
1342
|
-
return (c,
|
|
1343
|
-
const
|
|
1344
|
-
return b(), Y(
|
|
1367
|
+
return (c, _) => {
|
|
1368
|
+
const N = G("FmTextField"), z = G("FmSwitch"), g = G("FmCard"), C = G("FmSpacer"), F = G("FmCircularProgress"), A = G("FmForm");
|
|
1369
|
+
return b(), Y(A, {
|
|
1345
1370
|
ref_key: "formRef",
|
|
1346
|
-
ref:
|
|
1371
|
+
ref: B,
|
|
1347
1372
|
onValidationSuccess: $
|
|
1348
1373
|
}, {
|
|
1349
1374
|
default: J(() => [
|
|
1350
|
-
|
|
1351
|
-
|
|
1375
|
+
v("div", lo, [
|
|
1376
|
+
h(N, {
|
|
1352
1377
|
disabled: c.disabled,
|
|
1353
|
-
label: n(
|
|
1378
|
+
label: n(x)("inventory.recipe.name"),
|
|
1354
1379
|
"model-value": u.value,
|
|
1355
|
-
"onUpdate:modelValue":
|
|
1380
|
+
"onUpdate:modelValue": _[0] || (_[0] = (P) => u.value = P),
|
|
1356
1381
|
rules: [
|
|
1357
1382
|
n(Rt)(),
|
|
1358
|
-
n(lt)(e.value,
|
|
1383
|
+
n(lt)(e.value, E.value, (P) => `[${P.value}] already exists`)
|
|
1359
1384
|
],
|
|
1360
1385
|
"label-mark": "required"
|
|
1361
1386
|
}, null, 8, ["disabled", "label", "model-value", "rules"]),
|
|
1362
|
-
n(
|
|
1363
|
-
|
|
1387
|
+
n(r).enableRecipeV2 ? (b(), V("div", ro, [
|
|
1388
|
+
h(z, {
|
|
1364
1389
|
modelValue: p.value,
|
|
1365
|
-
"onUpdate:modelValue":
|
|
1390
|
+
"onUpdate:modelValue": _[1] || (_[1] = (P) => p.value = P),
|
|
1366
1391
|
value: !0,
|
|
1367
|
-
label: n(
|
|
1392
|
+
label: n(x)("inventory.recipe.enableRecipeV2"),
|
|
1368
1393
|
"label-placement": "right",
|
|
1369
1394
|
disabled: c.disabled,
|
|
1370
|
-
sublabel: n(
|
|
1395
|
+
sublabel: n(x)("inventory.recipe.recipeV2Warning")
|
|
1371
1396
|
}, null, 8, ["modelValue", "label", "disabled", "sublabel"])
|
|
1372
|
-
])) :
|
|
1373
|
-
|
|
1397
|
+
])) : T("", !0),
|
|
1398
|
+
h(g, {
|
|
1374
1399
|
variant: "outlined",
|
|
1375
1400
|
class: "p-16"
|
|
1376
1401
|
}, {
|
|
1377
1402
|
default: J(() => {
|
|
1378
|
-
var P,
|
|
1403
|
+
var P, K;
|
|
1379
1404
|
return [
|
|
1380
|
-
n(
|
|
1405
|
+
n(r).enableRecipeV2 ? (b(), Y(io, {
|
|
1381
1406
|
key: 0,
|
|
1382
1407
|
id: (P = c.modelValue) == null ? void 0 : P._id,
|
|
1383
1408
|
disabled: c.disabled,
|
|
1384
1409
|
"model-value": o.value,
|
|
1385
|
-
"onUpdate:modelValue":
|
|
1410
|
+
"onUpdate:modelValue": _[2] || (_[2] = (H) => o.value = H),
|
|
1386
1411
|
rules: [n(Ne)(1)],
|
|
1387
|
-
"enable-ingredient-group": n(
|
|
1412
|
+
"enable-ingredient-group": n(r).enableIngredientGroup,
|
|
1388
1413
|
"recipe-binding-config": { enabled: !p.value, ableToApplyRules: p.value },
|
|
1389
1414
|
"sku-binding-config": {
|
|
1390
1415
|
ableToConfigureAlternative: p.value
|
|
1391
1416
|
}
|
|
1392
1417
|
}, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group", "recipe-binding-config", "sku-binding-config"])) : (b(), Y(At, {
|
|
1393
1418
|
key: 1,
|
|
1394
|
-
id: (
|
|
1419
|
+
id: (K = c.modelValue) == null ? void 0 : K._id,
|
|
1395
1420
|
disabled: c.disabled,
|
|
1396
1421
|
"model-value": o.value,
|
|
1397
|
-
"onUpdate:modelValue":
|
|
1422
|
+
"onUpdate:modelValue": _[3] || (_[3] = (H) => o.value = H),
|
|
1398
1423
|
rules: [n(Ne)(1)],
|
|
1399
|
-
"enable-ingredient-group": n(
|
|
1424
|
+
"enable-ingredient-group": n(r).enableIngredientGroup
|
|
1400
1425
|
}, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group"]))
|
|
1401
1426
|
];
|
|
1402
1427
|
}),
|
|
1403
1428
|
_: 1
|
|
1404
1429
|
})
|
|
1405
1430
|
]),
|
|
1406
|
-
c.mode !== n(se).CREATE ? (b(),
|
|
1407
|
-
|
|
1431
|
+
c.mode !== n(se).CREATE ? (b(), V("div", ao, [
|
|
1432
|
+
h(z, {
|
|
1408
1433
|
label: "Show binded items",
|
|
1409
|
-
modelValue:
|
|
1410
|
-
"onUpdate:modelValue":
|
|
1434
|
+
modelValue: k.value,
|
|
1435
|
+
"onUpdate:modelValue": _[4] || (_[4] = (P) => k.value = P),
|
|
1411
1436
|
"label-placement": "right",
|
|
1412
1437
|
disabled: S.value
|
|
1413
1438
|
}, null, 8, ["modelValue", "disabled"]),
|
|
1414
|
-
S.value ? (b(),
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1439
|
+
S.value ? (b(), V("div", so, [
|
|
1440
|
+
h(C),
|
|
1441
|
+
v("div", null, [
|
|
1442
|
+
h(F, { size: "xl" })
|
|
1418
1443
|
]),
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
])) :
|
|
1422
|
-
|
|
1444
|
+
_[6] || (_[6] = v("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
1445
|
+
h(C)
|
|
1446
|
+
])) : k.value && f.value.length ? (b(), V("div", uo, [
|
|
1447
|
+
h(nt, {
|
|
1423
1448
|
name: "Menu",
|
|
1424
1449
|
bindings: f.value
|
|
1425
1450
|
}, null, 8, ["bindings"])
|
|
1426
|
-
])) :
|
|
1427
|
-
])) :
|
|
1428
|
-
|
|
1429
|
-
|
|
1451
|
+
])) : T("", !0)
|
|
1452
|
+
])) : T("", !0),
|
|
1453
|
+
v("div", co, [
|
|
1454
|
+
h(Ot, {
|
|
1430
1455
|
entity: "inventoryRecipe",
|
|
1431
1456
|
modelValue: s.value,
|
|
1432
|
-
"onUpdate:modelValue":
|
|
1457
|
+
"onUpdate:modelValue": _[5] || (_[5] = (P) => s.value = P)
|
|
1433
1458
|
}, null, 8, ["modelValue"])
|
|
1434
1459
|
])
|
|
1435
1460
|
]),
|
|
@@ -1437,7 +1462,7 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1437
1462
|
}, 512);
|
|
1438
1463
|
};
|
|
1439
1464
|
}
|
|
1440
|
-
}),
|
|
1465
|
+
}), mo = { class: "flex gap-4" }, fo = /* @__PURE__ */ le({
|
|
1441
1466
|
__name: "RecipeDialog",
|
|
1442
1467
|
props: {
|
|
1443
1468
|
show: { type: Boolean },
|
|
@@ -1446,7 +1471,7 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1446
1471
|
},
|
|
1447
1472
|
emits: ["update:show"],
|
|
1448
1473
|
setup(m) {
|
|
1449
|
-
const d = m, l = ne(), t = je(), { t: i } =
|
|
1474
|
+
const d = m, l = ne(), t = je(), { t: i } = ie(), r = Ge(d, "show"), x = Ge(d, "recipe"), u = R(() => {
|
|
1450
1475
|
switch (d.mode) {
|
|
1451
1476
|
case se.READ:
|
|
1452
1477
|
return "";
|
|
@@ -1466,14 +1491,14 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1466
1491
|
return i("common.add");
|
|
1467
1492
|
}
|
|
1468
1493
|
return "";
|
|
1469
|
-
}), s =
|
|
1494
|
+
}), s = W(), a = W(!1);
|
|
1470
1495
|
async function p() {
|
|
1471
|
-
|
|
1496
|
+
a.value = !0;
|
|
1472
1497
|
try {
|
|
1473
|
-
const f = Oe(
|
|
1474
|
-
f.precision ?? (f.precision = 0), f.measurements ?? (f.measurements = []), await l.createRecipe(f),
|
|
1498
|
+
const f = Oe(x.value);
|
|
1499
|
+
f.precision ?? (f.precision = 0), f.measurements ?? (f.measurements = []), await l.createRecipe(f), r.value = !1, t.open({
|
|
1475
1500
|
title: i("inventory.common.success"),
|
|
1476
|
-
message: i("inventory.recipe.create.success", { name:
|
|
1501
|
+
message: i("inventory.recipe.create.success", { name: x.value.name }),
|
|
1477
1502
|
type: "success"
|
|
1478
1503
|
});
|
|
1479
1504
|
} catch (f) {
|
|
@@ -1483,15 +1508,15 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1483
1508
|
type: "error"
|
|
1484
1509
|
});
|
|
1485
1510
|
} finally {
|
|
1486
|
-
|
|
1511
|
+
a.value = !1;
|
|
1487
1512
|
}
|
|
1488
1513
|
}
|
|
1489
1514
|
async function $() {
|
|
1490
|
-
|
|
1515
|
+
a.value = !0;
|
|
1491
1516
|
try {
|
|
1492
|
-
await l.updateRecipe(
|
|
1517
|
+
await l.updateRecipe(x.value), r.value = !1, t.open({
|
|
1493
1518
|
title: i("inventory.common.success"),
|
|
1494
|
-
message: i("inventory.recipe.update.success", { name:
|
|
1519
|
+
message: i("inventory.recipe.update.success", { name: x.value.name }),
|
|
1495
1520
|
type: "success"
|
|
1496
1521
|
});
|
|
1497
1522
|
} catch (f) {
|
|
@@ -1501,12 +1526,12 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1501
1526
|
type: "error"
|
|
1502
1527
|
});
|
|
1503
1528
|
} finally {
|
|
1504
|
-
|
|
1529
|
+
a.value = !1;
|
|
1505
1530
|
}
|
|
1506
1531
|
}
|
|
1507
|
-
function
|
|
1508
|
-
var f,
|
|
1509
|
-
(
|
|
1532
|
+
function B() {
|
|
1533
|
+
var f, k;
|
|
1534
|
+
(k = (f = s.value) == null ? void 0 : f.validateInputs) == null || k.call(f);
|
|
1510
1535
|
}
|
|
1511
1536
|
function I() {
|
|
1512
1537
|
switch (d.mode) {
|
|
@@ -1518,41 +1543,41 @@ const In = { class: "flex flex-col gap-24" }, wn = {
|
|
|
1518
1543
|
return p();
|
|
1519
1544
|
}
|
|
1520
1545
|
}
|
|
1521
|
-
return (f,
|
|
1522
|
-
const S = G("FmButton"),
|
|
1523
|
-
return b(), Y(
|
|
1524
|
-
"model-value": n(
|
|
1525
|
-
"onUpdate:modelValue":
|
|
1546
|
+
return (f, k) => {
|
|
1547
|
+
const S = G("FmButton"), y = G("FmSideSheet");
|
|
1548
|
+
return b(), Y(y, {
|
|
1549
|
+
"model-value": n(r),
|
|
1550
|
+
"onUpdate:modelValue": k[3] || (k[3] = (e) => De(r) ? r.value = e : null),
|
|
1526
1551
|
header: u.value,
|
|
1527
1552
|
"close-button": "",
|
|
1528
1553
|
"dismiss-away": "",
|
|
1529
1554
|
"max-width": 800
|
|
1530
1555
|
}, {
|
|
1531
1556
|
"side-sheet-footer": J(() => [
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
loading:
|
|
1557
|
+
v("div", mo, [
|
|
1558
|
+
h(S, {
|
|
1559
|
+
loading: a.value,
|
|
1535
1560
|
label: o.value,
|
|
1536
|
-
onClick:
|
|
1561
|
+
onClick: B
|
|
1537
1562
|
}, null, 8, ["loading", "label"]),
|
|
1538
|
-
|
|
1539
|
-
disabled:
|
|
1563
|
+
h(S, {
|
|
1564
|
+
disabled: a.value,
|
|
1540
1565
|
label: n(i)("common.close"),
|
|
1541
1566
|
variant: "tertiary",
|
|
1542
|
-
onClick:
|
|
1567
|
+
onClick: k[2] || (k[2] = (e) => r.value = !1)
|
|
1543
1568
|
}, null, 8, ["disabled", "label"])
|
|
1544
1569
|
])
|
|
1545
1570
|
]),
|
|
1546
1571
|
default: J(() => [
|
|
1547
|
-
|
|
1572
|
+
h(po, {
|
|
1548
1573
|
class: "w-full",
|
|
1549
1574
|
ref_key: "hasValidationExpose",
|
|
1550
1575
|
ref: s,
|
|
1551
|
-
modelValue: n(
|
|
1552
|
-
"onUpdate:modelValue":
|
|
1576
|
+
modelValue: n(x),
|
|
1577
|
+
"onUpdate:modelValue": k[0] || (k[0] = (e) => De(x) ? x.value = e : null),
|
|
1553
1578
|
mode: f.mode,
|
|
1554
|
-
disabled:
|
|
1555
|
-
"onClick:submit":
|
|
1579
|
+
disabled: a.value,
|
|
1580
|
+
"onClick:submit": k[1] || (k[1] = (e) => I())
|
|
1556
1581
|
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
1557
1582
|
]),
|
|
1558
1583
|
_: 1
|
|
@@ -1568,14 +1593,14 @@ function ke(m, d, l) {
|
|
|
1568
1593
|
else if (i.type === be.enum.SKU_GROUP)
|
|
1569
1594
|
t.push({ ...i, isGroup: !0, recipeIds: [...d] });
|
|
1570
1595
|
else if (i.type === be.enum.RECIPE) {
|
|
1571
|
-
const
|
|
1572
|
-
|
|
1573
|
-
...ke(
|
|
1596
|
+
const r = l[i.id];
|
|
1597
|
+
r && !d.has(i.id) && t.push(
|
|
1598
|
+
...ke(r.contains, /* @__PURE__ */ new Set([...d, i.id]), l)
|
|
1574
1599
|
);
|
|
1575
1600
|
}
|
|
1576
1601
|
return t;
|
|
1577
1602
|
}
|
|
1578
|
-
function
|
|
1603
|
+
function vo(m, d) {
|
|
1579
1604
|
return he.equal(m, d);
|
|
1580
1605
|
}
|
|
1581
1606
|
function Ae(m) {
|
|
@@ -1596,115 +1621,115 @@ function Xe(m) {
|
|
|
1596
1621
|
return m.measurement ? he.multiplyDecimal(m.amount, m.measurement.conversion) : m.amount;
|
|
1597
1622
|
}
|
|
1598
1623
|
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 = ((
|
|
1624
|
+
var i, r;
|
|
1625
|
+
if (m.type !== d.type || m.id !== d.id || !vo(Xe(m), Xe(d))) return !1;
|
|
1626
|
+
const l = ((i = m.measurement) == null ? void 0 : i.id) ?? null, t = ((r = d.measurement) == null ? void 0 : r.id) ?? null;
|
|
1602
1627
|
return !(l !== t || Ae(m.rules) !== Ae(d.rules) || Te(m.alternatives) !== Te(d.alternatives));
|
|
1603
1628
|
}
|
|
1604
1629
|
function Ze(m, d) {
|
|
1605
1630
|
return m.type === d.type && m.id === d.id;
|
|
1606
1631
|
}
|
|
1607
|
-
function
|
|
1632
|
+
function yo(m, d) {
|
|
1608
1633
|
const l = [];
|
|
1609
1634
|
let t = [...m.contains];
|
|
1610
|
-
for (const
|
|
1611
|
-
switch (
|
|
1635
|
+
for (const r of d)
|
|
1636
|
+
switch (r.type) {
|
|
1612
1637
|
case "remove-binding": {
|
|
1613
|
-
const
|
|
1614
|
-
(u) => u.type ===
|
|
1638
|
+
const x = t.findIndex(
|
|
1639
|
+
(u) => u.type === r.target.type && u.id === r.target.id
|
|
1615
1640
|
);
|
|
1616
|
-
|
|
1641
|
+
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
1642
|
break;
|
|
1618
1643
|
}
|
|
1619
1644
|
case "add-binding": {
|
|
1620
|
-
if (t.find((o) => Me(o,
|
|
1621
|
-
l.push({ change:
|
|
1645
|
+
if (t.find((o) => Me(o, r.binding))) {
|
|
1646
|
+
l.push({ change: r, outcome: "already-satisfied", reason: "Exact binding already present" });
|
|
1622
1647
|
break;
|
|
1623
1648
|
}
|
|
1624
|
-
if (t.find((o) => Ze(o,
|
|
1625
|
-
l.push({ change:
|
|
1649
|
+
if (t.find((o) => Ze(o, r.binding))) {
|
|
1650
|
+
l.push({ change: r, outcome: "blocked", reason: "A similar but non-exact binding already exists" });
|
|
1626
1651
|
break;
|
|
1627
1652
|
}
|
|
1628
|
-
if (m.version === "v2" &&
|
|
1629
|
-
l.push({ change:
|
|
1653
|
+
if (m.version === "v2" && r.binding.type === "RECIPE") {
|
|
1654
|
+
l.push({ change: r, outcome: "blocked", reason: "Cannot add RECIPE binding to a V2 recipe" });
|
|
1630
1655
|
break;
|
|
1631
1656
|
}
|
|
1632
|
-
if (m.version !== "v2" && (
|
|
1633
|
-
l.push({ change:
|
|
1657
|
+
if (m.version !== "v2" && (r.binding.alternatives ?? []).length > 0) {
|
|
1658
|
+
l.push({ change: r, outcome: "blocked", reason: "Cannot add a binding with alternatives to a non-V2 recipe" });
|
|
1634
1659
|
break;
|
|
1635
1660
|
}
|
|
1636
|
-
t = [...t,
|
|
1661
|
+
t = [...t, r.binding], l.push({ change: r, outcome: "applied" });
|
|
1637
1662
|
break;
|
|
1638
1663
|
}
|
|
1639
1664
|
case "replace-binding": {
|
|
1640
|
-
const
|
|
1641
|
-
(s) => s.type ===
|
|
1642
|
-
), u = t.find((s) => Me(s,
|
|
1643
|
-
if (
|
|
1644
|
-
u ? l.push({ change:
|
|
1665
|
+
const x = t.findIndex(
|
|
1666
|
+
(s) => s.type === r.from.type && s.id === r.from.id
|
|
1667
|
+
), u = t.find((s) => Me(s, r.to)), o = t.find((s, a) => a !== x && Ze(s, r.to) && !Me(s, r.to));
|
|
1668
|
+
if (x === -1) {
|
|
1669
|
+
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
1670
|
break;
|
|
1646
1671
|
}
|
|
1647
|
-
if (m.version === "v2" &&
|
|
1648
|
-
l.push({ change:
|
|
1672
|
+
if (m.version === "v2" && r.to.type === "RECIPE") {
|
|
1673
|
+
l.push({ change: r, outcome: "blocked", reason: "Cannot add RECIPE binding to a V2 recipe" });
|
|
1649
1674
|
break;
|
|
1650
1675
|
}
|
|
1651
|
-
if (m.version !== "v2" && (
|
|
1652
|
-
l.push({ change:
|
|
1676
|
+
if (m.version !== "v2" && (r.to.alternatives ?? []).length > 0) {
|
|
1677
|
+
l.push({ change: r, outcome: "blocked", reason: "Cannot apply a binding with alternatives to a non-V2 recipe" });
|
|
1653
1678
|
break;
|
|
1654
1679
|
}
|
|
1655
1680
|
if (o) {
|
|
1656
|
-
l.push({ change:
|
|
1681
|
+
l.push({ change: r, outcome: "blocked", reason: "A similar but non-exact replacement binding already exists" });
|
|
1657
1682
|
break;
|
|
1658
1683
|
}
|
|
1659
|
-
u ? (t = [...t.slice(0,
|
|
1660
|
-
...t.slice(0,
|
|
1661
|
-
|
|
1662
|
-
...t.slice(
|
|
1663
|
-
], l.push({ change:
|
|
1684
|
+
u ? (t = [...t.slice(0, x), ...t.slice(x + 1)], l.push({ change: r, outcome: "applied", reason: "Source removed; replacement already present" })) : (t = [
|
|
1685
|
+
...t.slice(0, x),
|
|
1686
|
+
r.to,
|
|
1687
|
+
...t.slice(x + 1)
|
|
1688
|
+
], l.push({ change: r, outcome: "applied" }));
|
|
1664
1689
|
break;
|
|
1665
1690
|
}
|
|
1666
1691
|
case "update-binding-rule": {
|
|
1667
|
-
const
|
|
1668
|
-
(
|
|
1692
|
+
const x = t.findIndex(
|
|
1693
|
+
(a) => a.type === r.target.type && a.id === r.target.id
|
|
1669
1694
|
);
|
|
1670
|
-
if (
|
|
1671
|
-
l.push({ change:
|
|
1695
|
+
if (x === -1) {
|
|
1696
|
+
l.push({ change: r, outcome: "ignored", reason: "Binding not found in target" });
|
|
1672
1697
|
break;
|
|
1673
1698
|
}
|
|
1674
|
-
const u = t[
|
|
1699
|
+
const u = t[x], o = u.rules ?? null, s = r.rule ?? null;
|
|
1675
1700
|
if (Ae(o) === Ae(s)) {
|
|
1676
|
-
l.push({ change:
|
|
1701
|
+
l.push({ change: r, outcome: "already-satisfied", reason: "Rule already matches" });
|
|
1677
1702
|
break;
|
|
1678
1703
|
}
|
|
1679
1704
|
t = [
|
|
1680
|
-
...t.slice(0,
|
|
1705
|
+
...t.slice(0, x),
|
|
1681
1706
|
{ ...u, rules: s },
|
|
1682
|
-
...t.slice(
|
|
1683
|
-
], l.push({ change:
|
|
1707
|
+
...t.slice(x + 1)
|
|
1708
|
+
], l.push({ change: r, outcome: "applied" });
|
|
1684
1709
|
break;
|
|
1685
1710
|
}
|
|
1686
1711
|
case "update-alternatives": {
|
|
1687
1712
|
if (m.version !== "v2") {
|
|
1688
|
-
l.push({ change:
|
|
1713
|
+
l.push({ change: r, outcome: "blocked", reason: "Cannot update alternatives on a non-V2 recipe" });
|
|
1689
1714
|
break;
|
|
1690
1715
|
}
|
|
1691
|
-
const
|
|
1692
|
-
(
|
|
1716
|
+
const x = t.findIndex(
|
|
1717
|
+
(a) => a.type === r.target.type && a.id === r.target.id
|
|
1693
1718
|
);
|
|
1694
|
-
if (
|
|
1695
|
-
l.push({ change:
|
|
1719
|
+
if (x === -1) {
|
|
1720
|
+
l.push({ change: r, outcome: "ignored", reason: "Binding not found in target" });
|
|
1696
1721
|
break;
|
|
1697
1722
|
}
|
|
1698
|
-
const u = t[
|
|
1723
|
+
const u = t[x], o = Te(u.alternatives), s = Te(r.alternatives);
|
|
1699
1724
|
if (o === s) {
|
|
1700
|
-
l.push({ change:
|
|
1725
|
+
l.push({ change: r, outcome: "already-satisfied", reason: "Alternatives already match" });
|
|
1701
1726
|
break;
|
|
1702
1727
|
}
|
|
1703
1728
|
t = [
|
|
1704
|
-
...t.slice(0,
|
|
1705
|
-
{ ...u, alternatives:
|
|
1706
|
-
...t.slice(
|
|
1707
|
-
], l.push({ change:
|
|
1729
|
+
...t.slice(0, x),
|
|
1730
|
+
{ ...u, alternatives: r.alternatives },
|
|
1731
|
+
...t.slice(x + 1)
|
|
1732
|
+
], l.push({ change: r, outcome: "applied" });
|
|
1708
1733
|
break;
|
|
1709
1734
|
}
|
|
1710
1735
|
}
|
|
@@ -1724,17 +1749,17 @@ function et(m) {
|
|
|
1724
1749
|
return m.target.id !== "";
|
|
1725
1750
|
}
|
|
1726
1751
|
}
|
|
1727
|
-
function
|
|
1752
|
+
function bo(m) {
|
|
1728
1753
|
if (m.length === 0) return "no-applicable-changes";
|
|
1729
1754
|
let d = 0, l = 0, t = 0, i = 0;
|
|
1730
|
-
for (const
|
|
1731
|
-
|
|
1755
|
+
for (const r of m)
|
|
1756
|
+
r.outcome === "applied" ? d++ : r.outcome === "blocked" ? l++ : r.outcome === "ignored" ? t++ : r.outcome === "already-satisfied" && i++;
|
|
1732
1757
|
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
1758
|
}
|
|
1734
|
-
let
|
|
1735
|
-
function
|
|
1759
|
+
let go = 0;
|
|
1760
|
+
function _o(m = null) {
|
|
1736
1761
|
return {
|
|
1737
|
-
id: String(++
|
|
1762
|
+
id: String(++go),
|
|
1738
1763
|
type: m,
|
|
1739
1764
|
itemId: null,
|
|
1740
1765
|
amountModel: ye()
|
|
@@ -1745,60 +1770,60 @@ function ut(m, d, l, t) {
|
|
|
1745
1770
|
if (i.type === "RECIPE") {
|
|
1746
1771
|
if (i.id === d) return !0;
|
|
1747
1772
|
if (!l.has(i.id)) {
|
|
1748
|
-
const
|
|
1749
|
-
if (
|
|
1773
|
+
const r = t[i.id];
|
|
1774
|
+
if (r && ut(r.contains, d, /* @__PURE__ */ new Set([...l, i.id]), t))
|
|
1750
1775
|
return !0;
|
|
1751
1776
|
}
|
|
1752
1777
|
}
|
|
1753
1778
|
return !1;
|
|
1754
1779
|
}
|
|
1755
1780
|
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
|
-
|
|
1781
|
+
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(""), B = W([]), I = R(() => {
|
|
1782
|
+
let O = d.recipes;
|
|
1783
|
+
const D = x.value;
|
|
1784
|
+
if (D != null && D.nameSearch) {
|
|
1785
|
+
const L = D.nameSearch.trim().toLowerCase();
|
|
1786
|
+
L && (O = O.filter((q) => q.name.toLowerCase().includes(L)));
|
|
1787
|
+
}
|
|
1788
|
+
if (D != null && D.filters && D.filters.length > 0) {
|
|
1789
|
+
const L = /* @__PURE__ */ new Map();
|
|
1790
|
+
for (const q of O)
|
|
1791
|
+
L.set(
|
|
1767
1792
|
q._id,
|
|
1768
1793
|
ke(q.contains, /* @__PURE__ */ new Set([q._id]), d.recipeById)
|
|
1769
1794
|
);
|
|
1770
|
-
for (const q of
|
|
1795
|
+
for (const q of D.filters)
|
|
1771
1796
|
if (q.type === "ingredient") {
|
|
1772
|
-
const { itemId:
|
|
1773
|
-
|
|
1797
|
+
const { itemId: oe, amount: Z, measurementId: ae } = q;
|
|
1798
|
+
O = O.filter((fe) => (L.get(fe._id) ?? []).some((re) => {
|
|
1774
1799
|
var ce;
|
|
1775
|
-
if (
|
|
1776
|
-
if (
|
|
1777
|
-
if (
|
|
1778
|
-
const Ue =
|
|
1779
|
-
if (!he.equal(Ue,
|
|
1800
|
+
if (re.type !== "SKU" || re.id !== oe) return !1;
|
|
1801
|
+
if (re.recipeIds.length === 1) {
|
|
1802
|
+
if (Z != null) {
|
|
1803
|
+
const Ue = re.measurement ? he.multiplyDecimal(re.amount, re.measurement.conversion) : re.amount;
|
|
1804
|
+
if (!he.equal(Ue, Z)) return !1;
|
|
1780
1805
|
}
|
|
1781
|
-
if (
|
|
1806
|
+
if (ae != null && (((ce = re.measurement) == null ? void 0 : ce.id) ?? null) !== ae)
|
|
1782
1807
|
return !1;
|
|
1783
1808
|
}
|
|
1784
1809
|
return !0;
|
|
1785
1810
|
}));
|
|
1786
1811
|
} else if (q.type === "recipe") {
|
|
1787
|
-
const
|
|
1788
|
-
|
|
1789
|
-
(
|
|
1812
|
+
const oe = q.itemId;
|
|
1813
|
+
O = O.filter(
|
|
1814
|
+
(Z) => ut(Z.contains, oe, /* @__PURE__ */ new Set([Z._id]), d.recipeById)
|
|
1790
1815
|
);
|
|
1791
1816
|
}
|
|
1792
1817
|
}
|
|
1793
|
-
return
|
|
1818
|
+
return O;
|
|
1794
1819
|
}), f = R(
|
|
1795
|
-
() => I.value.filter((
|
|
1796
|
-
),
|
|
1797
|
-
const
|
|
1798
|
-
if (
|
|
1799
|
-
const
|
|
1820
|
+
() => I.value.filter((O) => !u.value.has(O._id))
|
|
1821
|
+
), k = R(() => f.value.length > 0), S = R(() => {
|
|
1822
|
+
const O = o.value.filter(et);
|
|
1823
|
+
if (O.length === 0) {
|
|
1824
|
+
const L = {};
|
|
1800
1825
|
for (const q of f.value)
|
|
1801
|
-
|
|
1826
|
+
L[q._id] = {
|
|
1802
1827
|
recipeId: q._id,
|
|
1803
1828
|
recipeName: q.name,
|
|
1804
1829
|
original: q,
|
|
@@ -1807,90 +1832,90 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
1807
1832
|
changes: [],
|
|
1808
1833
|
counts: { applied: 0, ignored: 0, blocked: 0, satisfied: 0 }
|
|
1809
1834
|
};
|
|
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:
|
|
1835
|
+
return L;
|
|
1836
|
+
}
|
|
1837
|
+
const D = {};
|
|
1838
|
+
for (const L of f.value) {
|
|
1839
|
+
const q = JSON.parse(JSON.stringify(L)), { projected: oe, results: Z } = yo(q, O), ae = bo(Z);
|
|
1840
|
+
let fe = 0, xe = 0, re = 0, ve = 0;
|
|
1841
|
+
for (const ce of Z)
|
|
1842
|
+
ce.outcome === "applied" ? fe++ : ce.outcome === "ignored" ? xe++ : ce.outcome === "blocked" ? re++ : ce.outcome === "already-satisfied" && ve++;
|
|
1843
|
+
D[L._id] = {
|
|
1844
|
+
recipeId: L._id,
|
|
1845
|
+
recipeName: L.name,
|
|
1821
1846
|
original: q,
|
|
1822
|
-
projected:
|
|
1823
|
-
status:
|
|
1824
|
-
changes:
|
|
1825
|
-
counts: { applied: fe, ignored: xe, blocked:
|
|
1847
|
+
projected: ae === "will-update" || ae === "partially-ignored" ? oe : null,
|
|
1848
|
+
status: ae,
|
|
1849
|
+
changes: Z,
|
|
1850
|
+
counts: { applied: fe, ignored: xe, blocked: re, satisfied: ve }
|
|
1826
1851
|
};
|
|
1827
1852
|
}
|
|
1828
|
-
return
|
|
1829
|
-
}),
|
|
1830
|
-
(
|
|
1853
|
+
return D;
|
|
1854
|
+
}), y = R(() => o.value.some(et) ? Object.values(S.value).some(
|
|
1855
|
+
(O) => O.status === "will-update" || O.status === "partially-ignored"
|
|
1831
1856
|
) : !1);
|
|
1832
1857
|
function e() {
|
|
1833
1858
|
c(), i.value = !0;
|
|
1834
1859
|
}
|
|
1835
|
-
function
|
|
1860
|
+
function E() {
|
|
1836
1861
|
i.value = !1;
|
|
1837
1862
|
}
|
|
1838
1863
|
function c() {
|
|
1839
|
-
|
|
1864
|
+
r.value = 1, x.value = null, u.value = /* @__PURE__ */ new Set(), o.value = [], s.value = {}, a.value = !1, p.value = /* @__PURE__ */ new Map(), $.value = "", B.value = [];
|
|
1840
1865
|
}
|
|
1841
|
-
function
|
|
1842
|
-
|
|
1866
|
+
function _(O) {
|
|
1867
|
+
x.value = O;
|
|
1843
1868
|
}
|
|
1844
|
-
function
|
|
1845
|
-
const
|
|
1846
|
-
|
|
1869
|
+
function N(O) {
|
|
1870
|
+
const D = new Set(u.value);
|
|
1871
|
+
D.add(O), u.value = D;
|
|
1847
1872
|
}
|
|
1848
|
-
function
|
|
1873
|
+
function z() {
|
|
1849
1874
|
u.value = /* @__PURE__ */ new Set();
|
|
1850
1875
|
}
|
|
1851
|
-
function
|
|
1852
|
-
o.value = [...o.value,
|
|
1876
|
+
function g(O) {
|
|
1877
|
+
o.value = [...o.value, O];
|
|
1853
1878
|
}
|
|
1854
|
-
function
|
|
1855
|
-
const
|
|
1856
|
-
O
|
|
1879
|
+
function C(O, D) {
|
|
1880
|
+
const L = [...o.value];
|
|
1881
|
+
L[O] = D, o.value = L;
|
|
1857
1882
|
}
|
|
1858
|
-
function
|
|
1859
|
-
o.value = o.value.filter((
|
|
1883
|
+
function F(O) {
|
|
1884
|
+
o.value = o.value.filter((D, L) => L !== O);
|
|
1860
1885
|
}
|
|
1861
|
-
function
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1886
|
+
function A(O, D) {
|
|
1887
|
+
const L = [...o.value], [q] = L.splice(O, 1);
|
|
1888
|
+
L.splice(D, 0, q), o.value = L;
|
|
1864
1889
|
}
|
|
1865
1890
|
function P() {
|
|
1866
|
-
s.value = { ...S.value },
|
|
1891
|
+
s.value = { ...S.value }, r.value = 3;
|
|
1867
1892
|
}
|
|
1868
|
-
function
|
|
1869
|
-
s.value = {},
|
|
1893
|
+
function K() {
|
|
1894
|
+
s.value = {}, r.value = 2;
|
|
1870
1895
|
}
|
|
1871
1896
|
function H() {
|
|
1872
1897
|
return Object.values(s.value).filter(
|
|
1873
|
-
(
|
|
1874
|
-
).map((
|
|
1898
|
+
(O) => (O.status === "will-update" || O.status === "partially-ignored") && O.projected != null
|
|
1899
|
+
).map((O) => O.projected);
|
|
1875
1900
|
}
|
|
1876
|
-
async function
|
|
1877
|
-
if (!
|
|
1878
|
-
|
|
1901
|
+
async function ee() {
|
|
1902
|
+
if (!a.value) {
|
|
1903
|
+
a.value = !0, p.value = /* @__PURE__ */ new Map();
|
|
1879
1904
|
try {
|
|
1880
|
-
const
|
|
1905
|
+
const O = H(), D = await d.importRecipes({
|
|
1881
1906
|
create: [],
|
|
1882
|
-
update:
|
|
1883
|
-
}),
|
|
1884
|
-
if (
|
|
1907
|
+
update: O
|
|
1908
|
+
}), L = (D == null ? void 0 : D.errors) ?? [];
|
|
1909
|
+
if (L.length > 0) {
|
|
1885
1910
|
const q = /* @__PURE__ */ new Map();
|
|
1886
|
-
for (const { data:
|
|
1887
|
-
const
|
|
1888
|
-
q.set(
|
|
1911
|
+
for (const { data: oe, error: Z } of L) {
|
|
1912
|
+
const ae = typeof Z == "string" ? Z : (Z == null ? void 0 : Z.message) ?? t("inventory.recipe.bulkEditor.step3.unknownError");
|
|
1913
|
+
q.set(oe._id, ae);
|
|
1889
1914
|
}
|
|
1890
1915
|
p.value = q, l.open({
|
|
1891
1916
|
title: t("inventory.recipe.bulkEditor.step3.partialErrorTitle"),
|
|
1892
1917
|
message: t("inventory.recipe.bulkEditor.step3.partialErrorMessage", {
|
|
1893
|
-
count:
|
|
1918
|
+
count: L.length
|
|
1894
1919
|
}),
|
|
1895
1920
|
type: "warning"
|
|
1896
1921
|
});
|
|
@@ -1898,288 +1923,288 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
1898
1923
|
l.open({
|
|
1899
1924
|
title: t("inventory.recipe.bulkEditor.step3.successTitle"),
|
|
1900
1925
|
message: t("inventory.recipe.bulkEditor.step3.successMessage", {
|
|
1901
|
-
count:
|
|
1926
|
+
count: O.length
|
|
1902
1927
|
}),
|
|
1903
1928
|
type: "success"
|
|
1904
1929
|
}), i.value = !1, c();
|
|
1905
|
-
} catch (
|
|
1930
|
+
} catch (O) {
|
|
1906
1931
|
l.open({
|
|
1907
1932
|
title: t("inventory.recipe.bulkEditor.step3.errorTitle"),
|
|
1908
1933
|
message: t("inventory.recipe.bulkEditor.step3.errorMessage"),
|
|
1909
1934
|
type: "error"
|
|
1910
|
-
}), console.error("confirmAndApply failed",
|
|
1935
|
+
}), console.error("confirmAndApply failed", O);
|
|
1911
1936
|
} finally {
|
|
1912
|
-
|
|
1937
|
+
a.value = !1;
|
|
1913
1938
|
}
|
|
1914
1939
|
}
|
|
1915
1940
|
}
|
|
1916
1941
|
return {
|
|
1917
1942
|
// state
|
|
1918
1943
|
show: i,
|
|
1919
|
-
currentStep:
|
|
1920
|
-
query:
|
|
1944
|
+
currentStep: r,
|
|
1945
|
+
query: x,
|
|
1921
1946
|
excludedRecipeIds: u,
|
|
1922
1947
|
modifications: o,
|
|
1923
1948
|
entries: s,
|
|
1924
|
-
isSaving:
|
|
1949
|
+
isSaving: a,
|
|
1925
1950
|
applyErrors: p,
|
|
1926
1951
|
nameSearch: $,
|
|
1927
|
-
filterRows:
|
|
1952
|
+
filterRows: B,
|
|
1928
1953
|
// computed
|
|
1929
1954
|
matchedRecipes: I,
|
|
1930
1955
|
selectedRecipes: f,
|
|
1931
1956
|
livePreviewEntries: S,
|
|
1932
|
-
canGoToStep2:
|
|
1933
|
-
canGoToStep3:
|
|
1957
|
+
canGoToStep2: k,
|
|
1958
|
+
canGoToStep3: y,
|
|
1934
1959
|
// actions
|
|
1935
1960
|
openDialog: e,
|
|
1936
|
-
closeDialog:
|
|
1961
|
+
closeDialog: E,
|
|
1937
1962
|
reset: c,
|
|
1938
|
-
updateQuery:
|
|
1939
|
-
removeRecipe:
|
|
1940
|
-
restoreAllRecipes:
|
|
1941
|
-
addModification:
|
|
1942
|
-
updateModification:
|
|
1943
|
-
removeModification:
|
|
1944
|
-
reorderModification:
|
|
1963
|
+
updateQuery: _,
|
|
1964
|
+
removeRecipe: N,
|
|
1965
|
+
restoreAllRecipes: z,
|
|
1966
|
+
addModification: g,
|
|
1967
|
+
updateModification: C,
|
|
1968
|
+
removeModification: F,
|
|
1969
|
+
reorderModification: A,
|
|
1945
1970
|
goToStep3: P,
|
|
1946
|
-
backToStep2:
|
|
1971
|
+
backToStep2: K,
|
|
1947
1972
|
buildPayload: H,
|
|
1948
|
-
confirmAndApply:
|
|
1973
|
+
confirmAndApply: ee
|
|
1949
1974
|
};
|
|
1950
|
-
}),
|
|
1975
|
+
}), ko = { class: "flex flex-col h-full" }, ho = { class: "px-16 pt-16 pb-8 shrink-0 flex items-center justify-between" }, xo = { class: "fm-typo-en-heading-sm-700 text-fm-color-typo-primary" }, $o = { 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" }, Io = {
|
|
1951
1976
|
key: 0,
|
|
1952
1977
|
class: "flex flex-wrap items-center gap-8"
|
|
1953
|
-
},
|
|
1978
|
+
}, wo = {
|
|
1954
1979
|
type: "button",
|
|
1955
1980
|
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
|
-
},
|
|
1981
|
+
}, Eo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-primary" }, Vo = { class: "flex flex-col gap-8 p-12 min-w-[260px]" }, So = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary" }, Bo = {
|
|
1957
1982
|
key: 0,
|
|
1958
1983
|
class: "flex flex-col gap-4"
|
|
1959
|
-
},
|
|
1984
|
+
}, Co = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Fo = { class: "text-fm-color-typo-placeholder ml-4" }, Ro = ["title", "onClick"], Ao = { class: "flex-1 overflow-y-auto" }, To = {
|
|
1960
1985
|
key: 0,
|
|
1961
1986
|
class: "flex flex-col items-center justify-center h-full gap-8 px-24 text-center"
|
|
1962
|
-
},
|
|
1987
|
+
}, Uo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Po = {
|
|
1963
1988
|
key: 1,
|
|
1964
1989
|
class: "divide-y divide-fm-color-border-default"
|
|
1965
|
-
},
|
|
1990
|
+
}, Mo = { class: "flex-1 min-w-0" }, Do = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary truncate" }, Go = {
|
|
1966
1991
|
key: 0,
|
|
1967
1992
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-1 whitespace-normal break-words"
|
|
1968
|
-
},
|
|
1993
|
+
}, No = { class: "flex items-center gap-4 mt-2" }, zo = /* @__PURE__ */ le({
|
|
1969
1994
|
__name: "RecipeBulkEditorStep1",
|
|
1970
1995
|
setup(m) {
|
|
1971
|
-
const { t: d } =
|
|
1996
|
+
const { t: d } = ie(), l = ne(), t = ge(), i = R({
|
|
1972
1997
|
get: () => t.nameSearch,
|
|
1973
|
-
set: (
|
|
1974
|
-
t.nameSearch =
|
|
1998
|
+
set: (y) => {
|
|
1999
|
+
t.nameSearch = y;
|
|
1975
2000
|
}
|
|
1976
|
-
}),
|
|
1977
|
-
function u(
|
|
1978
|
-
return
|
|
2001
|
+
}), r = R(() => t.filterRows), x = W({});
|
|
2002
|
+
function u(y) {
|
|
2003
|
+
return x.value[y] ?? !1;
|
|
1979
2004
|
}
|
|
1980
|
-
function o(
|
|
1981
|
-
|
|
2005
|
+
function o(y, e) {
|
|
2006
|
+
x.value = { ...x.value, [y]: e };
|
|
1982
2007
|
}
|
|
1983
2008
|
const s = R(
|
|
1984
|
-
() => l.skus.map((
|
|
1985
|
-
label:
|
|
1986
|
-
sublabel:
|
|
1987
|
-
value:
|
|
2009
|
+
() => l.skus.map((y) => ({
|
|
2010
|
+
label: y.name,
|
|
2011
|
+
sublabel: y.code,
|
|
2012
|
+
value: y._id
|
|
1988
2013
|
}))
|
|
1989
|
-
),
|
|
1990
|
-
() => l.recipes.map((
|
|
1991
|
-
label:
|
|
1992
|
-
value:
|
|
2014
|
+
), a = R(
|
|
2015
|
+
() => l.recipes.map((y) => ({
|
|
2016
|
+
label: y.name,
|
|
2017
|
+
value: y._id
|
|
1993
2018
|
}))
|
|
1994
2019
|
);
|
|
1995
|
-
function p(
|
|
1996
|
-
return
|
|
2020
|
+
function p(y) {
|
|
2021
|
+
return y.type !== "ingredient" || !y.itemId ? null : l.skuById[y.itemId] ?? null;
|
|
1997
2022
|
}
|
|
1998
|
-
function $(
|
|
2023
|
+
function $(y) {
|
|
1999
2024
|
var e;
|
|
2000
|
-
if (!
|
|
2001
|
-
if (
|
|
2002
|
-
if (!
|
|
2003
|
-
const
|
|
2004
|
-
if (!
|
|
2005
|
-
const { amount: c, measurement:
|
|
2006
|
-
if (!(c != null && c.amount > 0)) return
|
|
2007
|
-
const
|
|
2008
|
-
return `${
|
|
2025
|
+
if (!y.type) return d("inventory.recipe.bulkEditor.step1.filter");
|
|
2026
|
+
if (y.type === "ingredient") {
|
|
2027
|
+
if (!y.itemId) return d("inventory.recipe.bulkEditor.step1.filterTypeIngredient");
|
|
2028
|
+
const E = l.skuById[y.itemId];
|
|
2029
|
+
if (!E) return d("inventory.recipe.bulkEditor.step1.filterTypeIngredient");
|
|
2030
|
+
const { amount: c, measurement: _ } = y.amountModel;
|
|
2031
|
+
if (!(c != null && c.amount > 0)) return E.name;
|
|
2032
|
+
const z = (_ == null ? void 0 : _.abbrev) ?? ((e = E.unit) == null ? void 0 : e.abbrev) ?? "", g = Q(c);
|
|
2033
|
+
return `${E.name} (${g}${z})`;
|
|
2009
2034
|
}
|
|
2010
|
-
if (
|
|
2011
|
-
if (!
|
|
2012
|
-
const
|
|
2013
|
-
return
|
|
2035
|
+
if (y.type === "recipe") {
|
|
2036
|
+
if (!y.itemId) return d("inventory.recipe.bulkEditor.step1.filterTypeRecipe");
|
|
2037
|
+
const E = l.recipeById[y.itemId];
|
|
2038
|
+
return E ? E.name : d("inventory.recipe.bulkEditor.step1.filterTypeRecipe");
|
|
2014
2039
|
}
|
|
2015
2040
|
return "";
|
|
2016
2041
|
}
|
|
2017
|
-
function
|
|
2018
|
-
const e =
|
|
2042
|
+
function B(y) {
|
|
2043
|
+
const e = _o(y);
|
|
2019
2044
|
t.filterRows.push(e), o(e.id, !0);
|
|
2020
2045
|
}
|
|
2021
|
-
function I(
|
|
2022
|
-
t.filterRows = t.filterRows.filter((
|
|
2023
|
-
const e = { ...
|
|
2024
|
-
delete e[
|
|
2046
|
+
function I(y) {
|
|
2047
|
+
t.filterRows = t.filterRows.filter((E) => E.id !== y);
|
|
2048
|
+
const e = { ...x.value };
|
|
2049
|
+
delete e[y], x.value = e;
|
|
2025
2050
|
}
|
|
2026
|
-
function f(
|
|
2027
|
-
|
|
2051
|
+
function f(y) {
|
|
2052
|
+
y.amountModel = ye(), o(y.id, !0);
|
|
2028
2053
|
}
|
|
2029
2054
|
ue(
|
|
2030
|
-
[i,
|
|
2055
|
+
[i, r],
|
|
2031
2056
|
() => {
|
|
2032
|
-
const
|
|
2033
|
-
for (const c of
|
|
2057
|
+
const y = [];
|
|
2058
|
+
for (const c of r.value)
|
|
2034
2059
|
if (!(!c.type || !c.itemId))
|
|
2035
2060
|
if (c.type === "ingredient") {
|
|
2036
|
-
const
|
|
2037
|
-
let
|
|
2038
|
-
|
|
2061
|
+
const _ = p(c), { amount: N, measurement: z } = c.amountModel, g = N != null && N.amount > 0;
|
|
2062
|
+
let C, F;
|
|
2063
|
+
_ && g && (C = z ? he.multiplyDecimal(N, z.conversion) : N, F = (z == null ? void 0 : z.id) ?? null), y.push({
|
|
2039
2064
|
id: c.id,
|
|
2040
2065
|
type: "ingredient",
|
|
2041
2066
|
itemId: c.itemId,
|
|
2042
|
-
amount:
|
|
2043
|
-
measurementId:
|
|
2067
|
+
amount: C ?? null,
|
|
2068
|
+
measurementId: F
|
|
2044
2069
|
});
|
|
2045
|
-
} else c.type === "recipe" &&
|
|
2070
|
+
} else c.type === "recipe" && y.push({
|
|
2046
2071
|
id: c.id,
|
|
2047
2072
|
type: "recipe",
|
|
2048
2073
|
itemId: c.itemId
|
|
2049
2074
|
});
|
|
2050
2075
|
t.updateQuery({
|
|
2051
2076
|
nameSearch: i.value,
|
|
2052
|
-
filters:
|
|
2077
|
+
filters: y
|
|
2053
2078
|
});
|
|
2054
|
-
const e = i.value.trim().length > 0,
|
|
2055
|
-
!e && !
|
|
2079
|
+
const e = i.value.trim().length > 0, E = y.length > 0;
|
|
2080
|
+
!e && !E && t.restoreAllRecipes();
|
|
2056
2081
|
},
|
|
2057
2082
|
{ deep: !0, immediate: !0 }
|
|
2058
2083
|
);
|
|
2059
|
-
function
|
|
2060
|
-
var
|
|
2061
|
-
if (
|
|
2062
|
-
const
|
|
2063
|
-
if (!
|
|
2064
|
-
const
|
|
2065
|
-
return
|
|
2084
|
+
function k(y) {
|
|
2085
|
+
var _, N, z, g;
|
|
2086
|
+
if (y.isGroup) {
|
|
2087
|
+
const C = l.skuGroupById[y.id];
|
|
2088
|
+
if (!C) return null;
|
|
2089
|
+
const F = `x${Q(y.amount)}`;
|
|
2090
|
+
return y.recipeIds.slice(1).length ? `(${((_ = l.recipeById[y.recipeIds.at(-1) ?? ""]) == null ? void 0 : _.name) ?? ""}) ${C.name} (${F})` : `${C.name} (${F})`;
|
|
2066
2091
|
}
|
|
2067
|
-
const e = l.skuById[
|
|
2092
|
+
const e = l.skuById[y.id];
|
|
2068
2093
|
if (!e) return null;
|
|
2069
|
-
const
|
|
2070
|
-
return
|
|
2094
|
+
const E = ((N = y.measurement) == null ? void 0 : N.abbrev) ?? ((z = e.unit) == null ? void 0 : z.abbrev) ?? "", c = `${Q(y.amount)}${E}`;
|
|
2095
|
+
return y.recipeIds.slice(1).length ? `(${((g = l.recipeById[y.recipeIds.at(-1) ?? ""]) == null ? void 0 : g.name) ?? ""}) ${e.name} (${c})` : `${e.name} (${c})`;
|
|
2071
2096
|
}
|
|
2072
|
-
function S(
|
|
2073
|
-
return ke(
|
|
2097
|
+
function S(y) {
|
|
2098
|
+
return ke(y.contains, /* @__PURE__ */ new Set([y._id]), l.recipeById).map(k).filter((e) => e !== null).join(", ");
|
|
2074
2099
|
}
|
|
2075
|
-
return (
|
|
2076
|
-
const
|
|
2077
|
-
return b(),
|
|
2078
|
-
|
|
2079
|
-
|
|
2100
|
+
return (y, e) => {
|
|
2101
|
+
const E = G("FmButton"), c = G("FmSearch"), _ = G("FmSelect"), N = G("FmPopover"), z = G("FmIcon"), g = G("FmMenuItem"), C = G("FmMenu"), F = G("FmChip");
|
|
2102
|
+
return b(), V("div", ko, [
|
|
2103
|
+
v("div", ho, [
|
|
2104
|
+
v("span", xo, U(n(d)("inventory.recipe.bulkEditor.step1.selectedCount", {
|
|
2080
2105
|
count: n(t).selectedRecipes.length
|
|
2081
2106
|
})), 1),
|
|
2082
|
-
n(t).excludedRecipeIds.size > 0 ? (b(), Y(
|
|
2107
|
+
n(t).excludedRecipeIds.size > 0 ? (b(), Y(E, {
|
|
2083
2108
|
key: 0,
|
|
2084
2109
|
label: n(d)("inventory.recipe.bulkEditor.step1.restoreAll"),
|
|
2085
2110
|
variant: "tertiary",
|
|
2086
2111
|
size: "md",
|
|
2087
|
-
onClick: e[0] || (e[0] = (
|
|
2088
|
-
}, null, 8, ["label"])) :
|
|
2112
|
+
onClick: e[0] || (e[0] = (A) => n(t).restoreAllRecipes())
|
|
2113
|
+
}, null, 8, ["label"])) : T("", !0)
|
|
2089
2114
|
]),
|
|
2090
|
-
|
|
2091
|
-
|
|
2115
|
+
v("div", $o, [
|
|
2116
|
+
h(c, {
|
|
2092
2117
|
modelValue: i.value,
|
|
2093
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
2118
|
+
"onUpdate:modelValue": e[1] || (e[1] = (A) => i.value = A),
|
|
2094
2119
|
placeholder: n(d)("inventory.recipe.bulkEditor.query.nameSearchPlaceholder")
|
|
2095
2120
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
2096
|
-
|
|
2097
|
-
(b(!0),
|
|
2098
|
-
key:
|
|
2121
|
+
r.value.length > 0 ? (b(), V("div", Io, [
|
|
2122
|
+
(b(!0), V(X, null, me(r.value, (A) => (b(), V("div", {
|
|
2123
|
+
key: A.id,
|
|
2099
2124
|
class: "flex items-center"
|
|
2100
2125
|
}, [
|
|
2101
|
-
|
|
2102
|
-
"show-popover": u(
|
|
2126
|
+
h(N, {
|
|
2127
|
+
"show-popover": u(A.id),
|
|
2103
2128
|
"exclude-el-from-click-outside": ["fm-menu"],
|
|
2104
2129
|
placement: "bottom-start",
|
|
2105
|
-
onPopoverChanged: (P) => o(
|
|
2130
|
+
onPopoverChanged: (P) => o(A.id, P)
|
|
2106
2131
|
}, {
|
|
2107
2132
|
"popover-button": J(() => [
|
|
2108
|
-
|
|
2109
|
-
|
|
2133
|
+
v("button", wo, [
|
|
2134
|
+
v("span", Eo, U($(A)), 1)
|
|
2110
2135
|
])
|
|
2111
2136
|
]),
|
|
2112
2137
|
default: J(() => [
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
modelValue:
|
|
2118
|
-
"onUpdate:modelValue": [(P) =>
|
|
2138
|
+
v("div", Vo, [
|
|
2139
|
+
v("p", So, U(A.type === "ingredient" ? n(d)("inventory.recipe.bulkEditor.step1.filterTypeIngredient") : n(d)("inventory.recipe.bulkEditor.step1.filterTypeRecipe")), 1),
|
|
2140
|
+
A.type === "ingredient" ? (b(), V(X, { key: 0 }, [
|
|
2141
|
+
h(_, {
|
|
2142
|
+
modelValue: A.itemId,
|
|
2143
|
+
"onUpdate:modelValue": [(P) => A.itemId = P, (P) => f(A)],
|
|
2119
2144
|
items: s.value,
|
|
2120
2145
|
placeholder: n(d)("inventory.recipe.bulkEditor.step1.selectIngredient"),
|
|
2121
2146
|
clearable: ""
|
|
2122
2147
|
}, {
|
|
2123
2148
|
"menu-wrapper": J((P) => [
|
|
2124
|
-
|
|
2149
|
+
h(Fe, we({ ref_for: !0 }, P, {
|
|
2125
2150
|
items: s.value,
|
|
2126
|
-
"model-value":
|
|
2151
|
+
"model-value": A.itemId
|
|
2127
2152
|
}), null, 16, ["items", "model-value"])
|
|
2128
2153
|
]),
|
|
2129
2154
|
_: 2
|
|
2130
2155
|
}, 1032, ["modelValue", "onUpdate:modelValue", "items", "placeholder"]),
|
|
2131
|
-
p(
|
|
2132
|
-
|
|
2133
|
-
mt(
|
|
2134
|
-
|
|
2156
|
+
p(A) ? (b(), V("div", Bo, [
|
|
2157
|
+
v("span", Co, [
|
|
2158
|
+
mt(U(n(d)("inventory.recipe.bulkEditor.step1.amountLabel")) + " ", 1),
|
|
2159
|
+
v("span", Fo, U(n(d)("inventory.recipe.bulkEditor.step1.amountOptional")), 1)
|
|
2135
2160
|
]),
|
|
2136
|
-
|
|
2137
|
-
modelValue:
|
|
2138
|
-
"onUpdate:modelValue": (P) =>
|
|
2139
|
-
unit: p(
|
|
2161
|
+
h(Ce, {
|
|
2162
|
+
modelValue: A.amountModel,
|
|
2163
|
+
"onUpdate:modelValue": (P) => A.amountModel = P,
|
|
2164
|
+
unit: p(A).unit,
|
|
2140
2165
|
placeholder: n(d)("inventory.recipe.bulkEditor.step1.amountPlaceholder"),
|
|
2141
2166
|
"convert-amount-on-change-unit": ""
|
|
2142
2167
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "unit", "placeholder"])
|
|
2143
|
-
])) :
|
|
2144
|
-
], 64)) :
|
|
2168
|
+
])) : T("", !0)
|
|
2169
|
+
], 64)) : A.type === "recipe" ? (b(), Y(_, {
|
|
2145
2170
|
key: 1,
|
|
2146
|
-
modelValue:
|
|
2147
|
-
"onUpdate:modelValue": [(P) =>
|
|
2148
|
-
items:
|
|
2171
|
+
modelValue: A.itemId,
|
|
2172
|
+
"onUpdate:modelValue": [(P) => A.itemId = P, (P) => f(A)],
|
|
2173
|
+
items: a.value,
|
|
2149
2174
|
placeholder: n(d)("inventory.recipe.bulkEditor.step1.selectRecipe"),
|
|
2150
2175
|
clearable: ""
|
|
2151
2176
|
}, {
|
|
2152
2177
|
"menu-wrapper": J((P) => [
|
|
2153
|
-
|
|
2154
|
-
items:
|
|
2155
|
-
"model-value":
|
|
2178
|
+
h(Fe, we({ ref_for: !0 }, P, {
|
|
2179
|
+
items: a.value,
|
|
2180
|
+
"model-value": A.itemId
|
|
2156
2181
|
}), null, 16, ["items", "model-value"])
|
|
2157
2182
|
]),
|
|
2158
2183
|
_: 2
|
|
2159
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "items", "placeholder"])) :
|
|
2184
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "items", "placeholder"])) : T("", !0)
|
|
2160
2185
|
])
|
|
2161
2186
|
]),
|
|
2162
2187
|
_: 2
|
|
2163
2188
|
}, 1032, ["show-popover", "onPopoverChanged"]),
|
|
2164
|
-
|
|
2189
|
+
v("button", {
|
|
2165
2190
|
type: "button",
|
|
2166
2191
|
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
2192
|
title: n(d)("inventory.recipe.bulkEditor.step1.removeFilter"),
|
|
2168
|
-
onClick: (P) => I(
|
|
2193
|
+
onClick: (P) => I(A.id)
|
|
2169
2194
|
}, [
|
|
2170
|
-
|
|
2195
|
+
h(z, {
|
|
2171
2196
|
name: "close",
|
|
2172
2197
|
size: "sm"
|
|
2173
2198
|
})
|
|
2174
|
-
], 8,
|
|
2199
|
+
], 8, Ro)
|
|
2175
2200
|
]))), 128))
|
|
2176
|
-
])) :
|
|
2177
|
-
|
|
2201
|
+
])) : T("", !0),
|
|
2202
|
+
h(C, {
|
|
2178
2203
|
"close-on-click": !0,
|
|
2179
2204
|
placement: "bottom-start"
|
|
2180
2205
|
}, {
|
|
2181
2206
|
"menu-button": J(() => [
|
|
2182
|
-
|
|
2207
|
+
h(E, {
|
|
2183
2208
|
label: n(d)("inventory.recipe.bulkEditor.step1.filter"),
|
|
2184
2209
|
variant: "secondary",
|
|
2185
2210
|
size: "md",
|
|
@@ -2188,50 +2213,50 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2188
2213
|
}, null, 8, ["label"])
|
|
2189
2214
|
]),
|
|
2190
2215
|
default: J(() => [
|
|
2191
|
-
|
|
2216
|
+
h(g, {
|
|
2192
2217
|
label: n(d)("inventory.recipe.bulkEditor.step1.filterTypeIngredient"),
|
|
2193
2218
|
icon: "inventory_2",
|
|
2194
|
-
onClick: e[2] || (e[2] = (
|
|
2219
|
+
onClick: e[2] || (e[2] = (A) => B("ingredient"))
|
|
2195
2220
|
}, null, 8, ["label"]),
|
|
2196
|
-
|
|
2221
|
+
h(g, {
|
|
2197
2222
|
label: n(d)("inventory.recipe.bulkEditor.step1.filterTypeRecipe"),
|
|
2198
2223
|
icon: "restaurant_menu",
|
|
2199
|
-
onClick: e[3] || (e[3] = (
|
|
2224
|
+
onClick: e[3] || (e[3] = (A) => B("recipe"))
|
|
2200
2225
|
}, null, 8, ["label"])
|
|
2201
2226
|
]),
|
|
2202
2227
|
_: 1
|
|
2203
2228
|
})
|
|
2204
2229
|
]),
|
|
2205
|
-
|
|
2206
|
-
n(t).selectedRecipes.length === 0 ? (b(),
|
|
2207
|
-
|
|
2230
|
+
v("div", Ao, [
|
|
2231
|
+
n(t).selectedRecipes.length === 0 ? (b(), V("div", To, [
|
|
2232
|
+
h(z, {
|
|
2208
2233
|
name: "search_off",
|
|
2209
2234
|
size: "lg",
|
|
2210
2235
|
class: "text-fm-color-typo-placeholder"
|
|
2211
2236
|
}),
|
|
2212
|
-
|
|
2213
|
-
])) : (b(),
|
|
2214
|
-
(b(!0),
|
|
2215
|
-
key:
|
|
2237
|
+
v("p", Uo, U(n(d)("inventory.recipe.bulkEditor.query.noResults")), 1)
|
|
2238
|
+
])) : (b(), V("div", Po, [
|
|
2239
|
+
(b(!0), V(X, null, me(n(t).selectedRecipes, (A) => (b(), V("div", {
|
|
2240
|
+
key: A._id,
|
|
2216
2241
|
class: "flex items-center gap-12 px-16 py-12 hover:bg-fm-color-surface-hover transition-colors"
|
|
2217
2242
|
}, [
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2243
|
+
v("div", Mo, [
|
|
2244
|
+
v("div", Do, U(A.name), 1),
|
|
2245
|
+
A.contains.length > 0 ? (b(), V("div", Go, U(S(A)), 1)) : T("", !0),
|
|
2246
|
+
v("div", No, [
|
|
2247
|
+
A.version === "v2" ? (b(), Y(F, {
|
|
2223
2248
|
key: 0,
|
|
2224
2249
|
size: "sm",
|
|
2225
2250
|
label: "V2",
|
|
2226
2251
|
variant: "info"
|
|
2227
|
-
})) :
|
|
2252
|
+
})) : T("", !0)
|
|
2228
2253
|
])
|
|
2229
2254
|
]),
|
|
2230
|
-
|
|
2255
|
+
h(E, {
|
|
2231
2256
|
variant: "tertiary",
|
|
2232
2257
|
icon: "do_not_disturb_on",
|
|
2233
2258
|
title: n(d)("inventory.recipe.bulkEditor.step1.removeRecipeTooltip"),
|
|
2234
|
-
onClick: (P) => n(t).removeRecipe(
|
|
2259
|
+
onClick: (P) => n(t).removeRecipe(A._id)
|
|
2235
2260
|
}, null, 8, ["title", "onClick"])
|
|
2236
2261
|
]))), 128))
|
|
2237
2262
|
]))
|
|
@@ -2239,16 +2264,16 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2239
2264
|
]);
|
|
2240
2265
|
};
|
|
2241
2266
|
}
|
|
2242
|
-
}),
|
|
2267
|
+
}), Oo = { class: "flex flex-col gap-0 rounded-lg border border-fm-color-border-default bg-fm-color-surface-default overflow-hidden" }, Lo = { class: "flex items-start gap-12 px-16 py-12" }, jo = { class: "flex-1" }, Ko = { class: "flex-1" }, qo = {
|
|
2243
2268
|
key: 0,
|
|
2244
2269
|
class: "border-t border-fm-color-border-default px-16 py-10 flex items-center gap-10"
|
|
2245
|
-
},
|
|
2270
|
+
}, Wo = {
|
|
2246
2271
|
key: 1,
|
|
2247
2272
|
class: "border-t border-fm-color-border-default px-16 py-10 flex items-start gap-8 bg-fm-color-surface-warning"
|
|
2248
|
-
},
|
|
2273
|
+
}, Yo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-warning" }, Jo = {
|
|
2249
2274
|
key: 2,
|
|
2250
2275
|
class: "border-t border-fm-color-border-default px-16 py-12 flex flex-col gap-12"
|
|
2251
|
-
},
|
|
2276
|
+
}, Ho = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary -mb-4" }, Qo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, 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-warning" }, ei = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary -mt-8" }, ti = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary -mb-4" }, ni = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, oi = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ii = /* @__PURE__ */ le({
|
|
2252
2277
|
__name: "ModificationCard",
|
|
2253
2278
|
props: {
|
|
2254
2279
|
modelValue: {},
|
|
@@ -2256,20 +2281,20 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2256
2281
|
},
|
|
2257
2282
|
emits: ["update:modelValue"],
|
|
2258
2283
|
setup(m, { emit: d }) {
|
|
2259
|
-
const l = m, t = d, { t: i } =
|
|
2260
|
-
function u(
|
|
2261
|
-
const M =
|
|
2284
|
+
const l = m, t = d, { t: i } = ie(), r = ne(), x = We();
|
|
2285
|
+
function u(w) {
|
|
2286
|
+
const M = 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;
|
|
2262
2287
|
return M ? M === "RECIPE" ? "recipe" : "ingredient" : null;
|
|
2263
2288
|
}
|
|
2264
|
-
function o(
|
|
2265
|
-
return
|
|
2289
|
+
function o(w) {
|
|
2290
|
+
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
2291
|
}
|
|
2267
|
-
function s(
|
|
2268
|
-
switch (
|
|
2292
|
+
function s(w) {
|
|
2293
|
+
switch (w.type) {
|
|
2269
2294
|
case "add-binding":
|
|
2270
2295
|
return "link";
|
|
2271
2296
|
case "replace-binding":
|
|
2272
|
-
return
|
|
2297
|
+
return w.from.id === w.to.id ? "update" : null;
|
|
2273
2298
|
case "remove-binding":
|
|
2274
2299
|
return "remove";
|
|
2275
2300
|
case "update-binding-rule":
|
|
@@ -2278,79 +2303,79 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2278
2303
|
return "alts";
|
|
2279
2304
|
}
|
|
2280
2305
|
}
|
|
2281
|
-
function
|
|
2282
|
-
return
|
|
2306
|
+
function a(w) {
|
|
2307
|
+
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
2308
|
}
|
|
2284
|
-
function p(
|
|
2285
|
-
return
|
|
2309
|
+
function p(w) {
|
|
2310
|
+
return w.type === "add-binding" && w.binding.id || null;
|
|
2286
2311
|
}
|
|
2287
|
-
function $(
|
|
2288
|
-
const M =
|
|
2312
|
+
function $(w) {
|
|
2313
|
+
const M = w.type === "replace-binding" ? w.to : w.type === "add-binding" ? w.binding : null;
|
|
2289
2314
|
return M ? { amount: M.amount, measurement: M.measurement ?? null } : ye();
|
|
2290
2315
|
}
|
|
2291
|
-
function
|
|
2292
|
-
return
|
|
2316
|
+
function B(w) {
|
|
2317
|
+
return w.type === "replace-binding" ? w.to.rules ?? null : w.type === "add-binding" ? w.binding.rules ?? null : null;
|
|
2293
2318
|
}
|
|
2294
|
-
function I(
|
|
2295
|
-
return
|
|
2319
|
+
function I(w) {
|
|
2320
|
+
return w.type === "update-alternatives" ? w.alternatives ?? [] : w.type === "add-binding" ? w.binding.alternatives ?? [] : [];
|
|
2296
2321
|
}
|
|
2297
|
-
const f =
|
|
2322
|
+
const f = W(u(l.modelValue)), k = W(s(l.modelValue)), S = W(o(l.modelValue)), y = W(a(l.modelValue)), e = W(p(l.modelValue)), E = W($(l.modelValue)), c = W(B(l.modelValue)), _ = W(I(l.modelValue)), N = W(
|
|
2298
2323
|
(() => {
|
|
2299
|
-
const
|
|
2300
|
-
return
|
|
2324
|
+
const w = $(l.modelValue);
|
|
2325
|
+
return w.amount ? Q(w.amount) : "";
|
|
2301
2326
|
})()
|
|
2302
2327
|
);
|
|
2303
|
-
let
|
|
2304
|
-
function w
|
|
2305
|
-
|
|
2306
|
-
const M = +
|
|
2307
|
-
|
|
2308
|
-
amount:
|
|
2328
|
+
let z = null;
|
|
2329
|
+
function g(w) {
|
|
2330
|
+
N.value = w, z && clearTimeout(z), z = setTimeout(() => {
|
|
2331
|
+
const M = +w;
|
|
2332
|
+
E.value = {
|
|
2333
|
+
amount: w.length > 0 && isFinite(M) ? Ke(M) : { amount: 0, precision: 0 },
|
|
2309
2334
|
measurement: null
|
|
2310
2335
|
};
|
|
2311
2336
|
}, 300);
|
|
2312
2337
|
}
|
|
2313
2338
|
ue(f, () => {
|
|
2314
|
-
|
|
2315
|
-
}), ue(
|
|
2316
|
-
|
|
2317
|
-
}), ue(S, (
|
|
2318
|
-
|
|
2339
|
+
k.value = null, S.value = !1, y.value = null, e.value = null, E.value = ye(), c.value = null, _.value = [], N.value = "";
|
|
2340
|
+
}), ue(k, () => {
|
|
2341
|
+
y.value = null, e.value = null, E.value = ye(), c.value = null, _.value = [], N.value = "";
|
|
2342
|
+
}), ue(S, (w) => {
|
|
2343
|
+
w || (_.value = [], k.value === "alts" && (k.value = null));
|
|
2319
2344
|
});
|
|
2320
|
-
const
|
|
2345
|
+
const C = R(() => [
|
|
2321
2346
|
{ label: i("inventory.recipe.bulkEditor.step2.fieldIngredient"), value: "ingredient" },
|
|
2322
2347
|
{ label: i("inventory.recipe.bulkEditor.step2.fieldRecipe"), value: "recipe" }
|
|
2323
|
-
]),
|
|
2324
|
-
const
|
|
2348
|
+
]), F = R(() => {
|
|
2349
|
+
const w = [
|
|
2325
2350
|
{ label: i("inventory.recipe.bulkEditor.step2.actionLink"), value: "link" },
|
|
2326
2351
|
{ label: i("inventory.recipe.bulkEditor.step2.actionUpdate"), value: "update" },
|
|
2327
2352
|
{ label: i("inventory.recipe.bulkEditor.step2.actionRemove"), value: "remove" }
|
|
2328
2353
|
];
|
|
2329
|
-
return f.value === "ingredient" && S.value &&
|
|
2330
|
-
}),
|
|
2331
|
-
() =>
|
|
2332
|
-
),
|
|
2333
|
-
() =>
|
|
2354
|
+
return f.value === "ingredient" && S.value && x.enableRecipeV2 && w.push({ label: i("inventory.recipe.bulkEditor.step2.actionAlts"), value: "alts" }), w;
|
|
2355
|
+
}), A = R(() => f.value !== null && k.value !== null), P = R(
|
|
2356
|
+
() => k.value === "update" || k.value === "remove" || k.value === "alts"
|
|
2357
|
+
), K = R(
|
|
2358
|
+
() => k.value === "link"
|
|
2334
2359
|
), H = R(
|
|
2335
|
-
() =>
|
|
2336
|
-
),
|
|
2337
|
-
() => f.value === "ingredient" && S.value &&
|
|
2338
|
-
),
|
|
2339
|
-
() =>
|
|
2340
|
-
),
|
|
2341
|
-
() =>
|
|
2342
|
-
),
|
|
2343
|
-
const
|
|
2344
|
-
return
|
|
2345
|
-
}), fe = R(() =>
|
|
2346
|
-
(
|
|
2360
|
+
() => k.value === "update" && y.value !== null
|
|
2361
|
+
), ee = R(
|
|
2362
|
+
() => f.value === "ingredient" && S.value && x.enableRecipeV2
|
|
2363
|
+
), O = R(
|
|
2364
|
+
() => r.skus.map((w) => ({ label: w.name, sublabel: w.code, value: w._id }))
|
|
2365
|
+
), D = R(
|
|
2366
|
+
() => r.recipes.map((w) => ({ label: w.name, value: w._id }))
|
|
2367
|
+
), L = R(() => f.value === "recipe" ? D.value : O.value), q = R(() => f.value === "recipe" ? D.value : O.value), oe = R(() => f.value !== "ingredient" || !e.value ? null : r.skuById[e.value] ?? null), Z = R(() => f.value !== "ingredient" || !y.value ? null : r.skuById[y.value] ?? null), ae = R(() => {
|
|
2368
|
+
const w = y.value ?? e.value;
|
|
2369
|
+
return w ? [w] : [];
|
|
2370
|
+
}), fe = R(() => ee.value ? Object.values(l.livePreviewEntries).filter(
|
|
2371
|
+
(w) => w.original.version !== "v2"
|
|
2347
2372
|
).length : 0), xe = R(() => Object.values(l.livePreviewEntries).length);
|
|
2348
2373
|
ue(
|
|
2349
|
-
() => [
|
|
2350
|
-
([
|
|
2351
|
-
if (
|
|
2374
|
+
() => [k.value, y.value],
|
|
2375
|
+
([w, M], [te, pe]) => {
|
|
2376
|
+
if (w !== "alts" || M === pe) return;
|
|
2352
2377
|
if (!M) {
|
|
2353
|
-
|
|
2378
|
+
_.value = [];
|
|
2354
2379
|
return;
|
|
2355
2380
|
}
|
|
2356
2381
|
const $e = Object.values(l.livePreviewEntries).find(
|
|
@@ -2358,187 +2383,187 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2358
2383
|
);
|
|
2359
2384
|
if ($e) {
|
|
2360
2385
|
const j = $e.original.contains.find((Ie) => Ie.type === "SKU" && Ie.id === M);
|
|
2361
|
-
|
|
2386
|
+
_.value = j != null && j.alternatives ? [...j.alternatives] : [];
|
|
2362
2387
|
} else
|
|
2363
|
-
|
|
2388
|
+
_.value = [];
|
|
2364
2389
|
}
|
|
2365
2390
|
);
|
|
2366
|
-
const
|
|
2367
|
-
(
|
|
2391
|
+
const re = R(() => k.value !== "alts" || !y.value ? 0 : Object.values(l.livePreviewEntries).filter(
|
|
2392
|
+
(w) => w.original.version === "v2" && w.original.contains.some((M) => M.type === "SKU" && M.id === y.value)
|
|
2368
2393
|
).length);
|
|
2369
2394
|
function ve() {
|
|
2370
2395
|
return f.value === "recipe" ? "RECIPE" : "SKU";
|
|
2371
2396
|
}
|
|
2372
2397
|
function ce() {
|
|
2373
|
-
const
|
|
2374
|
-
type:
|
|
2398
|
+
const w = ve(), M = ye().amount, te = {
|
|
2399
|
+
type: w,
|
|
2375
2400
|
id: "",
|
|
2376
2401
|
amount: M,
|
|
2377
2402
|
measurement: null,
|
|
2378
2403
|
rules: null,
|
|
2379
2404
|
alternatives: []
|
|
2380
2405
|
};
|
|
2381
|
-
switch (
|
|
2406
|
+
switch (k.value) {
|
|
2382
2407
|
case "update":
|
|
2383
|
-
return { type: "replace-binding", from: { type:
|
|
2408
|
+
return { type: "replace-binding", from: { type: w, id: "" }, to: te };
|
|
2384
2409
|
case "remove":
|
|
2385
|
-
return { type: "remove-binding", target: { type:
|
|
2410
|
+
return { type: "remove-binding", target: { type: w, id: "" } };
|
|
2386
2411
|
case "alts":
|
|
2387
|
-
return { type: "update-alternatives", target: { type:
|
|
2412
|
+
return { type: "update-alternatives", target: { type: w, id: "" }, alternatives: [] };
|
|
2388
2413
|
case "link":
|
|
2389
2414
|
default:
|
|
2390
2415
|
return { type: "add-binding", binding: te };
|
|
2391
2416
|
}
|
|
2392
2417
|
}
|
|
2393
2418
|
function Ue() {
|
|
2394
|
-
return
|
|
2419
|
+
return y.value ? { type: ve(), id: y.value } : null;
|
|
2395
2420
|
}
|
|
2396
|
-
function Ye(
|
|
2397
|
-
const M =
|
|
2421
|
+
function Ye(w = !1) {
|
|
2422
|
+
const M = w ? y.value : e.value;
|
|
2398
2423
|
if (!M) return null;
|
|
2399
|
-
const { amount: te, measurement: pe } =
|
|
2424
|
+
const { amount: te, measurement: pe } = E.value, Ee = pe ? he.multiplyDecimal(te, pe.conversion) : te;
|
|
2400
2425
|
return {
|
|
2401
2426
|
type: ve(),
|
|
2402
2427
|
id: M,
|
|
2403
2428
|
amount: Ee,
|
|
2404
2429
|
measurement: pe ?? null,
|
|
2405
2430
|
rules: f.value === "recipe" ? c.value ?? null : null,
|
|
2406
|
-
alternatives:
|
|
2431
|
+
alternatives: ee.value ? _.value : []
|
|
2407
2432
|
};
|
|
2408
2433
|
}
|
|
2409
2434
|
function ct() {
|
|
2410
2435
|
if (!f.value) return;
|
|
2411
|
-
if (!
|
|
2436
|
+
if (!k.value) {
|
|
2412
2437
|
t("update:modelValue", ce());
|
|
2413
2438
|
return;
|
|
2414
2439
|
}
|
|
2415
|
-
const
|
|
2440
|
+
const w = Ue(), M = Ye(!1);
|
|
2416
2441
|
let te = null;
|
|
2417
|
-
switch (
|
|
2442
|
+
switch (k.value) {
|
|
2418
2443
|
case "link":
|
|
2419
2444
|
M && (te = { type: "add-binding", binding: M });
|
|
2420
2445
|
break;
|
|
2421
2446
|
case "update": {
|
|
2422
2447
|
const pe = Ye(!0);
|
|
2423
|
-
|
|
2448
|
+
w && pe && (te = { type: "replace-binding", from: w, to: pe });
|
|
2424
2449
|
break;
|
|
2425
2450
|
}
|
|
2426
2451
|
case "remove":
|
|
2427
|
-
|
|
2452
|
+
w && (te = { type: "remove-binding", target: w });
|
|
2428
2453
|
break;
|
|
2429
2454
|
case "alts":
|
|
2430
|
-
|
|
2455
|
+
w && (te = { type: "update-alternatives", target: w, alternatives: _.value });
|
|
2431
2456
|
break;
|
|
2432
2457
|
}
|
|
2433
2458
|
t("update:modelValue", te ?? ce());
|
|
2434
2459
|
}
|
|
2435
2460
|
return ue(
|
|
2436
|
-
[f,
|
|
2461
|
+
[f, k, S, y, e, E, c, _],
|
|
2437
2462
|
() => ct(),
|
|
2438
2463
|
{ deep: !0 }
|
|
2439
|
-
), (
|
|
2464
|
+
), (w, M) => {
|
|
2440
2465
|
const te = G("FmSelect"), pe = G("FmSwitch"), Ee = G("FmIcon"), $e = G("FmTextField");
|
|
2441
|
-
return b(),
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2466
|
+
return b(), V("div", Oo, [
|
|
2467
|
+
v("div", Lo, [
|
|
2468
|
+
v("div", jo, [
|
|
2469
|
+
h(te, {
|
|
2445
2470
|
modelValue: f.value,
|
|
2446
2471
|
"onUpdate:modelValue": M[0] || (M[0] = (j) => f.value = j),
|
|
2447
|
-
items:
|
|
2472
|
+
items: C.value,
|
|
2448
2473
|
label: n(i)("inventory.recipe.bulkEditor.step2.sectionField"),
|
|
2449
2474
|
placeholder: n(i)("inventory.recipe.bulkEditor.step2.sectionField")
|
|
2450
2475
|
}, null, 8, ["modelValue", "items", "label", "placeholder"])
|
|
2451
2476
|
]),
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
modelValue:
|
|
2455
|
-
"onUpdate:modelValue": M[1] || (M[1] = (j) =>
|
|
2456
|
-
items:
|
|
2477
|
+
v("div", Ko, [
|
|
2478
|
+
h(te, {
|
|
2479
|
+
modelValue: k.value,
|
|
2480
|
+
"onUpdate:modelValue": M[1] || (M[1] = (j) => k.value = j),
|
|
2481
|
+
items: F.value,
|
|
2457
2482
|
label: n(i)("inventory.recipe.bulkEditor.step2.sectionAction"),
|
|
2458
2483
|
placeholder: n(i)("inventory.recipe.bulkEditor.step2.sectionAction")
|
|
2459
2484
|
}, null, 8, ["modelValue", "items", "label", "placeholder"])
|
|
2460
2485
|
])
|
|
2461
2486
|
]),
|
|
2462
|
-
f.value === "ingredient" && n(
|
|
2463
|
-
|
|
2487
|
+
f.value === "ingredient" && n(x).enableRecipeV2 ? (b(), V("div", qo, [
|
|
2488
|
+
h(pe, {
|
|
2464
2489
|
modelValue: S.value,
|
|
2465
2490
|
"onUpdate:modelValue": M[2] || (M[2] = (j) => S.value = j),
|
|
2466
2491
|
label: n(i)("inventory.recipe.bulkEditor.step2.includeAlternativesToggle")
|
|
2467
2492
|
}, null, 8, ["modelValue", "label"])
|
|
2468
|
-
])) :
|
|
2469
|
-
|
|
2470
|
-
|
|
2493
|
+
])) : T("", !0),
|
|
2494
|
+
ee.value && fe.value > 0 ? (b(), V("div", Wo, [
|
|
2495
|
+
h(Ee, {
|
|
2471
2496
|
name: "warning",
|
|
2472
2497
|
size: "sm",
|
|
2473
2498
|
class: "text-fm-color-typo-warning mt-1 shrink-0"
|
|
2474
2499
|
}),
|
|
2475
|
-
|
|
2500
|
+
v("p", Yo, U(n(i)("inventory.recipe.bulkEditor.step2.v1AlternativesWarning", {
|
|
2476
2501
|
v1Count: fe.value,
|
|
2477
2502
|
total: xe.value
|
|
2478
2503
|
})), 1)
|
|
2479
|
-
])) :
|
|
2480
|
-
|
|
2481
|
-
P.value ? (b(),
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
modelValue:
|
|
2485
|
-
"onUpdate:modelValue": M[3] || (M[3] = (j) =>
|
|
2486
|
-
items:
|
|
2504
|
+
])) : T("", !0),
|
|
2505
|
+
A.value ? (b(), V("div", Jo, [
|
|
2506
|
+
P.value ? (b(), V(X, { key: 0 }, [
|
|
2507
|
+
v("p", Ho, U(n(i)("inventory.recipe.bulkEditor.addModification.targetLabel")), 1),
|
|
2508
|
+
h(te, {
|
|
2509
|
+
modelValue: y.value,
|
|
2510
|
+
"onUpdate:modelValue": M[3] || (M[3] = (j) => y.value = j),
|
|
2511
|
+
items: L.value,
|
|
2487
2512
|
placeholder: f.value === "recipe" ? n(i)("inventory.recipe.bulkEditor.addModification.recipePlaceholder") : n(i)("inventory.recipe.bulkEditor.addModification.skuPlaceholder"),
|
|
2488
2513
|
clearable: ""
|
|
2489
2514
|
}, {
|
|
2490
2515
|
"menu-wrapper": J((j) => [
|
|
2491
|
-
|
|
2492
|
-
items:
|
|
2493
|
-
"model-value":
|
|
2516
|
+
h(Fe, we(j, {
|
|
2517
|
+
items: L.value,
|
|
2518
|
+
"model-value": y.value
|
|
2494
2519
|
}), null, 16, ["items", "model-value"])
|
|
2495
2520
|
]),
|
|
2496
2521
|
_: 1
|
|
2497
2522
|
}, 8, ["modelValue", "items", "placeholder"]),
|
|
2498
|
-
H.value ? (b(),
|
|
2499
|
-
f.value === "ingredient" &&
|
|
2523
|
+
H.value ? (b(), V(X, { key: 0 }, [
|
|
2524
|
+
f.value === "ingredient" && Z.value ? (b(), Y(Ce, {
|
|
2500
2525
|
key: 0,
|
|
2501
|
-
modelValue:
|
|
2502
|
-
"onUpdate:modelValue": M[4] || (M[4] = (j) =>
|
|
2503
|
-
unit:
|
|
2526
|
+
modelValue: E.value,
|
|
2527
|
+
"onUpdate:modelValue": M[4] || (M[4] = (j) => E.value = j),
|
|
2528
|
+
unit: Z.value.unit,
|
|
2504
2529
|
placeholder: n(i)("inventory.recipe.bulkEditor.query.amountPlaceholder"),
|
|
2505
2530
|
"convert-amount-on-change-unit": ""
|
|
2506
2531
|
}, null, 8, ["modelValue", "unit", "placeholder"])) : f.value === "recipe" ? (b(), Y($e, {
|
|
2507
2532
|
key: 1,
|
|
2508
|
-
"model-value":
|
|
2533
|
+
"model-value": N.value,
|
|
2509
2534
|
label: n(i)("inventory.recipe.bulkEditor.addModification.amountLabel"),
|
|
2510
2535
|
type: "number",
|
|
2511
|
-
"onUpdate:modelValue": M[5] || (M[5] = (j) =>
|
|
2512
|
-
}, null, 8, ["model-value", "label"])) :
|
|
2513
|
-
f.value === "recipe" ? (b(),
|
|
2514
|
-
|
|
2515
|
-
|
|
2536
|
+
"onUpdate:modelValue": M[5] || (M[5] = (j) => g(j))
|
|
2537
|
+
}, null, 8, ["model-value", "label"])) : T("", !0),
|
|
2538
|
+
f.value === "recipe" ? (b(), V(X, { key: 2 }, [
|
|
2539
|
+
v("p", Qo, U(n(i)("inventory.recipe.bulkEditor.addModification.optionalRuleLabel")), 1),
|
|
2540
|
+
h(Re, {
|
|
2516
2541
|
modelValue: c.value,
|
|
2517
2542
|
"onUpdate:modelValue": M[6] || (M[6] = (j) => c.value = j)
|
|
2518
2543
|
}, null, 8, ["modelValue"])
|
|
2519
|
-
], 64)) :
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
modelValue:
|
|
2524
|
-
"onUpdate:modelValue": M[7] || (M[7] = (j) =>
|
|
2525
|
-
"filter-ingredient-ids":
|
|
2544
|
+
], 64)) : T("", !0),
|
|
2545
|
+
ee.value ? (b(), V(X, { key: 3 }, [
|
|
2546
|
+
v("p", Xo, U(n(i)("inventory.recipe.bulkEditor.addModification.optionalAlternativesLabel")), 1),
|
|
2547
|
+
h(Se, {
|
|
2548
|
+
modelValue: _.value,
|
|
2549
|
+
"onUpdate:modelValue": M[7] || (M[7] = (j) => _.value = j),
|
|
2550
|
+
"filter-ingredient-ids": ae.value
|
|
2526
2551
|
}, null, 8, ["modelValue", "filter-ingredient-ids"])
|
|
2527
|
-
], 64)) :
|
|
2528
|
-
], 64)) :
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
modelValue:
|
|
2534
|
-
"onUpdate:modelValue": M[8] || (M[8] = (j) =>
|
|
2535
|
-
"filter-ingredient-ids":
|
|
2552
|
+
], 64)) : T("", !0)
|
|
2553
|
+
], 64)) : T("", !0),
|
|
2554
|
+
k.value === "alts" && y.value ? (b(), V(X, { key: 1 }, [
|
|
2555
|
+
v("p", Zo, U(re.value > 0 ? n(i)("inventory.recipe.bulkEditor.addModification.altsOverwriteWarning", { count: re.value }) : n(i)("inventory.recipe.bulkEditor.addModification.altsNotFoundWarning")), 1),
|
|
2556
|
+
v("p", ei, U(n(i)("inventory.recipe.bulkEditor.addModification.altsClearNote")), 1),
|
|
2557
|
+
h(Se, {
|
|
2558
|
+
modelValue: _.value,
|
|
2559
|
+
"onUpdate:modelValue": M[8] || (M[8] = (j) => _.value = j),
|
|
2560
|
+
"filter-ingredient-ids": ae.value
|
|
2536
2561
|
}, null, 8, ["modelValue", "filter-ingredient-ids"])
|
|
2537
|
-
], 64)) :
|
|
2538
|
-
], 64)) :
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2562
|
+
], 64)) : T("", !0)
|
|
2563
|
+
], 64)) : T("", !0),
|
|
2564
|
+
K.value ? (b(), V(X, { key: 1 }, [
|
|
2565
|
+
v("p", ti, U(n(i)("inventory.recipe.bulkEditor.addModification.bindingLabel")), 1),
|
|
2566
|
+
h(te, {
|
|
2542
2567
|
modelValue: e.value,
|
|
2543
2568
|
"onUpdate:modelValue": M[9] || (M[9] = (j) => e.value = j),
|
|
2544
2569
|
items: q.value,
|
|
@@ -2546,90 +2571,90 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2546
2571
|
clearable: ""
|
|
2547
2572
|
}, {
|
|
2548
2573
|
"menu-wrapper": J((j) => [
|
|
2549
|
-
|
|
2574
|
+
h(Fe, we(j, {
|
|
2550
2575
|
items: q.value,
|
|
2551
2576
|
"model-value": e.value
|
|
2552
2577
|
}), null, 16, ["items", "model-value"])
|
|
2553
2578
|
]),
|
|
2554
2579
|
_: 1
|
|
2555
2580
|
}, 8, ["modelValue", "items", "placeholder"]),
|
|
2556
|
-
e.value ? (b(),
|
|
2557
|
-
f.value === "ingredient" &&
|
|
2581
|
+
e.value ? (b(), V(X, { key: 0 }, [
|
|
2582
|
+
f.value === "ingredient" && oe.value ? (b(), Y(Ce, {
|
|
2558
2583
|
key: 0,
|
|
2559
|
-
modelValue:
|
|
2560
|
-
"onUpdate:modelValue": M[10] || (M[10] = (j) =>
|
|
2561
|
-
unit:
|
|
2584
|
+
modelValue: E.value,
|
|
2585
|
+
"onUpdate:modelValue": M[10] || (M[10] = (j) => E.value = j),
|
|
2586
|
+
unit: oe.value.unit,
|
|
2562
2587
|
placeholder: n(i)("inventory.recipe.bulkEditor.query.amountPlaceholder"),
|
|
2563
2588
|
"convert-amount-on-change-unit": ""
|
|
2564
2589
|
}, null, 8, ["modelValue", "unit", "placeholder"])) : f.value === "recipe" ? (b(), Y($e, {
|
|
2565
2590
|
key: 1,
|
|
2566
|
-
"model-value":
|
|
2591
|
+
"model-value": N.value,
|
|
2567
2592
|
label: n(i)("inventory.recipe.bulkEditor.addModification.amountLabel"),
|
|
2568
2593
|
type: "number",
|
|
2569
|
-
"onUpdate:modelValue": M[11] || (M[11] = (j) =>
|
|
2570
|
-
}, null, 8, ["model-value", "label"])) :
|
|
2571
|
-
f.value === "recipe" ? (b(),
|
|
2572
|
-
|
|
2573
|
-
|
|
2594
|
+
"onUpdate:modelValue": M[11] || (M[11] = (j) => g(j))
|
|
2595
|
+
}, null, 8, ["model-value", "label"])) : T("", !0),
|
|
2596
|
+
f.value === "recipe" ? (b(), V(X, { key: 2 }, [
|
|
2597
|
+
v("p", ni, U(n(i)("inventory.recipe.bulkEditor.addModification.optionalRuleLabel")), 1),
|
|
2598
|
+
h(Re, {
|
|
2574
2599
|
modelValue: c.value,
|
|
2575
2600
|
"onUpdate:modelValue": M[12] || (M[12] = (j) => c.value = j)
|
|
2576
2601
|
}, null, 8, ["modelValue"])
|
|
2577
|
-
], 64)) :
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
modelValue:
|
|
2582
|
-
"onUpdate:modelValue": M[13] || (M[13] = (j) =>
|
|
2583
|
-
"filter-ingredient-ids":
|
|
2602
|
+
], 64)) : T("", !0),
|
|
2603
|
+
ee.value ? (b(), V(X, { key: 3 }, [
|
|
2604
|
+
v("p", oi, U(n(i)("inventory.recipe.bulkEditor.addModification.optionalAlternativesLabel")), 1),
|
|
2605
|
+
h(Se, {
|
|
2606
|
+
modelValue: _.value,
|
|
2607
|
+
"onUpdate:modelValue": M[13] || (M[13] = (j) => _.value = j),
|
|
2608
|
+
"filter-ingredient-ids": ae.value
|
|
2584
2609
|
}, null, 8, ["modelValue", "filter-ingredient-ids"])
|
|
2585
|
-
], 64)) :
|
|
2586
|
-
], 64)) :
|
|
2587
|
-
], 64)) :
|
|
2588
|
-
])) :
|
|
2610
|
+
], 64)) : T("", !0)
|
|
2611
|
+
], 64)) : T("", !0)
|
|
2612
|
+
], 64)) : T("", !0)
|
|
2613
|
+
])) : T("", !0)
|
|
2589
2614
|
]);
|
|
2590
2615
|
};
|
|
2591
2616
|
}
|
|
2592
|
-
}),
|
|
2617
|
+
}), li = { class: "flex flex-col gap-8" }, ri = { class: "flex flex-wrap items-center gap-12 px-4" }, ai = {
|
|
2593
2618
|
key: 0,
|
|
2594
2619
|
class: "flex items-center gap-6"
|
|
2595
|
-
},
|
|
2620
|
+
}, si = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, di = {
|
|
2596
2621
|
key: 1,
|
|
2597
2622
|
class: "flex items-center gap-6"
|
|
2598
|
-
},
|
|
2623
|
+
}, ui = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ci = {
|
|
2599
2624
|
key: 2,
|
|
2600
2625
|
class: "flex items-center gap-6"
|
|
2601
|
-
},
|
|
2626
|
+
}, pi = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, mi = { class: "rounded-lg border border-fm-color-border-default overflow-hidden" }, fi = {
|
|
2602
2627
|
key: 0,
|
|
2603
2628
|
class: "px-16 py-12 text-center fm-typo-en-body-sm-400 text-fm-color-typo-placeholder"
|
|
2604
|
-
},
|
|
2629
|
+
}, vi = {
|
|
2605
2630
|
key: 1,
|
|
2606
2631
|
class: "divide-y divide-fm-color-border-default"
|
|
2607
|
-
},
|
|
2632
|
+
}, yi = { class: "flex items-center gap-12" }, bi = { class: "flex-1 fm-typo-en-body-sm-600 text-fm-color-typo-primary truncate" }, gi = {
|
|
2608
2633
|
key: 0,
|
|
2609
2634
|
class: "flex flex-col gap-4 pl-8"
|
|
2610
|
-
},
|
|
2635
|
+
}, _i = { class: "flex-1 fm-typo-en-body-xs-400 text-fm-color-typo-secondary font-mono truncate" }, ki = /* @__PURE__ */ le({
|
|
2611
2636
|
__name: "LivePreviewTable",
|
|
2612
2637
|
setup(m) {
|
|
2613
|
-
const { t: d } =
|
|
2638
|
+
const { t: d } = ie(), l = ge(), t = ne(), i = {
|
|
2614
2639
|
"will-update": 0,
|
|
2615
2640
|
"partially-ignored": 1,
|
|
2616
2641
|
"already-satisfied": 2,
|
|
2617
2642
|
blocked: 3,
|
|
2618
2643
|
"no-applicable-changes": 4
|
|
2619
|
-
},
|
|
2644
|
+
}, r = R(
|
|
2620
2645
|
() => Object.values(l.livePreviewEntries).sort(
|
|
2621
|
-
(e,
|
|
2646
|
+
(e, E) => i[e.status] - i[E.status]
|
|
2622
2647
|
)
|
|
2623
|
-
),
|
|
2624
|
-
() =>
|
|
2648
|
+
), x = R(
|
|
2649
|
+
() => r.value.filter((e) => e.status === "will-update").length
|
|
2625
2650
|
), u = R(
|
|
2626
|
-
() =>
|
|
2651
|
+
() => r.value.filter((e) => e.status === "partially-ignored").length
|
|
2627
2652
|
), o = R(
|
|
2628
|
-
() =>
|
|
2653
|
+
() => r.value.filter((e) => e.status === "already-satisfied").length
|
|
2629
2654
|
), s = R(
|
|
2630
|
-
() =>
|
|
2655
|
+
() => r.value.filter((e) => e.status === "blocked").length
|
|
2631
2656
|
);
|
|
2632
|
-
function
|
|
2657
|
+
function a(e) {
|
|
2633
2658
|
switch (e) {
|
|
2634
2659
|
case "will-update":
|
|
2635
2660
|
return d("inventory.recipe.bulkEditor.status.willUpdate");
|
|
@@ -2661,34 +2686,34 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2661
2686
|
return "neutral";
|
|
2662
2687
|
}
|
|
2663
2688
|
}
|
|
2664
|
-
function $(e,
|
|
2665
|
-
var c,
|
|
2666
|
-
return e === "SKU" ? ((c = t.skuById[
|
|
2689
|
+
function $(e, E) {
|
|
2690
|
+
var c, _, N;
|
|
2691
|
+
return e === "SKU" ? ((c = t.skuById[E]) == null ? void 0 : c.name) ?? E : e === "SKU_GROUP" ? ((_ = t.skuGroupById[E]) == null ? void 0 : _.name) ?? E : e === "RECIPE" ? ((N = t.recipeById[E]) == null ? void 0 : N.name) ?? E : E;
|
|
2667
2692
|
}
|
|
2668
|
-
function
|
|
2669
|
-
var c,
|
|
2670
|
-
const
|
|
2693
|
+
function B(e) {
|
|
2694
|
+
var c, _;
|
|
2695
|
+
const E = $(e.type, e.id);
|
|
2671
2696
|
if (e.type === "SKU") {
|
|
2672
|
-
const
|
|
2673
|
-
return `${
|
|
2697
|
+
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) ?? "";
|
|
2698
|
+
return `${E} (${Q(e.amount)} ${z})`.trim();
|
|
2674
2699
|
}
|
|
2675
|
-
return e.type === "RECIPE" ? `${
|
|
2700
|
+
return e.type === "RECIPE" ? `${E} ×${Q(e.amount)}` : E;
|
|
2676
2701
|
}
|
|
2677
2702
|
function I(e) {
|
|
2678
2703
|
return $(e.type, e.id);
|
|
2679
2704
|
}
|
|
2680
|
-
function f(e,
|
|
2681
|
-
const c =
|
|
2682
|
-
return c ?
|
|
2705
|
+
function f(e, E) {
|
|
2706
|
+
const c = E.contains.find((_) => _.type === e.type && _.id === e.id);
|
|
2707
|
+
return c ? B(c) : I(e);
|
|
2683
2708
|
}
|
|
2684
|
-
function
|
|
2709
|
+
function k(e, E) {
|
|
2685
2710
|
switch (e.type) {
|
|
2686
2711
|
case "add-binding":
|
|
2687
|
-
return `+ ${
|
|
2712
|
+
return `+ ${B(e.binding)}`;
|
|
2688
2713
|
case "remove-binding":
|
|
2689
2714
|
return `− ${I(e.target)}`;
|
|
2690
2715
|
case "replace-binding":
|
|
2691
|
-
return `${f(e.from,
|
|
2716
|
+
return `${f(e.from, E)} → ${B(e.to)}`;
|
|
2692
2717
|
case "update-binding-rule":
|
|
2693
2718
|
return `Rule: ${I(e.target)}`;
|
|
2694
2719
|
case "update-alternatives":
|
|
@@ -2709,7 +2734,7 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2709
2734
|
return "neutral";
|
|
2710
2735
|
}
|
|
2711
2736
|
}
|
|
2712
|
-
function
|
|
2737
|
+
function y(e) {
|
|
2713
2738
|
switch (e) {
|
|
2714
2739
|
case "applied":
|
|
2715
2740
|
return d("inventory.recipe.bulkEditor.livePreview.outcomeApplied");
|
|
@@ -2723,78 +2748,78 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2723
2748
|
return e;
|
|
2724
2749
|
}
|
|
2725
2750
|
}
|
|
2726
|
-
return (e,
|
|
2751
|
+
return (e, E) => {
|
|
2727
2752
|
const c = G("FmChip");
|
|
2728
|
-
return b(),
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2753
|
+
return b(), V("div", li, [
|
|
2754
|
+
v("div", ri, [
|
|
2755
|
+
x.value + u.value > 0 ? (b(), V("div", ai, [
|
|
2756
|
+
h(c, {
|
|
2732
2757
|
size: "sm",
|
|
2733
|
-
label: String(
|
|
2758
|
+
label: String(x.value + u.value),
|
|
2734
2759
|
variant: "success"
|
|
2735
2760
|
}, null, 8, ["label"]),
|
|
2736
|
-
|
|
2737
|
-
])) :
|
|
2738
|
-
o.value > 0 ? (b(),
|
|
2739
|
-
|
|
2761
|
+
v("span", si, U(n(d)("inventory.recipe.bulkEditor.livePreview.willUpdate")), 1)
|
|
2762
|
+
])) : T("", !0),
|
|
2763
|
+
o.value > 0 ? (b(), V("div", di, [
|
|
2764
|
+
h(c, {
|
|
2740
2765
|
size: "sm",
|
|
2741
2766
|
label: String(o.value),
|
|
2742
2767
|
variant: "info"
|
|
2743
2768
|
}, null, 8, ["label"]),
|
|
2744
|
-
|
|
2745
|
-
])) :
|
|
2746
|
-
s.value > 0 ? (b(),
|
|
2747
|
-
|
|
2769
|
+
v("span", ui, U(n(d)("inventory.recipe.bulkEditor.livePreview.alreadySatisfied")), 1)
|
|
2770
|
+
])) : T("", !0),
|
|
2771
|
+
s.value > 0 ? (b(), V("div", ci, [
|
|
2772
|
+
h(c, {
|
|
2748
2773
|
size: "sm",
|
|
2749
2774
|
label: String(s.value),
|
|
2750
2775
|
variant: "critical"
|
|
2751
2776
|
}, null, 8, ["label"]),
|
|
2752
|
-
|
|
2753
|
-
])) :
|
|
2777
|
+
v("span", pi, U(n(d)("inventory.recipe.bulkEditor.livePreview.blocked")), 1)
|
|
2778
|
+
])) : T("", !0)
|
|
2754
2779
|
]),
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
(b(!0),
|
|
2758
|
-
key:
|
|
2780
|
+
v("div", mi, [
|
|
2781
|
+
r.value.length === 0 ? (b(), V("div", fi, U(n(d)("inventory.recipe.bulkEditor.livePreview.noRecipes")), 1)) : (b(), V("div", vi, [
|
|
2782
|
+
(b(!0), V(X, null, me(r.value, (_) => (b(), V("div", {
|
|
2783
|
+
key: _.recipeId,
|
|
2759
2784
|
class: "flex flex-col gap-6 px-16 py-10"
|
|
2760
2785
|
}, [
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2786
|
+
v("div", yi, [
|
|
2787
|
+
v("span", bi, U(_.recipeName), 1),
|
|
2788
|
+
h(c, {
|
|
2764
2789
|
size: "sm",
|
|
2765
|
-
label:
|
|
2766
|
-
variant: p(
|
|
2790
|
+
label: a(_.status),
|
|
2791
|
+
variant: p(_.status)
|
|
2767
2792
|
}, null, 8, ["label", "variant"])
|
|
2768
2793
|
]),
|
|
2769
|
-
|
|
2770
|
-
(b(!0),
|
|
2771
|
-
key:
|
|
2794
|
+
_.changes.length > 0 ? (b(), V("div", gi, [
|
|
2795
|
+
(b(!0), V(X, null, me(_.changes, (N, z) => (b(), V("div", {
|
|
2796
|
+
key: z,
|
|
2772
2797
|
class: "flex items-center gap-8"
|
|
2773
2798
|
}, [
|
|
2774
|
-
|
|
2775
|
-
|
|
2799
|
+
v("span", _i, U(k(N.change, _.original)), 1),
|
|
2800
|
+
h(c, {
|
|
2776
2801
|
size: "sm",
|
|
2777
|
-
label:
|
|
2778
|
-
variant: S(
|
|
2802
|
+
label: y(N.outcome),
|
|
2803
|
+
variant: S(N.outcome)
|
|
2779
2804
|
}, null, 8, ["label", "variant"])
|
|
2780
2805
|
]))), 128))
|
|
2781
|
-
])) :
|
|
2806
|
+
])) : T("", !0)
|
|
2782
2807
|
]))), 128))
|
|
2783
2808
|
]))
|
|
2784
2809
|
])
|
|
2785
2810
|
]);
|
|
2786
2811
|
};
|
|
2787
2812
|
}
|
|
2788
|
-
}),
|
|
2813
|
+
}), hi = { class: "flex flex-col h-full overflow-hidden" }, xi = { class: "flex flex-col min-h-0 shrink-0" }, $i = { class: "flex items-center gap-8 px-16 pt-12 border-b border-fm-color-border-default" }, Ii = { class: "flex-1 overflow-x-auto min-w-0" }, wi = {
|
|
2789
2814
|
class: "px-16 py-14 overflow-y-auto",
|
|
2790
2815
|
style: { "max-height": "45vh" }
|
|
2791
|
-
},
|
|
2816
|
+
}, Ei = {
|
|
2792
2817
|
key: 0,
|
|
2793
2818
|
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
|
-
},
|
|
2819
|
+
}, Vi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Si = { 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" }, Ci = /* @__PURE__ */ le({
|
|
2795
2820
|
__name: "RecipeBulkEditorStep2",
|
|
2796
2821
|
setup(m) {
|
|
2797
|
-
const { t: d } =
|
|
2822
|
+
const { t: d } = ie(), l = ge(), t = W(null);
|
|
2798
2823
|
ue(
|
|
2799
2824
|
() => l.modifications.length,
|
|
2800
2825
|
(o) => {
|
|
@@ -2803,16 +2828,16 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2803
2828
|
{ immediate: !0 }
|
|
2804
2829
|
);
|
|
2805
2830
|
function i(o, s) {
|
|
2806
|
-
const
|
|
2807
|
-
return
|
|
2831
|
+
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;
|
|
2832
|
+
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
2833
|
}
|
|
2809
|
-
const
|
|
2834
|
+
const r = R(
|
|
2810
2835
|
() => l.modifications.map((o, s) => ({
|
|
2811
2836
|
label: i(o, s),
|
|
2812
2837
|
value: s
|
|
2813
2838
|
}))
|
|
2814
2839
|
);
|
|
2815
|
-
function
|
|
2840
|
+
function x() {
|
|
2816
2841
|
const s = {
|
|
2817
2842
|
type: "add-binding",
|
|
2818
2843
|
binding: {
|
|
@@ -2830,24 +2855,24 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2830
2855
|
l.removeModification(o);
|
|
2831
2856
|
}
|
|
2832
2857
|
return (o, s) => {
|
|
2833
|
-
const
|
|
2834
|
-
return b(),
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2858
|
+
const a = G("FmButton"), p = G("FmTab"), $ = G("FmTabs"), B = G("FmIcon");
|
|
2859
|
+
return b(), V("div", hi, [
|
|
2860
|
+
v("div", xi, [
|
|
2861
|
+
v("div", $i, [
|
|
2862
|
+
v("div", Ii, [
|
|
2863
|
+
r.value.length > 0 ? (b(), Y($, {
|
|
2839
2864
|
key: 0,
|
|
2840
2865
|
"model-value": t.value,
|
|
2841
|
-
items:
|
|
2866
|
+
items: r.value,
|
|
2842
2867
|
"onUpdate:modelValue": s[1] || (s[1] = (I) => t.value = I)
|
|
2843
2868
|
}, {
|
|
2844
2869
|
default: J((I) => [
|
|
2845
|
-
|
|
2870
|
+
h(p, we(I, {
|
|
2846
2871
|
"model-value": t.value,
|
|
2847
2872
|
"onUpdate:modelValue": s[0] || (s[0] = (f) => t.value = f)
|
|
2848
2873
|
}), {
|
|
2849
2874
|
append: J(() => [
|
|
2850
|
-
|
|
2875
|
+
h(a, {
|
|
2851
2876
|
variant: "tertiary",
|
|
2852
2877
|
icon: "close",
|
|
2853
2878
|
size: "md",
|
|
@@ -2858,139 +2883,139 @@ const ge = ot("recipeBulkEditor", function() {
|
|
|
2858
2883
|
}, 1040, ["model-value"])
|
|
2859
2884
|
]),
|
|
2860
2885
|
_: 1
|
|
2861
|
-
}, 8, ["model-value", "items"])) :
|
|
2886
|
+
}, 8, ["model-value", "items"])) : T("", !0)
|
|
2862
2887
|
]),
|
|
2863
|
-
|
|
2888
|
+
h(a, {
|
|
2864
2889
|
label: n(d)("inventory.recipe.bulkEditor.step2.addModification"),
|
|
2865
2890
|
variant: "secondary",
|
|
2866
2891
|
size: "md",
|
|
2867
2892
|
"prepend-icon": "add",
|
|
2868
2893
|
class: "shrink-0",
|
|
2869
|
-
onClick:
|
|
2894
|
+
onClick: x
|
|
2870
2895
|
}, null, 8, ["label"])
|
|
2871
2896
|
]),
|
|
2872
|
-
|
|
2873
|
-
n(l).modifications.length === 0 ? (b(),
|
|
2874
|
-
|
|
2897
|
+
v("div", wi, [
|
|
2898
|
+
n(l).modifications.length === 0 ? (b(), V("div", Ei, [
|
|
2899
|
+
h(B, {
|
|
2875
2900
|
name: "edit_note",
|
|
2876
2901
|
size: "lg",
|
|
2877
2902
|
class: "text-fm-color-typo-placeholder"
|
|
2878
2903
|
}),
|
|
2879
|
-
|
|
2880
|
-
])) : t.value !== null && n(l).modifications[t.value] ? (b(), Y(
|
|
2904
|
+
v("p", Vi, U(n(d)("inventory.recipe.bulkEditor.step2.emptyState")), 1)
|
|
2905
|
+
])) : t.value !== null && n(l).modifications[t.value] ? (b(), Y(ii, {
|
|
2881
2906
|
key: t.value,
|
|
2882
2907
|
"model-value": n(l).modifications[t.value],
|
|
2883
2908
|
"live-preview-entries": n(l).livePreviewEntries,
|
|
2884
2909
|
"onUpdate:modelValue": s[2] || (s[2] = (I) => n(l).updateModification(t.value, I))
|
|
2885
|
-
}, null, 8, ["model-value", "live-preview-entries"])) :
|
|
2910
|
+
}, null, 8, ["model-value", "live-preview-entries"])) : T("", !0)
|
|
2886
2911
|
])
|
|
2887
2912
|
]),
|
|
2888
|
-
s[3] || (s[3] =
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2913
|
+
s[3] || (s[3] = v("div", { class: "border-t border-fm-color-border-default shrink-0" }, null, -1)),
|
|
2914
|
+
v("div", Si, [
|
|
2915
|
+
v("span", Bi, U(n(d)("inventory.recipe.bulkEditor.step2.livePreviewTitle")), 1),
|
|
2916
|
+
h(ki)
|
|
2892
2917
|
])
|
|
2893
2918
|
]);
|
|
2894
2919
|
};
|
|
2895
2920
|
}
|
|
2896
2921
|
});
|
|
2897
|
-
function
|
|
2922
|
+
function Fi(m) {
|
|
2898
2923
|
return !m || Object.keys(m).length === 0 ? "" : Object.entries(m).map(([d, l]) => `${d}: ${l}`).join(", ");
|
|
2899
2924
|
}
|
|
2900
|
-
function
|
|
2901
|
-
const m = ne(), d = ge(), l = m.skuById, t = m.recipeById, i = m.skuGroupById,
|
|
2925
|
+
function Ri() {
|
|
2926
|
+
const m = ne(), d = ge(), l = m.skuById, t = m.recipeById, i = m.skuGroupById, x = Object.values(d.entries).filter(
|
|
2902
2927
|
(s) => s.status === "will-update" || s.status === "partially-ignored"
|
|
2903
|
-
).flatMap((s,
|
|
2904
|
-
var
|
|
2905
|
-
const p = s.projected ?? s.original, $ =
|
|
2906
|
-
if ((
|
|
2907
|
-
const I = p.contains.filter((S) => S.type === "RECIPE"), f = p.contains.filter((S) => S.type === "SKU"),
|
|
2928
|
+
).flatMap((s, a) => {
|
|
2929
|
+
var B;
|
|
2930
|
+
const p = s.projected ?? s.original, $ = Fi(p.customAttributes);
|
|
2931
|
+
if ((B = p.contains) != null && B.length) {
|
|
2932
|
+
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
2933
|
return [
|
|
2909
|
-
...
|
|
2934
|
+
...a === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
2910
2935
|
...I.map(
|
|
2911
|
-
(S,
|
|
2936
|
+
(S, y) => {
|
|
2912
2937
|
var e;
|
|
2913
2938
|
return [
|
|
2914
|
-
|
|
2939
|
+
y === 0 ? p.name : "",
|
|
2915
2940
|
"RECIPE",
|
|
2916
2941
|
"",
|
|
2917
2942
|
((e = t[S.id]) == null ? void 0 : e.name) ?? S.id,
|
|
2918
2943
|
Q(S.amount),
|
|
2919
2944
|
"UNIT",
|
|
2920
|
-
|
|
2945
|
+
y === 0 ? $ : ""
|
|
2921
2946
|
];
|
|
2922
2947
|
}
|
|
2923
2948
|
),
|
|
2924
2949
|
...f.map(
|
|
2925
|
-
(S,
|
|
2926
|
-
var e,
|
|
2950
|
+
(S, y) => {
|
|
2951
|
+
var e, E, c, _;
|
|
2927
2952
|
return [
|
|
2928
|
-
!I.length &&
|
|
2953
|
+
!I.length && y === 0 ? p.name : "",
|
|
2929
2954
|
"INGREDIENT",
|
|
2930
2955
|
((e = l[S.id]) == null ? void 0 : e.code) ?? "",
|
|
2931
|
-
((
|
|
2956
|
+
((E = l[S.id]) == null ? void 0 : E.name) ?? S.id,
|
|
2932
2957
|
Q(S.amount),
|
|
2933
|
-
S.measurement ? S.measurement.abbrev : ((
|
|
2934
|
-
!I.length &&
|
|
2958
|
+
S.measurement ? S.measurement.abbrev : ((_ = (c = l[S.id]) == null ? void 0 : c.unit) == null ? void 0 : _.abbrev) ?? "",
|
|
2959
|
+
!I.length && y === 0 ? $ : ""
|
|
2935
2960
|
];
|
|
2936
2961
|
}
|
|
2937
2962
|
),
|
|
2938
|
-
...
|
|
2939
|
-
(S,
|
|
2940
|
-
var e,
|
|
2963
|
+
...k.map(
|
|
2964
|
+
(S, y) => {
|
|
2965
|
+
var e, E;
|
|
2941
2966
|
return [
|
|
2942
|
-
I.length === 0 && f.length === 0 &&
|
|
2967
|
+
I.length === 0 && f.length === 0 && y === 0 ? p.name : "",
|
|
2943
2968
|
"SKU_GROUP",
|
|
2944
2969
|
((e = i[S.id]) == null ? void 0 : e.ref) ?? "",
|
|
2945
|
-
((
|
|
2970
|
+
((E = i[S.id]) == null ? void 0 : E.name) ?? S.id,
|
|
2946
2971
|
Q(S.amount),
|
|
2947
2972
|
"UNIT",
|
|
2948
|
-
I.length === 0 && f.length === 0 &&
|
|
2973
|
+
I.length === 0 && f.length === 0 && y === 0 ? $ : ""
|
|
2949
2974
|
];
|
|
2950
2975
|
}
|
|
2951
2976
|
)
|
|
2952
2977
|
];
|
|
2953
2978
|
}
|
|
2954
2979
|
return [
|
|
2955
|
-
...
|
|
2980
|
+
...a === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
2956
2981
|
[p.name, "No bindings", "", "", "", "", $]
|
|
2957
2982
|
];
|
|
2958
|
-
}), o =
|
|
2983
|
+
}), o = at(x, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
|
|
2959
2984
|
st(o, `RECIPE_BULK_EDIT_${dt(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
|
|
2960
2985
|
}
|
|
2961
|
-
const
|
|
2986
|
+
const Ai = { class: "flex flex-col gap-16" }, Ti = { class: "rounded-lg border border-fm-color-border-default bg-fm-color-surface-secondary p-16" }, Ui = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary mb-8" }, Pi = { class: "flex flex-wrap gap-12" }, Mi = { class: "flex items-center gap-6" }, Di = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gi = {
|
|
2962
2987
|
key: 0,
|
|
2963
2988
|
class: "flex items-center gap-6"
|
|
2964
|
-
},
|
|
2989
|
+
}, Ni = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, zi = {
|
|
2965
2990
|
key: 1,
|
|
2966
2991
|
class: "flex items-center gap-6"
|
|
2967
|
-
},
|
|
2992
|
+
}, Oi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Li = {
|
|
2968
2993
|
key: 2,
|
|
2969
2994
|
class: "flex items-center gap-6"
|
|
2970
|
-
},
|
|
2995
|
+
}, ji = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ki = {
|
|
2971
2996
|
key: 3,
|
|
2972
2997
|
class: "flex items-center gap-6"
|
|
2973
|
-
},
|
|
2998
|
+
}, qi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Wi = { class: "mt-12" }, Yi = ["onClick"], Ji = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary flex-1 truncate" }, Hi = {
|
|
2974
2999
|
key: 0,
|
|
2975
3000
|
class: "px-12 py-8 border-b border-fm-color-border-default"
|
|
2976
|
-
},
|
|
3001
|
+
}, Qi = { class: "px-12 py-10 leading-relaxed" }, Xi = {
|
|
2977
3002
|
key: 2,
|
|
2978
3003
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-placeholder italic"
|
|
2979
|
-
},
|
|
3004
|
+
}, Zi = { 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" }, el = { key: 0 }, tl = { key: 1 }, nl = {
|
|
2980
3005
|
key: 2,
|
|
2981
3006
|
class: "text-fm-color-warning"
|
|
2982
|
-
},
|
|
3007
|
+
}, ol = {
|
|
2983
3008
|
key: 3,
|
|
2984
3009
|
class: "text-fm-color-error"
|
|
2985
|
-
},
|
|
3010
|
+
}, il = {
|
|
2986
3011
|
key: 4,
|
|
2987
3012
|
class: "text-fm-color-typo-placeholder"
|
|
2988
|
-
},
|
|
3013
|
+
}, ll = /* @__PURE__ */ le({
|
|
2989
3014
|
__name: "RecipeBulkEditorSummaryStep",
|
|
2990
3015
|
setup(m) {
|
|
2991
|
-
const { t: d } =
|
|
3016
|
+
const { t: d } = ie(), l = ne(), t = ge(), i = R(() => Object.values(t.entries)), r = R(
|
|
2992
3017
|
() => i.value.filter((e) => e.status === "will-update").length
|
|
2993
|
-
),
|
|
3018
|
+
), x = R(
|
|
2994
3019
|
() => i.value.filter((e) => e.status === "partially-ignored").length
|
|
2995
3020
|
), u = R(
|
|
2996
3021
|
() => i.value.filter((e) => e.status === "already-satisfied").length
|
|
@@ -2998,76 +3023,76 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
2998
3023
|
() => i.value.filter((e) => e.status === "blocked").length
|
|
2999
3024
|
), s = R(
|
|
3000
3025
|
() => i.value.filter((e) => e.status === "no-applicable-changes").length
|
|
3001
|
-
),
|
|
3026
|
+
), a = W(/* @__PURE__ */ new Set());
|
|
3002
3027
|
function p(e) {
|
|
3003
|
-
return
|
|
3028
|
+
return a.value.has(e);
|
|
3004
3029
|
}
|
|
3005
3030
|
function $(e) {
|
|
3006
|
-
const
|
|
3007
|
-
|
|
3008
|
-
}
|
|
3009
|
-
function
|
|
3010
|
-
var
|
|
3011
|
-
const
|
|
3012
|
-
for (let
|
|
3013
|
-
const
|
|
3031
|
+
const E = new Set(a.value);
|
|
3032
|
+
E.has(e) ? E.delete(e) : E.add(e), a.value = E;
|
|
3033
|
+
}
|
|
3034
|
+
function B(e) {
|
|
3035
|
+
var _, N, z;
|
|
3036
|
+
const E = [], c = ke(e.contains, /* @__PURE__ */ new Set([e._id]), l.recipeById);
|
|
3037
|
+
for (let g = 0; g < c.length; g++) {
|
|
3038
|
+
const C = c[g], F = C.recipeIds.slice(1).length > 0, A = F ? ((_ = l.recipeById[C.recipeIds.at(-1) ?? ""]) == null ? void 0 : _.name) ?? "" : "";
|
|
3014
3039
|
let P;
|
|
3015
|
-
if (
|
|
3016
|
-
const
|
|
3017
|
-
if (!
|
|
3018
|
-
const H = `x${Q(
|
|
3019
|
-
P =
|
|
3040
|
+
if (C.isGroup) {
|
|
3041
|
+
const K = l.skuGroupById[C.id];
|
|
3042
|
+
if (!K) continue;
|
|
3043
|
+
const H = `x${Q(C.amount)}`;
|
|
3044
|
+
P = F ? `(${A}) ${K.name} (${H})` : `${K.name} (${H})`;
|
|
3020
3045
|
} else {
|
|
3021
|
-
const
|
|
3022
|
-
if (!
|
|
3023
|
-
const H = ((
|
|
3024
|
-
P =
|
|
3046
|
+
const K = l.skuById[C.id];
|
|
3047
|
+
if (!K) continue;
|
|
3048
|
+
const H = ((N = C.measurement) == null ? void 0 : N.abbrev) ?? ((z = K.unit) == null ? void 0 : z.abbrev) ?? "", ee = `${Q(C.amount)}${H}`;
|
|
3049
|
+
P = F ? `(${A}) ${K.name} (${ee})` : `${K.name} (${ee})`;
|
|
3025
3050
|
}
|
|
3026
|
-
|
|
3051
|
+
g > 0 && E.push({ text: ", " }), E.push({ text: P });
|
|
3027
3052
|
}
|
|
3028
|
-
return
|
|
3053
|
+
return E;
|
|
3029
3054
|
}
|
|
3030
3055
|
function I(e) {
|
|
3031
|
-
var
|
|
3056
|
+
var g, C, F, A;
|
|
3032
3057
|
if (e.isGroup) {
|
|
3033
3058
|
const P = l.skuGroupById[e.id];
|
|
3034
3059
|
if (!P) return "";
|
|
3035
|
-
const
|
|
3036
|
-
return
|
|
3060
|
+
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)}`;
|
|
3061
|
+
return K ? `(${H}) ${P.name} (${ee})` : `${P.name} (${ee})`;
|
|
3037
3062
|
}
|
|
3038
|
-
const
|
|
3039
|
-
if (!
|
|
3040
|
-
const c = e.recipeIds.slice(1).length > 0,
|
|
3041
|
-
return c ? `(${
|
|
3063
|
+
const E = l.skuById[e.id];
|
|
3064
|
+
if (!E) return "";
|
|
3065
|
+
const c = e.recipeIds.slice(1).length > 0, _ = c ? ((C = l.recipeById[e.recipeIds.at(-1) ?? ""]) == null ? void 0 : C.name) ?? "" : "", N = ((F = e.measurement) == null ? void 0 : F.abbrev) ?? ((A = E.unit) == null ? void 0 : A.abbrev) ?? "", z = `${Q(e.amount)}${N}`;
|
|
3066
|
+
return c ? `(${_}) ${E.name} (${z})` : `${E.name} (${z})`;
|
|
3042
3067
|
}
|
|
3043
3068
|
function f(e) {
|
|
3044
3069
|
if (!e.projected) return [];
|
|
3045
|
-
const
|
|
3046
|
-
for (const
|
|
3047
|
-
const
|
|
3048
|
-
for (const
|
|
3049
|
-
const
|
|
3050
|
-
let
|
|
3051
|
-
function F
|
|
3052
|
-
|
|
3070
|
+
const E = 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();
|
|
3071
|
+
for (const F of E) _.set(`${F.type}:${F.id}`, F);
|
|
3072
|
+
const N = /* @__PURE__ */ new Map();
|
|
3073
|
+
for (const F of c) N.set(`${F.type}:${F.id}`, F);
|
|
3074
|
+
const z = [];
|
|
3075
|
+
let g = !0;
|
|
3076
|
+
function C(F, A) {
|
|
3077
|
+
A && (g || z.push({ kind: "unchanged", text: ", " }), z.push({ kind: F, text: A }), g = !1);
|
|
3053
3078
|
}
|
|
3054
|
-
for (const [
|
|
3055
|
-
const P =
|
|
3079
|
+
for (const [F, A] of _) {
|
|
3080
|
+
const P = N.get(F);
|
|
3056
3081
|
if (!P)
|
|
3057
|
-
|
|
3082
|
+
C("removed", I(A));
|
|
3058
3083
|
else {
|
|
3059
|
-
const
|
|
3060
|
-
|
|
3084
|
+
const K = I(A), H = I(P);
|
|
3085
|
+
K === H ? C("unchanged", K) : (C("removed", K), C("added", H));
|
|
3061
3086
|
}
|
|
3062
3087
|
}
|
|
3063
|
-
for (const [
|
|
3064
|
-
|
|
3065
|
-
return
|
|
3088
|
+
for (const [F, A] of N)
|
|
3089
|
+
_.has(F) || C("added", I(A));
|
|
3090
|
+
return z;
|
|
3066
3091
|
}
|
|
3067
|
-
const
|
|
3092
|
+
const k = R(() => {
|
|
3068
3093
|
const e = /* @__PURE__ */ new Map();
|
|
3069
|
-
for (const
|
|
3070
|
-
e.set(
|
|
3094
|
+
for (const E of i.value)
|
|
3095
|
+
e.set(E.recipeId, f(E));
|
|
3071
3096
|
return e;
|
|
3072
3097
|
});
|
|
3073
3098
|
function S(e) {
|
|
@@ -3086,7 +3111,7 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3086
3111
|
return "";
|
|
3087
3112
|
}
|
|
3088
3113
|
}
|
|
3089
|
-
function
|
|
3114
|
+
function y(e) {
|
|
3090
3115
|
switch (e) {
|
|
3091
3116
|
case "will-update":
|
|
3092
3117
|
return "success";
|
|
@@ -3102,154 +3127,154 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3102
3127
|
return "neutral";
|
|
3103
3128
|
}
|
|
3104
3129
|
}
|
|
3105
|
-
return (e,
|
|
3106
|
-
const c = G("FmChip"),
|
|
3107
|
-
return b(),
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3130
|
+
return (e, E) => {
|
|
3131
|
+
const c = G("FmChip"), _ = G("FmButton"), N = G("FmBanner"), z = G("FmIcon");
|
|
3132
|
+
return b(), V("div", Ai, [
|
|
3133
|
+
v("div", Ti, [
|
|
3134
|
+
v("p", Ui, U(n(d)("inventory.recipe.bulkEditor.summary.title")), 1),
|
|
3135
|
+
v("div", Pi, [
|
|
3136
|
+
v("div", Mi, [
|
|
3137
|
+
h(c, {
|
|
3113
3138
|
size: "sm",
|
|
3114
|
-
label: String(
|
|
3139
|
+
label: String(r.value),
|
|
3115
3140
|
variant: "success"
|
|
3116
3141
|
}, null, 8, ["label"]),
|
|
3117
|
-
|
|
3142
|
+
v("span", Di, U(n(d)("inventory.recipe.bulkEditor.summary.countWillUpdate")), 1)
|
|
3118
3143
|
]),
|
|
3119
|
-
|
|
3120
|
-
|
|
3144
|
+
x.value > 0 ? (b(), V("div", Gi, [
|
|
3145
|
+
h(c, {
|
|
3121
3146
|
size: "sm",
|
|
3122
|
-
label: String(
|
|
3147
|
+
label: String(x.value),
|
|
3123
3148
|
variant: "warning"
|
|
3124
3149
|
}, null, 8, ["label"]),
|
|
3125
|
-
|
|
3126
|
-
])) :
|
|
3127
|
-
u.value > 0 ? (b(),
|
|
3128
|
-
|
|
3150
|
+
v("span", Ni, U(n(d)("inventory.recipe.bulkEditor.summary.countPartiallyIgnored")), 1)
|
|
3151
|
+
])) : T("", !0),
|
|
3152
|
+
u.value > 0 ? (b(), V("div", zi, [
|
|
3153
|
+
h(c, {
|
|
3129
3154
|
size: "sm",
|
|
3130
3155
|
label: String(u.value),
|
|
3131
3156
|
variant: "info"
|
|
3132
3157
|
}, null, 8, ["label"]),
|
|
3133
|
-
|
|
3134
|
-
])) :
|
|
3135
|
-
o.value > 0 ? (b(),
|
|
3136
|
-
|
|
3158
|
+
v("span", Oi, U(n(d)("inventory.recipe.bulkEditor.summary.countAlreadySatisfied")), 1)
|
|
3159
|
+
])) : T("", !0),
|
|
3160
|
+
o.value > 0 ? (b(), V("div", Li, [
|
|
3161
|
+
h(c, {
|
|
3137
3162
|
size: "sm",
|
|
3138
3163
|
label: String(o.value),
|
|
3139
3164
|
variant: "critical"
|
|
3140
3165
|
}, null, 8, ["label"]),
|
|
3141
|
-
|
|
3142
|
-
])) :
|
|
3143
|
-
s.value > 0 ? (b(),
|
|
3144
|
-
|
|
3166
|
+
v("span", ji, U(n(d)("inventory.recipe.bulkEditor.summary.countBlocked")), 1)
|
|
3167
|
+
])) : T("", !0),
|
|
3168
|
+
s.value > 0 ? (b(), V("div", Ki, [
|
|
3169
|
+
h(c, {
|
|
3145
3170
|
size: "sm",
|
|
3146
3171
|
label: String(s.value),
|
|
3147
3172
|
variant: "neutral"
|
|
3148
3173
|
}, null, 8, ["label"]),
|
|
3149
|
-
|
|
3150
|
-
])) :
|
|
3174
|
+
v("span", qi, U(n(d)("inventory.recipe.bulkEditor.summary.countNoChanges")), 1)
|
|
3175
|
+
])) : T("", !0)
|
|
3151
3176
|
]),
|
|
3152
|
-
|
|
3153
|
-
|
|
3177
|
+
v("div", Wi, [
|
|
3178
|
+
h(_, {
|
|
3154
3179
|
label: n(d)("common.export"),
|
|
3155
3180
|
variant: "secondary",
|
|
3156
3181
|
size: "md",
|
|
3157
|
-
onClick: n(
|
|
3182
|
+
onClick: n(Ri)
|
|
3158
3183
|
}, null, 8, ["label", "onClick"])
|
|
3159
3184
|
]),
|
|
3160
|
-
|
|
3185
|
+
r.value === 0 && x.value === 0 ? (b(), Y(N, {
|
|
3161
3186
|
key: 0,
|
|
3162
3187
|
class: "mt-12",
|
|
3163
3188
|
type: "warning",
|
|
3164
3189
|
message: n(d)("inventory.recipe.bulkEditor.summary.nothingToSubmit")
|
|
3165
|
-
}, null, 8, ["message"])) :
|
|
3190
|
+
}, null, 8, ["message"])) : T("", !0)
|
|
3166
3191
|
]),
|
|
3167
|
-
(b(!0),
|
|
3168
|
-
key:
|
|
3192
|
+
(b(!0), V(X, null, me(i.value, (g) => (b(), V("div", {
|
|
3193
|
+
key: g.recipeId,
|
|
3169
3194
|
class: "rounded-lg border border-fm-color-border-default overflow-hidden"
|
|
3170
3195
|
}, [
|
|
3171
|
-
|
|
3196
|
+
v("button", {
|
|
3172
3197
|
type: "button",
|
|
3173
|
-
class: Be(["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(
|
|
3174
|
-
onClick: (
|
|
3198
|
+
class: Be(["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) }]),
|
|
3199
|
+
onClick: (C) => $(g.recipeId)
|
|
3175
3200
|
}, [
|
|
3176
|
-
|
|
3177
|
-
name: p(
|
|
3201
|
+
h(z, {
|
|
3202
|
+
name: p(g.recipeId) ? "expand_less" : "expand_more",
|
|
3178
3203
|
size: "sm",
|
|
3179
3204
|
class: "text-fm-color-typo-secondary flex-shrink-0"
|
|
3180
3205
|
}, null, 8, ["name"]),
|
|
3181
|
-
|
|
3182
|
-
|
|
3206
|
+
v("span", Ji, U(g.recipeName), 1),
|
|
3207
|
+
g.original.version === "v2" ? (b(), Y(c, {
|
|
3183
3208
|
key: 0,
|
|
3184
3209
|
size: "sm",
|
|
3185
3210
|
label: "V2",
|
|
3186
3211
|
variant: "info"
|
|
3187
|
-
})) :
|
|
3188
|
-
|
|
3212
|
+
})) : T("", !0),
|
|
3213
|
+
h(c, {
|
|
3189
3214
|
size: "sm",
|
|
3190
|
-
label: S(
|
|
3191
|
-
variant:
|
|
3215
|
+
label: S(g.status),
|
|
3216
|
+
variant: y(g.status)
|
|
3192
3217
|
}, null, 8, ["label", "variant"])
|
|
3193
|
-
], 10,
|
|
3194
|
-
p(
|
|
3195
|
-
n(t).applyErrors.has(
|
|
3196
|
-
|
|
3218
|
+
], 10, Yi),
|
|
3219
|
+
p(g.recipeId) ? (b(), V(X, { key: 0 }, [
|
|
3220
|
+
n(t).applyErrors.has(g.recipeId) ? (b(), V("div", Hi, [
|
|
3221
|
+
h(N, {
|
|
3197
3222
|
type: "error",
|
|
3198
|
-
message: n(t).applyErrors.get(
|
|
3223
|
+
message: n(t).applyErrors.get(g.recipeId)
|
|
3199
3224
|
}, null, 8, ["message"])
|
|
3200
|
-
])) :
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
key:
|
|
3225
|
+
])) : T("", !0),
|
|
3226
|
+
v("div", Qi, [
|
|
3227
|
+
g.projected ? (k.value.get(g.recipeId) ?? []).length > 0 ? (b(!0), V(X, { key: 1 }, me(k.value.get(g.recipeId), (C, F) => (b(), V("span", {
|
|
3228
|
+
key: F,
|
|
3204
3229
|
class: Be(["fm-typo-en-body-sm-400", {
|
|
3205
|
-
"text-fm-color-typo-secondary":
|
|
3206
|
-
"line-through text-fm-color-error font-medium":
|
|
3207
|
-
"text-fm-color-success font-medium":
|
|
3230
|
+
"text-fm-color-typo-secondary": C.kind === "unchanged",
|
|
3231
|
+
"line-through text-fm-color-error font-medium": C.kind === "removed",
|
|
3232
|
+
"text-fm-color-success font-medium": C.kind === "added"
|
|
3208
3233
|
}])
|
|
3209
|
-
},
|
|
3210
|
-
key:
|
|
3234
|
+
}, U(C.text), 3))), 128)) : (b(), V("span", Xi, U(n(d)("inventory.recipe.bulkEditor.summary.emptyBindings")), 1)) : (b(!0), V(X, { key: 0 }, me(B(g.original), (C, F) => (b(), V("span", {
|
|
3235
|
+
key: F,
|
|
3211
3236
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-placeholder"
|
|
3212
|
-
},
|
|
3237
|
+
}, U(C.text), 1))), 128))
|
|
3213
3238
|
]),
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3239
|
+
v("div", Zi, [
|
|
3240
|
+
g.counts.applied > 0 ? (b(), V("span", el, U(n(d)("inventory.recipe.bulkEditor.summary.footerApplied", { count: g.counts.applied })), 1)) : T("", !0),
|
|
3241
|
+
g.counts.satisfied > 0 ? (b(), V("span", tl, U(n(d)("inventory.recipe.bulkEditor.summary.footerSatisfied", { count: g.counts.satisfied })), 1)) : T("", !0),
|
|
3242
|
+
g.counts.ignored > 0 ? (b(), V("span", nl, U(n(d)("inventory.recipe.bulkEditor.summary.footerIgnored", { count: g.counts.ignored })), 1)) : T("", !0),
|
|
3243
|
+
g.counts.blocked > 0 ? (b(), V("span", ol, U(n(d)("inventory.recipe.bulkEditor.summary.footerBlocked", { count: g.counts.blocked })), 1)) : T("", !0),
|
|
3244
|
+
g.counts.applied === 0 && g.counts.satisfied === 0 && g.counts.ignored === 0 && g.counts.blocked === 0 ? (b(), V("span", il, U(n(d)("inventory.recipe.bulkEditor.summary.noChangesDetail")), 1)) : T("", !0)
|
|
3220
3245
|
])
|
|
3221
|
-
], 64)) :
|
|
3246
|
+
], 64)) : T("", !0)
|
|
3222
3247
|
]))), 128))
|
|
3223
3248
|
]);
|
|
3224
3249
|
};
|
|
3225
3250
|
}
|
|
3226
|
-
}),
|
|
3251
|
+
}), rl = { class: "flex items-center gap-12" }, al = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, sl = {
|
|
3227
3252
|
key: 0,
|
|
3228
3253
|
class: "h-[calc(98vh-120px)] overflow-hidden flex flex-col"
|
|
3229
|
-
},
|
|
3254
|
+
}, dl = {
|
|
3230
3255
|
key: 1,
|
|
3231
3256
|
class: "h-[calc(98vh-120px)] overflow-hidden flex flex-col"
|
|
3232
|
-
},
|
|
3257
|
+
}, ul = {
|
|
3233
3258
|
key: 2,
|
|
3234
3259
|
class: "h-[calc(98vh-120px)] overflow-y-auto px-24 py-20"
|
|
3235
|
-
},
|
|
3260
|
+
}, cl = {
|
|
3236
3261
|
key: 0,
|
|
3237
3262
|
class: "flex items-center gap-8 px-4"
|
|
3238
|
-
},
|
|
3263
|
+
}, pl = {
|
|
3239
3264
|
key: 1,
|
|
3240
3265
|
class: "flex items-center gap-8 px-4"
|
|
3241
|
-
},
|
|
3266
|
+
}, ml = {
|
|
3242
3267
|
key: 2,
|
|
3243
3268
|
class: "flex items-center gap-8 px-4"
|
|
3244
|
-
},
|
|
3269
|
+
}, fl = /* @__PURE__ */ le({
|
|
3245
3270
|
__name: "RecipeBulkEditorDialog",
|
|
3246
3271
|
props: {
|
|
3247
3272
|
show: { type: Boolean }
|
|
3248
3273
|
},
|
|
3249
3274
|
emits: ["update:show"],
|
|
3250
3275
|
setup(m, { emit: d }) {
|
|
3251
|
-
const l = m, { t } =
|
|
3252
|
-
function
|
|
3276
|
+
const l = m, { t } = ie(), i = ge(), r = Ge(l, "show"), x = Le(), u = R(() => i.currentStep === 1), o = R(() => i.currentStep === 2), s = R(() => i.currentStep === 3);
|
|
3277
|
+
function a() {
|
|
3253
3278
|
i.currentStep = 2;
|
|
3254
3279
|
}
|
|
3255
3280
|
function p() {
|
|
@@ -3258,11 +3283,11 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3258
3283
|
function $() {
|
|
3259
3284
|
i.goToStep3();
|
|
3260
3285
|
}
|
|
3261
|
-
function
|
|
3286
|
+
function B() {
|
|
3262
3287
|
i.backToStep2();
|
|
3263
3288
|
}
|
|
3264
3289
|
function I() {
|
|
3265
|
-
|
|
3290
|
+
x.open({
|
|
3266
3291
|
title: t("inventory.recipe.bulkEditor.step3.confirmTitle"),
|
|
3267
3292
|
message: t("inventory.recipe.bulkEditor.step3.confirmMessage"),
|
|
3268
3293
|
primaryActions: {
|
|
@@ -3279,14 +3304,14 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3279
3304
|
});
|
|
3280
3305
|
}
|
|
3281
3306
|
function f() {
|
|
3282
|
-
|
|
3307
|
+
r.value = !1, i.reset();
|
|
3283
3308
|
}
|
|
3284
|
-
return (
|
|
3285
|
-
const
|
|
3286
|
-
return b(), Y(
|
|
3287
|
-
modelValue: n(
|
|
3309
|
+
return (k, S) => {
|
|
3310
|
+
const y = G("FmChip"), e = G("FmButton"), E = G("FmDialog");
|
|
3311
|
+
return b(), Y(E, {
|
|
3312
|
+
modelValue: n(r),
|
|
3288
3313
|
"onUpdate:modelValue": [
|
|
3289
|
-
S[0] || (S[0] = (c) => De(
|
|
3314
|
+
S[0] || (S[0] = (c) => De(r) ? r.value = c : null),
|
|
3290
3315
|
S[1] || (S[1] = (c) => {
|
|
3291
3316
|
c || n(i).reset();
|
|
3292
3317
|
})
|
|
@@ -3297,9 +3322,9 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3297
3322
|
"max-height": "98vh"
|
|
3298
3323
|
}, {
|
|
3299
3324
|
"dialog-header": J(() => [
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3325
|
+
v("div", rl, [
|
|
3326
|
+
v("span", al, U(n(t)("inventory.recipe.bulkEditor.title")), 1),
|
|
3327
|
+
h(y, {
|
|
3303
3328
|
size: "sm",
|
|
3304
3329
|
label: n(t)("inventory.recipe.bulkEditor.stepIndicator", { step: n(i).currentStep, total: 3 }),
|
|
3305
3330
|
variant: "neutral"
|
|
@@ -3307,118 +3332,118 @@ const Bi = { class: "flex flex-col gap-16" }, Ci = { class: "rounded-lg border b
|
|
|
3307
3332
|
])
|
|
3308
3333
|
]),
|
|
3309
3334
|
"dialog-footer": J(() => [
|
|
3310
|
-
u.value ? (b(),
|
|
3311
|
-
|
|
3335
|
+
u.value ? (b(), V("div", cl, [
|
|
3336
|
+
h(e, {
|
|
3312
3337
|
label: n(t)("common.next"),
|
|
3313
3338
|
disabled: !n(i).canGoToStep2,
|
|
3314
|
-
onClick:
|
|
3339
|
+
onClick: a
|
|
3315
3340
|
}, null, 8, ["label", "disabled"]),
|
|
3316
|
-
|
|
3341
|
+
h(e, {
|
|
3317
3342
|
label: n(t)("common.close"),
|
|
3318
3343
|
variant: "tertiary",
|
|
3319
3344
|
onClick: f
|
|
3320
3345
|
}, null, 8, ["label"])
|
|
3321
|
-
])) : o.value ? (b(),
|
|
3322
|
-
|
|
3346
|
+
])) : o.value ? (b(), V("div", pl, [
|
|
3347
|
+
h(e, {
|
|
3323
3348
|
label: n(t)("inventory.recipe.bulkEditor.step2.reviewButton"),
|
|
3324
3349
|
disabled: !n(i).canGoToStep3,
|
|
3325
3350
|
onClick: $
|
|
3326
3351
|
}, null, 8, ["label", "disabled"]),
|
|
3327
|
-
|
|
3352
|
+
h(e, {
|
|
3328
3353
|
label: n(t)("common.back"),
|
|
3329
3354
|
variant: "secondary",
|
|
3330
3355
|
onClick: p
|
|
3331
3356
|
}, null, 8, ["label"]),
|
|
3332
|
-
|
|
3357
|
+
h(e, {
|
|
3333
3358
|
label: n(t)("common.close"),
|
|
3334
3359
|
variant: "tertiary",
|
|
3335
3360
|
onClick: f
|
|
3336
3361
|
}, null, 8, ["label"])
|
|
3337
|
-
])) : s.value ? (b(),
|
|
3338
|
-
|
|
3362
|
+
])) : s.value ? (b(), V("div", ml, [
|
|
3363
|
+
h(e, {
|
|
3339
3364
|
label: n(t)("inventory.recipe.bulkEditor.step3.confirmButton"),
|
|
3340
3365
|
disabled: n(i).isSaving,
|
|
3341
3366
|
loading: n(i).isSaving,
|
|
3342
3367
|
onClick: I
|
|
3343
3368
|
}, null, 8, ["label", "disabled", "loading"]),
|
|
3344
|
-
|
|
3369
|
+
h(e, {
|
|
3345
3370
|
label: n(t)("common.back"),
|
|
3346
3371
|
variant: "secondary",
|
|
3347
3372
|
disabled: n(i).isSaving,
|
|
3348
|
-
onClick:
|
|
3373
|
+
onClick: B
|
|
3349
3374
|
}, null, 8, ["label", "disabled"]),
|
|
3350
|
-
|
|
3375
|
+
h(e, {
|
|
3351
3376
|
label: n(t)("common.close"),
|
|
3352
3377
|
variant: "tertiary",
|
|
3353
3378
|
disabled: n(i).isSaving,
|
|
3354
3379
|
onClick: f
|
|
3355
3380
|
}, null, 8, ["label", "disabled"])
|
|
3356
|
-
])) :
|
|
3381
|
+
])) : T("", !0)
|
|
3357
3382
|
]),
|
|
3358
3383
|
default: J(() => [
|
|
3359
|
-
u.value ? (b(),
|
|
3360
|
-
|
|
3361
|
-
])) : o.value ? (b(),
|
|
3362
|
-
|
|
3363
|
-
])) : s.value ? (b(),
|
|
3364
|
-
|
|
3365
|
-
])) :
|
|
3384
|
+
u.value ? (b(), V("div", sl, [
|
|
3385
|
+
h(zo)
|
|
3386
|
+
])) : o.value ? (b(), V("div", dl, [
|
|
3387
|
+
h(Ci)
|
|
3388
|
+
])) : s.value ? (b(), V("div", ul, [
|
|
3389
|
+
h(ll)
|
|
3390
|
+
])) : T("", !0)
|
|
3366
3391
|
]),
|
|
3367
3392
|
_: 1
|
|
3368
3393
|
}, 8, ["modelValue"]);
|
|
3369
3394
|
};
|
|
3370
3395
|
}
|
|
3371
3396
|
});
|
|
3372
|
-
function
|
|
3397
|
+
function vl(m) {
|
|
3373
3398
|
return !m || Object.keys(m).length === 0 ? "" : Object.entries(m).map(([d, l]) => `${d}: ${l}`).join(", ");
|
|
3374
3399
|
}
|
|
3375
|
-
function
|
|
3376
|
-
const m = ne(), d = m.recipes, l = m.recipeById, t = m.skuById, i = m.skuGroupById,
|
|
3400
|
+
function yl() {
|
|
3401
|
+
const m = ne(), d = m.recipes, l = m.recipeById, t = m.skuById, i = m.skuGroupById, r = d.flatMap((o, s) => {
|
|
3377
3402
|
var p;
|
|
3378
|
-
const
|
|
3403
|
+
const a = vl(o.customAttributes);
|
|
3379
3404
|
if ((p = o.contains) != null && p.length) {
|
|
3380
|
-
const $ = o.contains.filter((f) => f.type === "RECIPE"),
|
|
3405
|
+
const $ = o.contains.filter((f) => f.type === "RECIPE"), B = o.contains.filter((f) => f.type === "SKU"), I = o.contains.filter((f) => f.type === "SKU_GROUP");
|
|
3381
3406
|
return [
|
|
3382
3407
|
...s === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
3383
3408
|
...$.map(
|
|
3384
|
-
(f,
|
|
3409
|
+
(f, k) => {
|
|
3385
3410
|
var S;
|
|
3386
3411
|
return [
|
|
3387
|
-
|
|
3412
|
+
k === 0 ? o.name : "",
|
|
3388
3413
|
"RECIPE",
|
|
3389
3414
|
"",
|
|
3390
3415
|
(S = l[f.id]) == null ? void 0 : S.name,
|
|
3391
3416
|
Q(f.amount),
|
|
3392
3417
|
"UNIT",
|
|
3393
|
-
|
|
3418
|
+
k === 0 ? a : ""
|
|
3394
3419
|
];
|
|
3395
3420
|
}
|
|
3396
3421
|
),
|
|
3397
|
-
...
|
|
3398
|
-
(f,
|
|
3399
|
-
var S,
|
|
3422
|
+
...B.map(
|
|
3423
|
+
(f, k) => {
|
|
3424
|
+
var S, y, e, E;
|
|
3400
3425
|
return [
|
|
3401
|
-
!$.length &&
|
|
3426
|
+
!$.length && k === 0 ? o.name : "",
|
|
3402
3427
|
"INGREDIENT",
|
|
3403
3428
|
(S = t[f.id]) == null ? void 0 : S.code,
|
|
3404
|
-
(
|
|
3429
|
+
(y = t[f.id]) == null ? void 0 : y.name,
|
|
3405
3430
|
Q(f.amount),
|
|
3406
|
-
f.measurement ? f.measurement.abbrev : (
|
|
3407
|
-
!$.length &&
|
|
3431
|
+
f.measurement ? f.measurement.abbrev : (E = (e = t[f.id]) == null ? void 0 : e.unit) == null ? void 0 : E.abbrev,
|
|
3432
|
+
!$.length && k === 0 ? a : ""
|
|
3408
3433
|
];
|
|
3409
3434
|
}
|
|
3410
3435
|
),
|
|
3411
3436
|
...I.map(
|
|
3412
|
-
(f,
|
|
3413
|
-
var S,
|
|
3437
|
+
(f, k) => {
|
|
3438
|
+
var S, y;
|
|
3414
3439
|
return [
|
|
3415
|
-
$.length === 0 &&
|
|
3440
|
+
$.length === 0 && B.length === 0 && k === 0 ? o.name : "",
|
|
3416
3441
|
"SKU_GROUP",
|
|
3417
3442
|
((S = i[f.id]) == null ? void 0 : S.ref) || "",
|
|
3418
|
-
(
|
|
3443
|
+
(y = i[f.id]) == null ? void 0 : y.name,
|
|
3419
3444
|
Q(f.amount),
|
|
3420
3445
|
"UNIT",
|
|
3421
|
-
$.length === 0 &&
|
|
3446
|
+
$.length === 0 && B.length === 0 && k === 0 ? a : ""
|
|
3422
3447
|
];
|
|
3423
3448
|
}
|
|
3424
3449
|
)
|
|
@@ -3426,42 +3451,42 @@ function pl() {
|
|
|
3426
3451
|
}
|
|
3427
3452
|
return [
|
|
3428
3453
|
...s === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
3429
|
-
[o.name, "No bindings", "", "", "", "",
|
|
3454
|
+
[o.name, "No bindings", "", "", "", "", a]
|
|
3430
3455
|
];
|
|
3431
|
-
}), u =
|
|
3456
|
+
}), u = at(r, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
|
|
3432
3457
|
st(u, `RECIPE_${dt(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
|
|
3433
3458
|
}
|
|
3434
|
-
const
|
|
3459
|
+
const bl = { class: "flex flex-col py-8" }, gl = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, _l = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Jl = /* @__PURE__ */ le({
|
|
3435
3460
|
__name: "RecipeView",
|
|
3436
3461
|
setup(m) {
|
|
3437
|
-
const d = ne(), l = R(() => d.recipes), t = tt(), { createRecipe: i, updateRecipe:
|
|
3438
|
-
|
|
3439
|
-
function
|
|
3462
|
+
const d = ne(), l = R(() => d.recipes), t = tt(), { createRecipe: i, updateRecipe: r } = ze(), { recipeDialogProps: x, recipeViewLoading: u } = Et(ze()), { columnDefs: o, formatRowData: s } = Jt(), a = R(() => s(l.value)), p = ge(), $ = We();
|
|
3463
|
+
W(!1);
|
|
3464
|
+
function B(c) {
|
|
3440
3465
|
if (c === "add")
|
|
3441
3466
|
return i();
|
|
3442
3467
|
if (c === "export")
|
|
3443
|
-
return
|
|
3468
|
+
return yl();
|
|
3444
3469
|
c === "bulk-edit" && p.openDialog();
|
|
3445
3470
|
}
|
|
3446
|
-
const I =
|
|
3447
|
-
return (c,
|
|
3448
|
-
const
|
|
3471
|
+
const I = W(""), f = R(() => u.value), { breakpoints: k } = xt(), S = R(() => k.value.xs || k.value.sm), y = R(() => S.value ? 10 : 20), e = Bt(), { t: E } = ie();
|
|
3472
|
+
return (c, _) => {
|
|
3473
|
+
const N = G("FmTable");
|
|
3449
3474
|
return b(), Y(Ct, {
|
|
3450
|
-
title: n(
|
|
3475
|
+
title: n(E)("inventory.recipe.title"),
|
|
3451
3476
|
actions: [
|
|
3452
3477
|
{
|
|
3453
|
-
label: n(
|
|
3478
|
+
label: n(E)("inventory.recipe.create.title"),
|
|
3454
3479
|
value: "add",
|
|
3455
3480
|
isPrimary: !0,
|
|
3456
3481
|
prependIcon: "add"
|
|
3457
3482
|
},
|
|
3458
|
-
...n($).enableBulkEditRecipes ? [{ label: n(
|
|
3459
|
-
{ label: n(
|
|
3483
|
+
...n($).enableBulkEditRecipes ? [{ label: n(E)("inventory.recipe.bulkEditor.title"), value: "bulk-edit", isPrimary: !1 }] : [],
|
|
3484
|
+
{ label: n(E)("common.export"), value: "export", isPrimary: !1 }
|
|
3460
3485
|
],
|
|
3461
|
-
"onClick:action":
|
|
3486
|
+
"onClick:action": B
|
|
3462
3487
|
}, {
|
|
3463
3488
|
default: J(() => [
|
|
3464
|
-
|
|
3489
|
+
v("div", {
|
|
3465
3490
|
class: Be([
|
|
3466
3491
|
"flex flex-col gap-8 max-h-full",
|
|
3467
3492
|
{
|
|
@@ -3470,40 +3495,40 @@ const ml = { class: "flex flex-col py-8" }, fl = { class: "fm-typo-en-body-lg-60
|
|
|
3470
3495
|
}
|
|
3471
3496
|
])
|
|
3472
3497
|
}, [
|
|
3473
|
-
|
|
3498
|
+
h(jt, {
|
|
3474
3499
|
searchable: "",
|
|
3475
3500
|
search: I.value,
|
|
3476
|
-
"onUpdate:search":
|
|
3501
|
+
"onUpdate:search": _[0] || (_[0] = (z) => I.value = z)
|
|
3477
3502
|
}, null, 8, ["search"]),
|
|
3478
|
-
(b(), Y(
|
|
3503
|
+
(b(), Y(N, {
|
|
3479
3504
|
style: vt(n(e).tableHeight),
|
|
3480
3505
|
"column-defs": n(o),
|
|
3481
|
-
"row-data":
|
|
3506
|
+
"row-data": a.value,
|
|
3482
3507
|
"search-value": I.value,
|
|
3483
3508
|
loading: !n(t)._currentLocation || f.value,
|
|
3484
|
-
onRowClick:
|
|
3509
|
+
onRowClick: _[1] || (_[1] = (z) => n(r)(z.original.original)),
|
|
3485
3510
|
key: l.value.length,
|
|
3486
|
-
"page-size":
|
|
3511
|
+
"page-size": y.value
|
|
3487
3512
|
}, {
|
|
3488
|
-
"list-row": J((
|
|
3489
|
-
|
|
3490
|
-
row:
|
|
3491
|
-
onRowClick: (
|
|
3513
|
+
"list-row": J((z) => [
|
|
3514
|
+
h(Lt, {
|
|
3515
|
+
row: z,
|
|
3516
|
+
onRowClick: (g) => n(r)(g.original)
|
|
3492
3517
|
}, {
|
|
3493
|
-
default: J((
|
|
3494
|
-
var
|
|
3518
|
+
default: J((g) => {
|
|
3519
|
+
var C, F, A, P, K, H, ee, O, D, L;
|
|
3495
3520
|
return [
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
render: (
|
|
3500
|
-
props: (
|
|
3521
|
+
v("div", bl, [
|
|
3522
|
+
v("div", gl, [
|
|
3523
|
+
h(n(Qe), {
|
|
3524
|
+
render: (A = (F = (C = g.recipe) == null ? void 0 : C.column) == null ? void 0 : F.columnDef) == null ? void 0 : A.cell,
|
|
3525
|
+
props: (K = (P = g.recipe) == null ? void 0 : P.getContext) == null ? void 0 : K.call(P)
|
|
3501
3526
|
}, null, 8, ["render", "props"])
|
|
3502
3527
|
]),
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
render: (
|
|
3506
|
-
props: (
|
|
3528
|
+
v("div", _l, [
|
|
3529
|
+
h(n(Qe), {
|
|
3530
|
+
render: (O = (ee = (H = g.ingredients) == null ? void 0 : H.column) == null ? void 0 : ee.columnDef) == null ? void 0 : O.cell,
|
|
3531
|
+
props: (L = (D = g.ingredients) == null ? void 0 : D.getContext) == null ? void 0 : L.call(D)
|
|
3507
3532
|
}, null, 8, ["render", "props"])
|
|
3508
3533
|
])
|
|
3509
3534
|
])
|
|
@@ -3516,12 +3541,12 @@ const ml = { class: "flex flex-col py-8" }, fl = { class: "fm-typo-en-body-lg-60
|
|
|
3516
3541
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
3517
3542
|
], 2),
|
|
3518
3543
|
(b(), Y(yt, { to: "body" }, [
|
|
3519
|
-
|
|
3520
|
-
n($).enableBulkEditRecipes ? (b(), Y(
|
|
3544
|
+
h(fo, bt(gt(n(x))), null, 16),
|
|
3545
|
+
n($).enableBulkEditRecipes ? (b(), Y(fl, {
|
|
3521
3546
|
key: 0,
|
|
3522
3547
|
show: n(p).show,
|
|
3523
|
-
"onUpdate:show":
|
|
3524
|
-
}, null, 8, ["show"])) :
|
|
3548
|
+
"onUpdate:show": _[2] || (_[2] = (z) => n(p).show = z)
|
|
3549
|
+
}, null, 8, ["show"])) : T("", !0)
|
|
3525
3550
|
]))
|
|
3526
3551
|
]),
|
|
3527
3552
|
_: 1
|
|
@@ -3530,5 +3555,5 @@ const ml = { class: "flex flex-col py-8" }, fl = { class: "fm-typo-en-body-lg-60
|
|
|
3530
3555
|
}
|
|
3531
3556
|
});
|
|
3532
3557
|
export {
|
|
3533
|
-
|
|
3558
|
+
Jl as default
|
|
3534
3559
|
};
|