<div id="TicketMainEvent" class="card panel-info shadow-sm rounded">

    <div class="card panel-info shadow-sm rounded">
        <div class="card-header">
            <h3 class="card-title-fcs">

                [% if !$type.type_id %]<img title="[% $user->gettext('Standard Ticket')%]"  src="index.php?module=upload&class=download&event=ShowImage&name=[% $smarty.const.STANDARD_ICON %]"  height="25"> [% $smarty.const.STANDARD_NAME %][% else %][% if $type.path %]<img title="[% $type.type_name%]"  src="index.php?module=upload&class=download&event=ShowImage&name=[% $type.path %]"  height="25">[% else %]<img title="[% $type.type_name%]"  src="index.php?module=upload&class=download&event=ShowImage&name=[% $smarty.const.NO_ICON %]"  height="25">[% /if %] [% $type.type_name%][% /if %]:
                [% $ticket.ticketdescr %]
                <small>(#[% $ticket.id %])</small>               
            </h3>
        </div>
    </div>
    <div class="card-header" role="tab" id="headingTicketDescr">
        <a class="collapsed" role="button" data-toggle="collapse" data-parent="#DEACTIVEleftAccordion" href="#TicketDescrPanel" aria-expanded="false" aria-controls="collapseContact" style="text-decoration: none;">
            <div class="row">
                <div class="col-sm-6 text-left">
                    <h6 class="card-title">[% $user->gettext('Beschreibung') %]</h6>
                </div>
                <div class="col-sm-6 text-end">
                    <div class="row">
                        <div class="col-sm-11">
                            <ul class="list-inline">
                                <li title="[% $user->gettext('Bearbeitungsdatum') %]" data-toggle="tooltip" data-container="body"><span class="fa fa-calendar" aria-hidden="true"></span> [% $FirstTicketEvent.eventdate|date_format:"%d.%m.%Y %H:%M" %]</li>
                                [% if !$user->hasRight(243) %]
                                <li title="[% $user->gettext('Erstellt von') %]" data-toggle="tooltip" data-container="body">
                                    [% if $FirstTicketEvent.croppedavatar %]
                                        <img class="hm-avatar-medium" src="index.php?module=upload&class=download&event=ShowImage&name=[%  $FirstTicketEvent.croppedavatar %]"/>
                                    [% else %]
                                        <div id="img-circular-[% $FirstTicketEvent.id %]"></div>
                                        <style>
                                            #img-circular-[% $FirstTicketEvent.id %]{
                                                width: 30px;
                                                height: 30px;
                                                background-image: url('index.php?module=upload&class=download&event=ShowImage&name=[%  $FirstTicketEvent.avatar %]');
                                                background-size: cover;
                                                display: inline-block;
                                                border-radius: 100px;
                                                margin-bottom: -8px;
                                                -webkit-border-radius: 100px;
                                                -moz-border-radius: 100px;
                                            }
                                        </style>
                                    [% /if %]
                                    [% $FirstTicketEvent.name %]
                                </li>
                                [% /if %]
                                    [% if $user->hasRight(524) %]
                                    <span title="[% $user->gettext('Aufwand in Minuten') %]" data-toggle="tooltip" data-container="body"><span class="fa fa-clock" aria-hidden="true"></span> [% $FirstTicketEvent.expense|intval %] [% $user->gettext('Min') %]</span>
                                [% /if %]
                                [% if $user->hasRight(48) %]
                                    <li><span class="fa fa-euro" aria-hidden="true"></span>
                                        <span data-toggle="tooltip" data-container="body" title="[% $user->gettext('Kosten aus Aufwand') %]" >[% $FirstTicketEvent.eventcosts %]</li>
                                        [% if $user->hasRight(506) && $FirstTicketEvent.projecteventcosts > 0 %]
                                        <span data-toggle="tooltip" data-container="body" title="[% $user->gettext('Kosten im Projekt') %]" > | [% $FirstTicketEvent.projecteventcosts %]</span>
                                    [% /if %]
                                    [% if $user->hasRight(506) && $FirstTicketEvent.projectfixcosts %]
                                        <span data-toggle="tooltip" data-container="body" title="[% $user->gettext('Fixkosten') %]"> | [% $FirstTicketEvent.projectfixcosts|default:0 %]</span>
                                    [% /if %]
                                    [% $FirstTicketEvent.symbol %]</li>
                                [% /if %]

                                [% if $FirstTicketEvent.mailssentto.count > 0 %]
                                    <li title="[% $user->gettext('Benachrichtigungen') %]" data-toggle="tooltip" data-container="body">
                                        [% foreach key=name item=recipients from=$FirstTicketEvent.mailssentto %]
                                            [% if $name != 'count' %]
                                                [% if $name == 'Contact' %]
                                                    <img src="images/identity.png"  alt="" border="0" title="[% $user->gettext('An Kontakt') %]: [% $recipients %]"/>
                                                [% /if %]
                                                [% if $name == 'Supporter' %]
                                                    <img src="images/user14.png"  alt="" width="16" height="16" border="0" title="[% $user->gettext('An Supporter') %]: [% $recipients %]"/>
                                                [% /if %]
                                                [% if $name == 'other' %]
                                                    <img src="images/mail.png"  alt="" width="16" height="16" border="0" title="[% $user->gettext('Weitere Empfänger') %]: [% $recipients %]"/>
                                                [% /if %]
                                            [% /if %]
                                        [% /foreach %]
                                    </li>
                                [% /if %]
                            </ul>

                        </div>

                        <div class="col-sm-1" style="border-left: 1px solid #adadad;">

                        </div>
                    </div>


                </div>
            </div>
        </a>

    </div>

    <div id="TicketDescrPanel" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingTicketDescr" aria-expanded="true">
        <div class="card-body">

            [% if $FirstTicketEvent.mailinfos.sender.count > 0 %]

                <a class="btn btn-outline-secondary btn-sm btn-block" style="width:100%;" role="button" data-toggle="collapse" href="#[% $FirstTicketEvent.id %]SendFrom" aria-expanded="true" aria-controls="SendFrom">
                    <span class="fa fa-envelope"></span>
                    [% $user->gettext('Per Mail angelegt.') %]
                </a>

                <div class="collapse" id="[% $FirstTicketEvent.id %]SendFrom">
                    <div class="well">
                        <ul class="list-group">

                            [% foreach key=name item=senders from=$FirstTicketEvent.mailinfos.sender %]
                                [% if $name != 'count' && $senders %]
                                    <li class="list-group-item">
                                        [% $user->gettext($name) %]: [% $senders %]
                                    </li>
                                [% /if %]
                            [% /foreach %]
                        </ul>

                        [% if $FirstTicketEvent.mailinfos.mailto.count > 0 %]
                            <strong>[% $user->gettext('Benachrichtigungen gesendet an') %]</strong>
                            <ul class="list-group">
                                [% foreach key=name item=senders from=$FirstTicketEvent.mailinfos.mailto %]
                                    [% if $name != 'count' && $senders %]
                                        <li class="list-group-item">
                                            [% $user->gettext($name) %]: [% $senders %]
                                        </li>
                                    [% /if %]
                                [% /foreach %]
                            </ul>
                        [% /if %]
                    </div>
                </div>


            [% /if %]
            [% if $TicketDescrFromMail %]
                [% $TicketDescrFromMail %]
            [% else %]
                [% $formatedTicketDescription|nl2br %]
            [% /if %]
            [% if $descr_has_dec %]
                <hr>
                <p><strong>[% $user->gettext('Entscheidungsprotokoll') %]</strong></p>
                [% foreach from= $descr_dec item=dec %]
                    <p>[% $dec.decdate|date_format:"%d.%m.%Y - %H:%M" %] : <strong>[% $dec.name %]</strong> [% if $dec.agree == 1 %][% $user->gettext('stimmt zu') %][% else %][% $user->gettext('lehnt ab') %][% /if %] [% if $dec.decdescr != NULL %]: [% $dec.decdescr %] [% /if %]</p>
                [% /foreach %]
            [% /if %]
        </div>
    </div>
</div>
