2021-10-18 19:44:26 +02:00
|
|
|
<!doctype html>
|
|
|
|
|
|
|
|
<html lang="fr">
|
2022-02-12 20:04:05 +01:00
|
|
|
|
2021-10-18 19:44:26 +02:00
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
2022-01-26 10:00:01 +01:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
2022-02-12 20:04:05 +01:00
|
|
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
|
|
|
|
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
2022-02-13 12:12:58 +01:00
|
|
|
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
|
|
|
|
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
2022-02-12 20:04:05 +01:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
|
|
|
|
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
|
|
|
|
crossorigin="anonymous"></script>
|
|
|
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
|
|
|
|
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
|
|
|
|
crossorigin="anonymous"></script>
|
2022-02-18 18:39:51 +01:00
|
|
|
<script src="https://unpkg.com/@trevoreyre/autocomplete-js"></script>
|
|
|
|
<link
|
|
|
|
rel="stylesheet"
|
|
|
|
href="https://unpkg.com/@trevoreyre/autocomplete-js/dist/style.css"
|
|
|
|
/>
|
2021-10-18 19:44:26 +02:00
|
|
|
<title>Aquilenet: Éligibilité FTTH</title>
|
|
|
|
<style>
|
2022-02-12 20:04:05 +01:00
|
|
|
{% include 'style.css'%}
|
2021-10-18 19:44:26 +02:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2022-02-13 16:53:04 +01:00
|
|
|
<h1 class="text-center">
|
|
|
|
<a href="https://www.aquilenet.fr/" id="aquilenet-title">AQUILENET</a>
|
|
|
|
</h1>
|
2022-01-26 10:00:01 +01:00
|
|
|
<div id="mainContainer" class="container">
|
2022-02-12 11:50:57 +01:00
|
|
|
|
2022-01-26 10:00:01 +01:00
|
|
|
<div class="row d-flex justify-content-between align-items-center" data-parent="#mainContainer">
|
2022-02-12 11:50:57 +01:00
|
|
|
|
2022-01-26 10:00:01 +01:00
|
|
|
<div class="col-12 text-intro">
|
|
|
|
<div id="methodPto" class="collapse show testMethods">
|
2022-02-12 11:50:57 +01:00
|
|
|
|
2022-02-12 20:04:05 +01:00
|
|
|
<h2 class="text-center form-title">Test d'éligibilité par PTO</h2>
|
2022-02-13 12:54:39 +01:00
|
|
|
<form id="formPtoTest" method="post" action="/test/pto">
|
2022-01-26 10:00:01 +01:00
|
|
|
<div class="form-group" id="ptoForm">
|
|
|
|
<label class="form-label" for="pto-number">Numéro PTO</label>
|
2022-02-12 21:31:23 +01:00
|
|
|
<input autofocus required type="text" class="form-control" name="pto" id="pto-number" aria-describedby="ptoHelp"
|
2022-02-12 20:04:05 +01:00
|
|
|
placeholder="OOOO-XXXX-XXXX" oninvalid="this.setCustomValidity('Veuillez renseigner le PTO')"
|
|
|
|
oninput="setCustomValidity('')">
|
2022-02-12 11:50:57 +01:00
|
|
|
|
2022-02-12 20:04:05 +01:00
|
|
|
<small id="ptoHelp" class="form-text btn btn-link" data-toggle="collapse" data-target="#ptoInfo"
|
|
|
|
aria-expanded="true" aria-controls="ptoInfo">Où trouver mon numéro de PTO ?</small>
|
2022-01-26 10:00:01 +01:00
|
|
|
<div id="ptoInfo" class="collapse" aria-labelledby="ptoForm" data-parent="#ptoForm">
|
|
|
|
<div class="card-body">
|
2022-02-12 20:04:05 +01:00
|
|
|
PTO (Point de terminaison optique) est un numéro unique que vous pouvez trouver sur le boîtier de
|
|
|
|
raccordement de la fibre.
|
2022-01-26 10:00:01 +01:00
|
|
|
C'est un petit boîtier blanc installé dans la maison
|
|
|
|
<br>
|
|
|
|
<img src="{{url_for('static', filename='find_pto.jpg')}}" class="img-fluid" alt="Responsive image">
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-02-12 11:50:57 +01:00
|
|
|
</div>
|
2022-02-13 12:54:39 +01:00
|
|
|
<button id="buttonPtoTest" type="submit" class="btn btn-sable">Tester le PTO</button>
|
2022-01-26 10:00:01 +01:00
|
|
|
</form>
|
2022-02-12 11:50:57 +01:00
|
|
|
|
2022-01-26 15:57:46 +01:00
|
|
|
<br>
|
2022-02-12 20:04:05 +01:00
|
|
|
<button id="buttonNoPto" type="button" data-toggle="collapse" data-target=".testMethods"
|
2022-02-13 16:53:04 +01:00
|
|
|
class="btn btn-link page-nav-btn" aria-expanded="false" aria-controls="methodPto methodAddress">Je n'ai pas/ne trouve
|
2022-02-12 20:04:05 +01:00
|
|
|
pas le PTO, tester autrement</button>
|
2022-01-26 10:00:01 +01:00
|
|
|
</div>
|
|
|
|
|
2022-01-26 15:57:46 +01:00
|
|
|
<div id="methodAddress" class="collapse testMethods">
|
2022-02-12 20:04:05 +01:00
|
|
|
<h2 class="text-center form-title">Test d'éligibilité par adresse</h2>
|
2022-02-18 18:39:51 +01:00
|
|
|
|
2022-02-12 20:04:05 +01:00
|
|
|
<form id="formAddressTest" method="post" action="/test/address">
|
2022-02-18 18:39:51 +01:00
|
|
|
<div id="commune-form">
|
|
|
|
<label class="form-label" for="commune-autocomplete-input">Commune</label>
|
|
|
|
<div class="autocomplete" id="commune-autocomplete">
|
|
|
|
<input id="commune-autocomplete-input" class="autocomplete-input"
|
|
|
|
spellcheck="false" autocorrect="off" autocomplete="off"
|
|
|
|
autocapitalize="off" placeholder="Nom/Code Postal de la Commune"/>
|
|
|
|
<ul class="autocomplete-result-list"/>
|
2022-02-13 12:18:24 +01:00
|
|
|
</div>
|
2022-02-18 18:39:51 +01:00
|
|
|
</div>
|
|
|
|
<div class="collapse" id="voieForm">
|
|
|
|
<div id="voieFormContent">
|
|
|
|
<div id="street-number-form">
|
2022-02-12 20:04:05 +01:00
|
|
|
<label class="form-label" for="numeroVoieInput">Numéro de voie</label>
|
|
|
|
<input required type="text" name="numeroVoie" class="form-control" id="numeroVoieInput"
|
|
|
|
aria-describedby="numeroVoieHelp" placeholder="Numéro de voie"
|
|
|
|
oninvalid="this.setCustomValidity('Veuillez renseigner le numéro de voie')"
|
|
|
|
oninput="setCustomValidity('')">
|
|
|
|
</div>
|
2022-02-18 18:39:51 +01:00
|
|
|
<div id="street-name-form">
|
|
|
|
<label class="form-label" for="street-name-autocomplete-input">Nom de voie</label>
|
|
|
|
<div class="autocomplete" id="street-name-autocomplete">
|
|
|
|
<input id="street-name-autocomplete-input" class="autocomplete-input"
|
|
|
|
spellcheck="false" autocorrect="off" autocomplete="off"
|
|
|
|
autocapitalize="off" placeholder="Nom de voie"/>
|
|
|
|
<ul class="autocomplete-result-list"/>
|
|
|
|
</div>
|
2022-02-12 20:04:05 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-02-18 18:39:51 +01:00
|
|
|
</div>
|
|
|
|
<div id="btnTestAdresseContainer"><button id="btnTestAdresse" type="submit" class="btn btn-sable collapse">Tester l'adresse</button></div>
|
2022-02-12 20:04:05 +01:00
|
|
|
</form>
|
2022-02-18 18:39:51 +01:00
|
|
|
|
2022-01-26 15:57:46 +01:00
|
|
|
<br>
|
2022-02-12 20:04:05 +01:00
|
|
|
<button id="buttonReturnPto" type="button" data-toggle="collapse" data-target=".testMethods"
|
2022-02-13 16:53:04 +01:00
|
|
|
class="btn btn-link page-nav-btn" aria-expanded="false" aria-controls="methodPto methodAddress">Revenir au test par
|
2022-02-12 20:04:05 +01:00
|
|
|
PTO</button>
|
2022-01-26 10:00:01 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-01-26 15:57:46 +01:00
|
|
|
|
|
|
|
<script>
|
2022-02-12 20:04:05 +01:00
|
|
|
$(document).ready(function () {
|
|
|
|
|
|
|
|
// Global variables
|
2022-02-18 18:39:51 +01:00
|
|
|
let communes = []
|
|
|
|
let codeInsee = 0
|
|
|
|
let codeRivoli = ""
|
|
|
|
let voies = []
|
|
|
|
let voie = ""
|
2022-02-12 20:04:05 +01:00
|
|
|
|
|
|
|
function sanitizeInputStr(inputStr) {
|
|
|
|
|
|
|
|
inputStr = inputStr.replace(/[ÀÁÂÃÄÅàáâãäå]/g, "a");
|
|
|
|
inputStr = inputStr.replace(/[Ææ]/g, "ae");
|
|
|
|
inputStr = inputStr.replace(/[Çç]/g, "c");
|
|
|
|
inputStr = inputStr.replace(/[ÈÉÊËèéêë]/g, "e");
|
|
|
|
inputStr = inputStr.replace(/[ÌÍÎÏìíîï]/g, "i");
|
|
|
|
inputStr = inputStr.replace(/[Ññ]/g, "n");
|
|
|
|
inputStr = inputStr.replace(/[ÒÓÔÕÖòóôõö]/g, "o");
|
|
|
|
inputStr = inputStr.replace(/[ÙÚÛÜùúûü]/g, "u");
|
|
|
|
inputStr = inputStr.replace(/[Ýý]/g, "y");
|
|
|
|
inputStr = inputStr.replace(/[ß]/g, "ss");
|
|
|
|
|
|
|
|
return inputStr;
|
|
|
|
}
|
|
|
|
|
2022-02-13 16:53:04 +01:00
|
|
|
function setButtonSpinner(buttonSelector, buttonText) {
|
|
|
|
// disable button
|
|
|
|
$(buttonSelector).prop("disabled", true);
|
|
|
|
// add spinner to button
|
|
|
|
$(buttonSelector).html(
|
|
|
|
`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>${buttonText}`
|
2022-02-18 18:39:51 +01:00
|
|
|
);
|
2022-02-13 16:53:04 +01:00
|
|
|
}
|
|
|
|
|
2022-01-27 23:53:19 +01:00
|
|
|
$('#methodAddress').on('show.bs.collapse', function () {
|
|
|
|
$('#communeInput').trigger('input')
|
|
|
|
$('#communeInput').trigger('keyup')
|
2022-01-26 15:57:46 +01:00
|
|
|
});
|
2022-02-12 21:31:23 +01:00
|
|
|
$('#methodAddress').on('shown.bs.collapse', function () {
|
|
|
|
$('#communeInput').focus();
|
|
|
|
});
|
2022-01-27 23:53:19 +01:00
|
|
|
$('#voieForm').on('show.bs.collapse', function () {
|
|
|
|
$('#voieInput').trigger('input')
|
|
|
|
$('#voieInput').trigger('keyup')
|
|
|
|
});
|
2022-02-12 21:31:23 +01:00
|
|
|
$('#voieForm').on('shown.bs.collapse', function () {
|
|
|
|
$('#numeroVoieInput').focus();
|
|
|
|
});
|
2022-02-12 11:50:57 +01:00
|
|
|
|
2022-02-18 18:39:51 +01:00
|
|
|
const communeAutocompleteOptions = {
|
|
|
|
search: async (query) => {
|
|
|
|
const api = "addresses/communes?limit=100";
|
|
|
|
const reqUrl = query === '' ? api : `${api}&s=${query}`;
|
|
|
|
const source = await fetch(reqUrl);
|
|
|
|
const data = await source.json();
|
|
|
|
return data;
|
2022-02-13 12:18:24 +01:00
|
|
|
},
|
2022-02-18 18:39:51 +01:00
|
|
|
onSubmit: (res) => {
|
|
|
|
const searchInput = $('#commune-autocomplete-input');
|
|
|
|
searchInput.val(`${res.codeZip} - ${res.nom}`);
|
|
|
|
$("#voieForm").collapse("show");
|
|
|
|
codeInsee = res.codeInsee;
|
2022-02-13 12:18:24 +01:00
|
|
|
},
|
2022-02-18 18:39:51 +01:00
|
|
|
debounceTime: 300,
|
|
|
|
renderResult: (res, props) => `<li ${props}>${res.codeZip} - ${res.nom}</li>`
|
|
|
|
};
|
|
|
|
const autocompleteCommune = new Autocomplete("#commune-autocomplete", communeAutocompleteOptions);
|
|
|
|
|
|
|
|
const voieAutocompleteOptions = {
|
|
|
|
search: async (query) => {
|
|
|
|
const api = `addresses/fantoirvoies/${codeInsee}?limit=100`;
|
|
|
|
const reqUrl = query === '' ? api : `${api}&s=${query}`;
|
|
|
|
const source = await fetch(reqUrl);
|
|
|
|
const data = await source.json();
|
|
|
|
return Object.entries(data).map(e => {return {"name": e[0], "value": e[1]}; });
|
2022-02-13 12:18:24 +01:00
|
|
|
},
|
2022-02-18 18:39:51 +01:00
|
|
|
onSubmit: (res) => {
|
|
|
|
const searchInput = $("#street-name-autocomplete-input");
|
|
|
|
searchInput.val(res.name);
|
|
|
|
codeRivoli=res.value;
|
|
|
|
$('#btnTestAdresse').collapse('show');
|
2022-02-13 12:18:24 +01:00
|
|
|
},
|
2022-02-18 18:39:51 +01:00
|
|
|
debounceTime: 300,
|
|
|
|
renderResult: (res, props) => `<li ${props}>${res.name}</li>`
|
|
|
|
};
|
|
|
|
const autocompleteVoie = new Autocomplete("#street-name-autocomplete", voieAutocompleteOptions);
|
2022-02-12 20:04:05 +01:00
|
|
|
$('#formAddressTest').submit(function(eventObj) {
|
2022-02-13 16:53:04 +01:00
|
|
|
setButtonSpinner("#btnTestAdresse", "Test...");
|
2022-02-12 20:04:05 +01:00
|
|
|
$('#formAddressTest').append(`<input type="hidden" class="form-control" name="codeInsee" value="${codeInsee}" />`);
|
2022-02-13 00:26:31 +01:00
|
|
|
$('#formAddressTest').append(`<input type="hidden" class="form-control" name="codeRivoli" value="${codeRivoli}" />`);
|
2022-02-12 20:04:05 +01:00
|
|
|
return true;
|
|
|
|
});
|
2022-02-13 12:54:39 +01:00
|
|
|
$('#formPtoTest').submit(function(eventObj) {
|
2022-02-13 16:53:04 +01:00
|
|
|
setButtonSpinner("#buttonPtoTest", "Test...");
|
2022-02-13 12:54:39 +01:00
|
|
|
return true;
|
|
|
|
});
|
2022-01-26 15:57:46 +01:00
|
|
|
});
|
|
|
|
</script>
|
2021-10-18 19:44:26 +02:00
|
|
|
</body>
|
2022-02-12 20:04:05 +01:00
|
|
|
|
2022-02-12 23:32:32 +01:00
|
|
|
</html>
|