move request review information into a partial

This commit is contained in:
dandds 2018-08-30 10:54:25 -04:00 committed by luis cielak
parent 0a62157d00
commit 0a36f1d6ca
6 changed files with 335 additions and 403 deletions

View File

@ -30,7 +30,10 @@ def readableInteger(value):
def getOptionLabel(value, options):
return next(tup[1] for tup in options if tup[0] == value)
try:
return next(tup[1] for tup in options if tup[0] == value)
except StopIteration:
return
def mixedContentToJson(value):

View File

@ -7,6 +7,7 @@ requests_bp = Blueprint("requests", __name__)
from . import index
from . import requests_form
from . import financial_verification
from . import approval
@requests_bp.context_processor

View File

@ -0,0 +1,9 @@
from flask import render_template
from . import requests_bp
from atst.forms.data import SERVICE_BRANCHES
@requests_bp.route("/request_approval", methods=["GET"])
def requests_approval():
return render_template("request_approval.html", service_branches=SERVICE_BRANCHES)

View File

@ -17,140 +17,46 @@
<p>Ongoing maintainence for Death Star (a moon-sized Imperial military battlestation armed with a planet-destroying superlaser). Its definitely hasn't been sabotaged from the start.</p>
<h2>Details of Use</h2>
<dl>
<div>
<dt>DoD Component</dt>
<dd>
Army, Department of the
</dd>
</div>
<div>
<dt>JEDI Usage</dt>
<dd>asdsa</dd>
</div>
<div>
<dt>Number of software systems</dt>
<dd>
2
</dd>
</div>
<div>
<dt>JEDI Migration</dt>
<dd>yes</dd>
</div>
<div>
<dt>Rationalization of Software Systems</dt>
<dd>yes</dd>
</div>
<div>
<dt>Technical Support Team</dt>
<dd>yes</dd>
</div>
<div>
<dt>Organization Providing Assistance</dt>
<dd>
In-house staff
</dd>
</div>
<div>
<dt>Engineering Assessment</dt>
<dd>yes</dd>
</div>
<div>
<dt>Data Transfers</dt>
<dd>
Less than 100GB
</dd>
</div>
<div>
<dt>Expected Completion Date</dt>
<dd>
Less than 1 month
</dd>
</div>
<div>
<dt>Estimated Monthly Spend</dt>
<dd>
$12
</dd>
</div>
<div>
<dt>Total Spend</dt>
<dd>
$1,231
</dd>
</div>
<div>
<dt>Start Date</dt>
<dd>12/12/2018</dd>
</div>
</dl>
<hr>
<h2>Information About You</h2>
<dl>
<div>
<dt>First Name</dt>
<dd>Amanda</dd>
</div>
<div>
<dt>Last Name</dt>
<dd>Adamson</dd>
</div>
<div>
<dt>Email Address</dt>
<dd>amanda@test.com</dd>
</div>
<div>
<dt>Phone Number</dt>
<dd>
+1 (123) 123 - 1231
</dd>
</div>
<div>
<dt>Service Branch or Agency</dt>
<dd>
Air Force, Department of the
</dd>
</div>
<div>
<dt>Citizenship</dt>
<dd>United States</dd>
</div>
<div>
<dt>Designation of Person</dt>
<dd>
Military
</dd>
</div>
<div>
<dt>Latest Information Assurance (IA) Training completion date</dt>
<dd>12/12/2017</dd>
</div>
</dl>
<hr>
<h2>Workspace Owner</h2>
<dl>
<div>
<dt>POC First Name</dt>
<dd>Amanda</dd>
</div>
<div>
<dt>POC Last Name</dt>
<dd>Adamson</dd>
</div>
<div>
<dt>POC Email Address</dt>
<dd>amanda@test.com</dd>
</div>
<div>
<dt>DOD ID</dt>
<dd>2345678901</dd>
</div>
</dl>
{% with data = {
"primary_poc": {
"am_poc": False,
"dodid_poc": "1234567890",
"email_poc": "fake@email.com",
"fname_poc": "Amanda",
"lname_poc": "Adamson",
},
"details_of_use": {
"jedi_usage": "adf",
"start_date": "2018-08-08",
"cloud_native": "yes",
"dollar_value": 500000,
"dod_component": "Air Force, Department of the",
"data_transfers": "Less than 100GB",
"expected_completion_date": "Less than 1 month",
"jedi_migration": "yes",
"num_software_systems": 1,
"number_user_sessions": 2,
"average_daily_traffic": 1,
"engineering_assessment": "yes",
"technical_support_team": "yes",
"estimated_monthly_spend": 100,
"average_daily_traffic_gb": 4,
"rationalization_software_systems": "yes",
"organization_providing_assistance": "In-house staff",
},
"information_about_you": {
"citizenship": "United States",
"designation": "military",
"phone_number": "1234567890",
"email_request": "fake@email.mil",
"fname_request": "Amanda",
"lname_request": "Adamson",
"service_branch": "Air Force, Department of the",
"date_latest_training": "2018-08-06",
}
}, service_branches=service_branches %}
{% include "requests/_review.html" %}
{% endwith %}
</div>

View File

@ -0,0 +1,278 @@
{% macro RequiredLabel() -%}
<span class='label label--error'>Response Required</span>
{%- endmacro %}
<h2>
Details of Use
{% if editable %}
<a href="{{ url_for('requests.requests_form_update', screen=1, request_id=request_id) }}" class="icon-link">
{{ Icon('edit') }}
<span>Edit this section</span>
</a>
{% endif %}
</h2>
<dl>
<div>
<dt>DoD Component</dt>
<dd>
{% if data['details_of_use']['dod_component'] %}
{{ data['details_of_use']['dod_component'] | getOptionLabel(service_branches) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>JEDI Usage</dt>
<dd>{{ data['details_of_use']['jedi_usage'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Number of software systems</dt>
<dd>
{% if data['details_of_use']['num_software_systems'] %}
{{ data['details_of_use']['num_software_systems'] | readableInteger }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>JEDI Migration</dt>
<dd>{{ data['details_of_use']['jedi_migration'] or RequiredLabel() }}</dd>
</div>
{% if data['details_of_use']['jedi_migration'] == 'yes' %}
<div>
<dt>Rationalization of Software Systems</dt>
<dd>{{ data['details_of_use']['rationalization_software_systems'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Technical Support Team</dt>
<dd>{{ data['details_of_use']['technical_support_team'] or RequiredLabel() }}</dd>
</div>
{% if data['details_of_use']['technical_support_team'] == 'yes' %}
<div>
<dt>Organization Providing Assistance</dt>
<dd>
{% if data['details_of_use']['organization_providing_assistance'] %}
{{ data['details_of_use']['organization_providing_assistance'] | getOptionLabel(assistance_org_types) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
{% endif %}
<div>
<dt>Engineering Assessment</dt>
<dd>{{ data['details_of_use']['engineering_assessment'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Data Transfers</dt>
<dd>
{% if data['details_of_use']['data_transfers'] %}
{{ data['details_of_use']['data_transfers'] | getOptionLabel(data_transfer_amounts) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Expected Completion Date</dt>
<dd>
{% if data['details_of_use']['expected_completion_date'] %}
{{ data['details_of_use']['expected_completion_date'] | getOptionLabel(completion_date_ranges) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
{% else %}
<div>
<dt>Cloud Native</dt>
<dd>{{ data['details_of_use']['cloud_native'] or RequiredLabel() }}</dd>
</div>
{% endif %}
<div>
<dt>Estimated Monthly Spend</dt>
<dd>
{% if data['details_of_use']['estimated_monthly_spend'] %}
{{ data['details_of_use']['estimated_monthly_spend'] | dollars }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
{% if jedi_request and jedi_request.annual_spend > annual_spend_threshold %}
<div>
<dt>Number of User Sessions</dt>
<dd>
{% if data['details_of_use']['number_user_sessions'] %}
{{ data['details_of_use']['number_user_sessions'] | readableInteger }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Average Daily Traffic (Number of Requests)</dt>
<dd>
{% if data['details_of_use']['average_daily_traffic'] %}
{{ data['details_of_use']['average_daily_traffic'] | readableInteger }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Average Daily Traffic (GB)</dt>
<dd>
{% if data['details_of_use']['average_daily_traffic_gb'] %}
{{ data['details_of_use']['average_daily_traffic_gb'] | readableInteger }} GB
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
{% endif %}
<div>
<dt>Total Spend</dt>
<dd>
{% if data['details_of_use']['dollar_value'] %}
{{ data['details_of_use']['dollar_value'] | dollars }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Start Date</dt>
<dd>{{ data['details_of_use']['start_date'] or RequiredLabel() }}</dd>
</div>
</dl>
<h2>
Information About You
{% if editable %}
<a href="{{ url_for('requests.requests_form_update', screen=2, request_id=request_id) }}" class="icon-link">
{{ Icon('edit') }}
<span>Edit this section</span>
</a>
{% endif %}
</h2>
<dl>
<div>
<dt>First Name</dt>
<dd>{{ data['information_about_you']['fname_request'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Last Name</dt>
<dd>{{ data['information_about_you']['lname_request'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Email Address</dt>
<dd>{{ data['information_about_you']['email_request'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Phone Number</dt>
<dd>
{% if data['information_about_you']['phone_number'] %}
{{ data['information_about_you']['phone_number'] | usPhone }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Service Branch or Agency</dt>
<dd>
{% if data['information_about_you']['service_branch'] %}
{{ data['information_about_you']['service_branch'] | getOptionLabel(service_branches) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Citizenship</dt>
<dd>{{ data['information_about_you']['citizenship'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Designation of Person</dt>
<dd>
{% if data['information_about_you']['designation'] %}
{{ data['information_about_you']['designation'] | capitalize }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Latest Information Assurance (IA) Training completion date</dt>
<dd>{{ data['information_about_you']['date_latest_training'] or RequiredLabel() }}</dd>
</div>
</dl>
<h2>
Workspace Owner
{% if editable %}
<a href="{{ url_for('requests.requests_form_update', screen=3, request_id=request_id) }}" class="icon-link">
{{ Icon('edit') }}
<span>Edit this section</span>
</a>
{% endif %}
</h2>
<dl>
<div>
<dt>POC First Name</dt>
<dd>{{ data['primary_poc']['fname_poc'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>POC Last Name</dt>
<dd>{{ data['primary_poc']['lname_poc'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>POC Email Address</dt>
<dd>{{ data['primary_poc']['email_poc'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>DOD ID</dt>
<dd>{{ data['primary_poc']['dodid_poc'] or RequiredLabel() }}</dd>
</div>
</dl>

View File

@ -28,274 +28,9 @@
) }}
{% endif %}
<h2>
Details of Use
<a href="{{ url_for('requests.requests_form_update', screen=1, request_id=request_id) }}" class="icon-link">
{{ Icon('edit') }}
<span>Edit this section</span>
</a>
</h2>
<dl>
<div>
<dt>DoD Component</dt>
<dd>
{% if data['details_of_use']['dod_component'] %}
{{ data['details_of_use']['dod_component'] | getOptionLabel(service_branches) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>JEDI Usage</dt>
<dd>{{ data['details_of_use']['jedi_usage'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Number of software systems</dt>
<dd>
{% if data['details_of_use']['num_software_systems'] %}
{{ data['details_of_use']['num_software_systems'] | readableInteger }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>JEDI Migration</dt>
<dd>{{ data['details_of_use']['jedi_migration'] or RequiredLabel() }}</dd>
</div>
{% if data['details_of_use']['jedi_migration'] == 'yes' %}
<div>
<dt>Rationalization of Software Systems</dt>
<dd>{{ data['details_of_use']['rationalization_software_systems'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Technical Support Team</dt>
<dd>{{ data['details_of_use']['technical_support_team'] or RequiredLabel() }}</dd>
</div>
{% if data['details_of_use']['technical_support_team'] == 'yes' %}
<div>
<dt>Organization Providing Assistance</dt>
<dd>
{% if data['details_of_use']['organization_providing_assistance'] %}
{{ data['details_of_use']['organization_providing_assistance'] | getOptionLabel(assistance_org_types) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
{% endif %}
<div>
<dt>Engineering Assessment</dt>
<dd>{{ data['details_of_use']['engineering_assessment'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Data Transfers</dt>
<dd>
{% if data['details_of_use']['data_transfers'] %}
{{ data['details_of_use']['data_transfers'] | getOptionLabel(data_transfer_amounts) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Expected Completion Date</dt>
<dd>
{% if data['details_of_use']['expected_completion_date'] %}
{{ data['details_of_use']['expected_completion_date'] | getOptionLabel(completion_date_ranges) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
{% else %}
<div>
<dt>Cloud Native</dt>
<dd>{{ data['details_of_use']['cloud_native'] or RequiredLabel() }}</dd>
</div>
{% endif %}
<div>
<dt>Estimated Monthly Spend</dt>
<dd>
{% if data['details_of_use']['estimated_monthly_spend'] %}
{{ data['details_of_use']['estimated_monthly_spend'] | dollars }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
{% if jedi_request and jedi_request.annual_spend > annual_spend_threshold %}
<div>
<dt>Number of User Sessions</dt>
<dd>
{% if data['details_of_use']['number_user_sessions'] %}
{{ data['details_of_use']['number_user_sessions'] | readableInteger }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Average Daily Traffic (Number of Requests)</dt>
<dd>
{% if data['details_of_use']['average_daily_traffic'] %}
{{ data['details_of_use']['average_daily_traffic'] | readableInteger }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Average Daily Traffic (GB)</dt>
<dd>
{% if data['details_of_use']['average_daily_traffic_gb'] %}
{{ data['details_of_use']['average_daily_traffic_gb'] | readableInteger }} GB
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
{% endif %}
<div>
<dt>Total Spend</dt>
<dd>
{% if data['details_of_use']['dollar_value'] %}
{{ data['details_of_use']['dollar_value'] | dollars }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Start Date</dt>
<dd>{{ data['details_of_use']['start_date'] or RequiredLabel() }}</dd>
</div>
</dl>
<h2>
Information About You
<a href="{{ url_for('requests.requests_form_update', screen=2, request_id=request_id) }}" class="icon-link">
{{ Icon('edit') }}
<span>Edit this section</span>
</a>
</h2>
<dl>
<div>
<dt>First Name</dt>
<dd>{{ data['information_about_you']['fname_request'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Last Name</dt>
<dd>{{ data['information_about_you']['lname_request'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Email Address</dt>
<dd>{{ data['information_about_you']['email_request'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Phone Number</dt>
<dd>
{% if data['information_about_you']['phone_number'] %}
{{ data['information_about_you']['phone_number'] | usPhone }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Service Branch or Agency</dt>
<dd>
{% if data['information_about_you']['service_branch'] %}
{{ data['information_about_you']['service_branch'] | getOptionLabel(service_branches) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Citizenship</dt>
<dd>{{ data['information_about_you']['citizenship'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Designation of Person</dt>
<dd>
{% if data['information_about_you']['designation'] %}
{{ data['information_about_you']['designation'] | capitalize }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Latest Information Assurance (IA) Training completion date</dt>
<dd>{{ data['information_about_you']['date_latest_training'] or RequiredLabel() }}</dd>
</div>
</dl>
<h2>
Workspace Owner
<a href="{{ url_for('requests.requests_form_update', screen=3, request_id=request_id) }}" class="icon-link">
{{ Icon('edit') }}
<span>Edit this section</span>
</a>
</h2>
<dl>
<div>
<dt>POC First Name</dt>
<dd>{{ data['primary_poc']['fname_poc'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>POC Last Name</dt>
<dd>{{ data['primary_poc']['lname_poc'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>POC Email Address</dt>
<dd>{{ data['primary_poc']['email_poc'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>DOD ID</dt>
<dd>{{ data['primary_poc']['dodid_poc'] or RequiredLabel() }}</dd>
</div>
</dl>
{% with editable=True %}
{% include "requests/_review.html" %}
{% endwith %}
{% endblock %}