Skip to content
Snippets Groups Projects
Verified Commit 320ca5e4 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

split document.component

parent 5e121d6b
No related branches found
No related tags found
No related merge requests found
Showing
with 559 additions and 488 deletions
......@@ -20,13 +20,16 @@ import { SignaturesComponent } from './signatures/signatures.component';
import { SignaturePadPageComponent } from './pad/pad.component';
import { SignaturePadModule } from 'angular2-signaturepad';
import { DrawerComponent } from './drawer/drawer.component';
import { DocumentComponent,
WarnModalComponent,
ConfirmModalComponent,
SuccessInfoValidBottomSheetComponent,
RejectInfoBottomSheetComponent } from './document/document.component';
import { DocumentComponent } from './document/document.component';
import { DocumentSignListComponent } from './documentSignList/document-sign-list.component';
import { DocumentNoteListComponent } from './documentNoteList/document-note-list.component';
import { DocumentNotePadComponent } from './documentNotePad/document-note-pad.component';
import { SidebarComponent } from './sidebar/sidebar.component';
import { ProfileComponent } from './profile/profile.component';
import { ConfirmModalComponent } from './modal/confirm-modal.component';
import { WarnModalComponent } from './modal/warn-modal.component';
import { SuccessInfoValidBottomSheetComponent } from './modal/success-info-valid.component';
import { RejectInfoBottomSheetComponent } from './modal/reject-info.component';
// SERVICES
import { NotificationService, CustomSnackbarComponent } from './service/notification.service';
......@@ -42,6 +45,9 @@ import { SignaturesContentService } from './service/signatures.service';
SignaturePadPageComponent,
DrawerComponent,
DocumentComponent,
DocumentSignListComponent,
DocumentNoteListComponent,
DocumentNotePadComponent,
SidebarComponent,
WarnModalComponent,
ConfirmModalComponent,
......
......@@ -43,32 +43,6 @@
</section>
</article>
</header>
<div *ngIf="signaturesService.lockNote">
<span style="z-index:1;position: fixed;bottom: 10px;top: 10px;font-size: 25px;height:50px;">
<button class="btn blue" (tap)="cancelAnnotation(i);"><i
class="fas fa-arrow-left fa-2x"></i>Quitter l'annotation</button>
</span>
<span *ngIf="!lockSignaturePad" style="z-index:1;position: fixed;top: 10px;left: 50%;transform: translateX(-50%);font-size: 25px;">
<button class="btn red" (tap)="test();"><i
class="fas fa-lock fa-2x"></i>Vérouiller la zone de travaille</button>
</span>
<span *ngIf="lockSignaturePad" style="z-index:1;position: fixed;top: 10px;left: 50%;transform: translateX(-50%);font-size: 25px;">
<button class="btn green" (tap)="test();"><i
class="fas fa-lock fa-2x"></i>Dévérouiller la zone de travaille</button>
</span>
<span *ngIf="scale==1" style="z-index:1;position: fixed;top: 10px;right: 0;font-size: 25px;">
<button class="btn blue" (tap)="zoomPlus();"><i
class="fas fa-plus fa-2x"></i>Zoomer</button>
</span>
<span *ngIf="scale==2" style="z-index:1;position: fixed;top: 10px;right: 0px;font-size: 25px;">
<button class="btn blue" (tap)="zoomMinus();"><i
class="fas fa-plus fa-2x"></i>Dézoomer</button>
</span>
<span style="z-index:1;position: fixed;bottom: 10px;left: 50%;transform: translateX(-50%);font-size: 25px;">
<button class="btn green" (click)="$event.stopPropagation();validateAnnotation();"><i
class="fas fa-check-circle fa-2x"></i>Valider l'annotation</button>
</span>
</div>
<article class="article" #article *ngIf="!freezeSidenavClose">
<button class="btn-previous" (click)="prevPage()" *ngIf="pageNum > 1 && !this.signaturesService.annotationMode"><i
class="fas fa-chevron-left fa-3x"></i></button>
......@@ -79,66 +53,18 @@
<button class="btn-next" (click)="nextDoc()" *ngIf="pageNum == totalPages && docList.length > currentDoc+1 && !this.signaturesService.annotationMode"><i
class="fas fa-chevron-right fa-3x"></i><i class="fas fa-chevron-right fa-3x"></i></button>
<div [ngClass]="{'overlay': (annotation$ | async)}"></div>
<div [style.width.px]="768*scale" class="canvas-wrapper" #canvasWrapper>
<div [style.width.px]="768*signaturesService.scale" class="canvas-wrapper" #canvasWrapper>
<pdf-viewer [ngClass]="{
'pdf-page-canvas':!renderingDoc,
'pdf-page-canvas-loading-doc':renderingDoc
}" [src]="pdfDataArr" [render-text]="false" [zoom]="scale" [show-all]="false" [(page)]="pageNum" [original-size]="false" style="display: block;" (after-load-complete)="pdfRendered($event)" (page-rendered)="pageRendered($event)" (click)="addAnnotation($event)"></pdf-viewer>
}" [src]="pdfDataArr" [render-text]="false" [zoom]="signaturesService.scale" [show-all]="false" [(page)]="pageNum" [original-size]="false" style="display: block;" (after-load-complete)="pdfRendered($event)" (page-rendered)="pageRendered($event)" (click)="addAnnotation($event)"></pdf-viewer>
<ng-container *ngIf="currentDoc == 0">
<ng-container *ngFor="let note of this.signaturesService.notesContent[this.signaturesService.currentPage];let i = index;">
<div style="top:0;left:0;position: absolute;" [ngClass]="{
'pdf-page-canvas':!renderingDoc,
'pdf-page-canvas-loading-doc':renderingDoc
}">
<img [style.width.px]="note.width*scale" [src]="sanitization.bypassSecurityTrustUrl(note.fullPath)" (click)="addAnnotation($event)">
</div>
</ng-container>
<ng-container *ngFor="let signature of this.signaturesService.signaturesContent[this.signaturesService.currentPage];let i = index;">
<div [position]="{'x': signature.positionX*scale, 'y': signature.positionY*scale}" id="signaturesContent"
style="top:0;left:0;position: absolute;border: dashed 1px grey;background: rgba(255, 255, 255, 0.6) none repeat scroll 0% 0%;" ngDraggable preventDefaultEvent="true" [bounds]="canvas"
inBounds="true" (endOffset)="moveSign($event,i)" [ngClass]="{
'pdf-page-canvas':!renderingDoc,
'pdf-page-canvas-loading-doc':renderingDoc
}">
<button (tap)="openMenu(menuTrigger)" mat-icon-button #menuTrigger="matMenuTrigger" [matMenuTriggerFor]="menu" style="right: 0;position: absolute;color:#F99830;">
<mat-icon fontSet="fas" fontIcon="fa-ellipsis-v"></mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="$event.stopPropagation();deleteSignature(i);">
<mat-icon fontSet="fas" fontIcon="fa-times"></mat-icon>
<span>Supprimer la signature</span>
</button>
<button [disabled]="signature.inAllPage" mat-menu-item (click)="$event.stopPropagation();cloneSign(i);">
<mat-icon fontSet="fas" fontIcon="fa-clone"></mat-icon>
<span>Cloner la signature</span>
</button>
</mat-menu>
<img [src]="sanitization.bypassSecurityTrustUrl('data:image/png;base64,' + signature.encodedSignature)"
[style.width.px]="this.signaturesService.signWidth">
</div>
</ng-container>
<app-document-note-list (triggerEvent)="addAnnotation($event)"></app-document-note-list>
<app-document-sign-list [canvas]="canvasWrapper"></app-document-sign-list>
<app-document-note-pad [pageNum]="pageNum" #appDocumentNotePad></app-document-note-pad>
<div *ngIf="signaturesService.lockNote" [style.width.px]="this.signaturesService.workingAreaWidth" [style.height.px]="this.signaturesService.workingAreaHeight" style="top:0;position: absolute;border: dashed 1px grey;overflow: hidden;" [ngClass]="{
'pdf-page-canvas':!renderingDoc,
'pdf-page-canvas-loading-doc':renderingDoc
}">
<div class="tool-content tool-content-left">
<input type="range" name="dot" min="1" max="10" step="1" value="1" (input)="onDotChange($event.target.value)"
class="range">
<i class="fas fa-pen-nib"></i>
</div>
<div class="tool-content tool-content-right">
<ng-container *ngFor="let color of penColors" let idx="index">
<input type="radio" name="colors" [checked]="idx === 0" [value]="color.id" (change)="onColorChange(color)"
class="radio" [ngStyle]="{'border-color': color.id, 'background-color': color.id}">
</ng-container>
<hr>
<i class="fa fa-undo fa-2x undo" (click)="undo()"></i>
</div>
<signature-pad id="notePad" [options]="annotationPadOptions"></signature-pad>
<div *ngIf="lockSignaturePad" style="background: #ffffffb3;position: absolute;top: 0;left: 0;width: 100%;height: 100%;"></div>
</div>
</ng-container>
</div>
<div class="page-under">
......
......@@ -190,23 +190,6 @@ button.disabled {
background: rgba(0, 0, 0, 0.5);
}
.radio {
appearance: none;
position: relative;
margin: 5px;
width: 30px;
height: 30px;
border-radius: 30px;
border-width: none;
border-style: solid;
outline: none;
cursor: pointer;
transition: all 0.2s;
&:checked, &:hover {
transform: scale(1.5);
}
}
.pdf-page-canvas {
opacity: 1;
transition: 0.5s opacity ease-in;
......@@ -222,28 +205,3 @@ button.disabled {
overflow: hidden;
text-overflow: ellipsis;
}
.tool-content {
display: flex;
position: fixed;
background: #8080804d;
border-radius: 20px;
top: 170px;
transform: translateY(-50%) rotate(-90deg);
padding: 10px;
&-left {
left: -40px;
}
&-right {
right: -40px;
}
}
.undo {
cursor: pointer;
transform: rotate(90deg);
transition: all 0.2s;
&:active {
transform: rotate(90deg) scale(1.5);
}
}
This diff is collapsed.
<ng-container *ngFor="let note of this.signaturesService.notesContent[this.signaturesService.currentPage];let i = index;">
<div style="top:0;left:0;position: absolute;" [ngClass]="{
'pdf-page-canvas':!renderingDoc,
'pdf-page-canvas-loading-doc':renderingDoc
}">
<img [style.width.px]="note.width*signaturesService.scale" [src]="sanitization.bypassSecurityTrustUrl(note.fullPath)" (click)="triggerAddnnotation($event)">
</div>
</ng-container>
\ No newline at end of file
import { Component, OnInit, Input, ElementRef, EventEmitter, Output } from '@angular/core';
import { SignaturesContentService } from '../service/signatures.service';
import { DomSanitizer } from '@angular/platform-browser';
@Component({
selector: 'app-document-note-list',
templateUrl: 'document-note-list.component.html',
})
export class DocumentNoteListComponent implements OnInit {
@Input() canvas: ElementRef;
@Input() scale: number;
@Output() triggerEvent = new EventEmitter<string>();
constructor(private sanitization: DomSanitizer, public signaturesService: SignaturesContentService) { }
ngOnInit(): void { }
triggerAddnnotation (event: any) {
this.triggerEvent.emit(event);
}
}
<div *ngIf="signaturesService.lockNote">
<span style="z-index:1;position: fixed;bottom: 10px;top: 10px;font-size: 25px;height:50px;">
<button class="btn blue" (tap)="cancelAnnotation(i);"><i class="fas fa-arrow-left fa-2x"></i>Quitter l'annotation</button>
</span>
<span *ngIf="!lockSignaturePad" style="z-index:1;position: fixed;top: 10px;left: 50%;transform: translateX(-50%);font-size: 25px;">
<button class="btn red" (tap)="togglePad();"><i class="fas fa-lock fa-2x"></i>Vérouiller la zone de travaille</button>
</span>
<span *ngIf="lockSignaturePad" style="z-index:1;position: fixed;top: 10px;left: 50%;transform: translateX(-50%);font-size: 25px;">
<button class="btn green" (tap)="togglePad();"><i class="fas fa-lock fa-2x"></i>Dévérouiller la zone de travaille</button>
</span>
<span *ngIf="signaturesService.scale==1" style="z-index:1;position: fixed;top: 10px;right: 0;font-size: 25px;">
<button class="btn blue" (tap)="zoomPlus();"><i class="fas fa-plus fa-2x"></i>Zoomer</button>
</span>
<span *ngIf="signaturesService.scale==2" style="z-index:1;position: fixed;top: 10px;right: 0px;font-size: 25px;">
<button class="btn blue" (tap)="zoomMinus();"><i class="fas fa-plus fa-2x"></i>Dézoomer</button>
</span>
<span style="z-index:1;position: fixed;bottom: 10px;left: 50%;transform: translateX(-50%);font-size: 25px;">
<button class="btn green" (click)="$event.stopPropagation();validateAnnotation();"><i class="fas fa-check-circle fa-2x"></i>Valider
l'annotation</button>
</span>
</div>
<div *ngIf="signaturesService.lockNote" [style.width.px]="this.signaturesService.workingAreaWidth" [style.height.px]="this.signaturesService.workingAreaHeight"
style="top:0;position: absolute;border: dashed 1px grey;overflow: hidden;" [ngClass]="{
'pdf-page-canvas':!renderingDoc,
'pdf-page-canvas-loading-doc':renderingDoc
}">
<div class="tool-content tool-content-left">
<input type="range" name="dot" min="1" max="10" step="1" value="1" (input)="onDotChange($event.target.value)" class="range">
<i class="fas fa-pen-nib"></i>
</div>
<div class="tool-content tool-content-right">
<ng-container *ngFor="let color of penColors" let idx="index">
<input type="radio" name="colors" [checked]="idx === 0" [value]="color.id" (change)="onColorChange(color)" class="radio"
[ngStyle]="{'border-color': color.id, 'background-color': color.id}">
</ng-container>
<hr>
<i class="fa fa-undo fa-2x undo" (click)="undo()"></i>
</div>
<signature-pad id="notePad" [options]="annotationPadOptions"></signature-pad>
<div *ngIf="lockSignaturePad" style="background: #ffffffb3;position: absolute;top: 0;left: 0;width: 100%;height: 100%;"></div>
</div>
\ No newline at end of file
.tool-content {
display: flex;
position: fixed;
background: #8080804d;
border-radius: 20px;
top: 170px;
transform: translateY(-50%) rotate(-90deg);
padding: 10px;
&-left {
left: -40px;
}
&-right {
right: -40px;
}
}
.undo {
cursor: pointer;
transform: rotate(90deg);
transition: all 0.2s;
&:active {
transform: rotate(90deg) scale(1.5);
}
}
.radio {
appearance: none;
position: relative;
margin: 5px;
width: 30px;
height: 30px;
border-radius: 30px;
border-width: none;
border-style: solid;
outline: none;
cursor: pointer;
transition: all 0.2s;
&:checked, &:hover {
transform: scale(1.5);
}
}
import { Component, OnInit, ViewChild, Input, ElementRef } from '@angular/core';
import { SignaturesContentService } from '../service/signatures.service';
import { NotificationService } from '../service/notification.service';
import { DomSanitizer } from '@angular/platform-browser';
import { SignaturePad } from 'angular2-signaturepad/signature-pad';
@Component({
selector: 'app-document-note-pad',
templateUrl: 'document-note-pad.component.html',
styleUrls: ['document-note-pad.component.scss'],
})
export class DocumentNotePadComponent implements OnInit {
lockSignaturePad = false;
penColors = [{ id: 'black' }, { id: '#1a75ff' }, { id: '#FF0000' }];
annotationPadOptions = {
throttle: 0,
minWidth: 1,
maxWidth: 2.5,
backgroundColor: 'rgba(255, 255, 255, 0)',
canvasWidth: 768,
canvasHeight: 270
};
@ViewChild(SignaturePad) signaturePad: SignaturePad;
@Input() pageNum: number;
constructor(private sanitization: DomSanitizer, public signaturesService: SignaturesContentService, public notificationService: NotificationService) { }
ngOnInit(): void { }
onDotChange(entry: any) {
this.signaturePad.set('minWidth', parseFloat(entry));
this.signaturePad.set('maxWidth', parseFloat(entry) + 2);
}
onColorChange(entry: any) {
this.signaturePad.set('penColor', entry.id);
}
undoTag() {
if (this.signaturesService.notesContent[this.pageNum]) {
this.signaturesService.notesContent[this.pageNum].pop();
}
}
resizePad() {
this.annotationPadOptions.canvasWidth = this.signaturesService.workingAreaWidth;
this.annotationPadOptions.canvasHeight = this.signaturesService.workingAreaHeight;
const ratio = Math.max(window.devicePixelRatio || 1, 1);
this.annotationPadOptions.canvasHeight = this.annotationPadOptions.canvasHeight * ratio;
this.annotationPadOptions.canvasWidth = this.annotationPadOptions.canvasWidth * ratio;
if (this.signaturePad !== undefined) {
this.signaturePad.set('canvasWidth', this.annotationPadOptions.canvasWidth);
this.signaturePad.set('canvasHeight', this.annotationPadOptions.canvasHeight);
}
}
cancelAnnotation() {
setTimeout(() => {
this.signaturesService.annotationMode = false;
this.signaturePad.clear();
this.signaturesService.scale = 1;
this.signaturesService.lockNote = false;
}, 200);
}
togglePad() {
if (this.lockSignaturePad) {
this.lockSignaturePad = false;
this.signaturePad.on();
} else {
this.lockSignaturePad = true;
this.signaturePad.off();
}
}
zoomPlus() {
this.signaturesService.renderingDoc = true;
this.lockSignaturePad = true;
this.signaturesService.scale = 2;
}
zoomMinus() {
this.signaturesService.renderingDoc = true;
this.signaturePad.clear();
this.lockSignaturePad = true;
this.signaturesService.scale = 1;
}
validateAnnotation() {
if (!this.signaturesService.notesContent[this.signaturesService.currentPage]) {
this.signaturesService.notesContent[this.signaturesService.currentPage] = [];
}
this.signaturesService.notesContent[this.signaturesService.currentPage].push(
{
'fullPath': this.signaturePad.toDataURL('image/svg+xml'),
'positionX': 0,
'positionY': 0,
'height': this.annotationPadOptions.canvasHeight,
'width': 768,
}
);
this.signaturePad.clear();
if (this.signaturesService.scale > 1) {
this.signaturesService.renderingDoc = true;
}
this.signaturesService.scale = 1;
this.signaturesService.annotationMode = false;
this.signaturesService.lockNote = false;
this.notificationService.success('Annotation ajoutée');
}
undo() {
const data = this.signaturePad.toData();
if (data) {
data.pop(); // remove the last dot or line
this.signaturePad.fromData(data);
}
}
}
<ng-container *ngFor="let signature of this.signaturesService.signaturesContent[this.signaturesService.currentPage];let i = index;">
<div [position]="{'x': signature.positionX*signaturesService.scale, 'y': signature.positionY*signaturesService.scale}" id="signaturesContent" style="top:0;left:0;position: absolute;border: dashed 1px grey;background: rgba(255, 255, 255, 0.6) none repeat scroll 0% 0%;"
ngDraggable preventDefaultEvent="true" [bounds]="canvas" inBounds="true" (endOffset)="moveSign($event,i)" [ngClass]="{
'pdf-page-canvas':!renderingDoc,
'pdf-page-canvas-loading-doc':renderingDoc
}">
<button (tap)="openMenu(menuTrigger)" mat-icon-button #menuTrigger="matMenuTrigger" [matMenuTriggerFor]="menu"
style="right: 0;position: absolute;color:#F99830;">
<mat-icon fontSet="fas" fontIcon="fa-ellipsis-v"></mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="$event.stopPropagation();deleteSignature(i);">
<mat-icon fontSet="fas" fontIcon="fa-times"></mat-icon>
<span>Supprimer la signature</span>
</button>
<button [disabled]="signature.inAllPage" mat-menu-item (click)="$event.stopPropagation();cloneSign(i);">
<mat-icon fontSet="fas" fontIcon="fa-clone"></mat-icon>
<span>Cloner la signature</span>
</button>
</mat-menu>
<img [src]="sanitization.bypassSecurityTrustUrl('data:image/png;base64,' + signature.encodedSignature)"
[style.width.px]="this.signaturesService.signWidth">
</div>
</ng-container>
\ No newline at end of file
import { Component, OnInit, ViewChild, Input, ElementRef } from '@angular/core';
import { SignaturesContentService } from '../service/signatures.service';
import {
MatMenuTrigger,
} from '@angular/material';
import { NotificationService } from '../service/notification.service';
import { DomSanitizer } from '@angular/platform-browser';
@Component({
selector: 'app-document-sign-list',
templateUrl: 'document-sign-list.component.html',
})
export class DocumentSignListComponent implements OnInit {
@Input('canvas') canvas: ElementRef;
@ViewChild('menuTrigger') menuSign: MatMenuTrigger;
constructor(private sanitization: DomSanitizer, public signaturesService: SignaturesContentService, public notificationService: NotificationService) { }
ngOnInit(): void { }
moveSign(event: any, i: number) {
this.signaturesService.signaturesContent[this.signaturesService.currentPage][i].positionX = event.x;
this.signaturesService.signaturesContent[this.signaturesService.currentPage][i].positionY = event.y;
}
cloneSign(i: number) {
const r = confirm('Voulez-vous apposer la signature sur les autres pages ?');
if (r) {
this.signaturesService.signaturesContent[this.signaturesService.currentPage][i].inAllPage = true;
this.signaturesService.signaturesContent[this.signaturesService.currentPage][i].token = Math.random().toString(36).substr(2, 9);
for (let index = 1; index <= this.signaturesService.totalPage; index++) {
if (!this.signaturesService.signaturesContent[index]) {
this.signaturesService.signaturesContent[index] = [];
}
if (index !== this.signaturesService.currentPage) {
this.signaturesService.signaturesContent[index].push(JSON.parse(JSON.stringify(this.signaturesService.signaturesContent[this.signaturesService.currentPage][i])));
}
}
}
this.menuSign.closeMenu();
}
deleteSignature(i: number) {
if (this.signaturesService.signaturesContent[this.signaturesService.currentPage][i].inAllPage === true) {
const token = this.signaturesService.signaturesContent[this.signaturesService.currentPage][i].token;
const r = confirm('Voulez-vous supprimer la signature sur les autres pages ?');
if (r) {
for (let index = 1; index <= this.signaturesService.totalPage; index++) {
if (!this.signaturesService.signaturesContent[index]) {
this.signaturesService.signaturesContent[index] = [];
}
for (let index2 = 0; index2 <= this.signaturesService.signaturesContent[index].length; index2++) {
if (this.signaturesService.signaturesContent[index][index2]) {
if (token === this.signaturesService.signaturesContent[index][index2].token) {
this.signaturesService.signaturesContent[index].splice(index2, 1);
}
}
}
}
} else {
this.signaturesService.signaturesContent[this.signaturesService.currentPage].splice(i, 1);
}
} else {
this.signaturesService.signaturesContent[this.signaturesService.currentPage].splice(i, 1);
}
}
// USE TO PREVENT ISSUE IN MOBILE
openMenu(menu: MatMenuTrigger) {
menu.openMenu();
}
}
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { SignaturesContentService } from '../service/signatures.service';
import { NotificationService } from '../service/notification.service';
import { HttpClient } from '@angular/common/http';
@Component({
templateUrl: 'confirm-modal.component.html',
styleUrls: ['confirm-modal.component.scss']
})
export class ConfirmModalComponent {
disableState = false;
constructor(@Inject(MAT_DIALOG_DATA) public data: any, public http: HttpClient, public dialogRef: MatDialogRef<ConfirmModalComponent>, public signaturesService: SignaturesContentService, public notificationService: NotificationService) { }
confirmDoc () {
const signatures: any[] = [];
if (this.signaturesService.currentAction > 0) {
for (let index = 1; index <= this.signaturesService.totalPage; index++) {
if (this.signaturesService.signaturesContent[index]) {
this.signaturesService.signaturesContent[index].forEach((signature: any) => {
signatures.push(
{
'encodedImage' : signature.encodedSignature,
'width' : (this.signaturesService.signWidth * 100) / signature.pdfAreaX,
'positionX' : (signature.positionX * 100) / signature.pdfAreaX,
'positionY' : (signature.positionY * 100) / signature.pdfAreaY,
'type' : 'PNG',
'page' : index,
}
);
});
}
if (this.signaturesService.notesContent[index]) {
this.signaturesService.notesContent[index].forEach((note: any) => {
signatures.push(
{
'encodedImage' : note.fullPath,
'width' : note.width,
'positionX' : note.positionX,
'positionY' : note.positionY,
'type' : 'SVG',
'page' : index,
}
);
});
}
}
this.disableState = true;
this.http.put('../rest/documents/' + this.signaturesService.mainDocumentId + '/actions/' + this.signaturesService.currentAction, {'signatures': signatures})
.subscribe(() => {
this.disableState = false;
this.dialogRef.close('sucess');
this.signaturesService.documentsList.splice(this.signaturesService.indexDocumentsList, 1);
if (this.signaturesService.documentsListCount > 0) {
this.signaturesService.documentsListCount--;
}
}, (err: any) => {
this.notificationService.handleErrors(err);
this.disableState = false;
});
} else {
this.dialogRef.close('sucess');
}
}
}
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { SignaturesContentService } from '../service/signatures.service';
import { MatBottomSheetRef } from '@angular/material';
@Component({
templateUrl: '../modal/reject-info.html',
styleUrls: ['../modal/reject-info.scss']
})
export class RejectInfoBottomSheetComponent implements OnInit {
date: Date = new Date();
constructor(private router: Router, public signaturesService: SignaturesContentService, private bottomSheetRef: MatBottomSheetRef<RejectInfoBottomSheetComponent>) { }
ngOnInit(): void {
setTimeout(() => {
if (this.signaturesService.documentsList[this.signaturesService.indexDocumentsList]) {
this.router.navigate(['/documents/' + this.signaturesService.documentsList[this.signaturesService.indexDocumentsList].id]);
} else {
this.router.navigate(['/documents']);
}
this.bottomSheetRef.dismiss();
}, 2000);
}
}
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { SignaturesContentService } from '../service/signatures.service';
import { MatBottomSheetRef } from '@angular/material';
@Component({
templateUrl: 'success-info-valid.html',
styleUrls: ['success-info-valid.scss']
})
export class SuccessInfoValidBottomSheetComponent implements OnInit {
date: Date = new Date();
constructor(private router: Router, public signaturesService: SignaturesContentService, private bottomSheetRef: MatBottomSheetRef<SuccessInfoValidBottomSheetComponent>) { }
ngOnInit(): void {
setTimeout(() => {
if (this.signaturesService.documentsList[this.signaturesService.indexDocumentsList]) {
this.router.navigate(['/documents/' + this.signaturesService.documentsList[this.signaturesService.indexDocumentsList].id]);
} else {
this.router.navigate(['/documents']);
}
this.bottomSheetRef.dismiss();
}, 2000);
}
}
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { SignaturesContentService } from '../service/signatures.service';
import { NotificationService } from '../service/notification.service';
import { HttpClient } from '@angular/common/http';
@Component({
templateUrl: 'warn-modal.component.html',
styleUrls: ['warn-modal.component.scss']
})
export class WarnModalComponent {
disableState = false;
constructor(@Inject(MAT_DIALOG_DATA) public data: any, public http: HttpClient, public dialogRef: MatDialogRef<WarnModalComponent>, public signaturesService: SignaturesContentService, public notificationService: NotificationService) { }
confirmDoc () {
const signatures: any[] = [];
if (this.signaturesService.currentAction > 0) {
for (let index = 1; index <= this.signaturesService.totalPage; index++) {
if (this.signaturesService.signaturesContent[index]) {
this.signaturesService.signaturesContent[index].forEach((signature: any) => {
signatures.push(
{
'encodedImage' : signature.encodedSignature,
'width' : (this.signaturesService.signWidth * 100) / signature.pdfAreaX,
'positionX' : (signature.positionX * 100) / signature.pdfAreaX,
'positionY' : (signature.positionY * 100) / signature.pdfAreaY,
'type' : 'PNG',
'page' : index
}
);
});
}
if (this.signaturesService.notesContent[index]) {
this.signaturesService.notesContent[index].forEach((note: any) => {
signatures.push(
{
'encodedImage' : note.fullPath,
'width' : note.width,
'positionX' : note.positionX,
'positionY' : note.positionY,
'type' : 'SVG',
'page' : index
}
);
});
}
}
this.disableState = true;
this.http.put('../rest/documents/' + this.signaturesService.mainDocumentId + '/actions/' + this.signaturesService.currentAction, {'signatures': signatures})
.subscribe(() => {
this.signaturesService.documentsList.splice(this.signaturesService.indexDocumentsList, 1);
if (this.signaturesService.documentsListCount > 0) {
this.signaturesService.documentsListCount--;
}
this.disableState = false;
this.dialogRef.close('sucess');
}, (err: any) => {
this.notificationService.handleErrors(err);
this.disableState = false;
});
} else {
this.dialogRef.close('sucess');
}
}
}
......@@ -25,4 +25,6 @@ export class SignaturesContentService {
newSign: any = {};
workingAreaWidth = 0;
workingAreaHeight = 0;
renderingDoc = true;
scale = 1;
}
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