diff --git a/angular_app/js/app.js b/angular_app/js/app.js
index c126504..8073899 100644
--- a/angular_app/js/app.js
+++ b/angular_app/js/app.js
@@ -148,7 +148,7 @@ eventManApp.config(['$stateProvider', '$urlRouterProvider',
.state('tickets', {
url: '/tickets',
templateUrl: 'tickets-list.html',
- controller: 'EventTicketsCtrl'
+ controller: 'EventsListCtrl'
})
.state('import', {
url: '/import',
diff --git a/angular_app/js/controllers.js b/angular_app/js/controllers.js
index 71fa4cc..0bfa006 100644
--- a/angular_app/js/controllers.js
+++ b/angular_app/js/controllers.js
@@ -66,10 +66,23 @@ eventManControllers.controller('ModalConfirmInstanceCtrl', ['$scope', '$uibModal
);
-eventManControllers.controller('EventsListCtrl', ['$scope', 'Event', '$uibModal', '$log', '$translate', '$rootScope',
- function ($scope, Event, $uibModal, $log, $translate, $rootScope) {
- $scope.events = Event.all();
+eventManControllers.controller('EventsListCtrl', ['$scope', 'Event', '$uibModal', '$log', '$translate', '$rootScope', '$state',
+ function ($scope, Event, $uibModal, $log, $translate, $rootScope, $state) {
+ $scope.tickets = [];
+ $scope.events = Event.all(function(events) {
+ if (events && $state.is('tickets')) {
+ angular.forEach(events, function(evt, idx) {
+ var evt_tickets = (evt.persons || []).slice(0);
+ angular.forEach(evt_tickets, function(obj, obj_idx) {
+ obj.event_title = evt.title;
+ obj.event_id = evt._id;
+ });
+ $scope.tickets.push.apply($scope.tickets, evt_tickets || []);
+ });
+ }
+ });
$scope.eventsOrderProp = "-begin_date";
+ $scope.ticketsOrderProp = ["name", "surname"];
$scope.confirm_delete = 'Do you really want to delete this event?';
$rootScope.$on('$translateChangeSuccess', function () {
@@ -94,6 +107,25 @@ eventManControllers.controller('EventsListCtrl', ['$scope', 'Event', '$uibModal'
);
});
};
+
+ $scope.updateOrded = function(key) {
+ var new_order = [key];
+ var inv_key;
+ if (key && key[0] === '-') {
+ inv_key = key.substring(1);
+ } else {
+ inv_key = '-' + key;
+ }
+ angular.forEach($scope.ticketsOrderProp,
+ function(value, idx) {
+ if (value !== key && value !== inv_key) {
+ new_order.push(value);
+ }
+ }
+ );
+ $scope.ticketsOrderProp = new_order;
+ };
+
}]
);
diff --git a/angular_app/tickets-list.html b/angular_app/tickets-list.html
index ab4aaf2..b7416bf 100644
--- a/angular_app/tickets-list.html
+++ b/angular_app/tickets-list.html
@@ -1,66 +1,49 @@
-
+
-
{{'Persons' | translate}}
-
-
-
+ {{'All tickets' | translate}}
-
{{'Persons:' | translate}} {{persons.length || 0}}
+
{{'Tickets:' | translate}} {{tickets.length || 0}}
-
{{'Persons' | translate}}
+
{{'Tickets' | translate}}
-
# |
- {{'Person' | translate}} {{'Name' | translate}} {{'Surname' | translate}} |
-
- {{col.label | translate}}
- |
- {{'Delete' | translate}} |
+ {{'Name' | translate}} {{'Surname' | translate}} {{'Email' | translate}} |
+ {{'Event' | translate}} |
+ {{'Attended' | translate}} |
-
+
{{$index+1}} |
- {{person.name}} {{person.surname}} <{{person.email}}>
- {{person.job_title}} @ {{person.company}}
- |
-
-
-
-
-
- {{person[col.key]}}
-
+ {{ticket.name}} {{ticket.surname}} <{{ticket.email}}>
+ {{ticket.job_title}} @ {{ticket.company}}
|
-
+ {{ticket.event_title}}
+ |
+
+
|
diff --git a/eventman_server.py b/eventman_server.py
index 3db014c..a53a325 100755
--- a/eventman_server.py
+++ b/eventman_server.py
@@ -522,28 +522,6 @@ class CollectionHandler(BaseHandler):
self.logger.error('Error yielding WebSocket message: %s', e)
-class TicketsHandler(CollectionHandler):
- """Handle requests for Tickes."""
-
- @gen.coroutine
- @authenticated
- def get(self, id_=None, resource=None, resource_id=None, acl=True, **kwargs):
- query = {}
- events = self.db.query('events', {})
- persons = {}
- for event in events:
- id_ = str(event['_id'])
- title = event['title']
- for person in (event.get('persons') or []):
- email = person.get('email')
- if not email:
- continue
- if email not in persons:
- persons[email] = person
- persons[email].setdefault('events', {})[id_] = title
- self.write({'persons': persons.values()})
-
-
class PersonsHandler(CollectionHandler):
"""Handle requests for Persons."""
@@ -1018,7 +996,6 @@ def run():
_persons_path = r"/persons/?(?P[\w\d_-]+)?/?(?P[\w\d_-]+)?/?(?P[\w\d_-]+)?"
_events_path = r"/events/?(?P[\w\d_-]+)?/?(?P[\w\d_-]+)?/?(?P[\w\d_-]+)?"
_users_path = r"/users/?(?P[\w\d_-]+)?/?(?P[\w\d_-]+)?/?(?P[\w\d_-]+)?"
- _tickets_path = r"/tickets"
application = tornado.web.Application([
(_persons_path, PersonsHandler, init_params),
(r'/v%s%s' % (API_VERSION, _persons_path), PersonsHandler, init_params),
@@ -1026,8 +1003,6 @@ def run():
(r'/v%s%s' % (API_VERSION, _events_path), EventsHandler, init_params),
(_users_path, UsersHandler, init_params),
(r'/v%s%s' % (API_VERSION, _users_path), UsersHandler, init_params),
- (_tickets_path, TicketsHandler, init_params),
- (r'/v%s%s' % (API_VERSION, _tickets_path), TicketsHandler, init_params),
(r"/(?:index.html)?", RootHandler, init_params),
(r"/ebcsvpersons", EbCSVImportPersonsHandler, init_params),
(r"/settings", SettingsHandler, init_params),