-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebf3bea
commit 09b64c6
Showing
14 changed files
with
170 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from django.urls import path | ||
from apps.admin_regis_table.views import RegistrationsTable, RegistrationsApi | ||
from apps.admin_regis_table.views import RegistrationsTable, RegistrationsApi, RegistrationsPostApi | ||
|
||
app_name = 'admin_regis_table' | ||
urlpatterns = [ | ||
path('list-registration-requests/', RegistrationsTable.as_view(), name='admin_regis_table'), | ||
path('list-registration-requests/api/', RegistrationsApi.as_view(), name='admin_regis_table_api'), | ||
path('request-to-submit/api/<int:reg_id>/', RegistrationsApi.as_view(), name='admin_regis_update_api'), | ||
path('request-to-submit/api/<int:reg_id>/', RegistrationsPostApi.as_view(), name='admin_regis_update_api'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
from apps.components.paginator.paginator import paginator | ||
from apps.utils.registrations_data_formatting import ( | ||
_set_registration_for_listing, | ||
) | ||
from apps.utils.utils import table_filter | ||
from datetime import date as datetimeDate | ||
|
||
|
||
def get_registration_list_json(registrations_content, status_filter, org_filter, page_num, *args, **kwargs): | ||
context = {} | ||
|
||
context['header'] = ['Business Name', 'Year', 'Type', 'Location', 'Registration Status', 'Actions'] | ||
context['status_options'] = ['All', 'Received', 'Processing', 'Complete', 'Withdrawn'] | ||
context['org_options'] = ['All'] | ||
|
||
def getDate(row): | ||
date = row[1] | ||
return date if date is not None else datetimeDate(1, 1, 1) # put 'None' date entries all together at end of listing w/ date 1-1-0001 | ||
|
||
registrations_content = sorted(registrations_content, key=lambda row: getDate(row), reverse=True) # sort registrations by newest to oldest | ||
|
||
registration_table_entries = [] | ||
for registration in registrations_content: | ||
registration_table_entries.append(_set_registration_for_listing(registration)) | ||
org_name = registration[5] | ||
if org_name not in context['org_options']: | ||
context['org_options'].append(org_name) | ||
|
||
queryStr = '' | ||
|
||
context['selected_status'] = None | ||
if status_filter is not None 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'] = org_filter | ||
queryStr += f'&org={org_filter}' | ||
registration_table_entries = table_filter(org_filter.replace("(", "").replace(")", ""), registration_table_entries, 'biz_name') | ||
|
||
context['query_str'] = queryStr | ||
page_info = paginator(page_num, registration_table_entries) | ||
context['page'] = [ | ||
{ | ||
'biz_name': obj['biz_name'], | ||
'year': obj['year'], | ||
'type': obj['type'], | ||
'location': obj['location'], | ||
'reg_status': obj['reg_status'], | ||
'reg_id': obj['reg_id'], | ||
} | ||
for obj in page_info['page'] | ||
] | ||
context['page_num'] = page_num | ||
context['total_pages'] = page_info['page'].paginator.num_pages | ||
context['pagination_url_namespaces'] = 'administration:admin_regis_table' | ||
return context | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from apps.utils.apcd_database import ( | ||
get_submitter_info, | ||
) | ||
from django.http import JsonResponse | ||
|
||
|
||
def get_submitter_codes(user): | ||
submitter = get_submitter_info(str(user)) | ||
submitter_codes = [] | ||
for i in submitter: | ||
submitter_codes.append(i[1]) | ||
return JsonResponse({'submitter_codes': submitter_codes} if submitter_codes else [], safe=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.