Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitoring workflow #58

Open
wants to merge 4 commits into
base: upgrade
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions cpovc_forms/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9856,6 +9856,7 @@ def new_hivscreeningtool(request, id):
hiv_screen = None
hiv_facility = None
if request.method == 'POST':

try:

form = HIV_SCREENING_FORM(request.POST, initial={'person': id})
Expand Down Expand Up @@ -9979,7 +9980,7 @@ def new_hivscreeningtool(request, id):
data_to_save[skip] = False

print(data_to_save)
# breakpoint()

ovcscreeningtool = OVCHIVRiskScreening.objects.create(
person = RegPerson.objects.get(pk=int(id)),
test_done_when = data_to_save.get('HIV_RS_03'),
Expand Down Expand Up @@ -10733,7 +10734,7 @@ def new_cpara(request, id):
ind_answer = True
else:
ind_answer = False
breakpoint()
# breakpoint()

try:
OVCCareIndividaulCpara.objects.create(
Expand All @@ -10755,8 +10756,8 @@ def new_cpara(request, id):
print(error_message)

else:
for h_mmembers in hhmembers:
hh_members = []
hh_members = []
for h_mmembers in hhmembers:
hh_person_ids = h_mmembers.person.id
hh_members.append(hh_person_ids)
hh_members.append(id)
Expand Down Expand Up @@ -11393,14 +11394,14 @@ def delete_cpara(request, id, btn_event_pk):
def grad_monitor_tool(request, id):
if request.method == 'POST':
data = request.POST
# print(data)
print(data)

child = RegPerson.objects.get(id=id)
house_hold = OVCHouseHold.objects.get(id=OVCHHMembers.objects.get(person=child).house_hold_id)
caregiver_id = OVCRegistration.objects.get(person=child).caretaker_id
caregiver = RegPerson.objects.get(id=caregiver_id)

event_date = convert_date(data.get('gm1d'))
event_date = data.get('gm1d')
event_type_id = 'obm'
time_saved = timezone.now()

Expand All @@ -11423,7 +11424,8 @@ def grad_monitor_tool(request, id):

answer_value = {
'AYES': True,
'ANNO': False
'ANNO': False,
None: False
}
try:
OVCBenchmarkMonitoring.objects.create(
Expand Down
4 changes: 3 additions & 1 deletion static/js/cpara-validate-benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ validBench(['CP1q', 'CP2q', 'CP3q', 'CP4q', 'CP5q'], ['AYES','AYES,ANA','AYES,AN
validBench(['CP6q','CP7q','CP8q','CP9q','CP10q','CP11q','CP12q','CP13q','CP14q'], ['AYES','AYES,ANA','AYES','AYES','AYES,ANA','AYES','AYES','AYES,ANA','AYES'], 'CP2b');

// Healthy Goal 3 >> Benchmark 3
// validBench(['CP23q_b_1','CP23q_b_2','CP23q_b_3'],['AYES','AYES','AYES'],'CP3b')
validBench(['CP23q_b_1','CP23q_b_2','CP23q_b_3'],['AYES','AYES','AYES'],'CP3b')
// Healthy Goal 4 >> Benchmark 4
// $('input[name=CP41Skip').change(function (e){
// if ($('input[name=CP41Skip]:checked').val()==='ANA'){
Expand All @@ -251,6 +251,8 @@ validBench(['CP33q','CP34q','CP35q','CP36q'],['AYES','AYES','AYES','AYES,ANA'],'
validBench(['CP330q','CP340q','CP350q','CP360q'],['AYES','AYES','AYES','AYES'],'CP90b')




validDate('CP2d','CP1d','AYES','ANNO');


Expand Down
62 changes: 60 additions & 2 deletions templates/forms/edit_grad_monitor_tool.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'base.html' %}
{% extends 'base.html' %}
{% load app_filters %}
{% load static %}
{% block page_title %} Graduation Monitoring Tool {% endblock %}
Expand Down Expand Up @@ -213,7 +213,7 @@ <h2 class="text-left note note-info">Schooled</h2>
<div class="form-group">
<label class="control-label col-md-4 col-sm-4"></label>
<div class="col-md-6 col-sm-6">
<button type="submit" class="btn btn-primary">Update</button>
<button type="submit" onClick="submitActivate()" class="btn btn-primary">Update</button>
<a href="javascript:history.go(-1)" class="btn btn-white">Cancel</a>
</div>
</div>
Expand Down Expand Up @@ -248,6 +248,64 @@ <h2 class="text-left note note-info">Schooled</h2>
$('html,body').scrollTop(0);
FormWizardValidation.init();
$('#monitoring_date').datepicker({ format: 'yyyy-mm-dd' }).val();
$('input[name=cm13q]').prop("disabled", true);
$('input[name=cm14q]').prop("disabled", true);


});

function submitActivate(){
$('input[name=cm13q]').removeAttr('disabled')
$('input[name=cm14q]').removeAttr('disabled')
}

$('input[name=form1_type]').on('change', function(){
let f_type = $(this).val()
console.log(f_type)
if (f_type == 'bm'){
$('.grad_control').hide()
$('input[name=cm13q][value=ANNO]').prop("checked", true);
$('input[name=cm14q][value=ANNO]').prop("checked", true);
}else if (f_type=='hhrcpa'){
$('.grad_control').show()
$('input[name=cm13q][value=ANNO]').prop("checked", true);
$('input[name=cm14q][value=ANNO]').prop("checked", true);

}
})
$('input[type=radio]').on('change', function(){
ben_m1 = $('input[name=cm1q]:checked').val()
if(ben_m1=='AYES'){benchmark_1 = 1}else{benchmark_1 = 0}
ben_m2 = $('input[name=cm2q]:checked').val()
if(ben_m2=='AYES'){benchmark_2 = 1}else{benchmark_2 = 0}
ben_m3 = $('input[name=cm3q]:checked').val()
if(ben_m3=='AYES'){benchmark_3 = 1}else{benchmark_3 = 0}
ben_m4 = $('input[name=cm4q]:checked').val()
if(ben_m4=='AYES'){benchmark_4 = 1}else{benchmark_4 = 0}
ben_m5 = $('input[name=cm5q]:checked').val()
if(ben_m5=='AYES'){benchmark_5 = 1}else{benchmark_5 = 0}
ben_m6 = $('input[name=cm6q]:checked').val()
if(ben_m6=='AYES'){benchmark_6 = 1}else{benchmark_6 = 0}
ben_m7 = $('input[name=cm7q]:checked').val()
if(ben_m7=='AYES'){benchmark_7 = 1}else{benchmark_7 = 0}
ben_m8 = $('input[name=cm8q]:checked').val()
if(ben_m8=='AYES'){benchmark_8 = 1}else{benchmark_8 = 0}
ben_m9 = $('input[name=cm9q]:checked').val()
if(ben_m9=='AYES'){benchmark_9 = 1}else{benchmark_9 = 0}

total_score = benchmark_1+benchmark_2+benchmark_3+benchmark_4+benchmark_5+benchmark_6+benchmark_7+benchmark_8+benchmark_9

console.log(total_score)
$('#total_score').html(total_score+' / 9 ')

let form_type = $('input[name=form1_type]').val()
if (total_score >= 8 && form_type == 'hhrcpa'){
$('input[name=cm13q][value=AYES]').prop("checked", true);
$('input[name=cm14q][value=AYES]').prop("checked", true);
}else{
$('input[name=cm13q][value=ANNO]').prop("checked", true);
$('input[name=cm14q][value=ANNO]').prop("checked", true);
}
})
</script>
{% endblock lazy_javascript_code %}
3 changes: 2 additions & 1 deletion templates/forms/new_cpara.html
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ <h4 class="">
{% endif %}
{% if hhmembers %}
{% for sibling in hhmembers %}
{% if sibling.person.years >= 10 and sibling.person.years <= 20 %}
{% if sibling.person.years >= 12 and sibling.person.years <= 20 %}
<tr class="row12">
<td>
<a href="{% url 'view_person' id=sibling.person.id %}">{{ sibling.person.first_name }} {{ sibling.person.surname }} {{ sibling.person.last_name }}</a>
Expand Down Expand Up @@ -951,6 +951,7 @@ <h4 class="">
</label>
</td>
</tr>


{% endif %}
{% endfor %}
Expand Down
91 changes: 78 additions & 13 deletions templates/forms/new_grad_monitor_tool.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,25 +194,31 @@ <h2 class="text-left note note-info">Schooled</h2>

<br/>
<hr style="border-color: darkgrey; border-width: 5px;"/>
<div class="form-group">
<label class="col-md-9 control-label semi-bold">Household is still ready to successfully exit (Case plan achievement):<span class="asteriskField">*</label>
<div class="col-md-3">
{{ form.cm13q }}
</div>
</div>
<div class="form-group">
<label class="col-md-9 control-label semi-bold">Case determined ready for closure:<span class="asteriskField">*</label>
<div class="col-md-3">
{{ form.cm14q }}
</div>
</div>
<div class="form-group grad_control">
<label class="col-md-9 control-label semi-bold">Household is still ready to successfully exit (Case plan achievement):<span class="asteriskField">*</label>
<div class="col-md-3">
{{ form.cm13q }}
</div>
</div>
<div class="form-group grad_control">
<label class="col-md-9 control-label semi-bold">Case determined ready for closure:<span class="asteriskField">*</label>
<div class="col-md-3">
{{ form.cm14q }}
</div>
</div>
<div class="form-group grad_control">
<label class="col-md-9 control-label bold"></label>
<div id="total_score" class="col-md-3">

</div>
</div>


<div class="panel-body panel-form">
<div class="form-group">
<label class="control-label col-md-4 col-sm-4"></label>
<div class="col-md-6 col-sm-6">
<button type="submit" class="btn btn-primary">Submit</button>
<button type="submit" onClick="submitActivate()" class="btn btn-primary">Submit</button>
<a href="javascript:history.go(-1)" class="btn btn-white">Cancel</a>
</div>
</div>
Expand Down Expand Up @@ -312,6 +318,65 @@ <h2 class="text-left note note-info">Schooled</h2>


$('#monitoring_date').datepicker({ format: 'yyyy-mm-dd' }).val();

$('input[name=cm13q]').prop("disabled", true);
$('input[name=cm14q]').prop("disabled", true);


});

function submitActivate(){
$('input[name=cm13q]').removeAttr('disabled')
$('input[name=cm14q]').removeAttr('disabled')
}

$('input[name=form1_type]').on('change', function(){
let f_type = $(this).val()
console.log(f_type)
if (f_type == 'bm'){
$('.grad_control').hide()
$('input[name=cm13q][value=ANNO]').prop("checked", true);
$('input[name=cm14q][value=ANNO]').prop("checked", true);
}else if (f_type=='hhrcpa'){
$('.grad_control').show()
$('input[name=cm13q][value=ANNO]').prop("checked", true);
$('input[name=cm14q][value=ANNO]').prop("checked", true);

}
})
$('input[type=radio]').on('change', function(){
ben_m1 = $('input[name=cm1q]:checked').val()
if(ben_m1=='AYES'){benchmark_1 = 1}else{benchmark_1 = 0}
ben_m2 = $('input[name=cm2q]:checked').val()
if(ben_m2=='AYES'){benchmark_2 = 1}else{benchmark_2 = 0}
ben_m3 = $('input[name=cm3q]:checked').val()
if(ben_m3=='AYES'){benchmark_3 = 1}else{benchmark_3 = 0}
ben_m4 = $('input[name=cm4q]:checked').val()
if(ben_m4=='AYES'){benchmark_4 = 1}else{benchmark_4 = 0}
ben_m5 = $('input[name=cm5q]:checked').val()
if(ben_m5=='AYES'){benchmark_5 = 1}else{benchmark_5 = 0}
ben_m6 = $('input[name=cm6q]:checked').val()
if(ben_m6=='AYES'){benchmark_6 = 1}else{benchmark_6 = 0}
ben_m7 = $('input[name=cm7q]:checked').val()
if(ben_m7=='AYES'){benchmark_7 = 1}else{benchmark_7 = 0}
ben_m8 = $('input[name=cm8q]:checked').val()
if(ben_m8=='AYES'){benchmark_8 = 1}else{benchmark_8 = 0}
ben_m9 = $('input[name=cm9q]:checked').val()
if(ben_m9=='AYES'){benchmark_9 = 1}else{benchmark_9 = 0}

total_score = benchmark_1+benchmark_2+benchmark_3+benchmark_4+benchmark_5+benchmark_6+benchmark_7+benchmark_8+benchmark_9

console.log(total_score)
$('#total_score').html(total_score+' / 9 ')

let form_type = $('input[name=form1_type]').val()
if (total_score >= 8 && form_type == 'hhrcpa'){
$('input[name=cm13q][value=AYES]').prop("checked", true);
$('input[name=cm14q][value=AYES]').prop("checked", true);
}else{
$('input[name=cm13q][value=ANNO]').prop("checked", true);
$('input[name=cm14q][value=ANNO]').prop("checked", true);
}
})
</script>
{% endblock lazy_javascript_code %}