dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15606
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5694: (patient)Use message-div instead of temporary popup in Enrollment form.
------------------------------------------------------------
revno: 5694
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-01-11 14:19:34 +0700
message:
(patient)Use message-div instead of temporary popup in Enrollment form.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ValidatePatientProgramEnrollmentAction.java
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/javascript/patient.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.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/java/org/hisp/dhis/caseentry/action/patient/ValidatePatientProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ValidatePatientProgramEnrollmentAction.java 2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ValidatePatientProgramEnrollmentAction.java 2012-01-11 07:19:34 +0000
@@ -132,85 +132,46 @@
if ( criteria != null )
{
- message = i18n.getString( "can_not_enroll_into_the_program_because" ) + " " + criteria.getName();
- return INPUT;
- }
-
- if ( enrollmentDate == null )
- {
- message = i18n.getString( "can_not_enrol_into_the_program_because" );
-
- return INPUT;
- }
-
- else
- {
- enrollmentDate = enrollmentDate.trim();
-
- if ( enrollmentDate.length() == 0 )
- {
- message = i18n.getString( "please_specify_enrollment_date" );
-
- return INPUT;
- }
-
- if ( enrollmentDate.length() != 0 )
- {
- Date DateOfEnrollment = format.parseDate( enrollmentDate );
-
- if ( DateOfEnrollment == null )
- {
- message = i18n.getString( "please_specify_a_valid_enrollment_date" );
-
- return INPUT;
- }
- }
- }
-
- if ( dateOfIncident == null )
- {
- message = i18n.getString( "please_specify_date_of_incident" );
-
- return INPUT;
- }
-
- else
- {
- dateOfIncident = dateOfIncident.trim();
-
- if ( dateOfIncident.length() == 0 )
- {
- message = i18n.getString( "please_specify_date_of_incident" );
-
- return INPUT;
- }
-
- if ( dateOfIncident.length() != 0 )
- {
- Date DateOfIncident = format.parseDate( dateOfIncident );
-
- if ( DateOfIncident == null )
- {
- message = i18n.getString( "please_specify_a_valid_date_of_incident" );
-
- return INPUT;
- }
-
- Date DateOfEnrollment = format.parseDate( enrollmentDate );
-
- if ( DateOfEnrollment.before( DateOfIncident ) )
- {
- message = i18n.getString( "date_of_incident_invalid" );
-
- return INPUT;
- }
- }
- }
-
- // ---------------------------------------------------------------------
- // Validation success
- // ---------------------------------------------------------------------
-
+ message = i18n.getString( "patient_could_not_be_enrolled_due_to_following_enrollment_criteria" ) + ": " + i18n.getString( criteria.getProperty() );
+
+ switch ( criteria.getOperator() )
+ {
+
+ case ValidationCriteria.OPERATOR_EQUAL_TO:
+ message += " = ";
+ break;
+ case ValidationCriteria.OPERATOR_GREATER_THAN:
+ message += " > ";
+ break;
+ default:
+ message += " < ";
+ break;
+ }
+
+ if ( criteria.getProperty() == "birthDate" )
+ {
+ message += " " + format.formatValue( criteria.getValue() );
+ }
+ else
+ {
+ message += " " + criteria.getValue().toString();
+ }
+
+ return INPUT;
+ }
+
+ Date DateOfEnrollment = format.parseDate( enrollmentDate );
+
+ Date DateOfIncident = format.parseDate( dateOfIncident );
+
+ if ( DateOfEnrollment.before( DateOfIncident ) )
+ {
+ message = program.getDateOfEnrollmentDescription() + " "
+ + i18n.getString( "have_to_be_greater_or_equals_to" ) + " " + program.getDateOfIncidentDescription();
+
+ return INPUT;
+
+ }
message = i18n.getString( "everything_is_ok" );
return SUCCESS;
=== 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-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-01-11 07:19:34 +0000
@@ -345,9 +345,6 @@
enroll=Enroll
update_enrollment_date=Update Enrollment Date
please_specify_enrollment_date=Please specify program enrollment date
-please_specify_a_valid_enrollment_date=Please specify a valid program enrollment date
-please_specify_date_of_incident=Please specify date of incident
-please_specify_a_valid_date_of_incident=Please specify a valid date of incident
date_of_incident=Date of Incident
date_of_enrollment=Date of Enrollment
update_enrollment=Update Enrollment
@@ -398,7 +395,7 @@
month=Month
year=Year
please_verify_birthday=Please verify the birthday
-date_of_incident_invalid=Date of Enrollment should be greater and equals to Date of incident
+have_to_be_greater_or_equals_to=have to be greater and equals to
no_patients_found=No Patients Found
please_enter_a_valid_full_name=Please enter a valid full name
program_unenrollment=Program UnEnrollment
@@ -456,4 +453,7 @@
registered_by_orgunit = Registered by facility
show_events = Show events
event_information = Event information
-history_events = History events
\ No newline at end of file
+history_events = History events
+integerValueOfAge = Age(years)
+reason = Reason
+patient_could_not_be_enrolled_due_to_following_enrollment_criteria=The beneficiary could not be enrolled due to the following enrollment criteria
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-01-11 07:19:34 +0000
@@ -521,6 +521,7 @@
url: 'validatePatientProgramEnrollment.action',
data: getParamsForDiv('programEnrollmentSelectDiv'),
success: function(json) {
+ hideById('message');
var type = json.response;
if ( type == 'success' )
{
@@ -528,11 +529,11 @@
}
else if ( type == 'error' )
{
- showErrorMessage( i18n_program_enrollment_failed + ':' + '\n' + message );
+ setMessage( i18n_program_enrollment_failed + ':' + '\n' + message );
}
else if ( type == 'input' )
{
- showWarningMessage( json.message );
+ setMessage( json.message );
}
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2012-01-11 07:19:34 +0000
@@ -1,6 +1,6 @@
<input type='hidden' id='registerEvent' name='registerEvent' value='$registerEvent'>
-#if( $programStageInstances )
+#if( $programStageInstances.size() > 0 )
<table width=100%>
<col id="noCol">
<col id="stageCol">
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2012-01-11 07:19:34 +0000
@@ -1,6 +1,6 @@
<h3>$i18n.getString( "patient_registered" )</h3>
-<div id='programEnrollmentSelectDiv'>
+<form id='programEnrollmentSelectDiv' method='POST'>
<input type="hidden" id="patientId" name="patientId" value="$patient.id">
@@ -56,12 +56,12 @@
</td></td>
</tr>
<tr>
- <td><label for="enrollmentDate"><span id='enrollmentDateDescription'></span><em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td colspan='2' align='left'><input type="text" id="enrollmentDate" name="enrollmentDate" style='width:30em' disabled="disabled" ></td>
+ <td><label for="enrollmentDate"><span id='enrollmentDateDescription'></span><em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
+ <td colspan='2' align='left'><input type="text" id="enrollmentDate" name="enrollmentDate" style='width:30em' disabled="disabled" class="{validate:{required:true}}"></td>
</tr>
<tr>
- <td><label for="dateOfIncident"><span id='dateOfIncidentDescription'></span><em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td colspan='2'><input type="text" id="dateOfIncident" name="dateOfIncident" style='width:30em' disabled="disabled" ></td>
+ <td><label for="dateOfIncident"><span id='dateOfIncidentDescription'></span><em title="$i18n.getString( "required" )" class="required"> * </em></label></td>
+ <td colspan='2'><input type="text" id="dateOfIncident" name="dateOfIncident" style='width:30em' disabled="disabled" class="{validate:{required:true}}"></td>
</tr>
<tr>
<td></td>
@@ -72,9 +72,12 @@
<tr>
<td style="width:180px"></td>
<td colspan='2'>
- <input type="button" id='enrollBtn' name='enrollBtn' value="$i18n.getString( 'enroll_to_program' )" style='width:10em' onclick="validateProgramEnrollment();" disabled='disabled'/>
+ <input type="submit" id='enrollBtn' name='enrollBtn' value="$i18n.getString( 'enroll_to_program' )" style='width:10em' disabled='disabled'/>
</td>
</tr>
+ <tr>
+ <td colspan='3'><span id='message'></span></td>
+ </tr>
</table>
<div id='programEnrollmentDiv' style='display:none;'></div>
@@ -86,13 +89,17 @@
<div id='dataEntryFormDiv' style='display:none;'></div>
</div>
-</div>
+</form>
<script>
var i18n_enroll_to_program = '$encoder.jsEscape( $i18n.getString( "enroll_to_program" ) , "'")';
jQuery('#programEnrollmentSelectDiv').ready(function()
{
+ validation( 'programEnrollmentSelectDiv', function(form){
+ validateProgramEnrollment();
+ });
+
jQuery("#tabs").tabs();
datePickerValid( 'enrollmentDate' );
datePickerValid( 'dateOfIncident' );