v-container
v-card-title {{$t('common.users')}}
v-spacer
v-text-field(v-model='search'
:append-icon='mdiMagnify' outlined rounded
:label="$t('common.search')"
single-line hide-details)
v-btn(color='primary' text @click='newUserDialog = true') {{$t('common.new_user')}}
//- ADD NEW USER
v-dialog(v-model='newUserDialog' :fullscreen='$vuetify.breakpoint.xsOnly')
v-card
v-card-title {{$t('common.new_user')}}
v-card-text
v-form(v-model='valid' ref='user_form' lazy-validation @submit.prevent='createUser')
v-col
v-text-field.col-4(v-model='new_user.email'
:label="$t('common.email')"
:rules="$validators.email")
v-col
v-select.col-4(v-model='new_user.role' :label="$t('common.role')" :items="['admin', 'editor', 'user']")
v-text-field(v-model='new_user.description' :label="$t('common.description')")
//- v-switch.d-inline-block.mr-5(v-model='new_user.is_admin' :label="$t('common.admin')" inset)
//- v-switch.d-inline-block(v-if='!new_user.is_admin' v-model='new_user.is_editor' :label="$t('common.editor')" inset)
v-alert(type='info' :closable='false' :icon='mdiInformation') {{$t('admin.user_add_help')}}
v-card-actions
v-spacer
v-btn(@click='newUserDialog=false' color='error' outlined) {{$t('common.cancel')}}
v-btn(@click='createUser' :disabled='!valid' color='primary' outlined) {{$t('common.send')}}
v-card-text
//- USERS LIST
v-data-table(
:headers='headers'
:items='users'
:hide-default-footer='users.length<5'
:header-props='{ sortIcon: mdiChevronDown }'
:footer-props='{ prevIcon: mdiChevronLeft, nextIcon: mdiChevronRight }'
:search='search')
template(v-slot:item.is_active='{item}')
v-switch(:input-value='item.is_active' readonly @click.native.prevent="toggle(item)" inset hide-details)
template(v-slot:item.role='{item}')
v-menu(offset-y)
template(v-slot:activator="{ on, attrs }")
v-btn(:color='role_colors[item.role ]' v-bind='attrs' v-on="on" small label) {{ item.role }}
v-list(width=100 nav)
v-list-item(v-for="role in ['admin', 'editor', 'user'].filter(r => r !== item.role)" :key='role' link @click='changeRole(item, role)')
v-list-item-content
v-list-item-title {{ role }}
template(v-slot:item.actions='{item}')
v-btn(text small @click='deleteUser(item)' color='error' ) {{$t('admin.delete_user')}}