This repository has been archived by the owner on May 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New functionnalities: User Dashboard & Booking for user
Dashboard + Book a day of canteen (User side)
- Loading branch information
Showing
27 changed files
with
707 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import '../scss/dashboard.scss'; | ||
import Vue from "vue"; | ||
import Toasted from "vue-toasted"; | ||
import Notification from "../vue/Notification"; | ||
|
||
Vue.use(Toasted, { | ||
iconPack: 'fontawesome' | ||
}); | ||
import Dashboard from "../vue/Dashboard"; | ||
|
||
new Vue({ | ||
components: { Notification }, | ||
template: "<Notification/>", | ||
// router | ||
}).$mount("#notification"); | ||
components: { Dashboard }, | ||
template: "<Dashboard/>" | ||
}).$mount("#app-dashboard"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Vue from "vue"; | ||
import Toasted from "vue-toasted"; | ||
import Notification from "../vue/Notification"; | ||
|
||
Vue.use(Toasted, { | ||
iconPack: 'fontawesome' | ||
}); | ||
|
||
new Vue({ | ||
components: { Notification }, | ||
template: "<Notification/>", | ||
// router | ||
}).$mount("#notification"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import '../scss/newBooking.scss'; | ||
import Vue from "vue"; | ||
import ParentNewBooking from "../vue/ParentNewBooking"; | ||
import Toasted from "vue-toasted"; | ||
|
||
// Utilisation des toasts (notifications) | ||
Vue.use(Toasted, { | ||
iconPack: 'fontawesome' | ||
}); | ||
|
||
new Vue({ | ||
components: { ParentNewBooking }, | ||
template: "<ParentNewBooking/>", | ||
// router | ||
}).$mount("#app-parent-new-booking"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
<template> | ||
<div class="dashboard"> | ||
<h5>Aujourd'hui :</h5> | ||
<div class="grey-bg rounded mb-3"> | ||
<div class="row meal-day mx-1 py-4" v-for="daily in dailyMeal" v-if="dailyMeal"> | ||
<span class="kcal-indicator">{{randomKcal}} <span class="little-text">Kcal</span></span> | ||
<div class="col-md-4 food-card"> | ||
<div class="img-thumb pb-1"> | ||
<img class="img-fluid" :src="path + daily.meal.entree.picture" alt=""> | ||
<span class="like-button">+1</span> | ||
</div> | ||
<h5>{{daily.meal.entree.title}}</h5> | ||
</div> | ||
<div class="col-md-4 food-card"> | ||
<div class="img-thumb pb-1"> | ||
<img :src="path + daily.meal.maindish.picture" alt=""> | ||
<span class="like-button">+1</span> | ||
</div> | ||
<h5>{{daily.meal.maindish.title}}</h5> | ||
</div> | ||
<div class="col-md-4 food-card"> | ||
<div class="img-thumb pb-1"> | ||
<img :src="path + daily.meal.dessert.picture" alt=""> | ||
<span class="like-button">+1</span> | ||
</div> | ||
<h5>{{daily.meal.dessert.title}}</h5> | ||
</div> | ||
</div> | ||
<div class="row" v-else> | ||
<div class="col-md-12"> | ||
Pas d'information concernant le repas à venir | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<h5>Demain :</h5> | ||
<div class="grey-bg rounded"> | ||
<div class="row meal-day mx-1 py-4" v-for="aftermeal in afterTomorrowMeal" v-if="afterTomorrowMeal"> | ||
<span class="kcal-indicator">{{randomKcal2}} <span class="little-text">Kcal</span></span> | ||
<div class="col-md-4 food-card"> | ||
<div class="img-thumb pb-1"> | ||
<img class="img-fluid" :src="path + aftermeal.meal.entree.picture" alt=""> | ||
<span class="like-button">+1</span> | ||
</div> | ||
<h5>{{aftermeal.meal.entree.title}}</h5> | ||
</div> | ||
<div class="col-md-4 food-card"> | ||
<div class="img-thumb pb-1"> | ||
<img :src="path + aftermeal.meal.maindish.picture" alt=""> | ||
<span class="like-button">+1</span> | ||
</div> | ||
<h5>{{aftermeal.meal.maindish.title}}</h5> | ||
</div> | ||
<div class="col-md-4 food-card"> | ||
<div class="img-thumb pb-1"> | ||
<img :src="path + aftermeal.meal.dessert.picture" alt=""> | ||
<span class="like-button">+1</span> | ||
</div> | ||
<h5>{{aftermeal.meal.dessert.title}}</h5> | ||
</div> | ||
</div> | ||
<div class="row" v-else> | ||
<div class="col-md-12"> | ||
Pas d'information concernant le repas à venir | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import axios from "axios"; | ||
export default { | ||
name: "Dashboard", | ||
data: function(){ | ||
return { | ||
dailyMeal: {}, | ||
afterTomorrowMeal: {}, | ||
path: '/uploads/food_picture/', // Aide vue pour trouver les images | ||
} | ||
}, | ||
mounted() { | ||
this.getDailyMeal(); | ||
this.getTomorrowMeal(); | ||
}, | ||
computed: { | ||
today: function() { | ||
return new Date().toLocaleDateString('us-US').split('/').join('-'); | ||
}, | ||
tomorrow: function() { | ||
let today = new Date(); | ||
today.setDate(today.getDate() + 1); | ||
return today.toLocaleDateString('us-US').split('/').join('-'); | ||
}, | ||
afterTomorrow: function() { | ||
let today = new Date(); | ||
today.setDate(today.getDate() + 2); | ||
return today.toLocaleDateString('us-US').split('/').join('-'); | ||
}, | ||
randomKcal: function () { | ||
let min = 820; | ||
let max = 950; | ||
return Math.round(Math.random() * (max - min) + min); | ||
}, | ||
randomKcal2: function () { | ||
let min = 820; | ||
let max = 950; | ||
return Math.round(Math.random() * (max - min) + min); | ||
}, | ||
}, | ||
methods: { | ||
// Récupère le repas d'aujourd'hui | ||
getDailyMeal: function () { | ||
axios.get(`/api/bookings/?date[strictly_before]=${this.tomorrow}&date[strictly_after]=${this.today}`) | ||
.then((response) => { | ||
this.dailyMeal = response.data['hydra:member']; | ||
}) | ||
.catch(function() { | ||
console.log('Erreur dans le chargement des repas liés aux réservations!'); | ||
}); | ||
}, | ||
// Récupère le repas de demain | ||
getTomorrowMeal: function () { | ||
axios.get(`/api/bookings/?date[strictly_before]=${this.afterTomorrow}&date[strictly_after]=${this.tomorrow}`) | ||
.then((response) => { | ||
this.afterTomorrowMeal = response.data['hydra:member']; | ||
}) | ||
.catch(function() { | ||
console.log('Erreur dans le chargement des repas d\'après demain!'); | ||
}); | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.