mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
condition added to display thirdparty centers or not
This commit is contained in:
parent
13d579dc33
commit
b8d9d59d76
@ -34,6 +34,7 @@ and this project adheres to
|
||||
* [person] email added to twig personRenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/490)
|
||||
* [person] Add link to current household in person banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/484)
|
||||
* [person] Change 'personne' with 'usager' and '&' with 'ET' (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/499)
|
||||
* [thirdparty] Add parameter condition to display centers or not (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/500)
|
||||
|
||||
## Test releases
|
||||
|
||||
|
@ -20,6 +20,7 @@ use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\ThirdPartyBundle\Repository\ThirdPartyACLAwareRepositoryInterface;
|
||||
use Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter;
|
||||
use LogicException;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
@ -31,37 +32,39 @@ use function array_merge;
|
||||
|
||||
final class ThirdPartyController extends CRUDController
|
||||
{
|
||||
/**
|
||||
* @var AuthorizationHelper
|
||||
*/
|
||||
protected $authorizationHelper;
|
||||
protected AuthorizationHelper $authorizationHelper;
|
||||
|
||||
/**
|
||||
* @var PaginatorFactory
|
||||
*/
|
||||
protected $paginatorFactory;
|
||||
protected PaginatorFactory $paginatorFactory;
|
||||
|
||||
protected RequestStack $requestStack;
|
||||
|
||||
protected ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
private bool $askCenter;
|
||||
|
||||
public function __construct(
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
TranslatorInterface $translator,
|
||||
PaginatorFactory $paginatorFactory,
|
||||
RequestStack $requestStack,
|
||||
ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository
|
||||
ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository,
|
||||
ParameterBagInterface $parameterBag
|
||||
) {
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->translator = $translator;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
$this->requestStack = $requestStack;
|
||||
$this->thirdPartyACLAwareRepository = $thirdPartyACLAwareRepository;
|
||||
$this->askCenter = $parameterBag->get('chill_main')['acl']['form_show_centers'];
|
||||
}
|
||||
|
||||
public function generateTemplateParameter(string $action, $entity, Request $request, array $defaultTemplateParameters = [])
|
||||
{
|
||||
$defaultTemplateParameters['askCenter'] = $this->askCenter;
|
||||
|
||||
return $defaultTemplateParameters;
|
||||
}
|
||||
|
||||
protected function buildFilterOrderHelper(string $action, Request $request): ?FilterOrderHelper
|
||||
|
@ -13,7 +13,7 @@
|
||||
<h1>
|
||||
{{ title_ }}
|
||||
<span class="badge bg-{{ thirdParty.active ? 'success' : 'danger' }} float-end"
|
||||
title="{{ (thirdParty.active ? 'shown to users' : 'not shown to users')|trans }}">
|
||||
title="{{ (thirdParty.active ? 'shown to users' : 'not shown to users')|trans }}">
|
||||
{{ (thirdParty.active ? 'Active' : 'Inactive')|trans }}
|
||||
</span>
|
||||
</h1>
|
||||
@ -123,19 +123,20 @@
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt>{{ 'Centers'|trans }}</dt>
|
||||
<dd>
|
||||
{% set centers = thirdParty|chill_resolve_center %}
|
||||
{% if centers is iterable %}
|
||||
{{ 'The party is visible in those centers'|trans }} :
|
||||
{{ centers|join(', ') }}
|
||||
{% elseif centers is null %}
|
||||
{{ 'The party is not visible in any center'|trans }}
|
||||
{% else %}
|
||||
{{ 'The party is visible in those centers'|trans }} : {{ centers }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
{% if askCenter %}
|
||||
<dt>{{ 'Centers'|trans }}</dt>
|
||||
<dd>
|
||||
{% set centers = thirdParty|chill_resolve_center %}
|
||||
{% if centers is iterable %}
|
||||
{{ 'The party is visible in those centers'|trans }} :
|
||||
{{ centers|join(', ') }}
|
||||
{% elseif centers is null %}
|
||||
{{ 'The party is not visible in any center'|trans }}
|
||||
{% else %}
|
||||
{{ 'The party is visible in those centers'|trans }} : {{ centers }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
{% endblock %}
|
||||
{% block content_form_actions_delete %}{% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user