{namespace vh=Newland\NeosViewHelpers\ViewHelpers}

<svg style="display: none;">
    <symbol id="tb-poi-opening-times-toggle-open" viewBox="0 0 320 512"><path d="M151.5 347.8L3.5 201c-4.7-4.7-4.7-12.3 0-17l19.8-19.8c4.7-4.7 12.3-4.7 17 0L160 282.7l119.7-118.5c4.7-4.7 12.3-4.7 17 0l19.8 19.8c4.7 4.7 4.7 12.3 0 17l-148 146.8c-4.7 4.7-12.3 4.7-17 0z"/></symbol>
    <symbol id="tb-poi-opening-times-toggle-close" viewBox="0 0 320 512"><path d="M168.5 164.2l148 146.8c4.7 4.7 4.7 12.3 0 17l-19.8 19.8c-4.7 4.7-12.3 4.7-17 0L160 229.3 40.3 347.8c-4.7 4.7-12.3 4.7-17 0L3.5 328c-4.7-4.7-4.7-12.3 0-17l148-146.8c4.7-4.7 12.3-4.7 17 0z"/></symbol>
</svg>

<span data-vue="poi" style="display: none;">
    <tb-opening-times-line-preview
        :opening-times-definition="{article.openingTimes}"
        opening-times-format="{article.openingTimesFormat}"
        date-format="{vh:translate(id: 'dateFormat', package: 'Newland.Toubiz.Poi.Neos', source: 'Views/OpeningTimes')}">

        <template #label_always_open="{ openingTimes }">
            <strong class="tb-hours-now__state tb-hours-now__state--open">
                <vh:translate id="heading.alwaysOpen" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
            </strong>
        </template>

        <template #label_open="{ openingTimes }">
            <span class="tb-hours-now__info-line">
                <strong class="tb-hours-now__state tb-hours-now__state--open">
                    <vh:translate id="heading.open" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
                </strong>
                <vh:translate
                    id="heading.open.until"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Views/OpeningTimes"
                    arguments="{ 0: '{{ openingTimes.timeRange.end }}' }"/>

            </span>
        </template>

        <template #label_open_closing_soon_reopens_today="{ openingTimes }">
            <span class="tb-hours-now__info-line">
                <strong class="tb-hours-now__state tb-hours-now__state--changes-soon">
                    <vh:translate id="heading.closingSoon" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
                </strong>
            </span>
            <span class="tb-hours-now__info-line">
                <vh:translate
                    id="subtext.closesAt"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Views/OpeningTimes"
                    arguments="{ 0: '{{ openingTimes.timeRange.end }}' }"/>

            </span>
            <span class="tb-hours-now__info-line">
                <vh:translate
                    id="subtext.opensAgainAt"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Views/OpeningTimes"
                    arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning }}', 1: '{{ openingTimes.nextTimeRange.end }}' }"/>

            </span>
        </template>

        <template #label_open_closing_soon="{ openingTimes }">
            <span class="tb-hours-now__info-line">
                <strong class="tb-hours-now__state tb-hours-now__state--changes-soon">
                    <vh:translate id="heading.closingSoon" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
                </strong>
            </span>
            <span class="tb-hours-now__info-line">
                <vh:translate
                    id="subtext.closesAt"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Views/OpeningTimes"
                    arguments="{ 0: '{{ openingTimes.timeRange.end }}' }"/>

            </span>
       </template>

        <template #label_open_reopens_today="{ openingTimes }">
            <span class="tb-hours-now__info-line">
                <strong class="tb-hours-now__state tb-hours-now__state--open">
                    <vh:translate id="heading.open" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
                </strong>
                <vh:translate
                    id="heading.open.until"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Views/OpeningTimes"
                    arguments="{ 0: '{{ openingTimes.timeRange.end }}' }"/>

            </span>
            <span class="tb-hours-now__info-line">
                <vh:translate
                    id="subtext.opensAgainAt"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Views/OpeningTimes"
                    arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning }}', 1: '{{ openingTimes.nextTimeRange.end }}' }"/>

            </span>
        </template>

        <template #label_closed_opens_soon="{ openingTimes }">
            <span class="tb-hours-now__info-line">
                <strong class="tb-hours-now__state tb-hours-now__state--changes-soon">
                    <vh:translate id="heading.openSoon" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
                </strong>
            </span>
            <span class="tb-hours-now__info-line">
                <vh:translate
                    id="subtext.openTime"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Views/OpeningTimes"
                    arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning}}', 1: '{{ openingTimes.nextTimeRange.end}}' }"/>

            </span>
        </template>

        <template #label_closed_opens_today="{ openingTimes }">
            <span class="tb-hours-now__info-line">
                <strong class="tb-hours-now__state tb-hours-now__state--closed">
                    <vh:translate id="heading.closed" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
                </strong>
            </span>
            <span class="tb-hours-now__info-line">
                <vh:translate
                    id="subtext.openTime"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Views/OpeningTimes"
                    arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning }}', 1: '{{ openingTimes.nextTimeRange.end }}' }"/>

            </span>
        </template>

        <template #label_closed_opens_tomorrow="{ openingTimes }">
            <span class="tb-hours-now__info-line">
                <strong class="tb-hours-now__state tb-hours-now__state--closed">
                    <vh:translate id="heading.closedToday" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
                </strong>
            </span>
            <span class="tb-hours-now__info-line">
                <vh:translate
                    id="subtext.openTomorrow"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Views/OpeningTimes"
                    arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning }}', 1: '{{ openingTimes.nextTimeRange.end }}' }"/>

            </span>
        </template>

        <template #label_closed_opens_day_after_tomorrow="{ openingTimes }">
            <span class="tb-hours-now__info-line">
                <strong class="tb-hours-now__state tb-hours-now__state--closed">
                    <vh:translate id="heading.closedToday" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
                </strong>
            </span>
            <span class="tb-hours-now__info-line">
                <vh:translate
                    id="subtext.openDayAfterTomorrow"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Views/OpeningTimes"
                    arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning }}', 1: '{{ openingTimes.nextTimeRange.end }}' }"/>

            </span>
        </template>

        <template #label_closed_opens_within_next_week="{ openingTimes }">
            <span class="tb-hours-now__info-line">
                <strong class="tb-hours-now__state tb-hours-now__state--closed">
                    <vh:translate id="heading.closedToday" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
                </strong>
            </span>
            <span class="tb-hours-now__info-line">
                <template v-if="openingTimes.nextOpenWeekday === 1">
                    <vh:translate
                        id="subtext.openOnWeekday.monday"
                        package="Newland.Toubiz.Poi.Neos"
                        source="Views/OpeningTimes"
                        arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning}}', 1: '{{ openingTimes.nextTimeRange.end}}' }"/>

                </template>
                <template v-else-if="openingTimes.nextOpenWeekday === 2">
                    <vh:translate
                        id="subtext.openOnWeekday.tuesday"
                        package="Newland.Toubiz.Poi.Neos"
                        source="Views/OpeningTimes"
                        arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning}}', 1: '{{ openingTimes.nextTimeRange.end}}' }"/>

                </template>
                <template v-else-if="openingTimes.nextOpenWeekday === 3">
                    <vh:translate
                        id="subtext.openOnWeekday.wednesday"
                        package="Newland.Toubiz.Poi.Neos"
                        source="Views/OpeningTimes"
                        arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning}}', 1: '{{ openingTimes.nextTimeRange.end}}' }"/>

                </template>
                <template v-else-if="openingTimes.nextOpenWeekday === 4">
                    <vh:translate
                        id="subtext.openOnWeekday.thursday"
                        package="Newland.Toubiz.Poi.Neos"
                        source="Views/OpeningTimes"
                        arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning}}', 1: '{{ openingTimes.nextTimeRange.end}}' }"/>

                </template>
                <template v-else-if="openingTimes.nextOpenWeekday === 5">
                    <vh:translate
                        id="subtext.openOnWeekday.friday"
                        package="Newland.Toubiz.Poi.Neos"
                        source="Views/OpeningTimes"
                        arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning}}', 1: '{{ openingTimes.nextTimeRange.end}}' }"/>

                </template>
                <template v-else-if="openingTimes.nextOpenWeekday === 6">
                    <vh:translate
                        id="subtext.openOnWeekday.saturday"
                        package="Newland.Toubiz.Poi.Neos"
                        source="Views/OpeningTimes"
                        arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning}}', 1: '{{ openingTimes.nextTimeRange.end}}' }"/>

                </template>
                <template v-else-if="openingTimes.nextOpenWeekday === 7 || openingTimes.nextOpenWeekday === 0">
                    <vh:translate
                        id="subtext.openOnWeekday.sunday"
                        package="Newland.Toubiz.Poi.Neos"
                        source="Views/OpeningTimes"
                        arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning}}', 1: '{{ openingTimes.nextTimeRange.end}}' }"/>

                </template>
                <template v-else>
                    <!-- This case should never happen but was added as a safeguard -->
                    <vh:translate
                        id="closed_opensWithinNextWeek"
                        package="Newland.Toubiz.Poi.Neos"
                        source="Views/OpeningTimes"
                        arguments="{ 0: '{{ openingTimes.nextTimeRange.beginning}}', 1: '{{ openingTimes.nextTimeRange.end}}' }"/>

                </template>
            </span>
        </template>

        <template #label_closed_opens_on_date="{ openingTimes, nextOpenDate }">
            <span class="tb-hours-now__info-line">
                <strong class="tb-hours-now__state tb-hours-now__state--closed">
                    <vh:translate id="heading.closed" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
                </strong>
            </span>
            <span class="tb-hours-now__info-line">
                <vh:translate
                    id="subtext.opensOn"
                    package="Newland.Toubiz.Poi.Neos"
                    source="Views/OpeningTimes"
                    arguments="{ 0: '{{ nextOpenDate }}', 1: '{{ openingTimes.nextTimeRange.beginning}}', 2: '{{ openingTimes.nextTimeRange.end}}' }"/>

            </span>
        </template>

        <template #label_closed="{ openingTimes }">
            <span class="tb-hours-now__info-line">
                <strong class="tb-hours-now__state tb-hours-now__state--closed">
                    <vh:translate id="heading.closedToday" package="Newland.Toubiz.Poi.Neos" source="Views/OpeningTimes"/>
                </strong>
            </span>
        </template>

        <f:if condition="{displayTable}">
            <template #additional_label="{ additionalActive }">
                <svg class="tb-hours-now__toggle-icon c-icon" aria-hidden="true">
                    <use :xlink:href="additionalActive ? '#tb-poi-opening-times-toggle-close' : '#tb-poi-opening-times-toggle-open'"></use>
                </svg>
            </template>

            <template #additional_information="{ openingTimes, upcomingOpeningTimes, additionalActive }">
                <div v-if="additionalActive" class="tb-hours-detail">
                    <h3>
                        <vh:translate
                            id="tableHeader"
                            source="Views/OpeningTimes"
                            package="Newland.Toubiz.Poi.Neos"/>

                    </h3>
                    <ul class="tb-hours-detail__body">
                        <dl class="tb-hours-detail__item" v-for="upcoming in upcomingOpeningTimes">
                            <dt class="tb-hours-detail__item-day">{{ $t('day.' + upcoming.weekday) }}</dt>
                            <ul v-if="upcoming.times && upcoming.times.timeRanges.length > 0" class="tb-hours-detail__item-ranges">
                                <dl class="tb-hours-detail__item-range" v-for="timeRange in upcoming.times.timeRanges">
                                    <dd class="tb-hours-detail__item-range-value">
                                        {{ timeRange }}
                                    </dd>
                                    <dd v-if="timeRange.comment" class="tb-hours-detail__item-range-comment">
                                        {{ timeRange.comment }}
                                    </dd>
                                </dl>
                            </ul>
                            <dd v-else class="tb-hours-now__state--closed">
                                <vh:translate
                                    id="closed"
                                    source="Views/OpeningTimes"
                                    package="Newland.Toubiz.Poi.Neos"/>

                            </dd>
                        </dl>
                    </ul>
                </div>
            </template>
        </f:if>
    </tb-opening-times-line-preview>
</span>
