2016-01-15 16:10:24 +00:00
|
|
|
from flask import (abort, render_template)
|
2016-01-06 16:40:38 +00:00
|
|
|
from flask_login import login_required
|
2015-12-18 10:26:56 +00:00
|
|
|
from app.main import main
|
2016-01-15 16:10:24 +00:00
|
|
|
from app.main.dao.services_dao import get_service_by_id
|
|
|
|
|
from client.errors import HTTPError
|
2015-12-18 10:26:56 +00:00
|
|
|
from ._jobs import jobs
|
|
|
|
|
|
|
|
|
|
|
2016-01-13 13:14:23 +00:00
|
|
|
@main.route("/services/<int:service_id>/dashboard")
|
2016-01-06 16:40:38 +00:00
|
|
|
@login_required
|
2016-01-15 17:46:09 +00:00
|
|
|
def service_dashboard(service_id):
|
2016-01-15 16:10:24 +00:00
|
|
|
try:
|
|
|
|
|
service = get_service_by_id(service_id)
|
|
|
|
|
except HTTPError as e:
|
|
|
|
|
if e.status_code == 404:
|
|
|
|
|
abort(404)
|
|
|
|
|
else:
|
|
|
|
|
raise e
|
2015-12-18 10:26:56 +00:00
|
|
|
return render_template(
|
2016-01-15 17:46:09 +00:00
|
|
|
'views/service_dashboard.html',
|
2015-12-18 16:36:24 +00:00
|
|
|
jobs=jobs,
|
|
|
|
|
free_text_messages_remaining=560,
|
2016-01-13 12:10:29 +00:00
|
|
|
spent_this_month='0.00',
|
2016-01-15 16:10:24 +00:00
|
|
|
service_id=service_id)
|