2022-07-04 06:06:28 +00:00
|
|
|
<template>
|
2022-07-04 06:25:48 +00:00
|
|
|
<div class="box">
|
|
|
|
<dir class="columns is-align-items-flex-end pl-0 pb-4">
|
2022-07-11 16:56:17 +00:00
|
|
|
<b-field class="column mb-0 pb-0" label="Programa">
|
2022-07-04 06:25:48 +00:00
|
|
|
<b-input
|
|
|
|
type="text"
|
|
|
|
placeholder="Nombre del programa"
|
|
|
|
v-model="programa"
|
|
|
|
rounded
|
|
|
|
@keyup.enter.native="
|
2022-07-11 14:15:10 +00:00
|
|
|
$alertsGenericos.imprimirWarning(
|
|
|
|
$buefy,
|
2022-07-04 06:25:48 +00:00
|
|
|
'¿Está segur@ de querer crear este programa?',
|
2022-07-04 06:06:28 +00:00
|
|
|
crearInstitucionPrograma
|
|
|
|
)
|
|
|
|
"
|
2022-07-04 06:25:48 +00:00
|
|
|
/>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<b-button
|
|
|
|
type="is-info"
|
2022-07-11 16:56:17 +00:00
|
|
|
class="column is-4"
|
2022-07-04 06:25:48 +00:00
|
|
|
@click="
|
2022-07-11 14:15:10 +00:00
|
|
|
$alertsGenericos.imprimirWarning(
|
|
|
|
$buefy,
|
2022-07-11 16:56:17 +00:00
|
|
|
'¿Esta segur@ de querer crear este programa?',
|
2022-07-04 06:25:48 +00:00
|
|
|
crearInstitucionPrograma
|
|
|
|
)
|
|
|
|
"
|
|
|
|
:disabled="!programa"
|
|
|
|
expanded
|
|
|
|
rounded
|
|
|
|
>
|
|
|
|
Crear
|
|
|
|
</b-button>
|
|
|
|
</dir>
|
2022-07-04 06:06:28 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
admin: { type: Object, require: true },
|
|
|
|
updateIsLoading: { 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.updateIsLoading(false)
|
2022-07-11 14:15:10 +00:00
|
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
2022-07-04 06:06:28 +00:00
|
|
|
this.programa = ''
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.updateIsLoading(false)
|
2022-07-11 14:15:10 +00:00
|
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
2022-07-04 06:06:28 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|