mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
use msgBoxConfirm for user role change modal
This commit is contained in:
parent
c08b5387c5
commit
44f57779b8
@ -12,25 +12,13 @@
|
|||||||
variant="danger"
|
variant="danger"
|
||||||
v-b-modal.user-role-modal
|
v-b-modal.user-role-modal
|
||||||
:disabled="currentRole === roleSelected"
|
:disabled="currentRole === roleSelected"
|
||||||
@click="showModal('changeUserRole')"
|
@click="showModal()"
|
||||||
>
|
>
|
||||||
{{ $t('change_user_role') }}
|
{{ $t('change_user_role') }}
|
||||||
</b-button>
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<b-modal
|
|
||||||
id="user-role-modal"
|
|
||||||
hide-header-close
|
|
||||||
ok-variant="danger"
|
|
||||||
:title="modalTitle"
|
|
||||||
:cancel-title="$t('overlay.cancel')"
|
|
||||||
:ok-title="modalOkTitle"
|
|
||||||
@ok="setUserRole(roleSelected, currentRole)"
|
|
||||||
>
|
|
||||||
<p class="my-4">{{ modalQuestion }}</p>
|
|
||||||
</b-modal>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -57,21 +45,36 @@ export default {
|
|||||||
{ value: rolesValues.user, text: this.$t('userRole.selectRoles.user') },
|
{ value: rolesValues.user, text: this.$t('userRole.selectRoles.user') },
|
||||||
{ value: rolesValues.admin, text: this.$t('userRole.selectRoles.admin') },
|
{ value: rolesValues.admin, text: this.$t('userRole.selectRoles.admin') },
|
||||||
],
|
],
|
||||||
modalTitle: '',
|
|
||||||
modalQuestion: '',
|
|
||||||
modalOkTitle: '',
|
|
||||||
username: '',
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showModal() {
|
showModal() {
|
||||||
this.username = `${this.item.firstName} ${this.item.lastName}`
|
this.$bvModal
|
||||||
this.modalTitle = this.$t('overlay.changeUserRole.title')
|
.msgBoxConfirm(
|
||||||
this.modalQuestion = this.$t('overlay.changeUserRole.question', {
|
this.$t('overlay.changeUserRole.question', {
|
||||||
username: this.username,
|
username: `${this.item.firstName} ${this.item.lastName}`,
|
||||||
newRole: this.roleSelected, // TODO get the text:Administrator instead of admin
|
newRole:
|
||||||
})
|
this.roleSelected === 'admin'
|
||||||
this.modalOkTitle = this.$t('overlay.changeUserRole.yes')
|
? this.$t('userRole.selectRoles.admin')
|
||||||
|
: this.$t('userRole.selectRoles.user'),
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
cancelTitle: this.$t('overlay.cancel'),
|
||||||
|
centered: true,
|
||||||
|
hideHeaderClose: true,
|
||||||
|
title: this.$t('overlay.changeUserRole.title'),
|
||||||
|
okTitle: this.$t('overlay.changeUserRole.yes'),
|
||||||
|
okVariant: 'danger',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.then((okClicked) => {
|
||||||
|
if (okClicked) {
|
||||||
|
this.setUserRole(this.roleSelected, this.currentRole)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.toastError(error.message)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
setUserRole(newRole, oldRole) {
|
setUserRole(newRole, oldRole) {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user