Commit f0844afc by Damien Moulard

Merge branch '3590-show-balance-inhabitant' into 'develop'

3590-show-balance-inhabitant

See merge request cooperatic/kohinos-tav!16
parents 7e05daf3 5befa416
...@@ -6,6 +6,7 @@ use App\Entity\AccountAdherent; ...@@ -6,6 +6,7 @@ use App\Entity\AccountAdherent;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\CotisationAdherent; use App\Entity\CotisationAdherent;
use App\Entity\Geoloc; use App\Entity\Geoloc;
use App\Entity\GlobalParameter;
use App\Entity\Groupe; use App\Entity\Groupe;
use App\Entity\User; use App\Entity\User;
use App\Entity\Usergroup; use App\Entity\Usergroup;
...@@ -26,6 +27,7 @@ use Sonata\AdminBundle\Datagrid\ListMapper; ...@@ -26,6 +27,7 @@ use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface; use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\DoctrineORMAdminBundle\Datagrid\OrderByToSelectWalker; use Sonata\DoctrineORMAdminBundle\Datagrid\OrderByToSelectWalker;
use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter; use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
use Sonata\Form\Type\DateTimeRangePickerType; use Sonata\Form\Type\DateTimeRangePickerType;
...@@ -171,10 +173,10 @@ class AdherentAdmin extends AbstractAdmin ...@@ -171,10 +173,10 @@ class AdherentAdmin extends AbstractAdmin
if ($this->getConfigurationPool()->getContainer()->getParameter('tav_env')) { if ($this->getConfigurationPool()->getContainer()->getParameter('tav_env')) {
$formMapper $formMapper
->tab('General') ->tab('General')
->with('Profil de cotisation', ['class' => 'col-md-5']) ->with('Informations de cotisation', ['class' => 'col-md-5'])
->add('profilDeCotisation', ChoiceType::class, [ ->add('profilDeCotisation', ChoiceType::class, [
'required' => true, 'required' => true,
'label' => 'Choix du profil :', 'label' => 'Choix du profil de cotisation :',
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(ProfilDeCotisation::class)->findAll(), 'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(ProfilDeCotisation::class)->findAll(),
'empty_data' => null, 'empty_data' => null,
'placeholder' => 'Choisir un profil', 'placeholder' => 'Choisir un profil',
...@@ -188,6 +190,23 @@ class AdherentAdmin extends AbstractAdmin ...@@ -188,6 +190,23 @@ class AdherentAdmin extends AbstractAdmin
]) ])
->end() ->end()
->end(); ->end();
if (!empty($adherent) && !empty($adherent->getEmlcAccount()) ) {
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$balance = $adherent->getEmlcAccount()->getBalance();
$mlc = $em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_SYMBOL);
$formMapper
->tab('General')
->with('Informations de cotisation')
->add('idmlc', TextType::class, [
'disabled' => true,
'required' => false,
'label' => 'Solde e-' . $mlc . ' :',
'data' => $balance . ' ' . $mlc
])
->end()
->end();
}
} }
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager(); $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
...@@ -524,3 +543,4 @@ class AdherentAdmin extends AbstractAdmin ...@@ -524,3 +543,4 @@ class AdherentAdmin extends AbstractAdmin
return $iterator; return $iterator;
} }
} }
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