2022-07-26 05:44:07 +00:00
|
|
|
<template>
|
2022-07-26 13:35:38 +00:00
|
|
|
<section class="mb-6">
|
2022-07-26 21:06:12 +00:00
|
|
|
<h3 class="is-size-4 mb-3">Asociar un software con una carrera</h3>
|
2022-07-26 05:44:07 +00:00
|
|
|
|
2022-07-26 13:35:38 +00:00
|
|
|
<div class="box">
|
|
|
|
<div class="columns is-align-items-flex-end pl-0 pb-4">
|
|
|
|
<SelectCarrera
|
|
|
|
:idInstitucion="idInstitucion"
|
2022-08-03 20:34:17 +00:00
|
|
|
:idInstitucionCarreraPadre="idInstitucionCarrera"
|
2022-07-26 13:35:38 +00:00
|
|
|
@institucion-carrera-seleccionada="
|
|
|
|
(nuevaInstitucionCarrera) =>
|
2022-08-03 20:34:17 +00:00
|
|
|
(idInstitucionCarrera = nuevaInstitucionCarrera)
|
2022-07-26 13:35:38 +00:00
|
|
|
"
|
|
|
|
/>
|
2022-07-26 05:44:07 +00:00
|
|
|
|
2022-07-26 13:35:38 +00:00
|
|
|
<SelectPrograma
|
2022-08-03 20:41:31 +00:00
|
|
|
:idProgramaPadre="idPrograma"
|
|
|
|
@programa-seleccionado="
|
|
|
|
(nuevoPrograma) => (idPrograma = nuevoPrograma)
|
|
|
|
"
|
2022-07-26 13:35:38 +00:00
|
|
|
/>
|
2022-07-26 05:44:07 +00:00
|
|
|
|
2022-07-26 13:35:38 +00:00
|
|
|
<BotonCrear
|
2022-08-03 20:41:31 +00:00
|
|
|
:disabled="!idInstitucionCarrera || !idPrograma"
|
2022-07-26 13:35:38 +00:00
|
|
|
:crear="warning"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
2022-07-26 05:44:07 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
2022-07-26 13:35:38 +00:00
|
|
|
import BotonCrear from '@/components/botones/BotonCrear'
|
|
|
|
import SelectCarrera from '@/components/selects/SelectCarrera'
|
|
|
|
import SelectPrograma from '@/components/selects/SelectPrograma'
|
|
|
|
|
2022-07-26 05:44:07 +00:00
|
|
|
export default {
|
2022-07-26 13:35:38 +00:00
|
|
|
components: { BotonCrear, SelectCarrera, SelectPrograma },
|
2022-07-26 05:44:07 +00:00
|
|
|
props: {
|
2022-07-26 21:06:12 +00:00
|
|
|
obtenerCarrerasProgramas: {
|
|
|
|
type: Function,
|
|
|
|
required: true,
|
|
|
|
default: () => {},
|
|
|
|
},
|
2023-01-09 17:29:31 +00:00
|
|
|
updateIsLoading: { type: Function, required: true, default: () => {} },
|
2022-07-26 13:35:38 +00:00
|
|
|
idInstitucion: { type: Number, required: true, default: 0 },
|
2022-07-26 05:44:07 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2022-08-03 20:34:17 +00:00
|
|
|
idInstitucionCarrera: 0,
|
2022-08-03 20:41:31 +00:00
|
|
|
idPrograma: 0,
|
2022-07-26 05:44:07 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2022-07-26 13:35:38 +00:00
|
|
|
crearCarreraPrograma() {
|
2022-07-26 05:44:07 +00:00
|
|
|
const data = {
|
2022-08-03 20:34:17 +00:00
|
|
|
id_institucion_carrera: this.idInstitucionCarrera,
|
2022-08-03 20:41:31 +00:00
|
|
|
id_programa: this.idPrograma,
|
2022-07-26 05:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
this.updateIsLoading(true)
|
2022-12-05 15:36:30 +00:00
|
|
|
return axios
|
2022-07-26 05:44:07 +00:00
|
|
|
.post(
|
|
|
|
`${process.env.api}/carrera-programa`,
|
|
|
|
data,
|
|
|
|
this.$getToken.token()
|
|
|
|
)
|
|
|
|
.then((res) => {
|
2022-08-03 20:34:17 +00:00
|
|
|
this.idInstitucionCarrera = 0
|
2022-08-03 20:41:31 +00:00
|
|
|
this.idPrograma = 0
|
2022-07-26 21:06:12 +00:00
|
|
|
this.obtenerCarrerasProgramas()
|
2022-07-26 05:44:07 +00:00
|
|
|
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-26 05:44:07 +00:00
|
|
|
})
|
|
|
|
},
|
2022-07-26 13:35:38 +00:00
|
|
|
warning() {
|
2022-08-03 20:41:31 +00:00
|
|
|
if (this.idInstitucionCarrera && this.idPrograma)
|
2022-07-26 13:35:38 +00:00
|
|
|
this.$alertsGenericos.imprimirWarning(
|
|
|
|
this.$buefy,
|
|
|
|
'¿Estas segur@ de querer asignar este software a esta carrera?',
|
|
|
|
this.crearCarreraPrograma
|
2022-07-26 05:44:07 +00:00
|
|
|
)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|