<?php
namespace App\Controller\Admin;
use App\Entity\Equipo;
use App\Entity\Evento;
use App\Entity\Grupo;
use App\Entity\Grupomenu;
use App\Entity\GrupomenuMenu;
use App\Entity\Menu;
use App\Entity\Persona;
use App\Entity\Portico;
use App\Entity\Puerta;
use App\Entity\User;
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use EasyCorp\Bundle\EasyAdminBundle\Router\CrudUrlGenerator;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class DashboardController extends AbstractDashboardController
{
/**
* @Route("/admin", name="admin")
*/
public function index(): Response
{
$routeBuilder = $this->get(CrudUrlGenerator::class)->build();
return $this->redirect($routeBuilder->setController(PersonaCrudController::class)->generateUrl());
return parent::index();
}
public function configureDashboard(): Dashboard
{
return Dashboard::new()
->setTitle('Administración de pórticos');
}
public function configureMenuItems(): iterable
{
yield MenuItem::linkToRoute('Reportes','fa fa-chart-bar','persona_consultar');
yield MenuItem::linktoDashboard('Dashboard', 'fa fa-home')->setPermission('ROLE_ADMIN');
// yield MenuItem::linkToCrud('The Label', 'icon class', EntityClass::class);
yield MenuItem::subMenu('BETA', 'fa fa-users')->setSubItems([
MenuItem::linkToRoute('Personas por dia', 'fa fa-dashboard', 'personas_pordia'),
MenuItem::linkToRoute('Personas en planta', 'fa fa-dashboard', 'personas_planta')
])->setPermission('ROLE_ADMIN');
yield MenuItem::subMenu('Personas', 'fa fa-users')->setSubItems([
MenuItem::linkToCrud('Listado', 'fa fa-users', Persona::class),
MenuItem::linkToRoute('Carga masiva', 'fa fa-upload', 'carga_personas_masiva'),
MenuItem::linkToRoute('Descarga personas', 'fa fa-download', 'descarga_personas')])->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Grupos', 'fa fa-sitemap', Grupo::class)->setPermission('ROLE_ADMIN');
yield MenuItem::subMenu('Casino', 'fa fa-utensils')->setSubItems([
MenuItem::linkToCrud('Menús', 'fa fa-list', Menu::class),
MenuItem::linkToCrud('Grupo menú - Menú', 'fa fa-list', GrupomenuMenu::class),
MenuItem::linkToCrud('Grupo menú', 'fa fa-list', Grupomenu::class)])->setPermission('ROLE_ADMIN');
yield MenuItem::subMenu('Eventos', 'fa fa-tasks')->setSubItems([
MenuItem::linkToCrud('Listado Eventos', 'fa fa-tasks', Evento::class),
MenuItem::linkToRoute('Descargar últimos eventos', 'fa fa-download', 'descarga_eventos'),
MenuItem::linkToRoute('Descargar por fecha','','descarga_eventos_por_fecha'),
MenuItem::linkToRoute('Carga masiva eventos', 'fa fa-upload', 'carga_eventos_masiva'),
])->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Porticos', 'fa fa-door-open', Portico::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Puertas', 'fa fa-door-open', Puerta::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Equipos', 'fa fa-microchip', Equipo::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Usuarios', 'fa fa-users-cog', User::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Ingreso','fa fa-user', Persona::class);
}
}