dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30898
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15710: integration with the new menu, update as per change in the web-api,
------------------------------------------------------------
revno: 15710
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Tue 2014-06-17 09:48:20 +0200
message:
integration with the new menu, update as per change in the web-api,
modified:
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/app.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html
--
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-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-06-06 13:35:06 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2014-06-17 07:48:20 +0000
@@ -36,7 +36,7 @@
DHIS2EventFactory.getByEntity($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgram.id).then(function(data){
$scope.dhis2Events = data;
-
+
/*if(angular.isUndefined($scope.dhis2Events)){
$scope.dhis2Events = [];
@@ -94,6 +94,7 @@
}
}
+ //get orgunit name for the event
if(dhis2Event.orgUnit){
OrgUnitService.open().then(function(){
OrgUnitService.get(dhis2Event.orgUnit).then(function(ou){
@@ -116,11 +117,11 @@
};
$scope.showDataEntry = function(event){
+
if(event){
$scope.currentEvent = event;
$scope.currentEvent.providedElsewhere = [];
- $scope.currentEvent.dataValues = [];
ProgramStageFactory.get($scope.currentEvent.programStage).then(function(stage){
$scope.currentStage = stage;
@@ -134,21 +135,77 @@
angular.forEach($scope.currentEvent.dataValues, function(dataValue){
var val = dataValue.value;
- var de = $scope.currentStage.programStageDataElements[dataValue.dataElement];
- if( de && de.type === 'int' && val){
- val = parseInt(val);
- dataValue.value = val;
- }
+ if(val){
+ var de = $scope.currentStage.programStageDataElements[dataValue.dataElement];
+ if( de && de.type === 'int' && val){
+ val = parseInt(val);
+ dataValue.value = val;
+ }
+ $scope.currentEvent[dataValue.dataElement] = val;
+ }
});
+
+ $scope.currentEvent.dataValues = [];
});
}
};
- $scope.savePatientDatavalue = function(currentEvent, dataElement){
-
- $scope.updateSuccess = false;
-
- //get the dataelement whose value is being saved/updated
- $scope.currentDataElement = {id: dataElement};
+ $scope.saveDatavalue = function(prStDe){
+
+ $scope.updateSuccess = false;
+
+ if(!angular.isUndefined($scope.currentEvent[prStDe.dataElement.id])){
+
+ //currentEvent.providedElsewhere[prStDe.dataElement.id];
+ var value = $scope.currentEvent[prStDe.dataElement.id];
+ var ev = { event: $scope.currentEvent.event,
+ orgUnit: $scope.currentEvent.orgUnit,
+ program: $scope.currentEvent.program,
+ programStage: $scope.currentEvent.programStage,
+ status: $scope.currentEvent.status,
+ trackedEntityInstance: $scope.currentEvent.trackedEntityInstance,
+ dataValues: [
+ {
+ dataElement: prStDe.dataElement.id,
+ value: value,
+ providedElseWhere: $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] ? $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] : false
+ }
+ ]
+ };
+ DHIS2EventFactory.updateForSingleValue(ev).then(function(response){
+ $scope.updateSuccess = true;
+ });
+
+ }
+ };
+
+ $scope.saveDatavalueLocation = function(prStDe){
+
+ $scope.updateSuccess = false;
+
+ if(!angular.isUndefined($scope.currentEvent.providedElsewhere[prStDe.dataElement.id])){
+
+ console.log('the event is: ',$scope.currentEvent.providedElsewhere[prStDe.dataElement.id]);
+ //currentEvent.providedElsewhere[prStDe.dataElement.id];
+ var value = $scope.currentEvent[prStDe.dataElement.id];
+ var ev = { event: $scope.currentEvent.event,
+ orgUnit: $scope.currentEvent.orgUnit,
+ program: $scope.currentEvent.program,
+ programStage: $scope.currentEvent.programStage,
+ status: $scope.currentEvent.status,
+ trackedEntityInstance: $scope.currentEvent.trackedEntityInstance,
+ dataValues: [
+ {
+ dataElement: prStDe.dataElement.id,
+ value: value,
+ providedElseWhere: $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] ? $scope.currentEvent.providedElsewhere[prStDe.dataElement.id] : false
+ }
+ ]
+ };
+ DHIS2EventFactory.updateForSingleValue(ev).then(function(response){
+ $scope.updateSuccess = true;
+ });
+
+ }
};
});
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2014-06-06 13:35:06 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html 2014-06-17 07:48:20 +0000
@@ -13,7 +13,7 @@
<table class="table-borderless">
<tbody>
<tr>
- <td class="inline-block" ng-repeat="dhis2Event in dhis2Events track by $index">
+ <td class="inline-block" ng-repeat="dhis2Event in dhis2Events">
<span class="block align-center">{{dhis2Event.orgUnitName}}</span>
<span class="stage-container"
ng-class="{'current-stage': currentEvent && currentEvent.event == dhis2Event.event, '{{dhis2Event.statusColor}}': true}"
@@ -45,7 +45,7 @@
<tr ng-repeat="prStDe in currentStage.programStageDataElements">
<td>
- {{prStDe.dataElement.name}}-{{prStDe.dataElement.type}}
+ {{prStDe.dataElement.name}}
</td>
<td>
<div ng-switch="prStDe.dataElement.type">
@@ -54,7 +54,7 @@
class="form-control"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-blur="savePatientDatavalue(currentEvent, prStDe.dataElement.id)"
+ ng-blur="saveDatavalue(prStDe)"
name="foo"/>
</div>
<div ng-switch-when="string">
@@ -64,14 +64,14 @@
ng-required={{prStDe.compulsory}}
typeahead="option for option in prStDe.dataElement.optionSet.options | filter:$viewValue | limitTo:20"
typeahead-open-on-focus
- ng-blur="savePatientDatavalue(currentEvent, prStDe.dataElement.id)"
+ ng-blur="saveDatavalue(prStDe)"
name="foo"/>
</div>
<div ng-switch-when="bool">
<select class="form-control"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-change="savePatientDatavalue(currentEvent, prStDe.dataElement.id)"
+ ng-change="saveDatavalue(prStDe)"
name="foo">
<option value="">{{'please_select'| translate}}</option>
<option value="0">{{'no'| translate}}</option>
@@ -84,9 +84,9 @@
placeholder="yyyy-mm-dd"
ng-date
class="form-control"
- ng-model="savePatientDatavalue(currentEvent, prStDe.dataElement.id)"
+ ng-model="saveDatavalue(prStDe)"
ng-required={{prStDe.compulsory}}
- blur-or-change="savePatientDatavalue(dhis2Event, eventGridColumn.id)"
+ blur-or-change="saveDatavalue(dhis2Event, eventGridColumn.id)"
name="foo"/>
</div>
</div>
@@ -95,7 +95,7 @@
<div class="align-center" ng-if="prStDe.allowProvidedElsewhere">
<input type="checkbox"
ng-model="currentEvent.providedElsewhere[prStDe.dataElement.id]"
- ng-change="savePatientDatavalue(currentEvent, prStDe.dataElement.id)"/>
+ ng-change="saveDatavalueLocation(prStDe)"/>
</div>
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js 2014-06-06 13:35:06 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/components/profile/profile-controller.js 2014-06-17 07:48:20 +0000
@@ -96,7 +96,7 @@
if(updateResponse.status !== 'SUCCESS'){//update has failed
var dialogOptions = {
- headerText: 'registration_error',
+ headerText: 'update_error',
bodyText: updateResponse.description
};
DialogService.showDialog({}, dialogOptions);
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-06-15 09:15:17 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/i18n/en.json 2014-06-17 07:48:20 +0000
@@ -84,6 +84,7 @@
"registration_date": "Registration date",
"register": "Register",
"registration_error": "Error in registration",
+ "update_error": "Error in update",
"category": "Category",
"entity_type": "Entity type",
"save": "Save",
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html 2014-06-06 13:35:06 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/index.html 2014-06-17 07:48:20 +0000
@@ -12,7 +12,7 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.tmpl.js"></script>
<link rel="stylesheet" type="text/css" href="../dhis-web-commons/javascripts/jQuery/ui/css/redmond/jquery-ui.css">
-
+
<script type="text/javascript" src="../dhis-web-commons/select2/select2.min.js"></script>
<link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/select2/select2.css">
@@ -27,7 +27,7 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/ui-bootstrap-tpls-0.10.0-draggable-modal.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/moment/moment-with-langs.min.js"></script>
-
+
<script type="text/javascript" src="../dhis-web-commons/javascripts/underscore.min.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.util.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/commons.js"></script>
@@ -51,7 +51,7 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.contextmenu.js"></script>
<!--<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>-->
-
+
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angularLocalStorage.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angular-translate.min.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angular-translate-loader-static-files.min.js"></script>
@@ -70,20 +70,22 @@
<script type="text/javascript" src="components/relationship/relationship-controller.js"></script>
<script type="text/javascript" src="components/profile/profile-controller.js"></script>
<script type="text/javascript" src="components/notes/notes-controller.js"></script>
-
+
<!-- Menu scripts -->
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.translate.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.menu.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.menu.ui.js"></script>
+
<link type="text/css" rel="stylesheet" href="../dhis-web-commons/font-awesome/css/font-awesome.min.css"/>
<link type="text/css" rel="stylesheet" media="screen,print" href="../dhis-web-commons/css/light_blue/light_blue.css"/>
<link type="text/css" rel="stylesheet" media="screen,print" href="../dhis-web-commons/css/widgets.css"/>
<link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/menu.css">
-
+
<link type="text/css" rel="stylesheet" href="styles/style.css">
-
+
<script type="text/javascript" src="../main.js"></script>
-
+
</head>
<body>
<div id="header" ng-controller="HeaderController">
@@ -92,78 +94,11 @@
</div>
<div id="headerMessage" class="bold"></div>
- <!-- Menu html -->
- <ul id="menuLinkArea">
- <li id="profileDropDown_button">
- <a id="profileMenuLink" class="menu-link drop-down-menu-link">
- <i class="fa fa-user"></i>{{'profile'| translate}}
- </a>
- </li>
- <li id="appsDropDown_button">
- <a id="appsMenuLink" class="menu-link drop-down-menu-link">
- <i class="fa fa-th"></i>{{'applications'| translate}}
- </a>
- </li>
- </ul>
-
- <div id="appsDropDown" class="menuDropDownArea app-menu-dropdown appsMenuLink_menu" >
- <div class="caret-up-border"></div>
- <div class="caret-up-background"></div>
- <div class="menu-drop-down-wrap">
- <div class="menu-drop-down-scroll">
- <ul class="menuDropDownBox"><li class="menu-placeholder"><img src="../images/ajax-loader-bar.gif"></li></ul>
- </div>
- </div>
- <div class="apps-menu-more"><a href="../dhis-web-commons-about/modules.action">{{'more_applications'| translate}}</a></div>
- </div>
-
- <div id="profileDropDown" class="menuDropDownArea app-menu-dropdown ui-helper-clearfix profileMenuLink_menu">
- <div class="caret-up-border"></div>
- <div class="caret-up-background"></div>
- <ul class="menuDropDownBox">
- <li>
- <a class="app-menu-item" href="../dhis-web-commons-about/userSettings.action">
- <img src="../icons/usersettings.png" alt="{{'settings'| translate}}">
- <span>{{'settings'| translate}} </span>
- </a>
- </li>
- <li>
- <a class="app-menu-item" href="../dhis-web-commons-about/showUpdateUserProfileForm.action">
- <img src="../icons/function-profile.png" alt="{{'profile'| translate}}">
- <span>{{'settings'| translate}} </span>
- </a>
- </li>
- <li>
- <a class="app-menu-item" href="../dhis-web-commons-about/showUpdateUserAccountForm.action">
- <img src="../icons/function-account.png" alt="{{'account' | translate}}">
- <span>{{'account' | translate}} </span>
- </a>
- </li>
- <li>
- <a class="app-menu-item" href="../dhis-web-commons-about/help.action">
- <img src="../icons/function-help-center.png" alt="{{'help' | translate}}">
- <span>{{'help' | translate}} </span>
- </a>
- </li>
- <li>
- <a class="app-menu-item" href="../dhis-web-commons-security/logout.action">
- <img src="../icons/function-log-out.png" alt="{{'log_out' | translate}}">
- <span>{{'log_out' | translate}} </span>
- </a>
- </li>
- <li>
- <a class="app-menu-item" href="../dhis-web-commons-about/about.action">
- <img src="../icons/function-about-dhis2.png" alt="{{'about_dhis2' | translate}}">
- <span>{{'about_dhis2' | translate}} </span>
- </a>
- </li>
- </ul>
- </div>
- <!-- /Menu html -->
+ <div d2-menu></div>
</div>
-
+
<div class="container-1" data-ng-view=''></div>
-
+
</body>
</html>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/app.js 2014-06-06 13:35:06 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/app.js 2014-06-17 07:48:20 +0000
@@ -12,6 +12,7 @@
'trackerCaptureControllers',
'angularLocalStorage',
'ui.select2',
+ 'd2Menu',
'pascalprecht.translate'])
.value('DHIS2URL', '..')
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-06-06 13:35:06 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/services.js 2014-06-17 07:48:20 +0000
@@ -15,6 +15,7 @@
currentStore: store
};
})
+
/* factory for loading logged in user profiles from DHIS2 */
.factory('CurrentUserProfile', function($http) {
@@ -381,6 +382,30 @@
return response.data.events;
});
return promise;
+ },
+ get: function(eventUid){
+ var promise = $http.get('../api/events/' + eventUid + '.json').then(function(response){
+ return response.data;
+ });
+ return promise;
+ },
+ create: function(dhis2Event){
+ var promise = $http.post('../api/events.json', dhis2Event).then(function(response){
+ return response.data;
+ });
+ return promise;
+ },
+ update: function(dhis2Event){
+ var promise = $http.put('../api/events/' + dhis2Event.event, dhis2Event).then(function(response){
+ return response.data;
+ });
+ return promise;
+ },
+ updateForSingleValue: function(singleValue){
+ var promise = $http.put('../api/events/' + singleValue.event + '/' + singleValue.dataValues[0].dataElement, singleValue ).then(function(response){
+ return response.data;
+ });
+ return promise;
}
};
})
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2014-06-15 09:15:17 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2014-06-17 07:48:20 +0000
@@ -709,6 +709,17 @@
}
}
+.expanded{
+ border: 1px solid #aaa;
+ padding: 6px 12px;
+ font-size: 14px;
+}
+/*input[type=number], input[type=text], input[type=password], textarea {
+ border: 1px solid #aaa;
+ padding: 6px 12px;
+ font-size: 14px;
+}
+
input[type=number] {
border: 1px solid #aaa;
padding: 4px 1px;
@@ -720,7 +731,8 @@
padding: 6px 12px;
font-size: 14px;
border-radius: 3px;
-}
+}*/
+
/*----------------------------------------------------------------------------*/
/* Search filters
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html 2014-06-06 13:35:06 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/home.html 2014-06-17 07:48:20 +0000
@@ -29,12 +29,12 @@
<!--- Advanced search input field begins -->
<div class="row">
<div id="searchDropDownParent" class="input-group col-md-6">
- <input type="text" placeholder="{{'your_search_input_here'| translate}}" ng-model="searchText" class="form-control" ng-class="{true: 'invalid - input'} [!searchText && emptySearchText]" ng-focus="hideSearch()" ng-disabled="showRegistrationDiv">
+ <input type="text" placeholder="{{'your_search_input_here'| translate}}" ng-model="searchText" class="form-control expanded" ng-class="{true: 'invalid - input'} [!searchText && emptySearchText]" ng-focus="hideSearch()" ng-disabled="showRegistrationDiv">
<div class="input-group-btn">
<button class="btn btn-default trim" type="button" title="{{'advanced_search'| translate}}" data-toggle="dropdown" ng-disabled="showRegistrationDiv"><i class="fa fa-caret-down"></i></button>
<div id="searchDropDown" class="dropdown-menu pull-right">
<form ng-include="'views/search.html'">
- </form>
+ </form>
</div>
</div>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html 2014-06-15 09:15:17 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/views/search.html 2014-06-17 07:48:20 +0000
@@ -43,7 +43,7 @@
<option value="1">{{'yes'| translate}}</option>
</select>
</div>
- <div ng-switch-when="combo">
+ <div ng-switch-when="optionSet">
<select multiple ui-select2 ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
<option ng-repeat="option in attribute.optionSet.options" value="{{option}}">{{option}}</option>
</select>