From 24d6689abe75d5afd347d42cd9a861aed126dde6 Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sun, 10 Jul 2016 09:35:55 +0200 Subject: [PATCH] more consistent GUI --- angular_app/event-tickets.html | 39 ++++++++++++--------------------- angular_app/events-list.html | 4 ++-- angular_app/import-persons.html | 9 ++++---- angular_app/index.html | 2 +- angular_app/js/controllers.js | 23 +++++++++++-------- angular_app/js/services.js | 12 +++++++--- angular_app/ticket-edit.html | 2 +- eventman_server.py | 7 +++--- 8 files changed, 48 insertions(+), 50 deletions(-) diff --git a/angular_app/event-tickets.html b/angular_app/event-tickets.html index 62c0cb2..98abbb4 100644 --- a/angular_app/event-tickets.html +++ b/angular_app/event-tickets.html @@ -3,43 +3,32 @@
-
-

{{event.title}} +
+
+
+

{{event.title}} - {{'tickets' | translate}}   + + {{'Attendees:' | translate}} {{countAttendees}} +   + {{'Registered:' | translate}} {{((event.tickets || []) | registeredFilter).length}} +

-
-
-
-

{{'Registered:' | translate}} {{((event.tickets || []) | registeredFilter).length}}

-
-

{{'Attendees:' | translate}} {{countAttendees}}

-
-
-
-
-
- -
-
-
-
-
{{'tickets' | translate}}
-
+
  @@ -54,7 +43,7 @@ - +
{{$index+1}} @@ -88,7 +77,7 @@
-
{{'Unregistered persons' | translate}}
+

{{'Unregistered persons' | translate}}

diff --git a/angular_app/events-list.html b/angular_app/events-list.html index 7dfb6e8..1ca4ea6 100644 --- a/angular_app/events-list.html +++ b/angular_app/events-list.html @@ -4,7 +4,7 @@

{{'Events' | translate}}

@@ -52,7 +52,7 @@
diff --git a/angular_app/import-persons.html b/angular_app/import-persons.html index 74d8c41..556fc9a 100644 --- a/angular_app/import-persons.html +++ b/angular_app/import-persons.html @@ -1,20 +1,19 @@ - +
-

{{'Import persons' | translate}}

-
{{'Import persons from eventbrite CSV' | translate}}
+

{{'Import tickets from Eventbrite CSV' | translate}}

-

{{'CSV exported from eventbrite' | translate}}

+

{{'CSV exported from Eventbrite' | translate}}

- + diff --git a/angular_app/index.html b/angular_app/index.html index f091851..76d2c7e 100644 --- a/angular_app/index.html +++ b/angular_app/index.html @@ -73,8 +73,8 @@
diff --git a/angular_app/js/controllers.js b/angular_app/js/controllers.js index c54ddcc..5657493 100644 --- a/angular_app/js/controllers.js +++ b/angular_app/js/controllers.js @@ -172,12 +172,14 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event', $scope.countAttendees = 0; $scope.message = {}; $scope.event = {}; + $scope.event.tickets = []; $scope.ticket = {}; // current ticket, for the event.ticket.* states $scope.tickets = []; // list of all tickets, for the 'tickets' state $scope.formSchema = {}; $scope.formData = {}; $scope.guiOptions = {dangerousActionsEnabled: false}; $scope.customFields = Setting.query({setting: 'ticket_custom_field', in_event_details: true}); + $scope.registeredFilterOptions = {all: true}; $scope.formFieldsMap = {}; $scope.formFieldsMapRev = {}; @@ -186,10 +188,11 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event', $scope.event = Event.get({id: $state.params.id}, function(data) { $scope.$watchCollection(function() { return $scope.event.tickets; - }, function(prev, old) { + }, function(new_collection, old_collection) { $scope.calcAttendees(); } ); + if (!(data && data.formSchema)) { return; } @@ -219,7 +222,7 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event', $scope.EventUpdates.open(); $scope.$watchCollection(function() { return $scope.EventUpdates.data; - }, function(prev, old) { + }, function(new_collection, old_collection) { if (!($scope.EventUpdates.data && $scope.EventUpdates.data.update)) { return; } @@ -280,7 +283,7 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event', $scope.event.tickets = []; } var ticket_idx = $scope.event.tickets.findIndex(function(el, idx, array) { - return ticket._id == el._id; + return ticket._id == el._id; }); if (ticket_idx != -1) { $log.warn('ticket already present: not added'); @@ -289,7 +292,7 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event', $scope.event.tickets.push(ticket); } - // Try to remove this person from the allPersons list using ID or email. + // Try to remove this person from the allPersons list using ID of the original entry or email. var field = null; var field_value = null; if (original_ticket && original_ticket._id) { @@ -340,6 +343,7 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event', } var removed_person = $scope.event.tickets.splice(ticket_idx, 1); // to be used to populate allPersons, if needed. + var person = null; if (removed_person.length) { person = removed_person[0]; } else { @@ -413,16 +417,17 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event', $scope.addTicket = function(ticket) { ticket.event_id = $state.params.id; - EventTicket.add(ticket, function(ticket) { + EventTicket.add(ticket, function(ret_ticket) { $log.debug('addTicket'); - $log.debug(ticket); - $scope._localAddTicket(ticket, ticket); + $log.debug(ret_ticket); + $scope._localAddTicket(ret_ticket, ticket); if (!$state.is('event.tickets')) { - $state.go('event.ticket.edit', {id: $scope.event._id, ticket_id: ticket._id}); + $state.go('event.ticket.edit', {id: $scope.event._id, ticket_id: ret_ticket._id}); } else { $scope.query = ''; - $scope._setAttended(ticket); + $scope._setAttended(ret_ticket); if ($scope.$close) { + // Close the Quick ticket modal. $scope.$close(); } } diff --git a/angular_app/js/services.js b/angular_app/js/services.js index 3acb671..b44749c 100644 --- a/angular_app/js/services.js +++ b/angular_app/js/services.js @@ -84,9 +84,6 @@ eventManServices.factory('EventTicket', ['$resource', '$rootScope', isArray: true, transformResponse: function(data, headers) { data = angular.fromJson(data); - if (data.error) { - return data; - } return data.tickets; } }, @@ -97,6 +94,9 @@ eventManServices.factory('EventTicket', ['$resource', '$rootScope', interceptor : {responseError: $rootScope.errorHandler}, transformResponse: function(data, headers) { data = angular.fromJson(data); + if (data.error) { + return data; + } return data.ticket; } }, @@ -109,6 +109,9 @@ eventManServices.factory('EventTicket', ['$resource', '$rootScope', params: {uuid: $rootScope.app_uuid}, transformResponse: function(data, headers) { data = angular.fromJson(data); + if (data.error) { + return data; + } return data.ticket; } }, @@ -120,6 +123,9 @@ eventManServices.factory('EventTicket', ['$resource', '$rootScope', url: 'events/:event_id/tickets/:ticket_id', params: {uuid: $rootScope.app_uuid}, transformResponse: function(data, headers) { + if (data.error) { + return data; + } return angular.fromJson(data); } }, diff --git a/angular_app/ticket-edit.html b/angular_app/ticket-edit.html index 3d6a221..76319d7 100644 --- a/angular_app/ticket-edit.html +++ b/angular_app/ticket-edit.html @@ -17,7 +17,7 @@ {{'Event details' | translate}}    
- +