shopping list ui somewhat bearable

This commit is contained in:
vabene1111
2021-01-26 18:21:45 +01:00
parent 15c758b24a
commit 7b75e279b0
2 changed files with 7 additions and 7 deletions

View File

@@ -342,7 +342,7 @@ class ShoppingListRecipeSerializer(serializers.ModelSerializer):
class ShoppingListEntrySerializer(WritableNestedModelSerializer): class ShoppingListEntrySerializer(WritableNestedModelSerializer):
food = FoodSerializer(allow_null=True) food = FoodSerializer(allow_null=True)
unit = UnitSerializer(allow_null=True) unit = UnitSerializer(allow_null=True, required=False)
amount = CustomDecimalField() amount = CustomDecimalField()
class Meta: class Meta:

View File

@@ -109,14 +109,14 @@
</div> </div>
</div> </div>
<table class="table table-sm table-striped" style="margin-top: 1vh"> <table class="table table-sm" style="margin-top: 1vh">
<template v-for="c in display_categories"> <template v-for="c in display_categories">
<tbody> <thead>
<tr> <tr>
<td colspan="4">[[c.name]]</td> <th colspan="5">[[c.name]]</th>
</tr> </tr>
</tbody> </thead>
<tbody is="draggable" :list="c.entries" tag="tbody" group="people" @sort="sortEntries" <tbody is="draggable" :list="c.entries" tag="tbody" group="people" @sort="sortEntries"
@change="dragChanged(c, $event)"> @change="dragChanged(c, $event)">
<tr v-for="(element, index) in c.entries" :key="element.id"> <tr v-for="(element, index) in c.entries" :key="element.id">
@@ -686,7 +686,7 @@
'unit': this.new_entry.unit, 'unit': this.new_entry.unit,
'amount': parseFloat(this.new_entry.amount), 'amount': parseFloat(this.new_entry.amount),
'order': 0, 'order': 0,
'checked': false 'checked': false,
}) })
this.new_entry = { this.new_entry = {
@@ -781,7 +781,7 @@
}) })
}, },
addFoodType: function (tag, index) { //TODO move to central component addFoodType: function (tag, index) { //TODO move to central component
let new_food = {'name': tag} let new_food = {'name': tag, supermarket_category: null}
this.foods.push(new_food) this.foods.push(new_food)
this.new_entry.food = new_food this.new_entry.food = new_food
}, },