<!-- Component CSV-Import begin -->
<script type="text/javascript" language="javascript">
    <!--
    function checkAll(el) {
        var objArray = document.getElementsByName("employee[]");
        if (objArray && objArray.length > 0) {
            for (i = 0; i < objArray.length; i++) {
                objArray[i].checked = el.checked;
            }
        }
    }

    function checkEmployee(id) {
        var objArray = document.getElementsByName("employee[]");
        if (objArray && objArray.length > 0) {
            for (i = 0; i < objArray.length; i++) {
                if (objArray[i].value == id) {
                    objArray[i].checked = (objArray[i].checked)
                        ? false : true;
                }
            }
        }
    }

    function switchPage(page) {
        document.getElementById('pos').value = page;
        submitForm();
    }

    function changeSort(sort) {
        var el  = document.getElementById("sort");
        var els = document.getElementById("order");
        if (el) {
            if (el.value == sort) {
                if (els) {
                    els.value = (els.value == "asc") ? "desc" : "asc";
                }
            } else {
                el.value = sort;
            }
            submitForm();
        }
    }

    function keyEvent(event) {
        if (event.keyCode == 13) submitForm();
    }

    var iMode = null;

    function importCheck(mode) {

        if (mode == 1 || isChecked()) {
               
            if(document.getElementById('csvFormat2') == undefined || !document.getElementById('csvFormat2').checked){
    [% if $ADUpdate %]
                    document.getElementById("iMode").value = mode;
                    submitForm();
    [% else %]
                    iMode = mode;
                    $("#dialog-PopUpFrameContent").dialog('open');
    [% /if %]
                } else {
                    document.getElementById("iMode").value = mode;

                    submitForm();
                }
            } else {
                alert("[% $user->gettext('Bitte selektieren Sie min. einen Mitarbeiter.') %]");
            }
        }

        function isChecked() {
            var objArray = document.getElementsByName("employee[]");
            if (objArray && objArray.length > 0) {
                for (i = 0; i < objArray.length; i++) {
                    if (objArray[i].checked) {
                        return true;
                    }
                }
            }
            return false;
        }

        function closePopUpFrame() {
            var el = document.getElementById("PopUpFrame");
            var obj = document.getElementById("PopUpFrameContent");
            el.style.visibility = "hidden";
            obj.style.visibility = "hidden";
        }

        function startImport() {
            var el1  = document.getElementById("uMode");
            var el2  = document.getElementById("cMode");
            
            var pwd1 = $("#passwd1").val();
            var pwd2 = $("#passwd2").val();

        if (el2.checked) {
            $("#FormcMode").val('Y');
        }
        if (el1.checked) {
            $("#FormuMode").val('Y');
        }
        
            $("#Formpasswd1").val($("#passwd1").val());
            $("#Formpasswd2").val($("#passwd2").val());
        
            if (el1 && el2 && (el1.checked || el2.checked)) {
                if(el1.checked)
                {
                    [% if !$ADImport %]
                    if (pwd1 != pwd2) {
                        alert("[% $user->gettext('Passwörter stimmen nicht überein. Bitte kontrollieren Sie Ihre Eingabe.') %]");
                    } else {
                        if (pwd1 != '') {
                            document.getElementById("iMode").value = iMode;
                            submitForm();
                        } else {
                            alert("[% $user->gettext('Bitte geben Sie ein Standardpasswort ein') %]");
                        }
                    }
                    [% else %]
                      document.getElementById("iMode").value = iMode;
                      submitForm();
                    [% /if %]
                }
                else
                {
                    document.getElementById("iMode").value = iMode;
                    submitForm();
                    //$("#hm").submit();
                }

            } else {
                alert("[% $user->gettext('Bitte geben Sie an als was Sie den Mitarbeiter anlegen wollen') %]");
            }
        }

        function collapseTr() {
        [% if !$ADImport %]
            var el = document.getElementById('invisible2');
            if(el.style.display=="none") {
                el.style.display="";
                el.style.visibility='visible';
            } else {
                el.style.display="none";
                el.style.visibility='hidden';
            }
        
            var el = document.getElementById('invisible1');
            if(el.style.display=="none") {
                el.style.display="";
                el.style.visibility='visible';
            } else {
                el.style.display="none";
                el.style.visibility='hidden';
            }
            [% /if %]

        }


        // -->
</script>


<form action="" method="post" name="hm" id="hm" enctype="multipart/form-data" style="margin:0;padding:0;" 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="order" id="order" value="[% $order %]" />
    <input type="hidden" name="iMode" id="iMode" value="" />

    <input type="hidden" name="cMode" id="FormcMode" value="" />
    <input type="hidden" name="uMode" id="FormuMode" value="" />
    <input type="hidden" name="passwd1" id="Formpasswd1" value="" />
    <input type="hidden" name="passwd2" id="Formpasswd2" value="" />

    <!-- ###CONTENT### begin -->
    <div class="card panel-fcs-border shadow-sm">
        <div class="card-header">
            <span class="fcs-card-title h2">[% if $ADImport %][% $user->gettext('Mitarbeiter aus ActiveDirectory importieren') %][% else %][% if $ADUpdate %][% $user->gettext('Mitarbeiter aus ActiveDirectory aktualisieren') %][% else %][% $user->gettext('Mitarbeiter aus einer CSV-Datei importieren') %][% /if %][% /if %]</span>
        </div>
        <div class="card-body">
            <div class="card panel-info shadow-sm rounded">
                <div class="card-body">
                    <div class="row">
                        <div class="col-lg-6">
                             [% if !$ADImport && !$ADUpdate %]
                         <p>[% $user->gettext('Hier k&ouml;nnen Sie Kontakte und / oder Benutzer durch Datenimport aus einer CSV-Datei anlegen.') %]</p>
                                <p>[% $user->gettext('W&auml;hlen Sie das Format, in dem die Daten in der CSV-Datei Vorliegen:') %]</p>
                                    [% if $hmcompany != "3D CAD GMBH" %]
                                        <label for="csvFormat1">
                                            <input type="radio" id="csvFormat1" name="csvFormat" value="csvFormat1" [% if $hmcompany != "3D CAD GMBH" || $csvmode == 1 %]checked="checked"[% /if %] onchange="submitForm();">
                                            <strong>
                                            [% $user->gettext('Vorname') %];[% $user->gettext('Name') %];[% $user->gettext('Anmeldename') %];[% $user->gettext('Email') %];[% $user->gettext('Telefon') %];[% $user->gettext('FAX') %];
                                            [% $user->gettext('Mobil') %];[% $user->gettext('Personalnummer') %];[% $user->gettext('Firma') %];[% $user->gettext('Kostenstelle') %];[% $user->gettext('Abteilung') %];[% $user->gettext('Mandant') %];                                                                                        
                                            <br/>
                                            [% $user->gettext('Geb&auml;ude') %];[% $user->gettext('Raum') %];[% $user->gettext('Stockwerk') %];[% $user->gettext('Position') %];
                                            [% $user->gettext('Stra&szlig;e') %];[% $user->gettext('Plz') %];[% $user->gettext('Ort') %];[% $user->gettext('Bundesland') %];[% $user->gettext('Land') %];
                                            [% $user->gettext('Zus&auml;tzliche Informationen') %];
                                            [% $user->gettext('Wichtiger Kontakt (1 = Ja)') %];[% $user->gettext('Kontakt erh&auml;lt E-Mails (1 = Ja)') %];[% $user->gettext('Lieferant (1 = Ja)') %];                                        
                                            </strong>                                            
                                        </label>
                                        <br />
                                    [% /if %]
                                    <label for="csvFormat2">
                                        <input type="radio" id="csvFormat2" name="csvFormat" value="csvFormat2" [% if ($hmcompany == "3D CAD GMBH" && $csvmode != 1 ) || $csvmode == 2 %]checked="checked"[% /if %] onchange="submitForm();">
                                        [% if $hmcompany == "3D CAD GMBH" %]
                                            [% $user->gettext('Vorname') %];[% $user->gettext('Name') %];[% $user->gettext('Anmeldename') %];[% $user->gettext('Passwort') %];[% $user->gettext('Email') %];[% $user->gettext('Telefon') %];[% $user->gettext('Firma') %];<span title="[% $user->gettext('Bezahlter Support') %]">[% $user->gettext('(Ja/Nein)') %]</span>;
                                            <span title="[% $user->gettext('Anwender CAD (Wartung) / Anwender CAD (keine Wartung)') %]" >[% $user->gettext('(Ja/Nein/Leer)') %]</span>;
                                            <span title="[% $user->gettext('Anwender DM Vault (Wartung) / Anwender DM Vault (keine Wartung)') %]" >[% $user->gettext('(Ja/Nein/Leer)') %]</span>;
                                            <span title="[% $user->gettext('Anwender DM ProFile (Wartung)') %]" >[% $user->gettext('(Ja/Nein/Leer)') %]</span></b>
                                        [% else %]
                                            [% $user->gettext('Vorname') %];[% $user->gettext('Name') %];[% $user->gettext('Anmeldename') %];[% $user->gettext('Passwort') %];[% $user->gettext('Email') %];[% $user->gettext('Telefon') %];[% $user->gettext('Firma') %];[% $user->gettext('Priorisierter Kontakt') %][% $user->gettext('(Ja/Nein)') %] [% $user->gettext('gefolgt von Benutzergruppen-Namen getrennt durch Semikolons') %]
                                        [% /if %]
                                </label>
                                    <div class="form-group row mb-3">
                                        <label for="filter" class="control-label">[% $user->gettext('Filter:') %]</label>
                                        <input type="text" class="form-control" id="filter" name="filter" value="[% $filter %]" size="20" onkeyup="keyEvent(event);" autocomplete="off" />
                                    </div>
                                    
                                    [% if $ADUpdate %]
                                    <div>
                                        <label>[% $user->gettext("Zu aktualisierende Felder:") %]</label>
                                        &nbsp;<label><input type="checkbox" name="fields[Name]" value="1"[% if $fields.Name == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Name') %]</label>
                                        &nbsp;<label><input type="checkbox" name="fields[Email]" value="1" [% if $fields.Email == 1 %] checked="checked"[% /if %] /> [% $user->gettext('E-Mail') %]</label>
                                        &nbsp;<label><input type="checkbox" name="fields[Telefon]" value="1" [% if $fields.Telefon == 1 %] checked="checked"[% /if %]  /> [% $user->gettext('Telefon') %]</label>
                                        &nbsp;<label><input type="checkbox" name="fields[Fax]" value="1" [% if $fields.Fax == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Fax') %]</label>
                                        &nbsp;<label><input type="checkbox" name="fields[Handy]" value="1" [% if $fields.Handy == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Handy') %]</label>
                                        &nbsp;<label><input type="checkbox" name="fields[Company]" value="1" [% if $fields.Company == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Firma') %]</label>
                                        &nbsp;<label><input type="checkbox" name="fields[Room]" value="1" [% if $fields.Room == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Raum') %]</label>
            
                                        [% if $CostCenter %]
                                            &nbsp;<label><input type="checkbox" name="fields[CostCenter]" value="1" [% if $fields.CostCenter == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Kostenstelle') %]</label>
                                            [% /if %]
                                        &nbsp;<label><input type="checkbox" name="fields[Department]" value="1" [% if $fields.Department == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Abteilung') %]</label>
                                    </div>

                                 [% /if %]
                            
                    [% /if %]
                        </div>
                        <div class="col-lg-2">
                            <h6>[% $user->gettext("Format des Namens") %]</h6>
                            <div class="form-check">
                              <input class="form-check-input" type="radio" name="PrenameSurename" value="SurenameFirst" id="PrenameSurename1" [% if !$PrenameSurename || $PrenameSurename == 'SurenameFirst' %]checked[% /if %]>
                              <label class="form-check-label" for="PrenameSurename1">
                            [% $user->gettext("Nachname, Vorname (default)") %]  </label>
                            </div>
                            <div class="form-check">
                              <input class="form-check-input" type="radio" name="PrenameSurename" value="PrenameFirst" id="PrenameSurename2" [% if $PrenameSurename == 'PrenameFirst' %]checked[% /if %]>
                              <label class="form-check-label" for="PrenameSurename2">
                                [% $user->gettext("Vorname Nachname") %]
                              </label>
                            </div>

                            <h6>[% $user->gettext("Eindeutiges Kennzeichen von Benutzern") %]</h6>
                            <div class="form-check">
                              <input class="form-check-input" type="radio" name="useAsIdentifier" value="Name" id="useAsIdentifier1" [% if !$useAsIdentifier || $useAsIdentifier == 'Name' %]checked[% /if %]>
                              <label class="form-check-label" for="useAsIdentifier1">
                            [% $user->gettext("Name (default)") %] </label>
                            </div>
                            <div class="form-check">
                              <input class="form-check-input" type="radio" name="useAsIdentifier" value="eMail"  id="useAsIdentifier2" [% if $useAsIdentifier == 'eMail' %]checked[% /if %]>
                              <label class="form-check-label" for="useAsIdentifier2">
                                [% $user->gettext("Mailadresse") %]
                              </label>
                            </div>

                        </div>
                        <div class="col-lg-4 text-end">
                            <div class="btn btn-group">
                            [% if !$ADImport && !$ADUpdate %]
                                <a href="index.php?module=upload&event=SimpleFileUpload[% if ($hmcompany == "3D CAD GMBH" && $csvmode != 1 ) || $csvmode == 2 %]&mode=2[% /if %]" data-fancybox-type="iframe" class="btn btn-outline-primary dialog">[% $user->gettext('Datei hochladen') %]</a>
                            [% /if %]
        
        
                            [% if $ADUpdate %]
                                <a href="javascript:importCheck(0);"  class="btn button-default" >[% $user->gettext('Auswahl aktualisieren') %]</a>
                                <a href="javascript:importCheck(1);"  class="btn btn-outline-secondary" >[% $user->gettext('Alle aktualisieren') %]</a>
                            [% else %]
                                <a href="javascript:importCheck(0);" class="btn btn-outline-primary" >[% $user->gettext('Auswahl importieren') %]</a>
                                <a href="javascript:importCheck(1);" class="btn btn-outline-primary" >[% $user->gettext('Alle importieren') %]</a>
        
                            [% /if %]
                            </div>
                             [% if $updated %]<p>Daten wurden importiert...</p>[% /if %]
                        </div>
                    </div>
                </div>
            </div>
        
            <div class="card panel-info shadow-sm rounded">
                <div class="card-header">
                    <span class="fcs-card-title h3">[%$user->gettext('Mitarbeiterliste')%]</span><span id="info" class="fcs-card-title h4"> - [% $entries %] [% $user->gettext('Mitarbeiter gefunden') %]</span>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                                [% if $csvmode == 2 %]


                        <tr class="fields">
                            <th style="text-align:center !important;">
                                <input type="checkbox" id="checkall" onclick="checkAll(this);" />
                            </th>
                            <th onclick="changeSort('name');">
                                [% $user->gettext('Name') %]
                                [% if $sort == "name" %]
                                    &nbsp;
                                    <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                                [% /if %]
                            </th>
                            <th onclick="changeSort('username');">
                                [% $user->gettext('Anmeldename') %]
                                [% if $sort == "username" %]
                                    &nbsp;
                                    <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                                [% /if %]
                            </th>
                            <th onclick="changeSort('email');">
                                [% $user->gettext('E-Mail') %]
                                [% if $sort == "email" %]
                                    &nbsp;
                                    <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                                [% /if %]
                            </th>
                            <th onclick="changeSort('phone');">
                                [% $user->gettext('Telefon') %]
                                [% if $sort == "phone" %]
                                    &nbsp;
                                    <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                                [% /if %]
                            </th>

                            <th onclick="changeSort('company');">
                                [% $user->gettext('Firma') %]
                                [% if $sort == "company" %]
                                    &nbsp;
                                    <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                                [% /if %]
                            </th>


                            <th onclick="changeSort('password');">
                                [% $user->gettext('Passwort') %]
                                [% if $sort == "password" %]
                                    &nbsp;
                                    <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                                [% /if %]
                            </th>
                            <th onclick="changeSort('important');">
                                [% if $hmcompany == "3D CAD GMBH" %]
                                    [% $user->gettext('Bezahler Support') %]
                                [% else %]
                                    [% $user->gettext('Prio. Kontakt') %]
                                [% /if %]
                                [% if $sort == "important" %]
                                    &nbsp;
                                    <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                                [% /if %]
                            </th>
                            <th style="cursor: default;">
                                [% $user->gettext('Gruppen') %]
                            </th>

                        </tr>
                        </thead>
                        <tbody>
                            [% foreach from=$employees item=employee %]
                                <tr>
                                    <td style="text-align:center !important;"><input type="checkbox" name="employee[]" value="[% $employee.employeeid %]" /></th>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);"[% if $employee.importedFlag %]class="import" title="Erfolgreich importiert / aktualisiert"[% elseif $Tools->FCS_Count($employee.errors) %]class="error" title="Fehler beim Import"[% /if %]>[% $employee.name %]&nbsp;</th>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.username %]&nbsp;</th>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);" [% if $employee.emailErr %]class="error" title="Keine gültige Mailadresse" [% /if %]>[% $employee.email %]&nbsp;</th>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.phone %]&nbsp;</th>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.company %]&nbsp;</th>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.password %]&nbsp;</th>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);" style="text-align: center;">[% if $employee.important == 1 %]<img src="images/tick.png" alt="[% $user->gettext('Priorisierter Kontakt') %]" title="[% $user->gettext('Priorisierter Kontakt') %]" />[% /if %]&nbsp;</th>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);">[% $Tools->FCS_Implode($employee.groups, '<br /> ') %]&nbsp;</th>
                                </tr>
                            [% foreachelse %]
                                <tr class="row1">
                                    <td colspan="[% if $ADImport %]14[% else %]12[% /if %]" style="text-align:center !important;">[% if $ADUpdate %][% $user->gettext('Keine Mitarbeiter zum aktualisieren gefunden...') %][% else %][% $user->gettext('Keine Mitarbeiter zum importieren gefunden...') %][% /if %]</th>
                                </tr>
                            [% /foreach %]
                        </tbody>
                    </table>

                [% else %]

                    <tr class="fields">
                        <th style="text-align:center !important;">
                            <input type="checkbox" id="checkall" onclick="checkAll(this);" />
                        </th>
                        <th onclick="changeSort('name');">
                            [% $user->gettext('Name') %]
                            [% if $sort == "name" %]
                                &nbsp;
                               <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        <th onclick="changeSort('username');">
                            [% $user->gettext('Benutzername') %]
                            [% if $sort == "username" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        [% if $ADImport %]
                            <th onclick="changeSort('UsernameErr');">
                                [% $user->gettext('Benutzer') %]
                                [% if $sort == "UsernameErr" %]
                                    &nbsp;
                                    <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                                [% /if %]
                            </th>
                            <th onclick="changeSort('ContactExist');">
                                [% $user->gettext('Kontakt') %]
                                [% if $sort == "ContactExist" %]
                                    &nbsp;
                                    <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                                [% /if %]
                            </th>
                        [% /if %]
                        <th onclick="changeSort('email');">
                            [% $user->gettext('E-Mail') %]
                            [% if $sort == "email" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        <th onclick="changeSort('telefon');">
                            [% $user->gettext('Telefon') %]
                            [% if $sort == "phone" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        
                       
                        <th onclick="changeSort('fax');">
                            [% $user->gettext('Fax') %]
                            [% if $sort == "fax" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        <th onclick="changeSort('handy');">
                            [% $user->gettext('Mobil') %]
                            [% if $sort == "mobil" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        <th onclick="changeSort('personalno');">
                            [% $user->gettext('Personalnummer') %]
                            [% if $sort == "personalno" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>

                        <th onclick="changeSort('company');">
                            [% $user->gettext('Firma') %]
                            [% if $sort == "company" %]
                                &nbsp;
                               <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        
                        <th onclick="changeSort('CostCenter');">
                            [% $user->gettext('Kostenstelle') %]
                            [% if $sort == "CostCenter" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>

                        <th onclick="changeSort('department');">
                            [% $user->gettext('Abteilung') %]
                            [% if $sort == "department" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>    
                        <th onclick="changeSort('mandant');">
                            [% $user->gettext('Mandant') %]
                            [% if $sort == "mandant" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>                                                 

                        <th onclick="changeSort('building');">
                            [% $user->gettext('Geb&auml;ude') %]
                            [% if $sort == "building" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        <th onclick="changeSort('room');">
                            [% $user->gettext('Raum') %]
                            [% if $sort == "room" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        <th onclick="changeSort('floor');">
                            [% $user->gettext('Stockwerk') %]
                            [% if $sort == "floor" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                            <th onclick="changeSort('com_position');">
                                [% $user->gettext('Position') %]
                                [% if $sort == "com_position" %]
                                    &nbsp;
                                    <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                                [% /if %]
                            </th>
                        
                        <th onclick="changeSort('street');">
                            [% $user->gettext('Stra&szlig;e') %]
                            [% if $sort == "street" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        <th onclick="changeSort('plz');">
                            [% $user->gettext('PLZ') %]
                            [% if $sort == "plz" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>        
                        <th onclick="changeSort('city');">
                            [% $user->gettext('Stadt') %]
                            [% if $sort == "city" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        <th onclick="changeSort('state');">
                            [% $user->gettext('Bundesland') %]
                            [% if $sort == "state" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        <th onclick="changeSort('country');">
                            [% $user->gettext('Land') %]
                            [% if $sort == "country" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>
                        
                        <th onclick="changeSort('misc');">
                            [% $user->gettext('Info') %]
                            [% if $sort == "misc" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>     
                        <th onclick="changeSort('important');">
                            [% $user->gettext('Wichtiger Kontakt') %]
                            [% if $sort == "important" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>        
                        <th onclick="changeSort('sendEmails');">
                            [% $user->gettext('Erh&auml;lt Emails') %]
                            [% if $sort == "sendEmails" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>        
                        <th onclick="changeSort('eMailTicketAddress');">
                            [% $user->gettext('Lieferant') %]
                            [% if $sort == "eMailTicketAddress" %]
                                &nbsp;
                                <span class="fa fa-chevron-[% if $order == "desc" %]down[% else %]up[% /if %]"></span>
                            [% /if %]
                        </th>                                
                        
                    </tr>
                    </thead>
                    <tbody>
                        [% foreach from=$employees item=employee %]
                            <tr >
                                <td style="text-align:center !important;"><input type="checkbox" name="employee[]" value="[% $employee.employeeid %]" /></th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);" [% if $employee.importedFlag %]class="import" title="Erfolgreich importiert" [% /if %]>[% $employee.name %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);" [% if $employee.usernameerr %]class="error" title="In DB schon vorhanden" [% /if %]>[% $employee.username %]&nbsp;</th>
                                [% if $ADImport %]
                                    <td style="text-align:center !important;" onclick="checkEmployee([% $employee.employeeid %]);" ><img src="images/[% if $employee.usernameerr %]tick.png" alt="[% $user->gettext('Der Benutzer existiert bereits') %]" title="[% $user->gettext('Der Benutzer existiert bereits') %]" [% else %]publish_x.png" alt="[% $user->gettext('Benutzer kann importiert werden') %]" title="[% $user->gettext('Benutzer kann importiert werden') %]"[% /if %]/></th>
                                    <td style="text-align:center !important;" onclick="checkEmployee([% $employee.employeeid %]);" ><img src="images/[% if $employee.contactexist %]tick.png"  alt="[% $user->gettext('Der Kontakt existiert bereits') %]" title="[% $user->gettext('Der Kontakt existiert bereits') %]" [% else %]publish_x.png"  alt="[% $user->gettext('Kontakt kann importiert werden') %]" title="[% $user->gettext('Kontakt kann importiert werden') %]" [% /if %]/></th>
                                    [% /if %]
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.email %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.phone %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.fax %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.mobil %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.personalno %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.company %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.CostCenter %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.department %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.mandant %]&nbsp;</th>                                
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.building %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.room %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.floor %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.com_position %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.street %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.plz %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.city %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.state %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.country %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.misc %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.important %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.sendEmails %]&nbsp;</th>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.eMailTicketAddress %]&nbsp;</th>
                                                                
                            </tr>
                        [% foreachelse %]
                            <tr class="even">
                                <td colspan="[% if $ADImport %]26[% else %]25[% /if %]" style="text-align:center !important;">[% if $ADUpdate %][% $user->gettext('Keine Mitarbeiter zum aktualisieren gefunden...') %][% else %][% $user->gettext('Keine Mitarbeiter zum importieren gefunden...') %][% /if %]</th>
                            </tr>
                        [% /foreach %]
                        
                        
                    </tbody>
                    
                        </table>
                                [% if $pages > 1 %]
                                     [% $Paging %]
                                 [% /if %]
                             [% /if %]
                                   

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


<div id="dialog-PopUpFrameContent" >
    	<div class="card panel-info shadow-sm rounded">
		<div class="card-header">
			<span class="fcs-card-title h5">[% $user->gettext('Standardangaben f&uuml;r die Mitarbeiter') %]</span>
		</div>
		<div class="card-body">
			<div class="form-group row mb-3 row">
				<label for="cMode" class="control-label col-lg-10">[% $user->gettext('Als Kontakt anlegen:') %]</label>
				<div class="col-lg-2">
					<input type="checkbox" name="cMode" value="Y" id="cMode" />
				</div>
			</div>
			<div class="form-group row mb-3 row">
				<label for="uMode" class="control-label col-lg-10">[% $user->gettext('Als Benutzer anlegen:') %]</label>
				<div class="col-lg-2">
					<input type="checkbox" name="uMode" value="Y" id="uMode" onclick="collapseTr()"/>
				</div>
			</div>
            [% if !$ADImport %]

            <div class="form-group row mb-3 row" id="invisible1" style="display:none; visibility:hidden;">
				<label for="passwd1" class="control-label col-lg-4">[% $user->gettext('Passwort') %]:</label>  
				<div class="col-lg-8">
					<input type="password" class="form-control" name="passwd1" id="passwd1" autocomplete="off"  />
				</div>
			</div>
            <div class="form-group row mb-3 row" id="invisible2" style="display:none; visibility:hidden;">
				<label for="passwd2" class="control-label col-lg-4">[% $user->gettext('Passwort best&auml;tigen') %]:</label>  
				<div class="col-lg-8">
					<input type="password" class="form-control" name="passwd2" id="passwd2" autocomplete="off"  />
				</div>
			</div>
            [% /if %]
			<div class="btn-group row text-center">
				<div class="col-lg-6">
					<input type="button" class="btn btn-outline-primary" value="[% $user->gettext('Importieren') %]" onclick="startImport();" />
				</div>
				<div class="col-lg-6">
					<input type="button" class="btn btn-outline-secondary" value="[% $user->gettext('Abbruch') %]" onclick="$('#dialog-PopUpFrameContent').dialog('close');" />
				</div>
			</div>
		</div>
	</div>
</div>

<!-- Component CSV-Import end -->
<script type="text/javascript" language="javascript">
    <!--
                        
    $(".dialog").fancybox({
        maxWidth  : 500,
        maxHeight : 300,
        closeClick : false,
        autoOpen: false,
        onClosed   : function() {
            parent.location.reload(true);
        }
    });
                    
    $("#dialog-PopUpFrameContent").dialog({
        autoOpen: false,
        maxWidth  : 500,
        maxHeight : 300,
        closeClick : false,
        onClosed   : function() {
            parent.location.reload(true);
        },
        beforeClose: function( event, ui ) {
                  
        }
    });
                    
                    
    // -->
</script>
