Skip to content

Commit

Permalink
Merging feat/apcd react conversion into main (#411)
Browse files Browse the repository at this point in the history
* Initial commit - using react with APCD admin registration list page (#276)

* Initial commit - using react with APCD page

* remove visualizer

* Remove print statements

* Renamed shared-components to core-components

* Initial commit - using react with APCD admin registration list page (#276)

* Initial commit - using react with APCD page

* remove visualizer

* Remove print statements

* Renamed shared-components to core-components

* Update README.md for APCD

* Fix dockerfile for static

* Initial commit - using react with APCD admin registration list page (#276)

* Initial commit - using react with APCD page

* remove visualizer

* Remove print statements

* Renamed shared-components to core-components

* Update README.md for APCD

* Fix dockerfile for static

* Install nodejs as part of docker image

* Docker compose dev adjustments for react

* task/WP-443 Convert Admin Submissions to React (#288)

* apcd admin submissions react page version 1

* moved filter and sort functionality to react

* Added View logs modal using reactstrap modal

---------

Co-authored-by: Chandra Y <[email protected]>

* Task/wp 425 admin user listing (#286)

* feat: Add ViewUsers component

* chore: Update Docker Compose dev configuration for React

* refactor: Update ViewUsers component and related files

* refactor: Update ViewUsers component and related files

* feat: Add user action dropdown in ViewUsers component

* Filter by Status and Org now work

* URL updated w/ status and org

* URL updates to show status and/or organization

---------

Co-authored-by: Chandra Y <[email protected]>

* Fix merge issue

* [ACPD React Conversion]: Setup vite local and add base template with react (#294)

* Setup vite local and template with react content

* Update Makefile

* Update README.md to reflect new changes

* Initial version (#299)

Modal windows not included

* Task/WP-429 list registrations: filters, pagination and view modal (#298)

* List registrations: filters, pagination and view modal

* Add pending edit modal and fix org status

* List Admin Extensions React Conversion (#289)

* first run at the react conversion

* Update list_admin_extension.html from merge feat branch

* Updated incorrect import

---------

Co-authored-by: Chandra Y <[email protected]>

* Add formik, reactstrap, yup for APCD React forms (#302)

* temp commit

* Task/wp 425 view edit modals (#297)

* feat: Add user action dropdown in ViewUsers component

* Add ViewRecordModal component and styles for user details modal

* Update ViewRecordModal component and styles for user details modal

* Update ViewRecordModal component and styles for user details modal

* Create Edit Record modal

* Add Success and Error modals

* Update EditRecordModal component and fix error handling

* Add support for fetchUtil request method and use it in EditRecordModal

* Add update user method

* Add pagination to ViewUsersTable component

* Update ViewUsersTable component with duplicate path in urls.py

* Update EditRecordModal component and fix error handling

* Remove link

---------

Co-authored-by: Chandra Y <[email protected]>

* Submitter Registration List using React (#307)

* Bug/wp 690 empty values should be None (#310)

* Update RegistrationList and ViewRegistrationModal to display 'None' when year, reg_status, fein, license, or naic is undefined or null

---------

Co-authored-by: Chandra Y <[email protected]>

* WP-713 - add pagination to admin submissions (#322)

* task/WP-712-Create-useEntity-Hook (#324)

Co-authored-by: Chandra Y <[email protected]>

* Task/WP-437-Exception-Form-React (#326)

* - Moves templates out of exception_submission_form
dir

* task/wp-437-exception-form-react
Initial commit
- adds CDL hook and cdl class to common_api apps
- Creates exception form id to reference React component
- Updates template to only reference exception form id
- Adds ExceptionForm React component
TODO:
- Button actions
- submitting form
- adding non dynamic fields
- option for non threshold exception submissions

* Additional additions for initial commit

* Update apcd-cms/src/client/src/components/Submitter/Exceptions/ExceptionForm.tsx

Co-authored-by: Chandra Y <[email protected]>

* Update apcd-cms/src/client/src/hooks/cdls/useCDLs.ts

Co-authored-by: Chandra Y <[email protected]>

* Update apcd-cms/src/client/src/components/Submitter/Exceptions/ExceptionForm.tsx

Co-authored-by: Chandra Y <[email protected]>

* Linting

---------

Co-authored-by: Chandra Y <[email protected]>

* WP-711: Do not use hardcoded org list (#331)

* Wp 579 request extensions form (#332)

* feat: Add ExtensionRequestForm component and related files

* chore: Update ExtensionsForm component buttons styling

* feat: Improve accessibility and usability of ExtensionsForm component

* Task/wp 715 react exception form follow on (#330)

* 10/15 Loads other/threshold dynamically. Add/remove threshold working. Dynamically appending unique index for thresholdform fields

* - Adds validation schema and initial values using
exception object passed from ExceptionForm
- Adds styling changes

* - Formatting child form fields to pass and
iterate over in parent component

* - Adds post changes in view

* - Uses formik field to store values in child component

* - Child component fields update

* - Debugging Form rendering

* - Updated to ExceptionFormPage

* - POST request alteration
- DB insert altered to match views
- Removed FormFeedback from ExcpetionMessage as
Formik's Field is no longer linked to Reactstrap's
Input component
- Created style for invalid inputs

* - Unstaged changes left behind from last commit

* Clear fields when exception type is changed

Co-authored-by: Chandra Y <[email protected]>

* Moves header for exception type selection near field

Co-authored-by: Chandra Y <[email protected]>

* Updates title of page to reflect type of exception

Co-authored-by: Chandra Y <[email protected]>

* - Updates button text if an exception has been submitted

* Prettier

* - Removes debug statement

---------

Co-authored-by: Chandra Y <[email protected]>

* Split into two components (#333)

* Task/jira wp431 user submissions listing Convert to REACT (#336)

* added submissions folder in hooks and updating submissions to react

* for examination by C

* Fixing up errors

* for examination by C-2

* for examination by C-3

* added last c edit

* Update apcd-cms/src/client/src/components/Submissions/ViewFileSubmissions/ViewSubmissions.tsx

---------

Co-authored-by: Chandra Y <[email protected]>

* Use dynamic data in business name field in extensions. Use relative links (#337)

* [APCD][React] User friendly date time display in UI (#338)

* Handle datetime usage in APCD

* Fix date time in Extension Listing

* Task/wp 735 other exception form (#341)

* task/WP-735-Other-Exception-Form

* Removes unused templates and styles sheets on the app side

* - Adds missing asterisk from expiration date

* WP-720: [APCD][React] Extension form submit hookup (#340)

* Submit handling for extension

* Add error message ui element

* - Suggested styles changes for extension form (#342)

* Update apcd-cms/src/client/src/components/Submitter/Extensions/ExtensionsForm.tsx

Co-authored-by: sophia-massie <[email protected]>

* Delete unused templates and css

---------

Co-authored-by: sophia-massie <[email protected]>

* APCD react feature - use react-asset.html instead of react-assets.html

* Exception list React implementation (#329)

* Initial version
Modal windows not included

* View modal and paginator implementation.

* Cleaning code

* Edit Exception modal, initial version.

* Edit Extensions modal.

* Modal windows review changes.

---------

Co-authored-by: Chandra Y <[email protected]>

* task/WP-580 - Registration form react conversion (#339)

* Merge with feature branch and initial commit

* Registration form - React components

* Registration form - add registration form to client index to pick up react form

* Registration form - clear out django template + add div for react form to be served to

* Registration form - styling updates to better mesh with react form

* Clean up warnings + add required text + some style adjustments

* Factor out use of reactstrap's formtext to better align with existing form's styling + limit contacts and entities to 5 entries each (+ add message about submitting ticket for add. entities)

* Some client hooks cleanup

* Add submission method for registration form

* Adjust registration form post + writing to db for registration funtions to work with react form + submission method

* Fix submission - add styling for errors to show on each field, provide initial values for on_behalf_of and type, adjust how errors are passed from the view back to react on submission

* Update apcd-cms/src/client/src/components/Forms/Registrations/RegistrationForm.tsx

single braces instead of double braces

* Return loading spinner on loading

Co-authored-by: sophia-massie <[email protected]>

* Update number validation messages + rename reg form data hook

---------

Co-authored-by: Chandra Y <[email protected]>
Co-authored-by: sophia-massie <[email protected]>

* Run prettier

* Admin Extensions React Conversion: Filters, Pagination, Modals (#335)

Branch that implements filtering and pagination on listing page as well as view and edit modals. First pass with many improvements needed in a later PR. 
---------

Co-authored-by: Chandra Y <[email protected]>

* prettier run

* WP-738 Hook up Edit Registration and Renew Registration to Registration Form. (#344)

* Hook up edit registration and renew registration

* Fix bug in RegistrationList

* zip code has spaces, strip them.

* Handle deletion

* Bug/WP-749: ViewUsers - fix filter usage. (#346)

* ViewUsers - fix filters

* Adjust css for sizing of org filter

* Task/wp 743 exception form testing changes (#345)

* - Clears field codes when file type is not selected

* - Adds required badges to match CEP forms
- Resets field codes on file type change
- Changes text to alert users that changing
exception type will erase changes
- Improves form validation messages

* - Removes unused static css from template
- Adds missing class to a badge

* - Adds error message next to submit if fields are
invalid on submit

* - Adds missing class from a field

---------

Co-authored-by: Chandra Y <[email protected]>

* Registration Table - fix clear selection button (#347)

* ExtensionForm fixes (#351)

* View Users various fixes

* chore: delete seemingly erroneous entity (#349)

Co-authored-by: Chandra Y <[email protected]>

* View Users: clear options button behavior (#352)

* Task/WP-746-styles-primary-color-blue (#348)

* bugs/WP-756: [APCD][React] Fix modal close button (#355)

* Adjust modal close icon

* Adjust modals to use ModalHeader with close button

* Task/wp 441 exception list - Testing session fixes (#356)

* Initial version
Modal windows not included

* View modal and paginator implementation.

* Cleaning code

* Edit Exception modal, initial version.

* Edit Extensions modal.

* Modal windows review changes.

* Testing feedback fixes.

* Cleaning up code

* Cleaning up code

* Delete duplicated code.

* Removing unnecessary styling classes

* Fixing merging conflicts

---------

Co-authored-by: Chandra Y <[email protected]>

* bug/WP-741: Registration Form cleanup tasks (#358)

* Move 'On behalf of' help text div to arrange correctly under radio buttons

* Fix validation messages for entity grouped 'atleast one' inputs + checkboxes not writing correctly to db

* Fix checkboxes writing to db from reg form - inputs now return bool instead of str

* Task/wp 751 submission listing bugs (#357)

* - Updated view and url to get filters and filtered
submission content
- Moved styles from app to client
- Added sort options to filter hooks
- Created client side title case util so it won't
break pages on response if response does not exist

* - Staged the wrong changes. WIP from Nov 12

* - Adds filter styles to filter-contents class rather
that hard coding

* - Added some debug statements to find where
the modal data goes missing

* - Final configuring of both submitter submission page
and admin submission page

* - Catches undefined for string utils
- Removes repeated header

* - Linting

---------

Co-authored-by: Chandra Y <[email protected]>

* Fix merge issue and prettier

* Handle empty data scenario (#354)

* WP-763: [APCD] Use field wrapper for registration, exception and extension forms. (#360)

* core-wrapper and usage of field-wrapper

* ExceptionForm fieldwrapper

* Registration Changes

* bug/WP-741: Missed bugs follow on (#359)

* Import get_registration db util functions to view

* Front-end fixes: Add/Remove Entity/Contacts button wrapping, Entity/Contact header styling, add initial value + initial touched for state field

* Add style class for bolding nested headers on form

* Add some padding above  labels for entity and contact entries

* Data transfer bugs when pre-loading data to form: for self value now goes to form as string rather than bool, and type display value is mapped to the database value

---------

Co-authored-by: Chandra Y <[email protected]>

* applicable data period fix (#361)

* task/WP-742: Fix renew registration in react (#362)

* Strip trailing slash from reg_id coming from submitter reg listing to get to renew form

* Renew form hookup fixes: change type for useRegFormData function to capture all data passed from view + index reg year up by 1 on form population to match prod behavior

* Update apcd-cms/src/apps/registrations/views.py

Co-authored-by: Chandra Y <[email protected]>

---------

Co-authored-by: Chandra Y <[email protected]>

* bug/WP-769-Submission-Sort-Bug (#363)

* bug/WP-709-Submission-Sort-Bug
- Adds a sort of filtered list after intial API
date sort

* - Removes redundant sort

* - Fixes the clear options button on submitter
submissions table

* Feat/extensions listing residual issues (#364)

* new branch off latest feat branch updates. removed a few residual debug messages and fixed styling

* bugs/WP-756: [APCD][React] Fix modal close button (#355)

* Adjust modal close icon

* Adjust modals to use ModalHeader with close button

* Task/wp 441 exception list - Testing session fixes (#356)

* Initial version
Modal windows not included

* View modal and paginator implementation.

* Cleaning code

* Edit Exception modal, initial version.

* Edit Extensions modal.

* Modal windows review changes.

* Testing feedback fixes.

* Cleaning up code

* Cleaning up code

* Delete duplicated code.

* Removing unnecessary styling classes

* Fixing merging conflicts

---------

Co-authored-by: Chandra Y <[email protected]>

* bug/WP-741: Registration Form cleanup tasks (#358)

* Move 'On behalf of' help text div to arrange correctly under radio buttons

* Fix validation messages for entity grouped 'atleast one' inputs + checkboxes not writing correctly to db

* Fix checkboxes writing to db from reg form - inputs now return bool instead of str

* Task/wp 751 submission listing bugs (#357)

* - Updated view and url to get filters and filtered
submission content
- Moved styles from app to client
- Added sort options to filter hooks
- Created client side title case util so it won't
break pages on response if response does not exist

* - Staged the wrong changes. WIP from Nov 12

* - Adds filter styles to filter-contents class rather
that hard coding

* - Added some debug statements to find where
the modal data goes missing

* - Final configuring of both submitter submission page
and admin submission page

* - Catches undefined for string utils
- Removes repeated header

* - Linting

---------

Co-authored-by: Chandra Y <[email protected]>

* Fix merge issue and prettier

---------

Co-authored-by: Chandra Y <[email protected]>
Co-authored-by: Juan <[email protected]>
Co-authored-by: Garrett Edmonds <[email protected]>
Co-authored-by: sophia-massie <[email protected]>

* made Pending default and fixed clear options button so its consistent with other pages (#365)

* Task/wp 759 exeption listing bugs (#366)

* Exception Listing bugs fixed

* FieldWrapper applied

* Modal header and close button fix

---------

Co-authored-by: Chandra Y <[email protected]>

* prettier fix

* task/WP-700:  Add status to view record modal + default filter registration records to 'Received' status (#369)

* Add registration status to View Record modal

* Show only status='Received' records on admin registrations listing on load (by default)

* Title case for registration status within view modal

* WP-201: add entity organization to user file submissions (#368)

* WP-201: add entity organization to user file submissions

* Unifying submission modal and css.

* bug/extension-expected-date (#367)

* - Prevents user from changing Current Expected date
from database when filling out extension form

* - Fixes key console error for mapped options
- Removes deleted css sheet from extension form templates
- Removes required badge from Current Expected Date field

* Data Refresh and Display Issues (#370)

* fixed a few issues with refresh etc

* Fixed multiple issues including data not being refetched and displayed properly and small styling issues

* more small polishing

* task/stashed-extension-modal-styles (#371)

Style ideas - not needed just left over work when
trying to figure out the useEffect yesterday for
extension modal

Co-authored-by: Carrie Arnold <[email protected]>

---------

Co-authored-by: sophia-massie <[email protected]>
Co-authored-by: Chandra Y <[email protected]>

* WP-754: submissions - html and json log download (#374)

* WP-754: submissions - html and json log download

* fix bug in admin user

* Add 'No Data found' message for all listing tables if data from response is empty (#375)

Co-authored-by: Chandra Y <[email protected]>

* distinguish page differences (#372)

Co-authored-by: Chandra Y <[email protected]>

* Rename apcd-cms to acpd_cms, prepare for merge from main

* manual merge to new folder structure (#378)

Co-authored-by: Chandra Y <[email protected]>

* fix apcd image path

* add urls.py for check-submitter-role

* WP-777  - json download issue (#380)

* Manual merge for apcd - folder rename (#376)

Co-authored-by: Chandra Y <[email protected]>

* Bug/WP-792: disable submit if form is not modified. (#384)

* WP-793: Check for null logs (#383)

* Bugs/WP-789: Extension Edit Modal (#382)

* WP-789:Extension Edit Modal fixes

* New api is only for admin users

* Remove print

* handle "None" for expiration date

* Remove duplicate main.tsx

* Bugs/WP-795: clear selection button uniformity (#388)

* WP-795: clear options button similarity across all pages

* set styles

* WP-796 - registration list needs to update on modal edits (#391)

* WP-799 fix ticket creation api and handle error message (#387)

* tasl/WP-802 & WP-808: Remaining admin default filters (#394)

* Default filter admin submissions listing to 'status=In Process'

* Default filter admin users listing to 'status=Active'

* Merge features from main to apcd feature branch (#393)

* Merge features from main to apcd feature branch

* Fix id field

---------

Co-authored-by: Garrett Edmonds <[email protected]>

* Fix Vite build warning

* bug/Exception-Modal-Success-Exit-Icon-Missing (#397)

- Removes toggle from success and error message to mimic behavior in other edit modals
- Will revisit handling of success messages after React initial release

* Task/WP-762--Use-Core-Component-Buttons (#381)

* react-strap buttons

* submit attribute for formik

* edit record modal submit attribute

---------

Co-authored-by: Chandra Y <[email protected]>

* fix merge issue

* Task/WP-764: Implement field wrapper for edit modals (#385)

* initial commit

* Validation Users Edit Record Modal

* Exception Modal

* ExtensionModal

* error above, succsess inline

* EditRecord QueryWrapper

* QueryWrapper ExceptionModal

* pill inline fix

* removed non required pills

---------

Co-authored-by: Chandra Y <[email protected]>

* Quick Fix: APCD, List registrations for submitter is broken (#398)

* Fix syntax error in sql

* move left join before where

* File Submissions title update (#399)

* Update admin list users title + description (#400)

* Task/WP-157: View Submitter Users (New Admin Page) (#386)

* Created new blank page at URL administration/view-submitter-users

* Began building of Submitter Users Page

* All Users shown on table; working on filtering by Submitter-User role

* Established SQL query to get submitter users; set up views.py

* Still working on getting the site to load the data

* Got table of submitter users to appear

* View modal opens and closes

* Edit Modal opens and closes; can't edit records yet

* Edit modal updates user names and emails correctly

* Added View Submitter Users site to navbar

* Linted client code

* Removed changes to apcd_cms/src/client/main.tsx

* Removed extraneous HTML files and commented-out portions

* Update apcd_cms/src/apps/utils/apcd_database.py

Simplify the database connection

Co-authored-by: Chandra Y <[email protected]>

* Update apcd_cms/src/apps/utils/apcd_database.py

Sort users by user ID

Co-authored-by: Chandra Y <[email protected]>

* Update apcd_cms/src/apps/utils/apcd_database.py

Co-authored-by: Chandra Y <[email protected]>

---------

Co-authored-by: Jeff McMillen <[email protected]>
Co-authored-by: Chandra Y <[email protected]>

* Restrict valid dates for both exception types to format MM/DD/YYYY (#396)

Co-authored-by: Chandra Y <[email protected]>

* bug/WP-820-exp-date-exception-edit-modal (#402)

* bug/WP-820-exp-date-exception-edit-modal

* - Adds new label for clarity

* [APCD] Exception, Submission and navigation bugs (#401)

* Bugs from testing session

* revert testing change

* WP-821[APCD] Writing the required threshold to DB (#403)

* Task/WP-822: Improve Submitter Users Page (#405)

* Reorganized Submitter Users table

* Added filters for status and payor code

* View Record shows all row data plus user email

* Edit Record shows editable fields and required data

* Payor codes now shown as organization names

* Linted client-side code

* Payor Code filter now shows organization names instead of codes

* Removed extraneous console logs

* Fix payor code filter to check against display value in view

* Edit submitter user modal adjustments: display success/error messages instead of modals, bring submit button to same style as like modals in portal

* Remove leftover logging

---------

Co-authored-by: Jeff McMillen <[email protected]>
Co-authored-by: Garrett Edmonds <[email protected]>

* fix - merge issue - undo non apcd dirs

* Merge branch 'main' into feat/apcd-react-conversion

* undo a2cps_cms change

* more merge issues

* adding .env

* cipp merge issues

* EOF

---------

Co-authored-by: Garrett Edmonds <[email protected]>
Co-authored-by: Shayan Khan <[email protected]>
Co-authored-by: Van Go <[email protected]>
Co-authored-by: Juan <[email protected]>
Co-authored-by: Carrie Arnold <[email protected]>
Co-authored-by: sophia-massie <[email protected]>
Co-authored-by: davidmtacc <[email protected]>
Co-authored-by: Garrett Edmonds <[email protected]>
Co-authored-by: Wesley B <[email protected]>
Co-authored-by: Jacob Lowe <[email protected]>
Co-authored-by: Jeff McMillen <[email protected]>
Co-authored-by: Jeff McMillen <[email protected]>
  • Loading branch information
13 people authored Jan 17, 2025
1 parent 91804a0 commit d3ed1f4
Show file tree
Hide file tree
Showing 267 changed files with 36,150 additions and 3,593 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/apcd-cms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
with:
context: apcd_cms
push: true
tags: taccwma/apcd-cms:${{ steps.vars.outputs.SHORT_SHA }},taccwma/apcd-cms:${{ steps.vars.outputs.BRANCH_NAME }}
tags: taccwma/apcd-cms:${{ steps.vars.outputs.SHORT_SHA }},taccwma/apcd-cms:${{ steps.vars.outputs.BRANCH_NAME }}
12 changes: 11 additions & 1 deletion apcd_cms/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
FROM taccwma/core-cms:v4.12.0
# TACC/Core-CMS#v4.20.0 & TACC/Core-Styles#v2.37.0
FROM taccwma/core-cms:v4.20.0

WORKDIR /code

COPY /src/apps /code/apps
COPY /src/client /code/client
COPY /src/taccsite_custom /code/taccsite_custom
COPY /src/taccsite_cms /code/taccsite_cms

# install node 20.x
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
RUN apt-get install -y nodejs

RUN chmod u+x /code/client/build_client.sh && /code/client/build_client.sh
RUN cp -R /code/client/dist/static/assets/. /code/taccsite_custom/apcd_cms/static/assets/
RUN cp -R /code/client/dist/react-assets.html /code/taccsite_custom/apcd_cms/templates/react-asset.html
53 changes: 53 additions & 0 deletions apcd_cms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,56 @@ An extension of the [Core CMS](https://github.com/TACC/Core-CMS) project
## Basics

See [Core-CMS-Custom](../README.md).


## Build

1. cd to acpd-cms
2. run make build
3. run make start
4. cd to apcd_cms/src/client
5. run npm ci
6. run npm run build
7. run npm run dev
8. Make code changes and observe changes live in browser.


## Converting existing page to react based page

### Backend

1. Update urls.py
+ Make the default page return as TemplateView.as_view(template_name='<template_name')
+ Add api end points. These endpoints are used in client.

2. Update views.py

+ import JsonResponse
+ remove Template building
+ Adjust context to return Json.
+ send JsonResponse



### Client

1. Define hook
+ Add method to retrieve data from server
+ Add types in index.ts

2. Defining component
- Add one or more component as tsx file.
- Export the component
- Add exports in index.ts

3. Update apcd_cms/src/client/src/main.tsx:
- add import for your component
- update componentMap to add the


### Template

* Update the first line: standard.html to use this {% extends "apcd_cms/templates/standard.html" %}
* Add a div element where the component will render, Example: (make the id name distinct)
<div id="list-registrations-root"></div>

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{% extends "standard.html" %}
{% extends "apcd_cms/templates/standard.html" %}
{% load static %}

{% block content %}
<link rel="stylesheet" href="{% static 'apcd_cms/css/table.css' %}">
<link rel="stylesheet" href="{% static 'apcd_cms/css/modal.css' %}">
<link rel="stylesheet" href="{% static 'admin_exception/css/table.css' %}">
<div class="container">
{% include "nav_cms_breadcrumbs.html" %}
Expand All @@ -11,104 +12,10 @@ <h1>View Exception Requests</h1>
<hr />
<p style="margin-bottom: 30px">All submitted exception requests</p>
<hr/>
<div class="filter-container">
<div class="filter-content">
<span><b>Filter by Status: </b></span>
<select id="statusFilter" class="status-filter" onchange="filterTableByStatus()">
{% for option in status_options %}
<option class="dropdown-text" {% if option == selected_status %}selected{% endif %}>{{ option }}</option>
{% endfor %}
</select>
<span><b>Filter by Organization: </b></span>
<select id="organizationFilter" class="status-filter org-filter" onchange="sortByOrg()">
<!-- Value set here so dropdown is not blank but set to All-->
{% for option in org_options %}
<option class="dropdown-text" {% if option == selected_org %}selected{% endif %}>{{ option }}</option>
{% endfor %}
</select>
{% if selected_status != 'All' or selected_org != 'All' %}
<button onclick="clearSelections()">Clear Options</button>
{% endif %}
</div>
</div>
<table id="exception-table" class="exception-table">
<thead>
<tr>
{% for k in header %}
<th>{{k}}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for r in page %}
<tr>
<!-- So when page is shrunk, rows match with the former columns -->
<td class="created">{{r.created_at}}</td>
<td class="entity_name">{{r.entity_name}}</td>
<td class="requestor_name">{{r.requestor_name}}</td>
<td class="exception_type">{{r.request_type}}</td>
<td class="outcome">{{r.outcome}}</td>
<td class="status">{{r.status}}</td>
<td class="modal-cell">
{% include "view_admin_exception_modal.html" %}
{% include "edit_exception_modal.html" %}
<select id='actionsDropdown_{{r.exception_id}}' onchange="openAction('{{r.exception_id}}')">
<div class="filter-container">
<div class="filter-content">
<option value="">Select Action</option>
<option value="viewAdminExceptions">View Record</option>
<option value="editException">Edit Record</option>
</div>
</div>
</select>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% include 'paginator.html' %}
<div id="admin-exceptions-root"></div>
</div>
<script>

function filterTableByStatus() {
var dropdown, statusFilter, xhr, url_params, url;
dropdown = document.getElementById("statusFilter");
statusFilter = dropdown.value;
url_params = `?status=${statusFilter}`;
{% if selected_org %}
url_params = `?status=${statusFilter}&org={{selected_org}}`;
{% endif %}
url = `/administration/list-exceptions/${url_params}`;
xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.send();
window.location.href = url;
window.location.load();
}

function sortByOrg() {
var orgDropdown, orgValue, url_params, url, xhr;
orgDropdown = document.getElementById('organizationFilter');
orgValue = orgDropdown.value;
url_params = `?org=${orgValue}`;
{% if selected_status %}
url_params = `?status={{selected_status}}&org=${orgValue}`;
{% endif %}
url = `/administration/list-exceptions/${url_params}`;
xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.send();
window.location.href = url;
window.location.load();
}
function clearSelections() {
var xhr;
xhr = new XMLHttpRequest();
xhr.open('GET', '/administration/list-exceptions/')
xhr.send()
window.location.href = '/administration/list-exceptions/';
window.location.load();
}
function openAction(exception_id) {
var actionsDropdown, selectedOption, modal_id;
actionsDropdown = document.getElementById(`actionsDropdown_${exception_id}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,65 +1,11 @@
{% extends "apcd_cms/templates/standard.html" %}
{% load static %}
<link rel="stylesheet" href="{% static 'apcd_cms/css/modal.css' %}">
<link rel="stylesheet" href="{% static 'admin_exception/css/modal.css' %}">
<div id="viewAdminExceptionsModal_{{r.exception_id}}" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">

<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Exception Details</h4>
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&#xe912;</span>
</button>
</div>
<div class="modal-body">
<div>
<dl>
<h4>Details</h4>
<div class="modal-section">
<dl class="c-data-list--is-vert c-data-list--is-wide">
<dt class="c-data-list__key">Created</dt>
<dd class="c-data-list__value">{{r.created_at}}</dd>
<dt class="c-data-list__key">Entity Organization</dt>
<dd class="c-data-list__value">{{r.entity_name}}</dd>
<dt class="c-data-list__key">Requestor</dt>
<dd class="c-data-list__value">{{r.requestor_name}}</dd>
<dt class="c-data-list__key">Requestor Email</dt>
<dd class="c-data-list__value">{{r.requestor_email}}</dd>
<dt class="c-data-list__key">Exception Type</dt>
<dd class="c-data-list__value">{{r.request_type}}</dd>
<dt class="c-data-list__key">Status</dt>
<dd class="c-data-list__value">{{r.status}}</dd>
<dt class="c-data-list__key">Outcome</dt>
<dd class="c-data-list__value">{{r.outcome}}</dd>
<dt class="c-data-list__key">File Type</dt>
<dd class="c-data-list__value">{{r.data_file_name}}</dd>
<dt class="c-data-list__key">Field Number</dt>
<dd class="c-data-list__value">{{r.field_number}}</dd>
<dt class="c-data-list__key">Required Threshold</dt>
<dd class="c-data-list__value">{{r.required_threshold}}</dd>
<dt class="c-data-list__key">Requested Threshold</dt>
<dd class="c-data-list__value">{{r.requested_threshold}}</dd>
<dt class="c-data-list__key">Approved Threshold</dt>
<dd class="c-data-list__value">{{r.approved_threshold}}</dd>
<dt class="c-data-list__key">Requested Expiration Date</dt>
<dd class="c-data-list__value">{{r.requested_expiration_date}}</dd>
<dt class="c-data-list__key">Approved Expiration Date</dt>
<dd class="c-data-list__value">{{r.approved_expiration_date}}</dd>
<dt class="c-data-list__key">Explanation Justification</dt>
<dd class="c-data-list__value">{{r.explanation_justification}}</dd>
<dt class="c-data-list__key">Exception Notes</dt>
<dd class="c-data-list__value">{{r.notes}}</dd>
<dt class="c-data-list__key">Last Updated</dt>
<dd class="c-data-list__value">{{r.updated_at}}</dd>
</dl>
<hr>
</div>
</dd>
</dl>
</div>
</div>
</div>
<div id="view-exception-modal-root"></div>
</div>
</div>

10 changes: 5 additions & 5 deletions apcd_cms/src/apps/admin_exception/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.urls import path
from apps.admin_exception.views import AdminExceptionsTable
from django.views.generic import TemplateView
from apps.admin_exception.views import AdminExceptionsTable, UpdateExceptionView

app_name = 'admin_exception'
urlpatterns = [
path('list-exceptions/', AdminExceptionsTable.as_view(), name="list_exceptions"),
path('list-exceptions/<str:status>', AdminExceptionsTable.as_view(), name='status'),
path('list-exceptions/<str:org>', AdminExceptionsTable.as_view(), name='org'),
path('list-exceptions/<str:status><str:org>', AdminExceptionsTable.as_view(), name='status_org')
path('list-exceptions/', TemplateView.as_view(template_name='list_admin_exception.html'), name="list_exceptions"),
path('list-exceptions/api/', AdminExceptionsTable.as_view(), name='admin_exceptions_table_api'),
path('exceptions/<int:exception_id>/', UpdateExceptionView.as_view(), name='update_exceptions'),
]
Loading

0 comments on commit d3ed1f4

Please sign in to comment.