diff --git a/Controller/ViewController.php b/Controller/ViewController.php index 12bf7f5..573ce7d 100644 --- a/Controller/ViewController.php +++ b/Controller/ViewController.php @@ -69,7 +69,8 @@ public function viewCustomerAction( Customer $customer, string $shareKey, Request $request, - CustomerStatisticService $statisticsService, + CustomerStatisticService $customerStatisticsService, + ProjectStatisticService $projectStatisticService, ViewService $viewService, SharedProjectTimesheetRepository $sharedProjectTimesheetRepository, ): Response @@ -120,13 +121,13 @@ public function viewCustomerAction( // we cannot call $this->getDateTimeFactory() as it throws a AccessDeniedException for anonymous users $timezone = $customer->getTimezone() ?? date_default_timezone_get(); $date = new \DateTimeImmutable('now', new \DateTimeZone($timezone)); - $stats = $statisticsService->getBudgetStatisticModel($customer, $date); + $stats = $customerStatisticsService->getBudgetStatisticModel($customer, $date); $projects = $sharedProjectTimesheetRepository->getProjects($sharedProject); + $projectStats = $projectStatisticService->getBudgetStatisticModelForProjects($projects, $date); return $this->render('@SharedProjectTimesheets/view/customer.html.twig', [ 'sharedProject' => $sharedProject, 'customer' => $customer, - 'projects' => $projects, 'shareKey' => $shareKey, 'timeRecords' => $timeRecords, 'rateSum' => $rateSum, @@ -139,6 +140,7 @@ public function viewCustomerAction( 'statsPerDay' => $statsPerDay, 'detailsMode' => $detailsMode, 'stats' => $stats, + 'projectStats' => $projectStats, ]); } diff --git a/Resources/views/view/customer.html.twig b/Resources/views/view/customer.html.twig index 8e77ee4..38f56b8 100644 --- a/Resources/views/view/customer.html.twig +++ b/Resources/views/view/customer.html.twig @@ -179,9 +179,6 @@ {% if ((stats.hasBudget() and sharedProject.isBudgetStatsVisible()) or (stats.hasTimeBudget() and sharedProject.isTimeBudgetStatsVisible())) %} {% import "macros/progressbar.html.twig" as progress %}
-
-

{{ 'shared_project_timesheets.view.stats.title' | trans }}

-
{% if stats.hasBudget() and sharedProject.isBudgetStatsVisible() %} @@ -214,26 +211,41 @@

{{ 'projects'|trans }}

- {% if projects is empty %} + {% if projectStats is empty %} {{ nothing_found() }} {% else %}
- - + + {% if (sharedProject.isBudgetStatsVisible() or sharedProject.isTimeBudgetStatsVisible()) %} + + {% endif %} + - {% for project in projects %} - + }) + %} + - + {% if (sharedProject.isBudgetStatsVisible() or sharedProject.isTimeBudgetStatsVisible()) %} + + {% endif %} + {% endfor %}
NAMECOMMENT{{ 'name'|trans }}