-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial vehicle showroom with single model type
- Loading branch information
Showing
12 changed files
with
197 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
desktop/src/app/vehicleshowroom/vehicleshowroom.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* CSS options for the vehicle showroom component */ | ||
.center-button { | ||
text-align: center; | ||
padding-top: 10px; | ||
} |
71 changes: 71 additions & 0 deletions
71
desktop/src/app/vehicleshowroom/vehicleshowroom.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<!-- Show the header --> | ||
<app-header></app-header> | ||
|
||
<!-- Jumbotron with page title --> | ||
<div class="jumbotron"> | ||
<h1 class="display-4 text-center">Vehicle Showroom</h1> | ||
</div> | ||
|
||
<div class="row" style="margin-top: 20px;"> | ||
|
||
<div class="col"> | ||
<!-- Show the vehicle picture --> | ||
<img src="{{ getVehiclePicture() }}" class="mx-auto d-block" style="max-height: 500px;" alt="Vehicle Picture"/> | ||
</div> | ||
<div class="col"> | ||
<!-- Show the vehicle type --> | ||
<div class="form-group top-space m-3"> | ||
<label for="vehicleType" style="font-weight: bold;">Type:</label> | ||
<h5 id="vehicleType">{{getVehicleType()}}</h5> | ||
</div> | ||
<!-- Show the seating capacity --> | ||
<div class="form-group top-space m-3"> | ||
<label for="seatingCapacity" style="font-weight: bold;">Seating Capacity:</label> | ||
<h5 id="seatingCapacity">{{getVehicleSeatingCapacity()}}</h5> | ||
</div> | ||
<!-- Show the standing capacity --> | ||
<div class="form-group top-space m-3"> | ||
<label for="standingCapacity" style="font-weight: bold;">Standing Capacity:</label> | ||
<h5 id="standingCapacity">{{getVehicleStandingCapacity()}}</h5> | ||
</div> | ||
<!-- Show the delivery date --> | ||
<div class="form-group top-space m-3"> | ||
<label for="deliveryDate" style="font-weight: bold;">Delivery Date:</label> | ||
<h5 id="deliveryDate">{{getVehicleDeliveryDate()}}</h5> | ||
</div> | ||
<!-- Show the purchase price --> | ||
<div class="form-group top-space m-3"> | ||
<label for="purchasePrice" style="font-weight: bold;">Purchase Price:</label> | ||
<h5 id="purchasePrice">€{{getVehiclePurchasePrice()}},00</h5> | ||
</div> | ||
<!-- Show an input box where the user can choose the quantity --> | ||
<div class="form-group top-space m-3"> | ||
<label for="startStop" style="font-weight: bold;">Quantity:</label> | ||
<select class="form-control" [(ngModel)]="quantity" id="startStop"> | ||
<option *ngFor="let item of this.getPossibleQuantities()" [ngValue]="item">{{ item }}</option> | ||
</select> | ||
</div> | ||
<!-- Show the total price --> | ||
<h3 class="text-center">Total Price: €{{getTotalPrice()}},00</h3> | ||
</div> | ||
</div> | ||
|
||
<!-- Submit button --> | ||
<div class="center-button"> | ||
<button type="submit" (click)="onPurchaseVehicle()" class="btn btn-primary btn-lg" [disabled]="checkDisablePrevious()">Previous Vehicle Type</button> | ||
</div> | ||
|
||
<!-- Back to Management Screen button --> | ||
<div class="center-button"> | ||
<button class="btn btn-primary btn-lg" style="margin: 10px;" type="submit" [disabled]="checkDisableNext()">Next Vehicle Type</button> | ||
</div> | ||
|
||
<!-- Submit button --> | ||
<div class="center-button"> | ||
<button type="submit" (click)="onPurchaseVehicle()" class="btn btn-primary btn-lg">Purchase Vehicle</button> | ||
</div> | ||
|
||
<!-- Back to Management Screen button --> | ||
<div class="center-button"> | ||
<button class="btn btn-primary btn-lg" style="margin: 10px;" type="submit" (click)="backToManagementScreen()">Back to Management Screen</button> | ||
</div> |
21 changes: 21 additions & 0 deletions
21
desktop/src/app/vehicleshowroom/vehicleshowroom.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { VehicleshowroomComponent } from './vehicleshowroom.component'; | ||
|
||
describe('VehicleshowroomComponent', () => { | ||
let component: VehicleshowroomComponent; | ||
let fixture: ComponentFixture<VehicleshowroomComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [VehicleshowroomComponent] | ||
}); | ||
fixture = TestBed.createComponent(VehicleshowroomComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
83 changes: 83 additions & 0 deletions
83
desktop/src/app/vehicleshowroom/vehicleshowroom.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { Component } from '@angular/core'; | ||
import {VehicleModel} from "../vehicles/vehiclemodel.model"; | ||
import {GameService} from "../shared/game.service"; | ||
import {Router} from "@angular/router"; | ||
import {DatePipe} from "@angular/common"; | ||
|
||
@Component({ | ||
selector: 'app-vehicleshowroom', | ||
templateUrl: './vehicleshowroom.component.html', | ||
styleUrls: ['./vehicleshowroom.component.css'] | ||
}) | ||
export class VehicleshowroomComponent { | ||
|
||
models: VehicleModel[]; | ||
currentDisplay: number; | ||
gameService: GameService | ||
currentDate: Date | ||
quantity: number; | ||
|
||
/** | ||
* Construct a new Vehicle Showroom component | ||
* @param gameService2 the game service containing the currently loaded game. | ||
* @param router the router for navigating to other pages. | ||
* @param datePipe a date pipe object for transforming dates in Angular. | ||
*/ | ||
constructor(private gameService2: GameService, public router: Router, private datePipe: DatePipe) { | ||
this.gameService = gameService2; | ||
this.models = [new VehicleModel('MyBus Single Decker', 44, 36, 85000.0, 'assets/Bus.jpg')]; | ||
this.currentDisplay = 0; | ||
this.quantity = 1; | ||
this.currentDate = new Date(); | ||
this.currentDate.setDate(this.currentDate.getDate() + 5); | ||
} | ||
|
||
getVehiclePicture(): string { | ||
return this.models[this.currentDisplay].picture; | ||
} | ||
|
||
getVehicleType(): string { | ||
return this.models[this.currentDisplay].modelName; | ||
} | ||
|
||
getVehicleSeatingCapacity(): number { | ||
return this.models[this.currentDisplay].seatingCapacity; | ||
} | ||
|
||
getVehicleStandingCapacity(): number { | ||
return this.models[this.currentDisplay].standingCapacity; | ||
} | ||
|
||
getVehicleDeliveryDate(): string { | ||
return this.datePipe.transform(this.currentDate, 'yyyy-MM-dd'); | ||
} | ||
|
||
getVehiclePurchasePrice(): number { | ||
return this.models[this.currentDisplay].value; | ||
} | ||
|
||
getPossibleQuantities(): number[] { | ||
return [1,2,3,4,5,6,7,8,9,10]; | ||
} | ||
|
||
getTotalPrice(): number { | ||
return this.models[this.currentDisplay].value * this.quantity; | ||
} | ||
|
||
onPurchaseVehicle(): void { | ||
alert('Coming Soon!'); | ||
} | ||
|
||
backToManagementScreen(): void { | ||
this.router.navigate(['management']); | ||
} | ||
|
||
checkDisablePrevious():boolean { | ||
return this.currentDisplay === 0; | ||
} | ||
|
||
checkDisableNext():boolean { | ||
return (this.currentDisplay + 1) >= this.models.length; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters