35 lines
1.3 KiB
Twig
35 lines
1.3 KiB
Twig
{% import "macros/widgets.html.twig" as widgets %}
|
|
|
|
{% if section.title %}
|
|
{{ widgets.page_header(section.title) }}
|
|
{% endif %}
|
|
|
|
{% set width = section.widgets|length %}
|
|
{% set rawWidth = 12 / width %}
|
|
{% set columnWidth = rawWidth|round(0, 'floor') %}
|
|
<div class="row">
|
|
{% for widget in section.widgets %}
|
|
{% set columnSize = columnWidth %}
|
|
{% if width == 5 and (loop.first or loop.last) %}
|
|
{% set columnSize = columnWidth + 1 %}
|
|
{% endif %}
|
|
<div class="col-md-{{ columnSize }} col-sm-{{ columnSize * 2 }} col-xs-{{ columnSize * 4 }}">
|
|
|
|
{% set data = widget.data %}
|
|
{% if widget.dataType == constant('App\\Model\\Widget::DATA_TYPE_DURATION') %}
|
|
{% set data = widget.data|duration %}
|
|
{% elseif widget.dataType == constant('App\\Model\\Widget::DATA_TYPE_MONEY') %}
|
|
{% set data = widget.data|money %}
|
|
{% endif %}
|
|
|
|
{% set url = null %}
|
|
{% if widget.route %}
|
|
{% set url = path(widget.route, widget.routeOptions) %}
|
|
{% endif %}
|
|
|
|
{% set embedOptions = {data: data, title: widget.title, icon: widget.icon, color: widget.color, url: url} %}
|
|
{% embed 'embeds/widget-'~widget.type~'.html.twig' with embedOptions %}{% endembed %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|