Review request page #159038263
This commit is contained in:
dandds
2018-09-07 16:07:52 -04:00
committed by GitHub
14 changed files with 303 additions and 253 deletions

View File

@@ -1,9 +1,52 @@
from flask import render_template
from flask import render_template, g, Response
from flask import current_app as app
from . import requests_bp
from atst.forms.data import SERVICE_BRANCHES
from atst.domain.requests import Requests
from atst.domain.exceptions import NotFoundError
from atst.domain.authz import Authorization
@requests_bp.route("/request_approval", methods=["GET"])
def requests_approval():
return render_template("request_approval.html", service_branches=SERVICE_BRANCHES)
def task_order_dictionary(task_order):
return {
c.name: getattr(task_order, c.name)
for c in task_order.__table__.columns
if c.name not in ["id", "attachment_id"]
}
@requests_bp.route("/requests/approval/<string:request_id>", methods=["GET"])
def approval(request_id):
request = Requests.get(g.current_user, request_id)
Authorization.check_can_approve_request(g.current_user)
data = request.body
if request.task_order:
data["task_order"] = task_order_dictionary(request.task_order)
return render_template(
"requests/approval.html",
data=data,
request_id=request_id,
status=request.status.value,
financial_review=True,
pdf_available=request.task_order and request.task_order.pdf,
)
@requests_bp.route("/requests/task_order_download/<string:request_id>", methods=["GET"])
def task_order_pdf_download(request_id):
request = Requests.get(g.current_user, request_id)
if request.task_order and request.task_order.pdf:
pdf = request.task_order.pdf
generator = app.uploader.download_stream(pdf.object_name)
return Response(
generator,
headers={
"Content-Disposition": "attachment; filename={}".format(pdf.filename)
},
mimetype="application/pdf",
)
else:
raise NotFoundError("task_order pdf")

View File

@@ -70,7 +70,9 @@ class RequestsIndex(object):
else "-"
)
if Requests.is_pending_financial_verification(request):
if viewing_role == "ccpo":
edit_link = url_for("requests.approval", request_id=request.id)
elif Requests.is_pending_financial_verification(request):
edit_link = url_for(
"requests.financial_verification", request_id=request.id
)

View File

@@ -9,6 +9,8 @@ from atst.forms.data import (
ASSISTANCE_ORG_TYPES,
DATA_TRANSFER_AMOUNTS,
COMPLETION_DATE_RANGES,
FUNDING_TYPES,
TASK_ORDER_SOURCES,
)
@@ -19,6 +21,8 @@ def option_data():
"assistance_org_types": ASSISTANCE_ORG_TYPES,
"data_transfer_amounts": DATA_TRANSFER_AMOUNTS,
"completion_date_ranges": COMPLETION_DATE_RANGES,
"funding_types": FUNDING_TYPES,
"task_order_sources": TASK_ORDER_SOURCES,
}