lets stop minor design fixes and get real...
This commit is contained in:
@@ -2,14 +2,14 @@
|
|||||||
<div id="app">
|
<div id="app">
|
||||||
<Heading msg="Cook-Assistant"/>
|
<Heading msg="Cook-Assistant"/>
|
||||||
<section class="section" id="recipes-view">
|
<section class="section" id="recipes-view">
|
||||||
<p v-if="status.loading">Loading...</p>
|
<div v-if="status.loading" class="notification is-info">Loading...</div>
|
||||||
<div v-if="status.error" class="notification is-danger">Error: {{ status.error_msg }}</div>
|
<div v-if="status.error" class="notification is-danger">Error: {{ status.error_msg }}</div>
|
||||||
<h2 v-else class="subtitle">Livre de recettes</h2>
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<keep-alive>
|
<keep-alive>
|
||||||
<RecipeDetails v-if="active_view > -1"
|
<RecipeDetails v-if="active_view > -1"
|
||||||
v-bind:item="items[active_view]"
|
v-bind:item="items[active_view]"
|
||||||
v-on:close="closeActiveView" />
|
v-on:close="closeActiveView"
|
||||||
|
v-on:add="addToPlanning" />
|
||||||
<RecipeList v-else
|
<RecipeList v-else
|
||||||
v-bind:items="items"
|
v-bind:items="items"
|
||||||
v-on:open-details="setActiveView" />
|
v-on:open-details="setActiveView" />
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</section>
|
</section>
|
||||||
<section class="section has-background-grey-lighter" id="planner-view">
|
<section class="section has-background-grey-lighter" id="planner-view">
|
||||||
<h2 class="subtitle">Planning</h2>
|
<h2 class="subtitle">Planning</h2>
|
||||||
<Planner />
|
<Planner ref="weekPlanning" />
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -60,6 +60,11 @@ export default {
|
|||||||
closeActiveView: function() {
|
closeActiveView: function() {
|
||||||
this.active_view = -1;
|
this.active_view = -1;
|
||||||
},
|
},
|
||||||
|
addToPlanning: function(idx) {
|
||||||
|
let mealKey = ["Lundi", "Lunch"];
|
||||||
|
let mealData = this.items[idx];
|
||||||
|
this.$refs.weekPlanning.setMeal(mealKey, mealData);
|
||||||
|
},
|
||||||
deleteRecipe: function(id) {
|
deleteRecipe: function(id) {
|
||||||
fetch("http://localhost:8000/api/delete/" + id)
|
fetch("http://localhost:8000/api/delete/" + id)
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
@@ -87,10 +92,14 @@ export default {
|
|||||||
this.statue.error_msg = err;
|
this.statue.error_msg = err;
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
initWeekPlanning: function() {
|
||||||
|
this.$refs.weekPlanning.fetchSolution();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.fetchRecipesList();
|
this.fetchRecipesList();
|
||||||
|
this.initWeekPlanning();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<nav class="navbar" role="navigation" aria-label="main navigation">
|
<nav class="navbar is-dark" role="navigation" aria-label="main navigation">
|
||||||
<div class="navbar-brand">
|
<div class="navbar-brand">
|
||||||
<a class="navbar-item" href="#">
|
<a class="navbar-item" href="#">
|
||||||
{{ msg }}
|
{{ msg }}
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<button @click="fetchSolution"
|
<button @click="fetchSolution"
|
||||||
class="button is-primary"
|
class="button is-primary is-fullwidth"
|
||||||
v-bind:class="{'is-loading': is_loading }">
|
v-bind:class="{'is-loading': is_loading }">
|
||||||
FetchSolution</button>
|
FetchSolution</button>
|
||||||
<hr />
|
|
||||||
<div v-if="template">
|
<div v-if="template">
|
||||||
<div class="columns is-desktop is-vcentered is-multiline">
|
<div class="columns is-mobile is-vcentered is-multiline">
|
||||||
<div v-for="day_meals in itemsGroupedByDay"
|
<div v-for="day_meals in itemsGroupedByDay"
|
||||||
class="column is-one-quarter">
|
class="column is-one-quarter-desktop is-half-mobile">
|
||||||
<strong> {{ day_meals[0] }}</strong>
|
<p class="subtitle"><strong> {{ day_meals[0] }}</strong></p>
|
||||||
<div v-for="meal in day_meals[1]">
|
<div v-for="meal in day_meals[1]">
|
||||||
<div v-if="meal.value" class="tags has-addons">
|
<p v-if="meal.value" class="tags has-addons">
|
||||||
<span class="tag is-info">{{ meal.key[1] }}</span>
|
<span class="tag is-info">{{ meal.key[1] }}</span>
|
||||||
<span class="tag is-light">{{ meal.value.title }}</span>
|
<span class="tag is-light">{{ meal.value.title }}</span>
|
||||||
<a @click="unsetMeal(meal.key)"
|
<a @click="unsetMeal(meal.key)"
|
||||||
class="tag is-delete"></a>
|
class="tag is-delete"></a>
|
||||||
</div>
|
</p>
|
||||||
<div v-else class="tag is-warning">Empty</div>
|
<div v-else class="tag is-warning">Empty</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -75,6 +74,15 @@ export default {
|
|||||||
return item.key == mealKey;
|
return item.key == mealKey;
|
||||||
});
|
});
|
||||||
this.template.items[idx].value = null;
|
this.template.items[idx].value = null;
|
||||||
|
//console.log("vm" + this.vm.items);
|
||||||
|
},
|
||||||
|
setMeal: function(mealKey, mealData) {
|
||||||
|
let idx = this.template.items.findIndex((item) => {
|
||||||
|
return (item.key[0] == mealKey[0]
|
||||||
|
&& item.key[1] == mealKey[1]);
|
||||||
|
});
|
||||||
|
console.log(idx)
|
||||||
|
this.template.items[idx].value = mealData;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-narrow">
|
<div class="column is-narrow">
|
||||||
<a @click="$emit('close')" class="has-text-dark">
|
<a @click="$emit('close')"
|
||||||
|
class="has-text-dark">
|
||||||
<span class="icon is-large">
|
<span class="icon is-large">
|
||||||
<i class="mdi mdi-48px mdi-view-list"></i>
|
<i class="mdi mdi-48px mdi-view-list"></i>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
<br class="is-hidden-mobile"/>
|
||||||
|
<a @click="$emit('add', item.id)"
|
||||||
|
class="has-text-success">
|
||||||
|
<span class="icon is-large">
|
||||||
|
<i class="mdi mdi-36px mdi-table-plus"></i>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<h4 class="title">{{ item.title }}</h4>
|
<h4 class="title">{{ item.title }}</h4>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<h2 class="subtitle">{{ categories[active_category].name }}</h2>
|
<h2 class="title">{{ categories[active_category].name }}</h2>
|
||||||
<ul class="content">
|
<ul class="content">
|
||||||
<li v-for="item in displayed" :key="item.id" class="has-text-left">
|
<li v-for="item in displayed" :key="item.id" class="has-text-left">
|
||||||
<a href=""
|
<a href=""
|
||||||
|
|||||||
Reference in New Issue
Block a user