<style>
    .select2-container {
        width: 100% !important;
    }
</style>

<form [% if !$KeyAccount %]action="index.php?module=assets&class=keyaccount&event=create" [% else %] action="index.php?module=assets&class=keyaccount&event=edit" [% /if %] method="post" name="hm" class="form-horizontal form-label-left">
    <div class="card panel-fcs-border shadow-sm">
        <div class="card-header">
            <div class="row">
                <div class="col-sm-6">
                    [% if $KeyAccount %]
                        <span class="fcs-card-title h2">[% $user->gettext('Key Account bearbeiten') %]</span>
                    [% else %]
                        <span class="fcs-card-title h2">[% $user->gettext('Key Account anlegen') %]</span>
                    [% /if %]
                </div>
                <div class="col-sm-6 text-end">
                    <div class="btn-group">
                        <input type="button" onclick="window.location.href = 'index.php?module=assets&class=keyaccount';" value="[% $user->gettext('Liste') %]" class="btn btn-outline-secondary"  />
                        <input type="submit" value="[% $user->gettext('Speichern') %]" class="btn btn-outline-primary"  />
                    </div>
                </div>
            </div>
        </div>
        <div class="card-body">
            <input type="hidden" name="save" value="1" />
            [% if $KeyAccount %]
                <input type="hidden" name="id" value="[% $KeyAccount->KeyAccountID %]" />
            [% /if %]
            <div class="form-group row mb-3">
                <label class="col-lg-2 control-label">[% $user->gettext('Name') %] *</label>
                <div class="col-lg-10">
                    <input type="text" name="Name"  value="[% $KeyAccount->Name %]" class="form-control required"  required="required" />
                </div>
            </div>


            <div class="form-group row mb-3">
                <label class="col-lg-2 control-label">[% $user->gettext('Gruppe') %]</label>
                <div class="col-lg-10">
                    <div>
                        <select name="GroupID" class="form-control">
                            [% foreach $Groups as $Group %]
                                <option [% if $KeyAccount->GroupID == $Group->group_id %]selected="selected"[% /if %] value="[% $Group->group_id %]">[% $Group->name %]</option>
                            [% /foreach%]
                        </select>
                    </div>
                </div>
            </div>

            <div class="form-group row mb-3">
                <label class="col-lg-2 control-label">[% $user->gettext('Aktiviert') %]</label>
                <div class="col-lg-10">
                    <input type="checkbox" [% if $KeyAccount->isActive %]checked="checked"[% /if %] name="Active">
                </div>
            </div>
        </div>
    </div>
</form>

<script>

    $('.select2').select2({theme: 'bootstrap-5',
        closeOnSelect: true,
        filter: true
    });

</script>

<!-- Component Mandant end -->
