Proyectos CEDETEC

This commit is contained in:
2021-08-12 12:22:04 -05:00
parent 48c483810a
commit 31558bc14c
2 changed files with 25 additions and 50 deletions
+19 -38
View File
@@ -27,7 +27,12 @@
<b-button
class="is-link"
@click="rechazarDialog()"
@click="
imprimirWarning(
'¿Seguro(a) que quiere rechazar este documento?',
rechazarArchivo
)
"
:disabled="!mensajeRechazo"
>
Rechazar documento
@@ -52,6 +57,8 @@ export default {
imprimirWarning: { type: Function, required: true },
imprimirError: { type: Function, required: true },
updateIsLoading: { type: Function, required: true },
catchError: { type: Function, required: true },
regresar: { type: Function, required: true },
alumno: { type: Object, required: true },
title: { type: String, required: true },
},
@@ -77,32 +84,15 @@ export default {
if (this.title === 'carta de termino') return this.alumno.cartaTermino
if (this.title === 'informe global') return this.alumno.informeGlobal
},
rechazarDialog() {
this.$buefy.dialog.confirm({
title: 'Confimar servicio',
message: '¿Seguro(a) que quiere rechazar este documento?',
confirmText: 'Confirmar',
cancelText: 'Cancelar',
type: 'is-danger',
hasIcon: true,
onConfirm: () => {
switch (this.idDoc) {
case 1:
this.rechazarCartaAceptacion()
break
case 2:
this.rechazarCartaTermino()
break
case 3:
this.rechazarInformeGlobal()
}
},
})
rechazarArchivo() {
if (this.title === 'carta de aceptación') this.rechazarCartaAceptacion()
if (this.title === 'carta de termino') this.rechazarCartaTermino()
if (this.title === 'informe global') this.rechazarInformeGlobal()
},
rechazarCartaAceptacion() {
const data = {
mensaje: this.mensajeRechazo,
idServicio: this.alumno.idServicio,
mensaje: this.mensajeRechazo,
}
this.updateIsLoading(true)
@@ -113,13 +103,10 @@ export default {
this.admin.token
)
.then((res) => {
this.updateIsLoading(false)
this.imprimirMensaje(res.data.message)
this.$router.push('/admin')
this.regresar(res.data.message)
})
.catch((err) => {
this.updateIsLoading(false)
this.imprimirError(err.response.data)
this.catchError(err.response.data)
})
},
rechazarCartaTermino() {
@@ -136,13 +123,10 @@ export default {
this.admin.token
)
.then((res) => {
this.updateIsLoading(false)
this.imprimirMensaje(res.data.message)
this.$router.push('/admin')
this.regresar(res.data.message)
})
.catch((err) => {
this.updateIsLoading(false)
this.imprimirError(err.response.data)
this.catchError(err.response.data)
})
},
rechazarInformeGlobal() {
@@ -159,13 +143,10 @@ export default {
this.admin.token
)
.then((res) => {
this.updateIsLoading(false)
this.imprimirMensaje(res.data.message)
this.$router.push('/admin')
this.regresar(res.data.message)
})
.catch((err) => {
this.updateIsLoading(false)
this.imprimirError(err.response.data)
this.catchError(err.response.data)
})
},
},
+6 -12
View File
@@ -196,13 +196,10 @@ export default {
axios
.put(`${process.env.api}/servicio/cancelar`, data, this.admin.token)
.then((res) => {
localStorage.removeItem('idServicio')
this.updateIsLoading(false)
this.imprimirMensaje(res.data.message)
this.$router.push('/admin')
this.regresar(res.data.message)
})
.catch((err) => {
catchError(err.response.data)
this.catchError(err.response.data)
})
},
confirmarRegistro() {
@@ -212,13 +209,10 @@ export default {
axios
.put(`${process.env.api}/servicio/registro`, data, this.admin.token)
.then((res) => {
localStorage.removeItem('idServicio')
this.updateIsLoading(false)
this.imprimirMensaje(res.data.message)
this.$router.push('/admin')
this.regresar(res.data.message)
})
.catch((err) => {
catchError(err.response.data)
this.catchError(err.response.data)
})
},
confirmarLiberacion() {
@@ -233,7 +227,7 @@ export default {
this.regresar(res.data.message)
})
.catch((err) => {
catchError(err.response.data)
this.catchError(err.response.data)
})
},
obtenerRegistro() {
@@ -249,7 +243,7 @@ export default {
this.updateIsLoading(false)
})
.catch((err) => {
catchError(err.response.data)
this.catchError(err.response.data)
})
},
catchError(errObj) {