diff --git a/desktop/src/app/allocations/allocations.component.css b/desktop/src/app/allocations/allocations.component.css
new file mode 100644
index 0000000..765718f
--- /dev/null
+++ b/desktop/src/app/allocations/allocations.component.css
@@ -0,0 +1,5 @@
+/* CSS options for the allocation component */
+.center-button {
+ text-align: center;
+ padding-top: 10px;
+}
\ No newline at end of file
diff --git a/desktop/src/app/allocations/allocations.component.html b/desktop/src/app/allocations/allocations.component.html
new file mode 100644
index 0000000..4189434
--- /dev/null
+++ b/desktop/src/app/allocations/allocations.component.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
Allocate Vehicle
+
+
+
+
+ Route Number:
+
+ {{ item }}
+
+
+
+
+
+ Fleet Number:
+
+ {{ item }}
+
+
+
+
+
+ Tour Number:
+
+ {{ item }}
+
+
+
+
+
+ Save Allocation
+
+
+
+
+ Back to Management Screen
+
\ No newline at end of file
diff --git a/desktop/src/app/allocations/allocations.component.spec.ts b/desktop/src/app/allocations/allocations.component.spec.ts
new file mode 100644
index 0000000..b12be8d
--- /dev/null
+++ b/desktop/src/app/allocations/allocations.component.spec.ts
@@ -0,0 +1,21 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { AllocationsComponent } from './allocations.component';
+
+describe('AllocationsComponent', () => {
+ let component: AllocationsComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ declarations: [AllocationsComponent]
+ });
+ fixture = TestBed.createComponent(AllocationsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/desktop/src/app/allocations/allocations.component.ts b/desktop/src/app/allocations/allocations.component.ts
new file mode 100644
index 0000000..39cbd38
--- /dev/null
+++ b/desktop/src/app/allocations/allocations.component.ts
@@ -0,0 +1,95 @@
+import { Component } from '@angular/core';
+import {GameService} from "../shared/game.service";
+import {Router} from "@angular/router";
+import {Route} from "../routes/route.model";
+
+@Component({
+ selector: 'app-allocations',
+ templateUrl: './allocations.component.html',
+ styleUrls: ['./allocations.component.css']
+})
+export class AllocationsComponent {
+
+ gameService: GameService;
+ selectedRouteNumber: string;
+ selectedFleetNumber: string;
+ selectedTourNumber: string;
+
+ /**
+ * Construct a new Allocations component
+ * @param gameService2 the game service containing the currently loaded game.
+ * @param router the router for navigating to other pages.
+ */
+ constructor(private gameService2: GameService, public router: Router) {
+ this.gameService = gameService2;
+ if ( this.gameService.getGame().routes.length > 0 ) {
+ this.selectedRouteNumber = this.gameService.getGame().routes[0].routeNumber;
+ }
+ if ( this.gameService.getGame().vehicles.length > 0 ) {
+ this.selectedFleetNumber = this.gameService.getGame().vehicles[0].fleetNumber;
+ }
+ this.selectedTourNumber = "1";
+ }
+
+ /**
+ * Retrieve the list of defined route numbers.
+ */
+ getDefinedRouteNumbers(): string[] {
+ var routeNumbers = [];
+ for ( var i = 0; i < this.gameService.getGame().routes.length; i++ ) {
+ routeNumbers[i] = this.gameService.getGame().routes[i].routeNumber;
+ }
+ return routeNumbers;
+ }
+
+ /**
+ * Retrieve the list of defined fleet numbers.
+ */
+ getDefinedFleetNumbers(): string[] {
+ var fleetNumbers = [];
+ for ( var i = 0; i < this.gameService.getGame().vehicles.length; i++ ) {
+ fleetNumbers[i] = this.gameService.getGame().vehicles[i].fleetNumber;
+ }
+ return fleetNumbers;
+ }
+
+ /**
+ * Retrieve the list of defined tour numbers for the selected route.
+ */
+ getDefinedTourNumbers(): string[] {
+ if ( this.selectedRouteNumber ) {
+ var selectedRouteObject: Route;
+ for ( var j = 0; j < this.gameService.getGame().routes.length; j++ ) {
+ if ( this.selectedRouteNumber == this.gameService.getGame().routes[j].routeNumber ) {
+ selectedRouteObject = this.gameService.getGame().routes[j];
+ break;
+ }
+ }
+ if ( selectedRouteObject ) {
+ // We take the first timetable at the moment.
+ if ( selectedRouteObject.timetables.length > 0 && selectedRouteObject.timetables[0].frequencyPatterns.length > 0 ) {
+ var tours = [];
+ for (var k = 0; k < selectedRouteObject.timetables[0].frequencyPatterns[0].numTours; k++) {
+ tours.push((k + 1));
+ }
+ return tours;
+ }
+ return [];
+ } else {
+ return [];
+ }
+ } else {
+ return [];
+ }
+ }
+
+ onSaveAllocation(): void {
+ alert('I want to use vehicle ' + this.selectedFleetNumber + ' for ' + this.selectedRouteNumber + '/' + this.selectedTourNumber);
+ this.router.navigate(['management']);
+ }
+
+ backToManagementScreen(): void {
+ this.router.navigate(['management']);
+ }
+
+}
diff --git a/desktop/src/app/allocationslist/allocationslist.component.css b/desktop/src/app/allocationslist/allocationslist.component.css
new file mode 100644
index 0000000..765718f
--- /dev/null
+++ b/desktop/src/app/allocationslist/allocationslist.component.css
@@ -0,0 +1,5 @@
+/* CSS options for the allocation component */
+.center-button {
+ text-align: center;
+ padding-top: 10px;
+}
\ No newline at end of file
diff --git a/desktop/src/app/allocationslist/allocationslist.component.html b/desktop/src/app/allocationslist/allocationslist.component.html
new file mode 100644
index 0000000..c18727c
--- /dev/null
+++ b/desktop/src/app/allocationslist/allocationslist.component.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
Vehicle Allocations
+
+
+Coming Soon!
+
+
+
+ Back to Management Screen
+
\ No newline at end of file
diff --git a/desktop/src/app/allocationslist/allocationslist.component.spec.ts b/desktop/src/app/allocationslist/allocationslist.component.spec.ts
new file mode 100644
index 0000000..35f02cf
--- /dev/null
+++ b/desktop/src/app/allocationslist/allocationslist.component.spec.ts
@@ -0,0 +1,21 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { AllocationslistComponent } from './allocationslist.component';
+
+describe('AllocationslistComponent', () => {
+ let component: AllocationslistComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ declarations: [AllocationslistComponent]
+ });
+ fixture = TestBed.createComponent(AllocationslistComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/desktop/src/app/allocationslist/allocationslist.component.ts b/desktop/src/app/allocationslist/allocationslist.component.ts
new file mode 100644
index 0000000..b1dc376
--- /dev/null
+++ b/desktop/src/app/allocationslist/allocationslist.component.ts
@@ -0,0 +1,27 @@
+import { Component } from '@angular/core';
+import {GameService} from "../shared/game.service";
+import {Router} from "@angular/router";
+
+@Component({
+ selector: 'app-allocationslist',
+ templateUrl: './allocationslist.component.html',
+ styleUrls: ['./allocationslist.component.css']
+})
+export class AllocationslistComponent {
+
+ gameService: GameService;
+
+ /**
+ * Construct a new Allocations list component
+ * @param gameService2 the game service containing the currently loaded game.
+ * @param router the router for navigating to other pages.
+ */
+ constructor(private gameService2: GameService, public router: Router) {
+ this.gameService = gameService2;
+ }
+
+ backToManagementScreen(): void {
+ this.router.navigate(['management']);
+ }
+
+}
diff --git a/desktop/src/app/app-routing.module.ts b/desktop/src/app/app-routing.module.ts
index 0caa0ea..a8215b0 100644
--- a/desktop/src/app/app-routing.module.ts
+++ b/desktop/src/app/app-routing.module.ts
@@ -18,11 +18,15 @@ import {DriverDetailComponent} from "./drivers/driver-detail/driver-detail.compo
import {OptionsComponent} from "./options/options.component";
import {DrivercreatorComponent} from "./drivercreator/drivercreator.component";
import {VehicleshowroomComponent} from "./vehicleshowroom/vehicleshowroom.component";
+import {AllocationsComponent} from "./allocations/allocations.component";
+import {AllocationslistComponent} from "./allocationslist/allocationslist.component";
/**
* Define the links which work in this application.
*/
const appRoutes: Routes = [
+ { path: 'allocations', component: AllocationsComponent },
+ { path: 'allocationsList', component: AllocationslistComponent },
{ path: 'drivers', component: DriversComponent, children: [
{ path: ':id', component: DriverDetailComponent}
] },
diff --git a/desktop/src/app/app.module.ts b/desktop/src/app/app.module.ts
index 00576b0..f9f746d 100644
--- a/desktop/src/app/app.module.ts
+++ b/desktop/src/app/app.module.ts
@@ -33,6 +33,8 @@ import { DriverDetailComponent } from './drivers/driver-detail/driver-detail.com
import { OptionsComponent } from './options/options.component';
import { DrivercreatorComponent } from './drivercreator/drivercreator.component';
import { VehicleshowroomComponent } from './vehicleshowroom/vehicleshowroom.component';
+import { AllocationsComponent } from './allocations/allocations.component';
+import { AllocationslistComponent } from './allocationslist/allocationslist.component';
@NgModule({
declarations: [
@@ -57,7 +59,9 @@ import { VehicleshowroomComponent } from './vehicleshowroom/vehicleshowroom.comp
DriverDetailComponent,
OptionsComponent,
DrivercreatorComponent,
- VehicleshowroomComponent
+ VehicleshowroomComponent,
+ AllocationsComponent,
+ AllocationslistComponent
],
imports: [
BrowserModule,
diff --git a/desktop/src/app/management/management.component.html b/desktop/src/app/management/management.component.html
index 40c515b..c673e36 100644
--- a/desktop/src/app/management/management.component.html
+++ b/desktop/src/app/management/management.component.html
@@ -89,7 +89,8 @@ Allocations
Allocate or deallocate vehicles to routes.
-
Change
+
Change
+
View Allocations
diff --git a/desktop/src/app/management/management.component.ts b/desktop/src/app/management/management.component.ts
index a41fe74..a6450da 100644
--- a/desktop/src/app/management/management.component.ts
+++ b/desktop/src/app/management/management.component.ts
@@ -51,6 +51,10 @@ export class ManagementComponent implements OnInit {
onPurchaseVehicle(): void {
this.router.navigate(['vehicleshowroom']);
}
+
+ onChangeAllocation(): void {
+ this.router.navigate(['allocations']);
+ }
onResign(): void {
if(confirm("Are you sure you want to resign from " + this.gameService.getGame().companyName + "? This will end " +
"your game and any changes you have made will not be saved.")) {
diff --git a/desktop/src/app/shared/frequencypattern.model.ts b/desktop/src/app/shared/frequencypattern.model.ts
index e78bd07..743f6dc 100644
--- a/desktop/src/app/shared/frequencypattern.model.ts
+++ b/desktop/src/app/shared/frequencypattern.model.ts
@@ -10,6 +10,7 @@ export class FrequencyPattern {
public startTime: string;
public endTime: string;
public frequencyInMinutes: number;
+ public numTours: number;
/**
* Construct a new frequency pattern which contains the supplied data.
@@ -20,10 +21,11 @@ export class FrequencyPattern {
* @param startTime the start time when the frequency begins
* @param endTime the start time when the frequency ends
* @param frequencyInMinutes the frequency that will be run in minutes.
+ * @param numTours the number of tours that is required for this frequency pattern.
*/
constructor( name: string, daysOfOperation: string[], startStop: string, endStop: string,
- startTime: string, endTime: string, frequencyInMinutes: number ) {
+ startTime: string, endTime: string, frequencyInMinutes: number, numTours: number ) {
this.name = name;
this.daysOfOperation = daysOfOperation;
this.startStop = startStop;
@@ -31,6 +33,7 @@ export class FrequencyPattern {
this.startTime = startTime;
this.endTime = endTime;
this.frequencyInMinutes = frequencyInMinutes;
+ this.numTours = numTours;
}
}
\ No newline at end of file
diff --git a/desktop/src/app/timetablecreator/timetablecreator.component.ts b/desktop/src/app/timetablecreator/timetablecreator.component.ts
index fd029f6..8a5a32d 100644
--- a/desktop/src/app/timetablecreator/timetablecreator.component.ts
+++ b/desktop/src/app/timetablecreator/timetablecreator.component.ts
@@ -143,7 +143,7 @@ export class TimetablecreatorComponent {
// Create frequency pattern.
var frequencyPattern = new FrequencyPattern(this.frequencyPatternName, daysOfOperation,
this.frequencyPatternStartStop, this.frequencyPatternEndStop, this.frequencyPatternStartTime,
- this.frequencyPatternEndTime, this.frequencyPatternFrequency);
+ this.frequencyPatternEndTime, this.frequencyPatternFrequency, this.getNumberVehicles());
this.frequencyPatterns.push(frequencyPattern);
}