← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11872: Don't load the non-repeatable events existed into Create event box

 

------------------------------------------------------------
revno: 11872
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-09-03 10:58:32 +0700
message:
  Don't load the non-repeatable events existed into Create event box
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.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/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-09-02 18:49:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-09-03 03:58:32 +0000
@@ -555,11 +555,18 @@
 			height: 160
 		}).show('fast');
 		
-	if( programStageId != undefined )
-	{
-		jQuery('#repeatableProgramStage_' + programInstanceId).val(programStageId);
+	var flag = false;
+	jQuery('#repeatableProgramStage_' + programInstanceId + " option ").each(function(){
+		if( jQuery(this).css("display")!='none' && !flag){
+			jQuery(this).attr("selected","selected");
+			setSuggestedDueDate( programInstanceId );
+			flag = true;
+		}
+	});
+	
+	if(!flag){
+		jQuery('#repeatableProgramStage_' + programInstanceId).val("");
 	}
-	setSuggestedDueDate( programInstanceId );
 }
 
 function setSuggestedDueDate( programInstanceId )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2013-08-27 08:37:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2013-09-03 03:58:32 +0000
@@ -99,7 +99,7 @@
 				<select id='repeatableProgramStage_$!programInstance.id' name='repeatableProgramStageId_$!programInstance.id' onchange="setSuggestedDueDate('$programInstance.id')">
 					#foreach( $programStage in $programInstance.program.programStages )
 						#if( $programStage.irregular=='true')
-							<option value="$programStage.id" standardInterval='$programStage.standardInterval' repeatable="true">$!programStage.displayName</option>
+							<option value="$programStage.id" standardInterval='$programStage.standardInterval' selected repeatable="true">$!programStage.displayName</option>
 						#else
 							#set($hasEvent="false")
 							#foreach( $programStageInstance in $programInstance.programStageInstances )
@@ -108,7 +108,7 @@
 								#end
 							#end
 							
-							<option #if($hasEvent=="true") style="display:none;" #end value="$programStage.id" standardInterval='$programStage.minDaysFromStart' repeatable="false">$!programStage.displayName</option>
+							<option #if($hasEvent=="true") style="display:none;" #else selected #end value="$programStage.id" standardInterval='$programStage.minDaysFromStart' repeatable="false">$!programStage.displayName</option>
 						#end
 					#end
 				</select>