Commit ab9c46fc authored by David Foucher's avatar David Foucher

Merge branch 'new-simulator' into 'master'

New simulator

See merge request !45
parents 531eb5da 02b4b7dc
Pipeline #2879 passed with stage
in 1 minute and 28 seconds
<template>
<div id="Eligibilite">
<ul>
<li v-for="(props, id) in this.conditions" :key="id" :class="{passed: props.status, failed: !props.status}">
<span v-html="transformData(props.condition)"/>
<span v-if="props.children">
<eligibilite :conditions="props.children"/>
</span>
</li>
</ul>
</div>
</template>
<script>
import Eligibilite from './Eligibilite.vue';
export default {
name: 'Eligibilite',
props: ['conditions', 'schema'],
components: {
Eligibilite,
},
methods: {
transformData: function (data) {
return data
.replace(/Ou /g, '<span style="font-style: italic">&nbsp;Ou&nbsp; </span>')
.replace(/OU /g, '<span style="font-style: italic">&nbsp;OU&nbsp; </span>')
.replace(/, ou /g, '<span style="font-style: italic">&nbsp;, ou&nbsp; </span>')
.replace(/Et /g, '<span style="font-style: italic">&nbsp;Et&nbsp; </span>')
.replace(/ET /g, '<span style="font-style: italic">&nbsp;ET&nbsp; </span>')
.replace(/, et /g, '<span style="font-style: italic">&nbsp;, et&nbsp; </span>');
}
}
}
</script>
<style scoped>
.failed:before {
content: '✗';
color: crimson;
}
.passed:before {
content: '✔';
color: forestgreen;
}
li li {
padding-left: 1.5rem;
}
li ul, li.sub {
display: inline;
padding-left: 0;
}
.connective {
font-style: italic !important;
}
</style>
\ No newline at end of file
This diff is collapsed.
<template>
<div id="SimulateurContext">
<br>
<table class="table-responsive table table-striped table-hover">
<caption> Contexte de simulation </caption>
<thead>
<tr>
<th>Nom</th>
<th>Valeur</th>
</tr>
</thead>
<tbody>
<tr v-for="(value, key) in this.context" :key="key">
<td> {{ renderLabel(key) }} </td>
<td> {{ renderValue(key,value,schema[key]) }} </td>
</tr>
</tbody>
</table>
</div>
</template>
<script>
export default {
name: 'SimulateurContext',
props: ['schema', 'context',],
data: function () {
return {
test: [],
}
},
methods: {
renderValue: function (key, value, schema_tmp) {
schema_tmp = schema_tmp || this.schema[key]
if (schema_tmp['type'] === 'array') return value.map(v => this.renderValue(key, v, schema_tmp['items'])).join(', ')
if (schema_tmp['type'] === "boolean") return value ? 'oui' : 'non'
if (schema_tmp['format'] === 'date') return (new Date(value * 1000)).toLocaleDateString()
if (schema_tmp['enum']) return schema_tmp === undefined ? schema_tmp['enum'][value]+' ('+value+')' : ''
return value
},
renderLabel: function (key) {
return this.schema[key]['label'].charAt(0).toUpperCase() + this.schema[key]['label'].slice(1)
}
}
}
</script>
<style scoped>
td {
width: 50%;
max-width:50%;
}
table{
width:100%;
table-layout:fixed;
}
</style>
<template>
<div id="SimulateurExplain">
<br>
<div class="filter">
<span v-for="(tag, i) in this.tags" :key="i" class="filter-tags label" :class="{eligible: tagsEligibles.includes(tag), selected: selectedTags.includes(tag)}" v-on:click="setFilter(tag)">
{{tag}}
</span>
</div>
<br>
<div>
<span v-if="this.showReinitFilterButton" v-on:click="initFilter();" class="btn main-button pull-right">Réinitialiser les filtres</span>
</div>
<br>
<br>
<ul>
<li v-for="(financement, financement_id) in this.financements" :key="financement_id" class="result" :class="{hide:showFinancement(financement)}">
<br>
<h5 :class="{passed: financement.eligible, failed: !financement.eligible}" data-toggle="collapse" :data-target="'#details_'+financement_id" aria-expanded="false" aria-controls="explain" style="cursor:pointer;" >{{ financement.intitule }}
<div class="pull-right">
<label v-for="(tag, tag_id) in financement.tags" :key="tag_id" class="label">{{ tag }}</label>
</div>
</h5>
<div :id="'details_'+financement_id" class="collapse">
<p><strong>Description</strong> {{ financement.description }}</p>
<p><strong>Démarches</strong> {{ financement.demarches }}</p>
<div v-if="financement.eligible">
<p><strong>Prise en charge</strong> {{ financement.prise_en_charge }}</p>
<p v-if="financement.prise_en_charge_texte"><strong>Prise en charge</strong> {{ financement.prise_en_charge_texte }}</p>
<p><strong>Plafond de prise en charge</strong> {{ financement.plafond_prise_en_charge }}</p>
<p><strong>Plafond de prix horaire</strong> {{ financement.plafond_prix_horaire }}</p>
<p><strong>Nombre d'heures prises en charge</strong> {{ financement.heures }}</p>
<p><strong>Rémunération</strong> {{ financement.remuneration }}</p>
<p v-if="financement.remuneration_texte"><strong>Rémunération</strong> {{ financement.remuneration_texte }}</p>
<p v-if="financement.fin_remuneration"><strong>Fin de la rémunération</strong> {{ renderValue('financement.fin_remuneration', financement.fin_remuneration,schema) }}</p>
<p v-if="financement.rff"><strong>RFF</strong> {{ financement.rff }}</p>