select institucion arreglado
This commit is contained in:
parent
80e33440d5
commit
c37a7a3830
@ -6,18 +6,17 @@
|
||||
>
|
||||
<SelectInstitucion
|
||||
columnSize="is-4"
|
||||
:institucionPadre="institucionBuscar"
|
||||
:idInstitucionPadre="idInstitucion"
|
||||
@institucion-seleccionada="
|
||||
(nuevaInstitucion) => (institucionBuscar = nuevaInstitucion)
|
||||
(nuevaInstitucion) => (idInstitucion = nuevaInstitucion)
|
||||
"
|
||||
/>
|
||||
|
||||
<BotonBuscar
|
||||
columnSize="is-3"
|
||||
columnSize="is-4"
|
||||
:buscar="buscar"
|
||||
:disabled="
|
||||
!institucionBuscar.id_institucion ||
|
||||
institucionBuscar.id_institucion === institucion.id_institucion
|
||||
!idInstitucion || idInstitucion === institucion.id_institucion
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
@ -74,7 +73,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
institucionParam: null,
|
||||
institucionBuscar: {},
|
||||
idInstitucion: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -82,15 +81,15 @@ export default {
|
||||
this.institucionParam = parseInt(this.$route.params.institucion)
|
||||
if (
|
||||
this.admin.tipoUsuario.id_tipo_usuario === 2 &&
|
||||
this.institucionBuscar.id_institucion != this.institucionParam
|
||||
this.idInstitucion != this.institucionParam
|
||||
)
|
||||
this.$router.push(
|
||||
`/admin/configuracion/instituciones/buscar_institucion/${this.institucionBuscar.id_institucion}`
|
||||
`/admin/configuracion/instituciones/buscar_institucion/${this.idInstitucion}`
|
||||
)
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/institucion/institucion?id_institucion=${this.institucionBuscar.id_institucion}`,
|
||||
`${process.env.api}/institucion/institucion?id_institucion=${this.idInstitucion}`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
@ -104,11 +103,13 @@ export default {
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.institucionParam = parseInt(this.$route.params.institucion)
|
||||
if (this.admin.institucion) this.institucionBuscar = this.admin.institucion
|
||||
else if (this.institucionParam)
|
||||
this.institucionBuscar = { id_institucion: this.institucionParam }
|
||||
if (this.institucionBuscar.id_institucion) this.buscar()
|
||||
if (this.admin.institucion)
|
||||
this.idInstitucion = this.admin.institucion.id_institucion
|
||||
else {
|
||||
this.institucionParam = parseInt(this.$route.params.institucion)
|
||||
if (this.institucionParam) this.idInstitucion = this.institucionParam
|
||||
}
|
||||
if (this.idInstitucion) this.buscar()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -5,9 +5,10 @@
|
||||
<div class="box">
|
||||
<div class="columns is-align-items-flex-end pl-0 pb-4">
|
||||
<SelectInstitucion
|
||||
:institucionPadre="institucion"
|
||||
columnSize="is-3"
|
||||
:idInstitucionPadre="idInstitucion"
|
||||
@institucion-seleccionada="
|
||||
(nuevaInstitucion) => (institucion = nuevaInstitucion)
|
||||
(nuevaInstitucion) => (idInstitucion = nuevaInstitucion)
|
||||
"
|
||||
/>
|
||||
|
||||
@ -51,9 +52,8 @@
|
||||
</b-field>
|
||||
|
||||
<BotonCrear
|
||||
:disabled="
|
||||
!institucion.id_institucion || !admin || !correo || !nombre
|
||||
"
|
||||
columnSize="is-2"
|
||||
:disabled="!idInstitucion || !admin || !correo || !nombre"
|
||||
:crear="warning"
|
||||
/>
|
||||
</div>
|
||||
@ -74,17 +74,17 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
institucion: {},
|
||||
idInstitucion: 0,
|
||||
admin: '',
|
||||
correo: '',
|
||||
nombre: '',
|
||||
admin: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
crearAdmin() {
|
||||
const data = {
|
||||
correo: this.correo,
|
||||
id_institucion: this.institucion.id_institucion,
|
||||
id_institucion: this.idInstitucion,
|
||||
nombre: this.nombre,
|
||||
operador: this.admin,
|
||||
}
|
||||
@ -93,7 +93,7 @@ export default {
|
||||
axios
|
||||
.post(`${process.env.api}/operador/admin`, data, this.$getToken.token())
|
||||
.then((res) => {
|
||||
this.institucion = {}
|
||||
this.idInstitucion = 0
|
||||
this.admin = ''
|
||||
this.correo = ''
|
||||
this.nombre = ''
|
||||
@ -107,12 +107,7 @@ export default {
|
||||
})
|
||||
},
|
||||
warning() {
|
||||
if (
|
||||
this.institucion.id_institucion &&
|
||||
this.admin &&
|
||||
this.correo &&
|
||||
this.nombre
|
||||
)
|
||||
if (this.idInstitucion && this.admin && this.correo && this.nombre)
|
||||
this.$alertsGenericos.imprimirWarning(
|
||||
this.$buefy,
|
||||
'¿Esta segur@ de querer crear este admin?',
|
||||
|
@ -3,15 +3,19 @@
|
||||
<b-select
|
||||
icon="school-outline"
|
||||
:loading="isLoadingSelect"
|
||||
v-model="institucion"
|
||||
v-model="idInstitucion"
|
||||
expanded
|
||||
rounded
|
||||
>
|
||||
<option :disabled="deshabilitarOptVacia" :value="null">
|
||||
<option :disabled="deshabilitarOptVacia" :value="0">
|
||||
Selecciona una opción
|
||||
</option>
|
||||
|
||||
<option v-for="(i, index) in instituciones" :key="index" :value="i">
|
||||
<option
|
||||
v-for="(i, index) in instituciones"
|
||||
:key="index"
|
||||
:value="i.id_institucion"
|
||||
>
|
||||
{{ i.institucion }}
|
||||
</option>
|
||||
</b-select>
|
||||
@ -24,14 +28,14 @@ import axios from 'axios'
|
||||
export default {
|
||||
props: {
|
||||
deshabilitarOptVacia: { typeof: Boolean, required: false, default: true },
|
||||
institucionPadre: { type: Object, required: true },
|
||||
columnSize: { typeof: String, required: false, default: '' },
|
||||
idInstitucionPadre: { type: Number, required: true, default: 0 },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
instituciones: [],
|
||||
isLoadingSelect: false,
|
||||
institucion: null,
|
||||
idInstitucion: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -51,16 +55,15 @@ export default {
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
institucion(institucionSeleccionada) {
|
||||
if (institucionSeleccionada)
|
||||
this.$emit('institucion-seleccionada', institucionSeleccionada)
|
||||
idInstitucion() {
|
||||
this.$emit('institucion-seleccionada', this.idInstitucion)
|
||||
},
|
||||
institucionPadre(nuevaInstitucion) {
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevaInstitucion))
|
||||
this.institucion = null
|
||||
idInstitucionPadre(nuevaInstitucion) {
|
||||
this.idInstitucion = nuevaInstitucion
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (this.idInstitucionPadre) this.idInstitucion = this.idInstitucionPadre
|
||||
this.obtenerInstituciones()
|
||||
},
|
||||
}
|
||||
|
@ -1,45 +1,11 @@
|
||||
<template>
|
||||
<TablaInstituciones
|
||||
:instituciones="instituciones"
|
||||
:total="instituciones.length"
|
||||
:isLoadingTable="isLoadingTable"
|
||||
:obtenerInstituciones="obtenerInstituciones"
|
||||
/>
|
||||
<TablaBuscadorInstitucion />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import TablaInstituciones from '@/components/tablas/TablaInstituciones'
|
||||
import TablaBuscadorInstitucion from '@/components/tablaBuscador/TablaBuscadorInstitucion'
|
||||
|
||||
export default {
|
||||
components: { TablaInstituciones },
|
||||
data() {
|
||||
return {
|
||||
instituciones: [],
|
||||
isLoadingTable: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
obtenerInstituciones() {
|
||||
this.isLoadingTable = true
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/institucion/instituciones`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
for (let i = 0; i < res.data.length; i++)
|
||||
if (res.data[i].responsable) this.instituciones.push(res.data[i])
|
||||
this.isLoadingTable = false
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoadingTable = false
|
||||
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.obtenerInstituciones()
|
||||
},
|
||||
components: { TablaBuscadorInstitucion },
|
||||
}
|
||||
</script>
|
||||
|
@ -6,9 +6,9 @@
|
||||
<SelectInstitucion
|
||||
columnSize="is-3"
|
||||
:deshabilitarOptVacia="false"
|
||||
:institucionPadre="institucion"
|
||||
:idInstitucionPadre="idInstitucion"
|
||||
@institucion-seleccionada="
|
||||
(nuevaInstitucion) => (institucion = nuevaInstitucion)
|
||||
(nuevaInstitucion) => (idInstitucion = nuevaInstitucion)
|
||||
"
|
||||
/>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<BotonBuscar
|
||||
columnSize="is-3"
|
||||
:buscar="obtenerAdmins"
|
||||
:disabled="institucion.id_institucion || operador ? false : true"
|
||||
:disabled="false"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -60,9 +60,9 @@ export default {
|
||||
return {
|
||||
admins: [],
|
||||
isLoadingTable: false,
|
||||
idInstitucion: 0,
|
||||
page: 1,
|
||||
total: 0,
|
||||
institucion: {},
|
||||
lastSearch: {},
|
||||
operador: '',
|
||||
}
|
||||
@ -73,15 +73,14 @@ export default {
|
||||
|
||||
this.isLoadingTable = true
|
||||
if (
|
||||
this.institucion.id_institucion != this.lastSearch.idInstitucion ||
|
||||
this.idInstitucion != this.lastSearch.idInstitucion ||
|
||||
this.operador != this.lastSearch.operador
|
||||
) {
|
||||
this.page = 1
|
||||
this.lastSearch.idInstitucion = this.institucion.id_institucion
|
||||
this.lastSearch.idInstitucion = this.idInstitucion
|
||||
this.lastSearch.operador = this.operador
|
||||
}
|
||||
if (this.institucion.id_institucion)
|
||||
data += `&id_institucion=${this.institucion.id_institucion}`
|
||||
if (this.idInstitucion) data += `&id_institucion=${this.idInstitucion}`
|
||||
if (this.operador) data += `&operador=${this.operador}`
|
||||
axios
|
||||
.get(
|
||||
|
72
components/tablaBuscador/TablaBuscadorInstitucion.vue
Normal file
72
components/tablaBuscador/TablaBuscadorInstitucion.vue
Normal file
@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<div>
|
||||
<h3 class="is-size-4 mb-3">Todas las instituciones</h3>
|
||||
|
||||
<div class="columns mb-5 is-align-items-flex-end">
|
||||
<SelectInstitucion
|
||||
columnSize="is-4"
|
||||
:idInstitucionPadre="idInstitucion"
|
||||
@institucion-seleccionada="
|
||||
(nuevaInstitucion) => (idInstitucion = nuevaInstitucion)
|
||||
"
|
||||
/>
|
||||
|
||||
<BotonBuscar
|
||||
columnSize="is-4"
|
||||
:buscar="obtenerInstituciones"
|
||||
:disabled="idInstitucion ? false : true"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<TablaInstituciones
|
||||
:instituciones="instituciones"
|
||||
:total="instituciones.length"
|
||||
:isLoadingTable="isLoadingTable"
|
||||
:obtenerInstituciones="obtenerInstituciones"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import BotonBuscar from '@/components/botones/BotonBuscar'
|
||||
import SelectInstitucion from '@/components/selects/SelectInstitucion'
|
||||
import TablaInstituciones from '@/components/tablas/TablaInstituciones'
|
||||
|
||||
export default {
|
||||
components: { BotonBuscar, SelectInstitucion, TablaInstituciones },
|
||||
data() {
|
||||
return {
|
||||
instituciones: [],
|
||||
isLoadingTable: false,
|
||||
idInstitucion: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
obtenerInstituciones() {
|
||||
let data = ''
|
||||
|
||||
this.isLoadingTable = true
|
||||
if (this.idInstitucion) data = `?id_intitucion=${this.idInstitucion}`
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/institucion/instituciones${data}`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.instituciones = []
|
||||
for (let i = 0; i < res.data.length; i++)
|
||||
if (res.data[i].responsable) this.instituciones.push(res.data[i])
|
||||
this.isLoadingTable = false
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoadingTable = false
|
||||
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.obtenerInstituciones()
|
||||
},
|
||||
}
|
||||
</script>
|
@ -26,20 +26,20 @@ export default {
|
||||
sockets: [
|
||||
{
|
||||
name: 'main',
|
||||
// url: 'http://localhost:3000',
|
||||
url: 'https://venus.acatlan.unam.mx',
|
||||
url: 'http://localhost:3000',
|
||||
// url: 'https://venus.acatlan.unam.mx',
|
||||
// url: 'https://pmodulospcpuma.unam.mx',
|
||||
// url: 'https://modulospcpuma.unam.mx',
|
||||
},
|
||||
],
|
||||
},
|
||||
env: {
|
||||
// api: 'http://localhost:3000',
|
||||
api: 'https://venus.acatlan.unam.mx/pcpumaUnam_test',
|
||||
api: 'http://localhost:3000',
|
||||
// api: 'https://venus.acatlan.unam.mx/pcpumaUnam_test',
|
||||
// api: 'https://pmodulospcpuma.unam.mx/pcpumaUnam_test',
|
||||
// api: 'https://modulospcpuma.unam.mx/',
|
||||
// path: '/socket.io/',
|
||||
path: '/pcpumaUnam_test/socket.io/',
|
||||
path: '/socket.io/',
|
||||
// path: '/pcpumaUnam_test/socket.io/',
|
||||
// path: '/pcpumaUnam/socket.io/',
|
||||
},
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Admins from '@/components/admin/Admins'
|
||||
import Admins from '@/components/super_admin/Admins'
|
||||
import Title from '@/components/layouts/Title'
|
||||
|
||||
export default {
|
||||
|
Loading…
Reference in New Issue
Block a user