Files
sprawozdania/project/templates/navigation/switch_months.html.twig
T
2024-08-09 10:53:16 +02:00

40 lines
2.1 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-underline nav-fill">
<li class="nav-item">
<a href="{{ path(routeName, {monthId:-1}) }}" class="nav-link {% if currentMonth is null %}active{% endif %}">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}) }}">
{% if routeName=='app_schedule' %}
{{ id }}
{% else %}
{{ month | date("Y-m") }}
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endmacro %}