From a9a94d6f3c996f4d05bb456c408d7a61e9ae6dd2 Mon Sep 17 00:00:00 2001 From: Tobias Date: Fri, 22 Nov 2019 14:40:53 +0100 Subject: [PATCH] added room filter --- src/components/Rooms.vue | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/components/Rooms.vue b/src/components/Rooms.vue index 1d16b19..4c9d47c 100644 --- a/src/components/Rooms.vue +++ b/src/components/Rooms.vue @@ -15,6 +15,13 @@   Room list +
+ + {{$t('All rooms')}} + {{$t('Rooms with recorders')}} + {{$t('Rooms without recorders')}} + +

{{ $tc('rooms_defined', rooms.length, {num: rooms.length})}}:

- {{recorders}} + {{rooms}}
@@ -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() {