{% extends '@nucleus/partials/particle.html.twig' %}

{% set attr_extra = '' %}
{% if particle.extra %}
    {% for attributes in particle.extra %}
        {% for key, value in attributes %}
            {% set attr_extra = attr_extra ~ ' ' ~ key|e ~ '="' ~ value|e('html_attr') ~ '"' %}
        {% endfor %}
    {% endfor %}
{% endif %}

{% set particleheading %}
	<div class="g-particle-intro">
		{% if particle.mainheading %}
			<h3 class="g-title g-main-title">{{ particle.mainheading|raw }}</h3>
			<div class="g-title-separator {% if particle.introtext == false %}no-intro-text{% endif %}"></div>
		{% endif %}	
		{% if particle.introtext %}<p class="g-introtext">{{ particle.introtext|raw }}</p>{% endif %}
	</div>
{% endset %}

{% block particle %}
    <div class="g-price-lists {% if particle.css.class %} {{ particle.css.class|e }}{% endif %}{% if particle.gutter|default('enabled') == 'enabled' %} gutter-enabled{% else %} gutter-disabled{% endif %}" {% if particle.extra %}{{ attr_extra|raw }}{% endif %}>
		{% if particle.mainheading or particle.introtext %}
			{{ particleheading }}
		{% endif %}
    	
    	<div class="g-grid">
	        {% for item in particle.items %}
		       	{% set attr_extra_item = '' %}
				{% for extra in item.extra %}
					{% set attr_extra_item = attr_extra_item ~ ' ' ~ extra|keys|first|e ~ '="' ~ extra|values|first|e('html_attr') ~ '"' %}
				{% endfor %}
	        	<div class="g-block g-price-list{% if item.class %} {{ item.class|e }}{% endif %}" {% if item.extra %}{{ attr_extra_item|raw }}{% endif %}>
	        		<div {% if particle.gutter|default('enabled') == 'enabled' %}class="g-content"{% endif %}>
	        			<div class="g-price-list-inner">
	        				{% if item.title %}
	        					<h4 class="g-list-title">{{ item.title|raw }}</h4>
	        				{% endif %}
	        				<div class="g-list-container">
	        					{% for inner in item.inneritems %}
	        						<div class="g-item-container">
										{% if inner.title %}
											<div class="g-item-title">
												{{- inner.title|raw -}}
												{%- if inner.price -%}
													<span class="g-item-price">{{- inner.price|raw -}}</span>
												{%- endif -%}
											</div>
										{% endif %}
										{% if inner.description %}
											<div class="g-item-desc">{{ inner.description|raw }}</div>
										{% endif %}
									</div>
								{% endfor %}
	        				</div>
	        			</div>
		        	</div>
	            </div>
	        {% endfor %}
    	</div>
        {% if particle.link %}
            <div class="g-price-lists-button">
	            <a class="button" href="{{ particle.link|e }}" target="{{ particle.target|default('_blank')|e }}">
	                {%- if particle.buttonicon -%}
	                    <i class="{{ particle.buttonicon|e }}"></i>
	                {%- endif -%}
	                {{- particle.buttontext|raw -}}
	            </a>
	        </div>
        {% endif %}
	</div>
{% endblock %}