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

fakeResults wip

parent 4481ac09
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<v-expansion-panel> <v-expansion-panel>
<v-expansion-panel-header>Item</v-expansion-panel-header> <v-expansion-panel-header>Item</v-expansion-panel-header>
<v-expansion-panel-content v-for="(item,i) in 5" :key="i"> <v-expansion-panel-content v-for="(item,i) in 5" :key="i">
<Contract></Contract> <Contract v-for="aid in aids" :key="aid"></Contract>
</v-expansion-panel-content> </v-expansion-panel-content>
</v-expansion-panel> </v-expansion-panel>
</v-expansion-panels> </v-expansion-panels>
...@@ -18,6 +18,14 @@ export default { ...@@ -18,6 +18,14 @@ export default {
name: "Eligible", name: "Eligible",
components: { components: {
Contract Contract
},
data() {
return {
aids: []
};
},
beforeCreate() {
this.aids = this.$store.state.results.eligible;
} }
}; };
</script> </script>
......
...@@ -18,6 +18,9 @@ export default { ...@@ -18,6 +18,9 @@ export default {
name: "Contract", name: "Contract",
components: { components: {
AidSummary AidSummary
},
data() {
return {};
} }
}; };
</script> </script>
......
import { CLARA_API_URL } from "./config"; //import { CLARA_API_URL } from "./config";
import { LoremIpsum } from "lorem-ipsum"; import { LoremIpsum } from "lorem-ipsum";
const filters = [ export function contractsService() {
{ const contracts = [
name: "travailler-en-alternance", {
description: "Travailler en alternance", name: "mobilite",
value: false description: "Aides à la mobilité",
}, icon: "mobilite",
{ },
name: "s-informer-sur-contrats-specifiques", {
description: "S'informer sur les contrats spécifiques", name: "orientation",
value: false description: "Aides à la définition du projet professionnel, à l'orientation, ou à la reconversion",
}, icon: "orientation",
{ },
name: "travailler-a-l-international", {
description: "Travailler en Europe ou à l'international", name: "creation-entreprise",
value: false description: "Aides à la création ou reprise d'entreprise",
}, icon: "creation-entreprise",
{ },
name: "garder-enfant", {
description: "Faire garder son enfant", name: "appui-embauche",
value: false description: "Appui à l'embauche",
}, icon: "appui-embauche",
{ },
name: "creer-entreprise", {
description: "Créer ou reprendre une entreprise", name: "contrat-specifique",
value: false description: "Contrats spécifiques",
}, icon: "contrat-specifique",
{ },
name: "accompagne-recherche-emploi", {
description: "Être accompagné/e pour la recherche d'emploi", name: "emploi-international",
value: false description: "Emplois internationaux",
}, icon: "emploi-international",
{ },
name: "trouver-change-de-metier", {
description: "Trouver un métier, changer de métier", name: "formation",
value: false description: "Dispositifs de formation, certification, obtention de diplôme",
}, icon: "formation",
{ },
name: "se-deplacer", {
description: "Se déplacer", name: "aide-regionale",
value: false description: "Aides régionales",
}, icon: "aide-regionale",
{ },
name: "aides-employeurs", {
description: "Connaître les aides au bénéfice des employeurs", name: "senior",
value: false description: "Aides pour les séniors",
}, icon: "senior",
{ },
name: "se-former-valoriser-ses-competences", {
description: "Financer une formation, obtenir un diplôme", name: "alternance",
value: false description: "Aides pour l'alternance'",
} icon: "alternance",
]; },
];
return contracts;
}
export function filtersService() {
const filters = [
{
name: "travailler-en-alternance",
description: "Travailler en alternance",
value: false
},
{
name: "s-informer-sur-contrats-specifiques",
description: "S'informer sur les contrats spécifiques",
value: false
},
{
name: "travailler-a-l-international",
description: "Travailler en Europe ou à l'international",
value: false
},
{
name: "garder-enfant",
description: "Faire garder son enfant",
value: false
},
{
name: "creer-entreprise",
description: "Créer ou reprendre une entreprise",
value: false
},
{
name: "accompagne-recherche-emploi",
description: "Être accompagné/e pour la recherche d'emploi",
value: false
},
{
name: "trouver-change-de-metier",
description: "Trouver un métier, changer de métier",
value: false
},
{
name: "se-deplacer",
description: "Se déplacer",
value: false
},
{
name: "aides-employeurs",
description: "Connaître les aides au bénéfice des employeurs",
value: false
},
{
name: "se-former-valoriser-ses-competences",
description: "Financer une formation, obtenir un diplôme",
value: false
}
];
return filters;
function fakeAidSummaryGenerator(quantity) { }
function fakeAidSummaryGenerator() {
const lorem = new LoremIpsum({ const lorem = new LoremIpsum({
sentencesPerParagraph: { sentencesPerParagraph: {
...@@ -71,36 +135,55 @@ function fakeAidSummaryGenerator(quantity) { ...@@ -71,36 +135,55 @@ function fakeAidSummaryGenerator(quantity) {
var name = lorem.generateWords(6); var name = lorem.generateWords(6);
var slug = name.replace(" ", "-"); var slug = name.replace(" ", "-");
var short_description = lorem.generateParagraphs(1); var short_description = lorem.generateParagraphs(1);
var filters = []; let allFilters = filtersService();
var min = 1; let contracts = contractsService();
var max = 3; var contract = contracts[Math.floor(Math.random() * contracts.length)];
number_of_filters = Math.floor(Math.random() * (+max - +min)) + +min; let random_filter = Math.floor(Math.random() * allFilters.length);
var filters = [allFilters[random_filter], allFilters[random_filter - 1]];
return {
"name": name,
"slug": slug,
"short_description": short_description,
"contract": contract,
"filters": filters,
}
}
export function aidsService(quantity) {
return {} let aidsArray = new Array(quantity);
for (let i = 0; i < quantity; i++) {
aidsArray[i] = fakeAidSummaryGenerator();
}
} let aidsSortedByContract = [];
aidsArray.forEach(aid => {
aidsSortedByContract[aid.contract].push(aid)
});
export function ClaraService(resource, asker) { return aidsSortedByContract;
switch (resource) {
case filters:
break; // switch (resource) {
// case filters:
case eligible: // break;
break; // case eligible:
case nonEligible:
break; // break;
// case nonEligible:
default: // break;
break;
} // default:
// break;
// }
} }
\ No newline at end of file
//import ClaraService from "@/api/clara"; import * as clara from "@/services/clara";
export default { export default {
state: { state: {
...@@ -6,6 +6,7 @@ export default { ...@@ -6,6 +6,7 @@ export default {
nonEligible: [], nonEligible: [],
// uncertain: [], ??? // uncertain: [], ???
filters: [], filters: [],
contracts: [],
}, },
mutations: { mutations: {
updateEligible(state, eligible) { updateEligible(state, eligible) {
...@@ -19,16 +20,23 @@ export default { ...@@ -19,16 +20,23 @@ export default {
// }, // },
updateFilters(state, filters) { updateFilters(state, filters) {
state.filters = filters state.filters = filters
},
updateContracts(state, contracts) {
state.contracts = contracts
} }
}, },
actions: { actions: {
// getFilters({ commit }) { getFilters({ commit }) {
// // promise + fetch + API call // promise + fetch + API call
// }, commit("updateFilters", clara.filtersService());
// getResults({ commit, dispatch }) { },
// // promise + fetch + API call getResults({ commit }) {
// this.$store.commit("updateChanged", false) // promise + fetch + API call
// }, commit("updateChanged", false);
commit("updateContracts", clara.contractsService());
commit("updateEligible", clara.aidsService(50));
commit("updateNonEligible", clara.aidsService(50));
},
}, },
getters: { getters: {
eligible: state => state.eligible, eligible: state => state.eligible,
...@@ -38,5 +46,7 @@ export default { ...@@ -38,5 +46,7 @@ export default {
//uncertain: state => state.uncertain, //uncertain: state => state.uncertain,
filters: state => state.filters, filters: state => state.filters,
filters_quantity: state => state.filters.length, filters_quantity: state => state.filters.length,
contracts: state => state.contracts,
contracts_quantity: state => state.contracts.length,
}, },
} }
\ No newline at end of file
...@@ -44,6 +44,9 @@ export default { ...@@ -44,6 +44,9 @@ export default {
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) {
this.$store.dispatch("getContracts");
}
if (this.$store.state.situation.changed) { if (this.$store.state.situation.changed) {
this.$store.dispatch("getResults"); this.$store.dispatch("getResults");
} }
......
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