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

<poi:collection.attributes.notAllEmpty
    arrays="{
        0: article.flatAttributes.properties,
        1: article.flatAttributes.crossCountryTechnique
    }"
    strings="{
        0: article.description,
        1: article.flatAttributes.directions
    }"
    integers="{
        0: article.flatAttributes.conditionRating,
        1: article.flatAttributes.techniqueRating,
        2: article.flatAttributes.experienceRating,
        3: article.flatAttributes.landscapeRating
    }">

    <div
        id="target-enhancement-target-details"
        class="tb-tab-navigation__target"
        data-target-enhancement-subject>

        <div class="mb-4">
            <table class="tb-table tb-table--with-dividers tb-table--mobile-two-columns">
                <tbody>
                    <f:if condition="{article.flatAttributes.properties.hasContents}">
                        <tr>
                            <th>
                                <vh:translate
                                    id="property.attribute.properties"
                                    package="Newland.Toubiz.Poi.Neos"
                                    source="Models/Article"/>

                            </th>
                            <td colspan="3">
                                <vh:format.trim>
                                    <vh:render
                                        partial="PointOfInterests/Attribute"
                                        arguments="{
                                            type: 'translationArray',
                                            source: 'Models/Article',
                                            path: 'property.attribute.properties.values',
                                            attribute: article.flatAttributes.properties
                                        }"/>
                                </vh:format.trim><f:if condition="{article.flatAttributes.properties} && {article.flatAttributes.particularities} || {article.flatAttributes.properties} && {article.flatAttributes.feature}">, </f:if>

                                {article.flatAttributes.particularities}<f:if condition="{article.flatAttributes.particularities} && {article.flatAttributes.feature}">, </f:if>

                                {article.flatAttributes.feature}

                                <f:comment>
                                <!-- DO NOT INTRODUCE LINEBREAKS ABOVE TO PREVENT SPACES BEFORE COMMAS -->
                                <!-- To do: cleanup template structure above without creating whitespace before commas -->
                                </f:comment>
                            </td>
                        </tr>
                    </f:if>
                    <f:if condition="{article.flatAttributes.crossCountryTechnique.hasContents}">
                        <tr>
                            <th>
                                <vh:translate
                                    id="property.attribute.crossCountryTechnique"
                                    package="Newland.Toubiz.Poi.Neos"
                                    source="Models/Article"/>

                            </th>
                            <td colspan="3">
                                <vh:render
                                    partial="PointOfInterests/Attribute"
                                    arguments="{
                                        type: 'translationArray',
                                        source: 'Models/Article',
                                        path: 'property.attribute.crossCountryTechnique.values',
                                        attribute: article.flatAttributes.crossCountryTechnique
                                    }"/>

                            </td>
                        </tr>
                    </f:if>

                    <f:if condition="{article.flatAttributes.conditionRating.intValue} > 0 || {article.flatAttributes.techniqueRating.intValue} > 0">
                        <tr>
                            <f:if condition="{article.flatAttributes.conditionRating.intValue} > 0">
                                <th>
                                    <vh:translate
                                        id="property.attribute.conditionRating"
                                        package="Newland.Toubiz.Poi.Neos"
                                        source="Models/Article"/>

                                </th>
                                <td>
                                    <vh:render
                                        partial="PointOfInterests/Attribute"
                                        arguments="{
                                            type: 'tourRating',
                                            name: 'conditionRating',
                                            attribute: article.flatAttributes.conditionRating
                                        }"/>

                                </td>
                            </f:if>

                            <f:if condition="{article.flatAttributes.techniqueRating.intValue} > 0">
                                <th>
                                    <vh:translate
                                        id="property.attribute.techniqueRating"
                                        package="Newland.Toubiz.Poi.Neos"
                                        source="Models/Article"/>

                                </th>
                                <td>
                                    <vh:render
                                        partial="PointOfInterests/Attribute"
                                        arguments="{
                                            type: 'tourRating',
                                            name: 'techniqueRating',
                                            attribute: article.flatAttributes.techniqueRating
                                        }"/>

                                </td>
                            </f:if>
                        </tr>
                    </f:if>
                    <f:if condition="{article.flatAttributes.experienceRating.intValue} > 0 || {article.flatAttributes.landscapeRating.intValue} > 0">
                        <tr>
                            <f:if condition="{article.flatAttributes.experienceRating.intValue} > 0">
                                <th>
                                    <vh:translate
                                        id="property.attribute.experienceRating"
                                        package="Newland.Toubiz.Poi.Neos"
                                        source="Models/Article"/>

                                </th>
                                <td>
                                    <vh:render
                                        partial="PointOfInterests/Attribute"
                                        arguments="{
                                            type: 'tourRating',
                                            name: 'experienceRating',
                                            attribute: article.flatAttributes.experienceRating
                                        }"/>

                                </td>
                            </f:if>

                            <f:if condition="{article.flatAttributes.landscapeRating.intValue} > 0">
                                <th>
                                    <vh:translate
                                        id="property.attribute.landscapeRating"
                                        package="Newland.Toubiz.Poi.Neos"
                                        source="Models/Article"/>

                                </th>
                                <td>
                                    <vh:render
                                        partial="PointOfInterests/Attribute"
                                        arguments="{
                                            type: 'tourRating',
                                            name: 'landscapeRating',
                                            attribute: article.flatAttributes.landscapeRating
                                        }"/>

                                </td>
                            </f:if>
                        </tr>
                    </f:if>
                </tbody>
            </table>

        </div>
        <poi:collection.attributes.notAllEmpty
            strings="{
                0: article.flatAttributes.bestSeason
            }">
            <div class="mb-4">
                <section class="tb-best-season">
                    <h5 id="tb-best-season__heading" class="tb-best-season__heading">
                        {vh:translate(id: 'property.attribute.bestSeason', package: 'Newland.Toubiz.Poi.Neos', source:
                        'Models/Article')}
                    </h5>

                    <ul class="tb-best-season__list">
                        <f:for each="{poi:collection.attributes.bestSeason(attributes: article.attributes)}" key="month"
                               as="is">
                            <f:if condition="{is}">
                                <f:then>
                                    <li class="tb-best-season__month tb-best-season__month--marked"
                                        aria-labelledby="tb-best-season__heading">

                                        {vh:translate(id: 'property.attribute.bestSeason.values.{month}', package:
                                        'Newland.Toubiz.Poi.Neos', source: 'Models/Article')}
                                    </li>
                                </f:then>
                                <f:else>
                                    <li class="tb-best-season__month">
                                        {vh:translate(id: 'property.attribute.bestSeason.values.{month}', package:
                                        'Newland.Toubiz.Poi.Neos', source: 'Models/Article')}
                                    </li>
                                </f:else>
                            </f:if>
                        </f:for>
                    </ul>
                </section>
            </div>
        </poi:collection.attributes.notAllEmpty>
        <vh:render partial="PointOfInterests/Show/Content" arguments="{_all}"/>
        <f:if condition="{article.flatAttributes.directions}">
            <div class="mb-8 text-gray-900 leading-normal text-base" itemprop="description">
                <h3><vh:translate
                    id="property.attribute.directions"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Models/Article"/>
                </h3>

                {article.flatAttributes.directions -> f:format.raw()}
            </div>
        </f:if>
    </div>

</poi:collection.attributes.notAllEmpty>
