work in progress on Planner component
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<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>
|
<p v-if="status.loading">Loading...</p>
|
||||||
<div v-if="status.error">Error</div>
|
<div v-if="status.error" class="notification is-danger">Error: {{ status.error_msg }}</div>
|
||||||
<h2 v-else class="subtitle">Livre de recettes</h2>
|
<h2 v-else class="subtitle">Livre de recettes</h2>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<keep-alive>
|
<keep-alive>
|
||||||
@@ -31,7 +31,6 @@ import RecipeList from './components/RecipeList.vue'
|
|||||||
import Planner from './components/Planner.vue'
|
import Planner from './components/Planner.vue'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
components: {
|
components: {
|
||||||
@@ -96,12 +95,4 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#app {
|
|
||||||
font-family: 'Avenir', Helvetica, Arial, sans-serif;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
text-align: center;
|
|
||||||
color: #2c3e50;
|
|
||||||
margin-top: 60px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<h1 class="title">{{ msg }}</h1>
|
<nav class="navbar" role="navigation" aria-label="main navigation">
|
||||||
|
<div class="navbar-brand">
|
||||||
|
<a class="navbar-item" href="#">
|
||||||
|
{{ msg }}
|
||||||
|
</a>
|
||||||
|
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -3,13 +3,18 @@
|
|||||||
<button @click="fetchSolution" class="button is-primary">FetchSolution</button>
|
<button @click="fetchSolution" class="button is-primary">FetchSolution</button>
|
||||||
<hr />
|
<hr />
|
||||||
<div v-if="template">
|
<div v-if="template">
|
||||||
<div class="columns">
|
<div class="columns is-desktop is-vcentered">
|
||||||
<div v-for="day_meals in itemsGroupedByDay"
|
<div v-for="day_meals in itemsGroupedByDay"
|
||||||
class="column">
|
class="column">
|
||||||
<strong> {{ day_meals[0] }}</strong>
|
<strong> {{ day_meals[0] }}</strong>
|
||||||
<p v-for="meal in day_meals[1]">
|
<div v-for="meal in day_meals[1]">
|
||||||
<span class="tag is-light">{{ meal.value.title }}</span>
|
<div v-if="meal.value" class="tags has-addons">
|
||||||
</p>
|
<span class="tag is-info">{{ meal.value.title }}</span>
|
||||||
|
<a @click="unsetMeal(meal.key)"
|
||||||
|
class="tag is-delete"></a>
|
||||||
|
</div>
|
||||||
|
<div v-else class="tag is-warning">Empty</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -54,6 +59,13 @@ export default {
|
|||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((data) => this.template = data)
|
.then((data) => this.template = data)
|
||||||
.catch((err) => console.log(err));
|
.catch((err) => console.log(err));
|
||||||
|
},
|
||||||
|
unsetMeal: function(mealKey) {
|
||||||
|
console.log("Try unsetting " + mealKey);
|
||||||
|
let idx = this.template.items.findIndex((item) => {
|
||||||
|
return item.key == mealKey;
|
||||||
|
});
|
||||||
|
this.template.items[idx].value = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div v-if="active_category == -1" class="columns">
|
<div v-if="active_category == -1" class="columns is-multiline is-mobile">
|
||||||
<div v-for="c in categories" :key="c.id" class="column">
|
<div v-for="c in categories" :key="c.id" class="column is-one-quarter-desktop is-half-tablet">
|
||||||
<button @click="setActiveCategory(c.id)"
|
<button @click="setActiveCategory(c.id)"
|
||||||
class="button is-large is-primary has-text-dark button-block">
|
class="button is-large is-primary has-text-dark button-block">
|
||||||
{{ c.name }}</button>
|
{{ c.name }}</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user