dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30699
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15609: Hide Create-event-button in TEI Dashboard if no event can be created.
------------------------------------------------------------
revno: 15609
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-06-10 18:06:27 +0800
message:
Hide Create-event-button in TEI Dashboard if no event can be created.
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 2014-06-10 07:56:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2014-06-10 10:06:27 +0000
@@ -500,10 +500,6 @@
$('#dueDateNewEncounter_' + programInstanceId).val(sdate);
}
-function closeDueDateDiv(programInstanceId) {
- $('#createNewEncounterDiv_' + programInstanceId).dialog('close');
-}
-
// ------------------------------------------------------
// Register Irregular-encounter
// ------------------------------------------------------
@@ -645,7 +641,7 @@
disable('newEncounterBtn_' + programInstanceId);
}
- closeDueDateDiv(programInstanceId);
+ $('#createNewEncounterDiv_' + programInstanceId).dialog('close');
showSuccessMessage(i18n_create_event_success);
});
}
=== 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 2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2014-06-10 10:06:27 +0000
@@ -74,6 +74,7 @@
<tr>
<td>$i18n.getString( 'program_stage' )</td>
<td>
+ #set($noOption=0)
<select id='repeatableProgramStage_$!programInstance.id' name='repeatableProgramStageId_$!programInstance.id' onchange="setSuggestedDueDate('$programInstance.id')">
#set($allowGenerateNextVisit='false')
#set($prevStageId='')
@@ -106,6 +107,7 @@
openAfterEnrollment="$!programStage.openAfterEnrollment"
reportDateToUse="$!reportDateToUse"
>$!programStage.displayName</option>
+ #set($noOption=$noOption + 1)
#else
#set($hasEvent="false")
#foreach( $programStageInstance in $programInstance.programStageInstances )
@@ -113,7 +115,9 @@
#set($hasEvent="true")
#end
#end
-
+ #if($hasEvent!="true")
+ #set($noOption=$noOption + 1)
+ #end
<option
#if($hasEvent=="true") style="display:none;" #else selected #end
value="$programStage.uid" localid='$programStage.id'
@@ -174,13 +178,12 @@
var i18n_create_new_event = '$encoder.jsEscape( $i18n.getString( "create_new_event" ) , "'" )';
var i18n_create_event_success = '$encoder.jsEscape( $i18n.getString( "create_event_success" ) , "'" )';
jQuery(document).ready( function(){
- var options = jQuery('#repeatableProgramStage_' + $programInstance.id + " option ").length;
- if( options==0 ){
- jQuery("[name=newEncounterBtn]").addClass("hidden");
- }
- else{
- jQuery("[name=newEncounterBtn]").addClass("show-new-event");
- }
+ #if( $noOption == 0 )
+ disable('newEncounterBtn_' + $programInstance.id);
+ #else
+ enable('newEncounterBtn_' + $programInstance.id);
+ #end
+
resize();
});