- @if (ticketValidity() == TicketValidity.Valid) {
-
![Ticket Valid]()
-
Valid
- } @else {
-
![Ticket Invalid]()
-
Invalid
+@if (ticketSearch$() != null) {
+
+
+
+
+
![]()
+
{{getValidityText()}}
+
+ @if(ticketValidity() === TicketValidity.Valid) {
+
+
![]()
+
{{getTypeText()}}
+
+ @if(IsSeasonTicket(ticketType())) {
+

+
Seasonal
+ }
}
- @if (ticketValidity() == TicketValidity.Valid) {
-
- @switch (ticketType()){
- @case (TicketTypeEnum.Family) {
-
![Family]()
-
Family
- }
- @case (TicketTypeEnum.FamilySeason) {
-
![Family]()
-
Family
- }
- @case (TicketTypeEnum.Single) {
-
![Single]()
-
Single
- }
- @case (TicketTypeEnum.SingleSeason) {
-
![Single]()
-
Single
- }
- @case (TicketTypeEnum.Senior) {
-
![Senior]()
-
Senior
- }
- @case (TicketTypeEnum.SeniorSeason) {
-
![Senior]()
-
Senior
- }
- }
-
-
- @if (ticketType() !== TicketTypeEnum.FamilySeason) {
-
![Family]()
-
Season
- }
- @if (ticketType() !== TicketTypeEnum.SingleSeason) {
-
![Single]()
-
Season
- }
- @if (ticketType() !== TicketTypeEnum.SeniorSeason) {
-
![Single]()
-
Season
- }
-
- }
}
diff --git a/source/ticketUI/src/app/components/scan-result/scan-result.component.ts b/source/ticketUI/src/app/components/scan-result/scan-result.component.ts
index 583c66c..9eb571a 100644
--- a/source/ticketUI/src/app/components/scan-result/scan-result.component.ts
+++ b/source/ticketUI/src/app/components/scan-result/scan-result.component.ts
@@ -1,14 +1,11 @@
import {Component, inject} from '@angular/core';
import {TicketValidity} from '../../../models/enums/ticket-validity.enum';
-import {TicketTypeEnum} from '../../../models/enums/ticket-type.enum';
+import {IsSeasonTicket, TicketTypeEnum} from '../../../models/enums/ticket-type.enum';
import {ScanService} from '../../services/scan.service';
-import {NgOptimizedImage} from '@angular/common';
@Component({
selector: 'app-scan-result',
- imports: [
- NgOptimizedImage
- ],
+ imports: [],
templateUrl: './scan-result.component.html',
styleUrl: './scan-result.component.scss'
})
@@ -16,6 +13,61 @@ export class ScanResultComponent {
private scan = inject(ScanService);
public ticketValidity = this.scan.ticketValid$;
public ticketType = this.scan.ticketType$;
+ public ticketSearch$ = this.scan.ticketSearch$;
protected readonly TicketValidity = TicketValidity;
- protected readonly TicketTypeEnum = TicketTypeEnum;
+ protected readonly IsSeasonTicket = IsSeasonTicket;
+
+ public getValidityText(): string {
+ switch (this.ticketValidity()) {
+ case TicketValidity.Valid:
+ return 'Valid';
+ case TicketValidity.Expired:
+ return 'Expired';
+ case TicketValidity.Early:
+ return 'Early';
+ default:
+ return 'Invalid';
+ }
+ }
+
+ public getValidityImage(): string {
+ switch (this.ticketValidity()) {
+ case TicketValidity.Valid:
+ return 'pass.svg';
+ default:
+ return 'fail.svg';
+ }
+ }
+
+ public getTypeImage(): string {
+ switch (this.ticketType()) {
+ case TicketTypeEnum.SingleSeason:
+ case TicketTypeEnum.Single:
+ return 'single.svg';
+ case TicketTypeEnum.FamilySeason:
+ case TicketTypeEnum.Family:
+ return 'group.svg';
+ case TicketTypeEnum.SeniorSeason:
+ case TicketTypeEnum.Senior:
+ return 'senior.svg';
+ default:
+ return '';
+ }
+ }
+
+ public getTypeText(): string {
+ switch (this.ticketType()) {
+ case TicketTypeEnum.SingleSeason:
+ case TicketTypeEnum.Single:
+ return 'Single Ticket';
+ case TicketTypeEnum.FamilySeason:
+ case TicketTypeEnum.Family:
+ return 'Family Ticket';
+ case TicketTypeEnum.SeniorSeason:
+ case TicketTypeEnum.Senior:
+ return 'Senior Ticket';
+ default:
+ return '';
+ }
+ }
}
diff --git a/source/ticketUI/src/app/components/season-browser/season-browser.component.html b/source/ticketUI/src/app/components/season-browser/season-browser.component.html
index 650b32c..e293216 100644
--- a/source/ticketUI/src/app/components/season-browser/season-browser.component.html
+++ b/source/ticketUI/src/app/components/season-browser/season-browser.component.html
@@ -1,9 +1,11 @@
-
-
-
+
+
+
+
+
diff --git a/source/ticketUI/src/app/components/season-browser/season-browser.component.scss b/source/ticketUI/src/app/components/season-browser/season-browser.component.scss
index 0a5d778..e69de29 100644
--- a/source/ticketUI/src/app/components/season-browser/season-browser.component.scss
+++ b/source/ticketUI/src/app/components/season-browser/season-browser.component.scss
@@ -1,3 +0,0 @@
-label {
- padding-right: 15px;
-}
diff --git a/source/ticketUI/src/app/components/season-browser/season-browser.component.ts b/source/ticketUI/src/app/components/season-browser/season-browser.component.ts
index d296bee..ab612eb 100644
--- a/source/ticketUI/src/app/components/season-browser/season-browser.component.ts
+++ b/source/ticketUI/src/app/components/season-browser/season-browser.component.ts
@@ -1,17 +1,28 @@
-import {Component, inject, OnInit} from '@angular/core';
+import {Component, inject, OnInit, signal, WritableSignal} from '@angular/core';
import {SeasonService} from '../../services/season.service';
+import {Season} from '../../../models/core/season';
+import {ReactiveFormsModule} from '@angular/forms';
@Component({
selector: 'app-season-browser',
- imports: [],
+ imports: [
+ ReactiveFormsModule
+ ],
templateUrl: './season-browser.component.html',
styleUrl: './season-browser.component.scss'
})
export class SeasonBrowserComponent implements OnInit {
private seasonService = inject(SeasonService);
public seasons$ = this.seasonService.seasons$;
+ public selectedSeasonId$: WritableSignal
= signal('');
+ public selectedSeasonId!: string;
public ngOnInit() {
this.seasonService.getSeasons();
}
+
+ public click(selectedSeasonId: string): void {
+ this.selectedSeasonId$.set(selectedSeasonId);
+ this.selectedSeasonId = selectedSeasonId;
+ }
}
diff --git a/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.html b/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.html
index d949c7b..2ffdc31 100644
--- a/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.html
+++ b/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.html
@@ -1,9 +1,10 @@
-
-
-
+
+
+
+
+
diff --git a/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.scss b/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.scss
index 0a5d778..e69de29 100644
--- a/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.scss
+++ b/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.scss
@@ -1,3 +0,0 @@
-label {
- padding-right: 15px;
-}
diff --git a/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.ts b/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.ts
index f7286be..040fdcf 100644
--- a/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.ts
+++ b/source/ticketUI/src/app/components/ticket-type-selector/ticket-type-selector.component.ts
@@ -1,15 +1,24 @@
-import { Component } from '@angular/core';
-import {TicketTypeEnumLabel} from '../../../models/enums/ticket-type.enum';
+import {Component, signal, WritableSignal} from '@angular/core';
+import {TicketTypeEnum, TicketTypeEnumLabel} from '../../../models/enums/ticket-type.enum';
import {KeyValuePipe} from '@angular/common';
+import {ReactiveFormsModule} from '@angular/forms';
@Component({
selector: 'app-ticket-type-selector',
imports: [
- KeyValuePipe
+ KeyValuePipe,
+ ReactiveFormsModule
],
templateUrl: './ticket-type-selector.component.html',
styleUrl: './ticket-type-selector.component.scss'
})
export class TicketTypeSelectorComponent {
public ticketTypes = TicketTypeEnumLabel;
+ public selectedTicketType$: WritableSignal
= signal(TicketTypeEnum.Null);
+ public selectedTicketType!: TicketTypeEnum;
+
+ public click(ticketType: number): void {
+ this.selectedTicketType$.set(ticketType as TicketTypeEnum);
+ this.selectedTicketType = ticketType as TicketTypeEnum;
+ }
}
diff --git a/source/ticketUI/src/app/page/event/event.component.html b/source/ticketUI/src/app/page/event/event.component.html
index f58d9a8..f6a5b29 100644
--- a/source/ticketUI/src/app/page/event/event.component.html
+++ b/source/ticketUI/src/app/page/event/event.component.html
@@ -2,22 +2,22 @@
Add Season
@@ -26,18 +26,18 @@
Add Event
diff --git a/source/ticketUI/src/app/page/event/event.component.scss b/source/ticketUI/src/app/page/event/event.component.scss
index 0a5d778..e69de29 100644
--- a/source/ticketUI/src/app/page/event/event.component.scss
+++ b/source/ticketUI/src/app/page/event/event.component.scss
@@ -1,3 +0,0 @@
-label {
- padding-right: 15px;
-}
diff --git a/source/ticketUI/src/app/page/event/event.component.ts b/source/ticketUI/src/app/page/event/event.component.ts
index fd6c089..b1e9bd5 100644
--- a/source/ticketUI/src/app/page/event/event.component.ts
+++ b/source/ticketUI/src/app/page/event/event.component.ts
@@ -1,8 +1,12 @@
-import {Component, inject} from '@angular/core';
+import {Component, inject, ViewChild} from '@angular/core';
import {FormControl, ReactiveFormsModule, Validators} from '@angular/forms';
import {EventService} from '../../services/event.service';
import {SeasonService} from '../../services/season.service';
import {SeasonBrowserComponent} from '../../components/season-browser/season-browser.component';
+import {AddEventRequest} from '../../../models/request/add-event-request';
+import {AddSeason} from '../../../models/request/add-season';
+import {VALLEY_FORGE_HIGH_SCHOOL} from '../../../models/core/venue';
+import {PARMA_SYMPHONY_ORCHESTRA} from '../../../models/core/talent';
@Component({
selector: 'app-event',
@@ -11,23 +15,40 @@ import {SeasonBrowserComponent} from '../../components/season-browser/season-bro
styleUrl: './event.component.scss'
})
export class EventComponent {
- public eventName = new FormControl('', [Validators.required]);
+ @ViewChild(SeasonBrowserComponent) seasonBrowser!: SeasonBrowserComponent;
+ public eventName = new FormControl('', {nonNullable: true, validators: [Validators.required]});
public eventDescription = new FormControl('');
- public eventDate = new FormControl(new Date, [Validators.required]);
+ public eventDate = new FormControl(new Date, {nonNullable: true, validators: [Validators.required]});
- public seasonName = new FormControl('', [Validators.required]);
+ public seasonName = new FormControl('', {nonNullable: true, validators: [Validators.required]});
public seasonDescription = new FormControl('');
- public seasonStartDate = new FormControl(new Date, [Validators.required]);
- public seasonEndDate = new FormControl(new Date, [Validators.required]);
+ public seasonStartDate = new FormControl(new Date, {nonNullable: true, validators: [Validators.required]});
+ public seasonEndDate = new FormControl(new Date, {nonNullable: true, validators: [Validators.required]});
private eventService = inject(EventService);
private seasonService = inject(SeasonService);
public saveEvent(): void {
+ const request: AddEventRequest = {
+ date: this.eventDate.value,
+ name: this.eventName.value,
+ description: this.eventDescription.value,
+ venue: VALLEY_FORGE_HIGH_SCHOOL,
+ talent: PARMA_SYMPHONY_ORCHESTRA,
+ seasonId: this.seasonBrowser.selectedSeasonId
+ };
+ this.eventService.addEvent(request);
}
public saveSeason(): void {
+ const request: AddSeason = {
+ startDate: this.seasonStartDate.value,
+ endDate: this.seasonEndDate.value,
+ name: this.seasonName.value,
+ description: this.seasonDescription.value,
+ };
+ this.seasonService.saveSeason(request);
}
}
diff --git a/source/ticketUI/src/app/page/scan/scan.component.html b/source/ticketUI/src/app/page/scan/scan.component.html
index c55f3ea..af2b08f 100644
--- a/source/ticketUI/src/app/page/scan/scan.component.html
+++ b/source/ticketUI/src/app/page/scan/scan.component.html
@@ -1,4 +1,4 @@
-