mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Minor fixes for closing accompanying course:
* check that transition can be applyied in menu; * change organisation for activityVoter, and check for authorization in Activity Controller * fix label 'create' in accompanying course document * minor fix in accompanying course document voter * change color when course is closed and show old user, and startdate / enddate
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Chill\PersonBundle\Menu;
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Workflow\Registry;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
@@ -20,10 +21,12 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
protected Registry $registry;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(TranslatorInterface $translator, Registry $registry)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->registry = $registry;
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
@@ -33,6 +36,7 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
|
||||
{
|
||||
/** @var AccompanyingPeriod $period */
|
||||
$period = $parameters['accompanyingCourse'];
|
||||
|
||||
$menu->addChild($this->translator->trans('Resume Accompanying Course'), [
|
||||
@@ -68,13 +72,16 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||
]])
|
||||
->setExtras(['order' => 40]);
|
||||
|
||||
$menu->addChild($this->translator->trans('Close Accompanying Course'), [
|
||||
'route' => 'chill_person_accompanying_course_close',
|
||||
'routeParameters' => [
|
||||
'accompanying_period_id' => $period->getId()
|
||||
]])
|
||||
->setExtras(['order' => 500]);
|
||||
$workflow = $this->registry->get($period, 'accompanying_period_lifecycle');
|
||||
|
||||
if ($workflow->can($period, 'close')) {
|
||||
$menu->addChild($this->translator->trans('Close Accompanying Course'), [
|
||||
'route' => 'chill_person_accompanying_course_close',
|
||||
'routeParameters' => [
|
||||
'accompanying_period_id' => $period->getId()
|
||||
]])
|
||||
->setExtras(['order' => 99999]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user