diff --git a/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.html b/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.html
index 91b33dc..f59f1dc 100644
--- a/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.html
+++ b/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.html
@@ -9,6 +9,7 @@
{{ 'ListTunnelFlight_CurrentYear' | translate }}
{{ 'ListTunnelFlight_12Months' | translate }}
+ {{ 'ListTunnelFlight_AllFlights' | translate }}
diff --git a/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.ts b/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.ts
index bc4c970..b9c6337 100644
--- a/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.ts
+++ b/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.ts
@@ -103,17 +103,8 @@ export class ListOfTunnelFlightsComponent implements OnInit {
// Get data to show in a table
let endDate = new Date();
- let beginDate = new Date();
endDate.setHours(0, 0, 0, 0);
- switch (this.selectedPeriod) {
- case "currentYear":
- beginDate = new Date(endDate.getFullYear(), 0, 1);
- break;
- case "12Months":
- beginDate = this.dateService.addMonths(endDate, -12);
- beginDate.setDate(1);
- break;
- }
+ let beginDate = this.computeBeginDateByPeriod(this.selectedPeriod, endDate);
this.serviceTunnelFlight.getTunnelFlights(beginDate, endDate)
.subscribe((data) => {
@@ -127,17 +118,8 @@ export class ListOfTunnelFlightsComponent implements OnInit {
// Get data to show in a table
let endDate = new Date();
- let beginDate = new Date();
endDate.setHours(0, 0, 0, 0);
- switch (this.selectedPeriod) {
- case "currentYear":
- beginDate = new Date(endDate.getFullYear(), 0, 1);
- break;
- case "12Months":
- beginDate = this.dateService.addMonths(endDate, -12);
- beginDate.setDate(1);
- break;
- }
+ let beginDate = this.computeBeginDateByPeriod(this.selectedPeriod, endDate);
this.serviceTunnelFlight.getTunnelFlightsByMonth(beginDate, endDate)
.subscribe((data) => {
@@ -200,4 +182,24 @@ export class ListOfTunnelFlightsComponent implements OnInit {
return 'Sum: ' + sum;
};
+
+ private computeBeginDateByPeriod(selectedPeriod: String, endDate: Date): Date {
+ let beginDate = new Date();
+
+ switch (selectedPeriod) {
+ case "currentYear":
+ beginDate = new Date(endDate.getFullYear(), 0, 1);
+ break;
+ case "12Months":
+ beginDate = this.dateService.addMonths(endDate, -12);
+ beginDate.setDate(1);
+ break;
+ case "all":
+ beginDate = this.dateService.addMonths(endDate, -120);
+ beginDate.setDate(1);
+ break;
+ }
+
+ return beginDate;
+ }
}
diff --git a/Front/skydivelogs-app/src/assets/i18n/en.json b/Front/skydivelogs-app/src/assets/i18n/en.json
index 8bb72b7..ef894f8 100644
--- a/Front/skydivelogs-app/src/assets/i18n/en.json
+++ b/Front/skydivelogs-app/src/assets/i18n/en.json
@@ -128,5 +128,6 @@
"ListTunnelFlight_CurrentYear": "On the current year",
"ListTunnelFlight_12Months": "On 12 last months",
"ListTunnelFlight_Add" : "Add tunnel flights",
- "ListTunnelFlight_LoadTable" : "Load the tunnel flights"
+ "ListTunnelFlight_LoadTable" : "Load the tunnel flights",
+ "ListTunnelFlight_AllFlights" : "All"
}
\ No newline at end of file
diff --git a/Front/skydivelogs-app/src/assets/i18n/fr.json b/Front/skydivelogs-app/src/assets/i18n/fr.json
index ad36b94..958e2ed 100644
--- a/Front/skydivelogs-app/src/assets/i18n/fr.json
+++ b/Front/skydivelogs-app/src/assets/i18n/fr.json
@@ -128,5 +128,6 @@
"ListTunnelFlight_CurrentYear": "Dans l'année en cours",
"ListTunnelFlight_12Months": "Sur 12 derniers mois",
"ListTunnelFlight_Add" : "Ajouter du temps en soufflerie",
- "ListTunnelFlight_LoadTable" : "Charger les vols en tunnel"
+ "ListTunnelFlight_LoadTable" : "Charger les vols en tunnel",
+ "ListTunnelFlight_AllFlights" : "Tous les vols"
}
\ No newline at end of file