Compare commits

1 Commits

Author SHA1 Message Date
a872c70e93 add dynamic values to sms.html 2023-10-03 22:03:13 +02:00
5 changed files with 19 additions and 25 deletions

1
.gitignore vendored
View File

@@ -1 +0,0 @@
__pycacahe__/*

View File

@@ -7,3 +7,4 @@ Web app for tracking current ticket numbers
- keep all ticket numbers and timestamps in SQL table "tickets"
- display last ticket number
- don't allow tickets that are out of probable ticket number range
- if last submited ticket is timestamped more then 90 minutes ago, try to predict the next number

View File

@@ -1,6 +1,7 @@
from flask import render_template, request, redirect
from freeriders import app, db
from freeriders.models import Ticket
from datetime import datetime
import time
@app.route('/sms', methods=['GET'])
@@ -8,7 +9,10 @@ def sms():
if request.method == 'GET':
try:
lastticket = Ticket.query.order_by(Ticket.timestamp.desc()).first()
return render_template('sms.html', ticket = lastticket)
date = datetime.now()
datenow = f'{"{:02d}".format(date.day)}.{"{:02d}".format(date.month)}.{date.year}'
timenow = f'{"{:02d}".format(date.hour)}:{"{:02d}".format(date.minute)}:{date.second}'
return render_template('sms.html', ticket = lastticket, date = datenow, time = timenow)
except:
return 'Error retriving last ticket'
else:

View File

@@ -1,9 +1,9 @@
:root {
--border-radus: 1rem;
--background: #F9F9F9;
--header-background: #EEE;
--background: #EEE;
--header-background: #DDD;
--header-height: 3rem;
--input-bar-height: 3rem;
--input-bar-height: 2rem;
}
body{
@@ -14,13 +14,14 @@ body{
}
main {
max-width: 400px;
display: flex;
flex-direction: column;
align-self: flex-start;
gap: 1rem;
margin: 0 auto;
padding: 2rem 0.5rem;
height: calc(100vh - var(--header-height) - var(--input-bar-height));
padding: 1rem 0.5rem;
height: calc(100vh - 5rem);
overflow-y: scroll;
box-sizing: border-box;
}
@@ -29,25 +30,22 @@ header {
background-color: var(--header-background);
display: flex;
flex-direction: row;
align-items: center;
padding: 0 1rem;
padding: 1rem;
gap: 1rem;
font-weight: bold;
width: 100vw;
height: var(--header-height);
height: var(header-height);
box-sizing: border-box;
}
footer {
width: 100vw;
height: var(--input-bar-height);
background-color: var(--background);
height: var(input-bar-height);
background-color: #FDD;
display: flex;
flex-direction: row;
align-items: center;
padding: 0 1rem;
box-sizing: border-box;
gap: 1rem;
}
.request {
@@ -69,12 +67,4 @@ footer {
.date {
align-self: center;
margin-top: 0.5rem;
}
.textbox{
background-color: var(--header-background);
width: 80%;
height: 1rem;
padding: 0.2rem;
border-radius: 2rem;
}

View File

@@ -20,8 +20,8 @@
U Beogradu, za broj telefona ste kupili
VREMENSKU KARTU OD 90 MINUTA U ZONI A po
ceni od 50 din + osnovna cena poruke,
koja vazi do 03.10.2023, 09:42:54.
Karta broj: 0000343232.
koja vazi do {{ date }}, {{ time }}.
Karta broj: {{ ticket }}.
Placanjem operateru izmirujete dugovanja
za ovu kartu prema JKP Naplata prevozne
usluge Beograd. Sacuvajte ovu poruku.
@@ -59,4 +59,4 @@
<div>x</div>
</footer>
</body>
</html>
</html>