Commit 935f83f1 by Damien Moulard

admin profildecotisation

parent f170cc7a
......@@ -8,6 +8,8 @@ use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\Form\Type\DateTimeRangePickerType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Sonata\AdminBundle\Admin\FieldDescriptionInterface;
use App\Enum\CurrencyEnum;
/**
* Administration des profils de cotisation.
......@@ -69,11 +71,16 @@ class ProfilDeCotisationAdmin extends AbstractAdmin
'label' => 'Taux de cotisation',
'sortable' => true
])
->add('user.createdAt', 'date', [
->addIdentifier('maxPercevableMensuel', FieldDescriptionInterface::TYPE_CURRENCY, [
'label' => 'Montant maximum percevable',
'currency' => CurrencyEnum::getCode(CurrencyEnum::CURRENCY_EURO),
'sortable' => true
])
->add('createdAt', 'date', [
'pattern' => 'dd/MM/YYYY HH:mm',
'label' => 'Crée le',
])
->add('user.updatedAt', 'date', [
->add('updatedAt', 'date', [
'pattern' => 'dd/MM/YYYY HH:mm',
'label' => 'Mis à jour le',
])
......
......@@ -3,8 +3,6 @@
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
......@@ -19,6 +17,8 @@ use Symfony\Component\Validator\Constraints as Assert;
*/
class ProfilDeCotisation
{
use TimestampableEntity;
/**
* @var \Ramsey\Uuid\UuidInterface
*
......@@ -168,7 +168,7 @@ class ProfilDeCotisation
public function __toString(): string
{
return 'Profil de taux ' . strval($this->tauxCotisation)
return 'Profil de taux ' . strval(number_format($this->tauxCotisation, 2, '.', ''))
. ' et de maximum percevable mensuel ' . strval($this->maxPercevableMensuel) . ' €';
}
}
......@@ -17,6 +17,14 @@ abstract class CurrencyEnum
self::CURRENCY_MLC_NANTIE => 'MLC Nantie',
];
/** @var array ISO Code for national currencies */
protected static $code = [
self::CURRENCY_EMLC => 'EMLC',
self::CURRENCY_MLC => 'MLC',
self::CURRENCY_EURO => 'EUR',
self::CURRENCY_MLC_NANTIE => 'MLCN',
];
/**
* @param string $typeShortName
*
......@@ -32,6 +40,20 @@ abstract class CurrencyEnum
}
/**
* @param string $typeShortName
*
* @return string
*/
public static function getCode($typeShortName)
{
if (!isset(static::$code[$typeShortName])) {
return "Unknown type ($typeShortName)";
}
return static::$code[$typeShortName];
}
/**
* @return array<string>
*/
public static function getAvailableTypes()
......
<?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 Version20221202085509 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 prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('DROP INDEX UNIQ_386FBA47989D9B62 ON profildecotisation');
$this->addSql('ALTER TABLE profildecotisation DROP name, DROP slug, DROP content, DROP enabled');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$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('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