<form action="[% $action %]" method="POST" name="hm2" onsubmit="return false" id="hm2" />

<!-- Component Ticket begin -->
<input type="hidden" name="pos" id="pos" value="[% $pos %]" />
<div class="table-responsive">
<table class="table table-striped" cellspacing="0" >
    <thead>
        <tr>
            <th colspan="15"><strong>[% $user->gettext('Referenz-Tickets') %]</strong></th>
        </tr>
        <tr >
            <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "Status" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'Status'[% /if %]; submitForm();">
                [% $user->gettext('Status') %] 
                [% if $sort == "Status" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
            </th>
            <th data-hide="phone,tablet" width="16">&nbsp;</th>
            <th data-toggle="true" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "TicketDescr" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'TicketDescr'[% /if %]; submitForm();">
                [% $user->gettext('Kurzbeschreibung (Titel)') %] 
                [% if $sort == "TicketDescr" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
            </th>
            <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "Escalation" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'Escalation'[% /if %]; submitForm();">
                [% $user->gettext('Eskalation') %] 
                [% if $sort == "Escalation" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
            </th>
            <th data-toggle="true" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "ID" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'ID'[% /if %]; submitForm();">
                [% $user->gettext('Ticket-Nr.') %] 
                [% if $sort == "ID" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
            </th>
            <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "Company" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'Company'[% /if %]; submitForm();">
                [% $user->gettext('Firma') %]
                [% if $sort == "Company" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
            </th>
            <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "Contact" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'Contact'[% /if %]; submitForm();">
                [% $user->gettext('Kontakt') %]
                [% if $sort == "Contact" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
            </th>
            <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "Gruppe" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'Gruppe'[% /if %]; submitForm();">
                [% $user->gettext('Gruppe') %] 
                [% if $sort == "Gruppe" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
            </th>
            <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "Supporter" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'Supporter'[% /if %]; submitForm();">
                [% $user->gettext('Supporter') %] 
                [% if $sort == "Supporter" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
            </th>
            <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "DesireDate" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'DesireDate'[% /if %]; submitForm();">
                [% if $hmcompany|strpos:"AVAG HOLDING" !== false %]
                    [% $user->gettext('Wiedervorlage am') %]
                [% else %]
                    [% $user->gettext('F&auml;llig am') %]
                [% /if %]
                [% if $sort == "DesireDate" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
            </th>
            [% if $display == "UpdateDate" %]
                <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "UpdateDate" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'UpdateDate'[% /if %]; submitForm();">
            [% if $hmcompany|strpos:"AVAG HOLDING" !== false %][% $user->gettext('Zuletzt ge&auml;ndert am') %][% else %][% $user->gettext('Letzte &Auml;nderung am') %][% /if %] 
            [% if $sort == "UpdateDate" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
        </th>
    [% else %]
        <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "CreateDate" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'CreateDate'[% /if %]; submitForm();">
            [% $user->gettext('Erstellt am') %] 
            [% if $sort == "CreateDate" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
        </th>
    [% /if %]
    [% if $hmcompany|strpos:"AVAG HOLDING" !== false %]
        <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "SolutionDate" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'SolutionDate'[% /if %]; submitForm();">
            [% $user->gettext('L&ouml;sung bis') %]
            [% if $sort == "SolutionDate" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
        </th>
    [% /if %]
    [% if $catdep && !$user->hasRight(51) %]
        <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById([% if $sort == "Category2" %]'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'[% else %]'sort').value = 'Category2'[% /if %]; submitForm();">
            [% $user->gettext('Kategorie') %]
            [% if $sort == "Category2" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
        </th>
    [% /if %]
    <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById(
        [% if $sort == "OnHold" %]
        'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
        [% else %]
            'sort').value = 'OnHold'
        [% /if %]; submitForm();">
        [% $user->gettext('Zur&uuml;ckgestellt') %]
        [% if $sort == "OnHold" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
    </th>
    [% if $user->Security->Projects %]
        <th data-hide="phone,tablet" style="cursor:pointer;" onclick="document.getElementById(
            [% if $sort == "ProjectName" %]
            'sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
            [% else %]
                'sort').value = 'ProjectName'
            [% /if %]; submitForm();">
            [% $user->gettext('Projekt') %]
            [% if $sort == "ProjectName" %]&nbsp;<img src="images/sort[% if $sortorder == "DESC" %]desc[% else %]asc[% /if %].gif" width="11" height="11" border="0" alt=""  />[% /if %]
        </th>
    [% /if %]
</tr>
</thead>
<tbody>
    [% foreach from=$tickets item=ticket %]
        <tr class="[% if $ticket.isproblem == 1 %]problem[% /if %]" onclick="window.open('index.php?module=ticket&event=show&id=[% $ticket.id %]', 'Ticketlist');" 
            onmouseover="this.className = '[% if $ticket.isproblem == 1 %]problem[% /if %]hover'" 
            onmouseout="this.className = '[% if $ticket.isproblem == 1 %]problem[% /if %]'" style="cursor:pointer;">
            <td nowrap="nowrap" style="text-align:center !important;" class="[% if $ticket.diffonhold > 0 %]onhold[% else %]prio[% if $hmcompany != "HOLIDAY CARS" || $user->hasRight(26) %][% $ticket.ticketprioid %][% else %][% $ticket.ticketuserprioid %][% /if %][% /if %]">[% $user->gettext($ticket.tstatus) %]</td>
            <td>
                [% if $ticket.isproblem == 1 %]
                    <img src="images/isproblem.gif" width="16" height="16"  alt="[% $user->gettext('Problem') %]" title="[% $user->gettext('Problem') %]" />
                [% else %]
                    <img src="images/isincident.gif" width="16" height="16"  alt="[% $user->gettext('Vorfall') %]" title="[% $user->gettext('Vorfall') %]" />
                [% /if %]
                [% if $ticket.important == 1 %]<img src="images/important.gif" width="16" height="16"  alt="[% $user->gettext('Kontakt mit Priorität') %]" title="[% $user->gettext('Kontakt mit Priorität') %]" />[% /if %]
                [% if $ticket.master %]<img src="images/master.gif" width="16" height="16"  alt="[% $user->gettext('Masterticket') %]" title="[% $user->gettext('Masterticket') %] ([% $ticket.master %])" />[% /if %]
                [% if $ticket.ticketreferenzid > 0 %]<img src="images/slave.gif" width="16" height="16"  alt="[% $user->gettext('Abh&auml;ngiges Ticket') %]" title="[% $user->gettext('Abh&auml;ngiges Ticket') %]" />[% /if %]
                [% if $ticket.attachments > 0 %]<img src="images/attachment.gif" width="16" height="16"  alt="[% $user->gettext('Dokumente vorhanden') %]" title="[% $user->gettext('Dokumente vorhanden') %]" />[% /if %]
                [% if $ticket.important != 1 && !$ticket.master && $ticket.attachements <= 0 %]&nbsp;[% /if %]
            </td>
            <td nowrap="nowrap" title="[% $ticket.ticketdescr %]">&nbsp;[% $ticket.ticketdescr|truncate:50:"...":true %]&nbsp;</td>
            <td><img src="images/escalation[% if $ticket.escalationlevel > 0 %][% $ticket.escalationlevel %][% else %]0[% /if %].gif" width="57" height="13" alt="" title="[% $user->gettext('Eskalation') %]: -[% if $ticket.escalationlevel > 0 %][% $ticket.EscalationLevel %][% else %]0[% /if %]-" /></td>
            <td nowrap="nowrap">[% $ticket.id %]&nbsp;</td>
            <td nowrap="nowrap">[% $ticket.company %]&nbsp;</td>
            <td nowrap="nowrap">[% $ticket.contact %]&nbsp;</td>
            <td nowrap="nowrap">[% $ticket.groupdescr %]&nbsp;</td>
            <td nowrap="nowrap">[% $ticket.supporter %]&nbsp;</td>
            <td nowrap="nowrap">[% $ticket.ticketdesiredate|date_format:"%d.%m.%Y %H:%M" %]&nbsp;</td>
            <td nowrap="nowrap">[% $ticket.createdate|date_format:"%d.%m.%Y %H:%M" %]&nbsp;</td>
            [% if $hmcompany|strpos:"AVAG HOLDING" !== false %]
                <td nowrap="nowrap">[% $ticket.solutiondate|date_format:"%d.%m.%Y %H:%M" %]&nbsp;</td>
            [% /if %]
            [% if $catdep && !$user->hasRight(51) %]<td nowrap="nowrap">[% $ticket.category2 %]&nbsp;</td>[% /if %]
            <td nowrap="nowrap">[% $ticket.onhold %]&nbsp;</td>
            [% if $user->Security->Projects %]
                <td nowrap="nowrap">[% $ticket.projectname %]&nbsp;</td>
            [% /if %]
        </tr>
    [% foreachelse %]
        [% if $user->Security->Projects %]
        <td colspan="[% if $catdep && !$user->hasRight(51) %]15[% else %]14[% /if %]">[% $user->gettext('Keine Tickets gefunden') %]</td>
    [% else %]
        <td colspan="[% if $catdep && !$user->hasRight(51) %]14[% else %]13[% /if %]">[% $user->gettext('Keine Tickets gefunden') %]</td>
    [% /if %]
[% /foreach %]

[% if $pages > 1 %]
    <tr>
        <td colspan="14">
            <div class="navigation" style="float:left;">
                <ul>
                    <li>[% $user->gettext('Seite') %]:</li>
                    <li><a href="#" onclick="switchPage([% $pos-1 %])" class="button button-grey"><span>&laquo;</span></a></li>
                    <li><href="#" onclick="switchPage(0)" class="button button-[% if 0 == $pos %]green[% else %]grey[% /if %]"><span>1</span></a></li>
                        [% if $pages gt 1 %]
                            <li><a href="#" onclick="switchPage(1)" class="button button-[% if 1 == $pos %]green[% else %]grey[% /if %]"><span>2</span></a></li>
                            [% /if %]
                            [% if $pages gt 2 %]
                            <li><a href="#" onclick="switchPage(2)" class="button button-[% if 2 == $pos %]green[% else %]grey[% /if %]"><span>3</span></a></li>
                            [% /if %]
                            [% if $pages gt 3 %]
                            <li><a href="#" onclick="switchPage(3)" class="button button-[% if 3 == $pos %]green[% else %]grey[% /if %]"><span>4</span></a></li>
                            [% /if %]
                            [% if $pages gt 4 %]
                            <li><a href="#" onclick="switchPage(4)" class="button button-[% if 4 == $pos %]green[% else %]grey[% /if %]"><span>5</span></a></li>
                            [% /if %]
                            [% if $pages gt 5 %]
                            <li>...</li>
                            <li><a href="#" onclick="switchPage([% $pages-1 %])" class="button button-[% if $pages == $pos %]green[% else %]grey[% /if %]"><span>[% $pages-1 %]</span></a></li>
                                    [% /if %]
                        <li><a href="#" onclick="switchPage([% $pos+1 %])" class="button button-grey"><span>&raquo;</span></a></li>
                </ul>
            </div>
        </td>
    </tr>
[% /if %]
</tbody>
</table>
</div>
<script type="text/JavaScript" language="JavaScript">
    
    function switchPage(page) {
    document.getElementById('pos').value = page;
    submitForm2();
    }

</script>
<!-- Component Ticket end -->

</form>