Commit f9c2fa48 by Damien Moulard

update profildecotisation: use montant instead of montantMax

parent a28cc89d
...@@ -33,12 +33,12 @@ class ProfilDeCotisationAdmin extends AbstractAdmin ...@@ -33,12 +33,12 @@ class ProfilDeCotisationAdmin extends AbstractAdmin
{ {
$formMapper $formMapper
->with('Profil', ['class' => 'col-md-12']) ->with('Profil', ['class' => 'col-md-12'])
->add('montant', NumberType::class, [
'label' => 'Montant'
])
->add('tauxCotisation', NumberType::class, [ ->add('tauxCotisation', NumberType::class, [
'label' => 'Taux de cotisation' 'label' => 'Taux de cotisation'
]) ])
->add('maxPercevableMensuel', NumberType::class, [
'label' => 'Montant maximum percevable'
])
->end() ->end()
; ;
...@@ -65,13 +65,13 @@ class ProfilDeCotisationAdmin extends AbstractAdmin ...@@ -65,13 +65,13 @@ class ProfilDeCotisationAdmin extends AbstractAdmin
protected function configureListFields(ListMapper $listMapper): void protected function configureListFields(ListMapper $listMapper): void
{ {
$listMapper $listMapper
->addIdentifier('tauxCotisation', null, [ ->addIdentifier('montant', FieldDescriptionInterface::TYPE_CURRENCY, [
'label' => 'Taux de cotisation', 'label' => 'Montant',
'currency' => CurrencyEnum::getCode(CurrencyEnum::CURRENCY_EURO),
'sortable' => true 'sortable' => true
]) ])
->addIdentifier('maxPercevableMensuel', FieldDescriptionInterface::TYPE_CURRENCY, [ ->addIdentifier('tauxCotisation', null, [
'label' => 'Montant maximum percevable', 'label' => 'Taux de cotisation',
'currency' => CurrencyEnum::getCode(CurrencyEnum::CURRENCY_EURO),
'sortable' => true 'sortable' => true
]) ])
->add('createdAt', 'date', [ ->add('createdAt', 'date', [
......
...@@ -89,7 +89,7 @@ class Adherent extends AccountableObject implements AccountableInterface ...@@ -89,7 +89,7 @@ class Adherent extends AccountableObject implements AccountableInterface
* @var ProfilDeCotisation * @var ProfilDeCotisation
* *
* @ORM\ManyToOne(targetEntity="ProfilDeCotisation", cascade={"persist"}, inversedBy="beneficiaires") * @ORM\ManyToOne(targetEntity="ProfilDeCotisation", cascade={"persist"}, inversedBy="beneficiaires")
* @ORM\JoinColumn(name="profildecotisation_id", referencedColumnName="id", nullable=true) * @ORM\JoinColumn(name="profildecotisation_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
*/ */
private $profilDeCotisation; private $profilDeCotisation;
......
...@@ -30,13 +30,16 @@ class ProfilDeCotisation ...@@ -30,13 +30,16 @@ class ProfilDeCotisation
protected $id; protected $id;
/** /**
* @ORM\Column(name="maxPercevableMensuel", type="integer") * The amount the user will pay.
* The amount the user will receive depends on tauxCotisation.
*
* @ORM\Column(name="montant", type="integer")
* @Assert\Type("numeric") * @Assert\Type("numeric")
* @Assert\GreaterThanOrEqual( * @Assert\GreaterThanOrEqual(
* value = 0 * value = 0
* ) * )
*/ */
protected $maxPercevableMensuel; protected $montant;
/** /**
* @var float * @var float
...@@ -92,23 +95,23 @@ class ProfilDeCotisation ...@@ -92,23 +95,23 @@ class ProfilDeCotisation
} }
/** /**
* Get maxPercevableMensuel. * Get montant.
* *
* @return string maxPercevableMensuel * @return int montant
*/ */
public function getMaxPercevableMensuel(): ?int public function getMontant(): ?int
{ {
return $this->maxPercevableMensuel; return $this->montant;
} }
/** /**
* Set maxPercevableMensuel. * Set montant.
* *
* @return $this * @return $this
*/ */
public function setMaxPercevableMensuel(?int $maxPercevableMensuel): self public function setMontant(?int $montant): self
{ {
$this->maxPercevableMensuel = $maxPercevableMensuel; $this->montant = $montant;
return $this; return $this;
} }
...@@ -168,7 +171,7 @@ class ProfilDeCotisation ...@@ -168,7 +171,7 @@ class ProfilDeCotisation
public function __toString(): string public function __toString(): string
{ {
return 'Taux ' . strval(number_format($this->tauxCotisation, 2, '.', '')) return 'Montant ' . strval($this->montant) . '€'
. ', Maximum ' . strval($this->maxPercevableMensuel) . '€'; . ', Taux ' . strval(number_format($this->tauxCotisation, 2, '.', ''));
} }
} }
...@@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration; ...@@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
/** /**
* Auto-generated Migration: Please modify to your needs! * Auto-generated Migration: Please modify to your needs!
*/ */
final class Version20221202085509 extends AbstractMigration final class Version20221205112952 extends AbstractMigration
{ {
public function getDescription() : string public function getDescription() : string
{ {
...@@ -20,16 +20,20 @@ final class Version20221202085509 extends AbstractMigration ...@@ -20,16 +20,20 @@ final class Version20221202085509 extends AbstractMigration
public function up(Schema $schema) : void public function up(Schema $schema) : void
{ {
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE adherent DROP FOREIGN KEY FK_90D3F060D0B364B6');
$this->addSql('ALTER TABLE adherent ADD CONSTRAINT FK_90D3F060D0B364B6 FOREIGN KEY (profildecotisation_id) REFERENCES profildecotisation (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\''); $this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('DROP INDEX UNIQ_386FBA47989D9B62 ON profildecotisation'); $this->addSql('DROP INDEX UNIQ_386FBA47989D9B62 ON profildecotisation');
$this->addSql('ALTER TABLE profildecotisation DROP name, DROP slug, DROP content, DROP enabled'); $this->addSql('ALTER TABLE profildecotisation DROP name, DROP slug, DROP content, DROP enabled, CHANGE maxpercevablemensuel montant INT NOT NULL');
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
{ {
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE adherent DROP FOREIGN KEY FK_90D3F060D0B364B6');
$this->addSql('ALTER TABLE adherent ADD CONSTRAINT FK_90D3F060D0B364B6 FOREIGN KEY (profildecotisation_id) REFERENCES profildecotisation (id)');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8mb3 DEFAULT NULL COLLATE `utf8mb3_general_ci` COMMENT \'(DC2Type:personal_data)\''); $this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8mb3 DEFAULT NULL COLLATE `utf8mb3_general_ci` COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('ALTER TABLE profildecotisation ADD name VARCHAR(150) CHARACTER SET utf8mb3 NOT NULL COLLATE `utf8mb3_general_ci`, ADD slug VARCHAR(150) CHARACTER SET utf8mb3 NOT NULL COLLATE `utf8mb3_general_ci`, ADD content LONGTEXT CHARACTER SET utf8mb3 DEFAULT NULL COLLATE `utf8mb3_general_ci`, ADD enabled TINYINT(1) NOT NULL'); $this->addSql('ALTER TABLE profildecotisation ADD name VARCHAR(150) CHARACTER SET utf8mb3 NOT NULL COLLATE `utf8mb3_general_ci`, ADD slug VARCHAR(150) CHARACTER SET utf8mb3 NOT NULL COLLATE `utf8mb3_general_ci`, ADD content LONGTEXT CHARACTER SET utf8mb3 DEFAULT NULL COLLATE `utf8mb3_general_ci`, ADD enabled TINYINT(1) NOT NULL, CHANGE montant maxPercevableMensuel INT NOT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_386FBA47989D9B62 ON profildecotisation (slug)'); $this->addSql('CREATE UNIQUE INDEX UNIQ_386FBA47989D9B62 ON profildecotisation (slug)');
} }
} }
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