Start adding ui for nutrition.
This commit is contained in:
1 parent
627564e8c6
commit
7986632dab
6 files changed
+124
-14
No files matched your search
@@ -96,6 +96,8 @@
|
||||
|
||||
<v-divider vertical/>
|
||||
|
||||
<Nutrition v-bind:nutrition="store.article.nutritional"/>
|
||||
|
||||
<v-btn
|
||||
:flat="true"
|
||||
@click="toggleEdit();"
|
||||
@@ -108,6 +110,7 @@
|
||||
Bearbeiten
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
|
||||
</v-row>
|
||||
</v-card-title>
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
|
||||
const article: Article = new Article(0, name.value, bio.value, origin.value, description.value,
|
||||
ingredients.value, default_unit.value, [],
|
||||
mhd.value, bio_origin.value, allergens_text.value, bio_info.value, topm_id.value, additional_name.value);
|
||||
mhd.value, bio_origin.value, allergens_text.value, bio_info.value, topm_id.value,
|
||||
additional_name.value, null);
|
||||
|
||||
await store.createArticle(article);
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
<script setup lang="ts">
|
||||
import {useLabelEditorStore} from "~/store/labelEditorStore";
|
||||
import type {Ref} from "vue";
|
||||
import DeleteConfirm from "~/components/ui/deleteConfirm.vue";
|
||||
import type {Nutritional} from "~/types/nutritional.ts";
|
||||
|
||||
const props = defineProps({
|
||||
nutrition: {type: Object as PropType<Nutritional | null>, required: true},
|
||||
});
|
||||
|
||||
let store = useLabelEditorStore();
|
||||
let loading: Ref<boolean> = ref<boolean>(false);
|
||||
let dialog: Ref<boolean> = ref<boolean>(false);
|
||||
|
||||
async function updateNutrition() {
|
||||
|
||||
}
|
||||
|
||||
async function deleteNutrition() {
|
||||
|
||||
closeDialog();
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
dialog.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-dialog
|
||||
v-model="dialog"
|
||||
:scrollable="true"
|
||||
width="800"
|
||||
max-height="750"
|
||||
height="750"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn
|
||||
:flat="true"
|
||||
v-bind="props"
|
||||
size="small"
|
||||
>
|
||||
<v-icon v-if="nutrition != null" color="success">mdi-nutrition</v-icon>
|
||||
<v-icon v-else>mdi-nutrition</v-icon>
|
||||
|
||||
<v-tooltip v-if="nutrition != null"
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
Nährwerte
|
||||
</v-tooltip>
|
||||
|
||||
<v-tooltip v-else
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
Nährwerte hinzufügen
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<v-row style="padding-top: 10px">
|
||||
<v-icon size="small">
|
||||
mdi-nutrition
|
||||
</v-icon>
|
||||
|
||||
Nährwerte
|
||||
|
||||
<v-progress-circular v-if="loading" indeterminate :size="15" :width="2"></v-progress-circular>
|
||||
</v-row>
|
||||
</v-card-title>
|
||||
|
||||
<v-divider/>
|
||||
|
||||
<v-card-text>
|
||||
test
|
||||
</v-card-text>
|
||||
|
||||
<v-divider/>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer/>
|
||||
<DeleteConfirm
|
||||
title="Nährwert löschen?"
|
||||
:disable="!loading"
|
||||
@delete="deleteNutrition()"
|
||||
/>
|
||||
<v-divider vertical/>
|
||||
|
||||
<v-btn
|
||||
variant="text"
|
||||
:disabled="loading"
|
||||
@click="closeDialog()"
|
||||
>
|
||||
Speichern
|
||||
</v-btn>
|
||||
|
||||
<v-btn
|
||||
variant="text"
|
||||
:disabled="loading"
|
||||
@click="closeDialog()"
|
||||
>
|
||||
Schließen
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,11 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -4,6 +4,7 @@
|
||||
import { Variant } from "~/types/variant";
|
||||
import type {Unit} from "~/types/unit";
|
||||
import type {Label} from "~/types/label";
|
||||
import type {Nutritional} from "~/types/nutritional.ts";
|
||||
|
||||
let store = useLabelEditorStore();
|
||||
|
||||
@@ -33,7 +34,7 @@
|
||||
|
||||
const variant: Variant = new Variant(0, weight.value, ean.value, name.value,
|
||||
description.value, ingredients.value, unit.value, label.value,
|
||||
variant_description.value, topm_row.value);
|
||||
variant_description.value, topm_row.value, null);
|
||||
|
||||
await store.addVariant(variant);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import DeleteConfirm from "~/components/ui/deleteConfirm.vue";
|
||||
import type {Unit} from "~/types/unit";
|
||||
import type {Label} from "~/types/label";
|
||||
import type {Nutritional} from "~/types/nutritional.ts";
|
||||
|
||||
let store = useLabelEditorStore();
|
||||
|
||||
@@ -23,6 +24,7 @@
|
||||
let label: Ref<Label | null> = ref<Label | null>(JSON.parse(JSON.stringify(props.variant.label)));
|
||||
let variant_description: Ref<string | null> = ref<string | null>(JSON.parse(JSON.stringify(props.variant.variant_description)));
|
||||
let topm_row: Ref<string | null> = ref<string | null>(JSON.parse(JSON.stringify(props.variant.topm_row)));
|
||||
let nutrition: Ref<Nutritional | null> = ref<Nutritional | null>(JSON.parse(JSON.stringify(props.variant.nutritional)));
|
||||
|
||||
function toggleEdit() {
|
||||
if (edit.value) {
|
||||
@@ -51,7 +53,7 @@
|
||||
if (weight.value != null && unit.value != null) {
|
||||
let updateVariant: Variant = new Variant(props.variant.id, weight.value,
|
||||
ean.value, name.value, description.value, ingredients.value,
|
||||
unit.value, label.value, variant_description.value, topm_row.value);
|
||||
unit.value, label.value, variant_description.value, topm_row.value, nutrition.value);
|
||||
|
||||
await store.updateVariant(updateVariant);
|
||||
|
||||
|
||||
Reference in new issue
Block a user