<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Mes Informations</title>
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
    <link rel="stylesheet" href="../../css/RH/rh.css">
    <link rel="stylesheet" href="../../css/RH/style.css">
    <link rel="icon" href="../../media/img/logoIcon.ico" type="image/x-icon" />
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 0;
        }
        .container {
            max-width: 1200px;
            margin: auto;
            padding: 20px;
        }
        .info-card {
            background-color: white;
            padding: 20px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
            margin-bottom: 20px;
            border-radius: 8px;
        }
        .info-card h2 {
            border-bottom: 2px solid #0f431f;
            padding-bottom: 10px;
            margin-bottom: 20px;
        }
        .info-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }
        .info-table th, .info-table td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }
        .info-table th {
            background-color: #f8f8f8;
            color: #333;
        }
        .info-table input {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        .action-btn {
            display: inline-block;
            padding: 10px 20px;
            color: white;
            background-color: #0f431f;
            text-decoration: none;
            border-radius: 5px;
            margin: 10px 0;
            cursor: pointer;
        }
        .action-btn:hover {
            background-color: #0a2f15;
        }
        .non-editable {
            background-color: #e9e9e9;
        }

.logo-container img {
    width: 200px;
    height: 50px;
    cursor: pointer;
}
.categories {
    display: flex;
    gap: 15px;
    margin-left: 50px;
}
.categories a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}
.categories a:hover {
    text-decoration: underline;
}
.user-section {
    display: flex;
    align-items: center;
    margin-right: 20px;
}
.user-name {
    margin-right: 15px;
    font-size: 16px;
    font-weight: bold;
}
.logout-container {
    display: flex;
    align-items: center;
}
.logout-container img {
    width: 25px;
    height: 25px;
    margin-left: 10px;
    cursor: pointer;
}

.container {
            max-width: 1200px;
            margin: auto;
            padding: 20px;
        }
        .info-card {
            background-color: white;
            padding: 20px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
            margin-bottom: 20px;
            border-radius: 8px;
        }
        .info-card h2 {
            border-bottom: 2px solid #0f431f;
            padding-bottom: 10px;
            margin-bottom: 20px;
        }
        .info-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }
        .info-table th, .info-table td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }
        .info-table th {
            background-color: #f8f8f8;
            color: #333;
        }
        .info-table input {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        .action-btn {
            display: inline-block;
            padding: 10px 20px;
            color: white;
            background-color: #0f431f;
            text-decoration: none;
            border-radius: 5px;
            margin: 10px 0;
            cursor: pointer;
        }
        .action-btn:hover {
            background-color: #0f431f;
        }
        .non-editable {
            background-color: #e9e9e9;
        }

                /* Styles pour le popup */
        .popup {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: #fff; /* Blanc */
            padding: 20px;
            border: 2px solid #4a0777; /* Bordure couleur thème */
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
            z-index: 1000;
            border-radius: 10px;
            text-align: center;
            width: 300px; /* Largeur fixe */
        }
        .popup h4 {
            margin: 0 0 15px 0;
            font-size: 1.5em;
            color: #4a0777; /* Couleur de texte */
        }
        .popup p {
            font-size: 1.2em;
            margin: 5px 0; /* Espacement entre les lignes */
            color: #333; /* Couleur de texte */
        }
        .popup button {
            background-color: #0f431f;
            color: white;
            border: none;
            padding: 10px;
            cursor: pointer;
            border-radius: 5px; /* Arrondir les coins */
            margin-top: 15px; /* Espacement au-dessus du bouton */
        }
        .popup button:hover {
            background-color: #0f431f;
        }

        /* Sablier de chargement */
        .loading-text {
            font-size: 1.2em;
            color: #555;
        }
        .loading-icon {
            margin-left: 10px;
            width: 20px;
            height: 20px;
            vertical-align: middle;
        }

        .file-upload-label {
            display: inline-block;
            padding: 10px 15px;
            cursor: pointer;
            background-color: #e0e0e0; /* Couleur de fond gris clair */
            color: #333; /* Couleur du texte gris foncé */
            border-radius: 5px;
            margin-bottom: 10px; /* Espacement entre le label et le bouton */
            text-align: center; /* Centrer le texte */
            border: 1px solid #ccc; /* Bordure grise */
            transition: background-color 0.3s; /* Transition pour l'effet hover */
        }

        .file-upload-label:hover {
            background-color: #d0d0d0; /* Couleur de fond au survol */
        }

        .file-name {
            display: block;
            margin-top: 5px; /* Espacement entre le label et le nom du fichier */
            color: #555; /* Couleur du texte du nom de fichier */
        }

        .document-select {
            width: 100%; /* Prend toute la largeur */
            padding: 10px; /* Espacement interne */
            border: 1px solid #ddd; /* Bordure grise */
            border-radius: 4px; /* Coins arrondis */
            margin-bottom: 10px; /* Espacement sous le sélecteur */
            font-size: 16px; /* Taille du texte */
            color: #333; /* Couleur du texte */
        }



    </style>
</head>
<body>

    <div class="header w3-bar w3-card-4 w3-dark-blue">
        <!-- Logo pour retourner à l'accueil -->
        <div class="logo-container w3-bar-item">
            <img src="../../media/img/logoWhite.png" alt="Logo Accueil" class="w3-image" style="width:150px; height:40px;">
        </div>
    
        <!-- Bouton burger pour petit écran -->
        <a href="javascript:void(0)" class="w3-bar-item w3-button w3-hide-large w3-right w3-padding-16" onclick="toggleMenu()">☰</a>
    
        <!-- Catégories dans le header -->
        <div id="menu" class="categories w3-hide-small w3-hide-medium w3-bar-item">
            <a href="./rh.html" class="w3-bar-item w3-button">Accueil</a>
            <a href="./gestion_personnel.html" class="w3-bar-item w3-button">Gestion du personnel</a>
            <a href="./gestion-heures.html" class="w3-bar-item w3-button">Heures</a>
            <a href="./candidature.html" class="w3-bar-item w3-button">Candidatures</a>
            <a href="./mes-informations.html" class="w3-bar-item w3-button">Mes informations et documents</a>
        </div>
    
        <!-- Section utilisateur avec déconnexion -->
        <div class="user-section w3-right w3-hide-small w3-hide-medium">
            <div class="user-name">
                Alice BERGER
            </div>
            <div class="logout-container w3-bar-item">
                <a href="./notifications.html" title="Notifications">
                    <img src="../../media/img/notifs.png" alt="Logo notification" style="width:24px; height:24px;">
                </a>
                <a href="./settings.html" title="Paramètres">
                    <img src="../../media/img/settings.png" alt="Logo paramètres" style="width:24px; height:24px;">
                </a>
                <a href="../../index.html" title="Se déconnecter">
                    <img src="../../media/img/LogOutWhite.png" alt="Logo Déconnexion" style="width:24px; height:24px;">
                </a>
            </div>
        </div>
    
        <!-- Menu mobile caché au départ -->
        <div id="mobileMenu" class="w3-bar-block w3-hide w3-hide-large w3-dark-blue">
            <a href="./rh.html" class="w3-bar-item w3-button">Accueil</a>
            <a href="./gestion_personnel.html" class="w3-bar-item w3-button">Gestion du personnel</a>
            <a href="./gestion-heures.html" class="w3-bar-item w3-button">Heures</a>
            <a href="./candidature.html" class="w3-bar-item w3-button">Candidatures</a>
            <a href="./mes-informations.html" class="w3-bar-item w3-button">Mes informations et documents</a>
    
            <!-- Section utilisateur pour mobile -->
            <div class="w3-bar-item w3-border-top w3-margin-top">
                <div class="user-name">Alice BERGER</div>
                <a href="./notifications.html" title="Notifications">
                    <img src="../../media/img/notifs.png" alt="Logo notification" style="width:24px; height:24px;">
                </a>
                <a href="./settings.html" title="Paramètres">
                    <img src="../../media/img/settings.png" alt="Logo paramètres" style="width:24px; height:24px;">
                </a>
                <a href="../../index.html" title="Se déconnecter">
                    <img src="../../media/img/LogOutWhite.png" alt="Logo Déconnexion" style="width:24px; height:24px;">
                </a>
            </div>
        </div>
    </div>

<div class="container">
    <!-- Section Informations Personnelles -->
    <div class="info-card">
        <h2>Informations Personnelles</h2>
        <table class="info-table">
            <tr>
                <th>Nom Complet</th>
                <td><input type="text" id="nom" value="Alice BERGER" class="non-editable" readonly></td>
            </tr>
            <tr>
                <th>Date de Naissance</th>
                <td><input type="text" id="date_naissance" value="15 Mars 1985" class="non-editable" readonly></td>
            </tr>
            <tr>
                <th>Ville de Naissance</th>
                <td><input type="text" id="ville_naissance" value="Paris" class="non-editable" readonly></td>
            </tr>
            <tr>
                <th>Adresse</th>
                <td><input type="text" id="adresse" value="12 Rue de la République, 75000 Paris"></td>
            </tr>
            <tr>
                <th>E-mail</th>
                <td><input type="email" id="email" value="alice.berger@u-pec.fr"></td>
            </tr>
            <tr>
                <th>Téléphone</th>
                <td><input type="tel" id="telephone" value="07 69 55 14 55"></td>
            </tr>
            <tr>
                <th>Numéro de Sécurité Sociale</th>
                <td><input type="text" id="numero_securite" value="2 85 03 75 123 456 78" class="non-editable" readonly></td>
            </tr>
        </table>
        <button class="action-btn" onclick="saveInfo()">Sauvegarder les modifications</button>
    </div>

    <!-- Section Informations Bancaires -->
    <div class="info-card">
        <h2>Informations Bancaires</h2>
        <table class="info-table">
            <tr>
                <th>Banque</th>
                <td><input type="text" id="banque" value="BNP Paribas"></td>
            </tr>
            <tr>
                <th>IBAN</th>
                <td><input type="text" id="iban" value="FR76 3000 6000 0112 3456 7890 189"></td>
            </tr>
            <tr>
                <th>BIC</th>
                <td><input type="text" id="bic" value="BNPAFRPPXXX"></td>
            </tr>
        </table>
        <button class="action-btn" onclick="saveBankInfo()">Sauvegarder les informations bancaires</button>
    </div>

    <!-- Section Documents -->
    <div class="info-card">
        <h2>Documents Officiels</h2>
        <table class="info-table">
            <tr>
                <th>Pièce d'identité</th>
                <td><a href="../../media/documents/VACATAIRE/CarteIdentite.pdf">Télécharger</a></td>
            </tr>
            <tr>
                <th>Contrat de Travail</th>
                <td><a href="../../media/documents/VACATAIRE/ContratDeTravail.pdf">Télécharger</a></td>
            </tr>
            <tr>
                <th>Justificatif de Domicile</th>
                <td><a href="../../media/documents/VACATAIRE/JustificatifDomicile.pdf">Télécharger</a></td>
            </tr>
        </table>
    </div>

    <div class="info-card">
        <h2>Envoyer un Document</h2>
        <form id="uploadForm" onsubmit="return false;">
            <label for="documentType">Type de document :</label>
            <select id="documentType" class="document-select">
                <option value="" disabled selected>Sélectionnez un type de document</option>
                <option value="carte_identite">Carte d'Identité</option>
                <option value="contrat_travail">Contrat de Travail</option>
                <option value="justificatif_domicile">Justificatif de Domicile</option>
                <option value="releve_bancaire">Relevé Bancaire</option>
                <option value="certificat_medical">Certificat Médical</option>
                <option value="avis_imposition">Avis d'Imposition</option>
                <option value="permis_conduire">Permis de Conduire</option>
                <option value="passeport">Passeport</option>
                <option value="facture">Facture</option>
                <option value="autre">Autre</option>
            </select>
    
            <label for="newDocument" class="file-upload-label">
                Choisir un fichier
            </label>
            <input type="file" id="newDocument" accept=".pdf,.doc,.docx" style="display: none;" onchange="updateFileName()">
            <span id="fileName" class="file-name">Aucun fichier choisi</span>
            <button class="action-btn" onclick="uploadDocument()">Envoyer le document</button>
        </form>
    </div>
   
</div>

<!-- Popup de confirmation -->
<div class="popup" id="popup">
    <img src="https://img.icons8.com/ios-filled/50/155724/checkmark.png" alt="Coche">
    <h4>Message envoyé</h4>
    <p>Votre document a été transmis à la direction. Un email de confirmation vous a été envoyé.</p>
    <button onclick="fermerPopup()">Fermer</button>
</div>

<!-- Footer -->
<div class="footer">
    <p>&copy; 2024 IUT de Fontainebleau. Tous droits réservés | <a href="../mentions_legales.html" style="color: white;">Mentions légales</a></p>
</div>

<script>
    // Sauvegarder les informations personnelles dans le localStorage
    function saveInfo() {
        const ville_naissance = document.getElementById('ville_naissance').value;
        const adresse = document.getElementById('adresse').value;
        const email = document.getElementById('email').value;
        const email_pro = document.getElementById('email-pro').value;
        const telephone = document.getElementById('telephone').value;
        const numero_securite = document.getElementById('numero_securite').value;
        const statut = document.getElementById('statut').value;

        // Enregistrer les valeurs dans le localStorage
        localStorage.setItem('ville_naissance', ville_naissance);
        localStorage.setItem('adresse', adresse);
        localStorage.setItem('email', email);
        localStorage.setItem('email-pro', email_pro);
        localStorage.setItem('telephone', telephone);
        localStorage.setItem('numero_securite', numero_securite);
        localStorage.setItem('statut', statut);

        alert('Informations personnelles sauvegardées !');
    }

    // Sauvegarder les informations bancaires dans le localStorage
    function saveBankInfo() {
        const banque = document.getElementById('banque').value;
        const iban = document.getElementById('iban').value;
        const bic = document.getElementById('bic').value;

        // Enregistrer les valeurs dans le localStorage
        localStorage.setItem('banque', banque);
        localStorage.setItem('iban', iban);
        localStorage.setItem('bic', bic);

        alert('Informations bancaires sauvegardées !');
    }

    // Récupérer les informations depuis le localStorage (si elles existent)
    function loadInfo() {
        if(localStorage.getItem('ville_naissance')) {
            document.getElementById('ville_naissance').value = localStorage.getItem('ville_naissance');
        }
        if(localStorage.getItem('adresse')) {
            document.getElementById('adresse').value = localStorage.getItem('adresse');
        }
        if(localStorage.getItem('email')) {
            document.getElementById('email').value = localStorage.getItem('email');
        }
        if(localStorage.getItem('email-pro')) {
            document.getElementById('email-pro').value = localStorage.getItem('email-pro');
        }
        if(localStorage.getItem('telephone')) {
            document.getElementById('telephone').value = localStorage.getItem('telephone');
        }
        if(localStorage.getItem('numero_securite')) {
            document.getElementById('numero_securite').value = localStorage.getItem('numero_securite');
        }
        if(localStorage.getItem('statut')) {
            document.getElementById('statut').value = localStorage.getItem('statut');
        }

        // Informations bancaires
        if(localStorage.getItem('banque')) {
            document.getElementById('banque').value = localStorage.getItem('banque');
        }
        if(localStorage.getItem('iban')) {
            document.getElementById('iban').value = localStorage.getItem('iban');
        }
        if(localStorage.getItem('bic')) {
            document.getElementById('bic').value = localStorage.getItem('bic');
        }
    }

    // Charger les informations quand la page est chargée
    window.onload = loadInfo;

    function uploadDocument() {
        const documentType = document.getElementById('documentType').value;
        const fileInput = document.getElementById('newDocument').files[0];
        
        if (!documentType) {
            alert("Veuillez sélectionner un type de document.");
            return;
        }

        if (!fileInput) {
            alert("Veuillez choisir un fichier à envoyer.");
            return;
        }

        // Simulation d'un envoi réussi (ajoutez votre logique d'envoi ici)
        document.getElementById('fileName').textContent = "Aucun fichier choisi"; // Réinitialiser le nom de fichier
        
        // Afficher le document en attente de traitement
        const documentsTable = document.querySelector('.info-table'); // La table où afficher les documents
        const newRow = documentsTable.insertRow(-1); // Insérer une nouvelle ligne à la fin

        // Ajouter des cellules pour le type de document et le statut
        newRow.innerHTML = `<th>${documentType.replace(/_/g, ' ').toUpperCase()}</th><td>En attente de traitement</td>`;

        // Ouvrir le pop-up de confirmation
        document.getElementById('popup').style.display = 'block'; // Ouvrir le pop-up
    }


    function updateFileName() {
    const fileInput = document.getElementById('newDocument');
    const fileNameDisplay = document.getElementById('fileName');
    if (fileInput.files.length > 0) {
        fileNameDisplay.textContent = fileInput.files[0].name;
    } else {
        fileNameDisplay.textContent = 'Aucun fichier choisi';
    }
}


    // Fermer la pop-up
    function fermerPopup() {
        document.getElementById('popup').style.display = 'none';
    }

</script>
<script>
        function toggleMenu() {
            var x = document.getElementById("mobileMenu");
            if (x.className.indexOf("w3-show") == -1) {
                x.className += " w3-show";
            } else {
                x.className = x.className.replace(" w3-show", "");
            }
        }
</script>

</body>
</html>