change requests index column names depending on user role

This commit is contained in:
dandds 2018-08-13 15:27:07 -04:00
parent 7fef858d24
commit d921aaa2be
2 changed files with 35 additions and 22 deletions

View File

@ -10,6 +10,7 @@ def map_request(request):
time_created = pendulum.instance(request.time_created) time_created = pendulum.instance(request.time_created)
is_new = time_created.add(days=1) > pendulum.now() is_new = time_created.add(days=1) > pendulum.now()
app_count = request.body.get("details_of_use", {}).get("num_software_systems", 0) app_count = request.body.get("details_of_use", {}).get("num_software_systems", 0)
annual_usage = request.body.get("details_of_use", {}).get("dollar_value", 0)
update_url = url_for( update_url = url_for(
"requests.requests_form_update", screen=1, request_id=request.id "requests.requests_form_update", screen=1, request_id=request.id
) )
@ -22,6 +23,7 @@ def map_request(request):
"app_count": app_count, "app_count": app_count,
"date": time_created.format("M/DD/YYYY"), "date": time_created.format("M/DD/YYYY"),
"full_name": request.creator.full_name, "full_name": request.creator.full_name,
"annual_usage": annual_usage,
"edit_link": verify_url if Requests.is_pending_financial_verification( "edit_link": verify_url if Requests.is_pending_financial_verification(
request request
) else update_url, ) else update_url,
@ -47,4 +49,5 @@ def requests_index():
requests=mapped_requests, requests=mapped_requests,
pending_financial_verification=pending_fv, pending_financial_verification=pending_fv,
pending_ccpo_approval=pending_ccpo, pending_ccpo_approval=pending_ccpo,
extended_view=is_ccpo
) )

View File

@ -65,6 +65,7 @@
<div class="col col--grow"> <div class="col col--grow">
{% if extended_view %}
<form class='search-bar'> <form class='search-bar'>
<div class='usa-input search-input'> <div class='usa-input search-input'>
<label for='requests-search'>Search requests by Order ID</label> <label for='requests-search'>Search requests by Order ID</label>
@ -84,6 +85,7 @@
</select> </select>
</div> </div>
</form> </form>
{% endif %}
<div class='responsive-table-wrapper'> <div class='responsive-table-wrapper'>
<table> <table>
@ -91,8 +93,12 @@
<tr> <tr>
<th scope="col">Order ID</th> <th scope="col">Order ID</th>
<th scope="col">Request Date</th> <th scope="col">Request Date</th>
{% if extended_view %}
<th scope="col">Requester</th> <th scope="col">Requester</th>
<th scope="col">Total Apps</th> <th scope="col">Total Apps</th>
{% else %}
<th scope="col">Annual Usage</th>
{% endif %}
<th scope="col">Status</th> <th scope="col">Status</th>
<th scope="col" class="table-cell--shrink">Actions</th> <th scope="col" class="table-cell--shrink">Actions</th>
</tr> </tr>
@ -106,8 +112,12 @@
</th> </th>
{% endif %} {% endif %}
<td>{{ r['date'] }}</td> <td>{{ r['date'] }}</td>
{% if extended_view %}
<td>{{ r['full_name'] }}</td> <td>{{ r['full_name'] }}</td>
<td>{{ r['app_count'] }}</td> <td>{{ r['app_count'] }}</td>
{% else %}
<td>{{ r['annual_usage'] }}</td>
{% endif %}
<td>{{ r['status'] }}</td> <td>{{ r['status'] }}</td>
<td class="table-cell--shrink"> <td class="table-cell--shrink">
<a href="" class='icon-link'>Download</a> <a href="" class='icon-link'>Download</a>