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 %}
NAME | -COMMENT | +{{ 'name'|trans }} | + {% if (sharedProject.isBudgetStatsVisible() or sharedProject.isTimeBudgetStatsVisible()) %} ++ {% endif %} + | |
---|---|---|---|---|
{{ project.name }} | -{{ project.comment }} | + {% if (sharedProject.isBudgetStatsVisible() or sharedProject.isTimeBudgetStatsVisible()) %} ++ {% if stats.hasBudget() and sharedProject.isBudgetStatsVisible() %} + {{ progress.progressbar_budget(stats, currency) }} + {% endif %} + {% if stats.hasTimeBudget() and sharedProject.isTimeBudgetStatsVisible() %} + {{ progress.progressbar_timebudget(stats) }} + {% endif %} + | + {% endif %} +{{ 'shared_project_timesheets.view.table.title' | trans }} |