<div class="col-12">
    <div class="table-responsive">

        <table class="table table-striped table-bordered  table-condensed" id="listTable">
            <script>
                $('input:checkbox').on("change", function () {
                    if ($(this).attr("id") != "sortingMode") {
                        reloadPage();
                    } else {
                        var isChecked = $(this).is(":checked");
                        if (isChecked) {
                            $('#listTable').dragtable({
                                persistState: function (table) {
                                    var id = [];
                                    table.el.find('th').each(function (i) {
                                        id.push($(this).attr('id'));
                                    });
                                    $.post("index.php?module=ticketlist&event=saveColumnOrder", {cols: JSON.stringify(id)}, function (data) {
                                        $("#updateFilterBtn").removeClass('invisible');
                                        console.log('Update Filter Visible Pos 2');
                                    });
                                },
                                dragaccept: '.dragaccept'
                            });
                        } else {
                            $('#listTable').dragtable('destroy');
                        }
                    }
                });
            </script>
            <thead style="cursor: pointer;">
                <tr class="headings">
                    <th width="16" class="hidden-print" style="padding: 1px 10px;">
                        <input type="checkbox" id="TicketSelection" title="[% $user->gettext('Tickets auswählen') %]" />
                    </th>
                    <th class="hidden-print" colspan="1" onclick="
                        [% if $sort == "Status" %]
                                                document.getElementById('sortorder').value = '[% if $sortorder == "DESC" %]ASC[% else %]DESC[% /if %]'
                        [% else %]
                                                        document.getElementById('sort').value = 'Status'
                        [% /if %];
                                                        sessionStorage.setItem('update', '1');
                                                        $('#miniSearchForm').submit();">
                        [% $user->gettext('Status') %]
                        [% if $sort == "Status" %]
                            <span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]"></span>
                        [% /if %]
                    </th>
                    <th width="55" class="hidden-print">&nbsp;</th>
                        [% if $Tools->FCS_Count($listview.Columns)$Tools->FCS_Count >= 1 %]
                            [% foreach from=$listview.Columns key=ListItem item=ListItem2 %]
                                [% if ($ListItem == 'Category2' && $user->hasRight(51)) ||
                                                        ($ListItem == 'Expense' && !$user->hasRight(524)) ||
                                                        ($ListItem == 'DesireDate' && !$user->hasRight(521)) ||
                                                        ($ListItem == 'Priority' &&  (!$user->hasRight(522) || ($hmcompany == "HOLIDAY AUTOS" ))) %]
                                [% else %]


                                <th class="TicketlistHeader dragaccept" title="[% $user->gettext('Strl+Klick, um Spalten an zu ordnen') %]"  id="[% $ListItem %]" colspan="2" >
                                    [% $user->gettext($ListItem2) %]

                                    [% if $sort == "$ListItem" %]
                                        <span class="fa fa-chevron-[% if $sortorder == "DESC" %]down[% else %]up[% /if %]" aria-hidden="true" title="" onclick="sort(1, '[% $ListItem %]', [% if $sortorder == "ASC" %]DESC[% else %]ASC[% /if %]);"></span>
                                    [% /if %]
                                    [% if $sort2 == "$ListItem" && $sort2 != "$ListItem" %]
                                        <span class="fa fa-chevron-[% if $sortorder2 == "DESC" %]down[% else %]up[% /if %]" aria-hidden="true" title="" onclick="sort(2, '[% $ListItem %]', [% if $sortorder == "ASC" %]DESC[% else %]ASC[% /if %]);"></span>
                                    [% /if %]
                                </th>
                                [% /if %]
                                    [% /foreach %]
                                        [% /if %]
                                        </tr>

                                    </thead>
                                    <tbody id="TicketListBody" class="TicketListBody">

                                        [% foreach from=$tickets item=ticket %]
                                            <tr class="[% if $ticket.isproblem == 1 %]problem[% /if %] hidden-print"
                                                onmouseover="this.className = '[% if $ticket.isproblem == 1 %]problem[% /if %]hover'"
                                                onmouseout="this.className = '[% if $ticket.isproblem == 1 %]problem[% /if %]'" style="cursor:pointer;">

                                                <td width="16" class="hidden-print" style="padding: 1px 10px;">
                                                    [% if !$TRefID && !$iframe && !$ContactID %]
                                                        <input type="checkbox" value="[% $ticket.id %]" class="selectTicket" name="Basket[]" />
                                                    [% /if %]
                                                </td>

                                                <td onclick="callURL([% $ticket.id %]);" nowrap="nowrap" style="text-align:center !important;" class="[% if $ticket.diffonhold > 0 %]onhold[% else %]prio[% if $hmcompany != "HOLIDAY CARS" || $user->hasRight(26) %][% if $ticket.ticketstatusid == 3 || $ticket.ticketstatusid == 11 %]closed[% elseif $ticket.ticketstatusid == 9 %]done[% else %][% $ticket.ticketprioid %][% /if %][% else %][% $ticket.ticketuserprioid %][% /if %][% /if %] hidden-print">
                                                    [% $user->gettext($ticket.tstatus) %]
                                                </td>


                                                <td onclick="callURL([% $ticket.id %]);" nowrap="nowrap" class="hidden-print">
                                                    [% 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 $user->Security->Projects && $ticket.projectid > 0 %]<img src="images/project.png" width="16" height="16"  alt="[% $user->gettext('Projektticket') %]" title="[% $user->gettext('Einem Projekt zugeordnet') %]" />[% /if %]
                                                    [% if $ticket.important == 1 %]<img src="images/important.gif" width="16" height="16"  alt="[% $user->gettext('Kontakt mit Priorit&auml;t') %]" title="[% $user->gettext('Kontakt mit Priorit&auml;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/attach.png" 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 %]
                                                    [% if $ticket.archived == 1 %]<img src="images/archiv.png" width="16" height="16"  alt="[% $user->gettext('Archiv') %]" title="[% $user->gettext('Ticket archiviert') %]" />[% /if %]
                                                </td>

                                                [% if $Tools->FCS_Count($listview.Columns) >= 1 %]
                                                    [% foreach from=$listview.Columns key=ListItem item=ListItem2 %]
                                                        [% include file="$modulePath/parts/$ListItem"|cat:"Body.tpl" %]

                                                    [% /foreach %]
                                                [% else %]
                                                    <td onclick="callURL([% $ticket.id %]);"  nowrap="nowrap" title="[% $ticket.ticketdescr %]"><a href= "index.php?module=ticket&amp;event=show&amp;id=[% $ticket.id %]" style="text-decoration:none;color: #333333;">[% $ticket.ticketdescr|truncate:50:"...":true %]</a></td>
                                                    <td onclick="callURL([% $ticket.id %]);" ><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 onclick="callURL([% $ticket.id %]);"  nowrap="nowrap"><a href= "index.php?module=ticket&amp;event=show&amp;id=[% $ticket.id %]" style="text-decoration:none;color: #333333;">[% $ticket.id %]</a></td>
                                                    <td onclick="callURL([% $ticket.id %]);"  nowrap="nowrap">[% $ticket.company %]</td>
                                                    <td onclick="callURL([% $ticket.id %]);"  nowrap="nowrap">[% $ticket.contact %]</td>
                                                    <td onclick="callURL([% $ticket.id %]);"  nowrap="nowrap">[% $ticket.groupdescr %]</td>
                                                    <td onclick="callURL([% $ticket.id %]);"  nowrap="nowrap">[% $ticket.supporter %]</td>
                                                    <td onclick="callURL([% $ticket.id %]);"  nowrap="nowrap">[% $ticket.ticketdesiredate %]</td>
                                                    [% if $display == "UpdateDate" %]
                                                        <td onclick="callURL([% $ticket.id %]);"  nowrap="nowrap">[% $ticket.updatedate %]</td>
                                                    [% else %]
                                                        <td onclick="callURL([% $ticket.id %]);"  nowrap="nowrap">[% $ticket.editdate %]</td>
                                                    [% /if %]
                                                    [% if $catdep && !$user->hasRight(51) %]<td nowrap="nowrap">[% $ticket.category2 %]</td>[% /if %]
                                                    <td onclick="callURL([% $ticket.id %]);"  nowrap="nowrap">[% $ticket.onhold %]</td>
                                                    [% if $user->Security->Projects %]
                                                        <td onclick="callURL([% $ticket.id %]);"  nowrap="nowrap">[% $ticket.projectname %]</td>
                                                    [% /if %]
                                                [% /if %]

                                            </tr>
                                        [% foreachelse %]
                                            <tr>
                                                [% if $Tools->FCS_Count($listview.Columns) > 1 %]
                                                    <td colspan="[% math equation="(x * 2) + 5" x=$Tools->FCS_Count($listview.Columns) %]">[% $user->gettext('Keine Tickets gefunden') %] </td>
                                                [% else %]
                                                    [% if $user->Security->Projects %]
                                                        <td colspan="[% if $catdep && !$user->hasRight(51) %]17[% else %]18[% /if %]">[% $user->gettext('Keine Tickets gefunden') %]</td>
                                                    [% else %]
                                                        <td colspan="[% if $catdep && !$user->hasRight(51) %]15[% else %]17[% /if %]">[% $user->gettext('Keine Tickets gefunden') %]</td>
                                                    [% /if %]
                                                [% /if %]
                                            </tr>
                                        [% /foreach %]

                                    </tbody>

                                </table>

                            </div>
                        </div> <!-- Ticketliste -->
                        <div class="col-3">
                            <strong>[% $TicketsCountFrom %] - [% $TicketsCountTo %] [% $user->gettext('von') %] [% $entries %]</strong>
                            [%*
                            <input type="button" value="[% $user->gettext('Bearbeitung schlie&szlig;en') %]" class="btn btn-outline-primary" id="ToggleTicketCollection_Off" style="display:none; height: 27px;"/>
                            *%]
                        </div>
                        <div class="col-lg-12 col-sm-12 hidden-sm hidden-xs">
                            <div class="col-lg-2 col-sm-2" style="margin-left: -15px !important;" data-toggle="tooltip" title="[% $user->gettext('Markieren Sie Tickets um diese gesammelt zu bearbeiten') %]">
                                <a title="[% $user->gettext('Auswahl bearbeiten') %]" class="btn btn-outline-primary disabled" id="ToggleTicketCollection_On" style="margin:20px 0;" ><span class='fa fa-pencil'></span> [% $user->gettext('Auswahl bearbeiten')%]</a>
                                <a title="[% $user->gettext('Tickets zusammenführen') %]" class="btn btn-outline-primary disabled" id="MergeTickets" style="margin:20px 0;" >[% $user->gettext('Tickets zusammenführen')%]</a>
                            </div>
                            <div class="col-lg-4 col-sm-4"></div>
                            <div class="col-lg-6 col-sm-6 text-end">
                                [% $Paging %]
                            </div>
                        </div>
                        <div class="col-12 hidden-lg hidden-md">
                            [% $Paging %]
                        </div>

                        <div class="col-9 hidden-print">

                        </div><!-- nav -->
                    </div>
