13 changed files with 233 additions and 101 deletions
@ -0,0 +1,12 @@ |
|||||
|
<h1 mat-dialog-title>New Season</h1> |
||||
|
<div mat-dialog-content> |
||||
|
<p>Map Name: <input [(ngModel)]="data.mapName" /></p> |
||||
|
<p>Link: <input [(ngModel)]="data.mapLink" /></p> |
||||
|
<p>Starting Date: <input type="date" [(ngModel)]="data.startDate" /></p> |
||||
|
<p>End Date: <input type="date" [(ngModel)]="data.endDate" /></p> |
||||
|
<p>Week#: <input type="number" [(ngModel)]="data.weekNumber" /></p> |
||||
|
</div> |
||||
|
<div mat-dialog-actions> |
||||
|
<button mat-button (click)="onCancelClick()">Cancel</button> |
||||
|
<button mat-button color="primary" (click)="onSaveClick()">Save</button> |
||||
|
</div> |
||||
@ -0,0 +1,21 @@ |
|||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
|
||||
|
import { NewRaceDialogComponent } from './new-race-dialog.component'; |
||||
|
|
||||
|
describe('NewRaceDialogComponent', () => { |
||||
|
let component: NewRaceDialogComponent; |
||||
|
let fixture: ComponentFixture<NewRaceDialogComponent>; |
||||
|
|
||||
|
beforeEach(() => { |
||||
|
TestBed.configureTestingModule({ |
||||
|
declarations: [NewRaceDialogComponent] |
||||
|
}); |
||||
|
fixture = TestBed.createComponent(NewRaceDialogComponent); |
||||
|
component = fixture.componentInstance; |
||||
|
fixture.detectChanges(); |
||||
|
}); |
||||
|
|
||||
|
it('should create', () => { |
||||
|
expect(component).toBeTruthy(); |
||||
|
}); |
||||
|
}); |
||||
@ -0,0 +1,32 @@ |
|||||
|
import { Component, OnInit, Inject } from '@angular/core'; |
||||
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
||||
|
import { ApiService } from 'src/app/services/api.service'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-new-race-dialog', |
||||
|
templateUrl: './new-race-dialog.component.html', |
||||
|
styleUrls: ['./new-race-dialog.component.less'] |
||||
|
}) |
||||
|
export class NewRaceDialogComponent { |
||||
|
constructor( |
||||
|
public dialogRef: MatDialogRef<NewRaceDialogComponent>, |
||||
|
@Inject(MAT_DIALOG_DATA) public data: any, |
||||
|
private apiService: ApiService |
||||
|
) { } |
||||
|
|
||||
|
ngOnInit(): void { |
||||
|
} |
||||
|
|
||||
|
onCancelClick(): void { |
||||
|
this.dialogRef.close(); |
||||
|
} |
||||
|
|
||||
|
onSaveClick(): void { |
||||
|
this.apiService.addRace( |
||||
|
this.data.seasonId, this.data.startDate, this.data.endDate, this.data.mapName, this.data.mapLink, this.data.weekNumber |
||||
|
).subscribe(data => { |
||||
|
console.log(data); |
||||
|
}); |
||||
|
this.dialogRef.close(this.data); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue