Commit f187c75c by Damien Moulard

affect profildecotisation to adherent

parent 935f83f1
......@@ -9,6 +9,7 @@ use App\Entity\Geoloc;
use App\Entity\Groupe;
use App\Entity\User;
use App\Entity\Usergroup;
use App\Entity\ProfilDeCotisation;
use App\Enum\CurrencyEnum;
use App\Events\MLCEvents;
use App\Exporter\CustomDoctrineORMQuerySourceIterator;
......@@ -37,6 +38,7 @@ use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Form\CallbackTransformer;
/**
* Administration des adhérents.
......@@ -165,6 +167,27 @@ class AdherentAdmin extends AbstractAdmin
->end()
;
if (true) {
$formMapper
->tab('General')
->with('Profil de cotisation', ['class' => 'col-md-5'])
->add('profilDeCotisation', ChoiceType::class, [
'required' => false,
'label' => 'Choix du profil : ',
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(ProfilDeCotisation::class)->findAll(),
'empty_data' => null,
'choice_label' => function ($choice, $key, $value) {
if (null === $choice) {
return 'Aucun.';
}
return $choice->__toString();
}
])
->end()
->end();
}
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$formMapper->getFormBuilder()->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($em) {
$adherent = $event->getData();
......
......@@ -15,8 +15,6 @@ use App\Enum\CurrencyEnum;
* Administration des profils de cotisation.
*
* KOHINOS : Outil de gestion de Monnaie Locale Complémentaire
*
* -------------------------------> TODO
*/
class ProfilDeCotisationAdmin extends AbstractAdmin
{
......
......@@ -253,7 +253,7 @@ class Adherent extends AccountableObject implements AccountableInterface
/**
* @return ProfilDeCotisation
*/
public function getProfilDeCotisation(): ProfilDeCotisation
public function getProfilDeCotisation(): ?ProfilDeCotisation
{
return $this->profilDeCotisation;
}
......
......@@ -168,7 +168,7 @@ class ProfilDeCotisation
public function __toString(): string
{
return 'Profil de taux ' . strval(number_format($this->tauxCotisation, 2, '.', ''))
. ' et de maximum percevable mensuel ' . strval($this->maxPercevableMensuel) . ' €';
return 'Taux ' . strval(number_format($this->tauxCotisation, 2, '.', ''))
. ', Maximum ' . strval($this->maxPercevableMensuel) . '€';
}
}
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