already registred
This commit is contained in:
+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/premiaciones_test",
|
||||
api: "https://venus.acatlan.unam.mx/premiaciones",
|
||||
// api: "https://venus.acatlan.unam.mx/premiaciones",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
<div v-if="premiaciones.length !== 0" class="box">
|
||||
<div>
|
||||
<p class="is-size-4 block"><b>Nombre:</b> {{ `${Profesor.nombre}` }}</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 +35,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 +93,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()"
|
||||
@@ -121,6 +123,7 @@ export default {
|
||||
flag: false,
|
||||
isDisabled: false,
|
||||
isSent: false,
|
||||
alreadyRegistred: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -176,9 +179,9 @@ export default {
|
||||
}
|
||||
return false
|
||||
},
|
||||
fetchPremiaciones() {
|
||||
async fetchPremiaciones() {
|
||||
this.isLoading = true
|
||||
axios
|
||||
await axios
|
||||
.get(
|
||||
`${process.env.api}/profesor/premiaciones?idProfesor=${this.Profesor.idProfesor}`
|
||||
)
|
||||
@@ -191,13 +194,33 @@ export default {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
async yaRegistrado() {
|
||||
this.isLoading = true
|
||||
console.log(this.Profesor.idProfesor, this.premiaciones[0].idPremiacion)
|
||||
await axios
|
||||
.get(
|
||||
`${process.env.api}/profesor/yaRegistro?idProfesor=${this.Profesor.idProfesor}&idPremiacion=${this.premiaciones[0].idPremiacion}`
|
||||
)
|
||||
.then((res) => {
|
||||
this.isLoading = false
|
||||
if(res) this.alreadyRegistred = res.data
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
},
|
||||
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()
|
||||
console.log(this.premiaciones)
|
||||
if(this.premiaciones.length === 1) {
|
||||
await this.yaRegistrado()
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
numeroInvitados() {
|
||||
|
||||
Reference in New Issue
Block a user