{namespace poi=Newland\Toubiz\Poi\Neos\ViewHelpers}
{namespace vh=Newland\NeosViewHelpers\ViewHelpers}

<poi:collection.attributes.notAllEmpty objects="{article.addresses}">
    <div class="mb-8">
        <h2 class="mt-0 mb-2 text-xl">
            {vh:translate(id: 'contact.header', package: 'Newland.Toubiz.Poi.Neos', source: 'Views/Show')}
        </h2>
        <div class="tb-contact">
            <f:alias map="{address: article.addresses.0}">
                <p class="tb-contact__address" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
                    <strong>{address.name}</strong><br />
                    <f:if condition="{address.street}">
                        <span itemprop="streetAddress">{article.mainAddress.street}</span><br />
                    </f:if>
                    <span itemprop="postalCode">{article.mainAddress.zip}</span> <span itemprop="addressLocality">{article.mainAddress.city}</span>
                </p>

                <p class="tb-contact__telco">
                    <f:if condition="{address.phoneNumber}">
                        {vh:translate(id: 'contact.property.phoneNumber', package: 'Newland.Toubiz.Poi.Neos', source: 'Views/Show')}
                        <span itemprop="telephone">{address.phoneNumber}</span>
                    </f:if>
                    <f:if condition="{address.emailAddress}">
                        <a class="tb-contact__link" href="mailto:{address.emailAddress}">
                            {address.emailAddress}
                        </a>
                    </f:if>
                    <f:if condition="{address.websiteAddress}">
                        <a class="tb-contact__link" href="{address.websiteAddress}" target="_blank" itemprop="url">
                            {address.websiteAddress}
                        </a>
                    </f:if>
                </p>
            </f:alias>
        </div>
    </div>
</poi:collection.attributes.notAllEmpty>

<f:if condition="{article.facebookUri} || {article.twitterUri} || {article.youtubeUri} || {article.instagramUri} || {article.flickrUi} || {article.wikipediaUri} ">
    <div class="mb-8">
        <ul class="tb-social-links">
            <f:if condition="{article.facebookUri}">
                <li class="tb-social-links__item">
                    <a href="{article.facebookUri}" class="tb-social-links__link" target="_blank">
                        <div class="tb-social-links__icon-wrapper">
                            <svg class="c-icon" aria-labelledby="icon-facebook-title">
                                <title id="icon-facebook-title">Share on Facebook</title>
                                <use xlink:href="#icon-facebook" />
                            </svg>
                        </div>
                    </a>
                </li>
            </f:if>
            <f:if condition="{article.twitterUri}">
                <li class="tb-social-links__item">
                    <a href="{article.twitterUri}" class="tb-social-links__link" target="_blank">
                        <div class="tb-social-links__icon-wrapper">
                            <svg class="c-icon" aria-labelledby="icon-twitter-title">
                                <title id="icon-twitter-title">Share on Twitter</title>
                                <use xlink:href="#icon-twitter" />
                            </svg>
                        </div>
                    </a>
                </li>
            </f:if>
            <f:if condition="{article.instagramUri}">
                <li class="tb-social-links__item">
                    <a href="{article.instagramUri}" class="tb-social-links__link">
                        <div class="tb-social-links__icon-wrapper">
                            <svg class="c-icon" aria-labelledby="icon-instagram-title">
                                <title id="icon-instagram-title">Share on Instagram</title>
                                <use xlink:href="#icon-instagram" />
                            </svg>
                        </div>
                    </a>
                </li>
            </f:if>
            <f:if condition="{article.youtubeUri}">
                <li class="tb-social-links__item">
                    <a href="{article.youtubeUri}" class="tb-social-links__link" target="_blank">
                        <div class="tb-social-links__icon-wrapper">
                            <svg class="c-icon" aria-labelledby="icon-youtube-title">
                                <title id="icon-youtube-title">Share on Youtube</title>
                                <use xlink:href="#icon-youtube" />
                            </svg>
                        </div>
                    </a>
                </li>
            </f:if>
            <f:if condition="{article.flickrUri}">
                <li class="tb-social-links__item">
                    <a href="{article.flickrUri}" class="tb-social-links__link" target="_blank">
                        <div class="tb-social-links__icon-wrapper">
                            <svg class="c-icon" aria-labelledby="icon-flickr-title">
                                <title id="icon-flickr-title">Share on Flickr</title>
                                <use xlink:href="#icon-flickr" />
                            </svg>
                        </div>
                    </a>
                </li>
            </f:if>
            <f:if condition="{article.wikipediaUri}">
                <li class="tb-social-links__item">
                    <a href="{article.wikipediaUri}" class="tb-social-links__link" target="_blank">
                        <div class="tb-social-links__icon-wrapper">
                            <svg class="c-icon" aria-labelledby="icon-wikipedia-title">
                                <title id="icon-wikipedia-title">Share on Wikipedia</title>
                                <use xlink:href="#icon-wikipedia" />
                            </svg>
                        </div>
                    </a>
                </li>
            </f:if>
        </ul>
    </div>
</f:if>

<f:if condition="{article.bookingUri} || ({article.mainAddress.latitude} && {article.mainAddress.longitude})">
    <div class="mb-8">
        <f:if condition="{article.bookingUri}">
            <div class="mb-2">
                <a class="c-button c-button--secondary" href="{article.bookingUri}" target="_blank">
                    {vh:translate(id: 'links.property.bookingUri', package: 'Newland.Toubiz.Poi.Neos', source: 'Views/Show')}
                </a>
            </div>
        </f:if>
        <f:if condition="{article.mainAddress.latitude} && {article.mainAddress.longitude}">
            <div>
                <a class="c-button c-button--secondary c-button--ghost"
                    href="https://maps.google.com/maps?daddr={article.mainAddress.latitude}%2C{article.mainAddress.longitude}"
                    target="_blank">

                    {vh:translate(id: 'links.property.routePlanner', package: 'Newland.Toubiz.Poi.Neos', source: 'Views/Show')}
                </a>
            </div>
        </f:if>
    </div>
</f:if>

<f:if condition="{article.files} || {article.outdoorActiveTour}">
    <div class="mb-8">
        <h2 class="mt-0 mb-2 text-xl">
            {vh:translate(id: 'downloads.header', package: 'Newland.Toubiz.Poi.Neos', source: 'Views/Show')}
        </h2>
        <ul class="tb-downloads">
            <f:for each="{article.files}" as="file">
                <f:render
                    partial="DownloadItem"
                    arguments="{
                        url: file.sourceUri,
                        label: file.name
                    }" />

            </f:for>

            <f:if condition="{article.outdoorActiveTour}">
                <f:render
                    partial="DownloadItem"
                    arguments="{
                        url: '{poi:uri.outdoorActive.gpx(article: article)}',
                        label: '{vh:translate(id: \'outdoorActive.gpx\', package: \'Newland.Toubiz.Poi.Neos\', source: \'Models/Article\')}'
                    }" />

                <f:render
                    partial="DownloadItem"
                    arguments="{
                        url: '{poi:uri.outdoorActive.kml(article: article)}',
                        label: '{vh:translate(id: \'outdoorActive.kml\', package: \'Newland.Toubiz.Poi.Neos\', source: \'Models/Article\')}'
                    }" />

            </f:if>
        </ul>
    </div>
</f:if>
<f:if condition="{article.flatAttributes.additionalInformation}">
    <div class="mb-8">
        <h2 class="mt-0 mb-2 text-xl">
            {vh:translate(id: 'property.attribute.additionalInformation', package: 'Newland.Toubiz.Poi.Neos', source: 'Models/Article')}
        </h2>

        <f:render partial="PointOfInterests/Attribute"
                  arguments="{
                type: 'text',
                name: 'additionalInformation',
                attribute: article.flatAttributes.additionalInformation
            }" />
    </div>
</f:if>
<f:if condition="{nvh:collection.includesValue(collection: configuration.displayOptions.show.hide, value: 'source')} == false">
    <div class="mb-8">
        <h2 class="mt-0 mb-2 text-xl">
            {vh:translate(id: 'source.header', package: 'Newland.Toubiz.Poi.Neos', source: 'Views/Show')}
        </h2>

        <div class="tb-source">
            <p class="tb-source__text">
                <f:if condition="{article.sourceName}">
                    <strong>{article.sourceName}</strong>
                    <br />
                </f:if>
                <f:if condition="{article.authorName}">
                    {vh:translate(id: 'source.property.author', package: 'Newland.Toubiz.Poi.Neos', source: 'Views/Show')}:
                    {article.authorName}
                </f:if>
            </p>
        </div>
    </div>
</f:if>
