diff --git a/atst/forms/task_order.py b/atst/forms/task_order.py index fb10774e..5c062ae6 100644 --- a/atst/forms/task_order.py +++ b/atst/forms/task_order.py @@ -85,6 +85,11 @@ class UnclassifiedFundingForm(FundingForm): clin_02 = IntegerField("CLIN 02: Classified (available soon)") clin_04 = IntegerField("CLIN 04: Classified (available soon)") + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.clin_02.data = "0" + self.clin_04.data = "0" + class OversightForm(CacheableForm): ko_first_name = StringField("First Name") diff --git a/atst/routes/task_orders/new.py b/atst/routes/task_orders/new.py index 9534fe12..eb542340 100644 --- a/atst/routes/task_orders/new.py +++ b/atst/routes/task_orders/new.py @@ -1,3 +1,5 @@ +from copy import deepcopy + from flask import ( request as http_request, render_template, @@ -90,7 +92,7 @@ class ShowTaskOrderWorkflow: @property def display_screens(self): - screen_info = TASK_ORDER_SECTIONS.copy() + screen_info = deepcopy(TASK_ORDER_SECTIONS) if self.task_order: for section in screen_info: @@ -108,10 +110,11 @@ class UpdateTaskOrderWorkflow(ShowTaskOrderWorkflow): self.task_order_id = task_order_id self._task_order = None self._section = TASK_ORDER_SECTIONS[screen - 1] + self._form = self._section["form"](self.form_data) @property def form(self): - return self._section["form"](self.form_data) + return self._form @property def workspace(self): diff --git a/templates/components/text_input.html b/templates/components/text_input.html index 78b858b0..21a0839d 100644 --- a/templates/components/text_input.html +++ b/templates/components/text_input.html @@ -37,8 +37,10 @@ {{ description | safe }} {% endif %} - {{ Icon('alert',classes="icon-validation") }} - {{ Icon('ok',classes="icon-validation") }} + {% if not disabled %} + {{ Icon('alert',classes="icon-validation") }} + {{ Icon('ok',classes="icon-validation") }} + {% endif %} diff --git a/templates/task_orders/new/app_info.html b/templates/task_orders/new/app_info.html index 9005bc2b..9e01a1fc 100644 --- a/templates/task_orders/new/app_info.html +++ b/templates/task_orders/new/app_info.html @@ -11,8 +11,6 @@ {% block form %} -{% include "fragments/flash.html" %} -

Basic Information

{{ TextInput(form.portfolio_name, placeholder="The name of your office or organization") }} {{ TextInput(form.scope, paragraph=True) }} diff --git a/templates/task_orders/new/funding.html b/templates/task_orders/new/funding.html index 701c2b75..23586216 100644 --- a/templates/task_orders/new/funding.html +++ b/templates/task_orders/new/funding.html @@ -10,8 +10,6 @@ {% block form %} -{% include "fragments/flash.html" %} -
diff --git a/templates/task_orders/new/oversight.html b/templates/task_orders/new/oversight.html index 59ea3797..102d1c84 100644 --- a/templates/task_orders/new/oversight.html +++ b/templates/task_orders/new/oversight.html @@ -9,8 +9,6 @@ {% block form %} -{% include "fragments/flash.html" %} -

Contracting Officer (KO) Information

{{ UserInfo(form.ko_first_name, form.ko_last_name, form.ko_email, form.ko_dod_id) }} diff --git a/templates/task_orders/new/review.html b/templates/task_orders/new/review.html index 34a8d28c..7ca973a1 100644 --- a/templates/task_orders/new/review.html +++ b/templates/task_orders/new/review.html @@ -10,8 +10,6 @@ {% block form %} -{% include "fragments/flash.html" %} - {% macro TOEditLink(screen=1) %} {% if task_order %} {{ EditLink(url_for("task_orders.new", screen=screen, task_order_id=task_order.id)) }} diff --git a/tests/routes/task_orders/test_new_task_order.py b/tests/routes/task_orders/test_new_task_order.py index 462fabea..000e280d 100644 --- a/tests/routes/task_orders/test_new_task_order.py +++ b/tests/routes/task_orders/test_new_task_order.py @@ -70,6 +70,28 @@ def test_create_new_task_order(client, user_session): assert url_for("task_orders.new", screen=4) in response.headers["Location"] +def test_task_order_form_shows_errors(client, user_session): + creator = UserFactory.create() + user_session(creator) + + to = TaskOrderFactory.create() + + task_order_data = TaskOrderFactory.dictionary() + funding_data = slice_data_for_section(task_order_data, "funding") + funding_data = serialize_dates(funding_data) + funding_data.update({"clin_01": "one milllllion dollars"}) + + response = client.post( + url_for("task_orders.update", screen=2, task_order_id=to.id), + data=funding_data, + follow_redirects=False, + ) + + body = response.data.decode() + assert "There were some errors" in body + assert "Not a valid integer" in body + + def test_show_task_order(): workflow = ShowTaskOrderWorkflow() assert workflow.task_order is None