Ajout d'un champs "Commentaires" lors de l'ajoute de sauts
This commit is contained in:
@@ -50,14 +50,6 @@
|
|||||||
</button>
|
</button>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<!-- <div>
|
|
||||||
<label>Float label: </label>
|
|
||||||
<mat-radio-group [(ngModel)]="toto" name="toto">
|
|
||||||
<mat-radio-button value="dz">DZ</mat-radio-button>
|
|
||||||
<mat-radio-button value="tunel">Tunel</mat-radio-button>
|
|
||||||
</mat-radio-group>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>Choose the used gear</mat-label>
|
<mat-label>Choose the used gear</mat-label>
|
||||||
<input type="text" matInput [matAutocomplete]="autoGear" [(ngModel)]="selectedGear" name="selectedGear">
|
<input type="text" matInput [matAutocomplete]="autoGear" [(ngModel)]="selectedGear" name="selectedGear">
|
||||||
@@ -109,6 +101,14 @@
|
|||||||
</button>
|
</button>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<input matInput placeholder="Comments" [(ngModel)]="comments" name="comments" type="text"/>
|
||||||
|
<button mat-button *ngIf="comments" matSuffix mat-icon-button aria-label="Clear"
|
||||||
|
(click)="comments=undefined">
|
||||||
|
<mat-icon>close</mat-icon>
|
||||||
|
</button>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<button mat-raised-button color="accent" *ngIf="isValidatedForm()">Submit</button>
|
<button mat-raised-button color="accent" *ngIf="isValidatedForm()">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export class NewJumpComponent implements OnInit {
|
|||||||
listOfGear: Array<GearResp>;
|
listOfGear: Array<GearResp>;
|
||||||
private countDatasLoaded: number;
|
private countDatasLoaded: number;
|
||||||
private pendingAddRequest: boolean;
|
private pendingAddRequest: boolean;
|
||||||
|
comments: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
@@ -68,7 +69,8 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.endDate,
|
this.endDate,
|
||||||
this.exitAltitude,
|
this.exitAltitude,
|
||||||
this.deployAltitude,
|
this.deployAltitude,
|
||||||
this.countOfJumps
|
this.countOfJumps,
|
||||||
|
this.comments
|
||||||
);
|
);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -40,10 +40,7 @@ export class AuthenticationService extends BaseService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(user => {
|
map(user => {
|
||||||
// store user details and basic auth credentials in local storage to keep user logged in between page refreshes
|
this.pushUserToken(username, password, user);
|
||||||
user.authdata = window.btoa(username + ":" + password);
|
|
||||||
localStorage.setItem("currentUser", JSON.stringify(user));
|
|
||||||
this.currentUserSubject.next(user);
|
|
||||||
return user;
|
return user;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -56,15 +53,19 @@ export class AuthenticationService extends BaseService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(user => {
|
map(user => {
|
||||||
// store user details and basic auth credentials in local storage to keep user logged in between page refreshes
|
this.pushUserToken(newUser.login, newUser.password, user);
|
||||||
user.authdata = window.btoa(newUser.login + ":" + newUser.password);
|
|
||||||
localStorage.setItem("currentUser", JSON.stringify(user));
|
|
||||||
this.currentUserSubject.next(user);
|
|
||||||
return user;
|
return user;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private pushUserToken(login: string, password: string, user: any){
|
||||||
|
// store user details and basic auth credentials in local storage to keep user logged in between page refreshes
|
||||||
|
user.authdata = window.btoa(login + ":" + password);
|
||||||
|
localStorage.setItem("currentUser", JSON.stringify(user));
|
||||||
|
this.currentUserSubject.next(user);
|
||||||
|
}
|
||||||
|
|
||||||
private alwaysLogin() {
|
private alwaysLogin() {
|
||||||
return this.http.get(`${this.apiUrl}/User/AlwayLogin`, {
|
return this.http.get(`${this.apiUrl}/User/AlwayLogin`, {
|
||||||
headers: this.headers
|
headers: this.headers
|
||||||
|
|||||||
@@ -37,10 +37,9 @@ export class JumpService extends BaseService {
|
|||||||
endDate: Date,
|
endDate: Date,
|
||||||
defaultExitAltitude: number,
|
defaultExitAltitude: number,
|
||||||
defaultDeployAltitude: number,
|
defaultDeployAltitude: number,
|
||||||
countOfJumps: number
|
countOfJumps: number,
|
||||||
) {
|
notes: string) {
|
||||||
const diffInDays =
|
const diffInDays = this.dateService.DiffBetweenDates(beginDate, endDate) + 1;
|
||||||
this.dateService.DiffBetweenDates(beginDate, endDate) + 1;
|
|
||||||
const countOfJumpsPerDay = Math.trunc(countOfJumps / diffInDays);
|
const countOfJumpsPerDay = Math.trunc(countOfJumps / diffInDays);
|
||||||
|
|
||||||
for (let i = 1; beginDate.getTime() < endDate.getTime(); i++) {
|
for (let i = 1; beginDate.getTime() < endDate.getTime(); i++) {
|
||||||
@@ -53,7 +52,8 @@ export class JumpService extends BaseService {
|
|||||||
beginDate,
|
beginDate,
|
||||||
defaultExitAltitude,
|
defaultExitAltitude,
|
||||||
defaultDeployAltitude,
|
defaultDeployAltitude,
|
||||||
countOfJumpsPerDay
|
countOfJumpsPerDay,
|
||||||
|
notes
|
||||||
);
|
);
|
||||||
|
|
||||||
beginDate = this.dateService.AddDays(beginDate, 1);
|
beginDate = this.dateService.AddDays(beginDate, 1);
|
||||||
@@ -70,7 +70,8 @@ export class JumpService extends BaseService {
|
|||||||
beginDate,
|
beginDate,
|
||||||
defaultExitAltitude,
|
defaultExitAltitude,
|
||||||
defaultDeployAltitude,
|
defaultDeployAltitude,
|
||||||
restfJumps
|
restfJumps,
|
||||||
|
notes
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +84,8 @@ export class JumpService extends BaseService {
|
|||||||
jumpDate: Date,
|
jumpDate: Date,
|
||||||
defaultExitAltitude: number,
|
defaultExitAltitude: number,
|
||||||
defaultDeployAltitude: number,
|
defaultDeployAltitude: number,
|
||||||
countOfJumps: number
|
countOfJumps: number,
|
||||||
|
notes: string
|
||||||
) {
|
) {
|
||||||
for (let i = 0; i < countOfJumps; i++) {
|
for (let i = 0; i < countOfJumps; i++) {
|
||||||
const bodyNewjump: JumpReq = {
|
const bodyNewjump: JumpReq = {
|
||||||
@@ -94,7 +96,7 @@ export class JumpService extends BaseService {
|
|||||||
exitAltitude: defaultExitAltitude,
|
exitAltitude: defaultExitAltitude,
|
||||||
deployAltitude: defaultDeployAltitude,
|
deployAltitude: defaultDeployAltitude,
|
||||||
gearId: selectedRig,
|
gearId: selectedRig,
|
||||||
notes: "",
|
notes: notes,
|
||||||
id: 0,
|
id: 0,
|
||||||
jumpDate: jumpDate,
|
jumpDate: jumpDate,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user