<div class="card panel-fcs-border shadow-sm">
	<div class="card-header">
		<span class="fcs-card-title h2">
			[% $user->gettext('Ticketliste') %]&nbsp;(
            [% if $list_field == 'uid' %]
                [% $user->gettext('Benutzer') %]
            [% /if %]
            [% if $list_field == '' %]
                [% $user->gettext('Priorit&auml;t') %]
            [% /if %]
            [% if $list_field == 'cid' %]
                [% $user->gettext('Kategorie') %]
            [% /if %]
            [% if $list_field == 'conid' %]
                [% $user->gettext('Kontakt') %]
            [% /if %]
            [% if $list_field == 'devid' %]
                [% $user->gettext('Ger&auml;t') %]
            [% /if %]
            [% if $list_field == 'sid' %]
                [% $user->gettext('Struktur') %]
            [% /if %]
            [% if $list_field == 'com' %]
                [% $user->gettext('Firma') %]
            [% /if %]
            [% if $list_field == 'assign' %]
                [% $user->gettext('Weitergabe') %]
            [% /if %]
            [% if $list_field == 'dep' %]
                [% $user->gettext('Abteilung') %]
            [% /if %]
            [% if $list_field == 'tesca' %]
                [% $user->gettext('Eskalationsstufe') %]
            [% /if %]
            [% if $list_field == 'invno' %]
                [% $user->gettext('Inventarnummer') %]
            [% /if %]
            [% if $list_field == 'ttags' %]
                [% $user->gettext('Schlagwort') %]
            [% /if %]     
            [% if $list_field == 'sla' %]
                [% $user->gettext('SLA') %]
            [% /if %]           
            [% if $list_field == 'tickettype' %]
                [% $user->gettext('Tickettyp') %]
            [% /if %]
            [% if $list_field == 'tickettemplate' %]
                [% $user->gettext('Ticketvorlage') %]
            [% /if %]            
            [% if $list_field == 'deffield' %]
                [% $user->gettext('Felder') %]
            [% /if %]  
            [% if $list_field == 'tsupporter' %]
                [% $user->gettext('Supporter') %]
            [% /if %]          
            [% if $list_field == 'tgroup' %]
                [% $user->gettext('Gruppe') %]
            [% /if %]     
            [% if $list_field == 'costc' %]
                [% $user->gettext('Kostenstelle') %]
            [% /if %]                 
            [% if $list_field == 'proctype' %]
                [% $user->gettext('Bearbeitungsart') %]
            [% /if %]   
            

            ) - [% if $list_name != '' %][% $list_name %][% else %][% $user->gettext('Gesamt&uuml;bersicht') %][% /if %]     
		</span>
	</div>
	<div class="card-body">
            <div class="card panel-info shadow-sm rounded">
                <div class="card-body text-center">
                    <div class="btn-group">
                        <a href="#" onclick="setAction('xls');$('#HM-Report-Tickets').submit();return false;" class="btn btn-outline-primary"><span>EXPORT</span></a>
                        <a href="index.php?module=reporting&amp;event=showTickets&amp;action=print&[% $list_field %]=[% $list_value %][% if $fieldid %]&amp;fieldid=[% $fieldid %][% /if %][% if $deffieldid %]&amp;deffieldid=[% $deffieldid %][% /if %]&amp;SortOrder=[% $sortorder %]&amp;Sorting=[% $sort %]&amp;statusid=[% $statusid %]&amp;prioid=[% $prioid %]"  class="btn btn-outline-primary openInBigIFrameModal"><span>[% $user->gettext('DRUCKEN') %]</span></a>
                        <button class="btn btn-outline-secondary" onclick="showSearchBox();" ><span class="fa fa-search"></span> [% $user->gettext('Suchformular') %]</button>
                    </div>
                </div>
            </div>
		
		<div class="card panel-info shadow-sm rounded">
			<div class="card-header">
				<span class="fcs-card-title h3">[% $entries %] [% $user->gettext('Eintr&auml;ge gefunden') %]</span>
			</div>
			<div class="card-body">
				<div class="table-responsive">
					<table class="table table-striped table-bordered">
						<thead>
							<tr class="fields">
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "Status" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='Status'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Status') %]
									[% if $sort == "Status" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
		
								<th width="16"> [% $user->gettext('Anhänge') %]</th>
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "TicketDescr" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='TicketDescr'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Kurzbeschreibung') %]
									[% if $sort == "TicketDescr" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "ID" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='ID'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Ticket-Nr.') %]
									[% if $sort == "ID" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "Company" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='Company'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Firma') %]
									[% if $sort == "Company" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "Department" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='Department'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Abteilung') %]
									[% if $sort == "Department" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "Contact" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='Contact'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Kontakt') %]
									[% if $sort == "Contact" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "Gruppe" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='Gruppe'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Gruppe') %]
									[% if $sort == "Gruppe" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "Supporter" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='Supporter'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Supporter') %]
									[% if $sort == "Supporter" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "CreateDate" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='CreateDate'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Erstellt am') %]
									[% if $sort == "CreateDate" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>                        
								[% if $user->hasRight(48) %]
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "Costs" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='Costs'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Kosten') %]
									[% if $sort == "Costs" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "ExpenseDate" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='ExpenseDate'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Aufwand') %]
									[% if $sort == "ExpenseDate" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
                                                                
                                                                <th style="cursor:pointer;" onclick="document.getElementById(
                                                                    [% if $sort == "ExpExpense" %]
                                                                        'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
                                                                    [% else %]
                                                                        'sort').value='ExpExpense'
                                                                    [% /if %];$('#HM-Report-Tickets').submit();">
                                                                    [% $user->gettext('Erw. Aufwand') %]
                                                                    [% if $sort == "ExpExpense" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
                                                                </th>                                                                  
							[%*
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "Expense" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='Expense'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Aufwand [m]') %]
									[% if $sort == "Expense" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
							*%]
								[% /if %]
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "ProcessDate" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='ProcessDate'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Liegezeit') %]
									[% if $sort == "ProcessDate" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
							[%*
								<th style="cursor:pointer;" onclick="document.getElementById(
									[% if $sort == "ProcessTime" %]
										'sortorder').value='[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
									[% else %]
										'sort').value='ProcessTime'
									[% /if %];$('#HM-Report-Tickets').submit();">
									[% $user->gettext('Liegezeit [m]') %]
									[% if $sort == "ProcessTime" %]&nbsp;<span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>[% /if %]
								</th>
							*%]
							</tr>
							</thead>
							<tbody>
							[% foreach from=$tickets item=ticket %]
								<tr onclick="window.location.href='index.php?module=ticket&event=show&id=[% $ticket.id %]'" style="cursor:pointer;">
									<td style="text-align:center !important;" class="[% if $ticket.diffonhold > 0 %]onhold[% else %]prio[% $ticket.ticketprioid %][% /if %]">[% $user->gettext($ticket.tstatus) %]</td>
		
									<td width="16">
										[% 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.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>&nbsp;[% $ticket.ticketdescr|truncate:50:"...":true %]&nbsp;</td>
									<td>[% $ticket.id %]&nbsp;</td>
									<td>[% $ticket.company|truncate:20:"...":false %]&nbsp;</td>
									<td>[% $ticket.department|truncate:20:"...":false %]&nbsp;</td>
									<td>[% $ticket.contact %]&nbsp;</td>
									<td>[% $ticket.groups.groupnames %]&nbsp;</td>
									<td>[% $ticket.supporters.supporternames %]&nbsp;</td>
									<td>[% $ticket.editdate|date_format:"%d.%m.%Y %H:%M" %]&nbsp;</td>
									[% if $user->hasRight(48) %]
									<td>[% $ticket.kosten %] [% if $hmcompany == 'OTTO FISCHER AG' %]CHF&nbsp; [% else %] [% $user->getCurrencyDescr() %]&nbsp;[% /if %]</td>
									<td>
										[% if $ticket.expensedate.days > 0 %]
											[% $ticket.expensedate.days %]
											[% $user->gettext('T') %]
										[% /if %]
										[% if $ticket.expensedate.hours > 0 %]
											[% $ticket.expensedate.hours %]
											[% $user->gettext('Std') %]
										[% /if %]
										[% if $ticket.expensedate.minutes > 0 %]
											[% $ticket.expensedate.minutes %]
											[% $user->gettext('Min') %]
										[% /if %]
										&nbsp;
									</td>
                                                                        <td>[% $ticket.expexpense %]</td>
									[%*
									<td>[% $ticket.expense %]&nbsp;</td>
									*%]
									[% /if %]
									<td>
										[% if $ticket.processdate.days > 0 %]
											[% $ticket.processdate.days %]
											[% $user->gettext('T') %]
										[% /if %]
										[% if $ticket.processdate.hours > 0 %]
											[% $ticket.processdate.hours %]
											[% $user->gettext('Std') %]
										[% /if %]
										[% if $ticket.processdate.minutes > 0 %]
											[% $ticket.processdate.minutes %]
											[% $user->gettext('Min') %]
										[% /if %]
										&nbsp;
									</td>
									[%*
									<td>[% $ticket.processtime %]&nbsp;</td>
									*%]
								</tr>
							[% foreachelse %]
								<tr>
									<td colspan="13">[% $user->gettext('Keine Tickets gefunden') %]</td>
								</tr>
									[% /foreach %]                
							</tbody>
					</table>
					<div class="text-center">
						[% $Paging %]
					</div>
				</div>
			</div>
		</div>
	</div>
	
                                                <form action="index.php?module=reporting&amp;event=showTickets" name="HM-Report-Tickets" id="HM-Report-Tickets" class="form-horizontal form-label-left" method="post" enctype="multipart/form-data">
                                                    <input type="hidden" name="pos" id="pos" value="[% $pos %]" />
                                                    <input type="hidden" name="action" id="action" value="" />
                                                    <input type="hidden" name="listfield" value="[% $list_field %]" />

                                                    <div class="modal fade" id="reportModal" role="dialog" aria-hidden="true">
                                                        <div class="modal-dialog" role="document">
                                                            <div class="modal-content">
                                                                <div class="modal-header">

                                                                    <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
                                                                        <span aria-hidden="true">&times;</span>
                                                                    </button>


                                                                </div>
                                                                <div class="modal-body modalContent">
                                                                    [% include file=$modulePath|cat:"/list_searchform.tpl" %]
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </form>

</div>

  
<script type="text/JavaScript" language="JavaScript">

    function showSearchBox() {
		$('#reportModal').modal('show');

    }
    function switchPage(page) {
        var el = document.getElementById("Export");
        if (el) el.value = "none";
        document.getElementById("pos").value = page;
        $("#HM-Report-Tickets").submit();
    }
    
    function printList() {
        var MeinFenster = window.open("index.php?module=reporting&event=showTickets&action=print&[% $list_field %]=[% $list_value %]", "Druckansicht", "width=800,height=300,left=100,top=200,scrollbars=yes");
        MeinFenster.focus();
    }
	function setAction(action) {
        document.getElementById("action").value = action;
    }
    
    $(".dialog").fancybox({
      closeClick : false
    });

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