diff --git a/src/Controller/TaskController.php b/src/Controller/TaskController.php index fada10b..004f3f5 100644 --- a/src/Controller/TaskController.php +++ b/src/Controller/TaskController.php @@ -3,12 +3,30 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use App\Entity\TaskEntity; +use App\Repository\TaskRepository; class TaskController extends AbstractExtendedController { + /** + * Page for task list + * + * @param Request $request + * @return Response + */ public function tasks(Request $request): Response { - return $this->render('task/tasks.html.twig', []); + // Get repositories + $entityManager = $this->getDoctrine()->getManager(); + /** @var TaskRepository $taskRepository */ + $taskRepository = $entityManager->getRepository(TaskEntity::class); + + // Get tasks + $tasks = $taskRepository->findAll(); + + return $this->render('task/tasks.html.twig', [ + 'tasks' => $tasks, + ]); } } \ No newline at end of file diff --git a/src/Repository/TaskRepository.php b/src/Repository/TaskRepository.php index bc0f9ca..260040f 100644 --- a/src/Repository/TaskRepository.php +++ b/src/Repository/TaskRepository.php @@ -6,11 +6,13 @@ class TaskRepository extends EntityRepository { + /** @var array Default sorting */ public const DEFAULT_ORDER = [ + 'activity' => 'desc', 'name' => 'asc', ]; - + /** * {@inheritdoc} */ @@ -18,7 +20,7 @@ { return $this->findBy([], ActivityRepository::DEFAULT_ORDER); } - + /** * {@inheritdoc} */ @@ -28,7 +30,7 @@ foreach ($this::DEFAULT_ORDER as $field => $order) { $queryBuilder->addOrderBy($alias . '.' . $field, $order); } - + return $queryBuilder; } } \ No newline at end of file diff --git a/templates/_includes/html/arrays/activity.html.twig b/templates/_includes/html/arrays/activity.html.twig index 92ae911..584002e 100644 --- a/templates/_includes/html/arrays/activity.html.twig +++ b/templates/_includes/html/arrays/activity.html.twig @@ -20,22 +20,22 @@ {% for activity in activities %} - {{ activity.name }} + {{ activity.name }} {{ statusTools.statusName(activity.status) }} {% if not hideActor %} {% if activity.actor is not null %} {{ activity.actor.displayName }} - - {% endif %} + href="{{ url('actor_actor', {id: activity.actor.id}, false) }}" + title="Editer">{{ activity.actor.displayName }} {% endif %} {% endif %} - {% if activity.startDate is not null %} {{ dateTools.euro(activity.startDate) }} - {% endif %} + {% if activity.startDate is not null %} + {{ dateTools.euro(activity.startDate) }} {% endif %} {% if activity.endDate is not null %} {{ dateTools.euro(activity.endDate) }} {% endif %} - {% if activity.realStartDate is not null %} {{ dateTools.euro(activity.realStartDate) }} - {% endif %} - {% if activity.realEndDate is not null %} {{ dateTools.euro(activity.realEndDate) }} - {% endif %} + {% if activity.realStartDate is not null %} + {{ dateTools.euro(activity.realStartDate) }} {% endif %} + {% if activity.realEndDate is not null %} + {{ dateTools.euro(activity.realEndDate) }} {% endif %} + + + {% if not hideActivity %} + Activité + {% endif %} + Nom + Status + {% if not hideActor %} + Acteur + {% endif %} + Planifié + Executé + + + + {% for task in tasks %} + + {% if not hideActivity %} + {% if task.activity is not null %} {{ task.activity.name }} {% endif %} + {% endif %} + {{ task.name }} + {{ statusTools.statusName(task.status) }} + {% if not hideActor %} + {% if task.actor is not null %}{{ task.actor.displayName }} + {% endif %} + {% endif %} + {% if task.planifiedDate is not null %} + {{ dateTools.euro(task.planifiedDate) }} {% endif %} + {% if task.executionDate is not null %} + {{ dateTools.euro(task.executionDate) }} {% endif %} + + {% endfor %} + + \ No newline at end of file diff --git a/templates/task/tasks.html.twig b/templates/task/tasks.html.twig index 3da609f..f26ff49 100644 --- a/templates/task/tasks.html.twig +++ b/templates/task/tasks.html.twig @@ -4,4 +4,14 @@ {% set page='Tâches' %} {% block pageContent %} +
+
+
+

Tâches

+
+
+ {% include "_includes/html/arrays/tasks.html.twig" with {tasks: tasks} only %} +
+
+
{% endblock %} \ No newline at end of file