validaciones y validacion de la inscripcion sin ticket
This commit is contained in:
@@ -54,6 +54,24 @@
|
||||
@click="verTicket(props.row)"
|
||||
>Ver ticket</b-button
|
||||
>
|
||||
|
||||
<b-button
|
||||
type="is-success"
|
||||
v-if="
|
||||
!props.row.folio &&
|
||||
!props.row.monto &&
|
||||
!props.row.fechaTicket &&
|
||||
props.row.validacion != 1
|
||||
"
|
||||
@click="
|
||||
cuenta(props.row.Usuario.numeroCuenta),
|
||||
imprimirWarning(
|
||||
'¿Estas seguro de querer validar esta inscripción ?',
|
||||
validarSinTicket
|
||||
)
|
||||
"
|
||||
>Validar</b-button
|
||||
>
|
||||
</b-table-column>
|
||||
</b-table>
|
||||
</div>
|
||||
@@ -75,6 +93,7 @@ export default {
|
||||
currentPage: 1,
|
||||
perPage: 5,
|
||||
|
||||
noCuenta: '',
|
||||
validacion: '2',
|
||||
numeroCuenta: '',
|
||||
}
|
||||
@@ -90,13 +109,13 @@ export default {
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
this.inscripciones = res.data
|
||||
console.log(this.inscripciones)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
})
|
||||
},
|
||||
verTicket(value) {
|
||||
console.log(value)
|
||||
this.$router.push({
|
||||
path: '/admin/ticket/',
|
||||
query: {
|
||||
@@ -106,6 +125,81 @@ export default {
|
||||
},
|
||||
})
|
||||
},
|
||||
validarSinTicket() {
|
||||
const data = {
|
||||
numeroCuenta: this.noCuenta,
|
||||
}
|
||||
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.put(`${process.env.api}/admin/validar_sin_ticket`, data, this.token)
|
||||
.then((res) => {
|
||||
this.imprimirMensaje(res.data.message)
|
||||
this.updateIsLoading(false)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.imprimirError(err.response.data)
|
||||
this.updateIsLoading(false)
|
||||
})
|
||||
},
|
||||
cuenta(value) {
|
||||
this.noCuenta = value
|
||||
},
|
||||
|
||||
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('/')
|
||||
}
|
||||
},
|
||||
imprimirMensaje(message, title = '¡Felicidades!', onConfirm = () => {}) {
|
||||
this.$buefy.dialog.alert({
|
||||
ariaRole: 'alertdialog',
|
||||
ariaModal: true,
|
||||
type: 'is-success',
|
||||
title,
|
||||
message,
|
||||
confirmText: 'Ok',
|
||||
hasIcon: true,
|
||||
iconPack: 'mdi',
|
||||
icon: 'check-circle',
|
||||
onConfirm: () => onConfirm(),
|
||||
})
|
||||
},
|
||||
imprimirWarning(
|
||||
message,
|
||||
onConfirm = () => {},
|
||||
title = '¡Espera un minuto!',
|
||||
onCancel = () => {}
|
||||
) {
|
||||
this.$buefy.dialog.alert({
|
||||
ariaRole: 'alertdialog',
|
||||
ariaModal: true,
|
||||
type: 'is-warning',
|
||||
title,
|
||||
message,
|
||||
confirmText: 'Confirmar',
|
||||
canCancel: true,
|
||||
cancelText: 'Cancelar',
|
||||
hasIcon: true,
|
||||
iconPack: 'mdi',
|
||||
icon: 'help-circle',
|
||||
onConfirm: () => onConfirm(),
|
||||
onCancel: () => onCancel(),
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
validacion() {
|
||||
|
||||
@@ -143,7 +143,6 @@ export default {
|
||||
terminos: false,
|
||||
|
||||
fechaTicket: '',
|
||||
dia: 10,
|
||||
minDate: this.diaMin(today),
|
||||
maxDate: new Date(),
|
||||
|
||||
@@ -152,7 +151,19 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async inscribir() {
|
||||
let formData = new FormData()
|
||||
if (this.dropFiles.length > 0 && !this.folio) {
|
||||
if (!this.fechaTicket) {
|
||||
return this.imprimirError({
|
||||
message:
|
||||
'Por favor ingresa el campo de ticket y la fecha del ticket.',
|
||||
})
|
||||
} else {
|
||||
return this.imprimirError({
|
||||
message: 'Por favor ingresa el campo de ticket.',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
this.monto &&
|
||||
this.monto <= 20 &&
|
||||
@@ -160,6 +171,8 @@ export default {
|
||||
)
|
||||
this.error = true
|
||||
else this.error = false
|
||||
|
||||
let formData = new FormData()
|
||||
if (this.error === false) {
|
||||
formData.append('idUsuario', this.datosUsuario.idUsuario)
|
||||
formData.append('folio', this.folio)
|
||||
@@ -183,7 +196,6 @@ export default {
|
||||
this.clear()
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
@@ -242,9 +254,10 @@ export default {
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
inscripcionesUsuario() {
|
||||
this.areaPermitida()
|
||||
inscripcionesUsuario(value) {
|
||||
if (value.length > 0) this.idArea = ''
|
||||
},
|
||||
|
||||
dropFiles(value) {
|
||||
if (value.length > 1) this.deleteDropFile(0)
|
||||
},
|
||||
|
||||
+2
-2
@@ -24,9 +24,9 @@ export default {
|
||||
axios: {},
|
||||
build: {},
|
||||
env: {
|
||||
// api: 'http://localhost:3000',
|
||||
api: 'http://localhost:3000',
|
||||
// api: "https://890af9d598a4.ngrok.io"
|
||||
api: 'https://venus.acatlan.unam.mx/inscripciones_test',
|
||||
// api: 'https://venus.acatlan.unam.mx/inscripciones_test',
|
||||
// api: "https://venus.acatlan.unam.mx/produccion",
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user