From 0a36f1d6cad0989164850f4da72a617c773e0660 Mon Sep 17 00:00:00 2001 From: dandds Date: Thu, 30 Aug 2018 10:54:25 -0400 Subject: [PATCH] move request review information into a partial --- atst/filters.py | 5 +- atst/routes/requests/__init__.py | 1 + atst/routes/requests/approval.py | 9 + templates/request_approval.html | 174 +++++-------------- templates/requests/_review.html | 278 +++++++++++++++++++++++++++++++ templates/requests/screen-4.html | 271 +----------------------------- 6 files changed, 335 insertions(+), 403 deletions(-) create mode 100644 atst/routes/requests/approval.py create mode 100644 templates/requests/_review.html diff --git a/atst/filters.py b/atst/filters.py index 6811d198..6ecd6d1f 100644 --- a/atst/filters.py +++ b/atst/filters.py @@ -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): diff --git a/atst/routes/requests/__init__.py b/atst/routes/requests/__init__.py index 8dfc1a20..d4214f56 100644 --- a/atst/routes/requests/__init__.py +++ b/atst/routes/requests/__init__.py @@ -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 diff --git a/atst/routes/requests/approval.py b/atst/routes/requests/approval.py new file mode 100644 index 00000000..8d16960a --- /dev/null +++ b/atst/routes/requests/approval.py @@ -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) diff --git a/templates/request_approval.html b/templates/request_approval.html index d283fd2c..ab44c907 100644 --- a/templates/request_approval.html +++ b/templates/request_approval.html @@ -17,140 +17,46 @@

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.

-

Details of Use

-
-
-
DoD Component
-
- Army, Department of the -
-
-
-
JEDI Usage
-
asdsa
-
-
-
Number of software systems
-
- 2 -
-
-
-
JEDI Migration
-
yes
-
-
-
Rationalization of Software Systems
-
yes
-
-
-
Technical Support Team
-
yes
-
-
-
Organization Providing Assistance
-
- In-house staff -
-
-
-
Engineering Assessment
-
yes
-
-
-
Data Transfers
-
- Less than 100GB -
-
-
-
Expected Completion Date
-
- Less than 1 month -
-
-
-
Estimated Monthly Spend
-
- $12 -
-
-
-
Total Spend
-
- $1,231 -
-
-
-
Start Date
-
12/12/2018
-
-
- -
-

Information About You

- -
-
-
First Name
-
Amanda
-
-
-
Last Name
-
Adamson
-
-
-
Email Address
-
amanda@test.com
-
-
-
Phone Number
-
- +1 (123) 123 - 1231 -
-
-
-
Service Branch or Agency
-
- Air Force, Department of the -
-
-
-
Citizenship
-
United States
-
-
-
Designation of Person
-
- Military -
-
-
-
Latest Information Assurance (IA) Training completion date
-
12/12/2017
-
-
- -
-

Workspace Owner

-
-
-
POC First Name
-
Amanda
-
-
-
POC Last Name
-
Adamson
-
-
-
POC Email Address
-
amanda@test.com
-
-
-
DOD ID
-
2345678901
-
-
+ {% 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 %} diff --git a/templates/requests/_review.html b/templates/requests/_review.html new file mode 100644 index 00000000..6c038958 --- /dev/null +++ b/templates/requests/_review.html @@ -0,0 +1,278 @@ +{% macro RequiredLabel() -%} + Response Required +{%- endmacro %} + +

+ Details of Use + {% if editable %} + + {{ Icon('edit') }} + Edit this section + + {% endif %} +

+ +
+
+
DoD Component
+
+ {% if data['details_of_use']['dod_component'] %} + {{ data['details_of_use']['dod_component'] | getOptionLabel(service_branches) }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ + +
+
JEDI Usage
+
{{ data['details_of_use']['jedi_usage'] or RequiredLabel() }}
+
+ +
+
Number of software systems
+
+ {% if data['details_of_use']['num_software_systems'] %} + {{ data['details_of_use']['num_software_systems'] | readableInteger }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ +
+
JEDI Migration
+
{{ data['details_of_use']['jedi_migration'] or RequiredLabel() }}
+
+ + {% if data['details_of_use']['jedi_migration'] == 'yes' %} +
+
Rationalization of Software Systems
+
{{ data['details_of_use']['rationalization_software_systems'] or RequiredLabel() }}
+
+ +
+
Technical Support Team
+
{{ data['details_of_use']['technical_support_team'] or RequiredLabel() }}
+
+ + + {% if data['details_of_use']['technical_support_team'] == 'yes' %} +
+
Organization Providing Assistance
+
+ {% if data['details_of_use']['organization_providing_assistance'] %} + {{ data['details_of_use']['organization_providing_assistance'] | getOptionLabel(assistance_org_types) }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ {% endif %} + +
+
Engineering Assessment
+
{{ data['details_of_use']['engineering_assessment'] or RequiredLabel() }}
+
+ +
+
Data Transfers
+
+ {% if data['details_of_use']['data_transfers'] %} + {{ data['details_of_use']['data_transfers'] | getOptionLabel(data_transfer_amounts) }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ +
+
Expected Completion Date
+
+ {% if data['details_of_use']['expected_completion_date'] %} + {{ data['details_of_use']['expected_completion_date'] | getOptionLabel(completion_date_ranges) }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ + {% else %} + +
+
Cloud Native
+
{{ data['details_of_use']['cloud_native'] or RequiredLabel() }}
+
+ + {% endif %} + +
+
Estimated Monthly Spend
+
+ {% if data['details_of_use']['estimated_monthly_spend'] %} + {{ data['details_of_use']['estimated_monthly_spend'] | dollars }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ + {% if jedi_request and jedi_request.annual_spend > annual_spend_threshold %} + +
+
Number of User Sessions
+
+ {% if data['details_of_use']['number_user_sessions'] %} + {{ data['details_of_use']['number_user_sessions'] | readableInteger }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ +
+
Average Daily Traffic (Number of Requests)
+
+ {% if data['details_of_use']['average_daily_traffic'] %} + {{ data['details_of_use']['average_daily_traffic'] | readableInteger }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ +
+
Average Daily Traffic (GB)
+
+ {% if data['details_of_use']['average_daily_traffic_gb'] %} + {{ data['details_of_use']['average_daily_traffic_gb'] | readableInteger }} GB + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ {% endif %} + +
+
Total Spend
+
+ {% if data['details_of_use']['dollar_value'] %} + {{ data['details_of_use']['dollar_value'] | dollars }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ +
+
Start Date
+
{{ data['details_of_use']['start_date'] or RequiredLabel() }}
+
+
+ + +

+ Information About You + {% if editable %} + + {{ Icon('edit') }} + Edit this section + + {% endif %} +

+ +
+
+
First Name
+
{{ data['information_about_you']['fname_request'] or RequiredLabel() }}
+
+ +
+
Last Name
+
{{ data['information_about_you']['lname_request'] or RequiredLabel() }}
+
+ +
+
Email Address
+
{{ data['information_about_you']['email_request'] or RequiredLabel() }}
+
+ +
+
Phone Number
+
+ {% if data['information_about_you']['phone_number'] %} + {{ data['information_about_you']['phone_number'] | usPhone }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ +
+
Service Branch or Agency
+
+ {% if data['information_about_you']['service_branch'] %} + {{ data['information_about_you']['service_branch'] | getOptionLabel(service_branches) }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ +
+
Citizenship
+
{{ data['information_about_you']['citizenship'] or RequiredLabel() }}
+
+ +
+
Designation of Person
+
+ {% if data['information_about_you']['designation'] %} + {{ data['information_about_you']['designation'] | capitalize }} + {% else %} + {{ RequiredLabel() }} + {% endif %} +
+
+ +
+
Latest Information Assurance (IA) Training completion date
+
{{ data['information_about_you']['date_latest_training'] or RequiredLabel() }}
+
+
+ + +

+ Workspace Owner + {% if editable %} + + {{ Icon('edit') }} + Edit this section + + {% endif %} +

+ +
+
+
POC First Name
+
{{ data['primary_poc']['fname_poc'] or RequiredLabel() }}
+
+ +
+
POC Last Name
+
{{ data['primary_poc']['lname_poc'] or RequiredLabel() }}
+
+ +
+
POC Email Address
+
{{ data['primary_poc']['email_poc'] or RequiredLabel() }}
+
+ +
+
DOD ID
+
{{ data['primary_poc']['dodid_poc'] or RequiredLabel() }}
+
+
+ + diff --git a/templates/requests/screen-4.html b/templates/requests/screen-4.html index 3f079e7c..c53b3a25 100644 --- a/templates/requests/screen-4.html +++ b/templates/requests/screen-4.html @@ -28,274 +28,9 @@ ) }} {% endif %} - -

- Details of Use - - {{ Icon('edit') }} - Edit this section - -

- -
-
-
DoD Component
-
- {% if data['details_of_use']['dod_component'] %} - {{ data['details_of_use']['dod_component'] | getOptionLabel(service_branches) }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- - -
-
JEDI Usage
-
{{ data['details_of_use']['jedi_usage'] or RequiredLabel() }}
-
- -
-
Number of software systems
-
- {% if data['details_of_use']['num_software_systems'] %} - {{ data['details_of_use']['num_software_systems'] | readableInteger }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- -
-
JEDI Migration
-
{{ data['details_of_use']['jedi_migration'] or RequiredLabel() }}
-
- - {% if data['details_of_use']['jedi_migration'] == 'yes' %} -
-
Rationalization of Software Systems
-
{{ data['details_of_use']['rationalization_software_systems'] or RequiredLabel() }}
-
- -
-
Technical Support Team
-
{{ data['details_of_use']['technical_support_team'] or RequiredLabel() }}
-
- - - {% if data['details_of_use']['technical_support_team'] == 'yes' %} -
-
Organization Providing Assistance
-
- {% if data['details_of_use']['organization_providing_assistance'] %} - {{ data['details_of_use']['organization_providing_assistance'] | getOptionLabel(assistance_org_types) }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- {% endif %} - -
-
Engineering Assessment
-
{{ data['details_of_use']['engineering_assessment'] or RequiredLabel() }}
-
- -
-
Data Transfers
-
- {% if data['details_of_use']['data_transfers'] %} - {{ data['details_of_use']['data_transfers'] | getOptionLabel(data_transfer_amounts) }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- -
-
Expected Completion Date
-
- {% if data['details_of_use']['expected_completion_date'] %} - {{ data['details_of_use']['expected_completion_date'] | getOptionLabel(completion_date_ranges) }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- - {% else %} - -
-
Cloud Native
-
{{ data['details_of_use']['cloud_native'] or RequiredLabel() }}
-
- - {% endif %} - -
-
Estimated Monthly Spend
-
- {% if data['details_of_use']['estimated_monthly_spend'] %} - {{ data['details_of_use']['estimated_monthly_spend'] | dollars }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- - {% if jedi_request and jedi_request.annual_spend > annual_spend_threshold %} - -
-
Number of User Sessions
-
- {% if data['details_of_use']['number_user_sessions'] %} - {{ data['details_of_use']['number_user_sessions'] | readableInteger }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- -
-
Average Daily Traffic (Number of Requests)
-
- {% if data['details_of_use']['average_daily_traffic'] %} - {{ data['details_of_use']['average_daily_traffic'] | readableInteger }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- -
-
Average Daily Traffic (GB)
-
- {% if data['details_of_use']['average_daily_traffic_gb'] %} - {{ data['details_of_use']['average_daily_traffic_gb'] | readableInteger }} GB - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- {% endif %} - -
-
Total Spend
-
- {% if data['details_of_use']['dollar_value'] %} - {{ data['details_of_use']['dollar_value'] | dollars }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- -
-
Start Date
-
{{ data['details_of_use']['start_date'] or RequiredLabel() }}
-
-
- - -

- Information About You - - {{ Icon('edit') }} - Edit this section - -

- -
-
-
First Name
-
{{ data['information_about_you']['fname_request'] or RequiredLabel() }}
-
- -
-
Last Name
-
{{ data['information_about_you']['lname_request'] or RequiredLabel() }}
-
- -
-
Email Address
-
{{ data['information_about_you']['email_request'] or RequiredLabel() }}
-
- -
-
Phone Number
-
- {% if data['information_about_you']['phone_number'] %} - {{ data['information_about_you']['phone_number'] | usPhone }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- -
-
Service Branch or Agency
-
- {% if data['information_about_you']['service_branch'] %} - {{ data['information_about_you']['service_branch'] | getOptionLabel(service_branches) }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- -
-
Citizenship
-
{{ data['information_about_you']['citizenship'] or RequiredLabel() }}
-
- -
-
Designation of Person
-
- {% if data['information_about_you']['designation'] %} - {{ data['information_about_you']['designation'] | capitalize }} - {% else %} - {{ RequiredLabel() }} - {% endif %} -
-
- -
-
Latest Information Assurance (IA) Training completion date
-
{{ data['information_about_you']['date_latest_training'] or RequiredLabel() }}
-
-
- - -

- Workspace Owner - - {{ Icon('edit') }} - Edit this section - -

- -
-
-
POC First Name
-
{{ data['primary_poc']['fname_poc'] or RequiredLabel() }}
-
- -
-
POC Last Name
-
{{ data['primary_poc']['lname_poc'] or RequiredLabel() }}
-
- -
-
POC Email Address
-
{{ data['primary_poc']['email_poc'] or RequiredLabel() }}
-
- -
-
DOD ID
-
{{ data['primary_poc']['dodid_poc'] or RequiredLabel() }}
-
-
- + {% with editable=True %} + {% include "requests/_review.html" %} + {% endwith %} {% endblock %}