zkt26/z1/webapp/views/profil.ejs
2026-03-31 19:33:15 +02:00

71 lines
2.7 KiB
Plaintext

<!-- views/profil.ejs -->
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Mon Profil</title>
<link rel="stylesheet" href="/styleProfil.css">
</head>
<body>
<%- include("partials/header") %>
<div class="container">
<h1>Mon Profil</h1>
<form id="profilForm" action="/profil/update" method="POST" enctype="multipart/form-data">
<div>
<label>Login :</label>
<input type="text" name="identifiant" value="<%= session.utilisateur.identifiant %>" disabled>
</div>
<div>
<label>Nom :</label>
<input type="text" name="nom" value="<%= session.utilisateur.nom %>" disabled>
</div>
<div>
<label>Prénom :</label>
<input type="text" name="prenom" value="<%= session.utilisateur.prenom %>" disabled>
</div>
<div>
<label>Sexe :</label>
<select name="sexe" disabled>
<option value="Homme" <%= session.utilisateur.sexe === 'Homme' ? 'selected' : '' %>>Homme</option>
<option value="Femme" <%= session.utilisateur.sexe === 'Femme' ? 'selected' : '' %>>Femme</option>
<option value="Autre" <%= session.utilisateur.sexe === 'Autre' ? 'selected' : '' %>>Autre</option>
</select>
</div>
<div>
<label>Situation professionnelle :</label>
<input type="text" name="situation" value="<%= session.utilisateur.situation %>" disabled>
</div>
<div>
<label>Photo de profil :</label><br>
<img src="../photos/<%= session.utilisateur.photo %>" width="100" alt=""><br>
<input type="file" name="photo" disabled>
</div>
<div>
<label>Mot de passe :</label>
<input type="password" name="mot_de_passe" placeholder="nouveau mot de passe si désiré" disabled>
</div>
<button type="button" id="editBtn">Modifier mon profil</button>
<button type="submit" id="saveBtn" style="display: none;">Enregistrer</button>
</form>
</div>
<script>
const editBtn = document.getElementById('editBtn');
const saveBtn = document.getElementById('saveBtn');
const inputs = document.querySelectorAll('#profilForm input, #profilForm select');
editBtn.addEventListener('click', () => {
inputs.forEach(input => {
input.disabled = false;
});
editBtn.style.display = 'none';
saveBtn.style.display = 'inline-block';
});
</script>
<%- include("partials/footer") %>
</body>
</html>