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

fakeResults wip

parent 4481ac09
......@@ -6,7 +6,7 @@
<v-expansion-panel>
<v-expansion-panel-header>Item</v-expansion-panel-header>
<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>
</v-expansion-panels>
......@@ -18,6 +18,14 @@ export default {
name: "Eligible",
components: {
Contract
},
data() {
return {
aids: []
};
},
beforeCreate() {
this.aids = this.$store.state.results.eligible;
}
};
</script>
......
......@@ -18,6 +18,9 @@ export default {
name: "Contract",
components: {
AidSummary
},
data() {
return {};
}
};
</script>
......
import { CLARA_API_URL } from "./config";
//import { CLARA_API_URL } from "./config";
import { LoremIpsum } from "lorem-ipsum";
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
}
];
export function contractsService() {
const contracts = [
{
name: "mobilite",
description: "Aides à la mobilité",
icon: "mobilite",
},
{
name: "orientation",
description: "Aides à la définition du projet professionnel, à l'orientation, ou à la reconversion",
icon: "orientation",
},
{
name: "creation-entreprise",
description: "Aides à la création ou reprise d'entreprise",
icon: "creation-entreprise",
},
{
name: "appui-embauche",
description: "Appui à l'embauche",
icon: "appui-embauche",
},
{
name: "contrat-specifique",
description: "Contrats spécifiques",
icon: "contrat-specifique",
},
{
name: "emploi-international",
description: "Emplois internationaux",
icon: "emploi-international",
},
{
name: "formation",
description: "Dispositifs de formation, certification, obtention de diplôme",
icon: "formation",
},
{
name: "aide-regionale",
description: "Aides régionales",
icon: "aide-regionale",
},
{
name: "senior",
description: "Aides pour les séniors",
icon: "senior",
},
{
name: "alternance",
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({
sentencesPerParagraph: {
......@@ -71,36 +135,55 @@ function fakeAidSummaryGenerator(quantity) {
var name = lorem.generateWords(6);
var slug = name.replace(" ", "-");
var short_description = lorem.generateParagraphs(1);
var filters = [];
var min = 1;
var max = 3;
number_of_filters = Math.floor(Math.random() * (+max - +min)) + +min;
let allFilters = filtersService();
let contracts = contractsService();
var contract = contracts[Math.floor(Math.random() * contracts.length)];
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 nonEligible:
// case eligible:
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 {
state: {
......@@ -6,6 +6,7 @@ export default {
nonEligible: [],
// uncertain: [], ???
filters: [],
contracts: [],
},
mutations: {
updateEligible(state, eligible) {
......@@ -19,16 +20,23 @@ export default {
// },
updateFilters(state, filters) {
state.filters = filters
},
updateContracts(state, contracts) {
state.contracts = contracts
}
},
actions: {
// getFilters({ commit }) {
// // promise + fetch + API call
// },
// getResults({ commit, dispatch }) {
// // promise + fetch + API call
// this.$store.commit("updateChanged", false)
// },
getFilters({ commit }) {
// promise + fetch + API call
commit("updateFilters", clara.filtersService());
},
getResults({ commit }) {
// promise + fetch + API call
commit("updateChanged", false);
commit("updateContracts", clara.contractsService());
commit("updateEligible", clara.aidsService(50));
commit("updateNonEligible", clara.aidsService(50));
},
},
getters: {
eligible: state => state.eligible,
......@@ -38,5 +46,7 @@ export default {
//uncertain: state => state.uncertain,
filters: state => state.filters,
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 {
if (this.$store.state.results.filters_quantity == 0) {
this.$store.dispatch("getFilters");
}
if (this.$store.state.results.contracts_quantity == 0) {
this.$store.dispatch("getContracts");
}
if (this.$store.state.situation.changed) {
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