{# @var brochure \Elements\Demi\Model\ShopItem #}
{% set variants = brochure.getVariants() %}
{% set currentVariant = null %}
{% set isHorizontal = pimcore_checkbox('isHorizontal').getValue() %}
{% set firstImageUrl = demi_demiUrl({
'path': 'demi',
'objectId': brochure.getId(),
'thumbnail': isHorizontal ? 'demi-prospekt-teaser-horizontal' : 'demi-prospekt-teaser',
'dateFrom': carbon().create().getTimestamp()
}, 'demi_image', true) %}
{% set links = brochure.getLinks() ? brochure.getLinks().getItems() : [] %}
{% if links|length > 0 %}
{% set links = demi_sortLinks(links) %}
{% endif %}
<script type="application/javascript" data-cookieconsent="ignore">
_config.brochuresBookable = _config.brochuresBookable || [];
_config.brochuresBookable[{{ brochure.getId() }}] = {
{% for variant in variants %}
'{{ variant.getVariationLanguage() }}': {{ (not variant.getIsNotBookable() and variant.getStock() > 0) ? 'true' : 'false' }} ,
{% endfor %}
};
</script>
{% if not selectedLanguage|default(false)%}
{% set selectedLanguage = app.request.locale %}
{% endif %}
<li class="{{ isHorizontal ? 'col-12' : 'col-xl-3 col-sm-4 col-6 border-right' }} mb-4 js-prospekt-selection__item prospekt-teaser"
data-prospekt-id="{{ brochure.getId() }}">
<section class="{{ isHorizontal ? 'row row--gutter-width-20': 'd-flex flex-column justify-content-between h-100' }}">
{% if isHorizontal and pimcore_device().isPhone() %}
<div class="col-12">
<h6 class="text-primary fz18">{{ brochure.getName(currentLanguage) }} {{ elements_debug_mode() ? "(oid "~ brochure.getId() ~ ")" : "" }}</h6>
</div>
{% endif %}
<div class="{{ isHorizontal ? 'col-5 col-sm-3': ''}}">
<div class="{{ isHorizontal ? 'bg-light-gray p-1': '' }}">
<figure class="embed-responsive embed-responsive-{{ isHorizontal ? '3by2': '16by9'}}">
<div class="embed-responsive-item center-container">
<span class="center-container__item-wrapper">
<img data-src="{{ firstImageUrl }}"
class="center-container__item js-lazy-img js-lazy-img--img lazy-img"
alt="{{ brochure.getName(currentLanguage) }}"/>
{% do jsConfig().add('lightbox', true) %}
{% set gallerySrcUrl = demi_demiUrl({
'path': 'demi',
'objectId': brochure.getId(),
'thumbnail': 'demi-prospekt-gallery',
'thumbSmall': 'demi-prospekt-gallery-small',
'dateFrom': ''
}, 'demi_images') %}
<button type="button"
class="btn-show-gallery btn-show-gallery--small btn-no-styling js-lightbox-group-dyn js-tracking--click-piwik"
aria-label="{{ 'demi.detail.open-gallery'|trans }}"
title="{{ 'demi.detail.open-gallery'|trans }}"
data-lightbox-id="lightbox-{{ brochure.getId() }}"
data-lightbox-src-url="{{ gallerySrcUrl }}"
data-tracking-category="Brochure list"
data-tracking-action="open gallery">
<span class="js-lightbox-group-dyn__icon demi-icon demi-icon-search btn-show-gallery__icon"
aria-hidden="true"></span> <span class="js-lightbox-group-dyn__loading"
hidden> <span class="text-center d-block">
<span class="circle-spinner circle-spinner--white"
aria-label="{{ 'demi.content-loading'|trans }}"
title="{{ 'demi.content-loading'|trans }}"></span>
</span>
</span>
</button>
</span>
</div>
</figure>
{% if not isHorizontal %}
<h6 class="text-primary text-center my-2 fz15">{{ brochure.getName(currentLanguage) }} {{ elements_debug_mode() ? "(oid "~ brochure.getId() ~ ")" : "" }}</h6>
{% endif %}
</div>
</div>
{% if isHorizontal %}
<div class="col-7 col-sm-6">
{% if pimcore_device().isPhone() %}
{% do jsConfig().add('expandable', true) %}
<div class="js-expandable expandable-block">
<div class="expandable-block__content-wrapper js-expandable__content-wrapper expandable-block__content-wrapper--small">
<div class="js-expandable__content expandable-block__content">
<div class="wysiwyg">
{% set descriptions = brochure.getDescriptions(carbon().create()) %}
{% if descriptions is iterable %}
{% for description in descriptions %}
{% if description.getDescriptionLanguage() == currentLanguage %}
{{ description.getText()|raw }}
{% endif %}
{% endfor %}
{% endif %}
</div>
<ul class="list-unstyled">
{% for link in links %}
{% set tmpUrl = demi_findNiceUrl(link.getUrl()|escape) %}
{% set name = link.getNameLocalized(currentLanguage) ? link.getNameLocalized(currentLanguage) : link.getName() %}
{% if tmpUrl is not empty %}
<li><a class="text-underline text-primary" target="_blank" href="{{ tmpUrl }}">{{ name|escape }}</a></li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
<div class="expandable-block__more js-expandable__more text-right">
<button type="button" class="btn-no-styling text-primary font-medium fz15">
{{ 'demi.detail.read-more'|trans }}
<span class="demi-icon demi-icon-chevron-down icon-in-text ml-2" aria-hidden="true"></span>
</button>
</div>
</div>
{% else %}
<h6 class="text-primary fz18">{{ brochure.getName(currentLanguage) }} {{ elements_debug_mode() ? "(oid "~ brochure.getId() ~ ")" : "" }}</h6>
<div class="wysiwyg">
{% set descriptions = brochure.getDescriptions(carbon().create()) %}
{% if descriptions is iterable %}
{% for description in descriptions %}
{% if description.getDescriptionLanguage() == currentLanguage %}
{{ description.getText()|raw }}
{% endif %}
{% endfor %}
{% endif %}
</div>
<ul class="list-unstyled">
{% for link in links %}
{% set tmpUrl = demi_findNiceUrl(link.getUrl()|escape) %}
{% set name = link.getNameLocalized(currentLanguage) ? link.getNameLocalized(currentLanguage) : link.getName() %}
{% if tmpUrl is not empty %}
<li><a class="text-underline text-primary" target="_blank" href="{{ tmpUrl }}">{{ name|escape }}</a></li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</div>
{% endif %}
<div class="mt-2 mt-sm-0 {{ isHorizontal ? 'col-12 col-sm-3': '' }} ">
<label class="form-box form-box--gray mb-2">
<span class="form-box__label sr-only">{{ 'demi.brochures.language'|trans }}</span>
<select name="language" class="form-box__content form-control js-prospekt-selection__lang" {{ variants|length <= 1 ? 'disabled' : '' }}>
{# @var variant \Elements\Demi\Model\ShopItem #}
{% for variant in variants %}
{% set downloadDocument = variant.getDownloadDocument() %}
{% set downloadUrl = downloadDocument ? demi_demiUrl({
'id': downloadDocument.getId(),
'filenameOverride': (brochure.getName(variant.getVariationLanguage()) ~ "_" ~ variant.getVariationLanguage() ~ ".pdf")|url_encode
}, 'demi_download', true) : '' %}
{% set language = demi_getClassByStringAndIdentifier("\\Elements\\Demi\\Model\\Language", "getByFid", variant.getVariationLanguage(), 1) %}
{% set currentVariant = language.getFid() == selectedLanguage ? variant : currentVariant %}
{% if language is not null %}
<option value="{{ language.getFid() }}"
data-href="{{ downloadUrl }}"
data-offerId="{{ variant.getId() }}"
{{ language.getFid() == selectedLanguage ? 'selected' : ''}}>
{{ language.getName(currentLanguage) }}
</option>
{% endif %}
{% endfor %}
{% set currentVariant = (currentVariant is empty and variants|length > 0) ? variants[0] : currentVariant %}
</select>
{% if variants|length > 1 %}
<span class="demi-icon demi-icon-chevron-down form-box__select-icon" aria-hidden="true"></span>
{% endif %}
</label>
{% if currentVariant is not null %}
{% do jsConfig().add('tracking', true) %}
{% set downloadDocument = currentVariant.getDownloadDocument() %}
{% set downloadUrl = downloadDocument ? demi_demiUrl({
'id': downloadDocument.getId(),
'filenameOverride': (brochure.getName(currentVariant.getVariationLanguage()) ~ "_" ~ currentVariant.getVariationLanguage() ~ ".pdf")|url_encode
}, 'demi_download', true) : '' %}
<a href="{{ downloadUrl }}"
class="btn btn-default btn-block text-left mb-2 js-prospekt-selection__item-download js-tracking js-tracking--click"
target="_blank"
data-tracking-category="Klick Prospekte"
data-tracking-action="Download "
data-tracking-label="{{ brochure.getName(currentLanguage) }}">
<span class="btn__icon demi-icon demi-icon-star mr-1" aria-hidden="true"></span>
{{ 'demi.brochures.download'|trans }}
</a>
{% endif %}
{% set viewUrl = null %}
{% set viewName = null %}
{% set links = currentVariant.getLinks() %}
{% if links is empty %}
{% set links = brochure.getLinks() %}
{% endif %}
{% if links is not empty %}
{% set items = links.getItems() %}
{% if items is iterable %}
{% for item in items %}
{% if item.getLinkType == 1 %}
{% set viewUrl = item.getUrl() %}
{% set viewName = item.getName() %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% if viewUrl is not null %}
<a href="{{ viewUrl }}"
class="btn btn-default btn-block text-left mb-2 js-tracking js-tracking--click"
target="_blank"
data-tracking-category="Klick Prospekte"
data-tracking-action="View"
data-tracking-label="{{ viewName|escape }}">
<span class="btn__icon demi-icon demi-icon-visibility mr-1" aria-hidden="true"></span>
{{ 'demi.brochures.view'|trans }}
</a>
{% endif %}
{% if currentVariant is not null and not currentVariant.getIsNotBookable() and not demi_core_configuration('getIsWhiteLabel', [])%}
{{ include('@ElementsDemiFrontend/Includes/elements/buttons/toggle-button.html.twig', {
'type': 'checkbox',
'name': 'prospekte[]',
'isBlock': true,
'value': brochure.getId(),
'icon': 'check-circle',
'text': 'demi.brochures.select'|trans,
'isHighlighted': true,
'hasIcon': true,
'styleModifier': 'js-prospekt-selection__checkbox',
'classes': ['toggle-btn--highlighted'],
'dataAttr': 'data-offerId=' ~ (currentVariant is not null ? currentVariant.getId() : null)
}) }}
{% endif %}
</div>
</section>
{% if isHorizontal %}
<hr class="{{ pimcore_device().isPhone() ? 'container-break' : 'mx--4' }}">
{% endif %}
</li>