<form action = 'index.php?module=settings&event=[% if $Definition->FilterDefinitionID %]UpdateFilterDefinition&id=[% $Definition->FilterDefinitionID %][% else %]AddNewFilterDefinition[% /if %]' method='post' class="form-horizontal form-label-left">
    <input type="hidden" value="1" name="save">
    <div class='card panel-fcs-border shadow-sm'>
        <div class='card-header'>
            <div class="row">
                <div class="col-sm-8">
                    <div class='fcs-card-title h3'>
                        [% if $Definition->FilterDefinitionID %]
                            [% $user->gettext('Definition aktualisieren') %]
                        [% else %]
                            [% $user->gettext('Definition erstellen') %]
                        [% /if %]
                    </div>
                </div>
                <div class="col-sm-4 text-end">
                    [% if $user->hasRight(36) %]
                        <input type="submit" class='btn btn-outline-primary' value="[% $user->gettext('Speichern') %]">
                    [% /if %]

                </div>
            </div>
        </div>
        <div class="card-body">
            [% if $error %]
                <div class='row'>
                    <div class='col-sm-12'>
                        <div class='alert alert-danger'>
                            [% $user->gettext('<b>Fehler</b>: Diese Aktion konnte nicht ausgeführt werden.') %]
                        </div>
                    </div>
                </div>
            [% /if %]
            <div class="card panel-info shadow-sm rounded">
                <div class="card-header">
                    <h3 class="card-title">[% $user->gettext('Definitionsdaten') %]</h3>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="form-group row mb-3">
                                <label class="col-lg-4 control-label">[% $user->gettext('Name') %]</label>
                                <div class="col-lg-8">
                                    <input type="text" class="form-control" name="FilterDefinitionName" value="[% $Definition->FilterDefinitionName %]"/>
                                </div>
                            </div>
                            <div class="form-group row mb-3">
                                <label class="col-lg-4 control-label">[% $user->gettext('Filter') %]</label>
                                <div class="col-lg-8">
                                    <select class="form-control select2" name="FilterID">
                                        [% foreach from=$TicketFilterList item=$Filter key=$filterid %]
                                            <option value="[% $filterid%]" [% if $Definition->FilterID == $filterid %]selected="selected"[% /if %]>[% $Filter %]</option>
                                        [% /foreach %]
                                    </select>
                                </div>
                            </div>
                            <div class="form-group row mb-3">
                                <label class="col-lg-4 control-label">[% $user->gettext('Aktion') %]</label>
                                <div class="col-lg-8">
                                    <select class="form-control select2" name="Action">
                                        <option value='1' [% if $Definition->Action == 1 %]selected='selected'[% /if %]>[% $user->gettext('Ticket schließen') %]</option>
                                        <option value='2' [% if $Definition->Action == 2 %]selected='selected'[% /if %]>[% $user->gettext('Ticket löschen') %]</option>
                                    </select>
                                </div>
                            </div>
                                    <div class="form-group row mb-3">
                                <label class="col-lg-4 control-label">[% $user->gettext('Aktiviert?') %]</label>
                                <div class="col-lg-8">
                                        <input type='checkbox' name='IsActive' [% if $Definition->IsActive  %]checked='checked'[% /if %]>
                                </div>
                            </div>           
                        </div>
                    </div>
                </div>
            </div>         
        </div>
    </div>
</form>
<script>
    $(".select2").select2({theme: 'bootstrap-5'});
</script>