This commit is contained in:
2024-10-11 17:15:04 +02:00
parent a390944917
commit fdc4037786
11 changed files with 163 additions and 138 deletions

28
crud/vue/add.twig Normal file
View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style/style.css"/>
<title>Ajouter utilisateur</title>
</head>
<body>
<form method="post">
<label for="login">Utilisateur</label>
<input type="text" name="login" id="login">
<label for="password">Mot de passe</label>
<input type="text" name="password" id="password" />
<label for="firstname">Prénom</label>
<input type="text" name="firstname" id="firstname">
<label for="lastname">Nom de famille</label>
<input type="text" name="lastname" id="lastname" />
<label for="role">Role</label>
<input type="number" name="role" id="role">
<label for="description">Description</label>
<textarea name="description"></textarea>
<button>Enregistrer</button>
</form>
</body>
</html>

25
crud/vue/details.twig Normal file
View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Détails de l'utilisateur</title>
<link rel="stylesheet" href="style/style.css" />
</head>
<body>
<div>
<h1>Détails pour lutilisateur {{ user.login }}</h1>
<p>ID : {{ user.id }}</p>
<p>Login : {{ user.login }}</p>
<p>FirstName : {{ user.firstname }}</p>
<p>LastName : {{ user.lastname }}</p>
<p>Role : {{ user.role }}</p>
<p>
<button onclick="window.location.href='edit.php?id={{ user.id }}'">Modifier</button>
<button onclick="window.location.href='delete.php?id={{ user.id }}'">Supprimer</button>
</p>
</div>
</body>
</html>

36
crud/vue/edit.twig Normal file
View File

@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Modification de l'utilisateur</title>
<link rel="stylesheet"
href="style/style.css">
</head>
<body>
<div>
<h1>Modifier un utilisateur</h1>
<form method="post">
<p>
<label for="login">Login</label>
<input type="text" name="login" id="login" value="{{ user.login }}">
</p>
<p>
<label for="description">Description</label>
<input type="text" name="description" id="description" value="{{ user.description }}">
</p>
<p>
<label for="role">Role</label>
<input type="number" name="role" id="role" value="{{ user.role }}">
</p>
<p>
<button>Enregistrer</button>
</p>
<input type="hidden" name="id" value="{{ user.id }}">
</form>
</div>
</body>
</html>

46
crud/vue/index.twig Normal file
View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style/style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Liste des utilisateurs</title>
</head>
<body>
<div>
<h1>Liste des utilisateurs</h1>
<table>
<thead>
<th>ID</th>
<th>Login</th>
<th>Nom</th>
<th>Prenom</th>
<th>Rôle</th>
<th>Actions</th>
</thead>
<tbody>
{# afficher les utilisateurs #}
{% for user in users %}
<tr>
<td>{{ user.id }}</td>
<td>{{ user.login }}</td>
<td>{{ user.lastname }}</td>
<td>{{ user.firstname }}</td>
<td>{{ user.role }}</td>
<td>
<button onclick="window.location.href='details.php?id={{ user.id }}'">Voir</button>
<button onclick="window.location.href='edit.php?id= {{ user.id }}'">Modifier</button>
<button onclick="window.location.href='delete.php?id= {{ user.id }}'">Supprimer</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<button onclick="window.location.href='add.php'">Ajouter</button>
</div>
</body>
</html>