2022-07-27 21:41:02 +00:00
|
|
|
<template>
|
|
|
|
<b-table
|
2022-07-29 01:04:17 +00:00
|
|
|
class="pb-6"
|
2022-07-27 21:41:02 +00:00
|
|
|
:current-page="page"
|
|
|
|
:data="admins"
|
|
|
|
:loading="isLoadingTable"
|
|
|
|
:per-page="25"
|
|
|
|
:total="total"
|
|
|
|
@page-change="onPageChange"
|
|
|
|
backend-pagination
|
|
|
|
hoverable
|
|
|
|
paginated
|
|
|
|
striped
|
|
|
|
>
|
2022-07-29 01:04:17 +00:00
|
|
|
<b-table-column
|
|
|
|
field="operador"
|
2022-07-29 01:44:36 +00:00
|
|
|
label="Institución"
|
2022-07-29 01:04:17 +00:00
|
|
|
v-slot="props"
|
|
|
|
v-if="columnaInstitucion"
|
|
|
|
centered
|
|
|
|
>
|
|
|
|
<p>{{ props.row.institucion.institucion }}</p>
|
|
|
|
</b-table-column>
|
|
|
|
|
2022-07-27 21:41:02 +00:00
|
|
|
<b-table-column
|
|
|
|
field="operador"
|
|
|
|
label="Usuario administrador"
|
|
|
|
v-slot="props"
|
|
|
|
centered
|
|
|
|
>
|
|
|
|
<p>{{ props.row.operador }}</p>
|
|
|
|
</b-table-column>
|
|
|
|
|
|
|
|
<b-table-column field="nombre" label="Nombre" v-slot="props" centered>
|
|
|
|
<p>{{ props.row.nombre }}</p>
|
|
|
|
</b-table-column>
|
|
|
|
|
|
|
|
<b-table-column field="correo" label="Correo" v-slot="props" centered>
|
|
|
|
<p>{{ props.row.correo }}</p>
|
|
|
|
</b-table-column>
|
2022-07-29 01:04:17 +00:00
|
|
|
|
|
|
|
<b-table-column
|
|
|
|
field="activo"
|
|
|
|
label="Status"
|
|
|
|
v-slot="props"
|
|
|
|
v-if="columnaActivo"
|
|
|
|
centered
|
|
|
|
>
|
|
|
|
<BotonDesactivar
|
|
|
|
:activarDesactivar="activarDesactivar"
|
|
|
|
:row="props.row"
|
|
|
|
:msjWarning="`¿Estás segur@ de querer ${
|
|
|
|
props.row.activo ? 'desactivar' : 'activar'
|
2022-07-29 06:55:24 +00:00
|
|
|
} esta cuenta de admin?`"
|
2022-07-29 01:04:17 +00:00
|
|
|
/>
|
|
|
|
</b-table-column>
|
|
|
|
|
|
|
|
<b-table-column
|
|
|
|
field="password"
|
|
|
|
label="Cambiar contraseña"
|
|
|
|
v-slot="props"
|
2022-07-29 06:55:24 +00:00
|
|
|
v-if="columnaPasswordChange"
|
2022-07-29 01:04:17 +00:00
|
|
|
centered
|
|
|
|
>
|
|
|
|
<BotonUpdatePassword
|
|
|
|
:operador="props.row"
|
|
|
|
:updateIsLoading="updateIsLoading"
|
2022-08-14 22:23:01 +00:00
|
|
|
campo="admin"
|
2022-07-29 01:04:17 +00:00
|
|
|
/>
|
|
|
|
</b-table-column>
|
2022-07-27 21:41:02 +00:00
|
|
|
</b-table>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-07-29 01:04:17 +00:00
|
|
|
import axios from 'axios'
|
|
|
|
import BotonDesactivar from '@/components/botones/BotonDesactivar'
|
|
|
|
import BotonUpdatePassword from '@/components/botones/BotonUpdatePassword'
|
|
|
|
|
2022-07-27 21:41:02 +00:00
|
|
|
export default {
|
2022-07-29 01:04:17 +00:00
|
|
|
components: { BotonDesactivar, BotonUpdatePassword },
|
2022-07-27 21:41:02 +00:00
|
|
|
props: {
|
|
|
|
admins: { type: Array, required: true, default: () => [] },
|
2022-07-29 01:04:17 +00:00
|
|
|
columnaActivo: { type: Boolean, required: false, default: false },
|
|
|
|
columnaInstitucion: { type: Boolean, required: false, default: false },
|
|
|
|
columnaPasswordChange: { type: Boolean, required: false, default: false },
|
2022-07-27 21:41:02 +00:00
|
|
|
isLoadingTable: { type: Boolean, required: true, default: false },
|
2022-07-29 01:04:17 +00:00
|
|
|
obtenerAdmins: { type: Function, required: false, default: () => {} },
|
2022-07-27 21:41:02 +00:00
|
|
|
onPageChange: { type: Function, required: true, default: () => {} },
|
2022-07-29 01:04:17 +00:00
|
|
|
updateIsLoading: { type: Function, required: false, default: () => {} },
|
2022-07-27 21:41:02 +00:00
|
|
|
page: { type: Number, required: true, default: 0 },
|
2022-07-29 01:04:17 +00:00
|
|
|
total: { type: Number, required: true, default: 0 },
|
2022-07-27 21:41:02 +00:00
|
|
|
},
|
2022-07-29 01:04:17 +00:00
|
|
|
methods: {
|
|
|
|
activarDesactivar(operador) {
|
|
|
|
const data = {
|
|
|
|
id_operador: operador.id_operador,
|
|
|
|
activo: operador.activo ? false : true,
|
|
|
|
}
|
|
|
|
|
|
|
|
this.updateIsLoading(true)
|
2022-12-05 15:36:30 +00:00
|
|
|
return axios
|
2022-07-29 01:04:17 +00:00
|
|
|
.put(`${process.env.api}/operador`, data, this.$getToken.token())
|
|
|
|
.then((res) => {
|
|
|
|
this.obtenerAdmins()
|
|
|
|
this.updateIsLoading(false)
|
|
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.updateIsLoading(false)
|
2022-08-05 23:41:37 +00:00
|
|
|
this.$alertsGenericos.imprimirError(
|
|
|
|
this.$buefy,
|
|
|
|
this.$router,
|
|
|
|
err.response.data
|
|
|
|
)
|
2022-07-29 01:04:17 +00:00
|
|
|
})
|
|
|
|
},
|
2022-07-27 21:41:02 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|