correciones
This commit is contained in:
+3
-31
@@ -35,33 +35,11 @@
|
||||
>
|
||||
</p>
|
||||
|
||||
<b-field>
|
||||
<b-radio-button
|
||||
v-model="selector"
|
||||
native-value="impresiones"
|
||||
type="is-primary is-light is-outlined"
|
||||
expanded
|
||||
>
|
||||
<b-icon icon="printer-settings"></b-icon>
|
||||
<span>Impresiones</span>
|
||||
</b-radio-button>
|
||||
|
||||
<b-radio-button
|
||||
v-model="selector"
|
||||
native-value="inscripciones"
|
||||
type="is-primary is-light is-outlined"
|
||||
expanded
|
||||
>
|
||||
<b-icon icon="playlist-check"></b-icon>
|
||||
<span>Inscripciones</span>
|
||||
</b-radio-button>
|
||||
</b-field>
|
||||
|
||||
<div class="has-text-centered">
|
||||
<b-button
|
||||
@click="login()"
|
||||
type="is-success"
|
||||
:disabled="error || !(numeroCuenta && password && selector)"
|
||||
:disabled="error || !(numeroCuenta && password)"
|
||||
>
|
||||
Iniciar Sesión
|
||||
</b-button>
|
||||
@@ -84,13 +62,12 @@ export default {
|
||||
return {
|
||||
numeroCuenta: '',
|
||||
password: '',
|
||||
selector: '',
|
||||
error: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
login() {
|
||||
if (this.numeroCuenta && this.password && this.selector && !this.error) {
|
||||
if (this.numeroCuenta && this.password && !this.error) {
|
||||
const data = {
|
||||
numeroCuenta: this.numeroCuenta,
|
||||
passwordUser: this.password,
|
||||
@@ -109,12 +86,7 @@ export default {
|
||||
localStorage.setItem('idCarrera', info.idCarrera)
|
||||
localStorage.setItem('carrera', info.carrera)
|
||||
|
||||
this.updateIsLoading(false)
|
||||
if (this.selector === 'impresiones') {
|
||||
this.$router.push('/impresion')
|
||||
} else {
|
||||
this.$router.push('/registro')
|
||||
}
|
||||
this.$router.push('/registro')
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error = 'is-danger'
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
<template>
|
||||
<div class="columns margin">
|
||||
<div class="column ml-2 mr-5">
|
||||
<b-field label="Número de cuenta">
|
||||
<b-input v-model="numeroCuenta" expanded></b-input>
|
||||
<p class="control">
|
||||
<b-button @click="traerDatos" type="is-link">Buscar</b-button>
|
||||
</p>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Restar crédito">
|
||||
<b-input type="number" v-model="credito" expanded></b-input>
|
||||
<p class="control">
|
||||
<b-button @click="restarCredito" type="is-link">Restar</b-button>
|
||||
</p>
|
||||
</b-field>
|
||||
</div>
|
||||
|
||||
<div class="column mr-2 box ml-5">
|
||||
<p class="subtitle is-3">Cuenta: {{ this.numeroCuenta }}</p>
|
||||
<p class="subtitle is-3">Nombre: {{ datos.nombre }}</p>
|
||||
<p class="subtitle is-3">Credito: {{ datos.credito }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
export default {
|
||||
props: {
|
||||
updateIsLoading: { type: Function, require: true },
|
||||
imprimirError: { type: Function, require: true },
|
||||
imprimirMensaje: { type: Function, require: true },
|
||||
imprimirWarning: { type: Function, require: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
token: '',
|
||||
|
||||
numeroCuenta: '',
|
||||
credito: '',
|
||||
datos: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
traerDatos() {
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/admin/credito?numeroCuenta=${this.numeroCuenta}`,
|
||||
this.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
console.log(res)
|
||||
// this.datos.nombre = res.nombre
|
||||
// this.datos.credito = res.credito
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
restarCredito() {
|
||||
const data = {
|
||||
numeroCuenta: this.numeroCuenta,
|
||||
creditoUsado: this.credito,
|
||||
}
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.get(`${process.env.api}/usuario/restar_credito`, data, this.token)
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
;(this.datos.nombre = res.data.nombre),
|
||||
(this.datos.credito = res.data.credito)
|
||||
this.imprimirMensaje(res.data.message)
|
||||
this.traerDatos()
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.token = {
|
||||
headers: { token: localStorage.getItem('token') },
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.margin {
|
||||
margin-top: 70px;
|
||||
padding-bottom: 10%;
|
||||
}
|
||||
</style>
|
||||
@@ -1,123 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="block columns">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<b-table
|
||||
class="box"
|
||||
:data="inscripciones"
|
||||
:striped="true"
|
||||
:hoverable="true"
|
||||
:paginated="isPaginated"
|
||||
:per-page="perPage"
|
||||
:current-page.sync="currentPage"
|
||||
>
|
||||
<b-table-column
|
||||
field="numeroCuenta"
|
||||
label="Número de cuenta"
|
||||
centered
|
||||
v-slot="props"
|
||||
>
|
||||
{{ props.row.Usuario.numeroCuenta }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column field="ticket" label="Ticket" centered v-slot="props"
|
||||
>{{ props.row.folio }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column field="cantidad" label="Cantidad" centered v-slot="props">
|
||||
{{ props.row.monto }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column
|
||||
field="Fecha"
|
||||
label="Fecha y hora"
|
||||
centered
|
||||
v-slot="props"
|
||||
>{{ hora(props.row.fechaInscripcion) }}</b-table-column
|
||||
>
|
||||
|
||||
<b-table-column field="validar" label="Validar" centered v-slot="props">
|
||||
<b-button
|
||||
type="is-success"
|
||||
@click="
|
||||
usuario(
|
||||
props.row.Usuario.numeroCuenta,
|
||||
props.row.Usuario.idUsuario
|
||||
),
|
||||
imprimirWarning(
|
||||
'¿Estas seguro de querer validar esta inscripción ?',
|
||||
validarSinTicket
|
||||
)
|
||||
"
|
||||
>Validar</b-button
|
||||
>
|
||||
</b-table-column>
|
||||
</b-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import moment from 'moment'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
updateIsLoading: { type: Function, require: true },
|
||||
imprimirError: { type: Function, require: true },
|
||||
imprimirMensaje: { type: Function, require: true },
|
||||
imprimirWarning: { type: Function, require: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
token: '',
|
||||
|
||||
ticketsImpresion: [],
|
||||
isPaginated: true,
|
||||
currentPage: 1,
|
||||
perPage: 10,
|
||||
|
||||
numeroCuenta: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
tickets() {
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/admin/tickets_impresion?numeroCuenta=${this.numeroCuenta}`,
|
||||
this.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
this.ticketsImpresion = res.data
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
usuario(noCuenta, usuario) {
|
||||
this.data.numeroCuenta = noCuenta
|
||||
this.data.idUsuario = usuario
|
||||
},
|
||||
hora(value) {
|
||||
return moment(value).format('LLL')
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.token = {
|
||||
headers: { token: localStorage.getItem('token') },
|
||||
}
|
||||
this.tickets()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -1,138 +0,0 @@
|
||||
<template>
|
||||
<div class="px-2">
|
||||
<p class="subtitle is-4">
|
||||
<b
|
||||
>Captura la siguiente información tal cual se muestra en tu ticket de
|
||||
CEDETEC que se te entrego en cajas.</b
|
||||
>
|
||||
</p>
|
||||
|
||||
<div class="columns">
|
||||
<b-image
|
||||
class="column mx-2"
|
||||
:src="require('@/assets/ticket.jpeg')"
|
||||
alt="Ticket Acatlán"
|
||||
ratio="16by10"
|
||||
></b-image>
|
||||
|
||||
<div class="column pr-5">
|
||||
<b-field label="Monto">
|
||||
<b-input v-model="monto" type="number"></b-input>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Fecha">
|
||||
<b-datepicker
|
||||
v-model="fechaTicket"
|
||||
placeholder="Selecciona la fecha"
|
||||
icon="calendar-today"
|
||||
:min-date="minDate"
|
||||
:max-date="maxDate"
|
||||
>
|
||||
</b-datepicker>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Ticket">
|
||||
<b-input maxlength="6" v-model="folio"></b-input>
|
||||
</b-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="has-text-centered pb-2 pt-3">
|
||||
<p>Tu crédito es de: ${{ creditoDisponible }} pesos</p>
|
||||
</div>
|
||||
|
||||
<div class="has-text-centered pb-5 pt-3">
|
||||
<b-button
|
||||
:disabled="!(folio && monto && fechaTicket)"
|
||||
@click="
|
||||
imprimirWarning(
|
||||
'¿Los datos para el servicio de impresiones son correctos?',
|
||||
cargarCredito
|
||||
)
|
||||
"
|
||||
type="is-success"
|
||||
>Cargar crédito</b-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
imprimirMensaje: { type: Function, required: true },
|
||||
imprimirWarning: { type: Function, required: true },
|
||||
imprimirError: { type: Function, required: true },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
idUsuario: { type: Number, required: true },
|
||||
},
|
||||
data() {
|
||||
const today = new Date()
|
||||
return {
|
||||
folio: '',
|
||||
monto: '',
|
||||
fechaTicket: null,
|
||||
|
||||
creditoDisponible: 0,
|
||||
|
||||
minDate: this.diaMin(today),
|
||||
maxDate: new Date(),
|
||||
|
||||
data: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
traerCredito() {
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/usuario/credito?numeroCuenta=${this.numeroCuenta}`,
|
||||
this.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
this.creditoDisponible = res.data.credito
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
diaMin(today) {
|
||||
return new Date(
|
||||
today.getFullYear(),
|
||||
today.getMonth(),
|
||||
today.getDate() - today.getDate() + 1
|
||||
)
|
||||
},
|
||||
clear() {
|
||||
this.folio = ''
|
||||
this.monto = ''((this.fechaTicket = null))
|
||||
},
|
||||
async cargarCredito() {
|
||||
this.data.idUsuario = this.idUsuario
|
||||
this.data.folio = this.folio
|
||||
this.data.monto = this.monto
|
||||
this.data.fechaTicket = this.fechaTicket
|
||||
|
||||
this.updateIsLoading(true)
|
||||
await axios
|
||||
.post(`${process.env.api}/Usuario/agregar_credito`, this.data)
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirMensaje(res.data.message)
|
||||
this.clear()
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.traerCredito()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
+2
-13
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<!-- <b-tabs v-model="activeTab">
|
||||
<b-tabs v-model="activeTab">
|
||||
<b-tab-item label="Tabla de tickets">
|
||||
<TableTickets
|
||||
:updateIsLoading="updateIsLoading"
|
||||
@@ -16,29 +16,18 @@
|
||||
</p>
|
||||
<Reporte :updateIsLoading="updateIsLoading" />
|
||||
</b-tab-item>
|
||||
</b-tabs> -->
|
||||
|
||||
<RestarCredito
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:imprimirError="imprimirError"
|
||||
:imprimirMensaje="imprimirMensaje"
|
||||
:imprimirWarning="imprimirWarning"
|
||||
/>
|
||||
</b-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TableTickets from '~/components/admin/tableTickets.vue'
|
||||
import Reporte from '~/components/admin/reporte.vue'
|
||||
import RestarCredito from '~/components/admin/restarCredito.vue'
|
||||
import TableImpresiones from '~/components/admin/tableImpresiones.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
TableTickets,
|
||||
Reporte,
|
||||
RestarCredito,
|
||||
TableImpresiones,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<DatosTicket
|
||||
:imprimirMensaje="imprimirMensaje"
|
||||
:imprimirWarning="imprimirWarning"
|
||||
:imprimirError="imprimirError"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:idUsuario="idUsuario"
|
||||
/>
|
||||
|
||||
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DatosTicket from '../../components/impresion/datosTicket.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
DatosTicket,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
idUsuario: '',
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateIsLoading(booleanValue) {
|
||||
this.isLoading = booleanValue
|
||||
},
|
||||
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: () => {
|
||||
this.$router.push(`/`)
|
||||
localStorage.clear()
|
||||
},
|
||||
})
|
||||
},
|
||||
imprimirWarning(
|
||||
message,
|
||||
onConfirm = () => {},
|
||||
title = '¡Espera un minuto!',
|
||||
onCancel = () => {}
|
||||
) {
|
||||
this.$buefy.dialog.alert({
|
||||
ariaRole: 'alertdialog',
|
||||
ariaModal: true,
|
||||
type: 'is-warning',
|
||||
title,
|
||||
message,
|
||||
confirmText: 'Si',
|
||||
canCancel: true,
|
||||
cancelText: 'No',
|
||||
hasIcon: true,
|
||||
iconPack: 'mdi',
|
||||
icon: 'help-circle',
|
||||
onConfirm: () => onConfirm(),
|
||||
onCancel: () => onCancel(),
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.idUsuario = Number(localStorage.getItem('idUsuario'))
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user