Show article information.
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {useLabelEditorStore} from "~/store/labelEditorStore";
|
import {useLabelEditorStore} from "~/store/labelEditorStore";
|
||||||
|
import {originToString} from "~/types/origin";
|
||||||
|
|
||||||
let store = useLabelEditorStore();
|
let store = useLabelEditorStore();
|
||||||
|
|
||||||
|
//const rules = [(v: string | any[]) => v.length <= 256 || 'Maximal 256 Zeichen.'];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -14,40 +17,57 @@
|
|||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-row no-gutters>
|
<v-row no-gutters>
|
||||||
<v-col cols="2">
|
<v-col cols="2">
|
||||||
<v-sheet>
|
<v-row no-gutters>
|
||||||
BIO:
|
<v-checkbox
|
||||||
</v-sheet>
|
v-model="store.article.bio"
|
||||||
</v-col>
|
label="BIO"
|
||||||
<v-col>
|
:readonly=true
|
||||||
<v-sheet>
|
/>
|
||||||
{{ store.article.bio }}
|
</v-row>
|
||||||
</v-sheet>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row no-gutters>
|
<v-row no-gutters>
|
||||||
<v-col cols="2">
|
<v-col cols="5">
|
||||||
<v-sheet>
|
<v-sheet>
|
||||||
Herkunft:
|
Herkunft:
|
||||||
</v-sheet>
|
</v-sheet>
|
||||||
|
</v-col>
|
||||||
|
<v-col>
|
||||||
|
<v-sheet>
|
||||||
|
{{ originToString(store.article.origin) }}
|
||||||
|
</v-sheet>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col>
|
|
||||||
<v-sheet>
|
|
||||||
{{ store.article.origin }}
|
|
||||||
</v-sheet>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row no-gutters>
|
<v-col cols="5" style="padding: 5px;">
|
||||||
<v-col cols="2">
|
<v-textarea
|
||||||
<v-sheet>
|
:model-value="store.article.description"
|
||||||
Varianten:
|
:tile=true
|
||||||
</v-sheet>
|
label="Beschreibung"
|
||||||
|
counter
|
||||||
|
:persistentCounter=true
|
||||||
|
rows="6"
|
||||||
|
>
|
||||||
|
<template v-slot:counter="{ counter }">
|
||||||
|
<span>{{ counter }} von {{ store.ingredientsMaxChars }} Zeichen.</span>
|
||||||
|
</template>
|
||||||
|
</v-textarea>
|
||||||
|
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col>
|
|
||||||
<v-sheet>
|
<v-col cols="5" style="padding: 5px;">
|
||||||
{{ store.article.variants.length }}
|
<v-textarea
|
||||||
</v-sheet>
|
:model-value="store.article.ingredients"
|
||||||
|
:tile=true
|
||||||
|
label="Zutaten"
|
||||||
|
counter
|
||||||
|
:persistentCounter=true
|
||||||
|
rows="6"
|
||||||
|
>
|
||||||
|
<template v-slot:counter="{ counter }">
|
||||||
|
<span>{{ counter }} von {{ store.ingredientsMaxChars }} Zeichen.</span>
|
||||||
|
</template>
|
||||||
|
</v-textarea>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
|||||||
@@ -15,12 +15,6 @@
|
|||||||
let description: Ref<string | null> = ref<string | null>(null);
|
let description: Ref<string | null> = ref<string | null>(null);
|
||||||
let ingredients: Ref<string | null> = ref<string | null>(null);
|
let ingredients: Ref<string | null> = ref<string | null>(null);
|
||||||
|
|
||||||
let origins: Origin[] = [
|
|
||||||
Origin.EU,
|
|
||||||
Origin.NonEU,
|
|
||||||
Origin.EUnonEU
|
|
||||||
];
|
|
||||||
|
|
||||||
async function create() {
|
async function create() {
|
||||||
if (name.value != null && name.value.trim().length > 0 &&
|
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
|
||||||
@@ -91,6 +85,7 @@
|
|||||||
<v-text-field
|
<v-text-field
|
||||||
v-model.trim="name"
|
v-model.trim="name"
|
||||||
label="Bezeichnung"
|
label="Bezeichnung"
|
||||||
|
autofocus
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<v-row>
|
<v-row>
|
||||||
@@ -103,7 +98,7 @@
|
|||||||
<v-col>
|
<v-col>
|
||||||
<v-select
|
<v-select
|
||||||
v-model="origin"
|
v-model="origin"
|
||||||
:items="origins"
|
:items="store.origins"
|
||||||
label="Herkunft"
|
label="Herkunft"
|
||||||
></v-select>
|
></v-select>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|||||||
@@ -2,28 +2,45 @@ import {defineStore} from "pinia";
|
|||||||
import type {Article} from "~/types/article";
|
import type {Article} from "~/types/article";
|
||||||
import {NotificationMessage} from "~/types/notificationMessage";
|
import {NotificationMessage} from "~/types/notificationMessage";
|
||||||
import type {RuntimeConfig} from "nuxt/schema";
|
import type {RuntimeConfig} from "nuxt/schema";
|
||||||
|
import {Origin} from "~/types/origin";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
config: RuntimeConfig,
|
config: RuntimeConfig,
|
||||||
|
|
||||||
|
// UI
|
||||||
|
descriptionMaxChars: number,
|
||||||
|
ingredientsMaxChars: number,
|
||||||
|
|
||||||
// Notification
|
// Notification
|
||||||
notifications: NotificationMessage[],
|
notifications: NotificationMessage[],
|
||||||
notificationQueue: NotificationMessage[],
|
notificationQueue: NotificationMessage[],
|
||||||
|
|
||||||
// Article
|
// Article
|
||||||
article: Article | null,
|
article: Article | null,
|
||||||
|
|
||||||
|
origins: Array<Origin>,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useLabelEditorStore = defineStore('label_editor_store', {
|
export const useLabelEditorStore = defineStore('label_editor_store', {
|
||||||
state: (): State => ({
|
state: (): State => ({
|
||||||
config: useRuntimeConfig(),
|
config: useRuntimeConfig(),
|
||||||
|
|
||||||
|
// UI
|
||||||
|
descriptionMaxChars: 256,
|
||||||
|
ingredientsMaxChars: 256,
|
||||||
|
|
||||||
// Notification
|
// Notification
|
||||||
notifications: [],
|
notifications: [],
|
||||||
notificationQueue: [],
|
notificationQueue: [],
|
||||||
|
|
||||||
// Article
|
// Article
|
||||||
article: null,
|
article: null,
|
||||||
|
|
||||||
|
origins: [
|
||||||
|
Origin.EU,
|
||||||
|
Origin.NonEU,
|
||||||
|
Origin.EUnonEU
|
||||||
|
]
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
// Notification
|
// Notification
|
||||||
|
|||||||
@@ -3,3 +3,14 @@ export enum Origin {
|
|||||||
NonEU = "NonEU",
|
NonEU = "NonEU",
|
||||||
EUnonEU= "EUnonEU",
|
EUnonEU= "EUnonEU",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function originToString(origin: Origin): string {
|
||||||
|
switch (origin) {
|
||||||
|
case Origin.EU:
|
||||||
|
return "EU";
|
||||||
|
case Origin.NonEU:
|
||||||
|
return "Nicht EU";
|
||||||
|
case Origin.EUnonEU:
|
||||||
|
return "EU / Nicht EU";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user