13 Commits

Author SHA1 Message Date
Marcorv6 6bbf3bfcba premiaciones no mostrar inactivas 2022-06-01 20:34:02 -05:00
Marcorv6 d632711f66 estilos login mobile 2022-06-01 11:50:26 -05:00
Marcorv6 ccb97ee082 url api 2022-06-01 09:57:28 -05:00
Marcorv6 142be715d6 tokens 2022-05-29 23:17:52 -05:00
Marcorv6 e50e7ef6e6 url api 2022-05-25 23:36:32 -05:00
Marcorv6 2275e5e8fc already registred 2022-05-25 21:21:24 -05:00
Marcorv6 fc2af4c815 login arreglado 2022-05-25 19:27:02 -05:00
Marcorv6 5cf1e87d54 clean console logs 2022-05-24 23:11:56 -05:00
Marcorv6 4e7aa3d119 quick fix 2022-05-24 21:05:11 -05:00
Marcorv6 301be2124c correccion login 2022-05-24 18:06:54 -05:00
Marco 033c477808 conflict 2022-05-24 13:54:04 -05:00
Marco f424ecda46 router push 2022-05-24 13:52:25 -05:00
Jeremy Carreras 557344203b url api produccion 2022-05-23 19:29:56 -05:00
14 changed files with 182 additions and 92 deletions
+24 -12
View File
@@ -1,10 +1,8 @@
<template>
<div class="full-h cont">
<h2 class="has-text-centered is-size-2">
Registro de invitados
</h2>
<div class="is-flex">
<div class="">
<h2 class="has-text-centered is-size-2">Registro de invitados</h2>
<div class="cont-2 is-flex">
<div class="img">
<b-image
:src="require('@/assets/login_image.png')"
alt="LoginImage"
@@ -12,8 +10,8 @@
class="my-4 img"
></b-image>
</div>
<div class="is-flex is-justify-content-center">
<form class="box">
<div class="is-flex is-justify-content-center cont-login">
<form class="box" @submit.prevent="">
<p>
Para garantizar el acceso de sus invitados a la ceremonia de entrega
de medallas en la que usted será distinguido(a), le pedimos
@@ -22,15 +20,16 @@
<b-field label="Número de trabajador" :type="error">
<b-input
type="number"
@keyup.enter.native="login()"
v-model="noTrabajador"
v-on:keydown.prevent="submit"
/>
</b-field>
<div class="has-text-centered">
<b-button
@click="login()"
type="is-success"
native-type="submit"
@click="login()"
:disabled="error || !noTrabajador"
>
Iniciar sesión
@@ -79,12 +78,12 @@ export default {
'numeroTrabajador',
info.Profesor.numeroTrabajador
)
this.$router.push('profesor')
this.$router.push('Profesor')
})
.catch((err) => {
this.updateIsLoading(false)
this.error = 'is-danger'
this.imprimirError(err.response.data)
this.imprimirError(err.response.data.message)
})
}
},
@@ -110,7 +109,20 @@ export default {
.cont {
margin-top: 10rem;
}
.img{
@media (max-width: 768px) {
.img {
display: none;
}
.cont-login{
width: 382px;
}
.box
{
padding: 15px !important;
}
}
.img {
width: 30rem;
height: 14rem;
margin-right: 2rem;
+22 -8
View File
@@ -3,7 +3,7 @@
<div class="has-text-centered">
<h2 class="is-size-1">Entrega de medallas operador</h2>
</div>
<div class="is-flex is-justify-content-center my-3">
<div class="is-flex is-justify-content-center my-3 cont-login">
<b-radio v-model="loginType" name="loginType" native-value="1">
Admin
</b-radio>
@@ -11,8 +11,8 @@
Operador
</b-radio>
</div>
<div class="is-flex is-justify-content-center my-3">
<form v-if="loginType == 1" class="box">
<div class="is-flex is-justify-content-center my-3 cont-login">
<form v-if="loginType == 1" class="box" @submit.prevent="">
<b-field label="Usuario" :type="error">
<b-input
type="text"
@@ -34,13 +34,14 @@
<b-button
@click="login()"
type="is-success"
native-type="submit"
:disabled="error || !(usuario && password)"
>
Iniciar Sesión
</b-button>
</div>
</form>
<form v-else-if="loginType == 2" class="box">
<form v-else-if="loginType == 2" class="box" @submit.prevent="">
<b-field label="Usuario" :type="error">
<b-input
type="text"
@@ -62,6 +63,7 @@
<b-button
@click="login()"
type="is-success"
native-type="submit"
:disabled="error || !(usuario && password)"
>
Iniciar Sesión
@@ -114,12 +116,13 @@ export default {
localStorage.setItem('tipoUsuario', info.Usuario.idTipoUsuario)
localStorage.setItem('idUsuario', info.Usuario.idUsuario)
this.updateIsLoading(false)
this.$router.push(`/${'admin'}`)
this.$router.push(`/${'Admin'}`)
})
.catch((err) => {
this.error = 'is-danger'
this.updateIsLoading(false)
this.imprimirError(err.response.data)
this.error = 'is-danger'
console.log(err.response.data.message)
this.imprimirError(err.response.data.message)
})
}
@@ -139,7 +142,7 @@ export default {
localStorage.setItem('usuario', info.Usuario.usuario)
localStorage.setItem('idUsuario', info.Usuario.idUsuario)
this.updateIsLoading(false)
this.$router.push(`/${'operador'}`)
this.$router.push(`/${'Operador'}`)
})
.catch((err) => {
this.error = 'is-danger'
@@ -170,6 +173,17 @@ export default {
height: 75vh;
}
@media (max-width: 768px) {
.cont-login{
width: 382px;
margin-left: 1.5rem;
}
.box
{
padding: 15px !important;
}
}
form {
width: 30rem;
}
+5 -4
View File
@@ -111,13 +111,14 @@ export default {
hora: this.hora,
activa: true
}
console.log(data)
axios
.post(`${process.env.api}/Premiacion/nueva`, data)
.post(`${process.env.api}/Premiacion/nueva`, data, {
headers: {
token: localStorage.getItem('token'),
},
})
.then((res) => {
this.updateIsLoading(false)
const info = res.data
console.log(info)
this.success()
this.reset()
})
+12 -6
View File
@@ -77,7 +77,11 @@ export default {
fecha: this.fechaNueva,
}
axios
.put(`${process.env.api}/Premiacion/editar`, data)
.put(`${process.env.api}/Premiacion/editar`, data, {
headers: {
token: localStorage.getItem('token'),
},
})
.then((res) => {
this.updateIsLoading(false)
let message = 'Se ha editado la premiación con éxito.'
@@ -95,10 +99,9 @@ export default {
localStorage.removeItem('fecha')
localStorage.removeItem('hora')
localStorage.removeItem('activa')
this.$router.push('/admin')
this.$router.push('/Admin')
},
colorBoton() {
console.log(this.activa)
if (this.activa === true) return 'is-danger'
return 'is-success'
},
@@ -112,9 +115,12 @@ export default {
idPremiacion: this.idPremiacion,
activa: !this.activa,
}
console.log(data)
axios
.put(`${process.env.api}/Premiacion/activarDesactivar`, data)
.put(`${process.env.api}/Premiacion/activarDesactivar`, data, {
headers: {
token: localStorage.getItem('token'),
},
})
.then((res) => {
this.updateIsLoading(false)
let message =
@@ -177,7 +183,7 @@ export default {
confirmButtonColor: '#1e3c70',
}).then((res) => {
if (res.value) {
this.$router.push("/admin")
this.$router.push('/admin')
}
})
},
+5 -3
View File
@@ -108,11 +108,13 @@ export default {
password: this.password,
}
axios
.post(`${process.env.api}/usuario/nuevoOperador`, data)
.post(`${process.env.api}/usuario/nuevoOperador`, data, {
headers: {
token: localStorage.getItem('token'),
},
})
.then((res) => {
this.updateIsLoading(false)
const info = res.data
console.log(info)
this.success()
this.reset()
})
+12 -5
View File
@@ -1,7 +1,9 @@
<template>
<div>
<CrearPremiacion :updateIsLoading="updateIsLoading"/>
<h2 class="has-text-centered mt-5 is-size-3">Administración de premiaciones</h2>
<CrearPremiacion :updateIsLoading="updateIsLoading" />
<h2 class="has-text-centered mt-5 is-size-3">
Administración de premiaciones
</h2>
<TablaPremiaciones
:data="data"
:isLoadingTable="isLoadingTable"
@@ -20,14 +22,14 @@ import axios from 'axios'
export default {
components: {
TablaPremiaciones,
CrearPremiacion
CrearPremiacion,
},
props: {
updateIsLoading: {
type: Function,
required: true,
default: () => {},
}
},
},
data() {
return {
@@ -46,7 +48,12 @@ export default {
this.updateIsLoading(true)
axios
.get(
`${process.env.api}/premiacion/premiacionesPaginacion?pagina=${this.page}`
`${process.env.api}/premiacion/premiacionesPaginacion?pagina=${this.page}`,
{
headers: {
token: localStorage.getItem('token'),
},
}
)
.then((res) => {
if (res) {
+31 -11
View File
@@ -124,12 +124,16 @@ export default {
formData.append('file', this.csv)
axios
.post(`${process.env.api}/profesor/cargarDatos?idPremiacion=${this.idPremiacionCSV}`, formData, {
headers: {
'Content-Type': 'multipart/form-data',
// token: localStorage.getItem('token'),
},
})
.post(
`${process.env.api}/profesor/cargarDatos?idPremiacion=${this.idPremiacionCSV}`,
formData,
{
headers: {
'Content-Type': 'multipart/form-data',
token: localStorage.getItem('token'),
},
}
)
.then((res) => {
this.isLoading = false
this.csv = {}
@@ -162,6 +166,15 @@ export default {
confirmButtonColor: '#1e3c70',
})
},
errorMessageExt() {
this.$swal({
title: 'Asegurate de ingresar un archivo .CSV.',
type: 'error',
timer: 5000,
confirmButtonText: 'Aceptar',
confirmButtonColor: '#1e3c70',
})
},
noDataErrorMessage() {
this.$swal({
title: 'No hay datos que descargar.',
@@ -179,22 +192,25 @@ export default {
const extPermitidas = /(.csv)$/i
if (!extPermitidas.exec(this.csv.name)) {
this.imprimirError({ message: 'Asegurate de ingresar un archivo .CSV' })
this.errorMessageExt()
this.csv = {}
}
},
},
watch: {
idPremiacion() {
console.log("Algo")
this.dataExport = []
this.isLoading = true
axios
.get(
`${process.env.api}/invitado/get?idPremiacion=${this.idPremiacion}`
`${process.env.api}/invitado/get?idPremiacion=${this.idPremiacion}`,
{
headers: {
token: localStorage.getItem('token'),
},
}
)
.then((res) => {
console.log(res.data)
this.isLoading = false
if (res.data.length > 0) {
res.data.forEach((item, index) => {
@@ -216,7 +232,11 @@ export default {
async created() {
this.isLoading = true
await axios
.get(`${process.env.api}/premiacion/get`)
.get(`${process.env.api}/premiacion/get`, {
headers: {
token: localStorage.getItem('token'),
},
})
.then((res) => {
this.isLoading = false
if (res) {
+1 -1
View File
@@ -105,7 +105,7 @@ export default {
localStorage.setItem("fecha", data.fecha)
localStorage.setItem("hora", data.hora)
localStorage.setItem("activa", data.activa)
this.$router.push("/admin/editarPremiacion")
this.$router.push("/Admin/EditarPremiacion")
},
fecha(date) {
const fecha = moment(date)
+1 -1
View File
@@ -29,7 +29,7 @@ export default {
methods: {
cerrarSesion() {
localStorage.clear()
this.$router.push('/loginOperador')
this.$router.push('/LoginOperador')
},
},
created() {
+2 -2
View File
@@ -26,7 +26,7 @@ export default {
env: {
// api: "http://localhost:3000",
// api: "https://890af9d598a4.ngrok.io"
api: "https://venus.acatlan.unam.mx/premiaciones_test",
// api: "https://venus.acatlan.unam.mx/produccion",
// api: "https://venus.acatlan.unam.mx/premiaciones_test",
api: "https://venus.acatlan.unam.mx/premiaciones",
},
}
+2 -18
View File
@@ -25,13 +25,13 @@ export default {
updateIsLoading(booleanValue) {
this.isLoading = booleanValue
},
imprimirError(err = {}, title = '¡Hubo un error!', onConfirm = () => {}) {
imprimirError(err, title = '¡Hubo un error!', onConfirm = () => {}) {
this.$buefy.dialog.alert({
ariaRole: 'alertdialog',
ariaModal: true,
type: 'is-danger',
title,
message: err.message,
message: err,
confirmText: 'Entendido',
hasIcon: true,
iconPack: 'mdi',
@@ -79,22 +79,6 @@ export default {
onCancel: () => onCancel(),
})
},
// getLocalhostInfo() {
// this.admin.idUsuario = Number(localStorage.getItem('idUsuario'))
// this.admin.idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
// this.admin.tipoUsuario = localStorage.getItem('tipoUsuario')
// this.admin.token = {
// headers: {
// token: localStorage.getItem('token'),
// },
// }
// },
},
created() {
// this.getLocalhostInfo()
// if (this.admin.idTipoUsuario === 2) this.$router.push('/responsable')
// if (this.admin.idTipoUsuario === 3) this.$router.push('/alumno')
// if (this.admin.idTipoUsuario === 4) this.$router.push('/casoEspecial')
},
layout: 'login',
}
+10 -6
View File
@@ -4,11 +4,11 @@
<p class="is-size-2">Lector de códigos QR</p>
</div>
<div v-if="!isReading" class="has-text-centered mb-4">
<b-button type="is-info" @click="() => this.isReading = true">
<b-button type="is-info" @click="() => (this.isReading = true)">
Leer QR
</b-button>
</div>
<Scanner :enviar="enviar" v-if="isReading"/>
<Scanner :enviar="enviar" v-if="isReading" />
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
</section>
</template>
@@ -18,7 +18,7 @@ import axios from 'axios'
import Scanner from '../../components/operador/Scanner.vue'
export default {
components: {
Scanner
Scanner,
},
data() {
return {
@@ -32,7 +32,11 @@ export default {
this.isReading = false
const data = { idProfesor, idPremiacion }
axios
.post(`${process.env.api}/profesor/entradaInvitado`, data)
.post(`${process.env.api}/profesor/entradaInvitado`, data, {
headers: {
token: localStorage.getItem('token'),
},
})
.then((res) => {
this.isLoading = false
this.successUpload()
@@ -52,7 +56,7 @@ export default {
confirmButtonColor: '#1e3c70',
})
},
errorMessage(err){
errorMessage(err) {
this.$swal({
title: err,
type: 'error',
@@ -60,7 +64,7 @@ export default {
confirmButtonText: 'Aceptar',
confirmButtonColor: '#1e3c70',
})
}
},
},
layout: 'default',
}
+53 -13
View File
@@ -15,9 +15,14 @@
<div v-if="premiaciones.length !== 0" class="box">
<div>
<p class="is-size-4 block"><b>Nombre:</b> {{ `${Profesor.nombre}` }}</p>
<p v-if="isSent" class="is-size-3 block has-text-centered">¡Gracias por su registro!</p>
<p v-if="alreadyRegistred" class="is-size-3 block has-text-centered">
Este profesor ya registró invitados en otro momento.
</p>
<p v-if="isSent" class="is-size-3 block has-text-centered">
¡Gracias por su registro!
</p>
<div v-if="!isSent" class="is-flex block">
<div v-if="!isSent && !alreadyRegistred" class="is-flex block">
<p class="is-size-4 block mr-4"><b>Premiacion: </b></p>
<b-select
v-model="premiacion"
@@ -34,7 +39,7 @@
</b-select>
</div>
<div v-if="!isSent" class="is-flex">
<div v-if="!isSent && !alreadyRegistred" class="is-flex">
<p class="is-size-4 block mr-4"><b>Cantidad de invitados: </b></p>
<b-select
v-model="numeroInvitados"
@@ -92,6 +97,7 @@
</div>
<div v-if="premiaciones.length !== 0" class="has-text-centered">
<b-button
v-if="!alreadyRegistred"
:disabled="mostrarBoton()"
class="is-success mb-5"
@click="enviar()"
@@ -101,7 +107,9 @@
</div>
<div v-if="premiaciones.length === 0" class="box">
<p class="is-size-4 block"><b>Nombre:</b> {{ `${Profesor.nombre}` }}</p>
<p class="is-size-4 block"><b>No hay premiaciones activas para este profesor.</b> </p>
<p class="is-size-4 block">
<b>No hay premiaciones activas para este profesor.</b>
</p>
</div>
</div>
</template>
@@ -121,11 +129,11 @@ export default {
flag: false,
isDisabled: false,
isSent: false,
alreadyRegistred: null,
}
},
methods: {
enviar() {
console.log(this.premiacion)
this.isLoading = true
this.invitados.forEach((item) => {
item.nombreCompleto = `${item.nombre} ${item.apellido}`
@@ -135,9 +143,12 @@ export default {
idPremiacion: this.premiacion,
invitados: this.invitados,
}
console.log(data)
axios
.post(`${process.env.api}/invitado/infoInvitados`, data)
.post(`${process.env.api}/invitado/infoInvitados`, data, {
headers: {
token: localStorage.getItem('token'),
},
})
.then((res) => {
this.isLoading = false
this.invitados = []
@@ -176,15 +187,41 @@ export default {
}
return false
},
fetchPremiaciones() {
async fetchPremiaciones() {
this.isLoading = true
axios
await axios
.get(
`${process.env.api}/profesor/premiaciones?idProfesor=${this.Profesor.idProfesor}`
`${process.env.api}/profesor/premiaciones?idProfesor=${this.Profesor.idProfesor}`,
{
headers: {
token: localStorage.getItem('token'),
},
}
)
.then((res) => {
console.log(res)
this.isLoading = false
if (res) this.premiaciones = res.data
})
.catch((err) => {
this.isLoading = false
console.log(err)
})
},
async yaRegistrado() {
this.isLoading = true
await axios
.get(
`${process.env.api}/profesor/yaRegistro?idProfesor=${this.Profesor.idProfesor}&idPremiacion=${this.premiaciones[0].idPremiacion}`,
{
headers: {
token: localStorage.getItem('token'),
},
}
)
.then((res) => {
this.isLoading = false
if(res) this.premiaciones = res.data
if (res) this.alreadyRegistred = res.data
})
.catch((err) => {
this.isLoading = false
@@ -192,12 +229,15 @@ export default {
})
},
},
created() {
async created() {
this.Profesor.idProfesor = localStorage.getItem('idProfesor')
this.Profesor.nombre = localStorage.getItem('nombre')
this.Profesor.adscripcion = localStorage.getItem('adscripcion')
this.Profesor.numeroTrabajador = localStorage.getItem('numeroTrabajador')
this.fetchPremiaciones()
await this.fetchPremiaciones()
if (this.premiaciones.length === 1 && this.premiaciones.length > 0) {
await this.yaRegistrado()
}
},
watch: {
numeroInvitados() {
+2 -2
View File
@@ -25,13 +25,13 @@ export default {
updateIsLoading(booleanValue) {
this.isLoading = booleanValue
},
imprimirError(err = {}, title = '¡Hubo un error!', onConfirm = () => {}) {
imprimirError(err, title = '¡Hubo un error!', onConfirm = () => {}) {
this.$buefy.dialog.alert({
ariaRole: 'alertdialog',
ariaModal: true,
type: 'is-danger',
title,
message: err.message,
message: err,
confirmText: 'Entendido',
hasIcon: true,
iconPack: 'mdi',