SPRA-4 fix mobile views
This commit is contained in:
@@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
{% macro month_menu(routeName, months, currentMonth) %}
|
||||
<div class="row row-cols-12 reports-months-all">
|
||||
<div class="row reports-months-all">
|
||||
<div class="col">
|
||||
<a href="{{ path(routeName, {monthId:-1}) }}" class="btn {% if currentMonth is null %}btn-success{% else %}btn-secondary{% endif %}">Zaległe</a>
|
||||
<div class="card">
|
||||
<a href="{{ path(routeName, {monthId:-1}) }}" class="btn {% if currentMonth is null %}btn-success{% else %}btn-secondary{% endif %}">Zaległe</a>
|
||||
</div>
|
||||
</div>
|
||||
{% for id,month in months %}
|
||||
{% set isCurrent = currentMonth is not null and month | date("Y-m") == currentMonth | date("Y-m") %}
|
||||
<div class="col">
|
||||
<a href="{{ path(routeName,{monthId: id}) }}" class="btn {% if isCurrent %}btn-success{% else %}btn-secondary{% endif %}">
|
||||
{% if routeName=='app_schedule' %}
|
||||
{{ id }}
|
||||
{% else %}
|
||||
{{ month | date("Y-m") }}
|
||||
{% endif %}
|
||||
</a>
|
||||
<div class="col col-xxl-1 col-xl-2 col-lg-2 col-md-3 col-sm-3 col-4">
|
||||
<div class="card">
|
||||
<a href="{{ path(routeName,{monthId: id}) }}" class="btn {% if isCurrent %}btn-success{% else %}btn-secondary{% endif %}">
|
||||
{% if routeName=='app_schedule' %}
|
||||
{{ id }}
|
||||
{% else %}
|
||||
{{ month | date("Y-m") }}
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -2,9 +2,16 @@
|
||||
{% import 'navigation/switch_months.html.twig' as navigation %}
|
||||
{% block body %}
|
||||
{{ navigation.month_menu('app_base',months,currentMonth) }}
|
||||
<div class="row row-cols-3 row-cols-md-3 g-3 reports-all">
|
||||
<div class="
|
||||
row
|
||||
d-flex
|
||||
row-cols-sm-1
|
||||
row-cols-lg-3
|
||||
justify-content-center
|
||||
reports-all"
|
||||
>
|
||||
{% for id,reports in reportsGroup %}
|
||||
<div class="status-row" style="{% if currentMonth is null and id == 3 %}display:none{% endif %}">
|
||||
<div class="status-row" style="{% if isOverdue and id == 3 %}display:none{% endif %}">
|
||||
<div class="col">
|
||||
<div class="card text-center text-white bg-dark">
|
||||
<div class="card-title"><h2>{{ reports.status.takeLang }}</h2></div>
|
||||
@@ -24,7 +31,7 @@
|
||||
<form action="{{ path('app_set_status_todo') }}" method="post">
|
||||
<input type="hidden" name="reportId" value="{{ report.id }}">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('report-status') }}">
|
||||
<div class="btn-group" role="group" aria-label="Test">
|
||||
<div class="btn-group" role="group" aria-label="Todos">
|
||||
{% for todo in reportToDoList %}
|
||||
<input onchange="this.form.submit()"
|
||||
name="{{ todo.value }}"
|
||||
|
||||
Reference in New Issue
Block a user