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

Fixes and filters work

parent 29d31e99
......@@ -27,6 +27,15 @@ export default {
// contracts: {}
// };
// },
methods: {
// hasOneTrueFilter(aid) {
// let values = [];
// aid.filters.forEach(filter => {
// values.push(filter.value);
// });
// return values.include(true);
// }
},
computed: {
contracts() {
return this.$store.state.results.eligible;
......
......@@ -28,8 +28,13 @@ export default {
allocation_type: ""
}),
computed: {
filters() {
return this.store.state.results.filters;
filters: {
get() {
return this.$store.state.results.filters;
},
set(value) {
this.$store.commit("updateFilters", value);
}
}
}
};
......
......@@ -5,7 +5,7 @@
<v-list-item-subtitle>{{aid.short_description}}</v-list-item-subtitle>
<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-icon left>mdi-eye</v-icon>En savoir plus
</v-btn>
</v-list-item-content>
</v-list-item>
......
......@@ -2,12 +2,12 @@
<v-expansion-panels>
<v-expansion-panel>
<v-expansion-panel-header>
{{aids.length}}
{{aids.length | filtered}}
<v-img src="@/assets/contracts/alternance.svg"></v-img>
{{ contractType }}
</v-expansion-panel-header>
<v-expansion-panel-content>
<AidSummary v-for="aid in aids" :key="aid.name" v-bind:aid="aid"></AidSummary>
<AidSummary v-for="aid in aids" :key="aid.name" v-bind:aid="aid | filtered"></AidSummary>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
......@@ -25,6 +25,19 @@ export default {
aids: {
type: Array
}
},
filters: {
filtered(aid) {
let values = [];
aid.filters.forEach(filter => {
values.push(filter.value);
});
if (values.includes(true)) {
return aid;
} else {
return null;
}
}
}
};
</script>
......
......@@ -66,7 +66,7 @@ export function filtersService() {
{
name: "travailler-en-alternance",
description: "Travailler en alternance",
value: false
value: true
},
{
name: "s-informer-sur-contrats-specifiques",
......@@ -111,7 +111,7 @@ export function filtersService() {
{
name: "se-former-valoriser-ses-competences",
description: "Financer une formation, obtenir un diplôme",
value: false
value: true
}
];
......
......@@ -41,7 +41,7 @@ export default {
NonEligible
},
beforeCreate() {
if (this.$store.state.results.filters_quantity === 0) {
if (this.$store.state.results.filters.length === 0) {
this.$store.dispatch("getFilters");
}
if (this.$store.state.results.contracts_quantity === 0) {
......
<template>
<v-card class="pa-4" align="center">
<v-card-title
class="display-1 justify-center align-center"
>Êtes-vous dans l'une des situations suivantes ?</v-card-title>
<v-form @submit.prevent="submitOther" ref="formOther" v-model="validity">
<v-card-title class="display-1 justify-center align-center">Êtes-vous dans l'une des situations suivantes ?</v-card-title>
Cochez la ou les situations correspondantes
<div class="justify-center align-center check-group">
<div class="justify-center align-center check-group">
<v-checkbox autofocus v-model="spectacle" label="Artiste ou technicien•ne du spectacle"></v-checkbox>
<v-checkbox
v-model="disabled"
label="Bénéficiaire de l'obligation d'emploi (reconnu•e en situation de handicap)"
></v-checkbox>
<v-checkbox v-model="manager" label="Cadre et/ou en recherche d'un poste d'encadrement"></v-checkbox>
<v-checkbox v-model="none" label="Je ne suis dans aucune de ces situations"></v-checkbox>
<v-checkbox
v-model="handicap"
label="Bénéficiaire de l'obligation d'emploi (reconnu•e en situation de handicap)"
></v-checkbox>
<v-checkbox v-model="manager" label="Cadre et/ou en recherche d'un poste d'encadrement"></v-checkbox>
<v-checkbox v-model="none" label="Je ne suis dans aucune de ces situations"></v-checkbox>
</div>
<v-btn x-large class="ma-2" color="#96a8b2" @click="back">Revenir</v-btn>
<v-btn
x-large
class="ma-2"
color="secondary"
v-bind:disabled="!validity"
v-bind:disabled="validity"
type="submit"
>Continuer</v-btn>
</v-form>
......@@ -30,42 +31,40 @@ export default {
name: "Other",
created() {
this.spectacle = this.$store.state.situation.spectacle;
this.disabled = this.$store.state.situation.disabled;
this.handicap = this.$store.state.situation.disabled;
},
data: () => ({
spectacle: false,
disabled: false,
handicap: false,
manager: false,
none: false,
validity: false,
rules: [v => !!v || "doit être renseignée"]
none: false
}),
methods: {
onlyMe() {},
validate() {
if (this.$refs.formOther.validate()) {
this.validity = true;
}
},
back() {
this.$router.go(-1);
},
submitOther() {
this.validate();
this.$store.dispatch("submitDisabled", this.disabled);
this.$store.dispatch("submitDisabled", this.handicap);
this.$store.dispatch("submitSpectacle", this.spectacle);
this.$store.dispatch("submitManager", this.manager);
// if choice != non inscrit
this.$router.push({ path: "/resultats" });
}
},
computed: {
validity() {
return ![this.spectacle, this.handicap, this.manager, this.none].includes(
true
);
}
},
watch: {
spectacle: function(val) {
if (val) {
this.none = !val;
}
},