Added data label for backend.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
import {Variant} from "~/types/variant";
|
||||
import DeleteConfirm from "~/components/ui/deleteConfirm.vue";
|
||||
import type {Unit} from "~/types/unit";
|
||||
import type {Label} from "~/types/label";
|
||||
|
||||
let store = useLabelEditorStore();
|
||||
|
||||
@@ -19,6 +20,8 @@
|
||||
let unit: Ref<Unit | null> = ref<Unit | null>(JSON.parse(JSON.stringify(props.variant.unit)));
|
||||
let description: Ref<string | null> = ref<string | null>(JSON.parse(JSON.stringify(props.variant.description)));
|
||||
let ingredients: Ref<string | null> = ref<string | null>(JSON.parse(JSON.stringify(props.variant.ingredients)));
|
||||
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)));
|
||||
|
||||
function toggleEdit() {
|
||||
if (edit.value) {
|
||||
@@ -44,7 +47,9 @@
|
||||
|
||||
async function updateVariant() {
|
||||
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);
|
||||
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);
|
||||
|
||||
await store.updateVariant(updateVariant);
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
export class Label {
|
||||
readonly id: number;
|
||||
name: string;
|
||||
|
||||
constructor(id: number, name: string) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import type {Unit} from "~/types/unit";
|
||||
import type {Label} from "~/types/label";
|
||||
|
||||
export class Variant {
|
||||
readonly id: number;
|
||||
@@ -8,8 +9,12 @@ export class Variant {
|
||||
description: string | null;
|
||||
ingredients: string | null;
|
||||
unit: Unit;
|
||||
label: Label | null;
|
||||
variant_description: string | null;
|
||||
|
||||
constructor(id: number, weight: string, ean: string|null, name: string|null, description:string|null, ingredients: string|null, unit: Unit) {
|
||||
constructor(id: number, weight: string, ean: string|null, name: string|null,
|
||||
description:string|null, ingredients: string|null, unit: Unit,
|
||||
label: Label | null, variant_description: string | null) {
|
||||
this.id = id;
|
||||
this.weight = weight;
|
||||
this.ean = ean;
|
||||
@@ -17,5 +22,7 @@ export class Variant {
|
||||
this.description = description;
|
||||
this.ingredients = ingredients;
|
||||
this.unit = unit;
|
||||
this.label = label;
|
||||
this.variant_description = variant_description;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user