Your IP : 216.73.216.212


Current Path : /home/a/t/a/ataenra/www/ATA/INTRANET/Admin/Gestion_ACC/AC/
Upload File :
Current File : /home/a/t/a/ataenra/www/ATA/INTRANET/Admin/Gestion_ACC/AC/NewPointAutoConso.php

<script src="ac.js"></script>
<link src="style.css" rel="stylesheet" type="text/css">
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBJK0GVBASHQUIFbE3NudYEWFtodD9bM_s&callback=initMap"></script>


<form enctype="multipart/form-data" method="post" autocomplete="off">
    <div class="container1">
    <h5 class="btn-lg btn-warning">NOUVEAU SITE D'AUTOCONSOMMATION</h5>
        <div class="row">

            <div class="col-md-6">
                
                <div id="map"></div>    

                <!--<?php //require 'PV/MAPS.php'; ?>-->

                <input type="hidden" name="site_type" value="AutoConso" />
                <input type="hidden" name="ID_pmo" id='idpmo' value="<?php echo $IDpmo; ?>"/>
                
            </div>  

            <div class="col-md-3">
            <h6 class="btn-lg btn-success">EMPLACEMENT</h6>

                    <div class="col-md-6">
                                <p>Latitude</p>
                                <p id="lat">-</p>
                    </div>
                    <div class="col-md-6">       
                                <p>Longitude</p>
                                <p id="lng">-</p>
                    </div>
                                          
                    <p>Orientation Multiple :

<select name="nbo" id="nbo" onchange="updateList1(this.value)" class="form-control" required>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select></p>


<p> Puissance Centrale N°1 : <input class="form-control" type="Text" id='power1' name="pcentrale" required/>
<p> Orientation : <input class="form-control" type="Text" id='orientation1' name="orientation" required/>
<p> Inclinaison : <input class="form-control" type="Text" id='inclinaison1' name="inclinaison" required/>

<div id="power2">
<p> Puissance Centrale N°2 : <input class="form-control" type="Text" id='power2' name="pcentrale2"/>
<p> Orientation : <input class="form-control" type="Text" id='orientation2' name="orientation2"/>
<p> Inclinaison : <input class="form-control" type="Text" id='inclinaison2' name="inclinaison2"/>
</div>

<div id="power3">
<p> Puissance Centrale N°3 : <input class="form-control" type="Text" id='power3' name="pcentrale3"/>
<p> Orientation : <input class="form-control" type="Text" id='orientation3' name="orientation3"/>
<p> Inclinaison : <input class="form-control" type="Text" id='inclinaison3' name="inclinaison3"/>
</div>
            </div>

            <div class="col-md-3">
            <h6 class="btn-lg btn-success">INFO SITE</h6>

                <p> Nom du site : <input class="form-control" type="Text" name="site_nom" required/>
                <p> Adresse : <input class="form-control" type="Text" name="site_adresse" required/>
                <input type="hidden" id="lng1" name="longitude" value="" />
                <input type="hidden" id='lat1' name="latitude" value="" />

            <h6 class="btn-lg btn-warning">CONSOMMATIONS</h6>
                
                    <p>Type de raccordement :
                    <select name="racc" class="form-control" required>
                    <option value="C5">Basse tension < 36kw / C5</option>
                    <option value="C4">Basse tension > 36kw et < 250kw / C4</option>
                    <option value="C3">HTA via courbe profilée < 250kw / C3 </option>
                    <option value="C2">HTA via courbe mesurée > 250kw / C2</option>
                    </select></p> 
            
            <?php 
                    $list1 = $dbco->prepare("SELECT * FROM gest_acc_pmo_abos ORDER BY abo_appel ASC"); 
                    $list1->execute();
                   
            ?>
                    <p>Type d'abonnement :
                    <select name="abo"  class="form-control" required>
                    <?php while( $R1 = $list1->fetch(PDO::FETCH_OBJ)){
                    if($R1->abo_creneau == 1){
                    echo '<option value="'.$R1->ID_abo.'">'.$R1->abo_appel.' / '.$R1->abo_segment.' / HC '.$R1->abo_hc1_start.' - '.$R1->abo_hc1_stop.' </option>'; }
                    if($R1->abo_creneau == 2){
                        echo '<option value="'.$R1->ID_abo.'">'.$R1->abo_appel.' / '.$R1->abo_segment.' / HC '.$R1->abo_hc1_start.' - '.$R1->abo_hc1_stop.' / '.$R1->abo_hc2_start.' - '.$R1->abo_hc2_stop.' </option>'; }

                    }?>
                    </select></p> 

                <p> Courbe de charge ENEDIS : <input name="CC" type="file" required/><br>


            <h6 class="btn-lg btn-info">FINANCEMENT</h6>


            <p>Financement de la centrale :

                    <select name="f_type" id="f_type" onchange="updateList(this.value)" class="form-control" required>
                    <option value="">-- Selectionner --</option disabled>
                    <option value="CPT">Comptant</option>
                    <option value="FC">Financement</option>
                    <option value="FATA">Leasing ATA</option>
                    <option value="FTI">Tiers investisseur</option>
                    </select></p>

                <p id="taux">Taux en % :</p>
                <p id="f_taux_ata">Taux en % : 6</p>
                <select name="f_taux" id="f_taux" class="form-control">
                    <option value="3.0">-- Selectionner --</option disabled>
                    <option>2.0</option><option>2.1</option><option>2.2</option><option>2.3</option><option>2.4</option><option>2.5</option><option>2.6</option><option>2.7</option><option>2.8</option><option>2.9</option>
                    <option>3.0</option><option>3.1</option><option>3.2</option><option>3.3</option><option>3.4</option><option>3.5</option><option>3.6</option><option>3.7</option><option>3.8</option><option>3.9</option>
                    <option>4.0</option><option>4.1</option><option>4.2</option><option>4.3</option><option>4.4</option><option>4.5</option><option>4.6</option><option>4.7</option><option>4.8</option><option>4.9</option>
                    <option>5.0</option><option>5.1</option><option>5.2</option><option>5.3</option><option>5.4</option><option>5.5</option><option>5.6</option><option>5.7</option><option>5.8</option><option>5.9</option>
                    <option>6.0</option><option>6.1</option><option>6.2</option><option>6.3</option><option>6.4</option><option>6.5</option><option>6.6</option><option>6.7</option><option>6.8</option><option>6.9</option>
                    </select>

                <input class="form-control"  type="hidden" id='f_taux_ata' name="f_taux1" value="6"/></p>

                <p id="duree">Durée en mois :</p>
                <p id="f_duree_ata">Durée en mois : 120</p>

                    <select name="f_duree" id="f_duree" class="form-control">
                    <option value="120">-- Selectionner --</option disabled>
                    <option>12</option><option>24</option><option>36</option><option>48</option><option>60</option><option>72</option>
                    <option>84</option><option>96</option><option>108</option><option>120</option><option>132</option><option>144</option>
                    </select>

                    <input class="form-control"  type="hidden" id='f_duree_ata' name="f_duree1" value="120"/></p>

                    <p id="f_invest1">Tarif de rachat (euros/kwh) :</p>
                    <select name="f_invest" id="f_invest" class="form-control">
                    <option>0.15</option>
                    <option>0.10</option><option>0.11</option><option>0.12</option><option>0.13</option><option>0.14</option><option>0.15</option>
                    <option>0.16</option><option>0.17</option><option>0.18</option><option>0.19</option><option>0.20</option>
                    </select>

                <br>

                
                <button type="button" class="btn btn-secondary btn-lg btn-block" id='valid2' onclick="getValue();">Vérifier</button>
                <input class="btn btn-success btn-lg btn-block" type="Submit" name="NSPAC" id='valid' value="Enregistrer" /><br>

            </div>

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


<style>
    * {
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    background: #2563eb;
    color: white;
    padding: 1rem;
}

.header h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-message {
    margin-top: 0.5rem;
    background: #1d4ed8;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.content {
    padding: 1rem;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
}

#map {
    height: 500px;
    border-radius: 0.5rem;
    overflow: hidden;
}

.coordinates {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
}

.coordinates h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #1e293b;
}

.coordinate-box {
    background: white;
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.coordinate-box p:first-child {
    color: #64748b;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.coordinate-box p:last-child {
    font-family: monospace;
    font-size: 1.125rem;
}

@media (max-width: 1000px) {
    .content {
        grid-template-columns: 1fr;
    }
}

</style>

<script>
    
    const DEFAULT_LOCATION = { lat: 51, lng: 2 };
        let map, marker, latitude, longitude;

        function initMap() {
            // Fonction pour mettre à jour l'affichage des coordonnées
            function updateCoordinates(position) {
                document.getElementById('lat').textContent = position.lat.toFixed(6);
                document.getElementById('lng').textContent = position.lng.toFixed(6);
                latitude = position.lat.toFixed(5);
                longitude = position.lng.toFixed(5);
 
                
            }
            
            // Fonction pour initialiser la carte avec une position
            function createMap(position) {
                map = new google.maps.Map(document.getElementById('map'), {
                    center: position,
                    zoom: 15,
                    styles: [{
                        featureType: "poi",
                        elementType: "labels",
                        stylers: [{ visibility: "off" }]
                    }]
                });

                // Créer le marqueur
                marker = new google.maps.Marker({
                    position: position,
                    map: map,
                    animation: google.maps.Animation.DROP
                });

                // Mettre à jour les coordonnées initiales
                updateCoordinates(position);


                

                // Ajouter l'écouteur de clic sur la carte
                map.addListener('click', (e) => {
                    const position = {
                        lat: e.latLng.lat(),
                        lng: e.latLng.lng()
                        
                    };
                    marker.setPosition(position);
                    updateCoordinates(position);
                    

                });
            }

            // Tenter d'obtenir la position de l'utilisateur
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(
                    (position) => {
                        const userLocation = {
                            lat: position.coords.latitude,
                            lng: position.coords.longitude
                        };
                        createMap(userLocation);
                    },
                    (error) => {
                        console.error('Erreur de géolocalisation:', error);
                        const errorContainer = document.getElementById('error-container');
                        errorContainer.innerHTML = `
                            <div class="error-message">
                                Permission de géolocalisation refusée - Utilisation de la position par défaut (51°N, 2°E)
                            </div>
                        `;
                        createMap(DEFAULT_LOCATION);
                    },
                    {
                        timeout: 5000,
                        enableHighAccuracy: true
                    }
                );
            } else {
                console.error('La géolocalisation n\'est pas supportée');
                createMap(DEFAULT_LOCATION);
            }
        }
        window.initMap = initMap;
        document.getElementById("valid").style.display = "none";
        document.getElementById("valid2").style.display = "block";

        function getValue() {     

            document.getElementById("lat1").value = latitude;
            document.getElementById("lng1").value = longitude;
            var peakpower = document.getElementById("power1").value;
            var idpmo = document.getElementById("idpmo").value;
            var orientation = document.getElementById("orientation1").value;
            var inclinaison = document.getElementById("inclinaison1").value;
            document.getElementById("valid").style.display = "block";
            document.getElementById("valid2").style.display = "none";
                            }
 
  
    
</script>

<script>

document.getElementById("taux").style.display = "none";
document.getElementById("duree").style.display = "none";
document.getElementById("f_taux").style.display = "none";
document.getElementById("f_duree").style.display = "none";
document.getElementById("f_taux_ata").style.display = "none";
document.getElementById("f_duree_ata").style.display = "none";
document.getElementById("f_invest").style.display = "none";
document.getElementById("f_invest1").style.display = "none";

document.getElementById("power2").style.display = "none";
document.getElementById("power3").style.display = "none";


function updateList(A) {

if (A === "CPT") {
document.getElementById("taux").style.display = "none";
document.getElementById("duree").style.display = "none";
document.getElementById("f_taux").style.display = "none";
document.getElementById("f_duree").style.display = "none";
document.getElementById("f_taux_ata").style.display = "none";
document.getElementById("f_duree_ata").style.display = "none";
document.getElementById("f_invest").style.display = "none";
document.getElementById("f_invest1").style.display = "none";

} else if (A === "FC") {
document.getElementById("taux").style.display = "block";
document.getElementById("duree").style.display = "block";
document.getElementById("f_taux").style.display = "block";
document.getElementById("f_duree").style.display = "block";
document.getElementById("f_taux_ata").style.display = "none";
document.getElementById("f_duree_ata").style.display = "none";
document.getElementById("f_invest").style.display = "none";
document.getElementById("f_invest1").style.display = "none";

} else if (A === "FATA") {
document.getElementById("taux").style.display = "none";
document.getElementById("duree").style.display = "none";
document.getElementById("f_taux").style.display = "none";
document.getElementById("f_duree").style.display = "none";
document.getElementById("f_taux_ata").style.display = "block";
document.getElementById("f_duree_ata").style.display = "block";
document.getElementById("f_invest").style.display = "none";
document.getElementById("f_invest1").style.display = "none";
} 

if (A === "FTI") {
document.getElementById("taux").style.display = "none";
document.getElementById("duree").style.display = "none";
document.getElementById("f_taux").style.display = "none";
document.getElementById("f_duree").style.display = "none";
document.getElementById("f_taux_ata").style.display = "none";
document.getElementById("f_duree_ata").style.display = "none";
document.getElementById("f_invest").style.display = "block";
document.getElementById("f_invest1").style.display = "block";
} 

}

function updateList1(A) {

if (A === "1") {

document.getElementById("power2").style.display = "none";
document.getElementById("power3").style.display = "none";


} else if (A === "2") {

document.getElementById("power2").style.display = "block";
document.getElementById("power3").style.display = "none";



} else if (A === "3") {

document.getElementById("power2").style.display = "block";
document.getElementById("power3").style.display = "block";

} 
}
</script>