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