<style>
    th a{
        text-decoration: none;
        color: #333;
    }
    </style>
    
<form action="[% $action %]" method="POST" name="hm" onsubmit="return false" id="hm" class="form-horizontal form-label-left">        
    <input type="hidden" name="search[pos]" id="pos" value="[% $search.pos %]" />

    <div class="card panel-info shadow-sm rounded">
        <div class="card-header">
            <div class="row">
                <div class="col-sm-6">
                     <h3 class="card-title">[% $user->gettext('Projekttickets') %] <small>[% $entries %] [% $user->gettext('Projekttickets') %] [% $user->gettext('gefunden') %]</small></h3>
                </div>
                <div class="col-sm-6 text-end">
                      <div class="btn-group">
                        [% if  $pid <= 0 %]
                            <div id="SearchIcon" style="display:inline;">
                                <a href="#dialog-SearchBox" class="btn btn-outline-primary dialog">[% $user->gettext('Suchformular') %]</a>
                            </div>

                        [% else %]
                            <input type="hidden" name="search[Sorting]" id="sort" value="[% $search.Sorting %]" />
                            <input type="hidden" name="search[SortOrder]" id="sortorder" value="[% $search.SortOrder %]" />
                        [% /if %]

                        [% if $user->hasRight(504) && $pid > 0 && $project_active && $user->hasRight(1) %]
                            <input type="button" onclick="window.open('index.php?module=ticket&event=newTicket&pid=[% $pid %]', 'NewTicket');" value="[% $user->gettext('Neues Ticket') %]" class="btn btn-outline-primary" />
                        [% /if %]

                        <input type="button" onclick="window.open('index.php?module=project&class=projectticket&pid=[% $pid %]&action=xls', 'ExportList');" value="[% $user->gettext('Excel Export') %]" class="btn btn-outline-primary" />
                    </div>
                </div>
            </div>
           
        </div>
        <div class="card-body">
[% if $showTicketsInIFrame %]
    <iframe src="index.php?module=project&class=projectticket&event=ProjectTicketBody&pid=[% $pid %]" width="100%" border="0" frameborder="0" height="400"></iframe>
    [% else %]
        [% include file=$modulePath|cat:"/projectticketbody.tpl" %]
    [% /if %]
    </div>
</div>
</form>



[% if $pid <= 0 %]
    <div id="dialog-SearchBox" style="display:none;">[% include file=$modulePath|cat:"/ticket_search.tpl" %]</div>
[% /if %]

<script >
            

    [% if $TRefID  && !$iframe %]
    function saveTRefID(tid) {

        [% if $tid == 0 %]
    if (typeof (opener.document.getElementById('TicketRefId')) == "object") {
    opener.document.getElementById('TicketRefId').value = tid;
    }
    window.close();
        [% else %]
    document.getElementById('TRefID').value = tid;
    document.getElementById('save').value = 1;
    var export = document.getElementById("Export");
    if (export) export.value = "none";
    submitForm();
        [% /if %]
    }

    function closing() {
    window.opener.location.href = "index.php?module=ticket&event=show&id=[% $tid %]";
    window.close();
    }

    [% /if %]

    function switchPage(page)
    {
    document.getElementById('pos').value = page;
    submitForm();
    }

    $(".dialog").fancybox({
    closeClick : false,
            fitToView: false,
            autoSize: true,
            autoResize: true
    });

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