src/Controller/Admin/DashboardController.php line 124

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Admin;
  3. use App\Controller\Admin\Afhaler\AfhalerCrudController;
  4. use App\Controller\Admin\Bestelling\Filter\BestellingControlerenCrudController;
  5. use App\Controller\Admin\Bestelling\Filter\BestellingLeeftijdCrudController;
  6. use App\Controller\Admin\Bestelling\Filter\BestellingLopendCrudController;
  7. use App\Controller\Admin\Bestelling\Filter\BestellingNietBevestigdCrudController;
  8. use App\Controller\Admin\Bestelling\Filter\BestellingVerzendenCrudController;
  9. use App\Controller\Admin\Bestelling\BestellingCrudController;
  10. use App\Controller\Admin\Groep\GroepCrudController;
  11. use App\Controller\Admin\Offerte\Filter\OfferteAlleCrudController;
  12. use App\Controller\Admin\Offerte\Filter\OfferteTeOntwerpenCrudController;
  13. use App\Controller\Admin\Offerte\Filter\OfferteAanpassenCrudController;
  14. use App\Controller\Admin\Offerte\Filter\OfferteOntwerpAanpassenCrudController;
  15. use App\Controller\Admin\Offerte\Filter\OfferteOntwerpTeControlerenCrudController;
  16. use App\Controller\Admin\Offerte\Filter\OfferteTeControlerenCrudController;
  17. use App\Controller\Admin\Offerte\Filter\OfferteTeVersturenCrudController;
  18. use App\Controller\Admin\Order\Filter\OrderAlleCrudController;
  19. use App\Controller\Admin\Order\Filter\OrderTeOntwerpenCrudController;
  20. use App\Controller\Admin\Order\Filter\OrderAanpassenCrudController;
  21. use App\Controller\Admin\Order\Filter\OrderOntwerpAanpassenCrudController;
  22. use App\Controller\Admin\Order\Filter\OrderOntwerpTeControlerenCrudController;
  23. use App\Controller\Admin\Order\Filter\OrderTeControlerenCrudController;
  24. use App\Controller\Admin\Order\Filter\OrderTeVersturenCrudController;
  25. use App\Controller\Admin\Order\Filter\OrderTeLeverenCrudController;
  26. use App\Controller\Admin\Order\Filter\OrderLeveringCrudController;
  27. use App\Controller\Admin\Order\Filter\OrderVergunningaanvraagCrudController;
  28. use App\Controller\Admin\Order\Filter\OrderTeBestellenCrudController;
  29. use App\Controller\Admin\Order\Filter\OrderLeeftijdCrudController;
  30. use App\Controller\Admin\Order\Filter\OrderLevermaandOntbreektCrudController;
  31. use App\Controller\Admin\Order\Filter\OrderOndTeBestellenCrudController;
  32. use App\Controller\Admin\Orderregel\OrderregelCrudController;
  33. use App\Controller\Admin\Regel\RegelCrudController;
  34. use App\Controller\Admin\Reminder\Filter\ReminderActiveCrudController;
  35. use App\Controller\Admin\Reminder\Filter\ReminderEpeCrudController;
  36. use App\Controller\Admin\Reminder\Filter\ReminderHardeCrudController;
  37. use App\Controller\Admin\Reminder\Filter\ReminderHarderwijkCrudController;
  38. use App\Controller\Admin\Reminder\Filter\ReminderMijnCrudController;
  39. use App\Controller\Admin\Reminder\Filter\ReminderNijkerkCrudController;
  40. use App\Controller\Admin\Reminder\ReminderCrudController;
  41. use App\Controller\Admin\User\UserCrudController;
  42. use App\Entity\Begraafplaats;
  43. use App\Entity\Order;
  44. use App\Entity\Agent;
  45. use App\Entity\Belettering;
  46. use App\Entity\Bestelling;
  47. use App\Entity\Bewerking;
  48. use App\Entity\Brief;
  49. use App\Entity\Categorie;
  50. use App\Entity\Prospect;
  51. use App\Entity\User;
  52. use App\Entity\Vestiging;
  53. use App\Entity\Familie;
  54. use App\Entity\Groep;
  55. use App\Entity\Kleur;
  56. use App\Entity\Lettertype;
  57. use App\Entity\Leverancier;
  58. use App\Entity\Materiaal;
  59. use App\Entity\Model;
  60. use App\Entity\Onderdeel;
  61. use App\Entity\Opslaglocatie;
  62. use App\Entity\Orderonderdeel;
  63. use App\Entity\Orderregel;
  64. use App\Entity\Regel;
  65. use App\Entity\Reminder;
  66. use App\Entity\Uitvaartvereniging;
  67. use App\Repository\BestellingRepository;
  68. use App\Repository\OrderonderdeelRepository;
  69. use App\Repository\OrderRepository;
  70. use App\Repository\ReminderRepository;
  71. use App\Service\ContentDashboard;
  72. use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
  73. use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
  74. use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
  75. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  76. use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
  77. use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
  78. use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
  79. use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
  80. use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
  81. use Symfony\Component\HttpFoundation\Response;
  82. use Symfony\Component\Routing\Annotation\Route;
  83. use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
  84. use Symfony\UX\Chartjs\Builder\ChartBuilderInterface;
  85. use Symfony\UX\Chartjs\Model\Chart;
  86. class DashboardController extends AbstractDashboardController
  87. {
  88.     public OrderRepository $orderRepository;
  89.     public ReminderRepository $reminderRepository;
  90.     public BestellingRepository $bestellingRepository;
  91.     public OrderonderdeelRepository $orderonderdeelRepository;
  92.     public ChartBuilderInterface $chartbuilder;
  93.     public AdminUrlGenerator $adminUrlGenerator;
  94.     private TokenStorageInterface $tokenStorage;
  95.     public user $user;
  96.     public function __construct(OrderRepository $orderRepositoryReminderRepository $reminderRepositoryBestellingRepository $bestellingRepositoryOrderonderdeelRepository $orderonderdeelRepositoryChartBuilderInterface $chartbuilderAdminUrlGenerator $adminUrlGeneratorTokenStorageInterface $tokenStorage)
  97.     {
  98.         $this->orderRepository $orderRepository;
  99.         $this->reminderRepository $reminderRepository;
  100.         $this->bestellingRepository $bestellingRepository;
  101.         $this->orderonderdeelRepository $orderonderdeelRepository;
  102.         $this->chartbuilder $chartbuilder;
  103.         $this->adminUrlGenerator $adminUrlGenerator;
  104.         $this->tokenStorage $tokenStorage;
  105.         $this->user $tokenStorage->getToken()->getUser();
  106.     }
  107.     #[IsGranted('ROLE_ADMIN')]
  108.     #[Route('/admin'name'admin')]
  109.     public function index(): Response
  110.     {
  111.         //return parent::index();
  112.         $contentDashboard = new ContentDashboard($this->orderRepository$this->reminderRepository$this->bestellingRepository$this->orderonderdeelRepository$this->chartbuilder$this->adminUrlGenerator$this->tokenStorage);
  113.         return $this->render('admin/contentDashboard.html.twig'$contentDashboard->getContent());
  114.         // Option 1. You can make your dashboard redirect to some common page of your backend
  115.         //
  116.         // $adminUrlGenerator = $this->container->get(AdminUrlGenerator::class);
  117.         // return $this->redirect($adminUrlGenerator->setController(OneOfYourCrudController::class)->generateUrl());
  118.         // Option 2. You can make your dashboard redirect to different pages depending on the user
  119.         //
  120.         // if ('jane' === $this->getUser()->getUsername()) {
  121.         //     return $this->redirect('...');
  122.         // }
  123.         // Option 3. You can render some custom template to display a proper dashboard with widgets, etc.
  124.         // (tip: it's easier if your template extends from @EasyAdmin/page/content.html.twig)
  125.         //
  126.         // return $this->render('some/path/my-dashboard.html.twig');
  127.     }
  128.     public function configureDashboard(): Dashboard
  129.     {
  130.         return Dashboard::new()
  131.             ->setTitle('Alphanatuursteen');
  132.     }
  133.     public function configureMenuItems(): iterable
  134.     {
  135.         yield MenuItem::linkToDashboard('Dashboard''fa fa-dashboard');
  136.         yield MenuItem::subMenu('Reminders/Notities''fa fa-bell'Reminder::class)
  137.             ->setSubItems([
  138.                 MenuItem::linkToCrud('Voor mij''fa fa-minus'Reminder::class)
  139.                     ->setController(ReminderMijnCrudController::class),
  140.                 MenuItem::linkToCrud('Nijkerk''fa fa-minus'Reminder::class)
  141.                     ->setController(ReminderNijkerkCrudController::class),
  142.                 MenuItem::linkToCrud('Harderwijk''fa fa-minus'Reminder::class)
  143.                     ->setController(ReminderHarderwijkCrudController::class),
  144.                 MenuItem::linkToCrud('Epe''fa fa-minus'Reminder::class)
  145.                     ->setController(ReminderEpeCrudController::class),
  146.                 MenuItem::linkToCrud('\'t Harde''fa fa-minus'Reminder::class)
  147.                     ->setController(ReminderHardeCrudController::class),
  148.                 MenuItem::linkToCrud('Alle actief''fa fa-minus'Reminder::class)
  149.                     ->setController(ReminderActiveCrudController::class),
  150.                 MenuItem::linkToCrud('Alle''fa fa-minus'Reminder::class)
  151.                     ->setController(ReminderCrudController::class)
  152.             ]);
  153.         yield MenuItem::linkToCrud('Families''fa fa-users'Familie::class);
  154.         yield MenuItem::subMenu('Prospects''fa fa-user'Prospect::class)
  155.             ->setSubItems([
  156.                 MenuItem::linkToCrud('Alle prospects''fa fa-minus'Prospect::class)
  157.                     ->setController(ProspectCrudController::class),
  158.                 MenuItem::linkToCrud('Te versturen''fa fa-minus'Prospect::class)
  159.                     ->setController(ProspectTeVersturenCrudController::class),
  160.                 MenuItem::linkToCrud('Fotoboek afgegeven''fa fa-minus'Prospect::class)
  161.                     ->setController(ProspectFotoboekAfgegevenCrudController::class)
  162.             ]);
  163.         yield MenuItem::linkToCrud('Alle records''fa fa-folder-open'order::class)
  164.             ->setController(OrderCrudController::class);
  165.         yield MenuItem::linkToCrud('Afhalers''fa fa-folder-open'order::class)
  166.             ->setController(AfhalerCrudController::class);
  167.         yield MenuItem::subMenu('Offertes''fa fa-folder-open')
  168.             ->setSubItems([
  169.                 MenuItem::linkToCrud('Alle lopende offertes''fa fa-minus'order::class)
  170.                     ->setController(OfferteAlleCrudController::class),
  171.                 MenuItem::linkToCrud('Offerte te ontwerpen''fa fa-minus'order::class)
  172.                     ->setController(OfferteTeOntwerpenCrudController::class),
  173.                 MenuItem::linkToCrud('Offerte aan te passen''fa fa-minus'order::class)
  174.                     ->setController(OfferteAanpassenCrudController::class),
  175.                 MenuItem::linkToCrud('Ontwerp aanpassen''fa fa-minus'order::class)
  176.                     ->setController(OfferteOntwerpAanpassenCrudController::class),
  177.                 MenuItem::linkToCrud('Ontwerp controleren''fa fa-minus'order::class)
  178.                     ->setController(OfferteOntwerpTeControlerenCrudController::class),
  179.                 MenuItem::linkToCrud('Offerte controleren''fa fa-minus'order::class)
  180.                     ->setController(OfferteTeControlerenCrudController::class),
  181.                 MenuItem::linkToCrud('Offerte versturen''fa fa-minus'order::class)
  182.                     ->setController(OfferteTeVersturenCrudController::class)
  183.             ]);
  184.         yield MenuItem::subMenu('Orders''fa fa-folder-open')
  185.             ->setSubItems([
  186.                 //MenuItem::section('Orders'),
  187.                 // MenuItem::linkToCrud('Maak nieuwe order', 'fa fa-minus', order::class)
  188.                 //     ->setController(OrderPartialControllerStep01::class)
  189.                 //     ->setAction(Action::NEW),
  190.                 MenuItem::linkToCrud('Alle lopende orders''fa fa-minus'order::class)
  191.                     ->setController(OrderAlleCrudController::class),
  192.                 MenuItem::linkToCrud('Order te ontwerpen''fa fa-minus'order::class)
  193.                     ->setController(OrderTeOntwerpenCrudController::class),
  194.                 MenuItem::linkToCrud('Order aan te passen''fa fa-minus'order::class)
  195.                     ->setController(OrderAanpassenCrudController::class),
  196.                 MenuItem::linkToCrud('Ontwerp aanpassen''fa fa-minus'order::class)
  197.                     ->setController(OrderOntwerpAanpassenCrudController::class),
  198.                 MenuItem::linkToCrud('Ontwerp controleren''fa fa-minus'order::class)
  199.                     ->setController(OrderOntwerpTeControlerenCrudController::class),
  200.                 MenuItem::linkToCrud('Order controleren''fa fa-minus'order::class)
  201.                     ->setController(OrderTeControlerenCrudController::class),
  202.                 MenuItem::linkToCrud('Order versturen''fa fa-minus'order::class)
  203.                     ->setController(OrderTeVersturenCrudController::class),
  204.             ]);
  205.         yield MenuItem::subMenu('Workflow''fa fa-gears')
  206.             ->setSubItems([
  207.                 MenuItem::linkToCrud('Vergunning aanvr.''fa fa-minus'order::class)
  208.                     ->setController(OrderVergunningaanvraagCrudController::class),
  209.                 MenuItem::linkToCrud('Te bestellen (oud)''fa fa-minus'order::class)
  210.                     ->setController(OrderTeBestellenCrudController::class),
  211.                 MenuItem::linkToCrud('Te bestellen''fa fa-minus'order::class)
  212.                     ->setController(OrderOndTeBestellenCrudController::class),
  213.                 MenuItem::linkToCrud('Te Leveren''fa fa-minus'order::class)
  214.                     ->setController(OrderTeLeverenCrudController::class),
  215.                 MenuItem::linkToCrud('Levering melden''fa fa-minus'order::class)
  216.                     ->setController(OrderLeveringCrudController::class)
  217.             ]);
  218.         yield MenuItem::subMenu('Bestellingen''fa fa-folder-open')
  219.             ->setSubItems([
  220.                 MenuItem::linkToCrud('Alle bestellingen''fa fa-minus'Bestelling::class)
  221.                     ->setController(BestellingCrudController::class),
  222.                 MenuItem::linkToCrud('Lopende bestellingen''fa fa-minus'Bestelling::class)
  223.                     ->setController(BestellingLopendCrudController::class),
  224.                 MenuItem::linkToCrud('Te controleren''fa fa-minus'Bestelling::class)
  225.                     ->setController(BestellingControlerenCrudController::class),
  226.                 MenuItem::linkToCrud('Te verzenden''fa fa-minus'Bestelling::class)
  227.                     ->setController(BestellingVerzendenCrudController::class),
  228.                 MenuItem::linkToCrud('Bevestiging laat''fa fa-minus'Bestelling::class)
  229.                     ->setController(BestellingNietBevestigdCrudController::class),
  230.                 MenuItem::linkToCrud('Levering te laat''fa fa-minus'Bestelling::class)
  231.                     ->setController(BestellingLeeftijdCrudController::class),
  232.             ]);
  233.         yield MenuItem::subMenu('Monitoring''fa fa-magnifying-glass')
  234.             ->setSubItems([
  235.                 MenuItem::linkToCrud('Offertes > 14 dagen''fa fa-minus'order::class)
  236.                     ->setController(OfferteLeeftijdCrudController::class),
  237.                 MenuItem::linkToCrud('Orders > 5 maand''fa fa-minus'order::class)
  238.                     ->setController(OrderLeeftijdCrudController::class),
  239.                 MenuItem::linkToCrud('Afhalers > 3 weken''fa fa-minus'order::class)
  240.                     ->setController(AfhalerLeeftijdCrudController::class),
  241.                 MenuItem::linkToCrud('Orders niet akkoord''fa fa-minus'order::class)
  242.                     ->setController(OrderNietAkkoordCrudController::class),
  243.                 MenuItem::linkToCrud('Check voortgang levermaand < 2 weken''fa fa-minus'order::class)
  244.                     ->setController(OrderCheckVoortgangLevermaandCrudController::class),
  245.                 MenuItem::linkToCrud('Levermaand ontbreekt''fa fa-minus'order::class)
  246.                     ->setController(OrderLevermaandOntbreektCrudController::class)
  247.             ]);
  248.         yield MenuItem::section('Basisgegevens');
  249.         yield MenuItem::linkToCrud('Leveranciers''fa fa-truck'Leverancier::class);
  250.         yield MenuItem::linkToCrud('Uitvaartverenigingen''fa fa-people-roof'Uitvaartvereniging::class);
  251.         yield MenuItem::linkToCrud('Agenten''fa fa-user-pen'Agent::class);
  252.         yield MenuItem::linkToCrud('Begraafplaatsen''fa fa-leaf'Begraafplaats::class);
  253.         //yield MenuItem::linkToCrud('Topics','fa fa-folder',Topic::class);
  254.         //yield MenuItem::linkToCrud('Users', 'fas fa-users', User::class);
  255.         // yield MenuItem::linkToCrud('The Label', 'fas fa-list', EntityClass::class);
  256.         yield MenuItem::subMenu('Producten''fa fa-gear')
  257.             ->setSubItems([
  258.                 MenuItem::linkToCrud('Standaard modellen''fa fa-minus'Model::class)
  259.                     ->setController(ModelCrudController::class),
  260.                 MenuItem::linkToCrud('Standaard onderdelen''fa fa-minus'Onderdeel::class)
  261.                     ->setController(OnderdeelCrudController::class),
  262.                 //MenuItem::linkToCrud('Order onderdelen', 'fa fa-minus', Orderonderdeel::class)
  263.                 //    ->setController(OrderonderdeelCrudController::class),
  264.                 MenuItem::linkToCrud('Categorieën''fa fa-minus'Categorie::class)
  265.                     ->setController(CategorieCrudController::class),
  266.                 MenuItem::linkToCrud('Materialen''fa fa-minus'Materiaal::class)
  267.                     ->setController(MateriaalCrudController::class),
  268.                 MenuItem::linkToCrud('Bewerkingen''fa fa-minus'Bewerking::class)
  269.                     ->setController(BewerkingCrudController::class),
  270.                 MenuItem::linkToCrud('Kleuren''fa fa-minus'Kleur::class)
  271.                     ->setController(KleurCrudController::class),
  272.                 MenuItem::linkToCrud('Belettering''fa fa-minus'Belettering::class)
  273.                     ->setController(BeletteringCrudController::class),
  274.                 MenuItem::linkToCrud('Lettertype''fa fa-minus'Lettertype::class)
  275.                     ->setController(LettertypeCrudController::class),
  276.             ]);
  277.         yield MenuItem::subMenu('Teksten''fa fa-keyboard')
  278.             ->setSubItems([
  279.                 MenuItem::linkToCrud('Standaard regels''fa fa-minus'Regel::class)
  280.                     ->setController(RegelCrudController::class),
  281.             ]);
  282.         yield MenuItem::linkToCrud('Vestigingen''fa fa-building'Vestiging::class);
  283.         yield MenuItem::linkToCrud('Opslaglocaties''fa fa-archive'Opslaglocatie::class);
  284.         yield MenuItem::subMenu('Gebruikers''fa fa-users-line')
  285.             ->setSubItems([
  286.                 MenuItem::linkToCrud('Groepen''fa fa-minus'Groep::class)
  287.                     ->setController(GroepCrudController::class),
  288.                 MenuItem::linkToCrud('Users''fa fa-minus'User::class)
  289.                     ->setController(UserCrudController::class),
  290.             ]);;
  291.         yield      MenuItem::linkToCrud('Brieven''fa fa-newspaper'Brief::class)
  292.             ->setController(BriefCrudController::class);
  293.         yield      MenuItem::linkToCrud('Orderregels''fa fa-newspaper'Orderregel::class)
  294.             ->setController(OrderregelCrudController::class);
  295.     }
  296.     public function configureActions(): Actions
  297.     {
  298.         return parent::configureActions()
  299.             ->add(Crud::PAGE_INDEXAction::DETAIL)
  300.         ;
  301.     }
  302.     public function configureAssets(): Assets
  303.     {
  304.         return parent::configureAssets()
  305.             ->addWebpackEncoreEntry('admin');
  306.     }
  307. }