Render form fields on the page

This commit is contained in:
Montana 2019-01-25 15:58:41 -05:00
parent f6a066f983
commit 1ca4d62a3a
4 changed files with 30 additions and 17 deletions

View File

@ -8,31 +8,27 @@ from .validators import IsNumber
from atst.utils.localization import translate from atst.utils.localization import translate
class KOReviewForm(CacheableForm): class KOReviewForm(CacheableForm):
pdf = FileField( pdf = FileField(
translate("forms.ko_review.pdf_label"), translate("forms.ko_review.pdf_label"),
description=translate("forms.ko_review.pdf_description"),
validators=[ validators=[
FileAllowed(["pdf"], translate("forms.ko_review.pdf_description")), FileAllowed(
["pdf", "png"], translate("forms.task_order.file_format_not_allowed")
),
InputRequired(), InputRequired(),
], ],
render_kw={"required": False}, render_kw={"required": False, "accept": ".pdf,.png,application/pdf,image/png"},
) )
to_number = StringField( to_number = StringField(
translate("forms.ko_review.to_number"), translate("forms.ko_review.to_number"), validators=[Length(min=10), IsNumber()]
validators=[
Length(min=10),
IsNumber(),
],
) )
loa = StringField( loa = StringField(
translate("forms.ko_review.loa"), translate("forms.ko_review.loa"), validators=[Length(min=10), IsNumber()]
validators=[
Length(min=10),
IsNumber(),
],
) )
custom_clauses = TextAreaField( custom_clauses = TextAreaField(
translate("forms.ko_review.custom_clauses_label"), translate("forms.ko_review.custom_clauses_label"),
description=translate("forms.ko_review.custom_clauses_description"), description=translate("forms.ko_review.custom_clauses_description"),
validators=[Optional()] validators=[Optional()],
) )

View File

@ -81,7 +81,11 @@ def review_task_order(portfolio_id, task_order_id, form=None):
form=form or KOReviewForm(), form=form or KOReviewForm(),
) )
@portfolios_bp.route("/portfolios/<portfolio_id>/task_order/<task_order_id>/submit_review", methods=["POST"])
@portfolios_bp.route(
"/portfolios/<portfolio_id>/task_order/<task_order_id>/submit_review",
methods=["POST"],
)
def submit_review_task_order(portfolio_id, task_order_id, form=None): def submit_review_task_order(portfolio_id, task_order_id, form=None):
portfolio = Portfolios.get(g.current_user, portfolio_id) portfolio = Portfolios.get(g.current_user, portfolio_id)
task_order = TaskOrders.get(g.current_user, task_order_id) task_order = TaskOrders.get(g.current_user, task_order_id)

View File

@ -3,6 +3,9 @@
{% from "components/edit_link.html" import EditLink %} {% from "components/edit_link.html" import EditLink %}
{% from "components/required_label.html" import RequiredLabel %} {% from "components/required_label.html" import RequiredLabel %}
{% from "components/icon.html" import Icon %} {% from "components/icon.html" import Icon %}
{% from "components/datepicker.html" import DatePicker %}
{% from "components/text_input.html" import TextInput %}
{% block content %} {% block content %}
@ -205,7 +208,10 @@
</div> </div>
</div> </div>
<div class="">Period of Performance Start Date</div> <div class="">{{ "task_orders.ko_review.performance_start"| translate }}</div>
{{ DatePicker() }}
<div class="">{{ "task_orders.ko_review.performance_end"| translate }}</div>
{{ DatePicker() }}
<hr> <hr>
@ -223,7 +229,12 @@
<div class="h2">{{ "task_orders.ko_review.task_order_information"| translate }}</div> <div class="h2">{{ "task_orders.ko_review.task_order_information"| translate }}</div>
<div class="">Upload a copy of your Task Order document</div> {{ form.pdf.label }}
{{ form.pdf.description }}
{{ form.pdf }}
{{ TextInput(form.to_number) }}
{{ TextInput(form.loa) }}
{{ TextInput(form.custom_clauses, paragraph=True) }}
</div> </div>
</div> </div>

View File

@ -58,7 +58,7 @@ forms:
pdf_label: Upload a copy of your Task Order document pdf_label: Upload a copy of your Task Order document
pdf_description: Upload a PDF of the Task Order that you entered in your system of record for your organization. pdf_description: Upload a PDF of the Task Order that you entered in your system of record for your organization.
to_number: Task Order Number to_number: Task Order Number
loa: Line of Accounting (LOA) \#1 loa: Line of Accounting (LOA) #1
custom_clauses_label: Task Order Custom Clauses (optional) custom_clauses_label: Task Order Custom Clauses (optional)
custom_clauses_description: This will put a pause on the CSP access once the KO signs until the CCPO reviews that language to make sure it is legal. custom_clauses_description: This will put a pause on the CSP access once the KO signs until the CCPO reviews that language to make sure it is legal.
edit_member: edit_member:
@ -464,6 +464,8 @@ task_orders:
add_button_text: Add / Invite Security Officer add_button_text: Add / Invite Security Officer
invite_button_text: Invite Security Officer invite_button_text: Invite Security Officer
ko_review: ko_review:
performance_start: Period of Performance Start Date
performance_end: Period of Performance End Date
task_order_information: Task Order Information task_order_information: Task Order Information
testing: testing:
example_string: Hello World example_string: Hello World