use App\Type\RevoltsType; | use App\Type\RevoltsType; | ||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\HiddenField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; | 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\CollectionField; | ||||
use Lc\SovBundle\Field\StatusField; | use Lc\SovBundle\Field\StatusField; | ||||
public function configureFields(string $pageName): iterable | 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 | public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void | ||||
{ | { | ||||
$entityInstance->setUser($this->getUser()); | |||||
dump($entityInstance); | |||||
die; | |||||
$entityManager->persist($entityInstance); | $entityManager->persist($entityInstance); | ||||
$entityManager->flush(); | $entityManager->flush(); | ||||
use App\Entity\Configuration; | use App\Entity\Configuration; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use Lc\SovBundle\Controller\Admin\AbstractCrudController; | |||||
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController; | |||||
class ConfigurationCrudController extends AbstractCrudController | class ConfigurationCrudController extends AbstractCrudController | ||||
{ | { |
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; | use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | 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; | use Symfony\Component\HttpFoundation\Response; | ||||
class DashboardAnimatorController extends SovDashboardController | class DashboardAnimatorController extends SovDashboardController |
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; | use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | 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 | class DashboardController extends SovDashboardController | ||||
{ | { |
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | 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\CKEditorField; | ||||
use Lc\SovBundle\Field\FileManagerField; | use Lc\SovBundle\Field\FileManagerField; | ||||
use Lc\SovBundle\Field\GalleryManagerField; | use Lc\SovBundle\Field\GalleryManagerField; |
use App\Entity\Territory; | use App\Entity\Territory; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use Lc\SovBundle\Controller\Admin\AbstractCrudController; | |||||
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController; | |||||
class TerritoryCrudController extends AbstractCrudController | class TerritoryCrudController extends AbstractCrudController | ||||
{ | { |
use App\Entity\Thematic; | use App\Entity\Thematic; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use Lc\SovBundle\Controller\Admin\AbstractCrudController; | |||||
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController; | |||||
class ThematicCrudController extends AbstractCrudController | class ThematicCrudController extends AbstractCrudController | ||||
{ | { |
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; | use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField; | use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | 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\Doctrine\EntityManager; | ||||
use Lc\SovBundle\Translation\TranslatorAdmin; | use Lc\SovBundle\Translation\TranslatorAdmin; | ||||
use Symfony\Component\HttpFoundation\RequestStack; | use Symfony\Component\HttpFoundation\RequestStack; |
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->user->getFirstname() . " " . $this->user->getLastname() . " - " . $this->territory; | |||||
return $this->nbParticipant . " participants"; | |||||
} | } | ||||
public function getId(): ?int | public function getId(): ?int |
*/ | */ | ||||
private $collectifData; | private $collectifData; | ||||
public function __toString() | |||||
{ | |||||
return $this->description; | |||||
} | |||||
public function getId(): ?int | public function getId(): ?int | ||||
{ | { | ||||
return $this->id; | return $this->id; |
*/ | */ | ||||
private $collectifData; | private $collectifData; | ||||
public function __toString() | |||||
{ | |||||
return $this->description; | |||||
} | |||||
public function getId(): ?int | public function getId(): ?int | ||||
{ | { | ||||
return $this->id; | return $this->id; |
*/ | */ | ||||
private $collectifData; | private $collectifData; | ||||
public function __toString() | |||||
{ | |||||
return $this->description; | |||||
} | |||||
public function getId(): ?int | public function getId(): ?int | ||||
{ | { | ||||
return $this->id; | return $this->id; |
*/ | */ | ||||
private $collectifData; | private $collectifData; | ||||
public function __toString() | |||||
{ | |||||
return $this->description; | |||||
} | |||||
public function getId(): ?int | public function getId(): ?int | ||||
{ | { | ||||
return $this->id; | return $this->id; |