Skip to content

Commit

Permalink
Merge PR 314, 309 and 315 to hotfix branch
Browse files Browse the repository at this point in the history
Co-Authored-By: Chandra Y <[email protected]>
  • Loading branch information
chandra-tacc and chandra-tacc committed Sep 20, 2024
1 parent 96a5fc2 commit b7109d6
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1>View Exception Requests</h1>
<option class="dropdown-text" {% if option == selected_org %}selected{% endif %}>{{ option }}</option>
{% endfor %}
</select>
{% if selected_status or selected_org %}
{% if selected_status != 'All' or selected_org != 'All' %}
<button onclick="clearSelections()">Clear Options</button>
{% endif %}
</div>
Expand Down
24 changes: 11 additions & 13 deletions apcd-cms/src/apps/admin_exception/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _set_exceptions(exception):
'requestor_name': exception[2],
'request_type': title_case(exception[3]) if exception[3] else None, # to make sure if val doesn't exist, utils don't break page
'explanation_justification': exception[4],
'outcome': title_case(exception[5]) if exception[3] else None,
'outcome': title_case(exception[5]) if exception[5] else None,
'created_at': exception[6],
'updated_at': exception[7],
'submitter_code': exception[8],
Expand All @@ -83,7 +83,7 @@ def _set_exceptions(exception):
'requested_expiration_date': exception[16],
'approved_threshold': exception[17],
'approved_expiration_date': exception[18],
'status': title_case(exception[19])if exception[3] else None,
'status': title_case(exception[19])if exception[19] else 'None',
'notes': exception[20],
'entity_name': exception[21],
'data_file_name': exception[22]
Expand All @@ -110,31 +110,29 @@ def getDate(row):
# to be able to access any exception in a template using exceptions var in the future
context['exceptions'].append(_set_exceptions(exception))
entity_name = title_case(exception[21])
status = title_case(exception[19])
status = title_case(exception[19]) if exception[19] else 'None'
outcome = title_case(exception[5])
if entity_name not in context['org_options']:
context['org_options'].append(entity_name)
# to make sure All is first in the dropdown filter options after sorting alphabetically
context['org_options'] = sorted(context['org_options'], key=lambda x: (x != 'All', x))
context['org_options'] = sorted(context['org_options'],key=lambda x: (x != 'All', x is None, x if x is not None else ''))
# Remove empty strings
context['org_options'] = [option for option in context['org_options'] if option != '']
if status not in context['status_options']:
if status != None:
context['status_options'].append(status)
# to make sure All is first in the dropdown filter options after sorting alphabetically
context['status_options'] = sorted(context['status_options'], key=lambda x: (x != 'All', x))
context['status_options'].append(status)
context['status_options'] = sorted(context['status_options'], key=lambda x: (x != 'All', x is None, x if x is not None else ''))
if outcome not in context['outcome_options']:
context['outcome_options'].append(outcome)
context['outcome_options'] = sorted(context['outcome_options'], key=lambda x: (x is not None, x))
context['outcome_options'] = sorted(context['outcome_options'], key=lambda x: (x != 'All', x is None, x if x is not None else ''))

context['selected_status'] = None
if status_filter is not None and status_filter != 'All':
context['selected_status'] = 'All'
if status_filter and status_filter != 'All':
context['selected_status'] = status_filter
queryStr += f'&status={status_filter}'
exception_table_entries = table_filter(status_filter, exception_table_entries, 'status')

context['selected_org'] = None
if org_filter is not None and org_filter != 'All':
context['selected_org'] = 'All'
if org_filter and org_filter != 'All':
context['selected_org'] = org_filter
queryStr += f'&org={org_filter}'
exception_table_entries = table_filter(org_filter.replace("(", "").replace(")",""), exception_table_entries, 'entity_name')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1>View Extension Requests</h1>
<option class="dropdown-text" {% if option == selected_org %}selected{% endif %}>{{ option }}</option>
{% endfor %}
</select>
{% if selected_status or selected_org %}
{% if selected_status != 'All' or selected_org != 'All' %}
<button onclick="clearSelections()">Clear Options</button>
{% endif %}
</div>
Expand Down
18 changes: 9 additions & 9 deletions apcd-cms/src/apps/admin_extension/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ def _set_extensions(extension):
# to separate small carrier into two words
'extension_type': title_case(extension[5].replace('_', ' ')) if extension[5] else None,
'applicable_data_period': _get_applicable_data_period(extension[6]),
'status': title_case(extension[7]),
'outcome': title_case(extension[8]),
'status': title_case(extension[7]) if extension[7] else 'None',
'outcome': title_case(extension[8]) if extension[8] else None,
'created_at': extension[9],
'updated_at': extension[10],
'submitter_code': extension[11],
'payor_code': extension[12],
'user_id': extension[13],
'requestor_name': title_case(extension[14]),
'requestor_name': title_case(extension[14]) if extension[14] else None,
'requestor_email': extension[15],
'explanation_justification': extension[16],
'notes': extension[17],
Expand Down Expand Up @@ -104,31 +104,31 @@ def getDate(row):
# to be able to access any extension in a template
context['extensions'].append(_set_extensions(extension))
entity_name = title_case(extension[18])
status = title_case(extension[7])
status = title_case(extension[7]) if extension[7] else 'None'
outcome = title_case(extension[8])
if entity_name not in context['org_options']:
context['org_options'].append(entity_name)
context['org_options'] = sorted(context['org_options'], key=lambda x: (x != 'All', x))
context['org_options'] = sorted(context['org_options'], key=lambda x: (x != 'All', x is None, x if x is not None else ''))
# Remove empty strings
context['org_options'] = [option for option in context['org_options'] if option != '']
if status not in context['status_options']:
context['status_options'].append(status)
context['status_options'] = sorted(context['status_options'], key=lambda x: (x != 'All', x))
context['status_options'] = sorted(context['status_options'], key=lambda x: (x != 'All', x is None, x if x is not None else ''))
if outcome not in context['outcome_options']:
context['outcome_options'].append(outcome)
context['outcome_options'] = sorted(context['outcome_options'], key=lambda x: (x is not None, x))
context['outcome_options'] = sorted(context['outcome_options'], key=lambda x: (x != 'All', x is None, x if x is not None else ''))

queryStr = ''
status_filter = self.request.GET.get('status')
org_filter = self.request.GET.get('org')

context['selected_status'] = None
context['selected_status'] = 'All'
if status_filter is not None and status_filter != 'All':
context['selected_status'] = status_filter
queryStr += f'&status={status_filter}'
extension_table_entries = table_filter(status_filter, extension_table_entries, 'status')

context['selected_org'] = None
context['selected_org'] = 'All'
if org_filter is not None and org_filter != 'All':
context['selected_org'] = org_filter
queryStr += f'&org={org_filter}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h1>List Registrations</h1>
<option class="dropdown-text" {% if option == selected_org %}selected{% endif %}>{{ option }}</option>
{% endfor %}
</select>
{% if selected_status or selected_org %}
{% if selected_status != 'All' or selected_org != 'All' %}
<button onclick="clearSelections()">Clear Options</button>
{% endif %}
</div>
Expand Down
12 changes: 7 additions & 5 deletions apcd-cms/src/apps/admin_regis_table/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def get_context_data(self, registrations_content, registrations_entities, regist
context = super(RegistrationsTable, self).get_context_data(*args, **kwargs)

context['header'] = ['Business Name', 'Year', 'Type', 'Location', 'Registration Status', 'Actions']
context['status_options'] = ['All', 'Received', 'Processing', 'Complete']
context['status_options'] = ['All', 'Received', 'Processing', 'Complete', 'Withdrawn']
context['status_options'] = sorted(context['status_options'], key=lambda x: (x != 'All', x is None, x if x is not None else ''))
context['org_options'] = ['All']

try:
Expand All @@ -107,19 +108,20 @@ def getDate(row):
org_name = registration[7]
if org_name not in context['org_options']:
context['org_options'].append(org_name)
context['org_options'] = sorted(context['org_options'],key=lambda x: (x != 'All', x is None, x if x is not None else ''))

queryStr = ''
status_filter = self.request.GET.get('status')
org_filter = self.request.GET.get('org')

context['selected_status'] = None
if status_filter is not None and status_filter != 'All':
context['selected_status'] = 'All'
if status_filter and status_filter != 'All':
context['selected_status'] = status_filter
queryStr += f'&status={status_filter}'
registration_table_entries = table_filter(status_filter, registration_table_entries, 'reg_status')

context['selected_org'] = None
if org_filter is not None and org_filter != 'All':
context['selected_org'] = 'All'
if org_filter and org_filter != 'All':
context['selected_org'] = org_filter
queryStr += f'&org={org_filter}'
registration_table_entries = table_filter(org_filter.replace("(", "").replace(")",""), registration_table_entries, 'biz_name')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1>View Submissions</h1>
<div class="filter-content">
<span><b>Filter by Status: </b></span>
<select id="statusFilter" class="status-filter" onchange="filterTableByStatus()">
{% for option in filter_options %}
{% for option in status_options %}
<option class="dropdown-text" {% if option == selected_status %}selected{% endif %}>{{ option }}</option>
{% endfor %}
</select>
Expand All @@ -32,7 +32,7 @@ <h1>View Submissions</h1>
<option class="dropdown-text" value={{option}} {% if option == selected_sort %}selected{% endif %}>{{ display_text }}</option>
{% endfor %}
</select>
{% if selected_status or selected_sort %}
{% if selected_status != 'All' or selected_sort != None %}
<button onclick="clearSelections()">Clear Options</button>
{% endif %}
</div>
Expand Down
17 changes: 12 additions & 5 deletions apcd-cms/src/apps/admin_submissions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ def get_context_data(self, *args, **kwargs):

submission_content = get_all_submissions_and_logs()

context['status_options'] = ['All']
for i in submission_content:
status = title_case(i['status']) if i['status'] else 'None'
if status not in context['status_options']:
context['status_options'].append(status)
context['status_options'] = sorted(context['status_options'], key=lambda x: (x != 'All', x is None, x if x is not None else ''))

queryStr = ''
dateSort = self.request.GET.get('sort')
status_filter = self.request.GET.get('status')
Expand All @@ -42,7 +49,7 @@ def getDate(row):
except:
page_num = 1

context['selected_status'] = None
context['selected_status'] = 'All'
if status_filter is not None and status_filter != 'All':
context['selected_status'] = status_filter
queryStr += f'&status={status_filter}'
Expand All @@ -54,14 +61,14 @@ def getDate(row):
# modifies the object fields for display, only modifies a subset of entries that will be displayed
# on the current page using offset and limit
for s in submission_content[offset:offset + limit]:
s['status'] = title_case(s['status'])
s['entity_name'] = title_case(s['entity_name'])
s['outcome'] = title_case(s['outcome'])
s['status'] = title_case(s['status']) if s['status'] else None
s['entity_name'] = title_case(s['entity_name']) if s['entity_name'] else None
s['outcome'] = title_case(s['outcome']) if s['outcome'] else None
s['received_timestamp'] = parser.parse(s['received_timestamp']) if s['received_timestamp'] else None
s['updated_at'] = parser.parse(s['updated_at']) if s['updated_at'] else None
s['view_modal_content'] = [{
**t,
'outcome': title_case(t['outcome'])
'outcome': title_case(t['outcome']) if t['outcome'] else None
} for t in (s['view_modal_content'] or [])]

context['header'] = ['Received', 'Entity Organization', 'File Name', ' ', 'Outcome', 'Status', 'Last Updated', 'Actions']
Expand Down
4 changes: 2 additions & 2 deletions apcd-cms/src/apps/submissions/templates/list_submissions.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1>View Submissions</h1>
<div class="filter-content">
<span><b>Filter by Status: </b></span>
<select id="statusFilter" class="status-filter" onchange="filterTableByStatus()">
{% for option in filter_options %}
{% for option in status_options %}
<option class="dropdown-text" {% if option == selected_status %}selected{% endif %}>{{ option }}</option>
{% endfor %}
</select>
Expand All @@ -31,7 +31,7 @@ <h1>View Submissions</h1>
<option class="dropdown-text" value={{option}} {% if option == selected_sort %}selected{% endif %}>{{ display_text }}</option>
{% endfor %}
</select>
{% if selected_status or selected_sort %}
{% if selected_status != 'All' or selected_sort != None %}
<button onclick="clearSelections()">Clear Options</button>
{% endif %}
</div>
Expand Down
10 changes: 5 additions & 5 deletions apcd-cms/src/apps/submissions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def getDate(row):
except:
page_num = 1

context['selected_status'] = None
context['selected_status'] = 'All'
if status_filter is not None and status_filter != 'All':
context['selected_status'] = status_filter
queryStr += f'&status={status_filter}'
Expand All @@ -58,18 +58,18 @@ def getDate(row):
# modifies the object fields for display, only modifies a subset of entries that will be displayed
# on the current page using offset and limit
for s in submission_content[offset:offset + limit]:
s['status'] = title_case(s['status'])
s['outcome'] = title_case(s['outcome'])
s['status'] = title_case(s['status']) if s['status'] else None
s['outcome'] = title_case(s['outcome']) if s['outcome'] else None
s['received_timestamp'] = parser.parse(s['received_timestamp']) if s['received_timestamp'] else None
s['updated_at'] = parser.parse(s['updated_at']) if s['updated_at'] else None
s['view_modal_content'] = [{
**t,
'outcome': title_case(t['outcome'])
'outcome': title_case(t['outcome']) if t['outcome'] else None
} for t in (s['view_modal_content'] or [])]


context['header'] = ['Received', 'File Name', ' ', 'Outcome', 'Status', 'Last Updated', 'Actions']
context['filter_options'] = ['All', 'In Process', 'Complete']
context['status_options'] = ['All', 'Complete', 'In Process']
context['sort_options'] = {'newDate': 'Newest Received', 'oldDate': 'Oldest Received'}

context['query_str'] = queryStr
Expand Down
2 changes: 1 addition & 1 deletion apcd-cms/src/apps/view_users/templates/view_users.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1>View Users</h1>
{% endfor %}
</select>

{% if selected_status or selected_org %}
{% if selected_status != 'All' or selected_org != 'All' %}
<button onclick="clearSelections()">Clear Options</button>
{% endif %}
</div>
Expand Down
9 changes: 4 additions & 5 deletions apcd-cms/src/apps/view_users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _set_user(usr):
'user_id': usr[1],
'user_email': usr[2],
'user_name': usr[3],
'entity_name': usr[4] if usr[4] else "Not Applicable",
'entity_name': usr[4] if usr[4] else 'None',
'created_at': usr[5],
'updated_at': usr[6],
'notes': usr[7],
Expand Down Expand Up @@ -99,15 +99,14 @@ def _set_user(usr):
org_name = user[4]
if org_name not in context['filter_options']: # prevent duplicates
context['filter_options'].append(user[4])
if org_name is None and 'Not Applicable' not in context['filter_options']:
context['filter_options'].append('Not Applicable')
context['filter_options'] = sorted(context['filter_options'],key=lambda x: (x != 'All', x is None, x if x is not None else ''))

queryStr = ''
status_filter = self.request.GET.get('status')
org_filter = self.request.GET.get('org')
role_filter = self.request.GET.get('role_name')

context['selected_status'] = None
context['selected_status'] = 'All'
if status_filter is not None and status_filter !='All':
context['selected_status'] = status_filter
queryStr += f'&status={status_filter}'
Expand All @@ -117,7 +116,7 @@ def _set_user(usr):
context['selected_role'] = role_filter
table_entries = table_filter(role_filter, table_entries, 'role_name', False)

context['selected_org'] = None
context['selected_org'] = 'All'
if org_filter is not None and org_filter != 'All':
context['selected_org'] = org_filter
queryStr += f'&org={org_filter}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ table {
width: 150px;
appearance: none;
-webkit-appearance: none;
box-sizing: border-box;

background-image: url("data:image/svg+xml,%3Csvg id='tacc-arrows' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130.34 292.4'%3E%3Cdefs%3E%3Cstyle%3E.arrow%7Bfill:%23484848;%7D%3C/style%3E%3C/defs%3E%3Cg id='tacc-arrows——root'%3E%3Cpath id='Path_3088' data-name='Path 3088' class='arrow' d='M82.24,96.17,148.09,0l64.45,96.17Z' transform='translate(-82.2)'/%3E%3Cpath id='Path_3089' data-name='Path 3089' class='arrow' d='M212.5,196.23,146.65,292.4,82.2,196.23Z' transform='translate(-82.2)'/%3E%3C/g%3E%3C/svg%3E");
background-repeat: no-repeat;
Expand Down

0 comments on commit b7109d6

Please sign in to comment.