Filter with new implementation of roles list

This commit is contained in:
Montana 2018-10-31 13:45:00 -04:00
parent 3e1c813ceb
commit 471d98e650
2 changed files with 10 additions and 3 deletions

View File

@ -4,6 +4,7 @@ export default {
props: { props: {
members: Array, members: Array,
choices: Array,
}, },
data: function () { data: function () {
@ -21,8 +22,8 @@ export default {
member.status === this.status | this.status === 'all' member.status === this.status | this.status === 'all'
: true : true
).filter( ).filter(
member => this.role ? member => this.role ? (
member.role.toLowerCase() === this.role | this.role === 'all' this.getRoleFromDisplayName(member.role) === this.role | this.role === 'all')
: true : true
).filter( ).filter(
member => this.searchValue ? member.name.toLowerCase() member => this.searchValue ? member.name.toLowerCase()
@ -30,4 +31,10 @@ export default {
) )
} }
}, },
methods: {
getRoleFromDisplayName: function (role) {
return this.choices.find(choice => choice.display_name === role).name
},
},
} }

View File

@ -46,7 +46,7 @@
{% endif %} {% endif %}
<members-list inline-template id="search-template" v-bind:members='{{ members | tojson}}'> <members-list inline-template id="search-template" v-bind:members='{{ members | tojson}}' v-bind:choices='{{ choices | tojson}}'>
<div> <div>
<form class='search-bar' @submit.prevent> <form class='search-bar' @submit.prevent>
<div class='usa-input search-input'> <div class='usa-input search-input'>