59 lines
1.4 KiB
Vue
59 lines
1.4 KiB
Vue
![]() |
<template>
|
||
|
<div>
|
||
|
<b-field class="py-3" label="Institución Programa">
|
||
|
<b-input v-model="programa" expanded />
|
||
|
<p class="control">
|
||
|
<b-button
|
||
|
type="is-success"
|
||
|
@click="
|
||
|
imprimirWarning(
|
||
|
'¿Estás seguro de querer crear esta intitución programa?',
|
||
|
crearInstitucionPrograma
|
||
|
)
|
||
|
"
|
||
|
>Crear</b-button
|
||
|
>
|
||
|
</p>
|
||
|
</b-field>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import axios from 'axios'
|
||
|
export default {
|
||
|
props: {
|
||
|
admin: { type: Object, require: true },
|
||
|
imprimirMensaje: { type: Function, require: true },
|
||
|
imprimirWarning: { type: Function, require: true },
|
||
|
imprimirError: { type: Function, require: true },
|
||
|
updateIsLoading: { type: Function, required: true },
|
||
|
updateActualizarTabla: { type: Function, required: true },
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
programa: '',
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
crearInstitucionPrograma() {
|
||
|
const data = {
|
||
|
programa: this.programa,
|
||
|
}
|
||
|
this.updateIsLoading(true)
|
||
|
axios
|
||
|
.post(`${process.env.api}/institucion-programa/`, data)
|
||
|
.then((res) => {
|
||
|
this.updateActualizarTabla(true)
|
||
|
this.updateIsLoading(false)
|
||
|
this.imprimirMensaje(res.data.message)
|
||
|
this.programa = ''
|
||
|
})
|
||
|
.catch((err) => {
|
||
|
this.updateIsLoading(false)
|
||
|
this.imprimirError(err.response.data)
|
||
|
})
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
</script>
|