Files

224 lines
5.9 KiB
Vue
Raw Permalink Normal View History

2022-01-20 00:23:03 -06:00
<template>
<div>
2022-02-16 00:09:49 -06:00
<div class="block columns">
<b-field class="column" label="Status del ticket">
<b-radio v-model="validacion" native-value="1"
><b-tag type="is-success" size="is-medium">Validados</b-tag></b-radio
>
<b-radio v-model="validacion" native-value="0">
<b-tag type="is-danger" size="is-medium">Declinados</b-tag></b-radio
>
<b-radio v-model="validacion" native-value="2">
<b-tag size="is-medium">Sin validar</b-tag></b-radio
>
</b-field>
<b-field class="column" label="Número de cuenta">
<b-input v-model="numeroCuenta" expanded></b-input>
<p class="control">
<b-button @click="todasInscripciones" type="is-link">Buscar</b-button>
</p>
</b-field>
2022-02-10 00:45:16 -06:00
</div>
<b-table
class="box"
:data="inscripciones"
2022-02-10 00:45:16 -06:00
:striped="true"
:hoverable="true"
:paginated="isPaginated"
:per-page="perPage"
:current-page.sync="currentPage"
>
2022-02-01 23:43:44 -06:00
<b-table-column
field="numeroCuenta"
label="Número de cuenta"
centered
v-slot="props"
>
{{ props.row.Usuario.numeroCuenta }}
2022-01-20 00:23:03 -06:00
</b-table-column>
2022-03-14 23:38:59 -06:00
<b-table-column field="ticket" label="Ticket" centered v-slot="props"
2022-02-01 23:43:44 -06:00
>{{ props.row.folio }}
</b-table-column>
2022-01-20 17:42:55 -06:00
2022-02-01 23:43:44 -06:00
<b-table-column field="cantidad" label="Cantidad" centered v-slot="props">
{{ props.row.monto }}
2022-01-20 17:42:55 -06:00
</b-table-column>
2022-03-22 18:21:39 -06:00
<b-table-column
field="Fecha"
label="Fecha y hora"
centered
v-slot="props"
>{{ hora(props.row.fechaInscripcion) }}</b-table-column
>
2022-03-14 23:38:59 -06:00
<b-table-column
field="inscripcion"
label="Inscripción"
centered
v-slot="props"
>
<b-button
2022-03-14 23:38:59 -06:00
type="is-success"
v-if="!props.row.folio && !props.row.monto && !props.row.fechaTicket"
@click="
usuario(
props.row.Usuario.numeroCuenta,
2022-08-05 16:44:10 -05:00
props.row.Usuario.idUsuario,
props.row.idArea
2022-03-14 23:38:59 -06:00
),
imprimirWarning(
'¿Estas seguro de querer validar esta inscripción ?',
validarSinTicket
)
"
>Validar</b-button
2022-02-03 23:10:35 -06:00
>
2022-03-15 18:51:07 -06:00
</b-table-column>
2022-03-15 18:51:07 -06:00
<b-table-column centered v-slot="props">
<b-button
2022-03-14 23:38:59 -06:00
type="is-danger"
@click="
2022-03-15 18:51:07 -06:00
inscripcion(props.row.idInscripcion),
imprimirWarning(
2022-03-15 18:51:07 -06:00
'¿Estas seguro de querer cancelar esta inscripción ?',
cancelarInscripcion
)
"
2022-03-14 23:38:59 -06:00
>Cancelar</b-button
>
</b-table-column>
<b-table-column centered v-slot="props">
<b-button
type="is-info"
v-if="props.row.folio"
@click="verTicket(props.row)"
>Ver ticket</b-button
>
2022-01-20 00:23:03 -06:00
</b-table-column>
</b-table>
</div>
</template>
2022-01-20 00:24:35 -06:00
2022-02-01 23:43:44 -06:00
<script>
import axios from 'axios'
2022-03-22 18:21:39 -06:00
import moment from 'moment'
2022-02-01 23:43:44 -06:00
export default {
props: {
2022-07-28 13:23:21 -05:00
updateIsLoading: { type: Function, required: true },
imprimirError: { type: Function, required: true },
imprimirMensaje: { type: Function, required: true },
imprimirWarning: { type: Function, required: true },
},
2022-02-01 23:43:44 -06:00
data() {
return {
token: '',
2022-02-01 23:43:44 -06:00
inscripciones: [],
isPaginated: true,
currentPage: 1,
2022-03-22 18:21:39 -06:00
perPage: 10,
2022-02-10 00:45:16 -06:00
2022-03-06 20:01:55 -06:00
data: {},
2022-03-15 18:51:07 -06:00
dataIns: {},
2022-02-16 00:09:49 -06:00
validacion: '2',
numeroCuenta: '',
2022-02-01 23:43:44 -06:00
}
},
methods: {
2022-02-16 00:09:49 -06:00
todasInscripciones() {
this.updateIsLoading(true)
2022-02-01 23:43:44 -06:00
axios
2022-02-10 00:45:16 -06:00
.get(
`${process.env.api}/admin/todas_inscripciones?validacion=${this.validacion}&numeroCuenta=${this.numeroCuenta}`,
this.token
2022-02-10 00:45:16 -06:00
)
2022-02-01 23:43:44 -06:00
.then((res) => {
this.updateIsLoading(false)
2022-02-01 23:43:44 -06:00
this.inscripciones = res.data
})
.catch((err) => {
this.updateIsLoading(false)
2022-03-22 18:21:39 -06:00
this.imprimirError(err.response.data)
2022-02-01 23:43:44 -06:00
})
},
2022-02-03 23:10:35 -06:00
verTicket(value) {
2022-03-15 18:27:20 -06:00
this.$router.push('/admin/ticket')
2022-07-28 00:49:13 -05:00
localStorage.setItem('idArea', value.idArea)
2022-03-15 18:27:20 -06:00
localStorage.setItem('monto', value.monto)
localStorage.setItem('folio', value.folio)
localStorage.setItem('fechaTicket', value.fechaTicket)
2022-03-14 23:45:43 -06:00
localStorage.setItem('noCuenta', value.Usuario.numeroCuenta)
2022-03-15 18:27:20 -06:00
localStorage.setItem('inscripcion', value.idInscripcion)
2022-07-29 13:56:23 -05:00
localStorage.setItem('validacion', this.validacion)
2022-02-03 23:10:35 -06:00
},
2022-08-05 16:44:10 -05:00
usuario(noCuenta, usuario, idArea) {
2022-03-15 18:51:07 -06:00
this.data.numeroCuenta = noCuenta
this.data.idUsuario = usuario
2022-08-05 16:44:10 -05:00
this.data.idArea = idArea
2022-03-15 18:51:07 -06:00
},
validarSinTicket() {
this.updateIsLoading(true)
axios
2022-03-06 20:01:55 -06:00
.put(
`${process.env.api}/admin/validar_sin_ticket`,
this.data,
this.token
)
.then((res) => {
2022-03-22 18:21:39 -06:00
this.updateIsLoading(false)
this.imprimirMensaje(res.data.message)
2022-03-21 23:32:54 -06:00
this.todasInscripciones()
})
.catch((err) => {
this.updateIsLoading(false)
2022-03-22 18:21:39 -06:00
this.imprimirError(err.response.data)
})
},
2022-03-15 18:51:07 -06:00
inscripcion(inscripcion) {
this.dataIns.idInscripcion = inscripcion
},
cancelarInscripcion() {
this.updateIsLoading(true)
axios
.put(
`${process.env.api}/admin/cancelar_inscripcion`,
this.dataIns,
this.token
)
.then((res) => {
this.imprimirMensaje(res.data.message)
this.updateIsLoading(false)
2022-03-21 14:02:41 -06:00
this.todasInscripciones()
2022-03-15 18:51:07 -06:00
})
.catch((err) => {
this.imprimirError(err.response.data)
this.updateIsLoading(false)
})
},
2022-03-22 18:21:39 -06:00
hora(value) {
return moment(value).format('LLL')
},
2022-02-01 23:43:44 -06:00
},
2022-02-10 00:45:16 -06:00
watch: {
2022-02-16 00:09:49 -06:00
validacion() {
this.todasInscripciones()
2022-02-10 00:45:16 -06:00
},
},
2022-02-01 23:43:44 -06:00
created() {
this.token = {
headers: { token: localStorage.getItem('token') },
}
2022-02-16 00:09:49 -06:00
this.todasInscripciones()
2022-02-01 23:43:44 -06:00
},
}
</script>
2022-01-20 00:24:35 -06:00
<style scoped></style>