@feedmepos/mf-inventory-portal 1.3.8-dev.1 → 1.3.9-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-Dl97lAmD.js → App-DNKZjjI9.js} +3 -3
- package/dist/{ApprovalView-RePEhbhl.js → ApprovalView-C98lgT5e.js} +7 -7
- package/dist/{BindingsDialog-8QVbtnnq.js → BindingsDialog-CS0CWCh6.js} +2 -2
- package/dist/{BindingsPicker-D9yuDGcq.js → BindingsPicker-B5vTow14.js} +2 -2
- package/dist/{BindingsTable-DAYhI-6V.js → BindingsTable-Bti_Xzla.js} +3 -3
- package/dist/{ClosingDraftView-D_VtBfFG.js → ClosingDraftView-ouzqPAhv.js} +11 -11
- package/dist/{ClosingHistoryView-ClUnxQS2.js → ClosingHistoryView-BEvURv6K.js} +4 -4
- package/dist/{ClosingTemplateView-0a_isyyx.js → ClosingTemplateView-VBNFaPqq.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-DovAi6j-.js → DeliveryOrderPrintPreview-D98URlBL.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DjNZ0m13.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D_K3VA_7.js} +3 -3
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-4vZH2hLF.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-1vmf_LFu.js} +2 -2
- package/dist/{FmMultiselectDialog-Z49kK96R.js → FmMultiselectDialog-iIGOu9rD.js} +2 -2
- package/dist/{FmMultiselectDialog-B5-aK-b2.js → FmMultiselectDialog-u9c0wd_C.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-zP1nS7bp.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BrN6og75.js} +4 -4
- package/dist/{ImportView-Dba8fJry.js → ImportView-K2HsJy02.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DHITBIhp.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CF2e4xBO.js} +1 -1
- package/dist/{IngredientGroupView-CHi5_A4T.js → IngredientGroupView-CSt3-WyR.js} +5 -5
- package/dist/{IngredientsView-DWk27PJg.js → IngredientsView-CssjvCRN.js} +15 -15
- package/dist/{IntegrationExplorerView-CixgHWVb.js → IntegrationExplorerView-JX0ec-Ep.js} +5 -5
- package/dist/{IntegrationView-fttszvyC.js → IntegrationView-DLgOOxcA.js} +13 -13
- package/dist/{InventoryBindingForm-DDcM2paa.js → InventoryBindingForm-ZsoxhJlY.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DOHrtdbl.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B8vZBU_I.js} +5 -5
- package/dist/{InventoryBindingSummary-BERshnpd.js → InventoryBindingSummary-BiHujY96.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-D4u0MM_k.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BPSekTDs.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-eFb-84g2.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Ca97qVkJ.js} +1 -1
- package/dist/{PublishView-COGdnDHP.js → PublishView-4eJ8Zsr2.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-COJVgeTm.js → PurchaseOrderPrintPreview-DNPo5N3z.js} +2 -2
- package/dist/{ReceiveRequestView-DvC12_QK.js → ReceiveRequestView-DyIVIBsg.js} +23 -23
- package/dist/RecipeView-DGdnU5r3.js +1692 -0
- package/dist/{SettingsView-DbXva8_D.js → SettingsView-2i5aJNSb.js} +4 -4
- package/dist/{StockView-Hri6SSjn.js → StockView-QgTIxX0a.js} +18 -18
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DiRfjFmz.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DNDp2_fA.js} +1 -1
- package/dist/{SupplierView-DCMW5muk.js → SupplierView-CHpB8prR.js} +12 -12
- package/dist/{SurchargeView-DRh5EAi8.js → SurchargeView-Dm1r2uqN.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BHNIS7Pp.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-BFyV3yuR.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BVyoZ2a4.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-sSKtsPKi.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CMSKhz6_.js → TransferDetails.vue_vue_type_script_setup_true_lang-Dq_gl-Fd.js} +19 -19
- package/dist/{TransferTemplateView-71XY525Q.js → TransferTemplateView-DuZqVyUq.js} +17 -17
- package/dist/{UnitCostHistoryView-CjEaekfJ.js → UnitCostHistoryView-NFexFr7K.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-B8dRQhZi.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-CmlHqfim.js} +4 -4
- package/dist/{UnitView-D06txpBT.js → UnitView-DGk2xLYC.js} +7 -7
- package/dist/{WarehouseView-DQluGq0D.js → WarehouseView-CpQNS7Bz.js} +5 -5
- package/dist/{WastageTemplateView-Bqmd_r_Y.js → WastageTemplateView-Dm7Ecw85.js} +14 -14
- package/dist/{app-B5-QVzib.js → app-B94vpDz1.js} +12 -11
- package/dist/app.js +1 -1
- package/dist/{closing-template-C3ClR8Pj.js → closing-template-gkzyUcna.js} +1 -1
- package/dist/{date2-CQCX7jCE.js → date2-CTfi-XgH.js} +1 -1
- package/dist/{dayjs.min-Dhp0BWSV.js → dayjs.min-CQchfh63.js} +1 -1
- package/dist/{decimal-98G--u_X.js → decimal-BmKtexQF.js} +2 -2
- package/dist/{defineDeepModel-BmHs4vdS.js → defineDeepModel-DDY4AljR.js} +1 -1
- package/dist/{duplicate-template-UzmArmcM.js → duplicate-template-BPEnMLDR.js} +1 -1
- package/dist/{export-Bdxro0GT.js → export-CiwJijHC.js} +1 -1
- package/dist/{feature-DyfUPR3b.js → feature-KqBb92Wn.js} +2 -2
- package/dist/{format-time-from-id-uRCD3JxF.js → format-time-from-id-CVkLaNfw.js} +1 -1
- package/dist/{format-unit-display-C-_85vuL.js → format-unit-display-BhO4oXRU.js} +11 -11
- package/dist/{import-export.helper-N1BqiTub.js → import-export.helper-D08yYJQH.js} +6 -6
- package/dist/{index-CwqHa5AY.js → index-BvmBzF4R.js} +1 -1
- package/dist/{index-CaREZ_vQ.js → index-DCcmylAB.js} +3 -3
- package/dist/{index-B1RZtqz-.js → index-Dh-BfFG1.js} +1 -1
- package/dist/{inventory-core-dart.default-BK8f9n8e.js → inventory-core-dart.default-DVKKHudz.js} +1 -1
- package/dist/{lodash-B9tHF9A4.js → lodash-CEWqYtF5.js} +1 -1
- package/dist/{lz-string-BSMjlcH9.js → lz-string-DtovFFjp.js} +1 -1
- package/dist/{netsuite-D4KHhWWu.js → netsuite-iwYdYZ14.js} +3 -3
- package/dist/{number-DmqVo28f.js → number-CTWi0ssr.js} +3 -3
- package/dist/{predefined-templates-Dy5hYXMM.js → predefined-templates-Pm5D7HjM.js} +1 -1
- package/dist/{purchase-order-template-BT3tF_gn.js → purchase-order-template-Csv21mIG.js} +1 -1
- package/dist/{rules-CbJ7idQa.js → rules-DVfR0Xim.js} +2 -2
- package/dist/{stock-C9RXv-3_.js → stock-D1ePDr9E.js} +1 -1
- package/dist/{stock-YXoLCE8o.js → stock-DLt3OI7v.js} +3 -3
- package/dist/{supplier-Duiacdig.js → supplier-CgKISRGa.js} +2 -2
- package/dist/{surcharge-CkDK4P_6.js → surcharge-Cp2pVdxh.js} +1 -1
- package/dist/{use-ingredient-select-dialog-C7uVeT1M.js → use-ingredient-select-dialog-D9VdQnDW.js} +2 -2
- package/dist/{use-inventory-binding-dialog-BIo9Fi-9.js → use-inventory-binding-dialog-BnmwzT3w.js} +2 -2
- package/dist/{use-template-enabled-locations-BtbfLc0y.js → use-template-enabled-locations-SW017st9.js} +2 -2
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +24 -33
- package/dist/{vue-i18n-D1JHIbLE.js → vue-i18n-uxjJeG_L.js} +206 -206
- package/dist/{xlsx-BEbkruI_.js → xlsx-haWzxLbc.js} +1 -1
- package/dist/{xlsx.util-BMTXqfxw.js → xlsx.util-CfVQ7V20.js} +1 -1
- package/package.json +5 -5
- package/dist/RecipeView-BKlVCFPR.js +0 -1682
|
@@ -1,1682 +0,0 @@
|
|
|
1
|
-
import { defineComponent as J, ref as G, onMounted as Ce, resolveComponent as A, openBlock as B, createElementBlock as R, Fragment as oe, createElementVNode as v, toDisplayString as N, createVNode as k, createCommentVNode as E, mergeModels as Ie, computed as S, useModel as Ae, unref as a, watch as _e, normalizeClass as he, withCtx as K, h as O, createBlock as D, renderList as se, isRef as fe, normalizeStyle as Re, Teleport as Se, normalizeProps as $e, guardReactiveProps as Ee } from "vue";
|
|
2
|
-
import { a as Y, c as ue, S as Te, F as ie, w as Ue, x as Pe, j as ve, u as De } from "./app-B5-QVzib.js";
|
|
3
|
-
import { useDialog as me, useSnackbar as ce, components as ee, useProxiedModel as ye, useBreakpoints as Ge } from "@feedmepos/ui-library";
|
|
4
|
-
import { i as Me, _ as ze } from "./is-linked-ingredient-error-fJ2TJb3z.js";
|
|
5
|
-
import { F as z } from "./form-mode.enum-BKiNVH6A.js";
|
|
6
|
-
import { _ as Ve } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-DHITBIhp.js";
|
|
7
|
-
import { defineStore as Ne, storeToRefs as Ke } from "pinia";
|
|
8
|
-
import { D as be, R as te } from "./row-action.enum-Co_O4qD9.js";
|
|
9
|
-
import { c as Le } from "./component-kqxARxvM.js";
|
|
10
|
-
import { a as j, c as ke } from "./number-DmqVo28f.js";
|
|
11
|
-
import { useI18n as Q, useCoreStore as Oe } from "@feedmepos/mf-common";
|
|
12
|
-
import { u as je, _ as Ye } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CkPuJQWF.js";
|
|
13
|
-
import { b as xe, c as pe, I as qe, A as re, U as Be, R as He } from "./rules-CbJ7idQa.js";
|
|
14
|
-
import { _ as We } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-DOHrtdbl.js";
|
|
15
|
-
import { a as ae } from "./FmMultiselectDialog-Z49kK96R.js";
|
|
16
|
-
import { d as we } from "./defineDeepModel-BmHs4vdS.js";
|
|
17
|
-
import { D as Je } from "./app-DiX-EfV6.js";
|
|
18
|
-
import { _ as Qe, c as Xe, d as Ze } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-zP1nS7bp.js";
|
|
19
|
-
import { u as en } from "./FmMultiselectDialog-B5-aK-b2.js";
|
|
20
|
-
import { u as nn } from "./vue-i18n-D1JHIbLE.js";
|
|
21
|
-
import { F as tn } from "./inventory-core-dart.default-BK8f9n8e.js";
|
|
22
|
-
import { _ as on } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
|
|
23
|
-
import { u as ln } from "./feature-DyfUPR3b.js";
|
|
24
|
-
import { _ as sn, F as ge } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
25
|
-
import { b as an, d as rn } from "./xlsx.util-BMTXqfxw.js";
|
|
26
|
-
import { f as dn } from "./date2-CQCX7jCE.js";
|
|
27
|
-
import { _ as un } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-4vZH2hLF.js";
|
|
28
|
-
const mn = {
|
|
29
|
-
key: 0,
|
|
30
|
-
class: "flex flex-col items-center w-full h-full gap-24"
|
|
31
|
-
}, cn = { key: 1 }, pn = { key: 0 }, fn = /* @__PURE__ */ J({
|
|
32
|
-
__name: "DeleteDialog",
|
|
33
|
-
props: {
|
|
34
|
-
type: {},
|
|
35
|
-
data: {},
|
|
36
|
-
message: {},
|
|
37
|
-
bindedItems: {}
|
|
38
|
-
},
|
|
39
|
-
setup(p) {
|
|
40
|
-
const V = p, b = G(V.bindedItems || []), m = G(!1);
|
|
41
|
-
Ce(() => {
|
|
42
|
-
d();
|
|
43
|
-
});
|
|
44
|
-
async function d() {
|
|
45
|
-
var u, g;
|
|
46
|
-
!m.value && ((u = V.data) != null && u._id) && (m.value = !0, b.value = await Y().getAffectedMenu((g = V.data) == null ? void 0 : g._id), m.value = !1);
|
|
47
|
-
}
|
|
48
|
-
return (u, g) => {
|
|
49
|
-
const n = A("FmSpacer"), t = A("FmCircularProgress");
|
|
50
|
-
return B(), R(oe, null, [
|
|
51
|
-
v("p", null, N(u.message), 1),
|
|
52
|
-
m.value ? (B(), R("div", mn, [
|
|
53
|
-
k(n),
|
|
54
|
-
v("div", null, [
|
|
55
|
-
k(t, { size: "xl" })
|
|
56
|
-
]),
|
|
57
|
-
g[0] || (g[0] = v("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
58
|
-
k(n)
|
|
59
|
-
])) : (B(), R("div", cn, [
|
|
60
|
-
g[2] || (g[2] = v("br", null, null, -1)),
|
|
61
|
-
b.value.length > 0 ? (B(), R("div", pn, [
|
|
62
|
-
g[1] || (g[1] = v("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
|
|
63
|
-
k(Ve, {
|
|
64
|
-
name: "Menu",
|
|
65
|
-
bindings: b.value
|
|
66
|
-
}, null, 8, ["bindings"])
|
|
67
|
-
])) : E("", !0)
|
|
68
|
-
]))
|
|
69
|
-
], 64);
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}), de = Ne("recipeForm", function() {
|
|
73
|
-
const V = me(), b = ce(), m = Y(), d = G(!1), u = G();
|
|
74
|
-
function g() {
|
|
75
|
-
const e = {
|
|
76
|
-
recipe: {},
|
|
77
|
-
mode: z.CREATE,
|
|
78
|
-
show: !0,
|
|
79
|
-
"onUpdate:show"(i) {
|
|
80
|
-
u.value.show = i;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
u.value = e;
|
|
84
|
-
}
|
|
85
|
-
async function n(e) {
|
|
86
|
-
const i = {
|
|
87
|
-
recipe: ue(e),
|
|
88
|
-
mode: z.UPDATE,
|
|
89
|
-
show: !0,
|
|
90
|
-
"onUpdate:show"(r) {
|
|
91
|
-
u.value.show = r;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
u.value = i;
|
|
95
|
-
}
|
|
96
|
-
async function t(e) {
|
|
97
|
-
d.value = !0;
|
|
98
|
-
try {
|
|
99
|
-
await m.deleteRecipe(e), b.open({
|
|
100
|
-
title: "Success",
|
|
101
|
-
message: `Deleted ${e.name}`,
|
|
102
|
-
type: "success"
|
|
103
|
-
});
|
|
104
|
-
} catch (i) {
|
|
105
|
-
i instanceof Te && Me(i) ? V.open({
|
|
106
|
-
title: "Cannot delete recipe",
|
|
107
|
-
contentComponent: ze,
|
|
108
|
-
contentComponentProps: {
|
|
109
|
-
subject: (e == null ? void 0 : e.name) ?? "",
|
|
110
|
-
items: i.errorResponse.message
|
|
111
|
-
},
|
|
112
|
-
secondaryActions: {
|
|
113
|
-
text: "Close",
|
|
114
|
-
close: !0
|
|
115
|
-
}
|
|
116
|
-
}) : console.log("unable to delete recipe", i), b.open({
|
|
117
|
-
title: `Cannot delete ${e == null ? void 0 : e.name}`,
|
|
118
|
-
message: "Please try again.",
|
|
119
|
-
type: "error"
|
|
120
|
-
}), console.error("failed to delete recipe", i);
|
|
121
|
-
} finally {
|
|
122
|
-
d.value = !1;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function o(e) {
|
|
126
|
-
V.open({
|
|
127
|
-
title: `Delete ${(e == null ? void 0 : e.name) ?? "recipe"}?`,
|
|
128
|
-
closeButton: !1,
|
|
129
|
-
primaryActions: {
|
|
130
|
-
text: "Delete",
|
|
131
|
-
close: !0,
|
|
132
|
-
variant: "destructive"
|
|
133
|
-
},
|
|
134
|
-
secondaryActions: {
|
|
135
|
-
text: "Cancel",
|
|
136
|
-
close: !0
|
|
137
|
-
},
|
|
138
|
-
contentComponent: fn,
|
|
139
|
-
contentComponentProps: {
|
|
140
|
-
type: "menu",
|
|
141
|
-
data: e,
|
|
142
|
-
message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
|
|
143
|
-
}
|
|
144
|
-
}).onPrimary(() => t(e));
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
createRecipe: g,
|
|
148
|
-
updateRecipe: n,
|
|
149
|
-
deleteRecipe: o,
|
|
150
|
-
recipeDialogProps: u,
|
|
151
|
-
recipeViewLoading: d
|
|
152
|
-
};
|
|
153
|
-
});
|
|
154
|
-
function vn() {
|
|
155
|
-
const { updateRecipe: p, deleteRecipe: V } = de(), b = Y(), { t: m } = Q();
|
|
156
|
-
async function d(t, o) {
|
|
157
|
-
const e = ue(o);
|
|
158
|
-
if (t === te.Edit) {
|
|
159
|
-
await p(e);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
if (t === te.Delete) {
|
|
163
|
-
await V(e);
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
function u(t, o) {
|
|
168
|
-
const e = t.filter((_) => _.type === ie.enum.SKU), i = t.filter(
|
|
169
|
-
(_) => _.type === ie.enum.SKU_GROUP
|
|
170
|
-
), r = t.filter((_) => _.type === ie.enum.RECIPE);
|
|
171
|
-
return [
|
|
172
|
-
...e.map((_) => ({ ..._, recipeIds: [...o] })),
|
|
173
|
-
...i.map((_) => ({ ..._, isGroup: !0, recipeIds: [...o] })),
|
|
174
|
-
...r.filter((_) => b.recipeById[_.id] && !o.has(_.id)).flatMap(
|
|
175
|
-
(_) => u(b.recipeById[_.id].contains, /* @__PURE__ */ new Set([...o, _.id]))
|
|
176
|
-
)
|
|
177
|
-
];
|
|
178
|
-
}
|
|
179
|
-
const g = [
|
|
180
|
-
{
|
|
181
|
-
accessorKey: "recipe",
|
|
182
|
-
header: () => m("inventory.recipe.name"),
|
|
183
|
-
size: 400
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
accessorKey: "ingredients",
|
|
187
|
-
header: () => m("inventory.recipe.ingredients"),
|
|
188
|
-
size: "auto"
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
id: "action",
|
|
192
|
-
header: "",
|
|
193
|
-
cell(t) {
|
|
194
|
-
return Le(
|
|
195
|
-
[be[te.Edit], be[te.Delete]],
|
|
196
|
-
(o) => {
|
|
197
|
-
d(o, t.row.original.original);
|
|
198
|
-
}
|
|
199
|
-
);
|
|
200
|
-
},
|
|
201
|
-
enableSorting: !1,
|
|
202
|
-
size: 40,
|
|
203
|
-
meta: {
|
|
204
|
-
cellClass: "",
|
|
205
|
-
headerClass: ""
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
];
|
|
209
|
-
function n(t) {
|
|
210
|
-
const o = Y();
|
|
211
|
-
return t.map((e) => ({
|
|
212
|
-
recipe: e.name,
|
|
213
|
-
ingredients: u(e.contains, /* @__PURE__ */ new Set([e._id])).map((i) => {
|
|
214
|
-
var _, y, l, s, x, C;
|
|
215
|
-
if (i.isGroup) {
|
|
216
|
-
const I = o.skuGroupById[i.id];
|
|
217
|
-
return i.recipeIds.slice(1).length ? `(${(_ = o.recipeById[i.recipeIds.at(-1) ?? ""]) == null ? void 0 : _.name}) ${I.name} (x ${j(i.amount)})` : `${I.name} (x${j(i.amount)})`;
|
|
218
|
-
}
|
|
219
|
-
const r = o.skuById[i.id];
|
|
220
|
-
return r ? i.recipeIds.slice(1).length ? `(${(y = o.recipeById[i.recipeIds.at(-1) ?? ""]) == null ? void 0 : y.name}) ${r.name} (${j(i.amount)}${((l = i.measurement) == null ? void 0 : l.abbrev) ?? ((s = r == null ? void 0 : r.unit) == null ? void 0 : s.abbrev)})` : `${r.name} (${j(i.amount)}${((x = i.measurement) == null ? void 0 : x.abbrev) ?? ((C = r == null ? void 0 : r.unit) == null ? void 0 : C.abbrev)})` : null;
|
|
221
|
-
}).filter((i) => i).join(", "),
|
|
222
|
-
original: e
|
|
223
|
-
}));
|
|
224
|
-
}
|
|
225
|
-
return { columnDefs: g, formatRowData: n };
|
|
226
|
-
}
|
|
227
|
-
function yn() {
|
|
228
|
-
const p = Y(), V = me();
|
|
229
|
-
async function b(u, g, n, t = []) {
|
|
230
|
-
var y, l;
|
|
231
|
-
const o = u.filter((s) => s.type === "SKU"), e = u.filter((s) => s.type !== "SKU"), i = /* @__PURE__ */ new Set();
|
|
232
|
-
if (n)
|
|
233
|
-
for (const s of p.skus)
|
|
234
|
-
!t.some((C) => C === s._id) && s._id !== n && !((l = (y = s.convert) == null ? void 0 : y.inventoryBindings) != null && l.some((C) => C.id === n)) || i.add(s._id);
|
|
235
|
-
const r = p.skus.map((s) => ({
|
|
236
|
-
label: s.name,
|
|
237
|
-
sublabel: `${s.code}${i.has(s._id) ? " (Cannot bind, will cause recursive binding)" : ""}`,
|
|
238
|
-
value: s,
|
|
239
|
-
disabled: i.has(s._id)
|
|
240
|
-
})), _ = r.filter(
|
|
241
|
-
(s) => o.find((x) => x.id === s.value._id) && !i.has(s.value._id)
|
|
242
|
-
).map((s) => s.value);
|
|
243
|
-
V.open({
|
|
244
|
-
title: "Select ingredients",
|
|
245
|
-
contentComponent: ae,
|
|
246
|
-
contentComponentProps: {
|
|
247
|
-
items: r,
|
|
248
|
-
modelValue: _,
|
|
249
|
-
virtualScroll: !0
|
|
250
|
-
},
|
|
251
|
-
primaryActions: {
|
|
252
|
-
text: "Confirm",
|
|
253
|
-
close: !0
|
|
254
|
-
},
|
|
255
|
-
secondaryActions: {
|
|
256
|
-
text: "Close",
|
|
257
|
-
close: !0,
|
|
258
|
-
variant: "tertiary"
|
|
259
|
-
}
|
|
260
|
-
}).onPrimary((s) => {
|
|
261
|
-
const x = [
|
|
262
|
-
...e,
|
|
263
|
-
...u.filter((C) => s.find((I) => I._id === C.id)),
|
|
264
|
-
...s.filter((C) => !u.find((I) => I.id === C._id)).map((C) => ({
|
|
265
|
-
type: "SKU",
|
|
266
|
-
id: C._id,
|
|
267
|
-
amount: {
|
|
268
|
-
amount: 1,
|
|
269
|
-
precision: 0
|
|
270
|
-
}
|
|
271
|
-
}))
|
|
272
|
-
];
|
|
273
|
-
g(x);
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
async function m(u, g, n = []) {
|
|
277
|
-
var _;
|
|
278
|
-
const t = u.filter((y) => y.type === "RECIPE"), o = u.filter((y) => y.type !== "RECIPE"), e = /* @__PURE__ */ new Set();
|
|
279
|
-
if (n.length)
|
|
280
|
-
for (const y of p.recipes) {
|
|
281
|
-
const l = ((_ = p.recipeBindingFlattenCache[y._id]) == null ? void 0 : _.inventoryBindings) ?? [], s = l.some(
|
|
282
|
-
(I) => I.bindingPaths.some((M) => n.some((H) => H === M.id))
|
|
283
|
-
), x = l.some(
|
|
284
|
-
(I) => "success" in I && n.includes(I.ingredient._id)
|
|
285
|
-
);
|
|
286
|
-
(n.some((I) => I === y._id) || s || x) && e.add(y._id);
|
|
287
|
-
}
|
|
288
|
-
const i = p.recipes.filter((y) => !n.includes(y._id)).map((y) => ({
|
|
289
|
-
label: y.name,
|
|
290
|
-
sublabel: e.has(y._id) ? "(Cannot bind, will cause recursive binding)" : `${y.contains.length} inventory bindings`,
|
|
291
|
-
value: y,
|
|
292
|
-
disabled: e.has(y._id)
|
|
293
|
-
})), r = i.filter(
|
|
294
|
-
(y) => t.find((l) => l.id === y.value._id) && !e.has(y.value._id)
|
|
295
|
-
).map((y) => y.value);
|
|
296
|
-
V.open({
|
|
297
|
-
title: "Select recipes",
|
|
298
|
-
contentComponent: ae,
|
|
299
|
-
contentComponentProps: {
|
|
300
|
-
items: i,
|
|
301
|
-
modelValue: r,
|
|
302
|
-
virtualScroll: !0
|
|
303
|
-
},
|
|
304
|
-
primaryActions: {
|
|
305
|
-
text: "Confirm",
|
|
306
|
-
close: !0
|
|
307
|
-
},
|
|
308
|
-
secondaryActions: {
|
|
309
|
-
text: "Close",
|
|
310
|
-
close: !0,
|
|
311
|
-
variant: "tertiary"
|
|
312
|
-
}
|
|
313
|
-
}).onPrimary((y) => {
|
|
314
|
-
const l = [
|
|
315
|
-
...u.filter((s) => y.find((x) => x._id === s.id)),
|
|
316
|
-
...y.filter((s) => !u.find((x) => x.id === s._id)).map((s) => ({
|
|
317
|
-
type: "RECIPE",
|
|
318
|
-
id: s._id,
|
|
319
|
-
amount: {
|
|
320
|
-
amount: 1,
|
|
321
|
-
precision: 0
|
|
322
|
-
}
|
|
323
|
-
})),
|
|
324
|
-
...o
|
|
325
|
-
];
|
|
326
|
-
g(l);
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
async function d(u, g, n = []) {
|
|
330
|
-
const t = u.filter((r) => r.type === "SKU_GROUP"), o = u.filter((r) => r.type !== "SKU_GROUP"), e = p.skuGroups.filter((r) => !n.includes(r._id)).map((r) => ({
|
|
331
|
-
label: r.name,
|
|
332
|
-
value: r
|
|
333
|
-
})), i = e.filter((r) => t.find((_) => _.id === r.value._id)).map((r) => r.value);
|
|
334
|
-
V.open({
|
|
335
|
-
title: "Select ingredient group",
|
|
336
|
-
contentComponent: ae,
|
|
337
|
-
contentComponentProps: {
|
|
338
|
-
items: e,
|
|
339
|
-
modelValue: i,
|
|
340
|
-
virtualScroll: !0
|
|
341
|
-
},
|
|
342
|
-
primaryActions: {
|
|
343
|
-
text: "Confirm",
|
|
344
|
-
close: !0
|
|
345
|
-
},
|
|
346
|
-
secondaryActions: {
|
|
347
|
-
text: "Close",
|
|
348
|
-
close: !0,
|
|
349
|
-
variant: "tertiary"
|
|
350
|
-
}
|
|
351
|
-
}).onPrimary((r) => {
|
|
352
|
-
const _ = [
|
|
353
|
-
...u.filter((y) => r.find((l) => l._id === y.id)),
|
|
354
|
-
...r.filter((y) => !u.find((l) => l.id === y._id)).map((y) => ({
|
|
355
|
-
type: "SKU_GROUP",
|
|
356
|
-
id: y._id,
|
|
357
|
-
amount: {
|
|
358
|
-
amount: 1,
|
|
359
|
-
precision: 0
|
|
360
|
-
}
|
|
361
|
-
})),
|
|
362
|
-
...o
|
|
363
|
-
];
|
|
364
|
-
g(_);
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
return {
|
|
368
|
-
promptIngredientsBinding: b,
|
|
369
|
-
promptRecipesBinding: m,
|
|
370
|
-
promptIngredientGroupsBinding: d
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
const bn = { class: "flex flex-col" }, gn = { class: "flex flex-col gap-4" }, Fe = /* @__PURE__ */ J({
|
|
374
|
-
__name: "InventoryBindingRule",
|
|
375
|
-
props: /* @__PURE__ */ Ie({
|
|
376
|
-
disabled: { type: Boolean },
|
|
377
|
-
modelValue: {},
|
|
378
|
-
minCount: {},
|
|
379
|
-
maxCount: {}
|
|
380
|
-
}, {
|
|
381
|
-
modelValue: {},
|
|
382
|
-
modelModifiers: {}
|
|
383
|
-
}),
|
|
384
|
-
emits: ["update:modelValue"],
|
|
385
|
-
setup(p) {
|
|
386
|
-
const V = p, { t: b } = Q(), m = Oe(), d = S(() => {
|
|
387
|
-
var o;
|
|
388
|
-
const n = /* @__PURE__ */ new Map(), t = m.restaurants.value.map((e) => e.customAttributes ?? {});
|
|
389
|
-
for (const e of t)
|
|
390
|
-
for (const [i, r] of Object.entries(e))
|
|
391
|
-
n.has(i) || n.set(i, /* @__PURE__ */ new Set()), r && ((o = n.get(i)) == null || o.add(r));
|
|
392
|
-
return n;
|
|
393
|
-
}), u = S(() => [
|
|
394
|
-
...[...d.value.entries()].map(([t, o]) => ({
|
|
395
|
-
type: "string",
|
|
396
|
-
key: t,
|
|
397
|
-
entity: "restaurant",
|
|
398
|
-
values: [...o]
|
|
399
|
-
}))
|
|
400
|
-
]), g = Ae(p, "modelValue");
|
|
401
|
-
return (n, t) => {
|
|
402
|
-
const o = A("FmLabel"), e = A("FmFormGroup");
|
|
403
|
-
return B(), R("div", bn, [
|
|
404
|
-
v("div", gn, [
|
|
405
|
-
k(o, {
|
|
406
|
-
label: a(b)("inventory.ingredientGroup.form.rules.title"),
|
|
407
|
-
required: n.minCount != null && n.minCount > 0
|
|
408
|
-
}, null, 8, ["label", "required"]),
|
|
409
|
-
k(a(Je), {
|
|
410
|
-
modelValue: g.value,
|
|
411
|
-
"onUpdate:modelValue": t[0] || (t[0] = (i) => g.value = i),
|
|
412
|
-
attributes: u.value
|
|
413
|
-
}, null, 8, ["modelValue", "attributes"])
|
|
414
|
-
]),
|
|
415
|
-
k(e, {
|
|
416
|
-
"model-value": g.value,
|
|
417
|
-
rules: [
|
|
418
|
-
(i) => {
|
|
419
|
-
const r = i ? 1 : 0;
|
|
420
|
-
return V.minCount !== void 0 && r < V.minCount ? a(b)("inventory.ingredientGroup.form.rules.validation.minCount", {
|
|
421
|
-
count: V.minCount
|
|
422
|
-
}) : V.maxCount !== void 0 && r > V.maxCount ? a(b)("inventory.ingredientGroup.form.rules.validation.maxCount", {
|
|
423
|
-
count: V.maxCount
|
|
424
|
-
}) : !0;
|
|
425
|
-
}
|
|
426
|
-
]
|
|
427
|
-
}, null, 8, ["model-value", "rules"])
|
|
428
|
-
]);
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
}), _n = { class: "border-1 mx-3 my-1 rounded-md" }, hn = { class: "flex flex-col w-full border-b border-fm-color-neutral-gray-100" }, Vn = {
|
|
432
|
-
class: "flex items-center",
|
|
433
|
-
style: { "min-height": "48px" }
|
|
434
|
-
}, kn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, xn = { class: "flex flex-col" }, Bn = { class: "line-clamp-1" }, wn = { class: "w-[200px]" }, Fn = {
|
|
435
|
-
key: 0,
|
|
436
|
-
class: "w-[52px]"
|
|
437
|
-
}, Cn = {
|
|
438
|
-
key: 0,
|
|
439
|
-
class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400 px-8"
|
|
440
|
-
}, In = { class: "px-12 pb-4" }, An = /* @__PURE__ */ J({
|
|
441
|
-
__name: "InventoryRecipeBindingV2Field",
|
|
442
|
-
props: {
|
|
443
|
-
disabled: { type: Boolean },
|
|
444
|
-
readonly: { type: Boolean },
|
|
445
|
-
modelValue: {},
|
|
446
|
-
displayName: {},
|
|
447
|
-
showError: { type: Boolean }
|
|
448
|
-
},
|
|
449
|
-
emits: ["update:modelValue", "delete", "settings"],
|
|
450
|
-
setup(p, { emit: V }) {
|
|
451
|
-
const b = V, { t: m } = Q(), d = we("modelValue"), u = G(""), g = S(() => +j(d.amount));
|
|
452
|
-
_e(
|
|
453
|
-
() => d.amount,
|
|
454
|
-
(o) => {
|
|
455
|
-
const e = j(o);
|
|
456
|
-
u.value !== e && (u.value = e);
|
|
457
|
-
},
|
|
458
|
-
{ immediate: !0 }
|
|
459
|
-
);
|
|
460
|
-
let n = null;
|
|
461
|
-
function t(o) {
|
|
462
|
-
u.value = o, n && clearTimeout(n), n = setTimeout(() => {
|
|
463
|
-
const e = +o;
|
|
464
|
-
o.length > 0 && isFinite(e) ? d.amount = ke(e) : d.amount = { amount: 0, precision: 0 };
|
|
465
|
-
}, 300);
|
|
466
|
-
}
|
|
467
|
-
return (o, e) => {
|
|
468
|
-
const i = A("FmTooltip"), r = A("FmTextField"), _ = A("FmButton"), y = A("FmIcon"), l = A("FmFormGroup");
|
|
469
|
-
return B(), R("div", _n, [
|
|
470
|
-
k(l, {
|
|
471
|
-
class: he(["mb-2"]),
|
|
472
|
-
disabled: o.disabled,
|
|
473
|
-
modelValue: g.value,
|
|
474
|
-
rules: [a(xe)(0), a(pe)(-1)]
|
|
475
|
-
}, {
|
|
476
|
-
default: K(({ invalid: s }) => [
|
|
477
|
-
v("div", hn, [
|
|
478
|
-
v("div", Vn, [
|
|
479
|
-
v("div", kn, [
|
|
480
|
-
v("div", xn, [
|
|
481
|
-
k(i, {
|
|
482
|
-
zIndex: 51,
|
|
483
|
-
variant: "plain",
|
|
484
|
-
placement: "top",
|
|
485
|
-
content: o.displayName
|
|
486
|
-
}, {
|
|
487
|
-
default: K(() => [
|
|
488
|
-
v("span", Bn, N(o.displayName), 1)
|
|
489
|
-
]),
|
|
490
|
-
_: 1
|
|
491
|
-
}, 8, ["content"])
|
|
492
|
-
])
|
|
493
|
-
]),
|
|
494
|
-
v("div", wn, [
|
|
495
|
-
k(r, {
|
|
496
|
-
class: "w-full",
|
|
497
|
-
disabled: o.disabled,
|
|
498
|
-
modelValue: u.value,
|
|
499
|
-
"onUpdate:modelValue": e[0] || (e[0] = (x) => t(x)),
|
|
500
|
-
invalid: s
|
|
501
|
-
}, null, 8, ["disabled", "modelValue", "invalid"])
|
|
502
|
-
]),
|
|
503
|
-
o.readonly ? E("", !0) : (B(), R("div", Fn, [
|
|
504
|
-
k(_, {
|
|
505
|
-
disabled: o.disabled,
|
|
506
|
-
type: "button",
|
|
507
|
-
variant: "plain",
|
|
508
|
-
icon: "delete",
|
|
509
|
-
"icon-color": "#000000",
|
|
510
|
-
onClick: e[1] || (e[1] = () => b("delete", a(d).id))
|
|
511
|
-
}, null, 8, ["disabled"])
|
|
512
|
-
]))
|
|
513
|
-
]),
|
|
514
|
-
o.showError ? (B(), R("div", Cn, [
|
|
515
|
-
k(y, {
|
|
516
|
-
name: "error",
|
|
517
|
-
color: "system-error-300",
|
|
518
|
-
size: "sm"
|
|
519
|
-
}),
|
|
520
|
-
v("div", null, N(a(m)("inventory.inventoryBindings.circularError")), 1)
|
|
521
|
-
])) : E("", !0)
|
|
522
|
-
])
|
|
523
|
-
]),
|
|
524
|
-
_: 1
|
|
525
|
-
}, 8, ["disabled", "modelValue", "rules"]),
|
|
526
|
-
v("div", In, [
|
|
527
|
-
k(Fe, {
|
|
528
|
-
modelValue: a(d).rules,
|
|
529
|
-
"onUpdate:modelValue": e[2] || (e[2] = (s) => a(d).rules = s),
|
|
530
|
-
disabled: o.disabled
|
|
531
|
-
}, null, 8, ["modelValue", "disabled"])
|
|
532
|
-
])
|
|
533
|
-
]);
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
function Rn(p) {
|
|
538
|
-
const V = en(), { t: b } = nn(), m = Y(), d = S(() => [
|
|
539
|
-
{
|
|
540
|
-
id: "delete",
|
|
541
|
-
header: "",
|
|
542
|
-
cell(n) {
|
|
543
|
-
const t = n.row.original;
|
|
544
|
-
return O(
|
|
545
|
-
"div",
|
|
546
|
-
{ class: "w-full flex justify-end" },
|
|
547
|
-
O(ee.FmButton, {
|
|
548
|
-
class: "delete-button",
|
|
549
|
-
key: t._id,
|
|
550
|
-
type: "button",
|
|
551
|
-
icon: "delete",
|
|
552
|
-
variant: "tertiary",
|
|
553
|
-
size: "md",
|
|
554
|
-
disabled: p.disabled ?? !1,
|
|
555
|
-
onClick: () => {
|
|
556
|
-
p.bindingAlternatives = p.bindingAlternatives.filter(
|
|
557
|
-
(o) => o._id !== t._id
|
|
558
|
-
);
|
|
559
|
-
}
|
|
560
|
-
})
|
|
561
|
-
);
|
|
562
|
-
},
|
|
563
|
-
enableSorting: !1,
|
|
564
|
-
size: 40,
|
|
565
|
-
meta: {
|
|
566
|
-
cellClass: "",
|
|
567
|
-
headerClass: ""
|
|
568
|
-
}
|
|
569
|
-
},
|
|
570
|
-
{
|
|
571
|
-
id: "alternative",
|
|
572
|
-
header: () => b("inventory.inventoryBindings.alternativeTable.ingredient"),
|
|
573
|
-
accessorFn: (n) => {
|
|
574
|
-
var t, o;
|
|
575
|
-
return `${((t = m.skuById[n._id]) == null ? void 0 : t.name) ?? ""} (${((o = m.skuById[n._id]) == null ? void 0 : o.code) ?? ""})`;
|
|
576
|
-
},
|
|
577
|
-
cell: ({ row: n }) => {
|
|
578
|
-
const t = m.skuById[n.original._id];
|
|
579
|
-
return O(
|
|
580
|
-
"div",
|
|
581
|
-
{
|
|
582
|
-
class: "w-full flex flex-col"
|
|
583
|
-
},
|
|
584
|
-
[
|
|
585
|
-
O("div", { class: "fm-typo-en-body-lg-400 line-clamp-1" }, t.name),
|
|
586
|
-
O(
|
|
587
|
-
"div",
|
|
588
|
-
{ class: "fm-typo-en-body-md-400 line-clamp-1 text-fm-color-typo-secondary" },
|
|
589
|
-
t.code
|
|
590
|
-
)
|
|
591
|
-
]
|
|
592
|
-
);
|
|
593
|
-
},
|
|
594
|
-
size: "auto",
|
|
595
|
-
enableSorting: !1
|
|
596
|
-
},
|
|
597
|
-
{
|
|
598
|
-
id: "unit",
|
|
599
|
-
header: () => b("inventory.inventoryBindings.alternativeTable.unit"),
|
|
600
|
-
accessorFn: (n) => {
|
|
601
|
-
const t = m.skuById[n._id];
|
|
602
|
-
return t.unit.measurements.computeFirst(
|
|
603
|
-
(o) => o.id === n.trackingMeasurement ? o.name : null
|
|
604
|
-
) ?? t.unit.name;
|
|
605
|
-
},
|
|
606
|
-
enableSorting: !1
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
id: "unitOption",
|
|
610
|
-
header: () => b("inventory.inventoryBindings.alternativeTable.unit"),
|
|
611
|
-
accessorKey: "trackingMeasurement",
|
|
612
|
-
cell(n) {
|
|
613
|
-
const t = m.skuById[n.row.original._id];
|
|
614
|
-
if (!t) return null;
|
|
615
|
-
const o = [
|
|
616
|
-
{
|
|
617
|
-
label: t.unit.name,
|
|
618
|
-
sublabel: t.unit.abbrev,
|
|
619
|
-
value: null
|
|
620
|
-
},
|
|
621
|
-
...t.unit.measurements.map((e) => ({
|
|
622
|
-
label: `${e.name} (${e.abbrev})`,
|
|
623
|
-
sublabel: b("inventory.inventoryBindings.alternativeTable.measurementOption"),
|
|
624
|
-
value: e.id
|
|
625
|
-
}))
|
|
626
|
-
].filter((e) => !e.label.toLowerCase().includes("inactive"));
|
|
627
|
-
return O(ee.FmSelect, {
|
|
628
|
-
modelValue: n.row.original.trackingMeasurement ?? null,
|
|
629
|
-
items: o,
|
|
630
|
-
disabled: p.disabled ?? !1,
|
|
631
|
-
"onUpdate:modelValue": (e) => {
|
|
632
|
-
p.bindingAlternatives = p.bindingAlternatives.map((i) => i._id === n.row.original._id ? { ...i, trackingMeasurement: e } : i);
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
},
|
|
636
|
-
enableSorting: !1
|
|
637
|
-
},
|
|
638
|
-
{
|
|
639
|
-
id: "priority",
|
|
640
|
-
header: () => b("inventory.inventoryBindings.alternativeTable.priority"),
|
|
641
|
-
accessorKey: "priority",
|
|
642
|
-
enableSorting: !0,
|
|
643
|
-
cell(n) {
|
|
644
|
-
const t = n.row.original;
|
|
645
|
-
return O(ee.FmTextField, {
|
|
646
|
-
modelValue: t.priority ?? n.row.index + 1,
|
|
647
|
-
rules: [
|
|
648
|
-
qe(),
|
|
649
|
-
re(1),
|
|
650
|
-
Be(
|
|
651
|
-
p.bindingAlternatives.filter((o) => o._id !== t._id).map((o) => {
|
|
652
|
-
const e = m.skuById[o._id];
|
|
653
|
-
return {
|
|
654
|
-
label: e == null ? void 0 : e.name,
|
|
655
|
-
value: o.priority
|
|
656
|
-
};
|
|
657
|
-
})
|
|
658
|
-
)
|
|
659
|
-
],
|
|
660
|
-
"onUpdate:modelValue": (o) => {
|
|
661
|
-
const e = Number(o);
|
|
662
|
-
isNaN(e) || (p.bindingAlternatives = p.bindingAlternatives.map((i) => i._id === n.row.original._id ? { ...i, priority: e } : i));
|
|
663
|
-
}
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
id: "default",
|
|
669
|
-
header: () => "",
|
|
670
|
-
accessorKey: "default",
|
|
671
|
-
cell(n) {
|
|
672
|
-
const t = m.skuById[n.row.original._id];
|
|
673
|
-
return t ? O(ee.FmCheckbox, {
|
|
674
|
-
modelValue: n.row.original.default ?? !1,
|
|
675
|
-
value: t._id,
|
|
676
|
-
disabled: p.disabled ?? !1,
|
|
677
|
-
"onUpdate:modelValue": () => {
|
|
678
|
-
p.bindingAlternatives = p.bindingAlternatives.map((o) => o._id === n.row.original._id ? { ...o, default: !0 } : { ...o, default: !1 });
|
|
679
|
-
}
|
|
680
|
-
}) : null;
|
|
681
|
-
},
|
|
682
|
-
enableSorting: !1,
|
|
683
|
-
size: 40,
|
|
684
|
-
meta: {
|
|
685
|
-
cellClass: "",
|
|
686
|
-
headerClass: ""
|
|
687
|
-
}
|
|
688
|
-
},
|
|
689
|
-
{
|
|
690
|
-
id: "move",
|
|
691
|
-
header: "",
|
|
692
|
-
cell(n) {
|
|
693
|
-
const t = n.row.original;
|
|
694
|
-
return O("div", { class: "w-full flex justify-end" }, [
|
|
695
|
-
O(ee.FmButton, {
|
|
696
|
-
key: t._id,
|
|
697
|
-
type: "button",
|
|
698
|
-
icon: "keyboard_arrow_up",
|
|
699
|
-
variant: "tertiary",
|
|
700
|
-
size: "md",
|
|
701
|
-
disabled: p.disabled ?? !1,
|
|
702
|
-
onClick: () => {
|
|
703
|
-
const o = [...p.bindingAlternatives], e = o.findIndex((i) => i._id === t._id);
|
|
704
|
-
if (e > 0) {
|
|
705
|
-
const i = o[e - 1];
|
|
706
|
-
o[e - 1] = t, o[e] = i;
|
|
707
|
-
}
|
|
708
|
-
p.bindingAlternatives = [...o];
|
|
709
|
-
}
|
|
710
|
-
}),
|
|
711
|
-
O(ee.FmButton, {
|
|
712
|
-
key: t._id,
|
|
713
|
-
type: "button",
|
|
714
|
-
icon: "keyboard_arrow_down",
|
|
715
|
-
variant: "tertiary",
|
|
716
|
-
size: "md",
|
|
717
|
-
disabled: p.disabled ?? !1,
|
|
718
|
-
onClick: () => {
|
|
719
|
-
const o = [...p.bindingAlternatives], e = o.findIndex((i) => i._id === t._id);
|
|
720
|
-
if (e < o.length - 1) {
|
|
721
|
-
const i = o[e + 1];
|
|
722
|
-
o[e + 1] = t, o[e] = i;
|
|
723
|
-
}
|
|
724
|
-
p.bindingAlternatives = [...o];
|
|
725
|
-
}
|
|
726
|
-
})
|
|
727
|
-
]);
|
|
728
|
-
},
|
|
729
|
-
enableSorting: !1,
|
|
730
|
-
size: 40,
|
|
731
|
-
meta: {
|
|
732
|
-
cellClass: "",
|
|
733
|
-
headerClass: ""
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
]);
|
|
737
|
-
return {
|
|
738
|
-
get columnDefs() {
|
|
739
|
-
return d.value;
|
|
740
|
-
},
|
|
741
|
-
promptAddIngredient: async (g) => {
|
|
742
|
-
const n = [];
|
|
743
|
-
for (const e of m.skus)
|
|
744
|
-
g.includes(e._id) || n.push({
|
|
745
|
-
label: e.name,
|
|
746
|
-
sublabel: e.code,
|
|
747
|
-
value: e._id,
|
|
748
|
-
disabled: g.includes(e._id)
|
|
749
|
-
});
|
|
750
|
-
const t = (p.bindingAlternatives ?? []).map((e) => e._id), o = await V.multiSelect(n, t, (e) => {
|
|
751
|
-
var r, _, y, l, s, x;
|
|
752
|
-
const i = (r = p.bindingAlternatives) == null ? void 0 : r.findIndex((C) => C._id === e);
|
|
753
|
-
return {
|
|
754
|
-
_id: e,
|
|
755
|
-
trackingMeasurement: typeof i != "number" || i == -1 ? (_ = m.skuById[e]) == null ? void 0 : _.trackingMeasurement : (l = (y = p.bindingAlternatives) == null ? void 0 : y[i]) == null ? void 0 : l.trackingMeasurement,
|
|
756
|
-
priority: ((x = (s = p.bindingAlternatives) == null ? void 0 : s[i]) == null ? void 0 : x.priority) ?? p.bindingAlternatives.length,
|
|
757
|
-
default: !1
|
|
758
|
-
};
|
|
759
|
-
});
|
|
760
|
-
p.bindingAlternatives = o ?? p.bindingAlternatives;
|
|
761
|
-
},
|
|
762
|
-
columnVisibility: {
|
|
763
|
-
delete: !0,
|
|
764
|
-
unit: !1,
|
|
765
|
-
unitOption: !0,
|
|
766
|
-
default: !1,
|
|
767
|
-
// previous demo: sort priority by moving sku element in the array,
|
|
768
|
-
// new demo: sort priority using priority field.
|
|
769
|
-
// can reenable if this use case is requested to be restored
|
|
770
|
-
move: !1
|
|
771
|
-
}
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
|
-
const Sn = { class: "flex flex-col gap-16" }, $n = { class: "flex flex-col" }, En = { class: "flex justify-between items-center px-2" }, Tn = /* @__PURE__ */ J({
|
|
775
|
-
__name: "InventoryBindingAlternative",
|
|
776
|
-
props: {
|
|
777
|
-
disabled: { type: Boolean },
|
|
778
|
-
modelValue: {},
|
|
779
|
-
filterIngredientIds: {}
|
|
780
|
-
},
|
|
781
|
-
emits: ["update:modelValue"],
|
|
782
|
-
setup(p, { emit: V }) {
|
|
783
|
-
const b = p, m = V, { t: d } = Q(), u = Rn({
|
|
784
|
-
get disabled() {
|
|
785
|
-
return b.disabled ?? !1;
|
|
786
|
-
},
|
|
787
|
-
get bindingAlternatives() {
|
|
788
|
-
return b.modelValue ?? [];
|
|
789
|
-
},
|
|
790
|
-
set bindingAlternatives(t) {
|
|
791
|
-
m("update:modelValue", t);
|
|
792
|
-
}
|
|
793
|
-
}), g = (t) => t && t.some((o) => b.filterIngredientIds.includes(o._id)) ? "Contains invalid ingredient" : !0, n = (t) => t && t.length > 5 ? d("inventory.binding.alternative.maximumExceeded", { max: 5 }) : !0;
|
|
794
|
-
return (t, o) => {
|
|
795
|
-
var y;
|
|
796
|
-
const e = A("FmLabel"), i = A("FmButton"), r = A("FmFormGroup"), _ = A("FmTable");
|
|
797
|
-
return B(), R("div", Sn, [
|
|
798
|
-
v("div", $n, [
|
|
799
|
-
v("div", En, [
|
|
800
|
-
k(e, {
|
|
801
|
-
label: a(d)("inventory.alternatives")
|
|
802
|
-
}, null, 8, ["label"]),
|
|
803
|
-
k(i, {
|
|
804
|
-
disabled: t.disabled,
|
|
805
|
-
"prepend-icon": "link",
|
|
806
|
-
variant: "primary",
|
|
807
|
-
class: "border-1 rounded-lg border-fm-color-primary",
|
|
808
|
-
onClick: o[0] || (o[0] = (l) => a(u).promptAddIngredient(t.filterIngredientIds)),
|
|
809
|
-
size: "md"
|
|
810
|
-
}, null, 8, ["disabled"])
|
|
811
|
-
]),
|
|
812
|
-
k(r, {
|
|
813
|
-
"model-value": t.modelValue,
|
|
814
|
-
rules: [g, n]
|
|
815
|
-
}, null, 8, ["model-value", "rules"])
|
|
816
|
-
]),
|
|
817
|
-
k(_, {
|
|
818
|
-
"row-data": t.modelValue ?? [],
|
|
819
|
-
"column-defs": a(u).columnDefs,
|
|
820
|
-
"page-size": ((y = t.modelValue) == null ? void 0 : y.length) || 0,
|
|
821
|
-
"shrink-at": 9999,
|
|
822
|
-
"column-visibility": a(u).columnVisibility,
|
|
823
|
-
"hide-footer": ""
|
|
824
|
-
}, null, 8, ["row-data", "column-defs", "page-size", "column-visibility"])
|
|
825
|
-
]);
|
|
826
|
-
};
|
|
827
|
-
}
|
|
828
|
-
}), Un = { class: "border-1 mx-3 my-1 rounded-md" }, Pn = { class: "flex flex-col border-b border-fm-color-neutral-gray-100" }, Dn = {
|
|
829
|
-
class: "flex items-center w-full",
|
|
830
|
-
style: { "min-height": "48px" }
|
|
831
|
-
}, Gn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, Mn = { class: "line-clamp-1 w-full" }, zn = { class: "w-[150px]" }, Nn = {
|
|
832
|
-
key: 0,
|
|
833
|
-
class: "w-[52px]"
|
|
834
|
-
}, Kn = { class: "flex flex-col px-12 pb-4" }, Ln = /* @__PURE__ */ J({
|
|
835
|
-
__name: "InventorySkuBindingV2Field",
|
|
836
|
-
props: {
|
|
837
|
-
disabled: { type: Boolean },
|
|
838
|
-
readonly: { type: Boolean },
|
|
839
|
-
modelValue: {},
|
|
840
|
-
displayName: {},
|
|
841
|
-
unit: {},
|
|
842
|
-
showError: { type: Boolean },
|
|
843
|
-
ableToConfigureAlternative: { type: Boolean },
|
|
844
|
-
ableToApplyRules: { type: Boolean }
|
|
845
|
-
},
|
|
846
|
-
emits: ["update:modelValue", "delete", "settings"],
|
|
847
|
-
setup(p, { emit: V }) {
|
|
848
|
-
const b = V, { t: m } = Q(), d = we("modelValue");
|
|
849
|
-
function u(n) {
|
|
850
|
-
n && (d.amount = n.amount, d.measurement = n.measurement);
|
|
851
|
-
}
|
|
852
|
-
function g() {
|
|
853
|
-
return {
|
|
854
|
-
modelValue: {
|
|
855
|
-
amount: d.amount,
|
|
856
|
-
measurement: d.measurement
|
|
857
|
-
},
|
|
858
|
-
amountAsString: tn.toFormatString({
|
|
859
|
-
value: d.amount
|
|
860
|
-
})
|
|
861
|
-
};
|
|
862
|
-
}
|
|
863
|
-
return (n, t) => {
|
|
864
|
-
const o = A("FmTooltip"), e = A("FmButton"), i = A("FmFormGroup");
|
|
865
|
-
return B(), R("div", Un, [
|
|
866
|
-
v("div", Pn, [
|
|
867
|
-
v("div", Dn, [
|
|
868
|
-
v("div", Gn, [
|
|
869
|
-
k(o, {
|
|
870
|
-
zIndex: 51,
|
|
871
|
-
variant: "plain",
|
|
872
|
-
placement: "top",
|
|
873
|
-
content: n.displayName
|
|
874
|
-
}, {
|
|
875
|
-
default: K(() => [
|
|
876
|
-
v("span", Mn, N(n.displayName), 1)
|
|
877
|
-
]),
|
|
878
|
-
_: 1
|
|
879
|
-
}, 8, ["content"])
|
|
880
|
-
]),
|
|
881
|
-
v("div", zn, [
|
|
882
|
-
k(Qe, {
|
|
883
|
-
"model-value": { amount: a(d).amount, measurement: a(d).measurement },
|
|
884
|
-
"onUpdate:modelValue": u,
|
|
885
|
-
unit: n.unit,
|
|
886
|
-
placement: "bottom",
|
|
887
|
-
"convert-amount-on-change-unit": "",
|
|
888
|
-
disabled: n.readonly
|
|
889
|
-
}, null, 8, ["model-value", "unit", "disabled"])
|
|
890
|
-
]),
|
|
891
|
-
n.readonly ? E("", !0) : (B(), R("div", Nn, [
|
|
892
|
-
k(e, {
|
|
893
|
-
disabled: n.disabled,
|
|
894
|
-
type: "button",
|
|
895
|
-
variant: "tertiary",
|
|
896
|
-
icon: "delete",
|
|
897
|
-
onClick: t[0] || (t[0] = () => b("delete", a(d).id))
|
|
898
|
-
}, null, 8, ["disabled"])
|
|
899
|
-
]))
|
|
900
|
-
]),
|
|
901
|
-
v("div", Kn, [
|
|
902
|
-
k(i, {
|
|
903
|
-
modelValue: a(d).amount,
|
|
904
|
-
rules: [a(pe)(0)]
|
|
905
|
-
}, null, 8, ["modelValue", "rules"]),
|
|
906
|
-
k(i, {
|
|
907
|
-
modelValue: g(),
|
|
908
|
-
rules: [
|
|
909
|
-
a(Xe)(),
|
|
910
|
-
a(Ze)(n.unit),
|
|
911
|
-
() => n.showError ? a(m)("inventory.inventoryBindings.invalidWarning") : !0
|
|
912
|
-
]
|
|
913
|
-
}, null, 8, ["modelValue", "rules"])
|
|
914
|
-
]),
|
|
915
|
-
n.ableToApplyRules ? (B(), D(Fe, {
|
|
916
|
-
key: 0,
|
|
917
|
-
modelValue: a(d).rules,
|
|
918
|
-
"onUpdate:modelValue": t[1] || (t[1] = (r) => a(d).rules = r),
|
|
919
|
-
disabled: n.disabled
|
|
920
|
-
}, null, 8, ["modelValue", "disabled"])) : E("", !0),
|
|
921
|
-
n.ableToConfigureAlternative ? (B(), D(Tn, {
|
|
922
|
-
key: 1,
|
|
923
|
-
modelValue: a(d).alternatives,
|
|
924
|
-
"onUpdate:modelValue": t[2] || (t[2] = (r) => a(d).alternatives = r),
|
|
925
|
-
disabled: n.disabled,
|
|
926
|
-
filterIngredientIds: [a(d).id]
|
|
927
|
-
}, null, 8, ["modelValue", "disabled", "filterIngredientIds"])) : E("", !0)
|
|
928
|
-
])
|
|
929
|
-
]);
|
|
930
|
-
};
|
|
931
|
-
}
|
|
932
|
-
});
|
|
933
|
-
exports.FfCalculator;
|
|
934
|
-
const On = { class: "flex flex-col gap-24" }, jn = {
|
|
935
|
-
key: 0,
|
|
936
|
-
class: "flex flex-col gap-16"
|
|
937
|
-
}, Yn = { class: "flex items-center" }, qn = { class: "flex-1 fm-typo-en-title-sm-600" }, Hn = { 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" }, Jn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Qn = {
|
|
938
|
-
key: 0,
|
|
939
|
-
class: "w-[52px]"
|
|
940
|
-
}, Xn = {
|
|
941
|
-
key: 1,
|
|
942
|
-
class: "w-[52px]"
|
|
943
|
-
}, Zn = {
|
|
944
|
-
key: 1,
|
|
945
|
-
class: "flex flex-col gap-16"
|
|
946
|
-
}, et = { class: "flex items-center" }, nt = { class: "flex-1 fm-typo-en-title-sm-600" }, tt = { class: "flex flex-col" }, ot = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, it = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, lt = { class: "flex flex-col w-full border-b border-fm-color-neutral-gray-100" }, st = {
|
|
947
|
-
key: 0,
|
|
948
|
-
class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400"
|
|
949
|
-
}, at = {
|
|
950
|
-
class: "flex items-center",
|
|
951
|
-
style: { "min-height": "48px" }
|
|
952
|
-
}, rt = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, dt = { class: "flex flex-col" }, ut = { class: "w-[200px]" }, mt = {
|
|
953
|
-
key: 0,
|
|
954
|
-
class: "w-[52px]"
|
|
955
|
-
}, ct = { class: "flex flex-col gap-16" }, pt = { class: "flex items-center" }, ft = { class: "flex-1 fm-typo-en-title-sm-600" }, vt = { class: "flex flex-col" }, yt = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, bt = { class: "flex-1 fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, gt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary w-[150px] px-16" }, _t = {
|
|
956
|
-
key: 0,
|
|
957
|
-
class: "w-[52px]"
|
|
958
|
-
}, ht = /* @__PURE__ */ J({
|
|
959
|
-
__name: "InventoryBindingFormV2",
|
|
960
|
-
props: {
|
|
961
|
-
id: {},
|
|
962
|
-
modelValue: { default: () => [] },
|
|
963
|
-
excludeBindingId: {},
|
|
964
|
-
rules: { default: () => [] },
|
|
965
|
-
iframeMode: { type: Boolean },
|
|
966
|
-
disabled: { type: Boolean },
|
|
967
|
-
readonly: { type: Boolean },
|
|
968
|
-
recipeBindingConfig: { default: () => ({ enabled: !0, ableToApplyRules: !1 }) },
|
|
969
|
-
skuBindingConfig: { default: () => ({
|
|
970
|
-
enabled: !0,
|
|
971
|
-
ableToApplyRules: !1,
|
|
972
|
-
ableToConfigureAlternative: !1
|
|
973
|
-
}) },
|
|
974
|
-
enableIngredientGroup: { type: Boolean }
|
|
975
|
-
},
|
|
976
|
-
emits: ["update:modelValue", "click:pick-inventory-bindings"],
|
|
977
|
-
setup(p, { emit: V }) {
|
|
978
|
-
const { t: b } = Q(), m = Y(), d = S(() => m.recipeById), u = S(() => m.skuById), g = S(() => m.skuGroupById), n = p, t = V, o = S(() => Ue({
|
|
979
|
-
parentId: n.id,
|
|
980
|
-
bindings: n.modelValue,
|
|
981
|
-
recipes: m.recipes.map((F) => F._id === n.id ? {
|
|
982
|
-
...F,
|
|
983
|
-
contains: n.modelValue
|
|
984
|
-
} : F),
|
|
985
|
-
skus: m.skus.map((F) => F._id === n.id ? {
|
|
986
|
-
...F,
|
|
987
|
-
convert: {
|
|
988
|
-
inventoryBindings: n.modelValue
|
|
989
|
-
}
|
|
990
|
-
} : F),
|
|
991
|
-
skuGroups: m.skuGroups
|
|
992
|
-
}).inventoryBindings.filter((F) => "error" in F && F.error).map((F) => F).filter((F) => F.reason === Pe.enum.circularDependency)), e = S(
|
|
993
|
-
() => new Set(o.value.map((f) => {
|
|
994
|
-
var w;
|
|
995
|
-
return (w = f.bindingPaths[0]) == null ? void 0 : w.id;
|
|
996
|
-
}))
|
|
997
|
-
), i = S(() => n.modelValue.filter((f) => f.type === "RECIPE")), { promptIngredientsBinding: r, promptRecipesBinding: _, promptIngredientGroupsBinding: y } = yn();
|
|
998
|
-
async function l() {
|
|
999
|
-
if (n.iframeMode) {
|
|
1000
|
-
t("click:pick-inventory-bindings", "RECIPE");
|
|
1001
|
-
return;
|
|
1002
|
-
}
|
|
1003
|
-
_(
|
|
1004
|
-
n.modelValue,
|
|
1005
|
-
(f) => t("update:modelValue", f),
|
|
1006
|
-
n.id ? [n.id] : []
|
|
1007
|
-
);
|
|
1008
|
-
}
|
|
1009
|
-
const s = S(() => n.modelValue.filter((f) => f.type === "SKU_GROUP"));
|
|
1010
|
-
async function x() {
|
|
1011
|
-
y(
|
|
1012
|
-
n.modelValue,
|
|
1013
|
-
(f) => t("update:modelValue", f),
|
|
1014
|
-
n.id ? [n.id] : []
|
|
1015
|
-
);
|
|
1016
|
-
}
|
|
1017
|
-
function C(f, w, F) {
|
|
1018
|
-
const T = +w;
|
|
1019
|
-
let q = F;
|
|
1020
|
-
w.length > 0 && isFinite(T) ? q = F.map((P) => (P.id !== f || (P.amount = ke(T)), P)) : q = F.map((P) => (P.id !== f || (P.amount = { amount: 0, precision: 0 }), P)), t("update:modelValue", q);
|
|
1021
|
-
}
|
|
1022
|
-
const I = S(() => n.modelValue.filter((f) => f.type === "SKU") ?? []);
|
|
1023
|
-
async function M() {
|
|
1024
|
-
if (n.iframeMode) {
|
|
1025
|
-
t("click:pick-inventory-bindings", "SKU");
|
|
1026
|
-
return;
|
|
1027
|
-
}
|
|
1028
|
-
r(
|
|
1029
|
-
n.modelValue,
|
|
1030
|
-
(f) => t("update:modelValue", f),
|
|
1031
|
-
n.excludeBindingId,
|
|
1032
|
-
n.id ? [n.id] : []
|
|
1033
|
-
);
|
|
1034
|
-
}
|
|
1035
|
-
function H(f) {
|
|
1036
|
-
const w = n.modelValue.map((F) => F.id === f.id ? f : F);
|
|
1037
|
-
t("update:modelValue", w);
|
|
1038
|
-
}
|
|
1039
|
-
function c(f) {
|
|
1040
|
-
const w = n.modelValue.filter((F) => F.id !== f);
|
|
1041
|
-
t("update:modelValue", w);
|
|
1042
|
-
}
|
|
1043
|
-
function h(f) {
|
|
1044
|
-
var F, T;
|
|
1045
|
-
if (f.type !== ie.enum.SKU)
|
|
1046
|
-
throw new Error("Non-SKU binding does not have unit");
|
|
1047
|
-
if (!((F = u.value[f.id]) == null ? void 0 : F.unit))
|
|
1048
|
-
throw new Error(`Cannot find ingredient: ${f.id}`);
|
|
1049
|
-
return (T = u.value[f.id]) == null ? void 0 : T.unit;
|
|
1050
|
-
}
|
|
1051
|
-
return (f, w) => {
|
|
1052
|
-
var U, X, L;
|
|
1053
|
-
const F = A("FmFormGroup"), T = A("FmButton"), q = A("FmIcon"), P = A("FmTextField");
|
|
1054
|
-
return B(), R("div", On, [
|
|
1055
|
-
k(F, {
|
|
1056
|
-
disabled: f.disabled,
|
|
1057
|
-
"model-value": f.modelValue,
|
|
1058
|
-
rules: [
|
|
1059
|
-
...f.rules,
|
|
1060
|
-
() => o.value.length ? "There is a binding error in your configuration" : !0
|
|
1061
|
-
]
|
|
1062
|
-
}, {
|
|
1063
|
-
label: K(() => w[4] || (w[4] = [
|
|
1064
|
-
v("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Define the inventory bindings for this recipe or ingredient. ", -1)
|
|
1065
|
-
])),
|
|
1066
|
-
_: 1
|
|
1067
|
-
}, 8, ["disabled", "model-value", "rules"]),
|
|
1068
|
-
((U = f.recipeBindingConfig) == null ? void 0 : U.enabled) !== !1 ? (B(), R("div", jn, [
|
|
1069
|
-
v("div", Yn, [
|
|
1070
|
-
v("div", qn, N(a(b)("inventory.inventoryBindings.recipe")), 1),
|
|
1071
|
-
f.readonly ? E("", !0) : (B(), D(T, {
|
|
1072
|
-
key: 0,
|
|
1073
|
-
variant: "secondary",
|
|
1074
|
-
"text-color": "primary",
|
|
1075
|
-
"border-color": "primary",
|
|
1076
|
-
label: a(b)("inventory.inventoryBindings.linkRecipe"),
|
|
1077
|
-
"prepend-icon": "link",
|
|
1078
|
-
onClick: l
|
|
1079
|
-
}, null, 8, ["label"]))
|
|
1080
|
-
]),
|
|
1081
|
-
v("div", Hn, [
|
|
1082
|
-
v("div", Wn, [
|
|
1083
|
-
v("div", Jn, N(a(b)("inventory.inventoryBindings.recipe")), 1),
|
|
1084
|
-
w[5] || (w[5] = v("div", { class: "w-[200px]" }, null, -1)),
|
|
1085
|
-
f.recipeBindingConfig.ableToApplyRules ? (B(), R("div", Qn)) : E("", !0),
|
|
1086
|
-
f.readonly ? E("", !0) : (B(), R("div", Xn))
|
|
1087
|
-
]),
|
|
1088
|
-
(B(!0), R(oe, null, se(i.value, ($) => {
|
|
1089
|
-
var Z;
|
|
1090
|
-
return B(), D(An, {
|
|
1091
|
-
key: $.id,
|
|
1092
|
-
"model-value": $,
|
|
1093
|
-
"display-name": (Z = d.value[$.id]) == null ? void 0 : Z.name,
|
|
1094
|
-
"show-error": e.value.has($.id),
|
|
1095
|
-
readonly: f.readonly,
|
|
1096
|
-
disabled: f.disabled,
|
|
1097
|
-
"onUpdate:modelValue": w[0] || (w[0] = (W) => H(W)),
|
|
1098
|
-
onDelete: w[1] || (w[1] = (W) => c(W))
|
|
1099
|
-
}, null, 8, ["model-value", "display-name", "show-error", "readonly", "disabled"]);
|
|
1100
|
-
}), 128))
|
|
1101
|
-
])
|
|
1102
|
-
])) : E("", !0),
|
|
1103
|
-
f.enableIngredientGroup ? (B(), R("div", Zn, [
|
|
1104
|
-
v("div", et, [
|
|
1105
|
-
v("div", nt, N(a(b)("inventory.inventoryBindings.ingredientGroup")), 1),
|
|
1106
|
-
f.readonly ? E("", !0) : (B(), D(T, {
|
|
1107
|
-
key: 0,
|
|
1108
|
-
variant: "secondary",
|
|
1109
|
-
"text-color": "primary",
|
|
1110
|
-
"border-color": "primary",
|
|
1111
|
-
label: a(b)("inventory.inventoryBindings.linkIngredientGroup"),
|
|
1112
|
-
"prepend-icon": "link",
|
|
1113
|
-
onClick: x
|
|
1114
|
-
}, null, 8, ["label"]))
|
|
1115
|
-
]),
|
|
1116
|
-
v("div", tt, [
|
|
1117
|
-
v("div", ot, [
|
|
1118
|
-
v("div", it, N(a(b)("inventory.inventoryBindings.ingredientGroup")), 1),
|
|
1119
|
-
w[6] || (w[6] = v("div", { class: "w-[200px]" }, null, -1)),
|
|
1120
|
-
w[7] || (w[7] = v("div", { class: "w-[52px]" }, null, -1))
|
|
1121
|
-
]),
|
|
1122
|
-
(B(!0), R(oe, null, se(s.value, ($) => (B(), D(F, {
|
|
1123
|
-
key: $.id,
|
|
1124
|
-
disabled: f.disabled,
|
|
1125
|
-
modelValue: +a(j)($.amount ?? { amount: 1, precision: 0 }),
|
|
1126
|
-
rules: [a(xe)(0), a(pe)(0)]
|
|
1127
|
-
}, {
|
|
1128
|
-
default: K(({ invalid: Z }) => {
|
|
1129
|
-
var W;
|
|
1130
|
-
return [
|
|
1131
|
-
v("div", lt, [
|
|
1132
|
-
e.value.has($.id) ? (B(), R("div", st, [
|
|
1133
|
-
k(q, {
|
|
1134
|
-
name: "error",
|
|
1135
|
-
color: "system-error-300",
|
|
1136
|
-
size: "sm"
|
|
1137
|
-
}),
|
|
1138
|
-
v("div", null, N(a(b)("inventory.inventoryBindings.circularError")), 1)
|
|
1139
|
-
])) : E("", !0),
|
|
1140
|
-
v("div", at, [
|
|
1141
|
-
v("div", rt, [
|
|
1142
|
-
v("div", dt, N((W = g.value[$.id]) == null ? void 0 : W.name), 1)
|
|
1143
|
-
]),
|
|
1144
|
-
v("div", ut, [
|
|
1145
|
-
k(P, {
|
|
1146
|
-
class: "w-full",
|
|
1147
|
-
disabled: f.disabled,
|
|
1148
|
-
modelValue: +a(j)($.amount ?? { amount: 1, precision: 0 }),
|
|
1149
|
-
"onUpdate:modelValue": (ne) => C($.id, ne, f.modelValue),
|
|
1150
|
-
invalid: Z
|
|
1151
|
-
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"])
|
|
1152
|
-
]),
|
|
1153
|
-
f.readonly ? E("", !0) : (B(), R("div", mt, [
|
|
1154
|
-
k(T, {
|
|
1155
|
-
disabled: f.disabled,
|
|
1156
|
-
type: "button",
|
|
1157
|
-
variant: "plain",
|
|
1158
|
-
icon: "delete",
|
|
1159
|
-
"icon-color": "#000000",
|
|
1160
|
-
onClick: (ne) => c($.id)
|
|
1161
|
-
}, null, 8, ["disabled", "onClick"])
|
|
1162
|
-
]))
|
|
1163
|
-
])
|
|
1164
|
-
])
|
|
1165
|
-
];
|
|
1166
|
-
}),
|
|
1167
|
-
_: 2
|
|
1168
|
-
}, 1032, ["disabled", "modelValue", "rules"]))), 128))
|
|
1169
|
-
])
|
|
1170
|
-
])) : E("", !0),
|
|
1171
|
-
v("div", ct, [
|
|
1172
|
-
v("div", pt, [
|
|
1173
|
-
v("div", ft, N(a(b)("inventory.inventoryBindings.ingredient")), 1),
|
|
1174
|
-
f.readonly ? E("", !0) : (B(), D(T, {
|
|
1175
|
-
key: 0,
|
|
1176
|
-
variant: "secondary",
|
|
1177
|
-
"text-color": "primary",
|
|
1178
|
-
"border-color": "primary",
|
|
1179
|
-
label: a(b)("inventory.inventoryBindings.linkIngredient"),
|
|
1180
|
-
"prepend-icon": "link",
|
|
1181
|
-
onClick: M
|
|
1182
|
-
}, null, 8, ["label"]))
|
|
1183
|
-
]),
|
|
1184
|
-
v("div", vt, [
|
|
1185
|
-
v("div", yt, [
|
|
1186
|
-
v("div", bt, N(a(b)("inventory.inventoryBindings.ingredient")), 1),
|
|
1187
|
-
v("div", gt, N(a(b)("inventory.inventoryBindings.amount")), 1),
|
|
1188
|
-
w[8] || (w[8] = v("div", { class: "w-[52px]" }, null, -1)),
|
|
1189
|
-
(X = f.skuBindingConfig) != null && X.ableToApplyRules || (L = f.skuBindingConfig) != null && L.ableToConfigureAlternative ? (B(), R("div", _t)) : E("", !0)
|
|
1190
|
-
]),
|
|
1191
|
-
(B(!0), R(oe, null, se(I.value, ($) => {
|
|
1192
|
-
var Z, W, ne;
|
|
1193
|
-
return B(), D(Ln, {
|
|
1194
|
-
key: $.id,
|
|
1195
|
-
"model-value": $,
|
|
1196
|
-
"display-name": (Z = u.value[$.id]) == null ? void 0 : Z.name,
|
|
1197
|
-
unit: h($),
|
|
1198
|
-
"show-error": e.value.has($.id),
|
|
1199
|
-
"able-to-apply-rules": ((W = f.skuBindingConfig) == null ? void 0 : W.ableToApplyRules) === !0,
|
|
1200
|
-
"able-to-configure-alternative": ((ne = f.skuBindingConfig) == null ? void 0 : ne.ableToConfigureAlternative) === !0,
|
|
1201
|
-
readonly: f.readonly,
|
|
1202
|
-
disabled: f.disabled,
|
|
1203
|
-
"onUpdate:modelValue": w[2] || (w[2] = (le) => H(le)),
|
|
1204
|
-
onDelete: w[3] || (w[3] = (le) => c(le))
|
|
1205
|
-
}, null, 8, ["model-value", "display-name", "unit", "show-error", "able-to-apply-rules", "able-to-configure-alternative", "readonly", "disabled"]);
|
|
1206
|
-
}), 128))
|
|
1207
|
-
])
|
|
1208
|
-
])
|
|
1209
|
-
]);
|
|
1210
|
-
};
|
|
1211
|
-
}
|
|
1212
|
-
}), Vt = { class: "flex flex-col gap-40" }, kt = {
|
|
1213
|
-
key: 0,
|
|
1214
|
-
class: "flex flex-col gap-16"
|
|
1215
|
-
}, xt = {
|
|
1216
|
-
key: 0,
|
|
1217
|
-
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"
|
|
1218
|
-
}, Bt = {
|
|
1219
|
-
key: 0,
|
|
1220
|
-
class: "flex flex-col items-center w-full h-full gap-24"
|
|
1221
|
-
}, wt = { key: 1 }, Ft = { class: "mt-32" }, Ct = /* @__PURE__ */ J({
|
|
1222
|
-
__name: "RecipeForm",
|
|
1223
|
-
props: {
|
|
1224
|
-
mode: {},
|
|
1225
|
-
modelValue: {},
|
|
1226
|
-
disabled: { type: Boolean }
|
|
1227
|
-
},
|
|
1228
|
-
emits: ["update:modelValue", "click:submit"],
|
|
1229
|
-
setup(p, { expose: V, emit: b }) {
|
|
1230
|
-
var H;
|
|
1231
|
-
const m = p, d = b, u = ln(), { t: g } = Q(), n = S({
|
|
1232
|
-
get() {
|
|
1233
|
-
var c;
|
|
1234
|
-
return ((c = m.modelValue) == null ? void 0 : c.name) ?? "";
|
|
1235
|
-
},
|
|
1236
|
-
set(c) {
|
|
1237
|
-
const h = m.modelValue ?? {};
|
|
1238
|
-
h.name = c, d("update:modelValue", h);
|
|
1239
|
-
}
|
|
1240
|
-
}), t = S({
|
|
1241
|
-
get() {
|
|
1242
|
-
var c;
|
|
1243
|
-
return ((c = m.modelValue) == null ? void 0 : c.contains) ?? [];
|
|
1244
|
-
},
|
|
1245
|
-
set(c) {
|
|
1246
|
-
const h = m.modelValue ?? {};
|
|
1247
|
-
h.contains = c, d("update:modelValue", h);
|
|
1248
|
-
}
|
|
1249
|
-
}), o = S({
|
|
1250
|
-
get() {
|
|
1251
|
-
var c;
|
|
1252
|
-
return ((c = m.modelValue) == null ? void 0 : c.customAttributes) ?? {};
|
|
1253
|
-
},
|
|
1254
|
-
set(c) {
|
|
1255
|
-
const h = m.modelValue ? {
|
|
1256
|
-
...m.modelValue
|
|
1257
|
-
} : {};
|
|
1258
|
-
h.customAttributes = c, d("update:modelValue", h);
|
|
1259
|
-
}
|
|
1260
|
-
}), e = S({
|
|
1261
|
-
get() {
|
|
1262
|
-
var c;
|
|
1263
|
-
return ((c = m.modelValue) == null ? void 0 : c.version) ?? null;
|
|
1264
|
-
},
|
|
1265
|
-
set(c) {
|
|
1266
|
-
const h = m.modelValue ? { ...m.modelValue } : {};
|
|
1267
|
-
h.version = c, d("update:modelValue", h);
|
|
1268
|
-
}
|
|
1269
|
-
}), i = S({
|
|
1270
|
-
get() {
|
|
1271
|
-
return e.value === "v2";
|
|
1272
|
-
},
|
|
1273
|
-
set(c) {
|
|
1274
|
-
e.value = c ? "v2" : null;
|
|
1275
|
-
}
|
|
1276
|
-
});
|
|
1277
|
-
function r() {
|
|
1278
|
-
d("click:submit");
|
|
1279
|
-
}
|
|
1280
|
-
const _ = G();
|
|
1281
|
-
V({
|
|
1282
|
-
validateInputs: () => {
|
|
1283
|
-
var c, h;
|
|
1284
|
-
(h = (c = _.value) == null ? void 0 : c.validateInputs) == null || h.call(c);
|
|
1285
|
-
},
|
|
1286
|
-
resetInputsValidation: () => {
|
|
1287
|
-
var c, h;
|
|
1288
|
-
(h = (c = _.value) == null ? void 0 : c.resetInputsValidation) == null || h.call(c);
|
|
1289
|
-
},
|
|
1290
|
-
resetInputs: () => {
|
|
1291
|
-
var c, h;
|
|
1292
|
-
(h = (c = _.value) == null ? void 0 : c.resetInputs) == null || h.call(c);
|
|
1293
|
-
}
|
|
1294
|
-
});
|
|
1295
|
-
const y = Y(), l = G([]), s = G(!1), x = G(!1);
|
|
1296
|
-
_e(s, async (c) => {
|
|
1297
|
-
C(c);
|
|
1298
|
-
});
|
|
1299
|
-
async function C(c) {
|
|
1300
|
-
var h, f;
|
|
1301
|
-
c && !x.value && ((h = m.modelValue) != null && h._id) && (x.value = !0, l.value = await y.getAffectedMenu((f = m.modelValue) == null ? void 0 : f._id).delayed(500), x.value = !1);
|
|
1302
|
-
}
|
|
1303
|
-
const I = S(
|
|
1304
|
-
() => y.recipes.map((c) => ({ label: c.name, value: c.name }))
|
|
1305
|
-
), M = G((H = m.modelValue) == null ? void 0 : H.name);
|
|
1306
|
-
return (c, h) => {
|
|
1307
|
-
const f = A("FmTextField"), w = A("FmSwitch"), F = A("FmCard"), T = A("FmSpacer"), q = A("FmCircularProgress"), P = A("FmForm");
|
|
1308
|
-
return B(), D(P, {
|
|
1309
|
-
ref_key: "formRef",
|
|
1310
|
-
ref: _,
|
|
1311
|
-
onValidationSuccess: r
|
|
1312
|
-
}, {
|
|
1313
|
-
default: K(() => [
|
|
1314
|
-
v("div", Vt, [
|
|
1315
|
-
k(f, {
|
|
1316
|
-
disabled: c.disabled,
|
|
1317
|
-
label: a(g)("inventory.recipe.name"),
|
|
1318
|
-
"model-value": n.value,
|
|
1319
|
-
"onUpdate:modelValue": h[0] || (h[0] = (U) => n.value = U),
|
|
1320
|
-
rules: [
|
|
1321
|
-
a(He)(),
|
|
1322
|
-
a(Be)(I.value, M.value, (U) => `[${U.value}] already exists`)
|
|
1323
|
-
],
|
|
1324
|
-
"label-mark": "required"
|
|
1325
|
-
}, null, 8, ["disabled", "label", "model-value", "rules"]),
|
|
1326
|
-
a(u).enableRecipeV2 ? (B(), R("div", kt, [
|
|
1327
|
-
k(w, {
|
|
1328
|
-
modelValue: i.value,
|
|
1329
|
-
"onUpdate:modelValue": h[1] || (h[1] = (U) => i.value = U),
|
|
1330
|
-
value: !0,
|
|
1331
|
-
label: a(g)("inventory.recipe.enableRecipeV2"),
|
|
1332
|
-
"label-placement": "right",
|
|
1333
|
-
disabled: c.disabled,
|
|
1334
|
-
sublabel: a(g)("inventory.recipe.recipeV2Warning")
|
|
1335
|
-
}, null, 8, ["modelValue", "label", "disabled", "sublabel"])
|
|
1336
|
-
])) : E("", !0),
|
|
1337
|
-
k(F, {
|
|
1338
|
-
variant: "outlined",
|
|
1339
|
-
class: "p-16"
|
|
1340
|
-
}, {
|
|
1341
|
-
default: K(() => {
|
|
1342
|
-
var U, X;
|
|
1343
|
-
return [
|
|
1344
|
-
a(u).enableRecipeV2 ? (B(), D(ht, {
|
|
1345
|
-
key: 0,
|
|
1346
|
-
id: (U = c.modelValue) == null ? void 0 : U._id,
|
|
1347
|
-
disabled: c.disabled,
|
|
1348
|
-
"model-value": t.value,
|
|
1349
|
-
"onUpdate:modelValue": h[2] || (h[2] = (L) => t.value = L),
|
|
1350
|
-
rules: [a(re)(1)],
|
|
1351
|
-
"enable-ingredient-group": a(u).enableIngredientGroup,
|
|
1352
|
-
"recipe-binding-config": { enabled: !i.value, ableToApplyRules: i.value },
|
|
1353
|
-
"sku-binding-config": {
|
|
1354
|
-
ableToConfigureAlternative: i.value
|
|
1355
|
-
}
|
|
1356
|
-
}, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group", "recipe-binding-config", "sku-binding-config"])) : (B(), D(We, {
|
|
1357
|
-
key: 1,
|
|
1358
|
-
id: (X = c.modelValue) == null ? void 0 : X._id,
|
|
1359
|
-
disabled: c.disabled,
|
|
1360
|
-
"model-value": t.value,
|
|
1361
|
-
"onUpdate:modelValue": h[3] || (h[3] = (L) => t.value = L),
|
|
1362
|
-
rules: [a(re)(1)],
|
|
1363
|
-
"enable-ingredient-group": a(u).enableIngredientGroup
|
|
1364
|
-
}, null, 8, ["id", "disabled", "model-value", "rules", "enable-ingredient-group"]))
|
|
1365
|
-
];
|
|
1366
|
-
}),
|
|
1367
|
-
_: 1
|
|
1368
|
-
})
|
|
1369
|
-
]),
|
|
1370
|
-
c.mode !== a(z).CREATE ? (B(), R("div", xt, [
|
|
1371
|
-
k(w, {
|
|
1372
|
-
label: "Show binded items",
|
|
1373
|
-
modelValue: s.value,
|
|
1374
|
-
"onUpdate:modelValue": h[4] || (h[4] = (U) => s.value = U),
|
|
1375
|
-
"label-placement": "right",
|
|
1376
|
-
disabled: x.value
|
|
1377
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
1378
|
-
x.value ? (B(), R("div", Bt, [
|
|
1379
|
-
k(T),
|
|
1380
|
-
v("div", null, [
|
|
1381
|
-
k(q, { size: "xl" })
|
|
1382
|
-
]),
|
|
1383
|
-
h[6] || (h[6] = v("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
1384
|
-
k(T)
|
|
1385
|
-
])) : s.value && l.value.length ? (B(), R("div", wt, [
|
|
1386
|
-
k(Ve, {
|
|
1387
|
-
name: "Menu",
|
|
1388
|
-
bindings: l.value
|
|
1389
|
-
}, null, 8, ["bindings"])
|
|
1390
|
-
])) : E("", !0)
|
|
1391
|
-
])) : E("", !0),
|
|
1392
|
-
v("div", Ft, [
|
|
1393
|
-
k(on, {
|
|
1394
|
-
entity: "inventoryRecipe",
|
|
1395
|
-
modelValue: o.value,
|
|
1396
|
-
"onUpdate:modelValue": h[5] || (h[5] = (U) => o.value = U)
|
|
1397
|
-
}, null, 8, ["modelValue"])
|
|
1398
|
-
])
|
|
1399
|
-
]),
|
|
1400
|
-
_: 1
|
|
1401
|
-
}, 512);
|
|
1402
|
-
};
|
|
1403
|
-
}
|
|
1404
|
-
}), It = { class: "flex gap-4" }, At = /* @__PURE__ */ J({
|
|
1405
|
-
__name: "RecipeDialog",
|
|
1406
|
-
props: {
|
|
1407
|
-
show: { type: Boolean },
|
|
1408
|
-
recipe: {},
|
|
1409
|
-
mode: { default: z.READ }
|
|
1410
|
-
},
|
|
1411
|
-
emits: ["update:show"],
|
|
1412
|
-
setup(p) {
|
|
1413
|
-
const V = p, b = Y(), m = ce(), { t: d } = Q(), u = ye(V, "show"), g = ye(V, "recipe"), n = S(() => {
|
|
1414
|
-
switch (V.mode) {
|
|
1415
|
-
case z.READ:
|
|
1416
|
-
return "";
|
|
1417
|
-
case z.UPDATE:
|
|
1418
|
-
return d("inventory.recipe.update.title");
|
|
1419
|
-
case z.CREATE:
|
|
1420
|
-
return d("inventory.recipe.create.title");
|
|
1421
|
-
}
|
|
1422
|
-
return "";
|
|
1423
|
-
}), t = S(() => {
|
|
1424
|
-
switch (V.mode) {
|
|
1425
|
-
case z.READ:
|
|
1426
|
-
return "";
|
|
1427
|
-
case z.UPDATE:
|
|
1428
|
-
return d("common.save");
|
|
1429
|
-
case z.CREATE:
|
|
1430
|
-
return d("common.add");
|
|
1431
|
-
}
|
|
1432
|
-
return "";
|
|
1433
|
-
}), o = G(), e = G(!1);
|
|
1434
|
-
async function i() {
|
|
1435
|
-
e.value = !0;
|
|
1436
|
-
try {
|
|
1437
|
-
const l = ue(g.value);
|
|
1438
|
-
l.precision ?? (l.precision = 0), l.measurements ?? (l.measurements = []), await b.createRecipe(l), u.value = !1, m.open({
|
|
1439
|
-
title: d("inventory.common.success"),
|
|
1440
|
-
message: d("inventory.recipe.create.success", { name: g.value.name }),
|
|
1441
|
-
type: "success"
|
|
1442
|
-
});
|
|
1443
|
-
} catch (l) {
|
|
1444
|
-
l instanceof ve || m.open({
|
|
1445
|
-
title: d("inventory.recipe.create.error.title"),
|
|
1446
|
-
message: d("inventory.recipe.create.error.message"),
|
|
1447
|
-
type: "error"
|
|
1448
|
-
});
|
|
1449
|
-
} finally {
|
|
1450
|
-
e.value = !1;
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
async function r() {
|
|
1454
|
-
e.value = !0;
|
|
1455
|
-
try {
|
|
1456
|
-
await b.updateRecipe(g.value), u.value = !1, m.open({
|
|
1457
|
-
title: d("inventory.common.success"),
|
|
1458
|
-
message: d("inventory.recipe.update.success", { name: g.value.name }),
|
|
1459
|
-
type: "success"
|
|
1460
|
-
});
|
|
1461
|
-
} catch (l) {
|
|
1462
|
-
l instanceof ve || m.open({
|
|
1463
|
-
title: d("inventory.recipe.update.error.title"),
|
|
1464
|
-
message: d("inventory.recipe.update.error.message"),
|
|
1465
|
-
type: "error"
|
|
1466
|
-
});
|
|
1467
|
-
} finally {
|
|
1468
|
-
e.value = !1;
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
function _() {
|
|
1472
|
-
var l, s;
|
|
1473
|
-
(s = (l = o.value) == null ? void 0 : l.validateInputs) == null || s.call(l);
|
|
1474
|
-
}
|
|
1475
|
-
function y() {
|
|
1476
|
-
switch (V.mode) {
|
|
1477
|
-
case z.READ:
|
|
1478
|
-
return;
|
|
1479
|
-
case z.UPDATE:
|
|
1480
|
-
return r();
|
|
1481
|
-
case z.CREATE:
|
|
1482
|
-
return i();
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
return (l, s) => {
|
|
1486
|
-
const x = A("FmButton"), C = A("FmSideSheet");
|
|
1487
|
-
return B(), D(C, {
|
|
1488
|
-
"model-value": a(u),
|
|
1489
|
-
"onUpdate:modelValue": s[3] || (s[3] = (I) => fe(u) ? u.value = I : null),
|
|
1490
|
-
header: n.value,
|
|
1491
|
-
"close-button": "",
|
|
1492
|
-
"dismiss-away": "",
|
|
1493
|
-
"max-width": 800
|
|
1494
|
-
}, {
|
|
1495
|
-
"side-sheet-footer": K(() => [
|
|
1496
|
-
v("div", It, [
|
|
1497
|
-
k(x, {
|
|
1498
|
-
loading: e.value,
|
|
1499
|
-
label: t.value,
|
|
1500
|
-
onClick: _
|
|
1501
|
-
}, null, 8, ["loading", "label"]),
|
|
1502
|
-
k(x, {
|
|
1503
|
-
disabled: e.value,
|
|
1504
|
-
label: a(d)("common.close"),
|
|
1505
|
-
variant: "tertiary",
|
|
1506
|
-
onClick: s[2] || (s[2] = (I) => u.value = !1)
|
|
1507
|
-
}, null, 8, ["disabled", "label"])
|
|
1508
|
-
])
|
|
1509
|
-
]),
|
|
1510
|
-
default: K(() => [
|
|
1511
|
-
k(Ct, {
|
|
1512
|
-
class: "w-full",
|
|
1513
|
-
ref_key: "hasValidationExpose",
|
|
1514
|
-
ref: o,
|
|
1515
|
-
modelValue: a(g),
|
|
1516
|
-
"onUpdate:modelValue": s[0] || (s[0] = (I) => fe(g) ? g.value = I : null),
|
|
1517
|
-
mode: l.mode,
|
|
1518
|
-
disabled: e.value,
|
|
1519
|
-
"onClick:submit": s[1] || (s[1] = (I) => y())
|
|
1520
|
-
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
1521
|
-
]),
|
|
1522
|
-
_: 1
|
|
1523
|
-
}, 8, ["model-value", "header"]);
|
|
1524
|
-
};
|
|
1525
|
-
}
|
|
1526
|
-
});
|
|
1527
|
-
function Rt(p) {
|
|
1528
|
-
return !p || Object.keys(p).length === 0 ? "" : Object.entries(p).map(([V, b]) => `${V}: ${b}`).join(", ");
|
|
1529
|
-
}
|
|
1530
|
-
function St() {
|
|
1531
|
-
const p = Y(), V = p.recipes, b = p.recipeById, m = p.skuById, d = p.skuGroupById, u = V.flatMap((t, o) => {
|
|
1532
|
-
var i;
|
|
1533
|
-
const e = Rt(t.customAttributes);
|
|
1534
|
-
if ((i = t.contains) != null && i.length) {
|
|
1535
|
-
const r = t.contains.filter((l) => l.type === "RECIPE"), _ = t.contains.filter((l) => l.type === "SKU"), y = t.contains.filter((l) => l.type === "SKU_GROUP");
|
|
1536
|
-
return [
|
|
1537
|
-
...o === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
1538
|
-
...r.map(
|
|
1539
|
-
(l, s) => {
|
|
1540
|
-
var x;
|
|
1541
|
-
return [
|
|
1542
|
-
s === 0 ? t.name : "",
|
|
1543
|
-
"RECIPE",
|
|
1544
|
-
"",
|
|
1545
|
-
(x = b[l.id]) == null ? void 0 : x.name,
|
|
1546
|
-
j(l.amount),
|
|
1547
|
-
"UNIT",
|
|
1548
|
-
s === 0 ? e : ""
|
|
1549
|
-
];
|
|
1550
|
-
}
|
|
1551
|
-
),
|
|
1552
|
-
..._.map(
|
|
1553
|
-
(l, s) => {
|
|
1554
|
-
var x, C, I, M;
|
|
1555
|
-
return [
|
|
1556
|
-
!r.length && s === 0 ? t.name : "",
|
|
1557
|
-
"INGREDIENT",
|
|
1558
|
-
(x = m[l.id]) == null ? void 0 : x.code,
|
|
1559
|
-
(C = m[l.id]) == null ? void 0 : C.name,
|
|
1560
|
-
j(l.amount),
|
|
1561
|
-
l.measurement ? l.measurement.abbrev : (M = (I = m[l.id]) == null ? void 0 : I.unit) == null ? void 0 : M.abbrev,
|
|
1562
|
-
!r.length && s === 0 ? e : ""
|
|
1563
|
-
];
|
|
1564
|
-
}
|
|
1565
|
-
),
|
|
1566
|
-
...y.map(
|
|
1567
|
-
(l, s) => {
|
|
1568
|
-
var x, C;
|
|
1569
|
-
return [
|
|
1570
|
-
r.length === 0 && _.length === 0 && s === 0 ? t.name : "",
|
|
1571
|
-
"SKU_GROUP",
|
|
1572
|
-
((x = d[l.id]) == null ? void 0 : x.ref) || "",
|
|
1573
|
-
(C = d[l.id]) == null ? void 0 : C.name,
|
|
1574
|
-
j(l.amount),
|
|
1575
|
-
"UNIT",
|
|
1576
|
-
r.length === 0 && _.length === 0 && s === 0 ? e : ""
|
|
1577
|
-
];
|
|
1578
|
-
}
|
|
1579
|
-
)
|
|
1580
|
-
];
|
|
1581
|
-
}
|
|
1582
|
-
return [
|
|
1583
|
-
...o === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
1584
|
-
[t.name, "No bindings", "", "", "", "", e]
|
|
1585
|
-
];
|
|
1586
|
-
}), n = an(u, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
|
|
1587
|
-
rn(n, `RECIPE_${dn(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
|
|
1588
|
-
}
|
|
1589
|
-
const $t = { class: "flex flex-col py-8" }, Et = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Tt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ro = /* @__PURE__ */ J({
|
|
1590
|
-
__name: "RecipeView",
|
|
1591
|
-
setup(p) {
|
|
1592
|
-
const V = Y(), b = S(() => V.recipes), m = De(), { createRecipe: d, updateRecipe: u } = de(), { recipeDialogProps: g, recipeViewLoading: n } = Ke(de()), { columnDefs: t, formatRowData: o } = vn(), e = S(() => o(b.value));
|
|
1593
|
-
me(), ce(), G(!1);
|
|
1594
|
-
function i(I) {
|
|
1595
|
-
if (I === "add")
|
|
1596
|
-
return d();
|
|
1597
|
-
if (I === "export")
|
|
1598
|
-
return St();
|
|
1599
|
-
}
|
|
1600
|
-
const r = G(""), _ = S(() => n.value), { breakpoints: y } = Ge(), l = S(() => y.value.xs || y.value.sm), s = S(() => l.value ? 10 : 20), x = je(), { t: C } = Q();
|
|
1601
|
-
return (I, M) => {
|
|
1602
|
-
const H = A("FmTable");
|
|
1603
|
-
return B(), D(Ye, {
|
|
1604
|
-
title: a(C)("inventory.recipe.title"),
|
|
1605
|
-
actions: [
|
|
1606
|
-
{
|
|
1607
|
-
label: a(C)("inventory.recipe.create.title"),
|
|
1608
|
-
value: "add",
|
|
1609
|
-
isPrimary: !0,
|
|
1610
|
-
prependIcon: "add"
|
|
1611
|
-
},
|
|
1612
|
-
{ label: a(C)("common.export"), value: "export", isPrimary: !1 }
|
|
1613
|
-
],
|
|
1614
|
-
"onClick:action": i
|
|
1615
|
-
}, {
|
|
1616
|
-
default: K(() => [
|
|
1617
|
-
v("div", {
|
|
1618
|
-
class: he([
|
|
1619
|
-
"flex flex-col gap-8 max-h-full",
|
|
1620
|
-
{
|
|
1621
|
-
"p-0": l.value,
|
|
1622
|
-
"px-24 ": !l.value
|
|
1623
|
-
}
|
|
1624
|
-
])
|
|
1625
|
-
}, [
|
|
1626
|
-
k(un, {
|
|
1627
|
-
searchable: "",
|
|
1628
|
-
search: r.value,
|
|
1629
|
-
"onUpdate:search": M[0] || (M[0] = (c) => r.value = c)
|
|
1630
|
-
}, null, 8, ["search"]),
|
|
1631
|
-
(B(), D(H, {
|
|
1632
|
-
style: Re(a(x).tableHeight),
|
|
1633
|
-
"column-defs": a(t),
|
|
1634
|
-
"row-data": e.value,
|
|
1635
|
-
"search-value": r.value,
|
|
1636
|
-
loading: !a(m)._currentLocation || _.value,
|
|
1637
|
-
onRowClick: M[1] || (M[1] = (c) => a(u)(c.original.original)),
|
|
1638
|
-
key: b.value.length,
|
|
1639
|
-
"page-size": s.value
|
|
1640
|
-
}, {
|
|
1641
|
-
"list-row": K((c) => [
|
|
1642
|
-
k(sn, {
|
|
1643
|
-
row: c,
|
|
1644
|
-
onRowClick: (h) => a(u)(h.original)
|
|
1645
|
-
}, {
|
|
1646
|
-
default: K((h) => {
|
|
1647
|
-
var f, w, F, T, q, P, U, X, L, $;
|
|
1648
|
-
return [
|
|
1649
|
-
v("div", $t, [
|
|
1650
|
-
v("div", Et, [
|
|
1651
|
-
k(a(ge), {
|
|
1652
|
-
render: (F = (w = (f = h.recipe) == null ? void 0 : f.column) == null ? void 0 : w.columnDef) == null ? void 0 : F.cell,
|
|
1653
|
-
props: (q = (T = h.recipe) == null ? void 0 : T.getContext) == null ? void 0 : q.call(T)
|
|
1654
|
-
}, null, 8, ["render", "props"])
|
|
1655
|
-
]),
|
|
1656
|
-
v("div", Tt, [
|
|
1657
|
-
k(a(ge), {
|
|
1658
|
-
render: (X = (U = (P = h.ingredients) == null ? void 0 : P.column) == null ? void 0 : U.columnDef) == null ? void 0 : X.cell,
|
|
1659
|
-
props: ($ = (L = h.ingredients) == null ? void 0 : L.getContext) == null ? void 0 : $.call(L)
|
|
1660
|
-
}, null, 8, ["render", "props"])
|
|
1661
|
-
])
|
|
1662
|
-
])
|
|
1663
|
-
];
|
|
1664
|
-
}),
|
|
1665
|
-
_: 2
|
|
1666
|
-
}, 1032, ["row", "onRowClick"])
|
|
1667
|
-
]),
|
|
1668
|
-
_: 1
|
|
1669
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
1670
|
-
], 2),
|
|
1671
|
-
(B(), D(Se, { to: "body" }, [
|
|
1672
|
-
k(At, $e(Ee(a(g))), null, 16)
|
|
1673
|
-
]))
|
|
1674
|
-
]),
|
|
1675
|
-
_: 1
|
|
1676
|
-
}, 8, ["title", "actions"]);
|
|
1677
|
-
};
|
|
1678
|
-
}
|
|
1679
|
-
});
|
|
1680
|
-
export {
|
|
1681
|
-
ro as default
|
|
1682
|
-
};
|