connexion base et création premier crud
This commit is contained in:
4
templates/membre/_delete_form.html.twig
Normal file
4
templates/membre/_delete_form.html.twig
Normal file
@@ -0,0 +1,4 @@
|
||||
<form method="post" action="{{ path('app_membre_delete', {'id': membre.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ membre.id) }}">
|
||||
<button class="btn">Delete</button>
|
||||
</form>
|
||||
4
templates/membre/_form.html.twig
Normal file
4
templates/membre/_form.html.twig
Normal file
@@ -0,0 +1,4 @@
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn">{{ button_label|default('Save') }}</button>
|
||||
{{ form_end(form) }}
|
||||
13
templates/membre/edit.html.twig
Normal file
13
templates/membre/edit.html.twig
Normal file
@@ -0,0 +1,13 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit Membre{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Edit Membre</h1>
|
||||
|
||||
{{ include('membre/_form.html.twig', {'button_label': 'Update'}) }}
|
||||
|
||||
<a href="{{ path('app_membre_index') }}">back to list</a>
|
||||
|
||||
{{ include('membre/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
||||
45
templates/membre/index.html.twig
Normal file
45
templates/membre/index.html.twig
Normal file
@@ -0,0 +1,45 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Membre index{% endblock %}
|
||||
|
||||
{% block stylesheets %}
|
||||
{{ parent() }}
|
||||
{# Ajouter Bootstrap depuis le CDN #}
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container mt-4">
|
||||
<h1 class="mb-4">Membre index</h1>
|
||||
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Nom</th>
|
||||
<th>Password</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for membre in membres %}
|
||||
<tr>
|
||||
<td>{{ membre.id }}</td>
|
||||
<td>{{ membre.nom }}</td>
|
||||
<td>{{ membre.password }}</td>
|
||||
<td>
|
||||
<a href="{{ path('app_membre_show', {'id': membre.id}) }}" class="btn btn-sm btn-primary">Show</a>
|
||||
<a href="{{ path('app_membre_edit', {'id': membre.id}) }}" class="btn btn-sm btn-warning">Edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">No records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_membre_new') }}" class="btn btn-success">Create new</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
22
templates/membre/membre.html.twig
Normal file
22
templates/membre/membre.html.twig
Normal file
@@ -0,0 +1,22 @@
|
||||
{# templates/membre/index.html.twig #}
|
||||
|
||||
<h1>Liste des Membres</h1>
|
||||
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nom</th>
|
||||
<th>Droit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for membre in membres %}
|
||||
<tr>
|
||||
<td>{{ membre.id }}</td>
|
||||
<td>{{ membre.nom }}</td>
|
||||
<td>{{ membre.droit ? membre.droit.nom : 'Aucun' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
11
templates/membre/new.html.twig
Normal file
11
templates/membre/new.html.twig
Normal file
@@ -0,0 +1,11 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New Membre{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Create new Membre</h1>
|
||||
|
||||
{{ include('membre/_form.html.twig') }}
|
||||
|
||||
<a href="{{ path('app_membre_index') }}">back to list</a>
|
||||
{% endblock %}
|
||||
30
templates/membre/show.html.twig
Normal file
30
templates/membre/show.html.twig
Normal file
@@ -0,0 +1,30 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Membre{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Membre</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ membre.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<td>{{ membre.nom }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Password</th>
|
||||
<td>{{ membre.password }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_membre_index') }}">back to list</a>
|
||||
|
||||
<a href="{{ path('app_membre_edit', {'id': membre.id}) }}">edit</a>
|
||||
|
||||
{{ include('membre/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user