Skip to content
Snippets Groups Projects
Verified Commit 8897bab8 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Added account filter

parent b636aa35
No related branches found
No related tags found
No related merge requests found
Pipeline #4255 passed
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<router-link to="/connect" class="secondary-content">Add another account</router-link> <router-link to="/connect" class="secondary-content">Add another account</router-link>
<h5>Connected accounts</h5> <h5>Connected accounts</h5>
</li> </li>
<li class="collection-item avatar" v-for="account in accounts" :key="account.fullId"> <li class="collection-item avatar" v-for="account in accounts" :key="account.id">
<img v-if="account._source.getAvatar(account)" :src="account._source.getAvatar(account)" alt="" class="circle"> <img v-if="account._source.getAvatar(account)" :src="account._source.getAvatar(account)" alt="" class="circle">
<span class="title">{{ account._source.getDisplayName(account) }}</span> <span class="title">{{ account._source.getDisplayName(account) }}</span>
<p>{{ account._source.label }}</p> <p>{{ account._source.label }}</p>
...@@ -28,17 +28,25 @@ ...@@ -28,17 +28,25 @@
</button> </button>
</h2> </h2>
<div class="row"> <div class="row">
<div class="input-field col l3"> <div class="input-field col l4">
<input v-model="maxDays" id="maxDays" placeholder="60" type="number" min="1" step="1" max="365" class="validate"> <input v-model="maxDays" id="maxDays" placeholder="60" type="number" min="1" step="1" max="365" class="validate">
<label class="active" for="maxDays">Period (in days)</label> <label class="active" for="maxDays">Period (in days)</label>
</div> </div>
<div class="input-field col l6"> <div class="input-field col l4">
<select multiple v-model="filters.providers"> <select multiple v-model="filters.providers">
<option value="" disabled selected>All</option>
<option v-for="provider in providers" :key="provider.id" :value="provider.id">{{ provider.label }}</option> <option v-for="provider in providers" :key="provider.id" :value="provider.id">{{ provider.label }}</option>
</select> </select>
<label>Donation services</label> <label>Donation services</label>
</div> </div>
<div class="input-field col l4">
<select multiple v-model="filters.accounts">
<option
v-for="account in accounts"
:key="account.id"
:value="account.id">{{ account._source.getDisplayName(account) }}</option>
</select>
<label>Accounts</label>
</div>
</div> </div>
<div v-if="isLoading" class="progress"> <div v-if="isLoading" class="progress">
<div class="indeterminate"></div> <div class="indeterminate"></div>
...@@ -102,7 +110,7 @@ import axios from 'axios' ...@@ -102,7 +110,7 @@ import axios from 'axios'
export default { export default {
data () { data () {
let filters = this.$store.state.cache.suggestionFilters || {} let filters = this.$store.state.cache.suggestionFilters || {}
filters = defaults(filters, {providers: [], retributeOnly: true}) filters = defaults(filters, {providers: [], retributeOnly: true, accounts: []})
return { return {
sources: sources.sources, sources: sources.sources,
maxDays: this.$store.state.cache.maxDays || 60, maxDays: this.$store.state.cache.maxDays || 60,
...@@ -139,6 +147,15 @@ export default { ...@@ -139,6 +147,15 @@ export default {
return self.filters.providers.indexOf(m.provider) > -1 return self.filters.providers.indexOf(m.provider) > -1
}).length > 0 }).length > 0
} }
let accountFilters = self.filters.accounts.filter((a) => {
return !!a
})
if (accountFilters.length > 0) {
f = f && s.accounts && accountFilters.filter((a) => {
return s.accounts.indexOf(a) > -1
}).length > 0
}
return f return f
}) })
return orderBy(suggestions, ['weight', 'id'], ['desc', 'asc']) return orderBy(suggestions, ['weight', 'id'], ['desc', 'asc'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment