mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
WIP shopping list
This commit is contained in:
@@ -116,6 +116,7 @@
|
||||
this.shopping_list = {
|
||||
"recipes": [],
|
||||
"entries": [],
|
||||
"entries_display": [],
|
||||
"shared": [],
|
||||
"created_by": 1
|
||||
}
|
||||
@@ -167,10 +168,10 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
updateMultiplier: function(slr_id) {
|
||||
updateMultiplier: function (slr_id) {
|
||||
console.log('searching', slr_id)
|
||||
let slr = undefined
|
||||
for (let r of this.shopping_list.recipes){
|
||||
for (let r of this.shopping_list.recipes) {
|
||||
console.log(r, r.id)
|
||||
if (r.id === slr_id) {
|
||||
console.log('FOUND')
|
||||
@@ -178,10 +179,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
for (let e of this.shopping_list.entries){
|
||||
for (let e of this.shopping_list.entries) {
|
||||
e.amount = (e.amount * slr.multiplier)
|
||||
}
|
||||
},
|
||||
updateDisplay: function () {
|
||||
//TODO merge multiple ingredients of same unit
|
||||
this.shopping_list.entries_display = []
|
||||
|
||||
for (let e of this.shopping_list.entries) {
|
||||
let de = e
|
||||
de.amount = (e.amount * slr.multiplier)
|
||||
|
||||
this.shopping_list.entries_display.push({
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
searchKeywords: function (query) {
|
||||
this.keywords_loading = true
|
||||
this.$http.get("{% url 'api:keyword-list' %}" + '?query=' + query + '&limit=10').then((response) => {
|
||||
|
||||
Reference in New Issue
Block a user