Skip to content

Commit

Permalink
feat: Disabling clear button of RoomsTable filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Aldemylla committed Oct 17, 2023
1 parent fbb2160 commit 109eb4d
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/views/chats/ClosedChatsNext/RoomsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
:inputFormat="$t('date_format')"
/>
</div>
<unnnic-button :text="$t('clear')" type="secondary" @click="resetFilters" />
<unnnic-button
:text="$t('clear')"
:disabled="isFiltersDefault"
type="secondary"
@click="resetFilters"
/>
</section>

<rooms-table-loading v-if="isTableLoading" />
Expand Down Expand Up @@ -213,6 +218,21 @@ export default {
total: roomsCount,
});
},
isFiltersDefault() {
const { filterContact, filterSector, filterTag, filterDate, filterDateDefault } = this;
if (
filterContact === '' &&
filterSector[0].value === 'all' &&
filterTag.length === 0 &&
filterDate === filterDateDefault
) {
return true;
}
return false;
},
},
methods: {
Expand Down Expand Up @@ -287,6 +307,10 @@ export default {
},
resetFilters() {
if (this.isFiltersDefault) {
return;
}
this.filterContact = '';
this.filterSector = [this.filterSectorsOptionAll];
this.filterTag = [];
Expand Down

0 comments on commit 109eb4d

Please sign in to comment.