improve layout of third parties in AddPerson

This commit is contained in:
2021-10-11 11:07:49 +02:00
parent c54edd8407
commit 08764aa0b4
7 changed files with 120 additions and 29 deletions

View File

@@ -21,6 +21,7 @@
namespace Chill\ThirdPartyBundle\Templating\Entity;
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Symfony\Component\Templating\EngineInterface;
@@ -32,10 +33,15 @@ class ThirdPartyRender extends AbstractChillEntityRender
{
protected EngineInterface $engine;
protected TranslatableStringHelper $translatableStringHelper;
public function __construct(EngineInterface $engine)
public function __construct(
EngineInterface $engine,
TranslatableStringHelper $translatableStringHelper
)
{
$this->engine = $engine;
$this->translatableStringHelper = $translatableStringHelper;
}
/**
@@ -76,7 +82,18 @@ class ThirdPartyRender extends AbstractChillEntityRender
*/
public function renderString($entity, array $options): string
{
return $entity->getName();
if ($entity->getCivility() !== NULL) {
$civility = $this->translatableStringHelper
->localize($entity->getCivility()->getAbbreviation()).' ';
} else {
$civility = '';
}
if (!empty($entity->getAcronym())) {
$acronym = ' ('.$entity->getAcronym().')';
} else {
$acronym = '';
}
return $civility.$entity->getName().$acronym;
}
public function supports($entity, array $options): bool