Ajout d'un champs "Commentaires" lors de l'ajoute de sauts

This commit is contained in:
Sébastien André
2021-02-26 15:06:26 +01:00
parent 6166551927
commit 426dcec7d9
4 changed files with 30 additions and 25 deletions

View File

@@ -50,14 +50,6 @@
</button>
</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-label>Choose the used gear</mat-label>
<input type="text" matInput [matAutocomplete]="autoGear" [(ngModel)]="selectedGear" name="selectedGear">
@@ -109,6 +101,14 @@
</button>
</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 />
<button mat-raised-button color="accent" *ngIf="isValidatedForm()">Submit</button>
</form>

View File

@@ -35,6 +35,7 @@ export class NewJumpComponent implements OnInit {
listOfGear: Array<GearResp>;
private countDatasLoaded: number;
private pendingAddRequest: boolean;
comments: string;
constructor(
private serviceComm: ServiceComm,
@@ -68,7 +69,8 @@ export class NewJumpComponent implements OnInit {
this.endDate,
this.exitAltitude,
this.deployAltitude,
this.countOfJumps
this.countOfJumps,
this.comments
);
setTimeout(() => {

View File

@@ -40,10 +40,7 @@ export class AuthenticationService extends BaseService {
})
.pipe(
map(user => {
// store user details and basic auth credentials in local storage to keep user logged in between page refreshes
user.authdata = window.btoa(username + ":" + password);
localStorage.setItem("currentUser", JSON.stringify(user));
this.currentUserSubject.next(user);
this.pushUserToken(username, password, user);
return user;
})
);
@@ -56,15 +53,19 @@ export class AuthenticationService extends BaseService {
})
.pipe(
map(user => {
// store user details and basic auth credentials in local storage to keep user logged in between page refreshes
user.authdata = window.btoa(newUser.login + ":" + newUser.password);
localStorage.setItem("currentUser", JSON.stringify(user));
this.currentUserSubject.next(user);
this.pushUserToken(newUser.login, newUser.password, 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() {
return this.http.get(`${this.apiUrl}/User/AlwayLogin`, {
headers: this.headers

View File

@@ -37,10 +37,9 @@ export class JumpService extends BaseService {
endDate: Date,
defaultExitAltitude: number,
defaultDeployAltitude: number,
countOfJumps: number
) {
const diffInDays =
this.dateService.DiffBetweenDates(beginDate, endDate) + 1;
countOfJumps: number,
notes: string) {
const diffInDays = this.dateService.DiffBetweenDates(beginDate, endDate) + 1;
const countOfJumpsPerDay = Math.trunc(countOfJumps / diffInDays);
for (let i = 1; beginDate.getTime() < endDate.getTime(); i++) {
@@ -53,7 +52,8 @@ export class JumpService extends BaseService {
beginDate,
defaultExitAltitude,
defaultDeployAltitude,
countOfJumpsPerDay
countOfJumpsPerDay,
notes
);
beginDate = this.dateService.AddDays(beginDate, 1);
@@ -70,7 +70,8 @@ export class JumpService extends BaseService {
beginDate,
defaultExitAltitude,
defaultDeployAltitude,
restfJumps
restfJumps,
notes
);
}
@@ -83,7 +84,8 @@ export class JumpService extends BaseService {
jumpDate: Date,
defaultExitAltitude: number,
defaultDeployAltitude: number,
countOfJumps: number
countOfJumps: number,
notes: string
) {
for (let i = 0; i < countOfJumps; i++) {
const bodyNewjump: JumpReq = {
@@ -94,7 +96,7 @@ export class JumpService extends BaseService {
exitAltitude: defaultExitAltitude,
deployAltitude: defaultDeployAltitude,
gearId: selectedRig,
notes: "",
notes: notes,
id: 0,
jumpDate: jumpDate,
};