Add Unconfirmed filter

This commit is contained in:
Angelina Filippova 2020-09-24 23:56:59 +03:00
parent 182543e55f
commit 28950a8fb8
3 changed files with 23 additions and 11 deletions

View file

@ -350,7 +350,8 @@ export default {
byStatus: 'By status', byStatus: 'By status',
active: 'Active', active: 'Active',
pending: 'Pending Approval', pending: 'Pending Approval',
deactivated: 'Deactivated' deactivated: 'Deactivated',
unconfirmed: 'Unconfirmed'
}, },
reports: { reports: {
reports: 'Reports', reports: 'Reports',

View file

@ -36,7 +36,8 @@ const users = {
external: false, external: false,
active: false, active: false,
need_approval: false, need_approval: false,
deactivated: false deactivated: false,
need_confirmed: false
}, },
passwordResetToken: { passwordResetToken: {
token: '', token: '',
@ -148,7 +149,14 @@ const users = {
}, },
ClearUsersState({ commit }) { ClearUsersState({ commit }) {
commit('SET_SEARCH_QUERY', '') commit('SET_SEARCH_QUERY', '')
commit('SET_USERS_FILTERS', { local: false, external: false, active: false, need_approval: false, deactivated: false }) commit('SET_USERS_FILTERS',
{ local: false,
external: false,
active: false,
need_approval: false,
deactivated: false,
need_confirmed: false
})
}, },
async ClearFilters({ commit, dispatch, state }) { async ClearFilters({ commit, dispatch, state }) {
commit('CLEAR_USERS_FILTERS') commit('CLEAR_USERS_FILTERS')
@ -308,7 +316,8 @@ const users = {
external: false, external: false,
active: false, active: false,
need_approval: false, need_approval: false,
deactivated: false deactivated: false,
need_confirmed: false
} }
const currentFilters = { ...defaultFilters, ...filters } const currentFilters = { ...defaultFilters, ...filters }
commit('SET_USERS_FILTERS', currentFilters) commit('SET_USERS_FILTERS', currentFilters)

View file

@ -7,13 +7,14 @@
class="select-field" class="select-field"
@change="toggleFilters"> @change="toggleFilters">
<el-option-group :label="$t('usersFilter.byAccountType')"> <el-option-group :label="$t('usersFilter.byAccountType')">
<el-option value="local" label="Local">{{ $t('usersFilter.local') }}</el-option> <el-option value="local">{{ $t('usersFilter.local') }}</el-option>
<el-option value="external" label="External">{{ $t('usersFilter.external') }}</el-option> <el-option value="external">{{ $t('usersFilter.external') }}</el-option>
</el-option-group> </el-option-group>
<el-option-group :label="$t('usersFilter.byStatus')"> <el-option-group :label="$t('usersFilter.byStatus')">
<el-option value="active" label="Active">{{ $t('usersFilter.active') }}</el-option> <el-option value="active">{{ $t('usersFilter.active') }}</el-option>
<el-option value="need_approval" label="Need Approval">{{ $t('usersFilter.pending') }}</el-option> <el-option value="deactivated">{{ $t('usersFilter.deactivated') }}</el-option>
<el-option value="deactivated" label="Deactivated">{{ $t('usersFilter.deactivated') }}</el-option> <el-option value="need_approval">{{ $t('usersFilter.pending') }}</el-option>
<el-option value="need_confirmed">{{ $t('usersFilter.unconfirmed') }}</el-option>
</el-option-group> </el-option-group>
</el-select> </el-select>
</template> </template>
@ -43,6 +44,7 @@ export default {
const indexOfActive = this.$data.value.indexOf('active') const indexOfActive = this.$data.value.indexOf('active')
const indexOfDeactivated = this.$data.value.indexOf('deactivated') const indexOfDeactivated = this.$data.value.indexOf('deactivated')
const indexOfPending = this.$data.value.indexOf('need_approval') const indexOfPending = this.$data.value.indexOf('need_approval')
const indexOfUnconfirmed = this.$data.value.indexOf('need_confirmed')
if (this.$data.value.length === filtersQuantity) { if (this.$data.value.length === filtersQuantity) {
return [] return []
@ -52,8 +54,8 @@ export default {
? currentFilters.push(this.$data.value[Math.max(indexOfLocal, indexOfExternal)]) ? currentFilters.push(this.$data.value[Math.max(indexOfLocal, indexOfExternal)])
: currentFilters : currentFilters
Math.max(indexOfActive, indexOfDeactivated, indexOfPending) > -1 Math.max(indexOfActive, indexOfDeactivated, indexOfPending, indexOfUnconfirmed) > -1
? currentFilters.push(this.$data.value[Math.max(indexOfActive, indexOfDeactivated, indexOfPending)]) ? currentFilters.push(this.$data.value[Math.max(indexOfActive, indexOfDeactivated, indexOfPending, indexOfUnconfirmed)])
: currentFilters : currentFilters
return currentFilters return currentFilters