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