diff --git a/lang/fr.json b/lang/fr.json index a508a78323d38522fd8ca0e87f660ffc7bbd6697..4d3d71127e9c0781bfc6f1e36ebc2533c95bf65e 100755 --- a/lang/fr.json +++ b/lang/fr.json @@ -426,6 +426,11 @@ "requiredLoginPassword": "Veuillez renseigner tous les champs", "workflowTemplateDeleted": "Modèle de circuit supprimé", "enterUserName": "Entrez le nom / prénom d'un utilisateur", - "clearFilters": "Effacer tous les filtres" + "clearFilters": "Effacer tous les filtres", + "options": "Options", + "format": "Format", + "font": "Police", + "color": "Couleur", + "langISO": "fr-FR" } } diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index aaba39142a62a4c853cb55c1f546548566e3ffd9..83a9b638eddc45830aa6cf2dd6b1619418dfabf6 100755 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -7,6 +7,9 @@ import { RouteReuseStrategy } from '@angular/router'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; +import localeFr from '@angular/common/locales/fr'; +import { registerLocaleData } from '@angular/common'; + import { AuthInterceptor } from './service/auth-interceptor.service'; // import ngx-translate and the http loader @@ -55,7 +58,8 @@ import { SearchComponent } from './search/search.component'; import { SignaturePositionComponent } from './indexation/signature-position/signature-position.component'; import { DevToolComponent } from './service/debug/dev-tool.component'; import { DevLangComponent } from './service/debug/dev-lang.component'; -import { DateOptionModalComponent } from './documentSignList/dateOption/date-option-modal.component'; +import { DocumentDateListComponent } from './documentDateList/document-date-list.component'; +import { DateOptionModalComponent } from './documentDateList/dateOption/date-option-modal.component'; // ADMINISTRATION @@ -90,6 +94,8 @@ import { AlertComponent } from './plugins/alert.component'; import { PluginAutocompleteComponent } from './plugins/autocomplete/autocomplete.component'; import { SortPipe } from './plugins/sorting.pipe'; +registerLocaleData(localeFr, 'fr-FR'); + @NgModule({ declarations: [ AppComponent, @@ -141,6 +147,7 @@ import { SortPipe } from './plugins/sorting.pipe'; DevLangComponent, SignatureMethodModalComponent, HistoryListComponent, + DocumentDateListComponent, DateOptionModalComponent ], imports: [ diff --git a/src/frontend/app/document/document.component.html b/src/frontend/app/document/document.component.html index 521d6ae4126ece9da9b02981ec9c465487f1f39b..73f3c437c7caf5a41cb664b2ee05b7668cc9e0eb 100755 --- a/src/frontend/app/document/document.component.html +++ b/src/frontend/app/document/document.component.html @@ -94,6 +94,8 @@ </app-document-note-list> <app-document-sign-list *ngIf="currentDoc === 0 && !loadingImage && this.signaturesService.signaturesContent[pageNum]" [bounds]="myBounds"> </app-document-sign-list> + <app-document-date-list *ngIf="currentDoc === 0 && !loadingImage && this.signaturesService.datesContent[pageNum]" [bounds]="myBounds"> + </app-document-date-list> <ion-img *ngIf="docList[currentDoc] !== undefined && !functionsService.empty(docList[currentDoc].imgContent[pageNum])" class="img-content" [src]="docList[currentDoc].imgContent[pageNum]" diff --git a/src/frontend/app/documentSignList/dateOption/date-option-modal.component.html b/src/frontend/app/documentDateList/dateOption/date-option-modal.component.html similarity index 77% rename from src/frontend/app/documentSignList/dateOption/date-option-modal.component.html rename to src/frontend/app/documentDateList/dateOption/date-option-modal.component.html index cf931d049ae50230fde9e1021067147940826fc6..a481f3b8c3f4d2e1087988036455a24633c43676 100644 --- a/src/frontend/app/documentSignList/dateOption/date-option-modal.component.html +++ b/src/frontend/app/documentDateList/dateOption/date-option-modal.component.html @@ -11,13 +11,13 @@ <ion-content> <ion-toolbar> <ion-title style="text-align: center;font-weight: normal;font-size: 50px;padding: 50px;" - [class]="getFontLabel(date.font)" [style.color]="date.color">{{today | date : date.format}}</ion-title> + [class]="getFontLabel(date.font)" [style.color]="date.color">{{today | date : date.format : undefined : ('lang.langISO' | translate)}}</ion-title> </ion-toolbar> <ion-item> <ion-label color="secondary">{{'lang.format' | translate}}</ion-label> - <ion-select [(ngModel)]="date.format"> + <ion-select [(ngModel)]="date.format" interface="popover"> <ion-select-option *ngFor="let format of dateformats" [value]="format"> - {{today | date : format}} + {{today | date : format : undefined : ('lang.langISO' | translate)}} </ion-select-option> </ion-select> </ion-item> @@ -28,7 +28,7 @@ </ion-item> <ion-item> <ion-label color="secondary">{{'lang.font' | translate}}</ion-label> - <ion-select [(ngModel)]="date.font" [interfaceOptions]="{cssClass:'selectFormat'}"> + <ion-select [(ngModel)]="date.font" (ionChange)="select($event.detail.value)" [interfaceOptions]="{cssClass:'selectFormat'}" [cancelText]="'lang.cancel' | translate"> <ion-select-option *ngFor="let font of datefonts" [value]="font" [class]="getFontLabel(font)"> {{font}} </ion-select-option> @@ -38,7 +38,7 @@ <ion-footer class="ion-no-border"> <ion-toolbar> <ion-buttons class="ion-justify-content-center"> - <ion-button type="submit" color="primary"> + <ion-button type="submit" color="primary" (click)="onSubmit()"> <ion-label>{{'lang.save' | translate}}</ion-label> </ion-button> </ion-buttons> diff --git a/src/frontend/app/documentSignList/dateOption/date-option-modal.component.scss b/src/frontend/app/documentDateList/dateOption/date-option-modal.component.scss similarity index 100% rename from src/frontend/app/documentSignList/dateOption/date-option-modal.component.scss rename to src/frontend/app/documentDateList/dateOption/date-option-modal.component.scss diff --git a/src/frontend/app/documentSignList/dateOption/date-option-modal.component.ts b/src/frontend/app/documentDateList/dateOption/date-option-modal.component.ts similarity index 73% rename from src/frontend/app/documentSignList/dateOption/date-option-modal.component.ts rename to src/frontend/app/documentDateList/dateOption/date-option-modal.component.ts index b092f977df162b8fe8861e799bb3c62dc9910440..8fb0e473549aa9043ef1b4a1b8da0c6551f7819a 100644 --- a/src/frontend/app/documentSignList/dateOption/date-option-modal.component.ts +++ b/src/frontend/app/documentDateList/dateOption/date-option-modal.component.ts @@ -29,6 +29,15 @@ export class DateOptionModalComponent implements OnInit { 'Courier New', ]; + size = { + 'Arial': 15, + 'Verdana': 13, + 'Helvetica': 13, + 'Tahoma': 13, + 'Times New Roman': 15, + 'Courier New': 13 + }; + constructor( private translate: TranslateService, public modalController: ModalController @@ -36,19 +45,21 @@ export class DateOptionModalComponent implements OnInit { ngOnInit(): void { console.log(this.date); - } dismissModal() { - this.modalController.dismiss('cancel'); + this.modalController.dismiss(); } getFontLabel(label: string) { return label.replace(' ', '_'); } - test() { - + onSubmit() { + this.modalController.dismiss(this.date); } + select(font: string) { + this.date.size = this.size[font]; + } } diff --git a/src/frontend/app/documentDateList/document-date-list.component.html b/src/frontend/app/documentDateList/document-date-list.component.html new file mode 100644 index 0000000000000000000000000000000000000000..b52f338d245c5991c0663ea9b8382cfa94d33642 --- /dev/null +++ b/src/frontend/app/documentDateList/document-date-list.component.html @@ -0,0 +1,21 @@ +<div *ngFor="let date of this.signaturesService.datesContent[this.signaturesService.currentPage];let i = index;" + class="test" [id]="'dateDiv_'+ i" + [position]="{x: (date.positionX*this.signaturesService.workingAreaWidth)/100, y:(date.positionY*this.signaturesService.workingAreaHeight)/100}" + [style.width.%]="date.width" [style.height.%]="date.height" [ngDraggable]="!signaturesService.resizing" ngResizable + (rzResizing)="onResizingDate($event, i)" + [rzAspectRatio]="true" (rzStart)="signaturesService.resizing=true" (movingOffset)="signaturesService.dragging=true" + (endOffset)="moveDate($event, i);" (rzStop)="onResizeDateStop($event, i);signaturesService.resizing=false;" + [preventDefaultEvent]="false" [bounds]="bounds" [inBounds]="true" (click)="$event.stopPropagation();" [style.height]="fix" #test2> + <ion-buttons style="position:absolute;top: -30px;right: 0px;"> + <ion-button slot="icon-only" shape="round" [matMenuTriggerFor]="menu" color="secondary"> + <ion-icon name="ellipsis-vertical"></ion-icon> + </ion-button> + </ion-buttons> + <mat-menu #menu="matMenu"> + <button mat-menu-item (click)="openDateSettings(i)">{{'lang.options' | translate}}</button> + <button mat-menu-item (click)="deleteDate(i)">{{'lang.delete' | translate}}</button> + </mat-menu> + <svg [id]="'testSVG_'+ i" viewBox="0 0 130 30" preserveAspectRatio="xMinYMin meet"> + <text y="15" [attr.font-size]="date.size" dy=".3em" [style.font-family]="date.font" [style.fill]="date.color">{{today | date : date.format : undefined : ('lang.langISO' | translate)}}</text> + </svg> +</div> \ No newline at end of file diff --git a/src/frontend/app/documentDateList/document-date-list.component.scss b/src/frontend/app/documentDateList/document-date-list.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..dcb435a878d572f54cceed96995d8a35f68e322f --- /dev/null +++ b/src/frontend/app/documentDateList/document-date-list.component.scss @@ -0,0 +1,33 @@ +::ng-deep .action-item ion-radio { + --color: transparent; + --color-checked: transparent; +} + +.test { + position: absolute; + border: dashed 1px grey; + background: rgba(255, 255, 255, 0.6) none repeat scroll 0% 0%; + position: absolute; + // margin-right: 10px; + background: none; + font: sans-serif; + // overflow: hidden; + // margin-bottom: 26px; +} + +svg { + width: 100%; + height: 100%; + pointer-events: none; + /* so that you can resize the element */ +} + +text { + pointer-events: auto; + /* Cancel the svg’s pointer-events */ +} + +svg.text { + display: block; // or inline-block + font-size: inherit; // will respond to parent's font size + } \ No newline at end of file diff --git a/src/frontend/app/documentDateList/document-date-list.component.ts b/src/frontend/app/documentDateList/document-date-list.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..311f5a91694986b3d47a36b9316c01fe10eda955 --- /dev/null +++ b/src/frontend/app/documentDateList/document-date-list.component.ts @@ -0,0 +1,75 @@ +import { Component, Input, OnInit, ViewChild } from '@angular/core'; +import { SignaturesContentService } from '../service/signatures.service'; +import { MatDialog } from '@angular/material/dialog'; +import { MatMenuTrigger } from '@angular/material/menu'; +import { NotificationService } from '../service/notification.service'; +import { TranslateService } from '@ngx-translate/core'; +import { LocalStorageService } from '../service/local-storage.service'; +import { ModalController, PopoverController } from '@ionic/angular'; +import { DateOptionModalComponent } from './dateOption/date-option-modal.component'; + +@Component({ + selector: 'app-document-date-list', + templateUrl: 'document-date-list.component.html', + styleUrls: ['document-date-list.component.scss'], +}) +export class DocumentDateListComponent implements OnInit { + + @Input() bounds: any; + @ViewChild('menuTrigger') menuSign: MatMenuTrigger; + @ViewChild('test2') test2: any; + + fix = 'auto'; + today: Date = new Date(); + + constructor(private translate: TranslateService, + public signaturesService: SignaturesContentService, + public notificationService: NotificationService, + private localStorage: LocalStorageService, + public dialog: MatDialog, + public popoverController: PopoverController, + public modalController: ModalController, + ) { } + + ngOnInit(): void { } + + moveDate(event: any, i: number) { + const percentx = (event.x * 100) / this.signaturesService.workingAreaWidth; + const percenty = (event.y * 100) / this.signaturesService.workingAreaHeight; + + this.signaturesService.datesContent[this.signaturesService.currentPage][i].positionX = percentx; + this.signaturesService.datesContent[this.signaturesService.currentPage][i].positionY = percenty; + this.localStorage.save(this.signaturesService.mainDocumentId.toString(), JSON.stringify({ 'date': this.signaturesService.datesContent, 'sign': this.signaturesService.signaturesContent, 'note': this.signaturesService.notesContent })); + this.signaturesService.dragging = false; + } + + onResizingDate(event: any, index: number) { + this.test2.nativeElement.style.height = 'auto'; + } + + onResizeDateStop(event: any, index: number) { + this.test2.nativeElement.style.height = 'auto'; + this.signaturesService.datesContent[this.signaturesService.currentPage][index].height = (event.size.height * 100) / this.signaturesService.workingAreaHeight; + this.signaturesService.datesContent[this.signaturesService.currentPage][index].width = (event.size.width * 100) / this.signaturesService.workingAreaWidth; + } + + deleteDate(i: number) { + this.signaturesService.datesContent[this.signaturesService.currentPage].splice(i, 1); + this.localStorage.save(this.signaturesService.mainDocumentId.toString(), JSON.stringify({ 'date': this.signaturesService.datesContent, 'sign': this.signaturesService.signaturesContent, 'note': this.signaturesService.notesContent })); + } + + async openDateSettings(index: number) { + const modal = await this.modalController.create({ + component: DateOptionModalComponent, + componentProps: { + 'date': this.signaturesService.datesContent[this.signaturesService.currentPage][index], + } + }); + await modal.present(); + + const { data } = await modal.onWillDismiss(); + if (data !== undefined) { + this.signaturesService.datesContent[this.signaturesService.currentPage][index] = data; + } + } +} diff --git a/src/frontend/app/documentSignList/document-sign-list.component.html b/src/frontend/app/documentSignList/document-sign-list.component.html index 18b14b2d994172799c81fb58675537f780652e9d..ebda0c161c25975ae8832f26eee56599f908583e 100644 --- a/src/frontend/app/documentSignList/document-sign-list.component.html +++ b/src/frontend/app/documentSignList/document-sign-list.component.html @@ -1,47 +1,22 @@ -<div - *ngFor="let signature of this.signaturesService.signaturesContent[this.signaturesService.currentPage];let i = index;" - [position]="{x: (signature.positionX*this.signaturesService.workingAreaWidth)/100, y:(signature.positionY*this.signaturesService.workingAreaHeight)/100}" - [style.width.%]="signature.width" [ngDraggable]="!signaturesService.resizing" ngResizable [rzAspectRatio]="true" - (rzResizing)="onResizing($event, i)" (rzStart)="signaturesService.resizing=true" - (movingOffset)="signaturesService.dragging=true" (endOffset)="moveSign($event, i);" - (rzStop)="onResizeStop($event, i);signaturesService.resizing=false;" [preventDefaultEvent]="false" [bounds]="bounds" - [inBounds]="true" - style="position:absolute;border: dashed 1px grey;background: rgba(255, 255, 255, 0.6) none repeat scroll 0% 0%;" - [style.height]="fix" #test> - <ion-item style="position: absolute;--background: none;right: 0;--border-width: 0;"> - <ion-select (click)="$event.stopPropagation();" selectedText=" " value="" interface="popover" - (ionChange)="select($event,i)"> - <ion-select-option class="action-item" value="deleteSignature">{{'lang.delete' | translate}}</ion-select-option> - <ion-select-option class="action-item" [disabled]="signature.inAllPage" value="cloneSign"> - {{'lang.replicate' | translate}}</ion-select-option> - </ion-select> - </ion-item> - <img class="img-content" - [src]="sanitization.bypassSecurityTrustUrl('data:image/png;base64,' + signature.encodedSignature)" - [style.width.%]="100"> -</div> - -<div *ngFor="let date of this.signaturesService.datesContent[this.signaturesService.currentPage];let i = index;" - class="test" - [position]="{x: (date.positionX*this.signaturesService.workingAreaWidth)/100, y:(date.positionY*this.signaturesService.workingAreaHeight)/100}" - [style.width.%]="date.width" [style.height.%]="date.height" [ngDraggable]="!signaturesService.resizing" ngResizable - [rzAspectRatio]="true" (rzStart)="signaturesService.resizing=true" (movingOffset)="signaturesService.dragging=true" - (endOffset)="moveDate($event, i);" (rzStop)="onResizeDateStop($event, i);signaturesService.resizing=false;" - [preventDefaultEvent]="false" [bounds]="bounds" [inBounds]="true" (click)="$event.stopPropagation();"> - <ion-select (click)="$event.stopPropagation();" selectedText=" " value="" interface="popover" - (ionChange)="select($event,i)" style="position: absolute;--background: none;right: 0;--border-width: 0; top: -30px;"> - <ion-select-option class="action-item" value="deleteDate">{{'lang.delete' | translate}}</ion-select-option> - </ion-select> - <ion-buttons style="position:absolute;top: -30px;"> - <ion-button slot="icon-only" shape="round" (click)="openDateSettings(date)"> - <ion-icon name="construct-outline"></ion-icon> - </ion-button> - </ion-buttons> - <svg [id]="'testSVG_'+ i" viewBox="0 0 130 30" preserveAspectRatio="xMinYMin meet"> - <text y="10" font-size="16" dy=".3em" style="fill: #0000ff;">25 décembre 2020</text></svg> -</div> - -<div class="test" ngDraggable ngResizable [rzAspectRatio]="true" style="position: absolute" - (movingOffset)="signaturesService.dragging=true"> - +<div *ngFor="let signature of this.signaturesService.signaturesContent[this.signaturesService.currentPage];let i = index;" + [position]="{x: (signature.positionX*this.signaturesService.workingAreaWidth)/100, y:(signature.positionY*this.signaturesService.workingAreaHeight)/100}" + [style.width.%]="signature.width" [ngDraggable]="!signaturesService.resizing" ngResizable [rzAspectRatio]="true" + (rzResizing)="onResizing($event, i)" (rzStart)="signaturesService.resizing=true" + (movingOffset)="signaturesService.dragging=true" (endOffset)="moveSign($event, i);" + (rzStop)="onResizeStop($event, i);signaturesService.resizing=false;" [preventDefaultEvent]="false" [bounds]="bounds" + [inBounds]="true" + style="position:absolute;border: dashed 1px grey;background: rgba(255, 255, 255, 0.6) none repeat scroll 0% 0%;" + [style.height]="fix" #test> + <ion-item style="position: absolute;--background: none;right: 0;--border-width: 0;"> + <ion-select (click)="$event.stopPropagation();" selectedText=" " value="" interface="popover" + (ionChange)="select($event,i)"> + <ion-select-option class="action-item" value="deleteSignature">{{'lang.delete' | translate}} + </ion-select-option> + <ion-select-option class="action-item" [disabled]="signature.inAllPage" value="cloneSign"> + {{'lang.replicate' | translate}}</ion-select-option> + </ion-select> + </ion-item> + <img class="img-content" + [src]="sanitization.bypassSecurityTrustUrl('data:image/png;base64,' + signature.encodedSignature)" + [style.width.%]="100"> </div> \ No newline at end of file diff --git a/src/frontend/app/documentSignList/document-sign-list.component.ts b/src/frontend/app/documentSignList/document-sign-list.component.ts index 23068112210cd51d5723c777e56b4e9dc130f6e0..476b1e4033ae875b866f850549dbf77f23e0ae51 100644 --- a/src/frontend/app/documentSignList/document-sign-list.component.ts +++ b/src/frontend/app/documentSignList/document-sign-list.component.ts @@ -8,7 +8,6 @@ import { TranslateService } from '@ngx-translate/core'; import { LocalStorageService } from '../service/local-storage.service'; import { ConfirmComponent } from '../plugins/confirm.component'; import { ModalController, PopoverController } from '@ionic/angular'; -import { DateOptionModalComponent } from './dateOption/date-option-modal.component'; @Component({ selector: 'app-document-sign-list', @@ -22,6 +21,7 @@ export class DocumentSignListComponent implements OnInit { @ViewChild('test') test: any; fix = 'auto'; + today: Date = new Date(); constructor(private translate: TranslateService, private sanitization: DomSanitizer, @@ -49,25 +49,10 @@ export class DocumentSignListComponent implements OnInit { this.signaturesService.dragging = false; } - moveDate(event: any, i: number) { - const percentx = (event.x * 100) / this.signaturesService.workingAreaWidth; - const percenty = (event.y * 100) / this.signaturesService.workingAreaHeight; - - this.signaturesService.datesContent[this.signaturesService.currentPage][i].positionX = percentx; - this.signaturesService.datesContent[this.signaturesService.currentPage][i].positionY = percenty; - this.localStorage.save(this.signaturesService.mainDocumentId.toString(), JSON.stringify({ 'date': this.signaturesService.datesContent, 'sign': this.signaturesService.signaturesContent, 'note': this.signaturesService.notesContent })); - this.signaturesService.dragging = false; - } - onResizing(event: any, index: number) { this.test.nativeElement.style.height = 'auto'; } - onResizeDateStop(event: any, index: number) { - this.signaturesService.datesContent[this.signaturesService.currentPage][index].height = (event.size.height * 100) / this.signaturesService.workingAreaHeight; - this.signaturesService.datesContent[this.signaturesService.currentPage][index].width = (event.size.width * 100) / this.signaturesService.workingAreaWidth; - } - onResizeStop(event: any, index: number) { this.test.nativeElement.style.height = 'auto'; this.signaturesService.signaturesContent[this.signaturesService.currentPage][index].width = (event.size.width * 100) / this.signaturesService.workingAreaWidth; @@ -124,19 +109,4 @@ export class DocumentSignListComponent implements OnInit { } this.localStorage.save(this.signaturesService.mainDocumentId.toString(), JSON.stringify({ 'sign': this.signaturesService.signaturesContent, 'note': this.signaturesService.notesContent })); } - - deleteDate(i: number) { - this.signaturesService.datesContent[this.signaturesService.currentPage].splice(i, 1); - this.localStorage.save(this.signaturesService.mainDocumentId.toString(), JSON.stringify({ 'date': this.signaturesService.datesContent })); - } - - async openDateSettings(date: any) { - const modal = await this.modalController.create({ - component: DateOptionModalComponent, - componentProps: { - 'date': date, - } - }); - await modal.present(); - } } diff --git a/src/frontend/app/service/actions.service.ts b/src/frontend/app/service/actions.service.ts index 163414e0cad46400be6ea5b02c7f196c40fb925a..18c2d8f82d90d19492f9c93a997b6e758dc58d2e 100644 --- a/src/frontend/app/service/actions.service.ts +++ b/src/frontend/app/service/actions.service.ts @@ -83,18 +83,26 @@ export class ActionsService { const signatures: any[] = []; for (let index = 1; index <= this.signaturesService.totalPage; index++) { if (this.signaturesService.datesContent[index]) { - this.signaturesService.datesContent[index].forEach((date: any) => { - signatures.push( - { - 'encodedImage': date.content.replace('data:image/svg+xml;base64,', ''), - 'width': date.width, - 'height': date.height, - 'positionX': date.positionX, - 'positionY': date.positionY, - 'type': 'SVG', - 'page': index, - } - ); + this.signaturesService.datesContent[index].forEach((date: any, indexSvg: number) => { + const svg = document.getElementById('testSVG_' + indexSvg); + const data = new XMLSerializer().serializeToString(svg); + const blob = new Blob([data], { type: 'image/svg+xml' }); + const reader = new FileReader(); + reader.readAsDataURL(blob); + reader.onloadend = () => { + const content: any = reader.result; + signatures.push( + { + 'encodedImage': content.replace('data:image/svg+xml;base64,', ''), + 'width': date.width, + 'height': date.height, + 'positionX': date.positionX, + 'positionY': date.positionY, + 'type': 'SVG', + 'page': index, + } + ); + }; }); } if (this.signaturesService.signaturesContent[index]) { @@ -126,7 +134,6 @@ export class ActionsService { }); } } - return signatures; } } diff --git a/src/frontend/app/signatures/signatures.component.ts b/src/frontend/app/signatures/signatures.component.ts index b5f1baf368732fac18657d8262dff96cb6c3e71b..9243dc5ddb0f4d9a2bbf003b0a767c26497b93c8 100755 --- a/src/frontend/app/signatures/signatures.component.ts +++ b/src/frontend/app/signatures/signatures.component.ts @@ -162,12 +162,13 @@ export class SignaturesComponent implements OnInit { positionX: 0, positionY: 0, font: 'Arial', - color: '#666', + size: 15, + color: '#eb4034', format : 'd MMMM y' }; - dateBlock.positionX = 130; - dateBlock.positionY = 30; + dateBlock.positionX = 60; + dateBlock.positionY = 80; this.storeDate(dateBlock, this.signaturesService.currentPage); this.notificationService.success('lang.dateInDocAdded'); setTimeout(() => { @@ -183,6 +184,7 @@ export class SignaturesComponent implements OnInit { positionX: datePosCurrentPage[0].positionX, positionY: datePosCurrentPage[0].positionY, font: 'Arial', + size: 15, color: '#666', format : 'd MMMM y' }; @@ -196,6 +198,7 @@ export class SignaturesComponent implements OnInit { positionX: position.positionX, positionY: position.positionY, font: 'Arial', + size: 15, color: '#666', format : 'd MMMM y' }; @@ -244,18 +247,7 @@ export class SignaturesComponent implements OnInit { this.signaturesService.datesContent[page] = []; } this.signaturesService.datesContent[page].push(JSON.parse(JSON.stringify(date))); - setTimeout(() => { - const svg = document.getElementById('testSVG_' + (this.signaturesService.datesContent[this.signaturesService.currentPage].length - 1)); - const data = new XMLSerializer().serializeToString(svg); - const blob = new Blob([data], { type: 'image/svg+xml' }); - - const reader = new FileReader(); - reader.readAsDataURL(blob); - reader.onloadend = () => { - this.signaturesService.datesContent[page][this.signaturesService.datesContent[page].length - 1].content = reader.result; - this.localStorage.save(this.signaturesService.mainDocumentId.toString(), JSON.stringify({ 'date': this.signaturesService.datesContent, 'sign': this.signaturesService.signaturesContent, 'note': this.signaturesService.notesContent })); - }; - }, 200); + this.localStorage.save(this.signaturesService.mainDocumentId.toString(), JSON.stringify({ 'date': this.signaturesService.datesContent, 'sign': this.signaturesService.signaturesContent, 'note': this.signaturesService.notesContent })); } removeSignature(signature: any) {