diff --git a/components/admin/Institucion.vue b/components/admin/Institucion.vue index 806c8af..41ab392 100644 --- a/components/admin/Institucion.vue +++ b/components/admin/Institucion.vue @@ -1,44 +1,72 @@ @@ -55,12 +83,25 @@ export default { updateIsLoading: { type: Function, required: true }, }, data() { - return { institucion: {}, idInstitucion: 0, modulo: { institucion: {} } } + return { + institucion: {}, + idInstitucion: 0, + data: [], + isLoadingTable: false, + page: 1, + total: 0, + lastSearch: {}, + search: { idInstitucion: 0 }, + } }, methods: { updateIdInstitucion(idInstitucion) { this.idInstitucion = idInstitucion }, + onPageChange(page) { + this.page = page + this.obtenerAdmins() + }, buscar() { this.updateIsLoading(true) axios @@ -75,12 +116,38 @@ export default { this.$router.push( `/admin/configuracion/instituciones/${this.idInstitucion}` ) + return this.obtenerAdmins() }) .catch((err) => { this.updateIsLoading(false) this.$alertsGenericos.imprimirError(this.$buefy, err.response.data) }) }, + obtenerAdmins() { + let data = '' + + this.isLoadingTable = true + if (this.search.idInstitucion != this.lastSearch.idInstitucion) { + this.page = 1 + this.lastSearch.idInstitucion = this.search.idInstitucion + } + if (this.search.idInstitucion) + data = `&id_institucion=${this.search.idInstitucion}` + axios + .get( + `${process.env.api}/operador/operadores?pagina=${this.page}&id_tipo_usuario=3${data}`, + this.$getToken.token() + ) + .then((res) => { + this.data = res.data[0] + this.total = res.data[1] + this.isLoadingTable = false + }) + .catch((err) => { + this.isLoadingTable = false + this.$alertsGenericos.imprimirError(this.$buefy, err.response.data) + }) + }, }, created() { if (this.$route.params.institucion) diff --git a/components/admin/TablaAdmins.vue b/components/admin/TablaAdmins.vue index 81019b7..0416a50 100644 --- a/components/admin/TablaAdmins.vue +++ b/components/admin/TablaAdmins.vue @@ -58,7 +58,7 @@ {{ props.row.nombre }} - + {{ props.row.correo }}