Correction sur l'ajout de sauts sur 1 jour.
This commit is contained in:
@@ -5,3 +5,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: initial;
|
align-items: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<p>
|
<p>
|
||||||
<a routerLink="/summary" routerLinkActive="active" skipLocationChange>
|
<a routerLink="/summary" routerLinkActive="active" skipLocationChange>
|
||||||
<img src="../../assets/img/summary.png" alt="Summary of jumps">
|
<mat-icon aria-hidden="false" aria-label="Summary" style="font-size: 256px;">timeline</mat-icon>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a routerLink="/newjump" routerLinkActive="active" skipLocationChange>
|
<a routerLink="/newjump" routerLinkActive="active" skipLocationChange>
|
||||||
<img src="../../assets/img/addJump_white.png" alt="Add new jumps">
|
<mat-icon aria-hidden="false" aria-label="Add jumps" style="font-size: 256px;">add_circle</mat-icon>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a routerLink="/jumps" routerLinkActive="active" skipLocationChange>
|
||||||
|
<mat-icon aria-hidden="false" aria-label="List of jumps" style="font-size: 256px;">list_alt</mat-icon>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -99,18 +99,17 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.deployAltitude,
|
this.deployAltitude,
|
||||||
this.countOfJumps,
|
this.countOfJumps,
|
||||||
this.comments,
|
this.comments,
|
||||||
this.isSpecial === undefined ? false : this.isSpecial);
|
this.isSpecial === undefined ? false : this.isSpecial)
|
||||||
|
.subscribe(() => {
|
||||||
|
this.comments = undefined;
|
||||||
|
this.withCutaway = false;
|
||||||
|
this.isSpecial = false;
|
||||||
|
|
||||||
setTimeout(() => {
|
if (this.resetForm === true) {
|
||||||
this.comments = undefined;
|
this.initForm();
|
||||||
this.withCutaway = false;
|
}
|
||||||
this.isSpecial = false;
|
this.pendingAddRequest = false;
|
||||||
|
});
|
||||||
if (this.resetForm === true) {
|
|
||||||
this.initForm();
|
|
||||||
}
|
|
||||||
this.pendingAddRequest = false;
|
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public isValidatedForm(): boolean {
|
public isValidatedForm(): boolean {
|
||||||
@@ -169,7 +168,8 @@ export class NewJumpComponent implements OnInit {
|
|||||||
|
|
||||||
private initForm() {
|
private initForm() {
|
||||||
this.endDate = new Date();
|
this.endDate = new Date();
|
||||||
this.beginDate = this.dateService.AddDays(new Date(), -1);
|
this.endDate.setHours(0, 0, 0, 0);
|
||||||
|
this.beginDate = this.dateService.AddDays(this.endDate, -1);
|
||||||
|
|
||||||
this.exitAltitude = 4000;
|
this.exitAltitude = 4000;
|
||||||
this.deployAltitude = 1000;
|
this.deployAltitude = 1000;
|
||||||
|
|||||||
@@ -11,10 +11,11 @@ export class DateService {
|
|||||||
public AddDays(currentDate: Date, nbDays: number): Date {
|
public AddDays(currentDate: Date, nbDays: number): Date {
|
||||||
const totalMilliSeconds = nbDays * this.milliSeconInDay;
|
const totalMilliSeconds = nbDays * this.milliSeconInDay;
|
||||||
const currentTime = currentDate.getTime();
|
const currentTime = currentDate.getTime();
|
||||||
|
const tmpDate = new Date(currentDate.getTime());
|
||||||
|
|
||||||
currentDate.setTime(currentTime + totalMilliSeconds);
|
tmpDate.setTime(currentTime + totalMilliSeconds);
|
||||||
|
|
||||||
return currentDate;
|
return tmpDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiffBetweenDates(beginDate: Date, endDate: Date): number {
|
public DiffBetweenDates(beginDate: Date, endDate: Date): number {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { Observable } from "rxjs";
|
import { forkJoin, Observable, of } from "rxjs";
|
||||||
import { map } from "rxjs/operators";
|
import { map } from "rxjs/operators";
|
||||||
|
|
||||||
import { JumpResp, JumpReq, Jump } from "../models/jump";
|
import { JumpResp, JumpReq, Jump } from "../models/jump";
|
||||||
@@ -19,6 +19,8 @@ import { GearService } from "./gear.service";
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class JumpService extends BaseService {
|
export class JumpService extends BaseService {
|
||||||
|
private callsToAdd : Array<Observable<any>>;
|
||||||
|
|
||||||
constructor(private http: HttpClient,
|
constructor(private http: HttpClient,
|
||||||
private dateService: DateService,
|
private dateService: DateService,
|
||||||
private datePipe: DatePipe,
|
private datePipe: DatePipe,
|
||||||
@@ -48,8 +50,9 @@ export class JumpService extends BaseService {
|
|||||||
defaultDeployAltitude: number,
|
defaultDeployAltitude: number,
|
||||||
countOfJumps: number,
|
countOfJumps: number,
|
||||||
notes: string,
|
notes: string,
|
||||||
isSpecial: boolean)
|
isSpecial: boolean): Observable<any[]>
|
||||||
{
|
{
|
||||||
|
this.callsToAdd = new Array<Observable<any>>();
|
||||||
const diffInDays = this.dateService.DiffBetweenDates(beginDate, endDate) + 1;
|
const diffInDays = this.dateService.DiffBetweenDates(beginDate, endDate) + 1;
|
||||||
const countOfJumpsPerDay = Math.trunc(countOfJumps / diffInDays);
|
const countOfJumpsPerDay = Math.trunc(countOfJumps / diffInDays);
|
||||||
|
|
||||||
@@ -82,6 +85,8 @@ export class JumpService extends BaseService {
|
|||||||
restfJumps,
|
restfJumps,
|
||||||
notes,
|
notes,
|
||||||
isSpecial);
|
isSpecial);
|
||||||
|
|
||||||
|
return forkJoin(this.callsToAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeleteJump(item: Jump) {
|
public DeleteJump(item: Jump) {
|
||||||
@@ -134,10 +139,14 @@ export class JumpService extends BaseService {
|
|||||||
isSpecial: isSpecial
|
isSpecial: isSpecial
|
||||||
};
|
};
|
||||||
|
|
||||||
this.http.post(`${this.apiUrl}/Jump`,
|
// let call = this.http.post(`${this.apiUrl}/Jump`,
|
||||||
bodyNewjump,
|
// bodyNewjump,
|
||||||
{ headers: this.headers, })
|
// { headers: this.headers });
|
||||||
.subscribe();
|
let call = of("2");
|
||||||
|
|
||||||
|
console.warn("Jump : " + i);
|
||||||
|
|
||||||
|
this.callsToAdd.push(call);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user