Mobile lay-out

This commit is contained in:
Abel 2022-01-03 16:56:05 +01:00
parent cc49ef43e4
commit 0e65ea8d3a
3 changed files with 43 additions and 19 deletions

32
main.py
View File

@ -43,18 +43,26 @@ def search_mp(product, postalcode, houseno, houseno_ext=''):
def flash_results(results):
for mp in results['meteringPoints']:
print(mp['specialMeteringPoint'])
result = str(mp['ean']) + ';' + \
str(mp['product']) + ';' + \
str(mp['address']['street']) + ';' + \
str(mp['address']['streetNumber']) + ';' + \
result = str(mp['address']['streetNumber']) + ';' + \
str(mp['address']['streetNumberAddition'] if 'streetNumberAddition' in mp['address'] else '') + ';' + \
str(mp['address']['city']) + ';' + \
str(mp['product']) + ';' + \
str(mp['ean']) + ';' + \
('Nee' if mp['specialMeteringPoint'] is False else 'Ja') + ';' + \
str(mp['organisation']) + ';' + \
str(mp['gridOperatorEan'])
str(mp['organisation']) + ';'
flash(result, 'results')
return
def flash_address(results):
for mp in results['meteringPoints']:
print(mp['specialMeteringPoint'])
result = 'Gevonden resultaten voor: ' + \
str(mp['address']['postalCode']) + ' ' + \
str(mp['address']['street']) + ' ' + \
str(mp['address']['streetNumber']) + ' ' + \
str(mp['address']['city'])
flash(result, 'info')
break
return
class ReusableForm(Form):
postalcode = StringField('Postcode:', validators=[validators.InputRequired(), validators.Length(min=6, max=6)])
@ -65,21 +73,19 @@ class ReusableForm(Form):
def home():
form = ReusableForm(request.form)
print(form.errors)
if form.validate():
print(form.errors)
if request.method == 'POST':
postalcode = request.form['postalcode']
houseno = request.form['houseno']
houseno_ext = request.form['houseno_ext']
results = search_mp('ELK', postalcode, houseno, houseno_ext)
flash_address(results)
flash_results(results)
results = search_mp('GAS', postalcode, houseno, houseno_ext)
flash_results(results)
if form.validate():
# Save the comment here.
flash('Gevonden resultaten voor: ' + postalcode + ' ' + houseno + ' ' + houseno_ext, 'info')
else:
flash('Postcode + huisnummer zijn verplicht.', 'info')
return render_template('index.html', form=form)

View File

@ -2,6 +2,9 @@ body {
margin: 0;
padding: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14pt;
line-size: 133%;
color: #444;
}
/*
@ -25,6 +28,17 @@ header h1.logo:hover {
color: #fff;
text-decoration: none;
}
input[type='text'] {
font-size: 150%;
font-family: monospace;
}
input[type='submit'] {
font-size: 150%;
font-family: monospace;
}
/*
* Centering the body content
*/
@ -45,6 +59,7 @@ div.form-group {
background-color: #1c3054;
color: whitesmoke;
text-align: left;
font-size: 150%;
margin: 10pt;
vertical-align: middle;
overflow: hidden;
@ -73,10 +88,9 @@ div.entry-label {
div.entry-text {
min-width: 80%
font-size: 150%;
}
div.messages {
padding: 10px 10px 10px 10px;
background-color: #1c3054;
@ -96,6 +110,7 @@ div.results {
color: #1c3054;
text-align: left;
margin: 10pt;
font-size: 100%;
vertical-align: middle;
float: left;
-webkit-border-radius: 6px;
@ -116,7 +131,7 @@ div.input-submit {
text-align: center;
margin: 7pt;
padding: 7pt;
color: #212121;
font-size: 150%;
}

View File

@ -17,11 +17,11 @@
<div class="entry-group">
<div class="entry-label"><label for="houseno_ext">Toevoeging:</label></div>
<div class="entry-text"><input type="text" id="houseno_ext" name="houseno_ext" placeholder="een huisnummer toevoeging?"></div>
<div class="entry-text"><input type="text" id="houseno_ext" name="houseno_ext" placeholder="Toevoeging?"></div>
</div>
<div class="input-submit">
<input type="submit" class="btn-search" value="Zoek">
<input type="Submit" class="input-submit" value="Zoek">
</div>
</form>
@ -42,7 +42,10 @@
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<table class="results">
<tr><th>EAN Aansluiting</th><th>Product</th><th>Straatnaam</th><th>Huisnr.</th><th>Toev.</th><th>Woonplaats</th><th>Bijz. aansl.</th><th>Netbeheerder</th><th>EAN Netbeheerder</th></tr>
<tr><th>Huisnr.</th><th>Toev.</th>
<th>Product</th><th>EAN Aansluiting</th>
<th>Bijz. aansl.</th><th>Netbeheerder</th>
</tr>
{% for category, message in messages %}
<tr>
{% if category == 'results' %}