<link rel="stylesheet" href="includes/js/bootstrap-select-1.12.4/dist/css/bootstrap-select.min.css">
<script src="includes/js/bootstrap-select-1.12.4/dist/js/bootstrap-select.min.js"></script>

<div class="card panel-fcs-border shadow-sm">
    <div class="card-header">
        <h2 class="card-title-fcs">[% $user->gettext('Klassifikationen verwalten') %]</h2>
    </div>

    <div class="card-body">
        <div class="card panel-info shadow-sm rounded">
            <div class="card-body">
                <div class="row">
                    <div class="col-lg-12">
                        <form action="" method="post" name="hm" id="ManageClassificationsForm" enctype="multipart/form-data" class="form-inline fcs-form-padding">

                            <input type="hidden" name="pos" id="pos" value="[% $pos %]" />
                            <input type="hidden" name="sort" id="sort" value="[% $sort %]" />
                            <input type="hidden" name="sortorder" id="sortorder" value="[% $sortorder %]" />
                            <input type="hidden" name="export" id="export" value="0" />

                            <div class="form-group row mb-3">
                                <label  for="search">[% $user->gettext('Hauptgruppe') %]</label>
                                <select name="Filter[]" id="MG" class="form-control select" multiple>
                                    <option vlaue="0">-- [% $user->gettext('Alle') %] --</option>

                                </select>
                            </div>

                            <div class="form-group row mb-3">
                                <label  for="search">[% $user->gettext('Assettyp') %]</label>
                                <select name="Filter[hm_EPErrorPatternAssetType.DeviceTypeID][]" id="AssetType" class="form-control" multiple>
                                    <option vlaue="0">-- [% $user->gettext('Alle') %] --</option>

                                </select>
                            </div>

                            <div class="form-group row mb-3">
                                <input type='submit' class="btn btn-outline-secondary" value='[% $user->gettext('Filtern') %]'>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="card panel-info shadow-sm rounded">
            <div class="card-header">
                <div class="row">
                    <div class="col-lg-4 text-left" >
                        <h3 class="card-title text-left" style="font-size: 24px; display:inline">
                            [% $user->gettext('Klassifikationen')%]
                        </h3>
                        </span>
                    </div>
                    <div class="text-end">
                        [%*
                        <div class="form-group row mb-3">
                        <span class="btn btn-outline-secondary" id="CSVExport" onclick="OnExportCSV();"><span class="fa fa-download"></span> CSV Export</span>
                        <button id="btnAddPattern" class="btn btn-outline-secondary" type="button" role="button" onclick="OnAddPattern();">[% $user->gettext('Hinzufügen')%]</button>
                        </div>                        
                        *%]
                    </div>
                </div>
            </div>
            <div class="card-body">

                <table id="ErrorPatternTable" class="table">
                    <thead>
                        <tr>
                            <th>[% $user->gettext('Code HBG')%]</th>
                            <th>[% $user->gettext('DE')%]</th>
                            <th>[% $user->gettext('EN')%]</th>
                            <th></th>
                            <th>[% $user->gettext('Code UBG')%]</th>
                            <th>[% $user->gettext('DE')%]</th>
                            <th>[% $user->gettext('EN')%]</th>
                            <th></th>
                            <th>[% $user->gettext('Code')%]</th>
                            <th>[% $user->gettext('DE')%]</th>
                            <th>[% $user->gettext('EN')%]</th>
                            <th>[% $user->gettext('Tickets')%]</th>
                            <th>[% $user->gettext('Aktion')%]</th>
                        </tr>
                    </thead>
                    <tbody id="ErrorPatternTableBody">
                        [% foreach from=$Classifications item=cl %]
                            <tr>
                                <td>[% $cl.mg_id %]</td>
                                <td>[% $cl.mg_de %]</td>
                                <td>[% $cl.mg_en %]</td>
                                <td>
                                    [% if !$cl.mgtickets && !$cl.cntsubgroups  %]
                                        <a href="index.php?module=errorpatterns&event=deleteclassifiction&id=[% $cl.mg_id %]" class="btn btn-outline-secondary btn-sm" title="[% $user->gettext('HG löschen') %]"><span class="fa fa-times"></span></a> 
                                        [% /if %]                                
                                </td>
                                <td>[% $cl.sg_id %]</td>
                                <td>[% $cl.sg_de %]</td>
                                <td>[% $cl.sg_en %]</td>
                                <td>
                                    [% if !$cl.sgtickets %]
                                        <a href="index.php?module=errorpatterns&event=deleteclassifiction&id=[% $cl.sg_id %]" class="btn btn-outline-secondary btn-sm" title="[% $user->gettext('UBG löschen') %]"><span class="fa fa-times"></span></a> 
                                        [% /if %]
                                </td>
                                <td>[% $cl.mg_id %] -- [% $cl.sg_id %]</td>
                                <td>[% $cl.mg_de %] -- [% $cl.sg_de %]</td>
                                <td>[% $cl.mg_en %] -- [% $cl.sg_en %]</td>
                                <td>[% $cl.cnttickets %]</td>
                                <td>
                                    <a href="index.php?module=errorpatterns&event=editclassifications&mgid=[% $cl.mg_id %]&sgid=[% $cl.sg_id %]" class="btn btn-outline-secondary btn-sm"><span class="fa fa-pencil"></span></a>
                                </td>                                                                
                            </tr>
                        [% /foreach %]
                    </tbody>
                </table>
            </div>
        </div>

    </div>
</div>

<script>
    //$('#MG').select2({theme: 'bootstrap-5'});
</script>