diff --git a/atst/routes/requests/index.py b/atst/routes/requests/index.py index 97225681..2a785aee 100644 --- a/atst/routes/requests/index.py +++ b/atst/routes/requests/index.py @@ -4,6 +4,7 @@ from flask import render_template, g, url_for from . import requests_bp from atst.domain.requests import Requests from atst.models.permissions import Permissions +from atst.forms.data import SERVICE_BRANCHES class RequestsIndex(object): @@ -20,7 +21,11 @@ class RequestsIndex(object): else: context = self._non_ccpo_view(self.user) - return {**context, "possible_statuses": Requests.possible_statuses()} + return { + **context, + "possible_statuses": Requests.possible_statuses(), + "possible_dod_components": [b[0] for b in SERVICE_BRANCHES[1:]], + } def _ccpo_view(self, user): requests = Requests.get_many() diff --git a/js/components/forms/requests_list.js b/js/components/forms/requests_list.js index c3b07518..1e3d586f 100644 --- a/js/components/forms/requests_list.js +++ b/js/components/forms/requests_list.js @@ -23,6 +23,10 @@ export default { type: Array, default: [], }, + dodComponents: { + type: Array, + default: [], + } }, data: function () { @@ -76,6 +80,7 @@ export default { return { searchValue: '', statusValue: '', + dodComponentValue: '', sort: { columnName: '', isAscending: true @@ -88,7 +93,7 @@ export default { filteredRequests: function () { return pipe( partial(this.applySearch, [this.searchValue]), - partial(this.applyFilters, [this.statusValue]), + partial(this.applyFilters, [this.statusValue, this.dodComponentValue]), partial(this.applySort, [this.sort]), )(this.requests) } @@ -106,11 +111,15 @@ export default { true ) }, - applyFilters: (status, requests) => { + applyFilters: (status, dodComponent, requests) => { return requests.filter( (request) => status !== '' ? request.status === status : true + ).filter( + (request) => dodComponent !== '' ? + request.dod_component === dodComponent : + true ) }, applySort: function(sort, requests) { diff --git a/templates/requests/index.html b/templates/requests/index.html index acba403f..03c3b441 100644 --- a/templates/requests/index.html +++ b/templates/requests/index.html @@ -37,7 +37,13 @@ {% endcall %} - +
{% if num_action_required %} @@ -96,6 +102,15 @@
+ +
+ + +
{% endif %}