fix ticket cancellation

This commit is contained in:
Davide Alberani 2016-07-02 19:05:28 +02:00
parent a5c510de0d
commit e4fba8039d
2 changed files with 22 additions and 20 deletions

View file

@ -98,8 +98,8 @@ eventManControllers.controller('EventsListCtrl', ['$scope', 'Event', '$uibModal'
);
eventManControllers.controller('EventDetailsCtrl', ['$scope', '$state', 'Event', 'Setting', '$log', '$translate', '$rootScope', '$uibModal',
function ($scope, $state, Event, Setting, $log, $translate, $rootScope, $uibModal) {
eventManControllers.controller('EventDetailsCtrl', ['$scope', '$state', 'Event', '$log', '$translate', '$rootScope',
function ($scope, $state, Event, $log, $translate, $rootScope) {
$scope.event = {};
$scope.event.persons = [];
$scope.event.formSchema = {};
@ -130,8 +130,8 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', '$state', 'Event',
);
eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event', 'EventTicket', 'Person', 'Setting', '$log', '$translate', '$rootScope', 'EventUpdates',
function ($scope, $state, Event, EventTicket, Person, Setting, $log, $translate, $rootScope, EventUpdates) {
eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event', 'EventTicket', 'Person', 'Setting', '$log', '$translate', '$rootScope', 'EventUpdates', '$uibModal',
function ($scope, $state, Event, EventTicket, Person, Setting, $log, $translate, $rootScope, EventUpdates, $uibModal) {
$scope.personsOrder = ["name", "surname"];
$scope.countAttendees = 0;
$scope.message = {};
@ -139,7 +139,7 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event',
$scope.ticket = {};
$scope.formSchema = {};
$scope.formData = {};
$scope.dangerousActionsEnabled = false;
$scope.guiOptions = {dangerousActionsEnabled: false};
$scope.customFields = Setting.query({setting: 'person_custom_field', in_event_details: true});
$scope.formFieldsMap = {};
@ -416,9 +416,10 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event',
$scope.openQuickAddTicket = function(_id) {
var modalInstance = $uibModal.open({
templateUrl: 'modal-quick-add-ticket.html'
templateUrl: 'modal-quick-add-ticket.html',
controller: 'EventTicketsCtrl'
});
modalInstance.result.then(function(x) {
modalInstance.result.then(function() {
});
};
@ -430,6 +431,7 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event',
if (!$state.is('event.tickets')) {
$state.go('event.ticket.edit', {id: $scope.event._id, ticket_id: ticket._id});
} else if ($scope.$close) {
$scope._setAttended(person);
$scope.$close();
}
});
@ -462,8 +464,8 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event',
return;
}
$scope.ticket.cancelled = !$scope.ticket.cancelled;
$scope.updateTicket($scope.ticket, function() {
$scope.dangerousActionsEnabled = false;
$scope.setPersonAttribute($scope.ticket, 'cancelled', $scope.ticket.cancelled, function() {
$scope.guiOptions.dangerousActionsEnabled = false;
});
};
@ -619,6 +621,7 @@ eventManControllers.controller('PersonDetailsCtrl', ['$scope', '$state', 'Person
}]
);
eventManControllers.controller('LoginCtrl', ['$scope', '$rootScope', '$state', '$log', 'User',
function ($scope, $rootScope, $state, $log, User) {
$scope.loginData = {};

View file

@ -45,17 +45,16 @@
<div class="panel panel-danger table-striped top5">
<div class="panel-heading">{{'Dangerous stuff' | translate}}</div>
<div class="panel-body">
<button ng-click="dangerousActionsEnabled = !dangerousActionsEnabled" class="btn btn-warning">
<span class="fa fa-exclamation-triangle vcenter"></span>
{{'Toggle dangerous actions' | translate}}
</button>
&nbsp;
<button ng-disabled="!dangerousActionsEnabled" ng-click="toggleTicket({id: ticket._id})" class="btn btn-danger">
<span ng-class="{fa: true, 'fa-sign-out': !ticket.cancelled, 'fa-sign-in': ticket.cancelled, vcenter: true}"></span>
<span ng-if="!ticket.cancelled">{{'Leave this event' | translate}}</span>
<span ng-if="ticket.cancelled">{{'Join again this event' | translate}}</span>
</button>
<button ng-click="guiOptions.dangerousActionsEnabled = !guiOptions.dangerousActionsEnabled" class="btn btn-warning">
<span class="fa fa-exclamation-triangle vcenter"></span>
{{'Toggle dangerous actions' | translate}}
</button>
&nbsp;
<button ng-disabled="!guiOptions.dangerousActionsEnabled" ng-click="toggleTicket({id: ticket._id})" class="btn btn-danger">
<span ng-class="{fa: true, 'fa-sign-out': !ticket.cancelled, 'fa-sign-in': ticket.cancelled, vcenter: true}"></span>
<span ng-if="!ticket.cancelled">{{'Leave this event' | translate}}</span>
<span ng-if="ticket.cancelled">{{'Join again this event' | translate}}</span>
</button>
</div>
</div>
</div>