Commit f170cc7a by Damien Moulard

WIP admin profildecotisation

parent 11bdb966
......@@ -201,6 +201,7 @@ sonata_admin:
roles: ['ROLE_SUPER_ADMIN', 'ROLE_ADMIN_ADHERENT_GERER_ALL', 'ROLE_ADMIN_ADHERENT_GERER_CREATE']
- admin.adherent.gerer
- admin.adherent.cotisations
- admin.adherent.profilsdecotisation
sonata.admin.group.prestataire:
keep_open: false
label: "Prestataires"
......
......@@ -300,6 +300,16 @@ services:
- [ setSecurity, ['@security.helper']]
- [ setOperationUtils, ['@app.utils.operations']]
admin.adherent.profilsdecotisation:
class: App\Admin\ProfilDeCotisationAdmin
arguments: [~, App\Entity\ProfilDeCotisation, 'App\Controller\CRUD\CRUDController']
tags:
- name: sonata.admin
manager_type: orm
group: "Adherent"
label: "Profils De Cotisation"
public: true
admin.prestataire.gerer:
class: App\Admin\PrestataireAdmin
arguments: [~, App\Entity\Prestataire, App\Controller\PrestataireAdminController]
......
<?php
namespace App\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\Form\Type\DateTimeRangePickerType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
/**
* Administration des profils de cotisation.
*
* KOHINOS : Outil de gestion de Monnaie Locale Complémentaire
*
* -------------------------------> TODO
*/
class ProfilDeCotisationAdmin extends AbstractAdmin
{
protected $baseRouteName = 'profilcotisation';
protected $baseRoutePattern = 'profilcotisation';
protected $datagridValues = [
'_sort_order' => 'DESC',
'_sort_by' => 'createdAt',
];
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper): void
{
$formMapper
->with('Profil', ['class' => 'col-md-12'])
->add('tauxCotisation', NumberType::class, [
'label' => 'Taux de cotisation'
])
->add('maxPercevableMensuel', NumberType::class, [
'label' => 'Montant maximum percevable'
])
->end()
;
parent::configureFormFields($formMapper);
}
/**
* {@inheritdoc}
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper): void
{
$datagridMapper
->add('createdAt', 'doctrine_orm_datetime_range', [
'field_type' => DateTimeRangePickerType::class,
'label' => 'Date de création',
])
->add('updatedAt', 'doctrine_orm_datetime_range', [
'field_type' => DateTimeRangePickerType::class,
'label' => 'Date de mise à jour',
])
;
}
protected function configureListFields(ListMapper $listMapper): void
{
$listMapper
->addIdentifier('tauxCotisation', null, [
'label' => 'Taux de cotisation',
'sortable' => true
])
->add('user.createdAt', 'date', [
'pattern' => 'dd/MM/YYYY HH:mm',
'label' => 'Crée le',
])
->add('user.updatedAt', 'date', [
'pattern' => 'dd/MM/YYYY HH:mm',
'label' => 'Mis à jour le',
])
->add('_action', null, [
'actions' => ['edit' => []],
])
;
}
}
......@@ -19,10 +19,6 @@ use Symfony\Component\Validator\Constraints as Assert;
*/
class ProfilDeCotisation
{
use NameSlugContentEntityTrait;
use TimestampableEntity;
use EnablableEntityTrait;
/**
* @var \Ramsey\Uuid\UuidInterface
*
......@@ -74,6 +70,50 @@ class ProfilDeCotisation
}
/**
* Get tauxCotisation.
*
* @return float tauxCotisation
*/
public function getTauxCotisation(): ?float
{
return $this->tauxCotisation;
}
/**
* Set tauxCotisation.
*
* @return $this
*/
public function setTauxCotisation(?float $tauxCotisation): self
{
$this->tauxCotisation = $tauxCotisation;
return $this;
}
/**
* Get maxPercevableMensuel.
*
* @return string maxPercevableMensuel
*/
public function getMaxPercevableMensuel(): ?int
{
return $this->maxPercevableMensuel;
}
/**
* Set maxPercevableMensuel.
*
* @return $this
*/
public function setMaxPercevableMensuel(?int $maxPercevableMensuel): self
{
$this->maxPercevableMensuel = $maxPercevableMensuel;
return $this;
}
/**
* @return ArrayCollection
*/
public function getBeneficiaires()
......@@ -128,7 +168,7 @@ class ProfilDeCotisation
public function __toString(): string
{
return 'Profil de taux ' . strval(100 * $this->tauxCotisation) . ' %'
return 'Profil de taux ' . strval($this->tauxCotisation)
. ' et de maximum percevable mensuel ' . 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