mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
working lists
This commit is contained in:
@@ -52,22 +52,31 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="mp in meal_plan">
|
<tr v-for="mp in meal_plan">
|
||||||
<td v-for="d in mp.days">
|
<td v-for="d in mp.days">
|
||||||
<draggable class="list-group" :list="d.items" group="plan" @change="log('l2', $event)">
|
<draggable class="list-group" :list="d.items" group="plan" @change="log(d.date, $event)"
|
||||||
<div
|
:empty-insert-threshold="100">
|
||||||
class="list-group-item"
|
<div class="list-group-item" v-for="(element, index) in d.items" :key="element.id">
|
||||||
v-for="(element, index) in d.items"
|
[[element.title]] - [[element.id]]
|
||||||
:key="element.id"
|
</div>
|
||||||
>
|
</draggable>
|
||||||
[[element.name]] - [[element.id]]
|
|
||||||
</div>
|
|
||||||
</draggable>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
[[plan_entries]]
|
|
||||||
|
|
||||||
[[meal_types]]
|
[[meal_plan]]
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
entries
|
||||||
|
<ul>
|
||||||
|
<li v-for="e in plan_entries">[[e]]</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
types
|
||||||
|
<ul>
|
||||||
|
<li v-for="t in meal_types">[[t]]</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -84,11 +93,11 @@
|
|||||||
days: moment.weekdays(),
|
days: moment.weekdays(),
|
||||||
plan_entries: [],
|
plan_entries: [],
|
||||||
meal_types: [],
|
meal_types: [],
|
||||||
meal_plan: [
|
meal_plan: {}
|
||||||
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
|
console.log("MOUNTED")
|
||||||
this.getPlanEntries();
|
this.getPlanEntries();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -98,10 +107,10 @@
|
|||||||
this.plan_entries = response.data;
|
this.plan_entries = response.data;
|
||||||
this.getPlanTypes();
|
this.getPlanTypes();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
console.log(err);
|
console.log(err);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getPlanTypes: function () {
|
getPlanTypes: function () {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@@ -110,27 +119,30 @@
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.buildGrid();
|
this.buildGrid();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
console.log(err);
|
console.log(err);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
buildGrid: function () {
|
buildGrid: function () {
|
||||||
|
console.log("BUILD GRID EXECUTED")
|
||||||
for (t of this.meal_types) {
|
for (t of this.meal_types) {
|
||||||
console.log(t.name)
|
this.$set(this.meal_plan, t.id, {
|
||||||
var type = {
|
|
||||||
name: t.name,
|
name: t.name,
|
||||||
days: []
|
meal_type: t.id,
|
||||||
}
|
days: {}
|
||||||
|
})
|
||||||
for (d of this.days) {
|
for (d of this.days) {
|
||||||
type.days.push({
|
date = moment().day(d).week(week).format('YYYY-MM-DD')
|
||||||
|
this.$set(this.meal_plan[t.id].days, date, {
|
||||||
name: d,
|
name: d,
|
||||||
items: [
|
date: date,
|
||||||
{'id':Math.round(Math.random()*1000), "name": "Test"}
|
items: []
|
||||||
]
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.meal_plan.push(type)
|
}
|
||||||
|
for (e of this.plan_entries) {
|
||||||
|
this.meal_plan[e.meal_type].days[e.date].items.push(e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
log: function (param, evt) {
|
log: function (param, evt) {
|
||||||
|
|||||||
Reference in New Issue
Block a user