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
@@ -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