149 lines
3.8 KiB
Vue
149 lines
3.8 KiB
Vue
<template>
|
|
<div class="box">
|
|
<p class="pb-2"><b>Número de cuenta: </b> {{ numeroCuenta }}</p>
|
|
|
|
<b-field label="Ticket" horizontal grouped>
|
|
<b-input v-model="folioA" :disabled="switchFolio" maxlength="6"></b-input>
|
|
<p class="control">
|
|
<b-button
|
|
type="is-primary"
|
|
icon-left="pencil"
|
|
@click="habilitar('folio')"
|
|
>
|
|
</b-button>
|
|
</p>
|
|
</b-field>
|
|
|
|
<b-field label="Cantidad" horizontal>
|
|
<b-input class="pb-5 px-4" expanded v-model="montoA" :disabled="switchMonto" type="number" step="0.01"/>
|
|
<p class="control">
|
|
<b-button
|
|
type="is-primary"
|
|
icon-left="pencil"
|
|
@click="habilitar('monto')"
|
|
>
|
|
</b-button>
|
|
</p>
|
|
</b-field>
|
|
|
|
<b-field label="Fecha del ticket" horizontal>
|
|
<b-datepicker
|
|
v-model="fechaTicketA"
|
|
:disabled="switchFecha"
|
|
:max-date="maxDate"
|
|
icon="calendar-today"
|
|
>
|
|
</b-datepicker>
|
|
<p class="control">
|
|
<b-button
|
|
type="is-primary"
|
|
icon-left="pencil"
|
|
@click="habilitar('fecha')"
|
|
>
|
|
</b-button>
|
|
</p>
|
|
</b-field>
|
|
|
|
<div class="has-text-centered pb-2">
|
|
<b-button
|
|
type="is-success"
|
|
@click="
|
|
imprimirWarning(
|
|
'¿Estas seguro de querer actualizar esta información?',
|
|
actualizarTicket
|
|
)
|
|
"
|
|
>Actualizar datos</b-button
|
|
>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
|
|
export default {
|
|
props: {
|
|
imprimirMensaje: { type: Function, required: true },
|
|
imprimirError: { type: Function, required: true },
|
|
imprimirWarning: { type: Function, required: true },
|
|
updateIsLoading: { type: Function, require: true },
|
|
folio: { type: String, required: true },
|
|
monto: { type: String, required: true },
|
|
token: { type: Object, required: true },
|
|
fechaTicket: { type: Date, required: true },
|
|
},
|
|
data() {
|
|
return {
|
|
numeroCuenta: localStorage.getItem('noCuenta'),
|
|
|
|
switchFolio: true,
|
|
switchMonto: true,
|
|
switchFecha: true,
|
|
|
|
folioA: '',
|
|
montoA: '',
|
|
fechaTicketA: null,
|
|
maxDate: new Date(),
|
|
}
|
|
},
|
|
methods: {
|
|
habilitar(tipo) {
|
|
tipo == 'folio' && this.switchFolio == true
|
|
? (this.switchFolio = false)
|
|
: (this.switchFolio = true)
|
|
|
|
tipo == 'monto' && this.switchMonto == true
|
|
? (this.switchMonto = false)
|
|
: (this.switchMonto = true)
|
|
|
|
tipo == 'fecha' && this.switchFecha == true
|
|
? (this.switchFecha = false)
|
|
: (this.switchFecha = true)
|
|
},
|
|
actualizarTicket() {
|
|
const data = {
|
|
idInscripcion: Number(localStorage.getItem('inscripcion')),
|
|
folio: this.folioA,
|
|
monto: this.montoA,
|
|
fechaTicket: this.fechaTicketA,
|
|
}
|
|
|
|
this.updateIsLoading(true)
|
|
axios
|
|
.put(`${process.env.api}/admin/actualizar_ticket`, data, this.token)
|
|
.then((res) => {
|
|
this.updateIsLoading(false)
|
|
this.imprimirMensaje(res.data.message)
|
|
this.bloquearBotones()
|
|
localStorage.setItem('monto', this.montoA)
|
|
localStorage.setItem('folio', this.folioA)
|
|
localStorage.setItem('fechaTicket', this.fechaTicketA)
|
|
this.$emit('actualizarFolio')
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.imprimirError(err.response.data)
|
|
})
|
|
},
|
|
bloquearBotones() {
|
|
this.switchFolio = true
|
|
this.switchMonto = true
|
|
this.switchFecha = true
|
|
},
|
|
diaMin(today) {
|
|
return new Date(
|
|
today.getFullYear(),
|
|
today.getMonth(),
|
|
today.getDate() - today.getDate() + 1
|
|
)
|
|
},
|
|
},
|
|
created() {
|
|
;(this.folioA = this.folio),
|
|
(this.montoA = this.monto),
|
|
(this.fechaTicketA = this.fechaTicket)
|
|
},
|
|
}
|
|
</script>
|