From 2c2b69affea33f8c63194bd77f01c0bae8768307 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Fri, 13 Dec 2019 10:54:00 -0500 Subject: [PATCH 1/2] Fix TO index blank states and number type issue --- atst/models/task_order.py | 3 +- atst/routes/task_orders/index.py | 5 +- templates/task_orders/index.html | 82 +++++++++++++++++--------------- translations.yaml | 2 + 4 files changed, 51 insertions(+), 41 deletions(-) diff --git a/atst/models/task_order.py b/atst/models/task_order.py index 64693831..7baef38d 100644 --- a/atst/models/task_order.py +++ b/atst/models/task_order.py @@ -1,4 +1,5 @@ from enum import Enum +from decimal import Decimal from sqlalchemy import Column, DateTime, ForeignKey, String from sqlalchemy.ext.hybrid import hybrid_property @@ -172,7 +173,7 @@ class TaskOrder(Base, mixins.TimestampsMixin): @property def invoiced_funds(self): # TODO: implement this using reporting data from the CSP - return self.total_obligated_funds * 75 / 100 + return self.total_obligated_funds * Decimal(0.75) @property def display_status(self): diff --git a/atst/routes/task_orders/index.py b/atst/routes/task_orders/index.py index a3d72cf7..e02780ca 100644 --- a/atst/routes/task_orders/index.py +++ b/atst/routes/task_orders/index.py @@ -28,5 +28,8 @@ def review_task_order(task_order_id): def portfolio_funding(portfolio_id): portfolio = Portfolios.get(g.current_user, portfolio_id) task_orders = TaskOrders.sort_by_status(portfolio.task_orders) + to_count = len(portfolio.task_orders) # TODO: Get expended amount from the CSP - return render_template("task_orders/index.html", task_orders=task_orders) + return render_template( + "task_orders/index.html", task_orders=task_orders, to_count=to_count + ) diff --git a/templates/task_orders/index.html b/templates/task_orders/index.html index dfabbd02..a272fade 100644 --- a/templates/task_orders/index.html +++ b/templates/task_orders/index.html @@ -15,45 +15,49 @@ {% macro TaskOrderList(task_orders, status) %}
- {% call Accordion(title=status, id=status, heading_tag="h4") %} - {% for task_order in task_orders %} - {% set to_number %} - {% if task_order.number != "" %} - Task Order #{{ task_order.number }} - {% else %} - New Task Order - {% endif %} - {% endset %} -
-

{{ to_number }} {{ Icon("caret_right", classes="icon--tiny icon--primary" ) }}

- {% if status != 'Expired' -%} -
-
-
- Current Period of Performance -
-

- {{ task_order.start_date | formattedDate(formatter="%b %d, %Y") }} - - - {{ task_order.end_date | formattedDate(formatter="%b %d, %Y") }} -

+ {% call Accordion(title=("task_orders.status_list_title"|translate({'status': status})), id=status, heading_tag="h4") %} + {% if task_orders|length > 0 %} + {% for task_order in task_orders %} + {% set to_number %} + {% if task_order.number != "" %} + Task Order #{{ task_order.number }} + {% else %} + New Task Order + {% endif %} + {% endset %} +
+

{{ to_number }} {{ Icon("caret_right", classes="icon--tiny icon--primary" ) }}

+ {% if status != 'Expired' -%} +
+
+
+ Current Period of Performance +
+

+ {{ task_order.start_date | formattedDate(formatter="%b %d, %Y") }} + - + {{ task_order.end_date | formattedDate(formatter="%b %d, %Y") }} +

+
+
+
Total Value
+

{{ task_order.total_contract_amount | dollars }}

+
+
+
Total Obligated
+

{{ task_order.total_obligated_funds | dollars }}

+
+
+
Total Expended
+

{{ task_order.invoiced_funds | dollars }}

+
-
-
Total Value
-

{{ task_order.total_contract_amount | dollars }}

-
-
-
Total Obligated
-

{{ task_order.total_obligated_funds | dollars }}

-
-
-
Total Expended
-

{{ task_order.invoiced_funds | dollars }}

-
-
- {%- endif %} -
- {% endfor %} + {%- endif %} +
+ {% endfor %} + {% else %} + {{ "task_orders.status_empty_state" | translate({ 'status': status }) }} + {% endif %} {% endcall %}
{% endmacro %} @@ -71,7 +75,7 @@
- {% if task_orders %} + {% if to_count > 0 %} {% call AccordionList() %} {% for status, to_list in task_orders.items() %} {{ TaskOrderList(to_list, status) }} diff --git a/translations.yaml b/translations.yaml index d63b1a5e..cb6b5376 100644 --- a/translations.yaml +++ b/translations.yaml @@ -529,6 +529,8 @@ task_orders: team_title: Your team sign: digital_signature_description: I acknowledge that the uploaded task order contains the required KO signature. + status_empty_state: 'This Portfolio has no {status} Task Orders.' + status_list_title: '{status} Task Orders' JEDICLINType: JEDI_CLIN_1: 'IDIQ CLIN 0001 Unclassified IaaS/PaaS' JEDI_CLIN_2: 'IDIQ CLIN 0002 Classified IaaS/PaaS' From 2552d4c700544d733c47cdf4703e4df96e56656d Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Fri, 13 Dec 2019 11:39:25 -0500 Subject: [PATCH 2/2] Styling for empty status accordion and update Not signed to Unsigned --- atst/models/task_order.py | 2 +- styles/elements/_accordions.scss | 7 +++++++ templates/task_orders/index.html | 4 +++- tests/domain/test_task_orders.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/atst/models/task_order.py b/atst/models/task_order.py index 7baef38d..1a46e505 100644 --- a/atst/models/task_order.py +++ b/atst/models/task_order.py @@ -17,7 +17,7 @@ class Status(Enum): ACTIVE = "Active" UPCOMING = "Upcoming" EXPIRED = "Expired" - UNSIGNED = "Not signed" + UNSIGNED = "Unsigned" SORT_ORDERING = [ diff --git a/styles/elements/_accordions.scss b/styles/elements/_accordions.scss index 4f56e9bb..8d21ef62 100644 --- a/styles/elements/_accordions.scss +++ b/styles/elements/_accordions.scss @@ -46,6 +46,13 @@ margin: 0; } } + + &--empty { + font-weight: $font-bold; + color: $color-gray-dark; + padding: $gap * 8; + text-align: center; + } } &-list { diff --git a/templates/task_orders/index.html b/templates/task_orders/index.html index a272fade..b9277123 100644 --- a/templates/task_orders/index.html +++ b/templates/task_orders/index.html @@ -56,7 +56,9 @@
{% endfor %} {% else %} - {{ "task_orders.status_empty_state" | translate({ 'status': status }) }} +
+ {{ "task_orders.status_empty_state" | translate({ 'status': status }) }} +
{% endif %} {% endcall %}
diff --git a/tests/domain/test_task_orders.py b/tests/domain/test_task_orders.py index acc2d158..7bc4cf41 100644 --- a/tests/domain/test_task_orders.py +++ b/tests/domain/test_task_orders.py @@ -152,5 +152,5 @@ def test_task_order_sort_by_status(): assert len(sorted_by_status["Active"]) == 1 assert len(sorted_by_status["Upcoming"]) == 1 assert len(sorted_by_status["Expired"]) == 2 - assert len(sorted_by_status["Not signed"]) == 1 + assert len(sorted_by_status["Unsigned"]) == 1 assert list(sorted_by_status.keys()) == [status.value for status in SORT_ORDERING]