dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23694
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11537: hide/show user group in the update program stage form
------------------------------------------------------------
revno: 11537
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-07-29 16:28:14 +0700
message:
hide/show user group in the update program stage form
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.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-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js 2013-07-22 09:24:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js 2013-07-29 09:28:14 +0000
@@ -293,7 +293,7 @@
+ '<tr name="tr' + rowId + '">'
+ '<td><label>' + i18n_send_to + '</label></td>'
+ '<td>'
- + '<select id="sendTo' + rowId + '" name="sendTo' + rowId + '" class="sendTo" >'
+ + '<select id="sendTo' + rowId + '" name="sendTo' + rowId + '" class="sendTo" onchange="onchangeUserGroup('+ rowId +')">'
+ '<option value="1">' + i18n_patient + '</option>'
+ '<option value="2">' + i18n_health_worker + '</option>'
+ '<option value="3">' + i18n_orgunit_registered + '</option>'
@@ -302,7 +302,7 @@
+ '</select>'
+ '</td>'
+ '/<tr>'
- + '<tr name="tr' + rowId + '">'
+ + '<tr name="tr' + rowId + '" id="tr' + rowId + '">'
+ '<td><label>' + i18n_user_group + '</label></td>'
+ '<td>'
+ program_stage_SMS_reminder_form
@@ -327,6 +327,7 @@
+ '</tr>';
jQuery('#programStageMessage').append( contend );
+ showHideUserGroup();
}
function removeTemplateMessageForm( rowId )
@@ -343,4 +344,15 @@
else{
enable('daysAllowedSendMessage' + index );
}
+}
+function showHideUserGroup()
+{
+ jQuery(".sendTo").each( function( i, item ){
+ var numb = i+1;
+ if( item.value == 5){
+ showById( 'tr'+numb );
+ }
+ else
+ hideById ( 'tr'+numb );
+ });
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js 2013-07-19 06:04:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js 2013-07-29 09:28:14 +0000
@@ -1,6 +1,7 @@
var duplicate = false;
jQuery( document ).ready( function()
{
+ showHideUserGroup();
validation( 'updateProgramStageForm', function( form ){
if( duplicate==true)
return false;
@@ -109,4 +110,15 @@
if(!flag) return option;
}
});
-});
\ No newline at end of file
+});
+function showHideUserGroup()
+{
+ jQuery(".sendTo").each( function( i, item ){
+ var numb = i+1;
+ if( item.value == 5){
+ showById( 'tr'+numb );
+ }
+ else
+ hideById ( 'tr'+numb );
+ });
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2013-07-22 09:24:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2013-07-29 09:28:14 +0000
@@ -4,9 +4,17 @@
program_stage_SMS_reminder_form += "<option value='$group.id'>$i18n.getString($group.name)</option>";
#end
program_stage_SMS_reminder_form +="</select>";
+
+function onchangeUserGroup( id )
+ {
+ var value = document.getElementById( 'sendTo'+id ).value;
+ hideById( 'tr'+id );
+ if ( value == 5) {
+ showById( 'tr'+id );
+ }
+ };
</script>
<script type="text/javascript" src="javascript/updateProgramStageForm.js"></script>
-
<h3>$i18n.getString( "edit_program_stage" )</h3>
<h4>$programStage.program.displayName</h4>
@@ -202,7 +210,7 @@
<tr name="tr$index">
<td><label>$i18n.getString( "send_to" )</label></td>
<td>
- <select type="text" id="sendTo$index" name="sendTo$index" class="sendTo {validate:{required:true,number:true}}">
+ <select type="text" id="sendTo$index" name="sendTo$index" class="sendTo {validate:{required:true,number:true}}" onchange="onchangeUserGroup( $index )">
<option value="1" #if($!reminder.sendTo==1) selected #end >$i18n.getString("patient")</option>
<option value="2" #if($!reminder.sendTo==2) selected #end >$i18n.getString("health_worker")</option>
<option value="3" #if($!reminder.sendTo==3) selected #end >$i18n.getString("orgunit_registered")</option>
@@ -211,7 +219,7 @@
</select>
</td>
</tr>
- <tr name="tr$index">
+ <tr name="tr$index" id="tr$index">
<td><label>$i18n.getString( "user_group" )</label></td>
<td>
<select type="text" id="userGroup$index" name="userGroup$index" class="userGroup">