sorting and ingredient adding

This commit is contained in:
vabene1111
2020-06-26 15:00:41 +02:00
parent 3d4aebcd9d
commit 642224fec9
3 changed files with 45 additions and 0 deletions

View File

@@ -70,6 +70,13 @@
<h3>Step</h3>
</div>
</div>
<div class="row">
<div class="col-md-12">
<label :for="'id_step_' + step.id + 'name'">{% trans 'Step Name' %}</label>
<input class="form-control" v-model="step.name" :id="'id_step_' + step.id + 'name'">
</div>
</div>
<div class="row">
<div class="col-md-12">
<draggable :list="step.ingredients" group="ingredients"
@@ -129,6 +136,8 @@
</div>
</div>
</draggable>
<button class="btn btn-success" @click="addIngredient(step)"><i class="fa fa-plus"></i></button>
</div>
</div>
<div class="row">
@@ -209,6 +218,15 @@
element.order = index
});
},
addIngredient: function (step) { //TODO see if default can be generated from options request
step.ingredients.push({
'food': undefined,
'unit': undefined,
'amount': 0,
'note': '',
})
this.sortStep(step)
},
searchKeywords: function (query) {
this.keywords_loading = true
this.$http.get("{% url 'api:keyword-list' %}" + '?query=' + query + '&limit=10').then((response) => {