first commit
This commit is contained in:
0
src/Controller/.gitignore
vendored
Executable file
0
src/Controller/.gitignore
vendored
Executable file
235
src/Controller/BackendAdmin/AnnonceController.php
Executable file
235
src/Controller/BackendAdmin/AnnonceController.php
Executable file
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Repository\AnnonceRepository;
|
||||
|
||||
use App\Entity\Annonce;
|
||||
|
||||
use App\Form\BackendAdmin\AnnonceType;
|
||||
|
||||
use App\Service\UploaderService;
|
||||
|
||||
|
||||
#[Route('/backend/admin/annonce')]
|
||||
class AnnonceController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var AnnonceRepository $annonceRepository
|
||||
*/
|
||||
private $annonceRepository;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @param AnnonceRepository $annonceRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
AnnonceRepository $annonceRepository,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->annonceRepository = $annonceRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
|
||||
#[Route('/index', name: 'backend_admin_annonce_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('backend_admin/annonce/index.html.twig', ['annonces'=> $this->annonceRepository->findBy([], ["id"=>'DESC'])]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/add', name: 'backend_admin_annonce_add')]
|
||||
public function add(Request $request): Response
|
||||
{
|
||||
$annonce = new Annonce();
|
||||
|
||||
$form = $this->createForm(AnnonceType::class, $annonce);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$annonce->setCreateBy($this->getUser());
|
||||
$this->em->persist($annonce);
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('info', ['title'=>'Info',
|
||||
'message'=>"L'annonce a été bien créer. pour qu'il soit complet il faut ajouter <b>au moins l'image d'accueil, recherche et détail</b>"]);
|
||||
|
||||
return $this->redirectToRoute('backend_admin_annonce_uploder', ['id' => $annonce->getId()]);
|
||||
|
||||
}
|
||||
|
||||
return $this->render('backend_admin/annonce/add_update.htm.twig',['form'=>$form]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[Route('/update/{id}', name: 'backend_admin_annonce_update')]
|
||||
public function update(Request $request, Annonce $annonce): Response
|
||||
{
|
||||
$form = $this->createForm(AnnonceType::class, $annonce);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$annonce->setDateUpdate(new \DateTime());
|
||||
$this->em->persist($annonce);
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('success', ['title'=>'Success', 'message'=>"L'annonce a été bien modifier."]);
|
||||
|
||||
}
|
||||
|
||||
return $this->render('backend_admin/annonce/add_update.htm.twig',['form'=>$form]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/delete/{id}', name: 'backend_admin_annonce_delete')]
|
||||
public function delete(Annonce $annonce, Request $request)
|
||||
{
|
||||
$delete = (boolean)$request->get('delete');
|
||||
|
||||
$annonce->setActive($delete);
|
||||
$this->em->persist($annonce);
|
||||
$this->em->flush();
|
||||
|
||||
if($delete == true ){
|
||||
$this->addFlash('success', ['title'=>'Success', 'message'=>"L'annoce a été bien activer"]);
|
||||
}else{
|
||||
$this->addFlash('success', ['title'=>'Success', 'message'=>"L'annoce a été bien déactiver"]);
|
||||
}
|
||||
|
||||
$referer = $request->headers->get('referer');
|
||||
return $this->redirect($referer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[Route('/uploder/{id}', name: 'backend_admin_annonce_uploder')]
|
||||
public function uploder(Annonce $annonce)
|
||||
{
|
||||
return $this->render('backend_admin/annonce/uploder.htm.twig', ['annonce'=>$annonce]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/uploder_image/{id}', name: 'backend_admin_annonce_uploder_add')]
|
||||
public function uploder_add(Annonce $annonce, Request $request)
|
||||
{
|
||||
$idSociete = $annonce->getSociete()->getId();
|
||||
$idAnnonce = $annonce->getId();
|
||||
|
||||
$type = $request->request->get('type');
|
||||
|
||||
$directory = $this->getParameter('annonces_directory');
|
||||
|
||||
$base64_image = $request->request->get('image64');
|
||||
|
||||
$posJpeg = strpos($base64_image, 'data:image/jpeg;base64,');
|
||||
if ($posJpeg !== false){
|
||||
$base64_img = str_replace('data:image/jpeg;base64,', '', $base64_image);
|
||||
$extension = ".jpeg";
|
||||
}
|
||||
|
||||
$posPng = strpos($base64_image,'data:image/png;base64,');
|
||||
if ($posPng !== false){
|
||||
$base64_img = str_replace('data:image/png;base64,', '', $base64_image);
|
||||
$extension = ".png";
|
||||
}
|
||||
|
||||
$posJpg = strpos($base64_image, 'data:image/jpg;base64,');
|
||||
if ($posJpg !== false){
|
||||
$base64_img = str_replace('data:image/jpg;base64,', '', $base64_image);
|
||||
$extension = ".jpg";
|
||||
}
|
||||
|
||||
$posGif = strpos($base64_image,'data:image/gif;base64,');
|
||||
if ($posGif !== false){
|
||||
$base64_img = str_replace('data:image/gif;base64,', '', $base64_image);
|
||||
$extension = ".gif";
|
||||
}
|
||||
|
||||
$namefile = "$idSociete-$idAnnonce-$type-".md5(rand()).$extension;
|
||||
|
||||
$image = base64_decode($base64_img);
|
||||
|
||||
|
||||
if($image){
|
||||
|
||||
$result = file_put_contents($directory . $namefile, $image);
|
||||
|
||||
if($result){
|
||||
if($type == 'home'){
|
||||
if($annonce->getImageHome() && file_exists($directory . $annonce->getImageHome()) ){
|
||||
unlink($directory . $annonce->getImageHome());
|
||||
}
|
||||
$annonce->setImageHome($namefile);
|
||||
}elseif($type == 'search'){
|
||||
if($annonce->getImageSearch() && file_exists($directory . $annonce->getImageSearch()) ){
|
||||
unlink($directory . $annonce->getImageSearch());
|
||||
}
|
||||
$annonce->setImageSearch($namefile);
|
||||
}
|
||||
elseif($type == 'detail1'){
|
||||
if($annonce->getImageDetail1() && file_exists($directory . $annonce->getImageDetail1()) ){
|
||||
unlink($directory . $annonce->getImageDetail1());
|
||||
}
|
||||
$annonce->setImageDetail1($namefile);
|
||||
}
|
||||
elseif($type == 'detail2'){
|
||||
if($annonce->getImageDetail2() && file_exists($directory . $annonce->getImageDetail2()) ){
|
||||
unlink($directory . $annonce->getImageDetail2());
|
||||
}
|
||||
$annonce->setImageDetail2($namefile);
|
||||
}
|
||||
elseif($type == 'detail3'){
|
||||
if($annonce->getImageDetail3() && file_exists($directory . $annonce->getImageDetail3()) ){
|
||||
unlink($directory . $annonce->getImageDetail3());
|
||||
}
|
||||
$annonce->setImageDetail3($namefile);
|
||||
}
|
||||
elseif($type == 'detail4'){
|
||||
if($annonce->getImageDetail4() && file_exists($directory . $annonce->getImageDetail4()) ){
|
||||
unlink($directory . $annonce->getImageDetail4());
|
||||
}
|
||||
$annonce->setImageDetail4($namefile);
|
||||
}
|
||||
|
||||
$annonce->checkComplet();
|
||||
|
||||
$this->em->persist($annonce);
|
||||
}
|
||||
}
|
||||
|
||||
$this->em->flush();
|
||||
return new Response();
|
||||
}
|
||||
|
||||
|
||||
#[Route('/uploder_image_delete', name: 'backend_admin_annonce_uploder_delete')]
|
||||
public function uploder_delete(Request $request)
|
||||
{
|
||||
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//datatable.html.twig
|
||||
258
src/Controller/BackendAdmin/AnnoncePositionController.php
Executable file
258
src/Controller/BackendAdmin/AnnoncePositionController.php
Executable file
@@ -0,0 +1,258 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Repository\SocieteRepository;
|
||||
use App\Repository\AnnonceRepository;
|
||||
use App\Repository\PositionRepository;
|
||||
use App\Repository\AffichageRepository;
|
||||
use App\Repository\LigneRepository;
|
||||
|
||||
use App\Entity\Affichage;
|
||||
|
||||
|
||||
use App\Service\BackendAdmin\ServiceAnnonce;
|
||||
|
||||
#[Route('/backend/admin/annonce/position')]
|
||||
class AnnoncePositionController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var PositionRepository $positionRepository
|
||||
*/
|
||||
private $positionRepository;
|
||||
|
||||
|
||||
/**
|
||||
* @var AnnonceRepository $annonceRepository
|
||||
*/
|
||||
private $annonceRepository;
|
||||
|
||||
/**
|
||||
* @var LigneRepository $ligneRepository
|
||||
*/
|
||||
private $ligneRepository;
|
||||
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
|
||||
/**
|
||||
* @var ServiceAnnonce $serviceAnnonce
|
||||
*/
|
||||
private $serviceAnnonce;
|
||||
|
||||
|
||||
/**
|
||||
* @param PositionRepository $positionRepository
|
||||
* @param AnnonceRepository $annonceRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @param ServiceAnnonce $serviceAnnonce
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
PositionRepository $positionRepository,
|
||||
AnnonceRepository $annonceRepository,
|
||||
LigneRepository $ligneRepository,
|
||||
ServiceAnnonce $serviceAnnonce,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->positionRepository = $positionRepository;
|
||||
$this->annonceRepository = $annonceRepository;
|
||||
$this->ligneRepository = $ligneRepository;
|
||||
$this->serviceAnnonce = $serviceAnnonce;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
#[Route('/index', name: 'backend_admin_position_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
$positions = $this->positionRepository->findAll();
|
||||
|
||||
return $this->render('backend_admin/position_affichage/index.html.twig', ['positions'=>$positions]);
|
||||
}
|
||||
|
||||
#[Route('/detail', name: 'backend_admin_position_detail')]
|
||||
public function detail(Request $request): Response
|
||||
{
|
||||
$idPosition = $request->get('idPosition');
|
||||
|
||||
$position = $this->positionRepository->find($idPosition);
|
||||
|
||||
$lignes = $this->ligneRepository->findAllKeyId();
|
||||
|
||||
$msg = $request->get('msg');
|
||||
if($msg == 'add'){
|
||||
$this->addFlash('success', ['title'=>'Success',
|
||||
'message'=>"La position et l'affichage d'annonce <b>(".$position->getAnnonce()->getTitre().")</b> a été bien enregister."]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $this->render('backend_admin/position_affichage/detail.html.twig', ['position'=>$position, 'ligne' => $lignes[$position->getLigne()]]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/creer', name: 'backend_admin_position_creer')]
|
||||
public function creer(Request $request,
|
||||
SocieteRepository $societeRepository): Response
|
||||
{
|
||||
$idSociete = $request->get('idSociete');
|
||||
if($idSociete){
|
||||
$annonces = $this->annonceRepository->findBy(["societe"=>$idSociete], ["id"=>'DESC']);
|
||||
$options = '';
|
||||
foreach($annonces as $annonce){
|
||||
$options .= '<option value="'.$annonce->getId().'" largeur="'.$annonce->getLargeur().'" >'.$annonce->getTitre().'</option>';
|
||||
}
|
||||
return new Response($options);
|
||||
}
|
||||
|
||||
return $this->render('backend_admin/position_affichage/creer.html.twig',['societes'=>$societeRepository->findAll()]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/ligne_detail', name: 'backend_admin_position_ligne_detail')]
|
||||
public function ligne_detail(Request $request): Response
|
||||
{
|
||||
|
||||
$dimension = $request->get('dimension');
|
||||
|
||||
$lignes = $this->ligneRepository->findAllKeyId();
|
||||
|
||||
$options = '<option value=""></option>';
|
||||
|
||||
foreach($lignes as $ligne){
|
||||
$options .= '<option value="'.$ligne->getId().'">('.$ligne->getRang().') '.$ligne->getId().'e ligne à '.$ligne->getPrixByBimension($dimension).' DT</option>';
|
||||
}
|
||||
|
||||
return new Response($options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#[Route('/disponibilite', name: 'backend_admin_position_disponibilite')]
|
||||
public function disponibilite(Request $request,
|
||||
AffichageRepository $affichageRepository): Response
|
||||
{
|
||||
$id_annonce = $request->get('id_annonce');
|
||||
$id_ligne = $request->get('id_ligne');
|
||||
$date_debut = $request->get('date_debut');
|
||||
$date_fin = $request->get('date_fin');
|
||||
|
||||
$annonce = $this->annonceRepository->find($id_annonce);
|
||||
|
||||
$arrAffichages = $this->serviceAnnonce->getAnnoncePosition($annonce, $date_debut, $date_fin, $id_ligne);
|
||||
|
||||
$totalPrix = $nbrDates = $nbrDispo = 0;
|
||||
|
||||
$body = "";
|
||||
|
||||
foreach($arrAffichages as $val)
|
||||
{
|
||||
|
||||
$totalPrix += $val['prix'];
|
||||
|
||||
$nbrDates++;
|
||||
|
||||
if($val['dispo']){
|
||||
if($id_ligne == $val['ligne']->getId()){
|
||||
$nbrDispo ++;
|
||||
$body .= '<li class="list-group-item d-flex justify-content-between lh-sm">
|
||||
<div>
|
||||
<h6 class="my-0"> '.$val['date']->format("d/m/Y").'</h6>
|
||||
<small class="text-muted">Disponible</small>
|
||||
</div>
|
||||
<small class="text-muted">Ligne '.$val['ligne']->getRang().'</small>
|
||||
<span class="text-muted">'.$val['prix'].' DT</span>
|
||||
</li>';
|
||||
|
||||
}else{
|
||||
$body .= '<li class="list-group-item d-flex justify-content-between lh-sm">
|
||||
<div>
|
||||
<h6 class="my-0 ">'.$val['date']->format("d/m/Y").'</h6>
|
||||
<small class="text-warning">Disponible sur une autre ligne</small>
|
||||
</div>
|
||||
<small class="text-muted">Ligne '.$val['ligne']->getRang().'</small>
|
||||
<span class="text-muted">'.$val['prix'].' DT</span>
|
||||
</li>';
|
||||
}
|
||||
}else{
|
||||
$body .= '<li class="list-group-item d-flex justify-content-between lh-sm">
|
||||
<div>
|
||||
<h6 class="my-0 ">'.$val['date']->format("d/m/Y").'</h6>
|
||||
<small class="text-danger">Ligne Suivante Disponible</small>
|
||||
</div>
|
||||
<small class="text-muted">Ligne '.$val['ligne']->getRang().'</small>
|
||||
<span class="text-muted">'.$val['prix'].' DT</span>
|
||||
</li>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$result = ' <div class="col-md-12 col-lg-12 order-md-last" style="display:">
|
||||
<h4 class="d-flex justify-content-between align-items-center mb-3">
|
||||
<span class="text-muted">Disponibilité annonce sur la Ligne </span>
|
||||
<span class="badge bg-secondary rounded-pill"> '.$nbrDispo.'/'.$nbrDates.'</span>
|
||||
</h4>
|
||||
<div class="overflow-scroll p-3 bg-light" style="height: 400px;">
|
||||
<ul class="list-group mb-3" >'.$body ;
|
||||
|
||||
$result .= '</ul>
|
||||
</div>
|
||||
<br>
|
||||
<p class="fs-5">
|
||||
Nombre des jours: <strong>'.$nbrDates.'</strong><br><br>
|
||||
Prix Total d\'annonce: <strong>'.$totalPrix.' DT</strong>
|
||||
</p>
|
||||
</div>';
|
||||
|
||||
return new Response($result);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/save', name: 'backend_admin_position_save')]
|
||||
public function save(Request $request): Response
|
||||
{
|
||||
$id_annonce = $request->get('id_annonce');
|
||||
$id_ligne =$request->get('id_ligne');
|
||||
$date_debut = $request->get('date_debut');
|
||||
$date_fin = $request->get('date_fin');
|
||||
|
||||
$annonce = $this->annonceRepository->find($id_annonce);
|
||||
|
||||
$position = $this->positionRepository->addPosition($annonce, $date_debut, $date_fin, $id_ligne, $this->getUser());
|
||||
|
||||
$arrAffichages = $this->serviceAnnonce->getAnnoncePosition($annonce, $date_debut, $date_fin, $id_ligne);
|
||||
|
||||
foreach($arrAffichages as $value){
|
||||
if($value['dispo']){
|
||||
$affichage = new Affichage();
|
||||
$affichage->setAnnonce($annonce);
|
||||
$affichage->setDateShow($value['date']);
|
||||
$affichage->setLigne($value['ligne']->getId());
|
||||
$affichage->setPosition($position);
|
||||
$affichage->setPrix($value['prix']);
|
||||
$this->em->persist($affichage);
|
||||
}
|
||||
}
|
||||
$this->em->flush();
|
||||
|
||||
return new Response($position->getId());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//datatable.html.twig
|
||||
233
src/Controller/BackendAdmin/ArticleController.php
Executable file
233
src/Controller/BackendAdmin/ArticleController.php
Executable file
@@ -0,0 +1,233 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\Article;
|
||||
|
||||
use App\Repository\ArticleRepository;
|
||||
|
||||
use App\Form\BackendAdmin\ArticleType;
|
||||
|
||||
|
||||
#[Route('/backend/admin/article')]
|
||||
class ArticleController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ArticleRepository $articleRepository
|
||||
*/
|
||||
private $articleRepository;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @param AnnonceRepository $articleRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
ArticleRepository $articleRepository,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->articleRepository = $articleRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
|
||||
#[Route('/index', name: 'backend_admin_article_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('backend_admin/article/index.html.twig', ['articles'=> $this->articleRepository->findBy([], ["id"=>'DESC'])]);
|
||||
}
|
||||
|
||||
#[Route('/add', name: 'backend_admin_article_add')]
|
||||
public function add(Request $request): Response
|
||||
{
|
||||
$article = new Article();
|
||||
|
||||
$form = $this->createForm(ArticleType::class, $article);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$article = $form->getData();
|
||||
|
||||
if( ($article->getLimitType() == 0) && ($article->getLimitDate() == null) ){
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Limitation Par Date vide</b>"]);
|
||||
return $this->redirectToRoute('backend_admin_article_add', ['form'=>$form]);
|
||||
}
|
||||
|
||||
if( ($article->getLimitType() == 1) && ($article->getLimitQuantite() <= 0) ){
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Limitation Par Quantité vide</b>"]);
|
||||
return $this->redirectToRoute('backend_admin_article_add', ['form'=>$form]);
|
||||
}
|
||||
|
||||
$article->setCreateBy($this->getUser());
|
||||
$this->em->persist($article);
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('info', ['title'=>'Info',
|
||||
'message'=>"Le produit a été bien créer. pour qu'il soit active il faut ajouter <b>au moins l'image d'accueil</b>"]);
|
||||
|
||||
return $this->redirectToRoute('backend_admin_article_uploder', ['id' => $article->getId()]);
|
||||
}
|
||||
|
||||
return $this->render('backend_admin/article/add.html.twig', ['form'=>$form->createView()] );
|
||||
}
|
||||
|
||||
#[Route('/activation/{id}', name: 'backend_admin_article_activation')]
|
||||
public function activation(Article $article, Request $request)
|
||||
{
|
||||
$activation = $request->get('activation');
|
||||
|
||||
if($activation == 'true'){
|
||||
$article->setActive(true);
|
||||
}else if($activation == 'false'){
|
||||
$article->setActive(false);
|
||||
}
|
||||
|
||||
$this->em->persist($article);
|
||||
$this->em->flush();
|
||||
|
||||
return $this->redirectToRoute('backend_admin_article_index');
|
||||
}
|
||||
|
||||
|
||||
#[Route('/update/{id}', name: 'backend_admin_article_update')]
|
||||
public function update(Article $article, Request $request): Response
|
||||
{
|
||||
$form = $this->createForm(ArticleType::class, $article);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$article = $form->getData();
|
||||
|
||||
if( ($article->getLimitType() == 0) && ($article->getLimitDate() == null) ){
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Limitation Par Date vide</b>"]);
|
||||
return $this->redirectToRoute('backend_admin_article_add', ['form'=>$form]);
|
||||
}
|
||||
|
||||
if( ($article->getLimitType() == 1) && ($article->getLimitQuantite() <= 0) ){
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Limitation Par Quantité vide</b>"]);
|
||||
return $this->redirectToRoute('backend_admin_article_add', ['form'=>$form]);
|
||||
}
|
||||
|
||||
$this->em->persist($article);
|
||||
$this->em->flush();
|
||||
|
||||
}
|
||||
|
||||
return $this->render('backend_admin/article/detail.html.twig', ['form'=>$form->createView(), 'article'=>$article] );
|
||||
}
|
||||
|
||||
|
||||
#[Route('/uploder/{id}', name: 'backend_admin_article_uploder')]
|
||||
public function uploder(Article $article)
|
||||
{
|
||||
return $this->render('backend_admin/article/uploder.htm.twig', ['article'=>$article]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/uploder_image/{id}', name: 'backend_admin_article_uploder_add')]
|
||||
public function uploder_add(Article $article, Request $request)
|
||||
{
|
||||
$idSociete = $article->getSociete()->getId();
|
||||
$idArticle = $article->getId();
|
||||
|
||||
$type = $request->request->get('type');
|
||||
|
||||
$directory = $this->getParameter('articles_directory');
|
||||
|
||||
$base64_image = $request->request->get('image64');
|
||||
|
||||
$posJpeg = strpos($base64_image, 'data:image/jpeg;base64,');
|
||||
if ($posJpeg !== false){
|
||||
$base64_img = str_replace('data:image/jpeg;base64,', '', $base64_image);
|
||||
$extension = ".jpeg";
|
||||
}
|
||||
|
||||
$posPng = strpos($base64_image,'data:image/png;base64,');
|
||||
if ($posPng !== false){
|
||||
$base64_img = str_replace('data:image/png;base64,', '', $base64_image);
|
||||
$extension = ".png";
|
||||
}
|
||||
|
||||
$posJpg = strpos($base64_image, 'data:image/jpg;base64,');
|
||||
if ($posJpg !== false){
|
||||
$base64_img = str_replace('data:image/jpg;base64,', '', $base64_image);
|
||||
$extension = ".jpg";
|
||||
}
|
||||
|
||||
$posGif = strpos($base64_image,'data:image/gif;base64,');
|
||||
if ($posGif !== false){
|
||||
$base64_img = str_replace('data:image/gif;base64,', '', $base64_image);
|
||||
$extension = ".gif";
|
||||
}
|
||||
|
||||
$namefile = "$idSociete-$idArticle-$type-".md5(rand()).$extension;
|
||||
|
||||
$image = base64_decode($base64_img);
|
||||
|
||||
|
||||
if($image){
|
||||
|
||||
$result = file_put_contents($directory . $namefile, $image);
|
||||
|
||||
if($result){
|
||||
if($type == 'default'){
|
||||
if($article->getImageDefault() && file_exists($directory . $article->getImageDefault()) ){
|
||||
unlink($directory . $article->getImageDefault());
|
||||
}
|
||||
$article->setImageDefault($namefile);
|
||||
$article->setActive(true);
|
||||
}elseif($type == 'detail1'){
|
||||
if($article->getImageDetail1() && file_exists($directory . $article->getImageDetail1()) ){
|
||||
unlink($directory . $article->getImageDetail1());
|
||||
}
|
||||
$article->setImageDetail1($namefile);
|
||||
}
|
||||
elseif($type == 'detail2'){
|
||||
if($article->getImageDetail2() && file_exists($directory . $article->getImageDetail2()) ){
|
||||
unlink($directory . $article->getImageDetail2());
|
||||
}
|
||||
$article->setImageDetail2($namefile);
|
||||
}
|
||||
elseif($type == 'detail3'){
|
||||
if($article->getImageDetail3() && file_exists($directory . $article->getImageDetail3()) ){
|
||||
unlink($directory . $article->getImageDetail3());
|
||||
}
|
||||
$article->setImageDetail3($namefile);
|
||||
}
|
||||
elseif($type == 'detail4'){
|
||||
if($article->getImageDetail4() && file_exists($directory . $article->getImageDetail4()) ){
|
||||
unlink($directory . $article->getImageDetail4());
|
||||
}
|
||||
$article->setImageDetail4($namefile);
|
||||
}
|
||||
|
||||
$this->em->persist($article);
|
||||
}
|
||||
}
|
||||
|
||||
$this->em->flush();
|
||||
return new Response();
|
||||
}
|
||||
|
||||
|
||||
#[Route('/uploder_image_delete', name: 'backend_admin_article_uploder_delete')]
|
||||
public function uploder_delete(Request $request)
|
||||
{
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
105
src/Controller/BackendAdmin/CategorieController.php
Executable file
105
src/Controller/BackendAdmin/CategorieController.php
Executable file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Repository\CategorieRepository;
|
||||
|
||||
use App\Entity\Categorie;
|
||||
|
||||
use App\Form\BackendAdmin\CategorieType;
|
||||
|
||||
#[Route('/backend/admin/categorie')]
|
||||
class CategorieController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var CategorieRepository $categorieRepository
|
||||
*/
|
||||
private $categorieRepository;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @param CategorieRepository $categorieRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
CategorieRepository $categorieRepository,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->categorieRepository = $categorieRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
|
||||
#[Route('/index', name: 'backend_admin_categorie_index')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$categorie = new Categorie();
|
||||
|
||||
$idCategorie = $request->get('idCategorie');
|
||||
if($idCategorie){
|
||||
$categorie = $this->categorieRepository->find($idCategorie);
|
||||
}
|
||||
|
||||
$form = $this->createForm(CategorieType::class, $categorie);
|
||||
|
||||
return $this->render('backend_admin/categorie/index_categorie.html.twig', ['form'=>$form, 'categorie' => $categorie, 'categories'=> $this->categorieRepository->findBy([], ["id"=>'DESC'])]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/add', name: 'backend_admin_categorie_add')]
|
||||
public function add(Request $request): Response
|
||||
{
|
||||
$categorie = new Categorie();
|
||||
|
||||
$form = $this->createForm(CategorieType::class, $categorie);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->em->persist($categorie);
|
||||
$this->em->flush();
|
||||
$this->addFlash('success', ['title'=>'Success',
|
||||
'message'=>"La catégorie <b>(".$categorie->getNom().")</b> a été bien créer."]);
|
||||
}
|
||||
return $this->redirectToRoute('backend_admin_categorie_index');
|
||||
}
|
||||
|
||||
|
||||
#[Route('/update/{id}', name: 'backend_admin_categorie_update')]
|
||||
public function update(Request $request, Categorie $categorie): Response
|
||||
{
|
||||
$form = $this->createForm(CategorieType::class, $categorie);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$this->em->persist($categorie);
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('success', ['title'=>'Success',
|
||||
'message'=>"La catégorie <b>(".$categorie->getNom().")</b> a été bien Modifier."]);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('backend_admin_categorie_index');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//datatable.html.twig
|
||||
24
src/Controller/BackendAdmin/DashboardController.php
Executable file
24
src/Controller/BackendAdmin/DashboardController.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/backend/admin/dashboard')]
|
||||
class DashboardController extends AbstractController
|
||||
{
|
||||
#[Route('/index', name: 'backend_admin_dashboard_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('backend_admin/dashboard/index.html.twig', ['titlePage'=> 'Dashboard']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//datatable.html.twig
|
||||
199
src/Controller/BackendAdmin/DemoController.php
Executable file
199
src/Controller/BackendAdmin/DemoController.php
Executable file
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Repository\ReservationArticleRepository;
|
||||
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
#[Route('/backend/admin/demo')]
|
||||
class DemoController extends AbstractController
|
||||
{
|
||||
#[Route('/testa')]
|
||||
public function testa(ReservationArticleRepository $reservationArticleRepository)
|
||||
{
|
||||
$reservationArticle = $reservationArticleRepository->findOneBy(['reference'=>"6781-4065-9580-5000"]);
|
||||
|
||||
//$reservationArticle = $reservationArticleRepository->findByReferenceNotValid("6781-4065-9580-5000");
|
||||
|
||||
dd($reservationArticle);
|
||||
die;
|
||||
}
|
||||
|
||||
#[Route('/test1')]
|
||||
public function test1()
|
||||
{
|
||||
$duree = 60;
|
||||
$between = 15;
|
||||
|
||||
$startTime = "09:00:00";
|
||||
$endTime = "13:00:00";
|
||||
|
||||
$excludeDay = ["Sun"];
|
||||
|
||||
$intervalDay = new \DateInterval('P1D');
|
||||
$dateRangeDay = new \DatePeriod(new \DateTime("2023-09-01"), $intervalDay, new \DateTime("2023-09-03"));
|
||||
|
||||
$range = [];
|
||||
foreach ($dateRangeDay as $date) {
|
||||
|
||||
$dateStr = $date->format("Y-m-d");
|
||||
|
||||
|
||||
$Indice = array_search($date->format('D'), $excludeDay);
|
||||
if(!$excludeDay || !is_numeric($Indice)){
|
||||
|
||||
$debut = new \DateTime("$dateStr $startTime");
|
||||
$tempo = new \DateTime("$dateStr $startTime");
|
||||
|
||||
$end = new \DateTime("$dateStr $endTime");
|
||||
|
||||
do{
|
||||
|
||||
$fin = clone $tempo->modify("+$duree minutes");
|
||||
|
||||
if($fin<$end){
|
||||
$range[] = ['debut'=>$debut, 'fin'=>$fin];
|
||||
}
|
||||
|
||||
$debut = clone $tempo->modify("+$between minutes");
|
||||
|
||||
}while($debut < $end);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dd($range);
|
||||
|
||||
die;
|
||||
}
|
||||
|
||||
#[Route('/index', name: 'backend_admin_demo_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/index.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/test', name: 'backend_admin_demo_test')]
|
||||
public function test(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/test.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/button', name: 'backend_admin_demo_button')]
|
||||
public function button(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/button.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/datatable', name: 'demo_backend_datatable')]
|
||||
public function datatable(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/datatable.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/page404', name: 'backend_admin_demo_page404')]
|
||||
public function page404(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/page404.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/bootstrap', name: 'demo_backend_bootstrap')]
|
||||
public function bootstrap(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/bootstrap.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/cards', name: 'demo_backend_cards')]
|
||||
public function cards(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/cards.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/charts', name: 'demo_backend_charts')]
|
||||
public function charts(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/charts.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/animation', name: 'demo_backend_animation')]
|
||||
public function animation(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/animation.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/border', name: 'demo_backend_border')]
|
||||
public function border(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/border.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/color', name: 'demo_backend_color')]
|
||||
public function color(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/color.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/other', name: 'demo_backend_other')]
|
||||
public function other(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/other.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/authentication', name: 'demo_backend_authentication')]
|
||||
public function authentication(): Response
|
||||
{
|
||||
return $this->render('backend_admin/demo/authentication.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[Route('/phpinfo', name: 'demo_backend_phpinfo')]
|
||||
public function phpinfo()
|
||||
{
|
||||
phpinfo();die;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//datatable.html.twig
|
||||
143
src/Controller/BackendAdmin/GroupCategorieController.php
Executable file
143
src/Controller/BackendAdmin/GroupCategorieController.php
Executable file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Repository\GroupeCategorieRepository;
|
||||
|
||||
use App\Form\BackendAdmin\GroupeCategorieType;
|
||||
|
||||
use App\Service\UploaderService;
|
||||
|
||||
use App\Entity\GroupeCategorie;
|
||||
|
||||
#[Route('/backend/admin/groupcategorie')]
|
||||
class GroupCategorieController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var GroupeCategorieRepository $groupeRepository
|
||||
*/
|
||||
private $groupeRepository;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @param GroupeCategorieRepository $groupeRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
GroupeCategorieRepository $groupeRepository,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->groupeRepository = $groupeRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
#[Route('/index', name: 'backend_admin_groupe_categorie_index')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
|
||||
$groupe = new GroupeCategorie();
|
||||
|
||||
$idGroupe = $request->get('idGroupe');
|
||||
if($idGroupe){
|
||||
$groupe = $this->groupeRepository->find($idGroupe);
|
||||
}
|
||||
|
||||
$form = $this->createForm(GroupeCategorieType::class, $groupe);
|
||||
|
||||
return $this->render('backend_admin/categorie/index_group.html.twig',['form'=>$form, 'groupe' => $groupe, 'groupes'=> $this->groupeRepository->findAll()]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/add', name: 'backend_admin_groupe_categorie_add')]
|
||||
public function add(Request $request, UploaderService $uploaderService): Response
|
||||
{
|
||||
$groupe = new GroupeCategorie();
|
||||
|
||||
$form = $this->createForm(GroupeCategorieType::class, $groupe);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$image = $form->get('image')->getData();
|
||||
if ($image) {
|
||||
$directory = $this->getParameter('groupes_directory');
|
||||
$groupe->setImage($uploaderService->uploadFile($image, $directory));
|
||||
}
|
||||
|
||||
$this->em->persist($groupe);
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('success', ['title'=>'Success',
|
||||
'message'=>"Le groupe <b>(".$groupe->getNom().")</b> a été bien ajouter."]);
|
||||
}
|
||||
return $this->redirectToRoute('backend_admin_groupe_categorie_index');
|
||||
}
|
||||
|
||||
|
||||
#[Route('/update/{id}', name: 'backend_admin_groupe_categorie_update')]
|
||||
public function update(Request $request, GroupeCategorie $groupe, UploaderService $uploaderService): Response
|
||||
{
|
||||
$form = $this->createForm(GroupeCategorieType::class, $groupe);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$image = $form->get('image')->getData();
|
||||
if ($image) {
|
||||
$directory = $this->getParameter('groupes_directory');
|
||||
$pathImage = $directory.$groupe->getImage();
|
||||
|
||||
$groupe->setImage($uploaderService->uploadFile($image, $directory));
|
||||
if(is_file($pathImage)){
|
||||
unlink($pathImage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->em->persist($groupe);
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('success', ['title'=>'Success',
|
||||
'message'=>"Le groupe <b>(".$groupe->getNom().")</b> a été bien modifier."]);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('backend_admin_groupe_categorie_index');
|
||||
}
|
||||
|
||||
|
||||
#[Route('/remove_image/{id}', name: 'backend_admin_groupe_categorie_remove_image')]
|
||||
public function remove_image(GroupeCategorie $groupe): Response
|
||||
{
|
||||
$directory = $this->getParameter('groupes_directory');
|
||||
$pathImage = $directory.$groupe->getImage();
|
||||
if($groupe->getImage() && is_file($pathImage)){
|
||||
unlink($pathImage);
|
||||
$groupe->setImage(null);
|
||||
$this->em->persist($groupe);
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('success', ['title'=>'Success',
|
||||
'message'=>"l'image du groupe <b>(".$groupe->getNom().")</b> a été bien supprimer."]);
|
||||
}
|
||||
return $this->redirectToRoute('backend_admin_groupe_categorie_update',['id'=>$groupe->getId()]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//datatable.html.twig
|
||||
138
src/Controller/BackendAdmin/PartenaireController.php
Executable file
138
src/Controller/BackendAdmin/PartenaireController.php
Executable file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\Partenaire;
|
||||
|
||||
use App\Repository\PartenaireRepository;
|
||||
|
||||
use App\Form\BackendAdmin\PartenaireType;
|
||||
|
||||
#[Route('/backend/admin/partenaire')]
|
||||
class PartenaireController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @var PartenaireRepository $partenaireRepository
|
||||
*/
|
||||
private $partenaireRepository;
|
||||
|
||||
|
||||
/**
|
||||
* @param EntityManagerInterface $em
|
||||
* @param PartenaireRepository $partenaireRepository
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
partenaireRepository $partenaireRepository
|
||||
){
|
||||
$this->em = $em;
|
||||
$this->partenaireRepository = $partenaireRepository;
|
||||
}
|
||||
|
||||
#[Route('/index', name: 'backend_admin_partenaire_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
$partenaires = $this->partenaireRepository->findAll();
|
||||
|
||||
return $this->render('backend_admin/partenaire/index.html.twig', ['partenaires'=>$partenaires]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/add', name: 'backend_admin_partenaire_add')]
|
||||
public function add(Request $request): Response
|
||||
{
|
||||
$partenaire = new Partenaire();
|
||||
|
||||
$form = $this->createForm(PartenaireType::class, $partenaire);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$partenaire = $form->getData();
|
||||
|
||||
$partenaires = $partenaire->getPartenaire()->getPartenaires();
|
||||
foreach($partenaires as $partner){
|
||||
if($partenaire->getSociete()->getId() == $partner->getSociete()->getId()){
|
||||
$this->addFlash('warning', ['title'=>'Attention', 'message'=>"<b>cette société existe déja pour ce utilisateur</b>"]);
|
||||
return $this->render('backend_admin/partenaire/add.html.twig', ['form'=>$form]);
|
||||
}
|
||||
}
|
||||
|
||||
$partenaire->setAdmin($this->getUser());
|
||||
$partenaire->setActive(true);
|
||||
$partenaire->setNotifier(true);
|
||||
|
||||
if(count($partenaires) == 0){
|
||||
$partenaire->setSelected(true);
|
||||
}else{
|
||||
$partenaire->setSelected(false);
|
||||
}
|
||||
|
||||
// update role user
|
||||
$partner = $partenaire->getPartenaire();
|
||||
$partner->addRole("ROLE_PARTNER_ADVANCED");
|
||||
|
||||
$this->em->persist($partner);
|
||||
$this->em->persist($partenaire);
|
||||
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('success', ['title'=>'Success', 'message'=>"L'ajout a été effectuée avec succès"]);
|
||||
return $this->redirectToRoute('backend_admin_partenaire_index');
|
||||
}
|
||||
|
||||
return $this->render('backend_admin/partenaire/add.html.twig', ['form'=>$form]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/activated/{id}/{active}', name: 'backend_admin_partenaire_activated')]
|
||||
public function activated(partenaire $partenaire, $active): Response
|
||||
{
|
||||
$message = "";
|
||||
$partenaire->setActive($active);
|
||||
$partenaire->setAdmin($this->getUser());
|
||||
$partenaire->setNotifier(true);
|
||||
|
||||
$user = $partenaire->getPartenaire();
|
||||
$roles = $user->getRoles();
|
||||
|
||||
if($active){
|
||||
$roles[] = "ROLE_PARTNER_ADVANCED";
|
||||
$message = "Le partenaire a été bien activer.";
|
||||
$societe = $partenaire->getSociete();
|
||||
$societe->setActive(true);
|
||||
$this->em->persist($societe);
|
||||
$this->em->flush();
|
||||
}else{
|
||||
$roles = [];
|
||||
$message = "Le partenaire a été bien déactiver.";
|
||||
}
|
||||
|
||||
$user->setRoles($roles);
|
||||
$this->em->persist($user);
|
||||
$this->em->flush();
|
||||
|
||||
$this->em->persist($partenaire);
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('success', ['title'=>'Success', 'message'=>$message]);
|
||||
|
||||
return $this->redirectToRoute('backend_admin_partenaire_index');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
227
src/Controller/BackendAdmin/ServiceController.php
Executable file
227
src/Controller/BackendAdmin/ServiceController.php
Executable file
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\Service;
|
||||
|
||||
use App\Repository\ServiceRepository;
|
||||
|
||||
use App\Form\BackendAdmin\ServiceType;
|
||||
|
||||
|
||||
#[Route('/backend/admin/service')]
|
||||
class ServiceController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ServiceRepository $serviceRepository
|
||||
*/
|
||||
private $serviceRepository;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @param AnnonceRepository $serviceRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
ServiceRepository $serviceRepository,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->serviceRepository = $serviceRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
|
||||
#[Route('/index', name: 'backend_admin_service_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('backend_admin/service/index.html.twig', ['services'=> $this->serviceRepository->findBy([], ["id"=>'DESC'])]);
|
||||
}
|
||||
|
||||
#[Route('/add', name: 'backend_admin_service_add')]
|
||||
public function add(Request $request): Response
|
||||
{
|
||||
$service = new Service();
|
||||
|
||||
$form = $this->createForm(ServiceType::class, $service);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$service = $form->getData();
|
||||
|
||||
if( ($service->getLimitType() == 0) && ($service->getLimitDate() == null) ){
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Limitation Par Date vide</b>"]);
|
||||
return $this->redirectToRoute('backend_admin_service_add', ['form'=>$form]);
|
||||
}
|
||||
|
||||
$service->setCreateBy($this->getUser());
|
||||
$this->em->persist($service);
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('info', ['title'=>'Info',
|
||||
'message'=>"Le service a été bien créer. pour qu'il soit active il faut ajouter les images et les rendez-vous "]);
|
||||
|
||||
|
||||
return $this->redirectToRoute('backend_admin_service_uploder', ['id' => $service->getId()]);
|
||||
}
|
||||
|
||||
return $this->render('backend_admin/service/add.html.twig', ['form'=>$form->createView()] );
|
||||
}
|
||||
|
||||
|
||||
#[Route('/activation/{id}', name: 'backend_admin_service_activation')]
|
||||
public function activation(Service $service, Request $request)
|
||||
{
|
||||
$activation = $request->get('activation');
|
||||
|
||||
if($activation == 'true'){
|
||||
$service->setActive(true);
|
||||
}else if($activation == 'false'){
|
||||
$service->setActive(false);
|
||||
}
|
||||
|
||||
$this->em->persist($service);
|
||||
$this->em->flush();
|
||||
|
||||
return $this->redirectToRoute('backend_admin_service_index');
|
||||
}
|
||||
|
||||
|
||||
#[Route('/update/{id}', name: 'backend_admin_service_update')]
|
||||
public function update(Service $service, Request $request): Response
|
||||
{
|
||||
$form = $this->createForm(ServiceType::class, $service);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$service = $form->getData();
|
||||
|
||||
if( ($service->getLimitType() == 0) && ($service->getLimitDate() == null) ){
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Limitation Par Date vide</b>"]);
|
||||
return $this->redirectToRoute('backend_admin_service_add', ['form'=>$form]);
|
||||
}
|
||||
|
||||
$service->gestionActive();
|
||||
|
||||
$this->em->persist($service);
|
||||
$this->em->flush();
|
||||
|
||||
}
|
||||
|
||||
return $this->render('backend_admin/service/detail.html.twig', ['form'=>$form->createView(), 'service'=>$service] );
|
||||
}
|
||||
|
||||
|
||||
#[Route('/uploder/{id}', name: 'backend_admin_service_uploder')]
|
||||
public function uploder(Service $service)
|
||||
{
|
||||
return $this->render('backend_admin/service/uploder.htm.twig', ['service'=>$service]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/uploder_image/{id}', name: 'backend_admin_service_uploder_add')]
|
||||
public function uploder_add(Service $service, Request $request)
|
||||
{
|
||||
$idSociete = $service->getSociete()->getId();
|
||||
$idService = $service->getId();
|
||||
|
||||
$type = $request->request->get('type');
|
||||
|
||||
$directory = $this->getParameter('services_directory');
|
||||
|
||||
$base64_image = $request->request->get('image64');
|
||||
|
||||
$posJpeg = strpos($base64_image, 'data:image/jpeg;base64,');
|
||||
if ($posJpeg !== false){
|
||||
$base64_img = str_replace('data:image/jpeg;base64,', '', $base64_image);
|
||||
$extension = ".jpeg";
|
||||
}
|
||||
|
||||
$posPng = strpos($base64_image,'data:image/png;base64,');
|
||||
if ($posPng !== false){
|
||||
$base64_img = str_replace('data:image/png;base64,', '', $base64_image);
|
||||
$extension = ".png";
|
||||
}
|
||||
|
||||
$posJpg = strpos($base64_image, 'data:image/jpg;base64,');
|
||||
if ($posJpg !== false){
|
||||
$base64_img = str_replace('data:image/jpg;base64,', '', $base64_image);
|
||||
$extension = ".jpg";
|
||||
}
|
||||
|
||||
$posGif = strpos($base64_image,'data:image/gif;base64,');
|
||||
if ($posGif !== false){
|
||||
$base64_img = str_replace('data:image/gif;base64,', '', $base64_image);
|
||||
$extension = ".gif";
|
||||
}
|
||||
|
||||
$namefile = "$idSociete-$idService-$type-".md5(rand()).$extension;
|
||||
|
||||
$image = base64_decode($base64_img);
|
||||
|
||||
if($image){
|
||||
|
||||
$result = file_put_contents($directory . $namefile, $image);
|
||||
|
||||
if($result){
|
||||
if($type == 'default'){
|
||||
if($service->getImageDefault() && file_exists($directory . $service->getImageDefault()) ){
|
||||
unlink($directory . $service->getImageDefault());
|
||||
}
|
||||
$service->setImageDefault($namefile);
|
||||
}elseif($type == 'detail1'){
|
||||
if($service->getImageDetail1() && file_exists($directory . $service->getImageDetail1()) ){
|
||||
unlink($directory . $service->getImageDetail1());
|
||||
}
|
||||
$service->setImageDetail1($namefile);
|
||||
}
|
||||
elseif($type == 'detail2'){
|
||||
if($service->getImageDetail2() && file_exists($directory . $service->getImageDetail2()) ){
|
||||
unlink($directory . $service->getImageDetail2());
|
||||
}
|
||||
$service->setImageDetail2($namefile);
|
||||
}
|
||||
elseif($type == 'detail3'){
|
||||
if($service->getImageDetail3() && file_exists($directory . $service->getImageDetail3()) ){
|
||||
unlink($directory . $service->getImageDetail3());
|
||||
}
|
||||
$service->setImageDetail3($namefile);
|
||||
}
|
||||
elseif($type == 'detail4'){
|
||||
if($service->getImageDetail4() && file_exists($directory . $service->getImageDetail4()) ){
|
||||
unlink($directory . $service->getImageDetail4());
|
||||
}
|
||||
$service->setImageDetail4($namefile);
|
||||
}
|
||||
|
||||
$service->gestionActive();
|
||||
|
||||
$this->em->persist($service);
|
||||
}
|
||||
}
|
||||
|
||||
$this->em->flush();
|
||||
return new Response();
|
||||
}
|
||||
|
||||
|
||||
#[Route('/uploder_image_delete', name: 'backend_admin_service_uploder_delete')]
|
||||
public function uploder_delete(Request $request)
|
||||
{
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
147
src/Controller/BackendAdmin/ServiceRDVController.php
Executable file
147
src/Controller/BackendAdmin/ServiceRDVController.php
Executable file
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\Service;
|
||||
use App\Entity\ServiceRdv;
|
||||
use App\Entity\ServiceRdvReservation;
|
||||
|
||||
use App\Repository\ServiceRDVRepository;
|
||||
|
||||
use App\Service\BackendAdmin\ServiceService;
|
||||
|
||||
#[Route('/backend/admin/service/rdv')]
|
||||
class ServiceRDVController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/add/{id}', name: 'backend_admin_service_rdv_add')]
|
||||
public function add(Service $service, Request $request, ServiceService $serviceService): Response
|
||||
{
|
||||
if ($request->isMethod('POST')) {
|
||||
|
||||
$data = $request->request->all();
|
||||
|
||||
if(isset($data['Sun'])){$excludeDay[] = 'Sun'; }
|
||||
if(isset($data['Mon'])){$excludeDay[] = 'Mon'; }
|
||||
if(isset($data['Tue'])){$excludeDay[] = 'Tue'; }
|
||||
if(isset($data['Wed'])){$excludeDay[] = 'Wed'; }
|
||||
if(isset($data['Thu'])){$excludeDay[] = 'Thu'; }
|
||||
if(isset($data['Fri'])){$excludeDay[] = 'Fri'; }
|
||||
if(isset($data['Sat'])){$excludeDay[] = 'Sat'; }
|
||||
|
||||
$Param['id'] = $service->getId();
|
||||
$Param['startDate'] = $data['date-debut'];
|
||||
$Param['endDate'] = $data['date-fin'];
|
||||
$Param['startTime'] = $data['time-debut'];
|
||||
$Param['endTime'] = $data['time-fin'];
|
||||
$Param['between'] = $data['duree-entre'];
|
||||
$Param ['duree'] = $service->getDuree();
|
||||
$Param['excludeDay'] = $excludeDay;
|
||||
$Param['save'] = 'true';
|
||||
|
||||
$ranges = $serviceService->getListRendezVous(new \DateTime($Param['startDate']), new \DateTime($Param['endDate']), $Param['startTime'], $Param['endTime'], $Param ['duree'], $Param['between'], $excludeDay);
|
||||
$RendezVous = [];
|
||||
foreach($ranges as $range){
|
||||
|
||||
$RendezVous[$range['debut']->format('d/m/Y')][] = ['debut'=>$range['debut']->format('H:i'), 'fin'=>$range['fin']->format('H:i')];
|
||||
}
|
||||
$Param['arrRendezVous'] = $RendezVous;
|
||||
|
||||
return $this->render('backend_admin/service_rdv/show_new_rdv.html.twig', $Param);
|
||||
}
|
||||
return $this->render('backend_admin/service_rdv/add.html.twig', ["service"=>$service]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/show/{id}', name: 'backend_admin_service_rdv_show')]
|
||||
public function show(ServiceRdv $serviceRdv): Response
|
||||
{
|
||||
$Param = $serviceRdv->toArray();
|
||||
$Param['save'] = 'false';
|
||||
|
||||
return $this->render('backend_admin/service_rdv/show_new_rdv.html.twig', $Param);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/rdv_ajax_show', name: 'backend_admin_service_rdv_ajax_show')]
|
||||
public function rdv_ajax_show(Request $request, ServiceRDVRepository $serviceRdvRepository)
|
||||
{
|
||||
$idRdv = $request->get('idRdv');
|
||||
$serviceRdvs = $serviceRdvRepository->findBy(['service'=>$idRdv],["id"=>'DESC']);
|
||||
$result = "";
|
||||
foreach($serviceRdvs as $serviceRdv){
|
||||
$result .= "<tr>";
|
||||
$result .= "<td>".$serviceRdv->getId()."</td>";
|
||||
$result .= "<td>".$serviceRdv->getStringStartDate()."</td>";
|
||||
$result .= "<td>".$serviceRdv->getStringEndDate()."</td>";
|
||||
$result .= "<td>".$serviceRdv->getStringStartTime()."</td>";
|
||||
$result .= "<td>".$serviceRdv->getStringEndTime()."</td>";
|
||||
$result .= "<td>".$serviceRdv->getBetweenRdv()."</td>";
|
||||
$result .= "<td>".$serviceRdv->getExcludeDay()."</td>";
|
||||
$result .= '<td><a href="rdv/show/'.$serviceRdv->getId().'" class="btn btn-info btn-action"><i class="fa-solid fa-magnifying-glass"></i></a></td>';
|
||||
$result .= "</tr>";
|
||||
}
|
||||
return new Response($result);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/save/{id}', name: 'backend_admin_service_rdv_save')]
|
||||
public function save(Service $service,
|
||||
Request $request,
|
||||
ServiceService $serviceService,
|
||||
EntityManagerInterface $em): Response
|
||||
{
|
||||
$Param['startDate'] = $request->get('startDate');
|
||||
$Param['endDate'] = $request->get('endDate');
|
||||
$Param['startTime'] = $request->get('startTime');
|
||||
$Param['endTime'] = $request->get('endTime');
|
||||
$Param['duree'] = $service->getDuree();
|
||||
$Param['between'] = $request->get('between');
|
||||
$Param['excludeDay'] = $excludeDay = $request->get('excludeDay');
|
||||
$Param['id'] = $service->getId();
|
||||
$Param['save'] = 'false';
|
||||
|
||||
$ranges = $serviceService->getListRendezVous(new \DateTime($Param['startDate']), new \DateTime($Param['endDate']), $Param['startTime'], $Param['endTime'], $Param ['duree'], $Param['between'], $excludeDay);
|
||||
|
||||
$serviceRdv = new ServiceRdv();
|
||||
$serviceRdv->setStartDate(new \DateTime($Param['startDate']));
|
||||
$serviceRdv->setEndDate(new \DateTime($Param['endDate']));
|
||||
$serviceRdv->setDuree($Param['duree']);
|
||||
$serviceRdv->setStartTime(new \DateTime($Param['startTime']));
|
||||
$serviceRdv->setEndTime(new \DateTime($Param['endTime']));
|
||||
$serviceRdv->setBetweenRdv($Param['between']);
|
||||
$serviceRdv->setExcludeDay(implode(",", $Param['excludeDay']));
|
||||
$serviceRdv->setService($service);
|
||||
$serviceRdv->setReservationJson($ranges);
|
||||
$serviceRdv->setCreateBy($this->getUser());
|
||||
$em->persist($serviceRdv);
|
||||
$em->flush();
|
||||
|
||||
$RendezVous = [];
|
||||
foreach($ranges as $reservation){
|
||||
$serviceRdvReservation = new ServiceRdvReservation();
|
||||
$serviceRdvReservation->setDateDebut($reservation['debut']);
|
||||
$serviceRdvReservation->setDateFin($reservation['fin']);
|
||||
$serviceRdvReservation->setServiceRdv($serviceRdv);
|
||||
$serviceRdvReservation->setService($service);
|
||||
$em->persist($serviceRdvReservation);
|
||||
$RendezVous[$reservation['debut']->format('d/m/Y')][] = ['debut'=>$reservation['debut']->format('H:i'), 'fin'=>$reservation['fin']->format('H:i')];
|
||||
}
|
||||
$Param['arrRendezVous'] = $RendezVous;
|
||||
|
||||
$em->flush();
|
||||
|
||||
return $this->render('backend_admin/service_rdv/show_new_rdv.html.twig', $Param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
129
src/Controller/BackendAdmin/SocieteController.php
Executable file
129
src/Controller/BackendAdmin/SocieteController.php
Executable file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Repository\SocieteRepository;
|
||||
|
||||
use App\Entity\Societe;
|
||||
|
||||
use App\Form\BackendAdmin\SocieteType;
|
||||
|
||||
use App\Service\UploaderService;
|
||||
|
||||
#[Route('/backend/admin/societe')]
|
||||
class SocieteController extends AbstractController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var SocieteRepository $societeRepository
|
||||
*/
|
||||
private $societeRepository;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @param SocieteRepository $societeRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
SocieteRepository $societeRepository,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->societeRepository = $societeRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
|
||||
#[Route('/index', name: 'backend_admin_societe_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('backend_admin/societe/index.html.twig', ['societes'=> $this->societeRepository->findBy([], ["id"=>'DESC'])]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/add', name: 'backend_admin_societe_add')]
|
||||
public function add(Request $request, UploaderService $uploaderService): Response
|
||||
{
|
||||
$societe = new Societe();
|
||||
|
||||
$form = $this->createForm(SocieteType::class, $societe);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$photo = $form->get('photo')->getData();
|
||||
if ($photo) {
|
||||
$directory = $this->getParameter('societes_directory');
|
||||
$societe->setLogo($uploaderService->uploadFile($photo, $directory));
|
||||
}
|
||||
$this->em->persist($societe);
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
return $this->render('backend_admin/societe/add_update.html.twig',['form'=>$form]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/update/{id}', name: 'backend_admin_societe_update')]
|
||||
public function update(Request $request, Societe $societe, UploaderService $uploaderService): Response
|
||||
{
|
||||
$form = $this->createForm(SocieteType::class, $societe);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$photo = $form->get('photo')->getData();
|
||||
if ($photo) {
|
||||
$pathImage = $this->getParameter('societes_directory').'/'.$societe->getLogo();
|
||||
$directory = $this->getParameter('societes_directory');
|
||||
$societe->setLogo($uploaderService->uploadFile($photo, $directory));
|
||||
if(file_exists($pathImage)){
|
||||
unlink($pathImage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->em->persist($societe);
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
return $this->render('backend_admin/societe/add_update.html.twig',['form'=>$form]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/activated/{id}/{active}', name: 'backend_admin_societe_activated')]
|
||||
public function activated(Societe $societe, $active)
|
||||
{
|
||||
$societe->setActive($active);
|
||||
$this->em->persist($societe);
|
||||
$this->em->flush();
|
||||
|
||||
if($active){
|
||||
$this->addFlash('success', ['title'=>'Success', 'message'=>'Société a été bien déactiver']);
|
||||
}else{
|
||||
foreach($societe->getPartenaires() as $partenaire){
|
||||
$partenaire->setActive(false);
|
||||
$this->em->persist($partenaire);
|
||||
}
|
||||
$this->em->flush();
|
||||
$this->addFlash('success', ['title'=>'Success', 'message'=>'Société a été bien activer']);
|
||||
}
|
||||
|
||||
|
||||
return $this->redirectToRoute('backend_admin_societe_index');
|
||||
}
|
||||
|
||||
}
|
||||
84
src/Controller/BackendAdmin/UserController.php
Executable file
84
src/Controller/BackendAdmin/UserController.php
Executable file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendAdmin;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Repository\UserRepository;
|
||||
|
||||
use App\Entity\User;
|
||||
|
||||
#[Route('/backend/admin/user')]
|
||||
class UserController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var UserRepository $userRepository
|
||||
*/
|
||||
private $userRepository;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @param UserRepository $userRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
UserRepository $userRepository,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->userRepository = $userRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
|
||||
#[Route('/index', name: 'backend_admin_user_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
$users = $this->userRepository->findBy(['isDeleted'=> false]);
|
||||
return $this->render('backend_admin/user/index.html.twig',['users'=>$users]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/deleted', name: 'backend_admin_user_deleted')]
|
||||
public function deleted(): Response
|
||||
{
|
||||
$users = $this->userRepository->findBy(['isDeleted'=> true]);
|
||||
return $this->render('backend_admin/user/deleted.html.twig',['users'=>$users]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/update_delete/{id}', name: 'backend_admin_user_update_delete')]
|
||||
public function update_delete(User $user, Request $request)
|
||||
{
|
||||
|
||||
$delete = (boolean)$request->get('delete');
|
||||
|
||||
$user->setIsDeleted($delete);
|
||||
$this->em->persist($user);
|
||||
$this->em->flush();
|
||||
|
||||
|
||||
|
||||
if($delete == true ){
|
||||
$this->addFlash('success', ['title'=>'Success', 'message'=>'Le compte du utilisateur'.$user->getFirstname().' '.$user->getLastname().' a été bien déactiver']);
|
||||
|
||||
}else{
|
||||
$this->addFlash('success', ['title'=>'Success', 'message'=>'Le compte du utilisateur'.$user->getFirstname().' '.$user->getLastname().' a été bien activer']);
|
||||
|
||||
}
|
||||
|
||||
$referer = $request->headers->get('referer');
|
||||
return $this->redirect($referer);
|
||||
}
|
||||
|
||||
}
|
||||
24
src/Controller/BackendPartner/DashboardController.php
Executable file
24
src/Controller/BackendPartner/DashboardController.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendPartner;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/backend/partner/dashboard')]
|
||||
class DashboardController extends AbstractController
|
||||
{
|
||||
#[Route('/index', name: 'backend_partner_dashboard_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('backend_partner/dashboard/index.html.twig', ['titlePage'=> 'Dashboard']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//datatable.html.twig
|
||||
90
src/Controller/BackendPartner/PartenaireController.php
Executable file
90
src/Controller/BackendPartner/PartenaireController.php
Executable file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendPartner;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\Partenaire;
|
||||
|
||||
use App\Repository\PartenaireRepository;
|
||||
|
||||
|
||||
#[Route('/backend/partner/partenaire')]
|
||||
class PartenaireController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @var PartenaireRepository $partenaireRepository
|
||||
*/
|
||||
private $partenaireRepository;
|
||||
|
||||
|
||||
/**
|
||||
* @param EntityManagerInterface $em
|
||||
* @param PartenaireRepository $partenaireRepository
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
partenaireRepository $partenaireRepository
|
||||
){
|
||||
$this->em = $em;
|
||||
$this->partenaireRepository = $partenaireRepository;
|
||||
}
|
||||
|
||||
#[Route('/selected', name: 'backend_partner_partenaire_selected')]
|
||||
public function update_selected(Request $request): Response
|
||||
{
|
||||
$idPartner = $request->get('id_partner');
|
||||
|
||||
$partenaires = $this->getUser()->getPartenairesActive();
|
||||
|
||||
foreach($partenaires as $partenaire){
|
||||
if($idPartner == $partenaire->getId()){
|
||||
$partenaire->setSelected(true);
|
||||
}else{
|
||||
$partenaire->setSelected(false);
|
||||
}
|
||||
$this->em->persist($partenaire);
|
||||
|
||||
}
|
||||
$this->em->flush();
|
||||
|
||||
$referer = $request->headers->get('referer');
|
||||
|
||||
return $this->redirect($referer);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/gestion', name: 'backend_partner_partenaire_gestion')]
|
||||
public function gestion(Request $request): Response
|
||||
{
|
||||
$societe = $this->getUser()->getSelectPartner()->getSociete();
|
||||
//$partenaires = $this->partenaireRepository->findBy();
|
||||
|
||||
return $this->render('backend_partner/partenaire/gestion.html.twig');
|
||||
}
|
||||
|
||||
|
||||
#[Route('/add', name: 'backend_partner_partenaire_add')]
|
||||
public function add(Request $request): Response
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
106
src/Controller/BackendPartner/ReservationListeController.php
Executable file
106
src/Controller/BackendPartner/ReservationListeController.php
Executable file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendPartner;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use App\Entity\Societe;
|
||||
|
||||
use App\Repository\ReservationArticleRepository;
|
||||
use App\Repository\ReservationServiceRepository;
|
||||
|
||||
use App\Repository\ReservationArticleValidationRepository;
|
||||
use App\Repository\ReservationServiceValidationRepository;
|
||||
|
||||
#[Route('/backend/partner/reservation/liste')]
|
||||
class ReservationListeController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @var ReservationArticleRepository $reservationArticleRepository
|
||||
*/
|
||||
private $reservationArticleRepository;
|
||||
|
||||
/**
|
||||
* @var ReservationArticleValidationRepository $reservationArticleValidationRepository
|
||||
*/
|
||||
private $reservationArticleValidationRepository;
|
||||
|
||||
/**
|
||||
* @var ReservationServiceRepository $reservationServiceRepository
|
||||
*/
|
||||
private $reservationServiceRepository;
|
||||
|
||||
/**
|
||||
* @var ReservationServiceValidationRepository $reservationServiceValidationRepository
|
||||
*/
|
||||
private $reservationServiceValidationRepository;
|
||||
|
||||
/**
|
||||
* @param ReservationArticleRepository $reservationArticleRepository
|
||||
* @param ReservationArticleValidationRepository $reservationArticleValidationRepository
|
||||
* @param ReservationServiceRepository $reservationServiceRepository
|
||||
* @param ReservationServiceValidationRepository $reservationServiceValidationRepository
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
ReservationArticleRepository $reservationArticleRepository,
|
||||
ReservationArticleValidationRepository $reservationArticleValidationRepository,
|
||||
ReservationServiceRepository $reservationServiceRepository,
|
||||
ReservationServiceValidationRepository $reservationServiceValidationRepository
|
||||
){
|
||||
|
||||
$this->reservationArticleRepository = $reservationArticleRepository;
|
||||
$this->reservationArticleValidationRepository = $reservationArticleValidationRepository;
|
||||
$this->reservationServiceRepository = $reservationServiceRepository;
|
||||
$this->reservationServiceValidationRepository = $reservationServiceValidationRepository;
|
||||
}
|
||||
|
||||
|
||||
#[Route('/valider', name: 'backend_partner_reservation_liste_valider')]
|
||||
public function valider(Request $request): Response
|
||||
{
|
||||
$societe = $this->getUser()->getSelectPartner()->getSociete();
|
||||
|
||||
$reservationArticleValidations = $this->reservationArticleValidationRepository->findBySociete($societe);
|
||||
|
||||
$reservationServiceValidations = $this->reservationServiceValidationRepository->findBySociete($societe);
|
||||
|
||||
$reservationValidations = array_merge($reservationArticleValidations, $reservationServiceValidations);
|
||||
|
||||
usort($reservationValidations, function($a, $b) {
|
||||
return $a->getDateAdd()->getTimestamp() - $b->getDateAdd()->getTimestamp();
|
||||
});
|
||||
|
||||
return $this->render('backend_partner/reservation/liste_valider.html.twig',[
|
||||
'reservationValidations'=>$reservationValidations
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[Route('/encours', name: 'backend_partner_reservation_liste_encours')]
|
||||
public function encours(Request $request): Response
|
||||
{
|
||||
$societe = $this->getUser()->getSelectPartner()->getSociete();
|
||||
|
||||
$reservationArticles = $this->reservationArticleRepository->findBySociete($societe);
|
||||
|
||||
$reservationServices = $this->reservationServiceRepository->findBySociete($societe);
|
||||
|
||||
$reservations = array_merge($reservationArticles, $reservationServices);
|
||||
|
||||
usort($reservations, function($a, $b) {
|
||||
return $a->getDateAdd()->getTimestamp() - $b->getDateAdd()->getTimestamp();
|
||||
});
|
||||
|
||||
return $this->render('backend_partner/reservation/liste_encours.html.twig', [
|
||||
'reservations'=>$reservations
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
176
src/Controller/BackendPartner/ReservationValiderController.php
Executable file
176
src/Controller/BackendPartner/ReservationValiderController.php
Executable file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\BackendPartner;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Repository\ReservationArticleRepository;
|
||||
use App\Repository\ReservationServiceRepository;
|
||||
|
||||
use App\Entity\ReservationArticleValidation;
|
||||
use App\Entity\ReservationServiceValidation;
|
||||
|
||||
#[Route('/backend/partner/reservation/valider')]
|
||||
class ReservationValiderController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @var ReservationArticleRepository $reservationArticleRepository
|
||||
*/
|
||||
private $reservationArticleRepository;
|
||||
|
||||
/**
|
||||
* @var ReservationServiceRepository $reservationServiceRepository
|
||||
*/
|
||||
private $reservationServiceRepository;
|
||||
|
||||
/**
|
||||
* @param EntityManagerInterface $em
|
||||
* @param ReservationArticleRepository $reservationArticleRepository
|
||||
* @param ReservationServiceRepository $reservationServiceRepository
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
ReservationArticleRepository $reservationArticleRepository,
|
||||
ReservationServiceRepository $reservationServiceRepository
|
||||
){
|
||||
$this->em = $em;
|
||||
$this->reservationArticleRepository = $reservationArticleRepository;
|
||||
$this->reservationServiceRepository = $reservationServiceRepository;
|
||||
}
|
||||
|
||||
#[Route('/valider', name: 'backend_partner_reservation_valider')]
|
||||
public function valider(Request $request): Response
|
||||
{
|
||||
$formArticle = $this->createFormBuilder()
|
||||
->add('reservnumarticle', \Symfony\Component\Form\Extension\Core\Type\TextType::class, ['required' => true])
|
||||
->add('save', \Symfony\Component\Form\Extension\Core\Type\SubmitType::class)
|
||||
->getForm();
|
||||
|
||||
|
||||
$formService = $this->createFormBuilder()
|
||||
->add('reservnumservice', \Symfony\Component\Form\Extension\Core\Type\TextType::class, ['required' => true])
|
||||
->add('save', \Symfony\Component\Form\Extension\Core\Type\SubmitType::class)
|
||||
->getForm();
|
||||
|
||||
return $this->render('backend_partner/reservation/valider.html.twig', ['formArticle'=> $formArticle, 'formService'=>$formService]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/article', name: 'backend_partner_reservation_valider_article')]
|
||||
public function article(Request $request): Response
|
||||
{
|
||||
$data = $request->request->all();
|
||||
if(!isset($data['form']['reservnumarticle'])){
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Numéro Réservation Vide</b>"]);
|
||||
return $this->redirectToRoute('backend_partner_reservation_valider');
|
||||
}
|
||||
|
||||
|
||||
$numReservation = $data['form']['reservnumarticle'];
|
||||
|
||||
if($numReservation){
|
||||
$partner = $this->getUser()->getSelectPartner();
|
||||
|
||||
|
||||
$reservationArticle = $this->reservationArticleRepository->findOneBy(['reference'=>$numReservation]);
|
||||
|
||||
if($reservationArticle){
|
||||
$societe = $reservationArticle->getArticle()->getSociete();
|
||||
$valider = $reservationArticle->getReservationArticleValidation();
|
||||
|
||||
if($partner->getSociete()->getId() != $societe->getId()){
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Incorrect séléct Société (".$societe->getNom().")</b>"]);
|
||||
}else if($valider != null){
|
||||
$dateAdd = $valider->getDateAdd();
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Réservation article déja valider le ".$dateAdd->format('d/m/Y H:i')."</b>"]);
|
||||
}else{
|
||||
$reservationArticleValidation = new ReservationArticleValidation();
|
||||
$reservationArticleValidation->setReservationArticle($reservationArticle);
|
||||
$reservationArticleValidation->setPartenaire($partner);
|
||||
$this->em->persist($reservationArticleValidation);
|
||||
$this->em->flush();
|
||||
if($reservationArticleValidation->getId()){
|
||||
$dateAdd = new \DateTime();
|
||||
$reservationArticle->addEtat("valider", $dateAdd->format('Y-m-d H:i'));
|
||||
$this->em->persist($reservationArticle);
|
||||
$this->em->flush();
|
||||
$this->addFlash('success', ['title'=>'Success', 'message'=>'Réservation article <b>valider</b>']);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Numéro Réservation Incorrect</b>"]);
|
||||
}
|
||||
}else{
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Numéro Réservation Vide</b>"]);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('backend_partner_reservation_valider');
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[Route('/service', name: 'backend_partner_reservation_valider_service')]
|
||||
public function service(Request $request): Response
|
||||
{
|
||||
$data = $request->request->all();
|
||||
if(!isset($data['form']['reservnumservice'])){
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Numéro Réservation Vide</b>"]);
|
||||
return $this->redirectToRoute('backend_partner_reservation_valider');
|
||||
}
|
||||
|
||||
|
||||
$numReservation = $data['form']['reservnumservice'];
|
||||
|
||||
if($numReservation){
|
||||
$partner = $this->getUser()->getSelectPartner();
|
||||
|
||||
|
||||
$reservationService = $this->reservationServiceRepository->findOneBy(['reference'=>$numReservation]);
|
||||
|
||||
if($reservationService){
|
||||
$societe = $reservationService->getService()->getSociete();
|
||||
$valider = $reservationService->getReservationServiceValidation();
|
||||
|
||||
if($partner->getSociete()->getId() != $societe->getId()){
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Incorrect séléct Société (".$societe->getNom().")</b>"]);
|
||||
}else if($valider != null){
|
||||
$dateAdd = $valider->getDateAdd();
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Réservation service déja valider le ".$dateAdd->format('d/m/Y H:i')."</b>"]);
|
||||
}else{
|
||||
$reservationServiceValidation = new ReservationServiceValidation();
|
||||
$reservationServiceValidation->setReservationService($reservationService);
|
||||
$reservationServiceValidation->setPartenaire($partner);
|
||||
$this->em->persist($reservationServiceValidation);
|
||||
$this->em->flush();
|
||||
if($reservationServiceValidation->getId()){
|
||||
$dateAdd = new \DateTime();
|
||||
$reservationService->addEtat("valider", $dateAdd->format('Y-m-d H:i'));
|
||||
$this->em->persist($reservationService);
|
||||
$this->em->flush();
|
||||
$this->addFlash('success', ['title'=>'Success', 'message'=>'Réservation service <b>valider</b>']);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Numéro Réservation Incorrect</b>"]);
|
||||
}
|
||||
}else{
|
||||
$this->addFlash('danger', ['title'=>'Erreur', 'message'=>"<b>Numéro Réservation Vide</b>"]);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('backend_partner_reservation_valider');
|
||||
}
|
||||
|
||||
}
|
||||
74
src/Controller/Frontend/AnnonceController.php
Executable file
74
src/Controller/Frontend/AnnonceController.php
Executable file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use App\Entity\Annonce;
|
||||
use App\Repository\AnnonceRepository;
|
||||
use App\Repository\PositionRepository;
|
||||
|
||||
#[Route('/frontend/annonce')]
|
||||
class AnnonceController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @var AnnonceRepository $annonceRepository
|
||||
*/
|
||||
private $annonceRepository;
|
||||
|
||||
/**
|
||||
* @var PositionRepository $positionRepository
|
||||
*/
|
||||
private $positionRepository;
|
||||
|
||||
|
||||
/**
|
||||
* @param AnnonceRepository $annonceRepository
|
||||
* @param PositionRepository $positionRepository
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
AnnonceRepository $annonceRepository,
|
||||
PositionRepository $positionRepository
|
||||
){
|
||||
$this->annonceRepository = $annonceRepository;
|
||||
$this->positionRepository = $positionRepository;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[Route('/index', name: 'frontend_annonce_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
$annonces = [];
|
||||
|
||||
$positions = $this->positionRepository->getPositionByDate(new \DateTime());
|
||||
|
||||
foreach($positions as $position){
|
||||
$annonce = $position->getAnnonce();
|
||||
$annonces[$annonce->getId()] = $annonce;
|
||||
}
|
||||
|
||||
return $this->render('frontend/annonce/index.html.twig', [
|
||||
'annonces' => $annonces,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/detail/{id}', name: 'frontend_annonce_detail')]
|
||||
public function detail(Annonce $annonce): Response
|
||||
{
|
||||
|
||||
$detailtwig = 'frontend/annonce/detailSimpleImage.html.twig';
|
||||
|
||||
if($annonce->getImageHome() && $annonce->getImageDetail1()){
|
||||
$detailtwig = 'frontend/annonce/detailManyImages.html.twig';
|
||||
}
|
||||
|
||||
return $this->render($detailtwig, [ 'annonce' => $annonce ]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
154
src/Controller/Frontend/ArticleServiceController.php
Executable file
154
src/Controller/Frontend/ArticleServiceController.php
Executable file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use App\Entity\Article;
|
||||
use App\Entity\Service;
|
||||
use App\Entity\ServiceRdvReservation;
|
||||
|
||||
use App\Repository\ArticleRepository;
|
||||
use App\Repository\ServiceRepository;
|
||||
use App\Repository\RdvTempoRepository;
|
||||
use App\Repository\ServiceRdvReservationRepository;
|
||||
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
use Symfony\Component\ExpressionLanguage\Expression;
|
||||
|
||||
#[Route('/frontend/arti-servi')]
|
||||
class ArticleServiceController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @var ArticleRepository $articleRepository
|
||||
*/
|
||||
private $articleRepository;
|
||||
|
||||
/**
|
||||
* @var ServiceRepository $serviceRepository
|
||||
*/
|
||||
private $serviceRepository;
|
||||
|
||||
/**
|
||||
* @var RdvTempoRepository $rdvTempoRepository
|
||||
*/
|
||||
private $rdvTempoRepository;
|
||||
|
||||
/**
|
||||
* @param ArticleRepository $articleRepository
|
||||
* @param PositionRepository $positionRepository
|
||||
* @param RdvTempoRepository $rdvTempoRepository
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
ArticleRepository $articleRepository,
|
||||
ServiceRepository $serviceRepository,
|
||||
RdvTempoRepository $rdvTempoRepository
|
||||
){
|
||||
$this->articleRepository = $articleRepository;
|
||||
$this->serviceRepository = $serviceRepository;
|
||||
$this->rdvTempoRepository = $rdvTempoRepository;
|
||||
}
|
||||
|
||||
|
||||
#[Route('/index', name: 'frontend_article_service_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
$promos = [];
|
||||
|
||||
$articles = $this->articleRepository->show();
|
||||
|
||||
$services = $this->serviceRepository->show();
|
||||
|
||||
$leng = (count($articles)>= count($services)) ? count($articles) : count($services);
|
||||
|
||||
for($i=0; $i<$leng; $i++)
|
||||
{
|
||||
if(isset($articles[$i])){
|
||||
$promos[] = $articles[$i];
|
||||
}
|
||||
|
||||
if(isset($services[$i])){
|
||||
$promos[] = $services[$i];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('frontend/article_service/index.html.twig', [
|
||||
'leng' => $leng,
|
||||
'articles' => $articles,
|
||||
'services' => $services,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/article/detail/{id}', name: 'frontend_article_detail')]
|
||||
#[IsGranted(new Expression('is_granted("ROLE_USER")'))]
|
||||
public function detail_article(Article $article): Response
|
||||
{
|
||||
return $this->render('frontend/article_service/article_detail.html.twig', [
|
||||
'article' => $article,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/service/detail/{id}', name: 'frontend_service_detail')]
|
||||
#[IsGranted(new Expression('is_granted("ROLE_USER")'))]
|
||||
public function detail_service(Service $service): Response
|
||||
{
|
||||
return $this->render('frontend/article_service/service_detail.html.twig', [
|
||||
'service' => $service
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/service/getlistrdv/{id}', name: 'frontend_service_get_list_rdv')]
|
||||
#[IsGranted(new Expression('is_granted("ROLE_USER")'))]
|
||||
public function get_list_rdv(Service $service, ServiceRdvReservationRepository $serviceRdvReservationRepository)
|
||||
{
|
||||
$serviceRdvReservations = $serviceRdvReservationRepository->findBy(['service'=>$service, 'disponible'=> true]);
|
||||
|
||||
$ListIdRdvEncours = $this->rdvTempoRepository->RdvEncoursListId();
|
||||
|
||||
$RendezVous = [];
|
||||
foreach($serviceRdvReservations as $reservation){
|
||||
|
||||
$idRdv = $reservation->getId();
|
||||
|
||||
$Indice = array_search($idRdv, $ListIdRdvEncours);
|
||||
if(!is_numeric($Indice)){
|
||||
$RendezVous[$reservation->getDateDebut()->format('d/m/Y')][] = ['idRdv'=>$idRdv, 'debut'=>$reservation->getDateDebut()->format('H:i'), 'fin'=>$reservation->getDateFin()->format('H:i')];
|
||||
}
|
||||
}
|
||||
|
||||
return new JsonResponse($RendezVous);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#[Route('/service/select/rdv', name: 'frontend_service_select_rdv')]
|
||||
#[IsGranted(new Expression('is_granted("ROLE_USER")'))]
|
||||
public function service_select_rdv(Request $request, ServiceRdvReservationRepository $serviceRdvReservationRepository): Response
|
||||
{
|
||||
$id = $request->get('id');
|
||||
|
||||
$user = $this->getUser();
|
||||
|
||||
$serviceRdvReservation = $serviceRdvReservationRepository->find($id);
|
||||
|
||||
$this->rdvTempoRepository->RdvEncoursAdd($user, $serviceRdvReservation);
|
||||
|
||||
return $this->render('frontend/article_service/service_select_rdv.html.twig', [
|
||||
'serviceRdvReservation'=>$serviceRdvReservation,
|
||||
'user'=> $user
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
43
src/Controller/Frontend/BasicController.php
Executable file
43
src/Controller/Frontend/BasicController.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use App\Repository\GroupeCategorieRepository;
|
||||
|
||||
class BasicController extends AbstractController
|
||||
{
|
||||
#[Route('/frontend/basic/search', name: 'frontend_basic_search')]
|
||||
public function search(GroupeCategorieRepository $groupeRepository, Request $request): Response
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
$paniers = [];
|
||||
$total = $nbr = 0;
|
||||
if($user){
|
||||
$basket = $user->getPanier($request, true);
|
||||
$paniers = $basket['paniers'];
|
||||
$total = $basket['total'];
|
||||
$nbr = $basket['nbr'];
|
||||
}
|
||||
|
||||
return $this->render('frontend/basic/search.html.twig', [
|
||||
'groupes'=>$groupeRepository->findAll(),
|
||||
'paniers' => $paniers,
|
||||
'total' => $total,
|
||||
'nbr'=> $nbr
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/frontend/basic/navbar', name: 'frontend_basic_navbar')]
|
||||
public function navbar(): Response
|
||||
{
|
||||
return $this->render('frontend/basic/navbar.html.twig');
|
||||
}
|
||||
|
||||
}
|
||||
135
src/Controller/Frontend/CommentController.php
Executable file
135
src/Controller/Frontend/CommentController.php
Executable file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
use Symfony\Component\ExpressionLanguage\Expression;
|
||||
|
||||
use App\Form\Frontend\CommentType;
|
||||
|
||||
use App\Entity\Article;
|
||||
use App\Entity\Service;
|
||||
use App\Entity\Annonce;
|
||||
use App\Entity\CommentArticle;
|
||||
use App\Entity\CommentService;
|
||||
use App\Entity\CommentAnnonce;
|
||||
|
||||
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
#[Route('/frontend/comment')]
|
||||
#[IsGranted(new Expression('is_granted("ROLE_USER")'))]
|
||||
class CommentController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
#[Route('/article/add/{id}', name: 'frontend_comment_article_add')]
|
||||
public function article_add(Article $article, Request $request): Response
|
||||
{
|
||||
$id = $article->getId();
|
||||
|
||||
$form = $this->createForm(CommentType::class);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$commentaire = $form->getData()['commentaire'];
|
||||
|
||||
$commentArticle = new CommentArticle();
|
||||
$commentArticle->setCommentaire($commentaire);
|
||||
$commentArticle->setArticle($article);
|
||||
$commentArticle->setClient($this->getUser());
|
||||
|
||||
$this->em->persist($commentArticle);
|
||||
$this->em->flush();
|
||||
|
||||
return $this->redirectToRoute('frontend_article_detail', ['id'=>$id]);
|
||||
}
|
||||
|
||||
return $this->render('frontend/comment/add.html.twig', [
|
||||
'form' => $form,
|
||||
'id' => $id,
|
||||
'pathComment'=> "/frontend/comment/article/add/$id"
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/service/add/{id}', name: 'frontend_comment_service_add')]
|
||||
public function service_add(Service $service, Request $request): Response
|
||||
{
|
||||
$id = $service->getId();
|
||||
$form = $this->createForm(CommentType::class);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$commentaire = $form->getData()['commentaire'];
|
||||
|
||||
$commentService = new CommentService();
|
||||
$commentService->setCommentaire($commentaire);
|
||||
$commentService->setService($service);
|
||||
$commentService->setClient($this->getUser());
|
||||
|
||||
$this->em->persist($commentService);
|
||||
$this->em->flush();
|
||||
|
||||
return $this->redirectToRoute('frontend_service_detail', ['id'=>$id]);
|
||||
}
|
||||
|
||||
return $this->render('frontend/comment/add.html.twig', [
|
||||
'form' => $form,
|
||||
'id' => $id,
|
||||
'pathComment'=> "/frontend/comment/service/add/$id"
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/annonce/add/{id}', name: 'frontend_comment_annonce_add')]
|
||||
public function annonce_add(Annonce $annonce, Request $request): Response
|
||||
{
|
||||
$id = $annonce->getId();
|
||||
|
||||
$form = $this->createForm(CommentType::class);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$commentaire = $form->getData()['commentaire'];
|
||||
|
||||
$commentAnnonce = new CommentAnnonce();
|
||||
$commentAnnonce->setCommentaire($commentaire);
|
||||
$commentAnnonce->setAnnonce($annonce);
|
||||
$commentAnnonce->setClient($this->getUser());
|
||||
|
||||
$this->em->persist($commentAnnonce);
|
||||
$this->em->flush();
|
||||
|
||||
return $this->redirectToRoute('frontend_annonce_detail', ['id'=>$id]);
|
||||
}
|
||||
|
||||
return $this->render('frontend/comment/add.html.twig', [
|
||||
'form' => $form,
|
||||
'id' => $id,
|
||||
'pathComment'=> "/frontend/comment/annonce/add/$id"
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
70
src/Controller/Frontend/DemoController.php
Executable file
70
src/Controller/Frontend/DemoController.php
Executable file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/frontend/demo')]
|
||||
class DemoController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/test', name: 'frontend_demo_test')]
|
||||
public function test(Request $request): Response
|
||||
{
|
||||
return $this->render('frontend/demo/test.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/index', name: 'frontend_demo_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('frontend/demo/index.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/checkbox', name: 'frontend_demo_checkbox')]
|
||||
public function checkbox(): Response
|
||||
{
|
||||
return $this->render('frontend/demo/checkbox.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/radio', name: 'frontend_demo_radio')]
|
||||
public function radio(): Response
|
||||
{
|
||||
return $this->render('frontend/demo/radio.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/404', name: 'frontend_demo_404')]
|
||||
public function demo404(): Response
|
||||
{
|
||||
return $this->render('frontend/demo/404.html.twig');
|
||||
}
|
||||
|
||||
#[Route('/blog', name: 'frontend_demo_blog')]
|
||||
public function blog(): Response
|
||||
{
|
||||
return $this->render('frontend/demo/blog.html.twig');
|
||||
}
|
||||
|
||||
#[Route('/blogdetails', name: 'frontend_demo_blogdetails')]
|
||||
public function blogdetails(): Response
|
||||
{
|
||||
return $this->render('frontend/demo/blogdetails.html.twig');
|
||||
}
|
||||
|
||||
|
||||
#[Route('/blogdetails2', name: 'frontend_demo_blogdetails2')]
|
||||
public function blogdetails2(): Response
|
||||
{
|
||||
return $this->render('frontend/demo/blogdetails2.html.twig');
|
||||
}
|
||||
}
|
||||
99
src/Controller/Frontend/FooterController.php
Executable file
99
src/Controller/Frontend/FooterController.php
Executable file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/frontend/footer')]
|
||||
class FooterController extends AbstractController
|
||||
{
|
||||
|
||||
|
||||
#[Route('/faq', name: 'frontend_footer_faq')]
|
||||
public function faq(): Response
|
||||
{
|
||||
return $this->render('frontend/footer/faq.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/aide', name: 'frontend_footer_aide')]
|
||||
public function aide(): Response
|
||||
{
|
||||
return $this->render('frontend/footer/aide.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/contacter', name: 'frontend_footer_contacter')]
|
||||
public function contacter(): Response
|
||||
{
|
||||
return $this->render('frontend/footer/contacter.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#[Route('/presentation', name: 'frontend_footer_presentation')]
|
||||
public function presentation(): Response
|
||||
{
|
||||
return $this->render('frontend/footer/presentation.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/quisommesnous', name: 'frontend_footer_quisommesnous')]
|
||||
public function quisommesnous(): Response
|
||||
{
|
||||
return $this->render('frontend/footer/quisommesnous.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/mentionslegales', name: 'frontend_footer_mentionslegales')]
|
||||
public function mentionslegales(): Response
|
||||
{
|
||||
return $this->render('frontend/footer/mentionslegales.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#[Route('/nospartenaires', name: 'frontend_footer_nospartenaires')]
|
||||
public function nospartenaires(): Response
|
||||
{
|
||||
return $this->render('frontend/footer/nospartenaires.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/temoignages', name: 'frontend_footer_temoignages')]
|
||||
public function temoignages(): Response
|
||||
{
|
||||
return $this->render('frontend/footer/temoignages.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/nosactualites', name: 'frontend_footer_nosactualites')]
|
||||
public function nosactualites(): Response
|
||||
{
|
||||
return $this->render('frontend/footer/nosactualites.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
122
src/Controller/Frontend/HomeController.php
Executable file
122
src/Controller/Frontend/HomeController.php
Executable file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use App\Repository\GroupeCategorieRepository;
|
||||
use App\Repository\AffichageRepository;
|
||||
|
||||
use App\Entity\GroupeCategorie;
|
||||
use App\Entity\Categorie;
|
||||
|
||||
use App\Service\Frontend\ServiceHome;
|
||||
|
||||
class HomeController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var GroupeCategorieRepository $groupeRepository
|
||||
*/
|
||||
private $groupeRepository;
|
||||
|
||||
/**
|
||||
* @var AffichageRepository $affichageRepository
|
||||
*/
|
||||
private $affichageRepository;
|
||||
|
||||
/**
|
||||
* @param GroupeCategorieRepository $groupeRepository
|
||||
* @param AffichageRepository $affichageRepository
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
GroupeCategorieRepository $groupeRepository,
|
||||
AffichageRepository $affichageRepository
|
||||
){
|
||||
$this->groupeRepository = $groupeRepository;
|
||||
$this->affichageRepository = $affichageRepository;
|
||||
}
|
||||
|
||||
|
||||
#[Route('/', name: 'frontend_home_index')]
|
||||
public function index(ServiceHome $serviceHome): Response
|
||||
{
|
||||
|
||||
return $this->render('frontend/home/index.html.twig', [
|
||||
'shows' => $serviceHome->show(),
|
||||
'groupes' => $this->groupeRepository->findAll()
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/frontend/home/profile', name: 'frontend_home_profile')]
|
||||
public function profile(): Response
|
||||
{
|
||||
|
||||
return $this->render('frontend/home/profile.html.twig', [
|
||||
'titlePage' => 'Inscription',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/frontend/search/groupe/{id}', name: 'frontend_search_groupe')]
|
||||
public function search_groupe(GroupeCategorie $groupeCategorie): Response
|
||||
{
|
||||
$annonces = [];
|
||||
|
||||
$categories = $groupeCategorie->getCategories();
|
||||
foreach($categories as $categorie){
|
||||
foreach($categorie->getAnnonces() as $annonce){
|
||||
if($annonce->isActive()){
|
||||
$annonces[] = $annonce;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$breadcrumbs[] = ['title'=>"Recherche", 'active'=>false, 'link'=>null];
|
||||
$breadcrumbs[] = ['title'=>"Groupe Catégories", 'active'=>false, 'link'=>null];
|
||||
$breadcrumbs[] = ['title'=>$groupeCategorie->getNom(), 'active'=>true, 'link'=>null];
|
||||
|
||||
return $this->render('frontend/home/show-promo.html.twig', [
|
||||
'annonces' => $annonces,
|
||||
'breadcrumbs' => $breadcrumbs
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/frontend/search/categorie/{id}', name: 'frontend_search_categorie')]
|
||||
public function search_categorie(Categorie $categorie): Response
|
||||
{
|
||||
$annonces = [];
|
||||
|
||||
foreach($categorie->getAnnonces() as $annonce){
|
||||
if($annonce->isActive()){
|
||||
$annonces[] = $annonce;
|
||||
}
|
||||
}
|
||||
|
||||
$breadcrumbs[] = ['title'=>"Recherche", 'active'=>false, 'link'=>null];
|
||||
$breadcrumbs[] = ['title'=>"Catégories", 'active'=>false, 'link'=>null];
|
||||
$breadcrumbs[] = ['title'=>$categorie->getNom(), 'active'=>true, 'link'=>null];
|
||||
|
||||
return $this->render('frontend/home/show-promo.html.twig', [
|
||||
'annonces' => $annonces,
|
||||
'breadcrumbs' => $breadcrumbs
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/frontend/search/annonce', name: 'frontend_search_annonce')]
|
||||
public function search_annonce(): Response
|
||||
{
|
||||
$annonces = [];
|
||||
|
||||
return $this->render('frontend/home/show-promo.html.twig', [
|
||||
'annonces' => $annonces,
|
||||
'breadcrumb' => "Accueil"
|
||||
]);
|
||||
}
|
||||
}
|
||||
59
src/Controller/Frontend/NewslettreController.php
Executable file
59
src/Controller/Frontend/NewslettreController.php
Executable file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\Newslettre;
|
||||
|
||||
use App\Repository\NewslettreRepository;
|
||||
use App\Repository\GroupeCategorieRepository;
|
||||
|
||||
|
||||
#[Route('/frontend/newslettre')]
|
||||
class NewslettreController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/index', name: 'frontend_newslettre_index')]
|
||||
public function index(GroupeCategorieRepository $groupeCategorieRepository): Response
|
||||
{
|
||||
$selectNews = [];
|
||||
foreach($this->getUser()->getNewslettres() as $newslettre){
|
||||
$selectNews[] = $newslettre->getRelated();
|
||||
}
|
||||
|
||||
return $this->render('frontend/newslettre/index.html.twig', [
|
||||
'groupes'=>$groupeCategorieRepository->findAll(),
|
||||
'selectNews'=> $selectNews
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/update', name: 'frontend_newslettre_update')]
|
||||
public function update(Request $request, EntityManagerInterface $em, NewslettreRepository $newslettreRepository)
|
||||
{
|
||||
$operation = $request->get('operation');
|
||||
$related = $request->get('related');
|
||||
$user = $this->getUser();
|
||||
|
||||
if($operation == "true"){
|
||||
$newslettre = new Newslettre();
|
||||
$newslettre->setProfile($user);
|
||||
$newslettre->setRelated($related);
|
||||
$em->persist($newslettre);
|
||||
}else{
|
||||
$newslettre = $newslettreRepository->findOneBy(['related'=>$related, 'profile'=>$user]);
|
||||
$em->remove($newslettre);
|
||||
}
|
||||
|
||||
$em->flush();
|
||||
|
||||
return new Response("true");
|
||||
}
|
||||
|
||||
}
|
||||
120
src/Controller/Frontend/PaiementController.php
Executable file
120
src/Controller/Frontend/PaiementController.php
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\ReservationService;
|
||||
use App\Entity\ReservationArticle;
|
||||
|
||||
use App\Repository\ServiceRdvReservationRepository;
|
||||
use App\Repository\ArticleRepository;
|
||||
|
||||
use App\Service\Frontend\ServicePanier;
|
||||
|
||||
#[Route('/frontend/paiement')]
|
||||
class PaiementController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ServiceRdvReservationRepository $serviceRdvReservationRepository
|
||||
*/
|
||||
private $serviceRdvReservationRepository;
|
||||
|
||||
/**
|
||||
* @var ArticleRepository $articleRepository
|
||||
*/
|
||||
private $articleRepository;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @param ServiceRdvReservationRepository $serviceRdvReservationRepository
|
||||
* @param ArticleRepository $articleRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
ServiceRdvReservationRepository $serviceRdvReservationRepository,
|
||||
ArticleRepository $articleRepository,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->serviceRdvReservationRepository = $serviceRdvReservationRepository;
|
||||
$this->articleRepository = $articleRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
|
||||
#[Route('/index', name: 'frontend_paiement_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('frontend/reservation_panier/paiement.html.twig', [
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/valider', name: 'frontend_paiement_valider')]
|
||||
public function valider(Request $request, ServicePanier $servicePanier): Response
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
$paniers = $user->getPanier($request);
|
||||
|
||||
foreach($paniers as $panier){
|
||||
if($panier['type'] == 'SERVICE'){
|
||||
$serviceRdvReservation = $this->serviceRdvReservationRepository->find($panier['idRdv']);
|
||||
$service = $serviceRdvReservation->getService();
|
||||
$reservationService = new ReservationService();
|
||||
$reservationService->setClient($user);
|
||||
$reservationService->setServiceRdvReservation($serviceRdvReservation);
|
||||
$reservationService->setService($service);
|
||||
$reservationService->setPrix($panier['prix']);
|
||||
$reservationService->setAvance($panier['avance']);
|
||||
$reservationService->setFrais($panier['frais']);
|
||||
$reservationService->setData($panier['data']);
|
||||
$reservationService->setDateRdv($serviceRdvReservation->getDateDebut());
|
||||
$reservationService->setEtat(['payer'=>new \DateTime()]);
|
||||
|
||||
$serviceRdvReservation->setDisponible(false);
|
||||
$this->em->persist($serviceRdvReservation);
|
||||
$this->em->persist($reservationService);
|
||||
}elseif($panier['type'] == 'ARTICLE'){
|
||||
$reservationArticle = new ReservationArticle();
|
||||
$article = $this->articleRepository->find($panier['id']);
|
||||
$reservationArticle->setClient($user);
|
||||
$reservationArticle->setArticle($article);
|
||||
|
||||
$reservationArticle->setPrix($panier['prix']);
|
||||
|
||||
$reservationArticle->setAvance($panier['avance']);
|
||||
$reservationArticle->setQuantite($panier['qtyRdv']);
|
||||
|
||||
$reservationArticle->setFrais($panier['frais']);
|
||||
$reservationArticle->setEtat(['payer'=>new \DateTime()]);
|
||||
|
||||
if($article->getLimitType() == 1){
|
||||
$Qty = $article->getLimitQuantite();
|
||||
$Qty -= $panier['qtyRdv'];
|
||||
$article->setLimitQuantite($Qty);
|
||||
$this->em->persist($article);
|
||||
}
|
||||
|
||||
$this->em->persist($reservationArticle);
|
||||
}
|
||||
}
|
||||
$this->em->flush();
|
||||
|
||||
$servicePanier->clear($user);
|
||||
|
||||
return $this->redirectToRoute('frontend_reservation_index');
|
||||
}
|
||||
|
||||
}
|
||||
110
src/Controller/Frontend/PanierController.php
Executable file
110
src/Controller/Frontend/PanierController.php
Executable file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use App\Entity\Article;
|
||||
use App\Entity\ServiceRdvReservation;
|
||||
|
||||
use App\Repository\ArticleRepository;
|
||||
use App\Repository\ServiceRdvReservationRepository;
|
||||
|
||||
#[Route('/frontend/panier')]
|
||||
class PanierController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/index', name: 'frontend_panier_index')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$session = $request->getSession();
|
||||
|
||||
$user = $this->getUser();
|
||||
|
||||
$nameSession = 'Panier-'.$user->getId();
|
||||
|
||||
$paniers = $session->get($nameSession);
|
||||
|
||||
return $this->render('frontend/reservation_panier/panier_index.html.twig', ['paniers'=>$paniers]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/add/article/{id}', name: 'frontend_panier_add_article')]
|
||||
public function add_article(Article $article, Request $request): Response
|
||||
{
|
||||
$qte = $request->get('qty');
|
||||
|
||||
$user = $this->getUser();
|
||||
|
||||
$avance = ($article->getPrixPromo() * $qte * 30) / 100;
|
||||
|
||||
$panier = ['type'=>'ARTICLE',
|
||||
'id'=>$article->getId(),
|
||||
'titre'=>$article->getTitre(),
|
||||
'image'=> "uploads/images/articles/".$article->getImageDefault(),
|
||||
'qtyRdv'=> $qte,
|
||||
'idRdv'=>'',
|
||||
'prix'=>$article->getPrixPromo(),
|
||||
'avance'=> $avance,
|
||||
'frais'=> ($user->getFrais() > 0)? ($article->getPrixPromo() * $qte * $user->getFrais()) / 100 : 0 ,
|
||||
'data'=>[]];
|
||||
|
||||
$user->setPanier($request, $panier);
|
||||
|
||||
$this->addFlash('success', ['title'=>'Success',
|
||||
'message'=>"L'article a été ajouté à votre panier."]);
|
||||
|
||||
$referer = $request->headers->get('referer');
|
||||
|
||||
return $this->redirect($referer);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/add/service/{id}', name: 'frontend_panier_add_service')]
|
||||
public function add_service(Request $request, ServiceRdvReservation $serviceRdvReservation): Response
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
$service = $serviceRdvReservation->getService();
|
||||
|
||||
$data = ['nom'=>$request->get('nom'), 'prenom'=>$request->get('prenom'), 'naissance'=>$request->get('naissance'), 'email'=>$request->get('email')];
|
||||
|
||||
$panier = ['type'=>'SERVICE',
|
||||
'id'=>$service->getId(),
|
||||
'titre'=>$service->getTitre(),
|
||||
'image'=> "uploads/images/services/".$service->getImageDefault(),
|
||||
'qtyRdv'=> $serviceRdvReservation->getDateDebut()->format('d/m/Y H:i'),
|
||||
'idRdv'=>$serviceRdvReservation->getId(),
|
||||
'prix'=>$service->getPrixPromo(),
|
||||
'avance'=> ($service->getPrixPromo() * 30) / 100,
|
||||
'frais'=>($user->getFrais() > 0)? ($service->getPrixPromo() * $user->getFrais()) / 100 : 0,
|
||||
'data'=>$data];
|
||||
|
||||
$user->setPanier($request, $panier);
|
||||
|
||||
return $this->redirectToRoute('frontend_panier_index');
|
||||
}
|
||||
|
||||
|
||||
#[Route('/remove/{idDele}', name: 'frontend_panier_remove')]
|
||||
public function remove(Request $request, int $idDele): Response
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
$id = $user->getId();
|
||||
|
||||
$session = $request->getSession();
|
||||
$sessionName = "Panier-$id";
|
||||
|
||||
$panier = $session->get($sessionName);
|
||||
|
||||
unset($panier[$idDele]);
|
||||
|
||||
$session->set($sessionName, $panier);
|
||||
|
||||
return $this->redirectToRoute('frontend_panier_index');
|
||||
}
|
||||
}
|
||||
89
src/Controller/Frontend/PartenaireController.php
Executable file
89
src/Controller/Frontend/PartenaireController.php
Executable file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use App\Form\BackendAdmin\SocieteType;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Repository\SocieteRepository;
|
||||
|
||||
use App\Service\UploaderService;
|
||||
|
||||
use App\Entity\Societe;
|
||||
use App\Entity\Partenaire;
|
||||
|
||||
#[Route('/frontend/partenaire')]
|
||||
class PartenaireController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var SocieteRepository $societeRepository
|
||||
*/
|
||||
private $societeRepository;
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @param SocieteRepository $societeRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
SocieteRepository $societeRepository,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->societeRepository = $societeRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
#[Route('/societe/add', name: 'frontend_partenaire_societe_add')]
|
||||
public function add(Request $request, UploaderService $uploaderService): Response
|
||||
{
|
||||
$societe = new Societe();
|
||||
|
||||
$form = $this->createForm(SocieteType::class, $societe);
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$photo = $form->get('photo')->getData();
|
||||
if ($photo) {
|
||||
$directory = $this->getParameter('societes_directory');
|
||||
$societe->setLogo($uploaderService->uploadFile($photo, $directory));
|
||||
}
|
||||
$this->em->persist($societe);
|
||||
$this->em->flush();
|
||||
|
||||
$partenaire = new Partenaire();
|
||||
$partenaire->setPartenaire($this->getUser());
|
||||
$partenaire->setSociete($societe);
|
||||
$partenaire->setSelected(true);
|
||||
$partenaire->setRole(1);
|
||||
$this->em->persist($partenaire);
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('success', ['title'=>'Success',
|
||||
'message'=>"Votre demande (Devenir partenaire ) à été enregistrer et envoyer avec succées aux administateurs.
|
||||
Votre demande sera traitée au maxum 24 heur"]);
|
||||
}
|
||||
|
||||
return $this->render('frontend/partenaire/add.html.twig',['form'=>$form]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#[Route('/index', name: 'frontend_partenaire_index')]
|
||||
public function test(Request $request): Response
|
||||
{
|
||||
return $this->render('frontend/partenaire/index.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
}
|
||||
}
|
||||
95
src/Controller/Frontend/ReservationController.php
Executable file
95
src/Controller/Frontend/ReservationController.php
Executable file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use App\Repository\ReservationArticleRepository;
|
||||
use App\Repository\ReservationServiceRepository;
|
||||
|
||||
use App\Entity\ReservationArticle;
|
||||
use App\Entity\ReservationService;
|
||||
|
||||
use App\Service\Frontend\ServiceReservation;
|
||||
|
||||
#[Route('/frontend/reservation')]
|
||||
class ReservationController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ReservationServiceRepository $reservationServiceRepository
|
||||
*/
|
||||
private $reservationServiceRepository;
|
||||
|
||||
/**
|
||||
* @var ReservationArticleRepository $reservationArticleRepository
|
||||
*/
|
||||
private $reservationArticleRepository;
|
||||
|
||||
/**
|
||||
* @var ServiceReservation $serviceReservation
|
||||
*/
|
||||
private $serviceReservation;
|
||||
|
||||
/**
|
||||
* @param ReservationServiceRepository $reservationServiceRepository
|
||||
* @param ReservationArticleRepository $reservationArticleRepository
|
||||
* @param ServiceReservation $serviceReservation
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
ReservationServiceRepository $reservationServiceRepository,
|
||||
ReservationArticleRepository $reservationArticleRepository,
|
||||
ServiceReservation $serviceReservation
|
||||
){
|
||||
$this->reservationServiceRepository = $reservationServiceRepository;
|
||||
$this->reservationArticleRepository = $reservationArticleRepository;
|
||||
$this->serviceReservation = $serviceReservation;
|
||||
}
|
||||
|
||||
#[Route('/index', name: 'frontend_reservation_index')]
|
||||
public function index(): Response
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
$reservationServices = $this->reservationServiceRepository->findBy(['client'=>$user]);
|
||||
$reservationArticles = $this->reservationArticleRepository->findBy(['client'=>$user]);
|
||||
|
||||
$reservations = array_merge($reservationServices, $reservationArticles);
|
||||
|
||||
usort($reservations,function($first,$second){
|
||||
return $first->getDateAdd() < $second->getDateAdd();
|
||||
});
|
||||
|
||||
return $this->render('frontend/reservation_panier/reservation_index.html.twig', [
|
||||
'reservations'=>$reservations
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
#[Route('/export/pdf/article/{id}', name: 'frontend_reservation_export_pdf_article')]
|
||||
public function export_pdf_article(ReservationArticle $reservationArticle): Response
|
||||
{
|
||||
$html = $this->renderView('frontend/reservation_panier/reservation_template_pdf_article.html.twig', ['reservationArticle'=>$reservationArticle]);
|
||||
|
||||
$idReservation = $reservationArticle->getId();
|
||||
$this->serviceReservation->generatePdfFile($html, "réservation_article_$idReservation.pdf");
|
||||
|
||||
return new Response();
|
||||
}
|
||||
|
||||
#[Route('/export/pdf/service/{id}', name: 'frontend_reservation_export_pdf_service')]
|
||||
public function export_pdf_service(ReservationService $reservationService): Response
|
||||
{
|
||||
$idReservation = $reservationService->getId();
|
||||
|
||||
$html = $this->renderView('frontend/reservation_panier/reservation_template_pdf_service.html.twig', ['reservationService'=>$reservationService]);
|
||||
|
||||
$this->serviceReservation->generatePdfFile($html, "réservation_service_$idReservation.pdf");
|
||||
|
||||
return new Response($html);
|
||||
}
|
||||
|
||||
}
|
||||
97
src/Controller/Frontend/SecurityController.php
Normal file
97
src/Controller/Frontend/SecurityController.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
|
||||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
use Symfony\Component\Security\Http\Authentication\UserAuthenticatorInterface;
|
||||
|
||||
use App\Security\LoginAuthenticator;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Entity\Parrainage;
|
||||
|
||||
use App\Form\Frontend\UserRegistrationType;
|
||||
|
||||
class SecurityController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route(path: '/login', name: 'frontend_security_login')]
|
||||
public function login(AuthenticationUtils $authenticationUtils): Response
|
||||
{
|
||||
if ($this->getUser()) {
|
||||
return $this->redirectToRoute('frontend_home_index');
|
||||
}
|
||||
|
||||
// get the login error if there is one
|
||||
$error = $authenticationUtils->getLastAuthenticationError();
|
||||
|
||||
// last username entered by the user
|
||||
$lastUsername = $authenticationUtils->getLastUsername();
|
||||
|
||||
return $this->render('frontend/security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error, 'titlePage' => 'Connexion',]);
|
||||
}
|
||||
|
||||
#[Route(path: '/logout', name: 'frontend_security_logout')]
|
||||
public function logout(): void
|
||||
{
|
||||
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
|
||||
}
|
||||
|
||||
|
||||
#[Route(path: '/registration', name: 'frontend_security_registration')]
|
||||
public function registration(Request $request,
|
||||
UserPasswordHasherInterface $userPasswordHasher,
|
||||
UserAuthenticatorInterface $userAuthenticator,
|
||||
LoginAuthenticator $authenticator,
|
||||
EntityManagerInterface $em,
|
||||
Session $session): Response
|
||||
{
|
||||
$user = new User();
|
||||
|
||||
$form = $this->createForm(UserRegistrationType::class, $user);
|
||||
$form->handleRequest($request);
|
||||
|
||||
|
||||
if($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$user->setPassword($userPasswordHasher->hashPassword($user, $form->get('password')->getData()));
|
||||
|
||||
$em->persist($user);
|
||||
$em->flush();
|
||||
|
||||
$IdOrigine = $session->get('user_parrai');
|
||||
if($IdOrigine){
|
||||
$parrainage = new Parrainage();
|
||||
$parrainage->setNew($user);
|
||||
$orginUser = $em->getRepository(User::class)->find($IdOrigine);
|
||||
$parrainage->setOrigine($orginUser);
|
||||
$em->persist($parrainage);
|
||||
$em->flush();
|
||||
$session->remove('user_parrai');
|
||||
}
|
||||
|
||||
|
||||
return $userAuthenticator->authenticateUser($user, $authenticator, $request);
|
||||
}
|
||||
|
||||
|
||||
return $this->render('frontend/security/register.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'errors' => $form->getErrors(),
|
||||
'titlePage' => 'Inscription',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
161
src/Controller/Frontend/UserController.php
Executable file
161
src/Controller/Frontend/UserController.php
Executable file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Form\Frontend\UserAdresseType;
|
||||
use App\Form\Frontend\UserInfoCnxType;
|
||||
use App\Form\Frontend\UserInfoPersoType;
|
||||
use App\Form\Frontend\UserUpdatePasswordType;
|
||||
|
||||
|
||||
use App\Entity\User;
|
||||
|
||||
/**
|
||||
* @Security("is_granted('ROLE_USER')")
|
||||
*/
|
||||
class UserController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
|
||||
/**
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
#[Route('/frontend/user/edit', name: 'frontend_user_profile')]
|
||||
public function profile(Request $request): Response
|
||||
{
|
||||
|
||||
$user = $this->getUser();
|
||||
|
||||
$formInfoPerso = $this->createForm(UserInfoPersoType::class, $user);
|
||||
$formInfoPerso->handleRequest($request);
|
||||
|
||||
$formInfoAdress = $this->createForm(UserAdresseType::class, $user);
|
||||
$formInfoAdress->handleRequest($request);
|
||||
|
||||
$formInfoCnx = $this->createForm(UserInfoCnxType::class, $user);
|
||||
$formInfoCnx->handleRequest($request);
|
||||
|
||||
if( ($formInfoPerso->isSubmitted() && $formInfoPerso->isValid()) or
|
||||
($formInfoAdress->isSubmitted() && $formInfoAdress->isValid()) or
|
||||
($formInfoCnx->isSubmitted() && $formInfoCnx->isValid())
|
||||
)
|
||||
{
|
||||
$this->em->persist($user);
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
return $this->render('frontend/user/edit.html.twig', [
|
||||
|
||||
'user' => $user,
|
||||
|
||||
'formInfoPerso' => $formInfoPerso->createView(),
|
||||
'errorsInfoPerso' => $formInfoPerso->getErrors(),
|
||||
|
||||
'formInfoAdress' => $formInfoAdress->createView(),
|
||||
'errorsInfoAdress' => $formInfoAdress->getErrors(),
|
||||
|
||||
'formInfoCnx' => $formInfoCnx->createView(),
|
||||
'errorsInfoCnx' => $formInfoCnx->getErrors(),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/frontend/user/update_password', name: 'frontend_user_update_password')]
|
||||
public function update_password(Request $request, UserPasswordHasherInterface $passwordHasher): Response
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
$form = $this->createForm(UserUpdatePasswordType::class);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if($form->isSubmitted() && $form->isValid() ) {
|
||||
|
||||
$plaintextPassword = $form->get('new_password')->getData();
|
||||
|
||||
$hashedPassword = $passwordHasher->hashPassword($user, $plaintextPassword);
|
||||
|
||||
$user->setPassword($hashedPassword);
|
||||
$user->setLastChangePassword(new \DateTime());
|
||||
|
||||
$this->em->persist($user);
|
||||
$this->em->flush();
|
||||
$this->addFlash('success', '');
|
||||
|
||||
return $this->redirectToRoute('frontend_security_logout');
|
||||
}
|
||||
|
||||
return $this->render('frontend/user/update_password.html.twig', [
|
||||
"form"=>$form,
|
||||
'errors' => $form->getErrors(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/frontend/user/delete', name: 'frontend_user_delete')]
|
||||
public function delete(): Response
|
||||
{
|
||||
$user = $this->getUser();
|
||||
$user->setIsDeleted(true);
|
||||
$this->em->persist($user);
|
||||
$this->em->flush();
|
||||
|
||||
return $this->redirectToRoute('frontend_security_logout');
|
||||
}
|
||||
|
||||
|
||||
#[Route('/frontend/user/parrainage', name: 'frontend_user_parrainage')]
|
||||
public function parrainage(Request $request): Response
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
$form = $this->createFormBuilder()
|
||||
->add('email', \Symfony\Component\Form\Extension\Core\Type\EmailType::class)
|
||||
->add('save', \Symfony\Component\Form\Extension\Core\Type\SubmitType::class, ['attr'=>['class'=>'envoyer']])
|
||||
->getForm();
|
||||
|
||||
$hash = openssl_encrypt(json_encode($user->getId()), "AES-128-ECB", $_ENV['APP_SECRET']);
|
||||
$urlParinage = $request->getScheme().'://'.$request->getHttpHost().$request->getBasePath().'/frontend/user_parrai?use='.$hash;
|
||||
|
||||
return $this->render('frontend/user/parrainage.html.twig', [
|
||||
"form"=>$form,
|
||||
"parrainages"=>$user->getParrainages(),
|
||||
"urlParinage"=>$urlParinage
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/frontend/user_parrai', name: 'frontend_user_parrai')]
|
||||
public function user_parrai(Request $request, Session $session): Response
|
||||
{
|
||||
$hash = $request->get('use');
|
||||
|
||||
$plain = openssl_decrypt($hash, "AES-128-ECB", $_ENV['APP_SECRET']);
|
||||
if(is_numeric($plain)){
|
||||
$session->set("user_parrai", $plain);
|
||||
}
|
||||
|
||||
|
||||
return $this->redirectToRoute('frontend_security_registration');
|
||||
}
|
||||
}
|
||||
0
src/Entity/.gitignore
vendored
Executable file
0
src/Entity/.gitignore
vendored
Executable file
145
src/Entity/Affichage.php
Normal file
145
src/Entity/Affichage.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\AffichageRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: AffichageRepository::class)]
|
||||
class Affichage
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'affichages')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Annonce $annonce = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_show = null;
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT)]
|
||||
private ?int $ligne = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'affichages')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Position $position = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $prix = null;
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT)]
|
||||
private ?int $largeur = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getAnnonce(): ?Annonce
|
||||
{
|
||||
return $this->annonce;
|
||||
}
|
||||
|
||||
public function setAnnonce(?Annonce $annonce): static
|
||||
{
|
||||
$this->annonce = $annonce;
|
||||
$this->largeur = $annonce->getLargeur();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateShow(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_show;
|
||||
}
|
||||
|
||||
public function setDateShow(\DateTimeInterface $date_show): static
|
||||
{
|
||||
$this->date_show = $date_show;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLigne(): ?int
|
||||
{
|
||||
return $this->ligne;
|
||||
}
|
||||
|
||||
public function setLigne(int $ligne): static
|
||||
{
|
||||
$this->ligne = $ligne;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPosition(): ?Position
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function setPosition(?Position $position): static
|
||||
{
|
||||
$this->position = $position;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrix(): ?float
|
||||
{
|
||||
return $this->prix;
|
||||
}
|
||||
|
||||
public function setPrix(float $prix): static
|
||||
{
|
||||
$this->prix = $prix;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLigneRange()
|
||||
{
|
||||
switch ($this->ligne):
|
||||
case 1:
|
||||
return "A";
|
||||
case 2:
|
||||
return "B";
|
||||
case 3:
|
||||
return "C";
|
||||
case 4:
|
||||
return "D";
|
||||
case 5:
|
||||
return "E";
|
||||
case 6:
|
||||
return "F";
|
||||
case 7:
|
||||
return "G";
|
||||
case 8:
|
||||
return "H";
|
||||
case 9:
|
||||
return "I";
|
||||
case 10:
|
||||
return "J";
|
||||
case 11:
|
||||
return "K";
|
||||
case 12:
|
||||
return "L";
|
||||
case 12:
|
||||
return "M";
|
||||
endswitch;
|
||||
}
|
||||
|
||||
public function getLargeur(): ?int
|
||||
{
|
||||
return $this->largeur;
|
||||
}
|
||||
|
||||
public function setLargeur(int $largeur): static
|
||||
{
|
||||
$this->largeur = $largeur;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
478
src/Entity/Annonce.php
Normal file
478
src/Entity/Annonce.php
Normal file
@@ -0,0 +1,478 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\AnnonceRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: AnnonceRepository::class)]
|
||||
class Annonce
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 300)]
|
||||
private ?string $titre = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?float $prix_marche = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $prix_promo = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?float $pourcentage_reduction = null;
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT)]
|
||||
private ?int $largeur = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $active = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'annonces')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Societe $societe = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $create_by = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_update = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'annonces')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Categorie $categorie = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'annonce', targetEntity: Position::class)]
|
||||
private Collection $positions;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'annonce', targetEntity: Affichage::class)]
|
||||
private Collection $affichages;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_home = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_search = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_1 = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_2 = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_3 = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_4 = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $complet = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'annonce', targetEntity: CommentAnnonce::class)]
|
||||
#[ORM\OrderBy(['id' => 'DESC'])]
|
||||
private Collection $commentAnnonces;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->active = true;
|
||||
$this->complet = false;
|
||||
$this->date_add = new \DateTime();
|
||||
$this->date_update = new \DateTime();
|
||||
$this->positions = new ArrayCollection();
|
||||
$this->affichages = new ArrayCollection();
|
||||
$this->commentAnnonces = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getTitre(): ?string
|
||||
{
|
||||
return $this->titre;
|
||||
}
|
||||
|
||||
public function setTitre(string $titre): self
|
||||
{
|
||||
$this->titre = $titre;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(string $description): self
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrixMarche(): ?float
|
||||
{
|
||||
return $this->prix_marche;
|
||||
}
|
||||
|
||||
public function setPrixMarche(?float $prix_marche): self
|
||||
{
|
||||
$this->prix_marche = $prix_marche;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrixPromo(): ?float
|
||||
{
|
||||
return $this->prix_promo;
|
||||
}
|
||||
|
||||
public function setPrixPromo(float $prix_promo): self
|
||||
{
|
||||
$this->prix_promo = $prix_promo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPourcentageReduction(): ?float
|
||||
{
|
||||
return $this->pourcentage_reduction;
|
||||
}
|
||||
|
||||
public function setPourcentageReduction(?float $pourcentage_reduction): self
|
||||
{
|
||||
$this->pourcentage_reduction = $pourcentage_reduction;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): self
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isActive(): ?bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function setActive(bool $active): self
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSociete(): ?Societe
|
||||
{
|
||||
return $this->societe;
|
||||
}
|
||||
|
||||
public function setSociete(?Societe $societe): self
|
||||
{
|
||||
$this->societe = $societe;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreateBy(): ?User
|
||||
{
|
||||
return $this->create_by;
|
||||
}
|
||||
|
||||
public function setCreateBy(?User $create_by): self
|
||||
{
|
||||
$this->create_by = $create_by;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateUpdate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_update;
|
||||
}
|
||||
|
||||
public function setDateUpdate(\DateTimeInterface $date_update): static
|
||||
{
|
||||
$this->date_update = $date_update;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCategorie(): ?Categorie
|
||||
{
|
||||
return $this->categorie;
|
||||
}
|
||||
|
||||
public function setCategorie(?Categorie $categorie): static
|
||||
{
|
||||
$this->categorie = $categorie;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Position>
|
||||
*/
|
||||
public function getPositions(): Collection
|
||||
{
|
||||
return $this->positions;
|
||||
}
|
||||
|
||||
public function addPosition(Position $position): static
|
||||
{
|
||||
if (!$this->positions->contains($position)) {
|
||||
$this->positions->add($position);
|
||||
$position->setAnnonce($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePosition(Position $position): static
|
||||
{
|
||||
if ($this->positions->removeElement($position)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($position->getAnnonce() === $this) {
|
||||
$position->setAnnonce(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLargeur(): ?int
|
||||
{
|
||||
return $this->largeur;
|
||||
}
|
||||
|
||||
public function setLargeur(int $largeur): static
|
||||
{
|
||||
$this->largeur = $largeur;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDimension(): ?string
|
||||
{
|
||||
if($this->largeur == 1){
|
||||
return "1/4 (438 * 240) pixels";
|
||||
}elseif($this->largeur == 2){
|
||||
return "2/4 (876 * 240) pixels";
|
||||
}elseif($this->largeur == 3){
|
||||
return "3/4 (1314 * 240) pixels";
|
||||
}elseif($this->largeur == 4){
|
||||
return "4/4 (1752 * 240) pixels";
|
||||
}
|
||||
}
|
||||
|
||||
public function getDimensionWidth(): ?string
|
||||
{
|
||||
if($this->largeur == 1){
|
||||
return 438;
|
||||
}elseif($this->largeur == 2){
|
||||
return 876;
|
||||
}elseif($this->largeur == 3){
|
||||
return 1314;
|
||||
}elseif($this->largeur == 4){
|
||||
return 1752;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Affichage>
|
||||
*/
|
||||
public function getAffichages(): Collection
|
||||
{
|
||||
return $this->affichages;
|
||||
}
|
||||
|
||||
public function addAffichage(Affichage $affichage): static
|
||||
{
|
||||
if (!$this->affichages->contains($affichage)) {
|
||||
$this->affichages->add($affichage);
|
||||
$affichage->setAnnonce($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeAffichage(Affichage $affichage): static
|
||||
{
|
||||
if ($this->affichages->removeElement($affichage)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($affichage->getAnnonce() === $this) {
|
||||
$affichage->setAnnonce(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageHome(): ?string
|
||||
{
|
||||
return $this->image_home;
|
||||
}
|
||||
|
||||
public function setImageHome(?string $image_home): static
|
||||
{
|
||||
$this->image_home = $image_home;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageSearch(): ?string
|
||||
{
|
||||
return $this->image_search;
|
||||
}
|
||||
|
||||
public function setImageSearch(?string $image_search): static
|
||||
{
|
||||
$this->image_search = $image_search;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail1(): ?string
|
||||
{
|
||||
return $this->image_detail_1;
|
||||
}
|
||||
|
||||
public function setImageDetail1(?string $image_detail_1): static
|
||||
{
|
||||
$this->image_detail_1 = $image_detail_1;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail2(): ?string
|
||||
{
|
||||
return $this->image_detail_2;
|
||||
}
|
||||
|
||||
public function setImageDetail2(?string $image_detail_2): static
|
||||
{
|
||||
$this->image_detail_2 = $image_detail_2;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail3(): ?string
|
||||
{
|
||||
return $this->image_detail_3;
|
||||
}
|
||||
|
||||
public function setImageDetail3(?string $image_detail_3): static
|
||||
{
|
||||
$this->image_detail_3 = $image_detail_3;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail4(): ?string
|
||||
{
|
||||
return $this->image_detail_4;
|
||||
}
|
||||
|
||||
public function setImageDetail4(?string $image_detail_4): static
|
||||
{
|
||||
$this->image_detail_4 = $image_detail_4;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAllImage(): ?array
|
||||
{
|
||||
$ListImg = [];
|
||||
|
||||
if($this->image_search) $ListImg[] = $this->image_search;
|
||||
if($this->image_home) $ListImg[] = $this->image_home;
|
||||
if($this->image_detail_1) $ListImg[] = $this->image_detail_1;
|
||||
if($this->image_detail_2) $ListImg[] = $this->image_detail_2;
|
||||
if($this->image_detail_3) $ListImg[] = $this->image_detail_3;
|
||||
if($this->image_detail_4) $ListImg[] = $this->image_detail_4;
|
||||
|
||||
return $ListImg;
|
||||
}
|
||||
|
||||
public function isComplet(): ?bool
|
||||
{
|
||||
return $this->complet;
|
||||
}
|
||||
|
||||
public function setComplet(bool $complet): static
|
||||
{
|
||||
$this->complet = $complet;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function checkComplet(): static
|
||||
{
|
||||
if( ($this->image_home!="") &&
|
||||
($this->image_search!="") &&
|
||||
($this->image_detail_1!="")
|
||||
)
|
||||
{
|
||||
$this->complet = true;
|
||||
}else{
|
||||
$this->complet = false;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, CommentAnnonce>
|
||||
*/
|
||||
public function getCommentAnnonces(): Collection
|
||||
{
|
||||
return $this->commentAnnonces;
|
||||
}
|
||||
|
||||
public function addCommentAnnonce(CommentAnnonce $commentAnnonce): static
|
||||
{
|
||||
if (!$this->commentAnnonces->contains($commentAnnonce)) {
|
||||
$this->commentAnnonces->add($commentAnnonce);
|
||||
$commentAnnonce->setAnnonce($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCommentAnnonce(CommentAnnonce $commentAnnonce): static
|
||||
{
|
||||
if ($this->commentAnnonces->removeElement($commentAnnonce)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($commentAnnonce->getAnnonce() === $this) {
|
||||
$commentAnnonce->setAnnonce(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
419
src/Entity/Article.php
Normal file
419
src/Entity/Article.php
Normal file
@@ -0,0 +1,419 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ArticleRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ArticleRepository::class)]
|
||||
class Article
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $titre = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $marque = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?float $prix_marche = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $prix_promo = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $adress = null;
|
||||
|
||||
// 'Limitation par date'=> 0 | 'Limitation par quantité'=> 1
|
||||
#[ORM\Column(type: Types::SMALLINT)]
|
||||
private ?int $limit_type = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $limit_date = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $limit_quantite = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_default = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_1 = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_2 = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_3 = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_4 = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_update = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'articles')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Societe $societe = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $active = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'articles')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Categorie $categorie = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'articles')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $create_by = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'article', targetEntity: ReservationArticle::class)]
|
||||
private Collection $reservationArticles;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'article', targetEntity: CommentArticle::class)]
|
||||
#[ORM\OrderBy(['id' => 'DESC'])]
|
||||
private Collection $commentArticles;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->active = false;
|
||||
$this->date_add = new \DateTime();
|
||||
$this->date_update = new \DateTime();
|
||||
$this->reservationArticles = new ArrayCollection();
|
||||
$this->commentArticles = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getTitre(): ?string
|
||||
{
|
||||
return $this->titre;
|
||||
}
|
||||
|
||||
public function setTitre(string $titre): static
|
||||
{
|
||||
$this->titre = $titre;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMarque(): ?string
|
||||
{
|
||||
return $this->marque;
|
||||
}
|
||||
|
||||
public function setMarque(string $marque): static
|
||||
{
|
||||
$this->marque = $marque;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrixMarche(): ?float
|
||||
{
|
||||
return $this->prix_marche;
|
||||
}
|
||||
|
||||
public function setPrixMarche(?float $prix_marche): self
|
||||
{
|
||||
$this->prix_marche = $prix_marche;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrixPromo(): ?float
|
||||
{
|
||||
return $this->prix_promo;
|
||||
}
|
||||
|
||||
public function setPrixPromo(float $prix_promo): self
|
||||
{
|
||||
$this->prix_promo = $prix_promo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAdress(): ?string
|
||||
{
|
||||
return $this->adress;
|
||||
}
|
||||
|
||||
public function setAdress(?string $adress): static
|
||||
{
|
||||
$this->adress = $adress;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLimitType(): ?int
|
||||
{
|
||||
return $this->limit_type;
|
||||
}
|
||||
|
||||
public function setLimitType(int $limit_type): static
|
||||
{
|
||||
$this->limit_type = $limit_type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLimitDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->limit_date;
|
||||
}
|
||||
|
||||
public function setLimitDate(?\DateTimeInterface $limit_date): static
|
||||
{
|
||||
$this->limit_date = $limit_date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLimitQuantite(): ?int
|
||||
{
|
||||
return $this->limit_quantite;
|
||||
}
|
||||
|
||||
public function setLimitQuantite(?int $limit_quantite): static
|
||||
{
|
||||
$this->limit_quantite = $limit_quantite;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDefault(): ?string
|
||||
{
|
||||
return $this->image_default;
|
||||
}
|
||||
|
||||
public function setImageDefault(?string $image_default): static
|
||||
{
|
||||
$this->image_default = $image_default;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail1(): ?string
|
||||
{
|
||||
return $this->image_detail_1;
|
||||
}
|
||||
|
||||
public function setImageDetail1(?string $image_detail_1): static
|
||||
{
|
||||
$this->image_detail_1 = $image_detail_1;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail2(): ?string
|
||||
{
|
||||
return $this->image_detail_2;
|
||||
}
|
||||
|
||||
public function setImageDetail2(?string $image_detail_2): static
|
||||
{
|
||||
$this->image_detail_2 = $image_detail_2;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail3(): ?string
|
||||
{
|
||||
return $this->image_detail_3;
|
||||
}
|
||||
|
||||
public function setImageDetail3(?string $image_detail_3): static
|
||||
{
|
||||
$this->image_detail_3 = $image_detail_3;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail4(): ?string
|
||||
{
|
||||
return $this->image_detail_4;
|
||||
}
|
||||
|
||||
public function setImageDetail4(?string $image_detail_4): static
|
||||
{
|
||||
$this->image_detail_4 = $image_detail_4;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAllImage(): ?array
|
||||
{
|
||||
$ListImg = [];
|
||||
|
||||
if($this->image_default) $ListImg[] = $this->image_default;
|
||||
if($this->image_detail_1) $ListImg[] = $this->image_detail_1;
|
||||
if($this->image_detail_2) $ListImg[] = $this->image_detail_2;
|
||||
if($this->image_detail_3) $ListImg[] = $this->image_detail_3;
|
||||
if($this->image_detail_4) $ListImg[] = $this->image_detail_4;
|
||||
|
||||
return $ListImg;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateUpdate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_update;
|
||||
}
|
||||
|
||||
public function setDateUpdate(\DateTimeInterface $date_update): static
|
||||
{
|
||||
$this->date_update = $date_update;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSociete(): ?Societe
|
||||
{
|
||||
return $this->societe;
|
||||
}
|
||||
|
||||
public function setSociete(?Societe $societe): static
|
||||
{
|
||||
$this->societe = $societe;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isActive(): ?bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function setActive(bool $active): static
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCategorie(): ?Categorie
|
||||
{
|
||||
return $this->categorie;
|
||||
}
|
||||
|
||||
public function setCategorie(?Categorie $categorie): static
|
||||
{
|
||||
$this->categorie = $categorie;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreateBy(): ?User
|
||||
{
|
||||
return $this->create_by;
|
||||
}
|
||||
|
||||
public function setCreateBy(?User $create_by): static
|
||||
{
|
||||
$this->create_by = $create_by;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ReservationArticle>
|
||||
*/
|
||||
public function getReservationArticles(): Collection
|
||||
{
|
||||
return $this->reservationArticles;
|
||||
}
|
||||
|
||||
public function addReservationArticle(ReservationArticle $reservationArticle): static
|
||||
{
|
||||
if (!$this->reservationArticles->contains($reservationArticle)) {
|
||||
$this->reservationArticles->add($reservationArticle);
|
||||
$reservationArticle->setArticle($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeReservationArticle(ReservationArticle $reservationArticle): static
|
||||
{
|
||||
if ($this->reservationArticles->removeElement($reservationArticle)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($reservationArticle->getArticle() === $this) {
|
||||
$reservationArticle->setArticle(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, CommentArticle>
|
||||
*/
|
||||
public function getCommentArticles(): Collection
|
||||
{
|
||||
return $this->commentArticles;
|
||||
}
|
||||
|
||||
public function addCommentArticle(CommentArticle $commentArticle): static
|
||||
{
|
||||
if (!$this->commentArticles->contains($commentArticle)) {
|
||||
$this->commentArticles->add($commentArticle);
|
||||
$commentArticle->setArticle($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCommentArticle(CommentArticle $commentArticle): static
|
||||
{
|
||||
if ($this->commentArticles->removeElement($commentArticle)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($commentArticle->getArticle() === $this) {
|
||||
$commentArticle->setArticle(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
159
src/Entity/Categorie.php
Normal file
159
src/Entity/Categorie.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\CategorieRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: CategorieRepository::class)]
|
||||
class Categorie
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255, unique:true)]
|
||||
private ?string $nom = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'categories')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?GroupeCategorie $groupeCategorie = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'categorie', targetEntity: Annonce::class)]
|
||||
private Collection $annonces;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'categorie', targetEntity: Article::class)]
|
||||
private Collection $articles;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'categorie', targetEntity: Service::class)]
|
||||
private Collection $services;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->annonces = new ArrayCollection();
|
||||
$this->articles = new ArrayCollection();
|
||||
$this->services = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getNom(): ?string
|
||||
{
|
||||
return $this->nom;
|
||||
}
|
||||
|
||||
public function setNom(string $nom): static
|
||||
{
|
||||
$this->nom = $nom;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getGroupeCategorie(): ?GroupeCategorie
|
||||
{
|
||||
return $this->groupeCategorie;
|
||||
}
|
||||
|
||||
public function setGroupeCategorie(?GroupeCategorie $groupeCategorie): static
|
||||
{
|
||||
$this->groupeCategorie = $groupeCategorie;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Annonce>
|
||||
*/
|
||||
public function getAnnonces(): Collection
|
||||
{
|
||||
return $this->annonces;
|
||||
}
|
||||
|
||||
public function addAnnonce(Annonce $annonce): static
|
||||
{
|
||||
if (!$this->annonces->contains($annonce)) {
|
||||
$this->annonces->add($annonce);
|
||||
$annonce->setCategorie($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeAnnonce(Annonce $annonce): static
|
||||
{
|
||||
if ($this->annonces->removeElement($annonce)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($annonce->getCategorie() === $this) {
|
||||
$annonce->setCategorie(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Article>
|
||||
*/
|
||||
public function getArticles(): Collection
|
||||
{
|
||||
return $this->articles;
|
||||
}
|
||||
|
||||
public function addArticle(Article $article): static
|
||||
{
|
||||
if (!$this->articles->contains($article)) {
|
||||
$this->articles->add($article);
|
||||
$article->setCategorie($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeArticle(Article $article): static
|
||||
{
|
||||
if ($this->articles->removeElement($article)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($article->getCategorie() === $this) {
|
||||
$article->setCategorie(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Service>
|
||||
*/
|
||||
public function getServices(): Collection
|
||||
{
|
||||
return $this->services;
|
||||
}
|
||||
|
||||
public function addService(Service $service): static
|
||||
{
|
||||
if (!$this->services->contains($service)) {
|
||||
$this->services->add($service);
|
||||
$service->setCategorie($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeService(Service $service): static
|
||||
{
|
||||
if ($this->services->removeElement($service)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($service->getCategorie() === $this) {
|
||||
$service->setCategorie(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
104
src/Entity/CommentAnnonce.php
Normal file
104
src/Entity/CommentAnnonce.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\CommentAnnonceRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: CommentAnnonceRepository::class)]
|
||||
class CommentAnnonce
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'commentAnnonces')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $client = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'commentAnnonces')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Annonce $annonce = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $commentaire = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $active = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_add = new \DateTime();
|
||||
$this->active = true;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getClient(): ?User
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function setClient(?User $client): static
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAnnonce(): ?Annonce
|
||||
{
|
||||
return $this->annonce;
|
||||
}
|
||||
|
||||
public function setAnnonce(?Annonce $annonce): static
|
||||
{
|
||||
$this->annonce = $annonce;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCommentaire(): ?string
|
||||
{
|
||||
return $this->commentaire;
|
||||
}
|
||||
|
||||
public function setCommentaire(string $commentaire): static
|
||||
{
|
||||
$this->commentaire = $commentaire;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isActive(): ?bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function setActive(bool $active): static
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
104
src/Entity/CommentArticle.php
Normal file
104
src/Entity/CommentArticle.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\CommentArticleRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: CommentArticleRepository::class)]
|
||||
class CommentArticle
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'commentArticles')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $client = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'commentArticles')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Article $article = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $commentaire = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $active = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_add = new \DateTime();
|
||||
$this->active = true;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getClient(): ?User
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function setClient(?User $client): static
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getArticle(): ?Article
|
||||
{
|
||||
return $this->article;
|
||||
}
|
||||
|
||||
public function setArticle(?Article $article): static
|
||||
{
|
||||
$this->article = $article;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCommentaire(): ?string
|
||||
{
|
||||
return $this->commentaire;
|
||||
}
|
||||
|
||||
public function setCommentaire(string $commentaire): static
|
||||
{
|
||||
$this->commentaire = $commentaire;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isActive(): ?bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function setActive(bool $active): static
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
104
src/Entity/CommentService.php
Normal file
104
src/Entity/CommentService.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\CommentServiceRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: CommentServiceRepository::class)]
|
||||
class CommentService
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'commentServices')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $client = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'commentServices')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Service $service = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $commentaire = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $active = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_add = new \DateTime();
|
||||
$this->active = true;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getClient(): ?User
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function setClient(?User $client): static
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getService(): ?Service
|
||||
{
|
||||
return $this->service;
|
||||
}
|
||||
|
||||
public function setService(?Service $service): static
|
||||
{
|
||||
$this->service = $service;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCommentaire(): ?string
|
||||
{
|
||||
return $this->commentaire;
|
||||
}
|
||||
|
||||
public function setCommentaire(string $commentaire): static
|
||||
{
|
||||
$this->commentaire = $commentaire;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isActive(): ?bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function setActive(bool $active): static
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
105
src/Entity/GroupeCategorie.php
Normal file
105
src/Entity/GroupeCategorie.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\GroupeCategorieRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: GroupeCategorieRepository::class)]
|
||||
class GroupeCategorie
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255, unique:true)]
|
||||
private ?string $nom = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'groupeCategorie', targetEntity: Categorie::class)]
|
||||
private Collection $categories;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $icon_fontawesome = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->categories = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getNom(): ?string
|
||||
{
|
||||
return $this->nom;
|
||||
}
|
||||
|
||||
public function setNom(string $nom): static
|
||||
{
|
||||
$this->nom = $nom;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Categorie>
|
||||
*/
|
||||
public function getCategories(): Collection
|
||||
{
|
||||
return $this->categories;
|
||||
}
|
||||
|
||||
public function addCategory(Categorie $category): static
|
||||
{
|
||||
if (!$this->categories->contains($category)) {
|
||||
$this->categories->add($category);
|
||||
$category->setGroupeCategorie($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCategory(Categorie $category): static
|
||||
{
|
||||
if ($this->categories->removeElement($category)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($category->getGroupeCategorie() === $this) {
|
||||
$category->setGroupeCategorie(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIconFontawesome(): ?string
|
||||
{
|
||||
return $this->icon_fontawesome;
|
||||
}
|
||||
|
||||
public function setIconFontawesome(?string $icon_fontawesome): static
|
||||
{
|
||||
$this->icon_fontawesome = $icon_fontawesome;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImage(): ?string
|
||||
{
|
||||
return $this->image;
|
||||
}
|
||||
|
||||
public function setImage(?string $image): static
|
||||
{
|
||||
$this->image = $image;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
138
src/Entity/Ligne.php
Normal file
138
src/Entity/Ligne.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\LigneRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: LigneRepository::class)]
|
||||
class Ligne
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 1)]
|
||||
private ?string $rang = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $prix_dim_1 = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $prix_dim_2 = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $prix_dim_3 = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $prix_dim_4 = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_update = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'lignes')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $create_by = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getRang(): ?string
|
||||
{
|
||||
return $this->rang;
|
||||
}
|
||||
|
||||
public function setRang(string $rang): static
|
||||
{
|
||||
$this->rang = $rang;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrixDim1(): ?float
|
||||
{
|
||||
return $this->prix_dim_1;
|
||||
}
|
||||
|
||||
public function setPrixDim1(float $prix_dim_1): static
|
||||
{
|
||||
$this->prix_dim_1 = $prix_dim_1;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrixDim2(): ?float
|
||||
{
|
||||
return $this->prix_dim_2;
|
||||
}
|
||||
|
||||
public function setPrixDim2(float $prix_dim_2): static
|
||||
{
|
||||
$this->prix_dim_2 = $prix_dim_2;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrixDim3(): ?float
|
||||
{
|
||||
return $this->prix_dim_3;
|
||||
}
|
||||
|
||||
public function setPrixDim3(float $prix_dim_3): static
|
||||
{
|
||||
$this->prix_dim_3 = $prix_dim_3;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrixDim4(): ?float
|
||||
{
|
||||
return $this->prix_dim_4;
|
||||
}
|
||||
|
||||
public function setPrixDim4(float $prix_dim_4): static
|
||||
{
|
||||
$this->prix_dim_4 = $prix_dim_4;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrixByBimension(int $dim): ?float
|
||||
{
|
||||
return match ($dim) {
|
||||
1 => $this->prix_dim_1,
|
||||
2 => $this->prix_dim_2,
|
||||
3 => $this->prix_dim_3,
|
||||
4 => $this->prix_dim_4,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public function getDateUpdate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_update;
|
||||
}
|
||||
|
||||
public function setDateUpdate(\DateTimeInterface $date_update): static
|
||||
{
|
||||
$this->date_update = $date_update;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreateBy(): ?User
|
||||
{
|
||||
return $this->create_by;
|
||||
}
|
||||
|
||||
public function setCreateBy(?User $create_by): static
|
||||
{
|
||||
$this->create_by = $create_by;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
73
src/Entity/Newslettre.php
Normal file
73
src/Entity/Newslettre.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\NewslettreRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: NewslettreRepository::class)]
|
||||
class Newslettre
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $related = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'newslettres')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $profile = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_add = new \DateTime();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getRelated(): ?int
|
||||
{
|
||||
return $this->related;
|
||||
}
|
||||
|
||||
public function setRelated(int $related): static
|
||||
{
|
||||
$this->related = $related;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProfile(): ?User
|
||||
{
|
||||
return $this->profile;
|
||||
}
|
||||
|
||||
public function setProfile(?User $profile): static
|
||||
{
|
||||
$this->profile = $profile;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
74
src/Entity/Parrainage.php
Normal file
74
src/Entity/Parrainage.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ParrainageRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ParrainageRepository::class)]
|
||||
class Parrainage
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'parrainages')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $origine = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $new = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $add = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->add = new \DateTime();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getOrigine(): ?User
|
||||
{
|
||||
return $this->origine;
|
||||
}
|
||||
|
||||
public function setOrigine(?User $origine): static
|
||||
{
|
||||
$this->origine = $origine;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNew(): ?User
|
||||
{
|
||||
return $this->new;
|
||||
}
|
||||
|
||||
public function setNew(?User $new): static
|
||||
{
|
||||
$this->new = $new;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->add;
|
||||
}
|
||||
|
||||
public function setAdd(\DateTimeInterface $add): static
|
||||
{
|
||||
$this->add = $add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
239
src/Entity/Partenaire.php
Executable file
239
src/Entity/Partenaire.php
Executable file
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\PartenaireRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: PartenaireRepository::class)]
|
||||
class Partenaire
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'partenaires')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $partenaire = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'partenaires')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Societe $societe = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $active = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
private ?User $admin = null;
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT)]
|
||||
private ?int $role = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $notifier = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?array $access = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'partenaire', targetEntity: ReservationArticleValidation::class)]
|
||||
private Collection $reservationArticleValidations;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $selected = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'partenaire', targetEntity: ReservationServiceValidation::class)]
|
||||
private Collection $reservationServiceValidations;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->active = false;
|
||||
$this->notifier = false;
|
||||
$this->selected = false;
|
||||
$this->role = 1; // 1 ROLE_PARTNER_ADVANCED | 2 ROLE_PARTNER
|
||||
$this->date_add = new \DateTime();
|
||||
$this->reservationArticleValidations = new ArrayCollection();
|
||||
$this->reservationServiceValidations = new ArrayCollection();
|
||||
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getPartenaire(): ?User
|
||||
{
|
||||
return $this->partenaire;
|
||||
}
|
||||
|
||||
public function setPartenaire(?User $partenaire): static
|
||||
{
|
||||
$this->partenaire = $partenaire;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSociete(): ?Societe
|
||||
{
|
||||
return $this->societe;
|
||||
}
|
||||
|
||||
public function setSociete(?Societe $societe): static
|
||||
{
|
||||
$this->societe = $societe;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isActive(): ?bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function setActive(bool $active): static
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAdmin(): ?User
|
||||
{
|
||||
return $this->admin;
|
||||
}
|
||||
|
||||
public function setAdmin(?User $admin): static
|
||||
{
|
||||
$this->admin = $admin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRole(): ?int
|
||||
{
|
||||
return $this->role;
|
||||
}
|
||||
|
||||
public function setRole(int $role): static
|
||||
{
|
||||
$this->role = $role;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isNotifier(): ?bool
|
||||
{
|
||||
return $this->notifier;
|
||||
}
|
||||
|
||||
public function setNotifier(bool $notifier): static
|
||||
{
|
||||
$this->notifier = $notifier;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAccess(): ?array
|
||||
{
|
||||
return $this->access;
|
||||
}
|
||||
|
||||
public function setAccess(?array $access): static
|
||||
{
|
||||
$this->access = $access;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ReservationArticleValidation>
|
||||
*/
|
||||
public function getReservationArticleValidations(): Collection
|
||||
{
|
||||
return $this->reservationArticleValidations;
|
||||
}
|
||||
|
||||
public function addReservationArticleValidation(ReservationArticleValidation $reservationArticleValidation): static
|
||||
{
|
||||
if (!$this->reservationArticleValidations->contains($reservationArticleValidation)) {
|
||||
$this->reservationArticleValidations->add($reservationArticleValidation);
|
||||
$reservationArticleValidation->setPartenaire($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeReservationArticleValidation(ReservationArticleValidation $reservationArticleValidation): static
|
||||
{
|
||||
if ($this->reservationArticleValidations->removeElement($reservationArticleValidation)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($reservationArticleValidation->getPartenaire() === $this) {
|
||||
$reservationArticleValidation->setPartenaire(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isSelected(): ?bool
|
||||
{
|
||||
return $this->selected;
|
||||
}
|
||||
|
||||
public function setSelected(bool $selected): static
|
||||
{
|
||||
$this->selected = $selected;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ReservationServiceValidation>
|
||||
*/
|
||||
public function getReservationServiceValidations(): Collection
|
||||
{
|
||||
return $this->reservationServiceValidations;
|
||||
}
|
||||
|
||||
public function addReservationServiceValidation(ReservationServiceValidation $reservationServiceValidation): static
|
||||
{
|
||||
if (!$this->reservationServiceValidations->contains($reservationServiceValidation)) {
|
||||
$this->reservationServiceValidations->add($reservationServiceValidation);
|
||||
$reservationServiceValidation->setPartenaire($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeReservationServiceValidation(ReservationServiceValidation $reservationServiceValidation): static
|
||||
{
|
||||
if ($this->reservationServiceValidations->removeElement($reservationServiceValidation)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($reservationServiceValidation->getPartenaire() === $this) {
|
||||
$reservationServiceValidation->setPartenaire(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
216
src/Entity/Position.php
Normal file
216
src/Entity/Position.php
Normal file
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\PositionRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: PositionRepository::class)]
|
||||
class Position
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_debut = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_fin = null;
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
|
||||
private ?int $ligne = null;
|
||||
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
|
||||
private ?int $priorite = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'positions')]
|
||||
private ?Annonce $annonce = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'positions')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $create_by = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'position', targetEntity: Affichage::class)]
|
||||
private Collection $affichages;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->affichages = new ArrayCollection();
|
||||
$this->date_add = new \DateTime();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDateDebut(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_debut;
|
||||
}
|
||||
|
||||
public function setDateDebut(\DateTimeInterface $date_debut): static
|
||||
{
|
||||
$this->date_debut = $date_debut;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateFin(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_fin;
|
||||
}
|
||||
|
||||
public function setDateFin(\DateTimeInterface $date_fin): static
|
||||
{
|
||||
$this->date_fin = $date_fin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getLigne(): ?int
|
||||
{
|
||||
return $this->ligne;
|
||||
}
|
||||
|
||||
public function setLigne(?int $ligne): static
|
||||
{
|
||||
$this->ligne = $ligne;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getPriorite(): ?int
|
||||
{
|
||||
return $this->priorite;
|
||||
}
|
||||
|
||||
public function setPriorite(?int $priorite): static
|
||||
{
|
||||
$this->priorite = $priorite;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAnnonce(): ?Annonce
|
||||
{
|
||||
return $this->annonce;
|
||||
}
|
||||
|
||||
public function setAnnonce(?Annonce $annonce): static
|
||||
{
|
||||
$this->annonce = $annonce;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreateBy(): ?User
|
||||
{
|
||||
return $this->create_by;
|
||||
}
|
||||
|
||||
public function setCreateBy(?User $create_by): static
|
||||
{
|
||||
$this->create_by = $create_by;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Affichage>
|
||||
*/
|
||||
public function getAffichages(): Collection
|
||||
{
|
||||
return $this->affichages;
|
||||
}
|
||||
|
||||
public function addAffichage(Affichage $affichage): static
|
||||
{
|
||||
if (!$this->affichages->contains($affichage)) {
|
||||
$this->affichages->add($affichage);
|
||||
$affichage->setPosition($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeAffichage(Affichage $affichage): static
|
||||
{
|
||||
if ($this->affichages->removeElement($affichage)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($affichage->getPosition() === $this) {
|
||||
$affichage->setPosition(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTotalPrix(): ?int
|
||||
{
|
||||
$prix = 0;
|
||||
foreach($this->affichages as $affichage){
|
||||
$prix += $affichage->getPrix();
|
||||
}
|
||||
return $prix;
|
||||
}
|
||||
|
||||
|
||||
public function getLigneRange()
|
||||
{
|
||||
switch ($this->ligne):
|
||||
case 1:
|
||||
return "A";
|
||||
case 2:
|
||||
return "B";
|
||||
case 3:
|
||||
return "C";
|
||||
case 4:
|
||||
return "D";
|
||||
case 5:
|
||||
return "E";
|
||||
case 6:
|
||||
return "F";
|
||||
case 7:
|
||||
return "G";
|
||||
case 8:
|
||||
return "H";
|
||||
case 9:
|
||||
return "I";
|
||||
case 10:
|
||||
return "J";
|
||||
case 11:
|
||||
return "K";
|
||||
case 12:
|
||||
return "L";
|
||||
case 13:
|
||||
return "M";
|
||||
endswitch;
|
||||
}
|
||||
|
||||
}
|
||||
67
src/Entity/RdvTempo.php
Normal file
67
src/Entity/RdvTempo.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\RdvTempoRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: RdvTempoRepository::class)]
|
||||
class RdvTempo
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
private ?User $client = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?ServiceRdvReservation $serviceRdvReservation = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getClient(): ?User
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function setClient(?User $client): static
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getServiceRdvReservation(): ?ServiceRdvReservation
|
||||
{
|
||||
return $this->serviceRdvReservation;
|
||||
}
|
||||
|
||||
public function setServiceRdvReservation(ServiceRdvReservation $serviceRdvReservation): static
|
||||
{
|
||||
$this->serviceRdvReservation = $serviceRdvReservation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
224
src/Entity/ReservationArticle.php
Executable file
224
src/Entity/ReservationArticle.php
Executable file
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ReservationArticleRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ReservationArticleRepository::class)]
|
||||
class ReservationArticle
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $reference = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'reservationArticles')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Article $article = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'reservationArticles')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $client = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'reservationArticles')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Societe $societe = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $quantite = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $prix = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $avance = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $frais = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private array $etat = [];
|
||||
|
||||
#[ORM\OneToOne(mappedBy: 'reservationArticle', cascade: ['persist', 'remove'])]
|
||||
private ?ReservationArticleValidation $reservationArticleValidation = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_add = new \DateTime();
|
||||
$this->generateReference();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getReference(): ?string
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
public function setReference(string $reference): static
|
||||
{
|
||||
$this->reference = $reference;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getArticle(): ?Article
|
||||
{
|
||||
return $this->article;
|
||||
}
|
||||
|
||||
public function setArticle(?Article $article): static
|
||||
{
|
||||
$this->article = $article;
|
||||
$this->societe = $article->getSociete();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getClient(): ?User
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function setClient(?User $client): static
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getQuantite(): ?int
|
||||
{
|
||||
return $this->quantite;
|
||||
}
|
||||
|
||||
public function setQuantite(int $quantite): static
|
||||
{
|
||||
$this->quantite = $quantite;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrix(): ?float
|
||||
{
|
||||
return $this->prix;
|
||||
}
|
||||
|
||||
public function setPrix(float $prix): static
|
||||
{
|
||||
$this->prix = $prix;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAvance(): ?float
|
||||
{
|
||||
return $this->avance;
|
||||
}
|
||||
|
||||
public function setAvance(float $avance): static
|
||||
{
|
||||
$this->avance = $avance;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFrais(): ?int
|
||||
{
|
||||
return $this->frais;
|
||||
}
|
||||
|
||||
public function setFrais(int $frais): static
|
||||
{
|
||||
$this->frais = $frais;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEtat(): array
|
||||
{
|
||||
return $this->etat;
|
||||
}
|
||||
|
||||
public function setEtat(array $etat): static
|
||||
{
|
||||
$this->etat = $etat;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addEtat(string $key, string $str): static
|
||||
{
|
||||
$this->etat[$key] = $str;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return "ReservationArticle";
|
||||
}
|
||||
|
||||
public function generateReference():static
|
||||
{
|
||||
$code1 = random_int(1000, 9999);
|
||||
$code2 = random_int(1000, 9999);
|
||||
$code3 = random_int(1000, 9999);
|
||||
$code4 = random_int(1000, 9999);
|
||||
|
||||
$this->reference = "$code1-$code2-$code3-$code4";
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReservationArticleValidation(): ?ReservationArticleValidation
|
||||
{
|
||||
return $this->reservationArticleValidation;
|
||||
}
|
||||
|
||||
public function setReservationArticleValidation(ReservationArticleValidation $reservationArticleValidation): static
|
||||
{
|
||||
// set the owning side of the relation if necessary
|
||||
if ($reservationArticleValidation->getReservationArticle() !== $this) {
|
||||
$reservationArticleValidation->setReservationArticle($this);
|
||||
}
|
||||
|
||||
$this->reservationArticleValidation = $reservationArticleValidation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSociete(): ?Societe
|
||||
{
|
||||
return $this->societe;
|
||||
}
|
||||
|
||||
public function setSociete(?Societe $societe): static
|
||||
{
|
||||
$this->societe = $societe;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
79
src/Entity/ReservationArticleValidation.php
Normal file
79
src/Entity/ReservationArticleValidation.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ReservationArticleValidationRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ReservationArticleValidationRepository::class)]
|
||||
class ReservationArticleValidation
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'reservationArticleValidations')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Partenaire $partenaire = null;
|
||||
|
||||
#[ORM\OneToOne(inversedBy: 'reservationArticleValidation', cascade: ['persist', 'remove'])]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?ReservationArticle $reservationArticle = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_add = new \DateTime();
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return "ReservationArticleValidation";
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getPartenaire(): ?Partenaire
|
||||
{
|
||||
return $this->partenaire;
|
||||
}
|
||||
|
||||
public function setPartenaire(?Partenaire $partenaire): static
|
||||
{
|
||||
$this->partenaire = $partenaire;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReservationArticle(): ?ReservationArticle
|
||||
{
|
||||
return $this->reservationArticle;
|
||||
}
|
||||
|
||||
public function setReservationArticle(ReservationArticle $reservationArticle): static
|
||||
{
|
||||
$this->reservationArticle = $reservationArticle;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
254
src/Entity/ReservationService.php
Executable file
254
src/Entity/ReservationService.php
Executable file
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ReservationServiceRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ReservationServiceRepository::class)]
|
||||
class ReservationService
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $reference = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'reservationServices')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Service $service = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'reservationServices')]
|
||||
private ?User $client = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_rdv = null;
|
||||
|
||||
#[ORM\OneToOne(inversedBy: 'reservationService', cascade: ['persist', 'remove'])]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?ServiceRdvReservation $serviceRdvReservation = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'reservationServices')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Societe $societe = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $prix = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $avance = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $frais = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?array $data = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private array $etat = [];
|
||||
|
||||
#[ORM\OneToOne(mappedBy: 'reservationService', cascade: ['persist', 'remove'])]
|
||||
private ?ReservationServiceValidation $reservationServiceValidation = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_add = new \DateTime();
|
||||
$this->generateReference();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getReference(): ?string
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
public function setReference(string $reference): static
|
||||
{
|
||||
$this->reference = $reference;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getService(): ?Service
|
||||
{
|
||||
return $this->service;
|
||||
}
|
||||
|
||||
public function setService(?Service $service): static
|
||||
{
|
||||
$this->service = $service;
|
||||
$this->societe = $service->getSociete();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getClient(): ?User
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function setClient(?User $client): static
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateRdv(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_rdv;
|
||||
}
|
||||
|
||||
public function setDateRdv(\DateTimeInterface $date_rdv): static
|
||||
{
|
||||
$this->date_rdv = $date_rdv;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getServiceRdvReservation(): ?ServiceRdvReservation
|
||||
{
|
||||
return $this->serviceRdvReservation;
|
||||
}
|
||||
|
||||
public function setServiceRdvReservation(ServiceRdvReservation $serviceRdvReservation): static
|
||||
{
|
||||
$this->serviceRdvReservation = $serviceRdvReservation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrix(): ?float
|
||||
{
|
||||
return $this->prix;
|
||||
}
|
||||
|
||||
public function setPrix(float $prix): static
|
||||
{
|
||||
$this->prix = $prix;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAvance(): ?float
|
||||
{
|
||||
return $this->avance;
|
||||
}
|
||||
|
||||
public function setAvance(float $avance): static
|
||||
{
|
||||
$this->avance = $avance;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFrais(): ?float
|
||||
{
|
||||
return $this->frais;
|
||||
}
|
||||
|
||||
public function setFrais(float $frais): static
|
||||
{
|
||||
$this->frais = $frais;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getData(): ?array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function setData(?array $data): static
|
||||
{
|
||||
$this->data = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEtat(): array
|
||||
{
|
||||
return $this->etat;
|
||||
}
|
||||
|
||||
public function setEtat(array $etat): static
|
||||
{
|
||||
$this->etat = $etat;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addEtat(string $key, string $str): static
|
||||
{
|
||||
$this->etat[$key] = $str;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return "ReservationService";
|
||||
}
|
||||
|
||||
public function generateReference():static
|
||||
{
|
||||
$code1 = random_int(1000, 9999);
|
||||
$code2 = random_int(1000, 9999);
|
||||
$code3 = random_int(1000, 9999);
|
||||
$code4 = random_int(1000, 9999);
|
||||
|
||||
$this->reference = "$code1-$code2-$code3-$code4";
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReservationServiceValidation(): ?ReservationServiceValidation
|
||||
{
|
||||
return $this->reservationServiceValidation;
|
||||
}
|
||||
|
||||
public function setReservationServiceValidation(ReservationServiceValidation $reservationServiceValidation): static
|
||||
{
|
||||
// set the owning side of the relation if necessary
|
||||
if ($reservationServiceValidation->getReservationService() !== $this) {
|
||||
$reservationServiceValidation->setReservationService($this);
|
||||
}
|
||||
|
||||
$this->reservationServiceValidation = $reservationServiceValidation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSociete(): ?Societe
|
||||
{
|
||||
return $this->societe;
|
||||
}
|
||||
|
||||
public function setSociete(?Societe $societe): static
|
||||
{
|
||||
$this->societe = $societe;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
80
src/Entity/ReservationServiceValidation.php
Normal file
80
src/Entity/ReservationServiceValidation.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ReservationServiceValidationRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ReservationServiceValidationRepository::class)]
|
||||
class ReservationServiceValidation
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'reservationServiceValidations')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Partenaire $partenaire = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\OneToOne(inversedBy: 'reservationServiceValidation', cascade: ['persist', 'remove'])]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?ReservationService $reservationService = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_add = new \DateTime();
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return "ReservationServiceValidation";
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getPartenaire(): ?Partenaire
|
||||
{
|
||||
return $this->partenaire;
|
||||
}
|
||||
|
||||
public function setPartenaire(?Partenaire $partenaire): static
|
||||
{
|
||||
$this->partenaire = $partenaire;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReservationService(): ?ReservationService
|
||||
{
|
||||
return $this->reservationService;
|
||||
}
|
||||
|
||||
public function setReservationService(ReservationService $reservationService): static
|
||||
{
|
||||
$this->reservationService = $reservationService;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
522
src/Entity/Service.php
Normal file
522
src/Entity/Service.php
Normal file
@@ -0,0 +1,522 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ServiceRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ServiceRepository::class)]
|
||||
class Service
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $titre = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $marque = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?float $prix_marche = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $prix_promo = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $adress = null;
|
||||
|
||||
// 'Limitation par date'=> 0 | 'Limitation par rendez-vous'=> 1
|
||||
#[ORM\Column(type: Types::SMALLINT)]
|
||||
private ?int $limit_type = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $limit_date = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $limit_nbr_rdv = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_default = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_1 = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_2 = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_3 = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $image_detail_4 = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_update = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $active = null;
|
||||
|
||||
#[ORM\Column(nullable: false)]
|
||||
private ?int $duree = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'services')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Societe $societe = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'services')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Categorie $categorie = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'services')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $create_by = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'service', targetEntity: ServiceRdv::class)]
|
||||
private Collection $serviceRdvs;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'service', targetEntity: ServiceRdvReservation::class)]
|
||||
private Collection $serviceRdvReservations;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'service', targetEntity: ReservationService::class)]
|
||||
private Collection $reservationServices;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'service', targetEntity: CommentService::class)]
|
||||
#[ORM\OrderBy(['id' => 'DESC'])]
|
||||
private Collection $commentServices;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->active = false;
|
||||
$this->date_add = new \DateTime();
|
||||
$this->date_update = new \DateTime();
|
||||
$this->serviceRdvs = new ArrayCollection();
|
||||
$this->serviceRdvReservations = new ArrayCollection();
|
||||
$this->reservationServices = new ArrayCollection();
|
||||
$this->commentServices = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getTitre(): ?string
|
||||
{
|
||||
return $this->titre;
|
||||
}
|
||||
|
||||
public function setTitre(string $titre): static
|
||||
{
|
||||
$this->titre = $titre;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMarque(): ?string
|
||||
{
|
||||
return $this->marque;
|
||||
}
|
||||
|
||||
public function setMarque(string $marque): static
|
||||
{
|
||||
$this->marque = $marque;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrixMarche(): ?float
|
||||
{
|
||||
return $this->prix_marche;
|
||||
}
|
||||
|
||||
public function setPrixMarche(?float $prix_marche): self
|
||||
{
|
||||
$this->prix_marche = $prix_marche;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrixPromo(): ?float
|
||||
{
|
||||
return $this->prix_promo;
|
||||
}
|
||||
|
||||
public function setPrixPromo(float $prix_promo): self
|
||||
{
|
||||
$this->prix_promo = $prix_promo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAdress(): ?string
|
||||
{
|
||||
return $this->adress;
|
||||
}
|
||||
|
||||
public function setAdress(?string $adress): static
|
||||
{
|
||||
$this->adress = $adress;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLimitType(): ?int
|
||||
{
|
||||
return $this->limit_type;
|
||||
}
|
||||
|
||||
public function setLimitType(int $limit_type): static
|
||||
{
|
||||
$this->limit_type = $limit_type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLimitDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->limit_date;
|
||||
}
|
||||
|
||||
public function setLimitDate(?\DateTimeInterface $limit_date): static
|
||||
{
|
||||
$this->limit_date = $limit_date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLimitNbrRdv(): ?int
|
||||
{
|
||||
return $this->limit_nbr_rdv;
|
||||
}
|
||||
|
||||
public function setLimitNbrRdv(?int $limit_nbr_rdv): static
|
||||
{
|
||||
$this->limit_nbr_rdv = $limit_nbr_rdv;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDefault(): ?string
|
||||
{
|
||||
return $this->image_default;
|
||||
}
|
||||
|
||||
public function setImageDefault(?string $image_default): static
|
||||
{
|
||||
$this->image_default = $image_default;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail1(): ?string
|
||||
{
|
||||
return $this->image_detail_1;
|
||||
}
|
||||
|
||||
public function setImageDetail1(?string $image_detail_1): static
|
||||
{
|
||||
$this->image_detail_1 = $image_detail_1;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail2(): ?string
|
||||
{
|
||||
return $this->image_detail_2;
|
||||
}
|
||||
|
||||
public function setImageDetail2(?string $image_detail_2): static
|
||||
{
|
||||
$this->image_detail_2 = $image_detail_2;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail3(): ?string
|
||||
{
|
||||
return $this->image_detail_3;
|
||||
}
|
||||
|
||||
public function setImageDetail3(?string $image_detail_3): static
|
||||
{
|
||||
$this->image_detail_3 = $image_detail_3;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageDetail4(): ?string
|
||||
{
|
||||
return $this->image_detail_4;
|
||||
}
|
||||
|
||||
public function setImageDetail4(?string $image_detail_4): static
|
||||
{
|
||||
$this->image_detail_4 = $image_detail_4;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAllImage(): ?array
|
||||
{
|
||||
$ListImg = [];
|
||||
|
||||
if($this->image_default) $ListImg[] = $this->image_default;
|
||||
if($this->image_detail_1) $ListImg[] = $this->image_detail_1;
|
||||
if($this->image_detail_2) $ListImg[] = $this->image_detail_2;
|
||||
if($this->image_detail_3) $ListImg[] = $this->image_detail_3;
|
||||
if($this->image_detail_4) $ListImg[] = $this->image_detail_4;
|
||||
|
||||
return $ListImg;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateUpdate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_update;
|
||||
}
|
||||
|
||||
public function setDateUpdate(\DateTimeInterface $date_update): static
|
||||
{
|
||||
$this->date_update = $date_update;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isActive(): ?bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function setActive(bool $active): static
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function gestionActive(): static
|
||||
{
|
||||
if($this->image_default == null){
|
||||
$this->active = false;
|
||||
}else{
|
||||
if($this->limit_type == 0){
|
||||
if($this->limit_date != null){
|
||||
$this->active = true;
|
||||
}else{
|
||||
$this->active = false;
|
||||
}
|
||||
}elseif($this->limit_type == 1){
|
||||
if($this->limit_nbr_rdv > 1){
|
||||
$this->active = true;
|
||||
}else{
|
||||
$this->active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDuree(): ?int
|
||||
{
|
||||
return $this->duree;
|
||||
}
|
||||
|
||||
public function setDuree(?int $duree): static
|
||||
{
|
||||
$this->duree = $duree;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSociete(): ?Societe
|
||||
{
|
||||
return $this->societe;
|
||||
}
|
||||
|
||||
public function setSociete(?Societe $societe): static
|
||||
{
|
||||
$this->societe = $societe;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCategorie(): ?Categorie
|
||||
{
|
||||
return $this->categorie;
|
||||
}
|
||||
|
||||
public function setCategorie(?Categorie $categorie): static
|
||||
{
|
||||
$this->categorie = $categorie;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreateBy(): ?User
|
||||
{
|
||||
return $this->create_by;
|
||||
}
|
||||
|
||||
public function setCreateBy(?User $create_by): static
|
||||
{
|
||||
$this->create_by = $create_by;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ServiceRdv>
|
||||
*/
|
||||
public function getServiceRdvs(): Collection
|
||||
{
|
||||
return $this->serviceRdvs;
|
||||
}
|
||||
|
||||
public function addServiceRdv(ServiceRdv $serviceRdv): static
|
||||
{
|
||||
if (!$this->serviceRdvs->contains($serviceRdv)) {
|
||||
$this->serviceRdvs->add($serviceRdv);
|
||||
$serviceRdv->setService($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeServiceRdv(ServiceRdv $serviceRdv): static
|
||||
{
|
||||
if ($this->serviceRdvs->removeElement($serviceRdv)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($serviceRdv->getService() === $this) {
|
||||
$serviceRdv->setService(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ServiceRdvReservation>
|
||||
*/
|
||||
public function getServiceRdvReservations(): Collection
|
||||
{
|
||||
return $this->serviceRdvReservations;
|
||||
}
|
||||
|
||||
public function addServiceRdvReservation(ServiceRdvReservation $serviceRdvReservation): static
|
||||
{
|
||||
if (!$this->serviceRdvReservations->contains($serviceRdvReservation)) {
|
||||
$this->serviceRdvReservations->add($serviceRdvReservation);
|
||||
$serviceRdvReservation->setService($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeServiceRdvReservation(ServiceRdvReservation $serviceRdvReservation): static
|
||||
{
|
||||
if ($this->serviceRdvReservations->removeElement($serviceRdvReservation)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($serviceRdvReservation->getService() === $this) {
|
||||
$serviceRdvReservation->setService(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ReservationService>
|
||||
*/
|
||||
public function getReservationServices(): Collection
|
||||
{
|
||||
return $this->reservationServices;
|
||||
}
|
||||
|
||||
public function addReservationService(ReservationService $reservationService): static
|
||||
{
|
||||
if (!$this->reservationServices->contains($reservationService)) {
|
||||
$this->reservationServices->add($reservationService);
|
||||
$reservationService->setService($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeReservationService(ReservationService $reservationService): static
|
||||
{
|
||||
if ($this->reservationServices->removeElement($reservationService)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($reservationService->getService() === $this) {
|
||||
$reservationService->setService(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, CommentService>
|
||||
*/
|
||||
public function getCommentServices(): Collection
|
||||
{
|
||||
return $this->commentServices;
|
||||
}
|
||||
|
||||
public function addCommentService(CommentService $commentService): static
|
||||
{
|
||||
if (!$this->commentServices->contains($commentService)) {
|
||||
$this->commentServices->add($commentService);
|
||||
$commentService->setService($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCommentService(CommentService $commentService): static
|
||||
{
|
||||
if ($this->commentServices->removeElement($commentService)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($commentService->getService() === $this) {
|
||||
$commentService->setService(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
274
src/Entity/ServiceRdv.php
Normal file
274
src/Entity/ServiceRdv.php
Normal file
@@ -0,0 +1,274 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ServiceRdvRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ServiceRdvRepository::class)]
|
||||
class ServiceRdv
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $start_date = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $end_date = null;
|
||||
|
||||
#[ORM\Column(type: Types::TIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $start_time = null;
|
||||
|
||||
#[ORM\Column(type: Types::TIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $end_time = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $duree = null;
|
||||
|
||||
#[ORM\Column(length: 100, nullable: true)]
|
||||
private ?string $excludeDay = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $betweenRdv = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'serviceRdvs')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Service $service = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'serviceRdvs')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $createBy = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?array $reservationJson = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $dateAdd = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'serviceRdv', targetEntity: ServiceRdvReservation::class)]
|
||||
private Collection $serviceRdvReservations;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->dateAdd = new \DateTime();
|
||||
$this->serviceRdvReservations = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getStartDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->start_date;
|
||||
}
|
||||
|
||||
public function getStringStartDate(): ?string
|
||||
{
|
||||
return $this->start_date->format('d/m/Y');
|
||||
}
|
||||
|
||||
public function setStartDate(\DateTimeInterface $start_date): static
|
||||
{
|
||||
$this->start_date = $start_date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEndDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->end_date;
|
||||
}
|
||||
|
||||
public function getStringEndDate(): ?string
|
||||
{
|
||||
return $this->end_date->format('d/m/Y');
|
||||
}
|
||||
|
||||
public function setEndDate(\DateTimeInterface $end_date): static
|
||||
{
|
||||
$this->end_date = $end_date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStartTime(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->start_time;
|
||||
}
|
||||
|
||||
public function getStringStartTime(): ?string
|
||||
{
|
||||
return $this->start_time->format('H:i');
|
||||
}
|
||||
|
||||
public function setStartTime(\DateTimeInterface $start_time): static
|
||||
{
|
||||
$this->start_time = $start_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEndTime(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->end_time;
|
||||
}
|
||||
|
||||
public function getStringEndTime(): ?string
|
||||
{
|
||||
return $this->end_time->format('H:i');
|
||||
}
|
||||
|
||||
public function setEndTime(\DateTimeInterface $end_time): static
|
||||
{
|
||||
$this->end_time = $end_time;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDuree(): ?int
|
||||
{
|
||||
return $this->duree;
|
||||
}
|
||||
|
||||
public function setDuree(int $duree): static
|
||||
{
|
||||
$this->duree = $duree;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getExcludeDay(): ?string
|
||||
{
|
||||
return $this->excludeDay;
|
||||
}
|
||||
|
||||
public function setExcludeDay(?string $excludeDay): static
|
||||
{
|
||||
$this->excludeDay = $excludeDay;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getService(): ?Service
|
||||
{
|
||||
return $this->service;
|
||||
}
|
||||
|
||||
public function setService(?Service $service): static
|
||||
{
|
||||
$this->service = $service;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreateBy(): ?User
|
||||
{
|
||||
return $this->createBy;
|
||||
}
|
||||
|
||||
public function setCreateBy(?User $createBy): static
|
||||
{
|
||||
$this->createBy = $createBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReservationJson(): ?array
|
||||
{
|
||||
return $this->reservationJson;
|
||||
}
|
||||
|
||||
public function setReservationJson(?array $reservationJson): static
|
||||
{
|
||||
$this->reservationJson = $reservationJson;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getBetweenRdv(): ?int
|
||||
{
|
||||
return $this->betweenRdv;
|
||||
}
|
||||
|
||||
public function setBetweenRdv(int $betweenRdv): static
|
||||
{
|
||||
$this->betweenRdv = $betweenRdv;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->dateAdd;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $dateAdd): static
|
||||
{
|
||||
$this->dateAdd = $dateAdd;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ServiceRdvReservation>
|
||||
*/
|
||||
public function getServiceRdvReservations(): Collection
|
||||
{
|
||||
return $this->serviceRdvReservations;
|
||||
}
|
||||
|
||||
public function addServiceRdvReservation(ServiceRdvReservation $serviceRdvReservation): static
|
||||
{
|
||||
if (!$this->serviceRdvReservations->contains($serviceRdvReservation)) {
|
||||
$this->serviceRdvReservations->add($serviceRdvReservation);
|
||||
$serviceRdvReservation->setServiceRdv($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeServiceRdvReservation(ServiceRdvReservation $serviceRdvReservation): static
|
||||
{
|
||||
if ($this->serviceRdvReservations->removeElement($serviceRdvReservation)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($serviceRdvReservation->getServiceRdv() === $this) {
|
||||
$serviceRdvReservation->setServiceRdv(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function toArray(): ?array
|
||||
{
|
||||
$Param['id'] = $this->service->getId();
|
||||
$Param['startDate'] = $this->start_date->format('d/m/Y');
|
||||
$Param['endDate'] = $this->end_date->format('d/m/Y');
|
||||
$Param['startTime'] = $this->start_time->format('H:i');
|
||||
$Param['endTime'] = $this->end_time->format('H:i');
|
||||
$Param['between'] = $this->duree;
|
||||
$Param ['duree'] = $this->service->getDuree();
|
||||
$Param['excludeDay'] = $this->excludeDay;
|
||||
|
||||
$RendezVous = [];
|
||||
foreach($this->serviceRdvReservations as $reservation){
|
||||
$RendezVous[$reservation->getDateDebut()->format('d/m/Y')][] = ['debut'=>$reservation->getDateDebut()->format('H:i'), 'fin'=>$reservation->getDateFin()->format('H:i')];
|
||||
}
|
||||
$Param['arrRendezVous'] = $RendezVous;
|
||||
|
||||
return $Param;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
123
src/Entity/ServiceRdvReservation.php
Normal file
123
src/Entity/ServiceRdvReservation.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ServiceRdvReservationRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ServiceRdvReservationRepository::class)]
|
||||
class ServiceRdvReservation
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $dateDebut = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $dateFin = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'serviceRdvReservations')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?ServiceRdv $serviceRdv = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'serviceRdvReservations')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Service $service = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $disponible = null;
|
||||
|
||||
#[ORM\OneToOne(mappedBy: 'serviceRdvReservation', cascade: ['persist', 'remove'])]
|
||||
private ?ReservationService $reservationService = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->disponible = true;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDateDebut(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->dateDebut;
|
||||
}
|
||||
|
||||
public function setDateDebut(\DateTimeInterface $dateDebut): static
|
||||
{
|
||||
$this->dateDebut = $dateDebut;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateFin(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->dateFin;
|
||||
}
|
||||
|
||||
public function setDateFin(\DateTimeInterface $dateFin): static
|
||||
{
|
||||
$this->dateFin = $dateFin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getServiceRdv(): ?ServiceRdv
|
||||
{
|
||||
return $this->serviceRdv;
|
||||
}
|
||||
|
||||
public function setServiceRdv(?ServiceRdv $serviceRdv): static
|
||||
{
|
||||
$this->serviceRdv = $serviceRdv;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getService(): ?Service
|
||||
{
|
||||
return $this->service;
|
||||
}
|
||||
|
||||
public function setService(?Service $service): static
|
||||
{
|
||||
$this->service = $service;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isDisponible(): ?bool
|
||||
{
|
||||
return $this->disponible;
|
||||
}
|
||||
|
||||
public function setDisponible(bool $disponible): static
|
||||
{
|
||||
$this->disponible = $disponible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReservationService(): ?ReservationService
|
||||
{
|
||||
return $this->reservationService;
|
||||
}
|
||||
|
||||
public function setReservationService(ReservationService $reservationService): static
|
||||
{
|
||||
// set the owning side of the relation if necessary
|
||||
if ($reservationService->getServiceRdvReservation() !== $this) {
|
||||
$reservationService->setServiceRdvReservation($this);
|
||||
}
|
||||
|
||||
$this->reservationService = $reservationService;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
383
src/Entity/Societe.php
Executable file
383
src/Entity/Societe.php
Executable file
@@ -0,0 +1,383 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\SocieteRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: SocieteRepository::class)]
|
||||
class Societe
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $nom = null;
|
||||
|
||||
#[ORM\Column(length: 300)]
|
||||
private ?string $immatriculation = null;
|
||||
|
||||
#[ORM\Column(length: 300, nullable: true)]
|
||||
private ?string $logo = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $adresse = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'societe', targetEntity: Annonce::class)]
|
||||
private Collection $annonces;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $email = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $telephone = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $fax = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'societe', targetEntity: Article::class)]
|
||||
private Collection $articles;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'societe', targetEntity: Service::class)]
|
||||
private Collection $services;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $active = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $date_add = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'societe', targetEntity: Partenaire::class)]
|
||||
private Collection $partenaires;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'societe', targetEntity: ReservationArticle::class)]
|
||||
private Collection $reservationArticles;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'societe', targetEntity: ReservationService::class)]
|
||||
private Collection $reservationServices;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->active = false;
|
||||
$this->annonces = new ArrayCollection();
|
||||
$this->articles = new ArrayCollection();
|
||||
$this->services = new ArrayCollection();
|
||||
$this->date_add = new \DateTime();
|
||||
$this->partenaires = new ArrayCollection();
|
||||
$this->reservationArticles = new ArrayCollection();
|
||||
$this->reservationServices = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getNom(): ?string
|
||||
{
|
||||
return $this->nom;
|
||||
}
|
||||
|
||||
public function setNom(string $nom): self
|
||||
{
|
||||
$this->nom = $nom;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImmatriculation(): ?string
|
||||
{
|
||||
return $this->immatriculation;
|
||||
}
|
||||
|
||||
public function setImmatriculation(string $immatriculation): self
|
||||
{
|
||||
$this->immatriculation = $immatriculation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLogo(): ?string
|
||||
{
|
||||
return $this->logo;
|
||||
}
|
||||
|
||||
public function setLogo(string $logo): self
|
||||
{
|
||||
$this->logo = $logo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAdresse(): ?string
|
||||
{
|
||||
return $this->adresse;
|
||||
}
|
||||
|
||||
public function setAdresse(string $adresse): self
|
||||
{
|
||||
$this->adresse = $adresse;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(string $description): self
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Annonce>
|
||||
*/
|
||||
public function getAnnonces(): Collection
|
||||
{
|
||||
return $this->annonces;
|
||||
}
|
||||
|
||||
public function addAnnonce(Annonce $annonce): self
|
||||
{
|
||||
if (!$this->annonces->contains($annonce)) {
|
||||
$this->annonces->add($annonce);
|
||||
$annonce->setSociete($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeAnnonce(Annonce $annonce): self
|
||||
{
|
||||
if ($this->annonces->removeElement($annonce)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($annonce->getSociete() === $this) {
|
||||
$annonce->setSociete(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setEmail(?string $email): self
|
||||
{
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTelephone(): ?string
|
||||
{
|
||||
return $this->telephone;
|
||||
}
|
||||
|
||||
public function setTelephone(string $telephone): self
|
||||
{
|
||||
$this->telephone = $telephone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFax(): ?string
|
||||
{
|
||||
return $this->fax;
|
||||
}
|
||||
|
||||
public function setFax(?string $fax): self
|
||||
{
|
||||
$this->fax = $fax;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Article>
|
||||
*/
|
||||
public function getArticles(): Collection
|
||||
{
|
||||
return $this->articles;
|
||||
}
|
||||
|
||||
public function addArticle(Article $article): static
|
||||
{
|
||||
if (!$this->articles->contains($article)) {
|
||||
$this->articles->add($article);
|
||||
$article->setSociete($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeArticle(Article $article): static
|
||||
{
|
||||
if ($this->articles->removeElement($article)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($article->getSociete() === $this) {
|
||||
$article->setSociete(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Service>
|
||||
*/
|
||||
public function getServices(): Collection
|
||||
{
|
||||
return $this->services;
|
||||
}
|
||||
|
||||
public function addService(Service $service): static
|
||||
{
|
||||
if (!$this->services->contains($service)) {
|
||||
$this->services->add($service);
|
||||
$service->setSociete($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeService(Service $service): static
|
||||
{
|
||||
if ($this->services->removeElement($service)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($service->getSociete() === $this) {
|
||||
$service->setSociete(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isActive(): ?bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function setActive(bool $active): static
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date_add;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $date_add): static
|
||||
{
|
||||
$this->date_add = $date_add;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Partenaire>
|
||||
*/
|
||||
public function getPartenaires(): Collection
|
||||
{
|
||||
return $this->partenaires;
|
||||
}
|
||||
|
||||
public function addPartenaire(Partenaire $partenaire): static
|
||||
{
|
||||
if (!$this->partenaires->contains($partenaire)) {
|
||||
$this->partenaires->add($partenaire);
|
||||
$partenaire->setSociete($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePartenaire(Partenaire $partenaire): static
|
||||
{
|
||||
if ($this->partenaires->removeElement($partenaire)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($partenaire->getSociete() === $this) {
|
||||
$partenaire->setSociete(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ReservationArticle>
|
||||
*/
|
||||
public function getReservationArticles(): Collection
|
||||
{
|
||||
return $this->reservationArticles;
|
||||
}
|
||||
|
||||
public function addReservationArticle(ReservationArticle $reservationArticle): static
|
||||
{
|
||||
if (!$this->reservationArticles->contains($reservationArticle)) {
|
||||
$this->reservationArticles->add($reservationArticle);
|
||||
$reservationArticle->setSociete($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeReservationArticle(ReservationArticle $reservationArticle): static
|
||||
{
|
||||
if ($this->reservationArticles->removeElement($reservationArticle)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($reservationArticle->getSociete() === $this) {
|
||||
$reservationArticle->setSociete(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ReservationService>
|
||||
*/
|
||||
public function getReservationServices(): Collection
|
||||
{
|
||||
return $this->reservationServices;
|
||||
}
|
||||
|
||||
public function addReservationService(ReservationService $reservationService): static
|
||||
{
|
||||
if (!$this->reservationServices->contains($reservationService)) {
|
||||
$this->reservationServices->add($reservationService);
|
||||
$reservationService->setSociete($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeReservationService(ReservationService $reservationService): static
|
||||
{
|
||||
if ($this->reservationServices->removeElement($reservationService)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($reservationService->getSociete() === $this) {
|
||||
$reservationService->setSociete(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
868
src/Entity/User.php
Normal file
868
src/Entity/User.php
Normal file
@@ -0,0 +1,868 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\UserRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||
#[ORM\Table(name: '`user`')]
|
||||
class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 180, unique: true)]
|
||||
private ?string $email = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private array $roles = [];
|
||||
|
||||
/**
|
||||
* @var string The hashed password
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $password = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $firstname = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $lastname = null;
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT)]
|
||||
private ?int $gender = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $pseudo = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $birthdate = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $phoneNumber = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $lastLogin = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $dateAdd = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $frais = 0;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $isDeleted = false;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'create_by', targetEntity: Position::class)]
|
||||
private Collection $positions;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'create_by', targetEntity: Ligne::class)]
|
||||
private Collection $lignes;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $country = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $zip = null;
|
||||
|
||||
#[ORM\Column(length: 350)]
|
||||
private ?string $adresse = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $LastChangePassword = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'origine', targetEntity: Parrainage::class)]
|
||||
private Collection $parrainages;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'profile', targetEntity: Newslettre::class)]
|
||||
private Collection $newslettres;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'create_by', targetEntity: Article::class)]
|
||||
private Collection $articles;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'create_by', targetEntity: Service::class)]
|
||||
private Collection $services;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'createBy', targetEntity: ServiceRdv::class)]
|
||||
private Collection $serviceRdvs;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'client', targetEntity: ReservationArticle::class)]
|
||||
private Collection $reservationArticles;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'client', targetEntity: ReservationService::class)]
|
||||
private Collection $reservationServices;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'partenaire', targetEntity: Partenaire::class)]
|
||||
private Collection $partenaires;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'client', targetEntity: CommentArticle::class)]
|
||||
private Collection $commentArticles;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'client', targetEntity: CommentService::class)]
|
||||
private Collection $commentServices;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'client', targetEntity: CommentAnnonce::class)]
|
||||
private Collection $commentAnnonces;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->isDeleted = false;
|
||||
$this->dateAdd = new \DateTime();
|
||||
$this->lastLogin = new \DateTime();
|
||||
$this->LastChangePassword = new \DateTime();
|
||||
$this->positions = new ArrayCollection();
|
||||
$this->lignes = new ArrayCollection();
|
||||
$this->parrainages = new ArrayCollection();
|
||||
$this->newslettres = new ArrayCollection();
|
||||
$this->articles = new ArrayCollection();
|
||||
$this->services = new ArrayCollection();
|
||||
$this->serviceRdvs = new ArrayCollection();
|
||||
$this->reservationArticles = new ArrayCollection();
|
||||
$this->reservationServices = new ArrayCollection();
|
||||
$this->partenaires = new ArrayCollection();
|
||||
$this->commentArticles = new ArrayCollection();
|
||||
$this->commentServices = new ArrayCollection();
|
||||
$this->commentAnnonces = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setEmail(string $email): self
|
||||
{
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A visual identifier that represents this user.
|
||||
*
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function getUserIdentifier(): string
|
||||
{
|
||||
return (string) $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function getRoles(): array
|
||||
{
|
||||
$roles = $this->roles;
|
||||
// guarantee every user at least has ROLE_USER
|
||||
$roles[] = 'ROLE_USER';
|
||||
|
||||
return array_unique($roles);
|
||||
}
|
||||
|
||||
public function setRoles(array $roles): self
|
||||
{
|
||||
$this->roles = $roles;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function hasRole(string $role): ?bool
|
||||
{
|
||||
$Indice = array_search($role, $this->roles);
|
||||
if(is_numeric($Indice)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function addRole(string $role): ?bool
|
||||
{
|
||||
if(!$this->hasRole($role)){
|
||||
$this->roles[] = $role;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see PasswordAuthenticatedUserInterface
|
||||
*/
|
||||
public function getPassword(): string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function setPassword(string $password): self
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function eraseCredentials(): void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getFirstname(): ?string
|
||||
{
|
||||
return $this->firstname;
|
||||
}
|
||||
|
||||
public function setFirstname(string $firstname): self
|
||||
{
|
||||
$this->firstname = $firstname;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLastname(): ?string
|
||||
{
|
||||
return $this->lastname;
|
||||
}
|
||||
|
||||
public function setLastname(string $lastname): self
|
||||
{
|
||||
$this->lastname = $lastname;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getFullName(): ?string
|
||||
{
|
||||
return $this->firstname." ".$this->lastname;
|
||||
}
|
||||
|
||||
|
||||
public function getGender(): ?int
|
||||
{
|
||||
return $this->gender;
|
||||
}
|
||||
|
||||
public function setGender(int $gender): self
|
||||
{
|
||||
$this->gender = $gender;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPseudo(): ?string
|
||||
{
|
||||
return ($this->pseudo) ? $this->pseudo : $this->firstname ;
|
||||
}
|
||||
|
||||
public function setPseudo(?string $pseudo): self
|
||||
{
|
||||
$this->pseudo = $pseudo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBirthdate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->birthdate;
|
||||
}
|
||||
|
||||
public function setBirthdate(\DateTimeInterface $birthdate): self
|
||||
{
|
||||
$this->birthdate = $birthdate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPhoneNumber(): ?string
|
||||
{
|
||||
return $this->phoneNumber;
|
||||
}
|
||||
|
||||
public function setPhoneNumber(string $phoneNumber): self
|
||||
{
|
||||
$this->phoneNumber = $phoneNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLastLogin(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->lastLogin;
|
||||
}
|
||||
|
||||
public function setLastLogin(\DateTimeInterface $lastLogin): self
|
||||
{
|
||||
$this->lastLogin = $lastLogin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->dateAdd;
|
||||
}
|
||||
|
||||
public function setDateAdd(\DateTimeInterface $dateAdd): self
|
||||
{
|
||||
$this->dateAdd = $dateAdd;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIsDeleted(): ?bool
|
||||
{
|
||||
return $this->isDeleted;
|
||||
}
|
||||
|
||||
public function setIsDeleted(bool $isDeleted): self
|
||||
{
|
||||
$this->isDeleted = $isDeleted;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Position>
|
||||
*/
|
||||
public function getPositions(): Collection
|
||||
{
|
||||
return $this->positions;
|
||||
}
|
||||
|
||||
public function addPosition(Position $position): static
|
||||
{
|
||||
if (!$this->positions->contains($position)) {
|
||||
$this->positions->add($position);
|
||||
$position->setCreateBy($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePosition(Position $position): static
|
||||
{
|
||||
if ($this->positions->removeElement($position)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($position->getCreateBy() === $this) {
|
||||
$position->setCreateBy(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Ligne>
|
||||
*/
|
||||
public function getLignes(): Collection
|
||||
{
|
||||
return $this->lignes;
|
||||
}
|
||||
|
||||
public function addLigne(Ligne $ligne): static
|
||||
{
|
||||
if (!$this->lignes->contains($ligne)) {
|
||||
$this->lignes->add($ligne);
|
||||
$ligne->setCreateBy($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeLigne(Ligne $ligne): static
|
||||
{
|
||||
if ($this->lignes->removeElement($ligne)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($ligne->getCreateBy() === $this) {
|
||||
$ligne->setCreateBy(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCountry(): ?string
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
public function setCountry(string $country): static
|
||||
{
|
||||
$this->country = $country;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getZip(): ?int
|
||||
{
|
||||
return $this->zip;
|
||||
}
|
||||
|
||||
public function setZip(int $zip): static
|
||||
{
|
||||
$this->zip = $zip;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAdresse(): ?string
|
||||
{
|
||||
return $this->adresse;
|
||||
}
|
||||
|
||||
public function setAdresse(string $adresse): static
|
||||
{
|
||||
$this->adresse = $adresse;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLastChangePassword(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->LastChangePassword;
|
||||
}
|
||||
|
||||
public function setLastChangePassword(\DateTimeInterface $LastChangePassword): static
|
||||
{
|
||||
$this->LastChangePassword = $LastChangePassword;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Parrainage>
|
||||
*/
|
||||
public function getParrainages(): Collection
|
||||
{
|
||||
return $this->parrainages;
|
||||
}
|
||||
|
||||
public function addParrainage(Parrainage $parrainage): static
|
||||
{
|
||||
if (!$this->parrainages->contains($parrainage)) {
|
||||
$this->parrainages->add($parrainage);
|
||||
$parrainage->setOrigine($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeParrainage(Parrainage $parrainage): static
|
||||
{
|
||||
if ($this->parrainages->removeElement($parrainage)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($parrainage->getOrigine() === $this) {
|
||||
$parrainage->setOrigine(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Newslettre>
|
||||
*/
|
||||
public function getNewslettres(): Collection
|
||||
{
|
||||
return $this->newslettres;
|
||||
}
|
||||
|
||||
public function addNewslettre(Newslettre $newslettre): static
|
||||
{
|
||||
if (!$this->newslettres->contains($newslettre)) {
|
||||
$this->newslettres->add($newslettre);
|
||||
$newslettre->setProfile($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeNewslettre(Newslettre $newslettre): static
|
||||
{
|
||||
if ($this->newslettres->removeElement($newslettre)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($newslettre->getProfile() === $this) {
|
||||
$newslettre->setProfile(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Article>
|
||||
*/
|
||||
public function getArticles(): Collection
|
||||
{
|
||||
return $this->articles;
|
||||
}
|
||||
|
||||
public function addArticle(Article $article): static
|
||||
{
|
||||
if (!$this->articles->contains($article)) {
|
||||
$this->articles->add($article);
|
||||
$article->setCreateBy($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeArticle(Article $article): static
|
||||
{
|
||||
if ($this->articles->removeElement($article)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($article->getCreateBy() === $this) {
|
||||
$article->setCreateBy(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Service>
|
||||
*/
|
||||
public function getServices(): Collection
|
||||
{
|
||||
return $this->services;
|
||||
}
|
||||
|
||||
public function addService(Service $service): static
|
||||
{
|
||||
if (!$this->services->contains($service)) {
|
||||
$this->services->add($service);
|
||||
$service->setCreateBy($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeService(Service $service): static
|
||||
{
|
||||
if ($this->services->removeElement($service)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($service->getCreateBy() === $this) {
|
||||
$service->setCreateBy(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ServiceRdv>
|
||||
*/
|
||||
public function getServiceRdvs(): Collection
|
||||
{
|
||||
return $this->serviceRdvs;
|
||||
}
|
||||
|
||||
public function addServiceRdv(ServiceRdv $serviceRdv): static
|
||||
{
|
||||
if (!$this->serviceRdvs->contains($serviceRdv)) {
|
||||
$this->serviceRdvs->add($serviceRdv);
|
||||
$serviceRdv->setCreateBy($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeServiceRdv(ServiceRdv $serviceRdv): static
|
||||
{
|
||||
if ($this->serviceRdvs->removeElement($serviceRdv)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($serviceRdv->getCreateBy() === $this) {
|
||||
$serviceRdv->setCreateBy(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFrais(): ?int
|
||||
{
|
||||
return $this->frais;
|
||||
}
|
||||
|
||||
public function setFrais(int $frais): static
|
||||
{
|
||||
$this->frais = $frais;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getPanier($request, $detail = false): ?array
|
||||
{
|
||||
$session = $request->getSession();
|
||||
|
||||
$nameSession = 'Panier-'.$this->id;
|
||||
|
||||
$data = $session->get($nameSession);
|
||||
|
||||
$paniers = ($data)? $data : [];
|
||||
|
||||
if($detail)
|
||||
{
|
||||
$total = $nbr = 0;
|
||||
|
||||
foreach($paniers as $panier){
|
||||
$total += $panier['avance'];
|
||||
$nbr++;
|
||||
}
|
||||
|
||||
return ['paniers'=>$paniers, 'total'=> $total, 'nbr'=>$nbr];
|
||||
}
|
||||
|
||||
return $paniers;
|
||||
}
|
||||
|
||||
public function setPanier($request, $data): ?array
|
||||
{
|
||||
$session = $request->getSession();
|
||||
|
||||
$nameSession = 'Panier-'.$this->id;
|
||||
|
||||
$paniers = $session->get($nameSession);
|
||||
|
||||
$paniers[] = $data;
|
||||
|
||||
$session->set($nameSession, $paniers);
|
||||
|
||||
return $session->get($nameSession);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ReservationArticle>
|
||||
*/
|
||||
public function getReservationArticles(): Collection
|
||||
{
|
||||
return $this->reservationArticles;
|
||||
}
|
||||
|
||||
public function addReservationArticle(ReservationArticle $reservationArticle): static
|
||||
{
|
||||
if (!$this->reservationArticles->contains($reservationArticle)) {
|
||||
$this->reservationArticles->add($reservationArticle);
|
||||
$reservationArticle->setClient($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeReservationArticle(ReservationArticle $reservationArticle): static
|
||||
{
|
||||
if ($this->reservationArticles->removeElement($reservationArticle)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($reservationArticle->getClient() === $this) {
|
||||
$reservationArticle->setClient(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ReservationService>
|
||||
*/
|
||||
public function getReservationServices(): Collection
|
||||
{
|
||||
return $this->reservationServices;
|
||||
}
|
||||
|
||||
public function addReservationService(ReservationService $reservationService): static
|
||||
{
|
||||
if (!$this->reservationServices->contains($reservationService)) {
|
||||
$this->reservationServices->add($reservationService);
|
||||
$reservationService->setClient($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeReservationService(ReservationService $reservationService): static
|
||||
{
|
||||
if ($this->reservationServices->removeElement($reservationService)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($reservationService->getClient() === $this) {
|
||||
$reservationService->setClient(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Partenaire>
|
||||
*/
|
||||
public function getPartenaires(): Collection
|
||||
{
|
||||
return $this->partenaires;
|
||||
}
|
||||
|
||||
|
||||
public function getPartenairesActive()
|
||||
{
|
||||
$arrPartenaires = [];
|
||||
foreach($this->partenaires as $partenaire){
|
||||
if($partenaire->isActive() && $partenaire->getSociete()->isActive()){
|
||||
$arrPartenaires[] = $partenaire;
|
||||
}
|
||||
}
|
||||
|
||||
return $arrPartenaires;
|
||||
}
|
||||
|
||||
public function addPartenaire(Partenaire $partenaire): static
|
||||
{
|
||||
if (!$this->partenaires->contains($partenaire)) {
|
||||
$this->partenaires->add($partenaire);
|
||||
$partenaire->setPartenaire($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePartenaire(Partenaire $partenaire): static
|
||||
{
|
||||
if ($this->partenaires->removeElement($partenaire)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($partenaire->getPartenaire() === $this) {
|
||||
$partenaire->setPartenaire(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isActiveRolePartner(): bool
|
||||
{
|
||||
if($this->getIsDeleted()){ return false;}
|
||||
|
||||
foreach($this->partenaires as $partner){
|
||||
if($partner->isActive()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function getSelectPartner(){
|
||||
foreach($this->partenaires as $partner){
|
||||
if($partner->isActive() && $partner->isSelected()){
|
||||
return $partner;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, CommentArticle>
|
||||
*/
|
||||
public function getCommentArticles(): Collection
|
||||
{
|
||||
return $this->commentArticles;
|
||||
}
|
||||
|
||||
public function addCommentArticle(CommentArticle $commentArticle): static
|
||||
{
|
||||
if (!$this->commentArticles->contains($commentArticle)) {
|
||||
$this->commentArticles->add($commentArticle);
|
||||
$commentArticle->setClient($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCommentArticle(CommentArticle $commentArticle): static
|
||||
{
|
||||
if ($this->commentArticles->removeElement($commentArticle)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($commentArticle->getClient() === $this) {
|
||||
$commentArticle->setClient(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, CommentService>
|
||||
*/
|
||||
public function getCommentServices(): Collection
|
||||
{
|
||||
return $this->commentServices;
|
||||
}
|
||||
|
||||
public function addCommentService(CommentService $commentService): static
|
||||
{
|
||||
if (!$this->commentServices->contains($commentService)) {
|
||||
$this->commentServices->add($commentService);
|
||||
$commentService->setClient($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCommentService(CommentService $commentService): static
|
||||
{
|
||||
if ($this->commentServices->removeElement($commentService)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($commentService->getClient() === $this) {
|
||||
$commentService->setClient(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, CommentAnnonce>
|
||||
*/
|
||||
public function getCommentAnnonces(): Collection
|
||||
{
|
||||
return $this->commentAnnonces;
|
||||
}
|
||||
|
||||
public function addCommentAnnonce(CommentAnnonce $commentAnnonce): static
|
||||
{
|
||||
if (!$this->commentAnnonces->contains($commentAnnonce)) {
|
||||
$this->commentAnnonces->add($commentAnnonce);
|
||||
$commentAnnonce->setClient($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCommentAnnonce(CommentAnnonce $commentAnnonce): static
|
||||
{
|
||||
if ($this->commentAnnonces->removeElement($commentAnnonce)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($commentAnnonce->getClient() === $this) {
|
||||
$commentAnnonce->setClient(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
84
src/Form/BackendAdmin/AnnonceType.php
Normal file
84
src/Form/BackendAdmin/AnnonceType.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\BackendAdmin;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\File;
|
||||
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
|
||||
use App\Entity\Annonce;
|
||||
use App\Entity\Societe;
|
||||
use App\Entity\Categorie;
|
||||
|
||||
use App\Repository\SocieteRepository;
|
||||
use App\Repository\CategorieRepository;
|
||||
|
||||
class AnnonceType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('titre')
|
||||
->add('description', CKEditorType::class)
|
||||
->add('prix_marche')
|
||||
->add('prix_promo')
|
||||
->add('pourcentage_reduction')
|
||||
->add('largeur', ChoiceType::class, array(
|
||||
'label' => 'Liste des groupes',
|
||||
'required' => true,
|
||||
'placeholder' => "Sélectionnez la dimension d'annonce",
|
||||
'choices' => [
|
||||
'1/4 (438 * 240) pixels' => 1,
|
||||
'2/4 (876 * 240) pixels' => 2,
|
||||
'3/4 (1314 * 240) pixels' => 3,
|
||||
'4/4 (1752 * 240) pixels' => 4,
|
||||
],
|
||||
))
|
||||
|
||||
->add('societe', EntityType::class, array(
|
||||
'label' => 'availability.host',
|
||||
'class' => Societe::class,
|
||||
'placeholder' => 'Sélectionnez une Société',
|
||||
'required' => true,
|
||||
'query_builder' => function (SocieteRepository $er){
|
||||
return $er->createQueryBuilder('S')
|
||||
->orderBy('S.id', 'DESC');
|
||||
},
|
||||
|
||||
'choice_label' => function (Societe $societe) {
|
||||
return $societe->getId() . ' ' . $societe->getNom();
|
||||
}//,'attr' => ['class' => 'select-filter select2bs4 select-filter-speaker'],
|
||||
))
|
||||
->add('categorie', EntityType::class, array(
|
||||
'label' => 'Liste des groupes',
|
||||
'class' => Categorie::class,
|
||||
'required' => true,
|
||||
'placeholder' => 'Sélectionnez une catégorie',
|
||||
'query_builder' => function (CategorieRepository $er) {
|
||||
return $er->createQueryBuilder('u')
|
||||
->orderBy('u.nom', 'ASC');
|
||||
},
|
||||
'choice_label' => function (Categorie $categorie) {
|
||||
return $categorie->getId() . ' - ' . $categorie->getNom();
|
||||
}
|
||||
))
|
||||
->add("save", SubmitType::class)
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Annonce::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
80
src/Form/BackendAdmin/ArticleType.php
Normal file
80
src/Form/BackendAdmin/ArticleType.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\BackendAdmin;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
|
||||
use App\Entity\Article;
|
||||
use App\Entity\Societe;
|
||||
use App\Entity\Categorie;
|
||||
|
||||
use App\Repository\CategorieRepository;
|
||||
|
||||
class ArticleType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('titre')
|
||||
->add('marque')
|
||||
->add('description', CKEditorType::class)
|
||||
->add('adress')
|
||||
->add('prix_marche')
|
||||
->add('prix_promo')
|
||||
->add('limit_type', ChoiceType::class, array(
|
||||
'choices' => array(
|
||||
'Limitation par date' => 0,
|
||||
'Limitation par quantité' => 1,
|
||||
),
|
||||
'expanded' => true
|
||||
))
|
||||
|
||||
|
||||
->add('limit_quantite')
|
||||
|
||||
->add('limit_date', DateType::class, [
|
||||
'widget' => 'single_text',
|
||||
'required' => false,
|
||||
])
|
||||
|
||||
|
||||
|
||||
->add('societe', EntityType::class, [
|
||||
'class' => Societe::class,
|
||||
'choice_label' => 'nom',
|
||||
'multiple' => false,])
|
||||
->add('categorie', EntityType::class, array(
|
||||
'label' => 'Liste des groupes',
|
||||
'class' => Categorie::class,
|
||||
'required' => true,
|
||||
'placeholder' => 'Sélectionnez une catégorie',
|
||||
'query_builder' => function (CategorieRepository $er) {
|
||||
return $er->createQueryBuilder('u')
|
||||
->orderBy('u.nom', 'ASC');
|
||||
},
|
||||
'choice_label' => function (Categorie $categorie) {
|
||||
return $categorie->getId() . ' - ' . $categorie->getNom();
|
||||
}
|
||||
))
|
||||
->add("save", SubmitType::class)
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Article::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
46
src/Form/BackendAdmin/CategorieType.php
Normal file
46
src/Form/BackendAdmin/CategorieType.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\BackendAdmin;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
|
||||
use App\Repository\GroupeCategorieRepository;
|
||||
|
||||
use App\Entity\Categorie;
|
||||
use App\Entity\GroupeCategorie;
|
||||
|
||||
class CategorieType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('nom')
|
||||
->add('groupeCategorie', EntityType::class, array(
|
||||
'label' => 'Liste des groupes',
|
||||
'class' => GroupeCategorie::class,
|
||||
'required' => false,
|
||||
'placeholder' => 'Sélectionnez un groupe',
|
||||
'query_builder' => function (GroupeCategorieRepository $er) {
|
||||
return $er->createQueryBuilder('u')
|
||||
->orderBy('u.nom', 'ASC');
|
||||
},
|
||||
'choice_label' => function (GroupeCategorie $group) {
|
||||
return $group->getId() . ' - ' . $group->getNom();
|
||||
}
|
||||
))
|
||||
->add("save", SubmitType::class)
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Categorie::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
51
src/Form/BackendAdmin/GroupeCategorieType.php
Normal file
51
src/Form/BackendAdmin/GroupeCategorieType.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\BackendAdmin;
|
||||
|
||||
use App\Entity\GroupeCategorie;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\File;
|
||||
|
||||
class GroupeCategorieType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('nom')
|
||||
->add('icon_fontawesome')
|
||||
->add('image', FileType::class, [
|
||||
'label' => 'Votre image de profil (Des fichiers images uniquement)',
|
||||
'mapped' => false,
|
||||
'required' => false,
|
||||
'constraints' => [
|
||||
new File([
|
||||
'maxSize' => '1024k',
|
||||
'mimeTypes' => [
|
||||
'image/gif',
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/jpg',
|
||||
],
|
||||
'mimeTypesMessage' => 'Please upload a valid Image',
|
||||
])
|
||||
],
|
||||
])
|
||||
->add("save", SubmitType::class)
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => GroupeCategorie::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
59
src/Form/BackendAdmin/PartenaireType.php
Normal file
59
src/Form/BackendAdmin/PartenaireType.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\BackendAdmin;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Entity\Societe;
|
||||
use App\Entity\Partenaire;
|
||||
|
||||
class PartenaireType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('partenaire', EntityType::class, array(
|
||||
'class' => User::class,
|
||||
'label' => 'Nom Partenaire',
|
||||
'query_builder' => function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('U')
|
||||
->where("U.isDeleted = false")
|
||||
->orderBy('U.firstname', 'ASC');
|
||||
},
|
||||
'choice_label' => 'firstname',
|
||||
'multiple' => false,
|
||||
'required' => true,
|
||||
'by_reference' => false,
|
||||
))
|
||||
->add('societe', EntityType::class, array(
|
||||
'class' => Societe::class,
|
||||
'label' => 'Société',
|
||||
'query_builder' => function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('S')
|
||||
->where("S.active = false")
|
||||
->orderBy('S.nom', 'ASC');
|
||||
},
|
||||
'choice_label' => 'nom',
|
||||
'multiple' => false,
|
||||
'required' => true,
|
||||
//'by_reference' => false,
|
||||
))
|
||||
->add("save", SubmitType::class)
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Partenaire::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
79
src/Form/BackendAdmin/ServiceType.php
Normal file
79
src/Form/BackendAdmin/ServiceType.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\BackendAdmin;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
|
||||
use App\Entity\Service;
|
||||
use App\Entity\Societe;
|
||||
use App\Entity\Categorie;
|
||||
|
||||
use App\Repository\CategorieRepository;
|
||||
|
||||
class ServiceType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('titre')
|
||||
->add('marque')
|
||||
->add('description', CKEditorType::class)
|
||||
->add('adress')
|
||||
->add('prix_marche')
|
||||
->add('prix_promo')
|
||||
->add('limit_type', ChoiceType::class, array(
|
||||
'choices' => array(
|
||||
'Limitation par date' => 0,
|
||||
'Limitation par Rendez-vous' => 1,
|
||||
),
|
||||
'expanded' => true
|
||||
))
|
||||
|
||||
->add('duree')
|
||||
|
||||
->add('limit_date', DateType::class, [
|
||||
'widget' => 'single_text',
|
||||
'required' => false,
|
||||
])
|
||||
|
||||
|
||||
|
||||
->add('societe', EntityType::class, [
|
||||
'class' => Societe::class,
|
||||
'choice_label' => 'nom',
|
||||
'multiple' => false,])
|
||||
->add('categorie', EntityType::class, array(
|
||||
'label' => 'Liste des groupes',
|
||||
'class' => Categorie::class,
|
||||
'required' => true,
|
||||
'placeholder' => 'Sélectionnez une catégorie',
|
||||
'query_builder' => function (CategorieRepository $er) {
|
||||
return $er->createQueryBuilder('u')
|
||||
->orderBy('u.nom', 'ASC');
|
||||
},
|
||||
'choice_label' => function (Categorie $categorie) {
|
||||
return $categorie->getId() . ' - ' . $categorie->getNom();
|
||||
}
|
||||
))
|
||||
->add("save", SubmitType::class)
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Service::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
64
src/Form/BackendAdmin/SocieteType.php
Normal file
64
src/Form/BackendAdmin/SocieteType.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\BackendAdmin;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\File;
|
||||
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
|
||||
use App\Entity\Societe;
|
||||
|
||||
class SocieteType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('nom', TextType::class, array(
|
||||
'label' => 'Nom du Société'
|
||||
))
|
||||
->add('immatriculation')
|
||||
->add('adresse')
|
||||
->add('description', CKEditorType::class)
|
||||
->add('email', EmailType::class, array(
|
||||
'label' => 'Email'
|
||||
))
|
||||
->add('telephone')
|
||||
->add('fax')
|
||||
->add('photo', FileType::class, [
|
||||
'label' => 'Votre image de société (Des fichiers images uniquement)',
|
||||
'mapped' => false,
|
||||
'required' => false,
|
||||
'constraints' => [
|
||||
new File([
|
||||
'maxSize' => '1024k',
|
||||
'mimeTypes' => [
|
||||
'image/gif',
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/jpg',
|
||||
],
|
||||
'mimeTypesMessage' => 'Please upload a valid Image',
|
||||
])
|
||||
],
|
||||
])
|
||||
->add("save", SubmitType::class)
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Societe::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
24
src/Form/Frontend/CommentType.php
Normal file
24
src/Form/Frontend/CommentType.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\Frontend;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
|
||||
class CommentType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('commentaire', TextareaType::class, [
|
||||
'required' => true,
|
||||
])
|
||||
->add('save', SubmitType::class, ['label' => 'Enregiser le commentaire'])
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
42
src/Form/Frontend/UserAdresseType.php
Normal file
42
src/Form/Frontend/UserAdresseType.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\Frontend;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
|
||||
use App\Entity\User;
|
||||
|
||||
class UserAdresseType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('country', TextType::class, array(
|
||||
'label' => 'Pays',
|
||||
'required' => true
|
||||
))
|
||||
->add('zip', IntegerType::class, array(
|
||||
'label' => 'Code Postal',
|
||||
'required' => true
|
||||
))
|
||||
->add('adresse', TextType::class, array(
|
||||
'label' => 'Adresse',
|
||||
'required' => true
|
||||
))
|
||||
->add("save", SubmitType::class, ['attr'=>['class'=>'save'] ])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => User::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
34
src/Form/Frontend/UserInfoCnxType.php
Normal file
34
src/Form/Frontend/UserInfoCnxType.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\Frontend;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
|
||||
use App\Entity\User;
|
||||
|
||||
class UserInfoCnxType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('email', EmailType::class, array(
|
||||
'label' => 'Email'
|
||||
))
|
||||
->add('pseudo')
|
||||
|
||||
->add("save", SubmitType::class, ['attr'=>['class'=>'save'], ])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => User::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
57
src/Form/Frontend/UserInfoPersoType.php
Normal file
57
src/Form/Frontend/UserInfoPersoType.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\Frontend;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
|
||||
|
||||
class UserInfoPersoType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('firstname', TextType::class, array(
|
||||
'label' => 'Prénom',
|
||||
'required' => true
|
||||
))
|
||||
->add('lastname', TextType::class, array(
|
||||
'label' => 'Nom',
|
||||
'required' => true
|
||||
))
|
||||
->add('birthdate', BirthdayType::class, array(
|
||||
'label' => 'Date de naissance',
|
||||
'format' => 'dd/MM/yyyy',
|
||||
'widget' => 'single_text',
|
||||
'html5' => false,
|
||||
'attr' => [
|
||||
'class'=> 'datepicker form-control unicase-form-control',
|
||||
]
|
||||
))
|
||||
->add('phoneNumber', TextType::class, array(
|
||||
'label' => 'Numéro Téléphone',
|
||||
'required' => true
|
||||
))
|
||||
->add('gender', ChoiceType::class, array(
|
||||
'label' => 'Gender',
|
||||
'choices' => ['Femme' => 0, 'Homme' => 1 ],
|
||||
'required' => true
|
||||
))
|
||||
->add("save", SubmitType::class, ['attr'=>['class'=>'save']])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => User::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
117
src/Form/Frontend/UserRegistrationType.php
Normal file
117
src/Form/Frontend/UserRegistrationType.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\Frontend;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\IsTrue;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
|
||||
|
||||
class UserRegistrationType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('email', EmailType::class, array(
|
||||
'label' => 'Email'
|
||||
))
|
||||
->add('password', RepeatedType::class, [
|
||||
'type' => PasswordType::class,
|
||||
'invalid_message' => 'The password fields must match.',
|
||||
'options' => ['attr' => ['class' => 'password-field']],
|
||||
'required' => true,
|
||||
'first_options' => ['label' => 'Mot de passe'],
|
||||
'second_options' => ['label' => 'Confirmation mot de passe'],
|
||||
'constraints' => [
|
||||
new NotBlank([
|
||||
'message' => 'Please enter a password',
|
||||
]),
|
||||
new Length([
|
||||
'min' => 6,
|
||||
'minMessage' => 'Your password should be at least {{ limit }} characters',
|
||||
// max length allowed by Symfony for security reasons
|
||||
'max' => 4096,
|
||||
]),
|
||||
],
|
||||
])
|
||||
->add('firstname', TextType::class, array(
|
||||
'label' => 'Prénom',
|
||||
'required' => true
|
||||
))
|
||||
->add('lastname', TextType::class, array(
|
||||
'label' => 'Nom',
|
||||
'required' => true
|
||||
))
|
||||
->add('birthdate', BirthdayType::class, array(
|
||||
'label' => 'Date de naissance',
|
||||
'format' => 'dd/MM/yyyy',
|
||||
'widget' => 'single_text',
|
||||
'html5' => false,
|
||||
'attr' => [
|
||||
'class'=> 'datepicker form-control unicase-form-control',
|
||||
]
|
||||
))
|
||||
->add('phoneNumber', TextType::class, array(
|
||||
'label' => 'Numéro Téléphone',
|
||||
'required' => true
|
||||
))
|
||||
->add('gender', ChoiceType::class, array(
|
||||
'label' => 'Gender',
|
||||
'choices' => ['Femme' => 0, 'Homme' => 1 ],
|
||||
'required' => true
|
||||
))
|
||||
->add('pseudo')
|
||||
|
||||
->add('country', TextType::class, array(
|
||||
'label' => 'Pays',
|
||||
'required' => true
|
||||
))
|
||||
|
||||
->add('zip', IntegerType::class, array(
|
||||
'label' => 'Code Postal',
|
||||
'required' => true
|
||||
))
|
||||
|
||||
->add('adresse', TextType::class, array(
|
||||
'label' => 'Adresse',
|
||||
'required' => true
|
||||
))
|
||||
|
||||
->add('newsletter', CheckboxType::class, array(
|
||||
'mapped' => false,
|
||||
'required' => false,
|
||||
'label' => 'Je m’inscris à la newsletter et accepte de recevoir des communications de la part TNpromo',
|
||||
))
|
||||
->add('cgu', CheckboxType::class, array(
|
||||
'mapped' => false,
|
||||
'constraints' => [
|
||||
new IsTrue([
|
||||
'message' => 'Merci d’accepter les conditions générales d’utilisation en cochant la case ci-dessous'
|
||||
])
|
||||
],
|
||||
))
|
||||
->add("save", SubmitType::class, ['attr'=>['class'=>'save'], ])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => User::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
57
src/Form/Frontend/UserUpdatePasswordType.php
Normal file
57
src/Form/Frontend/UserUpdatePasswordType.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\Frontend;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
use App\Entity\User;
|
||||
|
||||
class UserUpdatePasswordType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('password', PasswordType::class, array(
|
||||
'constraints' => [
|
||||
new \Symfony\Component\Security\Core\Validator\Constraints\UserPassword(),
|
||||
],
|
||||
'label' => 'Mot de passe actuel',
|
||||
'required' => true,
|
||||
))
|
||||
->add('new_password', PasswordType::class, [
|
||||
'label' => 'Nouveau mot de passe *',
|
||||
'required' => true,
|
||||
'mapped' => false,
|
||||
'constraints' =>[
|
||||
new Assert\Regex(['pattern'=> "/^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z]).{8,200}$/",
|
||||
'message' => 'Mot de passe très faible']),
|
||||
],
|
||||
|
||||
])
|
||||
->add('confirm_password', PasswordType::class, [
|
||||
'required' => true,
|
||||
'mapped' => false,
|
||||
'label' => 'Confirmation du nouveau mot de passe *',
|
||||
'constraints' => [
|
||||
new Assert\EqualTo(['propertyPath'=>'parent.all[new_password].data',
|
||||
'message' => 'Les 2 mots de passe ne sont pas identiques.'])
|
||||
],
|
||||
])
|
||||
->add('submit', SubmitType::class, array(
|
||||
'label' => 'Envoyer'
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => User::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
11
src/Kernel.php
Executable file
11
src/Kernel.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||
|
||||
class Kernel extends BaseKernel
|
||||
{
|
||||
use MicroKernelTrait;
|
||||
}
|
||||
0
src/Repository/.gitignore
vendored
Executable file
0
src/Repository/.gitignore
vendored
Executable file
48
src/Repository/AffichageRepository.php
Normal file
48
src/Repository/AffichageRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Affichage;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Affichage>
|
||||
*
|
||||
* @method Affichage|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Affichage|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Affichage[] findAll()
|
||||
* @method Affichage[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class AffichageRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Affichage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Affichage[] Returns an array of Affichage objects
|
||||
*/
|
||||
public function findBetweenDate($debut, $end): array
|
||||
{
|
||||
return $this->createQueryBuilder('a')
|
||||
->where('a.date_show BETWEEN :Debut AND :Fin')
|
||||
->setParameter('Debut', new \DateTime($debut))
|
||||
->setParameter('Fin', new \DateTime($end))
|
||||
->orderBy('a.date_show', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
// public function findOneBySomeField($value): ?Affichage
|
||||
// {
|
||||
// return $this->createQueryBuilder('a')
|
||||
// ->andWhere('a.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
66
src/Repository/AnnoncePositionRepository.php
Normal file
66
src/Repository/AnnoncePositionRepository.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\AnnoncePosition;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<AnnoncePosition>
|
||||
*
|
||||
* @method AnnoncePosition|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method AnnoncePosition|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method AnnoncePosition[] findAll()
|
||||
* @method AnnoncePosition[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class AnnoncePositionRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, AnnoncePosition::class);
|
||||
}
|
||||
|
||||
public function save(AnnoncePosition $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function remove(AnnoncePosition $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->remove($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return AnnoncePosition[] Returns an array of AnnoncePosition objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('a')
|
||||
// ->andWhere('a.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('a.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?AnnoncePosition
|
||||
// {
|
||||
// return $this->createQueryBuilder('a')
|
||||
// ->andWhere('a.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
66
src/Repository/AnnonceRepository.php
Normal file
66
src/Repository/AnnonceRepository.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Annonce;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Annonce>
|
||||
*
|
||||
* @method Annonce|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Annonce|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Annonce[] findAll()
|
||||
* @method Annonce[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class AnnonceRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Annonce::class);
|
||||
}
|
||||
|
||||
public function save(Annonce $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function remove(Annonce $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->remove($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Annonce[] Returns an array of Annonce objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('a')
|
||||
// ->andWhere('a.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('a.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Annonce
|
||||
// {
|
||||
// return $this->createQueryBuilder('a')
|
||||
// ->andWhere('a.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
64
src/Repository/ArticleRepository.php
Normal file
64
src/Repository/ArticleRepository.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Article;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Article>
|
||||
*
|
||||
* @method Article|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Article|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Article[] findAll()
|
||||
* @method Article[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class ArticleRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Article::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Article[] Returns an array of Article objects
|
||||
*/
|
||||
public function show(){
|
||||
return $this->createQueryBuilder('a')
|
||||
->Where('(a.limit_type = 0) AND (a.limit_date >= :LimitDate)')
|
||||
->orWhere('(a.limit_type = 1) AND (a.limit_quantite > 0)')
|
||||
->andWhere('a.active = :Active')
|
||||
->setParameter('LimitDate', new \DateTime())
|
||||
->setParameter('Active', true)
|
||||
->orderBy('a.id', 'DESC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Article[] Returns an array of Article objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('a')
|
||||
// ->andWhere('a.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('a.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Article
|
||||
// {
|
||||
// return $this->createQueryBuilder('a')
|
||||
// ->andWhere('a.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
48
src/Repository/CategorieRepository.php
Normal file
48
src/Repository/CategorieRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Categorie;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Categorie>
|
||||
*
|
||||
* @method Categorie|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Categorie|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Categorie[] findAll()
|
||||
* @method Categorie[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class CategorieRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Categorie::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Categorie[] Returns an array of Categorie objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('c.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Categorie
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
48
src/Repository/CommentAnnonceRepository.php
Normal file
48
src/Repository/CommentAnnonceRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\CommentAnnonce;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<CommentAnnonce>
|
||||
*
|
||||
* @method CommentAnnonce|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method CommentAnnonce|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method CommentAnnonce[] findAll()
|
||||
* @method CommentAnnonce[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class CommentAnnonceRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, CommentAnnonce::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return CommentAnnonce[] Returns an array of CommentAnnonce objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('c.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?CommentAnnonce
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
48
src/Repository/CommentArticleRepository.php
Normal file
48
src/Repository/CommentArticleRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\CommentArticle;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<CommentArticle>
|
||||
*
|
||||
* @method CommentArticle|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method CommentArticle|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method CommentArticle[] findAll()
|
||||
* @method CommentArticle[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class CommentArticleRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, CommentArticle::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return CommentArticle[] Returns an array of CommentArticle objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('c.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?CommentArticle
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
48
src/Repository/CommentServiceRepository.php
Normal file
48
src/Repository/CommentServiceRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\CommentService;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<CommentService>
|
||||
*
|
||||
* @method CommentService|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method CommentService|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method CommentService[] findAll()
|
||||
* @method CommentService[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class CommentServiceRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, CommentService::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return CommentService[] Returns an array of CommentService objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('c.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?CommentService
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
48
src/Repository/GroupeCategorieRepository.php
Normal file
48
src/Repository/GroupeCategorieRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\GroupeCategorie;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<GroupeCategorie>
|
||||
*
|
||||
* @method GroupeCategorie|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method GroupeCategorie|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method GroupeCategorie[] findAll()
|
||||
* @method GroupeCategorie[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class GroupeCategorieRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, GroupeCategorie::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return GroupeCategorie[] Returns an array of GroupeCategorie objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('g')
|
||||
// ->andWhere('g.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('g.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?GroupeCategorie
|
||||
// {
|
||||
// return $this->createQueryBuilder('g')
|
||||
// ->andWhere('g.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
60
src/Repository/LigneRepository.php
Normal file
60
src/Repository/LigneRepository.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Ligne;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Ligne>
|
||||
*
|
||||
* @method Ligne|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Ligne|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Ligne[] findAll()
|
||||
* @method Ligne[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class LigneRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Ligne::class);
|
||||
}
|
||||
|
||||
|
||||
public function findAllKeyId()
|
||||
{
|
||||
$lignes = [];
|
||||
foreach($this->findAll() as $ligne){
|
||||
$lignes[$ligne->getId()] = $ligne;
|
||||
}
|
||||
ksort($lignes);
|
||||
return $lignes;
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * @return Ligne[] Returns an array of Ligne objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('l')
|
||||
// ->andWhere('l.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('l.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Ligne
|
||||
// {
|
||||
// return $this->createQueryBuilder('l')
|
||||
// ->andWhere('l.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
48
src/Repository/NewslettreRepository.php
Normal file
48
src/Repository/NewslettreRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Newslettre;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Newslettre>
|
||||
*
|
||||
* @method Newslettre|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Newslettre|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Newslettre[] findAll()
|
||||
* @method Newslettre[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class NewslettreRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Newslettre::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Newslettre[] Returns an array of Newslettre objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('n')
|
||||
// ->andWhere('n.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('n.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Newslettre
|
||||
// {
|
||||
// return $this->createQueryBuilder('n')
|
||||
// ->andWhere('n.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
48
src/Repository/ParrainageRepository.php
Normal file
48
src/Repository/ParrainageRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Parrainage;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Parrainage>
|
||||
*
|
||||
* @method Parrainage|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Parrainage|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Parrainage[] findAll()
|
||||
* @method Parrainage[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class ParrainageRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Parrainage::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Parrainage[] Returns an array of Parrainage objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('p.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Parrainage
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
48
src/Repository/PartenaireRepository.php
Normal file
48
src/Repository/PartenaireRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Partenaire;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Partenaire>
|
||||
*
|
||||
* @method Partenaire|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Partenaire|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Partenaire[] findAll()
|
||||
* @method Partenaire[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class PartenaireRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Partenaire::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Partenaire[] Returns an array of Partenaire objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('p.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Partenaire
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
76
src/Repository/PositionRepository.php
Normal file
76
src/Repository/PositionRepository.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Position;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Position>
|
||||
*
|
||||
* @method Position|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Position|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Position[] findAll()
|
||||
* @method Position[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class PositionRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Position::class);
|
||||
}
|
||||
|
||||
public function addPosition($annonce, $date_debut, $date_fin, $id_ligne, $user)
|
||||
{
|
||||
$position = new Position();
|
||||
$position->setAnnonce($annonce);
|
||||
$position->setDateDebut(new \DateTime($date_debut));
|
||||
$position->setDateFin(new \DateTime($date_fin));
|
||||
$position->setLigne($id_ligne);
|
||||
$position->setCreateBy($user);
|
||||
|
||||
$this->_em->persist($position);
|
||||
$this->_em->flush();
|
||||
|
||||
return $position;
|
||||
}
|
||||
|
||||
|
||||
public function getPositionByDate($date)
|
||||
{
|
||||
return $this->createQueryBuilder('p')
|
||||
->where('p.date_debut <= :DateSelect')
|
||||
->andWhere('p.date_fin >= :DateSelect')
|
||||
->setParameter('DateSelect', $date)
|
||||
->orderBy('p.ligne', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Position[] Returns an array of Position objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('p.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Position
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
82
src/Repository/RdvTempoRepository.php
Normal file
82
src/Repository/RdvTempoRepository.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\RdvTempo;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<RdvTempo>
|
||||
*
|
||||
* @method RdvTempo|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method RdvTempo|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method RdvTempo[] findAll()
|
||||
* @method RdvTempo[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class RdvTempoRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, RdvTempo::class);
|
||||
}
|
||||
|
||||
|
||||
public function RdvEncoursAdd($user, $serviceRdvReservation)
|
||||
{
|
||||
$this->RdvEncoursPasser();
|
||||
|
||||
$rdvTempo = new RdvTempo();
|
||||
$rdvTempo->setClient($user);
|
||||
$rdvTempo->setDateAdd(new \DateTime());
|
||||
$rdvTempo->setServiceRdvReservation($serviceRdvReservation);
|
||||
|
||||
$this->_em->persist($rdvTempo);
|
||||
$this->_em->flush();
|
||||
|
||||
return $rdvTempo;
|
||||
}
|
||||
|
||||
public function RdvEncoursListId()
|
||||
{
|
||||
$this->RdvEncoursPasser();
|
||||
|
||||
$ListId = [];
|
||||
foreach($this->findAll() as $value){
|
||||
$ListId[] = $value->getServiceRdvReservation()->getId();
|
||||
}
|
||||
return $ListId;
|
||||
}
|
||||
|
||||
|
||||
public function RdvEncoursPasser()
|
||||
{
|
||||
$now = new \DateTime();
|
||||
|
||||
foreach($this->findAll() as $RdvEncour){
|
||||
$dateAdd = clone $RdvEncour->getDateAdd();
|
||||
$dateAdd->modify("+15 minutes");
|
||||
if($now > $dateAdd){
|
||||
$this->_em->remove($RdvEncour);
|
||||
}
|
||||
}
|
||||
|
||||
$this->_em->flush();
|
||||
}
|
||||
|
||||
|
||||
public function RdvEncoursDelete($serviceRdvReservation)
|
||||
{
|
||||
$rdvTempo = $this->findOneByBy(['serviceRdvReservation'=>$serviceRdvReservation]);
|
||||
|
||||
if($rdvTempo){
|
||||
$this->_em->remove($rdvTempo);
|
||||
$this->_em->flush();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
65
src/Repository/ReservationArticleRepository.php
Normal file
65
src/Repository/ReservationArticleRepository.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\ReservationArticle;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<ReservationArticle>
|
||||
*
|
||||
* @method ReservationArticle|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method ReservationArticle|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method ReservationArticle[] findAll()
|
||||
* @method ReservationArticle[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class ReservationArticleRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, ReservationArticle::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ReservationArticle[] Returns an array of ReservationArticle objects
|
||||
*/
|
||||
public function findBySociete($societe): array
|
||||
{
|
||||
return $this->createQueryBuilder('r')
|
||||
->Where('r.societe = :Societe')
|
||||
->setParameter('Societe', $societe)
|
||||
|
||||
->leftjoin('r.reservationArticleValidation', 'v')
|
||||
->andWhere('v.id IS NULL')
|
||||
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return ReservationArticle[] Returns an array of ReservationArticle objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('r.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?ReservationArticle
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
49
src/Repository/ReservationArticleValidationRepository.php
Normal file
49
src/Repository/ReservationArticleValidationRepository.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\ReservationArticleValidation;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<ReservationArticleValidation>
|
||||
*
|
||||
* @method ReservationArticleValidation|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method ReservationArticleValidation|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method ReservationArticleValidation[] findAll()
|
||||
* @method ReservationArticleValidation[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class ReservationArticleValidationRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, ReservationArticleValidation::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ReservationArticleValidation[] Returns an array of ReservationArticleValidation objects
|
||||
*/
|
||||
public function findBySociete($societe): array
|
||||
{
|
||||
return $this->createQueryBuilder('v')
|
||||
|
||||
->innerJoin('v.reservationArticle', 'ra')
|
||||
->andWhere('ra.societe = :Societe')
|
||||
->setParameter('Societe', $societe)
|
||||
//->orderBy('r.id', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
// public function findOneBySomeField($value): ?ReservationArticleValidation
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
66
src/Repository/ReservationServiceRepository.php
Normal file
66
src/Repository/ReservationServiceRepository.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\ReservationService;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<ReservationService>
|
||||
*
|
||||
* @method ReservationService|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method ReservationService|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method ReservationService[] findAll()
|
||||
* @method ReservationService[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class ReservationServiceRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, ReservationService::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ReservationService[] Returns an array of ReservationService objects
|
||||
*/
|
||||
public function findBySociete($societe): array
|
||||
{
|
||||
return $this->createQueryBuilder('r')
|
||||
->Where('r.societe = :Societe')
|
||||
->setParameter('Societe', $societe)
|
||||
|
||||
->leftjoin('r.reservationServiceValidation', 'v')
|
||||
->andWhere('v.id IS NULL')
|
||||
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * @return ReservationService[] Returns an array of ReservationService objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('r.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?ReservationService
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
64
src/Repository/ReservationServiceValidationRepository.php
Normal file
64
src/Repository/ReservationServiceValidationRepository.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\ReservationServiceValidation;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<ReservationServiceValidation>
|
||||
*
|
||||
* @method ReservationServiceValidation|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method ReservationServiceValidation|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method ReservationServiceValidation[] findAll()
|
||||
* @method ReservationServiceValidation[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class ReservationServiceValidationRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, ReservationServiceValidation::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ReservationServiceValidation[] Returns an array of ReservationServiceValidation objects
|
||||
*/
|
||||
public function findBySociete($societe): array
|
||||
{
|
||||
return $this->createQueryBuilder('s')
|
||||
|
||||
->innerJoin('s.reservationService', 'rs')
|
||||
->andWhere('rs.societe = :Societe')
|
||||
->setParameter('Societe', $societe)
|
||||
//->orderBy('r.id', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return ReservationServiceValidation[] Returns an array of ReservationServiceValidation objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('r.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?ReservationServiceValidation
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
48
src/Repository/ServiceRDVRepository.php
Normal file
48
src/Repository/ServiceRDVRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\ServiceRDV;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<ServiceRDV>
|
||||
*
|
||||
* @method ServiceRDV|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method ServiceRDV|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method ServiceRDV[] findAll()
|
||||
* @method ServiceRDV[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class ServiceRDVRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, ServiceRDV::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return ServiceRDV[] Returns an array of ServiceRDV objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('s.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?ServiceRDV
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
48
src/Repository/ServiceRdvRepository.php
Normal file
48
src/Repository/ServiceRdvRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\ServiceRdv;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<ServiceRdv>
|
||||
*
|
||||
* @method ServiceRdv|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method ServiceRdv|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method ServiceRdv[] findAll()
|
||||
* @method ServiceRdv[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class ServiceRdvRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, ServiceRdv::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return ServiceRdv[] Returns an array of ServiceRdv objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('s.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?ServiceRdv
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
48
src/Repository/ServiceRdvReservationRepository.php
Normal file
48
src/Repository/ServiceRdvReservationRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\ServiceRdvReservation;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<ServiceRdvReservation>
|
||||
*
|
||||
* @method ServiceRdvReservation|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method ServiceRdvReservation|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method ServiceRdvReservation[] findAll()
|
||||
* @method ServiceRdvReservation[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class ServiceRdvReservationRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, ServiceRdvReservation::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return ServiceRdvReservation[] Returns an array of ServiceRdvReservation objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('s.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?ServiceRdvReservation
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
97
src/Repository/ServiceRepository.php
Normal file
97
src/Repository/ServiceRepository.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Service;
|
||||
use App\Entity\ServiceRdvReservation;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Service>
|
||||
*
|
||||
* @method Service|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Service|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Service[] findAll()
|
||||
* @method Service[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class ServiceRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Service::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Service[] Returns an array of Service objects
|
||||
*/
|
||||
public function show(): array
|
||||
{
|
||||
$serviceDate = $this->showLimitationByDate();
|
||||
$serviceRDV = $this->showLimitationByRDV();
|
||||
return array_merge($serviceDate, $serviceRDV);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Service[] Returns an array of Service objects
|
||||
*/
|
||||
public function showLimitationByDate(): array
|
||||
{
|
||||
return $this->createQueryBuilder('s')
|
||||
->Where('s.active = :Active')
|
||||
->andWhere('s.limit_type = 0')
|
||||
->andWhere('s.limit_date >= :LimitDate')
|
||||
->setParameter('Active', true)
|
||||
->setParameter('LimitDate', new \DateTime())
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Service[] Returns an array of Service objects
|
||||
*/
|
||||
public function showLimitationByRDV(): array
|
||||
{
|
||||
$data = $this->createQueryBuilder('s')
|
||||
->select('S.id')
|
||||
->from(ServiceRdvReservation::class, 'R')
|
||||
->innerJoin('R.service', 'S')
|
||||
->Where('R.disponible = :Dispo')->setParameter('Dispo', true)
|
||||
->andWhere('R.dateDebut > :DateDebut')->setParameter('DateDebut', new \DateTime())
|
||||
->groupBy('S.id')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
$ListId = array_column($data, 'id');
|
||||
|
||||
return $this->findBy(['id'=>$ListId, 'active'=>true]);
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * @return Service[] Returns an array of Service objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('s.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Service
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
66
src/Repository/SocieteRepository.php
Normal file
66
src/Repository/SocieteRepository.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Societe;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Societe>
|
||||
*
|
||||
* @method Societe|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Societe|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Societe[] findAll()
|
||||
* @method Societe[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class SocieteRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Societe::class);
|
||||
}
|
||||
|
||||
public function save(Societe $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function remove(Societe $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->remove($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Societe[] Returns an array of Societe objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('s.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Societe
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
83
src/Repository/UserRepository.php
Normal file
83
src/Repository/UserRepository.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\User;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<User>
|
||||
*
|
||||
* @method User|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method User|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method User[] findAll()
|
||||
* @method User[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, User::class);
|
||||
}
|
||||
|
||||
public function save(User $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function remove(User $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->remove($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to upgrade (rehash) the user's password automatically over time.
|
||||
*/
|
||||
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
|
||||
}
|
||||
|
||||
$user->setPassword($newHashedPassword);
|
||||
|
||||
$this->save($user, true);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return User[] Returns an array of User objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('u')
|
||||
// ->andWhere('u.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('u.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?User
|
||||
// {
|
||||
// return $this->createQueryBuilder('u')
|
||||
// ->andWhere('u.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
75
src/Security/LoginAuthenticator.php
Normal file
75
src/Security/LoginAuthenticator.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Security;
|
||||
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Http\SecurityRequestAttributes;
|
||||
use Symfony\Component\Security\Http\Authenticator\AbstractLoginFormAuthenticator;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
|
||||
use Symfony\Component\Security\Http\Util\TargetPathTrait;
|
||||
|
||||
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class LoginAuthenticator extends AbstractLoginFormAuthenticator
|
||||
{
|
||||
use TargetPathTrait;
|
||||
|
||||
public const LOGIN_ROUTE = 'frontend_security_login';
|
||||
|
||||
private $em;
|
||||
|
||||
public function __construct(private UrlGeneratorInterface $urlGenerator, EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function authenticate(Request $request): Passport
|
||||
{
|
||||
$email = $request->request->get('email', '');
|
||||
|
||||
$request->getSession()->set(SecurityRequestAttributes::LAST_USERNAME, $email);
|
||||
|
||||
return new Passport(
|
||||
new UserBadge($email),
|
||||
new PasswordCredentials($request->request->get('password', '')),
|
||||
[
|
||||
new CsrfTokenBadge('authenticate', $request->request->get('_csrf_token')),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
|
||||
{
|
||||
if ($targetPath = $this->getTargetPath($request->getSession(), $firewallName)) {
|
||||
return new RedirectResponse($targetPath);
|
||||
}
|
||||
|
||||
$user = $token->getUser();
|
||||
$user->setLastLogin(new \DateTime());
|
||||
$this->em->persist($user);
|
||||
$this->em->flush();
|
||||
$this->em->clear();
|
||||
|
||||
if ($user->hasRole('ROLE_ADMIN')){
|
||||
return new RedirectResponse($this->urlGenerator->generate('backend_admin_dashboard_index'));
|
||||
}elseif ($user->hasRole('ROLE_PARTNER') or $user->hasRole('ROLE_PARTNER_ADVANCED')){
|
||||
return new RedirectResponse($this->urlGenerator->generate('backend_partner_dashboard_index'));
|
||||
}else{
|
||||
return new RedirectResponse($this->urlGenerator->generate('frontend_home_index'));
|
||||
}
|
||||
}
|
||||
|
||||
protected function getLoginUrl(Request $request): string
|
||||
{
|
||||
return $this->urlGenerator->generate(self::LOGIN_ROUTE);
|
||||
}
|
||||
}
|
||||
118
src/Service/BackendAdmin/ServiceAnnonce.php
Normal file
118
src/Service/BackendAdmin/ServiceAnnonce.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\BackendAdmin;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Repository\LigneRepository;
|
||||
use App\Repository\AnnonceRepository;
|
||||
use App\Repository\AffichageRepository;
|
||||
use App\Repository\PositionRepository;
|
||||
|
||||
use App\Entity\Affichage;
|
||||
|
||||
class ServiceAnnonce
|
||||
{
|
||||
|
||||
/**
|
||||
* @var LigneRepository $ligneRepository
|
||||
*/
|
||||
private $ligneRepository;
|
||||
|
||||
/**
|
||||
* @var AnnonceRepository $annonceRepository
|
||||
*/
|
||||
private $annonceRepository;
|
||||
|
||||
/**
|
||||
* @var AffichageRepository $affichageRepository
|
||||
*/
|
||||
private $affichageRepository;
|
||||
|
||||
/**
|
||||
* @var PositionRepository $positionRepository
|
||||
*/
|
||||
private $positionRepository;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @param PositionRepository $positionRepository
|
||||
* @param AnnonceRepository $annonceRepository
|
||||
* @param AffichageRepository $affichageRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
PositionRepository $positionRepository,
|
||||
AnnonceRepository $annonceRepository,
|
||||
LigneRepository $ligneRepository,
|
||||
AffichageRepository $affichageRepository,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->positionRepository = $positionRepository;
|
||||
$this->annonceRepository = $annonceRepository;
|
||||
$this->ligneRepository = $ligneRepository;
|
||||
$this->affichageRepository = $affichageRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function getDisponiblePosition($annonce, $id_ligne, $date, $affichages)
|
||||
{
|
||||
$totalLargeur = $annonce->getLargeur();
|
||||
foreach($affichages as $affichage){
|
||||
if($date == $affichage->getDateShow()){
|
||||
if($id_ligne == $affichage->getLigne()){
|
||||
$totalLargeur += $affichage->getLargeur();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($id_ligne > 10){
|
||||
return null;
|
||||
}elseif($totalLargeur > 4){
|
||||
return $this->getDisponiblePosition($annonce, ++$id_ligne, $date, $affichages);
|
||||
}else{
|
||||
return $id_ligne;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getAnnoncePosition($annonce, $date_debut, $date_fin, $id_ligne)
|
||||
{
|
||||
$arrAffichage = [];
|
||||
|
||||
$interval = new \DateInterval('P1D');
|
||||
$realEnd = new \DateTime($date_fin);
|
||||
$realEnd->add($interval);
|
||||
$period = new \DatePeriod(new \DateTime($date_debut), $interval, $realEnd);
|
||||
|
||||
$lignes = $this->ligneRepository->findAllKeyId();
|
||||
|
||||
$affichages = $this->affichageRepository->findBetweenDate($date_debut, $date_fin);
|
||||
|
||||
foreach($period as $date) {
|
||||
|
||||
$ligneTrouver = $this->getDisponiblePosition($annonce, $id_ligne, $date, $affichages);
|
||||
|
||||
if($ligneTrouver){
|
||||
$ligne = $lignes[$ligneTrouver];
|
||||
$prix = $ligne->getPrixByBimension($annonce->getLargeur());
|
||||
$arrAffichage[] = ['date'=>$date, 'ligne'=>$ligne, 'prix'=>$prix, 'dispo'=>true];
|
||||
}else{
|
||||
$arrAffichage[] = ['date'=>$date, 'ligne'=>null, 'prix'=>0, 'dispo'=>false];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $arrAffichage;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
47
src/Service/BackendAdmin/ServiceService.php
Normal file
47
src/Service/BackendAdmin/ServiceService.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\BackendAdmin;
|
||||
|
||||
|
||||
class ServiceService
|
||||
{
|
||||
|
||||
public function getListRendezVous($startDate, $endDate, $startTime, $endTime, $duree, $between, $excludeDay)
|
||||
{
|
||||
$excludeDay = ["Sun"];
|
||||
|
||||
$intervalDay = new \DateInterval('P1D');
|
||||
$dateRangeDay = new \DatePeriod($startDate, $intervalDay, $endDate);
|
||||
|
||||
$range = [];
|
||||
foreach ($dateRangeDay as $date) {
|
||||
|
||||
$dateStr = $date->format("Y-m-d");
|
||||
|
||||
|
||||
$Indice = array_search($date->format('D'), $excludeDay);
|
||||
if(!$excludeDay || !is_numeric($Indice)){
|
||||
|
||||
$debut = new \DateTime("$dateStr $startTime");
|
||||
$tempo = new \DateTime("$dateStr $startTime");
|
||||
|
||||
$end = new \DateTime("$dateStr $endTime");
|
||||
|
||||
do{
|
||||
|
||||
$fin = clone $tempo->modify("+$duree minutes");
|
||||
|
||||
if($fin<$end){
|
||||
$range[] = ['debut'=>$debut, 'fin'=>$fin];
|
||||
}
|
||||
|
||||
$debut = clone $tempo->modify("+$between minutes");
|
||||
|
||||
}while($debut < $end);
|
||||
}
|
||||
|
||||
}
|
||||
return $range;
|
||||
}
|
||||
|
||||
}
|
||||
221
src/Service/Frontend/ServiceHome.php
Normal file
221
src/Service/Frontend/ServiceHome.php
Normal file
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\Frontend;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use App\Repository\AffichageRepository;
|
||||
use App\Repository\ArticleRepository;
|
||||
use App\Repository\ServiceRepository;
|
||||
|
||||
class ServiceHome
|
||||
{
|
||||
|
||||
/**
|
||||
* @var AffichageRepository $affichageRepository
|
||||
*/
|
||||
private $affichageRepository;
|
||||
|
||||
/**
|
||||
* @var ArticleRepository $articleRepository
|
||||
*/
|
||||
private $articleRepository;
|
||||
|
||||
/**
|
||||
* @var ServiceRepository $serviceRepository
|
||||
*/
|
||||
private $serviceRepository;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface $em
|
||||
*/
|
||||
private $em;
|
||||
|
||||
|
||||
/**
|
||||
* @param AffichageRepository $affichageRepository
|
||||
* @param ArticleRepository $articleRepository
|
||||
* @param ServiceRepository $serviceRepository
|
||||
* @param EntityManagerInterface $em
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
AffichageRepository $affichageRepository,
|
||||
ArticleRepository $articleRepository,
|
||||
ServiceRepository $serviceRepository,
|
||||
EntityManagerInterface $em
|
||||
){
|
||||
$this->affichageRepository = $affichageRepository;
|
||||
$this->articleRepository = $articleRepository;
|
||||
$this->serviceRepository = $serviceRepository;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
$affichages = $this->affichageRepository->findBy(['date_show'=>new \DateTime()], ["ligne"=>"ASC", "largeur"=>"DESC"]);
|
||||
$articles = $this->articleRepository->show();
|
||||
$services = $this->serviceRepository->show();
|
||||
|
||||
$Art = $Ser = 0;
|
||||
$LengArt = count($articles);
|
||||
$LengSer = count($services);
|
||||
$promos = [];
|
||||
|
||||
foreach($affichages as $affichage){
|
||||
$promos[$affichage->getLigne()]['largeur'][] = $affichage->getLargeur();
|
||||
|
||||
$annonce = $affichage->getAnnonce();
|
||||
$promos[$affichage->getLigne()]['promos'][] = ['id'=>$annonce->getId(), 'img'=>$annonce->getImageHome(), 'type'=>'annonce', 'title'=>$annonce->getTitre()];
|
||||
}
|
||||
|
||||
for($i=1; $i<=12; $i++){
|
||||
|
||||
$largeur = 0;
|
||||
if(isset($promos[$i]['largeur'])){
|
||||
foreach($promos[$i]['largeur'] as $larg){
|
||||
$largeur += $larg;
|
||||
}
|
||||
}
|
||||
|
||||
//(largeur=4)
|
||||
if($largeur == 4){
|
||||
break;
|
||||
}
|
||||
|
||||
//(largeur=3) 1
|
||||
if($largeur == 3){
|
||||
$dataLarg1111 = $this->Largeur31($promos, $i, $articles, $Art, $LengArt, $services, $Ser, $LengSer);
|
||||
$Art = $dataLarg1111['Art'];
|
||||
$Ser = $dataLarg1111['Ser'];
|
||||
$promos = $dataLarg1111['promos'];
|
||||
}
|
||||
|
||||
//(largeur=2) 1, 1
|
||||
if($largeur == 2){
|
||||
$dataLarg1111 = $this->Largeur211($promos, $i, $articles, $Art, $LengArt, $services, $Ser, $LengSer);
|
||||
$Art = $dataLarg1111['Art'];
|
||||
$Ser = $dataLarg1111['Ser'];
|
||||
$promos = $dataLarg1111['promos'];
|
||||
}
|
||||
|
||||
|
||||
//(largeur=1) 1, 1, 1
|
||||
if($largeur == 1){
|
||||
$dataLarg1111 = $this->Largeur1111($promos, $i, $articles, $Art, $LengArt, $services, $Ser, $LengSer);
|
||||
$Art = $dataLarg1111['Art'];
|
||||
$Ser = $dataLarg1111['Ser'];
|
||||
$promos = $dataLarg1111['promos'];
|
||||
}
|
||||
|
||||
//(largeur=0) 1, 1, 1, 1
|
||||
if($largeur == 0){
|
||||
$dataLarg1111 = $this->Largeur01111($promos, $i, $articles, $Art, $LengArt, $services, $Ser, $LengSer);
|
||||
$Art = $dataLarg1111['Art'];
|
||||
$Ser = $dataLarg1111['Ser'];
|
||||
$promos = $dataLarg1111['promos'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
ksort($promos);
|
||||
|
||||
return $promos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//largeur 2, 1, 1
|
||||
public function Largeur211($promos, $start, $articles, $art, $lengArt, $services, $ser, $lengSer)
|
||||
{
|
||||
if( ($art<$lengArt) && (isset($articles[$art])) ){
|
||||
$promos[$start]['largeur'][] = 1;
|
||||
$promos[$start]['promos'][] = ['id'=>$articles[$art]->getId(), 'img'=>$articles[$art]->getImageDefault(), 'type'=>'article', 'title'=>$articles[$art]->getTitre()];
|
||||
$art++;
|
||||
}elseif( ($ser<$lengSer) && (isset($services[$ser])) ){
|
||||
$promos[$start]['largeur'][] = 1;
|
||||
$promos[$start]['promos'][] = ['id'=>$services[$ser]->getId(), 'img'=>$services[$ser]->getImageDefault(), 'type'=>'service', 'title'=>$services[$ser]->getTitre()];
|
||||
$ser++;
|
||||
}
|
||||
|
||||
if( ($ser<$lengSer) && (isset($services[$ser])) ){
|
||||
$promos[$start]['largeur'][] = 1;
|
||||
$promos[$start]['promos'][] = ['id'=>$services[$ser]->getId(), 'img'=>$services[$ser]->getImageDefault(), 'type'=>'service', 'title'=>$services[$ser]->getTitre()];
|
||||
$ser++;
|
||||
}elseif( ($art<$lengArt) && (isset($articles[$art])) ){
|
||||
$promos[$start]['largeur'][] = 1;
|
||||
$promos[$start]['promos'][] = ['id'=>$articles[$art]->getId(), 'img'=>$articles[$art]->getImageDefault(), 'type'=>'article', 'title'=>$articles[$art]->getTitre()];
|
||||
$art++;
|
||||
}
|
||||
|
||||
return ['promos'=>$promos, 'Art'=>$art, 'Ser'=>$ser];
|
||||
}
|
||||
|
||||
//largeur 3, 1
|
||||
public function Largeur31($promos, $start, $articles, $art, $lengArt, $services, $ser, $lengSer)
|
||||
{
|
||||
if( ($art<$lengArt) && (isset($articles[$art])) ){
|
||||
$promos[$start]['largeur'][] = 1;
|
||||
$promos[$start]['promos'][] = ['id'=>$articles[$art]->getId(), 'img'=>$articles[$art]->getImageDefault(), 'type'=>'article', 'title'=>$articles[$art]->getTitre()];
|
||||
$art++;
|
||||
}elseif( ($ser<$lengSer) && (isset($services[$ser])) ){
|
||||
$promos[$start]['largeur'][] = 1;
|
||||
$promos[$start]['promos'][] = ['id'=>$services[$ser]->getId(), 'img'=>$services[$ser]->getImageDefault(), 'type'=>'service', 'title'=>$services[$ser]->getTitre()];
|
||||
$ser++;
|
||||
}
|
||||
|
||||
return ['promos'=>$promos, 'Art'=>$art, 'Ser'=>$ser];
|
||||
}
|
||||
|
||||
//largeur 1, 1, 1
|
||||
public function Largeur1111($promos, $start, $articles, $art, $lengArt, $services, $ser, $lengSer)
|
||||
{
|
||||
$l = 1;
|
||||
do{
|
||||
if( ($art<$lengArt) && (isset($articles[$art])) ){
|
||||
$promos[$start]['largeur'][] = 1;
|
||||
$promos[$start]['promos'][] = ['id'=>$articles[$art]->getId(), 'img'=>$articles[$art]->getImageDefault(), 'type'=>'article', 'title'=>$articles[$art]->getTitre()];
|
||||
$art++;
|
||||
}
|
||||
|
||||
if( ($ser<$lengSer) && (isset($services[$ser])) ){
|
||||
$promos[$start]['largeur'][] = 1;
|
||||
$promos[$start]['promos'][] = ['id'=>$services[$ser]->getId(), 'img'=>$services[$ser]->getImageDefault(), 'type'=>'service', 'title'=>$services[$ser]->getTitre()];
|
||||
$ser++;
|
||||
}
|
||||
|
||||
$l++;
|
||||
}while( ($l<=3) and (($art<$lengArt) or ($ser<$lengSer)) );
|
||||
|
||||
return ['promos'=>$promos, 'Art'=>$art, 'Ser'=>$ser];
|
||||
}
|
||||
|
||||
//largeur 1, 1, 1, 1
|
||||
public function Largeur01111($promos, $start, $articles, $art, $lengArt, $services, $ser, $lengSer)
|
||||
{
|
||||
$l = 1;
|
||||
do{
|
||||
if( ($art<$lengArt) && (isset($articles[$art])) ){
|
||||
$promos[$start]['largeur'][] = 1;
|
||||
$promos[$start]['promos'][] = ['id'=>$articles[$art]->getId(), 'img'=>$articles[$art]->getImageDefault(), 'type'=>'article', 'title'=>$articles[$art]->getTitre()];
|
||||
$art++;
|
||||
}
|
||||
|
||||
if( ($ser<$lengSer) && (isset($services[$ser])) ){
|
||||
$promos[$start]['largeur'][] = 1;
|
||||
$promos[$start]['promos'][] = ['id'=>$services[$ser]->getId(), 'img'=>$services[$ser]->getImageDefault(), 'type'=>'service', 'title'=>$services[$ser]->getTitre()];
|
||||
$ser++;
|
||||
}
|
||||
|
||||
$l++;
|
||||
}while( ($l<=4) and (($art<$lengArt) or ($ser<$lengSer)) );
|
||||
|
||||
return ['promos'=>$promos, 'Art'=>$art, 'Ser'=>$ser];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
46
src/Service/Frontend/ServicePanier.php
Normal file
46
src/Service/Frontend/ServicePanier.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\Frontend;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
class ServicePanier
|
||||
{
|
||||
|
||||
/**
|
||||
* @var RequestStack $session
|
||||
*/
|
||||
private $session;
|
||||
|
||||
|
||||
/**
|
||||
* @param RequestStack $requestStack
|
||||
* @return $this
|
||||
*/
|
||||
public function __construct(
|
||||
private RequestStack $requestStack,
|
||||
){
|
||||
$this->session = $requestStack->getSession();
|
||||
}
|
||||
|
||||
public function clear($user)
|
||||
{
|
||||
$id = $user->getId();
|
||||
|
||||
$this->session->set("Panier-$id", []);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user