dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36839
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18834: tracker-capture: some UI improvments when registering relationship
------------------------------------------------------------
revno: 18834
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-04-08 17:56:10 +0200
message:
tracker-capture: some UI improvments when registering relationship
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/add-relationship.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/tei.html
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/relationship/add-relationship.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/add-relationship.html 2015-03-10 08:57:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/add-relationship.html 2015-04-08 15:56:10 +0000
@@ -59,23 +59,35 @@
</table>
</div>
<div class='relationship-container' ng-show="!teiForRelationship">
- <select ng-model="selectedRelationshipSource.value"
- class="form-control"
- ng-change='getRelative()'
- ng-options="relationshipSource | translate for relationshipSource in relationshipSources">
- <option value="">{{'please_select_source'| translate}}</option>
- </select>
- <div class="input-group vertical-spacing" ng-if="selectedRelationshipSource.value === 'search_from_existing'">
- <input type="text" placeholder="{{'type_your_search_criteria_here'| translate}}" ng-model="searchText.value" d2-enter="search(searchMode.freeText)" class="form-control expanded" ng-class="{true: 'invalid - input'} [!searchText && emptySearchText]" ng-focus="showHideSearch(true)">
- <div class="input-group-btn">
- <button class="btn btn-default without-border-radius trim" type="button" title="{{'advanced_search'| translate}}" ng-click="showHideSearch(false)"><i class="fa fa-caret-down"></i></button>
- <button class="btn btn-primary trim" type="button" title="{{'search'| translate}}" ng-click="search(searchMode.freeText)"><i class="fa fa-search"></i></button>
- </div>
+
+ <div class="row">
+
+ <div class="col-sm-4 vertical-spacing">
+ <select ng-model="selectedProgramForRelative"
+ class="form-control"
+ ng-disabled="programs.length < 1 || (selectedProgramForRelative && selectedProgram.relatedProgram && relatedProgramRelationship)"
+ ng-options="program as program.name for program in programs | orderBy: 'name'">
+ <option value="">{{'please_select_a_program'| translate}}</option>
+ </select>
+ </div>
+
+ <div class="input-group col-sm-8 vertical-spacing">
+ <input type="text" placeholder="{{'type_your_search_criteria_here'| translate}}" ng-model="searchText.value" d2-enter="search(searchMode.freeText)" class="form-control expanded" ng-class="{true: 'invalid - input'} [!searchText && emptySearchText]" ng-focus="showHideSearch(true)">
+ <div class="input-group-btn">
+ <button class="btn btn-default without-border-radius trim" type="button" title="{{'advanced_search'| translate}}" ng-click="showHideSearch(false)"><i class="fa fa-caret-down"></i></button>
+ <button class="btn btn-primary without-border-radius trim" type="button" title="{{'search'| translate}}" ng-click="search(searchMode.freeText)"><i class="fa fa-search"></i></button>
+ <button class="btn btn-info without-border-radius trim" type="button" title="{{'list_all'| translate}}" ng-disabled="showRegistrationDiv" ng-click="search(searchMode.listAll)"><i class="fa fa-list"></i></button>
+ <button class="btn btn-success trim" type="button" title="{{'register'| translate}}" ng-click="showRegistration()"><i class="fa fa-user-plus"></i></button>
+ </div>
+ </div>
+
</div>
- <div ng-if="showSearchDiv && selectedRelationshipSource.value === 'search_from_existing'">
+
+ <div ng-if="showAdvancedSearchDiv">
<div ng-include="'components/relationship/search.html'"></div>
<span> </span>
</div>
+
<!-- entity grid begins -->
<div class="row" ng-if="showTrackedEntityDiv">
<img class="col-md-12" src="../images/ajax-loader-bar.gif" ng-if="!teiFetched"/>
@@ -91,7 +103,7 @@
</div>
<!--- Error display for search ends -->
- <div ng-show="selectedRelationshipSource.value === 'register_new'">
+ <div ng-show="showRegistrationDiv">
<div ng-include="'components/relationship/registration.html'"></div>
<span> </span>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html 2015-02-24 13:10:51 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/registration.html 2015-04-08 15:56:10 +0000
@@ -1,15 +1,7 @@
-<div ng-controller="RelativeRegistrationController" class="modal-dialog">
- <hr>
-
+<div ng-controller="RelativeRegistrationController">
+
<form name="outerForm" novalidate>
- <select ng-model="selectedProgramForRelative"
- class="form-control"
- ng-disabled="programs.length < 1 || (selectedProgramForRelative && selectedProgram.relatedProgram && relatedProgramRelationship)"
- ng-options="program as program.name for program in programs | orderBy: 'name'">
- <option value="">{{'please_select_a_program'| translate}}</option>
- </select>
-
<div ng-if='!selectedProgramForRelative'>
<h3>{{'category' | translate}}</h3>
<table class="table-borderless table-striped">
@@ -153,7 +145,7 @@
<div class="vertical-spacing">
<button type="button" class="btn btn-primary" ng-click="registerEntity()">{{'register'| translate}}</button>
- <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="resetRelationshipSource()">{{'cancel'| translate}}</button>
+ <button type="button" class="btn btn-default small-horizonal-spacing" ng-click="showRegistration()">{{'cancel'| translate}}</button>
</div>
</form>
</div>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2015-03-30 10:40:41 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2015-04-08 15:56:10 +0000
@@ -171,6 +171,7 @@
.controller('AddRelationshipController',
function($scope,
$rootScope,
+ $timeout,
CurrentSelection,
OperatorFactory,
AttributesFactory,
@@ -194,7 +195,6 @@
$scope.programs = selections.prs;
$scope.relationshipSources = ['search_from_existing','register_new'];
- $scope.selectedRelationshipSource = {};
$scope.selectedRelationship = {};
$scope.relationship = {};
@@ -246,8 +246,27 @@
$scope.attributes = atts;
$scope.attributes = $scope.generateAttributeFilters($scope.attributes);
$scope.gridColumns = $scope.generateGridColumns($scope.attributes);
+
+ resetFields();
+ $scope.search($scope.searchMode.listAll);
});
+ function resetFields(){
+ $scope.teiForRelationship = null;
+ $scope.teiFetched = false;
+ $scope.emptySearchText = false;
+ $scope.emptySearchAttribute = false;
+ $scope.showAdvancedSearchDiv = false;
+ $scope.showRegistrationDiv = false;
+ $scope.showTrackedEntityDiv = false;
+ $scope.trackedEntityList = null;
+ $scope.teiCount = null;
+
+ $scope.queryUrl = null;
+ $scope.programUrl = null;
+ $scope.attributeUrl = {url: null, hasValue: false};
+ }
+
//set attributes as per selected program
$scope.setAttributesForSearch = function(program){
@@ -272,13 +291,10 @@
$scope.selectedOuMode = $scope.ouModes[0];
//Paging
- $scope.pager = {pageSize: 50, page: 1, toolBarDisplay: 5};
-
- //EntityList
- $scope.showTrackedEntityDiv = false;
+ $scope.pager = {pageSize: 50, page: 1, toolBarDisplay: 5};
//Searching
- $scope.showSearchDiv = false;
+ $scope.showAdvancedSearchDiv = false;
$scope.searchText = {value: null};
$scope.emptySearchText = false;
$scope.searchFilterExists = false;
@@ -294,33 +310,8 @@
$scope.$on('relationship', function() {
var relationshipInfo = CurrentSelection.getRelationshipInfo();
$scope.teiForRelationship = relationshipInfo.tei;
- });
-
- var resetFields = function(){
- $scope.teiForRelationship = null;
- $scope.teiFetched = false;
- $scope.emptySearchText = false;
- $scope.emptySearchAttribute = false;
- $scope.showSearchDiv = false;
- $scope.showRegistrationDiv = false;
- $scope.showTrackedEntityDiv = false;
- $scope.trackedEntityList = null;
- $scope.teiCount = null;
-
- $scope.queryUrl = null;
- $scope.programUrl = null;
- $scope.attributeUrl = {url: null, hasValue: false};
- };
-
- $scope.getRelative = function(){
-
- resetFields();
-
- if($scope.selectedRelationshipSource.value === $scope.relationshipSources[0]){
- $scope.search($scope.searchMode.listAll);
- }
- };
-
+ });
+
$scope.search = function(mode){
resetFields();
@@ -340,8 +331,8 @@
$scope.teiCount = null;
return;
}
-
- $scope.queryUrl = 'query=' + $scope.searchText.value;
+
+ $scope.queryUrl = 'query=LIKE:' + $scope.searchText.value;
}
if( $scope.selectedSearchMode === $scope.searchMode.attributeBased ){
@@ -356,10 +347,10 @@
}
}
- $scope.doSearch();
+ $scope.fetchTei();
};
- $scope.doSearch = function(){
+ $scope.fetchTei = function(){
//get events for the specified parameters
TEIService.search($scope.selectedOrgUnit.id,
@@ -443,12 +434,33 @@
$scope.showHideSearch = function(simpleSearch){
if(simpleSearch){
- $scope.showSearchDiv = false;
- }
- else{
- $scope.showSearchDiv = !$scope.showSearchDiv;
+ $scope.showAdvancedSearchDiv = false;
+ }
+ else{
+ $scope.showAdvancedSearchDiv = !$scope.showAdvancedSearchDiv;
+ }
+
+ if($scope.showAdvancedSearchDiv){
+ $scope.showTrackedEntityDiv = false;
+ }
+ else{
+ $scope.showTrackedEntityDiv = true;
+ }
+ };
+
+ $scope.showRegistration = function(){
+ $scope.showRegistrationDiv = !$scope.showRegistrationDiv;
+
+ if($scope.showRegistrationDiv){
+ $scope.showTrackedEntityDiv = false;
+ /*$timeout(function() {
+ $rootScope.$broadcast('registrationWidget', {registrationMode: 'RELATIONSHIP'});
+ }, 100);*/
+ }
+ else{
+ $scope.showTrackedEntityDiv = true;
}
- };
+ };
$scope.close = function () {
$modalInstance.close($scope.selectedTei.relationships ? $scope.selectedTei.relationships : []);
@@ -648,10 +660,6 @@
});
};
- $scope.resetRelationshipSource = function(){
- $scope.selectedRelationshipSource.value = '';
- };
-
$scope.broadCastSelections = function(){
if($scope.tei){
angular.forEach($scope.tei.attributes, function(att){
@@ -661,7 +669,7 @@
$scope.tei.orgUnitName = $scope.selectedOrgUnit.name;
$scope.tei.created = DateUtils.formatFromApiToUser(new Date());
- CurrentSelection.setRelationshipInfo({tei: $scope.tei, src: $scope.selectedRelationshipSource});
+ CurrentSelection.setRelationshipInfo({tei: $scope.tei});
$timeout(function() {
$rootScope.$broadcast('relationship', {});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/tei.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/tei.html 2014-07-04 14:36:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/tei.html 2015-04-08 15:56:10 +0000
@@ -13,7 +13,7 @@
<!-- entity begins -->
<div class="vertical-spacing">
- <table class="table table-striped dhis2-table-hover">
+ <table class="table table-striped dhis2-table-hover table-bordered">
<thead>
<tr>
<th ng-show="gridColumn.show" ng-repeat="gridColumn in gridColumns">
=== 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 2015-03-19 10:18:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css 2015-04-08 15:56:10 +0000
@@ -830,6 +830,10 @@
border-color: #d1d1d1;
}
+.without-border-radius{
+ border-radius: 0;
+}
+
.dropdown-menu-right{
right: 0;
left: auto;