Commit 38241d8e by Damien Moulard

re set Flux/Achat de monnaie filter in admin

parent 793313a4
......@@ -8,6 +8,7 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
/**
* Administration des flux 'Achat de monnaie'.
......@@ -51,18 +52,34 @@ class AchatMonnaieAdmin extends FluxAdmin
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper): void
{
//In mode ssa_friendly_flux_type_names, we display on this page all cotisation
//initial operation (i.e. we display vente_emlc operations in addition to achat_monnaie)
//therefore filtering by type achat_monnaie_adherent VS achat_monnaie_prestataire
//would be confusing (selecting one of them would hide all vente_emlc operations)
if(!$this->getConfigurationPool()->getContainer()->getParameter('tav_env')
|| !$this->getConfigurationPool()->getContainer()->getParameter('ssa_friendly_flux_type_names')) {
if($this->getConfigurationPool()->getContainer()->getParameter('tav_env')
&& $this->getConfigurationPool()->getContainer()->getParameter('ssa_friendly_flux_type_names')) {
$datagridMapper->add('type', null, [
'advanced_filter' => false,
'show_filter' => true,
'field_type' => ChoiceType::class,
'field_options' => [
'choices' => [
'Achat des adhérents' => 'achat_monnaie_adherent',
'Achat des prestataires' => 'achat_monnaie_prestataire',
'Vente aux adhérents' => 'vente_emlc_adherent',
'Vente aux prestataires' => 'vente_emlc_prestataire',
],
'placeholder' => 'Indifférent',
'expanded' => false,
'multiple' => false,
],
]);
} else {
$datagridMapper->add('type', null, [
'advanced_filter' => false,
'show_filter' => true,
'field_type' => ChoiceType::class,
'field_options' => [
'choices' => ['Adhérent' => 'achat_monnaie_adherent', 'Prestataire' => 'achat_monnaie_prestataire'],
'choices' => [
'Adhérent' => 'achat_monnaie_adherent',
'Prestataire' => 'achat_monnaie_prestataire',
],
'placeholder' => 'Indifférent',
'expanded' => true,
'multiple' => false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment