Commit 7aa96294 authored by ornanovitch's avatar ornanovitch 🐃

ajout d'une liste des dernières réservations pour chaque théâtre

parent 16b70e7f
......@@ -6,6 +6,7 @@ use App\Entity\ShowDate;
use App\Entity\Spectacle;
use App\Form\SpectacleType;
use App\Repository\ShowDateRepository;
use App\Repository\BookingRepository;
use App\Repository\SpectacleRepository;
use App\Repository\TheaterRepository;
use Doctrine\ORM\EntityManagerInterface;
......@@ -14,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\File\Exception\FileException;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use App\Service\FileUploader;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
......@@ -29,16 +31,28 @@ class SpectacleController extends AbstractController
* @Route("/", name="spectacle_index", methods={"GET"})
* @param SpectacleRepository $spectacleRepository
* @param TheaterRepository $theaterRepository
* @param ShowDateRepository $repo
* @param SerializerInterface $serializer
* @param BookingRepository $bookingRepository
* @return Response
*/
public function index(SpectacleRepository $spectacleRepository, TheaterRepository $theaterRepository): Response
{
public function index(
SpectacleRepository $spectacleRepository,
TheaterRepository $theaterRepository,
ShowDateRepository $repo,
SerializerInterface $serializer,
BookingRepository $bookingRepository
): Response {
$user = $this->getUser();
$theater = $theaterRepository->findOneBy(['user' => $user]);
$spectacle = $spectacleRepository->findBy(['theater'=>$theater]);
$lastBooking = $bookingRepository->findLastBooking();
return $this->render('spectacle/index.html.twig', [
'spectacles' => $spectacle, 'user' => $user, 'theater' => $theater ]);
'spectacles' => $spectacle,
'user' => $user,
'bookingList' => $lastBooking,
'theater' => $theater ]);
/*
return $this->render('spectacle/index.html.twig', [
'spectacles' => $spectacleRepository->findAll(),
......
......@@ -202,6 +202,7 @@ class UserController extends AbstractController
return $this->redirectToRoute('user_index');
}
/**
* @Route("/chart", name="user_chart", methods={"GET"})
* @IsGranted("ROLE_ADMIN")
......
......@@ -3,7 +3,6 @@
namespace App\DataFixtures;
use App\Entity\ShowDate;
use App\Entity\ShowRate;
use App\Entity\Spectacle;
use App\Entity\Theater;
use App\Entity\User;
......@@ -74,7 +73,6 @@ class UserFixtures extends Fixture
$t1->setZipCode(69007);
$t1->setWebsite('www.elysee.com');
$t1->setPhoneNumber('0478588825');
$t1->setBaseRate(12);
$t1->setLogo('elyseeLogo.jpeg');
$t1->setPicture('ELYSEEphoto.jpg');
$t1->setUser($user1);
......@@ -92,7 +90,6 @@ class UserFixtures extends Fixture
$t2->setZipCode(69600);
$t2->setWebsite('www.renaissance.com');
$t2->setPhoneNumber('0472397491');
$t2->setBaseRate(25);
$t2->setLogo('logo-la-renaissance.png');
$t2->setPicture('Renaissance.jpg');
$t2->setUser($user2);
......@@ -110,7 +107,6 @@ class UserFixtures extends Fixture
$t3->setZipCode(69001);
$t3->setWebsite('www.clochards-celestes.com');
$t3->setPhoneNumber('0478283443');
$t3->setBaseRate(12);
$t3->setLogo('theatre-des-clochards-celestes-logo.png');
$t3->setPicture('clochards-ceilestes.jpg');
$t3->setUser($user3);
......@@ -122,7 +118,6 @@ class UserFixtures extends Fixture
$show1 = new Spectacle();
$show1->setTitle('Les chevaliers');
$show1->setImage('https://lelysee.com/wp-content/uploads/2008/10/spe1img_96.jpg');
$show1->setBaseRate(25.00);
$show1->setDescription('Ils sont quatre. Ce sont des chevaliers, avec des plumes et des armures.
Un barde les accompagne, il sera garant de l’aspect épique du spectacle. Un narrateur est présent, il sera
garant de l’aspect éthique du spectacle. C’est une pièce sur l’héroïsme donc c’est une pièce sur l’impuissance.
......@@ -145,7 +140,6 @@ class UserFixtures extends Fixture
$show2 = new Spectacle();
$show2->setTitle('La première ville de l’histoire de l’humanité');
$show2->setImage('https://lelysee.com/wp-content/uploads/2009/11/spe1img_76.jpg');
$show2->setBaseRate(12.00);
$show2->setDescription('Au centre de ce texte, il y a le personnage de Jennifer, femme opaque,
volatile, somme vide de tous les silences. Autour d’elle, un monde s’agite, et met tout en œuvre pour la sauver.
La sauver de quoi ? La sauver pourquoi ? Aucun de ses preux chevaliers ne le sait exactement, mais considère
......@@ -171,7 +165,6 @@ class UserFixtures extends Fixture
$show3 = new Spectacle();
$show3->setTitle('Éloge de la motivation');
$show3->setImage('https://lelysee.com/wp-content/uploads/2009/11/spe1img_34.jpg');
$show3->setBaseRate(12.00);
$show3->setDescription('Trois spécialistes du travail viennent nous faire l\'apologie de la réussite
par le travail à tout prix. C\'est à travers une conférence où se mêleront entretiens, simulations, discours et
invités surprises.... qu\'ils tenteront de nous convaincre que pour s\'en sortir, il faut travailler et pour
......
......@@ -35,7 +35,7 @@ class BookingRepository extends ServiceEntityRepository
->andWhere('b.isConfirmed = :val')
->setParameter('val', 1)
->orderBy('b.bookingDate', 'DESC')
->setMaxResults(6)
->setMaxResults(10)
->getQuery()
->getResult();
}
......
This diff is collapsed.
......@@ -5,6 +5,7 @@
<title>{% block title %}Balises{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
{% block stylesheets %}
{{ encore_entry_link_tags('index') }}
{% endblock %}
......@@ -24,15 +25,15 @@
</div>
<ul class="list-group">
<li class="list-group-item bg-dark">
<a href="{{ path('theater_show', {'id': theater.id}) }}">
<i class="fas fa-university"></i>
Fiche Théâtre
<a href="{{ path('spectacle_index') }}">
<i class="fas fa-list"></i>
Gestion
</a>
</li>
<li class="list-group-item bg-dark">
<a href="{{ path('spectacle_index') }}">
<i class="fas fa-list"></i>
Spectacles
<a href="{{ path('theater_show', {'id': theater.id}) }}">
<i class="fas fa-university"></i>
Fiche Théâtre
</a>
</li>
<li class="list-group-item bg-dark">
......
......@@ -5,45 +5,80 @@
{% block title %}Liste des Spectacles{% endblock %}
{% block body %}
<div class="card">
<div class="card-header d-flex align-items-center">
<h4 class="text-dark font-weight-bold text-uppercase m-0">Liste des spectacles</h4>
<a href="{{ path('spectacle_new') }}" class="btn btn-light btn-sm ml-2"><i class="fas fa-plus-square mr-2"></i>Ajouter</a>
<div id="accordion" class="mb-3">
<div class="card">
<div class="btn text-decoration-none card-header text-left collapsed" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
<h5 class="mb-0 text-dark font-weight-bold"><i class="fas fa-chevron-down mr-2"></i>dernières offres Balises réservées</h5>
</div>
<div id="collapseOne" class="collapse" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<table class="table">
<thead>
<tr>
<th>Spectacle</th>
<th>Représentation</th>
<th>Réservée le</th>
<th>Réservant·e</th>
</tr>
</thead>
<tbody>
{% for booking in bookingList %}
{% if booking.showDate.showId.theater.name == theater.name %}
<tr>
<td>{{ booking.showDate.showId.title }}</td>
<td>{{ booking.showDate.dateShow |localizeddate('medium','none') }} à {{ booking.showDate.dateShow |date ("H:i") }}</td>
<td>{{ booking.bookingDate | localizeddate('medium','none') }}</td>
<td>{{ booking.firstname }} {{ booking.lastname }}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="card-body">
{% for spectacle in spectacles %}
<div class="row p-2 mb-3 justify-content-center align-items-center">
<div class="col-12 col-xl-4">
<span class="text-uppercase font-weight-bold">
{{ spectacle.title }}
</span>
<span id="dropActions" type="button" class="btn btn-sm border border-dark" data-toggle="dropdown">
options <i class="fas fa-chevron-down"></i>
</span>
<div class="dropdown-menu" aria-labelledby="dropActions">
<a class="dropdown-item btn-sm text-dark"
href="{{ path('spectacle_show', {'id':spectacle.id}) }}"><i class="far fa-eye mr-2"></i> Voir les détails</a>
<a class="dropdown-item btn-sm text-dark"
href="{{ path('spectacle_edit', {'id': spectacle.id}) }}"><i class="fas fa-edit mr-2"></i> Éditer le spectacle</a>
<a class="dropdown-item btn-sm text-dark"
href="{{ path('showDate_by_Spectacle', {'id': spectacle.id}) }}"><i class="fas fa-calendar-alt mr-2"></i> Gérer les représentations</a>
<form method="post" action="{{ path('spectacle_delete', {'id': spectacle.id}) }}
"onsubmit="return confirm('Etes-vous sûre de vouloir supprimer ce spectacle ?');">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ spectacle.id) }}">
<button class="dropdown-item btn-sm rounded-0 bg-danger text-dark"><i class="fas fa-trash mr-2"></i> Supprimer</button>
</form>
</div>
<div class="card">
<div class="card">
<div class="card-header d-flex align-items-center">
<h4 class="text-dark font-weight-bold text-uppercase m-0">Liste des spectacles</h4>
<a href="{{ path('spectacle_new') }}" class="btn btn-light btn-sm ml-2"><i class="fas fa-plus-square mr-2"></i>Ajouter</a>
</div>
<div class="card-body">
{% for spectacle in spectacles %}
<div class="row p-2 mb-3 justify-content-center align-items-center">
<div class="col-12 col-xl-4">
<span class="text-uppercase font-weight-bold">
{{ spectacle.title }}
</span>
<span id="dropActions" type="button" class="btn btn-sm border border-dark" data-toggle="dropdown">
options <i class="fas fa-chevron-down"></i>
</span>
<div class="dropdown-menu" aria-labelledby="dropActions">
<a class="dropdown-item btn-sm text-dark"
href="{{ path('spectacle_show', {'id':spectacle.id}) }}"><i class="far fa-eye mr-2"></i> Voir les détails</a>
<a class="dropdown-item btn-sm text-dark"
href="{{ path('spectacle_edit', {'id': spectacle.id}) }}"><i class="fas fa-edit mr-2"></i> Éditer le spectacle</a>
<a class="dropdown-item btn-sm text-dark"
href="{{ path('showDate_by_Spectacle', {'id': spectacle.id}) }}"><i class="fas fa-calendar-alt mr-2"></i> Gérer les représentations</a>
<form method="post" action="{{ path('spectacle_delete', {'id': spectacle.id}) }}
"onsubmit="return confirm('Etes-vous sûre de vouloir supprimer ce spectacle ?');">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ spectacle.id) }}">
<button class="dropdown-item btn-sm rounded-0 bg-danger text-dark"><i class="fas fa-trash mr-2"></i> Supprimer</button>
</form>
</div>
<p class="text-secondary">{{ spectacle.description | truncate(150) }}</p>
{% if spectacle.isBalise %}
<p class="badge badge-light border border-dark"><i class="fas fa-bullseye"></i> OFFRE BALISES</p>
{% endif %}
</div>
<div class="d-none d-md-block col-xs-3">
<img class="img-thumbnail" src="{{ asset('uploads/images/' ~ spectacle.image) }}" style="width: 200px;">
</div>
<p class="text-secondary">{{ spectacle.description | truncate(150) }}</p>
{% if spectacle.isBalise %}
<p class="badge badge-light border border-dark"><i class="fas fa-bullseye"></i> OFFRE BALISES</p>
{% endif %}
</div>
<div class="d-none d-md-block col-xs-3">
<img class="img-thumbnail" src="{{ asset('uploads/images/' ~ spectacle.image) }}" style="width: 200px;">
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
{% endblock %}
{% endblock %}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment