<!DOCTYPE document SYSTEM "rml.dtd">

{% load i18n staticfiles %}

<document filename="{{ view.get_filename }}.pdf">

    <docinit>
        <registerTTFont faceName="Istok" fileName="{{ settings.STATIC_ROOT }}/pdf_reporting/fonts/istok/Istok-Regular.ttf"/>
        <registerTTFont faceName="IstokBold" fileName="{{ settings.STATIC_ROOT }}/pdf_reporting/fonts/istok/Istok-Bold.ttf"/>
        <registerTTFont faceName="IstokBoldItalic" fileName="{{ settings.STATIC_ROOT }}/pdf_reporting/fonts/istok/Istok-BoldItalic.ttf"/>
        <registerTTFont faceName="IstokItalic" fileName="{{ settings.STATIC_ROOT }}/pdf_reporting/fonts/istok/Istok-Italic.ttf"/>
        <registerFontFamily normal="Istok" bold="IstokBold" italic="IstokItalic" boldItalic="IstokBoldItalic"/>
    </docinit>

    <template title="{{ view.get_filename }}" author="Magency">
        <pageTemplate id="main">
            <pageGraphics>
                <setFont name="Istok" size="12"/>
                <drawCentredString x="292" y="1cm">Page <pageNumber/> / <getName id="lastPage" default="1" /></drawCentredString>
            </pageGraphics>
            <frame id="first" x1="60" y1="60" width="475" height="698"/>
        </pageTemplate>
    </template>

    <stylesheet>
        <paraStyle name="default" fontName="Istok" alignment="center" />
        <paraStyle name="header" textColor="{{ theme.text_on_main }}" parent="default" />
        <blockTableStyle id="genericTable">
            <blockFont name="Istok" />
            <blockAlignment value="center" start="0,0" stop="-1,-1" />
            <blockAlignment value="center" start="0,0" stop="-1,-1" />
            <blockValign value="top" start="0,0" stop="-1,-1" />
        </blockTableStyle>
        <blockTableStyle id="resumeTable">
            <lineStyle kind="GRID" colorName="black"/>
            <blockFont name="Istok" />
            <lineStyle kind="GRID" colorName="black"/>
            <blockAlignment value="center" start="0,0" stop="-1,-1" />
            <blockAlignment value="center" start="0,0" stop="-1,-1" />
            <blockValign value="top" start="0,0" stop="-1,-1" />
        </blockTableStyle>
    </stylesheet>

    <story>
        <title>{% trans 'Your notes for the presentation' %} "{{ presentation.name }}"</title>
        <spacer length="0.5cm" />
        <blockTable style="resumeTable" colWidths="4cm,100%">
            <tr>
                <td>{% trans 'Training' %}</td>
                <td>{{ session.training.name }}</td>
            </tr>
            <tr>
                <td>{% trans 'Document' %}</td>
                <td>{{ presentation.name }}</td>
            </tr>
            <tr>
                <td>{% trans 'Session' %}</td>
                <td>
                    {% blocktrans with session_date=session.start_date trainer_first_name=session.trainer.first_name trainer_last_name=session.trainer.last_name %}
                        Session on the {{ session_date }} with {{ trainer_first_name }} {{ trainer_last_name }}
                    {% endblocktrans %}
                </td>
            </tr>
            <tr>
                <td>{% trans 'User' %}</td>
                <td>{{ user.first_name }} {{ user.last_name }}</td>
            </tr>
        </blockTable>
        <spacer length="1cm" />
        {% for image_with_notes in images_with_notes %}
            <blockTable style="genericTable">
                <tr>
                    <td></td>
                    <td>
                        <para style="header">{% trans 'Notes' %}</para>
                    </td>
                </tr>
                <tr>
                    <td>
                        <imageFigure imageName="{{ image_with_notes.image }}" imageHeight="500" imageWidth="290" preserveAspectRatio="yes" pdfBoxType="MediaBox" align="CENTER"/>
                    </td>
                    <td>
                        {% for note_text in image_with_notes.notes %}
                            <para>{{ note_text|linebreaksbr }}</para>
                        {% endfor %}
                    </td>
                </tr>
            </blockTable>
            {% if not forloop.last %}<nextFrame/>{% endif %}
        {% endfor %}
        <namedString id="lastPage">{{ images_with_notes | length }}</namedString>
    </story>
</document>
