<!DOCTYPE html>
<html v-bind:lang="$i18n.locale">
    <head>
        <meta name="viewport" content="width=device-width">
        <meta name="format-detection" content="telephone=no">
        <title>{{ $t('subject') }}</title>
    </head>
    <body>
        <table class="grid">
            <tbody>
                <tr>
                    <td>
                        <!-- Empty block -->
                        <div class="grid-row">
                            <div class="grid-block empty"></div>
                        </div>
                        <!-- Header block -->
                        <div class="grid-row">
                            <div class="grid-block">
                                <email-header v-bind="$props"></email-header>
                            </div>
                        </div>
                        <!-- Block -->
                        <div class="grid-row">
                            <div class="grid-block vn-pa-ml">
                                <h1>{{ $t('title') }}</h1>
                                <p>{{$t('dear')}},</p>
                                <p v-html="$t('description', [started, ended])"></p>
                                <p v-html="$t('totalResolved', [resolvedTickets])"></p>
                                <p v-html="$t('grafanaLink')"></p>
                                <div class="external-link vn-pa-sm vn-m-md">
                                    <a v-bind:href="'https://grafana.verdnatura.es/d/2kaHDi9Mk/osticket?orgId=1&from=' + startedTime + '&to=' + endedTime" target="_blank">
                                        https://grafana.verdnatura.es/d/2kaHDi9Mk/osticket?orgId=1&from={{startedTime}}&to={{endedTime}}
                                    </a>
                                </div>
                                <p v-html="$t('redmineLink')"></p>
                                <div class="external-link vn-pa-sm vn-m-md">
                                    <a href="https://redmine.verdnatura.es/projects/desarrollo/issues?query_id=112" target="_blank">
                                        https://redmine.verdnatura.es/projects/desarrollo/issues?query_id=112
                                    </a>
                                </div>
                            </div>
                        </div>
                        <!-- Block -->
                        <div class="grid-row">
                            <div class="grid-block vn-pa-ml" v-for="technician in technicians">
                                <div class="table-title clearfix">
                                    <h2>{{technician.name}} (<strong>{{technician.tickets.length}}</strong>)</h2>
                                </div>
                                <table class="column-oriented">
                                    <thead>
                                        <tr>
                                            <th width="5%">{{$t('author')}}</th>
                                            <th width="15%">{{$t('dated')}}</th>
                                            <th width="25%">{{$t('ticketSubject')}}</th>
                                            <th width="30%">{{$t('ticketDescription')}}</th>
                                            <th width="20%">{{$t('resolution')}}</th>
                                        </tr>
                                    </thead>
                                    <tbody v-for="ticket in technician.tickets">
                                        <tr>
                                            <td>{{ticket.author}}</td>
                                            <td class="font light-gray">
                                                <div v-bind:title="$t('opened')">
                                                    &#128275; {{ticket.created | date('%d-%m-%Y %H:%M')}}
                                                </div>
                                                <div v-bind:title="$t('closed')">
                                                    &#128274; {{ticket.closed | date('%d-%m-%Y %H:%M')}}
                                                </div>
                                            </td>
                                            <td>
                                                <a v-bind:href="'https://cau.verdnatura.es/scp/tickets.php?id=' + ticket.ticket_id">
                                                    {{ticket.number}} - {{ticket.subject}}
                                                </a>
                                            </td>
                                            <td class="message" v-html="ticket.description"></td>
                                            <td class="message" v-html="ticket.resolution"></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <!-- Footer block -->
                        <div class="grid-row">
                            <div class="grid-block">
                                <email-footer v-bind="$props"></email-footer>
                            </div>
                        </div>
                        <!-- Empty block -->
                        <div class="grid-row">
                            <div class="grid-block empty"></div>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </body>
</html>