@@ -3,7 +3,17 @@ | |||
namespace App\Controller\Admin; | |||
use App\Entity\CollectifData; | |||
use App\Entity\Configuration; | |||
use App\Type\DreamsType; | |||
use App\Type\ProjectsBoostType; | |||
use App\Type\ProjectsInspiringType; | |||
use App\Type\RevoltsType; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; | |||
use Lc\SovBundle\Controller\Admin\AbstractCrudController; | |||
use Lc\SovBundle\Field\CollectionField; | |||
use Lc\SovBundle\Field\StatusField; | |||
class CollectifDataCrudController extends AbstractCrudController | |||
{ | |||
@@ -12,14 +22,36 @@ class CollectifDataCrudController extends AbstractCrudController | |||
return CollectifData::class; | |||
} | |||
/* | |||
public function configureFields(string $pageName): iterable | |||
{ | |||
return [ | |||
IdField::new('id'), | |||
TextField::new('title'), | |||
TextEditorField::new('description'), | |||
AssociationField::new('territory'), | |||
IntegerField::new('nbParticipant'), | |||
CollectionField::new('revolts') | |||
->setFormTypeOption('entry_type', RevoltsType::class) | |||
->setFormTypeOption('mapped', true) | |||
->setRequired(false), | |||
CollectionField::new('dreams') | |||
->setFormTypeOption('entry_type', DreamsType::class) | |||
->setRequired(false), | |||
CollectionField::new('projectsboost') | |||
->setFormTypeOption('entry_type', ProjectsBoostType::class) | |||
->setRequired(false), | |||
CollectionField::new('projectsinspiring') | |||
->setFormTypeOption('entry_type', ProjectsInspiringType::class) | |||
->setRequired(false), | |||
StatusField::new('status')->setRequired(false) | |||
]; | |||
} | |||
*/ | |||
public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void | |||
{ | |||
$entityInstance->setUser($this->getUser()); | |||
dump($entityInstance); | |||
die; | |||
$entityManager->persist($entityInstance); | |||
$entityManager->flush(); | |||
parent::persistEntity($entityManager, $entityInstance); | |||
} | |||
} |
@@ -36,6 +36,7 @@ class DashboardAnimatorController extends SovDashboardController | |||
->generateUrl(); | |||
yield MenuItem::linkToDashboard('dashboard', 'circle'); | |||
yield MenuItem::linkToUrl('data_collectif_create', '', $urlCreate); | |||
yield MenuItem::subMenu('account', 'user') | |||
->setSubItems( | |||
[ | |||
@@ -43,7 +44,6 @@ class DashboardAnimatorController extends SovDashboardController | |||
MenuItem::linkToRoute('account_password', '', 'sov_admin_account_password'), | |||
] | |||
); | |||
yield MenuItem::linkToUrl('data_collectif_create', '', $urlCreate); | |||
} | |||
} |
@@ -9,7 +9,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\Actions; | |||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\SovBundle\Field\BooleanField; | |||
use Lc\SovBundle\Field\StatusField; | |||
class IndividualDataCrudController extends AbstractCrudController | |||
{ | |||
@@ -25,7 +25,7 @@ class IndividualDataCrudController extends AbstractCrudController | |||
TextField::new('lastname'), | |||
EmailField::new('email'), | |||
TextField::new('introAnswer'), | |||
BooleanField::new('status')->setRequired(false) | |||
StatusField::new('status')->setRequired(false) | |||
]; | |||
} | |||
@@ -6,8 +6,7 @@ use App\Entity\Site\Page; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\SovBundle\Controller\Admin\AbstractCrudController; | |||
use Lc\SovBundle\Field\BooleanField; | |||
use Lc\SovBundle\Controller\Admin\AbstractCrudController;; | |||
use Lc\SovBundle\Field\CKEditorField; | |||
use Lc\SovBundle\Field\FileManagerField; | |||
use Lc\SovBundle\Field\GalleryManagerField; |
@@ -36,22 +36,22 @@ class CollectifData implements StatusInterface, EntityInterface | |||
private $user; | |||
/** | |||
* @ORM\OneToMany(targetEntity=Revolts::class, mappedBy="collectifData") | |||
* @ORM\OneToMany(targetEntity=Revolts::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||
*/ | |||
private $revolts; | |||
/** | |||
* @ORM\OneToMany(targetEntity=Dreams::class, mappedBy="collectifData") | |||
* @ORM\OneToMany(targetEntity=Dreams::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||
*/ | |||
private $dreams; | |||
/** | |||
* @ORM\OneToMany(targetEntity=ProjectsBoost::class, mappedBy="collectifData") | |||
* @ORM\OneToMany(targetEntity=ProjectsBoost::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||
*/ | |||
private $projectsBoost; | |||
/** | |||
* @ORM\OneToMany(targetEntity=ProjectsInspiring::class, mappedBy="collectifData") | |||
* @ORM\OneToMany(targetEntity=ProjectsInspiring::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||
*/ | |||
private $projectsInspiring; | |||
@@ -70,8 +70,9 @@ class CollectifData implements StatusInterface, EntityInterface | |||
public function __toString() | |||
{ | |||
return $this->nbParticipant; | |||
return $this->user->getFirstname() . " " . $this->user->getLastname() . " - " . $this->territory; | |||
} | |||
public function getId(): ?int | |||
{ | |||
return $this->id; |
@@ -0,0 +1,71 @@ | |||
<?php | |||
namespace App\Type; | |||
use App\Entity\Dreams; | |||
use App\Entity\Thematic; | |||
use Lc\SovBundle\Doctrine\EntityManager; | |||
use Lc\SovBundle\Model\User\UserInterface; | |||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\AbstractType; | |||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | |||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | |||
use Symfony\Component\Validator\Constraints\NotBlank; | |||
class DreamsType extends AbstractType | |||
{ | |||
protected $em; | |||
protected $translatorAdmin; | |||
public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin) | |||
{ | |||
$this->em = $em; | |||
$this->translatorAdmin = $translatorAdmin; | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
{ | |||
$builder->add( | |||
'description', | |||
TextareaType::class, | |||
[ | |||
'label' => 'form.field.dreams.description', | |||
'constraints' => [ | |||
new NotBlank(), | |||
], | |||
] | |||
) | |||
->add( | |||
'thematic', | |||
EntityType::class, | |||
[ | |||
'label' => 'form.field.dreams.thematic', | |||
'class' => Thematic::class, | |||
'required' => false, | |||
] | |||
); | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function configureOptions(OptionsResolver $resolver) | |||
{ | |||
$resolver->setDefaults( | |||
[ | |||
'data_class' => $this->em->getEntityName(Dreams::class), | |||
] | |||
); | |||
} | |||
} | |||
@@ -0,0 +1,71 @@ | |||
<?php | |||
namespace App\Type; | |||
use App\Entity\ProjectsBoost; | |||
use App\Entity\Thematic; | |||
use Lc\SovBundle\Doctrine\EntityManager; | |||
use Lc\SovBundle\Model\User\UserInterface; | |||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\AbstractType; | |||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | |||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | |||
use Symfony\Component\Validator\Constraints\NotBlank; | |||
class ProjectsBoostType extends AbstractType | |||
{ | |||
protected $em; | |||
protected $translatorAdmin; | |||
public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin) | |||
{ | |||
$this->em = $em; | |||
$this->translatorAdmin = $translatorAdmin; | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
{ | |||
$builder->add( | |||
'description', | |||
TextareaType::class, | |||
[ | |||
'label' => 'form.field.projectsboost.description', | |||
'constraints' => [ | |||
new NotBlank(), | |||
], | |||
] | |||
) | |||
->add( | |||
'thematic', | |||
EntityType::class, | |||
[ | |||
'label' => 'form.field.projectsboost.thematic', | |||
'class' => Thematic::class, | |||
'required' => false, | |||
] | |||
); | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function configureOptions(OptionsResolver $resolver) | |||
{ | |||
$resolver->setDefaults( | |||
[ | |||
'data_class' => $this->em->getEntityName(ProjectsBoost::class), | |||
] | |||
); | |||
} | |||
} | |||
@@ -0,0 +1,71 @@ | |||
<?php | |||
namespace App\Type; | |||
use App\Entity\ProjectsInspiring; | |||
use App\Entity\Thematic; | |||
use Lc\SovBundle\Doctrine\EntityManager; | |||
use Lc\SovBundle\Model\User\UserInterface; | |||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\AbstractType; | |||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | |||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | |||
use Symfony\Component\Validator\Constraints\NotBlank; | |||
class ProjectsInspiringType extends AbstractType | |||
{ | |||
protected $em; | |||
protected $translatorAdmin; | |||
public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin) | |||
{ | |||
$this->em = $em; | |||
$this->translatorAdmin = $translatorAdmin; | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
{ | |||
$builder->add( | |||
'description', | |||
TextareaType::class, | |||
[ | |||
'label' => 'form.field.projectsinspiring.description', | |||
'constraints' => [ | |||
new NotBlank(), | |||
], | |||
] | |||
) | |||
->add( | |||
'thematic', | |||
EntityType::class, | |||
[ | |||
'label' => 'form.field.projectsinspiring.thematic', | |||
'class' => Thematic::class, | |||
'required' => false, | |||
] | |||
); | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function configureOptions(OptionsResolver $resolver) | |||
{ | |||
$resolver->setDefaults( | |||
[ | |||
'data_class' => $this->em->getEntityName(ProjectsInspiring::class), | |||
] | |||
); | |||
} | |||
} | |||
@@ -0,0 +1,71 @@ | |||
<?php | |||
namespace App\Type; | |||
use App\Entity\Revolts; | |||
use App\Entity\Thematic; | |||
use Lc\SovBundle\Doctrine\EntityManager; | |||
use Lc\SovBundle\Model\User\UserInterface; | |||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\AbstractType; | |||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | |||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | |||
use Symfony\Component\Validator\Constraints\NotBlank; | |||
class RevoltsType extends AbstractType | |||
{ | |||
protected $em; | |||
protected $translatorAdmin; | |||
public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin) | |||
{ | |||
$this->em = $em; | |||
$this->translatorAdmin = $translatorAdmin; | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
{ | |||
$builder->add( | |||
'description', | |||
TextareaType::class, | |||
[ | |||
'label' => 'form.field.revolts.description', | |||
'constraints' => [ | |||
new NotBlank(), | |||
], | |||
] | |||
) | |||
->add( | |||
'thematic', | |||
EntityType::class, | |||
[ | |||
'label' => 'form.field.revolts.thematic', | |||
'class' => Thematic::class, | |||
'required' => false, | |||
] | |||
); | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function configureOptions(OptionsResolver $resolver) | |||
{ | |||
$resolver->setDefaults( | |||
[ | |||
'data_class' => $this->em->getEntityName(Revolts::class), | |||
] | |||
); | |||
} | |||
} | |||
@@ -9,3 +9,26 @@ menu: | |||
territory: Territoires | |||
thematic: Thématiques | |||
configuration: Configuration question Intro | |||
entity: | |||
CollectifData: | |||
fields: | |||
territory: Territoire | |||
nbParticipant: Nombre de participant | |||
revolts: Les révoltes | |||
dreams: Les rêves | |||
projectsboost: Les projets boostés | |||
projectsinspiring: Les projets inspirants | |||
form: | |||
field: | |||
dreams: | |||
description: Description | |||
thematic: Thématique | |||
projectsboost: | |||
description: Description | |||
thematic: Thématique | |||
projectsinspiring: | |||
description: Description | |||
thematic: Thématique | |||
revolts: | |||
description: Description | |||
thematic: Thématique |