From 781313a5eaaea04ae4885124e4663f0cef16d83e Mon Sep 17 00:00:00 2001 From: shioheii Date: Thu, 4 Dec 2025 23:39:54 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20[Issue=20155]=20Adicionando=20exclus?= =?UTF-8?q?=C3=A3o=20de=20admins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/admin/UsersTable.vue | 62 +++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/components/admin/UsersTable.vue b/components/admin/UsersTable.vue index 62407a0..07958be 100644 --- a/components/admin/UsersTable.vue +++ b/components/admin/UsersTable.vue @@ -32,6 +32,13 @@ > mdi-pencil + + mdi-delete + @@ -95,6 +102,28 @@ + + + + + + Confirmar Exclusão + + + Tem certeza que deseja excluir o usuário {{ userToDelete?.name }}? + Esta ação não pode ser desfeita. + + + + + Cancelar + + + Excluir + + + + @@ -109,6 +138,7 @@ export default { search: '', loading: false, dialogEdit: false, + dialogDelete: false, users: [], editedUser: { id: null, @@ -124,6 +154,7 @@ export default { password: '', passwordConfirmation: '' }, + userToDelete: null, errors: { name: '', email: '', @@ -245,12 +276,43 @@ export default { } }, + confirmDelete (user) { + this.userToDelete = user + this.dialogDelete = true + }, + + async deleteUser () { + try { + await axiosClient.delete(`/user/admins/${this.userToDelete.id}`) + + this.showAlert({ + alertMessage: 'Usuário excluído com sucesso!', + alertType: 'success' + }) + + this.closeDelete() + this.fetchUsers() + } catch (error) { + this.showAlert({ + alertMessage: 'Erro ao excluir usuário. Tente novamente mais tarde.', + alertType: 'error' + }) + } + }, + closeEdit () { this.dialogEdit = false this.$nextTick(() => { this.editedUser = Object.assign({}, this.defaultUser) this.errors = { name: '', email: '', password: '', passwordConfirmation: '' } }) + }, + + closeDelete () { + this.dialogDelete = false + this.$nextTick(() => { + this.userToDelete = null + }) } } }