chargement initial
This commit is contained in:
119
caotek_mesavoirs/static/js/calcul_cv.js
Normal file
119
caotek_mesavoirs/static/js/calcul_cv.js
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
*
|
||||
* CONTROLES DE REMPLISSAGE DE CHAMP
|
||||
*
|
||||
*/
|
||||
var CACHER = 'fast';
|
||||
var AFFICHER = 'slow';
|
||||
|
||||
// Saisie de Revenu Fiscal de Référence
|
||||
function revenuCheck(){
|
||||
if(document.getElementById("rfr").value.length == 0){
|
||||
document.getElementById("rfr").value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Choix du montant de la mensualité
|
||||
function mt_mens(){
|
||||
document.getElementById("mtc").selectedIndex = document.getElementById("mtm").selectedIndex;
|
||||
}
|
||||
|
||||
// Affichage des résultats
|
||||
function resultat(){
|
||||
$("#res").hide(CACHER);
|
||||
$("#res").show(AFFICHER);
|
||||
|
||||
var rfr = document.getElementById("RFR");
|
||||
var fisc = document.getElementById("FISC");
|
||||
var tb = document.getElementById("TB");
|
||||
var mtm = document.getElementById("MTM");
|
||||
var mtc = document.getElementById("MTC");
|
||||
var nbm = document.getElementById("NBM");
|
||||
var tot = document.getElementById("TOT");
|
||||
|
||||
rfr.innerHTML = document.getElementById("rfr").value + " €";
|
||||
fisc.innerHTML = document.getElementById("fisc").value;
|
||||
tb.innerHTML = document.getElementById("tb").innerHTML;
|
||||
mtm.innerHTML = document.getElementById("mtm").value + " €";
|
||||
mtc.innerHTML = document.getElementById("mtc").value + " €";
|
||||
nbm.innerHTML = document.getElementById("nbm").value + " mois";
|
||||
// total = (Mt mensuel * Nb mensualités)+(Mt subv * Nb mensualités)
|
||||
tot.innerHTML = (parseFloat(mtm.innerHTML)*parseInt(nbm.innerHTML)) + (parseFloat(mtc.innerHTML)*parseInt(nbm.innerHTML)) + " €";
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* XHTTP REQUEST
|
||||
*
|
||||
*/
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
// Étape 1
|
||||
function etape1(){
|
||||
var rfr = document.getElementById("rfr").value.replace(",",".");
|
||||
var fisc = parseFloat(document.getElementById("fisc").value);
|
||||
var hand = document.getElementById("hand").value;
|
||||
var mtrente = document.getElementById("mtrente").value;
|
||||
|
||||
// Test pour voir si rfr n'est pas un nombre
|
||||
if(isNaN(rfr)){
|
||||
document.getElementById("erreur1").style.display="block";
|
||||
} else {
|
||||
rfr = parseFloat(rfr);
|
||||
// Test pour voir si c'est un nombre négatif
|
||||
if(rfr<0){
|
||||
document.getElementById("erreur1").style.display="block";
|
||||
} else {
|
||||
document.getElementById("erreur1").style.display="none";
|
||||
xhr.open("GET", "/calcul_cv/E1CV/"+rfr+"/"+fisc+"/"+hand+"/"+mtrente,true);
|
||||
xhr.onreadystatechange = c1;
|
||||
xhr.send(null);
|
||||
|
||||
// On cache tous les blocs (etapes 2 et 3)
|
||||
$("#etap2").hide(CACHER);
|
||||
$("#res").hide(CACHER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* FONCTION CALLBACK
|
||||
*
|
||||
*/
|
||||
function c1(){
|
||||
if(xhr.readyState == 4){
|
||||
var res = eval('(' + xhr.responseText + ')');
|
||||
|
||||
// On affiche l'étape 2
|
||||
$("#etap2").show(AFFICHER);
|
||||
|
||||
// On affiche le taux de bonification
|
||||
document.getElementById("tb").innerHTML = res.taux_bonif + " %";
|
||||
|
||||
// On regarde si le taux de bonif est différent de 0 afin de remplir le <select>
|
||||
var mtm = document.getElementById("mtm");
|
||||
var nbm = document.getElementById("nbm");
|
||||
var mchqvac = document.getElementById("mchqvac");
|
||||
document.getElementById("ptb").innerHTML = "";
|
||||
mtm.innerHTML = "";
|
||||
mtc.innerHTML = "";
|
||||
|
||||
if(res.taux_bonif != "0"){
|
||||
mtm.style.display = "block";
|
||||
nbm.style.display = "block";
|
||||
mchqvac.style.display = "block";
|
||||
|
||||
// On remplit le select
|
||||
for(var i = 0; i < res.montant.length; i++){
|
||||
mtm.innerHTML += "<option>"+res.montant[i][0]+"</option>";
|
||||
mtc.innerHTML += "<option>"+res.montant[i][1]+"</option>";
|
||||
}
|
||||
} else {
|
||||
mtm.style.display = "none";
|
||||
nbm.style.display = "none";
|
||||
mchqvac.style.display = "none";
|
||||
document.getElementById("ptb").innerHTML = "Vous ne pouvez pas commander de chèques vacances.";
|
||||
}
|
||||
}
|
||||
}
|
||||
126
caotek_mesavoirs/static/js/calcul_td.js
Normal file
126
caotek_mesavoirs/static/js/calcul_td.js
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
*
|
||||
* CONTROLES DE REMPLISSAGE DE CHAMP ET AUTRES
|
||||
*
|
||||
*/
|
||||
var CACHER = 'fast';
|
||||
var AFFICHER = 'slow';
|
||||
|
||||
// Saisie de Revenu Fiscal de Référence ou Base TD du séjour
|
||||
function numberCheck(champ){
|
||||
if(document.getElementById(champ).value.length == 0){
|
||||
document.getElementById(champ).value = 0;
|
||||
}
|
||||
|
||||
if(parseInt(document.getElementById(champ).value) < 0){
|
||||
document.getElementById(champ).value = 0;
|
||||
}
|
||||
|
||||
if(champ == 'nbPartCAES'){
|
||||
if(parseFloat(document.getElementById(champ).value.replace(",","."))%0.5 != 0 || parseFloat(document.getElementById(champ).value.replace(",",".")) < 1){
|
||||
document.getElementById(champ).value = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(champ == 'nbj'){
|
||||
if(parseInt(document.getElementById(champ).value) > 22){
|
||||
document.getElementById(champ).value = 22;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fonction pour garder deux chiffres après la virgule pour les champs calculés
|
||||
function toMoney(num){
|
||||
num = parseInt(Math.round(num*100));
|
||||
return num/100;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* XHTTP REQUEST
|
||||
*
|
||||
*/
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
function calculer(){
|
||||
// On prend les valeurs de l'étape 1
|
||||
var rfr = parseFloat(document.getElementById("rfr").value.replace(",","."));
|
||||
var nbPartCAES = parseFloat(document.getElementById("nbPartCAES").value.replace(",","."));
|
||||
var btd = parseFloat(document.getElementById("btd").value.replace(",","."));
|
||||
var nbj = parseInt(document.getElementById("nbj").value.replace(",","."));
|
||||
|
||||
// Si le Revenu Fiscal de Référence ou la Base TD du séjour ne sont pas des chiffres (on fait ces tests pour les anciens navigateurs qui gèrent pas le type number)
|
||||
if(isNaN(rfr) || isNaN(btd)){
|
||||
document.getElementById("erreur1").style.display="block";
|
||||
} else {
|
||||
rfr = parseFloat(rfr);
|
||||
btd = parseFloat(btd);
|
||||
// Si le Revenu Fiscal de Référence ou la Base TD du séjour sont négatifs
|
||||
if(rfr<0 || btd<0){
|
||||
document.getElementById("erreur1").style.display="block";
|
||||
} else {
|
||||
document.getElementById("erreur1").style.display="none";
|
||||
|
||||
xhr.open("GET", "/calcul_td/E1TD/"+Math.ceil(rfr/nbPartCAES),true);
|
||||
xhr.onreadystatechange = afficher;
|
||||
xhr.send(null);
|
||||
|
||||
// On cache tous le bloc de résultat
|
||||
$("#res").hide(CACHER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* FONCTION CALLBACK
|
||||
*
|
||||
*/
|
||||
|
||||
function afficher(){
|
||||
if(xhr.readyState == 4){
|
||||
$("#res").show(AFFICHER);
|
||||
|
||||
// On prend ce qui est retourné par la requête XHTTP
|
||||
var res = eval('(' + xhr.responseText + ')');
|
||||
|
||||
// On prend les valeurs de l'étape 1
|
||||
var rfr = parseFloat(document.getElementById("rfr").value.replace(",","."));
|
||||
var nbPartCAES = parseFloat(document.getElementById("nbPartCAES").value.replace(",","."));
|
||||
var btd = parseFloat(document.getElementById("btd").value.replace(",","."));
|
||||
var nbj = parseInt(document.getElementById("nbj").value);
|
||||
var td = 0;
|
||||
|
||||
// On affiche le TD famille
|
||||
document.getElementById("tdf").innerHTML = res.td_famille + " %";
|
||||
|
||||
// On affiche le TD jeunes
|
||||
document.getElementById("tdj").innerHTML = res.td_jeunes + " %";
|
||||
|
||||
// On affiche le TD CESU
|
||||
document.getElementById("tdc").innerHTML = res.td_cesu + " %";
|
||||
|
||||
// On calcule le Quotient Familial
|
||||
document.getElementById("qf").innerHTML = Math.ceil(rfr/nbPartCAES) + " €";
|
||||
|
||||
// On affiche la base TD du séjour
|
||||
document.getElementById("tds").innerHTML = btd + " €";
|
||||
|
||||
// On affiche le coût du séjour famille
|
||||
document.getElementById("csf").innerHTML = toMoney(btd - ((btd * parseFloat(res.td_famille))/100)) + " €";
|
||||
|
||||
// On affiche le coût du séjour jeunes
|
||||
if(nbj == 0){
|
||||
document.getElementById("csj").innerHTML = "-- €";
|
||||
} else {
|
||||
var cout_jour = btd/nbj;
|
||||
var subv = 0;
|
||||
if(cout_jour > 100){
|
||||
subv = parseFloat(res.td_jeunes);
|
||||
}else{
|
||||
subv = (parseFloat(res.td_jeunes) * cout_jour)/100;
|
||||
}
|
||||
document.getElementById("csj").innerHTML = toMoney(btd - (subv * nbj)) + " €";
|
||||
}
|
||||
}
|
||||
}
|
||||
485
caotek_mesavoirs/static/js/clas_le_plus_proche.js
Normal file
485
caotek_mesavoirs/static/js/clas_le_plus_proche.js
Normal file
@@ -0,0 +1,485 @@
|
||||
// Déclaration des variables
|
||||
var req1 = new XMLHttpRequest();
|
||||
var req2 = new XMLHttpRequest();
|
||||
|
||||
var results1;
|
||||
var results2;
|
||||
|
||||
var m1, m2, m3;
|
||||
|
||||
var point1 = new google.maps.LatLng(0.0, 0.0);
|
||||
var point2 = new google.maps.LatLng(0.0, 0.0);
|
||||
var point3 = new google.maps.LatLng(0.0, 0.0);
|
||||
var point4 = new google.maps.LatLng(0.0, 0.0);
|
||||
|
||||
var zoneMarqueurs;
|
||||
|
||||
var adresse1 = "";
|
||||
var adresse3 = "";
|
||||
var adresse4 = "";
|
||||
|
||||
var clasListe = [];
|
||||
var resListe = [];
|
||||
var tab = [];
|
||||
|
||||
var INCREMENT = 0;
|
||||
var fini = false;
|
||||
|
||||
var voiture = true;
|
||||
var velo = false;
|
||||
var marche = false;
|
||||
var is_m1 = true;
|
||||
var is_m2 = false;
|
||||
var is_m3 = false;
|
||||
|
||||
// Les icones
|
||||
var icone1, icone2, icone3;
|
||||
|
||||
// Fonction qui va retourner le tableau des Clas généré via le select listeClas
|
||||
function get_liste(){
|
||||
res = [];
|
||||
liste = document.getElementById("listeClas");
|
||||
|
||||
for(var i = 0; i<liste.length; i++){
|
||||
liste.selectedIndex = i;// On va à l'élément suivant du select
|
||||
value = liste.value.split("_/_");
|
||||
|
||||
dictionnaire = {};// On stocke dans un dictionnaire
|
||||
dictionnaire['no_clas']=value[0];
|
||||
dictionnaire['no_region']=value[1];
|
||||
dictionnaire['libelle']=value[2];
|
||||
dictionnaire['adres1']=value[3];
|
||||
dictionnaire['adres2']=value[4];
|
||||
dictionnaire['code_postal']=value[5];
|
||||
dictionnaire['ville']=value[6];
|
||||
dictionnaire['code_pays']=value[7];
|
||||
dictionnaire['no_tel']=value[8];
|
||||
dictionnaire['mail']=value[9];
|
||||
|
||||
res.push(dictionnaire);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// Fonction appelée par la page
|
||||
function chercher(){
|
||||
// On met l'image de chargement au début
|
||||
var img = document.getElementById("image").innerHTML;
|
||||
document.getElementById("res").innerHTML = "<img src='" + img + "' style='width:100px'></img>";
|
||||
|
||||
// On cache la map et les moyens de locomotion
|
||||
document.getElementById("moyenLocomotion").style.display = "none";
|
||||
document.getElementById("map").style.display = "none";
|
||||
|
||||
// On affecte les variables utiles
|
||||
var adresse = document.getElementById("adresse").value;
|
||||
var departement = document.getElementById("departement").value;
|
||||
var ville = document.getElementById("ville").value;
|
||||
|
||||
resListe = [];
|
||||
clasListe = get_liste();
|
||||
INCREMENT = 0;
|
||||
fini = false;
|
||||
|
||||
icone1 = {
|
||||
url: document.getElementById("icone1").innerHTML,
|
||||
size: new google.maps.Size(32,45),
|
||||
anchor: new google.maps.Point(17,45)
|
||||
};
|
||||
|
||||
icone2 = {
|
||||
url: document.getElementById("icone2").innerHTML,
|
||||
size: new google.maps.Size(32,45),
|
||||
anchor: new google.maps.Point(17,45)
|
||||
};
|
||||
|
||||
icone3 = {
|
||||
url: document.getElementById("icone3").innerHTML,
|
||||
size: new google.maps.Size(32,45),
|
||||
anchor: new google.maps.Point(17,45)
|
||||
};
|
||||
|
||||
adresse1 = adresse + " " + departement + " " + ville;
|
||||
|
||||
// On lance la première recherche
|
||||
var clas = clasListe[INCREMENT];
|
||||
var adresse2 = clas.adres1 + " " + clas.code_postal + " " + clas.ville;
|
||||
recherche(adresse1, adresse2);
|
||||
}
|
||||
|
||||
// Fonction qui lance la recherche via l'API de adresse.data.gouv.fr
|
||||
function recherche(adresse1, adresse2){
|
||||
//alert(INCREMENT+1+"\n> ADRESSE 1 : " + adresse1 + "\n> ADRESSE 2 : " + adresse2);
|
||||
req1.open("GET", "http://api-adresse.data.gouv.fr/search/?q="+adresse1,true);
|
||||
req1.onreadystatechange = calcul;
|
||||
req1.send(null);
|
||||
|
||||
req2.open("GET", "http://api-adresse.data.gouv.fr/search/?q="+adresse2,true);
|
||||
req2.onreadystatechange = calcul;
|
||||
req2.send(null);
|
||||
}
|
||||
|
||||
// Fonction qui affiche le tableau des trois meilleurs
|
||||
function aff(){
|
||||
if(resListe.length == clasListe.length){
|
||||
fini = true;
|
||||
// On efface le nombre de clas traités
|
||||
document.getElementById("traitement").innerHTML = "";
|
||||
document.getElementById("clas").innerHTML = "";
|
||||
// On trie le tableau resListe (il se retrouve en un grand tableau avec toute les valeurs en vrac
|
||||
resListe.sort(function(a,b){
|
||||
if(a[1] > b[1]){
|
||||
return 1;
|
||||
}
|
||||
if(a[1] < b[1]){
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
// On prend les 3 premiers éléments du tableau
|
||||
tab = [];
|
||||
for(var i = 0; i < 3; i++){
|
||||
tab.push(resListe[i]);
|
||||
}
|
||||
resListe = tab;
|
||||
|
||||
// On va chercher ces trois CLAS dans le tableau clasListe
|
||||
tab = [];
|
||||
for(var i = 0; i < resListe.length; i++){// On va prendre le ième élément de clasListe
|
||||
tab.push(clasListe[resListe[i][0]]);
|
||||
}
|
||||
|
||||
// On affiche
|
||||
var res = document.getElementById("res");
|
||||
res.innerHTML = "";
|
||||
for(var i = 0; i < tab.length; i++){
|
||||
var a = i+1;
|
||||
var titre = "<b>" + a + " - " +tab[i].libelle+"</b>";
|
||||
res.innerHTML += titre;
|
||||
res.innerHTML += "<br/>";
|
||||
|
||||
if(tab[i].adres1.length > 3){
|
||||
res.innerHTML += tab[i].adres1;
|
||||
res.innerHTML += "<br/>";
|
||||
}
|
||||
|
||||
if(tab[i].adres2.length > 3){
|
||||
res.innerHTML += tab[i].adres2;
|
||||
res.innerHTML += "<br/>";
|
||||
}
|
||||
|
||||
res.innerHTML += tab[i].code_postal;
|
||||
res.innerHTML += " ";
|
||||
res.innerHTML += tab[i].ville;
|
||||
res.innerHTML += "<br/>";
|
||||
|
||||
if(tab[i].no_tel.length > 3){
|
||||
res.innerHTML += "Téléphone : ";
|
||||
res.innerHTML += tab[i].no_tel;
|
||||
res.innerHTML += "<br/>";
|
||||
}
|
||||
|
||||
if(tab[i].mail.length > 3){
|
||||
res.innerHTML += tab[i].mail;
|
||||
res.innerHTML += "<br/>";
|
||||
}
|
||||
|
||||
res.innerHTML += "Distance : ";
|
||||
res.innerHTML += resListe[i][1];
|
||||
res.innerHTML += " km";
|
||||
|
||||
res.innerHTML += "<br/><br/><br/>";
|
||||
}
|
||||
// On affiche la map et les moyens de locomotion
|
||||
document.getElementById("moyenLocomotion").style.display = "block";
|
||||
document.getElementById("map").style.display = "block";
|
||||
map = new google.maps.Map(document.getElementById("map"), {
|
||||
zoom: 12,
|
||||
center: point1,
|
||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||
});
|
||||
document.getElementById("map").style.width = '100%';
|
||||
document.getElementById("map").style.height = '750px';
|
||||
|
||||
// On définit ce qui va afficher l'itinéraire
|
||||
direction = new google.maps.DirectionsRenderer({
|
||||
map: map,
|
||||
suppressMarkers: true
|
||||
});
|
||||
|
||||
// On met les points sur la carte
|
||||
// 0 - La position du bonhomme
|
||||
pos = new google.maps.Marker({
|
||||
position: point1,
|
||||
title: adresse1,
|
||||
map: map
|
||||
});
|
||||
|
||||
// On lance le placement des points
|
||||
INCREMENT = 0;
|
||||
adresse2 = tab[0].adres1 + " " + tab[0].code_postal + " " + tab[0].ville;
|
||||
recherche(adresse1, adresse2);
|
||||
} else {
|
||||
if(fini == false){
|
||||
// On affiche le nombre de clas traités
|
||||
var gFin = 200;
|
||||
var b = Math.floor(gFin - (resListe.length*gFin/clasListe.length)) % gFin;
|
||||
var g = Math.floor(resListe.length*gFin/clasListe.length) % gFin;
|
||||
document.getElementById("traitement").innerHTML = "Distances calculées : <b style='color:rgb(0,"+g+","+b+")'>" + resListe.length + "</b>/<b style='color:rgb(0,"+gFin+",0)'>" + clasListe.length+"</b>";
|
||||
// On lance les recherches suivantes
|
||||
var clas = clasListe[INCREMENT];
|
||||
var adresse2 = clas.adres1 + " " + clas.code_postal + " " + clas.ville;
|
||||
recherche(adresse1, adresse2);
|
||||
// On affiche le nom du clas traité
|
||||
document.getElementById("clas").innerHTML = adresse2;
|
||||
}else{
|
||||
if(INCREMENT == 1){
|
||||
adresse3 = tab[1].adres1 + " " + tab[1].code_postal + " " + tab[1].ville;
|
||||
recherche(adresse1, adresse3);
|
||||
} else if(INCREMENT == 2){
|
||||
adresse4 = tab[2].adres1 + " " + tab[2].code_postal + " " + tab[2].ville;
|
||||
recherche(adresse1, adresse4);
|
||||
} else if(INCREMENT == 3){
|
||||
// On attend la fin des deux étapes précédentes pour afficher les deux derniers points
|
||||
// 1 - La position du premier point
|
||||
m1 = new google.maps.Marker({
|
||||
position: point2,
|
||||
title: adresse2,
|
||||
icon: icone1,
|
||||
map: map
|
||||
});
|
||||
|
||||
// 2 - La position du deuxième point
|
||||
m2 = new google.maps.Marker({
|
||||
position: point3,
|
||||
title: adresse3,
|
||||
icon: icone2,
|
||||
map: map
|
||||
});
|
||||
|
||||
// 3 - La position du troisième point
|
||||
m3 = new google.maps.Marker({
|
||||
position: point4,
|
||||
title: adresse4,
|
||||
icon: icone3,
|
||||
map: map
|
||||
});
|
||||
|
||||
// On réduit assez pour afficher les 3 boutons
|
||||
zoneMarqueurs = new google.maps.LatLngBounds();
|
||||
zoneMarqueurs.extend(pos.getPosition());
|
||||
zoneMarqueurs.extend(m1.getPosition());
|
||||
zoneMarqueurs.extend(m2.getPosition());
|
||||
zoneMarqueurs.extend(m3.getPosition());
|
||||
|
||||
map.fitBounds(zoneMarqueurs);
|
||||
|
||||
// Définition des listeners
|
||||
// Click gauche
|
||||
google.maps.event.addListener(m1, 'click', function(){
|
||||
itineraire(point1,point2);
|
||||
});
|
||||
google.maps.event.addListener(m2, 'click', function(){
|
||||
itineraire(point1,point3);
|
||||
});
|
||||
google.maps.event.addListener(m3, 'click', function(){
|
||||
itineraire(point1,point4);
|
||||
});
|
||||
// Click droit
|
||||
google.maps.event.addListener(map, 'rightclick', function(){
|
||||
map.fitBounds(zoneMarqueurs);
|
||||
});
|
||||
// MouseOver
|
||||
var info1 = new google.maps.InfoWindow({
|
||||
content: "<div id='content'>Distance : "+resListe[0][1]+" km</div>"
|
||||
});
|
||||
var info2 = new google.maps.InfoWindow({
|
||||
content: "<div id='content'>Distance : "+resListe[1][1]+" km</div>"
|
||||
});
|
||||
var info3 = new google.maps.InfoWindow({
|
||||
content: "<div id='content'>Distance : "+resListe[2][1]+" km</div>"
|
||||
});
|
||||
google.maps.event.addListener(m1, 'mouseover', function(){
|
||||
info1.open(map, m1);
|
||||
//m1.setAnimation(google.maps.Animation.BOUNCE);
|
||||
});
|
||||
google.maps.event.addListener(m2, 'mouseover', function(){
|
||||
info2.open(map, m2);
|
||||
//m2.setAnimation(google.maps.Animation.BOUNCE);
|
||||
});
|
||||
google.maps.event.addListener(m3, 'mouseover', function(){
|
||||
info3.open(map, m3);
|
||||
//m3.setAnimation(google.maps.Animation.BOUNCE);
|
||||
});
|
||||
// MouseOut
|
||||
google.maps.event.addListener(m1, 'mouseout', function(){
|
||||
info1.close(map, m1);
|
||||
//m1.setAnimation(null);
|
||||
});
|
||||
google.maps.event.addListener(m2, 'mouseout', function(){
|
||||
info2.close(map, m2);
|
||||
//m2.setAnimation(null);
|
||||
});
|
||||
google.maps.event.addListener(m3, 'mouseout', function(){
|
||||
info3.close(map, m3);
|
||||
//m3.setAnimation(null);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fonction CALLBACK
|
||||
function calcul(){
|
||||
if(req1.readyState == 4 && req2.readyState == 4){
|
||||
// Première requête
|
||||
if(req1.responseText.length == 123+adresse1.length){// On contrôle si la requête ADRESSE UTILISATEUR ne renvoie rien
|
||||
document.getElementById("res").innerHTML = "<b style='color:red'>L'adresse que vous avez indiqué est incorrecte.<b>";
|
||||
document.getElementById("traitement").innerHTML = "";
|
||||
document.getElementById("clas").innerHTML = "";
|
||||
} else {
|
||||
results1 = eval('(' + req1.responseText + ')');
|
||||
point1 = new google.maps.LatLng(results1.features[0].geometry.coordinates[1], results1.features[0].geometry.coordinates[0]);
|
||||
|
||||
// Deuxième requête
|
||||
results2 = eval('(' + req2.responseText + ')');
|
||||
if(fini==false){
|
||||
point2 = new google.maps.LatLng(results2.features[0].geometry.coordinates[1], results2.features[0].geometry.coordinates[0]);
|
||||
} else {
|
||||
if(INCREMENT == 0){
|
||||
point2 = new google.maps.LatLng(results2.features[0].geometry.coordinates[1], results2.features[0].geometry.coordinates[0]);
|
||||
} else if(INCREMENT == 1){
|
||||
point3 = new google.maps.LatLng(results2.features[0].geometry.coordinates[1], results2.features[0].geometry.coordinates[0]);
|
||||
} else if(INCREMENT == 2){
|
||||
point4 = new google.maps.LatLng(results2.features[0].geometry.coordinates[1], results2.features[0].geometry.coordinates[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// Calcul de la distance
|
||||
var distance = google.maps.geometry.spherical.computeDistanceBetween(point1, point2);
|
||||
distance = distance/1000;// On prend le nombre de km
|
||||
distance = Math.floor(distance*100)/100;//On réduit à deux chiffres après la virgule
|
||||
|
||||
var tableau = [];
|
||||
tableau.push(INCREMENT);
|
||||
tableau.push(distance);
|
||||
|
||||
resListe.push(tableau);
|
||||
|
||||
INCREMENT++;
|
||||
|
||||
aff();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fonction de calcul de l'initénaire
|
||||
function itineraire(origin, destination){
|
||||
// On contrôle le radiobutton qui est coché (au cas où l'utilisateur a fait F5 et que le bouton VOITURE n'est pas coché
|
||||
var btn = document.getElementsByName("moyenLocomotion");
|
||||
if(btn[1].checked){// Vélo coché
|
||||
voiture = false;
|
||||
velo = true;
|
||||
marche = false;
|
||||
} else if(btn[2].checked){// Marche cochée
|
||||
voiture = false;
|
||||
velo = false;
|
||||
marche = true;
|
||||
} else {// Voiture cochée (par défaut)
|
||||
voiture = true;
|
||||
velo = false;
|
||||
marche = false;
|
||||
}
|
||||
// On re-contrôle le radiobutton qui est coché
|
||||
var mode;
|
||||
if(voiture == true){
|
||||
mode = "DRIVING";
|
||||
} else if(velo == true){
|
||||
mode = "BICYCLING";
|
||||
} else if(marche == true){
|
||||
mode = "WALKING";
|
||||
}
|
||||
|
||||
// On change la valeur de is_m[n°]
|
||||
var TEMPS = 7000;
|
||||
if(destination == m1.position){
|
||||
is_m1 = true;
|
||||
is_m2 = false;
|
||||
is_m3 = false;
|
||||
if(m1.animation == null){
|
||||
m1.setAnimation(google.maps.Animation.BOUNCE);
|
||||
m2.setAnimation(null);
|
||||
m3.setAnimation(null);
|
||||
setTimeout(function(){m1.setAnimation(null)}, TEMPS);// Timer de TEMPS secondes pour l'animation
|
||||
}
|
||||
} else if(destination == m2.position){
|
||||
is_m1 = false;
|
||||
is_m2 = true;
|
||||
is_m3 = false;
|
||||
if(m2.animation == null){
|
||||
m1.setAnimation(null);
|
||||
m2.setAnimation(google.maps.Animation.BOUNCE);
|
||||
m3.setAnimation(null);
|
||||
setTimeout(function(){m2.setAnimation(null);}, TEMPS);
|
||||
}
|
||||
} else if(destination == m3.position){
|
||||
is_m1 = false;
|
||||
is_m2 = false;
|
||||
is_m3 = true;
|
||||
if(m3.animation == null){
|
||||
m1.setAnimation(null);
|
||||
m2.setAnimation(null);
|
||||
m3.setAnimation(google.maps.Animation.BOUNCE);
|
||||
setTimeout(function(){m3.setAnimation(null);}, TEMPS);
|
||||
}
|
||||
}
|
||||
|
||||
var request = {
|
||||
origin: origin,
|
||||
destination: destination,
|
||||
travelMode: google.maps.TravelMode[mode]
|
||||
}
|
||||
var directionsService = new google.maps.DirectionsService();
|
||||
directionsService.route(request, function(response, status){
|
||||
if(status == google.maps.DirectionsStatus.OK){
|
||||
direction.setDirections(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Fonction de changement de mode de locomotion
|
||||
function locomotion(mode){
|
||||
// On contrôle le mode
|
||||
if(mode == "D"){
|
||||
voiture = true;
|
||||
velo = false;
|
||||
marche = false;
|
||||
} else if(mode == "B"){
|
||||
voiture = false;
|
||||
velo = true;
|
||||
marche = false;
|
||||
} else if(mode == "W"){
|
||||
voiture = false;
|
||||
velo = false;
|
||||
marche = true;
|
||||
}
|
||||
|
||||
// On contrôle la destination
|
||||
if(is_m1){
|
||||
itineraire(point1, point2);
|
||||
} else if(is_m2){
|
||||
itineraire(point1, point3);
|
||||
} else if(is_m3){
|
||||
itineraire(point1, point4);
|
||||
}
|
||||
}
|
||||
|
||||
function controleDebut(){
|
||||
var a = document.getElementById("adresse").value.length;
|
||||
var c = document.getElementById("departement").value.length;
|
||||
var v = document.getElementById("ville").value.length;
|
||||
if(a>0 || c>0 || v>0){
|
||||
chercher();
|
||||
}
|
||||
}
|
||||
198
caotek_mesavoirs/static/js/jquery.cookiebar.js
Normal file
198
caotek_mesavoirs/static/js/jquery.cookiebar.js
Normal file
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* Copyright (C) 2012 PrimeBox (info@primebox.co.uk)
|
||||
*
|
||||
* This work is licensed under the Creative Commons
|
||||
* Attribution 3.0 Unported License. To view a copy
|
||||
* of this license, visit
|
||||
* http://creativecommons.org/licenses/by/3.0/.
|
||||
*
|
||||
* Documentation available at:
|
||||
* http://www.primebox.co.uk/projects/cookie-bar/
|
||||
*
|
||||
* When using this software you use it at your own risk. We hold
|
||||
* no responsibility for any damage caused by using this plugin
|
||||
* or the documentation provided.
|
||||
*/
|
||||
(function($){
|
||||
$.cookieBar = function(options,val){
|
||||
if(options=='cookies'){
|
||||
var doReturn = 'cookies';
|
||||
}else if(options=='set'){
|
||||
var doReturn = 'set';
|
||||
}else{
|
||||
var doReturn = false;
|
||||
}
|
||||
var defaults = {
|
||||
message: 'En poursuivant la navigation sur ce site, vous acceptez l’utilisation de Cookies.', //Message displayed on bar
|
||||
acceptButton: true, //Set to true to show accept/enable button
|
||||
acceptText: 'Accepter les cookies', //Text on accept/enable button
|
||||
acceptFunction: function(cookieValue){if(cookieValue!='enabled' && cookieValue!='accepted') window.location = window.location.href;}, //Function to run after accept
|
||||
declineButton: false, //Set to true to show decline/disable button
|
||||
declineText: 'Disable Cookies', //Text on decline/disable button
|
||||
declineFunction: function(cookieValue){if(cookieValue=='enabled' || cookieValue=='accepted') window.location = window.location.href;}, //Function to run after decline
|
||||
policyButton: false, //Set to true to show Privacy Policy button
|
||||
policyText: 'Privacy Policy', //Text on Privacy Policy button
|
||||
policyURL: '/privacy-policy/', //URL of Privacy Policy
|
||||
autoEnable: true, //Set to true for cookies to be accepted automatically. Banner still shows
|
||||
acceptOnContinue: false, //Set to true to accept cookies when visitor moves to another page
|
||||
acceptOnScroll: false, //Set to true to accept cookies when visitor scrolls X pixels up or down
|
||||
acceptAnyClick: false, //Set to true to accept cookies when visitor clicks anywhere on the page
|
||||
expireDays: 365, //Number of days for cookieBar cookie to be stored for
|
||||
renewOnVisit: false, //Renew the cookie upon revisit to website
|
||||
forceShow: false, //Force cookieBar to show regardless of user cookie preference
|
||||
effect: 'slide', //Options: slide, fade, hide
|
||||
element: 'body', //Element to append/prepend cookieBar to. Remember "." for class or "#" for id.
|
||||
append: false, //Set to true for cookieBar HTML to be placed at base of website. Actual position may change according to CSS
|
||||
fixed: false, //Set to true to add the class "fixed" to the cookie bar. Default CSS should fix the position
|
||||
bottom: false, //Force CSS when fixed, so bar appears at bottom of website
|
||||
zindex: '', //Can be set in CSS, although some may prefer to set here
|
||||
domain: String(window.location.hostname), //Location of privacy policy
|
||||
referrer: String(document.referrer) //Where visitor has come from
|
||||
};
|
||||
var options = $.extend(defaults,options);
|
||||
|
||||
//Sets expiration date for cookie
|
||||
var expireDate = new Date();
|
||||
expireDate.setTime(expireDate.getTime()+(options.expireDays*86400000));
|
||||
expireDate = expireDate.toGMTString();
|
||||
|
||||
var cookieEntry = 'cb-enabled={value}; expires='+expireDate+'; path=/';
|
||||
|
||||
//Retrieves current cookie preference
|
||||
var i,cookieValue='',aCookie,aCookies=document.cookie.split('; ');
|
||||
for (i=0;i<aCookies.length;i++){
|
||||
aCookie = aCookies[i].split('=');
|
||||
if(aCookie[0]=='cb-enabled'){
|
||||
cookieValue = aCookie[1];
|
||||
}
|
||||
}
|
||||
//Sets up default cookie preference if not already set
|
||||
if(cookieValue=='' && doReturn!='cookies' && options.autoEnable){
|
||||
cookieValue = 'enabled';
|
||||
document.cookie = cookieEntry.replace('{value}','enabled');
|
||||
}else if((cookieValue=='accepted' || cookieValue=='declined') && doReturn!='cookies' && options.renewOnVisit){
|
||||
document.cookie = cookieEntry.replace('{value}',cookieValue);
|
||||
}
|
||||
if(options.acceptOnContinue){
|
||||
if(options.referrer.indexOf(options.domain)>=0 && String(window.location.href).indexOf(options.policyURL)==-1 && doReturn!='cookies' && doReturn!='set' && cookieValue!='accepted' && cookieValue!='declined'){
|
||||
doReturn = 'set';
|
||||
val = 'accepted';
|
||||
}
|
||||
}
|
||||
if(doReturn=='cookies'){
|
||||
//Returns true if cookies are enabled, false otherwise
|
||||
if(cookieValue=='enabled' || cookieValue=='accepted'){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else if(doReturn=='set' && (val=='accepted' || val=='declined')){
|
||||
//Sets value of cookie to 'accepted' or 'declined'
|
||||
document.cookie = cookieEntry.replace('{value}',val);
|
||||
if(val=='accepted'){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
//Sets up enable/accept button if required
|
||||
var message = options.message.replace('{policy_url}',options.policyURL);
|
||||
|
||||
if(options.acceptButton){
|
||||
var acceptButton = '<a href="" class="cb-enable">'+options.acceptText+'</a>';
|
||||
}else{
|
||||
var acceptButton = '';
|
||||
}
|
||||
//Sets up disable/decline button if required
|
||||
if(options.declineButton){
|
||||
var declineButton = '<a href="" class="cb-disable">'+options.declineText+'</a>';
|
||||
}else{
|
||||
var declineButton = '';
|
||||
}
|
||||
//Sets up privacy policy button if required
|
||||
if(options.policyButton){
|
||||
var policyButton = '<a href="'+options.policyURL+'" class="cb-policy">'+options.policyText+'</a>';
|
||||
}else{
|
||||
var policyButton = '';
|
||||
}
|
||||
//Whether to add "fixed" class to cookie bar
|
||||
if(options.fixed){
|
||||
if(options.bottom){
|
||||
var fixed = ' class="fixed bottom"';
|
||||
}else{
|
||||
var fixed = ' class="fixed"';
|
||||
}
|
||||
}else{
|
||||
var fixed = '';
|
||||
}
|
||||
if(options.zindex!=''){
|
||||
var zindex = ' style="z-index:'+options.zindex+';"';
|
||||
}else{
|
||||
var zindex = '';
|
||||
}
|
||||
|
||||
//Displays the cookie bar if arguments met
|
||||
if(options.forceShow || cookieValue=='enabled' || cookieValue==''){
|
||||
if(options.append){
|
||||
$(options.element).append('<div id="cookie-bar"'+fixed+zindex+'><p>'+message+acceptButton+declineButton+policyButton+'</p></div>');
|
||||
}else{
|
||||
$(options.element).prepend('<div id="cookie-bar"'+fixed+zindex+'><p>'+message+acceptButton+declineButton+policyButton+'</p></div>');
|
||||
}
|
||||
}
|
||||
|
||||
var removeBar = function(func){
|
||||
if(options.acceptOnScroll) $(document).off('scroll');
|
||||
if(typeof(func)==='function') func(cookieValue);
|
||||
if(options.effect=='slide'){
|
||||
$('#cookie-bar').slideUp(300,function(){$('#cookie-bar').remove();});
|
||||
}else if(options.effect=='fade'){
|
||||
$('#cookie-bar').fadeOut(300,function(){$('#cookie-bar').remove();});
|
||||
}else{
|
||||
$('#cookie-bar').hide(0,function(){$('#cookie-bar').remove();});
|
||||
}
|
||||
$(document).unbind('click',anyClick);
|
||||
};
|
||||
var cookieAccept = function(){
|
||||
document.cookie = cookieEntry.replace('{value}','accepted');
|
||||
removeBar(options.acceptFunction);
|
||||
};
|
||||
var cookieDecline = function(){
|
||||
var deleteDate = new Date();
|
||||
deleteDate.setTime(deleteDate.getTime()-(864000000));
|
||||
deleteDate = deleteDate.toGMTString();
|
||||
aCookies=document.cookie.split('; ');
|
||||
for (i=0;i<aCookies.length;i++){
|
||||
aCookie = aCookies[i].split('=');
|
||||
if(aCookie[0].indexOf('_')>=0){
|
||||
document.cookie = aCookie[0]+'=0; expires='+deleteDate+'; domain='+options.domain.replace('www','')+'; path=/';
|
||||
}else{
|
||||
document.cookie = aCookie[0]+'=0; expires='+deleteDate+'; path=/';
|
||||
}
|
||||
}
|
||||
document.cookie = cookieEntry.replace('{value}','declined');
|
||||
removeBar(options.declineFunction);
|
||||
};
|
||||
var anyClick = function(e){
|
||||
if(!$(e.target).hasClass('cb-policy')) cookieAccept();
|
||||
};
|
||||
|
||||
$('#cookie-bar .cb-enable').click(function(){cookieAccept();return false;});
|
||||
$('#cookie-bar .cb-disable').click(function(){cookieDecline();return false;});
|
||||
if(options.acceptOnScroll){
|
||||
var scrollStart = $(document).scrollTop(),scrollNew,scrollDiff;
|
||||
$(document).on('scroll',function(){
|
||||
scrollNew = $(document).scrollTop();
|
||||
if(scrollNew>scrollStart){
|
||||
scrollDiff = scrollNew - scrollStart;
|
||||
}else{
|
||||
scrollDiff = scrollStart - scrollNew;
|
||||
}
|
||||
if(scrollDiff>=Math.round(options.acceptOnScroll)) cookieAccept();
|
||||
});
|
||||
}
|
||||
if(options.acceptAnyClick){
|
||||
$(document).bind('click',anyClick);
|
||||
}
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
30
caotek_mesavoirs/static/js/modal_popup - fileupl.js
Normal file
30
caotek_mesavoirs/static/js/modal_popup - fileupl.js
Normal file
@@ -0,0 +1,30 @@
|
||||
;
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#afficheJustifModal').on('show.bs.modal', function (event) { // id of the modal with event
|
||||
var button = $(event.relatedTarget); // Button that triggered the modal
|
||||
var justif_id = button.data('justifid'); // Extract info from data-* attributes
|
||||
var justif_titre = button.data('justifname');
|
||||
|
||||
// Update the modal's content.
|
||||
var modal = $(this);
|
||||
modal.find('.modal-title').text(justif_titre);
|
||||
modal.find('#imagesrc').attr('src',justif_id);
|
||||
|
||||
});
|
||||
$('#uploadJustifModal').on('show.bs.modal', function (event) { // id of the modal with event
|
||||
var button = $(event.relatedTarget); // Button that triggered the modal
|
||||
var justif_id = button.data('justifid'); // Extract info from data-* attributes
|
||||
var justif_titre = button.data('justifname');
|
||||
var justif_lib = button.data('justiflib');
|
||||
var justif_matricule = button.data('justifmatricule');
|
||||
|
||||
// Update the modal's content.
|
||||
var modal = $(this);
|
||||
modal.find('.modal-title').text('Envoi de ' + justif_titre);
|
||||
modal.find('.modal-lib').text(justif_lib);
|
||||
// modal.find('#iframesrc').attr('src',justif_id);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
29
caotek_mesavoirs/static/js/modal_popup.js
Normal file
29
caotek_mesavoirs/static/js/modal_popup.js
Normal file
@@ -0,0 +1,29 @@
|
||||
;
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#afficheJustifModal').on('show.bs.modal', function (event) { // id of the modal with event
|
||||
var button = $(event.relatedTarget); // Button that triggered the modal
|
||||
var justif_id = button.data('justifid'); // Extract info from data-* attributes
|
||||
var justif_titre = button.data('justifname');
|
||||
|
||||
// Update the modal's content.
|
||||
var modal = $(this);
|
||||
modal.find('.modal-title').text(justif_titre);
|
||||
modal.find('#imagesrc').attr('src',justif_id);
|
||||
|
||||
});
|
||||
$('#uploadJustifModal').on('show.bs.modal', function (event) { // id of the modal with event
|
||||
var button = $(event.relatedTarget); // Button that triggered the modal
|
||||
var justif_id = button.data('justifid'); // Extract info from data-* attributes
|
||||
var justif_titre = button.data('justifname');
|
||||
var justif_lib = button.data('justiflib');
|
||||
var justif_matricule = button.data('justifmatricule');
|
||||
|
||||
// Update the modal's content.
|
||||
var modal = $(this);
|
||||
modal.find('.modal-title').text('Envoi de ' + justif_titre);
|
||||
modal.find('.modal-lib').text(justif_lib);
|
||||
modal.find('#iframesrc').attr('src','/upload/' + justif_id + '/' + justif_matricule);
|
||||
|
||||
});
|
||||
});
|
||||
12
caotek_mesavoirs/static/js/reglement1x.js
Normal file
12
caotek_mesavoirs/static/js/reglement1x.js
Normal file
@@ -0,0 +1,12 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$(".select_bill").change(
|
||||
function () {
|
||||
if ($(".select_bill:checked").length) {
|
||||
$('button#calculate').removeProp('disabled');
|
||||
} else {
|
||||
$('button#calculate').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
12
caotek_mesavoirs/static/js/reglement_vac.js
Normal file
12
caotek_mesavoirs/static/js/reglement_vac.js
Normal file
@@ -0,0 +1,12 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$(".select_bill").change(
|
||||
function () {
|
||||
if ($(".select_bill:checked").length) {
|
||||
$('button#calculate').removeProp('disabled');
|
||||
} else {
|
||||
$('button#calculate').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user