Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

add support for hybrid events #54

Merged
merged 1 commit into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/app/event-display/event-display.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ <h3 translate="show-event.sold-out.header"></h3>
<div *ngFor="let category of ticketCategories;let counter = index" formArrayName="reservation">
<app-item-card [currentLang]="translate.currentLang" [item]="category" [formGroupName]="''+counter" [parentFormGroup]="reservationFormItem(reservationForm, counter)" [additionalClass]="category.accessRestricted ? 'ticket-category-restricted border-warning shadow-sm ': ''">
<span class="item-title">
{{category.name}} <span class="d-inline badge badge-warning ml-2" *ngIf="ticketsLeftCountVisibleForCategory(category)">{{"show-event.tickets.left" | translate: {'0': category.availableTickets} }}</span>
{{category.name}}
</span>
<div class="item-badges mb-2">
<span *ngIf="displayOnlineTicketTag(category)" class="badge badge-success">{{'event.online.badge' | translate}}</span>
<span class="badge badge-warning" [class.ml-2]="displayOnlineTicketTag(category)" *ngIf="ticketsLeftCountVisibleForCategory(category)">{{"show-event.tickets.left" | translate: {'0': category.availableTickets} }}</span>
</div>
<div class="item-price">
<span *ngIf="category.free" translate="common.free"></span>
<span *ngIf="!category.free">
Expand Down
4 changes: 4 additions & 0 deletions src/app/event-display/event-display.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ export class EventDisplayComponent implements OnInit {
return this.event.format == 'ONLINE';
}

public displayOnlineTicketTag(category: TicketCategory): boolean {
return this.event.format === 'HYBRID' && category.ticketAccessType === 'ONLINE';
}

get displayMap(): boolean {
return (this.event.mapUrl && this.event.mapUrl.length > 0) && !this.isEventOnline;
}
Expand Down
1 change: 1 addition & 0 deletions src/app/item-card/item-card.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ <h3 class="card-title pr-1">
<ng-content select=".item-title"></ng-content>
</h3>
<div class="card-sale-period">
<ng-content select=".item-badges"></ng-content>
<app-item-sale-period [item]="item" [currentLang]="currentLang"></app-item-sale-period>
</div>
<div class="card-item-price">
Expand Down
2 changes: 1 addition & 1 deletion src/app/model/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class PaymentProxyWithParameters {
parameters: {[key: string]: any};
}

export type EventFormat = 'IN_PERSON' | 'ONLINE';
export type EventFormat = 'IN_PERSON' | 'ONLINE' | 'HYBRID';

export type PaymentMethod = 'CREDIT_CARD' | 'PAYPAL' | 'IDEAL' | 'BANK_TRANSFER' | 'ON_SITE'
| 'APPLE_PAY' | 'BANCONTACT' | 'ING_HOME_PAY' | 'BELFIUS' | 'PRZELEWY_24' | 'KBC' | 'NONE';
Expand Down
2 changes: 2 additions & 0 deletions src/app/model/reservation-info.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Ticket } from './ticket';
import { PaymentProxy, PaymentMethod, PaymentProxyWithParameters } from './event';
import { TicketAccessType } from './ticket-category';

export class ReservationInfo {
id: string;
Expand Down Expand Up @@ -49,6 +50,7 @@ export class ReservationStatusInfo {

export class TicketsByTicketCategory {
name: string;
ticketAccessType: TicketAccessType;
tickets: Ticket[];
}

Expand Down
4 changes: 4 additions & 0 deletions src/app/model/ticket-category.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export type TicketAccessType = 'INHERIT' | 'IN_PERSON' | 'ONLINE';

export class TicketCategory {
id: number;
name: string;
ticketAccessType: TicketAccessType;
bounded: boolean;
maximumSaleableTickets: number;
description: {[key: string]: string};
Expand All @@ -23,3 +26,4 @@ export class TicketCategory {

availableTickets: number | null;
}

4 changes: 2 additions & 2 deletions src/app/reservation/success/success.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ <h3 class="card-title text-muted" *ngIf="!ticket.assigned">{{'reservation-page-c
<hr *ngIf="!ticketFormVisible">

<div class="row justify-content-end" *ngIf="!ticketFormVisible">
<div class="col-lg-3 col-sm-6 col-12 mb-2" *ngIf="!isEventOnline && ticket.assigned && !ticket.cancellationEnabled" >
<div class="col-lg-3 col-sm-6 col-12 mb-2" *ngIf="!isOnlineTicket(tc) && ticket.assigned && !ticket.cancellationEnabled" >
<a [routerLink]="['/event', event.shortName, 'ticket', ticket.uuid, 'view']" target="_blank" class="btn btn-default btn-block"><fa-icon [icon]="['fas', 'search-plus']" a11yRole="presentation"></fa-icon> {{'reservation-page-complete.show-ticket'|translate}}</a>
</div>
<div class="col-lg-3 col-sm-6 col-12 mt-2 mt-md-0 mb-2" *ngIf="!isEventOnline && ticket.assigned">
<div class="col-lg-3 col-sm-6 col-12 mt-2 mt-md-0 mb-2" *ngIf="!isOnlineTicket(tc) && ticket.assigned">
<a [attr.href]="'/api/v2/public/event/' + event.shortName + '/ticket/' + ticket.uuid + '/download-ticket'" class="btn btn-default btn-block"><fa-icon [icon]="['fas', 'download']" a11yRole="presentation"></fa-icon> {{'reservation-page-complete.download-ticket'|translate}}</a>
</div>
<div class="col-lg-3 col-sm-6 col-12 mt-2 mt-md-0 mb-2" *ngIf="ticket.assigned">
Expand Down
9 changes: 6 additions & 3 deletions src/app/reservation/success/success.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import { Event } from 'src/app/model/event';
import { EventService } from 'src/app/shared/event.service';
import { TicketService } from 'src/app/shared/ticket.service';
import { Ticket } from 'src/app/model/ticket';
import { ReservationInfo } from 'src/app/model/reservation-info';
import { ReservationInfo, TicketsByTicketCategory } from 'src/app/model/reservation-info';
import { I18nService } from 'src/app/shared/i18n.service';
import { AnalyticsService } from 'src/app/shared/analytics.service';
import { handleServerSideValidationError } from 'src/app/shared/validation-helper';
import { FormGroup } from '@angular/forms';
import { TicketCategory } from 'src/app/model/ticket-category';
import { TryCatchStmt } from '@angular/compiler';

@Component({
selector: 'app-success',
Expand Down Expand Up @@ -132,8 +134,9 @@ export class SuccessComponent implements OnInit {
&& this.reservationInfo.invoiceOrReceiptDocumentPresent;
}

get isEventOnline(): boolean {
return this.event.format == 'ONLINE';
public isOnlineTicket(category: TicketsByTicketCategory): boolean {
return this.event.format == 'ONLINE'
|| (this.event.format == 'HYBRID' && category.ticketAccessType == 'ONLINE');
}

}
6 changes: 3 additions & 3 deletions src/app/update-ticket/update-ticket.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<app-event-header [event]="event"></app-event-header>
</header>
<main class="mt-5">
<div class="alert mb-5" [ngClass]="{'alert-info': !ticket.onlineEventStarted, 'alert-success': ticket.onlineEventStarted}" *ngIf="isEventOnline && !ticketFormVisible">
<div class="alert mb-5" [ngClass]="{'alert-info': !ticket.onlineEventStarted, 'alert-success': ticket.onlineEventStarted}" *ngIf="isOnlineTicket && !ticketFormVisible">
<div class="font-weight-bold text-center">
<span *ngIf="!ticket.onlineEventStarted">{{'event.online.not-started' | translate:{ '0' : ticketOnlineCheckInDate } }}</span>
<span *ngIf="ticket.onlineEventStarted">{{'event.online.started' | translate }}</span>
Expand All @@ -21,10 +21,10 @@ <h3 class="card-title text-muted" *ngIf="!ticket.assigned">{{'reservation-page-c
<hr *ngIf="!ticketFormVisible">

<div class="row justify-content-end" *ngIf="!ticketFormVisible">
<div class="col-lg-3 col-sm-6 col-12 mb-2" *ngIf="!isEventOnline && ticket.assigned && !ticket.cancellationEnabled" >
<div class="col-lg-3 col-sm-6 col-12 mb-2" *ngIf="!isOnlineTicket && ticket.assigned && !ticket.cancellationEnabled" >
<a [routerLink]="['/event', event.shortName, 'ticket', ticket.uuid, 'view']" target="_blank" class="btn btn-default btn-block"><fa-icon [icon]="['fas', 'search-plus']" a11yRole="presentation"></fa-icon> {{'reservation-page-complete.show-ticket'|translate}}</a>
</div>
<div class="col-lg-3 col-sm-6 col-12 mt-2 mt-md-0 mb-2" *ngIf="!isEventOnline && ticket.assigned">
<div class="col-lg-3 col-sm-6 col-12 mt-2 mt-md-0 mb-2" *ngIf="!isOnlineTicket && ticket.assigned">
<a [attr.href]="'/api/v2/public/event/' + event.shortName + '/ticket/' + ticket.uuid + '/download-ticket'" class="btn btn-default btn-block"><fa-icon [icon]="['fas', 'download']" a11yRole="presentation"></fa-icon> {{'reservation-page-complete.download-ticket'|translate}}</a>
</div>
<div class="col-lg-3 col-sm-6 col-12 mt-2 mt-md-0 mb-2" *ngIf="ticket.assigned">
Expand Down
8 changes: 6 additions & 2 deletions src/app/update-ticket/update-ticket.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Ticket } from '../model/ticket';
import { handleServerSideValidationError } from '../shared/validation-helper';
import { TicketsByTicketCategory } from '../model/reservation-info';
import { TranslateService } from '@ngx-translate/core';
import { TicketAccessType, TicketCategory } from '../model/ticket-category';

@Component({
selector: 'app-update-ticket',
Expand All @@ -27,6 +28,7 @@ export class UpdateTicketComponent implements OnInit {
categoryName: string;
emailSent: boolean;
ticketFormVisible: boolean;
ticketAccessType: TicketAccessType;

constructor(
private ticketService: TicketService,
Expand Down Expand Up @@ -58,6 +60,7 @@ export class UpdateTicketComponent implements OnInit {
}

private handleTicketResponse(ticketsByCategory: TicketsByTicketCategory): void {
this.ticketAccessType = ticketsByCategory.ticketAccessType;
this.ticket = ticketsByCategory.tickets[0];
this.formGroup = this.ticketService.buildFormGroupForTicket(this.ticket);
this.categoryName = ticketsByCategory.name;
Expand Down Expand Up @@ -92,8 +95,9 @@ export class UpdateTicketComponent implements OnInit {
});
}

get isEventOnline(): boolean {
return this.event.format === 'ONLINE';
get isOnlineTicket(): boolean {
return this.event.format == 'ONLINE'
|| (this.event.format == 'HYBRID' && this.ticketAccessType == 'ONLINE');
}

get ticketOnlineCheckInDate(): string {
Expand Down