=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js 2014-05-06 10:32:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js 2014-08-19 11:45:47 +0000
@@ -103,6 +103,25 @@
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
};
+
+dhis2.util.uid = function() {
+ var letters = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ var allowedChars = "0123456789" + letters;
+ var NUMBER_OF_CODEPOINTS = allowedChars.length;
+ var CODESIZE = 11;
+ var uid;
+
+ //the uid should start with a char
+ uid = letters.charAt( Math.random() * (letters.length) );
+
+ for ( var i = 1; i < CODESIZE; ++i ){
+ uid += allowedChars.charAt( Math.random() * (NUMBER_OF_CODEPOINTS) );
+ }
+
+ return uid;
+};
+
+
/**
* Normalizes an argument object returned from a jQuery promise. If the argument
* is undefined, not an array or an empty array, undefined is returned. If the
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json 2014-08-01 12:22:15 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json 2014-08-19 11:45:47 +0000
@@ -51,6 +51,7 @@
"new_event": "New Event",
"data_element": "Data element",
"value": "Value",
+ "form_id": "Form id",
"register_event": "Register event",
"total_number_of_pages": "No. of pages",
"rows_per_page": "No. of rows per page",
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html 2014-08-12 10:54:04 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html 2014-08-19 11:45:47 +0000
@@ -1,5 +1,6 @@
-
+
+
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2014-08-12 10:54:04 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2014-08-19 11:45:47 +0000
@@ -101,7 +101,6 @@
});
}
};
-
//get events for the selected program (and org unit)
$scope.loadEvents = function(){
@@ -134,6 +133,11 @@
$scope.newDhis2Event = {dataValues: []};
$scope.currentEvent = {dataValues: []};
+
+ if($scope.selectedProgramStage.preGenerateUID){
+ $scope.eventGridColumns.push({name: 'form_id', id: 'uid', type: 'string', compulsory: false, showFilter: false, show: true});
+ $scope.filterTypes['uid'] = 'string';
+ }
angular.forEach($scope.selectedProgramStage.programStageDataElements, function(prStDe){
$scope.programStageDataElements[prStDe.dataElement.id] = prStDe;
@@ -221,7 +225,9 @@
}
$scope.dhis2Events[i][dataValue.dataElement] = dataValue.value;
- });
+ });
+
+ $scope.dhis2Events[i]['uid'] = $scope.dhis2Events[i].event;
delete $scope.dhis2Events[i].dataValues;
}
@@ -233,7 +239,7 @@
}
if($scope.noteExists){
- $scope.eventGridColumns.push({name: 'Comment', id: 'comment', type: 'string', compulsory: false, showFilter: false, show: true});
+ $scope.eventGridColumns.push({name: 'comment', id: 'comment', type: 'string', compulsory: false, showFilter: false, show: true});
}
}
$scope.eventFetched = true;
@@ -340,6 +346,11 @@
$scope.outerForm.submitted = false;
$scope.note = {};
+ if($scope.selectedProgramStage.preGenerateUID){
+ $scope.eventUID = dhis2.util.uid();
+ $scope.currentEvent['uid'] = $scope.eventUID;
+ }
+
//$scope.currentEvent = {};
};
@@ -404,6 +415,10 @@
dataValues: dataValues
};
+ if($scope.selectedProgramStage.preGenerateUID && !angular.isUndefined(newEvent['uid'])){
+ dhis2Event.event = newEvent['uid'];
+ }
+
if(!angular.isUndefined($scope.note.value) && $scope.note.value != ''){
dhis2Event.notes = [{value: $scope.note.value}];
@@ -450,7 +465,8 @@
$scope.outerForm.submitted = false;
$scope.disableSaveAndAddNew = false;
- //this is to hide typeAheadPopUps - shouldn't be an issue in the
+ //this is to hide typeAheadPopUps - shouldn't be an issue in
+ //the first place.
$timeout(function() {
angular.element('#hideTypeAheadPopUp').trigger('click');
}, 10);
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2014-08-15 09:53:56 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2014-08-19 11:45:47 +0000
@@ -334,7 +334,7 @@
{
return function() {
return $.ajax( {
- url: '../api/programStages.json?filter=id:eq:' + id +'&fields=id,name,version,description,reportDateDescription,captureCoordinates,dataEntryForm,minDaysFromStart,repeatable,programStageDataElements[displayInReports,allowProvidedElsewhere,allowDateInFuture,compulsory,dataElement[id,name,type,formName,optionSet[id]]]',
+ url: '../api/programStages.json?filter=id:eq:' + id +'&fields=id,name,version,description,reportDateDescription,captureCoordinates,dataEntryForm,minDaysFromStart,repeatable,preGenerateUID,programStageDataElements[displayInReports,allowProvidedElsewhere,allowDateInFuture,compulsory,dataElement[id,name,type,formName,optionSet[id]]]',
type: 'GET'
}).done( function( response ){
_.each( _.values( response.programStages ), function( programStage ) {
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/filters.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/filters.js 2014-04-02 09:11:11 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/filters.js 2014-08-19 11:45:47 +0000
@@ -7,7 +7,7 @@
.filter('gridFilter', function($filter){
return function(data, filters, filterTypes){
-
+
if(!data ){
return;
}
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/services.js 2014-08-08 11:18:55 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/services.js 2014-08-19 11:45:47 +0000
@@ -240,6 +240,7 @@
newInputField = '
';
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/column-modal.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/column-modal.html 2014-04-22 08:56:08 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/column-modal.html 2014-08-19 11:45:47 +0000
@@ -6,7 +6,8 @@
- {{eventGridColumn.name}}
+ {{eventGridColumn.name}}
+ {{eventGridColumn.name | translate}}
|
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/customForm.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/customForm.html 2014-08-01 12:22:15 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/customForm.html 2014-08-19 11:45:47 +0000
@@ -1,23 +1,31 @@
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2014-08-08 11:18:55 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2014-08-19 11:45:47 +0000
@@ -10,6 +10,14 @@
|
+
+
+ {{'form_id' | translate}}
+ |
+
+
+ |
+
{{selectedProgramStage.reportDateDescription ? selectedProgramStage.reportDateDescription : 'incident_date'| translate }}
@@ -56,9 +64,9 @@
{{'number_required'| translate}}[-180 ... 180]
|
-
+
- {{eventGridColumn.name}}
+ {{eventGridColumn.name}}
|
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/eventList.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/eventList.html 2014-08-11 14:13:53 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/eventList.html 2014-08-19 11:45:47 +0000
@@ -48,7 +48,8 @@
- {{eventGridColumn.name}}
+ {{eventGridColumn.name}}
+ {{eventGridColumn.name | translate}}
@@ -91,14 +92,15 @@
{{'comment' | translate}}
-
|
+
+
*
|