← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22334: tracker-capture: registration and data entry in one page - WIP

 

------------------------------------------------------------
revno: 22334
committer: Abyot Asalefew Gizaw <abyot@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-15 17:29:06 +0100
message:
  tracker-capture: registration and data entry in one page - WIP
added:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/custom-registration-form.html
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-details.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/enrollment-dates-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/registration.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css


--
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-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-details.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-details.html	2016-03-15 15:40:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-details.html	2016-03-15 16:29:06 +0000
@@ -2,7 +2,7 @@
 <div class="row" ng-if="displayCustomForm !== 'TABLE' && displayCustomForm !== 'COMPARE' && !currentStage.periodType">
 
     <div ng-class="{true: 'col-md-12', false: 'col-md-6'} [currentStage.hideDueDate]">
-        {{currentEvent.excecutionDateLabel}}
+        {{currentEvent.excecutionDateLabel ? currentEvent.excecutionDateLabel : 'report_date' | translate}}
         <input type="text"
                placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
                class="form-control hideInPrint" 
@@ -24,10 +24,10 @@
         </div>        
     </div>
     <div ng-if="!currentStage.hideDueDate || !currentEvent.eventDate && currentEvent.status !== 'SKIPPED'"  class="col-md-6">
-        <span ng-if="currentEvent.eventDate || currentEvent.status === 'SKIPPED' || currentEvent.dueDate">
+        <span ng-if="currentEvent.eventDate || currentEvent.status === 'SKIPPED' || currentEvent.dueDate || registrationMode === 'REGISTRATION'">
             {{'due_date'| translate}}
         </span>
-        <span ng-if="!currentEvent.eventDate && currentEvent.status !== 'SKIPPED' && !selectedEntity.inactive && selectedEnrollment.status === 'ACTIVE'">
+        <span ng-if="!currentEvent.eventDate && currentEvent.status !== 'SKIPPED' && !selectedEntity.inactive && selectedEnrollment.status === 'ACTIVE' && registrationMode !== 'REGISTRATION'">
             <a href ng-click="enableRescheduling()" title="{{ schedulingEnabled ? 'disable_rescheduling' : 'enable_rescheduling' | translate}}"><span class="text-primary bold">{{'reschedule_duedate'| translate}}</span></a>                        
         </span>                    
         <input type="text"

=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/custom-registration-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/custom-registration-form.html	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/custom-registration-form.html	2016-03-15 16:29:06 +0000
@@ -0,0 +1,1 @@
+<d2-custom-form custom-form="customRegistrationForm"></d2-custom-form>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2016-03-15 12:36:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2016-03-15 16:29:06 +0000
@@ -1,4 +1,6 @@
-<h3 ng-if="widget !== 'PROFILE'">{{'profile'| translate}}</h3>
+<div ng-if="widget !== 'PROFILE'" class="section-label section-spacing vertical-spacing">
+    {{'profile'| translate}}
+</div>
 <script type="text/ng-template" id="attribute-details.html">
     <table class="table table-bordered">
         <tr>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/enrollment-dates-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/enrollment-dates-form.html	2016-03-15 14:50:51 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/enrollment-dates-form.html	2016-03-15 16:29:06 +0000
@@ -1,3 +1,6 @@
+<div class="section-label vertical-spacing">
+    {{'enrollment'| translate}}
+</div>
 <table class="dhis2-list-table-striped default-form-table">
     <tr>
         <td>
@@ -41,5 +44,4 @@
             <input type="text" class="form-control not-for-screen"/>
         </td>
     </tr>
-</table>
-<hr>
\ No newline at end of file
+</table>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2016-03-15 08:14:44 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2016-03-15 16:29:06 +0000
@@ -27,7 +27,7 @@
     $scope.maxOptionSize = 30;
     $scope.today = DateUtils.getToday();
     $scope.trackedEntityForm = null;
-    $scope.customForm = null;    
+    $scope.customRegistrationForm = null;    
     $scope.selectedTei = {};
     $scope.tei = {};    
     $scope.hiddenFields = {};    
@@ -68,7 +68,7 @@
 
     var getProgramRules = function(){
         $scope.trackedEntityForm = null;
-        $scope.customForm = null;        
+        $scope.customRegistrationForm = null;        
         $scope.allProgramRules = {constants: [], programIndicators: {}, programValidations: [], programVariables: [], programRules: []};
         if( angular.isObject($scope.selectedProgram) && $scope.selectedProgram.id ){
             TrackerRulesFactory.getRules($scope.selectedProgram.id).then(function(rules){                    
@@ -114,17 +114,37 @@
         
     $scope.getAttributes = function(_mode){        
         var mode = _mode ? _mode : 'ENROLLMENT';
+        $scope.customRegistrationFormExists = false;
+        $scope.customForm = null;
+        $scope.schedulingEnabled = true;
         AttributesFactory.getByProgram($scope.selectedProgram).then(function(atts){            
-            $scope.attributes = TEIGridService.generateGridColumns(atts, null,false).columns;
-            $scope.customFormExists = false;
-            if($scope.selectedProgram && $scope.selectedProgram.id && $scope.selectedProgram.dataEntryForm && $scope.selectedProgram.dataEntryForm.htmlCode){
-                $scope.customFormExists = true;
-                $scope.trackedEntityForm = $scope.selectedProgram.dataEntryForm;  
-                $scope.trackedEntityForm.attributes = $scope.attributes;
-                $scope.trackedEntityForm.selectIncidentDatesInFuture = $scope.selectedProgram.selectIncidentDatesInFuture;
-                $scope.trackedEntityForm.selectEnrollmentDatesInFuture = $scope.selectedProgram.selectEnrollmentDatesInFuture;
-                $scope.trackedEntityForm.displayIncidentDate = $scope.selectedProgram.displayIncidentDate;
-                $scope.customForm = CustomFormService.getForTrackedEntity($scope.trackedEntityForm, mode);
+            $scope.attributes = TEIGridService.generateGridColumns(atts, null,false).columns;            
+            if($scope.selectedProgram && $scope.selectedProgram.id ){                
+                if( $scope.selectedProgram.dataEntryForm && $scope.selectedProgram.dataEntryForm.htmlCode){
+                    $scope.customRegistrationFormExists = true;
+                    $scope.trackedEntityForm = $scope.selectedProgram.dataEntryForm;  
+                    $scope.trackedEntityForm.attributes = $scope.attributes;
+                    $scope.trackedEntityForm.selectIncidentDatesInFuture = $scope.selectedProgram.selectIncidentDatesInFuture;
+                    $scope.trackedEntityForm.selectEnrollmentDatesInFuture = $scope.selectedProgram.selectEnrollmentDatesInFuture;
+                    $scope.trackedEntityForm.displayIncidentDate = $scope.selectedProgram.displayIncidentDate;
+                    $scope.customRegistrationForm = CustomFormService.getForTrackedEntity($scope.trackedEntityForm, mode);
+                }
+                
+                if( $scope.selectedProgram.programStages && $scope.selectedProgram.programStages.length === 1 && $scope.registrationMode === 'REGISTRATION'){
+                    $scope.prStDes = [];
+                    $scope.currentEvent = {enrollmentStatus: 'ACTIVE'};
+                    $scope.currentStage = $scope.selectedProgram.programStages[0];
+                    $scope.currentEvent.excecutionDateLabel = $scope.currentStage.excecutionDateLabel;                    
+                    $scope.selectedEnrollment.status = 'ACTIVE';
+                    angular.forEach($scope.currentStage.programStageDataElements, function (prStDe) {
+                        $scope.prStDes[prStDe.dataElement.id] = prStDe;
+                        if(prStDe.allowProvidedElsewhere){
+                            $scope.allowProvidedElsewhereExists[$scope.currentStage.id] = true;
+                        }
+                    });
+                    
+                    $scope.customForm = CustomFormService.getForProgramStage($scope.currentStage, $scope.prStDes);
+                }                
             }
         });
     }; 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html	2016-03-14 14:35:45 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration.html	2016-03-15 16:29:06 +0000
@@ -1,7 +1,6 @@
 <div ng-controller="RegistrationController">
     <!--registration form starts -->
     <form name="outerForm" novalidate>
-
         <!-- Entity type begins -->
         <div ng-if="!selectedProgram && registrationMode === 'REGISTRATION'">
             <h3>{{'category'| translate}}</h3>
@@ -23,44 +22,58 @@
         <!-- Entity type ends -->        
 
         <!--custom registration form begins -->
-        <div class="vertical-spacing" ng-if="customFormExists">
+        <div class="vertical-spacing" ng-if="customRegistrationFormExists">
             <!-- enrollment and incidence dates begin -->
-            <div ng-if="selectedProgram && !customForm.hasProgramDate && registrationMode !== 'PROFILE'">
+            <div ng-if="selectedProgram && !customRegistrationForm.hasProgramDate && registrationMode !== 'PROFILE'">
                 <div ng-include="'components/registration/enrollment-dates-form.html'"></div>
             </div>
             <!-- enrollment and incidence dates end -->
-            <div ng-include="'../dhis-web-commons/angular-forms/custom-form.html'"></div>
+            <div ng-include="'components/registration/custom-registration-form.html'"></div>
 
         </div>
         <!-- custom registration form ends -->
 
         <!-- default registration form begins -->
-        <div class="vertical-spacing" ng-if="!customFormExists">
+        <div class="vertical-spacing" ng-if="!customRegistrationFormExists">
             <div ng-if="selectedProgram && registrationMode !== 'PROFILE'" ng-include="'components/registration/enrollment-dates-form.html'"></div>
-            <div ng-include="'components/registration/default-registration-form.html'"></div>
+            <div ng-include="'components/registration/default-registration-form.html'"></div>            
         </div>
         <!-- default registration form ends -->
-
-        <div ng-if="!editingDisabled && registrationMode === 'PROFILE'" class="vertical-spacing">
-            <button type="button" class="btn btn-primary small-horizonal-spacing" ng-click="registerEntity(null)">{{'save'| translate}}</button>        
-            <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="cancelRegistrationWarning(cancel)">{{'cancel'| translate}}</button>
-        </div>
-
-        <div class="vertical-spacing" ng-if="registrationMode === 'ENROLLMENT'">            
-            <button type="button" class="btn btn-primary" ng-click="registerEntity(null)">{{'enroll'| translate}}</button>  
-            <button type="button" class="btn btn-default" ng-click="cancelRegistrationWarning(showNewEnrollment)">{{'cancel'| translate}}</button>                    
-        </div>
-
-        <div class="vertical-spacing hideInPrint" ng-if="registrationMode === 'REGISTRATION'">                
-            <button type="button" class="btn btn-primary" ng-click="registerEntity('DASHBOARD')">{{'save_and_continue'| translate}}</button>
-            <button type="button" class="btn btn-success small-horizonal-spacing" ng-click="registerEntity('SELF')">{{'save_and_add_new'| translate}}</button>
-            <button type="button" class="btn btn-primary" onclick="javascript:window.print()">{{'print_form'| translate}}</button>
-            <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="cancelRegistrationWarning(showRegistration)">{{'cancel'| translate}}</button>
-        </div>
-
     </form>
     <!--registration form ends -->
-
+    
+    <!-- data entry form starts -->
+    <form name="outerDataEntryForm" novalidate>
+        <div ng-if="selectedProgram.programStages.length === 1 && registrationMode === 'REGISTRATION'">            
+            <div class="section-label section-spacing vertical-spacing">
+                {{'data_entry'| translate}}
+            </div>
+            <div ng-include="'components/dataentry/event-details.html'"></div>
+            <div class="clear vertical-spacing" ng-if="customForm" ng-include="'../dhis-web-commons/angular-forms/custom-form.html'"></div>
+            <div class="clear vertical-spacing" ng-if="!customForm" ng-include="'components/dataentry/default-form.html'"></div>
+        </div>    
+    </form>    
+    <!-- data entry form ends -->
+    
+    <!-- registration buttons begin -->
+    <div ng-if="!editingDisabled && registrationMode === 'PROFILE'" class="vertical-spacing">
+        <button type="button" class="btn btn-primary small-horizonal-spacing" ng-click="registerEntity(null)">{{'save'| translate}}</button>        
+        <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="cancelRegistrationWarning(cancel)">{{'cancel'| translate}}</button>
+    </div>
+
+    <div class="vertical-spacing" ng-if="registrationMode === 'ENROLLMENT'">            
+        <button type="button" class="btn btn-primary" ng-click="registerEntity(null)">{{'enroll'| translate}}</button>  
+        <button type="button" class="btn btn-default" ng-click="cancelRegistrationWarning(showNewEnrollment)">{{'cancel'| translate}}</button>                    
+    </div>
+
+    <div class="vertical-spacing hideInPrint" ng-if="registrationMode === 'REGISTRATION'">                
+        <button type="button" class="btn btn-primary" ng-click="registerEntity('DASHBOARD')">{{'save_and_continue'| translate}}</button>
+        <button type="button" class="btn btn-success small-horizonal-spacing" ng-click="registerEntity('SELF')">{{'save_and_add_new'| translate}}</button>
+        <button type="button" class="btn btn-primary" onclick="javascript:window.print()">{{'print_form'| translate}}</button>
+        <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="cancelRegistrationWarning(showRegistration)">{{'cancel'| translate}}</button>
+    </div>        
+    <!-- registration buttons end -->
+        
     <div class="hideInPrint" ng-if="warningMessages.length > 0" style="margin-top:18px" ng-class="{true: 'col-sm-4'} [registrationMode === 'REGISTRATION']">
         <div ng-include="'views/warnings.html'"></div>
     </div>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/registration.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/registration.html	2016-03-15 08:14:44 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/teiadd/registration.html	2016-03-15 16:29:06 +0000
@@ -4,7 +4,9 @@
 
         <!-- Entity type begins -->
         <div ng-if="!selectedProgramForRelative">
-            <h3>{{'category'| translate}}</h3>
+            <div class="section-label section-spacing vertical-spacing">
+                {{'category'| translate}}
+            </div>
             <table class="dhis2-list-table-striped dhis2-table-hover">
                 <tr>
                     <td>
@@ -19,7 +21,6 @@
                     </td>
                 </tr>                   
             </table>
-            <hr>
         </div>
         <!-- Entity type ends -->        
 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2016-03-11 13:02:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2016-03-15 16:29:06 +0000
@@ -473,4 +473,5 @@
 description=Description
 url=URL
 not_available=Not available
-attribute=Attribute
\ No newline at end of file
+attribute=Attribute
+data_entry=Data entry
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2016-03-15 12:17:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2016-03-15 16:29:06 +0000
@@ -847,6 +847,7 @@
 .section-label{
     font-size: 14pt;
     color: #585D61;
+    padding-bottom: 5px;
     border-bottom: 1px solid #e3e3e3;
 }
 
@@ -1934,4 +1935,8 @@
 .select2-hidden-accessible {
     display: none !important; 
     visibility: hidden !important;
+}
+
+.section-spacing {
+    margin-top: 20px;
 }
\ No newline at end of file