Skip to content

Commit

Permalink
Task/WP 349 350 Business name change exten excep forms (#240)
Browse files Browse the repository at this point in the history
* task/wp-349-350-business-name-exten-excep

- change only the form from org_name on submitter
table to entity_name on submitter table

* Removed spacing causing display issues

* Spacing

* spacing
  • Loading branch information
sophia-massie authored Nov 6, 2023
1 parent 0d00f76 commit 15b1ddb
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ <h4>Acknowledgment of Terms</h4>
<div class="field-errors" style="display: none"></div>
<select name='business-name' required='required' class="choicefield" id='business-name'>
{% for submitter in submitters %}
<option class="dropdown-text" value={{submitter.submitter_id}}>{{submitter.org_name}} - ID: {{submitter.submitter_id}}</option>
<option class="dropdown-text" value={{submitter.submitter_id}}>
{{submitter.entity_name}} - Payor Code: {{submitter.payor_code}}
</option>
{% endfor %}
</select>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ <h1>Threshold Exception Request</h1>
<hr/>
<h4>Requested Threshold Reduction</h4>
<div id="exception_block_1">
<div class="field-wrapper textinput required">
<label for="business-name_1">
Business Name<span class="asterisk">*</span>
</label>
<div class="field-errors" style="display: none"></div>
<select name='business-name_1' required='required' class="choicefield" id='business-name_1'>
{% for submitter in submitters %}
<option class="dropdown-text" value={{submitter.submitter_id}}>
{{submitter.entity_name}} - Payor Code: {{submitter.payor_code}}
</option>
{% endfor %}
</select>

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

Expand Down Expand Up @@ -155,19 +169,6 @@ <h4>Acknowledgment of Terms</h4>
I request an exception on behalf of:
</label></div>

<div class="field-wrapper textinput required">
<label for="business-name">
Business Name<span class="asterisk">*</span>
</label>
<div class="field-errors" style="display: none"></div>
<select name='business-name' required='required' class="choicefield" id='business-name'>
{% for submitter in submitters %}
<option class="dropdown-text" value={{submitter.submitter_id}}>{{submitter.org_name}} - ID:
{{submitter.submitter_id}}</option>
{% endfor %}
</select>

</div>

<div class="field-wrapper checkbox required">
<div class="field-errors" style="display: none"></div>
Expand Down Expand Up @@ -252,6 +253,18 @@ <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 textinput required">
<label for="business-name_${exceptions}">
Business Name<span class="asterisk">*</span>
</label>
<div class="field-errors" style="display: none"></div>
<select name='business-name_${exceptions}' required='required' class="choicefield" id='business-name_${exceptions}'>
{% for submitter in submitters %}
<option class="dropdown-text" value={{submitter.submitter_id}}>{{submitter.entity_name}} - Payor Code:
{{submitter.payor_code}}</option>
{% endfor %}
</select>
</div>
<div class="field-wrapper select required">
<div class="field-errors" style="display: none"></div>
Expand Down
13 changes: 6 additions & 7 deletions apcd-cms/src/apps/exception/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _set_submitter(sub):
"submitter_code": sub[1],
"payor_code": sub[2],
"user_name": sub[3],
"org_name": title_case(sub[4])
"entity_name": title_case(sub[4])
}

def _set_cdl(file_type):
Expand All @@ -77,19 +77,18 @@ def post(self, request):
errors = []
submitters = request.session.get('submitters')

submitter = next(submitter for submitter in submitters if int(submitter[0]) == int(form['business-name']))
if _err_msg(submitter):
errors.append(_err_msg(submitter))

# To create counter of exception requests and corresponding fields
max_iterations = 1

for i in range(2, 6):
if form.get('field-threshold-exception_{}'.format(i)):
max_iterations += 1
else:
break

for iteration in range(max_iterations):
submitter = next(submitter for submitter in submitters if int(submitter[0]) == int(form['business-name_{}'.format(iteration + 1)]))
if _err_msg(submitter):
errors.append(_err_msg(submitter))
except_response = apcd_database.create_threshold_exception(form, iteration + 1, submitter)
if _err_msg(except_response):
errors.append(_err_msg(except_response))
Expand Down Expand Up @@ -137,7 +136,7 @@ def _set_submitter(sub):
"submitter_code": sub[1],
"payor_code": sub[2],
"user_name": sub[3],
"org_name": title_case(sub[4])
"entity_name": title_case(sub[4])
}

context["submitters"] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ <h4>Extension Information</h4>
<div class="field-errors" style="display: none"></div>
<select name='business-name_1' required='required' class="choicefield" id='business-name_1'>
{% for submitter in submitters %}
<option class="dropdown-text" value={{submitter.submitter_id}}>{{submitter.org_name}} - ID:
{{submitter.submitter_id}}</option>
<option class="dropdown-text" value={{submitter.submitter_id}}>{{submitter.entity_name}} - Payor Code:
{{submitter.payor_code}}</option>
{% endfor %}
</select>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apcd-cms/src/apps/extension/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _set_submitter(sub):
"submitter_code": sub[1],
"payor_code": sub[2],
"user_name": sub[3],
"org_name": title_case(sub[4])
"entity_name": title_case(sub[4])
}
context["submitters"] = []
context["applicable_data_periods"] = []
Expand Down
6 changes: 3 additions & 3 deletions apcd-cms/src/apps/utils/apcd_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ def create_threshold_exception(form, iteration, sub_data):
) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
"""
values = (
_clean_value(form["business-name"]),
_clean_value(form['business-name_{}'.format(iteration)]),
sub_data[1],
sub_data[2],
sub_data[3],
Expand Down Expand Up @@ -1269,11 +1269,11 @@ def get_submitter_info(user):
submitters.submitter_code,
submitters.payor_code,
submitter_users.user_id,
submitters.org_name
submitters.entity_name
FROM submitter_users
JOIN submitters
ON submitter_users.submitter_id = submitters.submitter_id and submitter_users.user_id = (%s)
ORDER BY submitters.org_name, submitter_users.submitter_id
ORDER BY submitters.entity_name, submitter_users.submitter_id
"""
cur = conn.cursor()
cur.execute(query, (user,))
Expand Down

0 comments on commit 15b1ddb

Please sign in to comment.