@feedmepos/mf-inventory-portal 0.0.23-dev.4 → 0.0.23-dev.40
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-DReDvY0M.js → App-D8DXxTIq.js} +84 -72
- package/dist/{ApprovalView-BMZlYmRk.js → ApprovalView-BWGXkHV6.js} +25 -28
- package/dist/{BindingsDialog-Y2K4I7H7.js → BindingsDialog-D7WypDot.js} +6 -6
- package/dist/{BindingsPicker-DKBq9c37.js → BindingsPicker-DUlGwkwM.js} +8 -9
- package/dist/{BindingsTable-45v4SDfp.js → BindingsTable-BjeZYCaJ.js} +18 -22
- package/dist/ClosingDraftView-o2LEUfo8.js +1190 -0
- package/dist/{ClosingTemplateView-CKJVYSbj.js → ClosingTemplateView-Dt983Cg4.js} +271 -285
- package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-Dc_7IyBG.js +142 -0
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CMEOp-0r.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-wocPyZls.js} +18 -19
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C1DjyjyH.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DzoEp-Pg.js} +25 -26
- package/dist/{IngredientGroupView-BuP-HGeg.js → IngredientGroupView-CIPpIpv1.js} +63 -69
- package/dist/IngredientsView-CFV3kX7Q.js +1707 -0
- package/dist/{IntegrationView-kYCaKG0o.js → IntegrationView-DkW32m-t.js} +89 -92
- package/dist/{InventoryBindingForm-BXHq4h-n.js → InventoryBindingForm-B4CBet9W.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CVxJ_bV3.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DpdDVf6O.js} +112 -104
- package/dist/{InventoryBindingSummary-Bjasfc_v.js → InventoryBindingSummary-75ImZtqK.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DM0C4raP.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DfpG3Fy8.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-C3O3JebE.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B4d0c3nk.js} +19 -20
- package/dist/{PurchaseOrderPrintPreview-CmjkfTTS.js → PurchaseOrderPrintPreview-BYO0JcQW.js} +17 -18
- package/dist/ReceiveRequestView-cFLNExw9.js +4194 -0
- package/dist/RecipeView-CjfpaHaT.js +609 -0
- package/dist/StockView-HMtD9qar.js +1818 -0
- package/dist/{SupplierView-DAx7E7sR.js → SupplierView-Cidfe-Xm.js} +2325 -787
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CdU3HPBC.js +1275 -0
- package/dist/TransferTemplateView-Doxr1fXP.js +1264 -0
- package/dist/{UnitView-CQPGZ8-r.js → UnitView-C1af71aM.js} +228 -227
- package/dist/{WarehouseView-jy-RNCgy.js → WarehouseView-CviOLXfX.js} +100 -106
- package/dist/api/adjustment-template.d.ts +25 -0
- package/dist/api/bill.d.ts +240 -84
- package/dist/api/closing-draft.d.ts +6 -0
- package/dist/api/closing.d.ts +1 -0
- package/dist/api/inventory.d.ts +15 -6
- package/dist/api/netsuite.d.ts +3 -3
- package/dist/app-BE8SgDqI.js +84466 -0
- package/dist/app.d.ts +64 -0
- package/dist/app.js +2 -2
- package/dist/components/FmCustomAttribute.vue.d.ts +23 -0
- package/dist/components/FmLockableField.vue.d.ts +37 -0
- package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +3 -1
- package/dist/components/row-action.enum.d.ts +1 -0
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +3 -1
- package/dist/composable/defineDeepModel.d.ts +1 -1
- package/dist/{decimal-BAc9M88Q.js → decimal-xj3kVOP6.js} +1 -1
- package/dist/feature-CWpNYcWJ.js +946 -0
- package/dist/format-unit-display-CZ835oaL.js +1215 -0
- package/dist/index-B8IWDKYv.js +29202 -0
- package/dist/{StockView-D9no-mrA.js → index-C6SzYqK7.js} +2242 -3986
- package/dist/router/name.d.ts +2 -0
- package/dist/stock-C2xyYnS7.js +125 -0
- package/dist/stores/feature.d.ts +6 -0
- package/dist/stores/integration/netsuite.d.ts +70 -2
- package/dist/stores/inventory.d.ts +21 -12
- package/dist/stores/supplier.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/{supplier-DJC0UZWv.js → supplier-B-7o9hg1.js} +15 -15
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-inventory-binding-dialog-PEQbFRvO.js → use-inventory-binding-dialog-Dm8Ky1MH.js} +10 -11
- package/dist/views/adjustment-template/import/AdjustmentTemplateImport.vue.d.ts +2 -0
- package/dist/views/adjustment-template/import/AdjustmentTemplateImportItem.vue.d.ts +18 -0
- package/dist/views/adjustment-template/import/export.d.ts +60 -0
- package/dist/views/adjustment-template/wastage-template/WastageTemplateDetails.vue.d.ts +2 -0
- package/dist/views/adjustment-template/wastage-template/WastageTemplateDialog.vue.d.ts +22 -0
- package/dist/views/adjustment-template/wastage-template/WastageTemplatePublish.vue.d.ts +6 -0
- package/dist/views/adjustment-template/wastage-template/WastageTemplateReason.vue.d.ts +18 -0
- package/dist/views/adjustment-template/wastage-template/WastageTemplateView.vue.d.ts +2 -0
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +1329 -0
- package/dist/views/adjustment-template/wastage-template/form/WastageTemplateForm.vue.d.ts +16 -0
- package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +35 -0
- package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +20 -0
- package/dist/views/adjustment-template/wastage-template/props.d.ts +36 -0
- package/dist/views/adjustment-template/wastage-template/table.d.ts +1303 -0
- package/dist/views/closing-draft/ClosingDraftView.vue.d.ts +2 -0
- package/dist/views/closing-draft/components/closing-draft-action/ClosingDraftAction.vue.d.ts +22 -0
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +625 -0
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +25 -0
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +3645 -0
- package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +1 -0
- package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +19 -0
- package/dist/views/closing-draft/helpers/get-calculated-total.helper.d.ts +4 -0
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +2 -1
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +48 -204
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +49 -205
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +6 -3
- package/dist/views/ingredients/components/convert/ConvertFormProps.d.ts +1 -0
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -2
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +1 -0
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +2 -1
- package/dist/views/receive-request/components/netsuite/NetSuiteInfo.vue.d.ts +12 -0
- package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +13 -0
- package/dist/views/receive-request/components/netsuite/NetSuiteSync.vue.d.ts +12 -0
- package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +2 -0
- package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +40 -17
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +4 -2
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +2 -1
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +57 -24
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +57 -24
- package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -0
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +120 -42
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +6 -4
- package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +2 -1
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +24 -12
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +24 -12
- package/dist/views/transfer-template/helpers/import-export.helper.d.ts +2 -1
- package/package.json +5 -4
- package/dist/FmDroppableField-8RzKjEdL.js +0 -154
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BhdcqRh-.js +0 -436
- package/dist/FmMultiselectDialog-D7YtdoyJ.js +0 -415
- package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-zjvFEF5C.js +0 -51
- package/dist/IngredientsView-DMRN-odY.js +0 -1613
- package/dist/ReceiveRequestView-aQZJO8sq.js +0 -4165
- package/dist/RecipeView-DXO43tFi.js +0 -597
- package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +0 -135
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DCA0RUfu.js +0 -1209
- package/dist/TransferTemplateView-CfxdQF1t.js +0 -1261
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
- package/dist/app-KnSMkJBV.js +0 -33496
- package/dist/date2-CIeUqUIc.js +0 -117
- package/dist/dayjs.min-Df5jSnDJ.js +0 -282
- package/dist/defineDeepModel-BfuQAIoM.js +0 -13
- package/dist/feature-dwB4OxRQ.js +0 -86
- package/dist/format-time-from-id-BbvzyIN6.js +0 -15
- package/dist/format-unit-display-BBWblJEt.js +0 -1216
- package/dist/fuzzy-B9ryZ9VZ.js +0 -41
- package/dist/index-BN0CY3sZ.js +0 -22277
- package/dist/index-Bj1fJum-.js +0 -45
- package/dist/index-C4yL_7rR.js +0 -10545
- package/dist/netsuite-ByWOS6tI.js +0 -194
- package/dist/normalizeArguments-DP7Hrren.js +0 -1552
- package/dist/row-action.enum-PMKMRrZR.js +0 -50
- package/dist/rules-C12nWDD1.js +0 -198
- package/dist/use-template-enabled-locations-2-k9g5t8tt.js +0 -86
- package/dist/xlsx-B4XHad7S.js +0 -24004
- package/dist/xlsx.util-BSO4SHJi.js +0 -78
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
import { defineComponent as H, ref as C, onMounted as re, resolveComponent as S, openBlock as x, createElementBlock as $, Fragment as ie, createElementVNode as R, toDisplayString as ce, createVNode as v, createCommentVNode as j, computed as F, watch as ue, createBlock as T, withCtx as P, unref as b, isRef as Z, normalizeClass as de, normalizeStyle as me, Teleport as pe, normalizeProps as fe, guardReactiveProps as ve } from "vue";
|
|
2
|
+
import { a as A, d as V, e as O, S as ye, f as ge, D as ee, h as Y, i as q, F as te, l as be, U as _e, A as we, o as ne, p as Re, r as he, q as Ve, u as xe, y as Ee, z as Ce, B as Se, E as Fe, G as oe } from "./app-BE8SgDqI.js";
|
|
3
|
+
import { useDialog as ke, useSnackbar as se, useProxiedModel as ae, useBreakpoints as De } from "@feedmepos/ui-library";
|
|
4
|
+
import { i as Ae, _ as Ie } from "./is-linked-ingredient-error-fJ2TJb3z.js";
|
|
5
|
+
import { _ as le, a as $e } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-Dc_7IyBG.js";
|
|
6
|
+
import { defineStore as Pe, storeToRefs as Be } from "pinia";
|
|
7
|
+
import { useI18n as K } from "@feedmepos/mf-common";
|
|
8
|
+
import { _ as Te } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-DpdDVf6O.js";
|
|
9
|
+
const Me = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "flex flex-col items-center w-full h-full gap-24"
|
|
12
|
+
}, Ue = { key: 1 }, Ne = { key: 0 }, ze = /* @__PURE__ */ H({
|
|
13
|
+
__name: "DeleteDialog",
|
|
14
|
+
props: {
|
|
15
|
+
type: {},
|
|
16
|
+
data: {},
|
|
17
|
+
message: {},
|
|
18
|
+
bindedItems: {}
|
|
19
|
+
},
|
|
20
|
+
setup(h) {
|
|
21
|
+
const p = h, y = C(p.bindedItems || []), a = C(!1);
|
|
22
|
+
re(() => {
|
|
23
|
+
s();
|
|
24
|
+
});
|
|
25
|
+
async function s() {
|
|
26
|
+
var c, i;
|
|
27
|
+
!a.value && ((c = p.data) != null && c._id) && (a.value = !0, y.value = await A().getAffectedMenu((i = p.data) == null ? void 0 : i._id), a.value = !1);
|
|
28
|
+
}
|
|
29
|
+
return (c, i) => {
|
|
30
|
+
const f = S("FmSpacer"), u = S("FmCircularProgress");
|
|
31
|
+
return x(), $(ie, null, [
|
|
32
|
+
R("p", null, ce(c.message), 1),
|
|
33
|
+
a.value ? (x(), $("div", Me, [
|
|
34
|
+
v(f),
|
|
35
|
+
R("div", null, [
|
|
36
|
+
v(u, { size: "xl" })
|
|
37
|
+
]),
|
|
38
|
+
i[0] || (i[0] = R("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
39
|
+
v(f)
|
|
40
|
+
])) : (x(), $("div", Ue, [
|
|
41
|
+
i[2] || (i[2] = R("br", null, null, -1)),
|
|
42
|
+
y.value.length > 0 ? (x(), $("div", Ne, [
|
|
43
|
+
i[1] || (i[1] = R("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
|
|
44
|
+
v(le, {
|
|
45
|
+
name: "Menu",
|
|
46
|
+
bindings: y.value
|
|
47
|
+
}, null, 8, ["bindings"])
|
|
48
|
+
])) : j("", !0)
|
|
49
|
+
]))
|
|
50
|
+
], 64);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}), G = Pe("recipeForm", function() {
|
|
54
|
+
const p = ke(), y = se(), a = A(), s = C(!1), c = C();
|
|
55
|
+
function i() {
|
|
56
|
+
const n = {
|
|
57
|
+
recipe: {},
|
|
58
|
+
mode: V.CREATE,
|
|
59
|
+
show: !0,
|
|
60
|
+
"onUpdate:show"(l) {
|
|
61
|
+
c.value.show = l;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
c.value = n;
|
|
65
|
+
}
|
|
66
|
+
async function f(n) {
|
|
67
|
+
const l = {
|
|
68
|
+
recipe: O(n),
|
|
69
|
+
mode: V.UPDATE,
|
|
70
|
+
show: !0,
|
|
71
|
+
"onUpdate:show"(t) {
|
|
72
|
+
c.value.show = t;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
c.value = l;
|
|
76
|
+
}
|
|
77
|
+
async function u(n) {
|
|
78
|
+
s.value = !0;
|
|
79
|
+
try {
|
|
80
|
+
await a.deleteRecipe(n), y.open({
|
|
81
|
+
title: "Success",
|
|
82
|
+
message: `Deleted ${n.name}`,
|
|
83
|
+
type: "success"
|
|
84
|
+
});
|
|
85
|
+
} catch (l) {
|
|
86
|
+
l instanceof ye && Ae(l) ? p.open({
|
|
87
|
+
title: "Cannot delete recipe",
|
|
88
|
+
contentComponent: Ie,
|
|
89
|
+
contentComponentProps: {
|
|
90
|
+
subject: (n == null ? void 0 : n.name) ?? "",
|
|
91
|
+
items: l.errorResponse.message
|
|
92
|
+
},
|
|
93
|
+
secondaryActions: {
|
|
94
|
+
text: "Close",
|
|
95
|
+
close: !0
|
|
96
|
+
}
|
|
97
|
+
}) : console.log("unable to delete recipe", l), y.open({
|
|
98
|
+
title: `Cannot delete ${n == null ? void 0 : n.name}`,
|
|
99
|
+
message: "Please try again.",
|
|
100
|
+
type: "error"
|
|
101
|
+
}), console.error("failed to delete recipe", l);
|
|
102
|
+
} finally {
|
|
103
|
+
s.value = !1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function d(n) {
|
|
107
|
+
p.open({
|
|
108
|
+
title: `Delete ${(n == null ? void 0 : n.name) ?? "recipe"}?`,
|
|
109
|
+
closeButton: !1,
|
|
110
|
+
primaryActions: {
|
|
111
|
+
text: "Delete",
|
|
112
|
+
close: !0,
|
|
113
|
+
variant: "destructive"
|
|
114
|
+
},
|
|
115
|
+
secondaryActions: {
|
|
116
|
+
text: "Cancel",
|
|
117
|
+
close: !0
|
|
118
|
+
},
|
|
119
|
+
contentComponent: ze,
|
|
120
|
+
contentComponentProps: {
|
|
121
|
+
type: "menu",
|
|
122
|
+
data: n,
|
|
123
|
+
message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
|
|
124
|
+
}
|
|
125
|
+
}).onPrimary(() => u(n));
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
createRecipe: i,
|
|
129
|
+
updateRecipe: f,
|
|
130
|
+
deleteRecipe: d,
|
|
131
|
+
recipeDialogProps: c,
|
|
132
|
+
recipeViewLoading: s
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
function Le() {
|
|
136
|
+
const { updateRecipe: h, deleteRecipe: p } = G(), y = A(), { t: a } = K();
|
|
137
|
+
async function s(u, d) {
|
|
138
|
+
const n = O(d);
|
|
139
|
+
if (u === Y.Edit) {
|
|
140
|
+
await h(n);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (u === Y.Delete) {
|
|
144
|
+
await p(n);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function c(u, d) {
|
|
149
|
+
const n = u.filter((t) => t.type === te.enum.SKU), l = u.filter((t) => t.type === te.enum.RECIPE);
|
|
150
|
+
return [
|
|
151
|
+
...n.map((t) => ({ ...t, recipeIds: [...d] })),
|
|
152
|
+
...l.filter((t) => y.recipeById[t.id] && !d.has(t.id)).flatMap(
|
|
153
|
+
(t) => c(y.recipeById[t.id].contains, /* @__PURE__ */ new Set([...d, t.id]))
|
|
154
|
+
)
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
const i = [
|
|
158
|
+
{
|
|
159
|
+
accessorKey: "recipe",
|
|
160
|
+
header: () => a("inventory.recipe.name"),
|
|
161
|
+
size: 400
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
accessorKey: "ingredients",
|
|
165
|
+
header: () => a("inventory.recipe.ingredients"),
|
|
166
|
+
size: "auto"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "action",
|
|
170
|
+
header: "",
|
|
171
|
+
cell(u) {
|
|
172
|
+
return ge(
|
|
173
|
+
[ee[Y.Edit], ee[Y.Delete]],
|
|
174
|
+
(d) => {
|
|
175
|
+
s(d, u.row.original.original);
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
},
|
|
179
|
+
enableSorting: !1,
|
|
180
|
+
size: 40,
|
|
181
|
+
meta: {
|
|
182
|
+
cellClass: "",
|
|
183
|
+
headerClass: ""
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
];
|
|
187
|
+
function f(u) {
|
|
188
|
+
const d = A();
|
|
189
|
+
return u.map((n) => ({
|
|
190
|
+
recipe: n.name,
|
|
191
|
+
ingredients: c(n.contains, /* @__PURE__ */ new Set([n._id])).map((l) => {
|
|
192
|
+
var _, g, r, m, E;
|
|
193
|
+
const t = d.skuById[l.id];
|
|
194
|
+
return t ? l.recipeIds.slice(1).length ? `(linked recipe ${(_ = d.recipeById[l.recipeIds.at(-1) ?? ""]) == null ? void 0 : _.name}) ${t.name} (${q(l.amount)}${((g = l.measurement) == null ? void 0 : g.abbrev) ?? ((r = t == null ? void 0 : t.unit) == null ? void 0 : r.abbrev)})` : `${t.name} (${q(l.amount)}${((m = l.measurement) == null ? void 0 : m.abbrev) ?? ((E = t == null ? void 0 : t.unit) == null ? void 0 : E.abbrev)})` : null;
|
|
195
|
+
}).filter((l) => l).join(", "),
|
|
196
|
+
original: n
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
return { columnDefs: i, formatRowData: f };
|
|
200
|
+
}
|
|
201
|
+
const Ye = { class: "flex flex-col gap-40" }, qe = {
|
|
202
|
+
key: 0,
|
|
203
|
+
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"
|
|
204
|
+
}, He = {
|
|
205
|
+
key: 0,
|
|
206
|
+
class: "flex flex-col items-center w-full h-full gap-24"
|
|
207
|
+
}, Ke = { key: 1 }, je = { class: "mt-32" }, Ge = /* @__PURE__ */ H({
|
|
208
|
+
__name: "RecipeForm",
|
|
209
|
+
props: {
|
|
210
|
+
mode: {},
|
|
211
|
+
modelValue: {},
|
|
212
|
+
disabled: { type: Boolean }
|
|
213
|
+
},
|
|
214
|
+
emits: ["update:modelValue", "click:submit"],
|
|
215
|
+
setup(h, { expose: p, emit: y }) {
|
|
216
|
+
var k;
|
|
217
|
+
const a = h, s = y, { t: c } = K(), i = F({
|
|
218
|
+
get() {
|
|
219
|
+
var e;
|
|
220
|
+
return ((e = a.modelValue) == null ? void 0 : e.name) ?? "";
|
|
221
|
+
},
|
|
222
|
+
set(e) {
|
|
223
|
+
const o = a.modelValue ?? {};
|
|
224
|
+
o.name = e, s("update:modelValue", o);
|
|
225
|
+
}
|
|
226
|
+
}), f = F({
|
|
227
|
+
get() {
|
|
228
|
+
var e;
|
|
229
|
+
return ((e = a.modelValue) == null ? void 0 : e.contains) ?? [];
|
|
230
|
+
},
|
|
231
|
+
set(e) {
|
|
232
|
+
const o = a.modelValue ?? {};
|
|
233
|
+
o.contains = e, s("update:modelValue", o);
|
|
234
|
+
}
|
|
235
|
+
}), u = F({
|
|
236
|
+
get() {
|
|
237
|
+
var e;
|
|
238
|
+
return ((e = a.modelValue) == null ? void 0 : e.customAttributes) ?? {};
|
|
239
|
+
},
|
|
240
|
+
set(e) {
|
|
241
|
+
const o = a.modelValue ? {
|
|
242
|
+
...a.modelValue
|
|
243
|
+
} : {};
|
|
244
|
+
o.customAttributes = e, s("update:modelValue", o);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
function d() {
|
|
248
|
+
s("click:submit");
|
|
249
|
+
}
|
|
250
|
+
const n = C();
|
|
251
|
+
p({
|
|
252
|
+
validateInputs: () => {
|
|
253
|
+
var e, o;
|
|
254
|
+
(o = (e = n.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
|
|
255
|
+
},
|
|
256
|
+
resetInputsValidation: () => {
|
|
257
|
+
var e, o;
|
|
258
|
+
(o = (e = n.value) == null ? void 0 : e.resetInputsValidation) == null || o.call(e);
|
|
259
|
+
},
|
|
260
|
+
resetInputs: () => {
|
|
261
|
+
var e, o;
|
|
262
|
+
(o = (e = n.value) == null ? void 0 : e.resetInputs) == null || o.call(e);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
const l = A(), t = C([]), _ = C(!1), g = C(!1);
|
|
266
|
+
ue(_, async (e) => {
|
|
267
|
+
r(e);
|
|
268
|
+
});
|
|
269
|
+
async function r(e) {
|
|
270
|
+
var o, B;
|
|
271
|
+
e && !g.value && ((o = a.modelValue) != null && o._id) && (g.value = !0, t.value = await l.getAffectedMenu((B = a.modelValue) == null ? void 0 : B._id), g.value = !1);
|
|
272
|
+
}
|
|
273
|
+
const m = F(
|
|
274
|
+
() => l.recipes.map((e) => ({ label: e.name, value: e.name }))
|
|
275
|
+
), E = C((k = a.modelValue) == null ? void 0 : k.name);
|
|
276
|
+
return (e, o) => {
|
|
277
|
+
const B = S("FmTextField"), I = S("FmCard"), D = S("FmSwitch"), M = S("FmSpacer"), U = S("FmCircularProgress"), N = S("FmForm");
|
|
278
|
+
return x(), T(N, {
|
|
279
|
+
ref_key: "formRef",
|
|
280
|
+
ref: n,
|
|
281
|
+
onValidationSuccess: d
|
|
282
|
+
}, {
|
|
283
|
+
default: P(() => [
|
|
284
|
+
R("div", Ye, [
|
|
285
|
+
v(B, {
|
|
286
|
+
disabled: e.disabled,
|
|
287
|
+
label: b(c)("inventory.recipe.name"),
|
|
288
|
+
"model-value": i.value,
|
|
289
|
+
"onUpdate:modelValue": o[0] || (o[0] = (w) => i.value = w),
|
|
290
|
+
rules: [
|
|
291
|
+
b(be)(),
|
|
292
|
+
b(_e)(m.value, E.value, (w) => `[${w.value}] already exists`)
|
|
293
|
+
],
|
|
294
|
+
"label-mark": "required"
|
|
295
|
+
}, null, 8, ["disabled", "label", "model-value", "rules"]),
|
|
296
|
+
v(I, {
|
|
297
|
+
variant: "outlined",
|
|
298
|
+
class: "p-16"
|
|
299
|
+
}, {
|
|
300
|
+
default: P(() => {
|
|
301
|
+
var w;
|
|
302
|
+
return [
|
|
303
|
+
v(Te, {
|
|
304
|
+
id: (w = e.modelValue) == null ? void 0 : w._id,
|
|
305
|
+
disabled: e.disabled,
|
|
306
|
+
"model-value": f.value,
|
|
307
|
+
"onUpdate:modelValue": o[1] || (o[1] = (z) => f.value = z),
|
|
308
|
+
rules: [b(we)(1)]
|
|
309
|
+
}, null, 8, ["id", "disabled", "model-value", "rules"])
|
|
310
|
+
];
|
|
311
|
+
}),
|
|
312
|
+
_: 1
|
|
313
|
+
})
|
|
314
|
+
]),
|
|
315
|
+
e.mode !== b(V).CREATE ? (x(), $("div", qe, [
|
|
316
|
+
R("div", null, [
|
|
317
|
+
v(D, {
|
|
318
|
+
label: "Show binded items",
|
|
319
|
+
modelValue: _.value,
|
|
320
|
+
"onUpdate:modelValue": o[2] || (o[2] = (w) => _.value = w),
|
|
321
|
+
"label-placement": "right",
|
|
322
|
+
disabled: g.value
|
|
323
|
+
}, null, 8, ["modelValue", "disabled"])
|
|
324
|
+
]),
|
|
325
|
+
g.value ? (x(), $("div", He, [
|
|
326
|
+
v(M),
|
|
327
|
+
R("div", null, [
|
|
328
|
+
v(U, { size: "xl" })
|
|
329
|
+
]),
|
|
330
|
+
o[4] || (o[4] = R("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
331
|
+
v(M)
|
|
332
|
+
])) : (x(), $("div", Ke, [
|
|
333
|
+
_.value && t.value.length ? (x(), T(le, {
|
|
334
|
+
key: 0,
|
|
335
|
+
name: "Menu",
|
|
336
|
+
bindings: t.value
|
|
337
|
+
}, null, 8, ["bindings"])) : j("", !0)
|
|
338
|
+
]))
|
|
339
|
+
])) : j("", !0),
|
|
340
|
+
R("div", je, [
|
|
341
|
+
v($e, {
|
|
342
|
+
entity: "inventoryRecipe",
|
|
343
|
+
modelValue: u.value,
|
|
344
|
+
"onUpdate:modelValue": o[3] || (o[3] = (w) => u.value = w)
|
|
345
|
+
}, null, 8, ["modelValue"])
|
|
346
|
+
])
|
|
347
|
+
]),
|
|
348
|
+
_: 1
|
|
349
|
+
}, 512);
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
}), Oe = { class: "flex gap-4" }, Je = /* @__PURE__ */ H({
|
|
353
|
+
__name: "RecipeDialog",
|
|
354
|
+
props: {
|
|
355
|
+
show: { type: Boolean },
|
|
356
|
+
recipe: {},
|
|
357
|
+
mode: { default: V.READ }
|
|
358
|
+
},
|
|
359
|
+
emits: ["update:show"],
|
|
360
|
+
setup(h) {
|
|
361
|
+
const p = h, y = A(), a = se(), { t: s } = K(), c = ae(p, "show"), i = ae(p, "recipe"), f = F(() => {
|
|
362
|
+
switch (p.mode) {
|
|
363
|
+
case V.READ:
|
|
364
|
+
return "";
|
|
365
|
+
case V.UPDATE:
|
|
366
|
+
return s("inventory.recipe.update.title");
|
|
367
|
+
case V.CREATE:
|
|
368
|
+
return s("inventory.recipe.create.title");
|
|
369
|
+
}
|
|
370
|
+
return "";
|
|
371
|
+
}), u = F(() => {
|
|
372
|
+
switch (p.mode) {
|
|
373
|
+
case V.READ:
|
|
374
|
+
return "";
|
|
375
|
+
case V.UPDATE:
|
|
376
|
+
return s("common.save");
|
|
377
|
+
case V.CREATE:
|
|
378
|
+
return s("common.add");
|
|
379
|
+
}
|
|
380
|
+
return "";
|
|
381
|
+
}), d = C(), n = C(!1);
|
|
382
|
+
async function l() {
|
|
383
|
+
n.value = !0;
|
|
384
|
+
try {
|
|
385
|
+
const r = O(i.value);
|
|
386
|
+
r.precision ?? (r.precision = 0), r.measurements ?? (r.measurements = []), await y.createRecipe(r), c.value = !1, a.open({
|
|
387
|
+
title: s("inventory.common.success"),
|
|
388
|
+
message: s("inventory.recipe.create.success", { name: i.value.name }),
|
|
389
|
+
type: "success"
|
|
390
|
+
});
|
|
391
|
+
} catch (r) {
|
|
392
|
+
r instanceof ne || a.open({
|
|
393
|
+
title: s("inventory.recipe.create.error.title"),
|
|
394
|
+
message: s("inventory.recipe.create.error.message"),
|
|
395
|
+
type: "error"
|
|
396
|
+
});
|
|
397
|
+
} finally {
|
|
398
|
+
n.value = !1;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
async function t() {
|
|
402
|
+
n.value = !0;
|
|
403
|
+
try {
|
|
404
|
+
await y.updateRecipe(i.value), c.value = !1, a.open({
|
|
405
|
+
title: s("inventory.common.success"),
|
|
406
|
+
message: s("inventory.recipe.update.success", { name: i.value.name }),
|
|
407
|
+
type: "success"
|
|
408
|
+
});
|
|
409
|
+
} catch (r) {
|
|
410
|
+
r instanceof ne || a.open({
|
|
411
|
+
title: s("inventory.recipe.update.error.title"),
|
|
412
|
+
message: s("inventory.recipe.update.error.message"),
|
|
413
|
+
type: "error"
|
|
414
|
+
});
|
|
415
|
+
} finally {
|
|
416
|
+
n.value = !1;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function _() {
|
|
420
|
+
var r, m;
|
|
421
|
+
(m = (r = d.value) == null ? void 0 : r.validateInputs) == null || m.call(r);
|
|
422
|
+
}
|
|
423
|
+
function g() {
|
|
424
|
+
switch (p.mode) {
|
|
425
|
+
case V.READ:
|
|
426
|
+
return;
|
|
427
|
+
case V.UPDATE:
|
|
428
|
+
return t();
|
|
429
|
+
case V.CREATE:
|
|
430
|
+
return l();
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return (r, m) => {
|
|
434
|
+
const E = S("FmButton"), k = S("FmSideSheet");
|
|
435
|
+
return x(), T(k, {
|
|
436
|
+
"model-value": b(c),
|
|
437
|
+
"onUpdate:modelValue": m[3] || (m[3] = (e) => Z(c) ? c.value = e : null),
|
|
438
|
+
header: f.value,
|
|
439
|
+
"close-button": "",
|
|
440
|
+
"dismiss-away": "",
|
|
441
|
+
"max-width": 500
|
|
442
|
+
}, {
|
|
443
|
+
"side-sheet-footer": P(() => [
|
|
444
|
+
R("div", Oe, [
|
|
445
|
+
v(E, {
|
|
446
|
+
loading: n.value,
|
|
447
|
+
label: u.value,
|
|
448
|
+
onClick: _
|
|
449
|
+
}, null, 8, ["loading", "label"]),
|
|
450
|
+
v(E, {
|
|
451
|
+
disabled: n.value,
|
|
452
|
+
label: b(s)("common.close"),
|
|
453
|
+
variant: "tertiary",
|
|
454
|
+
onClick: m[2] || (m[2] = (e) => c.value = !1)
|
|
455
|
+
}, null, 8, ["disabled", "label"])
|
|
456
|
+
])
|
|
457
|
+
]),
|
|
458
|
+
default: P(() => [
|
|
459
|
+
v(Ge, {
|
|
460
|
+
class: "w-full",
|
|
461
|
+
ref_key: "hasValidationExpose",
|
|
462
|
+
ref: d,
|
|
463
|
+
modelValue: b(i),
|
|
464
|
+
"onUpdate:modelValue": m[0] || (m[0] = (e) => Z(i) ? i.value = e : null),
|
|
465
|
+
mode: r.mode,
|
|
466
|
+
disabled: n.value,
|
|
467
|
+
"onClick:submit": m[1] || (m[1] = (e) => g())
|
|
468
|
+
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
469
|
+
]),
|
|
470
|
+
_: 1
|
|
471
|
+
}, 8, ["model-value", "header"]);
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
function Qe() {
|
|
476
|
+
const h = A(), p = h.recipes, y = h.recipeById, a = h.skuById, s = p.flatMap((f, u) => {
|
|
477
|
+
var d;
|
|
478
|
+
if ((d = f.contains) != null && d.length) {
|
|
479
|
+
const n = f.contains.filter((t) => t.type === "RECIPE"), l = f.contains.filter((t) => t.type === "SKU");
|
|
480
|
+
return [
|
|
481
|
+
...u === 0 ? [] : [["", "", "", "", "", ""]],
|
|
482
|
+
...n.map(
|
|
483
|
+
(t, _) => {
|
|
484
|
+
var g;
|
|
485
|
+
return [
|
|
486
|
+
_ === 0 ? f.name : "",
|
|
487
|
+
"RECIPE",
|
|
488
|
+
"",
|
|
489
|
+
(g = y[t.id]) == null ? void 0 : g.name,
|
|
490
|
+
q(t.amount),
|
|
491
|
+
"UNIT"
|
|
492
|
+
];
|
|
493
|
+
}
|
|
494
|
+
),
|
|
495
|
+
...l.map(
|
|
496
|
+
(t, _) => {
|
|
497
|
+
var g, r, m, E;
|
|
498
|
+
return [
|
|
499
|
+
!n.length && _ === 0 ? f.name : "",
|
|
500
|
+
"INGREDIENT",
|
|
501
|
+
(g = a[t.id]) == null ? void 0 : g.code,
|
|
502
|
+
(r = a[t.id]) == null ? void 0 : r.name,
|
|
503
|
+
q(t.amount),
|
|
504
|
+
t.measurement ? t.measurement.abbrev : (E = (m = a[t.id]) == null ? void 0 : m.unit) == null ? void 0 : E.abbrev
|
|
505
|
+
];
|
|
506
|
+
}
|
|
507
|
+
)
|
|
508
|
+
];
|
|
509
|
+
}
|
|
510
|
+
return [
|
|
511
|
+
...u === 0 ? [] : [["", "", "", "", "", ""]],
|
|
512
|
+
[f.name, "No bindings", "", "", "", ""]
|
|
513
|
+
];
|
|
514
|
+
}), i = Re(s, ["Name", "Type", "Code", "Item", "Amount", "Unit"]);
|
|
515
|
+
he(i, `RECIPE_${Ve(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
|
|
516
|
+
}
|
|
517
|
+
const We = { class: "flex flex-col py-8" }, Xe = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ze = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, it = /* @__PURE__ */ H({
|
|
518
|
+
__name: "RecipeView",
|
|
519
|
+
setup(h) {
|
|
520
|
+
const p = A(), y = F(() => p.recipes), a = xe(), { createRecipe: s, updateRecipe: c } = G(), { recipeDialogProps: i, recipeViewLoading: f } = Be(G()), { columnDefs: u, formatRowData: d } = Le(), n = F(() => d(y.value));
|
|
521
|
+
function l(e) {
|
|
522
|
+
if (e === "add")
|
|
523
|
+
return s();
|
|
524
|
+
if (e === "export")
|
|
525
|
+
return Qe();
|
|
526
|
+
}
|
|
527
|
+
const t = C(""), _ = F(() => f.value), { breakpoints: g } = De(), r = F(() => g.value.xs || g.value.sm), m = F(() => r.value ? 10 : 20), E = Ee(), { t: k } = K();
|
|
528
|
+
return (e, o) => {
|
|
529
|
+
const B = S("FmTable");
|
|
530
|
+
return x(), T(Ce, {
|
|
531
|
+
title: b(k)("inventory.recipe.title"),
|
|
532
|
+
actions: [
|
|
533
|
+
{
|
|
534
|
+
label: b(k)("inventory.recipe.create.title"),
|
|
535
|
+
value: "add",
|
|
536
|
+
isPrimary: !0,
|
|
537
|
+
prependIcon: "add"
|
|
538
|
+
},
|
|
539
|
+
{ label: b(k)("common.export"), value: "export", isPrimary: !1 }
|
|
540
|
+
],
|
|
541
|
+
"onClick:action": l
|
|
542
|
+
}, {
|
|
543
|
+
default: P(() => [
|
|
544
|
+
R("div", {
|
|
545
|
+
class: de([
|
|
546
|
+
"flex flex-col gap-8 max-h-full",
|
|
547
|
+
{
|
|
548
|
+
"p-0": r.value,
|
|
549
|
+
"px-24 ": !r.value
|
|
550
|
+
}
|
|
551
|
+
])
|
|
552
|
+
}, [
|
|
553
|
+
v(Se, {
|
|
554
|
+
searchable: "",
|
|
555
|
+
search: t.value,
|
|
556
|
+
"onUpdate:search": o[0] || (o[0] = (I) => t.value = I)
|
|
557
|
+
}, null, 8, ["search"]),
|
|
558
|
+
(x(), T(B, {
|
|
559
|
+
style: me(b(E).tableHeight),
|
|
560
|
+
"column-defs": b(u),
|
|
561
|
+
"row-data": n.value,
|
|
562
|
+
"search-value": t.value,
|
|
563
|
+
loading: !b(a)._currentLocation || _.value,
|
|
564
|
+
onRowClick: o[1] || (o[1] = (I) => b(c)(I.original.original)),
|
|
565
|
+
key: y.value.length,
|
|
566
|
+
"page-size": m.value
|
|
567
|
+
}, {
|
|
568
|
+
"list-row": P((I) => [
|
|
569
|
+
v(Fe, {
|
|
570
|
+
row: I,
|
|
571
|
+
onRowClick: (D) => b(c)(D.original)
|
|
572
|
+
}, {
|
|
573
|
+
default: P((D) => {
|
|
574
|
+
var M, U, N, w, z, J, Q, W, L, X;
|
|
575
|
+
return [
|
|
576
|
+
R("div", We, [
|
|
577
|
+
R("div", Xe, [
|
|
578
|
+
v(b(oe), {
|
|
579
|
+
render: (N = (U = (M = D.recipe) == null ? void 0 : M.column) == null ? void 0 : U.columnDef) == null ? void 0 : N.cell,
|
|
580
|
+
props: (z = (w = D.recipe) == null ? void 0 : w.getContext) == null ? void 0 : z.call(w)
|
|
581
|
+
}, null, 8, ["render", "props"])
|
|
582
|
+
]),
|
|
583
|
+
R("div", Ze, [
|
|
584
|
+
v(b(oe), {
|
|
585
|
+
render: (W = (Q = (J = D.ingredients) == null ? void 0 : J.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
|
|
586
|
+
props: (X = (L = D.ingredients) == null ? void 0 : L.getContext) == null ? void 0 : X.call(L)
|
|
587
|
+
}, null, 8, ["render", "props"])
|
|
588
|
+
])
|
|
589
|
+
])
|
|
590
|
+
];
|
|
591
|
+
}),
|
|
592
|
+
_: 2
|
|
593
|
+
}, 1032, ["row", "onRowClick"])
|
|
594
|
+
]),
|
|
595
|
+
_: 1
|
|
596
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
597
|
+
], 2),
|
|
598
|
+
(x(), T(pe, { to: "body" }, [
|
|
599
|
+
v(Je, fe(ve(b(i))), null, 16)
|
|
600
|
+
]))
|
|
601
|
+
]),
|
|
602
|
+
_: 1
|
|
603
|
+
}, 8, ["title", "actions"]);
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
export {
|
|
608
|
+
it as default
|
|
609
|
+
};
|