Skip to content
Snippets Groups Projects
Commit ed95f176 authored by Jean-Laurent DUZANT's avatar Jean-Laurent DUZANT
Browse files

Merge branch 'develop' into 'fix/23980/develop'

# Fix conflicts:
#   src/frontend/app/app.component.ts
parents 76359765 420f1f52
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@
<ion-button color="danger" (click)="closePad()">
<ion-label>{{'lang.cancel' | translate}}</ion-label>
</ion-button>
<ion-button color="success" (click)="saveSignature()">
<ion-button color="success" (click)="saveSignature()" [disabled]="isSaving">
<ion-label>{{'lang.save' | translate}}</ion-label>
</ion-button>
</ion-footer>
......
import { Component, ViewChild, Output, EventEmitter } from '@angular/core';
import { SignaturePad } from 'angular2-signaturepad';
import { Observable } from 'rxjs';
import { Observable, of } from 'rxjs';
import { SignaturesContentService } from '../service/signatures.service';
import { HttpClient } from '@angular/common/http';
import { NotificationService } from '../service/notification.service';
import { TranslateService } from '@ngx-translate/core';
import { finalize } from 'rxjs/operators';
import { catchError, finalize, tap } from 'rxjs/operators';
import { AuthService } from '../service/auth.service';
import { LocalStorageService } from '../service/local-storage.service';
import { ModalController } from '@ionic/angular';
......@@ -28,6 +28,7 @@ export class SignaturePadPageComponent implements AfterViewInit {
selectedColor: any;
haveSigned: any;
disableState = false;
isSaving: boolean = false;
pad$: Observable<boolean>;
......@@ -84,6 +85,7 @@ export class SignaturePadPageComponent implements AfterViewInit {
saveSignature() {
this.disableState = true;
this.haveSigned = true;
this.isSaving = true;
const newEncodedSign = this.signaturePad.toDataURL('image/png').replace('data:image/png;base64,', '');
this.localStorage.save('signature', JSON.stringify(newEncodedSign));
......@@ -96,21 +98,26 @@ export class SignaturePadPageComponent implements AfterViewInit {
this.http.post('../rest/users/' + this.authService.user.id + '/signatures', newSign)
.pipe(
tap((data: any) => {
newSign.id = data.signatureId;
this.signaturesService.signaturesList.unshift(
{
id: newSign.id,
encodedSignature: newSign.encodedSignature
}
);
this.modalController.dismiss('reload');
this.notificationService.success('lang.signatureRegistered');
}),
finalize(() => {
this.disableState = false;
}),
catchError((err: any) => {
this.notificationService.handleErrors(err);
this.isSaving = false;
return of(false);
})
)
.subscribe((data: any) => {
newSign.id = data.signatureId;
this.signaturesService.signaturesList.unshift(
{
id: newSign.id,
encodedSignature: newSign.encodedSignature
}
);
this.modalController.dismiss('reload');
this.notificationService.success('lang.signatureRegistered');
});
).subscribe();
// BUG IMAGE CROPPED
// this.localStorage.save('signature', JSON.stringify(this.signaturePad.toDataURL('image/svg+xml')));
......
......@@ -78,7 +78,8 @@ export class SidebarComponent implements OnInit, AfterViewInit {
async openProfile() {
const modal = await this.modalController.create({
component: ProfileComponent,
cssClass: 'profileCss'
cssClass: 'profileCss',
backdropDismiss: false
});
await modal.present();
}
......
......@@ -92,8 +92,14 @@ input:read-only {
}
.profileCss {
--width: 40%;
--height: 65%;
@media screen and (min-width: 768px) and (min-height: 768px) {
--width: 56%;
--height: 600px
}
@media screen and (min-width: 768px) and (min-height: 600px) {
--width: 56%;
--height: 600px
}
}
.aboutUsCss {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment