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
<div id="Eligibilite">
<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"/>
import Eligibilite from './Eligibilite.vue';
export default {
name: 'Eligibilite',
props: ['conditions', 'schema'],
components: {
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>');
<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;
\ No newline at end of file
This diff is collapsed.
<div id="SimulateurContext">
<table class="table-responsive table table-striped table-hover">
<caption> Contexte de simulation </caption>
<tr v-for="(value, key) in this.context" :key="key">
<td> {{ renderLabel(key) }} </td>
<td> {{ renderValue(key,value,schema[key]) }} </td>
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 => 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)
<style scoped>
td {
width: 50%;