2024-03-06 14:20:32 +01:00
|
|
|
<script setup>
|
2024-03-18 11:55:51 +01:00
|
|
|
import {reactive, ref } from 'vue'
|
2024-03-08 23:35:11 +01:00
|
|
|
import i18n from '@/i18n.js'
|
2024-03-17 13:24:24 +01:00
|
|
|
import { login , register , disconnect, isLogged} from '@/rest/Users.js'
|
2024-03-16 12:47:49 +01:00
|
|
|
import { getAllCurriculums } from '@/rest/curriculum.js'
|
2024-03-13 22:30:42 +01:00
|
|
|
import { uploadProfilePicture } from '@/rest/uploads.js'
|
2024-03-16 11:52:31 +01:00
|
|
|
import {toast} from 'vue3-toastify'
|
|
|
|
import 'vue3-toastify/dist/index.css';
|
|
|
|
|
2024-03-13 22:30:42 +01:00
|
|
|
|
2024-03-08 16:37:00 +01:00
|
|
|
const loginPage= ref(true)
|
2024-03-06 14:20:32 +01:00
|
|
|
const page = ref(0)
|
2024-03-18 11:55:51 +01:00
|
|
|
|
|
|
|
const outputs = reactive({
|
|
|
|
surname:null,
|
|
|
|
firstname:null,
|
|
|
|
password:null,
|
|
|
|
birthday:null,
|
|
|
|
email:null,
|
|
|
|
address:null,
|
|
|
|
country:null,
|
|
|
|
curriculum:null,
|
|
|
|
})
|
2024-03-06 14:20:32 +01:00
|
|
|
|
2024-03-08 16:37:00 +01:00
|
|
|
const submitValue= ref(i18n("login.guest.submit"))
|
2024-03-08 11:54:10 +01:00
|
|
|
const passwordConfirm=ref("")
|
2024-03-06 17:41:18 +01:00
|
|
|
|
2024-03-13 22:30:42 +01:00
|
|
|
const imageSaved = ref(false)
|
|
|
|
const ppData = ref(false)
|
2024-03-16 11:52:31 +01:00
|
|
|
|
2024-03-17 13:24:24 +01:00
|
|
|
const curricula= await getAllCurriculums();
|
2024-03-16 12:47:49 +01:00
|
|
|
|
2024-03-16 11:52:31 +01:00
|
|
|
function goBackHome(){
|
2024-03-17 13:24:24 +01:00
|
|
|
setTimeout(() => {
|
|
|
|
window.location.href="#/home";
|
|
|
|
}, "500");
|
|
|
|
}
|
2024-03-18 11:55:51 +01:00
|
|
|
function verifyInputs(pass){
|
|
|
|
if(pass==passwordConfirm.value){
|
2024-03-16 11:52:31 +01:00
|
|
|
page.value++;
|
|
|
|
return toast('Password and Confirm Password are correct.', {
|
|
|
|
|
|
|
|
type: "success",});
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
return toast('Password and Confirm Password are different',{type: "error",});
|
|
|
|
}
|
|
|
|
}
|
2024-03-17 13:24:24 +01:00
|
|
|
if (isLogged()){
|
|
|
|
disconnect();
|
|
|
|
window.location.reload();}
|
2024-03-16 13:56:29 +01:00
|
|
|
|
2024-03-17 23:19:36 +01:00
|
|
|
|
|
|
|
|
2024-03-06 14:20:32 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
2024-03-22 20:14:20 +01:00
|
|
|
<template style="background-color:rgba(255,255,255,0.05); border-radius:50px" >
|
2024-03-03 18:37:55 +01:00
|
|
|
<div class='loginBox'>
|
2024-03-06 17:41:18 +01:00
|
|
|
|
2024-03-08 16:37:00 +01:00
|
|
|
<div v-if="loginPage">
|
2024-03-22 20:14:20 +01:00
|
|
|
<form @submit.prevent="login(outputs.email,outputs.password);goBackHome();"class="form">
|
2024-03-08 16:37:00 +01:00
|
|
|
<h1 style="color:rgb(239,60,168); font-family: sans-serif;">
|
|
|
|
{{i18n("login.guest.signin")}}
|
|
|
|
</h1>
|
|
|
|
<div class="inputBox">
|
|
|
|
<p>ID / {{i18n("login.guest.email")}}</p>
|
2024-03-18 11:55:51 +01:00
|
|
|
<input type="text" v-model="outputs.email">
|
2024-03-06 14:20:32 +01:00
|
|
|
</div>
|
2024-03-08 16:37:00 +01:00
|
|
|
<div class="inputBox">
|
|
|
|
<p>{{i18n("login.guest.password")}}</p>
|
2024-03-18 11:55:51 +01:00
|
|
|
<input type="password" v-model="outputs.password">
|
2024-03-08 16:37:00 +01:00
|
|
|
</div>
|
|
|
|
<div class="register">
|
|
|
|
<a @click="loginPage=!loginPage">{{i18n("login.guest.register")}}</a>
|
|
|
|
</div>
|
|
|
|
<div class="inputBox">
|
|
|
|
<input type="submit" v-model="submitValue">
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
2024-03-06 14:20:32 +01:00
|
|
|
|
2024-03-22 20:14:20 +01:00
|
|
|
<div v-else>
|
2024-03-16 11:52:31 +01:00
|
|
|
<form class="form">
|
2024-03-08 16:37:00 +01:00
|
|
|
<h1 style="color:rgb(239,60,168); font-family: sans-serif; text-align:center;">
|
|
|
|
{{i18n("login.guest.welcome")}}
|
|
|
|
</h1>
|
2024-03-06 14:35:58 +01:00
|
|
|
<div v-if="page === 0">
|
2024-03-06 14:20:32 +01:00
|
|
|
<div class="inputBox">
|
2024-03-06 17:41:18 +01:00
|
|
|
<p>{{i18n("login.guest.surname")}}</p>
|
2024-03-18 11:55:51 +01:00
|
|
|
<input type="text" v-model="outputs.surname">
|
2024-03-06 14:20:32 +01:00
|
|
|
</div>
|
|
|
|
<div class="inputBox">
|
2024-03-06 17:41:18 +01:00
|
|
|
<p>{{i18n("login.guest.firstname")}}</p>
|
2024-03-18 11:55:51 +01:00
|
|
|
<input type="text" v-model="outputs.firstname">
|
2024-03-06 14:20:32 +01:00
|
|
|
</div>
|
2024-03-08 16:37:00 +01:00
|
|
|
<div class="inputBox">
|
2024-03-08 20:22:00 +01:00
|
|
|
<p>{{i18n("login.guest.birthday")}}</p>
|
2024-03-18 11:55:51 +01:00
|
|
|
<input type="date" v-model="outputs.birthday">
|
2024-03-08 16:37:00 +01:00
|
|
|
</div>
|
2024-03-06 14:20:32 +01:00
|
|
|
<div class="inputBox">
|
2024-03-06 17:41:18 +01:00
|
|
|
<p>{{i18n("login.guest.password")}}</p>
|
2024-03-18 11:55:51 +01:00
|
|
|
<input type="password" v-model="outputs.password">
|
2024-03-06 14:20:32 +01:00
|
|
|
</div>
|
2024-03-06 21:00:35 +01:00
|
|
|
<div class="inputBox">
|
2024-03-08 20:22:00 +01:00
|
|
|
<p>{{i18n("login.guest.confirm")}} {{i18n("login.guest.password")}}</p>
|
2024-03-08 11:54:10 +01:00
|
|
|
<input type="password" v-model="passwordConfirm">
|
2024-03-06 21:00:35 +01:00
|
|
|
</div>
|
2024-03-08 11:54:10 +01:00
|
|
|
|
2024-03-06 17:41:18 +01:00
|
|
|
<div class="switchpage">
|
2024-03-18 11:55:51 +01:00
|
|
|
<button @click="verifyInputs(outputs.password);">{{i18n("login.guest.nextpage")}}</button>
|
2024-03-06 17:41:18 +01:00
|
|
|
|
2024-03-06 14:20:32 +01:00
|
|
|
</div>
|
2024-03-08 16:37:00 +01:00
|
|
|
<div @click="(loginPage=!loginPage) && (page=0)" class="register">
|
2024-03-06 17:41:18 +01:00
|
|
|
<a>{{i18n("login.guest.alregister")}}</a>
|
2024-03-06 14:20:32 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<div class="inputBox">
|
2024-03-06 17:41:18 +01:00
|
|
|
<p>{{i18n("login.guest.email")}}</p>
|
2024-03-18 11:55:51 +01:00
|
|
|
<input type="mail" v-model="outputs.email">
|
2024-03-06 14:20:32 +01:00
|
|
|
</div>
|
|
|
|
<div class="inputBox">
|
2024-03-06 17:41:18 +01:00
|
|
|
<p>{{i18n("login.guest.address")}}</p>
|
2024-03-18 11:55:51 +01:00
|
|
|
<input type="text" v-model="outputs.address">
|
2024-03-06 14:20:32 +01:00
|
|
|
</div>
|
|
|
|
<div class="inputBox">
|
2024-03-06 17:41:18 +01:00
|
|
|
<p>{{i18n("login.guest.country")}}</p>
|
2024-03-18 11:55:51 +01:00
|
|
|
<input type="text" v-model="outputs.country">
|
2024-03-06 14:20:32 +01:00
|
|
|
</div>
|
2024-03-13 22:30:42 +01:00
|
|
|
<form novalidate enctype="multipart/form-data" class="inputBox">
|
2024-03-15 15:12:01 +01:00
|
|
|
<p>{{i18n("profile.picture").toUpperCase()}}</p>
|
2024-03-13 22:30:42 +01:00
|
|
|
<input type="file" :disabled="imageSaved" @change="ppData = uploadProfilePicture($event.target.files); imageSaved = true;" accept="image/*">
|
|
|
|
</form>
|
2024-03-08 11:54:10 +01:00
|
|
|
<div class="inputBox">
|
2024-03-17 23:19:36 +01:00
|
|
|
<p>{{i18n("Curriculum").toUpperCase()}}</p>
|
2024-03-18 11:55:51 +01:00
|
|
|
<select v-model="outputs.curriculum">
|
2024-03-17 23:19:36 +01:00
|
|
|
<option v-for="item in curricula">{{item.curriculumId}}</option>
|
2024-03-16 12:47:49 +01:00
|
|
|
|
2024-03-08 11:54:10 +01:00
|
|
|
</select>
|
|
|
|
</div>
|
2024-03-06 17:41:18 +01:00
|
|
|
<div style="align-self:center;" class="inputBox">
|
2024-03-18 18:47:00 +01:00
|
|
|
<button style="margin-top:25px;" @click="register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData);">
|
2024-03-16 11:52:31 +01:00
|
|
|
{{i18n("login.guest.submit")}}
|
|
|
|
</button>
|
2024-03-06 14:20:32 +01:00
|
|
|
</div>
|
2024-03-06 17:41:18 +01:00
|
|
|
<div class="switchpage">
|
|
|
|
<button @click="page--">{{i18n("login.guest.lastpage")}}</button>
|
|
|
|
</div>
|
2024-03-08 16:37:00 +01:00
|
|
|
<div @click="(loginPage=!loginPage) && (page=0)" class="register">
|
2024-03-06 17:41:18 +01:00
|
|
|
<a>{{i18n("login.guest.alregister")}}</a>
|
2024-03-06 14:20:32 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-08 16:37:00 +01:00
|
|
|
</form>
|
|
|
|
</div>
|
2024-03-03 18:37:55 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
2024-03-02 15:52:35 +01:00
|
|
|
|
|
|
|
.loginBox {
|
|
|
|
background-color: rgb(24,24,24);
|
2024-03-22 20:14:20 +01:00
|
|
|
width: 100%;
|
|
|
|
height:100%;
|
2024-03-02 15:52:35 +01:00
|
|
|
justify-content: center;
|
2024-03-22 20:14:20 +01:00
|
|
|
padding: 10%;
|
|
|
|
border-radius: 5%;
|
2024-03-02 15:52:35 +01:00
|
|
|
box-shadow:0 5px 25px #000000;
|
|
|
|
|
|
|
|
}
|
|
|
|
.form {
|
|
|
|
position:relative;
|
|
|
|
width:100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items:center;
|
2024-03-22 20:14:20 +01:00
|
|
|
gap: 3%;
|
2024-03-02 15:52:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-03-06 21:00:35 +01:00
|
|
|
.inputBox input,button,select {
|
2024-03-06 17:41:18 +01:00
|
|
|
|
2024-03-02 15:52:35 +01:00
|
|
|
width:100%;
|
|
|
|
border: none;
|
2024-03-22 20:14:20 +01:00
|
|
|
margin-right: 12.5%;
|
|
|
|
padding-left: 2.5%;
|
|
|
|
padding-top:2.5%;
|
|
|
|
padding-bottom:2.5%;
|
2024-03-02 15:52:35 +01:00
|
|
|
outline:none;
|
2024-03-22 20:14:20 +01:00
|
|
|
border-radius: 10px;
|
2024-03-02 15:52:35 +01:00
|
|
|
font-size:1.35em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.inputBox p{
|
|
|
|
position:relative;
|
|
|
|
z-index: 100;
|
|
|
|
font-family:sans-serif ;
|
|
|
|
color:rgb(239,60,168);
|
|
|
|
transition:0.5;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.register{
|
|
|
|
color:rgb(239,60,168);
|
|
|
|
width: 100%;
|
|
|
|
display:flex;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
2024-03-06 17:41:18 +01:00
|
|
|
.switchpage{
|
|
|
|
width:100px;
|
|
|
|
background:rgb(255, 0 255);
|
|
|
|
border: none;
|
|
|
|
padding-right:0;
|
|
|
|
padding-top:10px;
|
|
|
|
padding-bottom:10px;
|
|
|
|
outline:none;
|
|
|
|
border-radius: 4px;
|
|
|
|
font-size:0.8em;
|
|
|
|
align-self:right;
|
|
|
|
|
|
|
|
}
|
2024-03-06 14:20:32 +01:00
|
|
|
|
2024-03-08 16:37:00 +01:00
|
|
|
input[type=submit],button,select{
|
2024-03-06 14:20:32 +01:00
|
|
|
margin-bottom:20px;
|
2024-03-02 15:52:35 +01:00
|
|
|
background-color: rgb(239,60,168);
|
|
|
|
cursor: pointer;
|
|
|
|
padding:10px;
|
|
|
|
font-size:1.35em;
|
2024-03-06 14:20:32 +01:00
|
|
|
border:none;
|
|
|
|
border-radius:20px;
|
|
|
|
|
2024-03-02 15:52:35 +01:00
|
|
|
}
|
|
|
|
|
2024-03-06 17:41:18 +01:00
|
|
|
button:active ,.switchpage:active{
|
2024-03-02 15:52:35 +01:00
|
|
|
opacity:0.8;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-03-08 16:37:00 +01:00
|
|
|
|
2024-03-03 18:37:55 +01:00
|
|
|
</style>
|