2019-11-15 19:00:40 +00:00
|
|
|
<template>
|
|
|
|
<div class="row">
|
2019-11-16 01:27:17 +00:00
|
|
|
<div class="col-lg-3 col-xl-2">
|
2019-11-15 19:00:40 +00:00
|
|
|
<div class="card bg-dark text-light mb-2" id="filters">
|
|
|
|
<div class="card-body">
|
|
|
|
<h5 class="card-title text-info">Sort & Filter</h5>
|
|
|
|
<div class="form-group" v-for="(column, index) in columns" :key="index">
|
|
|
|
<label>{{ column }}</label>
|
|
|
|
<div class="input-group">
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<button
|
|
|
|
:class="[ 'btn', column === sortBy ? 'btn-outline-info' : 'btn-outline-secondary' ]"
|
|
|
|
type="button"
|
|
|
|
@click="toggleSort(column)">
|
|
|
|
<font-awesome-icon :icon="getSortIcon(column)"/>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
class="form-control"
|
|
|
|
placeholder="filter"
|
|
|
|
:value="filters[column]"
|
2019-12-12 23:06:22 +00:00
|
|
|
@input="changeFilter(column, $event.target.value)"
|
2019-11-15 19:00:40 +00:00
|
|
|
>
|
2023-11-27 00:14:52 +00:00
|
|
|
<!-- <input @change="someHandler"> -->
|
2019-11-15 19:00:40 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-lg-9 col-xl-8">
|
2023-11-27 00:14:52 +00:00
|
|
|
<div class="row">
|
|
|
|
<div
|
|
|
|
class="mb-4 col-lg-4 col-xl-3"
|
|
|
|
v-for="item in internalItems"
|
|
|
|
:key="item[keyName]"
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
class="card-list-item card bg-dark text-light"
|
|
|
|
@click="$emit('itemActivated', item)"
|
|
|
|
>
|
|
|
|
<slot v-bind:item="item"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-12-05 03:32:33 +00:00
|
|
|
</div>
|
2019-11-15 19:00:40 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import DataContainer from '@/mixins/data-container';
|
2019-12-12 23:06:22 +00:00
|
|
|
import router from '../router';
|
2019-11-15 19:00:40 +00:00
|
|
|
|
|
|
|
export default {
|
2023-11-27 00:14:52 +00:00
|
|
|
name: 'Cards',
|
|
|
|
mixins: [DataContainer],
|
|
|
|
created() {
|
|
|
|
this.columns.map(e => ({
|
|
|
|
k: e,
|
|
|
|
v: this.$store.getters.getFilters[e]
|
|
|
|
})).filter(e => e.v).forEach(e => this.setFilter(e.k, e.v));
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
changeFilter(col, val) {
|
|
|
|
this.setFilter(col, val);
|
|
|
|
let newquery = Object.entries({
|
|
|
|
...this.$store.getters.getFilters,
|
|
|
|
[col]: val
|
|
|
|
}).reduce((a, [k, v]) => (v ? {...a, [k]: v} : a), {});
|
|
|
|
router.push({query: newquery});
|
|
|
|
},
|
2019-12-12 23:06:22 +00:00
|
|
|
},
|
2019-11-15 19:00:40 +00:00
|
|
|
};
|
|
|
|
</script>
|