Skip to content

Commit

Permalink
#18 add search and manual check in function for the table: second ste…
Browse files Browse the repository at this point in the history
…p for enabling the manual check in
  • Loading branch information
syjer committed Apr 6, 2015
1 parent 6b5a721 commit a1dd088
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/main/java/alfio/controller/api/admin/CheckInApiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,22 @@ public TicketAndCheckInResult checkIn(@PathVariable("eventId") int eventId, @Pat
}
return new TicketAndCheckInResult(optionally(() -> ticketRepository.findByUUID(ticketIdentifier)).orElse(null), status);
}

@RequestMapping(value = "/check-in/{eventId}/ticket/{ticketIdentifier}/manual-check-in", method = POST)
public boolean manualCheckIn(@PathVariable("eventId") int eventId, @PathVariable("ticketIdentifier") String ticketIdentifier) {
log.warn("for event id : {} and ticket : {}, a manual check in has been done", eventId, ticketIdentifier);

Optional<Ticket> ticket = optionally(() -> ticketRepository.findByUUID(ticketIdentifier));
return ticket.map((t) -> {

if(t.getStatus() == TicketStatus.TO_BE_PAID) {
checkInManager.acquire(ticketIdentifier);
}

checkInManager.checkIn(ticketIdentifier);
return true;
}).orElse(false);
}

@RequestMapping(value = "/check-in/{eventId}/ticket/{ticketIdentifier}/confirm-on-site-payment", method = POST)
public OnSitePaymentConfirmation confirmOnSitePayment(@PathVariable("eventId") int eventId, @PathVariable("ticketIdentifier") String ticketIdentifier) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ <h2>Scan the ticket for event {{event.shortName}}</h2>
<h2>Tickets to be checked in <button data-ng-click="reloadTickets()" class="btn btn-default" type="button"><i class="fa fa-refresh "></i> Refresh</button></h2>
</div>
<div>
<div class="input-group wMarginBottom">
<div class="input-group-addon"><i class="fa fa-search"></i></div>
<input type="text" class="form-control input-sm" data-ng-model="selection.freeText">
</div>
<table class="table check-in-data">
<thead>
<th>Status</th>
Expand All @@ -29,9 +33,10 @@ <h2>Tickets to be checked in <button data-ng-click="reloadTickets()" class="btn
<th>Payment Type</th>
<th>Transaction id</th>
<th>Transaction timestamp</th>
<th data-ng-if="filterResult.length == 1">Manual Check-In</th>
</thead>
<tbody>
<tr data-ng-repeat="ticket in tickets | filter: toBeCheckedIn | orderBy: ['timestamp', 'ticketReservationId' , 'uuid']">
<tr data-ng-repeat="ticket in tickets | filter: toBeCheckedIn | filter: selection.freeText |orderBy: ['timestamp', 'ticketReservationId' , 'uuid'] as filterResult">
<td data-ng-class-even="'active'" data-label="Status">{{::ticket.status | statusText}}</td>
<td data-ng-class-even="'active'" data-label="Holder's name">{{::ticket.fullName}}</td>
<td data-ng-class-even="'active'" data-label="Holder's e-mail">{{::ticket.email}}</td>
Expand All @@ -43,6 +48,7 @@ <h2>Tickets to be checked in <button data-ng-click="reloadTickets()" class="btn
<td data-ng-class-even="'active'" data-label="Payment Type">{{::ticket.ticketReservation.paymentMethod}}</td>
<td data-ng-class-even="'active'" data-label="Transaction id"><span data-ng-if="ticket.paid">{{::ticket.transaction.id}}</span></td>
<td data-ng-class-even="'active'" data-label="Transaction timestamp"><span data-ng-if="ticket.paid">{{::ticket.transactionTimestamp | formatDate:'DD.MM.YYYY HH:mm:ss'}}</span></td>
<td data-ng-class-even="'active'" data-label="Manual Check-In" data-ng-if="filterResult.length == 1"><button type="button" class="btn btn-primary btn-xs" data-ng-click="manualCheckIn(ticket)">Check-In</button></td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,8 @@

admin.controller('EventCheckInController', function($scope, $stateParams, $timeout, $log, $state, EventService, CheckInService) {

$scope.selection = {};

$scope.goToScanPage = function() {
$state.go('events.checkInScan', $stateParams);
};
Expand All @@ -729,6 +731,11 @@
});
};

$scope.manualCheckIn = function(ticket) {
CheckInService.manualCheckIn(ticket).then($scope.reloadTickets).then(function() {
$scope.selection = {};
});
}
});

admin.controller('EventCheckInScanController', function($scope, $stateParams, $timeout, $log, $state, EventService, CheckInService) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/webapp/resources/js/admin/service/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@
var ticketIdentifier = ticket.code.split('/')[0];
return $http['post']('/admin/api/check-in/' + eventId + '/ticket/' + ticketIdentifier, ticket);
},

manualCheckIn: function(ticket) {
return $http['post']('/admin/api/check-in/' + ticket.eventId + '/ticket/' + ticket.uuid + '/manual-check-in', ticket);
},

confirmPayment: function(eventId, ticket) {
var ticketIdentifier = ticket.code.split('/')[0];
Expand Down

0 comments on commit a1dd088

Please sign in to comment.