<link rel="stylesheet" type="text/css" href="includes/js/select2/css/select2.min.css"/>
<script type="text/javascript" src="includes/js/select2/js/select2.full.min.js"></script>
<script type="text/javascript" src="includes/js/select2/js/i18n/de.js"></script>

<div class="card panel-info shadow-sm rounded">
    <div class="card-header">
        <div class="row">
            <div class="col-sm-6">
                <span class="fcs-card-title h4">[% $user->gettext('Filter kopieren') %]: [% $Filter.filtername %]</span>
            </div>
            <div class="col-sm-6 text-end">
                <div class="btn-group">

                </div>
            </div>
        </div>
    </div>
    <div class="card-body">
        <form action="index.php?module=ticketlist&event=copyTicketFilter" method="POST" id="copyFilter" >
            <input type="hidden" name="save" value="1" />
            <input type="hidden" name="id" value="[% $Filter.filterid %]" />

            <div class="form-group row mb-3">
                <label class="col-lg-4 control-label">[% $user->gettext('Bezeichnung') %]</label>
                <div class="col-lg-8">
                    <input type="text" class="form-control" name="FilterName" id="FilterName" maxlength="40"  value="[% $Filter.filtername %]"/>
                </div>
            </div>

            <div class="form-group row mb-3">
                <label class="col-lg-4 control-label">[% $user->gettext('Beschreibung') %]</label>
                <div class="col-lg-8">
                    <textarea class="form-control"  name="FilterDescr" id="FilterDescr" style="width: 100%;height: 3em;">[% $Filter.filterdescr %]</textarea>
                </div>
            </div>

            <div class="form-group row mb-3">
                <label class="col-lg-4 control-label">[% $user->gettext('Freigeben für') %]</label>
                <div class="col-lg-8">
                    <select class="form-control multiple2"  name="FilterGroups[]" id="FilterGroups" multiple="multiple" style="width:100%">
                        [% html_options options=$allgroups selected=$Filter.GroupIDs %]
                    </select>
                </div>
            </div>
            <input type="submit" class="btn btn-outline-primary" value="Speichern" onclick=""/>

        </form>
    </div>
</div>              

<script type="text/JavaScript" language="JavaScript">
                    
$("#FilterGroups").select2({theme: 'bootstrap-5'});
    
$('#copyFilter').submit(function(e) {
    e.preventDefault(); // don't submit multiple times
    this.submit(); // use the native submit method of the form element
    parent.$.fancybox.close();  
});    

</script>