Browse Source

Merge branch 'feature/collectifdata' into develop

master
Charly 3 years ago
parent
commit
43d08ff6fd
21 changed files with 595 additions and 72 deletions
  1. +20
    -1
      public/build/adminlte-form.css
  2. +86
    -8
      src/Controller/Admin/CollectifDataCrudController.php
  3. +1
    -1
      src/Controller/Admin/ConfigurationCrudController.php
  4. +4
    -3
      src/Controller/Admin/DashboardAnimatorController.php
  5. +78
    -42
      src/Controller/Admin/DashboardController.php
  6. +27
    -3
      src/Controller/Admin/IndividualDataCrudController.php
  7. +1
    -2
      src/Controller/Admin/PageCrudController.php
  8. +1
    -1
      src/Controller/Admin/TerritoryCrudController.php
  9. +1
    -1
      src/Controller/Admin/ThematicCrudController.php
  10. +1
    -2
      src/Controller/Admin/UserCrudController.php
  11. +11
    -5
      src/Entity/CollectifData.php
  12. +5
    -0
      src/Entity/Dreams.php
  13. +5
    -0
      src/Entity/ProjectsBoost.php
  14. +5
    -0
      src/Entity/ProjectsInspiring.php
  15. +5
    -0
      src/Entity/Revolts.php
  16. +71
    -0
      src/Type/DreamsType.php
  17. +71
    -0
      src/Type/ProjectsBoostType.php
  18. +71
    -0
      src/Type/ProjectsInspiringType.php
  19. +71
    -0
      src/Type/RevoltsType.php
  20. +8
    -0
      templates/crud/field/association.html.twig
  21. +52
    -3
      translations/admin.fr.yaml

+ 20
- 1
public/build/adminlte-form.css View File

z-index: 2; z-index: 2;
} }


/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9mb3JtLnNjc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUU7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7QUFESjtBQUlFO0VBQ0U7QUFGSjtBQUtFO0VBQ0U7QUFISjtBQU1FO0VBQ0U7QUFKSjs7QUFRQTtFQUNFO0FBTEY7QUFPRTtFQUNFO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQ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C5zZWxlY3QyLXNlbGVjdGlvbiBiIHtcbiAgICBib3JkZXItY29sb3I6ICNkYzM1NDUgdHJhbnNwYXJlbnQgdHJhbnNwYXJlbnQgdHJhbnNwYXJlbnQ7XG4gIH1cblxuICAuZm9ybS1jaGVjay1sYWJlbCBpbnB1dDppbnZhbGlkIH4gLmNoZWNrbWFyayB7XG4gICAgYm9yZGVyLWNvbG9yOiAjZGMzNTQ1O1xuICB9XG59XG5cbi5uYXYtaXRlbSAubmF2LWxpbmsge1xuICBwb3NpdGlvbjogcmVsYXRpdmU7XG5cbiAgLmludmFsaWQtZm9ybSB7XG4gICAgZGlzcGxheTogbm9uZTtcbiAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgdG9wOiAtN3B4O1xuICAgIHJpZ2h0OiAtNnB4O1xuICAgIGNvbG9yOiAjZGMzNTQ1O1xuICAgIGJhY2tncm91bmQ6ICNmZmY7XG4gICAgYm9yZGVyLXJhZGl1czogMTBweDtcbiAgICBmb250LXNpemU6IDEuMnJlbTtcbiAgfVxufVxuXG4ubmF2LWl0ZW0uaGFzLWludmFsaWQgLm5hdi1saW5rIC5pbnZhbGlkLWZvcm0ge1xuICBkaXNwbGF5OiBpbmxpbmUtYmxvY2s7XG4gIHotaW5kZXg6IDI7XG59XG5cblxuIl0sInNvdXJjZVJvb3QiOiIifQ==*/
.field-collection {
padding-top: 15px;
}
.field-collection legend {
font-weight: bold;
font-size: 18px;
}
.field-collection .field-collection-item {
background-color: gainsboro;
padding: 10px;
position: relative;
border-radius: 5px;
}
.field-collection .field-collection-item .field-collection-delete {
position: absolute;
right: 0px;
top: 0px;
}

/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9mb3JtLnNjc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUU7RUFDRTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7QUFESjtBQU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B4O1xuICB9XG5cbiAgLmZpZWxkLWNvbGxlY3Rpb24taXRlbSB7XG4gICAgYmFja2dyb3VuZC1jb2xvcjogZ2FpbnNib3JvO1xuICAgIHBhZGRpbmc6IDEwcHg7XG4gICAgcG9zaXRpb246IHJlbGF0aXZlO1xuICAgIGJvcmRlci1yYWRpdXM6IDVweDtcblxuICAgIC5maWVsZC1jb2xsZWN0aW9uLWRlbGV0ZSB7XG4gICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICByaWdodDogMHB4O1xuICAgICAgdG9wOiAwcHg7XG4gICAgfVxuICB9XG59XG5cblxuXG4iXSwic291cmNlUm9vdCI6IiJ9*/

+ 86
- 8
src/Controller/Admin/CollectifDataCrudController.php View File

namespace App\Controller\Admin; namespace App\Controller\Admin;


use App\Entity\CollectifData; use App\Entity\CollectifData;
use Lc\SovBundle\Controller\Admin\AbstractCrudController;
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 Doctrine\ORM\QueryBuilder;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\HiddenField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController;
use Lc\SovBundle\Doctrine\Extension\TreeInterface;
use Lc\SovBundle\Field\CollectionField;
use Lc\SovBundle\Field\StatusField;


class CollectifDataCrudController extends AbstractCrudController class CollectifDataCrudController extends AbstractCrudController
{ {
return CollectifData::class; return CollectifData::class;
} }


/*
public function configureFields(string $pageName): iterable public function configureFields(string $pageName): iterable
{ {
return [
IdField::new('id'),
TextField::new('title'),
TextEditorField::new('description'),
];
$fields = array();

$fields[] = TextField::new('resume');
$fields[] = AssociationField::new('territory')
->setTemplatePath('crud/field/association.html.twig');
$fields[] = IntegerField::new('nbParticipant');
$fields[] = CollectionField::new('revolts')
->setFormTypeOption('entry_type', RevoltsType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false)
->hideOnIndex();
$fields[] = CollectionField::new('dreams')
->setFormTypeOption('entry_type', DreamsType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false)
->hideOnIndex();
$fields[] = CollectionField::new('projectsboost')
->setFormTypeOption('entry_type', ProjectsBoostType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false)
->hideOnIndex();
$fields[] = CollectionField::new('projectsinspiring')
->setFormTypeOption('entry_type', ProjectsInspiringType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false)
->hideOnIndex();
$hasAccess = $this->isGranted('ROLE_ADMIN');
if ($hasAccess) {
$fields[] = StatusField::new('status')
->setFormTypeOption('data', 0)
->setFormTypeOption('choices', ['Validé' => 1, 'En attente' => 0])
->setCustomOption('toggle_label', 'Valider');
} else {
$fields[] = HiddenField::new('status')
->setFormTypeOption('data', 0);
}


return $fields;
}

public function createIndexQueryBuilder(
SearchDto $searchDto,
EntityDto $entityDto,
FieldCollection $fields,
FilterCollection $filters
): QueryBuilder
{
$queryBuilder = parent::createIndexQueryBuilder(
$searchDto,
$entityDto,
$fields,
$filters
);

$queryBuilder->andWhere('entity.status = ' . $searchDto->getRequest()->get('status'));

return $queryBuilder;
}

public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void
{
$entityManager->persist($entityInstance);
$entityManager->flush();

parent::persistEntity($entityManager, $entityInstance);
} }
*/
} }

+ 1
- 1
src/Controller/Admin/ConfigurationCrudController.php View File



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
{ {

+ 4
- 3
src/Controller/Admin/DashboardAnimatorController.php View File

use App\Entity\Thematic; use App\Entity\Thematic;
use App\Entity\User\GroupUser; use App\Entity\User\GroupUser;
use App\Entity\User\User; use App\Entity\User\User;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Assets; use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
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
{ {
$urlCreate = $this->adminUrlGenerator $urlCreate = $this->adminUrlGenerator
->setController(CollectifDataCrudController::class) ->setController(CollectifDataCrudController::class)
->setAction('new')
->setAction(Action::NEW)
->generateUrl(); ->generateUrl();


yield MenuItem::linkToDashboard('dashboard', 'circle'); yield MenuItem::linkToDashboard('dashboard', 'circle');
yield MenuItem::linkToUrl('data_collectif_create', '', $urlCreate);
yield MenuItem::subMenu('account', 'user') yield MenuItem::subMenu('account', 'user')
->setSubItems( ->setSubItems(
[ [
MenuItem::linkToRoute('account_password', '', 'sov_admin_account_password'), MenuItem::linkToRoute('account_password', '', 'sov_admin_account_password'),
] ]
); );
yield MenuItem::linkToUrl('data_collectif_create', '', $urlCreate);


} }
} }

+ 78
- 42
src/Controller/Admin/DashboardController.php View File

use App\Entity\Thematic; use App\Entity\Thematic;
use App\Entity\User\GroupUser; use App\Entity\User\GroupUser;
use App\Entity\User\User; use App\Entity\User\User;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Assets; use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
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
{ {


public function configureMenuItems(): iterable public function configureMenuItems(): iterable
{ {
$urlNewCollectif = $this->adminUrlGenerator
->setController(CollectifDataCrudController::class)
->setAction(Action::NEW)
->set('menuIndex', 3)
->set('submenuIndex', 0)
->generateUrl();

$urlOnlineCollectif = $this->adminUrlGenerator
->setController(CollectifDataCrudController::class)
->setAction(Action::INDEX)
->set('status', 1)
->set('menuIndex', 3)
->set('submenuIndex', 2)
->generateUrl();


$urlCreate = $this->adminUrlGenerator
$urlOfflineCollectif = $this->adminUrlGenerator
->setController(CollectifDataCrudController::class) ->setController(CollectifDataCrudController::class)
->setAction('new')
->setAction(Action::INDEX)
->set('status', 0)
->set('menuIndex', 3)
->set('submenuIndex', 1)
->generateUrl(); ->generateUrl();


yield MenuItem::linkToDashboard('dashboard', 'circle');
yield MenuItem::subMenu('account', 'user')
->setSubItems(
[
MenuItem::linkToRoute('account_profile', '', 'sov_admin_account_profile'),
MenuItem::linkToRoute('account_password', '', 'sov_admin_account_password'),
]
);
yield MenuItem::subMenu('user', 'user')
->setPermission(self::ROLE_ADMIN)
->setSubItems(
[
MenuItem::linkToCrud('user_index', '', User::class),
]
);
yield MenuItem::subMenu('data_individual', 'user')
->setPermission(self::ROLE_ADMIN)
->setSubItems(
[
MenuItem::linkToCrud('data_individual_validate', '', IndividualData::class),
MenuItem::linkToCrud('data_individual_waiting', '', IndividualData::class),
]
);
yield MenuItem::subMenu('data_collectif', 'user')
->setPermission(self::ROLE_ADMIN)
->setSubItems(
[
MenuItem::linkToCrud('data_collectif_validate', '', CollectifData::class),
MenuItem::linkToCrud('data_collectif_waiting', '', CollectifData::class),
]
);
yield MenuItem::linkToCrud('thematic', 'copy', Thematic::class)
->setPermission(self::ROLE_ADMIN);
yield MenuItem::linkToCrud('territory', 'copy', Territory::class)
->setPermission(self::ROLE_SUPER_ADMIN);
yield MenuItem::linkToCrud('configuration', 'copy', Configuration::class)
->setPermission(self::ROLE_SUPER_ADMIN);
yield MenuItem::linkToCrud('page', 'copy', Page::class)
->setPermission(self::ROLE_ADMIN);
$urlOnlineIndividuel = $this->adminUrlGenerator
->setController(IndividualDataCrudController::class)
->setAction(Action::INDEX)
->set('status', 1)
->set('menuIndex', 3)
->set('submenuIndex', 1)
->generateUrl();

$urlOfflineIndividuel = $this->adminUrlGenerator
->setController(IndividualDataCrudController::class)
->setAction(Action::INDEX)
->set('status', 0)
->set('menuIndex', 3)
->set('submenuIndex', 0)
->generateUrl();

$menuItems = [
MenuItem::linkToDashboard('dashboard', 'far fa-circle'),
MenuItem::subMenu('account', 'fas fa-user')
->setSubItems(
[
MenuItem::linkToRoute('account_profile', 'fas fa-user-cog', 'sov_admin_account_profile'),
MenuItem::linkToRoute('account_password', 'fas fa-key', 'sov_admin_account_password'),
]
),
MenuItem::linkToCrud('user', 'fas fa-users', User::class)
->setPermission(self::ROLE_ADMIN),
/*MenuItem::subMenu('data_individual', 'user')
->setPermission(self::ROLE_ADMIN)
->setSubItems(
[
MenuItem::linkToUrl('data_individual_waiting', '', $urlOfflineIndividuel),
MenuItem::linkToUrl('data_individual_validate', '', $urlOnlineIndividuel),
]
),*/
MenuItem::subMenu('data_collectif', 'fas fa-database')
->setPermission(self::ROLE_ADMIN)
->setSubItems(
[
MenuItem::linkToUrl('data_collectif_new', 'fas fa-plus', $urlNewCollectif),
MenuItem::linkToUrl('data_collectif_waiting', 'fas fa-hourglass-half', $urlOfflineCollectif),
MenuItem::linkToUrl('data_collectif_validate', 'fas fa-check', $urlOnlineCollectif),
]
),
MenuItem::linkToCrud('thematic', 'fas fa-book', Thematic::class)
->setPermission(self::ROLE_ADMIN),
MenuItem::linkToCrud('territory', 'far fa-copy', Territory::class)
->setPermission(self::ROLE_SUPER_ADMIN),
MenuItem::linkToCrud('configuration', 'far fa-copy', Configuration::class)
->setPermission(self::ROLE_SUPER_ADMIN),
MenuItem::linkToCrud('page', 'far fa-copy', Page::class)
->setPermission(self::ROLE_ADMIN),
];

/*$this->setMenuIndexes($menuItems);*/

return $menuItems;
} }
} }

+ 27
- 3
src/Controller/Admin/IndividualDataCrudController.php View File

use App\Entity\Configuration; use App\Entity\Configuration;
use App\Entity\IndividualData; use App\Entity\IndividualData;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions; use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto;
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController;
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\Field\BooleanField;
use Lc\SovBundle\Field\StatusField;


class IndividualDataCrudController extends AbstractCrudController class IndividualDataCrudController extends AbstractCrudController
{ {
TextField::new('lastname'), TextField::new('lastname'),
EmailField::new('email'), EmailField::new('email'),
TextField::new('introAnswer'), TextField::new('introAnswer'),
BooleanField::new('status')->setRequired(false)
StatusField::new('status')->setRequired(false)
]; ];
} }




parent::persistEntity($entityManager, $entityInstance); // TODO: Change the autogenerated stub parent::persistEntity($entityManager, $entityInstance); // TODO: Change the autogenerated stub
} }

public function createIndexQueryBuilder(
SearchDto $searchDto,
EntityDto $entityDto,
FieldCollection $fields,
FilterCollection $filters
): QueryBuilder
{
$queryBuilder = parent::createIndexQueryBuilder(
$searchDto,
$entityDto,
$fields,
$filters
);

$queryBuilder->andWhere('entity.status = ' . $searchDto->getRequest()->get('status'));

return $queryBuilder;
}
} }

+ 1
- 2
src/Controller/Admin/PageCrudController.php View File

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\Field\BooleanField;
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;

+ 1
- 1
src/Controller/Admin/TerritoryCrudController.php View File



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
{ {

+ 1
- 1
src/Controller/Admin/ThematicCrudController.php View File

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
{ {

+ 1
- 2
src/Controller/Admin/UserCrudController.php View File

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;
TextField::new('firstname'), TextField::new('firstname'),
TextField::new('lastname'), TextField::new('lastname'),
EmailField::new('email'), EmailField::new('email'),
ArrayField::new('roles'),
ChoiceField::new('roles') ChoiceField::new('roles')
->allowMultipleChoices() ->allowMultipleChoices()
->autocomplete() ->autocomplete()

+ 11
- 5
src/Entity/CollectifData.php View File

private $user; private $user;


/** /**
* @ORM\OneToMany(targetEntity=Revolts::class, mappedBy="collectifData")
* @ORM\OneToMany(targetEntity=Revolts::class, mappedBy="collectifData", cascade={"persist", "remove"})
*/ */
private $revolts; private $revolts;


/** /**
* @ORM\OneToMany(targetEntity=Dreams::class, mappedBy="collectifData")
* @ORM\OneToMany(targetEntity=Dreams::class, mappedBy="collectifData", cascade={"persist", "remove"})
*/ */
private $dreams; private $dreams;


/** /**
* @ORM\OneToMany(targetEntity=ProjectsBoost::class, mappedBy="collectifData")
* @ORM\OneToMany(targetEntity=ProjectsBoost::class, mappedBy="collectifData", cascade={"persist", "remove"})
*/ */
private $projectsBoost; private $projectsBoost;


/** /**
* @ORM\OneToMany(targetEntity=ProjectsInspiring::class, mappedBy="collectifData")
* @ORM\OneToMany(targetEntity=ProjectsInspiring::class, mappedBy="collectifData", cascade={"persist", "remove"})
*/ */
private $projectsInspiring; private $projectsInspiring;




public function __toString() public function __toString()
{ {
return $this->nbParticipant;
return $this->nbParticipant . " participants";
} }

public function getResume()
{
return count($this->getRevolts()) . " révolte(s) - " . count($this->getDreams()) . " rêve(s) - " . count($this->getProjectsBoost()) . " projet(s) boosté(s) - " . count($this->getProjectsInspiring()) . " projets inspirants";
}

public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;

+ 5
- 0
src/Entity/Dreams.php View File

*/ */
private $collectifData; private $collectifData;


public function __toString()
{
return $this->description;
}

public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;

+ 5
- 0
src/Entity/ProjectsBoost.php View File

*/ */
private $collectifData; private $collectifData;


public function __toString()
{
return $this->description;
}

public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;

+ 5
- 0
src/Entity/ProjectsInspiring.php View File

*/ */
private $collectifData; private $collectifData;


public function __toString()
{
return $this->description;
}

public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;

+ 5
- 0
src/Entity/Revolts.php View File

*/ */
private $collectifData; private $collectifData;


public function __toString()
{
return $this->description;
}

public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;

+ 71
- 0
src/Type/DreamsType.php View File

<?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),
]
);
}
}


+ 71
- 0
src/Type/ProjectsBoostType.php View File

<?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),
]
);
}
}


+ 71
- 0
src/Type/ProjectsInspiringType.php View File

<?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),
]
);
}
}


+ 71
- 0
src/Type/RevoltsType.php View File

<?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),
]
);
}
}


+ 8
- 0
templates/crud/field/association.html.twig View File

{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% if 'toMany' == field.customOptions.get('associationType') %}
<span class="badge badge-secondary">{{ field.formattedValue }}</span>
{% else %}
{{ field.formattedValue }}
{% endif %}

+ 52
- 3
translations/admin.fr.yaml View File

menu: menu:
data_individual: Formulaire individuel data_individual: Formulaire individuel
data_individual_validate: Données validées data_individual_validate: Données validées
data_individual_waiting: Données en attente de validation
data_individual_waiting: Données en attente
data_collectif: Formulaire collectif data_collectif: Formulaire collectif
data_collectif_new: Créer
data_collectif_validate: Données validées data_collectif_validate: Données validées
data_collectif_waiting: Données en attente de validation
data_collectif_waiting: Données en attente
data_collectif_create: Formulaire collectif data_collectif_create: Formulaire collectif
territory: Territoires territory: Territoires
thematic: Thématiques thematic: Thématiques
configuration: Configuration question Intro
configuration: Configuration
entity:
User:
fields:
roles: Rôle(s)
CollectifData:
label: Données collectif
label_plurial: Données du formulaire collectif
fields:
territory: Territoire
nbParticipant: Nombre de participants
revolts: Les révoltes
dreams: Les rêves
projectsboost: Les projets boostés
projectsinspiring: Les projets inspirants
resume: Résumé
IndividualData:
label: Données individuel
label_plurial: Données du formulaire individuel
fields:
firstname: Prénom
lastname: Nom
Thematic:
label_plurial: Les thémes
label: Thématique
fields:
name: Nom
Territory:
label_plurial: Les territoires
label: Territoire
fields:
name: Nom
Configuration:
label_plurial: Les configurations
label: Configuration
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

Loading…
Cancel
Save