diff --git a/atst/routes/task_orders/index.py b/atst/routes/task_orders/index.py index 74393e75..6a632cbb 100644 --- a/atst/routes/task_orders/index.py +++ b/atst/routes/task_orders/index.py @@ -1,5 +1,5 @@ from io import BytesIO -from flask import g, Response +from flask import g, Response, current_app as app from . import task_orders_bp from atst.domain.task_orders import TaskOrders @@ -17,3 +17,22 @@ def download_summary(task_order_id): headers={"Content-Disposition": "attachment; filename={}".format(filename)}, mimetype="application/vnd.openxmlformats-officedocument.wordprocessingml.document", ) + + +@task_orders_bp.route("/task_orders/csp_estimate/") +def download_csp_estimate(task_order_id): + task_order = TaskOrders.get(g.current_user, task_order_id) + if task_order.csp_estimate: + estimate = task_order.csp_estimate + generator = app.csp.files.download(estimate.object_name) + return Response( + generator, + headers={ + "Content-Disposition": "attachment; filename={}".format( + estimate.filename + ) + }, + ) + + else: + raise NotFoundError("task_order CSP estimate") diff --git a/templates/portfolios/task_orders/show.html b/templates/portfolios/task_orders/show.html index 38dadacf..144e6c5b 100644 --- a/templates/portfolios/task_orders/show.html +++ b/templates/portfolios/task_orders/show.html @@ -133,7 +133,7 @@
{{ DocumentLink( title="Cloud Services Estimate", - link_url="#") }} + link_url=task_order.csp_estimate and url_for("task_orders.download_csp_estimate", task_order_id=task_order.id) ) }} {{ DocumentLink( title="Market Research", link_url="#") }} diff --git a/templates/task_orders/new/review.html b/templates/task_orders/new/review.html index 440c58ad..53089982 100644 --- a/templates/task_orders/new/review.html +++ b/templates/task_orders/new/review.html @@ -113,7 +113,7 @@
{% call ReviewField(("task_orders.new.review.performance_period" | translate), task_order.performance_length, filter="translateDuration") %} -

{{ Icon('download') }} {{ "task_orders.new.review.usage_est_link" | translate }}

+

{{ Icon('download') }} {{ "task_orders.new.review.usage_est_link"| translate }}

{% endcall %}