connexion base et création premier crud

This commit is contained in:
Logshiro
2025-10-16 13:37:35 +02:00
parent 521d0a2d61
commit ea9a187326
38 changed files with 953 additions and 2 deletions

View File

@@ -0,0 +1,33 @@
{% extends 'base.html.twig' %}
{% block title %}Hello CoucouController!{% endblock %}
{% block body %}
<!-- Ajout de Bootstrap via CDN -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet">
<div class="container my-5">
<div class="card shadow-sm">
<div class="card-body">
<h1 class="card-title text-primary mb-4">{{ controller_name }} </h1>
<h3 class="text-secondary">{{ msg }}</h3>
<hr>
<h4>Tableau reçu :</h4>
<ol class="list-group list-group-numbered mb-4">
{% for ligne in tableau %}
<li class="list-group-item">{{ ligne }}</li>
{% endfor %}
</ol>
<!-- Bouton vers la page Sport -->
<a href="{{ path('app_sport') }}" class="btn btn-success btn-lg">Aller sur Sport</a>
</div>
</div>
</div>
<!-- Optionnel : JS Bootstrap pour composants interactifs -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"></script>
{% endblock %}

View File

@@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_droit_delete', {'idDroit': droit.idDroit}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ droit.idDroit) }}">
<button class="btn">Delete</button>
</form>

View File

@@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}
{% block title %}Edit Droit{% endblock %}
{% block body %}
<h1>Edit Droit</h1>
{{ include('droit/_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('app_droit_index') }}">back to list</a>
{{ include('droit/_delete_form.html.twig') }}
{% endblock %}

View File

@@ -0,0 +1,35 @@
{% extends 'base.html.twig' %}
{% block title %}Droit index{% endblock %}
{% block body %}
<h1>Droit index</h1>
<table class="table">
<thead>
<tr>
<th>IdDroit</th>
<th>LibDroit</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for droit in droits %}
<tr>
<td>{{ droit.idDroit }}</td>
<td>{{ droit.libDroit }}</td>
<td>
<a href="{{ path('app_droit_show', {'idDroit': droit.idDroit}) }}">show</a>
<a href="{{ path('app_droit_edit', {'idDroit': droit.idDroit}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="3">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_droit_new') }}">Create new</a>
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block title %}New Droit{% endblock %}
{% block body %}
<h1>Create new Droit</h1>
{{ include('droit/_form.html.twig') }}
<a href="{{ path('app_droit_index') }}">back to list</a>
{% endblock %}

View File

@@ -0,0 +1,26 @@
{% extends 'base.html.twig' %}
{% block title %}Droit{% endblock %}
{% block body %}
<h1>Droit</h1>
<table class="table">
<tbody>
<tr>
<th>IdDroit</th>
<td>{{ droit.idDroit }}</td>
</tr>
<tr>
<th>LibDroit</th>
<td>{{ droit.libDroit }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_droit_index') }}">back to list</a>
<a href="{{ path('app_droit_edit', {'idDroit': droit.idDroit}) }}">edit</a>
{{ include('droit/_delete_form.html.twig') }}
{% endblock %}

View 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>

View File

@@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View 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 %}

View 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 %}

View 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>

View 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 %}

View 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 %}

View File

@@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_o_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>

View File

@@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}
{% block title %}Edit Membre{% endblock %}
{% block body %}
<h1>Edit Membre</h1>
{{ include('o/_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('app_o_index') }}">back to list</a>
{{ include('o/_delete_form.html.twig') }}
{% endblock %}

View File

@@ -0,0 +1,37 @@
{% extends 'base.html.twig' %}
{% block title %}Membre index{% endblock %}
{% block body %}
<h1>Membre index</h1>
<table class="table">
<thead>
<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_o_show', {'id': membre.id}) }}">show</a>
<a href="{{ path('app_o_edit', {'id': membre.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="4">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_o_new') }}">Create new</a>
{% endblock %}

11
templates/o/new.html.twig Normal file
View File

@@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block title %}New Membre{% endblock %}
{% block body %}
<h1>Create new Membre</h1>
{{ include('o/_form.html.twig') }}
<a href="{{ path('app_o_index') }}">back to list</a>
{% endblock %}

View 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_o_index') }}">back to list</a>
<a href="{{ path('app_o_edit', {'id': membre.id}) }}">edit</a>
{{ include('o/_delete_form.html.twig') }}
{% endblock %}

View File

@@ -0,0 +1,14 @@
{% extends 'base.html.twig' %}
{% block title %}Hello PecheController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
</div>
{% endblock %}

View File

@@ -0,0 +1,33 @@
{% extends 'base.html.twig' %}
{% block title %}Go Sport!{% endblock %}
{% block body %}
<!-- Ajout de Bootstrap via CDN -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet">
<div class="container my-5">
<div class="card shadow-sm">
<div class="card-body">
<h1 class="card-title text-primary mb-4">{{ controller_name }}</h1>
<h3 class="text-secondary">{{ msg }}</h3>
<hr>
<h4>Tableau Sport :</h4>
<ol class="list-group list-group-numbered mb-4">
{% for ligne in tableau %}
<li class="list-group-item">{{ ligne }}</li>
{% endfor %}
</ol>
<!-- Bouton pour revenir à Coucou -->
<a href="{{ path('app_coucou') }}" class="btn btn-primary btn-lg">Retourner sur Coucou</a>
</div>
</div>
</div>
<!-- Optionnel : JS Bootstrap pour composants interactifs -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"></script>
{% endblock %}