<?php
namespace App\Controller\Admin;
use App\Share\Entity\Card;
use App\Share\Entity\Category;
use App\Share\Entity\Chamber;
use App\Share\Entity\Configuration;
use App\Share\Entity\Customer;
use App\Share\Entity\Desiderata;
use App\Share\Entity\Formation;
use App\Share\Entity\FormationKind;
use App\Share\Entity\Framework;
use App\Share\Entity\Group;
use App\Share\Entity\Helper;
use App\Share\Entity\HomeCard;
use App\Share\Entity\JudgeCard;
use App\Share\Entity\JudicialCard;
use App\Share\Entity\JudicialCardService;
use App\Share\Entity\Jurisprudence;
use App\Share\Entity\Keyword;
use App\Share\Entity\MenuCategory;
use App\Share\Entity\News;
use App\Share\Entity\Notification;
use App\Share\Entity\Organization;
use App\Share\Entity\Page;
use App\Share\Entity\Plug;
use App\Share\Entity\Promotion;
use App\Share\Entity\Role;
use App\Share\Entity\Status;
use App\Share\Entity\User;
use App\Share\Entity\Vote;
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;
class DashboardController extends AbstractDashboardController
{
/**
* @Route("/dashboard", name="admin_dashboard")
*/
public function index(): Response
{
//return parent::index();
return $this->render('dashboard.html.twig');
}
/**
* @Route("/", name="admin_home")
*/
public function indexHome(): Response
{
return $this->index();
}
public function configureDashboard(): Dashboard
{
return Dashboard::new()
->setTitle('<img src="/images/gtcparis.png"> B.E.J Paris - Site d\'administration');
}
public function configureMenuItems(): iterable
{
yield MenuItem::linktoDashboard('Tableau de bord', 'fa fa-home');
yield MenuItem::linkToCrud('Actualités', 'fa fa-newspaper-o',News::class);
yield MenuItem::subMenu('Andre Orth', 'fa fa-archive')
->setSubItems([
MenuItem::linkToCrud('Mot clé', 'fa fa-file-word-o',Keyword::class)
->setController(KeywordCrudController::class)
,
MenuItem::linkToCrud('Services', 'fa fa-university',JudicialCardService::class)
->setController(JudicialCardServiceCrudController::class)
,
MenuItem::linkToCrud('Sous mot clé', 'fa fa-file-word-o',Keyword::class)
->setController(Keyword2CrudController::class)
,
MenuItem::linkToCrud('Fiche', 'fa fa-file-text-o',JudicialCard::class)
,
])
;
yield MenuItem::linkToCrud('Configuration', 'fa fa-cog',Configuration::class);
yield MenuItem::subMenu('Documentation qualité', 'fa fa-graduation-cap')
->setSubItems([
MenuItem::linkToCrud('Catégorie', 'fa fa-graduation-cap',Category::class),
MenuItem::linkToCrud('Fiche', 'fa fa-sitemap',Card::class),
])
;
yield MenuItem::linkToCrud('Encarts', 'fa fa-cog',HomeCard::class);
yield MenuItem::subMenu('Elviro', 'fa fa-archive')
->setSubItems([
MenuItem::linkToCrud('Desiderata', 'fa fa-sort-amount-asc',Desiderata::class),
MenuItem::linkToCrud('Vœux', 'fa fa-chevron-circle-down',Vote::class),
MenuItem::linkToCrud('Vœux (Tous les champs)', 'fa fa-chevron-circle-down',Vote::class)
->setController(VoteAllCrudController::class),
MenuItem::linkToCrud('Stats globales','fas fa-sort-amount-up',Desiderata::class)
->setAction('global'),
MenuItem::linkToCrud('Stats par chambre','fas fa-sort-amount-up',Desiderata::class)
->setAction('desiderataChamberStatistic'),
MenuItem::linkToCrud('Stats par jour de chambre','fas fa-sort-amount-up',Desiderata::class)
->setAction('desiderataChamberDayStatistic'),
])
;
yield MenuItem::subMenu('Formations', 'fa fa-graduation-cap')
->setSubItems([
MenuItem::linkToCrud('Formations', 'fa fa-graduation-cap',Formation::class),
MenuItem::linkToCrud('Nature', 'fa fa-sitemap',FormationKind::class),
MenuItem::linkToCrud('Organisme', 'fa fa-users',Organization::class),
MenuItem::linkToCrud('Juge sans formation','fas fa-user-times',Formation::class)
->setAction('judgeWithinFormation'),
MenuItem::linkToCrud('Statistiques','fas fa-sort-amount-up',Formation::class)
->setAction('statistiques'),
])
;
yield MenuItem::linkToCrud('Helpers', 'fa fa-info-circle',Helper::class);
yield MenuItem::subMenu('Jurisprudence', 'fa fa-graduation-cap')
->setSubItems([
MenuItem::linkToCrud('Jurisprudence', 'fa fa-graduation-cap',Jurisprudence::class),
MenuItem::linkToCrud('Fiche', 'fa fa-sitemap',Plug::class),
])
;
yield MenuItem::linkToCrud('Menu', 'fa fa-list',MenuCategory::class);
yield MenuItem::linkToCrud('Notifications', 'fa fa-commenting',Notification::class);
yield MenuItem::linkToCrud('Pages cms', 'fa fa-file-text-o',Page::class);
yield MenuItem::linkToCrud('Trames', 'fa fa-briefcase',Framework::class);
yield MenuItem::subMenu('Trombinoscope', 'fa fa-id-card-o')
->setSubItems([
MenuItem::linkToCrud('Magistrats', 'fa fa-id-card-o',JudgeCard::class),
MenuItem::linkToCrud('Chambre', 'fa fa-sitemap',Chamber::class),
MenuItem::linkToCrud('Promotion', 'fa fa-users',Promotion::class),
MenuItem::linkToCrud('Statut', 'fa fa-info-circle',Status::class),
])
;
//todo roles must be visible only for super admins
yield MenuItem::subMenu('Administration', 'fa fa-lock')
->setSubItems([
MenuItem::linkToCrud('Administrateurs', 'fa fa-user',User::class),
MenuItem::linkToCrud('Groupes', 'fa fa-users',Group::class),
MenuItem::linkToCrud('Roles', 'fa fa-shield',Role::class),
MenuItem::linkToCrud('Utilisateurs', 'far fa-user',Customer::class),
])
;
}
}