Files
servicio_social_front/pages/responsable/index.vue
T
2021-12-06 19:04:55 -06:00

87 lines
2.3 KiB
Vue

<template>
<section class="container px-2 pb-6">
<div class="pt-6 pb-5">
<p class="is-size-4 block">
Estimado(a) responsable del programa de servicio social:
</p>
<p class="block">
Para registrar a un alumno de servicio social pulsa el botón
<strong> Agregar Alumno </strong> y sigue las instrucciones.
</p>
<!-- <p>
Para visualizar los datos completos de un alumno ya registrado o subir
su carta de término, pulsa su nombre y se desplegará la ficha técnica
con toda la información.
</p> -->
</div>
<b-field class="pb-5">
<b-button type="is-info" tag="router-link" to="/responsable/nuevo">
Agregar alumno
</b-button>
</b-field>
<TablaServiciosSociales
:responsable="responsable"
:imprimirError="imprimirError"
/>
</section>
</template>
<script>
import TablaServiciosSociales from '@/components/responsable/TablaServiciosSociales'
export default {
components: {
TablaServiciosSociales,
},
data() {
return {
responsable: {},
}
},
methods: {
imprimirError(err = {}, title = '¡Hubo un error!', onConfirm = () => {}) {
this.$buefy.dialog.alert({
ariaRole: 'alertdialog',
ariaModal: true,
type: 'is-danger',
title,
message: err.message,
confirmText: 'Entendido',
hasIcon: true,
iconPack: 'mdi',
icon: 'alert-octagon',
onConfirm: () => onConfirm(),
})
if (err.err && err.err === 'token error') {
localStorage.clear()
this.$router.push('/')
}
},
getLocalhostInfo() {
this.responsable.idUsuario = Number(localStorage.getItem('idUsuario'))
this.responsable.idTipoUsuario = Number(
localStorage.getItem('idTipoUsuario')
)
this.responsable.tipoUsuario = localStorage.getItem('tipoUsuario')
this.responsable.token = {
headers: {
token: localStorage.getItem('token'),
},
}
},
},
created() {
this.getLocalhostInfo()
if (this.responsable.idTipoUsuario === 1) this.$router.push('/admin')
if (this.responsable.idTipoUsuario === 3) this.$router.push('/alumno')
if (this.responsable.idTipoUsuario === 4) this.$router.push('/casoEspecial')
},
}
</script>
<style></style>