2021-01-19 01:57:19 +11:00
|
|
|
<template>
|
2021-02-04 18:23:11 +11:00
|
|
|
<span>
|
2021-01-19 03:00:49 +11:00
|
|
|
<b-modal :active="modifyUserModal" @update:active="value => modifyUserModal = value" :width="640" scroll="keep" style="z-index: 100">
|
|
|
|
<div class="modal-card subtitle" style="width: auto">
|
|
|
|
<header class="modal-card-head">
|
|
|
|
<p class="modal-card-title">{{$t('modifyUser.title')}}</p>
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="delete"
|
|
|
|
@click="$emit('close')"/>
|
|
|
|
</header>
|
|
|
|
<section class="modal-card-body">
|
|
|
|
{{$t('modifyUser.text')}}:<br>
|
|
|
|
<b-switch type="is-dark" v-model="booster">
|
|
|
|
{{ $t('badges.booster') }}
|
|
|
|
</b-switch><br>
|
|
|
|
<b-switch type="is-success" v-model="system">
|
|
|
|
{{ $t('badges.system') }}
|
|
|
|
</b-switch><br>
|
|
|
|
<b-switch v-model="bot">
|
|
|
|
{{ $t('badges.bot') }}
|
|
|
|
</b-switch><br>
|
|
|
|
<b-switch type="is-dark" v-model="hidden">
|
|
|
|
{{ $t('badges.hidden') }}
|
|
|
|
</b-switch><br>
|
|
|
|
<b-switch type="is-danger" v-model="admin" v-if="$store.state.executive">
|
|
|
|
{{ $t('badges.admin') }}
|
|
|
|
</b-switch>
|
|
|
|
<b-tooltip label="Only executives can modify this setting" v-else>
|
|
|
|
<b-switch disabled="disabled" type="is-danger" v-model="admin">
|
|
|
|
Admin
|
|
|
|
</b-switch>
|
|
|
|
</b-tooltip>
|
|
|
|
</section>
|
|
|
|
<footer class="modal-card-foot">
|
|
|
|
<b-button
|
|
|
|
:label="$t('OK')"
|
|
|
|
@click="modifyUser()" />
|
|
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
</b-modal>
|
|
|
|
<b-tag v-if="admin" class="is-danger" rounded>{{ $t('badges.admin') }}</b-tag>
|
|
|
|
<b-tag v-if="bot" class="is-info" rounded>{{ $t('badges.bot') }}</b-tag>
|
|
|
|
<b-tag v-if="booster" class="is-success" rounded>{{ $t('badges.booster') }}</b-tag>
|
|
|
|
<b-tag v-if="system" class="is-success" rounded>{{ $t('badges.system') }}</b-tag>
|
|
|
|
<b-tag v-if="hidden" rounded>{{ $t('badges.hidden') }}</b-tag>
|
2021-02-04 18:23:11 +11:00
|
|
|
<b-tag v-if="verified" rounded><i class="fas fa-check"></i> Verified</b-tag>
|
|
|
|
<b-button @click="modal()" v-if="$store.state.user.admin & !noPlus" class="is-info tag" rounded><i class="fas fa-plus"></i></b-button>
|
|
|
|
</span>
|
2021-01-19 01:57:19 +11:00
|
|
|
</template>
|
|
|
|
<script>
|
2021-04-07 23:08:04 +10:00
|
|
|
import AjaxErrorHandler from ".././assets/js/errorHandler";
|
2021-01-19 03:00:49 +11:00
|
|
|
|
2021-01-19 01:57:19 +11:00
|
|
|
export default {
|
2021-01-19 03:00:49 +11:00
|
|
|
name: 'UserBadges',
|
2021-02-04 18:23:11 +11:00
|
|
|
props: ['admin', 'booster', 'bot', 'hidden', 'banned', 'system', 'username', 'noPlus', 'verified'],
|
2021-01-19 01:57:19 +11:00
|
|
|
data() {
|
|
|
|
return {
|
2021-01-19 03:00:49 +11:00
|
|
|
modifyUserModal: false
|
2021-01-19 01:57:19 +11:00
|
|
|
}
|
|
|
|
},
|
2021-01-19 03:00:49 +11:00
|
|
|
methods: {
|
|
|
|
modal() {
|
|
|
|
this.modifyUserModal = true
|
|
|
|
},
|
|
|
|
modifyUser() {
|
|
|
|
this.axios
|
|
|
|
.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'admin/user/modify', {
|
|
|
|
username: this.username,
|
|
|
|
bot: this.bot,
|
|
|
|
system: this.system,
|
|
|
|
booster: this.booster,
|
|
|
|
admin: this.admin,
|
|
|
|
hidden: this.hidden
|
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
this.modifyUserModal = false
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
AjaxErrorHandler(this.$store)(e)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2021-01-19 01:57:19 +11:00
|
|
|
}
|
|
|
|
</script>
|