Commit d0ffa319 authored by Matt Glorion's avatar Matt Glorion
Browse files

Merge branch 'dev' of gitlab.utc.fr:tx-techno-num/impactometre into dev

 Conflicts:
	front/src/components/Results.vue
parents 38f6112d 40349fe5
......@@ -17,18 +17,18 @@
value="Comparatif"
id="btn-comparatif"
@click.prevent="change_displayed_view('comparatif')"
:class="{ active: displayed_view === 'comparatif' }"
:class="{ active: displayed_view == 'comparatif' }"
/>
<input
type="button"
value="Equivalents"
id="btn-equivalents"
@click.prevent="change_displayed_view('equivalents')"
:class="{ active: displayed_view === 'equivalents' }"
:class="{ active: displayed_view == 'equivalents' }"
/>
</div>
</div>
<div class="results-content" v-if="displayed_view === 'comparatif'">
<div class="results-content" v-if="displayed_view == 'comparatif'">
<div
class="results-section"
@click="display_results_detailled_view(section.name)"
......@@ -47,7 +47,7 @@
</div>
</div>
</div>
<div class="results-content" v-if="displayed_view === 'equivalents'">
<div class="results-content" v-if="displayed_view == 'equivalents'">
<div
class="results-section"
@click="display_results_detailled_view(section.name)"
......@@ -78,15 +78,15 @@ export default {
sections_comparatif: [
{
name: "sante_humaine",
title: "Santé humaine",
title: "Santé Humaine",
},
{
name: "qualite_ecosysteme",
title: "Qualité des écosystèmes",
title: "Qualité des Écosystèmes",
},
{
name: "changement_climatique",
title: "Changement climatique",
title: "Changement Climatique",
},
{
name: "ressources",
......@@ -138,7 +138,7 @@ export default {
store.commit("updateScenarios", new_scenarios);
store.dispatch("callAPI").then(() => {
this.re_render_results = !this.re_render_results;
setTimeout( () => this.$root.$emit("re_render_results_detailled"), 500);
this.$root.$emit("re_render_results_detailled");
});
},
display_results_detailled_view(choice) {
......@@ -154,6 +154,12 @@ export default {
return (sphere) => store.state.impact_on_spheres[sphere];
},
},
mounted() {
this.updateResults();
this.$root.$on("renderResults", () => {
this.re_render_results = !this.re_render_results;
});
},
};
</script>
......
......@@ -131,6 +131,45 @@ import Tooltip from "./Tooltip";
import { software_options, journey_options } from "../options/options.js";
function initialScenario() {
return {
meetingDuration: 1,
numberOfParticipants: 1,
hardware: [
{
name: "LAPTOP",
french: "Ordinateurs portables",
qty: 0,
},
{
name: "DESKTOP",
french: "Ordinateurs fixes",
qty: 0,
},
{
name: "LOGITECH_KIT",
french: "Kits de vidéo-conférence",
helper: "Un kit complet.",
qty: 0,
},
{
name: "COMPUTER_SCREEN_LCD",
french: "Ecrans supplémentaires",
qty: 0,
},
{
name: "PROJECTOR",
french: "Vidéo-projecteurs",
qty: 0,
},
],
software: {
name: "",
},
journey: [],
}
}
export default {
name: "Scenario",
props: {
......@@ -148,50 +187,18 @@ export default {
active: false,
software_options,
journey_options,
scenario: {
meetingScenario: this.title,
meetingDuration: 1,
numberOfParticipants: 1,
hardware: [
{
name: "LAPTOP",
french: "Ordinateurs portables",
qty: 0,
},
{
name: "DESKTOP",
french: "Ordinateurs fixes",
qty: 0,
},
{
name: "LOGITECH_KIT",
french: "Kits de vidéo-conférence",
helper: "Un kit complet.",
qty: 0,
},
{
name: "COMPUTER_SCREEN_LCD",
french: "Ecrans supplémentaires",
qty: 0,
},
{
name: "PROJECTOR",
french: "Vidéo-projecteurs",
qty: 0,
},
],
software: {
name: "",
},
journey: [],
},
scenario: {},
};
},
methods: {
createScenario() {
this.scenario = initialScenario();
this.scenario.meetingScenario = this.title;
this.active = true;
},
deleteScenario() {
this.scenario = initialScenario();
this.scenario.meetingScenario = this.title;
this.active = false;
},
addJourney() {
......@@ -206,13 +213,20 @@ export default {
},
},
mounted() {
var cookie = JSON.parse(localStorage.getItem(this.title));
if (cookie) {
this.active = cookie[0]
this.scenario = cookie[1]
}
this.$root.$on("retrieveScenarios", (data) => {
//TODO: format data (remove useless fields)
if (this.active) {
data.push(this.scenario);
}
});
},
updated() {
localStorage.setItem(this.title, JSON.stringify([this.active, this.scenario]));
}
};
</script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment