Commit aa62e637 authored by Rémy Marronnier's avatar Rémy Marronnier

result page wip

parent d307baec
<template> <template>
<v-card> <v-card>
Vous pouvez bénéficier de
**tout déplier**
<v-expansion-panels> <v-expansion-panels>
<v-expansion-panel> <v-expansion-panel>
<v-expansion-panel-header>Item</v-expansion-panel-header> <v-expansion-panel-header>Vous pouvez bénéficier de**tout déplier**</v-expansion-panel-header>
<v-expansion-panel-content v-for="(item,i) in 5" :key="i"> <v-expansion-panel-content>
<Contract v-for="aid in aids" :key="aid"></Contract> <Contract
v-for="(aids, contractType) in contracts"
:key="(contractType)"
v-bind:aids="aids"
v-bind:contractType="contractType"
></Contract>
</v-expansion-panel-content> </v-expansion-panel-content>
</v-expansion-panel> </v-expansion-panel>
</v-expansion-panels> </v-expansion-panels>
...@@ -19,13 +22,15 @@ export default { ...@@ -19,13 +22,15 @@ export default {
components: { components: {
Contract Contract
}, },
data() { // data() {
return { // return {
aids: [] // contracts: {}
}; // };
}, // },
beforeCreate() { computed: {
this.aids = this.$store.state.results.eligible; contracts() {
return this.$store.state.results.eligible;
}
} }
}; };
</script> </script>
......
<template> <template>
<v-list-item two-line> <v-list-item two-line>
<v-list-item-content> <v-list-item-content>
<v-list-item-title>Titre de l'aide</v-list-item-title> <v-list-item-title>Titre de l'aide {{aid.name}}</v-list-item-title>
<v-list-item-subtitle>Résumé</v-list-item-subtitle> <v-list-item-subtitle>{{aid.short_description}}</v-list-item-subtitle>
<v-btn></v-btn> <v-chip v-for="filter in filters" :key="filter.desciption">{{filter.description}}</v-chip>
<v-btn right>
<v-icon left>mdi-eye</v-icon>Voir
</v-btn>
</v-list-item-content> </v-list-item-content>
</v-list-item> </v-list-item>
</template> </template>
<script> <script>
export default { export default {
name: "AidSummary" name: "AidSummary",
props: {
aid: {
type: Object
}
},
computed: {
filters() {
return this.aid.filters;
}
}
}; };
</script> </script>
......
<template> <template>
<v-expansion-panels> <v-expansion-panels>
<v-expansion-panel> <v-expansion-panel>
<v-expansion-panel-header>Nom du type d'aide</v-expansion-panel-header> <v-expansion-panel-header>
<v-img src="@/assets/contracts/alternance.svg"></v-img>
{{ contractType }}
</v-expansion-panel-header>
<v-expansion-panel-content> <v-expansion-panel-content>
<AidSummary></AidSummary> <AidSummary v-for="aid in aids" :key="aid.name" v-bind:aid="aid"></AidSummary>
<v-btn right>
<v-icon left>mdi-eye</v-icon>Voir
</v-btn>
</v-expansion-panel-content> </v-expansion-panel-content>
</v-expansion-panel> </v-expansion-panel>
</v-expansion-panels> </v-expansion-panels>
...@@ -19,8 +19,11 @@ export default { ...@@ -19,8 +19,11 @@ export default {
components: { components: {
AidSummary AidSummary
}, },
data() { props: {
return {}; contractType: String,
aids: {
type: Array
}
} }
}; };
</script> </script>
......
...@@ -137,7 +137,7 @@ function fakeAidSummaryGenerator() { ...@@ -137,7 +137,7 @@ function fakeAidSummaryGenerator() {
var short_description = lorem.generateParagraphs(1); var short_description = lorem.generateParagraphs(1);
let allFilters = filtersService(); let allFilters = filtersService();
let contracts = contractsService(); let contracts = contractsService();
var contract = contracts[Math.floor(Math.random() * contracts.length)]; var contract = contracts[Math.floor(Math.random() * contracts.length)].name;
let random_filter = Math.floor(Math.random() * allFilters.length); let random_filter = Math.floor(Math.random() * allFilters.length);
var filters = [allFilters[random_filter], allFilters[random_filter - 1]]; var filters = [allFilters[random_filter], allFilters[random_filter - 1]];
...@@ -160,12 +160,14 @@ export function aidsService(quantity) { ...@@ -160,12 +160,14 @@ export function aidsService(quantity) {
aidsArray[i] = fakeAidSummaryGenerator(); aidsArray[i] = fakeAidSummaryGenerator();
} }
let aidsSortedByContract = []; let aidsSortedByContract = {}
contractsService().forEach(contract => {
aidsSortedByContract[contract.name] = []
});
aidsArray.forEach(aid => { aidsArray.forEach(aid => {
aidsSortedByContract[aid.contract].push(aid) aidsSortedByContract[aid.contract].push(aid)
}); });
return aidsSortedByContract; return aidsSortedByContract;
......
...@@ -41,10 +41,10 @@ export default { ...@@ -41,10 +41,10 @@ export default {
NonEligible NonEligible
}, },
beforeCreate() { beforeCreate() {
if (this.$store.state.results.filters_quantity == 0) { if (this.$store.state.results.filters_quantity === 0) {
this.$store.dispatch("getFilters"); this.$store.dispatch("getFilters");
} }
if (this.$store.state.results.contracts_quantity == 0) { if (this.$store.state.results.contracts_quantity === 0) {
this.$store.dispatch("getContracts"); this.$store.dispatch("getContracts");
} }
if (this.$store.state.situation.changed) { if (this.$store.state.situation.changed) {
......
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