diff --git a/src/app/document/controllers/DocumentController.php b/src/app/document/controllers/DocumentController.php index ebd91d0209ace56b7f22de5c961831b2b4aef349..901dd097bf5e3b8831ce3c6a317449cefc0b10fb 100755 --- a/src/app/document/controllers/DocumentController.php +++ b/src/app/document/controllers/DocumentController.php @@ -373,7 +373,7 @@ class DocumentController foreach ($body['signatures'] as $signature) { if ($signature['page'] == $i) { if ($signature['positionX'] == 0 && $signature['positionY'] == 0) { - $signWidth = $size['width']*2; + $signWidth = $size['width']; $signPosX = 0; $signPosY = 0; } else { diff --git a/src/frontend/app/document/document-list/document-list.component.html b/src/frontend/app/document/document-list/document-list.component.html index aa9bb3d98fa213aa797200fb898650b2da9907bc..884ca9debce99c60d8e9529d8df89cac71238aab 100644 --- a/src/frontend/app/document/document-list/document-list.component.html +++ b/src/frontend/app/document/document-list/document-list.component.html @@ -1,6 +1,6 @@ <div class="panel-content" *ngIf="!loading"> <div class="panel-header"> - <button class="closePanel" mat-icon-button type="button" (tap)="snavRightComponent.close();"> + <button *ngIf="signaturesService.mobileMode" class="closePanel" mat-icon-button type="button" (tap)="snavRightComponent.close();"> <mat-icon fontSet="fas" fontIcon="fa-arrow-right fa-2x"></mat-icon> </button> <mat-icon fontSet="fas" fontIcon="fa-file fa-2x"></mat-icon> <b>{{docList.length}}</b> document(s) diff --git a/src/frontend/app/document/document-list/document-list.component.ts b/src/frontend/app/document/document-list/document-list.component.ts index cfc7bed5815cea0f099dac3d32b345137a2a05fd..0673aa0332a2eac119ca2b3ccbdb7f2d25d41fdb 100644 --- a/src/frontend/app/document/document-list/document-list.component.ts +++ b/src/frontend/app/document/document-list/document-list.component.ts @@ -1,7 +1,6 @@ import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { NotificationService } from '../../service/notification.service'; import { MatSidenav } from '@angular/material'; +import { SignaturesContentService } from '../../service/signatures.service'; @Component({ selector: 'app-document-list', @@ -21,13 +20,15 @@ export class DocumentListComponent implements OnInit { @Output() triggerEvent = new EventEmitter<string>(); - constructor(public http: HttpClient, public notificationService: NotificationService) { } + constructor(public signaturesService: SignaturesContentService) { } ngOnInit(): void { } loadDoc(id: string) { this.triggerEvent.emit(id); - this.snavRightComponent.close(); + if (this.signaturesService.mobileMode) { + this.snavRightComponent.close(); + } } } diff --git a/src/frontend/app/document/document.component.html b/src/frontend/app/document/document.component.html index 45dc01a24360715576d9f5d078d8bdb8ace505e9..76412519fb01f212960776b8cee6b8da3d5809bd 100755 --- a/src/frontend/app/document/document.component.html +++ b/src/frontend/app/document/document.component.html @@ -13,72 +13,23 @@ <header class="header" *ngIf="!this.signaturesService.annotationMode && !freezeSidenavClose" [@slideDown]> <article class="header-infos"> <section class="header-action"> - <button *ngIf="signaturesService.mobileMode" mat-icon-button (click)="this.snav.toggle();"> + <button *ngIf="signaturesService.mobileMode" mat-icon-button (click)="this.snav.toggle();" style="width:70px;"> <mat-icon fontSet="fas" fontIcon="fa-bars"></mat-icon> </button> - <button mat-icon-button (click)="openMainDocumentDetail();"> - <mat-icon fontSet="fas" fontIcon="fa-info-circle"></mat-icon> + <button mat-button (click)="openMainDocumentDetail();"> + <i class="fas fa-info-circle fa-2x"></i><span style="display: block">Informations</span> </button> </section> - <!--<mat-accordion class="header-expand"> - <mat-expansion-panel> - <mat-expansion-panel-header> - <mat-panel-title> - <div> - <mat-form-field> - <input matInput [value]="mainDocument.sender" title="{{mainDocument.sender}}" placeholder="{{'lang.emittedBy' | translate}}" - disabled> - </mat-form-field> - </div> - <div *ngIf="mainDocument.description != null"> - <mat-form-field> - <input matInput [value]="mainDocument.description" title="{{mainDocument.description}}" - placeholder="{{'lang.description' | translate}}" disabled> - </mat-form-field> - </div> - <div *ngIf="mainDocument.deadline != null"> - <mat-form-field> - <input matInput [value]="mainDocument.deadline" title="{{mainDocument.deadline}}" - placeholder="{{'lang.processingDeadline' | translate}}" disabled> - </mat-form-field> - </div> - </mat-panel-title> - </mat-expansion-panel-header> - <div class="header-expand-content"> - <mat-form-field> - <input matInput [value]="mainDocument.reference" title="{{mainDocument.reference}}" - placeholder="{{'lang.reference' | translate}}" disabled> - </mat-form-field> - </div> - <div class="header-expand-content"> - <mat-form-field> - <input matInput [value]="mainDocument.processingUserDisplay" - title="{{mainDocument.processingUserDisplay}}" placeholder="{{'lang.toBeProcessedBy' | translate}}" disabled> - </mat-form-field> - </div> - <div class="header-expand-content"> - <mat-form-field> - <input matInput [value]="mainDocument.title" title="{{mainDocument.title}}" placeholder="{{'lang.subject' | translate}}" - disabled> - </mat-form-field> - </div> - <div class="header-expand-content" *ngFor="let data of mainDocument.metadata;"> - <mat-form-field> - <input matInput [value]="data.value" title="{{data.value | translate}}" placeholder="{{data.label | translate}}" disabled> - </mat-form-field> - </div> - </mat-expansion-panel> - </mat-accordion>--> <section class="header-action"> - <button mat-icon-button [matBadge]="mainDocument.attachments.length + 1" (click)="openDocumentList();"> - <mat-icon fontSet="fas" fontIcon="fa-file"></mat-icon> + <button mat-button [matBadge]="mainDocument.attachments.length + 1" (click)="openDocumentList();"> + <i class="fas fa-file fa-2x"></i><span style="display: block">Documents</span> </button> - <button mat-icon-button [matBadge]="mainDocument.workflow.length" (click)="openVisaWorkflow();"> - <mat-icon fontSet="fas" fontIcon="fa-list-ol"></mat-icon> + <button mat-button [matBadge]="mainDocument.workflow.length" (click)="openVisaWorkflow();"> + <i class="fas fa-list-ol fa-2x"></i><span style="display: block">Circuit</span> </button> - <button mat-icon-button [matMenuTriggerFor]="menu"> - <mat-icon fontSet="fas" fontIcon="fa-cog"></mat-icon> + <button mat-button [matMenuTriggerFor]="menu"> + <i class="fas fa-cog fa-2x"></i><span style="display: block">Actions</span> </button> <mat-menu #menu="matMenu"> <button [disabled]="checkEmptiness()" mat-menu-item diff --git a/src/frontend/app/document/document.component.scss b/src/frontend/app/document/document.component.scss index 32300e4d5f4c8e732d09ee7bbd4a95f154f9042a..106d2719ba42a4c614eef0da3cdee4d5c183b59f 100644 --- a/src/frontend/app/document/document.component.scss +++ b/src/frontend/app/document/document.component.scss @@ -30,7 +30,7 @@ .header button { height: 70px; - width: 70px; + width: auto; } .header button mat-icon { @@ -71,12 +71,13 @@ canvas { justify-content: center; align-items: center; padding: 0; - /*&-left position absolute top 15px left -60px*/ &-action { + justify-content: center; + display: flex; color: $primary; } @@ -90,6 +91,8 @@ canvas { padding-top: 12px; padding-bottom: 12px; position: relative; + overflow-y: hidden; + overflow-x: auto; } &-info { @@ -272,7 +275,7 @@ button.disabled { } .mat-badge-content { - top: 10px !important; + top: 30px !important; right: 0 !important; background: $warn; } \ No newline at end of file diff --git a/src/frontend/app/document/document.component.ts b/src/frontend/app/document/document.component.ts index 6ebb088b8b1e0e9b1d714dd3b26520de613cb805..c97a16e2699dd2ed9c555acc001e5908137632db 100755 --- a/src/frontend/app/document/document.component.ts +++ b/src/frontend/app/document/document.component.ts @@ -158,6 +158,7 @@ export class DocumentComponent implements OnInit { this.http.get('../rest/documents/' + params['id']) .subscribe((data: any) => { this.mainDocument = data.document; + this.totalPages = this.mainDocument.pages; this.signaturesService.mainDocumentId = this.mainDocument.id; this.initDoc(); @@ -169,9 +170,9 @@ export class DocumentComponent implements OnInit { this.signaturesService.loadingSign = false; }); } - this.docList.push({ 'id': this.mainDocument.id, 'title': this.mainDocument.title, 'imgUrl': '../rest/documents/' + this.mainDocument.id + '/thumbnails' }); + this.docList.push({ 'id': this.mainDocument.id, 'title': this.mainDocument.title, 'pages': this.mainDocument.pages, 'imgUrl': '../rest/documents/' + this.mainDocument.id + '/thumbnails' }); this.mainDocument.attachments.forEach((attach: any) => { - this.docList.push({ 'id': attach.id, 'title': attach.title, 'imgUrl': '../rest/attachments/' + attach.id + '/thumbnails' }); + this.docList.push({ 'id': attach.id, 'title': attach.title, 'pages': attach.pages, 'imgUrl': '../rest/attachments/' + attach.id + '/thumbnails' }); }); this.loadingDoc = false; @@ -384,6 +385,7 @@ export class DocumentComponent implements OnInit { } this.pageNum = 1; this.currentDoc = index; + this.totalPages = this.docList[index].pages; } launchEvent(action: any) { diff --git a/src/frontend/app/documentNoteList/document-note-list.component.html b/src/frontend/app/documentNoteList/document-note-list.component.html index a6646cc7c8d4232d6fbf4942e1ba2d4e6c0345dd..8cde7e0952038d9591bb14bb47cc5da15bb3403d 100644 --- a/src/frontend/app/documentNoteList/document-note-list.component.html +++ b/src/frontend/app/documentNoteList/document-note-list.component.html @@ -3,6 +3,6 @@ 'pdf-page-canvas':!signaturesService.renderingDoc, 'pdf-page-canvas-loading-doc':signaturesService.renderingDoc }"> - <img [style.width.px]="signaturesService.mobileMode ? signaturesService.workingAreaWidth*2 : signaturesService.workingAreaWidth" [src]="sanitization.bypassSecurityTrustUrl(note.fullPath)"> + <img [style.width.px]="signaturesService.workingAreaWidth" [src]="sanitization.bypassSecurityTrustUrl(note.fullPath)"> </div> </ng-container> \ No newline at end of file diff --git a/src/frontend/app/documentNotePad/document-note-pad.component.ts b/src/frontend/app/documentNotePad/document-note-pad.component.ts index 15199e9148c58363ad5620e7fedf3b9a83fa3010..859e153e098552c25c01a8d1fb8c0b98bc5ce845 100644 --- a/src/frontend/app/documentNotePad/document-note-pad.component.ts +++ b/src/frontend/app/documentNotePad/document-note-pad.component.ts @@ -30,7 +30,8 @@ export class DocumentNotePadComponent implements OnInit { height: this.signaturesService.workingAreaHeight * 2, width: this.signaturesService.workingAreaWidth * 2, fixHeight: this.signaturesService.y, - fixWidth: this.signaturesService.x + fixWidth: this.signaturesService.x, + mobileMode: this.signaturesService.mobileMode }); $('input[value=\'' + this.signaturesService.userLogged.preferences.writingColor + '\']').click(); }, 200); @@ -49,6 +50,9 @@ export class DocumentNotePadComponent implements OnInit { if (!this.signaturesService.notesContent[this.signaturesService.currentPage]) { this.signaturesService.notesContent[this.signaturesService.currentPage] = []; } + + console.log(<HTMLCanvasElement>this.canvas.nativeElement.toDataURL('image/png')); + this.signaturesService.notesContent[this.signaturesService.currentPage].push( { 'fullPath': <HTMLCanvasElement>this.canvas.nativeElement.toDataURL('image/png'), @@ -66,7 +70,7 @@ export class DocumentNotePadComponent implements OnInit { this.signaturesService.renderingDoc = true; } this.signaturesService.annotationMode = false; - // this.notificationService.success('lang.annotationAdded'); + this.notificationService.success('lang.annotationAdded'); } undo() { diff --git a/src/frontend/app/sidebar/sidebar.component.html b/src/frontend/app/sidebar/sidebar.component.html index 830aaaca1501cffc78e31559bceab7234315719b..f6298f879ae2f6f7304100e33c3d72532890aaee 100755 --- a/src/frontend/app/sidebar/sidebar.component.html +++ b/src/frontend/app/sidebar/sidebar.component.html @@ -17,9 +17,9 @@ <span [class.primary]="signaturesService.mode != ''">{{signaturesService.documentsListCount}}</span> {{'lang.documents' | translate}} <span class="primary" *ngIf="signaturesService.mode != ''">{{'lang.'+signaturesService.mode+'Label' | translate}}</span> </header> <section class="sidebar-btn"> - <button class="btn btn-xs blue filter" [ngClass]="[signaturesService.mode == 'sign' ? 'active' : '']" (click)="filter('sign')"><i class="fas fa-file-signature"></i></button> - <button class="btn btn-xs blue filter" [ngClass]="[signaturesService.mode == 'visa' ? 'active' : '']" (click)="filter('visa')"><i class="fas fa-thumbs-up"></i></button> - <button class="btn btn-xs blue filter" [ngClass]="[signaturesService.mode == 'note' ? 'active' : '']" (click)="filter('note')"><i class="far fa-comment-dots"></i></button> + <button class="btn btn-xs blue filter" [ngClass]="[signaturesService.mode == 'sign' ? 'active' : '']" (click)="filter('sign')">{{'lang.signLabel' | translate | titlecase}}</button> + <button class="btn btn-xs blue filter" [ngClass]="[signaturesService.mode == 'visa' ? 'active' : '']" (click)="filter('visa')">{{'lang.visaLabel' | translate | titlecase}}</button> + <button class="btn btn-xs blue filter" [ngClass]="[signaturesService.mode == 'note' ? 'active' : '']" (click)="filter('note')">{{'lang.noteLabel' | translate | titlecase}}</button> </section> </div> <ul #listContent class="nav" detect-scroll (onScroll)="handleScroll($event)" [bottomOffset]="1" [topOffset]="1"> @@ -29,7 +29,11 @@ <ng-container *ngFor="let document of signaturesService.documentsList;let i=index"> <li class="nav-item active" matRipple (click)="gotTo(document.id, i)"> <div class="nav-item-left"> - <i class="fas fa-mail-bulk"></i> + <i class="fas" [ngClass]="{ + 'fa-file-signature':document.mode == 'sign', + 'fa-thumbs-up':document.mode == 'visa', + 'fa-comment-dots':document.mode == 'note' + }"></i> </div> <div class="nav-item-middle"> <div class="">{{document.reference}}</div> diff --git a/src/frontend/app/sidebar/sidebar.component.scss b/src/frontend/app/sidebar/sidebar.component.scss index 72295e871dbe7d21a7968bd6af3fefc22dfbc5dc..5a18b16e5851e6e39ddf57bf8d335a8f2c813d69 100644 --- a/src/frontend/app/sidebar/sidebar.component.scss +++ b/src/frontend/app/sidebar/sidebar.component.scss @@ -161,7 +161,10 @@ } .filter { - width: 35px; + font-size: 10px; + width: 95px; + padding-left: 0px; + padding-right: 0px; } .filter.active { diff --git a/src/frontend/js/sign.js b/src/frontend/js/sign.js index b456cd165a1af8244280ea8afb336a2836255a80..f4358feb90f77836dbccfa399069a82ff889c56d 100644 --- a/src/frontend/js/sign.js +++ b/src/frontend/js/sign.js @@ -26,6 +26,7 @@ jQuery(document).ready(function (e) { fixWidth: options.fixWidth ? options.fixWidth : 0, fixHeight: options.fixHeight ? options.fixHeight : 0, lineWidth: options.lineWidth ? options.lineWidth : 10, + mobileMode: options.mobileMode ? options.mobileMode : false, }, options); var canvas = jQuery(this); @@ -33,12 +34,16 @@ jQuery(document).ready(function (e) { var lineWidth = params.lineWidth; var context = canvas.get(0).getContext('2d'); - context.lineJoin = context.lineCap = 'round'; var fixFingerPosition = 15; - canvas.attr("width", params.width); - canvas.attr("height", params.height); + if (params.mobileMode === true) { + canvas.attr("width", params.width / 2); + canvas.attr("height", params.height / 2); + } else { + canvas.attr("width", params.width); + canvas.attr("height", params.height); + } var points = []; var last = {