Converted all form pages. Flow still not working

This commit is contained in:
richard-dds 2018-08-02 10:36:25 -04:00
parent f15fc19eaf
commit a032ccd5b0
6 changed files with 65 additions and 62 deletions

View File

@ -36,7 +36,6 @@ def suggest_pe_id(pe_id):
return None
@tornado.gen.coroutine
def validate_pe_id(field, existing_request, pe_numbers_repo):
try:
pe_number = pe_numbers_repo.get(field.data)
@ -55,12 +54,11 @@ def validate_pe_id(field, existing_request, pe_numbers_repo):
class FinancialForm(ValidatedForm):
@tornado.gen.coroutine
def perform_extra_validation(self, existing_request, pe_numbers_repo):
valid = True
if not existing_request or existing_request.get('pe_id') != self.pe_id.data:
valid = yield validate_pe_id(self.pe_id, existing_request, pe_numbers_repo)
raise Return(valid)
return valid
task_order_id = StringField(
"Task Order Number associated with this request.", validators=[Required()]

View File

@ -5,8 +5,7 @@ from flask_wtf import FlaskForm
class ValidatedForm(FlaskForm):
@tornado.gen.coroutine
def perform_extra_validation(self, *args, **kwargs):
"""A coroutine that performs any applicable extra validation. Must
"""Performs any applicable extra validation. Must
return True if the form is valid or False otherwise."""
raise Return(True)
return True

View File

@ -63,7 +63,7 @@ def requests_form_update(screen=1, request_id=None):
@requests_bp.route("/requests/new/<int:screen>/<string:request_id>", methods=["POST"])
def requests_update(screen=1, request_id=None):
screen = int(screen)
post_data = str(request.data)
post_data = request.form
current_user = g.current_user
existing_request = Requests.get(request_id) if request_id is not None else None
jedi_flow = JEDIRequestFlow(
@ -91,7 +91,7 @@ def requests_update(screen=1, request_id=None):
where = "/requests"
else:
where = url_for(
"requests.requests_Form_update", screen=jedi_flow.next_screen, request_id=jedi_flow.request_id
"requests.requests_form_update", screen=jedi_flow.next_screen, request_id=jedi_flow.request_id
)
return redirect(where)
else:
@ -120,6 +120,11 @@ def update_financial_verification():
pass
@requests_bp.route("/requests/submit/<string:request_id>", methods=["POST"])
def requests_submit(request_id=None):
pass
class JEDIRequestFlow(object):
def __init__(
self,
@ -240,7 +245,7 @@ class JEDIRequestFlow(object):
self.form_section: self.form.data
}
if self.request_id:
Requests.update(request_id, request_data)
Requests.update(self.request_id, request_data)
else:
request = Requests.create(self.current_user["id"], request_data)
self.request_id = request.id

View File

@ -1,18 +1,19 @@
{% extends '../requests_new.html.to' %}
{% extends 'requests_new.html' %}
{% from "components.html" import Alert, TextInput %}
{% block subtitle %}
<h2>Primary Government/Military <br> Point of Contact (POC)</h2>
{% end %}
{% endblock %}
{% block form %}
{% autoescape None %}
{% if f.errors %}
{% module Alert('There were some errors',
{{ Alert('There were some errors',
message="<p>Please see below.</p>",
level='error'
) %}
{% end %}
) }}
{% endif %}
<p>Please designate a Primary Point of Contact that will be responsible for owning the workspace in the JEDI Cloud.</p>
<p>The Point of Contact will become the primary owner of the <em>workspace</em> created to use the JEDI Cloud. As a workspace owner, this person will have the ability to:
@ -26,9 +27,9 @@
<em>This POC may be you.</em>
</p>
{% module TextInput(f.fname_poc,placeholder='First Name') %}
{% module TextInput(f.lname_poc,placeholder='Last Name') %}
{% module TextInput(f.email_poc,placeholder='jane@mail.mil') %}
{% module TextInput(f.dodid_poc,placeholder='10-digit number on the back of the CAC') %}
{{ TextInput(f.fname_poc,placeholder='First Name') }}
{{ TextInput(f.lname_poc,placeholder='Last Name') }}
{{ TextInput(f.email_poc,placeholder='jane@mail.mil') }}
{{ TextInput(f.dodid_poc,placeholder='10-digit number on the back of the CAC') }}
{% end %}
{% endblock %}

View File

@ -1,27 +1,28 @@
{% extends '../requests_new.html.to' %}
{% extends 'requests_new.html' %}
{% from "components.html" import Alert, TextInput %}
{% block subtitle %}
<h2>Review &amp; Submit</h2>
{% end %}
{% endblock %}
{% block form_action %}
<form method='POST' action="{{ reverse_url('requests_submit', request_id) }}" autocomplete="off">
{% end %}
<form method='POST' action="{{ url_for('requests.requests_submit', request_id=request_id) }}" autocomplete="off">
{% endblock %}
{% block form %}
{% autoescape None %}
{% if f.errors %}
{% module Alert('There were some errors',
{{ Alert('There were some errors',
message="<p>Please complete all required fields before submitting.</p>",
level='error'
) %}
{% end %}
) }}
{% endif %}
<p>Before you can submit your request, please take a moment to review the information entered in the form. You may make changes by clicking the edit link on each section. When all information looks right, go ahead and submit.</p>
<h2>Details of Use <a href="{{ reverse_url('request_form_update', 1, request_id) }}" class="icon-link">Edit</a></h2>
<h2>Details of Use <a href="{{ url_for('requests.requests_form_update', screen=1, request_id=request_id) }}" class="icon-link">Edit</a></h2>
<dl>
<div>
@ -107,7 +108,7 @@
</dl>
<h2>Information About You <a href="{{ reverse_url('request_form_update', 2, request_id) }}" class="icon-link">Edit</a></h2>
<h2>Information About You <a href="{{ url_for('requests.requests_form_update', screen=2, request_id=request_id) }}" class="icon-link">Edit</a></h2>
<dl>
<div>
@ -152,7 +153,7 @@
</dl>
<h2>Primary Point of Contact <a href="{{ reverse_url('request_form_update', 3, request_id) }}" class="icon-link">Edit</a></h2>
<h2>Primary Point of Contact <a href="{{ url_for('requests.requests_form_update', screen=3, request_id=request_id) }}" class="icon-link">Edit</a></h2>
<dl>
<div>
@ -178,15 +179,15 @@
{% end %}
{% endblock %}
{% block next %}
{% if not can_submit %}
{% module Alert('There were some errors',
{{ Alert('There were some errors',
message="<p>Please complete all required fields before submitting.</p>",
level='error'
) %}
{% end %}
) }}
{% endif %}
<div class='action-group'>
<input type='submit' class='usa-button usa-button-primary' value='Submit' {{ "disabled" if not can_submit else "" }} />
@ -194,4 +195,4 @@
</form>
{% end %}
{% endblock %}

View File

@ -2,13 +2,12 @@
{% block form %}
{% autoescape None %}
{% if f.errors %}
{% module Alert('There were some errors',
{{ Alert('There were some errors',
message="<p>Please complete all the fields before submitting.</p>",
level='error'
) %}
{% end %}
) }}
{% endif %}
<h2 id="financial-verification">Financial Verification</h2>
@ -20,7 +19,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.uii_ids.label }}
{{ f.uii_ids(placeholder="Example: \nDI 0CVA5786950 \nUN1945326361234786950") }}
@ -28,7 +27,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.pe_id.label }}
{{ f.pe_id(placeholder="Example: 0203752A") }}
@ -36,7 +35,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.treasury_code.label }}
{{ f.treasury_code(placeholder="Example: 1200") }}
@ -44,7 +43,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.ba_code.label }}
{{ f.ba_code(placeholder="Example: 02") }}
@ -52,7 +51,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
<!-- KO Information -->
@ -64,7 +63,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.lname_co.label }}
{{ f.lname_co(placeholder="Contracting Officer last name") }}
@ -72,7 +71,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.email_co.label }}
{{ f.email_co(placeholder="jane@mail.mil") }}
@ -80,7 +79,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.office_co.label }}
{{ f.office_co(placeholder="Example: WHS") }}
@ -88,7 +87,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
<!-- COR Information -->
@ -101,7 +100,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.lname_cor.label }}
{{ f.lname_cor(placeholder="Contracting Officer Representative last name") }}
@ -109,7 +108,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.email_cor.label }}
{{ f.email_cor(placeholder="jane@mail.mil") }}
@ -117,7 +116,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.office_cor.label }}
{{ f.office_cor(placeholder="Example: WHS") }}
@ -125,7 +124,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
<br><hr>
<em>&darr; FIELDS NEEDED FOR MANUAL ENTRY OF TASK ORDER INFORMATION (only necessary if EDA info not available)</em>
@ -137,7 +136,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.funding_type_other.label }}
{{ f.funding_type_other(placeholder="") }}
@ -145,7 +144,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.clin_0001.label }}
{{ f.clin_0001(placeholder="50,000") }}
@ -153,7 +152,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.clin_0003.label }}
{{ f.clin_0003(placeholder="13,000") }}
@ -161,7 +160,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.clin_1001.label }}
{{ f.clin_1001(placeholder="30,000") }}
@ -169,7 +168,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.clin_1003.label }}
{{ f.clin_1003(placeholder="7,000") }}
@ -177,7 +176,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.clin_2001.label }}
{{ f.clin_2001(placeholder="30,000") }}
@ -185,7 +184,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{{ f.clin_2003.label }}
{{ f.clin_2003(placeholder="7,000") }}
@ -193,7 +192,7 @@
<div class="usa-input-error-message">
{{ e }}
</div>
{% end %}
{% endfor %}
{% end %}
{% endblock %}