Added unit to db and structs/types.

This commit is contained in:
2026-01-26 22:09:32 +01:00
parent 7879f69255
commit 8a27639aad
14 changed files with 243 additions and 60 deletions
+12 -7
View File
@@ -115,7 +115,7 @@
<v-card-text>
<v-row no-gutters>
<v-col cols="2">
<v-col cols="2" style="padding: 5px;">
<v-row no-gutters>
<v-checkbox
v-model="store.articleEdit.bio"
@@ -126,16 +126,21 @@
<v-row no-gutters>
<v-col cols="5">
<v-sheet>
Herkunft:
</v-sheet>
Herkunft:
</v-col>
<v-col>
<v-sheet>
{{ originToString(store.article.origin) }}
</v-sheet>
{{ originToString(store.article.origin) }}
</v-col>
</v-row>
<v-row>
<v-select
v-model="store.articleEdit.default_unit"
:items="store.units"
label="Standard Einheit"
:readonly="!edit"
></v-select>
</v-row>
</v-col>
<v-col cols="5" style="padding: 5px;">
@@ -3,6 +3,7 @@
import {useLabelEditorStore} from "~/store/labelEditorStore";
import {Article} from "~/types/article";
import {Origin} from "~/types/origin";
import type {Unit} from "~/types/unit";
let store = useLabelEditorStore();
@@ -12,16 +13,18 @@
let name: Ref<string | null> = ref<string | null>(null);
let bio: Ref<boolean> = ref<boolean>(false);
let origin: Ref<Origin | null> = ref<Origin | null>(null);
let default_unit: Ref<Unit | null> = ref<Unit | null>(null);
let description: Ref<string | null> = ref<string | null>(null);
let ingredients: Ref<string | null> = ref<string | null>(null);
async function create() {
if (name.value != null && name.value.trim().length > 0 &&
origin.value != null && origin.value.trim().length > 0
origin.value != null && origin.value.trim().length > 0 &&
default_unit.value != null && default_unit.value.trim().length > 0
) {
loading.value = true;
const article: Article = new Article(0, name.value, bio.value, origin.value, description.value, ingredients.value, []);
const article: Article = new Article(0, name.value, bio.value, origin.value, description.value, ingredients.value, default_unit.value, []);
await store.createArticle(article);
@@ -102,6 +105,13 @@
label="Herkunft"
></v-select>
</v-col>
<v-col>
<v-select
v-model="default_unit"
:items="store.units"
label="Standard Einheit"
></v-select>
</v-col>
</v-row>
<v-textarea