first commit

This commit is contained in:
maher
2025-10-30 13:13:41 +01:00
commit ecd64aad53
404 changed files with 82238 additions and 0 deletions

View 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"
]);
}
}