Skip to content

Commit

Permalink
Merge branch 'main' into feat/WP-197-migrate-frontera
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyboar authored Sep 20, 2024
2 parents 1c5d395 + cfdab2d commit 99e04b2
Show file tree
Hide file tree
Showing 24 changed files with 1,902 additions and 1,846 deletions.
15 changes: 15 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#example-of-a-codeowners-file

# architecture
/.github/ @wesleyboar
.gitignore @wesleyboar

# projects
# simple customizations
/*_assets/ @wesleyboar
# uses incomplete tup-cms circa 2023
/demdata_cms/ @wesleyboar

# docs
/docs/ @wesleyboar
/README.md @wesleyboar
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 Expand Up @@ -121,4 +121,4 @@ <h1>View Extension Requests</h1>
actionsDropdown.selectedIndex = 0; /* resets dropdown to display 'Select Action' again */
}
</script>
{% endblock %}
{% endblock %}
20 changes: 10 additions & 10 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 All @@ -145,4 +145,4 @@ def _get_applicable_data_period(value):
try:
return datetime.strptime(str(value), '%Y%m').strftime('%b. %Y')
except:
return None
return None
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
14 changes: 8 additions & 6 deletions apcd_cms/src/apps/admin_regis_table/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,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 @@ -91,22 +92,23 @@ def getDate(row):
associated_entities = [ent for ent in registrations_entities if ent[1] == registration[0]]
associated_contacts = [cont for cont in registrations_contacts if cont[1] == registration[0]]
registration_table_entries.append(_set_registration(registration, associated_entities, associated_contacts))
org_name = registration[7]
org_name = registration[5]
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
19 changes: 13 additions & 6 deletions apcd_cms/src/apps/admin_submissions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ 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 +50,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,18 +62,17 @@ 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']
context['filter_options'] = ['All', 'In Process', 'Complete']
context['sort_options'] = {'newDate': 'Newest Received', 'oldDate': 'Oldest Received'}

context['query_str'] = queryStr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ input[id^="threshold-requested"]::-webkit-outer-spin-button
-moz-appearance:textfield;
}

[id^="required_threshold"] {
background-color: #e9ecef;
color: #6c757d;
border-color: #ced4da;
cursor: not-allowed;
}

/* Field Sizes */
[id^="threshold-requested"], [id^="expiration-date"] {
[id^="threshold-requested"], [id^="expiration-date"], [id^="required_threshold"] {
min-width: 15ch;
}
/* To make sure sup values are not cut off when set as a label*/
Expand All @@ -35,4 +42,4 @@ label[name^="date-row"] {
column-gap: var(--global-space--grid-gap);
grid-template-columns: repeat(auto-fill, var(--max-col-width));
max-width: calc(var(--global-space--grid-gap) + var(--max-col-width) * 2);
}
}
Loading

0 comments on commit 99e04b2

Please sign in to comment.