<?php
namespace App\Controller\Admin;
use App\Controller\Admin\Afhaler\AfhalerCrudController;
use App\Controller\Admin\Bestelling\Filter\BestellingControlerenCrudController;
use App\Controller\Admin\Bestelling\Filter\BestellingLeeftijdCrudController;
use App\Controller\Admin\Bestelling\Filter\BestellingLopendCrudController;
use App\Controller\Admin\Bestelling\Filter\BestellingNietBevestigdCrudController;
use App\Controller\Admin\Bestelling\Filter\BestellingVerzendenCrudController;
use App\Controller\Admin\Bestelling\BestellingCrudController;
use App\Controller\Admin\Groep\GroepCrudController;
use App\Controller\Admin\Offerte\Filter\OfferteAlleCrudController;
use App\Controller\Admin\Offerte\Filter\OfferteTeOntwerpenCrudController;
use App\Controller\Admin\Offerte\Filter\OfferteAanpassenCrudController;
use App\Controller\Admin\Offerte\Filter\OfferteOntwerpAanpassenCrudController;
use App\Controller\Admin\Offerte\Filter\OfferteOntwerpTeControlerenCrudController;
use App\Controller\Admin\Offerte\Filter\OfferteTeControlerenCrudController;
use App\Controller\Admin\Offerte\Filter\OfferteTeVersturenCrudController;
use App\Controller\Admin\Order\Filter\OrderAlleCrudController;
use App\Controller\Admin\Order\Filter\OrderTeOntwerpenCrudController;
use App\Controller\Admin\Order\Filter\OrderAanpassenCrudController;
use App\Controller\Admin\Order\Filter\OrderOntwerpAanpassenCrudController;
use App\Controller\Admin\Order\Filter\OrderOntwerpTeControlerenCrudController;
use App\Controller\Admin\Order\Filter\OrderTeControlerenCrudController;
use App\Controller\Admin\Order\Filter\OrderTeVersturenCrudController;
use App\Controller\Admin\Order\Filter\OrderTeLeverenCrudController;
use App\Controller\Admin\Order\Filter\OrderLeveringCrudController;
use App\Controller\Admin\Order\Filter\OrderVergunningaanvraagCrudController;
use App\Controller\Admin\Order\Filter\OrderTeBestellenCrudController;
use App\Controller\Admin\Order\Filter\OrderLeeftijdCrudController;
use App\Controller\Admin\Order\Filter\OrderLevermaandOntbreektCrudController;
use App\Controller\Admin\Order\Filter\OrderOndTeBestellenCrudController;
use App\Controller\Admin\Orderregel\OrderregelCrudController;
use App\Controller\Admin\Regel\RegelCrudController;
use App\Controller\Admin\Reminder\Filter\ReminderActiveCrudController;
use App\Controller\Admin\Reminder\Filter\ReminderEpeCrudController;
use App\Controller\Admin\Reminder\Filter\ReminderHardeCrudController;
use App\Controller\Admin\Reminder\Filter\ReminderHarderwijkCrudController;
use App\Controller\Admin\Reminder\Filter\ReminderMijnCrudController;
use App\Controller\Admin\Reminder\Filter\ReminderNijkerkCrudController;
use App\Controller\Admin\Reminder\ReminderCrudController;
use App\Controller\Admin\User\UserCrudController;
use App\Entity\Begraafplaats;
use App\Entity\Order;
use App\Entity\Agent;
use App\Entity\Belettering;
use App\Entity\Bestelling;
use App\Entity\Bewerking;
use App\Entity\Brief;
use App\Entity\Categorie;
use App\Entity\Prospect;
use App\Entity\User;
use App\Entity\Vestiging;
use App\Entity\Familie;
use App\Entity\Groep;
use App\Entity\Kleur;
use App\Entity\Lettertype;
use App\Entity\Leverancier;
use App\Entity\Materiaal;
use App\Entity\Model;
use App\Entity\Onderdeel;
use App\Entity\Opslaglocatie;
use App\Entity\Orderonderdeel;
use App\Entity\Orderregel;
use App\Entity\Regel;
use App\Entity\Reminder;
use App\Entity\Uitvaartvereniging;
use App\Repository\BestellingRepository;
use App\Repository\OrderonderdeelRepository;
use App\Repository\OrderRepository;
use App\Repository\ReminderRepository;
use App\Service\ContentDashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\UX\Chartjs\Builder\ChartBuilderInterface;
use Symfony\UX\Chartjs\Model\Chart;
class DashboardController extends AbstractDashboardController
{
public OrderRepository $orderRepository;
public ReminderRepository $reminderRepository;
public BestellingRepository $bestellingRepository;
public OrderonderdeelRepository $orderonderdeelRepository;
public ChartBuilderInterface $chartbuilder;
public AdminUrlGenerator $adminUrlGenerator;
private TokenStorageInterface $tokenStorage;
public user $user;
public function __construct(OrderRepository $orderRepository, ReminderRepository $reminderRepository, BestellingRepository $bestellingRepository, OrderonderdeelRepository $orderonderdeelRepository, ChartBuilderInterface $chartbuilder, AdminUrlGenerator $adminUrlGenerator, TokenStorageInterface $tokenStorage)
{
$this->orderRepository = $orderRepository;
$this->reminderRepository = $reminderRepository;
$this->bestellingRepository = $bestellingRepository;
$this->orderonderdeelRepository = $orderonderdeelRepository;
$this->chartbuilder = $chartbuilder;
$this->adminUrlGenerator = $adminUrlGenerator;
$this->tokenStorage = $tokenStorage;
$this->user = $tokenStorage->getToken()->getUser();
}
#[IsGranted('ROLE_ADMIN')]
#[Route('/admin', name: 'admin')]
public function index(): Response
{
//return parent::index();
$contentDashboard = new ContentDashboard($this->orderRepository, $this->reminderRepository, $this->bestellingRepository, $this->orderonderdeelRepository, $this->chartbuilder, $this->adminUrlGenerator, $this->tokenStorage);
return $this->render('admin/contentDashboard.html.twig', $contentDashboard->getContent());
// Option 1. You can make your dashboard redirect to some common page of your backend
//
// $adminUrlGenerator = $this->container->get(AdminUrlGenerator::class);
// return $this->redirect($adminUrlGenerator->setController(OneOfYourCrudController::class)->generateUrl());
// Option 2. You can make your dashboard redirect to different pages depending on the user
//
// if ('jane' === $this->getUser()->getUsername()) {
// return $this->redirect('...');
// }
// Option 3. You can render some custom template to display a proper dashboard with widgets, etc.
// (tip: it's easier if your template extends from @EasyAdmin/page/content.html.twig)
//
// return $this->render('some/path/my-dashboard.html.twig');
}
public function configureDashboard(): Dashboard
{
return Dashboard::new()
->setTitle('Alphanatuursteen');
}
public function configureMenuItems(): iterable
{
yield MenuItem::linkToDashboard('Dashboard', 'fa fa-dashboard');
yield MenuItem::subMenu('Reminders/Notities', 'fa fa-bell', Reminder::class)
->setSubItems([
MenuItem::linkToCrud('Voor mij', 'fa fa-minus', Reminder::class)
->setController(ReminderMijnCrudController::class),
MenuItem::linkToCrud('Nijkerk', 'fa fa-minus', Reminder::class)
->setController(ReminderNijkerkCrudController::class),
MenuItem::linkToCrud('Harderwijk', 'fa fa-minus', Reminder::class)
->setController(ReminderHarderwijkCrudController::class),
MenuItem::linkToCrud('Epe', 'fa fa-minus', Reminder::class)
->setController(ReminderEpeCrudController::class),
MenuItem::linkToCrud('\'t Harde', 'fa fa-minus', Reminder::class)
->setController(ReminderHardeCrudController::class),
MenuItem::linkToCrud('Alle actief', 'fa fa-minus', Reminder::class)
->setController(ReminderActiveCrudController::class),
MenuItem::linkToCrud('Alle', 'fa fa-minus', Reminder::class)
->setController(ReminderCrudController::class)
]);
yield MenuItem::linkToCrud('Families', 'fa fa-users', Familie::class);
yield MenuItem::subMenu('Prospects', 'fa fa-user', Prospect::class)
->setSubItems([
MenuItem::linkToCrud('Alle prospects', 'fa fa-minus', Prospect::class)
->setController(ProspectCrudController::class),
MenuItem::linkToCrud('Te versturen', 'fa fa-minus', Prospect::class)
->setController(ProspectTeVersturenCrudController::class),
MenuItem::linkToCrud('Fotoboek afgegeven', 'fa fa-minus', Prospect::class)
->setController(ProspectFotoboekAfgegevenCrudController::class)
]);
yield MenuItem::linkToCrud('Alle records', 'fa fa-folder-open', order::class)
->setController(OrderCrudController::class);
yield MenuItem::linkToCrud('Afhalers', 'fa fa-folder-open', order::class)
->setController(AfhalerCrudController::class);
yield MenuItem::subMenu('Offertes', 'fa fa-folder-open')
->setSubItems([
MenuItem::linkToCrud('Alle lopende offertes', 'fa fa-minus', order::class)
->setController(OfferteAlleCrudController::class),
MenuItem::linkToCrud('Offerte te ontwerpen', 'fa fa-minus', order::class)
->setController(OfferteTeOntwerpenCrudController::class),
MenuItem::linkToCrud('Offerte aan te passen', 'fa fa-minus', order::class)
->setController(OfferteAanpassenCrudController::class),
MenuItem::linkToCrud('Ontwerp aanpassen', 'fa fa-minus', order::class)
->setController(OfferteOntwerpAanpassenCrudController::class),
MenuItem::linkToCrud('Ontwerp controleren', 'fa fa-minus', order::class)
->setController(OfferteOntwerpTeControlerenCrudController::class),
MenuItem::linkToCrud('Offerte controleren', 'fa fa-minus', order::class)
->setController(OfferteTeControlerenCrudController::class),
MenuItem::linkToCrud('Offerte versturen', 'fa fa-minus', order::class)
->setController(OfferteTeVersturenCrudController::class)
]);
yield MenuItem::subMenu('Orders', 'fa fa-folder-open')
->setSubItems([
//MenuItem::section('Orders'),
// MenuItem::linkToCrud('Maak nieuwe order', 'fa fa-minus', order::class)
// ->setController(OrderPartialControllerStep01::class)
// ->setAction(Action::NEW),
MenuItem::linkToCrud('Alle lopende orders', 'fa fa-minus', order::class)
->setController(OrderAlleCrudController::class),
MenuItem::linkToCrud('Order te ontwerpen', 'fa fa-minus', order::class)
->setController(OrderTeOntwerpenCrudController::class),
MenuItem::linkToCrud('Order aan te passen', 'fa fa-minus', order::class)
->setController(OrderAanpassenCrudController::class),
MenuItem::linkToCrud('Ontwerp aanpassen', 'fa fa-minus', order::class)
->setController(OrderOntwerpAanpassenCrudController::class),
MenuItem::linkToCrud('Ontwerp controleren', 'fa fa-minus', order::class)
->setController(OrderOntwerpTeControlerenCrudController::class),
MenuItem::linkToCrud('Order controleren', 'fa fa-minus', order::class)
->setController(OrderTeControlerenCrudController::class),
MenuItem::linkToCrud('Order versturen', 'fa fa-minus', order::class)
->setController(OrderTeVersturenCrudController::class),
]);
yield MenuItem::subMenu('Workflow', 'fa fa-gears')
->setSubItems([
MenuItem::linkToCrud('Vergunning aanvr.', 'fa fa-minus', order::class)
->setController(OrderVergunningaanvraagCrudController::class),
MenuItem::linkToCrud('Te bestellen (oud)', 'fa fa-minus', order::class)
->setController(OrderTeBestellenCrudController::class),
MenuItem::linkToCrud('Te bestellen', 'fa fa-minus', order::class)
->setController(OrderOndTeBestellenCrudController::class),
MenuItem::linkToCrud('Te Leveren', 'fa fa-minus', order::class)
->setController(OrderTeLeverenCrudController::class),
MenuItem::linkToCrud('Levering melden', 'fa fa-minus', order::class)
->setController(OrderLeveringCrudController::class)
]);
yield MenuItem::subMenu('Bestellingen', 'fa fa-folder-open')
->setSubItems([
MenuItem::linkToCrud('Alle bestellingen', 'fa fa-minus', Bestelling::class)
->setController(BestellingCrudController::class),
MenuItem::linkToCrud('Lopende bestellingen', 'fa fa-minus', Bestelling::class)
->setController(BestellingLopendCrudController::class),
MenuItem::linkToCrud('Te controleren', 'fa fa-minus', Bestelling::class)
->setController(BestellingControlerenCrudController::class),
MenuItem::linkToCrud('Te verzenden', 'fa fa-minus', Bestelling::class)
->setController(BestellingVerzendenCrudController::class),
MenuItem::linkToCrud('Bevestiging laat', 'fa fa-minus', Bestelling::class)
->setController(BestellingNietBevestigdCrudController::class),
MenuItem::linkToCrud('Levering te laat', 'fa fa-minus', Bestelling::class)
->setController(BestellingLeeftijdCrudController::class),
]);
yield MenuItem::subMenu('Monitoring', 'fa fa-magnifying-glass')
->setSubItems([
MenuItem::linkToCrud('Offertes > 14 dagen', 'fa fa-minus', order::class)
->setController(OfferteLeeftijdCrudController::class),
MenuItem::linkToCrud('Orders > 5 maand', 'fa fa-minus', order::class)
->setController(OrderLeeftijdCrudController::class),
MenuItem::linkToCrud('Afhalers > 3 weken', 'fa fa-minus', order::class)
->setController(AfhalerLeeftijdCrudController::class),
MenuItem::linkToCrud('Orders niet akkoord', 'fa fa-minus', order::class)
->setController(OrderNietAkkoordCrudController::class),
MenuItem::linkToCrud('Check voortgang levermaand < 2 weken', 'fa fa-minus', order::class)
->setController(OrderCheckVoortgangLevermaandCrudController::class),
MenuItem::linkToCrud('Levermaand ontbreekt', 'fa fa-minus', order::class)
->setController(OrderLevermaandOntbreektCrudController::class)
]);
yield MenuItem::section('Basisgegevens');
yield MenuItem::linkToCrud('Leveranciers', 'fa fa-truck', Leverancier::class);
yield MenuItem::linkToCrud('Uitvaartverenigingen', 'fa fa-people-roof', Uitvaartvereniging::class);
yield MenuItem::linkToCrud('Agenten', 'fa fa-user-pen', Agent::class);
yield MenuItem::linkToCrud('Begraafplaatsen', 'fa fa-leaf', Begraafplaats::class);
//yield MenuItem::linkToCrud('Topics','fa fa-folder',Topic::class);
//yield MenuItem::linkToCrud('Users', 'fas fa-users', User::class);
// yield MenuItem::linkToCrud('The Label', 'fas fa-list', EntityClass::class);
yield MenuItem::subMenu('Producten', 'fa fa-gear')
->setSubItems([
MenuItem::linkToCrud('Standaard modellen', 'fa fa-minus', Model::class)
->setController(ModelCrudController::class),
MenuItem::linkToCrud('Standaard onderdelen', 'fa fa-minus', Onderdeel::class)
->setController(OnderdeelCrudController::class),
//MenuItem::linkToCrud('Order onderdelen', 'fa fa-minus', Orderonderdeel::class)
// ->setController(OrderonderdeelCrudController::class),
MenuItem::linkToCrud('Categorieën', 'fa fa-minus', Categorie::class)
->setController(CategorieCrudController::class),
MenuItem::linkToCrud('Materialen', 'fa fa-minus', Materiaal::class)
->setController(MateriaalCrudController::class),
MenuItem::linkToCrud('Bewerkingen', 'fa fa-minus', Bewerking::class)
->setController(BewerkingCrudController::class),
MenuItem::linkToCrud('Kleuren', 'fa fa-minus', Kleur::class)
->setController(KleurCrudController::class),
MenuItem::linkToCrud('Belettering', 'fa fa-minus', Belettering::class)
->setController(BeletteringCrudController::class),
MenuItem::linkToCrud('Lettertype', 'fa fa-minus', Lettertype::class)
->setController(LettertypeCrudController::class),
]);
yield MenuItem::subMenu('Teksten', 'fa fa-keyboard')
->setSubItems([
MenuItem::linkToCrud('Standaard regels', 'fa fa-minus', Regel::class)
->setController(RegelCrudController::class),
]);
yield MenuItem::linkToCrud('Vestigingen', 'fa fa-building', Vestiging::class);
yield MenuItem::linkToCrud('Opslaglocaties', 'fa fa-archive', Opslaglocatie::class);
yield MenuItem::subMenu('Gebruikers', 'fa fa-users-line')
->setSubItems([
MenuItem::linkToCrud('Groepen', 'fa fa-minus', Groep::class)
->setController(GroepCrudController::class),
MenuItem::linkToCrud('Users', 'fa fa-minus', User::class)
->setController(UserCrudController::class),
]);;
yield MenuItem::linkToCrud('Brieven', 'fa fa-newspaper', Brief::class)
->setController(BriefCrudController::class);
yield MenuItem::linkToCrud('Orderregels', 'fa fa-newspaper', Orderregel::class)
->setController(OrderregelCrudController::class);
}
public function configureActions(): Actions
{
return parent::configureActions()
->add(Crud::PAGE_INDEX, Action::DETAIL)
;
}
public function configureAssets(): Assets
{
return parent::configureAssets()
->addWebpackEncoreEntry('admin');
}
}