Files
sprawozdania/project/templates/navigation/switch_months.html.twig
T
2024-07-31 13:54:23 +02:00

40 lines
2.0 KiB
Twig

{% macro month_menu(routeName, months, currentMonth) %}
<div class="row reports-months-all">
<div class="col">
<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 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 %}
{# <ul class="nav nav-tabs">#}
{# <li class="nav-item">#}
{# <a class="nav-link {% if currentMonth is null %}active{% endif %}" aria-current="page" href="{{ path(routeName, {monthId:-1}) }}">Zaległe</a>#}
{# </li>#}
{# {% for id,month in months %}#}
{# {% set isCurrent = currentMonth is not null and month | date("Y-m") == currentMonth | date("Y-m") %}#}
{# <li class="nav-item">#}
{# <a class="nav-link {% if isCurrent %}active{% endif %}" href="{{ path(routeName,{monthId: id}) }}" aria-current="page">#}
{# {% if routeName=='app_schedule' %}#}
{# {{ id }}#}
{# {% else %}#}
{# {{ month | date("Y-m") }}#}
{# {% endif %}#}
{# </a>#}
{# </li>#}
{# {% endfor %}#}
{# </ul>#}
</div>
{% endmacro %}