<pdf>
    <dynamic-page page-size="letter-landscape">
        <placeholders>
            <header>
                <div height="50px">
                    <h1>{{ page_title }}</h1>
                </div>
            </header>
            <footer>
                <div height="25px" text-align="right">
                    <div float="right" text-align="right" font-style="italic">
                        <page-info format="page %s of %s" />
                    </div>
                    <div float="left" text-align="left" font-style="italic">
                        {{ app.session.get('userData').fullName ~ ' / ' ~ app.session.get('userData').username }} on {{ 'now'|date('Y-m-d h:i:s A') }}
                    </div>
                </div>
            </footer>
        </placeholders>
        <table>
            <tr background.color="#b42025" color="#FAFAFA">
                <td border.color="#FAFAFA" padding="3px" text-align="center" width="100"><strong>Date/Time</strong></td>
                <td border.color="#FAFAFA" padding="3px" text-align="center"><strong>Event No.</strong></td>
                <td border.color="#FAFAFA" padding="3px" text-align="center"><strong>Event Type</strong></td>
                <td border.color="#FAFAFA" padding="3px" text-align="center"><strong>Status</strong></td>
                <td border.color="#FAFAFA" padding="3px" text-align="center"><strong>Priority</strong></td>
                <td border.color="#FAFAFA" padding="3px" text-align="center"><strong>Client Mobile No.</strong></td>
                <td border.color="#FAFAFA" padding="3px" text-align="center"><strong>Client Name</strong></td>
                <td border.color="#FAFAFA" padding="3px" text-align="center"><strong>Remarks Count</strong></td>
                <td border.color="#FAFAFA" padding="3px" text-align="center"><strong>Responder Count</strong></td>
                <td border.color="#FAFAFA" padding="3px" text-align="center"><strong>Attachment Count</strong></td>
            </tr>
            {% set totalCount = 0 %}
            {% for record in records %}
                {% set totalCount = totalCount + 1 %}
                <tr {{ totalCount is divisibleby(2) ? 'background.color="#FAFAFA"' : '' }}>
                    <td border.type="none" padding-top="3px" padding-bottom="3px">{{ record.createdAt }}</td>
                    <td border.type="none" padding-top="3px" padding-bottom="3px">{{ record.eventNo }}</td>
                    <td border.type="none" padding-top="3px" padding-bottom="3px">{{ record.eventType_codeAndDesc }}</td>
                    <td border.type="none" padding-top="3px" padding-bottom="3px">{{ record.status }}</td>
                    <td border.type="none" padding-top="3px" padding-bottom="3px" text-align="center">{{ record.priority }}</td>
                    <td border.type="none" padding-top="3px" padding-bottom="3px">{{ record.client_mobileNo }}</td>
                    <td border.type="none" padding-top="3px" padding-bottom="3px">{{ record.client_fullName }}</td>
                    <td border.type="none" padding-top="3px" padding-bottom="3px" text-align="center">{{ record.noteCtr }}</td>
                    <td border.type="none" padding-top="3px" padding-bottom="3px" text-align="center">{{ record.responderCtr }}</td>
                    <td border.type="none" padding-top="3px" padding-bottom="3px" text-align="center">{{ record.fileCtr }}</td>
                </tr>
                <tr {{ totalCount is divisibleby(2) ? 'background.color="#FAFAFA"' : '' }}>
                    <td colspan="10" border.type="none" padding-top="3px" padding-bottom="3px">LL: {{ record.geoLat }}, {{ record.geoLong }}: {{ record.address }}</td>
                </tr>
                <tr {{ totalCount is divisibleby(2) ? 'background.color="#FAFAFA"' : '' }}>
                    <td colspan="10" border.type="bottom" padding-top="3px" padding-bottom="3px">Notes: {{ record.note }}</td>
                </tr>
            {% endfor %}
        </table>
        <div margin-top="10">Total Records: {{ totalCount }}</div>
        <h5 margin-top="10" font-size="16px">Status Summary</h5>
        <table margin-top="10" width="300">
            <tr background.color="#FAFAFA">
                <td padding="3px"><strong>Status</strong></td>
                <td padding="3px"><strong>Count</strong></td>
            </tr>
            {% set summStatus_ctr = 0 %}
            {% for summStatus in summary.status %}
                {% set summStatus_ctr = summStatus_ctr + summStatus.ctr %}
                <tr>
                    <td padding="3px">{{ summStatus.desc }}</td>
                    <td padding="3px" width="50">{{ summStatus.ctr }}</td>
                </tr>
            {% endfor %}
            <tr>
                <td padding="3px" text-align="right">Total</td>
                <td padding="3px">{{ summStatus_ctr }}</td>
            </tr>
        </table>
        <h5 margin-top="10" font-size="16px">Event Types Summary</h5>
        <table margin-top="10" width="400">
            <tr background.color="#FAFAFA">
                <td padding="3px"><strong>Event Type</strong></td>
                <td padding="3px" width="50"><strong>Count</strong></td>
            </tr>
            {% set summET_ctr = 0 %}
            {% for summET in summary.eventType %}
                {% set summET_ctr = summET_ctr + summET.ctr %}
                <tr>
                    <td padding="3px">{{ summET.codeAndDesc }}</td>
                    <td padding="3px">{{ summET.ctr }}</td>
                </tr>
            {% endfor %}
            <tr>
                <td padding="3px" text-align="right">Total</td>
                <td padding="3px">{{ summET_ctr }}</td>
            </tr>
        </table>
        <h5 margin-top="10" font-size="16px">City Summary</h5>
        <table margin-top="10" width="300">
            <tr background.color="#FAFAFA">
                <td padding="3px"><strong>City</strong></td>
                <td padding="3px"><strong>Count</strong></td>
            </tr>
            {% set summCity_ctr = 0 %}
            {% for summCity in summary.city %}
                {% set summCity_ctr = summCity_ctr + summCity.ctr %}
                <tr>
                    <td padding="3px">{{ summCity.desc }}</td>
                    <td padding="3px" width="50">{{ summCity.ctr }}</td>
                </tr>
            {% endfor %}
            <tr>
                <td padding="3px" text-align="right">Total</td>
                <td padding="3px">{{ summCity_ctr }}</td>
            </tr>
        </table>
    </dynamic-page>
</pdf>