Style and refactor components for expired funding
- modify Accordion component to be able to customize classes and tags that it uses to build markup - modify the shape of the object that the mock CSP returns for data that builds this section. - Also ensures that the CLINs TOs and CLINS are sorted - add appropriate css for styling
This commit is contained in:
parent
55e95b09af
commit
4e0af139cc
@ -308,20 +308,37 @@ class MockReportingProvider(ReportingInterface):
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
def get_expired_task_orders(self, portfolio):
|
def get_expired_task_orders(self, portfolio):
|
||||||
return [
|
def sorted_task_orders(to_list):
|
||||||
|
return sorted(to_list, key=lambda to: to["number"])
|
||||||
|
|
||||||
|
def sorted_clins(clin_list):
|
||||||
|
return sorted(clin_list, key=lambda clin: clin["number"])
|
||||||
|
|
||||||
|
def serialize_clin(clin):
|
||||||
|
return {
|
||||||
|
"number": clin.number,
|
||||||
|
"jedi_clin_type": clin.jedi_clin_type,
|
||||||
|
"period_of_performance": {
|
||||||
|
"start_date": clin.start_date,
|
||||||
|
"end_date": clin.end_date,
|
||||||
|
},
|
||||||
|
"total_value": clin.total_amount,
|
||||||
|
"total_obligated_funds": clin.obligated_amount,
|
||||||
|
"expended_funds": (
|
||||||
|
clin.obligated_amount * Decimal(self.MOCK_PERCENT_EXPENDED_FUNDS)
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
return sorted_task_orders(
|
||||||
|
[
|
||||||
{
|
{
|
||||||
"id": task_order.id,
|
"id": task_order.id,
|
||||||
"number": task_order.number,
|
"number": task_order.number,
|
||||||
"period_of_performance": {
|
"clins": sorted_clins(
|
||||||
"start_date": task_order.start_date,
|
[serialize_clin(clin) for clin in task_order.clins]
|
||||||
"end_date": task_order.end_date,
|
|
||||||
},
|
|
||||||
"total_obligated_funds": task_order.total_obligated_funds,
|
|
||||||
"expended_funds": (
|
|
||||||
task_order.total_obligated_funds
|
|
||||||
* Decimal(self.MOCK_PERCENT_EXPENDED_FUNDS)
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
for task_order in portfolio.task_orders
|
for task_order in portfolio.task_orders
|
||||||
if task_order.is_expired
|
if task_order.is_expired
|
||||||
]
|
]
|
||||||
|
)
|
||||||
|
@ -87,4 +87,14 @@
|
|||||||
font-size: $lead-font-size;
|
font-size: $lead-font-size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.reporting-expended-funding {
|
||||||
|
&__header {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
&__content {
|
||||||
|
padding: 0;
|
||||||
|
border-top: 1px solid $color-gray-lighter;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
{% macro Accordion(title, id, heading_level="h2") %}
|
{% macro Accordion(
|
||||||
<accordion inline-template>
|
title,
|
||||||
<div>
|
id,
|
||||||
<{{heading_level}}>
|
wrapper_tag="div",
|
||||||
|
wrapper_classes="",
|
||||||
|
heading_tag="h2",
|
||||||
|
heading_classes="",
|
||||||
|
content_tag="div",
|
||||||
|
content_classes="") %}
|
||||||
|
<accordion v-cloak inline-template>
|
||||||
|
<{{wrapper_tag}} class="{{ wrapper_classes }}">
|
||||||
|
<{{heading_tag}} class="{{ heading_classes }}">
|
||||||
<button
|
<button
|
||||||
v-on:click="toggle($event)"
|
v-on:click="toggle($event)"
|
||||||
class="usa-accordion-button"
|
class="usa-accordion-button"
|
||||||
@ -10,14 +18,13 @@
|
|||||||
>
|
>
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</button>
|
</button>
|
||||||
</{{heading_level}}>
|
</{{heading_tag}}>
|
||||||
<div
|
<{{content_tag}}
|
||||||
id="{{ id }}"
|
id="{{ id }}"
|
||||||
class="usa-accordion-content"
|
class="usa-accordion-content {{ content_classes }}"
|
||||||
v-bind:aria-hidden="isVisible ? 'false' : 'true'"
|
v-bind:aria-hidden="isVisible ? 'false' : 'true'">
|
||||||
>
|
|
||||||
{{ caller() }}
|
{{ caller() }}
|
||||||
</div>
|
</{{content_tag}}>
|
||||||
</div>
|
</{{wrapper_tag}}>
|
||||||
</accordion>
|
</accordion>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
@ -1,34 +1,51 @@
|
|||||||
{% from "components/accordion.html" import Accordion %}
|
{% from "components/accordion.html" import Accordion %}
|
||||||
|
{% from "components/icon.html" import Icon %}
|
||||||
|
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<div class="usa-accordion">
|
<div class="usa-accordion">
|
||||||
{% call Accordion("Expired Task Orders", "expired_task_orders", "h3") %}
|
{% call Accordion(
|
||||||
|
"Expired funding",
|
||||||
|
"expired_funding",
|
||||||
|
heading_classes="reporting-expended-funding__header",
|
||||||
|
content_tag="table",
|
||||||
|
content_classes="atat-table reporting-expended-funding__content") %}
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>TO CLIN</th>
|
||||||
|
<th>PoP</th>
|
||||||
|
<th>CLIN Value</th>
|
||||||
|
<th>Amount Obligated</th>
|
||||||
|
<th>Amount Unspent</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
{% for task_order in expired_task_orders %}
|
{% for task_order in expired_task_orders %}
|
||||||
<a href="{{ url_for("task_orders.review_task_order", task_order_id=task_order["id"]) }}">
|
<tr>
|
||||||
Task Order {{ task_order["number"] }}
|
<td colspan="5">
|
||||||
|
<span class="h4 reporting-expended-funding__header">Task Order</span> <a href="{{ url_for("task_orders.review_task_order", task_order_id=task_order.id) }}">
|
||||||
|
{{ task_order.number }} {{ Icon("caret_right", classes="icon--tiny icon--blue" ) }}
|
||||||
</a>
|
</a>
|
||||||
<div>
|
</td>
|
||||||
<p>Period of Performance</p>
|
</tr>
|
||||||
<p>
|
{% for clin in task_order.clins %}
|
||||||
{{ task_order["period_of_performance"].start_date | formattedDate(formatter="%B %d, %Y") }}
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="h4 reporting-expended-funding__header">{{ clin.number }}</div>
|
||||||
|
<div>{{ ("{}".format(clin.jedi_clin_type) | translate)[15:] }}</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ clin.period_of_performance.start_date | formattedDate(formatter="%b %d, %Y") }}
|
||||||
-
|
-
|
||||||
{{ task_order["period_of_performance"].end_date | formattedDate(formatter="%B %d, %Y") }}
|
{{ clin.period_of_performance.end_date | formattedDate(formatter="%b %d, %Y") }}
|
||||||
</p>
|
</td>
|
||||||
</div>
|
<td>{{ clin.total_value | dollars }}</td>
|
||||||
<div>
|
<td>{{ clin.total_obligated_funds | dollars }}</td>
|
||||||
<p>Total Obligated</p>
|
<td>{{ (clin.total_obligated_funds - clin.expended_funds) | dollars }}</td>
|
||||||
<p>{{ task_order["total_obligated_funds"] | dollars }}</p>
|
<tr>
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p>Total Expended</p>
|
|
||||||
<p>{{ task_order["expended_funds"] | dollars }}</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p>Total Unused</p>
|
|
||||||
<p>{{ (task_order["total_obligated_funds"] - task_order["expended_funds"]) | dollars }}</p>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user