From f54b6db693ff961ccd322d030a09b7a121052563 Mon Sep 17 00:00:00 2001 From: Ryjek Date: Mon, 29 Jul 2024 13:32:03 +0200 Subject: [PATCH] SPRA-4 fix mobile views --- project/src/Controller/BaseController.php | 6 +++-- project/src/Helper/MonthHelper.php | 2 +- .../navigation/switch_months.html.twig | 24 +++++++++++-------- project/templates/reports/list.html.twig | 15 ++++++++---- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/project/src/Controller/BaseController.php b/project/src/Controller/BaseController.php index 53994c0..0de3ac8 100644 --- a/project/src/Controller/BaseController.php +++ b/project/src/Controller/BaseController.php @@ -44,12 +44,13 @@ class BaseController extends AbstractController #[IsGranted('reportView')] public function reportsIndex(EntityManagerInterface $entityManager, int $monthId = 0) : Response { - if ($this->getUser()) + $isOverdue = false; if ($monthId > -1) { $monthCurrent = $this->monthHelper->getCurrentMonth($monthId); $reportsAll = $entityManager->getRepository(Reports::class)->findAllInMonth($monthCurrent); } else { $reportsAll = $entityManager->getRepository(Reports::class)->findAllOverdue(); + $isOverdue = true; } $reports = []; @@ -68,7 +69,8 @@ class BaseController extends AbstractController 'reportsGroup' => $reports, 'months' => $this->monthHelper->takeMonths(), 'currentMonth' => $monthCurrent ?? null, - 'reportToDoList' => ReportTodoEnum::cases() + 'reportToDoList' => ReportTodoEnum::cases(), + 'isOverdue' => $isOverdue, ]); } } diff --git a/project/src/Helper/MonthHelper.php b/project/src/Helper/MonthHelper.php index 0a0f1f3..d21705f 100644 --- a/project/src/Helper/MonthHelper.php +++ b/project/src/Helper/MonthHelper.php @@ -8,7 +8,7 @@ class MonthHelper $startDate = new \DateTime("-6 months"); $return = []; - for ($i=1; $i<=12; $i++) { + for ($i=1; $i<=11; $i++) { $tmp = clone $startDate; $tmp->modify("+$i month"); $return[$i] = $tmp; diff --git a/project/templates/navigation/switch_months.html.twig b/project/templates/navigation/switch_months.html.twig index 8565334..31ab962 100644 --- a/project/templates/navigation/switch_months.html.twig +++ b/project/templates/navigation/switch_months.html.twig @@ -1,18 +1,22 @@ {% macro month_menu(routeName, months, currentMonth) %} -
+
- Zaległe +
+ Zaległe +
{% for id,month in months %} {% set isCurrent = currentMonth is not null and month | date("Y-m") == currentMonth | date("Y-m") %} - diff --git a/project/templates/reports/list.html.twig b/project/templates/reports/list.html.twig index f6abcc5..85992fd 100644 --- a/project/templates/reports/list.html.twig +++ b/project/templates/reports/list.html.twig @@ -2,9 +2,16 @@ {% import 'navigation/switch_months.html.twig' as navigation %} {% block body %} {{ navigation.month_menu('app_base',months,currentMonth) }} -
+
{% for id,reports in reportsGroup %} -
+

{{ reports.status.takeLang }}

@@ -24,7 +31,7 @@
-
+
{% for todo in reportToDoList %} - + {% endfor %}