Add messages to the current job’s history

This mocks out a data structure for a job’s messages, and renders this data:
- on the notification page, as a table, which links through to…
- …the page for an indidivual message
This commit is contained in:
Chris Hill-Scott
2015-12-17 11:14:19 +00:00
parent 6bdc0d3fce
commit aa0663cad8
8 changed files with 162 additions and 32 deletions

View File

@@ -3,4 +3,4 @@ from flask import Blueprint
main = Blueprint('main', __name__)
from app.main.views import index, sign_in, register, two_factor, verify, sms, add_service, code_not_received
from app.main.views import index, sign_in, register, two_factor, verify, sms, add_service, code_not_received, jobs

View File

@@ -45,21 +45,6 @@ def checkemail():
return render_template('views/check-email.html')
@main.route("/jobs")
def showjobs():
return render_template('views/jobs.html')
@main.route("/jobs/job")
def showjob():
return render_template('views/job.html')
@main.route("/jobs/job/notification")
def shownotification():
return render_template('views/notification.html')
@main.route("/forgot-password")
def forgotpassword():
return render_template('views/forgot-password.html')

70
app/main/views/jobs.py Normal file
View File

@@ -0,0 +1,70 @@
from flask import render_template
from app.main import main
messages = [
{
'phone': '+44 7700 900 579',
'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires…',
'status': 'Delivered',
'time': '13:42',
'id': '0'
},
{
'phone': '+44 7700 900 306',
'message': 'Vehicle tax: Your vehicle tax for PL53 GBD expires…',
'status': 'Delivered',
'time': '13:42',
'id': '1'
},
{
'phone': '+44 7700 900 454',
'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires…',
'status': 'Delivered',
'time': '13:42',
'id': '2'
},
{
'phone': '+44 7700 900 522',
'message': 'Vehicle tax: Your vehicle tax for RE67 PLM expires…',
'status': 'Failed',
'time': '13:42',
'id': '3'
}
]
@main.route("/jobs")
def showjobs():
return render_template('views/jobs.html')
@main.route("/jobs/job/")
def showjob():
return render_template(
'views/job.html',
messages=messages,
counts={
'total': len(messages),
'delivered': len([
message for message in messages if message['status'] == 'Delivered'
]),
'failed': len([
message for message in messages if message['status'] == 'Failed'
])
},
cost='£0.00',
uploaded_file_name='contact-demo.csv',
template_used='Reminder template'
)
@main.route("/jobs/job/notification/<string:notification_id>")
def shownotification(notification_id):
return render_template(
'views/notification.html',
message=[
message for message in messages if message['id'] == notification_id
][0]
)