add debriefing show view, fix relations

This commit is contained in:
Simon Vieille 2022-04-15 17:04:56 +02:00
commit b627388ef4
Signed by: deblan
GPG key ID: 03383D15A1D31745
6 changed files with 44 additions and 9 deletions

View file

@ -104,6 +104,7 @@ class DebriefingAdminController extends CrudController
// ->setForm('filter', Type::class)
->setView('form', 'admin/debriefing/_form.html.twig')
->setView('show_entity', 'admin/debriefing/_show.html.twig')
// ->setMaxPerPage('index', 20)

View file

@ -33,7 +33,7 @@ class Debriefing implements EntityInterface
/**
* @ORM\ManyToMany(targetEntity=Project::class, inversedBy="debriefings")
*/
protected $project;
protected $projects;
/**
* @ORM\Column(type="text", nullable=true)
@ -92,15 +92,15 @@ class Debriefing implements EntityInterface
/**
* @return Collection<int, Project>
*/
public function getProject(): Collection
public function getProjects(): Collection
{
return $this->project;
return $this->projects;
}
public function addProject(Project $project): self
{
if (!$this->project->contains($project)) {
$this->project[] = $project;
if (!$this->projects->contains($project)) {
$this->projects[] = $project;
}
return $this;
@ -108,7 +108,7 @@ class Debriefing implements EntityInterface
public function removeProject(Project $project): self
{
$this->project->removeElement($project);
$this->projects->removeElement($project);
return $this;
}

View file

@ -46,7 +46,7 @@ class Project implements EntityInterface
protected $files = [];
/**
* @ORM\ManyToMany(targetEntity=Debriefing::class, mappedBy="project")
* @ORM\ManyToMany(targetEntity=Debriefing::class, mappedBy="projects")
*/
protected $debriefings;

View file

@ -19,7 +19,8 @@ class DebriefingType extends AbstractType
'html5' => true,
'widget' => 'single_text',
])
->add('project', null, [
->add('projects', null, [
'multiple' => true,
'attr' => [
'data-jschoice' => '',
],

View file

@ -1,6 +1,6 @@
<div class="row">
<div class="col-md-3 order-1 pr-md-3">
{% for item in ['date', 'project', 'internalContributors', 'externalContributors'] %}
{% for item in ['date', 'projects', 'internalContributors', 'externalContributors'] %}
{% include(configuration.view('form_widget', '@Core/admin/crud/_form_widget.html.twig')) with {form: form[item]} %}
{% endfor %}
</div>

View file

@ -0,0 +1,33 @@
<div class="row">
<div class="col-md-3 p-3">
<ul class="list-group">
<li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Date</span>
{{ entity.date|date('d/m/Y') }}
</li>
<li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Projets</span>
{% for item in entity.projects %}
{{ item.label }}<br>
{% endfor %}
</li>
<li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Contributeurs internes</span>
{{ entity.internalContributors|nl2br }}
</li>
<li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Contributeurs externes</span>
{{ entity.externalContributors|nl2br }}
</li>
</ul>
</div>
<div class="col-md-9 p-3">
<p class="font-weight-bold">{{ entity.topic }}</p>
{{ entity.content|raw }}
</div>
</div>