Merge pull request #1220 from dod-ccpo/reporting-expired-funding-and-spend-table

Styling for expired funding and spend table sections of reporting
This commit is contained in:
graham-dds 2019-12-02 13:13:19 -05:00 committed by GitHub
commit 699176fc91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 135 additions and 62 deletions

View File

@ -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
] ]
)

View File

@ -87,4 +87,32 @@
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;
}
}
.reporting-spend-table {
&__env-row {
&-label {
margin-left: $gap * 5;
}
&--last {
& > td {
border-bottom: 1px solid black;
}
&:last-of-type {
& > td {
border-bottom: none;
}
}
}
}
}
} }

View File

@ -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 %}

View File

@ -59,9 +59,13 @@
<span v-html='formatDollars(application["total_spend_to_date"])'></span> <span v-html='formatDollars(application["total_spend_to_date"])'></span>
</td> </td>
</tr> </tr>
<tr v-for='(environment, envName) in environments[name]' v-show='application.isVisible'> <tr
v-for='(environment, envName, index) in environments[name]'
v-show='application.isVisible'
v-bind:class="[ index == Object.keys(environments[name]).length -1 ? 'reporting-spend-table__env-row--last' : '']"
>
<td> <td>
<span v-html='envName'></span> <span class="reporting-spend-table__env-row-label" v-html='envName'></span>
</td> </td>
<td class="table-cell--align-right"> <td class="table-cell--align-right">
<span v-html='formatDollars(environment[currentMonthIndex] || 0)'></span> <span v-html='formatDollars(environment[currentMonthIndex] || 0)'></span>

View File

@ -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>