Commit 6ba16bca authored by elisabeth kee's avatar elisabeth kee

Created a register page

parent 07d61a62
......@@ -54,7 +54,7 @@ public class ProfileResource {
}
return Response.noContent().build();
}
/*
/*//I dont think the Query I wrote in profile repository works...
@GET
@Path("{id}")
@Consumes(MediaType.APPLICATION_JSON)
......@@ -66,25 +66,26 @@ public class ProfileResource {
}
return profile;
}
*/
@PATCH
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("{id}/updateAge")
public Response updateAge(@PathParam("id") Long id, String newAge) {
String newAge2 = newAge.replace('"',' ');
int newAge3 = Integer.parseInt(newAge2);
String newAge3 = newAge2.strip();
int newAge4 = Integer.parseInt(newAge3);
Optional<Profile> optional = profileRepository.findById(id);
if (optional.isPresent()) {
Profile pBDD = optional.get();
pBDD.setAge(newAge3);
pBDD.setAge(newAge4);
profileRepository.save(pBDD);
return Response.ok(pBDD).build();
} else {
return Response.status(Response.Status.NOT_FOUND).build();
}
}*/
}
@PATCH
@Consumes(MediaType.APPLICATION_JSON)
......
......@@ -4,6 +4,7 @@ $(document).ready(function() {
let $listeProfilesSelect = $("#listProfilesSelect");
let $listeProfilesSelect2 = $("#listProfilesSelect2");
let $listeMatches = $("#listMatches");
let $listeProfilesRegistered = $("#listProfiles");
//let $listeMyProfile= $("#myProfile");
let $selectLovers = $("#selectLovers");
let $selectLovers2 = $("#selectLovers2");
......@@ -14,6 +15,7 @@ $(document).ready(function() {
$.get("http://localhost:8080/api/profiles",function(resp){
resp.forEach( p => {
appendToListProfiles(p);
appendToListProfileDelete(p);
appendToListProfileSelect(p);
appendToListProfileSelect2(p);
......@@ -59,7 +61,7 @@ $(document).ready(function() {
});
return false;
});
/*
$listeLovers.on("click", "li button", function() {
let elemid = $(this).parent().attr('id');
let idLover = elemid.replace('lover-','');
......@@ -78,7 +80,7 @@ $(document).ready(function() {
}
});
});
/*
$('#seeModifications').click(function(){
let idProfile = $listeProfilesSelect2.val();
$.ajax({
......@@ -113,7 +115,7 @@ $(document).ready(function() {
$('#firstname-modify').val('');
return false;
});
/*
$('#modifyAge').click(function(){
let idProfile = $listeProfilesSelect2.val();
let newAge = $('#age-modify').val();
......@@ -128,7 +130,7 @@ $(document).ready(function() {
$('#age-modify').val('');
return false;
});
*/
$('#modifyGender').click(function(){
let idProfile = $listeProfilesSelect2.val();
let newGender = $('#gender-modify').val();
......@@ -225,23 +227,30 @@ $(document).ready(function() {
/* Ajoute un élément li dans la liste de lovers*/
function appendToListLover(lover) {
$listeLovers.append(`<li id="lover-${lover.id}" class="list-group-item">${lover.partnerGender} - who likes ${lover.partnerPet} <button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal" data-target="#delete" >X</button></li>`);
$listeLovers.append(`<li id="lover-${lover.id}" class="list-group-item">${lover.partnerGender} - who likes ${lover.partnerPet}</li>`);
//$listeLovers.append(`<li id="lover-${lover.id}" class="list-group-item">${lover.partnerGender} - who likes ${lover.partnerPet} <button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal" data-target="#delete" >X</button></li>`);
}
/* Ajoute un élément li dans la liste de lovers*/
/* Ajoute un élément li dans la liste de lovers
function showModifiedProfile(profile) {
liToAppend4 = `<li id="${profile.id}" class="list-group-item">You are: ${profile.firstname} - age: ${profile.age} - gender: ${profile.gender} - who likes: ${profile.pet} - contact info: ${profile.contact}`;
profile.lovers.forEach( lover => liToAppend4+= ` - interested in: ${lover.partnerGender} - who likes ${lover.partnerPet}`);
liToAppend4+= `</li>`;
$listModifiedProfile.append(liToAppend4);
}
}*/
/* Ajoute un élément li dans le select des lovers*/
function appendToSelects(lover) {
$selectLovers.append(`<option value="${lover.id}">${lover.partnerGender} - who likes ${lover.partnerPet}</option>`);
$selectLovers2.append(`<option value="${lover.id}">${lover.partnerGender} - who likes ${lover.partnerPet}</option>`);
}
/* Ajoute un élément li pour selectionner dans la liste de profiles*/
function appendToListProfiles(profile) {
liToAppend2 = `<li id="${profile.id}" class="list-group-item">You are: ${profile.firstname} - age: ${profile.age}`;
profile.lovers.forEach( lover => liToAppend2+= ` - interested in: ${lover.partnerGender} - who likes ${lover.partnerPet}`);
liToAppend2+= `</li>`;
$listeProfilesRegistered.append(liToAppend2);
}
/* Ajoute un élément li pour supprimer dans la liste de profiles*/
function appendToListProfileDelete(profile) {
liToAppend1 = `<li id="profile-${profile.id}" class="list-group-item">You are: ${profile.firstname} - age: ${profile.age}`;
......@@ -257,14 +266,6 @@ $(document).ready(function() {
$listeProfilesSelect.append(liToAppend2);
}
/* Ajoute un élément li pour selectionner dans la liste de profiles
function appendToListProfileSelect2(profile) {
liToAppend3 = `<li id="profile-${profile.id}" class="list-group-item">You are: ${profile.firstname} - age: ${profile.age}`;
profile.lovers.forEach( lover => liToAppend3+= ` - interested in: ${lover.partnerGender} - who likes ${lover.partnerPet} <button id="${lover.id}" class="btn btn-success btn-xs" data-title="Select" data-toggle="modal" data-target="#select" >o</button>`);
liToAppend3+= `</li>`;
$listeProfilesSelect2.append(liToAppend3);
}*/
/*Ajoute un élément option pour selectionner dans la liste de profiles*/
function appendToListProfileSelect2(profile) {
optionToAppend = `<option value="${profile.id}">Name: ${profile.firstname} - age: ${profile.age} - gender: ${profile.gender} - who likes: ${profile.pet} - contact info: ${profile.contact}`;
......@@ -296,6 +297,7 @@ $(document).ready(function() {
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data){
appendToListProfiles(data);
appendToListProfileSelect(data);
appendToListProfileSelect2(data);
appendToListProfileDelete(data);
......
......@@ -14,35 +14,12 @@
<p><h1 style="color:deeppink;">Love is just a click away!</h1></p>
<main>
<p>
<h2 style="color:darkorchid;">Create your profile: </h2>
<h2 style="color:darkorchid;">Ready to register?</h2>
<div class="form-group">
<p><label>Now tell us about yourself :</label></p>
<p>Firstname : <input type="text" name="firstname" id="firstname-input"></p>
<p>Age : <input type="number" name="age" id="age-input"></p>
<p>Gender (Male/Female/Other): <input type="text" name="gender" id="gender-input"></p>
<p>For a pet, what do you prefer (cats/dogs/other) ? : <input type="text" name="pet" id="pet-input"></p>
<p>Contact information for potential lovers : <input type="text" name="contact" id="contact-input"></p>
<p>Choose your love interest from this list (if not available in the list, add it to the list in the next section) : </p>
<select id="selectLovers"></select>
<p id="demo" style="display:none">Thank you for creating your profile. Scroll down and search for love!</p>
<p><input type="button" id="addbtnProfile" name="addbtn" value="Add" class="btn btn-primary btn-sm" onclick="document.getElementById('demo').style.display='block'"></p>
<input type="button" id="addbtnRegister" name="Register" value="Create Your Profile" class="btn btn-primary btn-sm" onclick="window.location.href='registerPage.html'"/>
</div>
</p>
<h2 style="color:mediumseagreen;">Who are you interesting in finding (if not already available in the list) ?</h2>
<div class="form-group">
<p><label>You're interested in someone who :</label></p>
<p>is Male/Female/Other : <input type="text" name="partnerGender" id="partner-input"></p>
<p>Likes cats/dogs/other for a pet : <input type="text" name="partnerPet" id="partner-pet-input"></p>
<input type="button" id="addbtnLover" name="addbtn" value="Add" class="btn btn-primary btn-sm"/>
<ul class="list-group" id="listLovers">
</ul>
</div>
<p>
<h2 style="color:crimson;">Ready to find love?</h2>
<p>Select your profile and search for matches by clicking on your green ";)" button : </p>
<ul class="list-group" id="listProfilesSelect">
......
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Time to tell us about you!</title>
</head>
<body style="background-color:honeydew; margin-left:10cm; margin-right:10cm;">
<p><h1 style="color:deeppink; text-align: center;">Time to tell us about you!</h1></p>
<main>
<p>
<h2 style="color:darkorchid;">Create your profile: </h2>
<div class="form-group">
<p><label>Now tell us about yourself :</label></p>
<p>Firstname : <input type="text" name="firstname" id="firstname-input"></p>
<p>Age : <input type="number" name="age" id="age-input"></p>
<p>Gender (Male/Female/Other): <input type="text" name="gender" id="gender-input"></p>
<p>For a pet, what do you prefer (cats/dogs/other) ? : <input type="text" name="pet" id="pet-input"></p>
<p>Contact information for potential lovers : <input type="text" name="contact" id="contact-input"></p>
<p>Choose your love interest from this list (if not available in the list, add it to the list in the next section) : </p>
<select id="selectLovers"></select>
<p id="demo" style="display:none">Thank you for creating your profile. </p>
<p><input type="button" id="addbtnProfile" name="addbtn" value="Add" class="btn btn-primary btn-sm" onclick="document.getElementById('demo').style.display='block'"></p>
</div>
</p>
<p>Please verify that your profile is in our list of all available profiles (if not, please try refreshing the page and/or re-registering your information):</p><button onclick="myFunction()">Verify</button>
<ul class="list-group" id="listProfiles" style="display:none">
</ul>
<script>
function myFunction(){
var x = document.getElementById("listProfiles");
if(x.style.display === "none"){
x.style.display = "block";
}
else{
x.style.display = "none";
}
}
</script>
</p>
<h2 style="color:mediumseagreen;">Who are you interesting in finding (if not already available in the list) ?</h2>
<div class="form-group">
<p><label>You're interested in someone who :</label></p>
<p>is Male/Female/Other : <input type="text" name="partnerGender" id="partner-input"></p>
<p>Likes cats/dogs/other for a pet : <input type="text" name="partnerPet" id="partner-pet-input"></p>
<input type="button" id="addbtnLover" name="addbtn" value="Add" class="btn btn-primary btn-sm"/>
<ul class="list-group" id="listLovers">
</ul>
</div>
<p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="hello1.js"></script>
</main>
<footer>
</footer>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment