added room filter
This commit is contained in:
@@ -15,6 +15,13 @@
|
||||
<font-awesome-icon icon="list"/> <font-awesome-icon icon="door-open"/>
|
||||
<strong>Room</strong> <i>list</i>
|
||||
</template>
|
||||
<div class="mt-3">
|
||||
<b-button-group>
|
||||
<b-button variant="success" @click="showAllRooms()">{{$t('All rooms')}}</b-button>
|
||||
<b-button variant="info" @click="showRoomsWithRecorder()">{{$t('Rooms with recorders')}}</b-button>
|
||||
<b-button variant="warning" @click="showRoomsWithoutRecorder()">{{$t('Rooms without recorders')}}</b-button>
|
||||
</b-button-group>
|
||||
</div>
|
||||
<p>{{ $tc('rooms_defined', rooms.length, {num: rooms.length})}}:</p>
|
||||
<b-card-group deck>
|
||||
<b-card class="mb-2" style="max-width: 30rem; min-width:20rem;" v-for="(room) in rooms"
|
||||
@@ -330,7 +337,7 @@
|
||||
|
||||
<div class="column">
|
||||
<section class="section">
|
||||
{{recorders}}
|
||||
{{rooms}}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -351,6 +358,8 @@
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
onlyShowRoomsWithRecorder: false,
|
||||
onlyShowRoomsWithoutRecorder: false,
|
||||
tabIndex: 0,
|
||||
updateValues: {},
|
||||
formEditField: {},
|
||||
@@ -365,6 +374,18 @@
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
showAllRooms(){
|
||||
this.onlyShowRoomsWithRecorder = false;
|
||||
this.onlyShowRoomsWithoutRecorder = false;
|
||||
},
|
||||
showRoomsWithRecorder(){
|
||||
this.onlyShowRoomsWithRecorder = true;
|
||||
this.onlyShowRoomsWithoutRecorder = false;
|
||||
},
|
||||
showRoomsWithoutRecorder(){
|
||||
this.onlyShowRoomsWithRecorder = false;
|
||||
this.onlyShowRoomsWithoutRecorder = true;
|
||||
},
|
||||
saveRoom() {
|
||||
this.$parent.$data.isLoading = true;
|
||||
RoomRepository.createRoom(this.form)
|
||||
@@ -433,6 +454,16 @@
|
||||
};
|
||||
},
|
||||
rooms() {
|
||||
if(this.onlyShowRoomsWithRecorder){
|
||||
return this.$store.state.rooms.filter(item => {
|
||||
return item.recorder
|
||||
});
|
||||
}
|
||||
else if(this.onlyShowRoomsWithoutRecorder){
|
||||
return this.$store.state.rooms.filter(item => {
|
||||
return !item.recorder
|
||||
});
|
||||
}
|
||||
return this.$store.state.rooms;
|
||||
},
|
||||
recorders() {
|
||||
|
||||
Reference in New Issue
Block a user