Compare commits

..

No commits in common. "nin/redo-front" and "master" have entirely different histories.

9 changed files with 90 additions and 153 deletions

View file

@ -71,14 +71,8 @@ def query_axione(cfg, body):
timeout=120, timeout=120,
) )
conn.request("POST", "/v3/fai", body, headers=headers) conn.request("POST", "/v3/fai", body, headers=headers)
print("")
print("[+] REQUEST")
print(body)
response = conn.getresponse() response = conn.getresponse()
respData = response.read() respData = response.read()
print("")
print("[+] RESPONSE")
print(respData)
except Exception as e: except Exception as e:
print("Error while querying Axione: ", file=sys.stderr) print("Error while querying Axione: ", file=sys.stderr)
print(str(e), file=sys.stderr) print(str(e), file=sys.stderr)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
.autocomplete-input{border:1px solid #eee;border-radius:8px;width:100%;padding:12px 12px 12px 48px;box-sizing:border-box;position:relative;font-size:16px;line-height:1.5;flex:1;background-color:#eee;background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNjY2IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PGNpcmNsZSBjeD0iMTEiIGN5PSIxMSIgcj0iOCIvPjxwYXRoIGQ9Ik0yMSAyMWwtNC00Ii8+PC9zdmc+");background-repeat:no-repeat;background-position:12px}.autocomplete-input:focus,.autocomplete-input[aria-expanded=true]{border-color:rgba(0,0,0,.12);background-color:#fff;outline:none;box-shadow:0 2px 2px rgba(0,0,0,.16)}[data-position=below] .autocomplete-input[aria-expanded=true]{border-bottom-color:transparent;border-radius:8px 8px 0 0}[data-position=above] .autocomplete-input[aria-expanded=true]{border-top-color:transparent;border-radius:0 0 8px 8px;z-index:2}.autocomplete[data-loading=true]:after{content:"";border:3px solid rgba(0,0,0,.12);border-right-color:rgba(0,0,0,.48);border-radius:100%;width:20px;height:20px;position:absolute;right:12px;top:50%;transform:translateY(-50%);animation:rotate 1s linear infinite}.autocomplete-result-list{margin:0;border:1px solid rgba(0,0,0,.12);padding:0;box-sizing:border-box;max-height:296px;overflow-y:auto;background:#fff;list-style:none;box-shadow:0 2px 2px rgba(0,0,0,.16)}[data-position=below] .autocomplete-result-list{margin-top:-1px;border-top-color:transparent;border-radius:0 0 8px 8px;padding-bottom:8px}[data-position=above] .autocomplete-result-list{margin-bottom:-1px;border-bottom-color:transparent;border-radius:8px 8px 0 0;padding-top:8px}.autocomplete-result{cursor:default;padding:12px 12px 12px 48px;background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjY2NjIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PGNpcmNsZSBjeD0iMTEiIGN5PSIxMSIgcj0iOCIvPjxwYXRoIGQ9Ik0yMSAyMWwtNC00Ii8+PC9zdmc+");background-repeat:no-repeat;background-position:12px}.autocomplete-result:hover,.autocomplete-result[aria-selected=true]{background-color:rgba(0,0,0,.06)}@keyframes rotate{0%{transform:translateY(-50%) rotate(0deg)}to{transform:translateY(-50%) rotate(359deg)}}

File diff suppressed because one or more lines are too long

View file

@ -5,21 +5,19 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="{{url_for('static', filename='boostrap-4.3.1.min.css')}}" <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"> integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="{{url_for('static', filename='jquery-3.3.1.slim.min.js')}}" <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="{{url_for('static', filename='popper-1.14.7.min.js')}}" <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="{{url_for('static', filename='bootstrap-4.3.1.min.js')}}" <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="{{url_for('static', filename='trevorevre-autocomplete-js.min.js')}}"></script> <script src="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.6/dist/autoComplete.min.js"></script>
<link <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.6/dist/css/autoComplete.02.min.css">
rel="stylesheet"
href="{{url_for('static', filename='trevorevre-autocomplete-js-style.css')}}"
/>
<title>Aquilenet: Éligibilité FTTH</title> <title>Aquilenet: Éligibilité FTTH</title>
<style> <style>
{% include 'style.css'%} {% include 'style.css'%}
@ -68,40 +66,27 @@
<div id="methodAddress" class="collapse testMethods"> <div id="methodAddress" class="collapse testMethods">
<h2 class="text-center form-title">Test d'éligibilité par adresse</h2> <h2 class="text-center form-title">Test d'éligibilité par adresse</h2>
<form id="formAddressTest" method="post" action="/test/address"> <form id="formAddressTest" method="post" action="/test/address">
<div id="commune-form"> <div class="form-group row" id="communeForm">
<label class="form-label" for="commune-autocomplete-input">Commune</label> <label class="form-label col-sm-2 my-1" for="commune-autocomplete">Commune</label>
<div class="autocomplete" id="commune-autocomplete"> <input id="commune-autocomplete" class="col-sm-9" type="search" dir="ltr" spellcheck=false autocorrect="off" autocomplete="off" class="form-control" autocapitalize="off"/>
<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"/>
</div> </div>
</div> <div class="form-row collapse" id="voieForm">
<div class="collapse" id="voieForm"> <div class="col-sm-3 my-1">
<div id="voieFormContent">
<div id="street-number-form">
<label class="form-label" for="numeroVoieInput">Numéro de voie</label> <label class="form-label" for="numeroVoieInput">Numéro de voie</label>
<input required type="text" name="numeroVoie" class="form-control" id="numeroVoieInput" <input required type="text" name="numeroVoie" class="form-control" id="numeroVoieInput"
aria-describedby="numeroVoieHelp" placeholder="Numéro de voie" aria-describedby="numeroVoieHelp" placeholder="Numéro de voie"
oninvalid="this.setCustomValidity('Veuillez renseigner le numéro de voie')" oninvalid="this.setCustomValidity('Veuillez renseigner le numéro de voie')"
oninput="setCustomValidity('')"> oninput="setCustomValidity('')">
</div> </div>
<div id="street-name-form"> <div class="col-sm-7 my-1">
<label class="form-label" for="street-name-autocomplete-input">Nom de voie</label> <label class="form-label" for="fantoir-autocomplete">Nom de voie</label>
<div class="autocomplete" id="street-name-autocomplete"> <input id="fantoir-autocomplete" class="form-control" type="search" dir="ltr" spellcheck=false autocorrect="off" autocomplete="off" autocapitalize="off"/>
<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>
</div> </div>
</div> </div>
</div> <br>
<div id="btnTestAdresseContainer"><button id="btnTestAdresse" type="submit" class="btn btn-sable collapse">Tester l'adresse</button></div> <button id="btnTestAdresse" type="submit" class="btn btn-sable collapse">Tester l'adresse</button>
</form> </form>
<br> <br>
<button id="buttonReturnPto" type="button" data-toggle="collapse" data-target=".testMethods" <button id="buttonReturnPto" type="button" data-toggle="collapse" data-target=".testMethods"
class="btn btn-link page-nav-btn" aria-expanded="false" aria-controls="methodPto methodAddress">Revenir au test par class="btn btn-link page-nav-btn" aria-expanded="false" aria-controls="methodPto methodAddress">Revenir au test par
@ -114,12 +99,18 @@
<script> <script>
$(document).ready(function () { $(document).ready(function () {
// AbortController allows to cancel promises
const controllerCommunes = new AbortController();
const { signalCommunes } = controllerCommunes;
const controllerVoies = new AbortController();
const { signalVoies } = controllerVoies;
// Global variables // Global variables
let communes = [] var communes = []
let codeInsee = 0 var codeInsee = 0
let codeRivoli = "" var codeRivoli = ""
let voies = [] var voies = []
let voie = "" var voie = ""
function sanitizeInputStr(inputStr) { function sanitizeInputStr(inputStr) {
@ -143,7 +134,7 @@
// add spinner to button // add spinner to button
$(buttonSelector).html( $(buttonSelector).html(
`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>${buttonText}` `<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>${buttonText}`
); );
} }
$('#methodAddress').on('show.bs.collapse', function () { $('#methodAddress').on('show.bs.collapse', function () {
@ -161,43 +152,72 @@
$('#numeroVoieInput').focus(); $('#numeroVoieInput').focus();
}); });
const communeAutocompleteOptions = { const autoCompleteCommune = new autoComplete({
search: async (query) => { selector: "#commune-autocomplete",
const api = "addresses/communes?limit=100"; placeHolder: "Code postal/nom de commune...",
const reqUrl = query === '' ? api : `${api}&s=${query}`; data: {
const source = await fetch(reqUrl); src: async (query) => {
const data = await source.json(); const api = "addresses/communes?limit=100";
return data; const reqUrl = query === '' ? api : api + "&s=" + query
const source = await fetch(reqUrl, { signalCommunes });
const data = await source.json();
return data;
},
keys: [ "codeZip", "nom" ],
}, },
onSubmit: (res) => { resultList: {
const searchInput = $('#commune-autocomplete-input'); element: (list, data) => {
searchInput.val(`${res.codeZip} - ${res.nom}`); }
$("#voieForm").collapse("show");
codeInsee = res.codeInsee;
}, },
debounceTime: 300, resultItem: {
renderResult: (res, props) => `<li ${props}>${res.codeZip} - ${res.nom}</li>` highlight: true
}; },
const autocompleteCommune = new Autocomplete("#commune-autocomplete", communeAutocompleteOptions); debounce: 300,
events: {
input: {
selection: (event) => {
const selection = event.detail.selection.value;
autoCompleteCommune.input.value = selection.codeZip + " - " + selection.nom ;
codeInsee = selection.codeInsee;
$("#voieForm").collapse("show");
}
}
}
});
const voieAutocompleteOptions = { const autoCompleteFantoir = new autoComplete({
search: async (query) => { selector: "#fantoir-autocomplete",
const api = `addresses/fantoirvoies/${codeInsee}?limit=100`; placeHolder: "Nom de la voie...",
const reqUrl = query === '' ? api : `${api}&s=${query}`; data: {
const source = await fetch(reqUrl); src: async (query) => {
const data = await source.json(); const api = "addresses/fantoirvoies/" + codeInsee + "?limit=100";
return Object.entries(data).map(e => {return {"name": e[0], "value": e[1]}; }); const reqUrl = query === '' ? api : api + "&s=" + query
const source = await fetch(reqUrl, { signalVoies });
const data = await source.json();
return Object.entries(data).map(e => {return {"name": e[0], "value": e[1]}; });
},
keys: [ "name" ],
}, },
onSubmit: (res) => { resultList: {
const searchInput = $("#street-name-autocomplete-input"); element: (list, data) => {
searchInput.val(res.name); }
codeRivoli=res.value;
$('#btnTestAdresse').collapse('show');
}, },
debounceTime: 300, resultItem: {
renderResult: (res, props) => `<li ${props}>${res.name}</li>` highlight: true
}; },
const autocompleteVoie = new Autocomplete("#street-name-autocomplete", voieAutocompleteOptions); debounce: 300,
events: {
input: {
selection: (event) => {
const selection = event.detail.selection.value;
autoCompleteFantoir.input.value = selection.name;
codeRivoli = selection.value;
$('#btnTestAdresse').collapse('show');
}
}
}
});
$('#formAddressTest').submit(function(eventObj) { $('#formAddressTest').submit(function(eventObj) {
setButtonSpinner("#btnTestAdresse", "Test..."); setButtonSpinner("#btnTestAdresse", "Test...");
$('#formAddressTest').append(`<input type="hidden" class="form-control" name="codeInsee" value="${codeInsee}" />`); $('#formAddressTest').append(`<input type="hidden" class="form-control" name="codeInsee" value="${codeInsee}" />`);

View file

@ -99,57 +99,3 @@ td {
padding-left: 1em; padding-left: 1em;
padding-right: 1em; padding-right: 1em;
} }
/*
********************
Form Styles
*******************
*/
#commune-form {
margin-top: 2em;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
#commune-autocomplete {
margin-left: 1em;
width: 65%;
}
#voieFormContent {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 1em;
width: 100%;
justify-content: center;
}
#voieFormContent > div {
margin-right: 1em;
}
#street-number-form {
width: 20%;
}
#street-name-form {
width: 51%;
}
#numeroVoieInput {
padding: 12px;
height: 3em;
}
#btnTestAdresseContainer {
margin-top: 2em;
display: flex;
width: 100%;
justify-content: center;
flex-direction: row;
}