<form action="index.php?module=workflow&event=mailReport&wfiid=[% $wfiid %]" method="POST" id="hm" class="form-horizontal" [% if $export %]style="font-size: 0.75em !important;"[% /if %]>
    <input type='hidden' name='save' value='1'>
    <div class="card panel-fcs-border shadow-sm">
        <div class="card-header">

            <h1 class="card-title">[% $user->gettext(' Bericht per Mail senden') %]</h1>
        </div>
        <div class="card-body">
            [% if $success %]
                <div class="alert alert-success">
                    [% $user->gettext('Bericht wurde gesendet.') %]
                </div>
            [% /if %]
            [% if $failed %]
                <div class="alert alert-danger">
                    [% $user->gettext('Bericht konnte nicht gesendet werden. Bitte prüfen Sie die Email Addressen, die Sie eingegeben haben.') %]
                </div>
            [% /if %]
            <div class="card panel-info shadow-sm rounded">
                <div class="card-body" style="padding-left: 25px; padding-right: 25px;">

                    <div class="form-group row mb-3">
                        <label class="control-label">

                            [% $user->gettext('Empfänger auswählen') %]
                        </label>

                        <select name="eMailcontact[]" class="form-control" id="eMailcontact" multiple="multiple" style="width:100%;" >
                            [% foreach from=$Contacts item=contact %]
                                <option value="[% $contact.email %]">[% $contact.name %] &lt;[% $contact.email %]&gt; [%* [% if $contact.lastusedate %]([% $contact.lastusedate|date_format:"%d.%m.%Y" %])[% /if %] [% if $contact.countuses %]([% $contact.countuses %])[% /if %] *%]</option>
                            [% /foreach %]
                        </select>
                    </div>
                    <div class="form-group row mb-3">
                        <label class="control-label">
                            [% $user->gettext('Weitere E-Mail-Adresse') %] <span class="fa fa-info" title="[% $user->gettext('Email-Adressen von Empfänger, durch ; getrennt') %]"></span>

                        </label>
                        <input type="text" class="form-control" name="other_emails" placeholder="" style="width: 100%;">
                    </div>
                    <div class="form-group row mb-3">
                        <label class="control-label">
                            [% $user->gettext('Nachricht') %] <span class="fa fa-info" title="[% $user->gettext('zusätzliche Nachricht') %]"></span>

                        </label>
                        <textarea class="form-control" name="message" placeholder="Ihre Nachricht"  style="width: 100%; min-height: 150px;"></textarea>
                    </div>
                    <div class="form-group row mb-3">
                        <a onclick="$('#load').show();
                                    $('#hm').submit();" class="btn btn-outline-primary btnasicon">[% if $smarty.const.SHOWBUTTONSASIMAGES %]<img src="images/TicketButtons/SendMail.png" width="32" height="32" alt="" border="0" />[% else %][% $user->gettext('Mail senden') %][% /if %]</a>
                    </div>
                   

                    <p>  <div id="load" style="display:none;" style="font-style:italic"><img src="images/ajax-loader.gif" /> [% $user->gettext('Daten werden generiert') %]...</div></p>

                </div>
            </div>
        </div>
    </div>
</form>
<script>
    function hideProtocols() {
        if ($('#NotProtocol').is(":checked")) {
            $('.protocol').prop('checked', false);
        } else {
            $('.protocol').prop('checked', true);
        }
    }

    $(document).ready(function () {

        $('#eMailcontact').select2({theme: 'bootstrap-5',width: 'resolve'});
    });


</script>