From b0574b397c65e123395dc66e50fb7c4192ac8b8f Mon Sep 17 00:00:00 2001 From: mxrco Date: Fri, 4 Dec 2020 16:30:15 -0600 Subject: [PATCH] vistaServicio final --- components/admin/servicio/vistaServicio.vue | 68 +++++++++++++++------ nuxt.config.js | 2 +- 2 files changed, 51 insertions(+), 19 deletions(-) diff --git a/components/admin/servicio/vistaServicio.vue b/components/admin/servicio/vistaServicio.vue index 10961d8..a05901a 100644 --- a/components/admin/servicio/vistaServicio.vue +++ b/components/admin/servicio/vistaServicio.vue @@ -133,7 +133,10 @@ Cancelar - + + Confirmar + + Confirmar

@@ -186,11 +189,14 @@ export default { } }, methods: { - mostrarConfirmar () { + mostrarConfirmar1 () { if (this.alumno.Status.idStatus === 1) return true - else if (this.alumno.Status.idStatus === 5) { + return false + }, + mostrarConfirmar2 () { + if (this.alumno.Status.idStatus === 5) { if (!this.alumno.acatlanContigo) return true - else if (this.vistoBueno) return true + else if (this.alumno.vistoBueno) return true } return false }, @@ -224,7 +230,7 @@ export default { onConfirm: () => this.cancelar() }) }, - confirmarDialog () { + confirmarDialog (a) { this.$buefy.dialog.confirm({ title: 'Confimar servicio', message: '¿Seguro(a) que quiere confirmar este servicio?', @@ -232,7 +238,14 @@ export default { cancelText: 'Cancelar', type: 'is-success', hasIcon: true, - onConfirm: () => this.confirmar() + onConfirm: () => { + switch (a) { + case 1: this.confirmarRegistro() + break + case 2: this.confirmarTermino() + break + } + } }) }, rechazarDialog (num) { @@ -259,7 +272,7 @@ export default { this.isLoading = true const data = { mensaje: this.mensajeRech1, - idRegistro: this.idRegistro + idServicio: this.idServicio } axios .put(`${process.env.api}/servicio/rechazar_aceptacion`, data) @@ -277,7 +290,7 @@ export default { this.isLoading = true const data = { mensaje: this.mensajeRech2, - idRegistro: this.idRegistro + idServicio: this.idServicio } axios .put(`${process.env.api}/servicio/rechazar_termino`, data) @@ -295,7 +308,7 @@ export default { this.isLoading = true const data = { mensaje: this.mensajeRech3, - idRegistro: this.idRegistro + idServicio: this.idServicio } axios .put(`${process.env.api}/servicio/rechazar_informe`, data) @@ -312,7 +325,7 @@ export default { cancelar () { this.isLoading = true const data = { - idRegistro: this.idRegistro, + idServicio: this.idServicio, mensajeCalce: this.mensajeCancel } axios @@ -320,8 +333,8 @@ export default { .then(res => { this.isLoading = false this.$buefy.dialog.alert('El servicio ha sido cancelado con éxito') - // localStorage.removeItem('idRegistro') - // this.$router.push('/admin') + localStorage.removeItem('idServicio') + this.$router.push('./') }) .catch(err => { this.isLoading = false @@ -333,20 +346,39 @@ export default { const fecha = moment(date.substr(0, 10)) return `${fecha.date()}/${fecha.month() + 1}/${fecha.year()}` }, - confirmar () { + confirmarRegistro () { this.isLoading = true const data = { - idRegistro: this.idRegistro + idServicio: this.idServicio + } + axios + .put(`${process.env.api}/servicio/registro`, data) + .then(res => { + this.isLoading = false + this.$buefy.dialog.alert('El servicio ha sido aprovado') + localStorage.removeItem('idServicio') + this.$router.push('/admin') + }) + .catch(e => { + this.isLoading = false + console.log(e) + this.error() + }) + }, + confirmarLiberacion () { + this.isLoading = true + const data = { + idServicio: this.idServicio } if (this.alumno.vistoBueno) { data.vistoBueno = this.alumno.vistoBueno } axios - .put(`${process.env.api}/servicio/cancelar`, data) + .put(`${process.env.api}/servicio/liberacion`, data) .then(res => { this.isLoading = false - this.$buefy.dialog.alert('El servicio ha sido aprovado') - localStorage.removeItem('idRegistro') + this.$buefy.dialog.alert('El servicio ha sido liberado') + localStorage.removeItem('idServicio') this.$router.push('/admin') }) .catch(e => { @@ -376,7 +408,7 @@ export default { await this.obtenerRegistro() }/* , beforeCreate () { - if (!localStorage.getItem('idRegistro')) { this.$router.push('./admin') } + if (!localStorage.getItem('idServicio')) { this.$router.push('./admin') } } */ } diff --git a/nuxt.config.js b/nuxt.config.js index 732b29b..16eb796 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -52,7 +52,7 @@ export default { }, env: { // api: 'http://localhost:3000' - api: 'https://6fcf0b54e39d.ngrok.io' + api: 'https://b82ccc416703.ngrok.io' // api: 'https//venus.acatlan.unam.mx/pruebas_pcpuma' }