← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8060: Improve the activity plan functionality (WIP).

 

------------------------------------------------------------
revno: 8060
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-09-13 10:48:22 +0700
message:
  Improve the activity plan functionality (WIP).
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-09-12 09:03:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-09-13 03:48:22 +0000
@@ -444,4 +444,11 @@
 please_select_criteria = Please select criteria
 sender = Sender
 activity_plan = Activity plan
-intro_activity_plan=View the activity plan to get an overview of outstanding, pending and completed visits.
\ No newline at end of file
+intro_activity_plan=View the activity plan to get an overview of outstanding, pending and completed visits.
+show_events_since = Show events since
+show_events_up_to = Show events up to
+show_activity_list = Show Activity List
+one_day = 1 day
+three_days = 3 days
+one_week = 1 week
+one_month = 1 month
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2012-09-12 09:03:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2012-09-13 03:48:22 +0000
@@ -18,7 +18,6 @@
 		disable('advancedSearchBtn');
 		setFieldValue('searchByProgramStage', 'true');
 		setFieldValue('hideLink', 'true');
-		showById('dueDateTR');
 	});	
 </script>
 
@@ -29,19 +28,86 @@
 	<input type='hidden' id='sendToList' name='sendToList'>
 	<input type='hidden' id='programStageInstanceId' name='programStageInstanceId' value='$programStageInstance.id'>
 	<input type='hidden' id='programStageName' name='programStageName'>
-	<div id='searchDiv'>
-		#parse( "dhis-web-caseentry/searchPatientCriteria.vm" )	
+	<input type='hidden' id='searchByProgramStage' name='searchByProgramStage' value="false">
+	<input type='hidden' id='orgunitId' name='orgunitId' value='$organisationUnit.id' >
+	<input type="hidden" id='hideLink' name='hideLink' value='false'>
+	<input type='hidden' id='isSearchByProgram' name='isSearchByProgram' value='false' >
+	<div id='advanced-search' style='width:500px;'>
+		<table style="margin-bottom:8px">    
+			<tr>
+				<td>
+					<label>$i18n.getString( "registering_unit" )</label>
+				</td>
+				<td>
+					<input type="text" id='orgunitName' readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( 'please_select_village' )]" #end >
+				</td>
+			</tr> 
+			<tr id='programAddPatientTR' class='hidden'>
+				<td>$i18n.getString('program')</td>
+				<td>
+					<select id='programIdAddPatient' name='programIdAddPatient' onchange='enableBtn();'>
+						#foreach($program in $programs)
+							<option value="$program.id" type='$program.type'>$program.name</option>
+						#end
+					</select>
+				</td>
+			</tr>
+			<tr id='programStageAddPatientTR'>
+				<td>$i18n.getString('status')</td>
+				<td>
+					<select id="statusEvent" name="statusEvent" onchange="statusEventOnChange()">
+						<option value='4'>$i18n.getString("overdue")</option>
+						<option value='2'>$i18n.getString("incomplete")</option>
+						<option value='1'>$i18n.getString("completed")</option>
+						<option value='3'>$i18n.getString("scheduled_in_future")</option> 
+					</select>
+				</td>
+			</tr>
+			<tr>
+				<td>$i18n.getString('show_events_since')</td>
+				<td>
+					<select id="showEventSince" name="showEventSince" disabled onchange="setDateRangeSince(this.value);">
+						<option value=''>[$i18n.getString("please_select")]</option>
+						<option value='-1'>$i18n.getString("one_day")</option>
+						<option value='-3'>$i18n.getString("three_days")</option>
+						<option value='-7' selected>$i18n.getString("one_week")</option>
+						<option value='-30'>$i18n.getString("one_month")</option>
+						<option value='ALL'>$i18n.getString("all")</option>
+					</select>
+				</td>
+			</tr>
+			<tr>
+				<td>$i18n.getString('show_events_up_to')</td>
+				<td>
+					<select id="showEventUpTo" name="showEventUpTo" onchange="setDateRangeUpTo(this.value);">
+						<option value=''>[$i18n.getString("please_select")]</option>
+						<option value='1'>$i18n.getString("one_day")</option>
+						<option value='3'>$i18n.getString("three_days")</option>
+						<option value='7' selected>$i18n.getString("one_week")</option>
+						<option value='30'>$i18n.getString("one_month")</option>
+						<option value='ALL'>$i18n.getString("all")</option>
+					</select>
+				</td>
+			</tr>
+			<tr>
+				<td></td>
+				<td valign='bottom'>
+					<input type="button" class='large-button' id='listPatientBtn' value="$i18n.getString( 'show_activity_list' )" onclick="javascript:showActitityList();" >
+				</td>
+			</tr>
+		</table>
 	</div>
 </form>
 
 <div id='listPatientDiv'></div>
 <div id='contentDataRecord'></div>
 #parse( "dhis-web-commons/loader/loader.vm" )
-
 <div class='hidden'>
+	<input type='text' id='startDueDate' name='startDueDate' >
+	<input type='text' id='endDueDate' name='endDueDate' >
 	<input type='textbox' id='currentDate' name='currentDate'>
 	<script>
-		datePickerValid( 'currentDate', true );
+		datePicker( 'currentDate' );
 	</script>
 </div>
 
@@ -59,4 +125,11 @@
 	var i18n_comfirm_delete_event = '$encoder.jsEscape( $i18n.getString( "comfirm_delete_event" ) , "'")';
 	var i18n_please_select_criteria = '[' + '$encoder.jsEscape( $i18n.getString( "please_select_criteria" ) , "'")' + ']';
 	var i18n_program_stage = '$encoder.jsEscape( $i18n.getString( "program_stage" ) , "'")';
+	
+	var date = new Date();
+	var d = date.getDate() + 7;
+	var m = date.getMonth();
+	var y= date.getFullYear();
+	jQuery("#startDueDate").val(jQuery.datepicker.formatDate( dateFormat, new Date() ));
+	jQuery("#endDueDate").val(jQuery.datepicker.formatDate( dateFormat, new Date(y, m, d) ));
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2012-09-12 09:03:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2012-09-13 03:48:22 +0000
@@ -21,22 +21,17 @@
 
 selection.setListenerFunction( orgunitSelected );
 
-function listAllPatient()
+function showActitityList()
 {
 	setFieldValue('listAll', "true");
 	hideById('listPatientDiv');
 	contentDiv = 'listPatientDiv';
 	$('#contentDataRecord').html('');
 	
-	var date = new Date();
-	var d = date.getDate() + 7;
-	var m = date.getMonth();
-	var y= date.getFullYear();
-	var startDate = jQuery( '#currentDate' ).val();
-	var endDate = jQuery.datepicker.formatDate( dateFormat, new Date(y, m, d) ) ;
-	
 	var programId = getFieldValue('programIdAddPatient');
-	var searchTexts = "stat_" + programId + "_3_" + startDate + "_" + endDate 
+	var searchTexts = "stat_" + programId + "_3_" 
+					+ getFieldValue('startDueDate')
+					+ "_" + getFieldValue('endDueDate')
 					+ "_" + getFieldValue('orgunitId');
 	
 	showLoader();
@@ -55,24 +50,6 @@
 		});
 }
 
-function advancedSearch( params )
-{
-	setFieldValue('listAll', "false");
-	$('#contentDataRecord').html('');
-	params += "&programId=" + getFieldValue('programIdAddPatient');
-	$.ajax({
-		url: 'getActivityPlanRecords.action',
-		type:"POST",
-		data: params,
-		success: function( html ){
-			jQuery('#listPatientDiv').html(html);
-			showById('colorHelpLink');
-			showById('listPatientDiv');
-			hideLoader();
-		}
-	});
-}
-
 function eventFlowToggle( programInstanceId )
 {
 	jQuery("#tb_" + programInstanceId + " .stage-object").each( function(){
@@ -118,3 +95,66 @@
 			height:500
 		});
 }
+
+function statusEventOnChange()
+{
+	var statusEvent = getFieldValue("statusEvent");
+	
+	if( statusEvent == '3' ){
+		disable('showEventSince');
+		enable('showEventUpTo');
+		setDateRangeUpTo( getFieldValue("showEventUpTo") );
+	}
+	else{
+		enable('showEventSince');
+		disable('showEventUpTo');
+		setDateRangeSince( getFieldValue("showEventSince") );
+	}
+}
+
+function setDateRangeSince( days )
+{
+	if(days == "")
+		return;
+	var date = new Date();
+	var d = date.getDate();
+	var m = date.getMonth();
+	var y= date.getFullYear();
+	
+	var startDate = "";
+	if( days == 'ALL'){
+		startDate = jQuery.datepicker.formatDate( dateFormat, new Date(y-100, m, d) ) ;
+	}
+	else{
+		d = d + eval(days);
+		startDate = jQuery.datepicker.formatDate( dateFormat, new Date(y, m, d) ) ;
+	}
+	
+	var endDate = jQuery.datepicker.formatDate( dateFormat, new Date() );
+	jQuery("#startDueDate").val(startDate);
+	jQuery("#endDueDate").val(endDate);
+}
+
+function setDateRangeUpTo( days )
+{
+	if(days == "")
+		return;
+		
+	var date = new Date();
+	var d = date.getDate();
+	var m = date.getMonth();
+	var y= date.getFullYear();
+	
+	var startDate = jQuery.datepicker.formatDate( dateFormat, new Date() );
+	var endDate = "";
+	if( days == 'ALL'){
+		endDate = jQuery.datepicker.formatDate( dateFormat, new Date(y+100, m, d) ) ;
+	}
+	else{
+		d = d + eval(days);
+		endDate = jQuery.datepicker.formatDate( dateFormat, new Date(y, m, d) ) ;
+	}
+	
+	jQuery("#startDueDate").val(startDate);
+	jQuery("#endDueDate").val(endDate);
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm	2012-09-12 13:36:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm	2012-09-13 03:48:22 +0000
@@ -27,7 +27,5 @@
 <h2>$i18n.getString( "tracking" )&nbsp;</h2>
 <ul>
     <li><a href="activityPlanSelect.action">$i18n.getString( "activity_plan" )</a></li>     
-</ul>
-<ul>
     <li><a href="smsReminderSelect.action">$i18n.getString( "program_tracking" )</a></li>     
 </ul>