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