-
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.
Dialog to create drivers in new desktop client
- Loading branch information
Showing
8 changed files
with
123 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* CSS options for the driver creator component */ | ||
.center-button { | ||
text-align: center; | ||
padding-top: 10px; | ||
} |
37 changes: 37 additions & 0 deletions
37
desktop/src/app/drivercreator/drivercreator.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,37 @@ | ||
<!-- Show the header --> | ||
<app-header></app-header> | ||
|
||
<!-- Jumbotron with page title --> | ||
<div class="jumbotron"> | ||
<h1 class="display-4 text-center">Employ Driver</h1> | ||
</div> | ||
|
||
<!-- Show an input box where the user can enter the name. --> | ||
<div class="form-group top-space m-5"> | ||
<label for="routeNumber" style="font-weight: bold;">Name:</label> | ||
<input class="form-control" [(ngModel)]="name" type="text" id="routeNumber"/> | ||
</div> | ||
|
||
<!-- Show an input box where the user can choose the contracted hours --> | ||
<div class="form-group top-space m-5"> | ||
<label for="startStop" style="font-weight: bold;">Contracted Hours:</label> | ||
<select class="form-control" [(ngModel)]="contractedHours" id="startStop"> | ||
<option *ngFor="let item of this.getPossibleContractedHours()" [ngValue]="item">{{ item }}</option> | ||
</select> | ||
</div> | ||
|
||
<!-- Show an input box where the user can choose the starting date --> | ||
<div class="form-group top-space m-5"> | ||
<label for="startingDate" style="font-weight: bold;">Your Start Date:</label> | ||
<input class="form-control" [(ngModel)]="startingDate" type="date" id="startingDate"/> | ||
</div> | ||
|
||
<!-- Submit button --> | ||
<div class="center-button"> | ||
<button type="submit" (click)="onSubmitDriver()" class="btn btn-primary btn-lg">Employ Driver</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/drivercreator/drivercreator.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 { DrivercreatorComponent } from './drivercreator.component'; | ||
|
||
describe('DrivercreatorComponent', () => { | ||
let component: DrivercreatorComponent; | ||
let fixture: ComponentFixture<DrivercreatorComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [DrivercreatorComponent] | ||
}); | ||
fixture = TestBed.createComponent(DrivercreatorComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
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,50 @@ | ||
import { Component } from '@angular/core'; | ||
import {GameService} from "../shared/game.service"; | ||
import {Router} from "@angular/router"; | ||
import {Driver} from "../drivers/driver.model"; | ||
import {DatePipe} from "@angular/common"; | ||
|
||
@Component({ | ||
selector: 'app-drivercreator', | ||
templateUrl: './drivercreator.component.html', | ||
styleUrls: ['./drivercreator.component.css'] | ||
}) | ||
export class DrivercreatorComponent { | ||
|
||
name: string; | ||
contractedHours: number; | ||
startingDate: string; | ||
gameService: GameService | ||
currentDate = new Date(); | ||
|
||
/** | ||
* Construct a new Driver Creator 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.contractedHours = 40; | ||
this.startingDate = this.datePipe.transform(this.currentDate, 'yyyy-MM-dd'); | ||
} | ||
|
||
/** | ||
* Retrieve the list of possible contracted hours that are available. | ||
*/ | ||
getPossibleContractedHours(): number[] { | ||
return [20,25,30,35,40]; | ||
} | ||
|
||
onSubmitDriver(): void { | ||
var driver = new Driver(this.name, this.contractedHours, this.startingDate); | ||
this.gameService.getGame().addDriver(driver); | ||
this.router.navigate(['management']); | ||
} | ||
|
||
backToManagementScreen(): void { | ||
this.router.navigate(['management']); | ||
} | ||
|
||
|
||
} |
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