<?php
    if(ENVIRONNEMENT == "DEV"){
        $titleHead = "<span class=\"badge\" style=\"background-color:red;\">DEV</span>";
    } elseif(ENVIRONNEMENT == "R7"){
        $titleHead = "<span class=\"badge\" style=\"background-color:red;\">R7</span>";
    } elseif(ENVIRONNEMENT == "PREPROD"){
        $titleHead = "<span class=\"badge\" style=\"background-color:red;\">PREPROD</span>";
    } elseif(ENVIRONNEMENT == "PROD"){
        $titleHead = "";
    }

    if(debug::isFile("debug")){
        $titleDebug = "<span class=\"badge\" style=\"background-color:red; margin-top:5px;\">MODE DEBUG</span>";
    } else {
        $titleDebug = "";
    }
?>
<main class="login">
    <div class="login-form">
        <img src="img/logo.png" alt="logo">
        <form id="formLogin">
            <?php echo "<div style=\"margin: -65px 0 0 2em; position: fixed;\">" . $titleHead . $titleDebug . "</div>"; ?>
            <div style="margin-bottom: -20px; display: none;" id="divAlerte"></div>
            <input type="hidden" id="from" name="from" value="login">
            <input type="hidden" id="event" name="event" value="<?php echo (core::ifGet("e")) ? core::getGet("e") : ""; ?>">
            <div>
                <label for="ident">Matricule ou identifiant</label>
                <input type="text" aria-label="Matricule ou identifiant" id="ident" value="" oninput="this.value = this.value.toUpperCase()" maxlength="8" name="ident" required>
            </div>
            <div>
                <label for="date">Date de naissance</label>
                <input type="date" pseudo="webkit-date-and-time-value" aria-label="Date d'ancienneté" id="date" value="" name="date" required>
                <input type="password" id="date_password" onchange="copyDate()" value="" name="password" style="display:none;">
            </div>
            <div>
                <button type="submit" id="submitLogin" onclick="saveDate()">Se connecter</button>
            </div>
        </form>
    <div>
    <script src="js/login-salarie.js"></script>
</main>

<script>
    function saveDate(){
        date = $('#date').val();
        $('#date_password').val(date);
    }
    
    function copyDate(){
        date = $('#date_password').val();
        $('#date').val(date);
    }
</script>