Ajout des formulaires de création de

"Aircraft", "JumpType", "Gear" et "DZ".
This commit is contained in:
Sébastien André
2019-11-28 16:44:53 +01:00
parent 54f5398af1
commit b1613ab15b
26 changed files with 212 additions and 7 deletions

View File

@@ -12,6 +12,10 @@ import { NewJumpComponent } from './new-jump/new-jump.component';
import { ListOfAircraftsComponent } from './list-of-aircrafts/list-of-aircrafts.component';
import { ListOfJumpTypesComponent } from './list-of-jump-types/list-of-jump-types.component';
import { ListOfGearsComponent } from './list-of-gears/list-of-gears.component';
import { NewAircraftComponent } from './new-aircraft/new-aircraft.component';
import { NewGearComponent } from './new-gear/new-gear.component';
import { NewDropZoneComponent } from './new-drop-zone/new-drop-zone.component';
import { NewJumpTypeComponent } from './new-jump-type/new-jump-type.component';
import { DateService } from '../services/date.service';
import { ServiceApiPut } from '../services/service-api-put.service';
@@ -34,6 +38,7 @@ import {
MatIconModule,
MatAutocompleteModule
} from '@angular/material';
import { RequestCache } from '../services/request-cache.service';
import { CachingInterceptor } from '../services/caching-interceptor.service';
@@ -56,7 +61,11 @@ const appRoutes: Routes = [
NewJumpComponent,
ListOfAircraftsComponent,
ListOfJumpTypesComponent,
ListOfGearsComponent
ListOfGearsComponent,
NewAircraftComponent,
NewGearComponent,
NewDropZoneComponent,
NewJumpTypeComponent
],
imports: [
RouterModule.forRoot(

View File

@@ -1,3 +1,6 @@
<button (click)="add()">Add a aircraft</button>
<app-new-aircraft *ngIf="showAddForm === true"></app-new-aircraft>
<div *ngIf="dataSourceTable != null else loading" class="table-container">
<table mat-table [dataSource]="dataSourceTable">
<ng-container matColumnDef="id">

View File

@@ -13,9 +13,10 @@ import { ServiceComm } from '../../services/service-comm.service';
})
export class ListOfAircraftsComponent implements OnInit {
public displayedColumns: Array<string> = ['id', 'name'];
public dataSourceTable;
public dataSourceTable: MatTableDataSource<AircraftResp>;
public resultsLength = 0;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
public showAddForm: boolean;
constructor(
private serviceApi: ServiceApiGet,
@@ -27,7 +28,7 @@ export class ListOfAircraftsComponent implements OnInit {
this.getListOfAircrafts();
}
getListOfAircrafts() {
private getListOfAircrafts() {
this.serviceApi.getListOfAircrafts().subscribe(data => {
data.sort((a, b) => (b.name < a.name) ? 1 : -1);
this.dataSourceTable = new MatTableDataSource<AircraftResp>(data);
@@ -35,4 +36,8 @@ export class ListOfAircraftsComponent implements OnInit {
this.resultsLength = data.length;
});
}
public add() {
this.showAddForm = true;
}
}

View File

@@ -1,3 +1,6 @@
<button (click)="add()">Add a aircraft</button>
<app-new-drop-zone *ngIf="showAddForm === true"></app-new-drop-zone>
<div *ngIf="dataSourceTable != null else loading" class="table-container">
<table mat-table [dataSource]="dataSourceTable">
<ng-container matColumnDef="isfavorite">

View File

@@ -23,9 +23,10 @@ export class ListOfDzsComponent implements OnInit {
'email',
'type'
];
public dataSourceTable;
public dataSourceTable: MatTableDataSource<DropZoneResp>;
public resultsLength = 0;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
public showAddForm: boolean;
constructor(
private serviceApiGet: ServiceApiGet,
@@ -54,4 +55,8 @@ export class ListOfDzsComponent implements OnInit {
public removeToFavorite(dropzone: DropZoneResp) {
dropzone.isFavorite = this.serviceApiPut.RemoveFavoriteDropZone(dropzone);
}
public add() {
this.showAddForm = true;
}
}

View File

@@ -1,3 +1,6 @@
<button (click)="add()">Add a aircraft</button>
<app-new-gear *ngIf="showAddForm === true"></app-new-gear>
<div *ngIf="dataSourceTable != null else loading" class="table-container">
<table mat-table [dataSource]="dataSourceTable">
<ng-container matColumnDef="id">

View File

@@ -20,9 +20,10 @@ export class ListOfGearsComponent implements OnInit {
'email',
'type'
];
public dataSourceTable;
public dataSourceTable: MatTableDataSource<GearResp>;
public resultsLength = 0;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
public showAddForm: boolean;
constructor(
private serviceApi: ServiceApiGet,
@@ -42,4 +43,8 @@ export class ListOfGearsComponent implements OnInit {
this.resultsLength = data.length;
});
}
public add() {
this.showAddForm = true;
}
}

View File

@@ -1,3 +1,6 @@
<button (click)="add()">Add a aircraft</button>
<app-new-jump-type *ngIf="showAddForm === true"></app-new-jump-type>
<div *ngIf="dataSourceTable != null else loading" class="table-container">
<table mat-table [dataSource]="dataSourceTable">
<ng-container matColumnDef="id">

View File

@@ -13,9 +13,10 @@ import { ServiceComm } from '../../services/service-comm.service';
})
export class ListOfJumpTypesComponent implements OnInit {
public displayedColumns: Array<string> = ['id', 'name'];
public dataSourceTable;
public dataSourceTable: MatTableDataSource<JumpTypeResp>;
public resultsLength = 0;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
public showAddForm: boolean;
constructor(
private serviceApi: ServiceApiGet,
@@ -35,4 +36,8 @@ export class ListOfJumpTypesComponent implements OnInit {
this.resultsLength = data.length;
});
}
public add() {
this.showAddForm = true;
}
}

View File

@@ -0,0 +1 @@
<p>new-aircraft works!</p>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NewAircraftComponent } from './new-aircraft.component';
describe('NewAircraftComponent', () => {
let component: NewAircraftComponent;
let fixture: ComponentFixture<NewAircraftComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NewAircraftComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NewAircraftComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-new-aircraft',
templateUrl: './new-aircraft.component.html',
styleUrls: ['./new-aircraft.component.css']
})
export class NewAircraftComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@@ -0,0 +1 @@
<p>new-drop-zone works!</p>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NewDropZoneComponent } from './new-drop-zone.component';
describe('NewDropZoneComponent', () => {
let component: NewDropZoneComponent;
let fixture: ComponentFixture<NewDropZoneComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NewDropZoneComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NewDropZoneComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-new-drop-zone',
templateUrl: './new-drop-zone.component.html',
styleUrls: ['./new-drop-zone.component.css']
})
export class NewDropZoneComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@@ -0,0 +1 @@
<p>new-gear works!</p>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NewGearComponent } from './new-gear.component';
describe('NewGearComponent', () => {
let component: NewGearComponent;
let fixture: ComponentFixture<NewGearComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NewGearComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NewGearComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-new-gear',
templateUrl: './new-gear.component.html',
styleUrls: ['./new-gear.component.css']
})
export class NewGearComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@@ -0,0 +1 @@
<p>new-jump-type works!</p>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NewJumpTypeComponent } from './new-jump-type.component';
describe('NewJumpTypeComponent', () => {
let component: NewJumpTypeComponent;
let fixture: ComponentFixture<NewJumpTypeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NewJumpTypeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NewJumpTypeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-new-jump-type',
templateUrl: './new-jump-type.component.html',
styleUrls: ['./new-jump-type.component.css']
})
export class NewJumpTypeComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 765 B