mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-08 14:29:42 +00:00
Create admin section for ticket bundle
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\TicketBundle\Controller;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AdminController
|
||||||
|
* Controller for the ticket configuration section (in admin section).
|
||||||
|
*/
|
||||||
|
class AdminController extends AbstractController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Ticket admin.
|
||||||
|
*/
|
||||||
|
#[Route(path: '/{_locale}/admin/ticket', name: 'chill_ticket_admin_index')]
|
||||||
|
public function indexAdminAction()
|
||||||
|
{
|
||||||
|
return $this->render('@ChillTicket/Admin/index.html.twig');
|
||||||
|
}
|
||||||
|
}
|
45
src/Bundle/ChillTicketBundle/src/Menu/AdminMenuBuilder.php
Normal file
45
src/Bundle/ChillTicketBundle/src/Menu/AdminMenuBuilder.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\TicketBundle\Menu;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Knp\Menu\MenuItem;
|
||||||
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
|
|
||||||
|
class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||||
|
{
|
||||||
|
public function __construct(protected AuthorizationCheckerInterface $authorizationChecker) {}
|
||||||
|
|
||||||
|
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
|
||||||
|
{
|
||||||
|
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$menu->addChild('Tickets', [
|
||||||
|
'route' => 'chill_ticket_admin_index',
|
||||||
|
])
|
||||||
|
->setAttribute('class', 'list-group-item-header')
|
||||||
|
->setExtras([
|
||||||
|
'order' => 7500,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$menu->addChild('ticket.motive.label', [
|
||||||
|
'route' => 'chill_crud_motive_index',
|
||||||
|
])->setExtras(['order' => 7510]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getMenuIds(): array
|
||||||
|
{
|
||||||
|
return ['admin_section', 'admin_ticket'];
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
|
||||||
|
|
||||||
|
{% block vertical_menu_content %}
|
||||||
|
{{ chill_menu('admin_ticket', {
|
||||||
|
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
|
||||||
|
}) }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block layout_wvm_content %}
|
||||||
|
{% block admin_content %}<!-- block content empty -->
|
||||||
|
<h1>{{ 'Tickets configuration' |trans }}</h1>
|
||||||
|
{% endblock %}
|
||||||
|
{% endblock %}
|
Reference in New Issue
Block a user