vistaServicio final

This commit is contained in:
2020-12-04 16:30:15 -06:00
parent f3a3f32e25
commit b0574b397c
2 changed files with 51 additions and 19 deletions
+50 -18
View File
@@ -133,7 +133,10 @@
<b-button class="is-danger" @click="enviarCancel = !enviarCancel">
Cancelar
</b-button>
<b-button class="is-success" @click="confirmarDialog()" v-if="mostrarConfirmar()">
<b-button class="is-success" @click="confirmarDialog()" v-if="mostrarConfirmar1(1)">
Confirmar
</b-button>
<b-button class="is-success" @click="confirmarDialog()" v-if="mostrarConfirmar2(2)">
Confirmar
</b-button>
<br><br>
@@ -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') }
} */
}
</script>
+1 -1
View File
@@ -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'
}