<?php
namespace App\Controller\Admin;
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
class DashboardController extends AbstractDashboardController
{
private $adminUrlGenerator;
public function __construct(AdminUrlGenerator $adminUrlGenerator)
{
$this->adminUrlGenerator = $adminUrlGenerator;
}
/**
* @Route("/admin", name="admin")
*/
public function index(): Response
{
return parent::index();
}
public function configureDashboard(): Dashboard
{
return Dashboard::new()
->setTitle('Marketplace');
}
public function configureMenuItems(): iterable
{
yield MenuItem::linkToCrud('Категории', 'fas fa-home', \App\Entity\Category::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Категории Мерлион', 'fas fa-list', \App\Entity\MerlionCategory::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Категории Ланит', 'fas fa-list', \App\Entity\LanitCategory::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Категории Ocs', 'fas fa-list', \App\Entity\OcsCategory::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Категории Resmed', 'fas fa-list', \App\Entity\ResmedCategory::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Бренды', 'fas fa-list', \App\Entity\Brand::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Товары', 'fas fa-list', \App\Entity\Product::class);
yield MenuItem::linkToCrud('Связи товар-МП', 'fas fa-list', \App\Entity\MLink::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Заказы на ОЗОНе', 'fas fa-list', \App\Entity\OzonOrder::class);
yield MenuItem::section('Настройки');
yield MenuItem::linkToCrud('Дистрибьюторы', 'fas fa-list', \App\Entity\Distributor::class);
yield MenuItem::linkToCrud('Пользователи', 'fas fa-user', \App\Entity\User::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Маркетплейсы', 'fas fa-list', \App\Entity\Marketplace::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToUrl('Чистка XLS', 'fa fa-file-excel', $this->adminUrlGenerator->setRoute('excel_cleanup')->generateUrl())->setPermission('ROLE_ADMIN');
yield MenuItem::linkToUrl('Выгрузка незаведенных товаров', 'fa fa-file-excel', $this->adminUrlGenerator->setRoute('excel_ozon_goods')->generateUrl());
yield MenuItem::linkToUrl('Загрузка собственного склада', 'fa fa-file-excel', $this->adminUrlGenerator->setRoute('excel_ownstock_upload')->generateUrl());
}
}