mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 02:42:26 -05:00
Merge with master.
This commit is contained in:
@@ -3,4 +3,6 @@ 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, dashboard, templates
|
||||
)
|
||||
|
||||
62
app/main/views/_jobs.py
Normal file
62
app/main/views/_jobs.py
Normal file
@@ -0,0 +1,62 @@
|
||||
jobs = [
|
||||
{
|
||||
'job': 'Test message 1',
|
||||
'file': 'dispatch_20151114.csv',
|
||||
'time': 'Just now',
|
||||
'status': 'Queued'
|
||||
},
|
||||
{
|
||||
'job': 'Mickey Mouse',
|
||||
'file': 'dispatch_20151117.csv',
|
||||
'time': '5 minutes ago',
|
||||
'status': 'Delivered'
|
||||
},
|
||||
{
|
||||
'job': 'Asdfgg',
|
||||
'file': 'remdinder_monday.csv',
|
||||
'time': '30 minutes ago',
|
||||
'status': 'Failed'
|
||||
},
|
||||
{
|
||||
'job': 'Test message 2',
|
||||
'file': 'appointments_wed.csv',
|
||||
'time': '2 hours ago',
|
||||
'status': 'Delivered'
|
||||
},
|
||||
{
|
||||
'job': 'Reminder file',
|
||||
'file': 'appointments_mon.csv',
|
||||
'time': '11:44 Yesterday',
|
||||
'status': 'Delivered'
|
||||
},
|
||||
{
|
||||
'job': 'Test message 1',
|
||||
'file': 'dispatch_20151114.csv',
|
||||
'time': '20 Jun 2015',
|
||||
'status': 'Queued'
|
||||
},
|
||||
{
|
||||
'job': 'Mickey Mouse',
|
||||
'file': 'dispatch_20151117.csv',
|
||||
'time': '18 Jun 2015',
|
||||
'status': 'Delivered'
|
||||
},
|
||||
{
|
||||
'job': 'Asdfgg',
|
||||
'file': 'remdinder_monday.csv',
|
||||
'time': '11 Jun 2015',
|
||||
'status': 'Failed'
|
||||
},
|
||||
{
|
||||
'job': 'Test message 2',
|
||||
'file': 'appointments_wed.csv',
|
||||
'time': '11 Jun 2015',
|
||||
'status': 'Delivered'
|
||||
},
|
||||
{
|
||||
'job': 'Final reminder',
|
||||
'file': 'appointments_mon.csv',
|
||||
'time': '11 Jun 2015',
|
||||
'status': 'Delivered'
|
||||
}
|
||||
]
|
||||
15
app/main/views/dashboard.py
Normal file
15
app/main/views/dashboard.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from flask import render_template
|
||||
|
||||
from app.main import main
|
||||
|
||||
from ._jobs import jobs
|
||||
|
||||
|
||||
@main.route("/dashboard")
|
||||
def dashboard():
|
||||
return render_template(
|
||||
'views/dashboard.html',
|
||||
jobs=jobs,
|
||||
free_text_messages_remaining=560,
|
||||
spent_this_month='0.00'
|
||||
)
|
||||
@@ -24,17 +24,6 @@ def verifymobile():
|
||||
return render_template('views/verify-mobile.html')
|
||||
|
||||
|
||||
@main.route("/text-not-received-2")
|
||||
def textnotreceived2():
|
||||
return render_template('views/text-not-received-2.html')
|
||||
|
||||
|
||||
@main.route("/dashboard")
|
||||
@login_required
|
||||
def dashboard():
|
||||
return render_template('views/dashboard.html')
|
||||
|
||||
|
||||
@main.route("/send-email")
|
||||
def sendemail():
|
||||
return render_template('views/send-email.html')
|
||||
@@ -45,21 +34,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')
|
||||
@@ -93,13 +67,3 @@ def apikeys():
|
||||
@main.route("/verification-not-received")
|
||||
def verificationnotreceived():
|
||||
return render_template('views/verification-not-received.html')
|
||||
|
||||
|
||||
@main.route("/manage-templates")
|
||||
def managetemplates():
|
||||
return render_template('views/manage-templates.html')
|
||||
|
||||
|
||||
@main.route("/edit-template")
|
||||
def edittemplate():
|
||||
return render_template('views/edit-template.html')
|
||||
|
||||
80
app/main/views/jobs.py
Normal file
80
app/main/views/jobs.py
Normal file
@@ -0,0 +1,80 @@
|
||||
import time
|
||||
from flask import render_template
|
||||
from app.main import main
|
||||
|
||||
from ._jobs import jobs
|
||||
|
||||
now = time.strftime('%H:%M')
|
||||
|
||||
messages = [
|
||||
{
|
||||
'phone': '+44 7700 900 579',
|
||||
'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
||||
'status': 'Delivered',
|
||||
'time': now,
|
||||
'id': '0'
|
||||
},
|
||||
{
|
||||
'phone': '+44 7700 900 306',
|
||||
'message': 'Vehicle tax: Your vehicle tax for PL53 GBD expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
||||
'status': 'Delivered',
|
||||
'time': now,
|
||||
'id': '1'
|
||||
},
|
||||
{
|
||||
'phone': '+44 7700 900 454',
|
||||
'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
||||
'status': 'Delivered',
|
||||
'time': now,
|
||||
'id': '2'
|
||||
},
|
||||
{
|
||||
'phone': '+44 7700 900 522',
|
||||
'message': 'Vehicle tax: Your vehicle tax for RE67 PLM expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
||||
'status': 'Failed',
|
||||
'time': now,
|
||||
'id': '3'
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@main.route("/jobs")
|
||||
def showjobs():
|
||||
return render_template(
|
||||
'views/jobs.html',
|
||||
jobs=jobs
|
||||
)
|
||||
|
||||
|
||||
@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='dispatch_20151114.csv',
|
||||
uploaded_file_time=now,
|
||||
template_used='Test message 1',
|
||||
flash_message='We’ve started sending your messages'
|
||||
)
|
||||
|
||||
|
||||
@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],
|
||||
delivered_at=now,
|
||||
uploaded_at=now
|
||||
)
|
||||
32
app/main/views/templates.py
Normal file
32
app/main/views/templates.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from flask import request, render_template, redirect, url_for
|
||||
|
||||
from app.main import main
|
||||
|
||||
|
||||
@main.route("/templates")
|
||||
def manage_templates():
|
||||
return render_template('views/manage-templates.html')
|
||||
|
||||
|
||||
@main.route("/templates/template", methods=['GET', 'POST'])
|
||||
def add_template():
|
||||
if request.method == 'GET':
|
||||
return render_template(
|
||||
'views/edit-template.html',
|
||||
template_name='Reminder',
|
||||
template_body='Vehicle tax: Your vehicle tax for ((registration number)) expires on ((date)). Tax your vehicle at www.gov.uk/vehicle-tax', # noqa
|
||||
h1='Edit template'
|
||||
)
|
||||
elif request.method == 'POST':
|
||||
return redirect(url_for('.manage_templates'))
|
||||
|
||||
|
||||
@main.route("/templates/template/add", methods=['GET', 'POST'])
|
||||
def edit_template():
|
||||
if request.method == 'GET':
|
||||
return render_template(
|
||||
'views/edit-template.html',
|
||||
h1='Add template'
|
||||
)
|
||||
elif request.method == 'POST':
|
||||
return redirect(url_for('.manage_templates'))
|
||||
Reference in New Issue
Block a user