order by in suggestion pages

This commit is contained in:
Michele Artini 2021-06-24 15:51:25 +02:00
parent 0f43e31025
commit 3450f2764e
3 changed files with 44 additions and 9 deletions

View File

@ -27,13 +27,22 @@
<table class="table table-sm table-hover" ng-if="duplicates.length > 0">
<thead class="thead-light">
<tr class="d-flex">
<th class="col-8">Organization</th>
<th class="col-3">Place</th>
<th class="col-1 text-right"># pending duplicates</th>
<th class="col-8">
<a href="javascript:void(0)" ng-click="sortBy('name')">Organization</a>
<i ng-show="sortProperty=='name'" ng-class="{'fas fa-chevron-up': sortReverse, 'fas fa-chevron-down': !sortReverse }"></i>
</th>
<th class="col-3">
<a href="javascript:void(0)" ng-click="sortBy('city')">Place</a>
<i ng-show="sortProperty=='city'" ng-class="{'fas fa-chevron-up': sortReverse, 'fas fa-chevron-down': !sortReverse }"></i>
</th>
<th class="col-1 text-right">
<a href="javascript:void(0)" ng-click="sortBy('numberOfDuplicates')"># pending duplicates</a>
<i ng-show="sortProperty=='numberOfDuplicates'" ng-class="{'fas fa-chevron-up': sortReverse, 'fas fa-chevron-down': !sortReverse }"></i>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="d in duplicates | filter:duplicateFilter" class="d-flex">
<tr ng-repeat="d in duplicates | filter:duplicateFilter | orderBy:sortProperty:sortReverse" class="d-flex">
<td class="col-8">
<a href="javascript:void(0)" title="{{d.id}}" ng-click="prepareDuplicatesModal(d)" data-toggle="modal" data-target="#duplicatesModal">{{d.name}}</a>
<a href="#!/edit/0/{{d.id}}" title="edit"><i class="fa fa-edit"></i></a>

View File

@ -25,14 +25,26 @@
<table class="table table-sm table-hover" ng-if="orgs.length > 0">
<thead class="thead-light">
<tr class="d-flex">
<th class="col-6">Organization name</th>
<th class="col-4">Place</th>
<th class="col-1 text-center">Acronyms</th>
<th class="col-1 text-right">Type</th>
<th class="col-6">
<a href="javascript:void(0)" ng-click="sortBy('name')">Organization name</a>
<i ng-show="sortProperty=='name'" ng-class="{'fas fa-chevron-up': sortReverse, 'fas fa-chevron-down': !sortReverse }"></i>
</th>
<th class="col-4">
<a href="javascript:void(0)" ng-click="sortBy('city')">Place</a>
<i ng-show="sortProperty=='city'" ng-class="{'fas fa-chevron-up': sortReverse, 'fas fa-chevron-down': !sortReverse }"></i>
</th>
<th class="col-1 text-center">
<a href="javascript:void(0)" ng-click="sortBy('acronyms')">Acronyms</a>
<i ng-show="sortProperty=='acronyms'" ng-class="{'fas fa-chevron-up': sortReverse, 'fas fa-chevron-down': !sortReverse }"></i>
</th>
<th class="col-1 text-right">
<a href="javascript:void(0)" ng-click="sortBy('type')">Type</a>
<i ng-show="sortProperty=='type'" ng-class="{'fas fa-chevron-up': sortReverse, 'fas fa-chevron-down': !sortReverse }"></i>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="o in orgs | filter:orgFilter" class="d-flex">
<tr ng-repeat="o in orgs | filter:orgFilter | orderBy:sortProperty:sortReverse" class="d-flex">
<td class="col-6">
<a href="#!/edit/0/{{o.id}}" title="{{o.id}}">{{o.name}}</a>
</td>

View File

@ -581,6 +581,8 @@ orgsModule.controller('pendingOrgsCtrl', function ($scope, $http, $routeParams,
$scope.loading = true;
$scope.orgs = [];
$scope.country = $routeParams.country;
$scope.sortProperty = 'name';
$scope.sortReverse = false;
$scope.getInfo = function() {
suggestionInfo.updateInfo(function(info) {
@ -596,6 +598,11 @@ orgsModule.controller('pendingOrgsCtrl', function ($scope, $http, $routeParams,
});
};
$scope.sortBy = function(sortProperty) {
$scope.sortReverse = ($scope.sortProperty == sortProperty) ? !$scope.sortReverse : false;
$scope.sortProperty = sortProperty;
};
$scope.refresh = function() {
$scope.orgs = [];
$scope.loading = true;
@ -616,6 +623,8 @@ orgsModule.controller('duplicatesCtrl', function ($scope, $http, $routeParams, $
$scope.country = $routeParams.country;
$scope.currentOrg = {};
$scope.currentOrgDetails = {};
$scope.sortProperty = 'name';
$scope.sortReverse = false;
$scope.prepareDuplicatesModal = function(org) {
$scope.currentOrg = org;
@ -665,6 +674,11 @@ orgsModule.controller('duplicatesCtrl', function ($scope, $http, $routeParams, $
});
};
$scope.sortBy = function(sortProperty) {
$scope.sortReverse = ($scope.sortProperty == sortProperty) ? !$scope.sortReverse : false;
$scope.sortProperty = sortProperty;
};
$scope.refresh = function() {
$scope.duplicates = [];
$scope.loading = true;