diff --git a/Front/skydivelogs-app/src/app/app.module.ts b/Front/skydivelogs-app/src/app/app.module.ts
index 71b3b26..3d0af83 100644
--- a/Front/skydivelogs-app/src/app/app.module.ts
+++ b/Front/skydivelogs-app/src/app/app.module.ts
@@ -42,7 +42,6 @@ import { MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatSelectModule } from '@angular/material/select';
import { MatTableModule } from '@angular/material/table';
-import { MatTabsModule } from '@angular/material/tabs';
import { RequestCache } from '../services/request-cache.service';
import { CachingInterceptor } from '../services/caching-interceptor.service';
@@ -95,8 +94,7 @@ const appRoutes: Routes = [
MatButtonModule,
MatIconModule,
MatAutocompleteModule,
- MatProgressSpinnerModule,
- MatTabsModule
+ MatProgressSpinnerModule
],
exports: [HttpClientModule],
providers: [
diff --git a/Front/skydivelogs-app/src/app/summary/summary.component.css b/Front/skydivelogs-app/src/app/summary/summary.component.css
index 8ef9d04..d17b30c 100644
--- a/Front/skydivelogs-app/src/app/summary/summary.component.css
+++ b/Front/skydivelogs-app/src/app/summary/summary.component.css
@@ -5,3 +5,10 @@
.paragraph {
margin-top: 30px;
}
+
+.labelTab {
+ margin: 5px;
+ cursor: pointer;
+ text-decoration: underline;
+ font-weight: bold;
+}
diff --git a/Front/skydivelogs-app/src/app/summary/summary.component.html b/Front/skydivelogs-app/src/app/summary/summary.component.html
index f2fea97..42bfd5f 100644
--- a/Front/skydivelogs-app/src/app/summary/summary.component.html
+++ b/Front/skydivelogs-app/src/app/summary/summary.component.html
@@ -1,5 +1,3 @@
-
-
Total Total
@@ -14,140 +12,147 @@
Date and location
-
-
-
-
- | {{element.label}} |
-
-
- {{element.nb}} |
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
- | {{element.label}} |
-
-
- {{element.nb}} |
-
-
-
-
-
-
-
+
+
+
+ | {{element.label}} |
+
+
+ {{element.nb}} |
+
+
+
+
+
+
-
-
-
- | {{element.label}} |
-
-
- {{element.nb}} |
-
-
-
-
-
-
+
+
+ | {{element.label}} |
+
+
+ {{element.nb}} |
+
+
+
+
+
+
+
-
-
- | {{element.label}} |
-
-
- {{element.nb}} |
-
-
-
-
-
-
-
+
+
+
+ | {{element.label}} |
+
+
+ {{element.nb}} |
+
+
+
+
+
+
-
-
-
- | {{element.label}} |
-
-
- {{element.nb}} |
-
-
-
-
-
-
-
+
+
+ | {{element.label}} |
+
+
+ {{element.nb}} |
+
+
+
+
+
+
+
-
-
-
- | {{element.label}} |
-
-
- {{element.nb}} |
-
-
-
-
-
-
-
+
+
+
+ | {{element.label}} |
+
+
+ {{element.nb}} |
+
+
+
+
+
+
+
-
-
-
- | {{element.label}} |
-
-
- {{element.nb}} |
-
-
-
-
-
-
-
+
+
+
+ | {{element.label}} |
+
+
+ {{element.nb}} |
+
+
+
+
+
+
+
-
-
-
- | {{element.label}} |
-
-
- {{element.nb}} |
-
-
-
-
-
-
-
+
+
+
+ | {{element.label}} |
+
+
+ {{element.nb}} |
+
+
+
+
+
+
+
-
-
-
- | {{element.label}} |
-
-
- {{element.nb}} |
-
-
-
-
-
-
-
-
+
+
+
+ | {{element.label}} |
+
+
+ {{element.nb}} |
+
+
+
+
+
+
+
+
+
+
+
+ | {{element.label}} |
+
+
+ {{element.nb}} |
+
+
+
+
+
+
+
diff --git a/Front/skydivelogs-app/src/app/summary/summary.component.ts b/Front/skydivelogs-app/src/app/summary/summary.component.ts
index 7ddadc4..e773a32 100644
--- a/Front/skydivelogs-app/src/app/summary/summary.component.ts
+++ b/Front/skydivelogs-app/src/app/summary/summary.component.ts
@@ -7,7 +7,8 @@ import {
StatsByAircraftResp,
StatsByGearResp,
StatsByJumpTypeResp,
- StatsByYearResp
+ StatsByYearResp,
+ StatType
} from '../../models/stats';
@Component({
@@ -15,6 +16,7 @@ import {
templateUrl: './summary.component.html',
styleUrls: ['./summary.component.css']
})
+
export class SummaryComponent implements OnInit {
public dsNbJumpByDz: MatTableDataSource;
public dsNbJumpByAircraft: MatTableDataSource;
@@ -26,8 +28,9 @@ export class SummaryComponent implements OnInit {
public dsJumpForLastMonthByDz: MatTableDataSource;
public dsJumpForLastMonthByJumpType: MatTableDataSource;
- private countDatasLoaded: number;
public displayedColumns: Array = ['label', 'nb'];
+ private _shownStats: Map;
+ public StatType = StatType;
constructor(
private serviceApi: StatsService,
@@ -35,30 +38,26 @@ export class SummaryComponent implements OnInit {
) { }
ngOnInit() {
- this.countDatasLoaded = 0;
+ this.initShownStats();
+
this.serviceComm.UpdatedComponentTitle('Summary');
const statsResult = this.serviceApi.getStatsOfJumps();
statsResult.statsByDz.subscribe(data => {
this.dsNbJumpByDz = new MatTableDataSource(data);
- this.countDatasLoaded++;
});
statsResult.statsByAircraft.subscribe(data => {
this.dsNbJumpByAircraft = new MatTableDataSource(data);
- this.countDatasLoaded++;
});
statsResult.statsByGear.subscribe(data => {
this.dsNbJumpByGear = new MatTableDataSource(data);
- this.countDatasLoaded++;
});
statsResult.statsByJumpType.subscribe(data => {
this.dsNbJumpByType = new MatTableDataSource(data);
- this.countDatasLoaded++;
});
statsResult.statsByYear.subscribe(data => {
this.dsNbJumpByYear = new MatTableDataSource(data);
- this.countDatasLoaded++;
});
statsResult.statsForLastYear.subscribe(data => {
@@ -66,18 +65,40 @@ export class SummaryComponent implements OnInit {
this.dsJumpForLastYearByJumpType = new MatTableDataSource(
data.byJumpType
);
- this.countDatasLoaded++;
});
statsResult.statsForLastMonth.subscribe(data => {
this.dsJumpForLastMonthByDz = new MatTableDataSource(data.byDz);
this.dsJumpForLastMonthByJumpType = new MatTableDataSource(
data.byJumpType
);
- this.countDatasLoaded++;
});
}
- public allDatasLoaded(): boolean {
- return this.countDatasLoaded === 7;
+ public showStats(statsToShow: StatType) {
+ this._shownStats.set(StatType.ForLastMonth, false);
+ this._shownStats.set(StatType.ForLastYear, false);
+ this._shownStats.set(StatType.ByDz, false);
+ this._shownStats.set(StatType.ByAircraft, false);
+ this._shownStats.set(StatType.ByGear, false);
+ this._shownStats.set(StatType.ByJumpType, false);
+ this._shownStats.set(StatType.ByYear, false);
+
+ this._shownStats.set(statsToShow, true);
+ }
+
+ private initShownStats() {
+ this._shownStats = new Map();
+
+ this._shownStats.set(StatType.ForLastMonth, false);
+ this._shownStats.set(StatType.ForLastYear, false);
+ this._shownStats.set(StatType.ByDz, false);
+ this._shownStats.set(StatType.ByAircraft, false);
+ this._shownStats.set(StatType.ByGear, false);
+ this._shownStats.set(StatType.ByJumpType, false);
+ this._shownStats.set(StatType.ByYear, true);
+ }
+
+ public statsToShow(statsToShow: StatType): boolean {
+ return this._shownStats.get(statsToShow);
}
}
diff --git a/Front/skydivelogs-app/src/models/stats.ts b/Front/skydivelogs-app/src/models/stats.ts
index f04aa4a..3c584e5 100644
--- a/Front/skydivelogs-app/src/models/stats.ts
+++ b/Front/skydivelogs-app/src/models/stats.ts
@@ -1,4 +1,14 @@
-import { Observable } from "rxjs";
+import { Observable } from 'rxjs';
+
+export enum StatType {
+ ForLastMonth = 1,
+ ForLastYear = 2,
+ ByDz = 3,
+ ByAircraft = 4,
+ ByGear = 5,
+ ByJumpType = 6,
+ ByYear = 7,
+}
export class StatsResp {
public statsByDz: Observable>;