@feedmepos/mf-inventory-portal 1.3.17-dev.2 → 1.4.1-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-BZs8fZKo.js → App-ChJEzu4r.js} +5 -5
- package/dist/{ApprovalView-k409wjyM.js → ApprovalView-DE7cizNA.js} +7 -7
- package/dist/{BindingsDialog-B8eMUWro.js → BindingsDialog-BsMtvOJG.js} +2 -2
- package/dist/{BindingsPicker-DQqBaPmd.js → BindingsPicker-Cqm2FCk4.js} +2 -2
- package/dist/{BindingsTable-DBVIeFhW.js → BindingsTable-DnmlqSXV.js} +3 -3
- package/dist/{ClosingDraftView-IYvSijlu.js → ClosingDraftView-DCo7R5X_.js} +15 -15
- package/dist/{ClosingHistoryView-BCoB6tht.js → ClosingHistoryView-B8pvoz_L.js} +5 -5
- package/dist/{ClosingTemplateView-CYRes3xE.js → ClosingTemplateView-BhWMZskM.js} +14 -14
- package/dist/{DefaultView-Cw2nI7-X.js → DefaultView-7L4zg3pD.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-CdiaL8D5.js → DeliveryOrderPrintPreview-BJUAI20p.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-k5zRFn32.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CZz44xPT.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Df-pE1KK.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D2xaJ_fT.js} +2 -2
- package/dist/{FmMultiselectDialog-wAnP9Seb.js → FmMultiselectDialog-CPt0eMqz.js} +2 -2
- package/dist/{FmMultiselectDialog-nflYcmpQ.js → FmMultiselectDialog-CSlbhVxn.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Bwl1Jqam.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DeFbqEt_.js} +4 -4
- package/dist/{ImportView-moP3tPQ7.js → ImportView-DDq7-EqO.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-G7yOwwlA.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-TLC_uZ1L.js} +1 -1
- package/dist/{IngredientGroupView-B4NShCe7.js → IngredientGroupView-BOPm59h1.js} +5 -5
- package/dist/{IngredientsView-uhc_mfqq.js → IngredientsView-Drxqdl5C.js} +15 -15
- package/dist/{IntegrationExplorerView-6R_PAu4l.js → IntegrationExplorerView-ClolIlZJ.js} +5 -5
- package/dist/{IntegrationView-kt2CyS2K.js → IntegrationView-BhsxOMny.js} +13 -13
- package/dist/{InventoryBindingForm-Bxm_y_m_.js → InventoryBindingForm-DSmmb2Re.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CxxKiDAW.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Bs1WRSC4.js} +5 -5
- package/dist/{InventoryBindingSummary-COhLobHu.js → InventoryBindingSummary-DwmmGqLA.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B4qOsAtm.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-cBTXwRyT.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DShIs4zv.js → PremiumBadge.vue_vue_type_script_setup_true_lang-WgbXX2to.js} +1 -1
- package/dist/{PublishView-B6eXjyq0.js → PublishView-CjIwzQ1D.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-Bb5ZH7Ze.js → PurchaseOrderPrintPreview-D14UaMbm.js} +2 -2
- package/dist/{ReceiveRequestView-lWK576Cn.js → ReceiveRequestView-C5s6H1ly.js} +25 -25
- package/dist/RecipeView-BWlgNjqM.js +3520 -0
- package/dist/{SettingsView-D3ayESIi.js → SettingsView-BiaJS0Qs.js} +4 -4
- package/dist/{StockView-BQAwpib5.js → StockView-DzdW3saV.js} +19 -19
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-ZhGaDQV_.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CziwNGpm.js} +1 -1
- package/dist/{SupplierView-C4gyBYWT.js → SupplierView-CEH1mh4O.js} +12 -12
- package/dist/{SurchargeView-CIMnxsAM.js → SurchargeView-DLL1vb1m.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-Ddw6IO0s.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CyzJFEM1.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BgUQep1X.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-riu5GB0x.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-AzSsFnV9.js → TransferDetails.vue_vue_type_script_setup_true_lang-CdPx9jtv.js} +20 -20
- package/dist/{TransferTemplateView-B5zHVuMP.js → TransferTemplateView-B1hOOEld.js} +18 -18
- package/dist/{UnitCostHistoryView-DW2FSMdR.js → UnitCostHistoryView-CfVLgSsg.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-BK41FEeb.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-D_5MeWML.js} +4 -4
- package/dist/{UnitView-DJF9woxD.js → UnitView-CNEW1ZyC.js} +7 -7
- package/dist/{WarehouseView-LRwZezC5.js → WarehouseView-BAEddBqH.js} +5 -5
- package/dist/{WastageTemplateView-pS6AdviV.js → WastageTemplateView-BDDcGlH1.js} +14 -14
- package/dist/{app-Du9hjHZP.js → app-8jckOqPv.js} +94 -46
- package/dist/app.d.ts +82 -34
- package/dist/app.js +1 -1
- package/dist/{closing-template-CdjziuUw.js → closing-template-DI_wHTs-.js} +1 -1
- package/dist/{date2-DSeWLgzk.js → date2-R--GWp3h.js} +1 -1
- package/dist/{dayjs.min-DbVTJwyb.js → dayjs.min-BLMwzZoP.js} +1 -1
- package/dist/{decimal-DmzFXaRA.js → decimal-C1gVMYNr.js} +2 -2
- package/dist/{defineDeepModel-Cp75jSVs.js → defineDeepModel-v4CSJ0KR.js} +1 -1
- package/dist/{duplicate-template-DkswfS38.js → duplicate-template-B2FyWucr.js} +1 -1
- package/dist/{export-DOf-QW3M.js → export-rvaYes9_.js} +1 -1
- package/dist/{feature-D23WgLdE.js → feature-D5wDntDA.js} +113 -108
- package/dist/{format-time-from-id-w5E1yNUV.js → format-time-from-id-iIaeuVUR.js} +1 -1
- package/dist/{format-unit-display-C7-lUz9r.js → format-unit-display-DoXOol_B.js} +11 -11
- package/dist/{import-export.helper-KcOyMbsO.js → import-export.helper-CRZm_4kx.js} +6 -6
- package/dist/{index-C472V7Tf.js → index-BlCcDs_t.js} +1 -1
- package/dist/{index-BUMDqEa6.js → index-Dctf0kPG.js} +1 -1
- package/dist/{index-3KZhqtW4.js → index-DvydJuBP.js} +3 -3
- package/dist/{inventory-core-dart.default-DGd8GVhk.js → inventory-core-dart.default-BGNoRNOu.js} +1 -1
- package/dist/{lodash-CRpepM1B.js → lodash-BGLr9-Z4.js} +1 -1
- package/dist/{lz-string-BD7AmWsM.js → lz-string-BXxSHhql.js} +1 -1
- package/dist/{netsuite-B_ohVmZD.js → netsuite-QrjgLCzF.js} +3 -3
- package/dist/{number-BoWDForP.js → number-BW3CMNw8.js} +3 -3
- package/dist/{predefined-templates-CUGfpkjj.js → predefined-templates-BAl0dgvF.js} +1 -1
- package/dist/{purchase-order-template-BIfxRjTb.js → purchase-order-template-BXiI76-R.js} +1 -1
- package/dist/{recalculationUtils-D_aoQ2xV.js → recalculationUtils-DryzcsyX.js} +1 -1
- package/dist/{rules-BfAXqY67.js → rules-uhOTzvDT.js} +2 -2
- package/dist/{stock-TdIYgVjn.js → stock-CFigyCpv.js} +3 -3
- package/dist/{stock-CHvpVPdC.js → stock-DIzLmqOG.js} +1 -1
- package/dist/stores/feature.d.ts +2 -0
- package/dist/{supplier-CrOQf12H.js → supplier-DnHSGzUP.js} +2 -2
- package/dist/{surcharge-V2zH-cWZ.js → surcharge-NTU0Whsq.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-CM8XQxUr.js → use-ingredient-select-dialog-BTeCOYD1.js} +2 -2
- package/dist/{use-inventory-binding-dialog-DBHuTmlU.js → use-inventory-binding-dialog-C5dSHkMZ.js} +2 -2
- package/dist/{use-template-enabled-locations-BaPU4Yrr.js → use-template-enabled-locations-Ba9BFrFN.js} +2 -2
- package/dist/{use-transfer-locations-Cm8IvFNy.js → use-transfer-locations-D__VLxA7.js} +2 -2
- package/dist/{useHrmPermission-Dd5se0x1.js → useHrmPermission-DMlbCSlp.js} +1 -1
- package/dist/{useNavigationMenu-C0_Ilh1C.js → useNavigationMenu-jtnBmp0t.js} +2 -2
- package/dist/{useSseClient-BinJYKsX.js → useSseClient-D8q23tYV.js} +1 -1
- package/dist/views/recipe/components/recipe-bulk-editor/RecipeBulkEditorStep2.vue.d.ts +2 -0
- package/dist/views/recipe/components/recipe-bulk-editor/components/LivePreviewTable.vue.d.ts +2 -0
- package/dist/views/recipe/components/recipe-bulk-editor/components/ModificationCard.vue.d.ts +22 -0
- package/dist/views/recipe/composables/use-recipe-bulk-editor.d.ts +957 -314
- package/dist/views/recipe/helper/bulk-edit-simulation.helper.d.ts +79 -0
- package/dist/views/recipe/helper/export-bulk-edit-recipe.d.ts +1 -0
- package/dist/{vue-i18n-Bt04xsUS.js → vue-i18n-8-OMxHzQ.js} +2 -2
- package/dist/{xlsx-C5yfkOfj.js → xlsx-BFjtlsJV.js} +1 -1
- package/dist/{xlsx.util-D_VXgblQ.js → xlsx.util-0LMGvDYM.js} +3 -3
- package/package.json +4 -4
- package/dist/RecipeView-KVhdiv18.js +0 -2898
- /package/dist/views/recipe/components/recipe-bulk-editor/{RecipeBulkEditorQueryStep.vue.d.ts → RecipeBulkEditorStep1.vue.d.ts} +0 -0
|
@@ -1,2898 +0,0 @@
|
|
|
1
|
-
import { defineComponent as ee, ref as G, onMounted as ot, resolveComponent as D, openBlock as v, createElementBlock as C, Fragment as ae, createElementVNode as p, toDisplayString as R, createVNode as B, createCommentVNode as F, computed as A, watch as pe, unref as s, normalizeClass as he, withCtx as j, h as ne, createBlock as M, renderList as me, isRef as Ge, mergeProps as it, createTextVNode as qe, withModifiers as lt, normalizeStyle as at, Teleport as st, normalizeProps as rt, guardReactiveProps as dt } from "vue";
|
|
2
|
-
import { a as Y, c as Ve, S as ut, F as de, t as ct, v as mt, i as ze, u as pt } from "./app-Du9hjHZP.js";
|
|
3
|
-
import { useDialog as Ae, useSnackbar as Fe, components as ce, useProxiedModel as we, useBreakpoints as ft } from "@feedmepos/ui-library";
|
|
4
|
-
import { i as yt, _ as vt } from "./is-linked-ingredient-error-fJ2TJb3z.js";
|
|
5
|
-
import { F as q } from "./form-mode.enum-BKiNVH6A.js";
|
|
6
|
-
import { _ as Ye } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-G7yOwwlA.js";
|
|
7
|
-
import { defineStore as He, storeToRefs as bt } from "pinia";
|
|
8
|
-
import { D as Je, R as ge } from "./row-action.enum-DQ9bJ_uv.js";
|
|
9
|
-
import { c as gt } from "./component-kqxARxvM.js";
|
|
10
|
-
import { a as Q, c as Qe } from "./number-BoWDForP.js";
|
|
11
|
-
import { useI18n as W, useCoreStore as _t } from "@feedmepos/mf-common";
|
|
12
|
-
import { u as ht, _ as kt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-sUxHOj47.js";
|
|
13
|
-
import { b as We, c as Re, I as xt, A as Ee, U as Xe, R as St } from "./rules-BfAXqY67.js";
|
|
14
|
-
import { _ as wt } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-CxxKiDAW.js";
|
|
15
|
-
import { a as xe } from "./FmMultiselectDialog-wAnP9Seb.js";
|
|
16
|
-
import { d as Ze } from "./defineDeepModel-Cp75jSVs.js";
|
|
17
|
-
import { L as Et, P as It, D as Bt } from "./app-DiX-EfV6.js";
|
|
18
|
-
import { _ as et, c as Ct, d as $t, e as Ke } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-Bwl1Jqam.js";
|
|
19
|
-
import { u as Vt } from "./FmMultiselectDialog-nflYcmpQ.js";
|
|
20
|
-
import { u as At } from "./vue-i18n-Bt04xsUS.js";
|
|
21
|
-
import { F as Ft } from "./inventory-core-dart.default-DGd8GVhk.js";
|
|
22
|
-
import { _ as Rt } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
|
|
23
|
-
import { u as Tt } from "./feature-D23WgLdE.js";
|
|
24
|
-
import { F as Te } from "./decimal-DmzFXaRA.js";
|
|
25
|
-
import { _ as Ut } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-k5zRFn32.js";
|
|
26
|
-
import { _ as Dt, F as Le } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
27
|
-
import { b as Pt, d as Nt } from "./xlsx.util-D_VXgblQ.js";
|
|
28
|
-
import { f as Ot } from "./date2-DSeWLgzk.js";
|
|
29
|
-
import { _ as Mt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Df-pE1KK.js";
|
|
30
|
-
const Gt = {
|
|
31
|
-
key: 0,
|
|
32
|
-
class: "flex flex-col items-center w-full h-full gap-24"
|
|
33
|
-
}, zt = { key: 1 }, Jt = { key: 0 }, Kt = /* @__PURE__ */ ee({
|
|
34
|
-
__name: "DeleteDialog",
|
|
35
|
-
props: {
|
|
36
|
-
type: {},
|
|
37
|
-
data: {},
|
|
38
|
-
message: {},
|
|
39
|
-
bindedItems: {}
|
|
40
|
-
},
|
|
41
|
-
setup(m) {
|
|
42
|
-
const r = m, u = G(r.bindedItems || []), t = G(!1);
|
|
43
|
-
ot(() => {
|
|
44
|
-
i();
|
|
45
|
-
});
|
|
46
|
-
async function i() {
|
|
47
|
-
var a, f;
|
|
48
|
-
!t.value && ((a = r.data) != null && a._id) && (t.value = !0, u.value = await Y().getAffectedMenu((f = r.data) == null ? void 0 : f._id), t.value = !1);
|
|
49
|
-
}
|
|
50
|
-
return (a, f) => {
|
|
51
|
-
const l = D("FmSpacer"), n = D("FmCircularProgress");
|
|
52
|
-
return v(), C(ae, null, [
|
|
53
|
-
p("p", null, R(a.message), 1),
|
|
54
|
-
t.value ? (v(), C("div", Gt, [
|
|
55
|
-
B(l),
|
|
56
|
-
p("div", null, [
|
|
57
|
-
B(n, { size: "xl" })
|
|
58
|
-
]),
|
|
59
|
-
f[0] || (f[0] = p("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
60
|
-
B(l)
|
|
61
|
-
])) : (v(), C("div", zt, [
|
|
62
|
-
f[2] || (f[2] = p("br", null, null, -1)),
|
|
63
|
-
u.value.length > 0 ? (v(), C("div", Jt, [
|
|
64
|
-
f[1] || (f[1] = p("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
|
|
65
|
-
B(Ye, {
|
|
66
|
-
name: "Menu",
|
|
67
|
-
bindings: u.value
|
|
68
|
-
}, null, 8, ["bindings"])
|
|
69
|
-
])) : F("", !0)
|
|
70
|
-
]))
|
|
71
|
-
], 64);
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
}), Ie = He("recipeForm", function() {
|
|
75
|
-
const r = Ae(), u = Fe(), t = Y(), i = G(!1), a = G();
|
|
76
|
-
function f() {
|
|
77
|
-
const e = {
|
|
78
|
-
recipe: {},
|
|
79
|
-
mode: q.CREATE,
|
|
80
|
-
show: !0,
|
|
81
|
-
"onUpdate:show"(d) {
|
|
82
|
-
a.value.show = d;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
a.value = e;
|
|
86
|
-
}
|
|
87
|
-
async function l(e) {
|
|
88
|
-
const d = {
|
|
89
|
-
recipe: Ve(e),
|
|
90
|
-
mode: q.UPDATE,
|
|
91
|
-
show: !0,
|
|
92
|
-
"onUpdate:show"(w) {
|
|
93
|
-
a.value.show = w;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
a.value = d;
|
|
97
|
-
}
|
|
98
|
-
async function n(e) {
|
|
99
|
-
i.value = !0;
|
|
100
|
-
try {
|
|
101
|
-
await t.deleteRecipe(e), u.open({
|
|
102
|
-
title: "Success",
|
|
103
|
-
message: `Deleted ${e.name}`,
|
|
104
|
-
type: "success"
|
|
105
|
-
});
|
|
106
|
-
} catch (d) {
|
|
107
|
-
d instanceof ut && yt(d) ? r.open({
|
|
108
|
-
title: "Cannot delete recipe",
|
|
109
|
-
contentComponent: vt,
|
|
110
|
-
contentComponentProps: {
|
|
111
|
-
subject: (e == null ? void 0 : e.name) ?? "",
|
|
112
|
-
items: d.errorResponse.message
|
|
113
|
-
},
|
|
114
|
-
secondaryActions: {
|
|
115
|
-
text: "Close",
|
|
116
|
-
close: !0
|
|
117
|
-
}
|
|
118
|
-
}) : console.log("unable to delete recipe", d), u.open({
|
|
119
|
-
title: `Cannot delete ${e == null ? void 0 : e.name}`,
|
|
120
|
-
message: "Please try again.",
|
|
121
|
-
type: "error"
|
|
122
|
-
}), console.error("failed to delete recipe", d);
|
|
123
|
-
} finally {
|
|
124
|
-
i.value = !1;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function o(e) {
|
|
128
|
-
r.open({
|
|
129
|
-
title: `Delete ${(e == null ? void 0 : e.name) ?? "recipe"}?`,
|
|
130
|
-
closeButton: !1,
|
|
131
|
-
primaryActions: {
|
|
132
|
-
text: "Delete",
|
|
133
|
-
close: !0,
|
|
134
|
-
variant: "destructive"
|
|
135
|
-
},
|
|
136
|
-
secondaryActions: {
|
|
137
|
-
text: "Cancel",
|
|
138
|
-
close: !0
|
|
139
|
-
},
|
|
140
|
-
contentComponent: Kt,
|
|
141
|
-
contentComponentProps: {
|
|
142
|
-
type: "menu",
|
|
143
|
-
data: e,
|
|
144
|
-
message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
|
|
145
|
-
}
|
|
146
|
-
}).onPrimary(() => n(e));
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
createRecipe: f,
|
|
150
|
-
updateRecipe: l,
|
|
151
|
-
deleteRecipe: o,
|
|
152
|
-
recipeDialogProps: a,
|
|
153
|
-
recipeViewLoading: i
|
|
154
|
-
};
|
|
155
|
-
});
|
|
156
|
-
function Lt() {
|
|
157
|
-
const { updateRecipe: m, deleteRecipe: r } = Ie(), u = Y(), { t } = W();
|
|
158
|
-
async function i(n, o) {
|
|
159
|
-
const e = Ve(o);
|
|
160
|
-
if (n === ge.Edit) {
|
|
161
|
-
await m(e);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (n === ge.Delete) {
|
|
165
|
-
await r(e);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
function a(n, o) {
|
|
170
|
-
const e = n.filter((E) => E.type === de.enum.SKU), d = n.filter(
|
|
171
|
-
(E) => E.type === de.enum.SKU_GROUP
|
|
172
|
-
), w = n.filter((E) => E.type === de.enum.RECIPE);
|
|
173
|
-
return [
|
|
174
|
-
...e.map((E) => ({ ...E, recipeIds: [...o] })),
|
|
175
|
-
...d.map((E) => ({ ...E, isGroup: !0, recipeIds: [...o] })),
|
|
176
|
-
...w.filter((E) => u.recipeById[E.id] && !o.has(E.id)).flatMap(
|
|
177
|
-
(E) => a(u.recipeById[E.id].contains, /* @__PURE__ */ new Set([...o, E.id]))
|
|
178
|
-
)
|
|
179
|
-
];
|
|
180
|
-
}
|
|
181
|
-
const f = [
|
|
182
|
-
{
|
|
183
|
-
accessorKey: "recipe",
|
|
184
|
-
header: () => t("inventory.recipe.name"),
|
|
185
|
-
size: 400
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
accessorKey: "ingredients",
|
|
189
|
-
header: () => t("inventory.recipe.ingredients"),
|
|
190
|
-
size: "auto"
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
id: "action",
|
|
194
|
-
header: "",
|
|
195
|
-
cell(n) {
|
|
196
|
-
return gt(
|
|
197
|
-
[Je[ge.Edit], Je[ge.Delete]],
|
|
198
|
-
(o) => {
|
|
199
|
-
i(o, n.row.original.original);
|
|
200
|
-
}
|
|
201
|
-
);
|
|
202
|
-
},
|
|
203
|
-
enableSorting: !1,
|
|
204
|
-
size: 40,
|
|
205
|
-
meta: {
|
|
206
|
-
cellClass: "",
|
|
207
|
-
headerClass: ""
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
];
|
|
211
|
-
function l(n) {
|
|
212
|
-
const o = Y();
|
|
213
|
-
return n.map((e) => ({
|
|
214
|
-
recipe: e.name,
|
|
215
|
-
ingredients: a(e.contains, /* @__PURE__ */ new Set([e._id])).map((d) => {
|
|
216
|
-
var E, k, b, h, V, T;
|
|
217
|
-
if (d.isGroup) {
|
|
218
|
-
const _ = o.skuGroupById[d.id];
|
|
219
|
-
return d.recipeIds.slice(1).length ? `(${(E = o.recipeById[d.recipeIds.at(-1) ?? ""]) == null ? void 0 : E.name}) ${_.name} (x ${Q(d.amount)})` : `${_.name} (x${Q(d.amount)})`;
|
|
220
|
-
}
|
|
221
|
-
const w = o.skuById[d.id];
|
|
222
|
-
return w ? d.recipeIds.slice(1).length ? `(${(k = o.recipeById[d.recipeIds.at(-1) ?? ""]) == null ? void 0 : k.name}) ${w.name} (${Q(d.amount)}${((b = d.measurement) == null ? void 0 : b.abbrev) ?? ((h = w == null ? void 0 : w.unit) == null ? void 0 : h.abbrev)})` : `${w.name} (${Q(d.amount)}${((V = d.measurement) == null ? void 0 : V.abbrev) ?? ((T = w == null ? void 0 : w.unit) == null ? void 0 : T.abbrev)})` : null;
|
|
223
|
-
}).filter((d) => d).join(", "),
|
|
224
|
-
original: e
|
|
225
|
-
}));
|
|
226
|
-
}
|
|
227
|
-
return { columnDefs: f, formatRowData: l };
|
|
228
|
-
}
|
|
229
|
-
function jt() {
|
|
230
|
-
const m = Y(), r = Ae();
|
|
231
|
-
async function u(a, f, l, n = []) {
|
|
232
|
-
var k, b;
|
|
233
|
-
const o = a.filter((h) => h.type === "SKU"), e = a.filter((h) => h.type !== "SKU"), d = /* @__PURE__ */ new Set();
|
|
234
|
-
if (l)
|
|
235
|
-
for (const h of m.skus)
|
|
236
|
-
!n.some((T) => T === h._id) && h._id !== l && !((b = (k = h.convert) == null ? void 0 : k.inventoryBindings) != null && b.some((T) => T.id === l)) || d.add(h._id);
|
|
237
|
-
const w = m.skus.map((h) => ({
|
|
238
|
-
label: h.name,
|
|
239
|
-
sublabel: `${h.code}${d.has(h._id) ? " (Cannot bind, will cause recursive binding)" : ""}`,
|
|
240
|
-
value: h,
|
|
241
|
-
disabled: d.has(h._id)
|
|
242
|
-
})), E = w.filter(
|
|
243
|
-
(h) => o.find((V) => V.id === h.value._id) && !d.has(h.value._id)
|
|
244
|
-
).map((h) => h.value);
|
|
245
|
-
r.open({
|
|
246
|
-
title: "Select ingredients",
|
|
247
|
-
contentComponent: xe,
|
|
248
|
-
contentComponentProps: {
|
|
249
|
-
items: w,
|
|
250
|
-
modelValue: E,
|
|
251
|
-
virtualScroll: !0
|
|
252
|
-
},
|
|
253
|
-
primaryActions: {
|
|
254
|
-
text: "Confirm",
|
|
255
|
-
close: !0
|
|
256
|
-
},
|
|
257
|
-
secondaryActions: {
|
|
258
|
-
text: "Close",
|
|
259
|
-
close: !0,
|
|
260
|
-
variant: "tertiary"
|
|
261
|
-
}
|
|
262
|
-
}).onPrimary((h) => {
|
|
263
|
-
const V = [
|
|
264
|
-
...e,
|
|
265
|
-
...a.filter((T) => h.find((_) => _._id === T.id)),
|
|
266
|
-
...h.filter((T) => !a.find((_) => _.id === T._id)).map((T) => ({
|
|
267
|
-
type: "SKU",
|
|
268
|
-
id: T._id,
|
|
269
|
-
amount: {
|
|
270
|
-
amount: 1,
|
|
271
|
-
precision: 0
|
|
272
|
-
}
|
|
273
|
-
}))
|
|
274
|
-
];
|
|
275
|
-
f(V);
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
async function t(a, f, l = []) {
|
|
279
|
-
var E;
|
|
280
|
-
const n = a.filter((k) => k.type === "RECIPE"), o = a.filter((k) => k.type !== "RECIPE"), e = /* @__PURE__ */ new Set();
|
|
281
|
-
if (l.length)
|
|
282
|
-
for (const k of m.recipes) {
|
|
283
|
-
const b = ((E = m.recipeBindingFlattenCache[k._id]) == null ? void 0 : E.inventoryBindings) ?? [], h = b.some(
|
|
284
|
-
(_) => _.bindingPaths.some((g) => l.some((c) => c === g.id))
|
|
285
|
-
), V = b.some(
|
|
286
|
-
(_) => "success" in _ && l.includes(_.ingredient._id)
|
|
287
|
-
);
|
|
288
|
-
(l.some((_) => _ === k._id) || h || V) && e.add(k._id);
|
|
289
|
-
}
|
|
290
|
-
const d = m.recipes.filter((k) => !l.includes(k._id)).map((k) => ({
|
|
291
|
-
label: k.name,
|
|
292
|
-
sublabel: e.has(k._id) ? "(Cannot bind, will cause recursive binding)" : `${k.contains.length} inventory bindings`,
|
|
293
|
-
value: k,
|
|
294
|
-
disabled: e.has(k._id)
|
|
295
|
-
})), w = d.filter(
|
|
296
|
-
(k) => n.find((b) => b.id === k.value._id) && !e.has(k.value._id)
|
|
297
|
-
).map((k) => k.value);
|
|
298
|
-
r.open({
|
|
299
|
-
title: "Select recipes",
|
|
300
|
-
contentComponent: xe,
|
|
301
|
-
contentComponentProps: {
|
|
302
|
-
items: d,
|
|
303
|
-
modelValue: w,
|
|
304
|
-
virtualScroll: !0
|
|
305
|
-
},
|
|
306
|
-
primaryActions: {
|
|
307
|
-
text: "Confirm",
|
|
308
|
-
close: !0
|
|
309
|
-
},
|
|
310
|
-
secondaryActions: {
|
|
311
|
-
text: "Close",
|
|
312
|
-
close: !0,
|
|
313
|
-
variant: "tertiary"
|
|
314
|
-
}
|
|
315
|
-
}).onPrimary((k) => {
|
|
316
|
-
const b = [
|
|
317
|
-
...a.filter((h) => k.find((V) => V._id === h.id)),
|
|
318
|
-
...k.filter((h) => !a.find((V) => V.id === h._id)).map((h) => ({
|
|
319
|
-
type: "RECIPE",
|
|
320
|
-
id: h._id,
|
|
321
|
-
amount: {
|
|
322
|
-
amount: 1,
|
|
323
|
-
precision: 0
|
|
324
|
-
}
|
|
325
|
-
})),
|
|
326
|
-
...o
|
|
327
|
-
];
|
|
328
|
-
f(b);
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
async function i(a, f, l = []) {
|
|
332
|
-
const n = a.filter((w) => w.type === "SKU_GROUP"), o = a.filter((w) => w.type !== "SKU_GROUP"), e = m.skuGroups.filter((w) => !l.includes(w._id)).map((w) => ({
|
|
333
|
-
label: w.name,
|
|
334
|
-
value: w
|
|
335
|
-
})), d = e.filter((w) => n.find((E) => E.id === w.value._id)).map((w) => w.value);
|
|
336
|
-
r.open({
|
|
337
|
-
title: "Select ingredient group",
|
|
338
|
-
contentComponent: xe,
|
|
339
|
-
contentComponentProps: {
|
|
340
|
-
items: e,
|
|
341
|
-
modelValue: d,
|
|
342
|
-
virtualScroll: !0
|
|
343
|
-
},
|
|
344
|
-
primaryActions: {
|
|
345
|
-
text: "Confirm",
|
|
346
|
-
close: !0
|
|
347
|
-
},
|
|
348
|
-
secondaryActions: {
|
|
349
|
-
text: "Close",
|
|
350
|
-
close: !0,
|
|
351
|
-
variant: "tertiary"
|
|
352
|
-
}
|
|
353
|
-
}).onPrimary((w) => {
|
|
354
|
-
const E = [
|
|
355
|
-
...a.filter((k) => w.find((b) => b._id === k.id)),
|
|
356
|
-
...w.filter((k) => !a.find((b) => b.id === k._id)).map((k) => ({
|
|
357
|
-
type: "SKU_GROUP",
|
|
358
|
-
id: k._id,
|
|
359
|
-
amount: {
|
|
360
|
-
amount: 1,
|
|
361
|
-
precision: 0
|
|
362
|
-
}
|
|
363
|
-
})),
|
|
364
|
-
...o
|
|
365
|
-
];
|
|
366
|
-
f(E);
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
return {
|
|
370
|
-
promptIngredientsBinding: u,
|
|
371
|
-
promptRecipesBinding: t,
|
|
372
|
-
promptIngredientGroupsBinding: i
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
const qt = { class: "flex flex-col" }, Yt = { class: "flex flex-col gap-4" }, tt = /* @__PURE__ */ ee({
|
|
376
|
-
__name: "InventoryBindingRule",
|
|
377
|
-
props: {
|
|
378
|
-
disabled: { type: Boolean },
|
|
379
|
-
modelValue: {},
|
|
380
|
-
minCount: {},
|
|
381
|
-
maxCount: {}
|
|
382
|
-
},
|
|
383
|
-
emits: ["update:modelValue"],
|
|
384
|
-
setup(m, { emit: r }) {
|
|
385
|
-
const u = m, t = r, { t: i } = W(), a = _t(), f = A(() => {
|
|
386
|
-
var w;
|
|
387
|
-
const e = /* @__PURE__ */ new Map(), d = a.restaurants.value.map((E) => E.customAttributes ?? {});
|
|
388
|
-
for (const E of d)
|
|
389
|
-
for (const [k, b] of Object.entries(E))
|
|
390
|
-
e.has(k) || e.set(k, /* @__PURE__ */ new Set()), b && ((w = e.get(k)) == null || w.add(b));
|
|
391
|
-
return e;
|
|
392
|
-
}), l = A(() => [
|
|
393
|
-
...[...f.value.entries()].map(([d, w]) => ({
|
|
394
|
-
type: "string",
|
|
395
|
-
key: d,
|
|
396
|
-
entity: "restaurant",
|
|
397
|
-
values: [...w]
|
|
398
|
-
}))
|
|
399
|
-
]), n = G(null);
|
|
400
|
-
let o = null;
|
|
401
|
-
return pe(
|
|
402
|
-
() => u.modelValue,
|
|
403
|
-
(e) => {
|
|
404
|
-
JSON.stringify(e) !== JSON.stringify(o) && (n.value = e ? Et.build(e) : null);
|
|
405
|
-
},
|
|
406
|
-
{ immediate: !0 }
|
|
407
|
-
), pe(
|
|
408
|
-
n,
|
|
409
|
-
(e) => {
|
|
410
|
-
o = e ? It.build(e) : null, t("update:modelValue", o);
|
|
411
|
-
},
|
|
412
|
-
{ deep: !0 }
|
|
413
|
-
), (e, d) => {
|
|
414
|
-
const w = D("FmLabel"), E = D("FmFormGroup");
|
|
415
|
-
return v(), C("div", qt, [
|
|
416
|
-
p("div", Yt, [
|
|
417
|
-
B(w, {
|
|
418
|
-
label: s(i)("inventory.ingredientGroup.form.rules.title"),
|
|
419
|
-
required: e.minCount != null && e.minCount > 0
|
|
420
|
-
}, null, 8, ["label", "required"]),
|
|
421
|
-
B(s(Bt), {
|
|
422
|
-
modelValue: n.value,
|
|
423
|
-
"onUpdate:modelValue": d[0] || (d[0] = (k) => n.value = k),
|
|
424
|
-
attributes: l.value
|
|
425
|
-
}, null, 8, ["modelValue", "attributes"])
|
|
426
|
-
]),
|
|
427
|
-
B(E, {
|
|
428
|
-
"model-value": n.value,
|
|
429
|
-
rules: [
|
|
430
|
-
(k) => {
|
|
431
|
-
const b = k ? 1 : 0;
|
|
432
|
-
return u.minCount !== void 0 && b < u.minCount ? s(i)("inventory.ingredientGroup.form.rules.validation.minCount", {
|
|
433
|
-
count: u.minCount
|
|
434
|
-
}) : u.maxCount !== void 0 && b > u.maxCount ? s(i)("inventory.ingredientGroup.form.rules.validation.maxCount", {
|
|
435
|
-
count: u.maxCount
|
|
436
|
-
}) : !0;
|
|
437
|
-
}
|
|
438
|
-
]
|
|
439
|
-
}, null, 8, ["model-value", "rules"])
|
|
440
|
-
]);
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
}), Ht = { class: "border-1 mx-3 my-1 rounded-md" }, Qt = { class: "flex flex-col w-full border-b border-fm-color-neutral-gray-100" }, Wt = {
|
|
444
|
-
class: "flex items-center",
|
|
445
|
-
style: { "min-height": "48px" }
|
|
446
|
-
}, Xt = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, Zt = { class: "flex flex-col" }, en = { class: "line-clamp-1" }, tn = { class: "w-[200px]" }, nn = {
|
|
447
|
-
key: 0,
|
|
448
|
-
class: "w-[52px]"
|
|
449
|
-
}, on = {
|
|
450
|
-
key: 0,
|
|
451
|
-
class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400 px-8"
|
|
452
|
-
}, ln = { class: "px-12 pb-4" }, Be = /* @__PURE__ */ ee({
|
|
453
|
-
__name: "InventoryRecipeBindingV2Field",
|
|
454
|
-
props: {
|
|
455
|
-
disabled: { type: Boolean },
|
|
456
|
-
readonly: { type: Boolean },
|
|
457
|
-
modelValue: {},
|
|
458
|
-
displayName: {},
|
|
459
|
-
showError: { type: Boolean }
|
|
460
|
-
},
|
|
461
|
-
emits: ["update:modelValue", "delete", "settings"],
|
|
462
|
-
setup(m, { emit: r }) {
|
|
463
|
-
const u = r, { t } = W(), i = Ze("modelValue"), a = G(""), f = A(() => +Q(i.amount));
|
|
464
|
-
pe(
|
|
465
|
-
() => i.amount,
|
|
466
|
-
(o) => {
|
|
467
|
-
const e = Q(o);
|
|
468
|
-
a.value !== e && (a.value = e);
|
|
469
|
-
},
|
|
470
|
-
{ immediate: !0 }
|
|
471
|
-
);
|
|
472
|
-
let l = null;
|
|
473
|
-
function n(o) {
|
|
474
|
-
a.value = o, l && clearTimeout(l), l = setTimeout(() => {
|
|
475
|
-
const e = +o;
|
|
476
|
-
o.length > 0 && isFinite(e) ? i.amount = Qe(e) : i.amount = { amount: 0, precision: 0 };
|
|
477
|
-
}, 300);
|
|
478
|
-
}
|
|
479
|
-
return (o, e) => {
|
|
480
|
-
const d = D("FmTooltip"), w = D("FmTextField"), E = D("FmButton"), k = D("FmIcon"), b = D("FmFormGroup");
|
|
481
|
-
return v(), C("div", Ht, [
|
|
482
|
-
B(b, {
|
|
483
|
-
class: he(["mb-2"]),
|
|
484
|
-
disabled: o.disabled,
|
|
485
|
-
modelValue: f.value,
|
|
486
|
-
rules: [s(We)(0), s(Re)(-1)]
|
|
487
|
-
}, {
|
|
488
|
-
default: j(({ invalid: h }) => [
|
|
489
|
-
p("div", Qt, [
|
|
490
|
-
p("div", Wt, [
|
|
491
|
-
p("div", Xt, [
|
|
492
|
-
p("div", Zt, [
|
|
493
|
-
B(d, {
|
|
494
|
-
zIndex: 51,
|
|
495
|
-
variant: "plain",
|
|
496
|
-
placement: "top",
|
|
497
|
-
content: o.displayName
|
|
498
|
-
}, {
|
|
499
|
-
default: j(() => [
|
|
500
|
-
p("span", en, R(o.displayName), 1)
|
|
501
|
-
]),
|
|
502
|
-
_: 1
|
|
503
|
-
}, 8, ["content"])
|
|
504
|
-
])
|
|
505
|
-
]),
|
|
506
|
-
p("div", tn, [
|
|
507
|
-
B(w, {
|
|
508
|
-
class: "w-full",
|
|
509
|
-
disabled: o.disabled,
|
|
510
|
-
modelValue: a.value,
|
|
511
|
-
"onUpdate:modelValue": e[0] || (e[0] = (V) => n(V)),
|
|
512
|
-
invalid: h
|
|
513
|
-
}, null, 8, ["disabled", "modelValue", "invalid"])
|
|
514
|
-
]),
|
|
515
|
-
o.readonly ? F("", !0) : (v(), C("div", nn, [
|
|
516
|
-
B(E, {
|
|
517
|
-
disabled: o.disabled,
|
|
518
|
-
type: "button",
|
|
519
|
-
variant: "plain",
|
|
520
|
-
icon: "delete",
|
|
521
|
-
"icon-color": "#000000",
|
|
522
|
-
onClick: e[1] || (e[1] = () => u("delete", s(i).id))
|
|
523
|
-
}, null, 8, ["disabled"])
|
|
524
|
-
]))
|
|
525
|
-
]),
|
|
526
|
-
o.showError ? (v(), C("div", on, [
|
|
527
|
-
B(k, {
|
|
528
|
-
name: "error",
|
|
529
|
-
color: "system-error-300",
|
|
530
|
-
size: "sm"
|
|
531
|
-
}),
|
|
532
|
-
p("div", null, R(s(t)("inventory.inventoryBindings.circularError")), 1)
|
|
533
|
-
])) : F("", !0)
|
|
534
|
-
])
|
|
535
|
-
]),
|
|
536
|
-
_: 1
|
|
537
|
-
}, 8, ["disabled", "modelValue", "rules"]),
|
|
538
|
-
p("div", ln, [
|
|
539
|
-
B(tt, {
|
|
540
|
-
modelValue: s(i).rules,
|
|
541
|
-
"onUpdate:modelValue": e[2] || (e[2] = (h) => s(i).rules = h),
|
|
542
|
-
disabled: o.disabled
|
|
543
|
-
}, null, 8, ["modelValue", "disabled"])
|
|
544
|
-
])
|
|
545
|
-
]);
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
function an(m) {
|
|
550
|
-
const r = Vt(), { t: u } = At(), t = Y(), i = A(() => [
|
|
551
|
-
{
|
|
552
|
-
id: "delete",
|
|
553
|
-
header: "",
|
|
554
|
-
cell(l) {
|
|
555
|
-
const n = l.row.original;
|
|
556
|
-
return ne(
|
|
557
|
-
"div",
|
|
558
|
-
{ class: "w-full flex justify-end" },
|
|
559
|
-
ne(ce.FmButton, {
|
|
560
|
-
class: "delete-button",
|
|
561
|
-
key: n._id,
|
|
562
|
-
type: "button",
|
|
563
|
-
icon: "delete",
|
|
564
|
-
variant: "tertiary",
|
|
565
|
-
size: "md",
|
|
566
|
-
disabled: m.disabled ?? !1,
|
|
567
|
-
onClick: () => {
|
|
568
|
-
m.bindingAlternatives = m.bindingAlternatives.filter(
|
|
569
|
-
(o) => o._id !== n._id
|
|
570
|
-
);
|
|
571
|
-
}
|
|
572
|
-
})
|
|
573
|
-
);
|
|
574
|
-
},
|
|
575
|
-
enableSorting: !1,
|
|
576
|
-
size: 40,
|
|
577
|
-
meta: {
|
|
578
|
-
cellClass: "",
|
|
579
|
-
headerClass: ""
|
|
580
|
-
}
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
id: "alternative",
|
|
584
|
-
header: () => u("inventory.inventoryBindings.alternativeTable.ingredient"),
|
|
585
|
-
accessorFn: (l) => {
|
|
586
|
-
var n, o;
|
|
587
|
-
return `${((n = t.skuById[l._id]) == null ? void 0 : n.name) ?? ""} (${((o = t.skuById[l._id]) == null ? void 0 : o.code) ?? ""})`;
|
|
588
|
-
},
|
|
589
|
-
cell: ({ row: l }) => {
|
|
590
|
-
const n = t.skuById[l.original._id];
|
|
591
|
-
return ne(
|
|
592
|
-
"div",
|
|
593
|
-
{
|
|
594
|
-
class: "w-full flex flex-col"
|
|
595
|
-
},
|
|
596
|
-
[
|
|
597
|
-
ne("div", { class: "fm-typo-en-body-lg-400 line-clamp-1" }, n.name),
|
|
598
|
-
ne(
|
|
599
|
-
"div",
|
|
600
|
-
{ class: "fm-typo-en-body-md-400 line-clamp-1 text-fm-color-typo-secondary" },
|
|
601
|
-
n.code
|
|
602
|
-
)
|
|
603
|
-
]
|
|
604
|
-
);
|
|
605
|
-
},
|
|
606
|
-
size: "auto",
|
|
607
|
-
enableSorting: !1
|
|
608
|
-
},
|
|
609
|
-
{
|
|
610
|
-
id: "unit",
|
|
611
|
-
header: () => u("inventory.inventoryBindings.alternativeTable.unit"),
|
|
612
|
-
accessorFn: (l) => {
|
|
613
|
-
const n = t.skuById[l._id];
|
|
614
|
-
return n.unit.measurements.computeFirst(
|
|
615
|
-
(o) => o.id === l.trackingMeasurement ? o.name : null
|
|
616
|
-
) ?? n.unit.name;
|
|
617
|
-
},
|
|
618
|
-
enableSorting: !1
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
id: "unitOption",
|
|
622
|
-
header: () => u("inventory.inventoryBindings.alternativeTable.unit"),
|
|
623
|
-
accessorKey: "trackingMeasurement",
|
|
624
|
-
cell(l) {
|
|
625
|
-
const n = t.skuById[l.row.original._id];
|
|
626
|
-
if (!n) return null;
|
|
627
|
-
const o = [
|
|
628
|
-
{
|
|
629
|
-
label: n.unit.name,
|
|
630
|
-
sublabel: n.unit.abbrev,
|
|
631
|
-
value: null
|
|
632
|
-
},
|
|
633
|
-
...n.unit.measurements.map((e) => ({
|
|
634
|
-
label: `${e.name} (${e.abbrev})`,
|
|
635
|
-
sublabel: u("inventory.inventoryBindings.alternativeTable.measurementOption"),
|
|
636
|
-
value: e.id
|
|
637
|
-
}))
|
|
638
|
-
].filter((e) => !e.label.toLowerCase().includes("inactive"));
|
|
639
|
-
return ne(ce.FmSelect, {
|
|
640
|
-
modelValue: l.row.original.trackingMeasurement ?? null,
|
|
641
|
-
items: o,
|
|
642
|
-
disabled: m.disabled ?? !1,
|
|
643
|
-
"onUpdate:modelValue": (e) => {
|
|
644
|
-
m.bindingAlternatives = m.bindingAlternatives.map((d) => d._id === l.row.original._id ? { ...d, trackingMeasurement: e } : d);
|
|
645
|
-
}
|
|
646
|
-
});
|
|
647
|
-
},
|
|
648
|
-
enableSorting: !1
|
|
649
|
-
},
|
|
650
|
-
{
|
|
651
|
-
id: "priority",
|
|
652
|
-
header: () => u("inventory.inventoryBindings.alternativeTable.priority"),
|
|
653
|
-
accessorKey: "priority",
|
|
654
|
-
enableSorting: !0,
|
|
655
|
-
cell(l) {
|
|
656
|
-
const n = l.row.original;
|
|
657
|
-
return ne(ce.FmTextField, {
|
|
658
|
-
modelValue: n.priority ?? l.row.index + 1,
|
|
659
|
-
rules: [
|
|
660
|
-
xt(),
|
|
661
|
-
Ee(1),
|
|
662
|
-
Xe(
|
|
663
|
-
m.bindingAlternatives.filter((o) => o._id !== n._id).map((o) => {
|
|
664
|
-
const e = t.skuById[o._id];
|
|
665
|
-
return {
|
|
666
|
-
label: e == null ? void 0 : e.name,
|
|
667
|
-
value: o.priority
|
|
668
|
-
};
|
|
669
|
-
})
|
|
670
|
-
)
|
|
671
|
-
],
|
|
672
|
-
"onUpdate:modelValue": (o) => {
|
|
673
|
-
const e = Number(o);
|
|
674
|
-
isNaN(e) || (m.bindingAlternatives = m.bindingAlternatives.map((d) => d._id === l.row.original._id ? { ...d, priority: e } : d));
|
|
675
|
-
}
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
},
|
|
679
|
-
{
|
|
680
|
-
id: "default",
|
|
681
|
-
header: () => "",
|
|
682
|
-
accessorKey: "default",
|
|
683
|
-
cell(l) {
|
|
684
|
-
const n = t.skuById[l.row.original._id];
|
|
685
|
-
return n ? ne(ce.FmCheckbox, {
|
|
686
|
-
modelValue: l.row.original.default ?? !1,
|
|
687
|
-
value: n._id,
|
|
688
|
-
disabled: m.disabled ?? !1,
|
|
689
|
-
"onUpdate:modelValue": () => {
|
|
690
|
-
m.bindingAlternatives = m.bindingAlternatives.map((o) => o._id === l.row.original._id ? { ...o, default: !0 } : { ...o, default: !1 });
|
|
691
|
-
}
|
|
692
|
-
}) : null;
|
|
693
|
-
},
|
|
694
|
-
enableSorting: !1,
|
|
695
|
-
size: 40,
|
|
696
|
-
meta: {
|
|
697
|
-
cellClass: "",
|
|
698
|
-
headerClass: ""
|
|
699
|
-
}
|
|
700
|
-
},
|
|
701
|
-
{
|
|
702
|
-
id: "move",
|
|
703
|
-
header: "",
|
|
704
|
-
cell(l) {
|
|
705
|
-
const n = l.row.original;
|
|
706
|
-
return ne("div", { class: "w-full flex justify-end" }, [
|
|
707
|
-
ne(ce.FmButton, {
|
|
708
|
-
key: n._id,
|
|
709
|
-
type: "button",
|
|
710
|
-
icon: "keyboard_arrow_up",
|
|
711
|
-
variant: "tertiary",
|
|
712
|
-
size: "md",
|
|
713
|
-
disabled: m.disabled ?? !1,
|
|
714
|
-
onClick: () => {
|
|
715
|
-
const o = [...m.bindingAlternatives], e = o.findIndex((d) => d._id === n._id);
|
|
716
|
-
if (e > 0) {
|
|
717
|
-
const d = o[e - 1];
|
|
718
|
-
o[e - 1] = n, o[e] = d;
|
|
719
|
-
}
|
|
720
|
-
m.bindingAlternatives = [...o];
|
|
721
|
-
}
|
|
722
|
-
}),
|
|
723
|
-
ne(ce.FmButton, {
|
|
724
|
-
key: n._id,
|
|
725
|
-
type: "button",
|
|
726
|
-
icon: "keyboard_arrow_down",
|
|
727
|
-
variant: "tertiary",
|
|
728
|
-
size: "md",
|
|
729
|
-
disabled: m.disabled ?? !1,
|
|
730
|
-
onClick: () => {
|
|
731
|
-
const o = [...m.bindingAlternatives], e = o.findIndex((d) => d._id === n._id);
|
|
732
|
-
if (e < o.length - 1) {
|
|
733
|
-
const d = o[e + 1];
|
|
734
|
-
o[e + 1] = n, o[e] = d;
|
|
735
|
-
}
|
|
736
|
-
m.bindingAlternatives = [...o];
|
|
737
|
-
}
|
|
738
|
-
})
|
|
739
|
-
]);
|
|
740
|
-
},
|
|
741
|
-
enableSorting: !1,
|
|
742
|
-
size: 40,
|
|
743
|
-
meta: {
|
|
744
|
-
cellClass: "",
|
|
745
|
-
headerClass: ""
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
]);
|
|
749
|
-
return {
|
|
750
|
-
get columnDefs() {
|
|
751
|
-
return i.value;
|
|
752
|
-
},
|
|
753
|
-
promptAddIngredient: async (f) => {
|
|
754
|
-
const l = [];
|
|
755
|
-
for (const e of t.skus)
|
|
756
|
-
f.includes(e._id) || l.push({
|
|
757
|
-
label: e.name,
|
|
758
|
-
sublabel: e.code,
|
|
759
|
-
value: e._id,
|
|
760
|
-
disabled: f.includes(e._id)
|
|
761
|
-
});
|
|
762
|
-
const n = (m.bindingAlternatives ?? []).map((e) => e._id), o = await r.multiSelect(l, n, (e) => {
|
|
763
|
-
var w, E, k, b, h, V;
|
|
764
|
-
const d = (w = m.bindingAlternatives) == null ? void 0 : w.findIndex((T) => T._id === e);
|
|
765
|
-
return {
|
|
766
|
-
_id: e,
|
|
767
|
-
trackingMeasurement: typeof d != "number" || d == -1 ? (E = t.skuById[e]) == null ? void 0 : E.trackingMeasurement : (b = (k = m.bindingAlternatives) == null ? void 0 : k[d]) == null ? void 0 : b.trackingMeasurement,
|
|
768
|
-
priority: ((V = (h = m.bindingAlternatives) == null ? void 0 : h[d]) == null ? void 0 : V.priority) ?? m.bindingAlternatives.length,
|
|
769
|
-
default: !1
|
|
770
|
-
};
|
|
771
|
-
});
|
|
772
|
-
m.bindingAlternatives = o ?? m.bindingAlternatives;
|
|
773
|
-
},
|
|
774
|
-
columnVisibility: {
|
|
775
|
-
delete: !0,
|
|
776
|
-
unit: !1,
|
|
777
|
-
unitOption: !0,
|
|
778
|
-
default: !1,
|
|
779
|
-
// previous demo: sort priority by moving sku element in the array,
|
|
780
|
-
// new demo: sort priority using priority field.
|
|
781
|
-
// can reenable if this use case is requested to be restored
|
|
782
|
-
move: !1
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
const sn = { class: "flex flex-col gap-16" }, rn = { class: "flex flex-col" }, dn = { class: "flex justify-between items-center px-2" }, un = /* @__PURE__ */ ee({
|
|
787
|
-
__name: "InventoryBindingAlternative",
|
|
788
|
-
props: {
|
|
789
|
-
disabled: { type: Boolean },
|
|
790
|
-
modelValue: {},
|
|
791
|
-
filterIngredientIds: {}
|
|
792
|
-
},
|
|
793
|
-
emits: ["update:modelValue"],
|
|
794
|
-
setup(m, { emit: r }) {
|
|
795
|
-
const u = m, t = r, { t: i } = W(), a = an({
|
|
796
|
-
get disabled() {
|
|
797
|
-
return u.disabled ?? !1;
|
|
798
|
-
},
|
|
799
|
-
get bindingAlternatives() {
|
|
800
|
-
return u.modelValue ?? [];
|
|
801
|
-
},
|
|
802
|
-
set bindingAlternatives(n) {
|
|
803
|
-
t("update:modelValue", n);
|
|
804
|
-
}
|
|
805
|
-
}), f = (n) => n && n.some((o) => u.filterIngredientIds.includes(o._id)) ? "Contains invalid ingredient" : !0, l = (n) => n && n.length > 5 ? i("inventory.binding.alternative.maximumExceeded", { max: 5 }) : !0;
|
|
806
|
-
return (n, o) => {
|
|
807
|
-
var k;
|
|
808
|
-
const e = D("FmLabel"), d = D("FmButton"), w = D("FmFormGroup"), E = D("FmTable");
|
|
809
|
-
return v(), C("div", sn, [
|
|
810
|
-
p("div", rn, [
|
|
811
|
-
p("div", dn, [
|
|
812
|
-
B(e, {
|
|
813
|
-
label: s(i)("inventory.alternatives")
|
|
814
|
-
}, null, 8, ["label"]),
|
|
815
|
-
B(d, {
|
|
816
|
-
disabled: n.disabled,
|
|
817
|
-
"prepend-icon": "link",
|
|
818
|
-
variant: "primary",
|
|
819
|
-
class: "border-1 rounded-lg border-fm-color-primary",
|
|
820
|
-
onClick: o[0] || (o[0] = (b) => s(a).promptAddIngredient(n.filterIngredientIds)),
|
|
821
|
-
size: "md"
|
|
822
|
-
}, null, 8, ["disabled"])
|
|
823
|
-
]),
|
|
824
|
-
B(w, {
|
|
825
|
-
"model-value": n.modelValue,
|
|
826
|
-
rules: [f, l]
|
|
827
|
-
}, null, 8, ["model-value", "rules"])
|
|
828
|
-
]),
|
|
829
|
-
B(E, {
|
|
830
|
-
"row-data": n.modelValue ?? [],
|
|
831
|
-
"column-defs": s(a).columnDefs,
|
|
832
|
-
"page-size": ((k = n.modelValue) == null ? void 0 : k.length) || 0,
|
|
833
|
-
"shrink-at": 9999,
|
|
834
|
-
"column-visibility": s(a).columnVisibility,
|
|
835
|
-
"hide-footer": ""
|
|
836
|
-
}, null, 8, ["row-data", "column-defs", "page-size", "column-visibility"])
|
|
837
|
-
]);
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
}), cn = { class: "border-1 mx-3 my-1 rounded-md" }, mn = { class: "flex flex-col border-b border-fm-color-neutral-gray-100" }, pn = {
|
|
841
|
-
class: "flex items-center w-full",
|
|
842
|
-
style: { "min-height": "48px" }
|
|
843
|
-
}, fn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, yn = { class: "line-clamp-1 w-full" }, vn = { class: "w-[150px]" }, bn = {
|
|
844
|
-
key: 0,
|
|
845
|
-
class: "w-[52px]"
|
|
846
|
-
}, gn = { class: "flex flex-col px-12 pb-4" }, Ce = /* @__PURE__ */ ee({
|
|
847
|
-
__name: "InventorySkuBindingV2Field",
|
|
848
|
-
props: {
|
|
849
|
-
disabled: { type: Boolean },
|
|
850
|
-
readonly: { type: Boolean },
|
|
851
|
-
modelValue: {},
|
|
852
|
-
displayName: {},
|
|
853
|
-
unit: {},
|
|
854
|
-
showError: { type: Boolean },
|
|
855
|
-
ableToConfigureAlternative: { type: Boolean },
|
|
856
|
-
ableToApplyRules: { type: Boolean }
|
|
857
|
-
},
|
|
858
|
-
emits: ["update:modelValue", "delete", "settings"],
|
|
859
|
-
setup(m, { emit: r }) {
|
|
860
|
-
const u = r, { t } = W(), i = Ze("modelValue");
|
|
861
|
-
function a(l) {
|
|
862
|
-
l && (i.amount = l.amount, i.measurement = l.measurement);
|
|
863
|
-
}
|
|
864
|
-
function f() {
|
|
865
|
-
return {
|
|
866
|
-
modelValue: {
|
|
867
|
-
amount: i.amount,
|
|
868
|
-
measurement: i.measurement
|
|
869
|
-
},
|
|
870
|
-
amountAsString: Ft.toFormatString({
|
|
871
|
-
value: i.amount
|
|
872
|
-
})
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
return (l, n) => {
|
|
876
|
-
const o = D("FmTooltip"), e = D("FmButton"), d = D("FmFormGroup");
|
|
877
|
-
return v(), C("div", cn, [
|
|
878
|
-
p("div", mn, [
|
|
879
|
-
p("div", pn, [
|
|
880
|
-
p("div", fn, [
|
|
881
|
-
B(o, {
|
|
882
|
-
zIndex: 51,
|
|
883
|
-
variant: "plain",
|
|
884
|
-
placement: "top",
|
|
885
|
-
content: l.displayName
|
|
886
|
-
}, {
|
|
887
|
-
default: j(() => [
|
|
888
|
-
p("span", yn, R(l.displayName), 1)
|
|
889
|
-
]),
|
|
890
|
-
_: 1
|
|
891
|
-
}, 8, ["content"])
|
|
892
|
-
]),
|
|
893
|
-
p("div", vn, [
|
|
894
|
-
B(et, {
|
|
895
|
-
"model-value": { amount: s(i).amount, measurement: s(i).measurement },
|
|
896
|
-
"onUpdate:modelValue": a,
|
|
897
|
-
unit: l.unit,
|
|
898
|
-
placement: "bottom",
|
|
899
|
-
"convert-amount-on-change-unit": "",
|
|
900
|
-
disabled: l.readonly
|
|
901
|
-
}, null, 8, ["model-value", "unit", "disabled"])
|
|
902
|
-
]),
|
|
903
|
-
l.readonly ? F("", !0) : (v(), C("div", bn, [
|
|
904
|
-
B(e, {
|
|
905
|
-
disabled: l.disabled,
|
|
906
|
-
type: "button",
|
|
907
|
-
variant: "tertiary",
|
|
908
|
-
icon: "delete",
|
|
909
|
-
onClick: n[0] || (n[0] = () => u("delete", s(i).id))
|
|
910
|
-
}, null, 8, ["disabled"])
|
|
911
|
-
]))
|
|
912
|
-
]),
|
|
913
|
-
p("div", gn, [
|
|
914
|
-
B(d, {
|
|
915
|
-
modelValue: s(i).amount,
|
|
916
|
-
rules: [s(Re)(0)]
|
|
917
|
-
}, null, 8, ["modelValue", "rules"]),
|
|
918
|
-
B(d, {
|
|
919
|
-
modelValue: f(),
|
|
920
|
-
rules: [
|
|
921
|
-
s(Ct)(),
|
|
922
|
-
s($t)(l.unit),
|
|
923
|
-
() => l.showError ? s(t)("inventory.inventoryBindings.invalidWarning") : !0
|
|
924
|
-
]
|
|
925
|
-
}, null, 8, ["modelValue", "rules"])
|
|
926
|
-
]),
|
|
927
|
-
l.ableToApplyRules ? (v(), M(tt, {
|
|
928
|
-
key: 0,
|
|
929
|
-
modelValue: s(i).rules,
|
|
930
|
-
"onUpdate:modelValue": n[1] || (n[1] = (w) => s(i).rules = w),
|
|
931
|
-
disabled: l.disabled
|
|
932
|
-
}, null, 8, ["modelValue", "disabled"])) : F("", !0),
|
|
933
|
-
l.ableToConfigureAlternative ? (v(), M(un, {
|
|
934
|
-
key: 1,
|
|
935
|
-
modelValue: s(i).alternatives,
|
|
936
|
-
"onUpdate:modelValue": n[2] || (n[2] = (w) => s(i).alternatives = w),
|
|
937
|
-
disabled: l.disabled,
|
|
938
|
-
filterIngredientIds: [s(i).id]
|
|
939
|
-
}, null, 8, ["modelValue", "disabled", "filterIngredientIds"])) : F("", !0)
|
|
940
|
-
])
|
|
941
|
-
]);
|
|
942
|
-
};
|
|
943
|
-
}
|
|
944
|
-
});
|
|
945
|
-
exports.FfCalculator;
|
|
946
|
-
const _n = { class: "flex flex-col gap-24" }, hn = {
|
|
947
|
-
key: 0,
|
|
948
|
-
class: "flex flex-col gap-16"
|
|
949
|
-
}, kn = { class: "flex items-center" }, xn = { class: "flex-1 fm-typo-en-title-sm-600" }, Sn = { class: "flex flex-col" }, wn = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, En = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, In = {
|
|
950
|
-
key: 0,
|
|
951
|
-
class: "w-[52px]"
|
|
952
|
-
}, Bn = {
|
|
953
|
-
key: 1,
|
|
954
|
-
class: "w-[52px]"
|
|
955
|
-
}, Cn = {
|
|
956
|
-
key: 1,
|
|
957
|
-
class: "flex flex-col gap-16"
|
|
958
|
-
}, $n = { class: "flex items-center" }, Vn = { class: "flex-1 fm-typo-en-title-sm-600" }, An = { class: "flex flex-col" }, Fn = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, Rn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Tn = { class: "flex flex-col w-full border-b border-fm-color-neutral-gray-100" }, Un = {
|
|
959
|
-
key: 0,
|
|
960
|
-
class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400"
|
|
961
|
-
}, Dn = {
|
|
962
|
-
class: "flex items-center",
|
|
963
|
-
style: { "min-height": "48px" }
|
|
964
|
-
}, Pn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, Nn = { class: "flex flex-col" }, On = { class: "w-[200px]" }, Mn = {
|
|
965
|
-
key: 0,
|
|
966
|
-
class: "w-[52px]"
|
|
967
|
-
}, Gn = { class: "flex flex-col gap-16" }, zn = { class: "flex items-center" }, Jn = { class: "flex-1 fm-typo-en-title-sm-600" }, Kn = { class: "flex flex-col" }, Ln = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, jn = { class: "flex-1 fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, qn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary w-[150px] px-16" }, Yn = {
|
|
968
|
-
key: 0,
|
|
969
|
-
class: "w-[52px]"
|
|
970
|
-
}, Hn = /* @__PURE__ */ ee({
|
|
971
|
-
__name: "InventoryBindingFormV2",
|
|
972
|
-
props: {
|
|
973
|
-
id: {},
|
|
974
|
-
modelValue: { default: () => [] },
|
|
975
|
-
excludeBindingId: {},
|
|
976
|
-
rules: { default: () => [] },
|
|
977
|
-
iframeMode: { type: Boolean },
|
|
978
|
-
disabled: { type: Boolean },
|
|
979
|
-
readonly: { type: Boolean },
|
|
980
|
-
recipeBindingConfig: { default: () => ({ enabled: !0, ableToApplyRules: !1 }) },
|
|
981
|
-
skuBindingConfig: { default: () => ({
|
|
982
|
-
enabled: !0,
|
|
983
|
-
ableToApplyRules: !1,
|
|
984
|
-
ableToConfigureAlternative: !1
|
|
985
|
-
}) },
|
|
986
|
-
enableIngredientGroup: { type: Boolean }
|
|
987
|
-
},
|
|
988
|
-
emits: ["update:modelValue", "click:pick-inventory-bindings"],
|
|
989
|
-
setup(m, { emit: r }) {
|
|
990
|
-
const { t: u } = W(), t = Y(), i = A(() => t.recipeById), a = A(() => t.skuById), f = A(() => t.skuGroupById), l = m, n = r, o = A(() => ct({
|
|
991
|
-
parentId: l.id,
|
|
992
|
-
bindings: l.modelValue,
|
|
993
|
-
recipes: t.recipes.map((S) => S._id === l.id ? {
|
|
994
|
-
...S,
|
|
995
|
-
contains: l.modelValue
|
|
996
|
-
} : S),
|
|
997
|
-
skus: t.skus.map((S) => S._id === l.id ? {
|
|
998
|
-
...S,
|
|
999
|
-
convert: {
|
|
1000
|
-
inventoryBindings: l.modelValue
|
|
1001
|
-
}
|
|
1002
|
-
} : S),
|
|
1003
|
-
skuGroups: t.skuGroups
|
|
1004
|
-
}).inventoryBindings.filter((S) => "error" in S && S.error).map((S) => S).filter((S) => S.reason === mt.enum.circularDependency)), e = A(
|
|
1005
|
-
() => new Set(o.value.map((y) => {
|
|
1006
|
-
var x;
|
|
1007
|
-
return (x = y.bindingPaths[0]) == null ? void 0 : x.id;
|
|
1008
|
-
}))
|
|
1009
|
-
), d = A(() => l.modelValue.filter((y) => y.type === "RECIPE")), { promptIngredientsBinding: w, promptRecipesBinding: E, promptIngredientGroupsBinding: k } = jt();
|
|
1010
|
-
async function b() {
|
|
1011
|
-
if (l.iframeMode) {
|
|
1012
|
-
n("click:pick-inventory-bindings", "RECIPE");
|
|
1013
|
-
return;
|
|
1014
|
-
}
|
|
1015
|
-
E(
|
|
1016
|
-
l.modelValue,
|
|
1017
|
-
(y) => n("update:modelValue", y),
|
|
1018
|
-
l.id ? [l.id] : []
|
|
1019
|
-
);
|
|
1020
|
-
}
|
|
1021
|
-
const h = A(() => l.modelValue.filter((y) => y.type === "SKU_GROUP"));
|
|
1022
|
-
async function V() {
|
|
1023
|
-
k(
|
|
1024
|
-
l.modelValue,
|
|
1025
|
-
(y) => n("update:modelValue", y),
|
|
1026
|
-
l.id ? [l.id] : []
|
|
1027
|
-
);
|
|
1028
|
-
}
|
|
1029
|
-
function T(y, x, S) {
|
|
1030
|
-
const N = +x;
|
|
1031
|
-
let J = S;
|
|
1032
|
-
x.length > 0 && isFinite(N) ? J = S.map((O) => (O.id !== y || (O.amount = Qe(N)), O)) : J = S.map((O) => (O.id !== y || (O.amount = { amount: 0, precision: 0 }), O)), n("update:modelValue", J);
|
|
1033
|
-
}
|
|
1034
|
-
const _ = A(() => l.modelValue.filter((y) => y.type === "SKU") ?? []);
|
|
1035
|
-
async function g() {
|
|
1036
|
-
if (l.iframeMode) {
|
|
1037
|
-
n("click:pick-inventory-bindings", "SKU");
|
|
1038
|
-
return;
|
|
1039
|
-
}
|
|
1040
|
-
w(
|
|
1041
|
-
l.modelValue,
|
|
1042
|
-
(y) => n("update:modelValue", y),
|
|
1043
|
-
l.excludeBindingId,
|
|
1044
|
-
l.id ? [l.id] : []
|
|
1045
|
-
);
|
|
1046
|
-
}
|
|
1047
|
-
function c(y) {
|
|
1048
|
-
const x = l.modelValue.map((S) => S.id === y.id ? y : S);
|
|
1049
|
-
n("update:modelValue", x);
|
|
1050
|
-
}
|
|
1051
|
-
function I(y) {
|
|
1052
|
-
const x = l.modelValue.filter((S) => S.id !== y);
|
|
1053
|
-
n("update:modelValue", x);
|
|
1054
|
-
}
|
|
1055
|
-
function U(y) {
|
|
1056
|
-
var S, N;
|
|
1057
|
-
if (y.type !== de.enum.SKU)
|
|
1058
|
-
throw new Error("Non-SKU binding does not have unit");
|
|
1059
|
-
if (!((S = a.value[y.id]) == null ? void 0 : S.unit))
|
|
1060
|
-
throw new Error(`Cannot find ingredient: ${y.id}`);
|
|
1061
|
-
return (N = a.value[y.id]) == null ? void 0 : N.unit;
|
|
1062
|
-
}
|
|
1063
|
-
return (y, x) => {
|
|
1064
|
-
var oe, te, se;
|
|
1065
|
-
const S = D("FmFormGroup"), N = D("FmButton"), J = D("FmIcon"), O = D("FmTextField");
|
|
1066
|
-
return v(), C("div", _n, [
|
|
1067
|
-
B(S, {
|
|
1068
|
-
disabled: y.disabled,
|
|
1069
|
-
"model-value": y.modelValue,
|
|
1070
|
-
rules: [
|
|
1071
|
-
...y.rules,
|
|
1072
|
-
() => o.value.length ? "There is a binding error in your configuration" : !0
|
|
1073
|
-
]
|
|
1074
|
-
}, {
|
|
1075
|
-
label: j(() => x[4] || (x[4] = [
|
|
1076
|
-
p("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Define the inventory bindings for this recipe or ingredient. ", -1)
|
|
1077
|
-
])),
|
|
1078
|
-
_: 1
|
|
1079
|
-
}, 8, ["disabled", "model-value", "rules"]),
|
|
1080
|
-
((oe = y.recipeBindingConfig) == null ? void 0 : oe.enabled) !== !1 ? (v(), C("div", hn, [
|
|
1081
|
-
p("div", kn, [
|
|
1082
|
-
p("div", xn, R(s(u)("inventory.inventoryBindings.recipe")), 1),
|
|
1083
|
-
y.readonly ? F("", !0) : (v(), M(N, {
|
|
1084
|
-
key: 0,
|
|
1085
|
-
variant: "secondary",
|
|
1086
|
-
"text-color": "primary",
|
|
1087
|
-
"border-color": "primary",
|
|
1088
|
-
label: s(u)("inventory.inventoryBindings.linkRecipe"),
|
|
1089
|
-
"prepend-icon": "link",
|
|
1090
|
-
onClick: b
|
|
1091
|
-
}, null, 8, ["label"]))
|
|
1092
|
-
]),
|
|
1093
|
-
p("div", Sn, [
|
|
1094
|
-
p("div", wn, [
|
|
1095
|
-
p("div", En, R(s(u)("inventory.inventoryBindings.recipe")), 1),
|
|
1096
|
-
x[5] || (x[5] = p("div", { class: "w-[200px]" }, null, -1)),
|
|
1097
|
-
y.recipeBindingConfig.ableToApplyRules ? (v(), C("div", In)) : F("", !0),
|
|
1098
|
-
y.readonly ? F("", !0) : (v(), C("div", Bn))
|
|
1099
|
-
]),
|
|
1100
|
-
(v(!0), C(ae, null, me(d.value, (z) => {
|
|
1101
|
-
var X;
|
|
1102
|
-
return v(), M(Be, {
|
|
1103
|
-
key: z.id,
|
|
1104
|
-
"model-value": z,
|
|
1105
|
-
"display-name": (X = i.value[z.id]) == null ? void 0 : X.name,
|
|
1106
|
-
"show-error": e.value.has(z.id),
|
|
1107
|
-
readonly: y.readonly,
|
|
1108
|
-
disabled: y.disabled,
|
|
1109
|
-
"onUpdate:modelValue": x[0] || (x[0] = (Z) => c(Z)),
|
|
1110
|
-
onDelete: x[1] || (x[1] = (Z) => I(Z))
|
|
1111
|
-
}, null, 8, ["model-value", "display-name", "show-error", "readonly", "disabled"]);
|
|
1112
|
-
}), 128))
|
|
1113
|
-
])
|
|
1114
|
-
])) : F("", !0),
|
|
1115
|
-
y.enableIngredientGroup ? (v(), C("div", Cn, [
|
|
1116
|
-
p("div", $n, [
|
|
1117
|
-
p("div", Vn, R(s(u)("inventory.inventoryBindings.ingredientGroup")), 1),
|
|
1118
|
-
y.readonly ? F("", !0) : (v(), M(N, {
|
|
1119
|
-
key: 0,
|
|
1120
|
-
variant: "secondary",
|
|
1121
|
-
"text-color": "primary",
|
|
1122
|
-
"border-color": "primary",
|
|
1123
|
-
label: s(u)("inventory.inventoryBindings.linkIngredientGroup"),
|
|
1124
|
-
"prepend-icon": "link",
|
|
1125
|
-
onClick: V
|
|
1126
|
-
}, null, 8, ["label"]))
|
|
1127
|
-
]),
|
|
1128
|
-
p("div", An, [
|
|
1129
|
-
p("div", Fn, [
|
|
1130
|
-
p("div", Rn, R(s(u)("inventory.inventoryBindings.ingredientGroup")), 1),
|
|
1131
|
-
x[6] || (x[6] = p("div", { class: "w-[200px]" }, null, -1)),
|
|
1132
|
-
x[7] || (x[7] = p("div", { class: "w-[52px]" }, null, -1))
|
|
1133
|
-
]),
|
|
1134
|
-
(v(!0), C(ae, null, me(h.value, (z) => (v(), M(S, {
|
|
1135
|
-
key: z.id,
|
|
1136
|
-
disabled: y.disabled,
|
|
1137
|
-
modelValue: +s(Q)(z.amount ?? { amount: 1, precision: 0 }),
|
|
1138
|
-
rules: [s(We)(0), s(Re)(0)]
|
|
1139
|
-
}, {
|
|
1140
|
-
default: j(({ invalid: X }) => {
|
|
1141
|
-
var Z;
|
|
1142
|
-
return [
|
|
1143
|
-
p("div", Tn, [
|
|
1144
|
-
e.value.has(z.id) ? (v(), C("div", Un, [
|
|
1145
|
-
B(J, {
|
|
1146
|
-
name: "error",
|
|
1147
|
-
color: "system-error-300",
|
|
1148
|
-
size: "sm"
|
|
1149
|
-
}),
|
|
1150
|
-
p("div", null, R(s(u)("inventory.inventoryBindings.circularError")), 1)
|
|
1151
|
-
])) : F("", !0),
|
|
1152
|
-
p("div", Dn, [
|
|
1153
|
-
p("div", Pn, [
|
|
1154
|
-
p("div", Nn, R((Z = f.value[z.id]) == null ? void 0 : Z.name), 1)
|
|
1155
|
-
]),
|
|
1156
|
-
p("div", On, [
|
|
1157
|
-
B(O, {
|
|
1158
|
-
class: "w-full",
|
|
1159
|
-
disabled: y.disabled,
|
|
1160
|
-
modelValue: +s(Q)(z.amount ?? { amount: 1, precision: 0 }),
|
|
1161
|
-
"onUpdate:modelValue": (re) => T(z.id, re, y.modelValue),
|
|
1162
|
-
invalid: X
|
|
1163
|
-
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"])
|
|
1164
|
-
]),
|
|
1165
|
-
y.readonly ? F("", !0) : (v(), C("div", Mn, [
|
|
1166
|
-
B(N, {
|
|
1167
|
-
disabled: y.disabled,
|
|
1168
|
-
type: "button",
|
|
1169
|
-
variant: "plain",
|
|
1170
|
-
icon: "delete",
|
|
1171
|
-
"icon-color": "#000000",
|
|
1172
|
-
onClick: (re) => I(z.id)
|
|
1173
|
-
}, null, 8, ["disabled", "onClick"])
|
|
1174
|
-
]))
|
|
1175
|
-
])
|
|
1176
|
-
])
|
|
1177
|
-
];
|
|
1178
|
-
}),
|
|
1179
|
-
_: 2
|
|
1180
|
-
}, 1032, ["disabled", "modelValue", "rules"]))), 128))
|
|
1181
|
-
])
|
|
1182
|
-
])) : F("", !0),
|
|
1183
|
-
p("div", Gn, [
|
|
1184
|
-
p("div", zn, [
|
|
1185
|
-
p("div", Jn, R(s(u)("inventory.inventoryBindings.ingredient")), 1),
|
|
1186
|
-
y.readonly ? F("", !0) : (v(), M(N, {
|
|
1187
|
-
key: 0,
|
|
1188
|
-
variant: "secondary",
|
|
1189
|
-
"text-color": "primary",
|
|
1190
|
-
"border-color": "primary",
|
|
1191
|
-
label: s(u)("inventory.inventoryBindings.linkIngredient"),
|
|
1192
|
-
"prepend-icon": "link",
|
|
1193
|
-
onClick: g
|
|
1194
|
-
}, null, 8, ["label"]))
|
|
1195
|
-
]),
|
|
1196
|
-
p("div", Kn, [
|
|
1197
|
-
p("div", Ln, [
|
|
1198
|
-
p("div", jn, R(s(u)("inventory.inventoryBindings.ingredient")), 1),
|
|
1199
|
-
p("div", qn, R(s(u)("inventory.inventoryBindings.amount")), 1),
|
|
1200
|
-
x[8] || (x[8] = p("div", { class: "w-[52px]" }, null, -1)),
|
|
1201
|
-
(te = y.skuBindingConfig) != null && te.ableToApplyRules || (se = y.skuBindingConfig) != null && se.ableToConfigureAlternative ? (v(), C("div", Yn)) : F("", !0)
|
|
1202
|
-
]),
|
|
1203
|
-
(v(!0), C(ae, null, me(_.value, (z) => {
|
|
1204
|
-
var X, Z, re;
|
|
1205
|
-
return v(), M(Ce, {
|
|
1206
|
-
key: z.id,
|
|
1207
|
-
"model-value": z,
|
|
1208
|
-
"display-name": (X = a.value[z.id]) == null ? void 0 : X.name,
|
|
1209
|
-
unit: U(z),
|
|
1210
|
-
"show-error": e.value.has(z.id),
|
|
1211
|
-
"able-to-apply-rules": ((Z = y.skuBindingConfig) == null ? void 0 : Z.ableToApplyRules) === !0,
|
|
1212
|
-
"able-to-configure-alternative": ((re = y.skuBindingConfig) == null ? void 0 : re.ableToConfigureAlternative) === !0,
|
|
1213
|
-
readonly: y.readonly,
|
|
1214
|
-
disabled: y.disabled,
|
|
1215
|
-
"onUpdate:modelValue": x[2] || (x[2] = ($) => c($)),
|
|
1216
|
-
onDelete: x[3] || (x[3] = ($) => I($))
|
|
1217
|
-
}, null, 8, ["model-value", "display-name", "unit", "show-error", "able-to-apply-rules", "able-to-configure-alternative", "readonly", "disabled"]);
|
|
1218
|
-
}), 128))
|
|
1219
|
-
])
|
|
1220
|
-
])
|
|
1221
|
-
]);
|
|
1222
|
-
};
|
|
1223
|
-
}
|
|
1224
|
-
}), Qn = { class: "flex flex-col gap-40" }, Wn = {
|
|
1225
|
-
key: 0,
|
|
1226
|
-
class: "flex flex-col gap-16"
|
|
1227
|
-
}, Xn = {
|
|
1228
|
-
key: 0,
|
|
1229
|
-
class: "col-span-2 mt-16 border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
|
|
1230
|
-
}, Zn = {
|
|
1231
|
-
key: 0,
|
|
1232
|
-
class: "flex flex-col items-center w-full h-full gap-24"
|
|
1233
|
-
}, eo = { key: 1 }, to = { class: "mt-32" }, nt = /* @__PURE__ */ ee({
|
|
1234
|
-
__name: "RecipeForm",
|
|
1235
|
-
props: {
|
|
1236
|
-
mode: {},
|
|
1237
|
-
modelValue: {},
|
|
1238
|
-
disabled: { type: Boolean }
|
|
1239
|
-
},
|
|
1240
|
-
emits: ["update:modelValue", "click:submit"],
|
|
1241
|
-
setup(m, { expose: r, emit: u }) {
|
|
1242
|
-
const t = m, i = u, a = Tt(), { t: f } = W(), l = A({
|
|
1243
|
-
get() {
|
|
1244
|
-
var c;
|
|
1245
|
-
return ((c = t.modelValue) == null ? void 0 : c.name) ?? "";
|
|
1246
|
-
},
|
|
1247
|
-
set(c) {
|
|
1248
|
-
const I = t.modelValue ?? {};
|
|
1249
|
-
I.name = c, i("update:modelValue", I);
|
|
1250
|
-
}
|
|
1251
|
-
}), n = A({
|
|
1252
|
-
get() {
|
|
1253
|
-
var c;
|
|
1254
|
-
return ((c = t.modelValue) == null ? void 0 : c.contains) ?? [];
|
|
1255
|
-
},
|
|
1256
|
-
set(c) {
|
|
1257
|
-
const I = t.modelValue ?? {};
|
|
1258
|
-
I.contains = c, i("update:modelValue", I);
|
|
1259
|
-
}
|
|
1260
|
-
}), o = A({
|
|
1261
|
-
get() {
|
|
1262
|
-
var c;
|
|
1263
|
-
return ((c = t.modelValue) == null ? void 0 : c.customAttributes) ?? {};
|
|
1264
|
-
},
|
|
1265
|
-
set(c) {
|
|
1266
|
-
const I = t.modelValue ? {
|
|
1267
|
-
...t.modelValue
|
|
1268
|
-
} : {};
|
|
1269
|
-
I.customAttributes = c, i("update:modelValue", I);
|
|
1270
|
-
}
|
|
1271
|
-
}), e = A({
|
|
1272
|
-
get() {
|
|
1273
|
-
var c;
|
|
1274
|
-
return ((c = t.modelValue) == null ? void 0 : c.version) ?? null;
|
|
1275
|
-
},
|
|
1276
|
-
set(c) {
|
|
1277
|
-
const I = t.modelValue ? { ...t.modelValue } : {};
|
|
1278
|
-
I.version = c, i("update:modelValue", I);
|
|
1279
|
-
}
|
|
1280
|
-
}), d = A({
|
|
1281
|
-
get() {
|
|
1282
|
-
return e.value === "v2";
|
|
1283
|
-
},
|
|
1284
|
-
set(c) {
|
|
1285
|
-
e.value = c ? "v2" : null;
|
|
1286
|
-
}
|
|
1287
|
-
});
|
|
1288
|
-
function w() {
|
|
1289
|
-
i("click:submit");
|
|
1290
|
-
}
|
|
1291
|
-
const E = G();
|
|
1292
|
-
r({
|
|
1293
|
-
validateInputs: () => {
|
|
1294
|
-
var c, I;
|
|
1295
|
-
(I = (c = E.value) == null ? void 0 : c.validateInputs) == null || I.call(c);
|
|
1296
|
-
},
|
|
1297
|
-
resetInputsValidation: () => {
|
|
1298
|
-
var c, I;
|
|
1299
|
-
(I = (c = E.value) == null ? void 0 : c.resetInputsValidation) == null || I.call(c);
|
|
1300
|
-
},
|
|
1301
|
-
resetInputs: () => {
|
|
1302
|
-
var c, I;
|
|
1303
|
-
(I = (c = E.value) == null ? void 0 : c.resetInputs) == null || I.call(c);
|
|
1304
|
-
}
|
|
1305
|
-
});
|
|
1306
|
-
const k = Y(), b = G([]), h = G(!1), V = G(!1);
|
|
1307
|
-
pe(h, async (c) => {
|
|
1308
|
-
T(c);
|
|
1309
|
-
});
|
|
1310
|
-
async function T(c) {
|
|
1311
|
-
var I, U;
|
|
1312
|
-
c && !V.value && ((I = t.modelValue) != null && I._id) && (V.value = !0, b.value = await k.getAffectedMenu((U = t.modelValue) == null ? void 0 : U._id).delayed(500), V.value = !1);
|
|
1313
|
-
}
|
|
1314
|
-
const _ = A(
|
|
1315
|
-
() => k.recipes.map((c) => ({ label: c.name, value: c.name }))
|
|
1316
|
-
), g = A(() => {
|
|
1317
|
-
var c;
|
|
1318
|
-
return ((c = t.modelValue) == null ? void 0 : c.name) ?? "";
|
|
1319
|
-
});
|
|
1320
|
-
return (c, I) => {
|
|
1321
|
-
const U = D("FmTextField"), y = D("FmSwitch"), x = D("FmCard"), S = D("FmSpacer"), N = D("FmCircularProgress"), J = D("FmForm");
|
|
1322
|
-
return v(), M(J, {
|
|
1323
|
-
ref_key: "formRef",
|
|
1324
|
-
ref: E,
|
|
1325
|
-
onValidationSuccess: w
|
|
1326
|
-
}, {
|
|
1327
|
-
default: j(() => [
|
|
1328
|
-
p("div", Qn, [
|
|
1329
|
-
B(U, {
|
|
1330
|
-
disabled: c.disabled,
|
|
1331
|
-
label: s(f)("inventory.recipe.name"),
|
|
1332
|
-
"model-value": l.value,
|
|
1333
|
-
"onUpdate:modelValue": I[0] || (I[0] = (O) => l.value = O),
|
|
1334
|
-
rules: [
|
|
1335
|
-
s(St)(),
|
|
1336
|
-
s(Xe)(_.value, g.value, (O) => `[${O.value}] already exists`)
|
|
1337
|
-
],
|
|
1338
|
-
"label-mark": "required"
|
|
1339
|
-
}, null, 8, ["disabled", "label", "model-value", "rules"]),
|
|
1340
|
-
s(a).enableRecipeV2 ? (v(), C("div", Wn, [
|
|
1341
|
-
B(y, {
|
|
1342
|
-
modelValue: d.value,
|
|
1343
|
-
"onUpdate:modelValue": I[1] || (I[1] = (O) => d.value = O),
|
|
1344
|
-
value: !0,
|
|
1345
|
-
label: s(f)("inventory.recipe.enableRecipeV2"),
|
|
1346
|
-
"label-placement": "right",
|
|
1347
|
-
disabled: c.disabled,
|
|
1348
|
-
sublabel: s(f)("inventory.recipe.recipeV2Warning")
|
|
1349
|
-
}, null, 8, ["modelValue", "label", "disabled", "sublabel"])
|
|
1350
|
-
])) : F("", !0),
|
|
1351
|
-
B(x, {
|
|
1352
|
-
variant: "outlined",
|
|
1353
|
-
class: "p-16"
|
|
1354
|
-
}, {
|
|
1355
|
-
default: j(() => {
|
|
1356
|
-
var O, oe;
|
|
1357
|
-
return [
|
|
1358
|
-
s(a).enableRecipeV2 ? (v(), M(Hn, {
|
|
1359
|
-
key: 0,
|
|
1360
|
-
id: (O = c.modelValue) == null ? void 0 : O._id,
|
|
1361
|
-
disabled: c.disabled,
|
|
1362
|
-
"model-value": n.value,
|
|
1363
|
-
"onUpdate:modelValue": I[2] || (I[2] = (te) => n.value = te),
|
|
1364
|
-
rules: [s(Ee)(1)],
|
|
1365
|
-
"enable-ingredient-group": s(a).enableIngredientGroup,
|
|
1366
|
-
"recipe-binding-config": { enabled: !d.value, ableToApplyRules: d.value },
|
|
1367
|
-
"sku-binding-config": {
|
|
1368
|
-
ableToConfigureAlternative: d.value
|
|
1369
|
-
}
|
|
1370
|
-
}, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group", "recipe-binding-config", "sku-binding-config"])) : (v(), M(wt, {
|
|
1371
|
-
key: 1,
|
|
1372
|
-
id: (oe = c.modelValue) == null ? void 0 : oe._id,
|
|
1373
|
-
disabled: c.disabled,
|
|
1374
|
-
"model-value": n.value,
|
|
1375
|
-
"onUpdate:modelValue": I[3] || (I[3] = (te) => n.value = te),
|
|
1376
|
-
rules: [s(Ee)(1)],
|
|
1377
|
-
"enable-ingredient-group": s(a).enableIngredientGroup
|
|
1378
|
-
}, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group"]))
|
|
1379
|
-
];
|
|
1380
|
-
}),
|
|
1381
|
-
_: 1
|
|
1382
|
-
})
|
|
1383
|
-
]),
|
|
1384
|
-
c.mode !== s(q).CREATE ? (v(), C("div", Xn, [
|
|
1385
|
-
B(y, {
|
|
1386
|
-
label: "Show binded items",
|
|
1387
|
-
modelValue: h.value,
|
|
1388
|
-
"onUpdate:modelValue": I[4] || (I[4] = (O) => h.value = O),
|
|
1389
|
-
"label-placement": "right",
|
|
1390
|
-
disabled: V.value
|
|
1391
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
1392
|
-
V.value ? (v(), C("div", Zn, [
|
|
1393
|
-
B(S),
|
|
1394
|
-
p("div", null, [
|
|
1395
|
-
B(N, { size: "xl" })
|
|
1396
|
-
]),
|
|
1397
|
-
I[6] || (I[6] = p("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
1398
|
-
B(S)
|
|
1399
|
-
])) : h.value && b.value.length ? (v(), C("div", eo, [
|
|
1400
|
-
B(Ye, {
|
|
1401
|
-
name: "Menu",
|
|
1402
|
-
bindings: b.value
|
|
1403
|
-
}, null, 8, ["bindings"])
|
|
1404
|
-
])) : F("", !0)
|
|
1405
|
-
])) : F("", !0),
|
|
1406
|
-
p("div", to, [
|
|
1407
|
-
B(Rt, {
|
|
1408
|
-
entity: "inventoryRecipe",
|
|
1409
|
-
modelValue: o.value,
|
|
1410
|
-
"onUpdate:modelValue": I[5] || (I[5] = (O) => o.value = O)
|
|
1411
|
-
}, null, 8, ["modelValue"])
|
|
1412
|
-
])
|
|
1413
|
-
]),
|
|
1414
|
-
_: 1
|
|
1415
|
-
}, 512);
|
|
1416
|
-
};
|
|
1417
|
-
}
|
|
1418
|
-
}), no = { class: "flex gap-4" }, oo = /* @__PURE__ */ ee({
|
|
1419
|
-
__name: "RecipeDialog",
|
|
1420
|
-
props: {
|
|
1421
|
-
show: { type: Boolean },
|
|
1422
|
-
recipe: {},
|
|
1423
|
-
mode: { default: q.READ }
|
|
1424
|
-
},
|
|
1425
|
-
emits: ["update:show"],
|
|
1426
|
-
setup(m) {
|
|
1427
|
-
const r = m, u = Y(), t = Fe(), { t: i } = W(), a = we(r, "show"), f = we(r, "recipe"), l = A(() => {
|
|
1428
|
-
switch (r.mode) {
|
|
1429
|
-
case q.READ:
|
|
1430
|
-
return "";
|
|
1431
|
-
case q.UPDATE:
|
|
1432
|
-
return i("inventory.recipe.update.title");
|
|
1433
|
-
case q.CREATE:
|
|
1434
|
-
return i("inventory.recipe.create.title");
|
|
1435
|
-
}
|
|
1436
|
-
return "";
|
|
1437
|
-
}), n = A(() => {
|
|
1438
|
-
switch (r.mode) {
|
|
1439
|
-
case q.READ:
|
|
1440
|
-
return "";
|
|
1441
|
-
case q.UPDATE:
|
|
1442
|
-
return i("common.save");
|
|
1443
|
-
case q.CREATE:
|
|
1444
|
-
return i("common.add");
|
|
1445
|
-
}
|
|
1446
|
-
return "";
|
|
1447
|
-
}), o = G(), e = G(!1);
|
|
1448
|
-
async function d() {
|
|
1449
|
-
e.value = !0;
|
|
1450
|
-
try {
|
|
1451
|
-
const b = Ve(f.value);
|
|
1452
|
-
b.precision ?? (b.precision = 0), b.measurements ?? (b.measurements = []), await u.createRecipe(b), a.value = !1, t.open({
|
|
1453
|
-
title: i("inventory.common.success"),
|
|
1454
|
-
message: i("inventory.recipe.create.success", { name: f.value.name }),
|
|
1455
|
-
type: "success"
|
|
1456
|
-
});
|
|
1457
|
-
} catch (b) {
|
|
1458
|
-
b instanceof ze || t.open({
|
|
1459
|
-
title: i("inventory.recipe.create.error.title"),
|
|
1460
|
-
message: i("inventory.recipe.create.error.message"),
|
|
1461
|
-
type: "error"
|
|
1462
|
-
});
|
|
1463
|
-
} finally {
|
|
1464
|
-
e.value = !1;
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
async function w() {
|
|
1468
|
-
e.value = !0;
|
|
1469
|
-
try {
|
|
1470
|
-
await u.updateRecipe(f.value), a.value = !1, t.open({
|
|
1471
|
-
title: i("inventory.common.success"),
|
|
1472
|
-
message: i("inventory.recipe.update.success", { name: f.value.name }),
|
|
1473
|
-
type: "success"
|
|
1474
|
-
});
|
|
1475
|
-
} catch (b) {
|
|
1476
|
-
b instanceof ze || t.open({
|
|
1477
|
-
title: i("inventory.recipe.update.error.title"),
|
|
1478
|
-
message: i("inventory.recipe.update.error.message"),
|
|
1479
|
-
type: "error"
|
|
1480
|
-
});
|
|
1481
|
-
} finally {
|
|
1482
|
-
e.value = !1;
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
function E() {
|
|
1486
|
-
var b, h;
|
|
1487
|
-
(h = (b = o.value) == null ? void 0 : b.validateInputs) == null || h.call(b);
|
|
1488
|
-
}
|
|
1489
|
-
function k() {
|
|
1490
|
-
switch (r.mode) {
|
|
1491
|
-
case q.READ:
|
|
1492
|
-
return;
|
|
1493
|
-
case q.UPDATE:
|
|
1494
|
-
return w();
|
|
1495
|
-
case q.CREATE:
|
|
1496
|
-
return d();
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
return (b, h) => {
|
|
1500
|
-
const V = D("FmButton"), T = D("FmSideSheet");
|
|
1501
|
-
return v(), M(T, {
|
|
1502
|
-
"model-value": s(a),
|
|
1503
|
-
"onUpdate:modelValue": h[3] || (h[3] = (_) => Ge(a) ? a.value = _ : null),
|
|
1504
|
-
header: l.value,
|
|
1505
|
-
"close-button": "",
|
|
1506
|
-
"dismiss-away": "",
|
|
1507
|
-
"max-width": 800
|
|
1508
|
-
}, {
|
|
1509
|
-
"side-sheet-footer": j(() => [
|
|
1510
|
-
p("div", no, [
|
|
1511
|
-
B(V, {
|
|
1512
|
-
loading: e.value,
|
|
1513
|
-
label: n.value,
|
|
1514
|
-
onClick: E
|
|
1515
|
-
}, null, 8, ["loading", "label"]),
|
|
1516
|
-
B(V, {
|
|
1517
|
-
disabled: e.value,
|
|
1518
|
-
label: s(i)("common.close"),
|
|
1519
|
-
variant: "tertiary",
|
|
1520
|
-
onClick: h[2] || (h[2] = (_) => a.value = !1)
|
|
1521
|
-
}, null, 8, ["disabled", "label"])
|
|
1522
|
-
])
|
|
1523
|
-
]),
|
|
1524
|
-
default: j(() => [
|
|
1525
|
-
B(nt, {
|
|
1526
|
-
class: "w-full",
|
|
1527
|
-
ref_key: "hasValidationExpose",
|
|
1528
|
-
ref: o,
|
|
1529
|
-
modelValue: s(f),
|
|
1530
|
-
"onUpdate:modelValue": h[0] || (h[0] = (_) => Ge(f) ? f.value = _ : null),
|
|
1531
|
-
mode: b.mode,
|
|
1532
|
-
disabled: e.value,
|
|
1533
|
-
"onClick:submit": h[1] || (h[1] = (_) => k())
|
|
1534
|
-
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
1535
|
-
]),
|
|
1536
|
-
_: 1
|
|
1537
|
-
}, 8, ["model-value", "header"]);
|
|
1538
|
-
};
|
|
1539
|
-
}
|
|
1540
|
-
});
|
|
1541
|
-
function Ue(m, r) {
|
|
1542
|
-
return Te.equal(m, r);
|
|
1543
|
-
}
|
|
1544
|
-
function fe(m) {
|
|
1545
|
-
if (m == null) return null;
|
|
1546
|
-
const r = m.$and, u = m.$or;
|
|
1547
|
-
return Array.isArray(r) && r.length === 0 || Array.isArray(u) && u.length === 0 || Object.keys(m).length === 0 ? null : JSON.stringify(m);
|
|
1548
|
-
}
|
|
1549
|
-
function ye(m) {
|
|
1550
|
-
return m.measurement ? Te.multiplyDecimal(m.amount, m.measurement.conversion) : m.amount;
|
|
1551
|
-
}
|
|
1552
|
-
function _e(m, r) {
|
|
1553
|
-
var f, l;
|
|
1554
|
-
if (m.type !== r.type || m.id !== r.id || !Ue(ye(m), ye(r))) return !1;
|
|
1555
|
-
const u = ((f = m.measurement) == null ? void 0 : f.id) ?? null, t = ((l = r.measurement) == null ? void 0 : l.id) ?? null;
|
|
1556
|
-
if (u !== t || fe(m.rules) !== fe(r.rules)) return !1;
|
|
1557
|
-
const i = (m.alternatives ?? []).map((n) => n._id).sort(), a = (r.alternatives ?? []).map((n) => n._id).sort();
|
|
1558
|
-
return JSON.stringify(i) === JSON.stringify(a);
|
|
1559
|
-
}
|
|
1560
|
-
function je(m, r) {
|
|
1561
|
-
return m.type === r.type && m.id === r.id;
|
|
1562
|
-
}
|
|
1563
|
-
function De(m, r, u) {
|
|
1564
|
-
const t = [];
|
|
1565
|
-
for (const i of m)
|
|
1566
|
-
if (i.type === de.enum.SKU)
|
|
1567
|
-
t.push({ ...i, recipeIds: [...r] });
|
|
1568
|
-
else if (i.type === de.enum.SKU_GROUP)
|
|
1569
|
-
t.push({ ...i, isGroup: !0, recipeIds: [...r] });
|
|
1570
|
-
else if (i.type === de.enum.RECIPE) {
|
|
1571
|
-
const a = u[i.id];
|
|
1572
|
-
a && !r.has(i.id) && t.push(
|
|
1573
|
-
...De(a.contains, /* @__PURE__ */ new Set([...r, i.id]), u)
|
|
1574
|
-
);
|
|
1575
|
-
}
|
|
1576
|
-
return t;
|
|
1577
|
-
}
|
|
1578
|
-
function io(m, r) {
|
|
1579
|
-
const u = [];
|
|
1580
|
-
let t = [...m.contains];
|
|
1581
|
-
for (const a of r)
|
|
1582
|
-
switch (a.type) {
|
|
1583
|
-
case "remove-binding": {
|
|
1584
|
-
const f = t.findIndex(
|
|
1585
|
-
(l) => l.type === a.target.type && l.id === a.target.id
|
|
1586
|
-
);
|
|
1587
|
-
f === -1 ? u.push({ change: a, outcome: "ignored", reason: "Source binding not found in target" }) : (t = [...t.slice(0, f), ...t.slice(f + 1)], u.push({ change: a, outcome: "applied" }));
|
|
1588
|
-
break;
|
|
1589
|
-
}
|
|
1590
|
-
case "add-binding": {
|
|
1591
|
-
if (t.find((n) => _e(n, a.binding))) {
|
|
1592
|
-
u.push({ change: a, outcome: "already-satisfied", reason: "Exact binding already present" });
|
|
1593
|
-
break;
|
|
1594
|
-
}
|
|
1595
|
-
if (t.find((n) => je(n, a.binding))) {
|
|
1596
|
-
u.push({ change: a, outcome: "blocked", reason: "A similar but non-exact binding already exists" });
|
|
1597
|
-
break;
|
|
1598
|
-
}
|
|
1599
|
-
if (m.version === "v2" && a.binding.type === "RECIPE") {
|
|
1600
|
-
u.push({ change: a, outcome: "blocked", reason: "Cannot add RECIPE binding to a V2 recipe" });
|
|
1601
|
-
break;
|
|
1602
|
-
}
|
|
1603
|
-
t = [...t, a.binding], u.push({ change: a, outcome: "applied" });
|
|
1604
|
-
break;
|
|
1605
|
-
}
|
|
1606
|
-
case "replace-binding": {
|
|
1607
|
-
const f = t.findIndex(
|
|
1608
|
-
(o) => o.type === a.from.type && o.id === a.from.id
|
|
1609
|
-
), l = t.find((o) => _e(o, a.to)), n = t.find((o, e) => e !== f && je(o, a.to) && !_e(o, a.to));
|
|
1610
|
-
if (f === -1) {
|
|
1611
|
-
l ? u.push({ change: a, outcome: "already-satisfied", reason: "Target already has exact replacement" }) : u.push({ change: a, outcome: "ignored", reason: "Source binding not found in target" });
|
|
1612
|
-
break;
|
|
1613
|
-
}
|
|
1614
|
-
if (m.version === "v2" && a.to.type === "RECIPE") {
|
|
1615
|
-
u.push({ change: a, outcome: "blocked", reason: "Cannot add RECIPE binding to a V2 recipe" });
|
|
1616
|
-
break;
|
|
1617
|
-
}
|
|
1618
|
-
if (n) {
|
|
1619
|
-
u.push({ change: a, outcome: "blocked", reason: "A similar but non-exact replacement binding already exists" });
|
|
1620
|
-
break;
|
|
1621
|
-
}
|
|
1622
|
-
l ? (t = [...t.slice(0, f), ...t.slice(f + 1)], u.push({ change: a, outcome: "applied", reason: "Source removed; replacement already present" })) : (t = [
|
|
1623
|
-
...t.slice(0, f),
|
|
1624
|
-
a.to,
|
|
1625
|
-
...t.slice(f + 1)
|
|
1626
|
-
], u.push({ change: a, outcome: "applied" }));
|
|
1627
|
-
break;
|
|
1628
|
-
}
|
|
1629
|
-
case "update-binding-rule": {
|
|
1630
|
-
const f = t.findIndex(
|
|
1631
|
-
(e) => e.type === a.target.type && e.id === a.target.id
|
|
1632
|
-
);
|
|
1633
|
-
if (f === -1) {
|
|
1634
|
-
u.push({ change: a, outcome: "ignored", reason: "Binding not found in target" });
|
|
1635
|
-
break;
|
|
1636
|
-
}
|
|
1637
|
-
const l = t[f], n = l.rules ?? null, o = a.rule ?? null;
|
|
1638
|
-
if (fe(n) === fe(o)) {
|
|
1639
|
-
u.push({ change: a, outcome: "already-satisfied", reason: "Rule already matches" });
|
|
1640
|
-
break;
|
|
1641
|
-
}
|
|
1642
|
-
t = [
|
|
1643
|
-
...t.slice(0, f),
|
|
1644
|
-
{ ...l, rules: o },
|
|
1645
|
-
...t.slice(f + 1)
|
|
1646
|
-
], u.push({ change: a, outcome: "applied" });
|
|
1647
|
-
break;
|
|
1648
|
-
}
|
|
1649
|
-
case "update-alternatives": {
|
|
1650
|
-
const f = t.findIndex(
|
|
1651
|
-
(e) => e.type === a.target.type && e.id === a.target.id
|
|
1652
|
-
);
|
|
1653
|
-
if (f === -1) {
|
|
1654
|
-
u.push({ change: a, outcome: "ignored", reason: "Binding not found in target" });
|
|
1655
|
-
break;
|
|
1656
|
-
}
|
|
1657
|
-
const l = t[f], n = (l.alternatives ?? []).map((e) => e._id).sort(), o = (a.alternatives ?? []).map((e) => e._id).sort();
|
|
1658
|
-
if (JSON.stringify(n) === JSON.stringify(o)) {
|
|
1659
|
-
u.push({ change: a, outcome: "already-satisfied", reason: "Alternatives already match" });
|
|
1660
|
-
break;
|
|
1661
|
-
}
|
|
1662
|
-
t = [
|
|
1663
|
-
...t.slice(0, f),
|
|
1664
|
-
{ ...l, alternatives: a.alternatives },
|
|
1665
|
-
...t.slice(f + 1)
|
|
1666
|
-
], u.push({ change: a, outcome: "applied" });
|
|
1667
|
-
break;
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
return { projected: { ...m, contains: t }, results: u };
|
|
1671
|
-
}
|
|
1672
|
-
function lo(m) {
|
|
1673
|
-
if (m.length === 0) return "no-applicable-changes";
|
|
1674
|
-
let r = 0, u = 0, t = 0, i = 0;
|
|
1675
|
-
for (const a of m)
|
|
1676
|
-
a.outcome === "applied" ? r++ : a.outcome === "blocked" ? u++ : a.outcome === "ignored" ? t++ : a.outcome === "already-satisfied" && i++;
|
|
1677
|
-
return u > 0 && r === 0 ? "blocked" : i === m.length ? "already-satisfied" : r > 0 && (t > 0 || u > 0) ? "partially-ignored" : r > 0 ? "will-update" : "no-applicable-changes";
|
|
1678
|
-
}
|
|
1679
|
-
function $e(m, r) {
|
|
1680
|
-
var a, f, l, n;
|
|
1681
|
-
const u = [], t = /* @__PURE__ */ new Map();
|
|
1682
|
-
for (const o of m.contains) {
|
|
1683
|
-
const e = `${o.type}:${o.id}`;
|
|
1684
|
-
t.has(e) || t.set(e, o);
|
|
1685
|
-
}
|
|
1686
|
-
const i = /* @__PURE__ */ new Map();
|
|
1687
|
-
for (const o of r.contains) {
|
|
1688
|
-
const e = `${o.type}:${o.id}`;
|
|
1689
|
-
i.has(e) || i.set(e, o);
|
|
1690
|
-
}
|
|
1691
|
-
for (const [o, e] of t)
|
|
1692
|
-
i.has(o) || u.push({
|
|
1693
|
-
type: "remove-binding",
|
|
1694
|
-
target: {
|
|
1695
|
-
type: e.type,
|
|
1696
|
-
id: e.id,
|
|
1697
|
-
amount: e.amount,
|
|
1698
|
-
measurementId: ((a = e.measurement) == null ? void 0 : a.id) ?? null,
|
|
1699
|
-
rules: e.rules ?? null,
|
|
1700
|
-
alternatives: e.alternatives ?? []
|
|
1701
|
-
}
|
|
1702
|
-
});
|
|
1703
|
-
for (const [o, e] of i)
|
|
1704
|
-
t.has(o) || u.push({ type: "add-binding", binding: e });
|
|
1705
|
-
for (const [o, e] of t) {
|
|
1706
|
-
const d = i.get(o);
|
|
1707
|
-
if (!d || _e(e, d)) continue;
|
|
1708
|
-
const w = fe(e.rules) !== fe(d.rules), E = JSON.stringify((e.alternatives ?? []).map((b) => b._id).sort()) !== JSON.stringify((d.alternatives ?? []).map((b) => b._id).sort());
|
|
1709
|
-
!Ue(ye(e), ye(d)) || (((f = e.measurement) == null ? void 0 : f.id) ?? null) !== (((l = d.measurement) == null ? void 0 : l.id) ?? null) ? u.push({
|
|
1710
|
-
type: "replace-binding",
|
|
1711
|
-
from: {
|
|
1712
|
-
type: e.type,
|
|
1713
|
-
id: e.id,
|
|
1714
|
-
amount: e.amount,
|
|
1715
|
-
measurementId: ((n = e.measurement) == null ? void 0 : n.id) ?? null,
|
|
1716
|
-
rules: e.rules ?? null
|
|
1717
|
-
},
|
|
1718
|
-
to: d
|
|
1719
|
-
}) : w ? u.push({
|
|
1720
|
-
type: "update-binding-rule",
|
|
1721
|
-
target: { type: e.type, id: e.id },
|
|
1722
|
-
rule: d.rules ?? null
|
|
1723
|
-
}) : E && u.push({
|
|
1724
|
-
type: "update-alternatives",
|
|
1725
|
-
target: { type: e.type, id: e.id },
|
|
1726
|
-
alternatives: d.alternatives ?? []
|
|
1727
|
-
});
|
|
1728
|
-
}
|
|
1729
|
-
return u;
|
|
1730
|
-
}
|
|
1731
|
-
function Se(m, r, u) {
|
|
1732
|
-
const t = $e(r, u), i = t.map((o) => ({
|
|
1733
|
-
change: o,
|
|
1734
|
-
outcome: "applied"
|
|
1735
|
-
}));
|
|
1736
|
-
let a = 0, f = 0, l = 0, n = 0;
|
|
1737
|
-
for (const o of i)
|
|
1738
|
-
o.outcome === "applied" ? a++ : o.outcome === "ignored" ? f++ : o.outcome === "blocked" ? l++ : o.outcome === "already-satisfied" && n++;
|
|
1739
|
-
return {
|
|
1740
|
-
recipeId: m,
|
|
1741
|
-
recipeName: r.name,
|
|
1742
|
-
original: r,
|
|
1743
|
-
projected: u,
|
|
1744
|
-
status: t.length > 0 ? "will-update" : "no-applicable-changes",
|
|
1745
|
-
changes: i,
|
|
1746
|
-
counts: { applied: a, ignored: f, blocked: l, satisfied: n }
|
|
1747
|
-
};
|
|
1748
|
-
}
|
|
1749
|
-
const ke = He("recipeBulkEditor", function() {
|
|
1750
|
-
const r = Y(), u = Fe(), { t } = W(), i = G(!1), a = G(1), f = G(null), l = G(/* @__PURE__ */ new Set()), n = G(null), o = G(null), e = G({}), d = G({}), w = G(!1), E = G(/* @__PURE__ */ new Map()), k = A(() => {
|
|
1751
|
-
if (!n.value) return null;
|
|
1752
|
-
const $ = r.recipeById[n.value];
|
|
1753
|
-
return $ ? JSON.parse(JSON.stringify($)) : null;
|
|
1754
|
-
}), b = A(() => {
|
|
1755
|
-
var K;
|
|
1756
|
-
if (!((K = f.value) != null && K.skuId)) return r.recipes;
|
|
1757
|
-
const { skuId: $, amount: P, measurementId: L } = f.value;
|
|
1758
|
-
return r.recipes.filter((ie) => De(ie.contains, /* @__PURE__ */ new Set([ie._id]), r.recipeById).some((le) => {
|
|
1759
|
-
var ue;
|
|
1760
|
-
return !(le.type !== "SKU" || le.id !== $ || le.recipeIds.length === 1 && (P != null && !Ue(ye(le), P) || L != null && (((ue = le.measurement) == null ? void 0 : ue.id) ?? null) !== L));
|
|
1761
|
-
}));
|
|
1762
|
-
}), h = A(() => !k.value || !o.value ? [] : $e(k.value, o.value)), V = A(() => {
|
|
1763
|
-
if (!k.value || !o.value) return !1;
|
|
1764
|
-
const $ = k.value, P = o.value;
|
|
1765
|
-
return $.name !== P.name || ($.version ?? null) !== (P.version ?? null) || JSON.stringify($.customAttributes ?? null) !== JSON.stringify(P.customAttributes ?? null) ? !0 : h.value.length > 0;
|
|
1766
|
-
}), T = A(() => !k.value || !o.value ? !1 : (k.value.version ?? null) !== (o.value.version ?? null));
|
|
1767
|
-
function _() {
|
|
1768
|
-
l.value = /* @__PURE__ */ new Set(), n.value = null, o.value = null, e.value = {}, d.value = {};
|
|
1769
|
-
}
|
|
1770
|
-
function g() {
|
|
1771
|
-
I(), i.value = !0;
|
|
1772
|
-
}
|
|
1773
|
-
function c() {
|
|
1774
|
-
i.value = !1;
|
|
1775
|
-
}
|
|
1776
|
-
function I() {
|
|
1777
|
-
a.value = 1, f.value = null, _(), w.value = !1, E.value = /* @__PURE__ */ new Map();
|
|
1778
|
-
}
|
|
1779
|
-
function U($) {
|
|
1780
|
-
f.value = $, _();
|
|
1781
|
-
}
|
|
1782
|
-
function y($) {
|
|
1783
|
-
f.value = $;
|
|
1784
|
-
}
|
|
1785
|
-
function x() {
|
|
1786
|
-
f.value = null, _();
|
|
1787
|
-
}
|
|
1788
|
-
function S() {
|
|
1789
|
-
const $ = b.value;
|
|
1790
|
-
l.value = /* @__PURE__ */ new Set();
|
|
1791
|
-
const P = $[0] ?? null;
|
|
1792
|
-
P ? N(P._id) : (n.value = null, o.value = null);
|
|
1793
|
-
}
|
|
1794
|
-
function N($) {
|
|
1795
|
-
var K;
|
|
1796
|
-
const P = r.recipeById[$];
|
|
1797
|
-
if (!P) return;
|
|
1798
|
-
n.value && o.value && (e.value = { ...e.value, [n.value]: o.value }), n.value = $;
|
|
1799
|
-
const L = JSON.parse(JSON.stringify(P));
|
|
1800
|
-
o.value = e.value[$] ? JSON.parse(JSON.stringify(e.value[$])) : (K = d.value[$]) != null && K.projected ? JSON.parse(JSON.stringify(d.value[$].projected)) : JSON.parse(JSON.stringify(L));
|
|
1801
|
-
}
|
|
1802
|
-
function J($) {
|
|
1803
|
-
const P = JSON.parse(JSON.stringify($));
|
|
1804
|
-
o.value = P, n.value && (e.value = { ...e.value, [n.value]: P });
|
|
1805
|
-
}
|
|
1806
|
-
function O() {
|
|
1807
|
-
if (!n.value) return;
|
|
1808
|
-
const $ = r.recipeById[n.value];
|
|
1809
|
-
if (!$) return;
|
|
1810
|
-
const P = JSON.parse(JSON.stringify($));
|
|
1811
|
-
o.value = JSON.parse(JSON.stringify(P));
|
|
1812
|
-
const { [n.value]: L, ...K } = e.value;
|
|
1813
|
-
e.value = K, d.value = {};
|
|
1814
|
-
}
|
|
1815
|
-
function oe($) {
|
|
1816
|
-
const P = new Set(l.value);
|
|
1817
|
-
P.has($) ? P.delete($) : P.add($), l.value = P;
|
|
1818
|
-
}
|
|
1819
|
-
function te($) {
|
|
1820
|
-
return l.value.has($);
|
|
1821
|
-
}
|
|
1822
|
-
function se() {
|
|
1823
|
-
if (!o.value || !n.value) return;
|
|
1824
|
-
const $ = r.recipeById[n.value];
|
|
1825
|
-
if (!$) return;
|
|
1826
|
-
const P = d.value[n.value], L = P ? P.original : JSON.parse(JSON.stringify($));
|
|
1827
|
-
d.value = {
|
|
1828
|
-
...d.value,
|
|
1829
|
-
[n.value]: Se(n.value, L, o.value)
|
|
1830
|
-
};
|
|
1831
|
-
}
|
|
1832
|
-
function z() {
|
|
1833
|
-
const $ = { ...d.value };
|
|
1834
|
-
for (const P of l.value) {
|
|
1835
|
-
if (P === n.value) continue;
|
|
1836
|
-
const L = e.value[P];
|
|
1837
|
-
if (!L) continue;
|
|
1838
|
-
const K = r.recipeById[P];
|
|
1839
|
-
if (!K) continue;
|
|
1840
|
-
const ie = $[P], H = ie ? ie.original : JSON.parse(JSON.stringify(K));
|
|
1841
|
-
$[P] = Se(P, H, L);
|
|
1842
|
-
}
|
|
1843
|
-
d.value = $;
|
|
1844
|
-
}
|
|
1845
|
-
function X() {
|
|
1846
|
-
if (!k.value || !o.value) return;
|
|
1847
|
-
const $ = $e(k.value, o.value), P = {};
|
|
1848
|
-
for (const K of l.value) {
|
|
1849
|
-
const ie = r.recipeById[K];
|
|
1850
|
-
if (!ie) continue;
|
|
1851
|
-
const H = JSON.parse(JSON.stringify(ie));
|
|
1852
|
-
if (K === n.value) {
|
|
1853
|
-
P[K] = Se(K, H, o.value);
|
|
1854
|
-
continue;
|
|
1855
|
-
}
|
|
1856
|
-
const { projected: le, results: ve } = io(H, $), ue = lo(ve);
|
|
1857
|
-
let Pe = 0, Ne = 0, Oe = 0, Me = 0;
|
|
1858
|
-
for (const be of ve)
|
|
1859
|
-
be.outcome === "applied" ? Pe++ : be.outcome === "ignored" ? Ne++ : be.outcome === "blocked" ? Oe++ : be.outcome === "already-satisfied" && Me++;
|
|
1860
|
-
P[K] = {
|
|
1861
|
-
recipeId: K,
|
|
1862
|
-
recipeName: H.name,
|
|
1863
|
-
original: H,
|
|
1864
|
-
projected: ue === "will-update" || ue === "partially-ignored" ? le : null,
|
|
1865
|
-
status: ue,
|
|
1866
|
-
changes: ve,
|
|
1867
|
-
counts: { applied: Pe, ignored: Ne, blocked: Oe, satisfied: Me }
|
|
1868
|
-
};
|
|
1869
|
-
}
|
|
1870
|
-
d.value = P;
|
|
1871
|
-
const L = { ...e.value };
|
|
1872
|
-
for (const K of l.value)
|
|
1873
|
-
K !== n.value && delete L[K];
|
|
1874
|
-
e.value = L;
|
|
1875
|
-
}
|
|
1876
|
-
function Z() {
|
|
1877
|
-
return Object.values(d.value).filter(
|
|
1878
|
-
($) => ($.status === "will-update" || $.status === "partially-ignored") && $.projected != null
|
|
1879
|
-
).map(($) => $.projected);
|
|
1880
|
-
}
|
|
1881
|
-
async function re() {
|
|
1882
|
-
if (!w.value) {
|
|
1883
|
-
w.value = !0, E.value = /* @__PURE__ */ new Map();
|
|
1884
|
-
try {
|
|
1885
|
-
const $ = Z(), P = await r.importRecipes({
|
|
1886
|
-
create: [],
|
|
1887
|
-
update: $
|
|
1888
|
-
}), L = (P == null ? void 0 : P.errors) ?? [];
|
|
1889
|
-
if (L.length > 0) {
|
|
1890
|
-
const K = /* @__PURE__ */ new Map();
|
|
1891
|
-
for (const { data: ie, error: H } of L) {
|
|
1892
|
-
const le = typeof H == "string" ? H : (H == null ? void 0 : H.message) ?? t("inventory.recipe.bulkEditor.step3.unknownError");
|
|
1893
|
-
K.set(ie._id, le);
|
|
1894
|
-
}
|
|
1895
|
-
E.value = K, u.open({
|
|
1896
|
-
title: t("inventory.recipe.bulkEditor.step3.partialErrorTitle"),
|
|
1897
|
-
message: t("inventory.recipe.bulkEditor.step3.partialErrorMessage", {
|
|
1898
|
-
count: L.length
|
|
1899
|
-
}),
|
|
1900
|
-
type: "warning"
|
|
1901
|
-
});
|
|
1902
|
-
} else
|
|
1903
|
-
u.open({
|
|
1904
|
-
title: t("inventory.recipe.bulkEditor.step3.successTitle"),
|
|
1905
|
-
message: t("inventory.recipe.bulkEditor.step3.successMessage", {
|
|
1906
|
-
count: $.length
|
|
1907
|
-
}),
|
|
1908
|
-
type: "success"
|
|
1909
|
-
}), i.value = !1, I();
|
|
1910
|
-
} catch ($) {
|
|
1911
|
-
u.open({
|
|
1912
|
-
title: t("inventory.recipe.bulkEditor.step3.errorTitle"),
|
|
1913
|
-
message: t("inventory.recipe.bulkEditor.step3.errorMessage"),
|
|
1914
|
-
type: "error"
|
|
1915
|
-
}), console.error("confirmAndApply failed", $);
|
|
1916
|
-
} finally {
|
|
1917
|
-
w.value = !1;
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1921
|
-
return {
|
|
1922
|
-
// state
|
|
1923
|
-
show: i,
|
|
1924
|
-
currentStep: a,
|
|
1925
|
-
query: f,
|
|
1926
|
-
selectedRecipeIds: l,
|
|
1927
|
-
activeRecipeId: n,
|
|
1928
|
-
activeOriginal: k,
|
|
1929
|
-
activeDraft: o,
|
|
1930
|
-
entries: d,
|
|
1931
|
-
isSaving: w,
|
|
1932
|
-
applyErrors: E,
|
|
1933
|
-
// computed
|
|
1934
|
-
matchedRecipes: b,
|
|
1935
|
-
hasDraftChanges: V,
|
|
1936
|
-
hasVersionChange: T,
|
|
1937
|
-
pendingChanges: h,
|
|
1938
|
-
// actions
|
|
1939
|
-
openDialog: g,
|
|
1940
|
-
closeDialog: c,
|
|
1941
|
-
reset: I,
|
|
1942
|
-
setQuery: U,
|
|
1943
|
-
updateFilter: y,
|
|
1944
|
-
clearQuery: x,
|
|
1945
|
-
initSelectionFromQuery: S,
|
|
1946
|
-
setActiveRecipe: N,
|
|
1947
|
-
updateDraft: J,
|
|
1948
|
-
revertActive: O,
|
|
1949
|
-
toggleSelection: oe,
|
|
1950
|
-
isSelected: te,
|
|
1951
|
-
applyDraftToActive: se,
|
|
1952
|
-
flushAllDraftCache: z,
|
|
1953
|
-
applyToAll: X,
|
|
1954
|
-
buildPayload: Z,
|
|
1955
|
-
confirmAndApply: re
|
|
1956
|
-
};
|
|
1957
|
-
}), ao = { class: "flex flex-col h-full" }, so = { class: "px-16 py-12 border-b border-fm-color-border-default bg-fm-color-surface-default flex flex-col gap-12" }, ro = {
|
|
1958
|
-
key: 0,
|
|
1959
|
-
class: "flex flex-col gap-4"
|
|
1960
|
-
}, uo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, co = { class: "text-fm-color-typo-placeholder ml-4" }, mo = {
|
|
1961
|
-
key: 0,
|
|
1962
|
-
class: "flex items-center gap-12 px-16 py-10 border-b border-fm-color-border-default bg-fm-color-surface-secondary shrink-0"
|
|
1963
|
-
}, po = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, fo = { class: "flex-1 overflow-y-auto" }, yo = {
|
|
1964
|
-
key: 0,
|
|
1965
|
-
class: "flex flex-col items-center justify-center h-full gap-8 px-24 text-center"
|
|
1966
|
-
}, vo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, bo = {
|
|
1967
|
-
key: 1,
|
|
1968
|
-
class: "divide-y divide-fm-color-border-default"
|
|
1969
|
-
}, go = ["onClick"], _o = { class: "flex-1 min-w-0" }, ho = {
|
|
1970
|
-
key: 0,
|
|
1971
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary truncate mt-1"
|
|
1972
|
-
}, ko = { class: "flex items-center gap-4 mt-2 flex-wrap" }, xo = {
|
|
1973
|
-
key: 1,
|
|
1974
|
-
class: "px-16 py-10 border-t border-fm-color-border-default bg-fm-color-surface-secondary shrink-0"
|
|
1975
|
-
}, So = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, wo = /* @__PURE__ */ ee({
|
|
1976
|
-
__name: "RecipeBulkEditorQueryStep",
|
|
1977
|
-
setup(m) {
|
|
1978
|
-
const { t: r } = W(), u = Y(), t = ke(), i = G(""), a = G(null), f = A(
|
|
1979
|
-
() => u.skus.map((_) => ({
|
|
1980
|
-
label: _.name,
|
|
1981
|
-
sublabel: _.code,
|
|
1982
|
-
value: _._id
|
|
1983
|
-
}))
|
|
1984
|
-
), l = A(
|
|
1985
|
-
() => a.value ? u.skuById[a.value] ?? null : null
|
|
1986
|
-
), n = G(Ke()), o = A(() => {
|
|
1987
|
-
const _ = n.value.amount;
|
|
1988
|
-
return _ != null && _.amount > 0;
|
|
1989
|
-
});
|
|
1990
|
-
pe(a, () => {
|
|
1991
|
-
n.value = Ke();
|
|
1992
|
-
}), pe(
|
|
1993
|
-
[a, n],
|
|
1994
|
-
() => {
|
|
1995
|
-
if (!a.value) {
|
|
1996
|
-
t.updateFilter({ skuId: "" });
|
|
1997
|
-
return;
|
|
1998
|
-
}
|
|
1999
|
-
if (!o.value)
|
|
2000
|
-
t.updateFilter({ skuId: a.value });
|
|
2001
|
-
else {
|
|
2002
|
-
const { amount: _, measurement: g } = n.value, c = g ? Te.multiplyDecimal(_, g.conversion) : _;
|
|
2003
|
-
t.updateFilter({
|
|
2004
|
-
skuId: a.value,
|
|
2005
|
-
amount: c,
|
|
2006
|
-
measurementId: (g == null ? void 0 : g.id) ?? null
|
|
2007
|
-
});
|
|
2008
|
-
}
|
|
2009
|
-
},
|
|
2010
|
-
{ deep: !0 }
|
|
2011
|
-
);
|
|
2012
|
-
const e = A(() => {
|
|
2013
|
-
const _ = i.value.trim().toLowerCase();
|
|
2014
|
-
return _ ? t.matchedRecipes.filter(
|
|
2015
|
-
(g) => g.name.toLowerCase().includes(_)
|
|
2016
|
-
) : t.matchedRecipes;
|
|
2017
|
-
}), d = A(
|
|
2018
|
-
() => e.value.length > 0 && e.value.every((_) => t.isSelected(_._id))
|
|
2019
|
-
), w = A(
|
|
2020
|
-
() => e.value.some((_) => t.isSelected(_._id)) && !d.value
|
|
2021
|
-
);
|
|
2022
|
-
function E(_) {
|
|
2023
|
-
const g = new Set(t.selectedRecipeIds);
|
|
2024
|
-
for (const c of e.value)
|
|
2025
|
-
_ ? g.add(c._id) : g.delete(c._id);
|
|
2026
|
-
t.selectedRecipeIds = g;
|
|
2027
|
-
}
|
|
2028
|
-
function k(_) {
|
|
2029
|
-
switch (_) {
|
|
2030
|
-
case "will-update":
|
|
2031
|
-
return r("inventory.recipe.bulkEditor.status.willUpdate");
|
|
2032
|
-
case "already-satisfied":
|
|
2033
|
-
return r("inventory.recipe.bulkEditor.status.alreadySatisfied");
|
|
2034
|
-
case "partially-ignored":
|
|
2035
|
-
return r("inventory.recipe.bulkEditor.status.partiallyIgnored");
|
|
2036
|
-
case "blocked":
|
|
2037
|
-
return r("inventory.recipe.bulkEditor.status.blocked");
|
|
2038
|
-
case "no-applicable-changes":
|
|
2039
|
-
return r("inventory.recipe.bulkEditor.status.noApplicableChanges");
|
|
2040
|
-
default:
|
|
2041
|
-
return "";
|
|
2042
|
-
}
|
|
2043
|
-
}
|
|
2044
|
-
function b(_) {
|
|
2045
|
-
switch (_) {
|
|
2046
|
-
case "will-update":
|
|
2047
|
-
return "success";
|
|
2048
|
-
case "already-satisfied":
|
|
2049
|
-
return "info";
|
|
2050
|
-
case "partially-ignored":
|
|
2051
|
-
return "warning";
|
|
2052
|
-
case "blocked":
|
|
2053
|
-
return "critical";
|
|
2054
|
-
case "no-applicable-changes":
|
|
2055
|
-
return "neutral";
|
|
2056
|
-
default:
|
|
2057
|
-
return "neutral";
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
function h(_) {
|
|
2061
|
-
return t.entries[_] ?? null;
|
|
2062
|
-
}
|
|
2063
|
-
function V(_) {
|
|
2064
|
-
var U, y, x, S;
|
|
2065
|
-
if (_.isGroup) {
|
|
2066
|
-
const N = u.skuGroupById[_.id];
|
|
2067
|
-
if (!N) return null;
|
|
2068
|
-
const J = `x${Q(_.amount)}`;
|
|
2069
|
-
return _.recipeIds.slice(1).length ? `(${((U = u.recipeById[_.recipeIds.at(-1) ?? ""]) == null ? void 0 : U.name) ?? ""}) ${N.name} (${J})` : `${N.name} (${J})`;
|
|
2070
|
-
}
|
|
2071
|
-
const g = u.skuById[_.id];
|
|
2072
|
-
if (!g) return null;
|
|
2073
|
-
const c = ((y = _.measurement) == null ? void 0 : y.abbrev) ?? ((x = g.unit) == null ? void 0 : x.abbrev) ?? "", I = `${Q(_.amount)}${c}`;
|
|
2074
|
-
return _.recipeIds.slice(1).length ? `(${((S = u.recipeById[_.recipeIds.at(-1) ?? ""]) == null ? void 0 : S.name) ?? ""}) ${g.name} (${I})` : `${g.name} (${I})`;
|
|
2075
|
-
}
|
|
2076
|
-
function T(_) {
|
|
2077
|
-
return De(_.contains, /* @__PURE__ */ new Set([_._id]), u.recipeById).map(V).filter((g) => g !== null).join(", ");
|
|
2078
|
-
}
|
|
2079
|
-
return (_, g) => {
|
|
2080
|
-
const c = D("FmSearch"), I = D("FmSelect"), U = D("FmCheckbox"), y = D("FmIcon"), x = D("FmChip");
|
|
2081
|
-
return v(), C("div", ao, [
|
|
2082
|
-
p("div", so, [
|
|
2083
|
-
B(c, {
|
|
2084
|
-
modelValue: i.value,
|
|
2085
|
-
"onUpdate:modelValue": g[0] || (g[0] = (S) => i.value = S),
|
|
2086
|
-
placeholder: s(r)("inventory.recipe.bulkEditor.query.nameSearchPlaceholder")
|
|
2087
|
-
}, null, 8, ["modelValue", "placeholder"]),
|
|
2088
|
-
B(I, {
|
|
2089
|
-
modelValue: a.value,
|
|
2090
|
-
"onUpdate:modelValue": [
|
|
2091
|
-
g[1] || (g[1] = (S) => a.value = S),
|
|
2092
|
-
g[2] || (g[2] = (S) => {
|
|
2093
|
-
S || (a.value = null);
|
|
2094
|
-
})
|
|
2095
|
-
],
|
|
2096
|
-
items: f.value,
|
|
2097
|
-
label: s(r)("inventory.recipe.bulkEditor.query.ingredientFilterLabel"),
|
|
2098
|
-
placeholder: s(r)("inventory.recipe.bulkEditor.query.ingredientPlaceholder"),
|
|
2099
|
-
clearable: ""
|
|
2100
|
-
}, {
|
|
2101
|
-
"menu-wrapper": j((S) => [
|
|
2102
|
-
B(Ut, it(S, {
|
|
2103
|
-
items: f.value,
|
|
2104
|
-
"model-value": a.value
|
|
2105
|
-
}), null, 16, ["items", "model-value"])
|
|
2106
|
-
]),
|
|
2107
|
-
_: 1
|
|
2108
|
-
}, 8, ["modelValue", "items", "label", "placeholder"]),
|
|
2109
|
-
l.value ? (v(), C("div", ro, [
|
|
2110
|
-
p("span", uo, [
|
|
2111
|
-
qe(R(s(r)("inventory.recipe.bulkEditor.query.amountLabel")) + " ", 1),
|
|
2112
|
-
p("span", co, R(s(r)("inventory.recipe.bulkEditor.query.amountOptional")), 1)
|
|
2113
|
-
]),
|
|
2114
|
-
B(et, {
|
|
2115
|
-
modelValue: n.value,
|
|
2116
|
-
"onUpdate:modelValue": g[3] || (g[3] = (S) => n.value = S),
|
|
2117
|
-
unit: l.value.unit,
|
|
2118
|
-
placeholder: s(r)("inventory.recipe.bulkEditor.query.amountPlaceholder"),
|
|
2119
|
-
"convert-amount-on-change-unit": ""
|
|
2120
|
-
}, null, 8, ["modelValue", "unit", "placeholder"])
|
|
2121
|
-
])) : F("", !0)
|
|
2122
|
-
]),
|
|
2123
|
-
e.value.length > 0 ? (v(), C("div", mo, [
|
|
2124
|
-
B(U, {
|
|
2125
|
-
"model-value": d.value,
|
|
2126
|
-
value: !0,
|
|
2127
|
-
indeterminate: w.value,
|
|
2128
|
-
"onUpdate:modelValue": E
|
|
2129
|
-
}, null, 8, ["model-value", "indeterminate"]),
|
|
2130
|
-
p("span", po, R(s(r)("inventory.recipe.bulkEditor.query.selectAll", {
|
|
2131
|
-
count: e.value.length
|
|
2132
|
-
})), 1)
|
|
2133
|
-
])) : F("", !0),
|
|
2134
|
-
p("div", fo, [
|
|
2135
|
-
e.value.length === 0 ? (v(), C("div", yo, [
|
|
2136
|
-
B(y, {
|
|
2137
|
-
name: "search_off",
|
|
2138
|
-
size: "lg",
|
|
2139
|
-
class: "text-fm-color-typo-placeholder"
|
|
2140
|
-
}),
|
|
2141
|
-
p("p", vo, R(s(r)("inventory.recipe.bulkEditor.query.noResults")), 1)
|
|
2142
|
-
])) : (v(), C("div", bo, [
|
|
2143
|
-
(v(!0), C(ae, null, me(e.value, (S) => (v(), C("div", {
|
|
2144
|
-
key: S._id,
|
|
2145
|
-
class: he([
|
|
2146
|
-
"flex items-center gap-12 px-16 py-12 cursor-pointer transition-colors select-none",
|
|
2147
|
-
s(t).activeRecipeId === S._id ? "bg-fm-color-primary/20" : s(t).isSelected(S._id) ? "bg-fm-color-surface-secondary hover:bg-fm-color-surface-hover" : "hover:bg-fm-color-surface-hover"
|
|
2148
|
-
]),
|
|
2149
|
-
onClick: (N) => s(t).setActiveRecipe(S._id)
|
|
2150
|
-
}, [
|
|
2151
|
-
B(U, {
|
|
2152
|
-
"model-value": s(t).isSelected(S._id),
|
|
2153
|
-
value: S._id,
|
|
2154
|
-
"onUpdate:modelValue": () => s(t).toggleSelection(S._id),
|
|
2155
|
-
onClick: g[4] || (g[4] = lt(() => {
|
|
2156
|
-
}, ["stop"]))
|
|
2157
|
-
}, null, 8, ["model-value", "value", "onUpdate:modelValue"]),
|
|
2158
|
-
p("div", _o, [
|
|
2159
|
-
p("div", {
|
|
2160
|
-
class: he([
|
|
2161
|
-
"fm-typo-en-body-md-600 truncate",
|
|
2162
|
-
s(t).activeRecipeId === S._id ? "text-fm-color-primary" : "text-fm-color-typo-primary"
|
|
2163
|
-
])
|
|
2164
|
-
}, R(S.name), 3),
|
|
2165
|
-
S.contains.length > 0 ? (v(), C("div", ho, R(T(S)), 1)) : F("", !0),
|
|
2166
|
-
p("div", ko, [
|
|
2167
|
-
S.version === "v2" ? (v(), M(x, {
|
|
2168
|
-
key: 0,
|
|
2169
|
-
size: "sm",
|
|
2170
|
-
label: "V2",
|
|
2171
|
-
variant: "info"
|
|
2172
|
-
})) : F("", !0),
|
|
2173
|
-
h(S._id) ? (v(), M(x, {
|
|
2174
|
-
key: 1,
|
|
2175
|
-
size: "sm",
|
|
2176
|
-
label: k(h(S._id).status),
|
|
2177
|
-
variant: b(h(S._id).status)
|
|
2178
|
-
}, null, 8, ["label", "variant"])) : F("", !0)
|
|
2179
|
-
])
|
|
2180
|
-
]),
|
|
2181
|
-
s(t).activeRecipeId === S._id ? (v(), M(y, {
|
|
2182
|
-
key: 0,
|
|
2183
|
-
name: "chevron_right",
|
|
2184
|
-
size: "md",
|
|
2185
|
-
class: "text-fm-color-primary shrink-0"
|
|
2186
|
-
})) : F("", !0)
|
|
2187
|
-
], 10, go))), 128))
|
|
2188
|
-
]))
|
|
2189
|
-
]),
|
|
2190
|
-
e.value.length > 0 ? (v(), C("div", xo, [
|
|
2191
|
-
p("p", So, R(s(r)("inventory.recipe.bulkEditor.query.selectionCount", {
|
|
2192
|
-
selected: s(t).selectedRecipeIds.size,
|
|
2193
|
-
total: e.value.length
|
|
2194
|
-
})), 1)
|
|
2195
|
-
])) : F("", !0)
|
|
2196
|
-
]);
|
|
2197
|
-
};
|
|
2198
|
-
}
|
|
2199
|
-
}), Eo = { class: "flex flex-col gap-16" }, Io = { class: "rounded-lg border border-fm-color-border-default bg-fm-color-surface-secondary p-16" }, Bo = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary mb-8" }, Co = { class: "flex flex-wrap gap-12" }, $o = { class: "flex items-center gap-6" }, Vo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ao = {
|
|
2200
|
-
key: 0,
|
|
2201
|
-
class: "flex items-center gap-6"
|
|
2202
|
-
}, Fo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ro = {
|
|
2203
|
-
key: 1,
|
|
2204
|
-
class: "flex items-center gap-6"
|
|
2205
|
-
}, To = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Uo = {
|
|
2206
|
-
key: 2,
|
|
2207
|
-
class: "flex items-center gap-6"
|
|
2208
|
-
}, Do = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Po = {
|
|
2209
|
-
key: 3,
|
|
2210
|
-
class: "flex items-center gap-6"
|
|
2211
|
-
}, No = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Oo = { class: "flex items-center gap-8 px-12 py-10 bg-fm-color-surface-secondary border-b border-fm-color-border-default" }, Mo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary flex-1 truncate" }, Go = {
|
|
2212
|
-
key: 0,
|
|
2213
|
-
class: "px-12 py-8 border-b border-fm-color-border-default"
|
|
2214
|
-
}, zo = {
|
|
2215
|
-
key: 1,
|
|
2216
|
-
class: "px-12 py-10"
|
|
2217
|
-
}, Jo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-placeholder" }, Ko = {
|
|
2218
|
-
key: 2,
|
|
2219
|
-
class: "flex flex-col divide-y divide-fm-color-border-default"
|
|
2220
|
-
}, Lo = { class: "flex items-center gap-8 px-12 py-6 bg-fm-color-surface-default" }, jo = { class: "fm-typo-en-body-xs-400 text-fm-color-typo-secondary flex-1" }, qo = {
|
|
2221
|
-
key: 0,
|
|
2222
|
-
class: "px-12 pb-4"
|
|
2223
|
-
}, Yo = { class: "fm-typo-en-body-xs-400 text-fm-color-typo-placeholder italic" }, Ho = {
|
|
2224
|
-
key: 1,
|
|
2225
|
-
class: "relative border-l-4 border-fm-color-error bg-red-50"
|
|
2226
|
-
}, Qo = {
|
|
2227
|
-
key: 2,
|
|
2228
|
-
class: "px-12 py-8 flex items-center gap-8"
|
|
2229
|
-
}, Wo = { class: "fm-typo-en-body-sm-400 font-mono text-fm-color-error" }, Xo = {
|
|
2230
|
-
key: 2,
|
|
2231
|
-
class: "relative border-l-4 border-fm-color-success bg-green-50"
|
|
2232
|
-
}, Zo = {
|
|
2233
|
-
key: 2,
|
|
2234
|
-
class: "px-12 py-8 flex items-center gap-8"
|
|
2235
|
-
}, ei = { class: "fm-typo-en-body-sm-400 font-mono text-fm-color-success" }, ti = { class: "flex items-center gap-12 px-12 py-8 border-t border-fm-color-border-default bg-fm-color-surface-secondary text-fm-color-typo-secondary fm-typo-en-body-xs-400" }, ni = { key: 0 }, oi = { key: 1 }, ii = {
|
|
2236
|
-
key: 2,
|
|
2237
|
-
class: "text-fm-color-warning"
|
|
2238
|
-
}, li = {
|
|
2239
|
-
key: 3,
|
|
2240
|
-
class: "text-fm-color-error"
|
|
2241
|
-
}, ai = /* @__PURE__ */ ee({
|
|
2242
|
-
__name: "RecipeBulkEditorSummaryStep",
|
|
2243
|
-
setup(m) {
|
|
2244
|
-
const { t: r } = W(), u = Y(), t = ke(), i = A(() => Object.values(t.entries)), a = A(
|
|
2245
|
-
() => i.value.filter((g) => g.status === "will-update").length
|
|
2246
|
-
), f = A(
|
|
2247
|
-
() => i.value.filter((g) => g.status === "partially-ignored").length
|
|
2248
|
-
), l = A(
|
|
2249
|
-
() => i.value.filter((g) => g.status === "already-satisfied").length
|
|
2250
|
-
), n = A(
|
|
2251
|
-
() => i.value.filter((g) => g.status === "blocked").length
|
|
2252
|
-
), o = A(
|
|
2253
|
-
() => i.value.filter((g) => g.status === "no-applicable-changes").length
|
|
2254
|
-
);
|
|
2255
|
-
function e(g) {
|
|
2256
|
-
var c;
|
|
2257
|
-
return ((c = u.skuById[g]) == null ? void 0 : c.name) ?? g;
|
|
2258
|
-
}
|
|
2259
|
-
function d(g) {
|
|
2260
|
-
var c;
|
|
2261
|
-
return ((c = u.recipeById[g]) == null ? void 0 : c.name) ?? g;
|
|
2262
|
-
}
|
|
2263
|
-
function w(g) {
|
|
2264
|
-
var c;
|
|
2265
|
-
return ((c = u.skuGroupById[g]) == null ? void 0 : c.name) ?? g;
|
|
2266
|
-
}
|
|
2267
|
-
function E(g) {
|
|
2268
|
-
return g.type === "SKU" ? e(g.id) : g.type === "SKU_GROUP" ? w(g.id) : d(g.id);
|
|
2269
|
-
}
|
|
2270
|
-
function k(g) {
|
|
2271
|
-
var c;
|
|
2272
|
-
return (c = u.skuById[g]) == null ? void 0 : c.unit;
|
|
2273
|
-
}
|
|
2274
|
-
function b(g) {
|
|
2275
|
-
const c = [];
|
|
2276
|
-
for (const I of g.changes) {
|
|
2277
|
-
const { change: U, outcome: y, reason: x } = I;
|
|
2278
|
-
switch (U.type) {
|
|
2279
|
-
case "remove-binding": {
|
|
2280
|
-
const S = g.original.contains.find(
|
|
2281
|
-
(N) => N.type === U.target.type && N.id === U.target.id
|
|
2282
|
-
) ?? null;
|
|
2283
|
-
c.push({ label: r("inventory.recipe.bulkEditor.summary.changeRemove"), before: S, after: null, outcome: y, reason: x });
|
|
2284
|
-
break;
|
|
2285
|
-
}
|
|
2286
|
-
case "add-binding":
|
|
2287
|
-
c.push({ label: r("inventory.recipe.bulkEditor.summary.changeAdd"), before: null, after: U.binding, outcome: y, reason: x });
|
|
2288
|
-
break;
|
|
2289
|
-
case "replace-binding": {
|
|
2290
|
-
const S = g.original.contains.find(
|
|
2291
|
-
(N) => N.type === U.from.type && N.id === U.from.id
|
|
2292
|
-
) ?? null;
|
|
2293
|
-
c.push({ label: r("inventory.recipe.bulkEditor.summary.changeReplace"), before: S, after: U.to, outcome: y, reason: x });
|
|
2294
|
-
break;
|
|
2295
|
-
}
|
|
2296
|
-
case "update-binding-rule": {
|
|
2297
|
-
const S = g.original.contains.find(
|
|
2298
|
-
(J) => J.type === U.target.type && J.id === U.target.id
|
|
2299
|
-
) ?? null, N = S ? { ...S, rules: U.rule } : null;
|
|
2300
|
-
c.push({ label: r("inventory.recipe.bulkEditor.summary.changeUpdateRule"), before: S, after: N, outcome: y, reason: x });
|
|
2301
|
-
break;
|
|
2302
|
-
}
|
|
2303
|
-
case "update-alternatives": {
|
|
2304
|
-
const S = g.original.contains.find(
|
|
2305
|
-
(J) => J.type === U.target.type && J.id === U.target.id
|
|
2306
|
-
) ?? null, N = S ? { ...S, alternatives: U.alternatives } : null;
|
|
2307
|
-
c.push({ label: r("inventory.recipe.bulkEditor.summary.changeUpdateAlternatives"), before: S, after: N, outcome: y, reason: x });
|
|
2308
|
-
break;
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
return c;
|
|
2313
|
-
}
|
|
2314
|
-
function h(g) {
|
|
2315
|
-
switch (g) {
|
|
2316
|
-
case "will-update":
|
|
2317
|
-
return r("inventory.recipe.bulkEditor.status.willUpdate");
|
|
2318
|
-
case "already-satisfied":
|
|
2319
|
-
return r("inventory.recipe.bulkEditor.status.alreadySatisfied");
|
|
2320
|
-
case "partially-ignored":
|
|
2321
|
-
return r("inventory.recipe.bulkEditor.status.partiallyIgnored");
|
|
2322
|
-
case "blocked":
|
|
2323
|
-
return r("inventory.recipe.bulkEditor.status.blocked");
|
|
2324
|
-
case "no-applicable-changes":
|
|
2325
|
-
return r("inventory.recipe.bulkEditor.status.noApplicableChanges");
|
|
2326
|
-
default:
|
|
2327
|
-
return "";
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
function V(g) {
|
|
2331
|
-
switch (g) {
|
|
2332
|
-
case "will-update":
|
|
2333
|
-
return "success";
|
|
2334
|
-
case "already-satisfied":
|
|
2335
|
-
return "info";
|
|
2336
|
-
case "partially-ignored":
|
|
2337
|
-
return "warning";
|
|
2338
|
-
case "blocked":
|
|
2339
|
-
return "critical";
|
|
2340
|
-
case "no-applicable-changes":
|
|
2341
|
-
return "neutral";
|
|
2342
|
-
default:
|
|
2343
|
-
return "neutral";
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
function T(g) {
|
|
2347
|
-
switch (g) {
|
|
2348
|
-
case "applied":
|
|
2349
|
-
return r("inventory.recipe.bulkEditor.summary.outcomeApplied");
|
|
2350
|
-
case "ignored":
|
|
2351
|
-
return r("inventory.recipe.bulkEditor.summary.outcomeIgnored");
|
|
2352
|
-
case "already-satisfied":
|
|
2353
|
-
return r("inventory.recipe.bulkEditor.summary.outcomeAlreadySatisfied");
|
|
2354
|
-
case "blocked":
|
|
2355
|
-
return r("inventory.recipe.bulkEditor.summary.outcomeBlocked");
|
|
2356
|
-
default:
|
|
2357
|
-
return "";
|
|
2358
|
-
}
|
|
2359
|
-
}
|
|
2360
|
-
function _(g) {
|
|
2361
|
-
switch (g) {
|
|
2362
|
-
case "applied":
|
|
2363
|
-
return "success";
|
|
2364
|
-
case "ignored":
|
|
2365
|
-
return "warning";
|
|
2366
|
-
case "already-satisfied":
|
|
2367
|
-
return "info";
|
|
2368
|
-
case "blocked":
|
|
2369
|
-
return "critical";
|
|
2370
|
-
default:
|
|
2371
|
-
return "neutral";
|
|
2372
|
-
}
|
|
2373
|
-
}
|
|
2374
|
-
return (g, c) => {
|
|
2375
|
-
const I = D("FmChip"), U = D("FmBanner");
|
|
2376
|
-
return v(), C("div", Eo, [
|
|
2377
|
-
p("div", Io, [
|
|
2378
|
-
p("p", Bo, R(s(r)("inventory.recipe.bulkEditor.summary.title")), 1),
|
|
2379
|
-
p("div", Co, [
|
|
2380
|
-
p("div", $o, [
|
|
2381
|
-
B(I, {
|
|
2382
|
-
size: "sm",
|
|
2383
|
-
label: String(a.value),
|
|
2384
|
-
variant: "success"
|
|
2385
|
-
}, null, 8, ["label"]),
|
|
2386
|
-
p("span", Vo, R(s(r)("inventory.recipe.bulkEditor.summary.countWillUpdate")), 1)
|
|
2387
|
-
]),
|
|
2388
|
-
f.value > 0 ? (v(), C("div", Ao, [
|
|
2389
|
-
B(I, {
|
|
2390
|
-
size: "sm",
|
|
2391
|
-
label: String(f.value),
|
|
2392
|
-
variant: "warning"
|
|
2393
|
-
}, null, 8, ["label"]),
|
|
2394
|
-
p("span", Fo, R(s(r)("inventory.recipe.bulkEditor.summary.countPartiallyIgnored")), 1)
|
|
2395
|
-
])) : F("", !0),
|
|
2396
|
-
l.value > 0 ? (v(), C("div", Ro, [
|
|
2397
|
-
B(I, {
|
|
2398
|
-
size: "sm",
|
|
2399
|
-
label: String(l.value),
|
|
2400
|
-
variant: "info"
|
|
2401
|
-
}, null, 8, ["label"]),
|
|
2402
|
-
p("span", To, R(s(r)("inventory.recipe.bulkEditor.summary.countAlreadySatisfied")), 1)
|
|
2403
|
-
])) : F("", !0),
|
|
2404
|
-
n.value > 0 ? (v(), C("div", Uo, [
|
|
2405
|
-
B(I, {
|
|
2406
|
-
size: "sm",
|
|
2407
|
-
label: String(n.value),
|
|
2408
|
-
variant: "critical"
|
|
2409
|
-
}, null, 8, ["label"]),
|
|
2410
|
-
p("span", Do, R(s(r)("inventory.recipe.bulkEditor.summary.countBlocked")), 1)
|
|
2411
|
-
])) : F("", !0),
|
|
2412
|
-
o.value > 0 ? (v(), C("div", Po, [
|
|
2413
|
-
B(I, {
|
|
2414
|
-
size: "sm",
|
|
2415
|
-
label: String(o.value),
|
|
2416
|
-
variant: "neutral"
|
|
2417
|
-
}, null, 8, ["label"]),
|
|
2418
|
-
p("span", No, R(s(r)("inventory.recipe.bulkEditor.summary.countNoChanges")), 1)
|
|
2419
|
-
])) : F("", !0)
|
|
2420
|
-
]),
|
|
2421
|
-
a.value === 0 && f.value === 0 ? (v(), M(U, {
|
|
2422
|
-
key: 0,
|
|
2423
|
-
class: "mt-12",
|
|
2424
|
-
type: "warning",
|
|
2425
|
-
message: s(r)("inventory.recipe.bulkEditor.summary.nothingToSubmit")
|
|
2426
|
-
}, null, 8, ["message"])) : F("", !0)
|
|
2427
|
-
]),
|
|
2428
|
-
(v(!0), C(ae, null, me(i.value, (y) => (v(), C("div", {
|
|
2429
|
-
key: y.recipeId,
|
|
2430
|
-
class: "rounded-lg border border-fm-color-border-default overflow-hidden"
|
|
2431
|
-
}, [
|
|
2432
|
-
p("div", Oo, [
|
|
2433
|
-
p("span", Mo, R(y.recipeName), 1),
|
|
2434
|
-
y.original.version === "v2" ? (v(), M(I, {
|
|
2435
|
-
key: 0,
|
|
2436
|
-
size: "sm",
|
|
2437
|
-
label: "V2",
|
|
2438
|
-
variant: "info"
|
|
2439
|
-
})) : F("", !0),
|
|
2440
|
-
B(I, {
|
|
2441
|
-
size: "sm",
|
|
2442
|
-
label: h(y.status),
|
|
2443
|
-
variant: V(y.status)
|
|
2444
|
-
}, null, 8, ["label", "variant"])
|
|
2445
|
-
]),
|
|
2446
|
-
s(t).applyErrors.has(y.recipeId) ? (v(), C("div", Go, [
|
|
2447
|
-
B(U, {
|
|
2448
|
-
type: "error",
|
|
2449
|
-
message: s(t).applyErrors.get(y.recipeId)
|
|
2450
|
-
}, null, 8, ["message"])
|
|
2451
|
-
])) : F("", !0),
|
|
2452
|
-
y.changes.length === 0 ? (v(), C("div", zo, [
|
|
2453
|
-
p("p", Jo, R(s(r)("inventory.recipe.bulkEditor.summary.noChangesDetail")), 1)
|
|
2454
|
-
])) : (v(), C("div", Ko, [
|
|
2455
|
-
(v(!0), C(ae, null, me(b(y), (x, S) => (v(), C("div", {
|
|
2456
|
-
key: S,
|
|
2457
|
-
class: "flex flex-col"
|
|
2458
|
-
}, [
|
|
2459
|
-
p("div", Lo, [
|
|
2460
|
-
p("span", jo, R(x.label), 1),
|
|
2461
|
-
B(I, {
|
|
2462
|
-
size: "sm",
|
|
2463
|
-
label: T(x.outcome),
|
|
2464
|
-
variant: _(x.outcome)
|
|
2465
|
-
}, null, 8, ["label", "variant"])
|
|
2466
|
-
]),
|
|
2467
|
-
x.reason ? (v(), C("div", qo, [
|
|
2468
|
-
p("span", Yo, R(x.reason), 1)
|
|
2469
|
-
])) : F("", !0),
|
|
2470
|
-
x.before ? (v(), C("div", Ho, [
|
|
2471
|
-
c[0] || (c[0] = p("span", { class: "absolute left-0 top-1/2 -translate-x-full -translate-y-1/2 w-16 text-center fm-typo-en-body-sm-600 text-fm-color-error select-none" }, "−", -1)),
|
|
2472
|
-
x.before.type === "SKU" && k(x.before.id) ? (v(), M(Ce, {
|
|
2473
|
-
key: 0,
|
|
2474
|
-
"model-value": x.before,
|
|
2475
|
-
"display-name": E(x.before),
|
|
2476
|
-
unit: k(x.before.id),
|
|
2477
|
-
"show-error": !1,
|
|
2478
|
-
"able-to-apply-rules": !1,
|
|
2479
|
-
"able-to-configure-alternative": !1,
|
|
2480
|
-
disabled: "",
|
|
2481
|
-
readonly: ""
|
|
2482
|
-
}, null, 8, ["model-value", "display-name", "unit"])) : x.before.type === "RECIPE" ? (v(), M(Be, {
|
|
2483
|
-
key: 1,
|
|
2484
|
-
"model-value": x.before,
|
|
2485
|
-
"display-name": E(x.before),
|
|
2486
|
-
"show-error": !1,
|
|
2487
|
-
disabled: "",
|
|
2488
|
-
readonly: ""
|
|
2489
|
-
}, null, 8, ["model-value", "display-name"])) : (v(), C("div", Qo, [
|
|
2490
|
-
p("span", Wo, R(E(x.before)), 1)
|
|
2491
|
-
]))
|
|
2492
|
-
])) : F("", !0),
|
|
2493
|
-
x.after ? (v(), C("div", Xo, [
|
|
2494
|
-
c[1] || (c[1] = p("span", { class: "absolute left-0 top-1/2 -translate-x-full -translate-y-1/2 w-16 text-center fm-typo-en-body-sm-600 text-fm-color-success select-none" }, "+", -1)),
|
|
2495
|
-
x.after.type === "SKU" && k(x.after.id) ? (v(), M(Ce, {
|
|
2496
|
-
key: 0,
|
|
2497
|
-
"model-value": x.after,
|
|
2498
|
-
"display-name": E(x.after),
|
|
2499
|
-
unit: k(x.after.id),
|
|
2500
|
-
"show-error": !1,
|
|
2501
|
-
"able-to-apply-rules": !1,
|
|
2502
|
-
"able-to-configure-alternative": !1,
|
|
2503
|
-
disabled: "",
|
|
2504
|
-
readonly: ""
|
|
2505
|
-
}, null, 8, ["model-value", "display-name", "unit"])) : x.after.type === "RECIPE" ? (v(), M(Be, {
|
|
2506
|
-
key: 1,
|
|
2507
|
-
"model-value": x.after,
|
|
2508
|
-
"display-name": E(x.after),
|
|
2509
|
-
"show-error": !1,
|
|
2510
|
-
disabled: "",
|
|
2511
|
-
readonly: ""
|
|
2512
|
-
}, null, 8, ["model-value", "display-name"])) : (v(), C("div", Zo, [
|
|
2513
|
-
p("span", ei, R(E(x.after)), 1)
|
|
2514
|
-
]))
|
|
2515
|
-
])) : F("", !0)
|
|
2516
|
-
]))), 128))
|
|
2517
|
-
])),
|
|
2518
|
-
p("div", ti, [
|
|
2519
|
-
y.counts.applied > 0 ? (v(), C("span", ni, R(s(r)("inventory.recipe.bulkEditor.summary.footerApplied", { count: y.counts.applied })), 1)) : F("", !0),
|
|
2520
|
-
y.counts.satisfied > 0 ? (v(), C("span", oi, R(s(r)("inventory.recipe.bulkEditor.summary.footerSatisfied", { count: y.counts.satisfied })), 1)) : F("", !0),
|
|
2521
|
-
y.counts.ignored > 0 ? (v(), C("span", ii, R(s(r)("inventory.recipe.bulkEditor.summary.footerIgnored", { count: y.counts.ignored })), 1)) : F("", !0),
|
|
2522
|
-
y.counts.blocked > 0 ? (v(), C("span", li, R(s(r)("inventory.recipe.bulkEditor.summary.footerBlocked", { count: y.counts.blocked })), 1)) : F("", !0)
|
|
2523
|
-
])
|
|
2524
|
-
]))), 128))
|
|
2525
|
-
]);
|
|
2526
|
-
};
|
|
2527
|
-
}
|
|
2528
|
-
}), si = { class: "flex items-center gap-12" }, ri = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, di = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary ml-4" }, ui = {
|
|
2529
|
-
key: 0,
|
|
2530
|
-
class: "flex h-[calc(98vh-120px)] overflow-hidden"
|
|
2531
|
-
}, ci = { class: "w-[420px] shrink-0 border-r border-fm-color-border-default flex flex-col overflow-hidden" }, mi = { class: "flex-1 flex flex-col overflow-hidden" }, pi = {
|
|
2532
|
-
key: 0,
|
|
2533
|
-
class: "flex flex-col items-center justify-center h-full gap-8 px-40 text-center"
|
|
2534
|
-
}, fi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yi = { class: "flex items-center justify-between px-24 py-14 border-b border-fm-color-border-default shrink-0" }, vi = { class: "flex flex-col gap-2" }, bi = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, gi = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _i = { class: "flex items-center gap-8" }, hi = { class: "flex-1 overflow-y-auto px-24 py-16" }, ki = {
|
|
2535
|
-
key: 1,
|
|
2536
|
-
class: "h-[calc(98vh-120px)] overflow-y-auto px-24 py-20"
|
|
2537
|
-
}, xi = {
|
|
2538
|
-
key: 0,
|
|
2539
|
-
class: "flex items-center gap-8 px-4"
|
|
2540
|
-
}, Si = {
|
|
2541
|
-
key: 1,
|
|
2542
|
-
class: "flex items-center gap-8 px-4"
|
|
2543
|
-
}, wi = /* @__PURE__ */ ee({
|
|
2544
|
-
__name: "RecipeBulkEditorDialog",
|
|
2545
|
-
props: {
|
|
2546
|
-
show: { type: Boolean }
|
|
2547
|
-
},
|
|
2548
|
-
emits: ["update:show"],
|
|
2549
|
-
setup(m, { emit: r }) {
|
|
2550
|
-
const u = m, { t } = W(), i = ke(), a = we(u, "show"), f = A({
|
|
2551
|
-
get: () => !!a.value,
|
|
2552
|
-
set: (T) => {
|
|
2553
|
-
a.value = T;
|
|
2554
|
-
}
|
|
2555
|
-
}), l = Ae(), n = A(() => i.currentStep === 1), o = A(() => i.currentStep === 2), e = A(() => i.selectedRecipeIds.size === 0 ? !1 : Object.values(i.entries).some(
|
|
2556
|
-
(T) => T.status === "will-update" || T.status === "partially-ignored"
|
|
2557
|
-
)), d = A(() => e.value);
|
|
2558
|
-
function w() {
|
|
2559
|
-
i.flushAllDraftCache(), i.currentStep = 2;
|
|
2560
|
-
}
|
|
2561
|
-
function E() {
|
|
2562
|
-
i.currentStep = 1;
|
|
2563
|
-
}
|
|
2564
|
-
function k() {
|
|
2565
|
-
!i.activeDraft || !i.activeRecipeId || i.applyDraftToActive();
|
|
2566
|
-
}
|
|
2567
|
-
function b() {
|
|
2568
|
-
!i.activeOriginal || !i.activeDraft || i.pendingChanges.length !== 0 && l.open({
|
|
2569
|
-
title: t("inventory.recipe.bulkEditor.applyToAll.confirmTitle"),
|
|
2570
|
-
message: t("inventory.recipe.bulkEditor.applyToAll.confirmMessage", {
|
|
2571
|
-
count: i.selectedRecipeIds.size
|
|
2572
|
-
}),
|
|
2573
|
-
primaryActions: {
|
|
2574
|
-
text: t("inventory.recipe.bulkEditor.applyToAll.confirmButton"),
|
|
2575
|
-
variant: "primary",
|
|
2576
|
-
close: !0
|
|
2577
|
-
},
|
|
2578
|
-
secondaryActions: {
|
|
2579
|
-
text: t("common.cancel"),
|
|
2580
|
-
close: !0
|
|
2581
|
-
}
|
|
2582
|
-
}).onPrimary(() => {
|
|
2583
|
-
i.applyToAll();
|
|
2584
|
-
});
|
|
2585
|
-
}
|
|
2586
|
-
function h() {
|
|
2587
|
-
l.open({
|
|
2588
|
-
title: t("inventory.recipe.bulkEditor.step3.confirmTitle"),
|
|
2589
|
-
message: t("inventory.recipe.bulkEditor.step3.confirmMessage"),
|
|
2590
|
-
primaryActions: {
|
|
2591
|
-
text: t("inventory.recipe.bulkEditor.step3.confirmButton"),
|
|
2592
|
-
variant: "primary",
|
|
2593
|
-
close: !0
|
|
2594
|
-
},
|
|
2595
|
-
secondaryActions: {
|
|
2596
|
-
text: t("common.cancel"),
|
|
2597
|
-
close: !0
|
|
2598
|
-
}
|
|
2599
|
-
}).onPrimary(async () => {
|
|
2600
|
-
await i.confirmAndApply();
|
|
2601
|
-
});
|
|
2602
|
-
}
|
|
2603
|
-
function V() {
|
|
2604
|
-
f.value = !1, i.reset();
|
|
2605
|
-
}
|
|
2606
|
-
return (T, _) => {
|
|
2607
|
-
const g = D("FmChip"), c = D("FmIcon"), I = D("FmButton"), U = D("FmTooltip"), y = D("FmDialog");
|
|
2608
|
-
return v(), M(y, {
|
|
2609
|
-
modelValue: f.value,
|
|
2610
|
-
"onUpdate:modelValue": [
|
|
2611
|
-
_[2] || (_[2] = (x) => f.value = x),
|
|
2612
|
-
_[3] || (_[3] = (x) => {
|
|
2613
|
-
x || s(i).reset();
|
|
2614
|
-
})
|
|
2615
|
-
],
|
|
2616
|
-
overlay: !0,
|
|
2617
|
-
"close-button": "",
|
|
2618
|
-
"max-width": "98vw",
|
|
2619
|
-
"max-height": "98vh"
|
|
2620
|
-
}, {
|
|
2621
|
-
"dialog-header": j(() => [
|
|
2622
|
-
p("div", si, [
|
|
2623
|
-
p("span", ri, R(s(t)("inventory.recipe.bulkEditor.title")), 1),
|
|
2624
|
-
s(i).matchedRecipes.length > 0 ? (v(), M(g, {
|
|
2625
|
-
key: 0,
|
|
2626
|
-
size: "sm",
|
|
2627
|
-
label: String(s(i).matchedRecipes.length),
|
|
2628
|
-
variant: "info"
|
|
2629
|
-
}, null, 8, ["label"])) : F("", !0),
|
|
2630
|
-
p("span", di, R(o.value ? s(t)("inventory.recipe.bulkEditor.stepLabel.summary") : s(t)("inventory.recipe.bulkEditor.stepLabel.editor")), 1)
|
|
2631
|
-
])
|
|
2632
|
-
]),
|
|
2633
|
-
"dialog-footer": j(() => [
|
|
2634
|
-
n.value ? (v(), C("div", xi, [
|
|
2635
|
-
B(I, {
|
|
2636
|
-
label: s(t)("inventory.recipe.bulkEditor.editor.reviewButton"),
|
|
2637
|
-
disabled: !e.value,
|
|
2638
|
-
onClick: w
|
|
2639
|
-
}, null, 8, ["label", "disabled"]),
|
|
2640
|
-
B(I, {
|
|
2641
|
-
label: s(t)("common.close"),
|
|
2642
|
-
variant: "tertiary",
|
|
2643
|
-
disabled: s(i).isSaving,
|
|
2644
|
-
onClick: V
|
|
2645
|
-
}, null, 8, ["label", "disabled"])
|
|
2646
|
-
])) : o.value ? (v(), C("div", Si, [
|
|
2647
|
-
B(I, {
|
|
2648
|
-
label: s(t)("inventory.recipe.bulkEditor.step3.confirmButton"),
|
|
2649
|
-
disabled: !d.value || s(i).isSaving,
|
|
2650
|
-
loading: s(i).isSaving,
|
|
2651
|
-
onClick: h
|
|
2652
|
-
}, null, 8, ["label", "disabled", "loading"]),
|
|
2653
|
-
B(I, {
|
|
2654
|
-
label: s(t)("inventory.recipe.bulkEditor.summary.backButton"),
|
|
2655
|
-
variant: "secondary",
|
|
2656
|
-
disabled: s(i).isSaving,
|
|
2657
|
-
onClick: E
|
|
2658
|
-
}, null, 8, ["label", "disabled"]),
|
|
2659
|
-
B(I, {
|
|
2660
|
-
label: s(t)("common.close"),
|
|
2661
|
-
variant: "tertiary",
|
|
2662
|
-
disabled: s(i).isSaving,
|
|
2663
|
-
onClick: V
|
|
2664
|
-
}, null, 8, ["label", "disabled"])
|
|
2665
|
-
])) : F("", !0)
|
|
2666
|
-
]),
|
|
2667
|
-
default: j(() => [
|
|
2668
|
-
n.value ? (v(), C("div", ui, [
|
|
2669
|
-
p("div", ci, [
|
|
2670
|
-
B(wo)
|
|
2671
|
-
]),
|
|
2672
|
-
p("div", mi, [
|
|
2673
|
-
!s(i).activeRecipeId || !s(i).activeDraft ? (v(), C("div", pi, [
|
|
2674
|
-
B(c, {
|
|
2675
|
-
name: "edit_note",
|
|
2676
|
-
size: "lg",
|
|
2677
|
-
class: "text-fm-color-typo-placeholder"
|
|
2678
|
-
}),
|
|
2679
|
-
p("p", fi, R(s(t)("inventory.recipe.bulkEditor.editor.emptyPrompt")), 1)
|
|
2680
|
-
])) : (v(), C(ae, { key: 1 }, [
|
|
2681
|
-
p("div", yi, [
|
|
2682
|
-
p("div", vi, [
|
|
2683
|
-
p("span", bi, R(s(i).activeDraft.name), 1),
|
|
2684
|
-
p("span", gi, R(s(t)("inventory.recipe.bulkEditor.editor.editingLabel")), 1)
|
|
2685
|
-
]),
|
|
2686
|
-
p("div", _i, [
|
|
2687
|
-
B(I, {
|
|
2688
|
-
label: s(t)("inventory.recipe.bulkEditor.editor.revertButton"),
|
|
2689
|
-
variant: "tertiary",
|
|
2690
|
-
disabled: !s(i).hasDraftChanges,
|
|
2691
|
-
onClick: _[0] || (_[0] = (x) => s(i).revertActive())
|
|
2692
|
-
}, null, 8, ["label", "disabled"]),
|
|
2693
|
-
B(I, {
|
|
2694
|
-
label: s(t)("inventory.recipe.bulkEditor.editor.applyButton"),
|
|
2695
|
-
variant: "secondary",
|
|
2696
|
-
disabled: !s(i).hasDraftChanges,
|
|
2697
|
-
onClick: k
|
|
2698
|
-
}, null, 8, ["label", "disabled"]),
|
|
2699
|
-
s(i).hasVersionChange ? (v(), M(U, { key: 0 }, {
|
|
2700
|
-
content: j(() => [
|
|
2701
|
-
qe(R(s(t)("inventory.recipe.bulkEditor.applyToAll.disabledVersionChange")), 1)
|
|
2702
|
-
]),
|
|
2703
|
-
default: j(() => [
|
|
2704
|
-
B(I, {
|
|
2705
|
-
label: s(t)("inventory.recipe.bulkEditor.editor.applyToAllButton"),
|
|
2706
|
-
disabled: !0
|
|
2707
|
-
}, null, 8, ["label"])
|
|
2708
|
-
]),
|
|
2709
|
-
_: 1
|
|
2710
|
-
})) : (v(), M(I, {
|
|
2711
|
-
key: 1,
|
|
2712
|
-
label: s(t)("inventory.recipe.bulkEditor.editor.applyToAllButton"),
|
|
2713
|
-
disabled: s(i).pendingChanges.length === 0 || s(i).selectedRecipeIds.size === 0,
|
|
2714
|
-
onClick: b
|
|
2715
|
-
}, null, 8, ["label", "disabled"]))
|
|
2716
|
-
])
|
|
2717
|
-
]),
|
|
2718
|
-
p("div", hi, [
|
|
2719
|
-
(v(), M(nt, {
|
|
2720
|
-
key: s(i).activeRecipeId,
|
|
2721
|
-
mode: s(q).UPDATE,
|
|
2722
|
-
"model-value": s(i).activeDraft,
|
|
2723
|
-
"onUpdate:modelValue": _[1] || (_[1] = (x) => s(i).updateDraft(x))
|
|
2724
|
-
}, null, 8, ["mode", "model-value"]))
|
|
2725
|
-
])
|
|
2726
|
-
], 64))
|
|
2727
|
-
])
|
|
2728
|
-
])) : o.value ? (v(), C("div", ki, [
|
|
2729
|
-
B(ai)
|
|
2730
|
-
])) : F("", !0)
|
|
2731
|
-
]),
|
|
2732
|
-
_: 1
|
|
2733
|
-
}, 8, ["modelValue"]);
|
|
2734
|
-
};
|
|
2735
|
-
}
|
|
2736
|
-
});
|
|
2737
|
-
function Ei(m) {
|
|
2738
|
-
return !m || Object.keys(m).length === 0 ? "" : Object.entries(m).map(([r, u]) => `${r}: ${u}`).join(", ");
|
|
2739
|
-
}
|
|
2740
|
-
function Ii() {
|
|
2741
|
-
const m = Y(), r = m.recipes, u = m.recipeById, t = m.skuById, i = m.skuGroupById, a = r.flatMap((n, o) => {
|
|
2742
|
-
var d;
|
|
2743
|
-
const e = Ei(n.customAttributes);
|
|
2744
|
-
if ((d = n.contains) != null && d.length) {
|
|
2745
|
-
const w = n.contains.filter((b) => b.type === "RECIPE"), E = n.contains.filter((b) => b.type === "SKU"), k = n.contains.filter((b) => b.type === "SKU_GROUP");
|
|
2746
|
-
return [
|
|
2747
|
-
...o === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
2748
|
-
...w.map(
|
|
2749
|
-
(b, h) => {
|
|
2750
|
-
var V;
|
|
2751
|
-
return [
|
|
2752
|
-
h === 0 ? n.name : "",
|
|
2753
|
-
"RECIPE",
|
|
2754
|
-
"",
|
|
2755
|
-
(V = u[b.id]) == null ? void 0 : V.name,
|
|
2756
|
-
Q(b.amount),
|
|
2757
|
-
"UNIT",
|
|
2758
|
-
h === 0 ? e : ""
|
|
2759
|
-
];
|
|
2760
|
-
}
|
|
2761
|
-
),
|
|
2762
|
-
...E.map(
|
|
2763
|
-
(b, h) => {
|
|
2764
|
-
var V, T, _, g;
|
|
2765
|
-
return [
|
|
2766
|
-
!w.length && h === 0 ? n.name : "",
|
|
2767
|
-
"INGREDIENT",
|
|
2768
|
-
(V = t[b.id]) == null ? void 0 : V.code,
|
|
2769
|
-
(T = t[b.id]) == null ? void 0 : T.name,
|
|
2770
|
-
Q(b.amount),
|
|
2771
|
-
b.measurement ? b.measurement.abbrev : (g = (_ = t[b.id]) == null ? void 0 : _.unit) == null ? void 0 : g.abbrev,
|
|
2772
|
-
!w.length && h === 0 ? e : ""
|
|
2773
|
-
];
|
|
2774
|
-
}
|
|
2775
|
-
),
|
|
2776
|
-
...k.map(
|
|
2777
|
-
(b, h) => {
|
|
2778
|
-
var V, T;
|
|
2779
|
-
return [
|
|
2780
|
-
w.length === 0 && E.length === 0 && h === 0 ? n.name : "",
|
|
2781
|
-
"SKU_GROUP",
|
|
2782
|
-
((V = i[b.id]) == null ? void 0 : V.ref) || "",
|
|
2783
|
-
(T = i[b.id]) == null ? void 0 : T.name,
|
|
2784
|
-
Q(b.amount),
|
|
2785
|
-
"UNIT",
|
|
2786
|
-
w.length === 0 && E.length === 0 && h === 0 ? e : ""
|
|
2787
|
-
];
|
|
2788
|
-
}
|
|
2789
|
-
)
|
|
2790
|
-
];
|
|
2791
|
-
}
|
|
2792
|
-
return [
|
|
2793
|
-
...o === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
2794
|
-
[n.name, "No bindings", "", "", "", "", e]
|
|
2795
|
-
];
|
|
2796
|
-
}), l = Pt(a, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
|
|
2797
|
-
Nt(l, `RECIPE_${Ot(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
|
|
2798
|
-
}
|
|
2799
|
-
const Bi = { class: "flex flex-col py-8" }, Ci = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, $i = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ll = /* @__PURE__ */ ee({
|
|
2800
|
-
__name: "RecipeView",
|
|
2801
|
-
setup(m) {
|
|
2802
|
-
const r = Y(), u = A(() => r.recipes), t = pt(), { createRecipe: i, updateRecipe: a } = Ie(), { recipeDialogProps: f, recipeViewLoading: l } = bt(Ie()), { columnDefs: n, formatRowData: o } = Lt(), e = A(() => o(u.value)), d = ke();
|
|
2803
|
-
G(!1);
|
|
2804
|
-
function w(g) {
|
|
2805
|
-
if (g === "add")
|
|
2806
|
-
return i();
|
|
2807
|
-
if (g === "export")
|
|
2808
|
-
return Ii();
|
|
2809
|
-
g === "bulk-edit" && d.openDialog();
|
|
2810
|
-
}
|
|
2811
|
-
const E = G(""), k = A(() => l.value), { breakpoints: b } = ft(), h = A(() => b.value.xs || b.value.sm), V = A(() => h.value ? 10 : 20), T = ht(), { t: _ } = W();
|
|
2812
|
-
return (g, c) => {
|
|
2813
|
-
const I = D("FmTable");
|
|
2814
|
-
return v(), M(kt, {
|
|
2815
|
-
title: s(_)("inventory.recipe.title"),
|
|
2816
|
-
actions: [
|
|
2817
|
-
{
|
|
2818
|
-
label: s(_)("inventory.recipe.create.title"),
|
|
2819
|
-
value: "add",
|
|
2820
|
-
isPrimary: !0,
|
|
2821
|
-
prependIcon: "add"
|
|
2822
|
-
},
|
|
2823
|
-
{ label: s(_)("inventory.recipe.bulkEditor.title"), value: "bulk-edit", isPrimary: !1 },
|
|
2824
|
-
{ label: s(_)("common.export"), value: "export", isPrimary: !1 }
|
|
2825
|
-
],
|
|
2826
|
-
"onClick:action": w
|
|
2827
|
-
}, {
|
|
2828
|
-
default: j(() => [
|
|
2829
|
-
p("div", {
|
|
2830
|
-
class: he([
|
|
2831
|
-
"flex flex-col gap-8 max-h-full",
|
|
2832
|
-
{
|
|
2833
|
-
"p-0": h.value,
|
|
2834
|
-
"px-24 ": !h.value
|
|
2835
|
-
}
|
|
2836
|
-
])
|
|
2837
|
-
}, [
|
|
2838
|
-
B(Mt, {
|
|
2839
|
-
searchable: "",
|
|
2840
|
-
search: E.value,
|
|
2841
|
-
"onUpdate:search": c[0] || (c[0] = (U) => E.value = U)
|
|
2842
|
-
}, null, 8, ["search"]),
|
|
2843
|
-
(v(), M(I, {
|
|
2844
|
-
style: at(s(T).tableHeight),
|
|
2845
|
-
"column-defs": s(n),
|
|
2846
|
-
"row-data": e.value,
|
|
2847
|
-
"search-value": E.value,
|
|
2848
|
-
loading: !s(t)._currentLocation || k.value,
|
|
2849
|
-
onRowClick: c[1] || (c[1] = (U) => s(a)(U.original.original)),
|
|
2850
|
-
key: u.value.length,
|
|
2851
|
-
"page-size": V.value
|
|
2852
|
-
}, {
|
|
2853
|
-
"list-row": j((U) => [
|
|
2854
|
-
B(Dt, {
|
|
2855
|
-
row: U,
|
|
2856
|
-
onRowClick: (y) => s(a)(y.original)
|
|
2857
|
-
}, {
|
|
2858
|
-
default: j((y) => {
|
|
2859
|
-
var x, S, N, J, O, oe, te, se, z, X;
|
|
2860
|
-
return [
|
|
2861
|
-
p("div", Bi, [
|
|
2862
|
-
p("div", Ci, [
|
|
2863
|
-
B(s(Le), {
|
|
2864
|
-
render: (N = (S = (x = y.recipe) == null ? void 0 : x.column) == null ? void 0 : S.columnDef) == null ? void 0 : N.cell,
|
|
2865
|
-
props: (O = (J = y.recipe) == null ? void 0 : J.getContext) == null ? void 0 : O.call(J)
|
|
2866
|
-
}, null, 8, ["render", "props"])
|
|
2867
|
-
]),
|
|
2868
|
-
p("div", $i, [
|
|
2869
|
-
B(s(Le), {
|
|
2870
|
-
render: (se = (te = (oe = y.ingredients) == null ? void 0 : oe.column) == null ? void 0 : te.columnDef) == null ? void 0 : se.cell,
|
|
2871
|
-
props: (X = (z = y.ingredients) == null ? void 0 : z.getContext) == null ? void 0 : X.call(z)
|
|
2872
|
-
}, null, 8, ["render", "props"])
|
|
2873
|
-
])
|
|
2874
|
-
])
|
|
2875
|
-
];
|
|
2876
|
-
}),
|
|
2877
|
-
_: 2
|
|
2878
|
-
}, 1032, ["row", "onRowClick"])
|
|
2879
|
-
]),
|
|
2880
|
-
_: 1
|
|
2881
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
2882
|
-
], 2),
|
|
2883
|
-
(v(), M(st, { to: "body" }, [
|
|
2884
|
-
B(oo, rt(dt(s(f))), null, 16),
|
|
2885
|
-
B(wi, {
|
|
2886
|
-
show: s(d).show,
|
|
2887
|
-
"onUpdate:show": c[2] || (c[2] = (U) => s(d).show = U)
|
|
2888
|
-
}, null, 8, ["show"])
|
|
2889
|
-
]))
|
|
2890
|
-
]),
|
|
2891
|
-
_: 1
|
|
2892
|
-
}, 8, ["title", "actions"]);
|
|
2893
|
-
};
|
|
2894
|
-
}
|
|
2895
|
-
});
|
|
2896
|
-
export {
|
|
2897
|
-
ll as default
|
|
2898
|
-
};
|