diff --git a/module/Decision/config/module.config.php b/module/Decision/config/module.config.php index 330e4d589e..0ad5802ac3 100644 --- a/module/Decision/config/module.config.php +++ b/module/Decision/config/module.config.php @@ -249,10 +249,10 @@ ], 'priority' => 100, ], - 'organ' => [ + 'organs' => [ 'type' => Literal::class, 'options' => [ - 'route' => '/organ', + 'route' => '/organs', 'defaults' => [ 'controller' => OrganController::class, 'action' => 'index', @@ -260,15 +260,24 @@ ], 'may_terminate' => true, 'child_routes' => [ - 'show' => [ + 'history' => [ + 'type' => Literal::class, + 'options' => [ + 'route' => '/history', + 'defaults' => [ + 'action' => 'history', + ], + ], + ], + 'view' => [ 'type' => Segment::class, 'options' => [ - 'route' => '/show/:organ', + 'route' => '/view/:organ', 'constraints' => [ 'organ' => '[0-9]+', ], 'defaults' => [ - 'action' => 'show', + 'action' => 'view', ], ], ], @@ -400,6 +409,9 @@ 'template_path_stack' => [ 'decision' => __DIR__ . '/../view/', ], + 'template_map' => [ + 'decision/organ/history' => __DIR__ . '/../view/decision/organ/index.phtml', + ], ], 'doctrine' => [ 'driver' => [ diff --git a/module/Decision/src/Controller/OrganController.php b/module/Decision/src/Controller/OrganController.php index 367190f8f6..356fcb6e6f 100644 --- a/module/Decision/src/Controller/OrganController.php +++ b/module/Decision/src/Controller/OrganController.php @@ -23,15 +23,26 @@ public function indexAction(): ViewModel { return new ViewModel( [ + 'historical' => false, 'organs' => $this->organService->getOrgans(), ], ); } + public function historyAction(): ViewModel + { + return new ViewModel( + [ + 'historical' => true, + 'organs' => $this->organService->getOrgans(true), + ], + ); + } + /** * Show an organ. */ - public function showAction(): ViewModel + public function viewAction(): ViewModel { $organId = (int) $this->params()->fromRoute('organ'); $organ = $this->organService->getOrgan($organId); diff --git a/module/Decision/src/Service/Organ.php b/module/Decision/src/Service/Organ.php index 7aff10a038..18b4c998ad 100644 --- a/module/Decision/src/Service/Organ.php +++ b/module/Decision/src/Service/Organ.php @@ -70,13 +70,17 @@ public function __construct( * * @return OrganModel[] */ - public function getOrgans(): array + public function getOrgans(bool $abrogated = false): array { if (!$this->aclService->isAllowed('list', 'organ')) { throw new NotAllowedException($this->translator->translate('Not allowed to view the list of organs')); } - return $this->organMapper->findActive(); + if (!$abrogated) { + return $this->organMapper->findActive(); + } + + return $this->organMapper->findAbrogated(); } /** diff --git a/module/Decision/view/decision/member/index.phtml b/module/Decision/view/decision/member/index.phtml index 949735bb3f..ac02dc9348 100644 --- a/module/Decision/view/decision/member/index.phtml +++ b/module/Decision/view/decision/member/index.phtml @@ -68,7 +68,7 @@ $this->headTitle($this->translate('Members'));