axione-elig-test/templates/landing_form.html

133 lines
6.2 KiB
HTML
Raw Normal View History

<!doctype html>
<html lang="fr">
<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">
<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-01-26 15:57:46 +01:00
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
2022-01-26 10:00:01 +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>
<title>Aquilenet: Éligibilité FTTH</title>
<style>
{% include 'style.css' %}
</style>
</head>
<body>
2022-01-26 10:00:01 +01:00
<h1 class="text-center" id="aquilenet-title">AQUILENET</h1>
<div id="mainContainer" class="container">
<div class="row d-flex justify-content-between align-items-center" data-parent="#mainContainer">
<div class="col-12 text-intro">
<div id="methodPto" class="collapse show testMethods">
<h2 class="text-center form-title">Test d'éligibilité par PTO</h1>
<form>
<div class="form-group" id="ptoForm">
<label class="form-label" for="pto-number">Numéro PTO</label>
<input required type="text" class="form-control" id="pto-number" aria-describedby="ptoHelp" placeholder="OOOO-XXXX-XXXX" oninvalid="this.setCustomValidity('Veuillez renseigner le PTO')" oninput="setCustomValidity('')">
<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>
<div id="ptoInfo" class="collapse" aria-labelledby="ptoForm" data-parent="#ptoForm">
<div class="card-body">
PTO (Point de terminaison optique) est un numéro unique que vous pouvez trouver sur le boîtier de raccordement de la fibre.
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>
</div>
<button type="submit" class="btn btn-sable">Tester le PTO</button>
</form>
2022-01-26 15:57:46 +01:00
<br>
2022-01-26 10:00:01 +01:00
<button id="buttonNoPto" type="button" data-toggle="collapse" data-target=".testMethods" class="btn btn-link" aria-expanded="false" aria-controls="methodPto methodAddress">Je n'ai pas/ne trouve pas le PTO, tester autrement</button>
</div>
2022-01-26 15:57:46 +01:00
<div id="methodAddress" class="collapse testMethods">
2022-01-26 10:00:01 +01:00
<h2 class="text-center form-title">Test d'éligibilité par adresse</h1>
<form>
2022-01-26 15:57:46 +01:00
<div class="form-group" id="communeForm">
<label class="form-label" for="communeInput">Commune</label>
<input type="text" list="communes" class="form-control" id="communeInput" aria-describedby="communeHelp" placeholder="Nom de la commune ou code postal">
<datalist id="communes">
</datalist>
</div>
<div class="form-row collapse waitCommune" id="voieForm">
<div class="col-sm-3 my-1">
<label class="form-label" for="numeroVoieInput">Numéro de voie</label>
<input type="text" class="form-control" id="numeroVoieInput" aria-describedby="numeroVoieHelp" placeholder="Numéro de voie">
</div>
<div class="col-sm-9 my-1">
<label class="form-label" for="voieInput">Nom de voie</label>
<input type="text" class="form-control" id="voieInput" aria-describedby="voieHelp" placeholder="Nom de voie">
2022-01-26 10:00:01 +01:00
</div>
2022-01-26 15:57:46 +01:00
</div>
<br>
<button id="btnTestAdresse" type="button" class="btn btn-sable collapse waitCommune">Tester l'adresse</button>
2022-01-26 10:00:01 +01:00
</form>
2022-01-26 15:57:46 +01:00
<br>
2022-01-26 10:00:01 +01:00
<button id="buttonReturnPto" type="button" data-toggle="collapse" data-target=".testMethods" class="btn btn-link" aria-expanded="false" aria-controls="methodPto methodAddress">Revenir au test par PTO</button>
</div>
</div>
</div>
</div>
2022-01-26 15:57:46 +01:00
<script>
$(document).ready(function(){
var communes=[]
function fillCommunes(search='') {
var api="addresses/communes";
if (search != '') {
api+="?s="+search;
}
$.ajax({
type: 'GET',
dataType:"json",
url: api,
success: function (data, status, xhr) {
if (JSON.stringify(data) !== JSON.stringify(communes)){
$("#communes").empty();
communes=data
for (let i = 0; i < 20; i++) {
if (! communes[i]) {
break;
}
$("#communes").append("<option codeInsee=" + communes[i].codeInsee + " value='" +
communes[i].codeZip + ' ' + communes[i].nom + "'></option>");
}
if (communes.length == 1) {
$('.waitCommune').addClass('show');
} else {
$('.waitCommune').removeClass('show');
}
}
}
});
}
$('#methodAddress').on('shown.bs.collapse', function () {
fillCommunes();
});
$('#communeInput').on('keyup', function () {
console.log("call ",$(this).val() )
fillCommunes($(this).val());
});
$('#communeInput').on('input', function() {
if ($(this).val() === '') {
$('.waitCommune').removeClass('show');
}
});
$('#buttonReturnPto').on('click', function() {
console.log("click")
$('#communeInput').val('');
$('.waitCommune').removeClass('show');
});
});
</script>
</body>
</html>