Add person menu entry for signature list

This commit is contained in:
2024-09-04 15:13:14 +00:00
committed by Julien Fastré
parent 3e5a558cdf
commit 5f5d4b8f06
13 changed files with 240 additions and 30 deletions

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Repository\Workflow\EntityWorkflowStepSignatureACLAwareRepository;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Repository\ResidentialAddressRepository;
@@ -43,6 +44,7 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
private readonly Security $security,
protected TranslatorInterface $translator,
private readonly ResidentialAddressRepository $residentialAddressRepo,
private readonly EntityWorkflowStepSignatureACLAwareRepository $entityWorkflowStepSignatureRepository,
) {
$this->showAccompanyingPeriod = $parameterBag->get('chill_person.accompanying_period');
}
@@ -125,6 +127,21 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
? $nbAccompanyingPeriod : null,
]);
}
$nbSignatures = count($this->entityWorkflowStepSignatureRepository->findByPersonAndPendingState($parameters['person']));
if ($nbSignatures > 0) {
$menu->addChild($this->translator->trans('workflow.signature_list.menu'), [
'route' => 'chill_person_signature_list',
'routeParameters' => [
'id' => $parameters['person']->getId(),
],
])
->setExtras([
'order' => 110,
'counter' => $nbSignatures,
]);
}
}
public static function getMenuIds(): array