configure forms
This commit is contained in:
parent
6df0000382
commit
894c31f09c
|
@ -122,18 +122,16 @@ class InterventionAdminController extends CrudController
|
|||
|
||||
->setDefaultSort('index', 'date', 'desc')
|
||||
|
||||
->setView('form', 'admin/intervention/_form.html.twig')
|
||||
|
||||
->setField('index', 'Establishment', Field\TextField::class, [
|
||||
'property' => 'establishment',
|
||||
'sort' => ['establishment', '.establishment'],
|
||||
])
|
||||
->setField('index', 'Speaker', Field\TextField::class, [
|
||||
'property' => 'speaker',
|
||||
'sort' => ['speaker', '.speaker'],
|
||||
'attr' => ['class' => 'col-3,']
|
||||
])
|
||||
->setField('index', 'Date', Field\DateField::class, [
|
||||
'property' => 'date',
|
||||
'sort' => ['date', '.date'],
|
||||
'attr' => ['class' => 'col-3'],
|
||||
])
|
||||
|
||||
->setBatchAction('index', 'delete', 'Delete', function(EntityInterface $entity, EntityManager $manager) {
|
||||
|
|
|
@ -23,7 +23,7 @@ class Intervention implements EntityInterface
|
|||
/**
|
||||
* @ORM\ManyToMany(targetEntity=Speaker::class, inversedBy="interventions")
|
||||
*/
|
||||
private $speaker;
|
||||
private $speakers;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Establishment::class, inversedBy="interventions")
|
||||
|
@ -82,7 +82,7 @@ class Intervention implements EntityInterface
|
|||
|
||||
public function __construct()
|
||||
{
|
||||
$this->speaker = new ArrayCollection();
|
||||
$this->speakers = new ArrayCollection();
|
||||
$this->tools = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
@ -94,15 +94,15 @@ class Intervention implements EntityInterface
|
|||
/**
|
||||
* @return Collection<int, Speaker>
|
||||
*/
|
||||
public function getSpeaker(): Collection
|
||||
public function getSpeakers(): Collection
|
||||
{
|
||||
return $this->speaker;
|
||||
return $this->speakers;
|
||||
}
|
||||
|
||||
public function addSpeaker(Speaker $speaker): self
|
||||
{
|
||||
if (!$this->speaker->contains($speaker)) {
|
||||
$this->speaker[] = $speaker;
|
||||
if (!$this->speakers->contains($speaker)) {
|
||||
$this->speakers[] = $speaker;
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
|
|
@ -35,6 +35,11 @@ class Tool implements EntityInterface
|
|||
$this->interventions = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getLabel();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
|
|
|
@ -13,17 +13,34 @@ class InterventionType extends AbstractType
|
|||
{
|
||||
$builder
|
||||
->add('activityReference')
|
||||
->add('date')
|
||||
->add('date', null, [
|
||||
'html5' => true,
|
||||
'widget' => 'single_text',
|
||||
])
|
||||
->add('groups')
|
||||
->add('levels')
|
||||
->add('themes')
|
||||
->add('content')
|
||||
->add('toolsDetails')
|
||||
->add('feedback')
|
||||
->add('vigilantPoints')
|
||||
->add('speaker')
|
||||
->add('themes', null, [
|
||||
'attr' => ['rows' => 5],
|
||||
])
|
||||
->add('content', null, [
|
||||
'attr' => ['rows' => 7],
|
||||
])
|
||||
->add('tools', null, [
|
||||
'expanded' => true,
|
||||
])
|
||||
->add('toolsDetails', null, [
|
||||
'attr' => ['rows' => 5],
|
||||
])
|
||||
->add('feedback', null, [
|
||||
'attr' => ['rows' => 5],
|
||||
])
|
||||
->add('vigilantPoints', null, [
|
||||
'attr' => ['rows' => 5],
|
||||
])
|
||||
->add('speakers', null, [
|
||||
'expanded' => true,
|
||||
])
|
||||
->add('establishment')
|
||||
->add('tools')
|
||||
;
|
||||
}
|
||||
|
||||
|
|
13
templates/admin/intervention/_form.html.twig
Normal file
13
templates/admin/intervention/_form.html.twig
Normal file
|
@ -0,0 +1,13 @@
|
|||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{% for item in ['establishment', 'activityReference', 'date', 'groups', 'levels', 'speakers'] %}
|
||||
{% include(configuration.view('form_widget', '@Core/admin/crud/_form_widget.html.twig')) with {form: form[item]} %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="col-md-9 pl-md-3">
|
||||
{% for item in ['themes', 'content', 'tools', 'toolsDetails', 'feedback', 'vigilantPoints'] %}
|
||||
{% include(configuration.view('form_widget', '@Core/admin/crud/_form_widget.html.twig')) with {form: form[item]} %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -2,4 +2,13 @@
|
|||
"Zip code": "Code postal"
|
||||
"City": "Ville"
|
||||
"Speaker": "Intervenant⋅e"
|
||||
"Speakers": "Intervenant⋅e⋅s"
|
||||
"Establishment": "Établissement"
|
||||
"Activity reference": "Activité de référence"
|
||||
"Groups": "Groupe(s)"
|
||||
"Levels": "Niveau(x)"
|
||||
"Themes": "Thématiques abordées"
|
||||
"Tools": "Outils et supports"
|
||||
"Tools details": "Détails outils et supports"
|
||||
"Feedback": "Les retours des participant⋅e⋅s"
|
||||
"Vigilant points": "Point(s) de vigilance observé(s) par l'intervenant⋅e"
|
||||
|
|
Loading…
Reference in a new issue