src/Controller/Admin/DashboardController.php line 58

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Admin;
  3. use App\Share\Entity\Card;
  4. use App\Share\Entity\Category;
  5. use App\Share\Entity\Chamber;
  6. use App\Share\Entity\Configuration;
  7. use App\Share\Entity\Customer;
  8. use App\Share\Entity\Desiderata;
  9. use App\Share\Entity\Formation;
  10. use App\Share\Entity\FormationKind;
  11. use App\Share\Entity\Framework;
  12. use App\Share\Entity\Group;
  13. use App\Share\Entity\Helper;
  14. use App\Share\Entity\HomeCard;
  15. use App\Share\Entity\JudgeCard;
  16. use App\Share\Entity\JudicialCard;
  17. use App\Share\Entity\JudicialCardService;
  18. use App\Share\Entity\Jurisprudence;
  19. use App\Share\Entity\Keyword;
  20. use App\Share\Entity\MenuCategory;
  21. use App\Share\Entity\News;
  22. use App\Share\Entity\Notification;
  23. use App\Share\Entity\Organization;
  24. use App\Share\Entity\Page;
  25. use App\Share\Entity\Plug;
  26. use App\Share\Entity\Promotion;
  27. use App\Share\Entity\Role;
  28. use App\Share\Entity\Status;
  29. use App\Share\Entity\User;
  30. use App\Share\Entity\Vote;
  31. use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
  32. use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
  33. use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
  34. use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
  35. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  36. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  37. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  38. use Symfony\Component\HttpFoundation\Response;
  39. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  40. use Symfony\Component\Routing\Annotation\Route;
  41. class DashboardController extends AbstractDashboardController
  42. {
  43.     /**
  44.      * @Route("/dashboard", name="admin_dashboard")
  45.      */
  46.     public function index(): Response
  47.     {
  48.         //return parent::index();
  49.         return $this->render('dashboard.html.twig');
  50.     }
  51.     /**
  52.      * @Route("/", name="admin_home")
  53.      */
  54.     public function indexHome(): Response
  55.     {
  56.         return $this->index();
  57.     }
  58.     public function configureDashboard(): Dashboard
  59.     {
  60.         return Dashboard::new()
  61.             ->setTitle('<img src="/images/gtcparis.png"> B.E.J Paris - Site d\'administration');
  62.     }
  63.     public function configureMenuItems(): iterable
  64.     {
  65.         yield MenuItem::linktoDashboard('Tableau de bord''fa fa-home');
  66.         yield MenuItem::linkToCrud('Actualités''fa fa-newspaper-o',News::class);
  67.         yield MenuItem::subMenu('Andre Orth''fa fa-archive')
  68.             ->setSubItems([
  69.                 MenuItem::linkToCrud('Mot clé''fa fa-file-word-o',Keyword::class)
  70.                     ->setController(KeywordCrudController::class)
  71.                 ,
  72.                 MenuItem::linkToCrud('Services''fa fa-university',JudicialCardService::class)
  73.                     ->setController(JudicialCardServiceCrudController::class)
  74.                 ,
  75.                 MenuItem::linkToCrud('Sous mot clé''fa fa-file-word-o',Keyword::class)
  76.                 ->setController(Keyword2CrudController::class)
  77.                 ,
  78.                 MenuItem::linkToCrud('Fiche''fa fa-file-text-o',JudicialCard::class)
  79.                 ,
  80.             ])
  81.         ;
  82.         yield MenuItem::linkToCrud('Configuration''fa fa-cog',Configuration::class);
  83.         yield MenuItem::subMenu('Documentation qualité''fa fa-graduation-cap')
  84.             ->setSubItems([
  85.                 MenuItem::linkToCrud('Catégorie''fa fa-graduation-cap',Category::class),
  86.                 MenuItem::linkToCrud('Fiche''fa fa-sitemap',Card::class),
  87.             ])
  88.         ;
  89.         yield MenuItem::linkToCrud('Encarts''fa fa-cog',HomeCard::class);
  90.         yield MenuItem::subMenu('Elviro''fa fa-archive')
  91.             ->setSubItems([
  92.                 MenuItem::linkToCrud('Desiderata''fa fa-sort-amount-asc',Desiderata::class),
  93.                 MenuItem::linkToCrud('Vœux''fa fa-chevron-circle-down',Vote::class),
  94.                 MenuItem::linkToCrud('Vœux (Tous les champs)''fa fa-chevron-circle-down',Vote::class)
  95.                     ->setController(VoteAllCrudController::class),
  96.                 MenuItem::linkToCrud('Stats globales','fas fa-sort-amount-up',Desiderata::class)
  97.                     ->setAction('global'),
  98.                 MenuItem::linkToCrud('Stats par chambre','fas fa-sort-amount-up',Desiderata::class)
  99.                     ->setAction('desiderataChamberStatistic'),
  100.                 MenuItem::linkToCrud('Stats par jour de chambre','fas fa-sort-amount-up',Desiderata::class)
  101.                     ->setAction('desiderataChamberDayStatistic'),
  102.             ])
  103.         ;
  104.         yield MenuItem::subMenu('Formations''fa fa-graduation-cap')
  105.             ->setSubItems([
  106.                 MenuItem::linkToCrud('Formations''fa fa-graduation-cap',Formation::class),
  107.                 MenuItem::linkToCrud('Nature''fa fa-sitemap',FormationKind::class),
  108.                 MenuItem::linkToCrud('Organisme''fa fa-users',Organization::class),
  109.                 MenuItem::linkToCrud('Juge sans formation','fas fa-user-times',Formation::class)
  110.                     ->setAction('judgeWithinFormation'),
  111.                 MenuItem::linkToCrud('Statistiques','fas fa-sort-amount-up',Formation::class)
  112.                     ->setAction('statistiques'),
  113.             ])
  114.         ;
  115.         yield MenuItem::linkToCrud('Helpers''fa fa-info-circle',Helper::class);
  116.         yield MenuItem::subMenu('Jurisprudence''fa fa-graduation-cap')
  117.             ->setSubItems([
  118.                 MenuItem::linkToCrud('Jurisprudence''fa fa-graduation-cap',Jurisprudence::class),
  119.                 MenuItem::linkToCrud('Fiche''fa fa-sitemap',Plug::class),
  120.             ])
  121.         ;
  122.         yield MenuItem::linkToCrud('Menu''fa fa-list',MenuCategory::class);
  123.         yield MenuItem::linkToCrud('Notifications''fa fa-commenting',Notification::class);
  124.         yield MenuItem::linkToCrud('Pages cms''fa fa-file-text-o',Page::class);
  125.         yield MenuItem::linkToCrud('Trames''fa fa-briefcase',Framework::class);
  126.         yield MenuItem::subMenu('Trombinoscope''fa fa-id-card-o')
  127.             ->setSubItems([
  128.                 MenuItem::linkToCrud('Magistrats''fa fa-id-card-o',JudgeCard::class),
  129.                 MenuItem::linkToCrud('Chambre''fa fa-sitemap',Chamber::class),
  130.                 MenuItem::linkToCrud('Promotion''fa fa-users',Promotion::class),
  131.                 MenuItem::linkToCrud('Statut''fa fa-info-circle',Status::class),
  132.             ])
  133.         ;
  134.         //todo roles must be visible only for super admins
  135.         yield MenuItem::subMenu('Administration''fa fa-lock')
  136.             ->setSubItems([
  137.                 MenuItem::linkToCrud('Administrateurs''fa fa-user',User::class),
  138.                 MenuItem::linkToCrud('Groupes''fa fa-users',Group::class),
  139.                 MenuItem::linkToCrud('Roles''fa fa-shield',Role::class),
  140.                 MenuItem::linkToCrud('Utilisateurs''far fa-user',Customer::class),
  141.             ])
  142.         ;
  143.     }
  144. }