src/Controller/Admin/DashboardController.php line 38

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Admin;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
  4. use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
  5. use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
  6. use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use App\Entity\User;
  10. use App\Entity\Reseau;
  11. use App\Entity\ReseauDivision;
  12. use App\Entity\Garantie;
  13. use App\Entity\StructureCotisation;
  14. use App\Entity\Offre;
  15. use App\Entity\OffreDocumentContractuel;
  16. use App\Entity\DocumentControle;
  17. use App\Entity\Dossier;
  18. use App\Entity\statutDossier;
  19. use App\Entity\Commercial;
  20. use App\Entity\Activite;
  21. use App\Entity\Entreprise;
  22. use App\Entity\DocumentContractuel;
  23. use App\Entity\Commune;
  24. use App\Entity\PaiementType;
  25. use App\Entity\Notification;
  26. use App\Entity\NotificationTemplate;
  27. class DashboardController extends AbstractDashboardController
  28. {
  29.     /**
  30.      * @Route("/admin", name="admin")
  31.      * is_granted('ROLE_ADMIN')
  32.      */
  33.     public function index(): Response
  34.     {
  35.         // redirect to some CRUD controller
  36.         $routeBuilder $this->get(AdminUrlGenerator::class);
  37.         return $this->redirect($routeBuilder->setController(UserCrudController::class)->generateUrl());
  38.         
  39.         //return parent::index();
  40.         //return $this->render('admin/dashboard.html.twig');
  41.     }
  42.     public function configureDashboard(): Dashboard
  43.     {
  44.         return Dashboard::new()
  45.             // the name visible to end users
  46.             ->setTitle('MACIF ExtraMEG')
  47.             // you can include HTML contents too (e.g. to link to an image)
  48.             //->setTitle('<img src="/images/Logo_Macif.svg"> MACIF <span class="text-small">ExtraMEG</span>')
  49.             // the path defined in this method is passed to the Twig asset() function
  50.             ->setFaviconPath('favicon.svg')
  51.             // the domain used by default is 'messages'
  52.             ->setTranslationDomain('app')
  53.             // there's no need to define the "text direction" explicitly because
  54.             // its default value is inferred dynamically from the user locale
  55.             ->setTextDirection('ltr')
  56.             // set this option if you prefer the page content to span the entire
  57.             // browser width, instead of the default design which sets a max width
  58.             ->renderContentMaximized()
  59.             // set this option if you prefer the sidebar (which contains the main menu)
  60.             // to be displayed as a narrow column instead of the default expanded design
  61.             //->renderSidebarMinimized()
  62.             // by default, all backend URLs include a signature hash. If a user changes any
  63.             // query parameter (to "hack" the backend) the signature won't match and EasyAdmin
  64.             // triggers an error. If this causes any issue in your backend, call this method
  65.             // to disable this feature and remove all URL signature checks
  66.             ->disableUrlSignatures()
  67.             // by default, all backend URLs are generated as absolute URLs. If you
  68.             // need to generate relative URLs instead, call this method
  69.             ->generateRelativeUrls()
  70.         ;
  71.     }
  72.     public function configureMenuItems(): iterable
  73.     {
  74.         yield MenuItem::linktoDashboard('Dashboard''fa fa-home');
  75.         yield MenuItem::section('Admin');
  76.         yield MenuItem::linkToCrud('Utilisateurs''fas fa-list'User::class);
  77.         yield MenuItem::section('Paramétrage');
  78.         yield MenuItem::linkToCrud('Documents contractuels''fas fa-list'DocumentContractuel::class);
  79.         yield MenuItem::linkToCrud('Contrôles et motif de refus''fas fa-list'DocumentControle::class);
  80.         yield MenuItem::linkToCrud('Offres''fas fa-list'Offre::class);
  81.         yield MenuItem::linkToCrud('Garanties''fas fa-list'Garantie::class);
  82.         yield MenuItem::linkToCrud('Structures de cotisation''fas fa-list'StructureCotisation::class);
  83.         yield MenuItem::linkToCrud('Types de paiement''fas fa-list'PaiementType::class);
  84.         //yield MenuItem::linkToCrud('Communes', 'fas fa-list', Commune::class);
  85.         yield MenuItem::linkToCrud('Codes NAF/APE''fas fa-list'Activite::class);
  86.         yield MenuItem::linkToCrud('Modèles de notifications''fas fa-list'NotificationTemplate::class);
  87.         yield MenuItem::section('Entreprises');
  88.         yield MenuItem::linkToCrud('Entreprises''fas fa-list'Entreprise::class);
  89.         yield MenuItem::linkToCrud('Dossiers''fas fa-list'Dossier::class);
  90.         yield MenuItem::linkToCrud('Notifications''fas fa-list'Notification::class);
  91.         yield MenuItem::section('Réseaux de commercialisation');
  92.         yield MenuItem::linkToCrud('Réseaux''fas fa-list'Reseau::class);
  93.         yield MenuItem::linkToCrud('Divisions''fas fa-list'ReseauDivision::class);
  94.         yield MenuItem::linkToCrud('Commerciaux''fas fa-list'Commercial::class);
  95.     }
  96. }