Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #24

Closed
wants to merge 36 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0e87ac2
feat afficher le backend sur la page
Katd3v May 11, 2023
69c6eb0
creation page ProjetApiDataProvider
Katd3v May 15, 2023
785ed1d
creation des categories avec css
Katd3v May 17, 2023
bac3918
creation des boutons du filtre
Katd3v May 18, 2023
66a9462
creation page evenListener
Katd3v May 19, 2023
18a1958
correction eventlistener
Katd3v May 19, 2023
bee92d6
création de la page HTML et CSS de Login
Katd3v May 21, 2023
ab7f51a
develop page login.js avec fetch et eventListener
Katd3v May 23, 2023
19abdcb
modification requete post
Katd3v May 23, 2023
5252cd6
correction page login.js
Katd3v May 24, 2023
c706ae4
correction des fonctions en static sur toutes les pages
Katd3v May 24, 2023
d1e38d3
correction function postUserLogin
Katd3v May 25, 2023
950766c
ajout éléments hidden dans index.html
Katd3v May 25, 2023
c1f9b98
ajout de la fonction listenToken
Katd3v May 25, 2023
90e1881
ajout de la modale html
Katd3v May 25, 2023
d74597f
correction nom des classes et id
Katd3v May 26, 2023
043c156
ajout de la modale html + CSS
Katd3v May 26, 2023
5616c84
création de la fonction displayModal + style CSS des projets dans la …
Katd3v May 26, 2023
475f416
correction et ajustement CSS de la modale
Katd3v May 28, 2023
0609da2
ajout de la deuxième modale html + CSS
Katd3v May 28, 2023
df83b5e
ajout eventLisner afin d'agir sur la modale : fonction dysplayModal
Katd3v May 29, 2023
c14b62a
ajout eventListener pour recuperer id au click
Katd3v May 30, 2023
f271b01
ajout fonctionalité sur deleteprojects + correction css modale
Katd3v May 31, 2023
5a3a15d
ajout fonction OpenModal, closeModal, removeProject et suppression fo…
Katd3v Jun 4, 2023
1355659
ajout fonction previewProject + saveProject
Katd3v Jun 5, 2023
a8e2907
ajout ModalBuiler.selectCategoryID + modification HTML formulaire + m…
Katd3v Jun 6, 2023
f1eb4b6
ajout saveProject + POST project
Katd3v Jun 6, 2023
73d0700
modification fonction previewProject + fonction saveProject
Katd3v Jun 8, 2023
d588653
ajout message d'erreur log + disabled
Katd3v Jun 9, 2023
4955e74
formData + methode POST
Katd3v Jun 11, 2023
72304b1
correction saveProject, et addNewProjects + ajout activeSubmit + corr…
Katd3v Jun 14, 2023
4508a43
ajout CSS errorMessage + errorLoging
Katd3v Jun 15, 2023
3ca0938
correction button submit + message erreur
Katd3v Jun 16, 2023
03184cb
correction style image modale
Katd3v Jun 16, 2023
19bb68e
correction css modale + correction message d'erreur loging
Katd3v Jun 18, 2023
bc547d5
amelioration methode saveProject
Katd3v Jun 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ajout message d'erreur log + disabled
Katd3v committed Jun 9, 2023
commit d5886530a1f693d5834d9f3c154f17d7ee6f86ca
10 changes: 9 additions & 1 deletion FrontEnd/assets/style.css
Original file line number Diff line number Diff line change
@@ -299,7 +299,7 @@ body {
}
#submitPicture {
position: absolute;
background-color: #A7A7A7;
background-color: #1D6154;
border: none;
border-radius: 60px;
left: 50%;
@@ -310,6 +310,10 @@ body {
width: 240px;
}

#submitPicture:disabled {
background-color: #A7A7A7;
}

/************************* MODE EDITION **********************/
.hidden {
display: none;
@@ -555,6 +559,10 @@ footer nav ul {
border: none;
box-shadow: 0px 4px 14px rgba(0, 0, 0, 0.09);
}
.errorLoging{
color: red;
font-weight: 700;
}
.button {
background: #1D6154;
border: none;
4 changes: 2 additions & 2 deletions FrontEnd/index.html
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ <h3>Galerie photo</h3>
<h3>Ajout photo</h3>
<div class="picture-modal">
<div>
<form action="" class="formSubmit">
<form action="" class="formSubmit" method="post" enctype="multipart/form-data">
<div runat="server" class="picture-modal-contain">
<img class="iconePreview" src="./assets/icons/icons-image.png" alt="icône d'une image">
<input class="hidden" type="file" accept="image/png, image/jpeg" id="imageInput">
@@ -47,7 +47,7 @@ <h3>Ajout photo</h3>
</select>
</div>
<hr>
<input type="submit" id="submitPicture" value="Valider"></input>
<input type="submit" id="submitPicture" value="Valider" disabled></input>
</form>
</div>
</div>
3 changes: 2 additions & 1 deletion FrontEnd/src/ApiDataProvider.js
Original file line number Diff line number Diff line change
@@ -55,7 +55,8 @@ export default class ApiDataProvider {
method: "POST",
headers: {
accept: "application/json",
"Content-Type": "multipart/form-data",
"Content-Type": "multipart/form-data; boundary=MyBoundary",

Authorization: `Bearer ${window.localStorage.getItem("token")}`,
},
body: JSON.stringify(data),
26 changes: 16 additions & 10 deletions FrontEnd/src/EventListener.js
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ export default class EvenListener {
false
);
reader.readAsDataURL(file);
// console.log(imagePreview); // src est en database64
console.log(imagePreview); // src est en database64
}
});
}
@@ -165,8 +165,7 @@ export default class EvenListener {
input.addEventListener("input", () => {
const allInputsFlled = allInputs.every((input) => input.value !== "");
if (allInputsFlled) {
document.getElementById("submitPicture").style.backgroundColor =
"#1D6154";
document.querySelector("#submitPicture").disabled = false;
document.getElementById("submitPicture").style.cursor = "pointer";
}
});
@@ -177,21 +176,28 @@ export default class EvenListener {
pictureForm.addEventListener("submit", (event) => {
event.preventDefault();

const formData = new FormData(pictureForm);
const formData = new FormData();
// formData.append("image", inputImage.files[0]);
formData.append("image", imagePreview.src);
formData.append("title", inputTitle.value);
formData.append("category", inputCategory.value);

for (const pair of formData.entries()) {
data[pair[0]] = pair[1];
}
console.log(data);

// const image = formData.get("imagePreview.src");
// const title = formData.get("titlePicture");
// const category = formData.get("categories");
// console.log({ image, title, category });

console.log(data);
ApiDataProvider.addNewProjects(data);

// remettre à blanc la modale "ajout photo"
pictureForm.reset();
imagePreview.src = "#";
imagePreview.alt = "";
document.getElementById("buttonAddProject").classList.remove("hidden");
document.querySelector(".iconePreview").classList.remove("hidden");
document.querySelector(".textPreview").classList.remove("hidden");
document.getElementById("imagePreview").classList.add("hidden");

// document.querySelector(".modal-contain-projects").innerHTML = "";

// ApiDataProvider.getProjects().then((projects) => {
11 changes: 10 additions & 1 deletion FrontEnd/src/login.js
Original file line number Diff line number Diff line change
@@ -3,6 +3,11 @@ function userLogin() {
document.querySelector("form").addEventListener("submit", (event) => {
// console.log("test");
event.preventDefault();
const errorExist = document.querySelector(".errorLoging");
if (errorExist) {
errorExist.innerHTML = "";
}

const user = {
email: event.target.querySelector("#email").value,
password: event.target.querySelector("#mdp").value,
@@ -31,7 +36,11 @@ async function postUserLogin(user) {
window.localStorage.setItem("token", login.token);
window.location.href = "index.html";
} else {
alert("Votre identifiant ou votre mot de passe est incorrect");
const errorLoging = document.createElement("p");
errorLoging.className = "errorLoging";
errorLoging.innerHTML =
"Votre identifiant ou votre mot de passe est incorrect";
document.querySelector(".password").appendChild(errorLoging);
}
});
}