Merge pull request #187 from dod-ccpo/ui/review-and-submit

Ui/review and submit
This commit is contained in:
andrewdds 2018-08-20 13:20:11 -04:00 committed by GitHub
commit 19186a37e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 140 additions and 34 deletions

View File

@ -1,3 +1,5 @@
import re
def iconSvg(name):
with open('static/icons/'+name+'.svg') as contents:
return contents.read()
@ -11,6 +13,22 @@ def dollars(value):
return "${:,.0f}".format(numberValue)
def usPhone(number):
phone = re.sub(r'\D', '', number)
return '+1 ({}) {} - {}'.format(phone[0:3], phone[3:6], phone[6:])
def readableInteger(value):
try:
numberValue = int(value)
except ValueError:
numberValue = 0
return "{:,}".format(numberValue)
def register_filters(app):
app.jinja_env.filters['iconSvg'] = iconSvg
app.jinja_env.filters['dollars'] = dollars
app.jinja_env.filters['usPhone'] = usPhone
app.jinja_env.filters['readableInteger'] = readableInteger

View File

@ -8,6 +8,23 @@
{% from "components/text_input.html" import TextInput %}
{% from "components/icon.html" import Icon %}
{% set dod_component_choices = {
"null": "Select an option",
"us_air_force": "US Air Force",
"us_army": "US Army",
"us_navy": "US Navy",
"us_marine_corps": "US Marine Corps",
"joint_chiefs_of_staff": "Joint Chiefs of Staff"
} %}
{% set organization_providing_assistance_choices = {
"in_house_staff": "In-house staff",
"contractor": "Contractor",
"other_dod_organization": "Other DoD organization",
"none": "None"
} %}
{% block subtitle %}
<h2>Review &amp; Submit</h2>
{% endblock %}
@ -40,7 +57,13 @@
<dl>
<div>
<dt>DoD Component</dt>
<dd>{{ data['details_of_use']['dod_component'] or RequiredLabel() }}</dd>
<dd>
{% if data['details_of_use']['dod_component'] %}
{{ dod_component_choices[data['details_of_use']['dod_component']] }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
@ -51,7 +74,13 @@
<div>
<dt>Number of software systems</dt>
<dd>{{ data['details_of_use']['num_software_systems'] or RequiredLabel() }}</dd>
<dd>
{% if data['details_of_use']['num_software_systems'] %}
{{ data['details_of_use']['num_software_systems'] | readableInteger }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
@ -72,65 +101,112 @@
{% if data['details_of_use']['technical_support_team'] == 'yes' %}
<div>
<dt>Organization Providing Assistance</dt>
<dd>{{ data['details_of_use']['organization_providing_assistance'] or RequiredLabel() }}</dd>
<dd>
{% if data['details_of_use']['organization_providing_assistance'] %}
{{ organization_providing_assistance_choices[data['details_of_use']['organization_providing_assistance']] }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
{% endif %}
<div>
<dt>Engineering Assessment</dt>
<dd>{{ data['details_of_use']['engineering_assessment'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Engineering Assessment</dt>
<dd>{{ data['details_of_use']['engineering_assessment'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Data Transfers</dt>
<dd>{{ data['details_of_use']['data_transfers'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Data Transfers</dt>
<dd>
{% if data['details_of_use']['data_transfers'] %}
{{ data['details_of_use']['data_transfers'] | upper | replace("_"," ")}}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
<dt>Expected Completion Date</dt>
<dd>{{ data['details_of_use']['expected_completion_date'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Expected Completion Date</dt>
<dd>
{% if data['details_of_use']['expected_completion_date'] %}
{{ data['details_of_use']['expected_completion_date'] | replace("_"," ")}}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
{% else %}
{% else %}
<div>
<dt>Cloud Native</dt>
<dd>{{ data['details_of_use']['cloud_native'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Cloud Native</dt>
<dd>{{ data['details_of_use']['cloud_native'] or RequiredLabel() }}</dd>
</div>
{% endif %}
{% endif %}
<div>
<dt>Estimated Monthly Spend</dt>
<dd>{{ data['details_of_use']['estimated_monthly_spend'] or RequiredLabel() }}</dd>
</div>
<div>
<dt>Total Spend</dt>
<dd>{{ data['details_of_use']['dollar_value'] or RequiredLabel() }}</dd>
<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 > 1000000 %}
<div>
<dt>Number of User Sessions</dt>
<dd>{{ data['details_of_use']['number_user_sessions'] or RequiredLabel() }}</dd>
<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>{{ data['details_of_use']['average_daily_traffic'] or RequiredLabel() }}</dd>
<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>{{ data['details_of_use']['average_daily_traffic_gb'] or RequiredLabel() }}</dd>
<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>
@ -164,7 +240,13 @@
<div>
<dt>Phone Number</dt>
<dd>{{ data['information_about_you']['phone_number'] or RequiredLabel() }}</dd>
<dd>
{% if data['information_about_you']['phone_number'] %}
{{ data['information_about_you']['phone_number'] | usPhone }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>
@ -179,7 +261,13 @@
<div>
<dt>Designation of Person</dt>
<dd>{{ data['information_about_you']['designation'] or RequiredLabel() }}</dd>
<dd>
{% if data['information_about_you']['designation'] %}
{{ data['information_about_you']['designation'] | capitalize }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>