diff --git a/src/Controller/ActorController.php b/src/Controller/ActorController.php index 7fdcaad..9363d9c 100644 --- a/src/Controller/ActorController.php +++ b/src/Controller/ActorController.php @@ -5,8 +5,10 @@ use Symfony\Component\HttpFoundation\Response; use App\Form\Actors\ActorAddForm; use App\Repository\ActorRepository; +use App\Repository\TaskRepository; use App\Entity\ActivityEntity; use App\Entity\ActorEntity; +use App\Entity\TaskEntity; use App\Form\Actors\ActorDeleteForm; use Symfony\Component\Routing\Generator\UrlGenerator; use App\Form\Actors\ActorEditForm; @@ -105,6 +107,8 @@ $actorRepository = $entityManager->getRepository(ActorEntity::class); /** @var ActivityRepository $activityRepository */ $activityRepository = $entityManager->getRepository(ActivityEntity::class); + /** @var TaskRepository $taskRepository */ + $taskRepository = $entityManager->getRepository(TaskEntity::class); // Get actor $actor = $actorRepository->find($id); @@ -153,16 +157,23 @@ // Update fields $actorEditForm->updateFields($actor); - + // Get activities $activities = $activityRepository->findBy([ 'actor' => $actor, 'status' => StatusEnum::ACTIVE_STATUS ]); + // Get tasks + $tasks = $taskRepository->findBy([ + 'actor' => $actor, + 'status' => StatusEnum::ACTIVE_STATUS, + ]); + return $this->render('actor/actor.html.twig', [ 'actor' => $actor, 'activities' => $activities, + 'tasks' => $tasks, 'editForm' => $actorEditForm, 'deleteForm' => $actorDeleteForm, ]); diff --git a/templates/_includes/html/arrays/task.html.twig b/templates/_includes/html/arrays/task.html.twig new file mode 100644 index 0000000..a1c4353 --- /dev/null +++ b/templates/_includes/html/arrays/task.html.twig @@ -0,0 +1,44 @@ +{% import '_includes/macros/status.html.twig' as statusTools %} +{% import '_includes/macros/date.html.twig' as dateTools %} +{% set hideActor=hideActor|default(false) %} +{% set hideActivity=hideActivity|default(false) %} + + + + + {% if not hideActivity %} + + {% endif %} + + + {% if not hideActor %} + + {% endif %} + + + + + + {% for task in tasks %} + + {% if not hideActivity %} + + {% endif %} + + + {% if not hideActor %} + + {% endif %} + + + + {% endfor %} + +
ActivitéNomStatusActeurPlanifiéExecuté
{% if task.activity is not null %} {{ task.activity.name }} {% endif %}{{ task.name }}{{ statusTools.statusName(task.status) }}{% if task.actor is not null %}{{ task.actor.displayName }} + {% endif %}{% if task.planifiedDate is not null %} + {{ dateTools.euro(task.planifiedDate) }} {% endif %}{% if task.executionDate is not null %} + {{ dateTools.euro(task.executionDate) }} {% endif %}
\ No newline at end of file diff --git a/templates/_includes/html/arrays/tasks.html.twig b/templates/_includes/html/arrays/tasks.html.twig deleted file mode 100644 index a1c4353..0000000 --- a/templates/_includes/html/arrays/tasks.html.twig +++ /dev/null @@ -1,44 +0,0 @@ -{% import '_includes/macros/status.html.twig' as statusTools %} -{% import '_includes/macros/date.html.twig' as dateTools %} -{% set hideActor=hideActor|default(false) %} -{% set hideActivity=hideActivity|default(false) %} - - - - - {% if not hideActivity %} - - {% endif %} - - - {% if not hideActor %} - - {% endif %} - - - - - - {% for task in tasks %} - - {% if not hideActivity %} - - {% endif %} - - - {% if not hideActor %} - - {% endif %} - - - - {% endfor %} - -
ActivitéNomStatusActeurPlanifiéExecuté
{% if task.activity is not null %} {{ task.activity.name }} {% endif %}{{ task.name }}{{ statusTools.statusName(task.status) }}{% if task.actor is not null %}{{ task.actor.displayName }} - {% endif %}{% if task.planifiedDate is not null %} - {{ dateTools.euro(task.planifiedDate) }} {% endif %}{% if task.executionDate is not null %} - {{ dateTools.euro(task.executionDate) }} {% endif %}
\ No newline at end of file diff --git a/templates/actor/actor.html.twig b/templates/actor/actor.html.twig index 746abd7..0028fe7 100644 --- a/templates/actor/actor.html.twig +++ b/templates/actor/actor.html.twig @@ -35,4 +35,14 @@ +
+
+
+

Tâches

+
+
+ {% include "_includes/html/arrays/task.html.twig" with {tasks: tasks, hideActor: true} only %} +
+
+
{% endblock %} \ No newline at end of file diff --git a/templates/task/tasks.html.twig b/templates/task/tasks.html.twig index f26ff49..fafa0ba 100644 --- a/templates/task/tasks.html.twig +++ b/templates/task/tasks.html.twig @@ -10,7 +10,7 @@

Tâches

- {% include "_includes/html/arrays/tasks.html.twig" with {tasks: tasks} only %} + {% include "_includes/html/arrays/task.html.twig" with {tasks: tasks} only %}