<?php
namespace App\Controller\Admin;
use App\Entity\Employment;
use App\Entity\ObjectDef;
use App\Entity\ObjectDefinition;
use App\Entity\Swieta;
use App\Entity\Symulation;
use App\Entity\SymulationView;
use App\Entity\User;
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class DashboardController extends AbstractDashboardController
{
/**
* @Route("/public/img/products/{img?}", name="imgView")
*
*/
public function imgView(Request $request): Response
{
$image = $request->get('img');
return $this->render('image/imgView.html.twig', [
'image' => $image,
]);
}
/**
* @Route("/null", name="mupdate")
*
*/
public function mupdate(Request $request): Response
{
return $this->render('mupdate.html.twig',[
'idu' => $request->request->get('batchActionEntityIds')
]);
}
/**
* @Route("/", name="admin")
*/
public function index(): Response
{
//return parent::index();
return $this->render('bundles/EasyAdminBundle/welcome.html.twig',[
// 'statByDostawca' => $this -> produktRepository ->statByDostawca(),
// 'statByDostawcaCms' => $this -> produktRepository ->statByDostawcaCms(),
'stat' => '',
'statSprzedaz' => '',
]);
}
/**
* @Route("/admin", name="admin2")
*/
public function index2(): Response
{
//return parent::index();
return $this->render('bundles/EasyAdminBundle/welcome.html.twig',[
'statByDostawca' => '',
'statByDostawcaCms' => '',
'stat' =>''
]);
}
public function configureDashboard(): Dashboard
{
return Dashboard::new()
// the name visible to end users
// you can include HTML contents too (e.g. to link to an image)
->setTitle('Symulacja')
// the path defined in this method is passed to the Twig asset() function
->setFaviconPath('favicon.svg')
// the domain used by default is 'messages'
->setTranslationDomain('pl')
->disableUrlSignatures()
// there's no need to define the "text direction" explicitly because
// its default value is inferred dynamically from the user locale
->setTextDirection('ltr')
// set this option if you prefer the page content to span the entire
// browser width, instead of the default design which sets a max width
->renderContentMaximized()
// set this option if you prefer the sidebar (which contains the main menu)
// to be displayed as a narrow column instead of the default expanded design
//->renderSidebarMinimized()
// by default, all backend URLs include a signature hash. If a user changes any
// query parameter (to "hack" the backend) the signature won't match and EasyAdmin
// triggers an error. If this causes any issue in your backend, call this method
// to disable this feature and remove all URL signature checks
//->disableUrlSignatures()
;
}
public function configureMenuItems(): iterable
{
return [
MenuItem::linkToDashboard('Pulpit', 'fa fa-home')->setPermission('ROLE_PRODUCT_MANAGER'),
MenuItem::subMenu('Symulacja', 'fa fa-bar-chart')
->setSubItems([
MenuItem::linkToCrud('Def. Świąt', 'fa fa-spell-check', Swieta::class),
MenuItem::linkToCrud('Def. zatrudnienia', 'fa fa-spell-check', Employment::class),
MenuItem::linkToCrud('Def. obiektu', 'fa fa-spell-check', ObjectDef::class),
MenuItem::linkToRoute('Kreator obiektu', 'fa fa-spell-check', 'creator'),
MenuItem::linkToCrud('Kreator obiektu view', 'fa fa-spell-check', ObjectDefinition::class),
MenuItem::linkToCrud('Def. symulacji', 'fa fa-spell-check', Symulation::class),
MenuItem::linkToRoute('Symulacja','fa fa-cogs', 'symulation'),
MenuItem::linkToCrud('Symulacja Wyg. ', 'fa fa-view', SymulationView::class),
MenuItem::linkToRoute('Sym. Widok','fa fa-cogs', 'symulationView'),
MenuItem::linkToRoute('dane z pośrendika','fa fa-cogs', 'symulationPosrednik'),
])->setPermission('ROLE_USER'),
MenuItem::linkToCrud('Users', 'fa fa-user', User::class)
->setPermission('ROLE_ADMIN'),
// MenuItem::subMenu('Klienci','fa fa-address-book')
// ->setSubItems([
// MenuItem::linkToCrud('Klienci sklepu', 'fa fa-hashtag', PsCustomer::class)
// ->setPermission('ROLE_TRADER'),
// MenuItem::linkToCrud('Zamówienia Paynow', 'fa fa-hashtag', PsOrders::class)
// ->setPermission('ROLE_TRADER'),
//
// ])->setPermission('ROLE_TRADER')
];
}
}