src/Controller/Admin/DashboardController.php line 61

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Admin;
  3. use App\Entity\Employment;
  4. use App\Entity\ObjectDef;
  5. use App\Entity\ObjectDefinition;
  6. use App\Entity\Swieta;
  7. use App\Entity\Symulation;
  8. use App\Entity\SymulationView;
  9. use App\Entity\User;
  10. use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
  11. use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
  12. use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
  13. use Symfony\Component\HttpFoundation\Request;
  14. use Symfony\Component\HttpFoundation\Response;
  15. use Symfony\Component\Routing\Annotation\Route;
  16. class DashboardController extends AbstractDashboardController
  17. {
  18.     /**
  19.      * @Route("/public/img/products/{img?}", name="imgView")
  20.      *
  21.      */
  22.     public function imgView(Request $request): Response
  23.     {
  24.         $image $request->get('img');
  25.         return $this->render('image/imgView.html.twig', [
  26.             'image' => $image,
  27.         ]);
  28.     }
  29.     /**
  30.      * @Route("/null", name="mupdate")
  31.      *
  32.      */
  33.     public function mupdate(Request $request): Response
  34.     {
  35.         return $this->render('mupdate.html.twig',[
  36.                 'idu' => $request->request->get('batchActionEntityIds')
  37.         ]);
  38.     }
  39.     /**
  40.      * @Route("/", name="admin")
  41.      */
  42.     public function index(): Response
  43.     {
  44.         //return parent::index();
  45.         return $this->render('bundles/EasyAdminBundle/welcome.html.twig',[
  46.            // 'statByDostawca' => $this -> produktRepository ->statByDostawca(),
  47.            // 'statByDostawcaCms' => $this -> produktRepository ->statByDostawcaCms(),
  48.             'stat' => '',
  49.             'statSprzedaz' => '',
  50.     ]);
  51.     }
  52.     /**
  53.      * @Route("/admin", name="admin2")
  54.      */
  55.     public function index2(): Response
  56.     {
  57.         //return parent::index();
  58.         return $this->render('bundles/EasyAdminBundle/welcome.html.twig',[
  59.             'statByDostawca' => '',
  60.             'statByDostawcaCms' => '',
  61.             'stat' =>''
  62.         ]);
  63.     }
  64.     public function configureDashboard(): Dashboard
  65.     {
  66.         return Dashboard::new()
  67.             // the name visible to end users
  68.             // you can include HTML contents too (e.g. to link to an image)
  69.             ->setTitle('Symulacja')
  70.             // the path defined in this method is passed to the Twig asset() function
  71.             ->setFaviconPath('favicon.svg')
  72.             // the domain used by default is 'messages'
  73.             ->setTranslationDomain('pl')
  74.             ->disableUrlSignatures()
  75.             // there's no need to define the "text direction" explicitly because
  76.             // its default value is inferred dynamically from the user locale
  77.             ->setTextDirection('ltr')
  78.             // set this option if you prefer the page content to span the entire
  79.             // browser width, instead of the default design which sets a max width
  80.             ->renderContentMaximized()
  81.             // set this option if you prefer the sidebar (which contains the main menu)
  82.             // to be displayed as a narrow column instead of the default expanded design
  83.             //->renderSidebarMinimized()
  84.             // by default, all backend URLs include a signature hash. If a user changes any
  85.             // query parameter (to "hack" the backend) the signature won't match and EasyAdmin
  86.             // triggers an error. If this causes any issue in your backend, call this method
  87.             // to disable this feature and remove all URL signature checks
  88.             //->disableUrlSignatures()
  89.         ;
  90.     }
  91.     public function configureMenuItems(): iterable
  92.     {
  93.         return [
  94.             MenuItem::linkToDashboard('Pulpit''fa fa-home')->setPermission('ROLE_PRODUCT_MANAGER'),
  95.             MenuItem::subMenu('Symulacja''fa fa-bar-chart')
  96.                 ->setSubItems([
  97.                     MenuItem::linkToCrud('Def. Świąt''fa fa-spell-check'Swieta::class),
  98.                     MenuItem::linkToCrud('Def. zatrudnienia''fa fa-spell-check'Employment::class),
  99.                     MenuItem::linkToCrud('Def. obiektu''fa fa-spell-check'ObjectDef::class),
  100.                     MenuItem::linkToRoute('Kreator obiektu''fa fa-spell-check''creator'),
  101.                     MenuItem::linkToCrud('Kreator obiektu view''fa fa-spell-check'ObjectDefinition::class),
  102.                     MenuItem::linkToCrud('Def. symulacji''fa fa-spell-check'Symulation::class),
  103.                     MenuItem::linkToRoute('Symulacja','fa fa-cogs''symulation'),
  104.                     MenuItem::linkToCrud('Symulacja Wyg. ''fa fa-view'SymulationView::class),
  105.                     MenuItem::linkToRoute('Sym. Widok','fa fa-cogs''symulationView'),
  106.                     MenuItem::linkToRoute('dane z pośrendika','fa fa-cogs''symulationPosrednik'),
  107.                 ])->setPermission('ROLE_USER'),
  108.              MenuItem::linkToCrud('Users''fa fa-user'User::class)
  109.                 ->setPermission('ROLE_ADMIN'),
  110. //            MenuItem::subMenu('Klienci','fa fa-address-book')
  111. //                ->setSubItems([
  112. //                    MenuItem::linkToCrud('Klienci sklepu', 'fa fa-hashtag', PsCustomer::class)
  113. //                    ->setPermission('ROLE_TRADER'),
  114. //                    MenuItem::linkToCrud('Zamówienia Paynow', 'fa fa-hashtag', PsOrders::class)
  115. //                        ->setPermission('ROLE_TRADER'),
  116. //
  117. //                ])->setPermission('ROLE_TRADER')
  118.         ];
  119.     }
  120. }