Commit 1f672906 authored by Mat's avatar Mat

aside, les autres lettres frère en préparation

parent 1795358f
......@@ -17,8 +17,9 @@ class LettreInfosController extends MasterController
*/
public function ajaxDisplayAction($id)
{
$lettre = $this->getDoctrine()->getManager()
->getRepository('PotageBundle:Lettre')->findOneForLettreInfosAjaxDisplay($id);
$em = $this->getDoctrine()->getManager();
$lettre = $em->getRepository('PotageBundle:Lettre')->findOneForLettreInfosAjaxDisplay($id);
$autresLettres = $em->getRepository('PotageBundle:Lettre')->findAllBrotherLettre($id);
if ($lettre === null) {
return $this->createNotFoundException('Non trouvé');
......@@ -31,6 +32,7 @@ class LettreInfosController extends MasterController
return $this->render('@Potage/LettreInfos/ajaxDisplay.html.twig', array(
'id' => $id,
'lettre' => $lettre,
'autresLettres' => $autresLettres,
//'formInfo' => $form->createView(),
'formLettre' =>$formLettre->createView(),
'formLettreSorted' => $formSorted->createView()
......
<?php
namespace PotageBundle\Repository;
use PotageBundle\Entity\Lettre;
/**
* LettreRepository
......@@ -109,6 +110,22 @@ class LettreRepository extends \Doctrine\ORM\EntityRepository
return $qb->getQuery()->getOneOrNullResult();
}
/**
* @param $id
* @return Lettre[]
*/
public function findAllBrotherLettre($id)
{
$qb = $this->createQueryBuilder('l')
->where('l.id != :id')
->andWhere('l.status IN( :draft , :current )')
->setParameters(array(
':id'=> $id,
':draft' => 'draft',
':current' => 'current'
));
return $qb->getQuery()->getResult();
}
/**
* @param $id
......
......@@ -75,6 +75,18 @@
</div>
{% endif %}
</div>
<div class="mt-4">
<ul class="list-group list-group-flush">
<li class="list-group-item"><h5>En préparation</h5></li>
{% for brother in autresLettres %}
<li class="list-group-item">
<i class="far fa-envelope-open fa-fw">
</i> <a href="{{ path('potage_lettre_infos_ajax_display', {'id': brother.id }) }}">{{ brother.reference }}</a>
<span class="parenth"> {{ brother.groupe.nom }}</span>
</li>
{% endfor %}
</ul>
</div>
</aside>
{% endblock %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment