Commit 7b6c7f97 by Yvon

WIP add adherent configuration. Todo : add js + bug fields required not notifying user when empty.

parent b1acce17
......@@ -31,6 +31,7 @@ use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
use Sonata\Form\Type\DateTimeRangePickerType;
use Sonata\UserBundle\Model\UserManagerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormError;
......@@ -169,6 +170,7 @@ class AdherentAdmin extends AbstractAdmin
;
if ($this->getConfigurationPool()->getContainer()->getParameter('tav_env')) {
$formMapper
->tab('General')
->with('Profil de cotisation', ['class' => 'col-md-5'])
......@@ -186,6 +188,36 @@ class AdherentAdmin extends AbstractAdmin
return $choice->__toString();
}
])
->add('moyenDePaiement', ChoiceType::class, [
'required' => true,
'label' => 'Moyen de paiement :',
'choices' => [
"CB" => "CB",
"espèces" => "espèces",
"chèque" => "chèque",
"prélèvement" => "prélèvement"
],
'empty_data' => null,
'placeholder' => 'Choisir un moyen de paiement'
])
->add('jourPrelevement', ChoiceType::class, [
'required' => true,
'label' => 'Jour de prélèvement :',
'choices' => $this->daysOfMonth(),
'empty_data' => null,
'placeholder' => 'Choisir un jour de prélèvement'
])
->add('mailRappelCotisation', CheckboxType::class, [
'required' => false,
'label' => 'Recevoir un rappel du paiement de ma cotisation par mail',
])
->add('jourMailRappelCotisation', ChoiceType::class, [
'required' => true,
'label' => 'Jour de l\'envoi du mail de rappel :',
'choices' => $this->daysOfMonth(),
'empty_data' => null,
'placeholder' => 'Choisir un jour pour l\'envoi du mail de rappel'
])
->end()
->end();
}
......@@ -523,4 +555,13 @@ class AdherentAdmin extends AbstractAdmin
return $iterator;
}
private function daysOfMonth()
{
$res = [];
for($i = 1 ; $i < 29 ; $i++) {
$res[$i] = $i;
}
return $res;
}
}
......@@ -93,6 +93,26 @@ class Adherent extends AccountableObject implements AccountableInterface
*/
private $profilDeCotisation;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $moyenDePaiement;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $jourPrelevement;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $mailRappelCotisation;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $jourMailRappelCotisation;
public function __construct()
{
$this->accounts = new ArrayCollection();
......@@ -267,4 +287,52 @@ class Adherent extends AccountableObject implements AccountableInterface
return $this;
}
public function getMoyenDePaiement(): ?string
{
return $this->moyenDePaiement;
}
public function setMoyenDePaiement(?string $moyenDePaiement): self
{
$this->moyenDePaiement = $moyenDePaiement;
return $this;
}
public function getJourPrelevement(): ?int
{
return $this->jourPrelevement;
}
public function setJourPrelevement(?int $jourPrelevement): self
{
$this->jourPrelevement = $jourPrelevement;
return $this;
}
public function getMailRappelCotisation(): ?bool
{
return $this->mailRappelCotisation;
}
public function setMailRappelCotisation(?bool $mailRappelCotisation): self
{
$this->mailRappelCotisation = $mailRappelCotisation;
return $this;
}
public function getJourMailRappelCotisation(): ?int
{
return $this->jourMailRappelCotisation;
}
public function setJourMailRappelCotisation(?int $jourMailRappelCotisation): self
{
$this->jourMailRappelCotisation = $jourMailRappelCotisation;
return $this;
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221220094507 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE adherent ADD moyen_de_paiement VARCHAR(255) DEFAULT NULL, ADD date_prelevement DATE DEFAULT NULL, ADD mail_rappel_cotisation TINYINT(1) DEFAULT NULL, ADD date_mail_rappel_cotisation DATE DEFAULT NULL');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE adherent DROP moyen_de_paiement, DROP date_prelevement, DROP mail_rappel_cotisation, DROP date_mail_rappel_cotisation');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\'');
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221220095617 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE adherent ADD jour_prelevement INT DEFAULT NULL, ADD jour_mail_rappel_cotisation INT DEFAULT NULL, DROP date_prelevement, DROP date_mail_rappel_cotisation');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE adherent ADD date_prelevement DATE DEFAULT NULL, ADD date_mail_rappel_cotisation DATE DEFAULT NULL, DROP jour_prelevement, DROP jour_mail_rappel_cotisation');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\'');
}
}
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