This commit is contained in:
bourgoino 2024-12-05 17:20:42 +01:00
parent 3cf9ab3bed
commit f7c08a5c98
4 changed files with 151 additions and 66 deletions

View File

@ -1,13 +1,40 @@
{% extends 'base.html.twig' %}
{% block title %}Edit FAQ{% endblock %}
{% block title %}Modifier la FAQ{% endblock %}
{% block body %}
<h1>Edit FAQ</h1>
<div class="container mx-auto p-6">
<h1 class="text-3xl font-bold mb-4">Modifier la FAQ</h1>
{{ include('faq/_form.html.twig', {'button_label': 'Update'}) }}
<div class="bg-white shadow-md rounded-lg p-6">
{{ form_start(form) }}
<a href="{{ path('app_faq_index') }}">back to list</a>
<div class="mb-4">
<label for="faq_question" class="block text-lg font-medium text-gray-700 mb-2">Question</label>
<div class="mt-1">
{{ form_widget(form.question, {'attr': {'class': 'block w-full p-2 border rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-teal-500'}}) }}
</div>
</div>
{{ include('faq/_delete_form.html.twig') }}
<div class="mb-4">
<label for="faq_answer" class="block text-lg font-medium text-gray-700 mb-2">Réponse</label>
<div class="mt-1">
{{ form_widget(form.answer, {'attr': {'class': 'block w-full p-2 border rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-teal-500'}}) }}
</div>
</div>
<div class="mt-6">
<button type="submit" class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full w-full">
Mettre à jour la FAQ
</button>
</div>
{{ form_end(form) }}
</div>
<div class="mt-6">
<a href="{{ path('app_faq_index') }}" class="text-teal-500 hover:text-teal-700">
<i class="fas fa-arrow-left"></i> Retour à la liste des FAQs
</a>
</div>
</div>
{% endblock %}

View File

@ -1,39 +1,54 @@
{% extends 'base.html.twig' %}
{% block title %}FAQ index{% endblock %}
{% block title %}Liste des FAQs{% endblock %}
{% block body %}
<h1>FAQ index</h1>
<div class="container mx-auto p-6">
<h1 class="text-3xl font-bold mb-4">Liste des FAQs</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Question</th>
<th>Answer</th>
<th>UpdateDate</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for faq in faqs %}
<tr>
<td>{{ faq.id }}</td>
<td>{{ faq.question }}</td>
<td>{{ faq.answer }}</td>
<td>{{ faq.updateDate ? faq.updateDate|date('Y-m-d') : '' }}</td>
<td>
<a href="{{ path('app_faq_show', {'id': faq.id}) }}">show</a>
<a href="{{ path('app_faq_edit', {'id': faq.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="5">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="overflow-x-auto bg-white shadow-lg rounded-lg">
<table class="min-w-full table-auto">
<thead>
<tr class="bg-gray-800 text-white">
<th class="px-4 py-2 text-left">ID</th>
<th class="px-4 py-2 text-left">Question</th>
<th class="px-4 py-2 text-left">Réponse</th>
<th class="px-4 py-2 text-left">Actions</th>
</tr>
</thead>
<tbody>
{% for faq in faqs %}
<tr class="border-b">
<td class="px-4 py-2">{{ faq.id }}</td>
<td class="px-4 py-2">{{ faq.question }}</td>
<td class="px-4 py-2">{{ faq.answer }}</td>
<td class="px-4 py-2">
<a href="{{ path('app_faq_show', {'id': faq.id}) }}" class="text-teal-500 hover:text-teal-700 mr-3">
<i class="fas fa-eye"></i> Voir
</a>
<a href="{{ path('app_faq_new') }}">Create new</a>
<a href="{{ path('app_faq_edit', {'id': faq.id}) }}" class="text-yellow-500 hover:text-yellow-700 mr-3">
<i class="fas fa-edit"></i> Modifier
</a>
<form method="post" action="{{ path('app_faq_delete', {'id': faq.id}) }}" style="display:inline;">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ faq.id) }}">
<button type="submit" class="text-red-500 hover:text-red-700">
<i class="fas fa-trash-alt"></i> Supprimer
</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="mt-4">
<a href="{{ path('app_faq_new') }}" class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full">
<i class="fas fa-plus-circle"></i> Ajouter une FAQ
</a>
</div>
</div>
{% endblock %}

View File

@ -1,11 +1,40 @@
{% extends 'base.html.twig' %}
{% block title %}New FAQ{% endblock %}
{% block title %}Créer une FAQ{% endblock %}
{% block body %}
<h1>Create new FAQ</h1>
<div class="container mx-auto p-6">
<h1 class="text-3xl font-bold mb-4">Créer une nouvelle FAQ</h1>
{{ include('faq/_form.html.twig') }}
<div class="bg-white shadow-md rounded-lg p-6">
{{ form_start(form) }}
<a href="{{ path('app_faq_index') }}">back to list</a>
<div class="mb-4">
<label for="faq_question" class="block text-lg font-medium text-gray-700 mb-2">Question</label>
<div class="mt-1">
{{ form_widget(form.question, {'attr': {'class': 'block w-full p-2 border rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-teal-500'}}) }}
</div>
</div>
<div class="mb-4">
<label for="faq_answer" class="block text-lg font-medium text-gray-700 mb-2">Réponse</label>
<div class="mt-1">
{{ form_widget(form.answer, {'attr': {'class': 'block w-full p-2 border rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-teal-500'}}) }}
</div>
</div>
<div class="mt-6">
<button type="submit" class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full w-full">
Créer la FAQ
</button>
</div>
{{ form_end(form) }}
</div>
<div class="mt-6">
<a href="{{ path('app_faq_index') }}" class="text-teal-500 hover:text-teal-700">
<i class="fas fa-arrow-left"></i> Retour à la liste des FAQs
</a>
</div>
</div>
{% endblock %}

View File

@ -1,34 +1,48 @@
{% extends 'base.html.twig' %}
{% block title %}FAQ{% endblock %}
{% block title %}Détail de la FAQ{% endblock %}
{% block body %}
<h1>FAQ</h1>
<div class="container mx-auto p-6">
<h1 class="text-3xl font-bold mb-4">Détail de la FAQ</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ faq.id }}</td>
</tr>
<tr>
<th>Question</th>
<td>{{ faq.question }}</td>
</tr>
<tr>
<th>Answer</th>
<td>{{ faq.answer }}</td>
</tr>
<tr>
<th>UpdateDate</th>
<td>{{ faq.updateDate ? faq.updateDate|date('Y-m-d') : '' }}</td>
</tr>
</tbody>
</table>
<div class="bg-white shadow-md rounded-lg p-6">
<table class="min-w-full">
<tbody>
<tr class="border-b">
<th class="px-6 py-4 text-lg font-medium text-gray-700">ID</th>
<td class="px-6 py-4 text-lg text-gray-900">{{ faq.id }}</td>
</tr>
<tr class="border-b">
<th class="px-6 py-4 text-lg font-medium text-gray-700">Question</th>
<td class="px-6 py-4 text-lg text-gray-900">{{ faq.question }}</td>
</tr>
<tr class="border-b">
<th class="px-6 py-4 text-lg font-medium text-gray-700">Réponse</th>
<td class="px-6 py-4 text-lg text-gray-900">{{ faq.answer }}</td>
</tr>
</tbody>
</table>
</div>
<a href="{{ path('app_faq_index') }}">back to list</a>
<div class="mt-6 flex justify-between">
<a href="{{ path('app_faq_index') }}" class="text-teal-500 hover:text-teal-700">
<i class="fas fa-arrow-left"></i> Retour à la liste des FAQs
</a>
<a href="{{ path('app_faq_edit', {'id': faq.id}) }}">edit</a>
<a href="{{ path('app_faq_edit', {'id': faq.id}) }}" class="text-yellow-500 hover:text-yellow-700">
<i class="fas fa-edit"></i> Modifier cette FAQ
</a>
</div>
{{ include('faq/_delete_form.html.twig') }}
<div class="mt-6">
<form method="post" action="{{ path('app_faq_delete', {'id': faq.id}) }}" style="display:inline;">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ faq.id) }}">
<button type="submit" class="text-red-500 hover:text-red-700">
<i class="fas fa-trash-alt"></i> Supprimer cette question
</button>
</form>
</div>
</div>
{% endblock %}