Commit 8fa9c499 authored by David Foucher's avatar David Foucher

Merge branch '21-ajout-d-un-filtre-dans-le-context-de-simulation' into 'master'

Resolve "Ajout d'un filtre dans le context de simulation"

Closes #21

See merge request !57
parents cd11562b 8597c76c
Pipeline #3214 passed with stage
in 1 minute and 30 seconds
<template>
<div id="SimulateurContext">
<br>
<label for="filterContext">
<strong>
Filtrer les entrées du tableau :
</strong>
</label>
<br>
<input class="form-control" type="text" id="filterContext" name="filterContext" v-model="filterContext" placeholder="Filtre..."/>
<br>
<table class="table-responsive table table-striped table-hover">
<caption> Contexte de simulation </caption>
......@@ -10,7 +18,7 @@
</tr>
</thead>
<tbody>
<tr v-for="(value, key) in this.context" :key="key">
<tr v-for="(value, key) in this.filteredContext" :key="key">
<td> {{ renderLabel(key) }} </td>
<td> {{ renderValue(key,value,schema[key]) }} </td>
</tr>
......@@ -24,7 +32,7 @@
props: ['schema', 'context',],
data: function () {
return {
test: [],
filterContext: "",
}
},
methods: {
......@@ -38,9 +46,21 @@
},
renderLabel: function (key) {
return this.schema[key]['label'].charAt(0).toUpperCase() + this.schema[key]['label'].slice(1)
},
},
computed: {
filteredContext : function () {
if (this.filterContext == "") return this.context;
else {
return Object.keys(this.context)
.filter(key => this.renderLabel(key).toLowerCase().includes(this.filterContext.toLowerCase()))
.reduce((obj, key) => {
obj[key] = this.context[key];
return obj;
}, {});
}
}
}
}
</script>
......
......@@ -104,7 +104,6 @@
},
showFinancement: function (financement) {
if (this.selectedTags != this.tags) {
console.log("hello");
for(var i = 0; i< financement.tags.length; i++) {
if (this.selectedTags.includes(financement.tags[i])) return false;
}
......
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