diff --git a/src/app/attachment/controllers/AttachmentController.php b/src/app/attachment/controllers/AttachmentController.php index 81730daa907d7555ca029d37da4b7b92b4c63430..c25d2ba7796e7d7eeb82c421a8d4bdb42b68e724 100755 --- a/src/app/attachment/controllers/AttachmentController.php +++ b/src/app/attachment/controllers/AttachmentController.php @@ -136,7 +136,7 @@ class AttachmentController $adr = AdrModel::getAttachmentsAdr([ 'select' => ['path', 'filename'], - 'where' => ['main_document_id = ?', 'type = ?'], + 'where' => ['attachment_id = ?', 'type = ?'], 'data' => [$args['id'], 'TNL' . $args['page']] ]); 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 b817507e62f679103cf7a27ca80061421a2e56f9..aa9bb3d98fa213aa797200fb898650b2da9907bc 100644 --- a/src/frontend/app/document/document-list/document-list.component.html +++ b/src/frontend/app/document/document-list/document-list.component.html @@ -3,22 +3,16 @@ <button 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>{{mainDocument.attachments.length + 1}}</b> document(s) + <mat-icon fontSet="fas" fontIcon="fa-file fa-2x"></mat-icon> <b>{{docList.length}}</b> document(s) </div> <div class="pjListContent"> - <mat-card [style.background-image]="'url('+mainDocument.thumbnailUrl+')'" [class.current]="mainDocument.id == currentDocId" + <mat-card *ngFor="let doc of docList;let i=index" + [style.background-image]="'url('+doc.imgUrl+'/1)'" [class.current]="i == currentDocId" style="padding:0;margin-top: 30px;height: 400px;width: 100%;background-size: contain;background-repeat: no-repeat;background-position: center;" - (click)="loadDoc(mainDocument.id)"> + (click)="loadDoc(i)"> <div class="pjToolsContent"> - Main doc - </div> - </mat-card> - <mat-card *ngFor="let attachment of mainDocument.attachments;let i=index" - [style.background-image]="'url('+attachment.thumbnailUrl+')'" [class.current]="attachment == currentDocId" - style="padding:0;margin-top: 30px;height: 400px;width: 100%;background-size: contain;background-repeat: no-repeat;background-position: center;" - (click)="loadDoc(attachment)"> - <div class="pjToolsContent"> - Annexes {{i}} + {{doc.title}} <ng-container *ngIf="i == 0">(Ã signer)</ng-container> + </div> </mat-card> </div> diff --git a/src/frontend/app/document/document-list/document-list.component.scss b/src/frontend/app/document/document-list/document-list.component.scss index cfb335de10d383e55ed1253e7bb6d28086dc10b0..2b14ad169488f0dd779669e5d6fcfa235834d036 100644 --- a/src/frontend/app/document/document-list/document-list.component.scss +++ b/src/frontend/app/document/document-list/document-list.component.scss @@ -51,6 +51,9 @@ border-bottom-left-radius: 5px; background: white; padding: 10px; + font-weight: 600; + color: #135F7F; + font-size: 14px; } .current { 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 a48c71d97c62472326dd709e12d955080175c5c8..cfc7bed5815cea0f099dac3d32b345137a2a05fd 100644 --- a/src/frontend/app/document/document-list/document-list.component.ts +++ b/src/frontend/app/document/document-list/document-list.component.ts @@ -13,7 +13,7 @@ export class DocumentListComponent implements OnInit { loading: boolean = false; // tslint:disable-next-line:no-input-rename - @Input('mainDocument') mainDocument: any; + @Input('docList') docList: any; // tslint:disable-next-line:no-input-rename @Input('currentDocId') currentDocId: any; // tslint:disable-next-line:no-input-rename diff --git a/src/frontend/app/document/document.component.html b/src/frontend/app/document/document.component.html index 8bbeba20cb49c0900f927ba9e8cb3c15c231fbe6..45dc01a24360715576d9f5d078d8bdb8ace505e9 100755 --- a/src/frontend/app/document/document.component.html +++ b/src/frontend/app/document/document.component.html @@ -2,18 +2,18 @@ <mat-icon svgIcon="maarchLogo" class="maarchLogo"></mat-icon> </div> <mat-sidenav-container autosize> - <mat-sidenav #snav mode="over" fixedInViewport="true" [disableClose]="freezeSidenavClose" [style.width.px]="350"> + <mat-sidenav #snav [mode]="signaturesService.mobileMode ? 'over': 'side'" [opened]="!signaturesService.mobileMode || freezeSidenavClose" fixedInViewport="true" [disableClose]="freezeSidenavClose" [style.width.px]="350"> <app-sidebar [snavLeftComponent]="this.snav" [snavRightComponent]="this.snavRight"></app-sidebar> </mat-sidenav> <mat-sidenav-content class="mainView"> - <div *ngIf="loadingDoc || snapshot == null" + <div *ngIf="loadingDoc" style="position: fixed;z-index: 2;display: flex;background: #fffc;width: 100%;height: 100%;justify-content: center;align-items: center;"> <mat-spinner></mat-spinner> </div> <header class="header" *ngIf="!this.signaturesService.annotationMode && !freezeSidenavClose" [@slideDown]> <article class="header-infos"> <section class="header-action"> - <button mat-icon-button (click)="this.snav.toggle();"> + <button *ngIf="signaturesService.mobileMode" mat-icon-button (click)="this.snav.toggle();"> <mat-icon fontSet="fas" fontIcon="fa-bars"></mat-icon> </button> <button mat-icon-button (click)="openMainDocumentDetail();"> @@ -102,22 +102,18 @@ <div *ngIf="!resetDragPos" #dragElem class="example-box" cdkDragLockAxis="y" cdkDrag [cdkDragDisabled]="this.signaturesService.annotationMode" style="width: 100%;transform: translate3d(0px, 80px, 0px)" (cdkDragEnded)="testDrag($event)"> - <app-document-note-list (tap)="addAnnotation($event)" *ngIf="currentDoc == 0 && snapshot != null"> + <app-document-note-list (tap)="addAnnotation($event)" *ngIf="currentDoc == 0"> </app-document-note-list> - <app-document-sign-list *ngIf="currentDoc == 0 && snapshot != null"></app-document-sign-list> - <img (tap)="addAnnotation($event)" *ngIf="snapshot != null" id="snapshotPdf" [src]="snapshot" - style="width:100%" /> + <app-document-sign-list *ngIf="currentDoc == 0"></app-document-sign-list> + <img *ngIf="!loadingDoc && !freezeSidenavClose" (tap)="addAnnotation($event)" id="snapshotPdf" [src]="docList[currentDoc].imgUrl+'/'+pageNum" + style="width:100%;" /> <app-document-note-pad (triggerEvent)="zoomForView()" #appDocumentNotePad *ngIf="currentDoc == 0"> </app-document-note-pad> </div> </div> - <simple-pdf-viewer #pdfViewer [src]="pdfDataArr" removePageBorders="true" (onLoadComplete)="pdfRendered()" - (onError)="pdfError($event)" style="display:none;"></simple-pdf-viewer> - <section class="page-info" *ngIf="!this.signaturesService.annotationMode && docList[currentDoc]"> - <div class="page-info-doc">{{'lang.doc' | translate}} {{currentDoc+1}}/{{docList.length}} : - {{docList[currentDoc].title}}</div> + <div class="page-info-doc">{{docList[currentDoc].title}}</div> <div class="page-info-page">{{'lang.page' | translate}} {{ pageNum }} / {{ totalPages }}</div> </section> <footer class="footer" *ngIf="!this.signaturesService.annotationMode && !freezeSidenavClose" [@slideUp]> @@ -128,14 +124,14 @@ </footer> <app-drawer></app-drawer> </mat-sidenav-content> - <mat-sidenav #snavRight mode="over" fixedInViewport="true" [style.width]="signaturesService.sideNavRigtDatas.width" + <mat-sidenav #snavRight [mode]="this.signaturesService.mobileMode ? 'over': 'side'" [opened]="!signaturesService.mobileMode" fixedInViewport="true" [style.width]="signaturesService.sideNavRigtDatas.width" position='end' [disableClose]='signaturesService.sideNavRigtDatas.locked'> <app-my-profile *ngIf="signaturesService.sideNavRigtDatas.mode == 'profile'" [snavLeftComponent]="this.snav" [snavRightComponent]="this.snavRight"></app-my-profile> <app-visa-workflow [visaWorkflow]="mainDocument.workflow" [snavRightComponent]="this.snavRight" *ngIf="signaturesService.sideNavRigtDatas.mode == 'visaWorkflow'"></app-visa-workflow> - <app-document-list #appDocumentList [currentDocId]="docList[currentDoc].id" [snavRightComponent]="this.snavRight" - [mainDocument]="mainDocument" *ngIf="signaturesService.sideNavRigtDatas.mode == 'documentList'" + <app-document-list #appDocumentList [currentDocId]="currentDoc" [snavRightComponent]="this.snavRight" + [docList]="docList" *ngIf="signaturesService.sideNavRigtDatas.mode == 'documentList'" (triggerEvent)="loadDoc($event)"></app-document-list> <app-main-document-detail #appMainDocumentDetail [snavRightComponent]="this.snavRight" [mainDocument]="mainDocument" *ngIf="signaturesService.sideNavRigtDatas.mode == 'mainDocumentDetail'"></app-main-document-detail> diff --git a/src/frontend/app/document/document.component.scss b/src/frontend/app/document/document.component.scss index a7f43a06186d11a70dd0cf2e3ee20b511bc03be9..32300e4d5f4c8e732d09ee7bbd4a95f154f9042a 100644 --- a/src/frontend/app/document/document.component.scss +++ b/src/frontend/app/document/document.component.scss @@ -22,7 +22,7 @@ .mainView { height: 100vh; - width: 100vw; + width: auto; display: flex; flex-direction: column; overflow: hidden; @@ -63,9 +63,9 @@ canvas { } .header { - position: fixed; + position: absolute; z-index: 1; - width: 100vw; + width: 100%; height: 80px; display: flex; justify-content: center; @@ -161,8 +161,8 @@ canvas { .page { &-info { - position: fixed; - bottom: 100px; + position: absolute; + bottom: 25%; height: 30px; width: auto; max-width: 70%; diff --git a/src/frontend/app/document/document.component.ts b/src/frontend/app/document/document.component.ts index c71dc1a7a4089862066af8caf70fb41c75b2e35d..6ebb088b8b1e0e9b1d714dd3b26520de613cb805 100755 --- a/src/frontend/app/document/document.component.ts +++ b/src/frontend/app/document/document.component.ts @@ -13,12 +13,10 @@ import { WarnModalComponent } from '../modal/warn-modal.component'; import { RejectInfoBottomSheetComponent } from '../modal/reject-info.component'; import { ConfirmModalComponent } from '../modal/confirm-modal.component'; import { SuccessInfoValidBottomSheetComponent } from '../modal/success-info-valid.component'; -import { SimplePdfViewerComponent } from 'simple-pdf-viewer'; import { TranslateService } from '@ngx-translate/core'; import { CdkDragEnd, DragRef, CdkDrag } from '@angular/cdk/drag-drop'; import { DocumentListComponent } from './document-list/document-list.component'; -declare var PDFJS: any; @Component({ selector: 'app-document', @@ -120,7 +118,6 @@ export class DocumentComponent implements OnInit { @ViewChild('dragElem') dragElem: any; @ViewChild('appDocumentNotePad') appDocumentNotePad: DocumentNotePadComponent; @ViewChild('appDocumentList') appDocumentList: DocumentListComponent; - @ViewChild(SimplePdfViewerComponent) private pdfViewer: SimplePdfViewerComponent; @HostListener('mousedown', ['$event']) protected onPMouseDown(event: any) { event.preventDefault(); @@ -128,8 +125,14 @@ export class DocumentComponent implements OnInit { @HostListener('window:resize', ['$event']) onResize(event: any) { - this.signaturesService.workingAreaHeight = $('#snapshotPdf').height(); - this.signaturesService.workingAreaWidth = $('#snapshotPdf').width(); + this.resetDragPos = true; + setTimeout(() => { + this.resetDragPos = false; + }, 200); + setTimeout(() => { + this.signaturesService.workingAreaHeight = $('#snapshotPdf').height(); + this.signaturesService.workingAreaWidth = $('#snapshotPdf').width(); + }, 400); } constructor(private translate: TranslateService, private router: Router, private route: ActivatedRoute, public http: HttpClient, @@ -138,7 +141,6 @@ export class DocumentComponent implements OnInit { private cookieService: CookieService, private sanitizer: DomSanitizer, public dialog: MatDialog, private bottomSheet: MatBottomSheet) { this.draggable = false; - PDFJS.workerSrc = './../node_modules/simple-pdf-viewer/node_modules/pdfjs-dist/build/pdf.worker.min.js'; if (!this.cookieService.check('maarchParapheurAuth')) { this.router.navigate(['/login']); @@ -167,16 +169,12 @@ export class DocumentComponent implements OnInit { this.signaturesService.loadingSign = false; }); } - this.docList.push({ 'id': this.mainDocument.id, 'encodedDocument': this.mainDocument.encodedDocument, 'subject': this.mainDocument.subject }); + this.docList.push({ 'id': this.mainDocument.id, 'title': this.mainDocument.title, 'imgUrl': '../rest/documents/' + this.mainDocument.id + '/thumbnails' }); this.mainDocument.attachments.forEach((attach: any) => { - this.docList.push({ 'id': attach, 'encodedDocument': '', 'title': '' }); + this.docList.push({ 'id': attach.id, 'title': attach.title, 'imgUrl': '../rest/attachments/' + attach.id + '/thumbnails' }); }); - this.pdfRender(this.docList[this.currentDoc]); - setTimeout(() => { - this.loadingDoc = false; - }, 500); - this.loadNextDoc(); + this.loadingDoc = false; }, (err: any) => { this.notificationService.handleErrors(err); }); @@ -188,6 +186,14 @@ export class DocumentComponent implements OnInit { }); } + ngDoCheck() { + if (this.signaturesService.workingAreaHeight !== $('#snapshotPdf').height() || this.signaturesService.workingAreaWidth !== $('#snapshotPdf').width()) { + this.signaturesService.workingAreaHeight = $('#snapshotPdf').height(); + this.signaturesService.workingAreaWidth = $('#snapshotPdf').width(); + } + } + + initDoc() { this.docList = []; this.signaturesService.signaturesContent = []; @@ -207,44 +213,6 @@ export class DocumentComponent implements OnInit { this.currentDoc = 0; } - pdfRender(document: any) { - const binary_string = window.atob(document.encodedDocument); - const len = binary_string.length; - const bytes = new Uint8Array(len); - for (let i = 0; i < len; i++) { - bytes[i] = binary_string.charCodeAt(i); - } - this.pdfDataArr = bytes.buffer; - this.pdfViewer.openDocument(this.pdfDataArr); - } - - pdfRendered() { - this.pdfViewer.setZoom(this.signaturesService.scale); - - this.totalPages = this.pdfViewer.getNumberOfPages(); - this.signaturesService.totalPage = this.totalPages; - - this.getPdfImage(); - - this.signaturesService.renderingDoc = false; - } - - getPdfImage() { - this.resetDragPosition(); - this.snapshot = null; - this.pdfViewer.getPageSnapshot(2).then(snapshot => { - if (snapshot) { - this.snapshot = URL.createObjectURL(snapshot); - this.snapshot = this.sanitizer.bypassSecurityTrustResourceUrl(this.snapshot); - setTimeout(() => { - this.signaturesService.workingAreaHeight = $('#snapshotPdf').height(); - this.signaturesService.workingAreaWidth = $('#snapshotPdf').width(); - }, 1000); - - } - }); - } - testDrag(event: any) { const element = event.source.getRootElement(); const boundingClientRect = element.getBoundingClientRect(); @@ -265,10 +233,6 @@ export class DocumentComponent implements OnInit { return { top: y, left: x }; } - pdfError(e: any) { - console.log(e); - } - zoomForNotes() { this.widthDoc = '200%'; this.signaturesService.scale = 2; @@ -280,27 +244,23 @@ export class DocumentComponent implements OnInit { } zoomForView() { - this.resetDragPosition(); - this.widthDoc = '100%'; - this.signaturesService.workingAreaHeight /= this.signaturesService.scale; - this.signaturesService.workingAreaWidth /= this.signaturesService.scale; - this.signaturesService.scale = 1; - - } - - resetDragPosition() { - this.signaturesService.y = 0; - this.signaturesService.x = 0; + // this.resetDragPosition(); this.resetDragPos = true; + this.widthDoc = '100%'; setTimeout(() => { this.resetDragPos = false; }, 200); + setTimeout(() => { + this.signaturesService.workingAreaHeight = $('#snapshotPdf').height(); + this.signaturesService.workingAreaWidth = $('#snapshotPdf').width(); + }, 400); + this.signaturesService.scale = 1; + } prevPage() { this.pageNum--; - this.pdfViewer.prevPage(); - this.getPdfImage(); + if (this.pageNum === 0) { this.pageNum = 1; } else { @@ -317,34 +277,13 @@ export class DocumentComponent implements OnInit { } else { this.pageNum++; } - this.pdfViewer.nextPage(); - this.getPdfImage(); + // only for main document if (this.currentDoc === 0) { this.signaturesService.currentPage = this.pageNum; } } - nextDoc() { - this.signaturesService.renderingDoc = true; - this.signaturesService.isTaggable = false; - this.pageNum = 1; - this.currentDoc++; - this.pdfRender(this.docList[this.currentDoc]); - this.loadNextDoc(); - } - - prevDoc() { - this.signaturesService.renderingDoc = true; - this.pageNum = 1; - this.currentDoc--; - if (this.currentDoc === 0) { - this.signaturesService.currentPage = 1; - this.signaturesService.isTaggable = true; - } - this.pdfRender(this.docList[this.currentDoc]); - } - addAnnotation(e: any) { if (!this.signaturesService.annotationMode && this.currentDoc === 0) { @@ -352,7 +291,13 @@ export class DocumentComponent implements OnInit { const posX = e.srcEvent.layerX - this.signaturesService.x; const posY = e.srcEvent.layerY - this.signaturesService.y; - this.signaturesService.x = -posX; + + if (this.signaturesService.mobileMode) { + this.signaturesService.x = -posX; + } else { + this.signaturesService.x = -posX + 350; + } + this.signaturesService.y = -posY; this.zoomForNotes(); $('.example-box').css({ 'transform': 'translate3d(' + -(posX) + 'px, ' + -(posY) + 'px, 0px)' }); @@ -405,7 +350,6 @@ export class DocumentComponent implements OnInit { if (this.currentDoc > 0) { this.currentDoc = 0; this.pageNum = 1; - this.pdfRender(this.docList[this.currentDoc]); } this.signaturesService.showSign = true; this.signaturesService.showPad = false; @@ -433,44 +377,13 @@ export class DocumentComponent implements OnInit { }); } - loadNextDoc() { - if (this.docList[this.currentDoc + 1] && this.docList[this.currentDoc + 1].id && this.docList[this.currentDoc + 1].encodedDocument === '') { - this.http.get('../rest/attachments/' + this.docList[this.currentDoc + 1].id) - .subscribe((dataPj: any) => { - this.docList[this.currentDoc + 1] = dataPj.attachment; - }, (err: any) => { - this.notificationService.handleErrors(err); - }); - } - } - - loadDoc(id: any) { - const index = this.docList.map((doc: any) => (doc.id)).indexOf(id); - if (this.docList[index] && this.docList[index].id && this.docList[index].encodedDocument === '') { - this.loadingDoc = true; - this.http.get('../rest/attachments/' + this.docList[index].id) - .subscribe((dataPj: any) => { - this.docList[index] = dataPj.attachment; - this.signaturesService.renderingDoc = true; - if (index > 0) { - this.signaturesService.isTaggable = false; - } - this.pageNum = 1; - this.currentDoc = index; - this.pdfRender(this.docList[this.currentDoc]); - this.loadingDoc = false; - }, (err: any) => { - this.notificationService.handleErrors(err); - }); - } else { - this.signaturesService.renderingDoc = true; - if (index > 0) { - this.signaturesService.isTaggable = false; - } - this.pageNum = 1; - this.currentDoc = index; - this.pdfRender(this.docList[this.currentDoc]); + loadDoc(index: any) { + this.signaturesService.renderingDoc = true; + if (index > 0) { + this.signaturesService.isTaggable = false; } + this.pageNum = 1; + this.currentDoc = index; } launchEvent(action: any) { diff --git a/src/frontend/app/document/main-document-detail/main-document-detail.component.html b/src/frontend/app/document/main-document-detail/main-document-detail.component.html new file mode 100644 index 0000000000000000000000000000000000000000..a25b03def3ebbd16ccbc780bec3d27a3ed1d3c48 --- /dev/null +++ b/src/frontend/app/document/main-document-detail/main-document-detail.component.html @@ -0,0 +1,60 @@ +<div class="panel-container" *ngIf="!loading"> + <div class="panel-header"> + <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-info-circle fa-2x"></mat-icon> Informations + </div> + <div class="panel-content" *ngIf="mainDocument.id"> + <mat-list> + <mat-list-item> + <p mat-line style="display: flex;padding:10px;"> + <mat-form-field style="width:100%;"> + <input matInput [value]="mainDocument.sender" title="{{mainDocument.sender}}" + placeholder="{{'lang.emittedBy' | translate}}" disabled> + </mat-form-field> + </p> + </mat-list-item> + <mat-list-item *ngIf="mainDocument.description != null"> + <p mat-line style="display: flex;padding:10px;"> + <mat-form-field style="width:100%;"> + <input matInput [value]="mainDocument.description" title="{{mainDocument.description}}" + placeholder="{{'lang.description' | translate}}" disabled> + </mat-form-field> + </p> + </mat-list-item> + <mat-list-item *ngIf="mainDocument.deadline != null"> + <p mat-line style="display: flex;padding:10px;"> + <mat-form-field style="width:100%;"> + <input matInput [value]="mainDocument.deadline" title="{{mainDocument.deadline}}" + placeholder="{{'lang.processingDeadline' | translate}}" disabled> + </mat-form-field> + </p> + </mat-list-item> + <mat-list-item> + <p mat-line style="display: flex;padding:10px;"> + <mat-form-field style="width:100%;"> + <input matInput [value]="mainDocument.reference" title="{{mainDocument.reference}}" + placeholder="{{'lang.reference' | translate}}" disabled> + </mat-form-field> + </p> + </mat-list-item> + <mat-list-item> + <p mat-line style="display: flex;padding:10px;"> + <mat-form-field style="width:100%;"> + <input matInput [value]="mainDocument.title" title="{{mainDocument.title}}" + placeholder="{{'lang.subject' | translate}}" disabled> + </mat-form-field> + </p> + </mat-list-item> + <mat-list-item *ngFor="let data of mainDocument.metadata;"> + <p mat-line style="display: flex;padding:10px;"> + <mat-form-field style="width:100%;"> + <input matInput [value]="data.value" title="{{data.value | translate}}" + placeholder="{{data.label | translate}}" disabled> + </mat-form-field> + </p> + </mat-list-item> + </mat-list> + </div> +</div> \ No newline at end of file diff --git a/src/frontend/app/document/main-document-detail/main-document-detail.component.scss b/src/frontend/app/document/main-document-detail/main-document-detail.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..9c423914d46b6b56dc80d5f237ab9ca92ee55f61 --- /dev/null +++ b/src/frontend/app/document/main-document-detail/main-document-detail.component.scss @@ -0,0 +1,97 @@ +@import '../../../css/vars.scss'; + +.mat-list-item { + height: auto !important; + text-align: center; +} + +.mat-card { + box-shadow: none; + border: solid 1px #E0E0E0; +} + +.infosPj { + background: #F9F9F9; + border-top: solid 1px rgba(0, 0, 0, 0.12); + position: absolute; + width: 100%; + bottom: 0; + padding: 5px; + + ::ng-deep.mat-expansion-panel-body { + padding: 0px; + } + + ::ng-deep.mat-form-field-label { + color: $primary; + } +} + +.subInfos { + display: block; + font-size: 12px; + color: $primary; + font-weight: bold; +} + +.subInfosBottom { + font-size: 12px; + color: #666; +} + +.mat-icon { + height: auto; +} + +.pjToolsContent { + position: absolute; + right: 0px; + border-bottom: solid 1px #E0E0E0; + border-left: solid 1px #E0E0E0; + border-bottom-left-radius: 5px; + background: white; + padding: 10px; +} + +.current { + box-shadow: 0px 0px 20px 0px #656565; +} + +.panel-header { + box-shadow: 0px 0px 10px 0px #656565; + color: white; + background: $primary; + height: 65px; + display: flex; + justify-content: center; + position: relative; + font-size: 20px; + align-items: center; +} +.pjListContent { + padding-left: 30px; + padding-right: 30px; + flex: 1; + overflow: auto; +} +.panel-content { + display: flex; + flex-direction: column; + position: relative; + height: 100%; + overflow: hidden; +} + +.closePanel { + position: absolute; + left: 0px; + font-size: 24px; +} + +.panel-content ::ng-deep.mat-form-field-label { + color: #F99830; +} + +.panel-content ::ng-deep.mat-input-element:disabled { + color: $primary; +} \ No newline at end of file diff --git a/src/frontend/app/document/main-document-detail/main-document-detail.component.ts b/src/frontend/app/document/main-document-detail/main-document-detail.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..a33cdd61f1f5b17e19a7432b5934048dcc522ecb --- /dev/null +++ b/src/frontend/app/document/main-document-detail/main-document-detail.component.ts @@ -0,0 +1,24 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { MatSidenav } from '@angular/material'; +import { SignaturesContentService } from '../../service/signatures.service'; + +@Component({ + selector: 'app-main-document-detail', + templateUrl: 'main-document-detail.component.html', + styleUrls: ['main-document-detail.component.scss'], +}) +export class MainDocumentDetailComponent implements OnInit { + + loading: boolean = false; + + // tslint:disable-next-line:no-input-rename + @Input('mainDocument') mainDocument: any; + + // tslint:disable-next-line:no-input-rename + @Input('snavRightComponent') snavRightComponent: MatSidenav; + + constructor(public signaturesService: SignaturesContentService) { } + + ngOnInit(): void { } + +} diff --git a/src/frontend/app/document/visa-workflow/visa-workflow.component.html b/src/frontend/app/document/visa-workflow/visa-workflow.component.html index 55d7909539e263eaae13105b7f18388adb998131..51ed3123e4b7fca80179589d737510170f7789ed 100644 --- a/src/frontend/app/document/visa-workflow/visa-workflow.component.html +++ b/src/frontend/app/document/visa-workflow/visa-workflow.component.html @@ -1,6 +1,6 @@ <div class="panel-container" *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-list-ol fa-2x"></mat-icon> {{'lang.visaWorkflow' | translate}} diff --git a/src/frontend/app/document/visa-workflow/visa-workflow.component.ts b/src/frontend/app/document/visa-workflow/visa-workflow.component.ts index 84b4418d043acd39283d752ec1c2630fd9882097..b0d1ad5a1ac608dd99ca30c8be4bd9b4991ea220 100644 --- a/src/frontend/app/document/visa-workflow/visa-workflow.component.ts +++ b/src/frontend/app/document/visa-workflow/visa-workflow.component.ts @@ -1,7 +1,6 @@ import { Component, Input, OnInit } 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-visa-workflow', @@ -18,7 +17,7 @@ export class VisaWorkflowComponent implements OnInit { // tslint:disable-next-line:no-input-rename @Input('snavRightComponent') snavRightComponent: MatSidenav; - constructor(public http: HttpClient, public notificationService: NotificationService) { } + constructor(public signaturesService: SignaturesContentService) { } ngOnInit(): void { } } diff --git a/src/frontend/app/documentNoteList/document-note-list.component.html b/src/frontend/app/documentNoteList/document-note-list.component.html index a78721f43abb8a647965d1cc3ae0f28fdc043a17..a6646cc7c8d4232d6fbf4942e1ba2d4e6c0345dd 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.workingAreaWidth*2" [src]="sanitization.bypassSecurityTrustUrl(note.fullPath)"> + <img [style.width.px]="signaturesService.mobileMode ? signaturesService.workingAreaWidth*2 : 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 12e2b4692d1ae49d899215d4f443579f75b0ce4b..15199e9148c58363ad5620e7fedf3b9a83fa3010 100644 --- a/src/frontend/app/documentNotePad/document-note-pad.component.ts +++ b/src/frontend/app/documentNotePad/document-note-pad.component.ts @@ -66,7 +66,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/documentSignList/document-sign-list.component.html b/src/frontend/app/documentSignList/document-sign-list.component.html index 8b777d6c4849b3f891d89acbde59754f3082f50c..6c0eee1588b0bd26a5cc065e02c09f702610a4ef 100644 --- a/src/frontend/app/documentSignList/document-sign-list.component.html +++ b/src/frontend/app/documentSignList/document-sign-list.component.html @@ -1,5 +1,5 @@ <ng-container *ngFor="let signature of this.signaturesService.signaturesContent[this.signaturesService.currentPage];let i = index;"> - <div (tap)="$event.preventDefault();" [position]="{'x': (signature.positionX*this.signaturesService.workingAreaWidth)/100, 'y': (signature.positionY*this.signaturesService.workingAreaHeight)/100}" 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%;" + <div [style.width.%]="25" (tap)="$event.preventDefault();" [position]="{'x': (signature.positionX*this.signaturesService.workingAreaWidth)/100, 'y': (signature.positionY*this.signaturesService.workingAreaHeight)/100}" 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]="page" inBounds="true" (started)="onDragBegin($event)" (endOffset)="moveSign($event,i)" [ngClass]="{ 'pdf-page-canvas':!signaturesService.renderingDoc, 'pdf-page-canvas-loading-doc':signaturesService.renderingDoc @@ -19,6 +19,6 @@ </button> </mat-menu> <img [src]="sanitization.bypassSecurityTrustUrl('data:image/png;base64,' + signature.encodedSignature)" - [style.width.px]="this.signaturesService.workingAreaWidth/4"> + [style.width.%]="100"> </div> </ng-container> \ 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 407d070d4fe52ed515e4d00b22735f3bf9d34ca1..1455d780e7e64d7114bf8ffaed9676ba74cbcb9b 100644 --- a/src/frontend/app/documentSignList/document-sign-list.component.ts +++ b/src/frontend/app/documentSignList/document-sign-list.component.ts @@ -31,6 +31,7 @@ export class DocumentSignListComponent implements OnInit { this.signaturesService.signaturesContent[this.signaturesService.currentPage][i].positionY = percenty; localStorage.setItem(this.signaturesService.mainDocumentId.toString(), JSON.stringify({'sign' : this.signaturesService.signaturesContent, 'note' : this.signaturesService.notesContent})); this.signaturesService.documentFreeze = false; + console.log(this.signaturesService.signaturesContent); } cloneSign(i: number) { diff --git a/src/frontend/app/overlay/overlay.component.html b/src/frontend/app/overlay/overlay.component.html index 02331d30e3a07752d905160cd1a4cfdc46bd2b47..f0250ebcc3b8f093175f1504e77478d47a5656ad 100644 --- a/src/frontend/app/overlay/overlay.component.html +++ b/src/frontend/app/overlay/overlay.component.html @@ -1,9 +1,9 @@ <div> - <span style="z-index:1;position: fixed;left:0;bottom: 10px;top: 10px;font-size: 25px;height:50px;"> + <span style="z-index:1;position: absolute;left:0;bottom: 10px;top: 10px;font-size: 25px;height:50px;"> <button class="btn blue" (tap)="this.appDocumentNotePad.cancelAnnotation();"><i class="fas fa-arrow-left fa-2x"></i>{{'lang.exitAnnotation' | translate}}</button> </span> - <span style="z-index:1;position: fixed;bottom: 10px;left: 50%;transform: translateX(-50%);font-size: 25px;"> + <span style="z-index:1;position: absolute;bottom: 70px;left: 50%;transform: translateX(-50%);font-size: 25px;"> <button class="btn green" (tap)="this.appDocumentNotePad.validateAnnotation();"><i class="fas fa-check-circle fa-2x"></i>{{'lang.validateAnnotation' | translate}}</button> </span> diff --git a/src/frontend/app/overlay/overlay.component.scss b/src/frontend/app/overlay/overlay.component.scss index 9c516d14565f1ed64112791b7283d1a8a65a416d..5f6feaab7af1b9f0b72660060edab570144d8d19 100644 --- a/src/frontend/app/overlay/overlay.component.scss +++ b/src/frontend/app/overlay/overlay.component.scss @@ -1,7 +1,7 @@ .tool-content { z-index: 1; display: flex; - position: fixed; + position: absolute; background: #8080804d; border-radius: 20px; top: 170px; diff --git a/src/frontend/app/profile/profile.component.html b/src/frontend/app/profile/profile.component.html index 07f31bdaefb65cd76cdeb8331386989066e8a877..cd872ad9b8c951e48f98f1483766121568548b88 100644 --- a/src/frontend/app/profile/profile.component.html +++ b/src/frontend/app/profile/profile.component.html @@ -7,6 +7,7 @@ [ngStyle]="{'background': 'url(' + this.profileInfo.picture + ') no-repeat scroll center center / cover'}" (tap)="uploadFile.click();"> </div> + <input #uploadFile type="file" style="display:none;" (change)="handleFileInput($event.target.files)"> </div> <div class="panel-content"> <form (ngSubmit)="submitProfile()" #profileForm="ngForm"> @@ -234,7 +235,7 @@ <button class="validate" mat-button color="primary" type="submit" [disabled]="allowValidate() || !profileForm.form.valid">{{ msgButton | translate}}</button> - <button class="cancel" mat-icon-button type="button" (tap)="closeProfile();"> + <button *ngIf="signaturesService.mobileMode" class="cancel" mat-icon-button type="button" (tap)="closeProfile();"> <mat-icon fontSet="fas" fontIcon="fa-arrow-left fa-2x"></mat-icon> </button> </span> diff --git a/src/frontend/app/profile/profile.component.ts b/src/frontend/app/profile/profile.component.ts index eed31f9704b4d695ca3c9c6dc538771760c79397..5365d4d537381c29873739b67d5ba9a23b45d5d9 100644 --- a/src/frontend/app/profile/profile.component.ts +++ b/src/frontend/app/profile/profile.component.ts @@ -79,8 +79,11 @@ export class ProfileComponent implements OnInit { $('.avatarProfile').css({ 'content': '' }); this.profileInfo = JSON.parse(JSON.stringify(this.signaturesService.userLogged)); this.passwordContent.close(); - this.snavLeftComponent.open(); - this.snavRightComponent.close(); + + if (this.signaturesService.mobileMode) { + this.snavLeftComponent.open(); + this.snavRightComponent.close(); + } } diff --git a/src/frontend/app/service/signatures.service.ts b/src/frontend/app/service/signatures.service.ts index f170204aa4b214a09efeddfeade5d2e02575a900..a98a2c6f85f8331ef0f669e0cb96c65896c19f10 100755 --- a/src/frontend/app/service/signatures.service.ts +++ b/src/frontend/app/service/signatures.service.ts @@ -41,6 +41,11 @@ export class SignaturesContentService { this.mobileMode = true; } else { this.mobileMode = false; + this.sideNavRigtDatas = { + mode : 'mainDocumentDetail', + width : '450px', + locked : true, + }; } } @@ -76,6 +81,11 @@ export class SignaturesContentService { this.mobileMode = true; } else { this.mobileMode = false; + this.sideNavRigtDatas = { + mode : 'mainDocumentDetail', + width : '450px', + locked : true, + }; } this.mode = ''; this.scale = 1; diff --git a/src/frontend/app/sidebar/sidebar.component.html b/src/frontend/app/sidebar/sidebar.component.html index 0fbd14529c5b5aaf0666eff8b26f5d49f6b70003..830aaaca1501cffc78e31559bceab7234315719b 100755 --- a/src/frontend/app/sidebar/sidebar.component.html +++ b/src/frontend/app/sidebar/sidebar.component.html @@ -4,7 +4,7 @@ <button class="logout-button" mat-icon-button (click)="logout()"> <mat-icon fontSet="fas" fontIcon="fa-power-off"></mat-icon> </button> - <button *ngIf="signaturesService.mainDocumentId > 0" class="closePanel" mat-icon-button type="button" (tap)="snavLeftComponent.close();"> + <button *ngIf="signaturesService.mainDocumentId > 0 && signaturesService.mobileMode" class="closePanel" mat-icon-button type="button" (tap)="snavLeftComponent.close();"> <mat-icon fontSet="fas" fontIcon="fa-arrow-left fa-2x"></mat-icon> </button> <div class="user" style="color: #F99830"> diff --git a/src/frontend/app/sidebar/sidebar.component.scss b/src/frontend/app/sidebar/sidebar.component.scss index 01fa7c0c64bc71e973fab9ec8216d5d1d0b86bcf..72295e871dbe7d21a7968bd6af3fefc22dfbc5dc 100644 --- a/src/frontend/app/sidebar/sidebar.component.scss +++ b/src/frontend/app/sidebar/sidebar.component.scss @@ -150,7 +150,7 @@ font-size: 24px; color: white; position: absolute; - left: 0px; + left: 10px; } .closePanel { diff --git a/src/frontend/app/sidebar/sidebar.component.ts b/src/frontend/app/sidebar/sidebar.component.ts index a36c4ba70b0ca8cfe547e53e2f51737ed65d4901..60ff8809d5f8630af402fdcb3517e1dc7d7ede2d 100755 --- a/src/frontend/app/sidebar/sidebar.component.ts +++ b/src/frontend/app/sidebar/sidebar.component.ts @@ -29,7 +29,6 @@ export class SidebarComponent implements OnInit { } ngOnInit() { - console.log(this.signaturesService); $('.avatar').css({'background': 'url(data:image/png;base64,' + this.signaturesService.userLogged.picture + ') no-repeat #135F7F'}).css({'background-size': 'cover'}).css({'background-position': 'center'}); this.http.get('../rest/documents?limit=' + this.limit + '&offset=' + this.offset + '&mode=' + this.signaturesService.mode) .subscribe((data: any) => { @@ -62,7 +61,9 @@ export class SidebarComponent implements OnInit { gotTo(documentId: Number, i: any) { this.router.navigate(['/documents/' + documentId]); this.signaturesService.indexDocumentsList = i; - this.sidenav.close(); + if (this.signaturesService.mobileMode) { + this.sidenav.close(); + } } openProfile() { @@ -71,8 +72,10 @@ export class SidebarComponent implements OnInit { width : '650px', locked : true, }; - this.snavLeftComponent.close(); - this.snavRightComponent.open(); + if (this.signaturesService.mobileMode) { + this.snavLeftComponent.close(); + this.snavRightComponent.open(); + } } logout() { diff --git a/src/frontend/core/styles.scss b/src/frontend/core/styles.scss index 3a8980e44bab36eb77f57c5d842bb2be17535482..b42dfecf0e87d05b95a332188c084275295ab220 100644 --- a/src/frontend/core/styles.scss +++ b/src/frontend/core/styles.scss @@ -133,13 +133,13 @@ body { } .footer { - width: 100vw; + width: 100%; height: 60px; display: flex; align-items: center; justify-content: space-around; - position: fixed; - bottom: 10px; + position: absolute; + bottom: 70px; z-index: 1; }