display financial verification review info for ccpo

This commit is contained in:
dandds 2018-09-05 17:17:30 -04:00
parent 50c8766a7a
commit e8aa905a99
7 changed files with 90 additions and 16 deletions

View File

@ -30,6 +30,8 @@ def readableInteger(value):
def getOptionLabel(value, options):
if hasattr(value, "value"):
value = value.value
try:
return next(tup[1] for tup in options if tup[0] == value)
except StopIteration:
@ -59,6 +61,10 @@ def findFilter(value, filter_name, filter_args=[]):
raise ValueError("filter name {} not found".format(filter_name))
def renderList(value):
return app.jinja_env.filters["safe"]("<br>".join(value))
def register_filters(app):
app.jinja_env.filters["iconSvg"] = iconSvg
app.jinja_env.filters["dollars"] = dollars
@ -67,3 +73,4 @@ def register_filters(app):
app.jinja_env.filters["getOptionLabel"] = getOptionLabel
app.jinja_env.filters["mixedContentToJson"] = mixedContentToJson
app.jinja_env.filters["findFilter"] = findFilter
app.jinja_env.filters["renderList"] = renderList

View File

@ -140,3 +140,11 @@ WORKSPACE_ROLES = [
},
),
]
FUNDING_TYPES = [
("", "- Select -"),
("RDTE", "Research, Development, Testing & Evaluation (RDT&E)"),
("OM", "Operations & Maintenance (O&M)"),
("PROC", "Procurement (PROC)"),
("OTHER", "Other"),
]

View File

@ -10,6 +10,7 @@ from atst.domain.task_orders import TaskOrders
from .fields import NewlineListField, SelectField
from .forms import ValidatedForm
from .data import FUNDING_TYPES
PE_REGEX = re.compile(
@ -161,13 +162,7 @@ class ExtendedFinancialForm(BaseFinancialForm):
funding_type = SelectField(
description="What is the source of funding?",
choices=[
("", "- Select -"),
("RDTE", "Research, Development, Testing & Evaluation (RDT&E)"),
("OM", "Operations & Maintenance (O&M)"),
("PROC", "Procurement (PROC)"),
("OTHER", "Other"),
],
choices=FUNDING_TYPES,
validators=[Required()],
render_kw={"required": False},
)

View File

@ -1,11 +1,22 @@
from flask import render_template, g
from . import requests_bp
from atst.forms.data import SERVICE_BRANCHES
from atst.domain.requests import Requests
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)
return render_template("requests/approval.html", data=request.body, service_branches=SERVICE_BRANCHES)
data = request.body
if request.task_order:
data["task_order"] = task_order_dictionary(request.task_order)
return render_template("requests/approval.html", data=data, financial_review=True)

View File

@ -9,6 +9,7 @@ from atst.forms.data import (
ASSISTANCE_ORG_TYPES,
DATA_TRANSFER_AMOUNTS,
COMPLETION_DATE_RANGES,
FUNDING_TYPES,
)
@ -19,6 +20,7 @@ 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,
}

View File

@ -4,7 +4,7 @@
{% macro DefinitionReviewField(title, section, item_name, filter=None, filter_args=[]) -%}
<div>
<dt>{{ title }}</dt>
<dt>{{ title | safe }}</dt>
<dd>
{% if data[section] and data[section][item_name] %}
{{ data[section][item_name] | findFilter(filter, filter_args) }}
@ -125,4 +125,57 @@
{{ DefinitionReviewField("DOD ID", "primary_poc", "dodid_poc") }}
</dl>
{% if financial_review %}
<hr>
<h2>
Financial Verification
</h2>
<dl>
{{ DefinitionReviewField("Task Order Number", "task_order", "number") }}
{{ DefinitionReviewField("What is the source of funding?", "task_order", "funding_type", filter="getOptionLabel", filter_args=[funding_types]) }}
{% if data["task_order"] and data["task_order"]["funding_type"].value == "OTHER" %}
{{ DefinitionReviewField("If other, please specify", "task_order", "funding_type_other") }}
{% endif %}
{{ DefinitionReviewField("<dl><dt>CLIN 0001</dt> - <dd>Unclassified IaaS and PaaS Amount</dd></dl>", "task_order", "clin_0001", filter="dollars") }}
{{ DefinitionReviewField("<dl><dt>CLIN 0003</dt> - <dd>Unclassified Cloud Support Package</dd></dl>", "task_order", "clin_0003", filter="dollars") }}
{{ DefinitionReviewField("<dl><dt>CLIN 1001</dt> - <dd>Unclassified IaaS and PaaS Amount <br> OPTION PERIOD 1</dd></dl>", "task_order", "clin_1001", filter="dollars") }}
{{ DefinitionReviewField("<dl><dt>CLIN 1003</dt> - <dd>Unclassified Cloud Support Package <br> OPTION PERIOD 1</dd></dl>", "task_order", "clin_1003", filter="dollars") }}
{{ DefinitionReviewField("<dl><dt>CLIN 2001</dt> - <dd>Unclassified IaaS and PaaS Amount <br> OPTION PERIOD 2</dd></dl>", "task_order", "clin_2001", filter="dollars") }}
{{ DefinitionReviewField("<dl><dt>CLIN 2003</dt> - <dd>Unclassified Cloud Support Package <br> OPTION PERIOD 2</dd></dl>", "task_order", "clin_2003", filter="dollars") }}
<!-- {{ DefinitionReviewField("Task Order PDF", "task_order", "attachment") }} -->
{{ DefinitionReviewField("Unique Item Identifier (UII)s related to your application(s) if you already have them", "financial_verification", "uii_ids", filter="renderList") }}
{{ DefinitionReviewField("Program Element (PE) Number related to your request", "financial_verification", "pe_id") }}
{{ DefinitionReviewField("Program Treasury Code", "financial_verification", "treasury_code") }}
{{ DefinitionReviewField("Program Budget Activity (BA) Code", "financial_verification", "ba_code") }}
{{ DefinitionReviewField("Contracting Officer First Name", "financial_verification", "fname_co") }}
{{ DefinitionReviewField("Contracting Officer Last Name", "financial_verification", "lname_co") }}
{{ DefinitionReviewField("Contracting Officer Email", "financial_verification", "email_co") }}
{{ DefinitionReviewField("Contracting Officer Office", "financial_verification", "office_co") }}
{{ DefinitionReviewField("Contracting Officer Representative (COR) First Name", "financial_verification", "fname_cor") }}
{{ DefinitionReviewField("Contracting Officer Representative (COR) Last Name", "financial_verification", "lname_cor") }}
{{ DefinitionReviewField("Contracting Officer Representative (COR) Email", "financial_verification", "email_cor") }}
{{ DefinitionReviewField("Contracting Officer Representative (COR) Office", "financial_verification", "office_cor") }}
</dl>
{% endif %}

View File

@ -30,13 +30,11 @@ def test_ccpo_sees_approval_screen():
request = RequestFactory.create()
Requests.submit(request)
ccpo_context = RequestsIndex(ccpo).execute()
assert (
ccpo_context["requests"][0]["edit_link"]
== url_for("requests.approval", request_id=request.id)
assert ccpo_context["requests"][0]["edit_link"] == url_for(
"requests.approval", request_id=request.id
)
mo_context = RequestsIndex(request.creator).execute()
assert (
mo_context["requests"][0]["edit_link"]
!= url_for("requests.approval", request_id=request.id)
assert mo_context["requests"][0]["edit_link"] != url_for(
"requests.approval", request_id=request.id
)