@@ -10,8 +10,9 @@ use App\Type\ProjectsInspiringType; | |||
use App\Type\RevoltsType; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\HiddenField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; | |||
use Lc\SovBundle\Controller\Admin\AbstractCrudController; | |||
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController; | |||
use Lc\SovBundle\Field\CollectionField; | |||
use Lc\SovBundle\Field\StatusField; | |||
@@ -24,31 +25,41 @@ class CollectifDataCrudController extends AbstractCrudController | |||
public function configureFields(string $pageName): iterable | |||
{ | |||
return [ | |||
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) | |||
]; | |||
$fields = array(); | |||
$fields[] = AssociationField::new('territory'); | |||
$fields[] = IntegerField::new('nbParticipant'); | |||
$fields[] = CollectionField::new('revolts') | |||
->setFormTypeOption('entry_type', RevoltsType::class) | |||
->setFormTypeOption('by_reference', false) | |||
->setRequired(false); | |||
$fields[] = CollectionField::new('dreams') | |||
->setFormTypeOption('entry_type', DreamsType::class) | |||
->setFormTypeOption('by_reference', false) | |||
->setRequired(false); | |||
$fields[] = CollectionField::new('projectsboost') | |||
->setFormTypeOption('entry_type', ProjectsBoostType::class) | |||
->setFormTypeOption('by_reference', false) | |||
->setRequired(false); | |||
$fields[] = CollectionField::new('projectsinspiring') | |||
->setFormTypeOption('entry_type', ProjectsInspiringType::class) | |||
->setFormTypeOption('by_reference', false) | |||
->setRequired(false); | |||
$hasAccess = $this->isGranted('ROLE_ADMIN'); | |||
if ($hasAccess) { | |||
$fields[] = StatusField::new('status') | |||
->setFormTypeOption('data', 0); | |||
} else { | |||
$fields[] = HiddenField::new('status') | |||
->setFormTypeOption('data', 0); | |||
} | |||
return $fields; | |||
} | |||
public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void | |||
{ | |||
$entityInstance->setUser($this->getUser()); | |||
dump($entityInstance); | |||
die; | |||
$entityManager->persist($entityInstance); | |||
$entityManager->flush(); | |||
@@ -4,7 +4,7 @@ namespace App\Controller\Admin; | |||
use App\Entity\Configuration; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\SovBundle\Controller\Admin\AbstractCrudController; | |||
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController; | |||
class ConfigurationCrudController extends AbstractCrudController | |||
{ |
@@ -16,7 +16,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\Assets; | |||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | |||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; | |||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | |||
use Lc\SovBundle\Controller\Admin\DashboardController as SovDashboardController; | |||
use Lc\SovBundle\Controller\Dashboard\DashboardController as SovDashboardController; | |||
use Symfony\Component\HttpFoundation\Response; | |||
class DashboardAnimatorController extends SovDashboardController |
@@ -16,7 +16,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\Assets; | |||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | |||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; | |||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | |||
use Lc\SovBundle\Controller\Admin\DashboardController as SovDashboardController; | |||
use Lc\SovBundle\Controller\Dashboard\DashboardController as SovDashboardController; | |||
class DashboardController extends SovDashboardController | |||
{ |
@@ -6,7 +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\Controller\AbstractAdminController as AbstractCrudController;; | |||
use Lc\SovBundle\Field\CKEditorField; | |||
use Lc\SovBundle\Field\FileManagerField; | |||
use Lc\SovBundle\Field\GalleryManagerField; |
@@ -4,7 +4,7 @@ namespace App\Controller\Admin; | |||
use App\Entity\Territory; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\SovBundle\Controller\Admin\AbstractCrudController; | |||
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController; | |||
class TerritoryCrudController extends AbstractCrudController | |||
{ |
@@ -5,7 +5,7 @@ namespace App\Controller\Admin; | |||
use App\Entity\Thematic; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\SovBundle\Controller\Admin\AbstractCrudController; | |||
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController; | |||
class ThematicCrudController extends AbstractCrudController | |||
{ |
@@ -8,7 +8,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\ArrayField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\SovBundle\Controller\Admin\UserCrudController as AbstractUserCrudController; | |||
use Lc\SovBundle\Controller\User\UserAdminController as AbstractUserCrudController; | |||
use Lc\SovBundle\Doctrine\EntityManager; | |||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||
use Symfony\Component\HttpFoundation\RequestStack; |
@@ -70,7 +70,7 @@ class CollectifData implements StatusInterface, EntityInterface | |||
public function __toString() | |||
{ | |||
return $this->user->getFirstname() . " " . $this->user->getLastname() . " - " . $this->territory; | |||
return $this->nbParticipant . " participants"; | |||
} | |||
public function getId(): ?int |
@@ -32,6 +32,11 @@ class Dreams implements DescriptionProjectInterface, EntityInterface | |||
*/ | |||
private $collectifData; | |||
public function __toString() | |||
{ | |||
return $this->description; | |||
} | |||
public function getId(): ?int | |||
{ | |||
return $this->id; |
@@ -32,6 +32,11 @@ class ProjectsBoost implements DescriptionProjectInterface, EntityInterface | |||
*/ | |||
private $collectifData; | |||
public function __toString() | |||
{ | |||
return $this->description; | |||
} | |||
public function getId(): ?int | |||
{ | |||
return $this->id; |
@@ -32,6 +32,11 @@ class ProjectsInspiring implements DescriptionProjectInterface, EntityInterface | |||
*/ | |||
private $collectifData; | |||
public function __toString() | |||
{ | |||
return $this->description; | |||
} | |||
public function getId(): ?int | |||
{ | |||
return $this->id; |
@@ -32,6 +32,11 @@ class Revolts implements DescriptionProjectInterface, EntityInterface | |||
*/ | |||
private $collectifData; | |||
public function __toString() | |||
{ | |||
return $this->description; | |||
} | |||
public function getId(): ?int | |||
{ | |||
return $this->id; |