@feedmepos/mf-inventory-portal 1.2.12 → 1.2.14-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-BsAX8Df8.js +286 -0
- package/dist/{ApprovalView-D8_PzEpZ.js → ApprovalView-BT-A6f4_.js} +26 -26
- package/dist/{BindingsDialog-BbpKhb0L.js → BindingsDialog-CNpvAGHr.js} +2 -2
- package/dist/{BindingsPicker-DzDxisHj.js → BindingsPicker-D-vmVplT.js} +10 -10
- package/dist/{BindingsTable-DCXXSY8e.js → BindingsTable-Z7PTxSy6.js} +1 -1
- package/dist/{ClosingDraftView-CkF-9An8.js → ClosingDraftView-C_3P7kh0.js} +44 -44
- package/dist/{ClosingTemplateView-Ce1l7n0x.js → ClosingTemplateView-CimxBGT-.js} +26 -26
- package/dist/{DeliveryOrderPrintPreview-CFzsECiK.js → DeliveryOrderPrintPreview-CMTO9y6R.js} +10 -10
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-ZSERZzyn.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DMK3P4pu.js} +15 -15
- package/dist/{FmMultiselectDialog-DP992D0Q.js → FmMultiselectDialog-D6f0A92U.js} +4 -4
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CzUvuj_c.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CJvnR-aO.js} +54 -54
- package/dist/ImportView-CTYLH5Mz.js +1303 -0
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DsYwSn0d.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BbmtJ6Ge.js} +1 -1
- package/dist/{IngredientGroupView-DUiKKpvF.js → IngredientGroupView-wygIXAKy.js} +19 -20
- package/dist/IngredientsView-Ct3eNIqS.js +2240 -0
- package/dist/{IntegrationView-CydpIwrf.js → IntegrationView-CKA76Mi6.js} +3 -3
- package/dist/{InventoryBindingForm-BVd2FzOW.js → InventoryBindingForm-CdK2Ujur.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CYp_JSBb.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B-O0bjxU.js} +12 -12
- package/dist/{InventoryBindingSummary-Dthool-6.js → InventoryBindingSummary-DN6sSW2u.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DR0_Qtyc.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BK65pQy4.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BLfGb7mm.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DrFtLYGt.js} +1 -1
- package/dist/{PublishView-BE_aIhZ6.js → PublishView-LJA3-Xmq.js} +25 -25
- package/dist/{PurchaseOrderPrintPreview-CGeqqFg-.js → PurchaseOrderPrintPreview-CpnoNRcV.js} +12 -12
- package/dist/{ReceiveRequestView-Bul9Esf1.js → ReceiveRequestView-d7KmB_XN.js} +131 -132
- package/dist/RecipeView-B7PtWfJ-.js +636 -0
- package/dist/{StockView-fpJrx4Bd.js → StockView-DoataAnD.js} +165 -166
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DeOEgJ1N.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BZNMBDJ7.js} +1 -1
- package/dist/{SupplierView-cfZTJqef.js → SupplierView-D9Kb7rAO.js} +4 -4
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CfnN-1oC.js +3385 -0
- package/dist/{TransferTemplateView-PZ8Mad4D.js → TransferTemplateView-D9mrfBH5.js} +166 -166
- package/dist/UnitView-BP5IzLw2.js +674 -0
- package/dist/{WarehouseView-CWGQjwJm.js → WarehouseView-B-qnAHv5.js} +32 -32
- package/dist/api/inventory.d.ts +306 -0
- package/dist/api/purchase-order.d.ts +1 -0
- package/dist/{app-D5PlbdVa.js → app-DDKw9H3a.js} +11730 -11115
- package/dist/app.d.ts +421 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-C4FizLUw.js → closing-template-BYCZ8etT.js} +1 -1
- package/dist/{decimal-Cv7FZ14q.js → decimal-DMb7zEqx.js} +1 -1
- package/dist/{format-unit-display-B0NO6FLh.js → format-unit-display-BCTXGGeT.js} +24 -24
- package/dist/helper/number.d.ts +1 -0
- package/dist/import-export.helper-B4JVPOJK.js +243 -0
- package/dist/{index-DaJ92t7D.js → index-BZIogw8R.js} +1 -1
- package/dist/{index-BCo2jtpG.js → index-B__hxI_k.js} +1 -1
- package/dist/{purchase-order-template-DLkR7Mva.js → purchase-order-template-Duc9oBWo.js} +1 -1
- package/dist/router/name.d.ts +1 -0
- package/dist/{stock-AUSAF9Ij.js → stock-cFTv_nsm.js} +1 -1
- package/dist/stores/feature.d.ts +2 -0
- package/dist/stores/inventory.d.ts +26 -199
- package/dist/{supplier-DBXoP2UX.js → supplier-CESqvbEF.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-DZQR6jfi.js → use-ingredient-select-dialog-DRJNoQTb.js} +4 -4
- package/dist/{use-inventory-binding-dialog-8PZ37vLV.js → use-inventory-binding-dialog-DTK5yRv9.js} +1 -1
- package/dist/views/import/ImportView.vue.d.ts +3 -0
- package/dist/views/import/components/ImportDialog.vue.d.ts +2 -0
- package/dist/views/import/helper/import-export.helper.d.ts +4 -0
- package/dist/views/ingredients/helper/import-export.helper.d.ts +3 -1
- package/dist/views/receive-request/components/delivery-order-form/SystemTrailDialog.vue.d.ts +17 -0
- package/dist/views/receive-request/components/netsuite/NetSuiteTransactionChangeLog.vue.d.ts +15 -0
- package/dist/views/recipe/RecipeView.vue.d.ts +1 -0
- package/dist/views/recipe/components/import-recipes/ImportRecipeItem.vue.d.ts +16 -0
- package/dist/views/recipe/components/import-recipes/ImportRecipes.vue.d.ts +2 -0
- package/dist/views/recipe/helper/import-recipe.d.ts +48 -0
- package/dist/views/unit/UnitView.vue.d.ts +1 -0
- package/dist/views/unit/components/import-units/ImportUnitItem.vue.d.ts +12 -0
- package/dist/views/unit/components/import-units/ImportUnitItemProps.d.ts +6 -0
- package/dist/views/unit/components/import-units/ImportUnits.vue.d.ts +9 -0
- package/dist/views/unit/components/import-units/ImportUnitsProps.d.ts +5 -0
- package/dist/views/unit/helper/import-export.helper.d.ts +40 -0
- package/package.json +2 -2
- package/dist/App-CP0Qx_82.js +0 -276
- package/dist/IngredientsView-C3ozIXV8.js +0 -2475
- package/dist/RecipeView-B9AGELV7.js +0 -621
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-m5o77oG-.js +0 -3057
- package/dist/UnitView-C3gJq1Mt.js +0 -667
- package/dist/array-Ca8T3f_G.js +0 -44
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
import { defineComponent as J, computed as b, openBlock as v, createElementBlock as w, createElementVNode as s, Fragment as K, renderList as G, toDisplayString as h, createCommentVNode as Z, ref as I, watch as oe, resolveComponent as $, createBlock as T, withCtx as A, createVNode as f, unref as i, isRef as le, normalizeClass as me, normalizeStyle as ce, Teleport as pe, normalizeProps as ve, guardReactiveProps as fe } from "vue";
|
|
2
|
+
import { a as O, e as U, S as ye, i as be, D as se, j as q, f as ie, Z as ge, q as H, A as xe, l as Q, $ as _e, a0 as he, x as ae, u as Ve, b as Ue, E as we, G as Ce, I as Se, J as ke, K as Ee } from "./app-DDKw9H3a.js";
|
|
3
|
+
import { useDialog as ue, useSnackbar as X, useProxiedModel as re, useBreakpoints as Fe } from "@feedmepos/ui-library";
|
|
4
|
+
import { i as $e, _ as Ie } from "./is-linked-ingredient-error-fJ2TJb3z.js";
|
|
5
|
+
import { defineStore as Ae, storeToRefs as De } from "pinia";
|
|
6
|
+
import { useI18n as Y } from "@feedmepos/mf-common";
|
|
7
|
+
import { F as Re } from "./decimal-DMb7zEqx.js";
|
|
8
|
+
import { _ as Me } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BK65pQy4.js";
|
|
9
|
+
const Pe = { class: "flex flex-col gap-8" }, Te = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "flex flex-col"
|
|
12
|
+
}, Be = { class: "flex-1 py-8 px-16" }, Le = {
|
|
13
|
+
class: "flex-0 py-8 px-16",
|
|
14
|
+
style: { "flex-basis": "240px" }
|
|
15
|
+
}, Ne = {
|
|
16
|
+
key: 1,
|
|
17
|
+
class: "flex flex-col"
|
|
18
|
+
}, ze = { class: "flex-1 py-8 px-16" }, je = {
|
|
19
|
+
class: "flex-0 py-8 px-16",
|
|
20
|
+
style: { "flex-basis": "240px" }
|
|
21
|
+
}, qe = {
|
|
22
|
+
key: 2,
|
|
23
|
+
class: "flex flex-col"
|
|
24
|
+
}, He = { class: "flex-1 py-8 px-16" }, Ke = {
|
|
25
|
+
class: "flex-0 py-8 px-16",
|
|
26
|
+
style: { "flex-basis": "240px" }
|
|
27
|
+
}, Ge = /* @__PURE__ */ J({
|
|
28
|
+
__name: "UnitUsedBy",
|
|
29
|
+
props: {
|
|
30
|
+
unit: {}
|
|
31
|
+
},
|
|
32
|
+
setup(S) {
|
|
33
|
+
const c = S, g = O(), m = b(() => g.validateUnitUsage(c.unit)), l = b(() => m.value.filter((n) => n.from === "INGREDIENT")), a = b(() => m.value.filter((n) => n.from === "RECIPE")), d = b(() => m.value.filter((n) => n.from === "MENU"));
|
|
34
|
+
return (n, p) => (v(), w("div", Pe, [
|
|
35
|
+
p[3] || (p[3] = s("div", { class: "fm-typo-en-body-md-400" }, "Sorry, this unit is used in the following modules:", -1)),
|
|
36
|
+
l.value.length ? (v(), w("div", Te, [
|
|
37
|
+
p[0] || (p[0] = s("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
|
|
38
|
+
s("div", { class: "flex-1 py-8 px-16" }, "Ingredient"),
|
|
39
|
+
s("div", {
|
|
40
|
+
class: "flex-0 py-8 px-16",
|
|
41
|
+
style: { "flex-basis": "240px" }
|
|
42
|
+
}, "Used in")
|
|
43
|
+
], -1)),
|
|
44
|
+
(v(!0), w(K, null, G(l.value, (r) => {
|
|
45
|
+
var t;
|
|
46
|
+
return v(), w("div", {
|
|
47
|
+
key: r.code,
|
|
48
|
+
class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
|
|
49
|
+
}, [
|
|
50
|
+
s("div", Be, h(r.code) + " " + h(r.name), 1),
|
|
51
|
+
s("div", Le, h((t = r.bindedIngredient) != null && t.length ? "Convert binding" : "Item unit"), 1)
|
|
52
|
+
]);
|
|
53
|
+
}), 128))
|
|
54
|
+
])) : Z("", !0),
|
|
55
|
+
a.value.length ? (v(), w("div", Ne, [
|
|
56
|
+
p[1] || (p[1] = s("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
|
|
57
|
+
s("div", { class: "flex-1 py-8 px-16" }, "Recipe"),
|
|
58
|
+
s("div", {
|
|
59
|
+
class: "flex-0 py-8 px-16",
|
|
60
|
+
style: { "flex-basis": "240px" }
|
|
61
|
+
}, "Used in")
|
|
62
|
+
], -1)),
|
|
63
|
+
(v(!0), w(K, null, G(a.value, (r) => {
|
|
64
|
+
var t, u, y;
|
|
65
|
+
return v(), w("div", {
|
|
66
|
+
key: r.code,
|
|
67
|
+
class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
|
|
68
|
+
}, [
|
|
69
|
+
s("div", ze, h(r.code) + " " + h(r.name), 1),
|
|
70
|
+
s("div", je, h((t = r.bindedIngredient) == null ? void 0 : t.slice(0, 3).map((k) => k.code).join(", ")) + " " + h(r.bindedIngredient && ((u = r.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((y = r.bindedIngredient) == null ? void 0 : y.length) - 3} more` : ""), 1)
|
|
71
|
+
]);
|
|
72
|
+
}), 128))
|
|
73
|
+
])) : Z("", !0),
|
|
74
|
+
d.value.length ? (v(), w("div", qe, [
|
|
75
|
+
p[2] || (p[2] = s("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
|
|
76
|
+
s("div", { class: "flex-1 py-8 px-16" }, "Menu"),
|
|
77
|
+
s("div", {
|
|
78
|
+
class: "flex-0 py-8 px-16",
|
|
79
|
+
style: { "flex-basis": "240px" }
|
|
80
|
+
}, "Used in")
|
|
81
|
+
], -1)),
|
|
82
|
+
(v(!0), w(K, null, G(d.value, (r) => {
|
|
83
|
+
var t, u, y;
|
|
84
|
+
return v(), w("div", {
|
|
85
|
+
key: r.code,
|
|
86
|
+
class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
|
|
87
|
+
}, [
|
|
88
|
+
s("div", He, h(r.code) + " " + h(r.name), 1),
|
|
89
|
+
s("div", Ke, h((t = r.bindedIngredient) == null ? void 0 : t.slice(0, 3).map((k) => k.code).join(", ")) + " " + h(r.bindedIngredient && ((u = r.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((y = r.bindedIngredient) == null ? void 0 : y.length) - 3} more` : ""), 1)
|
|
90
|
+
]);
|
|
91
|
+
}), 128))
|
|
92
|
+
])) : Z("", !0)
|
|
93
|
+
]));
|
|
94
|
+
}
|
|
95
|
+
}), W = Ae("unitForm", function() {
|
|
96
|
+
const c = ue(), g = X(), m = O(), l = I(!1), a = I();
|
|
97
|
+
function d() {
|
|
98
|
+
const t = {
|
|
99
|
+
unit: {},
|
|
100
|
+
mode: U.CREATE,
|
|
101
|
+
show: !0,
|
|
102
|
+
"onUpdate:show"(u) {
|
|
103
|
+
a.value.show = u;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
a.value = t;
|
|
107
|
+
}
|
|
108
|
+
async function n(t) {
|
|
109
|
+
const u = {
|
|
110
|
+
unit: t,
|
|
111
|
+
mode: U.UPDATE,
|
|
112
|
+
show: !0,
|
|
113
|
+
"onUpdate:show"(y) {
|
|
114
|
+
a.value.show = y;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
a.value = u;
|
|
118
|
+
}
|
|
119
|
+
async function p(t) {
|
|
120
|
+
l.value = !0;
|
|
121
|
+
try {
|
|
122
|
+
await m.deleteUnit(t), g.open({
|
|
123
|
+
title: "Success",
|
|
124
|
+
message: `Deleted ${t.name}`,
|
|
125
|
+
type: "success"
|
|
126
|
+
});
|
|
127
|
+
} catch (u) {
|
|
128
|
+
u instanceof ye && $e(u) ? c.open({
|
|
129
|
+
title: "Cannot delete unit",
|
|
130
|
+
contentComponent: Ie,
|
|
131
|
+
contentComponentProps: {
|
|
132
|
+
subject: (t == null ? void 0 : t.name) ?? "",
|
|
133
|
+
items: u.errorResponse.message
|
|
134
|
+
},
|
|
135
|
+
secondaryActions: {
|
|
136
|
+
text: "Close",
|
|
137
|
+
close: !0
|
|
138
|
+
}
|
|
139
|
+
}) : console.log("unable to delete unit", u), g.open({
|
|
140
|
+
title: `Cannot delete ${t.name}`,
|
|
141
|
+
message: "Please try again.",
|
|
142
|
+
type: "error"
|
|
143
|
+
}), console.error("failed to delete unit", u);
|
|
144
|
+
} finally {
|
|
145
|
+
l.value = !1;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function r(t) {
|
|
149
|
+
if (m.validateUnitUsage(t).length) {
|
|
150
|
+
c.open({
|
|
151
|
+
title: `Cannot delete ${(t == null ? void 0 : t.name) ?? "unit"}`,
|
|
152
|
+
overlay: !0,
|
|
153
|
+
dismissAway: !0,
|
|
154
|
+
closeButton: !0,
|
|
155
|
+
contentComponent: Ge,
|
|
156
|
+
contentComponentProps: {
|
|
157
|
+
unit: t
|
|
158
|
+
},
|
|
159
|
+
primaryActions: {
|
|
160
|
+
text: "Confirm",
|
|
161
|
+
close: !0
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
c.open({
|
|
167
|
+
title: `Delete ${(t == null ? void 0 : t.name) ?? "unit"}?`,
|
|
168
|
+
closeButton: !1,
|
|
169
|
+
message: "You may not be able to delete this unit if it is linked in any of the inventory modules.",
|
|
170
|
+
primaryActions: {
|
|
171
|
+
text: "Delete",
|
|
172
|
+
close: !0,
|
|
173
|
+
variant: "destructive"
|
|
174
|
+
},
|
|
175
|
+
secondaryActions: {
|
|
176
|
+
text: "Cancel",
|
|
177
|
+
close: !0
|
|
178
|
+
}
|
|
179
|
+
}).onPrimary(() => p(t));
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
createUnit: d,
|
|
183
|
+
updateUnit: n,
|
|
184
|
+
deleteUnit: r,
|
|
185
|
+
unitDialogProps: a,
|
|
186
|
+
unitViewLoading: l
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
function Je() {
|
|
190
|
+
const { updateUnit: S, deleteUnit: c } = W(), { t: g } = Y();
|
|
191
|
+
async function m(a, d) {
|
|
192
|
+
const n = ie(d);
|
|
193
|
+
if (a === q.Edit) {
|
|
194
|
+
await S(n);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (a === q.Delete) {
|
|
198
|
+
await c(n);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return { columnDefs: [
|
|
203
|
+
{
|
|
204
|
+
accessorKey: "name",
|
|
205
|
+
header: g("inventory.unit.table.name"),
|
|
206
|
+
enableSorting: !0,
|
|
207
|
+
size: 300
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
accessorKey: "abbrev",
|
|
211
|
+
header: g("inventory.unit.table.symbol"),
|
|
212
|
+
enableSorting: !1,
|
|
213
|
+
size: "auto"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: "action",
|
|
217
|
+
header: "",
|
|
218
|
+
cell(a) {
|
|
219
|
+
return be(
|
|
220
|
+
[se[q.Edit], se[q.Delete]],
|
|
221
|
+
(d) => {
|
|
222
|
+
m(d, a.row.original);
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
},
|
|
226
|
+
enableSorting: !1,
|
|
227
|
+
size: 40,
|
|
228
|
+
meta: {
|
|
229
|
+
cellClass: "",
|
|
230
|
+
headerClass: ""
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
] };
|
|
234
|
+
}
|
|
235
|
+
const Oe = { class: "flex flex-col gap-24" }, Ye = { class: "flex gap-24" }, Ze = { class: "flex-1" }, Qe = { class: "flex-1" }, We = { class: "flex" }, Xe = { class: "flex items-center" }, et = { class: "fm-typo-en-body-lg-600 flex-grow" }, tt = { class: "flex flex-col gap-24" }, nt = { class: "flex gap-24" }, ot = { class: "flex-1" }, lt = { class: "flex-1" }, st = /* @__PURE__ */ J({
|
|
236
|
+
__name: "UnitForm",
|
|
237
|
+
props: {
|
|
238
|
+
mode: {},
|
|
239
|
+
modelValue: {},
|
|
240
|
+
disabled: { type: Boolean }
|
|
241
|
+
},
|
|
242
|
+
emits: ["update:modelValue", "click:submit"],
|
|
243
|
+
setup(S, { expose: c, emit: g }) {
|
|
244
|
+
const m = S, l = g, { t: a } = Y();
|
|
245
|
+
function d() {
|
|
246
|
+
l("click:submit");
|
|
247
|
+
}
|
|
248
|
+
const n = I(m.modelValue);
|
|
249
|
+
oe(
|
|
250
|
+
() => m.modelValue,
|
|
251
|
+
(e) => {
|
|
252
|
+
n.value = e;
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
const p = b({
|
|
256
|
+
get() {
|
|
257
|
+
var e;
|
|
258
|
+
return ((e = n.value) == null ? void 0 : e.name) ?? "";
|
|
259
|
+
},
|
|
260
|
+
set(e) {
|
|
261
|
+
n.value.name = e, l("update:modelValue", n.value);
|
|
262
|
+
}
|
|
263
|
+
}), r = b({
|
|
264
|
+
get() {
|
|
265
|
+
var e;
|
|
266
|
+
return ((e = n.value) == null ? void 0 : e.abbrev) ?? "";
|
|
267
|
+
},
|
|
268
|
+
set(e) {
|
|
269
|
+
n.value.abbrev = e, l("update:modelValue", n.value);
|
|
270
|
+
}
|
|
271
|
+
}), t = b({
|
|
272
|
+
get() {
|
|
273
|
+
var e;
|
|
274
|
+
return ((e = n.value) == null ? void 0 : e.precision) ?? 0;
|
|
275
|
+
},
|
|
276
|
+
set(e) {
|
|
277
|
+
n.value.precision = e, l("update:modelValue", n.value);
|
|
278
|
+
}
|
|
279
|
+
}), u = b({
|
|
280
|
+
get() {
|
|
281
|
+
var e;
|
|
282
|
+
return ((e = n.value) == null ? void 0 : e.measurements) ?? [];
|
|
283
|
+
},
|
|
284
|
+
set(e) {
|
|
285
|
+
n.value.measurements = e, l("update:modelValue", n.value);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
oe(
|
|
289
|
+
() => t.value,
|
|
290
|
+
(e) => {
|
|
291
|
+
if (typeof e == "number" && !isNaN(e)) {
|
|
292
|
+
const o = u.value.map((V) => ({
|
|
293
|
+
...V,
|
|
294
|
+
conversion: ge.convertPrecision({
|
|
295
|
+
value: V.conversion,
|
|
296
|
+
precision: e
|
|
297
|
+
})
|
|
298
|
+
}));
|
|
299
|
+
n.value.measurements = o, l("update:modelValue", n.value);
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
{ immediate: !0 }
|
|
303
|
+
);
|
|
304
|
+
function y() {
|
|
305
|
+
const e = n.value.measurements ?? [];
|
|
306
|
+
n.value.measurements = [
|
|
307
|
+
...e,
|
|
308
|
+
{
|
|
309
|
+
id: `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
310
|
+
name: "",
|
|
311
|
+
abbrev: "",
|
|
312
|
+
conversion: {
|
|
313
|
+
amount: 1,
|
|
314
|
+
precision: 0
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
], l("update:modelValue", n.value);
|
|
318
|
+
}
|
|
319
|
+
function k(e) {
|
|
320
|
+
const o = n.value.measurements ?? [];
|
|
321
|
+
o.splice(e, 1), n.value.measurements = o, l("update:modelValue", n.value);
|
|
322
|
+
}
|
|
323
|
+
const F = I();
|
|
324
|
+
return c({
|
|
325
|
+
validateInputs: () => {
|
|
326
|
+
var e, o;
|
|
327
|
+
(o = (e = F.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
|
|
328
|
+
},
|
|
329
|
+
resetInputsValidation: () => {
|
|
330
|
+
var e, o;
|
|
331
|
+
(o = (e = F.value) == null ? void 0 : e.resetInputsValidation) == null || o.call(e);
|
|
332
|
+
},
|
|
333
|
+
resetInputs: () => {
|
|
334
|
+
var e, o;
|
|
335
|
+
(o = (e = F.value) == null ? void 0 : e.resetInputs) == null || o.call(e);
|
|
336
|
+
}
|
|
337
|
+
}), (e, o) => {
|
|
338
|
+
const V = $("FmTextField"), R = $("FmStepperField"), C = $("FmButton"), M = $("FmCard"), D = $("FmForm");
|
|
339
|
+
return v(), T(D, {
|
|
340
|
+
ref_key: "formRef",
|
|
341
|
+
ref: F,
|
|
342
|
+
class: "flex flex-col gap-40",
|
|
343
|
+
onValidationSuccess: d
|
|
344
|
+
}, {
|
|
345
|
+
default: A(() => {
|
|
346
|
+
var B;
|
|
347
|
+
return [
|
|
348
|
+
s("div", Oe, [
|
|
349
|
+
s("div", Ye, [
|
|
350
|
+
s("div", Ze, [
|
|
351
|
+
f(V, {
|
|
352
|
+
disabled: e.disabled,
|
|
353
|
+
label: i(a)("inventory.unit.name"),
|
|
354
|
+
modelValue: p.value,
|
|
355
|
+
"onUpdate:modelValue": o[0] || (o[0] = (x) => p.value = x),
|
|
356
|
+
rules: [i(H)()],
|
|
357
|
+
"label-mark": "required"
|
|
358
|
+
}, null, 8, ["disabled", "label", "modelValue", "rules"])
|
|
359
|
+
]),
|
|
360
|
+
s("div", Qe, [
|
|
361
|
+
f(V, {
|
|
362
|
+
disabled: e.disabled,
|
|
363
|
+
label: i(a)("inventory.unit.symbol"),
|
|
364
|
+
modelValue: r.value,
|
|
365
|
+
"onUpdate:modelValue": o[1] || (o[1] = (x) => r.value = x),
|
|
366
|
+
rules: [i(H)()],
|
|
367
|
+
"label-mark": "required"
|
|
368
|
+
}, null, 8, ["disabled", "label", "modelValue", "rules"])
|
|
369
|
+
])
|
|
370
|
+
]),
|
|
371
|
+
s("div", null, [
|
|
372
|
+
f(R, {
|
|
373
|
+
disabled: e.disabled,
|
|
374
|
+
class: "col-span-3",
|
|
375
|
+
label: i(a)("inventory.unit.precision"),
|
|
376
|
+
modelValue: t.value,
|
|
377
|
+
"onUpdate:modelValue": o[2] || (o[2] = (x) => t.value = x),
|
|
378
|
+
rules: [i(xe)(0)]
|
|
379
|
+
}, null, 8, ["disabled", "label", "modelValue", "rules"])
|
|
380
|
+
])
|
|
381
|
+
]),
|
|
382
|
+
s("div", We, [
|
|
383
|
+
f(C, {
|
|
384
|
+
disabled: e.disabled,
|
|
385
|
+
type: "button",
|
|
386
|
+
"prepend-icon": "add",
|
|
387
|
+
label: i(a)("inventory.unit.measurement.addMeasurement"),
|
|
388
|
+
variant: "plain",
|
|
389
|
+
onClick: y
|
|
390
|
+
}, null, 8, ["disabled", "label"])
|
|
391
|
+
]),
|
|
392
|
+
(v(!0), w(K, null, G((B = e.modelValue) == null ? void 0 : B.measurements, (x, _) => (v(), T(M, {
|
|
393
|
+
class: "flex flex-col gap-16 p-16",
|
|
394
|
+
variant: "outlined",
|
|
395
|
+
key: x.id
|
|
396
|
+
}, {
|
|
397
|
+
default: A(() => [
|
|
398
|
+
s("div", Xe, [
|
|
399
|
+
s("div", et, h(i(a)("inventory.unit.measurement.measurementDefault", [_ + 1])), 1),
|
|
400
|
+
f(C, {
|
|
401
|
+
disabled: e.disabled,
|
|
402
|
+
variant: "tertiary",
|
|
403
|
+
"prepend-icon": "delete",
|
|
404
|
+
onClick: (E) => k(_)
|
|
405
|
+
}, null, 8, ["disabled", "onClick"])
|
|
406
|
+
]),
|
|
407
|
+
s("div", tt, [
|
|
408
|
+
s("div", nt, [
|
|
409
|
+
s("div", ot, [
|
|
410
|
+
f(V, {
|
|
411
|
+
disabled: e.disabled,
|
|
412
|
+
class: "col-span-2",
|
|
413
|
+
label: i(a)("inventory.unit.measurement.name"),
|
|
414
|
+
modelValue: e.modelValue.measurements[_].name,
|
|
415
|
+
"onUpdate:modelValue": (E) => e.modelValue.measurements[_].name = E,
|
|
416
|
+
rules: [i(H)()],
|
|
417
|
+
"label-mark": "required"
|
|
418
|
+
}, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
|
|
419
|
+
]),
|
|
420
|
+
s("div", lt, [
|
|
421
|
+
f(V, {
|
|
422
|
+
disabled: e.disabled,
|
|
423
|
+
label: i(a)("inventory.unit.measurement.symbol"),
|
|
424
|
+
modelValue: e.modelValue.measurements[_].abbrev,
|
|
425
|
+
"onUpdate:modelValue": (E) => e.modelValue.measurements[_].abbrev = E,
|
|
426
|
+
rules: [i(H)()],
|
|
427
|
+
"label-mark": "required"
|
|
428
|
+
}, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
|
|
429
|
+
])
|
|
430
|
+
]),
|
|
431
|
+
f(Me, {
|
|
432
|
+
disabled: e.disabled,
|
|
433
|
+
class: "col-span-3",
|
|
434
|
+
label: i(a)("inventory.unit.measurement.conversion"),
|
|
435
|
+
"model-value": +i(Q)(e.modelValue.measurements[_].conversion),
|
|
436
|
+
"onUpdate:modelValue": (E) => u.value = u.value.map(
|
|
437
|
+
(P, L) => L === _ ? {
|
|
438
|
+
...P,
|
|
439
|
+
conversion: i(Re).toPrecision(
|
|
440
|
+
i(_e)(E),
|
|
441
|
+
t.value
|
|
442
|
+
)
|
|
443
|
+
} : P
|
|
444
|
+
),
|
|
445
|
+
rules: [i(he)(0)],
|
|
446
|
+
step: +i(Q)({ amount: 1, precision: t.value }),
|
|
447
|
+
"helper-text": i(a)("inventory.unit.measurement.conversionHelper", {
|
|
448
|
+
measurementSymbol: e.modelValue.measurements[_].name || " measurement unit",
|
|
449
|
+
conversion: +i(Q)(e.modelValue.measurements[_].conversion),
|
|
450
|
+
unitSymbol: r.value || "base unit"
|
|
451
|
+
})
|
|
452
|
+
}, null, 8, ["disabled", "label", "model-value", "onUpdate:modelValue", "rules", "step", "helper-text"])
|
|
453
|
+
])
|
|
454
|
+
]),
|
|
455
|
+
_: 2
|
|
456
|
+
}, 1024))), 128))
|
|
457
|
+
];
|
|
458
|
+
}),
|
|
459
|
+
_: 1
|
|
460
|
+
}, 512);
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
}), at = { class: "flex gap-4" }, rt = /* @__PURE__ */ J({
|
|
464
|
+
__name: "UnitDialog",
|
|
465
|
+
props: {
|
|
466
|
+
show: { type: Boolean },
|
|
467
|
+
unit: {},
|
|
468
|
+
mode: { default: U.READ }
|
|
469
|
+
},
|
|
470
|
+
emits: ["update:show"],
|
|
471
|
+
setup(S) {
|
|
472
|
+
const c = S, g = O(), m = X(), { t: l } = Y(), a = re(c, "show"), d = re(c, "unit"), n = b(() => {
|
|
473
|
+
switch (c.mode) {
|
|
474
|
+
case U.READ:
|
|
475
|
+
return "";
|
|
476
|
+
case U.UPDATE:
|
|
477
|
+
return l("inventory.unit.update.title");
|
|
478
|
+
case U.CREATE:
|
|
479
|
+
return l("inventory.unit.create.title");
|
|
480
|
+
}
|
|
481
|
+
return "";
|
|
482
|
+
}), p = b(() => {
|
|
483
|
+
switch (c.mode) {
|
|
484
|
+
case U.READ:
|
|
485
|
+
return "";
|
|
486
|
+
case U.UPDATE:
|
|
487
|
+
return l("common.save");
|
|
488
|
+
case U.CREATE:
|
|
489
|
+
return l("common.add");
|
|
490
|
+
}
|
|
491
|
+
return "";
|
|
492
|
+
}), r = I(), t = I(!1);
|
|
493
|
+
async function u() {
|
|
494
|
+
t.value = !0;
|
|
495
|
+
try {
|
|
496
|
+
const e = ie(d.value);
|
|
497
|
+
e.precision ?? (e.precision = 0), e.measurements ?? (e.measurements = []), await g.createUnit(e), a.value = !1, m.open({
|
|
498
|
+
title: l("inventory.common.success"),
|
|
499
|
+
message: l("inventory.unit.create.success", { name: d.value.name }),
|
|
500
|
+
type: "success"
|
|
501
|
+
});
|
|
502
|
+
} catch (e) {
|
|
503
|
+
e instanceof ae || m.open({
|
|
504
|
+
title: l("inventory.unit.create.error.title"),
|
|
505
|
+
message: l("inventory.unit.create.error.message"),
|
|
506
|
+
type: "error"
|
|
507
|
+
});
|
|
508
|
+
} finally {
|
|
509
|
+
t.value = !1;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
async function y() {
|
|
513
|
+
t.value = !0;
|
|
514
|
+
try {
|
|
515
|
+
await g.updateUnit(d.value), a.value = !1, m.open({
|
|
516
|
+
title: l("inventory.common.success"),
|
|
517
|
+
message: l("inventory.unit.update.success", { name: d.value.name }),
|
|
518
|
+
type: "success"
|
|
519
|
+
});
|
|
520
|
+
} catch (e) {
|
|
521
|
+
e instanceof ae || m.open({
|
|
522
|
+
title: l("inventory.unit.update.error.title"),
|
|
523
|
+
message: l("inventory.unit.update.error.message"),
|
|
524
|
+
type: "error"
|
|
525
|
+
});
|
|
526
|
+
} finally {
|
|
527
|
+
t.value = !1;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
function k() {
|
|
531
|
+
var e, o;
|
|
532
|
+
(o = (e = r.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
|
|
533
|
+
}
|
|
534
|
+
function F() {
|
|
535
|
+
switch (c.mode) {
|
|
536
|
+
case U.READ:
|
|
537
|
+
return;
|
|
538
|
+
case U.UPDATE:
|
|
539
|
+
return y();
|
|
540
|
+
case U.CREATE:
|
|
541
|
+
return u();
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return (e, o) => {
|
|
545
|
+
const V = $("FmButton"), R = $("FmSideSheet");
|
|
546
|
+
return v(), T(R, {
|
|
547
|
+
"model-value": i(a),
|
|
548
|
+
"onUpdate:modelValue": o[3] || (o[3] = (C) => le(a) ? a.value = C : null),
|
|
549
|
+
header: n.value,
|
|
550
|
+
"close-button": "",
|
|
551
|
+
"dismiss-away": "",
|
|
552
|
+
"max-width": 500
|
|
553
|
+
}, {
|
|
554
|
+
"side-sheet-footer": A(() => [
|
|
555
|
+
s("div", at, [
|
|
556
|
+
f(V, {
|
|
557
|
+
loading: t.value,
|
|
558
|
+
label: p.value,
|
|
559
|
+
onClick: k
|
|
560
|
+
}, null, 8, ["loading", "label"]),
|
|
561
|
+
f(V, {
|
|
562
|
+
disabled: t.value,
|
|
563
|
+
label: i(l)("common.close"),
|
|
564
|
+
variant: "tertiary",
|
|
565
|
+
onClick: o[2] || (o[2] = (C) => a.value = !1)
|
|
566
|
+
}, null, 8, ["disabled", "label"])
|
|
567
|
+
])
|
|
568
|
+
]),
|
|
569
|
+
default: A(() => [
|
|
570
|
+
f(st, {
|
|
571
|
+
class: "w-full",
|
|
572
|
+
ref_key: "hasValidationExpose",
|
|
573
|
+
ref: r,
|
|
574
|
+
modelValue: i(d),
|
|
575
|
+
"onUpdate:modelValue": o[0] || (o[0] = (C) => le(d) ? d.value = C : null),
|
|
576
|
+
mode: e.mode,
|
|
577
|
+
disabled: t.value,
|
|
578
|
+
"onClick:submit": o[1] || (o[1] = (C) => F())
|
|
579
|
+
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
580
|
+
]),
|
|
581
|
+
_: 1
|
|
582
|
+
}, 8, ["model-value", "header"]);
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
}), it = { class: "flex flex-col py-8" }, ut = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xt = /* @__PURE__ */ J({
|
|
586
|
+
__name: "UnitView",
|
|
587
|
+
setup(S) {
|
|
588
|
+
const c = O(), g = Ve(), m = Ue();
|
|
589
|
+
ue(), X();
|
|
590
|
+
const { t: l } = Y(), a = b(() => c.units), { createUnit: d, updateUnit: n } = W(), { unitDialogProps: p, unitViewLoading: r } = De(W()), { columnDefs: t } = Je();
|
|
591
|
+
function u(M) {
|
|
592
|
+
switch (M) {
|
|
593
|
+
case "add":
|
|
594
|
+
return m.isEnabled ? void 0 : d();
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
const y = I(""), k = I(!1), F = b(() => k.value || r.value), { breakpoints: e } = Fe(), o = b(() => e.value.xs || e.value.sm), V = b(() => o.value ? 10 : 20), R = we(), C = b(() => [
|
|
598
|
+
...m.isEnabled ? [] : [
|
|
599
|
+
{
|
|
600
|
+
label: l("inventory.unit.create.title"),
|
|
601
|
+
value: "add",
|
|
602
|
+
isPrimary: !0,
|
|
603
|
+
prependIcon: "add"
|
|
604
|
+
}
|
|
605
|
+
]
|
|
606
|
+
]);
|
|
607
|
+
return (M, D) => {
|
|
608
|
+
const B = $("FmTable");
|
|
609
|
+
return v(), T(Ce, {
|
|
610
|
+
title: i(l)("inventory.unit.title"),
|
|
611
|
+
actions: C.value,
|
|
612
|
+
"onClick:action": u
|
|
613
|
+
}, {
|
|
614
|
+
default: A(() => [
|
|
615
|
+
s("div", {
|
|
616
|
+
class: me([
|
|
617
|
+
"flex flex-col gap-8 max-h-full",
|
|
618
|
+
{
|
|
619
|
+
"p-0": o.value,
|
|
620
|
+
"px-24 ": !o.value
|
|
621
|
+
}
|
|
622
|
+
])
|
|
623
|
+
}, [
|
|
624
|
+
f(Se, {
|
|
625
|
+
searchable: "",
|
|
626
|
+
search: y.value,
|
|
627
|
+
"onUpdate:search": D[0] || (D[0] = (x) => y.value = x)
|
|
628
|
+
}, null, 8, ["search"]),
|
|
629
|
+
f(B, {
|
|
630
|
+
style: ce(i(R).tableHeight),
|
|
631
|
+
"column-defs": i(t),
|
|
632
|
+
"row-data": a.value,
|
|
633
|
+
"search-value": y.value,
|
|
634
|
+
loading: !i(g)._currentLocation || F.value,
|
|
635
|
+
onRowClick: D[1] || (D[1] = (x) => i(n)(x.original)),
|
|
636
|
+
"page-size": V.value
|
|
637
|
+
}, {
|
|
638
|
+
"list-row": A((x) => [
|
|
639
|
+
f(ke, {
|
|
640
|
+
row: x,
|
|
641
|
+
onRowClick: i(n)
|
|
642
|
+
}, {
|
|
643
|
+
default: A((_) => {
|
|
644
|
+
var E, P, L, N, ee, z, te, j, ne;
|
|
645
|
+
return [
|
|
646
|
+
s("div", it, [
|
|
647
|
+
s("div", ut, [
|
|
648
|
+
f(i(Ee), {
|
|
649
|
+
render: (L = (P = (E = _.name) == null ? void 0 : E.column) == null ? void 0 : P.columnDef) == null ? void 0 : L.cell,
|
|
650
|
+
props: (ee = (N = _.name) == null ? void 0 : N.getContext) == null ? void 0 : ee.call(N)
|
|
651
|
+
}, null, 8, ["render", "props"])
|
|
652
|
+
]),
|
|
653
|
+
s("div", dt, h((ne = (j = (te = (z = x.original.measurements) == null ? void 0 : z.map) == null ? void 0 : te.call(z, (de) => de.name)) == null ? void 0 : j.join) == null ? void 0 : ne.call(j, ", ")), 1)
|
|
654
|
+
])
|
|
655
|
+
];
|
|
656
|
+
}),
|
|
657
|
+
_: 2
|
|
658
|
+
}, 1032, ["row", "onRowClick"])
|
|
659
|
+
]),
|
|
660
|
+
_: 1
|
|
661
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
662
|
+
], 2),
|
|
663
|
+
(v(), T(pe, { to: "body" }, [
|
|
664
|
+
f(rt, ve(fe(i(p))), null, 16)
|
|
665
|
+
]))
|
|
666
|
+
]),
|
|
667
|
+
_: 1
|
|
668
|
+
}, 8, ["title", "actions"]);
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
export {
|
|
673
|
+
xt as default
|
|
674
|
+
};
|