casos especiales y caso especial listo

This commit is contained in:
Lemuel Marquez
2021-05-17 01:09:05 -05:00
parent 5a08433938
commit 44ba43a8ee
14 changed files with 116 additions and 318 deletions
@@ -1,54 +1,67 @@
<template>
<div
v-if="alumno.Status.idServicio != 11 || alumno.Status.idServicio != 12"
class="footter"
>
<p class="is-size-2 mb-3" v-if="alumno.Status">
<section>
<h5 class="is-size-2 mb-3">
{{ alumno.Status.status }}
</p>
<p class="is-size-3"><b>Datos personales</b></p>
<p class="is-size-5 mt-3">
</h5>
<h3 class="is-size-3"><b>Datos personales</b></h3>
<h4 class="is-size-5 mt-3">
<b>Número de cuenta: </b> {{ alumno.Usuario.usuario }}
</p>
<p class="is-size-5 mt-3"><b>Nombre: </b> {{ alumno.Usuario.nombre }}</p>
</h4>
<h4 class="is-size-5 mt-3"><b>Nombre: </b> {{ alumno.Usuario.nombre }}</h4>
<p class="is-size-5 mt-3"><b>Carrera: </b> {{ alumno.Carrera.carrera }}</p>
<p class="is-size-5 mt-3"><b>Correo: </b> {{ alumno.correo }}</p>
<p class="is-size-5 mt-3"><b>Dirección: </b> {{ alumno.direccion }}</p>
<p class="is-size-5 mt-3"><b>Teléfono: </b> {{ alumno.telefono }}</p>
<p class="is-size-5 mt-3" v-if="alumno.motivo">
<b>Motivo: </b>{{ motivo(alumno.motivo) }}
</p>
<p class="is-size-5 mt-3" v-if="alumno.institucion">
<b>Institución: </b>{{ alumno.institucion }}
</p>
<p class="is-size-5 mt-3" v-if="alumno.dependencia">
<b>Dependencia: </b>{{ alumno.dependencia }}
</p>
<p class="is-size-5 mt-3"><b>Créditos: </b> {{ alumno.creditos + '%' }}</p>
<p class="is-size-5 mt-3">
<b>Fecha de nacimiento: </b>
{{ fecha(alumno.fechaNacimiento) }}
</p>
<p class="is-size-5 mt-3">
<b>Fecha de inicio: </b>
{{ fecha(alumno.fechaInicio) }}
</p>
<p class="is-size-5 mt-3">
<b>Fecha de fin: </b>
{{ fecha(alumno.fechaFin) }}
</p>
<b-button class="is-info my-4" @click="editar()">
<b-button
type="is-info"
class="my-5"
@click="editar()"
v-if="alumno.Status.idStatus === 11 || alumno.Status.idStatus === 12"
>
Editar información
</b-button>
<b-field
v-if="alumno.Status.idStatus === 11 || alumno.Status.idStatus === 12"
class="centro"
>
<b-button
class="boton border-info my-5"
type="is-success"
@click="confirmarLiberacion()"
>
<b-button type="is-success" class="mt-2" @click="confirmarLiberacion()">
Liberar
</b-button>
</b-field>
@@ -58,7 +71,7 @@
v-model="isLoading"
:can-cancel="false"
></b-loading>
</div>
</section>
</template>
<script>
@@ -68,64 +81,23 @@ import axios from 'axios'
export default {
data() {
return {
alumno: {
fechaNacimiento: '',
fechaInicio: '',
fechaFin: '',
Usuario: {},
Carrera: {},
Status: {},
},
token: {
headers: {
token: localStorage.getItem('token'),
},
},
idCasoEspecial: localStorage.getItem('idCasoEspecial'),
admin: {},
alumno: { Usuario: {}, Carrera: {}, Status: {} },
token: {},
idCasoEspecial: '',
isLoading: false,
}
},
methods: {
editar() {
this.$router.push('/admin/especial/casoEspecial/editar')
},
obtenerDatos() {
return axios
.get(
`${process.env.api}/caso_especial/?idCasoEspecial=${this.idCasoEspecial}`,
this.token
)
.then((res) => {
this.alumno = res.data
})
.catch((err) => {
this.error(err.response.data.message)
})
.finally(() => {
this.isLoading = false
})
},
confirmarLiberacion() {
this.isLoading = true
const data = { idCasoEspecial: this.idCasoEspecial }
axios
.put(`${process.env.api}/caso_especial/liberacion`, data, this.token)
.then((res) => {
this.$buefy.dialog.alert('El servicio ha sido liberado')
localStorage.removeItem('idCasoEspecial')
this.$router.push('/admin/especial')
})
.catch((err) => {
this.error(err.response.data.message)
})
.finally(() => {
this.isLoading = false
})
},
fecha(date) {
const fecha = moment(date.substr(0, 10))
return `${fecha.date()}/${fecha.month() + 1}/${fecha.year()}`
if (date) {
const fecha = moment(date.substr(0, 10))
return `${fecha.date()}/${fecha.month() + 1}/${fecha.year()}`
}
return ''
},
editar() {
this.$router.push('/admin/casos_especiales/caso_especial/editar')
},
motivo(n) {
if (n == 1) {
@@ -134,30 +106,54 @@ export default {
return 'Capacidades diferentes'
}
},
error(msj) {
let salir = false
switch (msj) {
case 'invalid signature':
msj = 'Tu token no es valido, inicia sesión de nuevo.'
salir = true
break
case 'jwt expired':
msj = 'Tu sesión ha expirado, inicia sesión de nuevo.'
salir = true
break
case 'jwt malformed':
msj = 'No se encontro tu token, inicia sesión de nuevo.'
salir = true
break
case 'No hay token':
msj = 'Ocurrio un error al enviar tu token, inicia sesión de nuevo.'
salir = true
break
getLocalhostInfo() {
this.admin.idUsuario = localStorage.getItem('idUsuario')
this.admin.idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
this.admin.tipoUsuario = localStorage.getItem('tipoUsuario')
this.token = {
headers: {
token: localStorage.getItem('token'),
},
}
this.idCasoEspecial = localStorage.getItem('idCasoEspecial')
},
obtenerCasoEspecial() {
return axios
.get(
`${process.env.api}/caso_especial?idCasoEspecial=${this.idCasoEspecial}`,
this.token
)
.then((res) => {
console.log(res.data)
this.alumno = res.data
this.isLoading = false
})
.catch((err) => {
this.isLoading = false
this.imprimirError(err.response.data)
})
},
confirmarLiberacion() {
const data = { idCasoEspecial: this.idCasoEspecial }
this.isLoading = true
axios
.put(`${process.env.api}/caso_especial/liberacion`, data, this.token)
.then((res) => {
localStorage.removeItem('idCasoEspecial')
this.$buefy.dialog.alert('El servicio ha sido liberado.')
this.isLoading = false
this.$router.push('/admin/casos_especiales')
})
.catch((err) => {
this.isLoading = false
this.error(err.response.data)
})
},
imprimirError(err) {
this.$buefy.dialog.alert({
title: 'Error',
message: msj,
message: err.message,
type: 'is-danger',
hasIcon: true,
icon: 'alert-circle',
@@ -165,23 +161,25 @@ export default {
ariaRole: 'alertdialog',
ariaModal: true,
})
if (salir == true) {
if (err.err === 'token error') {
localStorage.clear()
this.$router.push(`/`)
this.$router.push('/')
}
},
},
created() {
this.obtenerDatos()
this.getLocalhostInfo()
if (this.admin.idTipoUsuario === 1) this.obtenerCasoEspecial()
},
}
</script>
<style>
<style scoped>
.centro {
text-align: center;
}
.footter {
margin-bottom: 6rem;
section {
height: 60vh;
}
</style>
@@ -180,7 +180,7 @@ export default {
.put(`${process.env.api}/caso_especial/update`, data, this.token)
.then((res) => {
this.$buefy.dialog.alert('Los datos han sido actualizados')
this.$router.push('/admin/especial/casoEspecial')
this.$router.push('/admin/casos_especiales/caso_especial')
})
.catch((err) => {
this.error(err.response.data.message)
@@ -1,5 +1,5 @@
<template>
<section class="section">
<section>
<h3 class="title">Casos Especiales</h3>
<div class="columns">
@@ -217,7 +217,7 @@ export default {
'idCasoEspecial',
this.servicioSeleccionado.idCasoEspecial
)
this.$router.push(`/admin/especial/casoEspecial`)
this.$router.push(`/admin/casos_especiales/caso_especial`)
},
},
created() {
@@ -238,8 +238,4 @@ export default {
background-color: #1b3d70;
border-color: #1b3d70;
}
.pinter {
cursor: pointer;
}
</style>
-190
View File
@@ -1,190 +0,0 @@
<template>
<div
v-if="idServicio != null && cartaTermino != null"
class="container footter"
>
<b-button
class="border-info mt-5"
type="is-info is-light"
icon-left="arrow-left-box"
tag="router-link"
to="/responsable"
>Regresar</b-button
>
<h3 class="title is-4 mt-4">
Carta de termino (en formato .PDF. No se aceptan fotos).
</h3>
<b-field>
<b-upload
v-model="file"
drag-drop
type="is-black"
expanded
accept="application/pdf"
>
<section class="section">
<div class="content has-text-centered">
<p>
<b-icon icon="upload" size="is-large"></b-icon>
</p>
<p>
{{
file.name || 'Arrastra aquí tu archivo o da click para buscar'
}}
</p>
<p>Tamaño máximo para el archivo: 20MB</p>
</div>
</section>
</b-upload>
</b-field>
<b-field class="centro">
<b-button
:disabled="file == ''"
class="border-success my-5 is-medium"
type="is-success"
@click="Enviar()"
>
Enviar
</b-button>
</b-field>
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="true">
</b-loading>
</div>
</template>
<script>
import axios from 'axios'
export default {
data() {
return {
isFullPage: true,
file: [],
idServicio: '',
cartaTermino: '',
isLoading: false,
token: {
headers: {
token: localStorage.getItem('token'),
},
},
}
},
methods: {
validarTamaño() {
const TamMax = 20000000
const archivo = this.file
if (archivo.size > TamMax) {
this.toast()
this.file = ''
}
},
toast() {
this.$buefy.toast.open({
message: 'El archivo excede el tamaño permitido',
type: 'is-danger',
})
},
Enviar() {
const data = { idServicio: this.idServicio }
const formData = new FormData()
formData.append('data', JSON.stringify(data))
formData.append('cartaTermino', this.file)
this.isLoading = true
axios
.put(`${process.env.api}/servicio/carta_termino`, formData, {
headers: {
'Content-Type': 'multipart/form-data',
token: this.token.headers.token,
},
})
.then((res) => {
this.$buefy.dialog.alert({
title: 'Success',
message: 'Se enviaron los datos correctamente',
type: 'is-success',
hasIcon: true,
icon: 'checkbox-marked-circle',
iconPack: 'mdi',
ariaRole: 'alertdialog',
ariaModal: true,
})
})
.catch((error) => {
this.error(error.response.data.message)
})
.finally(() => {
this.isLoading = false
localStorage.removeItem('idServicio')
localStorage.removeItem('cartaTermino')
this.$router.push('/responsable')
})
},
getIdLocal() {
this.idServicio = localStorage.getItem('idServicio')
this.cartaTermino = localStorage.getItem('cartaTermino')
if (this.idServicio === null || this.cartaTermino === null) {
this.$router.push('/responsable')
}
},
error(msj) {
let salir = false
switch (msj) {
case 'invalid signature':
msj = 'Tu token no es valido, inicia sesión de nuevo.'
salir = true
break
case 'jwt expired':
msj = 'Tu sesión ha expirado, inicia sesión de nuevo.'
salir = true
break
case 'jwt malformed':
msj = 'No se encontro tu token, inicia sesión de nuevo.'
salir = true
break
case 'No hay token':
msj = 'Ocurrio un error al enviar tu token, inicia sesión de nuevo.'
salir = true
break
}
this.$buefy.dialog.alert({
title: 'Error',
message: msj,
type: 'is-danger',
hasIcon: true,
icon: 'alert-circle',
iconPack: 'mdi',
ariaRole: 'alertdialog',
ariaModal: true,
})
if (salir == true) {
localStorage.clear()
this.$router.push(`/`)
}
},
},
watch: {
file: function (newFile, oldFile) {
this.validarTamaño()
},
},
created() {
this.getIdLocal()
},
}
</script>
<style>
.centro {
text-align: center;
}
.footter {
margin-bottom: 10rem;
}
</style>
+2 -2
View File
@@ -28,8 +28,8 @@ export default {
// prefix: false,
// },
env: {
api: "http://localhost:3000",
// api: 'https://venus.acatlan.unam.mx/ss-pruebas',
// api: "http://localhost:3000",
api: 'https://venus.acatlan.unam.mx/ss-pruebas',
// api: "https://890af9d598a4.ngrok.io"
// api: "https://venus.acatlan.unam.mx/serviciosocial",
},
@@ -1,12 +1,12 @@
<template>
<div class="container">
<BotonRegresar path="/admin/especial/casoEspecial" />
<BotonRegresar path="/admin/casos_especiales/caso_especial" />
<FormEditar></FormEditar>
</div>
</template>
<script>
import formEditar from '../../../../../components/admin/especial/formEditar'
import formEditar from '../../../../../components/admin/casos_especiales/formEditar'
export default {
components: {
@@ -1,13 +1,15 @@
<template>
<div class="container">
<BotonRegresar path="/admin/especial" />
<div class="container section">
<BotonRegresar path="/admin/casos_especiales" />
<DatosPersonalesEspecial />
</div>
</template>
<script>
import BotonRegresar from '../../../../components/botonRegresar'
import DatosPersonalesEspecial from '../../../../components/admin/especial/casoEspecial.vue'
import DatosPersonalesEspecial from '../../../../components/admin/casos_especiales/casoEspecial'
export default {
components: {
BotonRegresar,
@@ -1,5 +1,5 @@
<template>
<section class="container">
<section class="container section">
<BotonRegresar path="/admin" />
<TablaCasosEspeciales />
@@ -8,7 +8,8 @@
<script>
import botonRegresar from '../../../components/botonRegresar'
import TablaCasosEspeciales from '../../../components/admin/especial/tablaCasosEspeciales.vue'
import TablaCasosEspeciales from '../../../components/admin/casos_especiales/tablaCasosEspeciales'
export default {
components: {
botonRegresar,
+1 -1
View File
@@ -9,7 +9,7 @@
Ver Registros
</b-button>
<b-button type="is-info" tag="router-link" to="/admin/especial">
<b-button type="is-info" tag="router-link" to="/admin/casos_especiales">
Ver casos especiales
</b-button>
</div>
-6
View File
@@ -15,12 +15,6 @@
</section>
</template>
<style scoped>
.container {
padding: 0.75rem;
}
</style>
<script>
import 'buefy/dist/buefy.css'
import axios from 'axios'
+1
View File
@@ -3,6 +3,7 @@
<b-button class="is-info mb-5" tag="router-link" to="/casoEspecial/nuevo">
Agregar alumno
</b-button>
<TablaServicios />
</div>
</template>
+1 -1
View File
@@ -6,7 +6,7 @@
/>
<h3 class="title is-4 mt-4">
Carta de aceptación (en formato .PDF. No se aceptan fotos).
Carta de termino (en formato .PDF. No se aceptan fotos).
</h3>
<b-field>
+3 -7
View File
@@ -9,13 +9,13 @@
<script>
import Texto from '../../../components/responsable/nuevoTexto'
import BotonRegresar from '../../../components/botonRegresar'
import FormSerivicioSocial from '../../../components/responsable/formServicioSocial'
import FormServicioSocial from '../../../components/responsable/formServicioSocial'
export default {
components: {
Texto,
BotonRegresar,
FormSerivicioSocial,
FormServicioSocial,
},
beforeCreate() {
const idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
@@ -27,8 +27,4 @@ export default {
}
</script>
<style scoped>
.container {
padding: 0.75rem;
}
</style>
<style scoped></style>