-
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 drivers overview screen in desktop client
- Loading branch information
Showing
11 changed files
with
148 additions
and
4 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,22 @@ | ||
/** | ||
* This class defines a model for Drivers in TraMS | ||
*/ | ||
export class Driver { | ||
|
||
public name: string; | ||
public contractedHours: number; | ||
public startDate: string; | ||
|
||
/** | ||
* Construct a new model for Drivers which contains the supplied data. | ||
* @param name the name of this driver | ||
* @param contractedHours the number of contracted hours for this driver that they are available to work | ||
* @param startDate the date that the driver started working for the company in dd-mm-yyyy | ||
*/ | ||
constructor( name: string, contractedHours: number, startDate: string) { | ||
this.name = name; | ||
this.contractedHours = contractedHours; | ||
this.startDate = startDate; | ||
} | ||
|
||
} |
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 @@ | ||
/* CSS options for the drivers component which is not currently used */ |
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,40 @@ | ||
<!-- Show the header --> | ||
<app-header></app-header> | ||
|
||
<!-- Display a jumbotron component which explains what drivers are and how they work in TraMS --> | ||
<div class="jumbotron" > | ||
<h1 class="display-4 text-center">Drivers</h1> | ||
<br/> | ||
<p class="lead m-4">Drivers help your customers to get from A to B. Without enough drivers, your vehicles will remain in the depot and you will not be able to run reliable services. | ||
But don't forget if a driver does not have enough duties then they are costing you money!</p> | ||
<hr class="my-4"> | ||
<p class="m-4">Click on a driver to access more information about the driver.</p> | ||
</div> | ||
|
||
<!-- Display a table with a list of driver names that are currently available in TraMS. Clicking on the driver name | ||
brings up the detailed information for that driver --> | ||
<div class="row"> | ||
<div class="col-md-4 m-4"> | ||
<table class="table"> | ||
<thead class="thead-light"> | ||
<tr> | ||
<th scope="col">Name</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let driverEl of drivers, let i = index"> | ||
<td><a style="cursor:pointer" [routerLink]="[i]" routerLinkActive="active">{{driverEl.name}}</a></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<!-- Display the detailed information when a user clicks on a driver --> | ||
<div class="col-md-8"> | ||
<router-outlet></router-outlet> | ||
</div> | ||
</div> | ||
|
||
<div class="col text-center"> | ||
<button class="btn btn-primary btn-lg" style="margin: 10px;" type="submit" (click)="backToManagementScreen()">Back to Management Screen</button> | ||
</div> |
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 { DriversComponent } from './drivers.component'; | ||
|
||
describe('DriversComponent', () => { | ||
let component: DriversComponent; | ||
let fixture: ComponentFixture<DriversComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [DriversComponent] | ||
}); | ||
fixture = TestBed.createComponent(DriversComponent); | ||
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,39 @@ | ||
import {Component, OnDestroy, OnInit} from '@angular/core'; | ||
import {GameService} from "../shared/game.service"; | ||
import {Router} from "@angular/router"; | ||
import {Driver} from "./driver.model"; | ||
|
||
@Component({ | ||
selector: 'app-drivers', | ||
templateUrl: './drivers.component.html', | ||
styleUrls: ['./drivers.component.css'] | ||
}) | ||
export class DriversComponent implements OnInit, OnDestroy { | ||
|
||
drivers: Driver[]; | ||
|
||
/** | ||
* Create a new drivers component which currently uses game service since the server does not yet has this functionality. | ||
* @param gameService a service which retrieves game information | ||
* @param router a router service provided by Angular | ||
*/ | ||
constructor(private gameService: GameService, private router:Router) { } | ||
|
||
/** | ||
* Initialise a new drivers component which maintains a list of drivers. | ||
*/ | ||
ngOnInit(): void { | ||
this.drivers = this.gameService.getGame().drivers; | ||
} | ||
|
||
/** | ||
* Destroy the subscription when the component is destroyed. | ||
*/ | ||
ngOnDestroy(): void { | ||
} | ||
|
||
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
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