Skip to content

Commit

Permalink
Task/wp 151 exception form changes (#167)
Browse files Browse the repository at this point in the history
* Updated html only to include file type for each section

* Add file to each threshold exception block

* Change field header for justification per request

* Justification header change on other form

* Update apcd-cms/src/apps/exception/templates/exception_submission_form/exception_threshold_form.html

Thanks!

Co-authored-by: edmondsgarrett <[email protected]>

* Requested changes

---------

Co-authored-by: edmondsgarrett <[email protected]>
  • Loading branch information
sophia-massie and edmondsgarrett committed Jun 21, 2023
1 parent 4bc7508 commit ee1d2ec
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h4>Exception Time Period</h4>

<hr />

<h4>Justification</h4>
<h4>Request and Justification</h4>

<div class="field-wrapper textarea required">
<p>Provide rationale for the exception request, outlining the reasons why the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,49 +28,39 @@ <h1>Threshold Exception Request</h1>
{% csrf_token %}
<div class="form-errors" style="display: none"></div>
<div class="exception-header-1">
<hr />
<h4>File Type</h4>
<p>Select submission file type for your requested threshold reduction.

</p>
</div>
<div class="field-wrapper select required">
<div class="field-errors" style="display: none"></div>

<label for="file_type">File Type <span class="asterisk">*</span></label>


<select name="file_type" required="required" class="choicefield" id="file_type"
value="none">
<option value="">-- Choose File Type --</option>
<option value="dc">Dental Claims</option>

<option value="mc">
Medical Claims
</option>

<option value="me">
Member Eligibility
</option>

<option value="pc">
Pharmacy Claims
</option>

<option value="pv">
Provider
</option>
</select>
<div id="help-text-file_type" class="help-text">You can only submit an exception for one file type per
form submission.
</div>
</div>
<hr />



<hr/>
<h4>Requested Threshold Reduction</h4>
<div id="exception_block_1">
<div class="field-wrapper select required">
<div class="field-errors" style="display: none"></div>

<label for="file_type_1">File Type <span class="asterisk">*</span></label>


<select name="file_type_1" required="required" class="choicefield" id="file_type_1"
value="none">
<option value="">-- Choose File Type --</option>
<option value="dc">Dental Claims</option>

<option value="mc">
Medical Claims
</option>

<option value="me">
Member Eligibility
</option>

<option value="pc">
Pharmacy Claims
</option>

<option value="pv">
Provider
</option>
</select>
</div>
<div class="field-wrapper select required" >
<div class="field-errors" style="display: none"></div>
<label for="field-threshold-exception_1">Field Code <span class="asterisk">*</span></label>
Expand Down Expand Up @@ -122,7 +112,7 @@ <h4 id="exception_header_5" style="display:none">Requested Threshold Reduction 5
<button class="c-button c-button--secondary" id="exception-drop-btn" type="button">- Remove Last Threshold
Exception</button>
<hr />
<h4>Request Justification</h4>
<h4>Request and Justification</h4>
<div class="field-wrapper textarea required">
<p>Provide rationale for the exception request, outlining the reasons why the
organization is unable to comply with the relevant requirements. Provide as
Expand Down Expand Up @@ -264,6 +254,33 @@ <h4>Acknowledgment of Terms</h4>
let exceptionBlock = document.getElementById(`exception_block_${exceptions}`);
document.getElementById(`exception_header_${exceptions}`).style.display = 'block';
exceptionBlock.innerHTML = `
<div class="field-wrapper select required">
<div class="field-errors" style="display: none"></div>
<label for="file_type_${exceptions}">File Type <span class="asterisk">*</span></label>
<select name="file_type_${exceptions}" required="required" class="choicefield" id="file_type_${exceptions}"
value="none">
<option value="">-- Choose File Type --</option>
<option value="dc">Dental Claims</option>
<option value="mc">
Medical Claims
</option>
<option value="me">
Member Eligibility
</option>
<option value="pc">
Pharmacy Claims
</option>
<option value="pv">
Provider
</option>
</select>
</div>
<div class="field-wrapper select required" >
<div class="field-errors" style="display: none"></div>
<label for="field-threshold-exception_${exceptions}">Field Code <span class="asterisk">*</span></label>
Expand All @@ -276,13 +293,13 @@ <h4>Acknowledgment of Terms</h4>
<div class="o-grid o-grid--col-auto-count">
<div class="field-wrapper numberinput required">
<div class="field-errors" style="display: none"></div>
<label for="expiration-date_${exceptions}">Expiriation Date<sup>*</sup><span class="asterisk">*</span> </label>
<label for="expiration-date_${exceptions}" name="date-row">Expiration Date<sup>*</sup><span class="asterisk">*</span> </label>
<input type="date" name="expiration-date_${exceptions}" class="numeric" id="expiration-date_${exceptions}" inputmode="numeric"
pattern="\d{4}-\d{2}-\d{2}" required />
</div>
<div class="field-wrapper numberinput required">
<div class="field-errors" style="display: none"></div>
<label for="threshold-requested_${exceptions}">
<label for="threshold-requested_${exceptions}" name="date-row">
Requested Threshold Percentage <span class="asterisk">*</span>
</label>
<div class="s-affixed-input-wrapper">
Expand Down Expand Up @@ -312,44 +329,17 @@ <h4>Acknowledgment of Terms</h4>
return exceptions
};
// Removes helper text and field select options
function clearDataOnFileChange() {
helpText = Array.from($('[id^="help-text-threshold-requested"]'));
fieldDropDown = Array.from($('[id^="field-threshold-exception"]'));
function clearDataOnFileChange(exceptions) {
helpText = $(`#help-text-threshold-requested_${exceptions}`)
fieldDropDown = $(`#field-threshold-exception_${exceptions}`);
for (let i = 0; i < fieldDropDown.length; i++) {
fieldDropDown[i].innerHTML = "";
helpText[i].innerHTML = "";
};
};
// Gets cdl data from AJAX
function getDynamicCDLData(file_type) {
helpText = Array.from($('[id^="help-text-threshold-requested"]'));
fieldDropDown = Array.from($('[id^="field-threshold-exception"]'));
$.ajax({
url: "{% url 'exception:get-cdls' %}",
type: 'GET',
data: {
'file_type': file_type
},
success: function(response) {
let cdls = response;
if (file_type != '') {
// Loop over each fieldTypeSelect element and set its innerHTML to the dropDownHTML
for (let i = 0; i < fieldDropDown.length; i++) {
fieldDropDown[i].options.add(new Option('-- Select a Field Type --', ""));
for (let j = 0; j < cdls.length; j++) {
fieldDropDown[i].options.add(new Option(`${cdls[j].field_list_value}: ${cdls[j].field_list_code}`, `${cdls[j].field_list_code}`));
};
};
};
},
error: function(xhr, status, error) {
console.log(error);
}
});
};
// To access previously hiddenexception blocks and populate with info from AJAX call.
// Ppulates based on sliced id name of select element to get exception block number
function getDynamicCDLDataforNewBlock(file_type, exceptions) {
function getDynamicCDLData(file_type, exceptions) {
helpText = $(`#help-text-threshold-requested_${exceptions}`)
fieldDropDown = $(`#field-threshold-exception_${exceptions}`);
$.ajax({
Expand Down Expand Up @@ -409,20 +399,26 @@ <h4>Acknowledgment of Terms</h4>
btnStatus(exceptions);

$('#exception-add-btn').click(function() {
let file_type = $("#file_type").val();

addException(exceptions);
// To track how many exception blocks there are for button logic
exceptions = addException(exceptions);
btnStatus(exceptions);
getDynamicCDLDataforNewBlock(file_type, exceptions);
// Gets help text for additional added blocks
$('[id^="field-threshold-exception"]').change(function() {
let fieldSelection = $(this).val();
// Gets exception number by id name
let exceptionsNum = $(this).attr('id').slice(-1);
let file_type = $('#file_type').val();
let exceptionsNum = $(this).attr('id').slice(-1);
let file_type = $(`#file_type_${exceptionsNum}`).val();
getHelpText(fieldSelection, file_type, exceptionsNum);
});
$('[id^="file_type"]').change(function() {
let exceptionsNum = $(this).attr('id').slice(-1);
clearDataOnFileChange(exceptionsNum);
let file_type = $(this).val();
getDynamicCDLData(file_type, exceptionsNum);
});

});

$('#exception-drop-btn').click(function() {
Expand All @@ -432,11 +428,19 @@ <h4>Acknowledgment of Terms</h4>
btnStatus(exceptions);
});

$('#file_type').change(function() {
clearDataOnFileChange()
$('[id^="file_type"]').change(function() {
let exceptionsNum = $(this).attr('id').slice(-1);
clearDataOnFileChange(exceptionsNum);
let file_type = $(this).val();
getDynamicCDLData(file_type);
getDynamicCDLData(file_type, exceptionsNum);
$('[id^="field-threshold-exception"]').change(function() {
let fieldSelection = $(this).val();
// Gets exception number by id name
let exceptionsNum = $(this).attr('id').slice(-1);
let file_type = $(`#file_type_${exceptionsNum}`).val();
getHelpText(fieldSelection, file_type, exceptionsNum);
});
});

$('[id^="field-threshold-exception"]').change(function() {
let fieldSelection = $(this).val();
Expand Down
2 changes: 1 addition & 1 deletion apcd-cms/src/apps/utils/apcd_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ def create_threshold_exception(form, iteration, sub_data):
_clean_email(form['requestor-email']),
"threshold",
_clean_date(form['expiration-date_{}'.format(iteration)]),
_clean_value(form['file_type']),
_clean_value(form['file_type_{}'.format(iteration)]),
_clean_value(form['field-threshold-exception_{}'.format(iteration)]),
_clean_value(form['threshold-requested_{}'.format(iteration)]),
_clean_value(form['justification']),
Expand Down

0 comments on commit ee1d2ec

Please sign in to comment.