| @@ -102,17 +102,17 @@ export class BotService { | |||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * Function to delete a share |    * Function to delete a share | ||||||
|    * @param  {string} symbol |    * @param  {string} isin | ||||||
|    * @returns Observable |    * @returns Observable | ||||||
|    */ |    */ | ||||||
|   public deleteShare(symbol: string): Observable<any> { |   public deleteShare(isin: string): Observable<any> { | ||||||
|     return this.http.delete(API_URL + 'share', { |     return this.http.delete(API_URL + 'share', { | ||||||
|       headers: new HttpHeaders({ |       headers: new HttpHeaders({ | ||||||
|         'Content-Type': 'application/json', |         'Content-Type': 'application/json', | ||||||
|         Authorization: 'Bearer ' + this.tokenStorage.getToken(), |         Authorization: 'Bearer ' + this.tokenStorage.getToken(), | ||||||
|       }), |       }), | ||||||
|       body: { |       body: { | ||||||
|         symbol, |         isin, | ||||||
|       }, |       }, | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -140,7 +140,7 @@ | |||||||
|             <!-- Name Column --> |             <!-- Name Column --> | ||||||
|             <ng-container matColumnDef="name"> |             <ng-container matColumnDef="name"> | ||||||
|               <th mat-header-cell *matHeaderCellDef>Price</th> |               <th mat-header-cell *matHeaderCellDef>Price</th> | ||||||
|               <td mat-cell *matCellDef="let element">{{ element.price }}$</td> |               <td mat-cell *matCellDef="let element">{{ element.price }}€</td> | ||||||
|             </ng-container> |             </ng-container> | ||||||
|  |  | ||||||
|             <!-- Weight Column --> |             <!-- Weight Column --> | ||||||
|   | |||||||
| @@ -63,7 +63,7 @@ export class DashboardComponent implements OnInit { | |||||||
|         }); |         }); | ||||||
|       } |       } | ||||||
|       this.dataSourceTransactions = TRANSACTION_DATA; |       this.dataSourceTransactions = TRANSACTION_DATA; | ||||||
|       this.profit = this.depotCurrentValue - this.depotCost; |       this.profit = this.depotCurrentValue + this.depotCost; | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,7 +24,7 @@ | |||||||
|           email |           email | ||||||
|           #email="ngModel" |           #email="ngModel" | ||||||
|         /> |         /> | ||||||
|         <div class="alert-danger" *ngIf="email.errors && f.submitted"> |         <div class="alert alert-danger" *ngIf="email.errors && f.submitted"> | ||||||
|           <div *ngIf="email.errors?.['required']">Email is required</div> |           <div *ngIf="email.errors?.['required']">Email is required</div> | ||||||
|           <div *ngIf="email.errors?.['email']"> |           <div *ngIf="email.errors?.['email']"> | ||||||
|             Email must be a valid email address |             Email must be a valid email address | ||||||
|   | |||||||
| @@ -64,13 +64,16 @@ | |||||||
|             <input |             <input | ||||||
|               type="password" |               type="password" | ||||||
|               matInput |               matInput | ||||||
|               [formControl]="passwordFormControl" |               [formControl]="passwordRepeatFormControl" | ||||||
|               placeholder="Ex. pat@example.com" |               placeholder="Ex. pat@example.com" | ||||||
|  |               minlength="6" | ||||||
|  |               [(ngModel)]="form.passwordRepeat" | ||||||
|  |               #passwordRepeat | ||||||
|             /> |             /> | ||||||
|             <mat-error |             <mat-error | ||||||
|               *ngIf=" |               *ngIf=" | ||||||
|                 passwordFormControl.hasError('minLength') && |                 passwordRepeatFormControl.hasError('minLength') && | ||||||
|                 !passwordFormControl.hasError('required') |                 !passwordRepeatFormControl.hasError('required') | ||||||
|               " |               " | ||||||
|             > |             > | ||||||
|               Please enter a valid password |               Please enter a valid password | ||||||
| @@ -79,12 +82,18 @@ | |||||||
|               Password is <strong>required</strong> |               Password is <strong>required</strong> | ||||||
|             </mat-error> |             </mat-error> | ||||||
|           </mat-form-field> |           </mat-form-field> | ||||||
|  |           <div class="alert-danger" *ngIf="checkPasswordFailed"> | ||||||
|  |             Password does not match, make sure it is the same! | ||||||
|  |           </div> | ||||||
|  |           <br /> | ||||||
|           <div class="form-group footer-buttons"> |           <div class="form-group footer-buttons"> | ||||||
|             <button |             <button | ||||||
|               class="btn btn-primary btn-block" |               class="btn btn-primary btn-block" | ||||||
|               [disabled]=" |               [disabled]=" | ||||||
|  |                 passwordRepeatFormControl.hasError('required') || | ||||||
|  |                 !passwordRepeatFormControl.hasError('minLength') || | ||||||
|                 passwordFormControl.hasError('required') || |                 passwordFormControl.hasError('required') || | ||||||
|                 passwordFormControl.hasError('minLength') || |                 !passwordFormControl.hasError('minLength') || | ||||||
|                 userNameFormControl.hasError('required') |                 userNameFormControl.hasError('required') | ||||||
|               " |               " | ||||||
|             > |             > | ||||||
|   | |||||||
| @@ -16,6 +16,10 @@ export class ProfileComponent implements OnInit { | |||||||
|     Validators.required, |     Validators.required, | ||||||
|     Validators.minLength(6), |     Validators.minLength(6), | ||||||
|   ]); |   ]); | ||||||
|  |   passwordRepeatFormControl = new FormControl('', [ | ||||||
|  |     Validators.required, | ||||||
|  |     Validators.minLength(6), | ||||||
|  |   ]); | ||||||
|   telegramIdFormControl = new FormControl('', [ |   telegramIdFormControl = new FormControl('', [ | ||||||
|     Validators.required, |     Validators.required, | ||||||
|     Validators.minLength(6), |     Validators.minLength(6), | ||||||
| @@ -26,9 +30,12 @@ export class ProfileComponent implements OnInit { | |||||||
|   form: any = { |   form: any = { | ||||||
|     username: null, |     username: null, | ||||||
|     email: 'example@web.com', |     email: 'example@web.com', | ||||||
|     password: 'password', |     password: null, | ||||||
|  |     passwordRepeat: null, | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|  |   checkPasswordFailed = false; | ||||||
|  |  | ||||||
|   constructor( |   constructor( | ||||||
|     private profileService: ProfileService, |     private profileService: ProfileService, | ||||||
|     public dialog: MatDialog |     public dialog: MatDialog | ||||||
| @@ -57,18 +64,24 @@ export class ProfileComponent implements OnInit { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   updateUser() { |   updateUser() { | ||||||
|  |     if (this.form.password === this.form.passwordRepeat) { | ||||||
|  |       this.checkPasswordFailed = false; | ||||||
|       const { username, email, password } = this.form; |       const { username, email, password } = this.form; | ||||||
|       this.profileService |       this.profileService | ||||||
|         .updateProfile(this.form.username, this.form.password) |         .updateProfile(this.form.username, this.form.password) | ||||||
|         .subscribe((result) => { |         .subscribe((result) => { | ||||||
|           console.log(result); |           console.log(result); | ||||||
|         }); |         }); | ||||||
|  |     } else { | ||||||
|  |       this.checkPasswordFailed = true; | ||||||
|  |       console.log("Passwords don't match"); | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   openDialog(action: string) { |   openDialog(action: string) { | ||||||
|     const dialogRef = this.dialog.open(ConfirmationDialogComponent, { |     const dialogRef = this.dialog.open(ConfirmationDialogComponent, { | ||||||
|       width: '50vw', |       width: '50vw', | ||||||
|       height: '20vh', |       height: '25vh', | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     dialogRef.afterClosed().subscribe((result) => { |     dialogRef.afterClosed().subscribe((result) => { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user