← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8944: Add Remove button for anonymous program.

 

------------------------------------------------------------
revno: 8944
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-11-07 23:42:07 +0700
message:
  Add Remove button for anonymous program.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js


--
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/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-11-07 14:52:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-11-07 16:42:07 +0000
@@ -96,22 +96,23 @@
 		<a href="javascript:backEventList();">$i18n.getString( "anonymous_events_management" ) </a>
 		&raquo; <span id='programName' name='programName'></span>
 	</h3>
-	<table style="width:480px;">
-		<tr>
-			<th><span id="reportDateDescriptionField2">$i18n.getString( "report_date" )</span> <em title="$i18n.getString( "required" )" class="required">*</em> </th>
-			<th><input type="text" id="executionDate" name="executionDate" onchange="addNewEvent();"></th>
-				<script type="text/javascript">
-				   datePickerValid( 'executionDate', false );
-				</script> 
-		</tr>
+	<table style="width:580px;" class="listTable">
+			<tr>
+				<th><span id="reportDateDescriptionField2">$i18n.getString( "report_date" )</span> <em title="$i18n.getString( "required" )" class="required">*</em> </th>
+				<th><input type="text" id="executionDate" name="executionDate" onchange="addNewEvent();"></th>
+					<script type="text/javascript">
+					   datePickerValid( 'executionDate', false );
+					</script> 
+			</tr>
 	</table> 
 	<div id='dataEntryFormDiv'></div>
 	
-	<div id='actionDiv' class="page inputCriteria" style="width:600px;height:29px;">	
+	<div id='actionDiv' class="page inputCriteria" style="width:680px;height:29px;">	
 		<input type="button" onclick="doComplete()" value="$i18n.getString('complete')" id="completeBtn">
 		<input type="button" onclick="doUnComplete()" value="$i18n.getString('incomplete')" id="uncompleteBtn" >
-		<input type="button" value="$i18n.getString('run_validation')" onClick="javascript: runValidation();">
+		<input type="button" value="$i18n.getString('run_validation')" onclick="javascript: runValidation();">
 		<input type="button" onclick="completedAndAddNewEvent()" value="$i18n.getString('complete_and_add_new_event')" id="completeAndAddNewBtn" style="width:150px;">
+		<input type="button" class='large-button' onclick="javascript:removeCurrentEvent();" value="$i18n.getString('remove')">
 	</div>
 </div>
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2012-11-07 14:52:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2012-11-07 16:42:07 +0000
@@ -293,36 +293,36 @@
 
 function showUpdateEvent( programStageInstanceId )
 {
+	hideById('selectDiv');
+    hideById('searchDiv');
+    hideById('listDiv');
 	setFieldValue('programStageInstanceId', programStageInstanceId);
-	$( '#dataEntryFormDiv' ).load( "viewProgramStageRecords.action", 
+	setInnerHTML('dataEntryFormDiv','');
+    showLoader();
+
+	$( '#dataEntryFormDiv' ).load( "dataentryform.action", 
 		{ 
 			programStageInstanceId: programStageInstanceId
 		},function()
 		{
-			showById('patientInforTB');
-			hideById('dueDateLbl');
-			hideById('dueDateField');
+			jQuery('#inputCriteriaDiv').remove();
+			hideById('mainLinkLbl');
+			showById('actionDiv');
 			var programName = jQuery('#programId option:selected').text();
 			var programStageId = jQuery('#programId option:selected').attr('psid');
 			jQuery('.stage-object-selected').attr('psid',programStageId);
 			setInnerHTML('programName', programName );
 			if( getFieldValue('completed')=='true' ){
-				jQuery("#inputCriteriaDiv [id=completeBtn]").attr("disabled", false);
-				jQuery("#inputCriteriaDiv [id=uncompleteBtn]").attr("disabled", true);
+				disable("completeBtn");
+				enable("uncompleteBtn");
 			}
 			else{
-				jQuery("#inputCriteriaDiv [id=completeBtn]").attr("disabled", true);
-				jQuery("#inputCriteriaDiv [id=uncompleteBtn]").attr("disabled", false);
+				enable("completeBtn");
+				disable("uncompleteBtn");
 			}
-		}).dialog(
-		{
-			title:i18n_data_entry,
-			maximize:true, 
-			closable:true,
-			modal:false,
-			overlay:{background:'#000000', opacity:0.1},
-			width:850,
-			height:500
+			hideById('loaderDiv');
+			showById('dataEntryInfor');
+			showById('entryFormContainer');
 		});
 }
 
@@ -347,6 +347,7 @@
 	hideById('actionDiv');
 	showById('dataEntryInfor');
 	setFieldValue('programStageInstanceId','0');
+	byId('executionDate').style.backgroundColor = "#ffffff";
 	setInnerHTML('programName', jQuery('#programId option:selected').text());
 }
 
@@ -405,3 +406,27 @@
 			});
 	}
 }
+
+function removeCurrentEvent()
+{	
+    var result = window.confirm( i18n_comfirm_delete_event );
+    if ( result )
+    {
+    	$.postJSON(
+    	    "removeCurrentEncounter.action",
+    	    {
+    	        "id": getFieldValue('programStageInstanceId')   
+    	    },
+    	    function( json )
+    	    { 
+    	    	if ( json.response == "success" )
+    	    	{
+					backEventList();
+				}
+				else if ( json.response == "error" )
+    	    	{ 
+					showWarningMessage( json.message );
+    	    	}
+			});
+	}
+}