fixes #166: introduce pagination for tickets

This commit is contained in:
Davide Alberani 2017-04-02 13:59:45 +02:00
parent d201ba8fa8
commit 55208639d4
3 changed files with 16 additions and 12 deletions

View file

@ -31,7 +31,7 @@
</div>&nbsp;<label>&nbsp;<input type="checkbox" ng-model="registeredFilterOptions.all" /> {{'Show cancelled tickets' | translate}}</label> </div>&nbsp;<label>&nbsp;<input type="checkbox" ng-model="registeredFilterOptions.all" /> {{'Show cancelled tickets' | translate}}</label>
</form> </form>
<pagination ng-model="currentPage" total-items="filteredLength" items-per-page="itemsPerPage" <pagination ng-model="currentPage" total-items="filteredLength" items-per-page="itemsPerPage"
boundary-links="true" boundary-link-numbers="true" max-size="maxPaginationSize"> direction-links="false" boundary-links="true" boundary-link-numbers="true" max-size="maxPaginationSize">
</pagination> </pagination>
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -75,7 +75,7 @@
</tbody> </tbody>
</table> </table>
<pagination ng-model="currentPage" total-items="filteredLength" items-per-page="itemsPerPage" <pagination ng-model="currentPage" total-items="filteredLength" items-per-page="itemsPerPage"
boundary-links="true" boundary-link-numbers="true" max-size="maxPaginationSize"> direction-links="false" boundary-links="true" boundary-link-numbers="true" max-size="maxPaginationSize">
</pagination> </pagination>
</div> </div>
</div> </div>
@ -93,7 +93,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="person in (query ? allPersons : []) | splittedFilter:query | personRegistered:{event: event, present: false}"> <tr ng-repeat="person in (query ? allPersons : []) | splittedFilter:query | personRegistered:{event: event, present: false} | limitTo:10>
<td> <td>
<strong>{{person.name}} {{person.surname}}</strong> <strong>{{person.name}} {{person.surname}}</strong>
<br /> <br />

View file

@ -88,9 +88,9 @@ eventManControllers.controller('EventsListCtrl', ['$scope', 'Event', '$uibModal'
$scope.shownItems = []; $scope.shownItems = [];
$scope.currentPage = 1; $scope.currentPage = 1;
$scope.itemsPerPage = 20; $scope.itemsPerPage = 10;
$scope.filteredLength = 0; $scope.filteredLength = 0;
$scope.maxPaginationSize = 5; $scope.maxPaginationSize = 10;
$scope.filterTickets = function() { $scope.filterTickets = function() {
var tickets = $scope.tickets || []; var tickets = $scope.tickets || [];
@ -210,11 +210,13 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event',
$scope.guiOptions = {dangerousActionsEnabled: false}; $scope.guiOptions = {dangerousActionsEnabled: false};
$scope.customFields = Setting.query({setting: 'ticket_custom_field', in_event_details: true}); $scope.customFields = Setting.query({setting: 'ticket_custom_field', in_event_details: true});
$scope.registeredFilterOptions = {all: false}; $scope.registeredFilterOptions = {all: false};
$scope.formFieldsMap = {};
$scope.formFieldsMapRev = {};
$scope.currentPage = 1; $scope.currentPage = 1;
$scope.itemsPerPage = 20; $scope.itemsPerPage = 10;
$scope.filteredLength = 0; $scope.filteredLength = 0;
$scope.maxPaginationSize = 5; $scope.maxPaginationSize = 10;
$scope.filterTickets = function() { $scope.filterTickets = function() {
var tickets = $scope.event.tickets || []; var tickets = $scope.event.tickets || [];
@ -233,12 +235,13 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event',
$scope.filterTickets(); $scope.filterTickets();
}); });
$scope.$watch('currentPage + itemsPerPage', function() { $scope.$watch('registeredFilterOptions', function() {
$scope.filterTickets(); $scope.filterTickets();
}); });
$scope.formFieldsMap = {}; $scope.$watch('currentPage + itemsPerPage', function() {
$scope.formFieldsMapRev = {}; $scope.filterTickets();
});
if ($state.params.id) { if ($state.params.id) {
$scope.event = Event.get({id: $state.params.id}, function(data) { $scope.event = Event.get({id: $state.params.id}, function(data) {
@ -642,6 +645,7 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event',
} }
); );
$scope.ticketsOrder = new_order; $scope.ticketsOrder = new_order;
$scope.filterTickets();
}; };
$scope.showMessage = function(cfg) { $scope.showMessage = function(cfg) {

View file

@ -16,7 +16,7 @@
</form> </form>
<pagination ng-model="currentPage" total-items="filteredLength" items-per-page="itemsPerPage" <pagination ng-model="currentPage" total-items="filteredLength" items-per-page="itemsPerPage"
boundary-links="true" boundary-link-numbers="true" max-size="maxPaginationSize"> direction-links="false" boundary-links="true" boundary-link-numbers="true" max-size="maxPaginationSize">
</pagination> </pagination>
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -44,7 +44,7 @@
</tbody> </tbody>
</table> </table>
<pagination ng-model="currentPage" total-items="filteredLength" items-per-page="itemsPerPage" <pagination ng-model="currentPage" total-items="filteredLength" items-per-page="itemsPerPage"
boundary-links="true" boundary-link-numbers="true" max-size="maxPaginationSize"> direction-links="false" boundary-links="true" boundary-link-numbers="true" max-size="maxPaginationSize">
</pagination> </pagination>
</div> </div>
</div> </div>