{% 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 %}

{% set contentproitems %}
	{% for row in particle.items|batch(particle.columns|default('3')|e) %}
		{% if particle.behaviour|default('static') == 'static' %}<div class="g-grid">{% endif %}
			{% for item in row %}
				{% 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 %}

				{% set image %}
					<div class="g-content-pro-image">
						{% if particle.lightbox|default('enable') == 'enable' or particle.lightbox|default('enable') == 'disable' %}
							{% if particle.lightbox|default('enable') == 'enable' %}
								<a href="{{ url(item.image, false, 0) }}" data-uk-lightbox class="uk-overlay uk-overlay-hover">
								{% if particle.style|default('style1') == 'style1' %}
									<span class="uk-overlay-panel uk-overlay-background uk-overlay-icon uk-overlay-fade"></span>
								{% endif %}
							{% endif %}
								<img alt="{{ item.alt|e }}" src="{{ url(item.image) }}" {{ item.image|imagesize|raw }}>
							{% if particle.lightbox|default('enable') == 'enable' %}
								</a>
							{% endif %}
						{% endif %}

						{% if particle.lightbox|default('enable') == 'disablelink' %}
							{% if item.link %}<a target="{{ item.target|default('_parent')|e }}" href="{{ item.link|e }}">{% endif %}
								<img alt="{{ item.alt|e }}" src="{{ url(item.image) }}" {{ item.image|imagesize|raw }}>
							{% if item.link %}</a>{% endif %}
						{% endif %}
					</div>
				{% endset %}

				{% set title %}
					<h4 class="g-content-pro-title">
						{%- if item.link -%}
							<a target="{{ item.target|default('_parent')|e }}" href="{{ item.link|e }}">
						{%- endif -%}
							{{- item.title|raw -}}
						{%- if item.link -%}
							</a>
						{%- endif -%}
					</h4>
				{% endset %}

				{% set date %}
					<div class="g-item-details">
						<span class="date"><i class="fa fa-clock-o"></i>{{ item.date|raw }}</span>
					</div>
				{% endset %}

				{% set description %}
					<div class="g-content-pro-desc">
						{{- item.description|raw -}}
					</div>
				{% endset %}

				{% set specialtext %}
					<div class="g-content-pro-special">
						{%- if item.icon -%}
							<i class="{{ item.icon|e }}"></i>
						{%- endif -%}
						{{- item.specialtext|raw -}}
					</div>
				{% endset %}

				{% set bottomlink %}
					<div class="g-content-pro-link">
						<a target="{{ item.target|default('_parent')|e }}" href="{{ item.link|e }}">
							{{- item.bottomlink|raw -}}
							<i class="fa fa-long-arrow-right"></i>
						</a>
					</div>
				{% endset %}

				{% set style1 %}
					<div class="g-content-pro-item">
						{% if item.image %}
							{{ image }}
						{% endif %}

						{% if item.title or item.description %}
							<div class="g-info-container">
								{% if item.title %}
									{{ title }}
								{% endif %}

								{% if item.date %}
									{{ date }}
								{% endif %}

								{% if item.description %}
									{{ description }}
								{% endif %}

								{% if item.specialtext or item.bottomlink %}
									<div class="g-bottom-info clearfix{% if item.specialtext == false %} no-special{% endif %}{% if item.bottomlink == false %} no-link{% endif %}">
										{% if item.specialtext %}
											{{ specialtext }}
										{% endif %}

										{% if item.bottomlink %}
											{{ bottomlink }}
										{% endif %}
									</div>
								{% endif %}
							</div>
						{% endif %}
					</div>
				{% endset %}

				{% set style2 %}
					<div class="g-content-pro-item uk-overlay uk-overlay-hover">
						{% if item.image %}
							{{ image }}
						{% endif %}

						{% if item.title or item.description %}
							<div class="g-info-container-style2 uk-overlay-panel uk-overlay-background uk-overlay-bottom uk-overlay-slide-bottom">
								{% if item.title %}
									{{ title }}
								{% endif %}

								{% if item.date %}
									{{ date }}
								{% endif %}

								{% if item.description %}
									{{ description }}
								{% endif %}

								{% if item.specialtext or item.bottomlink %}
									<div class="g-bottom-info clearfix{% if item.specialtext == false %} no-special{% endif %}{% if item.bottomlink == false %} no-link{% endif %}">
										{% if item.specialtext %}
											{{ specialtext }}
										{% endif %}

										{% if item.bottomlink %}
											{{ bottomlink }}
										{% endif %}
									</div>
								{% endif %}
							</div>
						{% endif %}
					</div>
				{% endset %}

				{% set style3 %}
					<div class="g-content-pro-item uk-overlay">
						{% if item.image %}
							{{ image }}
						{% endif %}

						{% if item.title or item.description %}
							<div class="g-info-container-style2 uk-overlay-panel uk-overlay-background uk-overlay-bottom">
								{% if item.title %}
									{{ title }}
								{% endif %}

								{% if item.date %}
									{{ date }}
								{% endif %}

								{% if item.description %}
									{{ description }}
								{% endif %}

								{% if item.specialtext or item.bottomlink %}
									<div class="g-bottom-info clearfix{% if item.specialtext == false %} no-special{% endif %}{% if item.bottomlink == false %} no-link{% endif %}">
										{% if item.specialtext %}
											{{ specialtext }}
										{% endif %}

										{% if item.bottomlink %}
											{{ bottomlink }}
										{% endif %}
									</div>
								{% endif %}
							</div>
						{% endif %}
					</div>
				{% endset %}

				{% if particle.behaviour|default('static') == 'static' %}
					<div class="g-block{% 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 %}>
							{% if particle.style|default("style1") == "style1" %}{{ style1 }}{% endif %}
							{% if particle.style|default("style1") == "style2" %}{{ style2 }}{% endif %}
							{% if particle.style|default("style1") == "style3" %}{{ style3 }}{% endif %}
						</div>
					</div>
				{% endif %}

				{% if particle.behaviour|default('static') == 'slider' or particle.behaviour|default('static') == 'slideset' %}
					<li {% if item.class %}class="{{ item.class|e }}"{% endif %} {% if item.extra %}{{ attr_extra_item|raw }}{% endif %}>
						{% if particle.style|default("style1") == "style1" %}{{ style1 }}{% endif %}
						{% if particle.style|default("style1") == "style2" %}{{ style2 }}{% endif %}
						{% if particle.style|default("style1") == "style3" %}{{ style3 }}{% endif %}
					</li>
				{% endif %}

			{% endfor %}
		{% if particle.behaviour|default('static') == 'static' %}</div>{% endif %}
	{% endfor %}
{% endset %}

{% block particle %}
	
	{% if particle.behaviour|default('static') == 'static' %}
		<div class="g-content-pro {{ particle.style|default("style1")|e }}{% if particle.css.class %} {{ particle.css.class|e }}{% endif %}{% if particle.pullup|default(0) %} g-pullup{% 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 %}
			{{ contentproitems }}
		</div>
	{% endif %}
	{% if particle.behaviour|default('static') == 'slider' %}
		<div class="g-content-pro-slider {{ particle.style|default("style1")|e }}{% if particle.css.class %} {{ particle.css.class|e }}{% endif %}{% if particle.pullup|default(0) %} g-pullup{% 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="uk-slidenav-position" data-uk-slider{% if particle.autoplay|default("disable") == "enable" %}="{autoplay:true, autoplayInterval: {{ particle.autoplayInterval|default(7000)|e}}}"{% endif %}>
				<div class="uk-slider-container">
					<ul class="uk-slider{% if particle.gutter|default('enabled') == 'enabled' %} uk-grid{% endif %} uk-grid-width-medium-1-{{ particle.columns|default('3')|e }}">
						{{ contentproitems }}
					</ul>
				</div>
				{% if (particle.navigation|default('arrows') == 'arrows') or (particle.navigation|default('arrows') == 'both') %}
					<div class="g-particle-navigation">
						<a href="" class="uk-slidenav uk-slidenav-previous" data-uk-slider-item="previous" aria-label="{{'Previous'|trans_key('IT_ACCESS_PREVIOUS')}}"></a>
						<a href="" class="uk-slidenav uk-slidenav-next" data-uk-slider-item="next" aria-label="{{'Next'|trans_key('IT_ACCESS_NEXT')}}"></a>
					</div>
				{% endif %}
			</div>		    	
		</div>
	{% endif %}
	{% if particle.behaviour|default('static') == 'slideset' %}
		<div class="g-content-pro-slideset {{ particle.style|default("style1")|e }}{% if particle.css.class %} {{ particle.css.class|e }}{% endif %}{% if particle.pullup|default(0) %} g-pullup{% 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="uk-slidenav-position" data-uk-slideset="{small: 1, medium: {{ particle.columns|default('3')|e }}, large: {{ particle.columns|default('3')|e }}, duration: {{ particle.duration|default(200)|e}}, {% if particle.autoplay|default("disable") == "enable" %}autoplay: 'true', autoplayInterval: {{ particle.autoplayInterval|default(7000)|e}},{% endif %} animation: '{{ particle.animation|default('fade')|e}}'}">
				<div class="uk-slider-container">
					<ul class="uk-slideset uk-grid">
						{{ contentproitems }}
					</ul>
				</div>
				{% if (particle.navigation|default('arrows') == 'arrows') or (particle.navigation|default('arrows') == 'both') %}
					<div class="g-particle-navigation">
						<a href="" class="uk-slidenav uk-slidenav-previous" data-uk-slideset-item="previous" aria-label="{{'Previous'|trans_key('IT_ACCESS_PREVIOUS')}}"></a>
						<a href="" class="uk-slidenav uk-slidenav-next" data-uk-slideset-item="next" aria-label="{{'Next'|trans_key('IT_ACCESS_NEXT')}}"></a>
					</div>
				{% endif %}
				{% if (particle.navigation|default('arrows') == 'dots') or (particle.navigation|default('arrows') == 'both') %}
					<ul class="uk-slideset-nav uk-dotnav uk-flex-center">
	    			{% set counter = 0 %}
	    			{% for item in particle.items %}
	    				<li data-uk-slideset-item="{{ counter }}"><a href="" aria-label="{{'Item'|trans_key('IT_ACCESS_ITEM')}} {{ counter }}"></a></li>
	    				{% set counter = counter + 1 %}
	    			{% endfor %}
					</ul>
				{% endif %}
			</div>		    	
		</div>
	{% endif %}
{% endblock %}