<?php
namespace App\Component\AdminMenu\EventSubscriber;
use App\Component\AdminMenu\Event\AbstractBuildMenuEvent;
use App\Component\AdminMenu\Event\BuildVacancyMenuEvent;
use App\Component\UserRole\Permission\UserRolePermission;
use App\Entity\Recruiter;
use App\Entity\RecruiterAttribute;
class RecruiterMenuSubscriber extends AbstractMenuBuildEventSubscriber
{
protected static int $priority = -30;
protected static string $eventClass = BuildVacancyMenuEvent::class;
public function buildMenu(AbstractBuildMenuEvent $event)
{
$menuBuilder = $this->getMenuBuilder($event->getMenu(), 'Vacancies');
if ($this->hasAccess(['ROLE_ADMIN_USER', [UserRolePermission::MASK_VIEW, Recruiter::class]])) {
$menuBuilder
->addMainItem('Recruiters', 'fal fa-user-circle')
->addOverlay()
->addSection('Recruiters')
->addColumn('General', 'fal fa-user-circle')
->addItem('View recruiters', 'recruiters')
->addItem('Create recruiter', 'recruiter_create')
;
}
if ($this->hasAccess(['ROLE_ADMIN_USER', [UserRolePermission::MASK_VIEW, RecruiterAttribute::class]])) {
$menuBuilder->addItem('Recruiter attributes', 'admin_recruiter_attribute_index');
}
}
}