Ajout calendrier + modif controller / css sur plats pour ressembler a un menu
This commit is contained in:
parent
41798397d3
commit
8626387473
120
public/css/Plats/plats.css
Normal file
120
public/css/Plats/plats.css
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
/* Table styles */
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background-color: #fafafa;
|
||||||
|
font-family: 'Arial', sans-serif;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Table headers */
|
||||||
|
table th, table td {
|
||||||
|
padding: 15px;
|
||||||
|
text-align: left;
|
||||||
|
border: 1px solid #e1e1e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
table th {
|
||||||
|
background-color: #d9534f;
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Even rows */
|
||||||
|
table tr:nth-child(even) {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Row hover effect */
|
||||||
|
table tr:hover {
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Action links */
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #d9534f;
|
||||||
|
font-weight: bold;
|
||||||
|
transition: color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* New client button */
|
||||||
|
a[href*="app_clients_new"] {
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 20px;
|
||||||
|
padding: 12px 25px;
|
||||||
|
background-color: #28a745;
|
||||||
|
color: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 16px;
|
||||||
|
text-align: center;
|
||||||
|
transition: background-color 0.3s ease, transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
a[href*="app_clients_new"]:hover {
|
||||||
|
background-color: #218838;
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Empty table row message */
|
||||||
|
table td[colspan="6"] {
|
||||||
|
text-align: center;
|
||||||
|
font-style: italic;
|
||||||
|
color: #999;
|
||||||
|
padding: 20px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Button container */
|
||||||
|
.btn-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Button styles */
|
||||||
|
.btn {
|
||||||
|
padding: 10px 20px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: white;
|
||||||
|
background-color: #d9534f;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 25px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
transition: background-color 0.3s ease, transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:hover {
|
||||||
|
background-color: #c9302c;
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For card-like container around the table */
|
||||||
|
.card {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
|
||||||
|
border-radius: 15px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Card title */
|
||||||
|
.card h2 {
|
||||||
|
font-size: 24px;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
}
|
36
public/css/Reservations/reservationCalendar.css
Normal file
36
public/css/Reservations/reservationCalendar.css
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
.calendar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar-header {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar-day {
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar-body {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar-column {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 400px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 5px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reservation {
|
||||||
|
margin: 5px 0;
|
||||||
|
padding: 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
@ -33,7 +33,7 @@ final class ReservationsController extends AbstractController
|
|||||||
$entityManager->persist($reservation);
|
$entityManager->persist($reservation);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
return $this->redirectToRoute('app_reservations_index', [], Response::HTTP_SEE_OTHER);
|
return $this->redirectToRoute('calendar_week', [], Response::HTTP_SEE_OTHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('reservations/new.html.twig', [
|
return $this->render('reservations/new.html.twig', [
|
||||||
@ -71,4 +71,29 @@ final class ReservationsController extends AbstractController
|
|||||||
|
|
||||||
return $this->redirectToRoute('app_reservations_index', [], Response::HTTP_SEE_OTHER);
|
return $this->redirectToRoute('app_reservations_index', [], Response::HTTP_SEE_OTHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/calendar/{year}/{week}', name: 'calendar_week', requirements: ['year' => '\d+', 'week' => '\d+'])]
|
||||||
|
public function calendar(ReservationsRepository $reservationsRepository, int $year = null, int $week = null): Response
|
||||||
|
{
|
||||||
|
if ($year === null || $week === null) {
|
||||||
|
$currentDate = new \DateTime();
|
||||||
|
$year = (int) $currentDate->format('Y');
|
||||||
|
$week = (int) $currentDate->format('W');
|
||||||
|
}
|
||||||
|
|
||||||
|
setlocale(LC_TIME, 'fr_FR.UTF-8');
|
||||||
|
$startDate = new \DateTime();
|
||||||
|
$startDate->setISODate($year, $week);
|
||||||
|
$endDate = (clone $startDate)->modify('+6 days');
|
||||||
|
|
||||||
|
$reservations = $reservationsRepository->findByDateRange($startDate, $endDate);
|
||||||
|
|
||||||
|
// dd($reservations);
|
||||||
|
|
||||||
|
return $this->render('reservations/index.html.twig', [
|
||||||
|
'reservations' => $reservations,
|
||||||
|
'startDate' => $startDate, // Passe startDate
|
||||||
|
'endDate' => $endDate, // Passe endDate
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class Reservations
|
|||||||
return $this->tables;
|
return $this->tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setTable(?Tables $tables): static
|
public function setTables(?Tables $tables): static
|
||||||
{
|
{
|
||||||
$this->tables = $tables;
|
$this->tables = $tables;
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ class Tables
|
|||||||
{
|
{
|
||||||
if (!$this->reservations->contains($reservation)) {
|
if (!$this->reservations->contains($reservation)) {
|
||||||
$this->reservations->add($reservation);
|
$this->reservations->add($reservation);
|
||||||
$reservation->setTable($this);
|
$reservation->setTables($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -105,7 +105,7 @@ class Tables
|
|||||||
if ($this->reservations->removeElement($reservation)) {
|
if ($this->reservations->removeElement($reservation)) {
|
||||||
// set the owning side to null (unless already changed)
|
// set the owning side to null (unless already changed)
|
||||||
if ($reservation->getTables() === $this) {
|
if ($reservation->getTables() === $this) {
|
||||||
$reservation->setTable(null);
|
$reservation->setTables(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class ReservationsType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('utilisateurs', EntityType::class, [
|
->add('utilisateurs', EntityType::class, [
|
||||||
'class' => Utilisateurs::class,
|
'class' => Utilisateurs::class,
|
||||||
'choice_label' => 'id',
|
'choice_label' => 'prenom',
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'expanded' => true,
|
'expanded' => true,
|
||||||
])
|
])
|
||||||
|
@ -40,4 +40,19 @@ class ReservationsRepository extends ServiceEntityRepository
|
|||||||
// ->getOneOrNullResult()
|
// ->getOneOrNullResult()
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// src/Repository/ReservationRepository.php
|
||||||
|
|
||||||
|
public function findByDateRange(\DateTime $startDate, \DateTime $endDate): array
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('r')
|
||||||
|
->where('r.DateHeure BETWEEN :start AND :end')
|
||||||
|
->setParameter('start', $startDate->format('Y-m-d 00:00:00'))
|
||||||
|
->setParameter('end', $endDate->format('Y-m-d 23:59:59'))
|
||||||
|
->orderBy('r.DateHeure', 'ASC')
|
||||||
|
->getQuery()
|
||||||
|
->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
<link rel="stylesheet" href="{{ asset('css/Index/index.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/Index/index.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
<link rel="stylesheet" href="{{ asset('css/Compte/index.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/Compte/index.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
<link rel="stylesheet" href="{{ asset('css/GestionUtilisateurs/GestionUtilisateurs.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/GestionUtilisateurs/GestionUtilisateurs.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
|
<link rel="stylesheet" href="{{ asset('css/Reservations/reservationCalendar.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{# {% block javascripts %}#}
|
{# {% block javascripts %}#}
|
||||||
@ -100,7 +101,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/reservations" class="btn-custom icon-container">
|
<a href="/reservations/calendar" class="btn-custom icon-container">
|
||||||
<i class="icon-medium"> {{ ux_icon('fluent-mdl2:reservation-orders') }}</i>
|
<i class="icon-medium"> {{ ux_icon('fluent-mdl2:reservation-orders') }}</i>
|
||||||
<span>Réservation</span>
|
<span>Réservation</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
<link rel="stylesheet" href="{{ asset('css/ControllerVues/list.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/ControllerVues/list.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
<link rel="stylesheet" href="{{ asset('css/ControllerVues/edit.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/ControllerVues/edit.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
<link rel="stylesheet" href="{{ asset('css/Index/index.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/Plats/plats.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
<link rel="stylesheet" href="{{ asset('css/Compte/index.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/Compte/index.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
<link rel="stylesheet" href="{{ asset('css/GestionUtilisateurs/GestionUtilisateurs.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/GestionUtilisateurs/GestionUtilisateurs.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -13,45 +13,50 @@
|
|||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
<link rel="stylesheet" href="{{ asset('css/ControllerVues/list.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/ControllerVues/list.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
<link rel="stylesheet" href="{{ asset('css/Index/index.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/Index/index.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
|
<link rel="stylesheet" href="{{ asset('css/Reservations/reservationCalendar.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
<link rel="stylesheet" href="{{ asset('css/Compte/index.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/Compte/index.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
<link rel="stylesheet" href="{{ asset('css/GestionUtilisateurs/GestionUtilisateurs.css') }}"> <!-- Ajout du fichier CSS -->
|
<link rel="stylesheet" href="{{ asset('css/GestionUtilisateurs/GestionUtilisateurs.css') }}"> <!-- Ajout du fichier CSS -->
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block container_modal %}
|
{% block container_modal %}
|
||||||
<div id="container_modal">
|
<div id="container_modal">
|
||||||
<h1>Reservations index</h1>
|
<h1>Calendrier de la semaine du {{ startDate|date('d/m/Y') }} au {{ endDate|date('d/m/Y') }}</h1>
|
||||||
|
|
||||||
<table class="table">
|
<!-- Navigation vers la semaine précédente -->
|
||||||
<thead>
|
<a href="{{ path('calendar_week', { year: startDate|date('Y'), week: startDate|date('W') - 1 }) }}">Semaine précédente</a>
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
<!-- Navigation vers la semaine suivante -->
|
||||||
<th>DateHeure</th>
|
<a href="{{ path('calendar_week', { year: startDate|date('Y'), week: startDate|date('W') + 1 }) }}">Semaine suivante</a>
|
||||||
<th>Nb_de_prsn</th>
|
|
||||||
<th>actions</th>
|
<div class="calendar">
|
||||||
</tr>
|
<div class="calendar-header">
|
||||||
</thead>
|
{% for i in 0..6 %}
|
||||||
<tbody>
|
<div class="calendar-day">
|
||||||
{% for reservation in reservations %}
|
{{ (startDate|date_modify("+" ~ i ~ " days"))|date('D d/m') }}
|
||||||
<tr>
|
</div>
|
||||||
<td>{{ reservation.id }}</td>
|
{% endfor %}
|
||||||
<td>{{ reservation.DateHeure ? reservation.DateHeure|date('Y-m-d H:i:s') : '' }}</td>
|
</div>
|
||||||
<td>{{ reservation.NbDePrsn }}</td>
|
<div class="calendar-body">
|
||||||
<td>
|
{% for i in 0..6 %}
|
||||||
<form method="post" action="{{ path('app_reservations_delete', {'id': reservation.id}) }}" onsubmit="return confirm('Es-tu sur de vouloir le supprimer ?');">
|
<div class="calendar-column">
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ reservation.id) }}">
|
{% set currentDate = startDate|date_modify("+" ~ i ~ " days") %}
|
||||||
{{ include('reservations/_delete_form.html.twig') }}
|
|
||||||
</form>
|
{% for reservation in reservations %}
|
||||||
<a href="{{ path('app_reservations_edit', {'id': reservation.id}) }}">Modifier</a>
|
{% set res_date = reservation.dateHeure|date('Y-m-d') %}
|
||||||
</td>
|
{% set res_time = reservation.dateHeure|date('H:i') %}
|
||||||
</tr>
|
|
||||||
{% else %}
|
{% if res_date == currentDate|date('Y-m-d') %}
|
||||||
<tr>
|
<div class="reservation" style="background-color: lightblue;">
|
||||||
<td colspan="4">Aucun enregistrement trouvé</td>
|
{{ res_time }} - {{ reservation.nbdeprsn }} pers.
|
||||||
</tr>
|
</div>
|
||||||
{% endfor %}
|
{% endif %}
|
||||||
</tbody>
|
{% endfor %}
|
||||||
</table>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<a href="{{ path('app_reservations_new') }}">Créer une réservation</a>
|
<a href="{{ path('app_reservations_new') }}">Créer une réservation</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -24,6 +24,6 @@
|
|||||||
|
|
||||||
{{ include('reservations/_form.html.twig') }}
|
{{ include('reservations/_form.html.twig') }}
|
||||||
|
|
||||||
<a href="{{ path('app_reservations_index') }}">Retour à la liste</a>
|
<a href="{{ path('calendar_week') }}">Retour à la liste</a>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user