diff --git a/cpovc_forms/views.py b/cpovc_forms/views.py index c5baef29c..b368188fb 100644 --- a/cpovc_forms/views.py +++ b/cpovc_forms/views.py @@ -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}) @@ -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'), @@ -10733,7 +10734,7 @@ def new_cpara(request, id): ind_answer = True else: ind_answer = False - breakpoint() + # breakpoint() try: OVCCareIndividaulCpara.objects.create( @@ -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) @@ -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() @@ -11423,7 +11424,8 @@ def grad_monitor_tool(request, id): answer_value = { 'AYES': True, - 'ANNO': False + 'ANNO': False, + None: False } try: OVCBenchmarkMonitoring.objects.create( diff --git a/static/js/cpara-validate-benchmark.js b/static/js/cpara-validate-benchmark.js index ef970c5b7..3fa835359 100644 --- a/static/js/cpara-validate-benchmark.js +++ b/static/js/cpara-validate-benchmark.js @@ -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'){ @@ -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'); diff --git a/templates/forms/edit_grad_monitor_tool.html b/templates/forms/edit_grad_monitor_tool.html index 2bfa37c6a..9688ccd03 100644 --- a/templates/forms/edit_grad_monitor_tool.html +++ b/templates/forms/edit_grad_monitor_tool.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} + {% extends 'base.html' %} {% load app_filters %} {% load static %} {% block page_title %} Graduation Monitoring Tool {% endblock %} @@ -213,7 +213,7 @@

Schooled

- + Cancel
@@ -248,6 +248,64 @@

Schooled

$('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); + } +}) {% endblock lazy_javascript_code %} \ No newline at end of file diff --git a/templates/forms/new_cpara.html b/templates/forms/new_cpara.html index 628e43512..fe9aaad9a 100644 --- a/templates/forms/new_cpara.html +++ b/templates/forms/new_cpara.html @@ -915,7 +915,7 @@

{% 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 %} {{ sibling.person.first_name }} {{ sibling.person.surname }} {{ sibling.person.last_name }} @@ -951,6 +951,7 @@

+ {% endif %} {% endfor %} diff --git a/templates/forms/new_grad_monitor_tool.html b/templates/forms/new_grad_monitor_tool.html index 2cdb24592..1e11abe51 100644 --- a/templates/forms/new_grad_monitor_tool.html +++ b/templates/forms/new_grad_monitor_tool.html @@ -194,25 +194,31 @@

Schooled



-
- -
- {{ form.cm13q }} -
-
-
- -
- {{ form.cm14q }} -
-
+
+ +
+ {{ form.cm13q }} +
+
+
+ +
+ {{ form.cm14q }} +
+
+
+ +
+ +
+
- + Cancel
@@ -312,6 +318,65 @@

Schooled

$('#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); + } +}) {% endblock lazy_javascript_code %} \ No newline at end of file