
{%- trans_default_domain 'form' -%}

{%- set date = operation.dateVisite
    ? operation.dateVisite|localizeddate('none', 'none', null, null, 'EEEE dd MMMM YYYY')
    : 'sentence.date.operationPEE.missing'|trans({}, 'sentence')
-%}

<!DOCTYPE html>
<html lang="{{ app.request.locale|replace({'_':'-'}) }}">
    <head>
        <meta charset="utf-8">

        <title>{{ operation.getPdfReadableName(false) }}</title>
        
        {# CSS files #}
        <link media="all" href="{{ absolute_url(asset('admin/styles/operationpee-print.css'|asset_rev)) }}" rel="stylesheet">
    </head>
    <body{% if operation.new %} class="new"{% endif %}>
        <header class="header row">
            <div>
                <p class="header-new">
                    <span>{{ 'word.new'|trans({}, 'word') }}</span>
                </p>
                <h1 class="header-company title">{{ operation.company }}</h1>
                <h2 class="header-site title">{{ operation.site }}</h2>
                <p class="header-date title">{{ date|first|upper ~ date|slice(1) }}</p>
            </div>
            <div>
                {% if operation.category %}
                    <figure class="header-category title">
                        <div class="header-category--image">
                            {% if operation.category.logoPath is not null %}
                                {{ file_get_contents(vich_uploader_asset(operation.category, 'logoFile')) }}
                            {% endif %}
                        </div>
                        <figcaption class="header-category--caption">{{ operation.category }}</figcaption>
                    </figure>
                {% endif %}
            </div>
        </header>

        <div class="main">
            <div class="row">
                <h3 class="main-title title">{{ operation.title }}</h3>

                <div>
                    {% if operation.siteImage1Path or operation.siteImage2Path or operation.siteImage3Path %}
                        <ul class="main-gallery">
                            {% if operation.siteImage1Path %}
                                <li class="main-gallery--item">
                                    <figure>
                                        <img alt="" class="main-gallery--img" src="{{ absolute_url(vich_uploader_asset(operation, 'siteImage1File')|imagine_filter('128Lx128H')) }}">
                                    </figure>
                                </li>
                            {% endif %}
                            {% if operation.siteImage2Path %}
                                <li class="main-gallery--item">
                                    <figure>
                                        <img alt="" class="main-gallery--img" src="{{ absolute_url(vich_uploader_asset(operation, 'siteImage2File')|imagine_filter('128Lx128H')) }}">
                                    </figure>
                                </li>
                            {% endif %}
                            {% if operation.siteImage3Path %}
                                <li class="main-gallery--item">
                                    <figure>
                                        <img alt="" class="main-gallery--img" src="{{ absolute_url(vich_uploader_asset(operation, 'siteImage3File')|imagine_filter('128Lx128H')) }}">
                                    </figure>
                                </li>
                            {% endif %}
                        </ul>
                    {% endif %}
                </div>
            </div>

            <div class="row">
                <article class="main-article">
                    <h4 class="main-article--title title">{{ 'sentence.company.description'|trans({}, 'sentence') }}</h4>
                    <p class="main-article--content">{{ operation.company.description|nl2br }}</p>
                    <p class="main-article--presentation">{{ operation.presentation|nl2br }}</p>

                    <h4 class="main-article--title title">{{ 'sentence.pee.print.presentation'|trans({}, 'sentence') }}</h4>
                    <p class="main-article--visit">{{ operation.visit|nl2br }}</p>

                    {% if operation.quoteContent %}
                        <div class="main-article--quote">
                            <blockquote class="main-article--quote-quote">{{ operation.quoteContent }}</blockquote>
                            {% if operation.quoteAuthor or operation.quoteAuthorJob %}
                                <p class="main-article--quote-signature">
                                    <span>
                                        {{ operation.quoteAuthor ?? '' }}
                                        {% if operation.quoteAuthor and operation.quoteAuthorJob %}<br/>{% endif %}
                                        {{ operation.quoteAuthorJob ?? '' }}
                                    </span>
                                </p>
                            {% endif %}
                        </div>
                    {% endif %}

                    {% if operation.partner and operation.partner.logoPath %}
                        <div class="main-article--partner">
                            <p>{{ 'sentence.pee.print.partnership'|trans([], 'sentence') }}</p>
                            <img alt="{{ operation.partner.name }}" class="main-article--partner-logo" src="{{ absolute_url(vich_uploader_asset(operation.partner, 'logoFile')|imagine_filter('50H_hq')) }}"/>
                        </div>
                    {% endif %}
                </article>

                <aside class="main-sidebar">
                    <section class="insert">
                        <h4 class="insert--title title">{{ 'form.namely.label'|trans }}</h5>
                        <ul>
                            <li class="insert-item insert-item--info-date">
                                {{ 'form.date.label'|trans }}&nbsp;: <strong>{{ date|first|upper ~ date|slice(1) }}</strong>
                            </li>
                            {% if operation.startTime %}
                                <li class="insert-item insert-item--info-time">
                                    {{ 'form.time.appointment.label'|trans }}&nbsp;: <strong>{{ operation.startTime ? operation.startTime|date('H\\hi') : '' }}</strong>
                                </li>
                            {% endif %}
                            {% if operation.endTime and operation.startTime %}
                                <li class="insert-item insert-item--info-duration">
                                    {{ 'form.duration.visit.label'|trans }}&nbsp;: <strong>{{ operation.endTime.diff(operation.startTime)|date('%hh%I')|replace({'00':''}) }}</strong>
                                </li>
                            {% endif %}
                            {% if operation.namely %}
                                <li class="insert-item insert-item--info-additional">
                                    <strong>{{ operation.namely }}</strong>
                                </li>
                            {% endif %}
                            <li class="insert-item insert-item--info-spaces">
                                {{ 'form.places.qty.available.label'|trans }}&nbsp;: <strong>{{ operation.nbPeople }}</strong>
                            </li>
                        </ul>
                    </section>

                    <section class="insert">
                        <h4 class="insert--title title">Conditions d’accès</h5>
                        <ul>
                            {% if operation.audience %}
                                <li class="insert-item insert-item--access-audience">
                                    {{ 'form.audience.label'|trans }}&nbsp;: <strong>{{ operation.audience }}</strong>
                                </li>
                            {% endif %}
                            {% if operation.urlExternalRegistration %}
                                <li class="insert-item insert-item--access-registration-paf">
                                    {%- set link -%}
                                        <strong>
                                            <a href="{{ operation.urlExternalRegistration }}">{{ operation.urlExternalRegistration }}</a>
                                        </strong>
                                    {%- endset -%}
                                    {{-
                                        'sentence.registration.paf'|trans({
                                            '%highlight_start%': '<strong>',
                                            '%highlight_end%': '</strong>',
                                            '%link%': link
                                        }, 'sentence')|raw
                                    -}}
                                </li>
                            {% endif %}
                            <li class="insert-item insert-item--access-registration">
                                {%- set link -%}
                                    <strong><a href="{{ url('_welcome') }}">{{ url('_welcome') }}</a></strong>
                                {%- endset -%}
                                {{
                                    ('sentence.registration.cgenial.' ~ (operation.urlExternalRegistration ? 'after_paf' : 'mandatory'))|trans({
                                        '%date%': '<strong>' ~ operation.publish|localizeddate('none', 'none', null, null, 'dd MMMM') ~ '</strong>',
                                        '%link%': link
                                    }, 'sentence')|raw
                                }}
                            </li>
                            <li class="insert-item insert-item--access-contact">
                                <a href="mailto:{{ cgenial_mail_pee_info }}">{{ cgenial_mail_pee_info }}</a>
                                <br/>{{ cgenial_phone }}
                            </li>
                            <li class="insert-item insert-item--access-price">
                                {{ 'form.visit.free.label'|transchoice(2, {}) }}
                            </li>
                        </ul>
                    </section>

                    <section class="insert insert-company">
                        <h4 class="insert--title title">{{ 'sentence.company.welcome'|trans({}, 'sentence') }}</h5>
                        <ul class="vcard">
                            {% if operation.company.logoPath %}
                                <li class="insert-item insert-company--logo">
                                    <img class="photo" src="{{ absolute_url(vich_uploader_asset(operation.company, 'logoFile')|imagine_filter('50H_hq')) }}"/>
                                </li>
                            {% endif %}
                            <li class="insert-item insert-item--company-location">
                                <div>
                                    {# @see http://microformats.org/wiki/hcard-fr hCard 1.0 microformat #}
                                    <div class="org">{{ operation.company ?? '' }}</div>
                                    <div class="adr">
                                        <div class="street-address">{{ operation.address }}</div>
                                        {% if operation.zipCode %}<span class="postal-code">{{ operation.zipCode }}</span> {% endif %}<span class="locality">{{ operation.city ?? '' }}</span>
                                    </div>
                                </div>
                            </li>
                            {% if operation.company.website %}
                                <li class="insert-item insert-item--company-website">
                                    <a class="url" href="{{ operation.company.website }}">{{ operation.company.website|replace({'https://':'', 'http://':''}) }}</a>
                                </li>
                            {% endif %}
                        </ul>
                    </section>
                </aside>
            </row>
        </div>
    </body>
</html>
