diff --git a/src/frontend/app/document/document.component.html b/src/frontend/app/document/document.component.html index f5cbb10b9d963b24791753ed2f9d208628e99378..f18b7ccb9fc6089507fce6784d8d66adaf4931bd 100755 --- a/src/frontend/app/document/document.component.html +++ b/src/frontend/app/document/document.component.html @@ -6,35 +6,68 @@ <app-sidebar [snavLeftComponent]="this.snav" [snavRightComponent]="this.snavRight"></app-sidebar> </mat-sidenav> <mat-sidenav-content class="mainView"> - <div *ngIf="loadingDoc" style="position: fixed;z-index: 2;display: flex;background: #fffc;width: 100%;height: 100%;justify-content: center;align-items: center;"> + <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]> + <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();"> <mat-icon fontSet="fas" fontIcon="fa-bars"></mat-icon> </button> </section> - <div class="header-info"> - <p class="c-active-color bold" *ngIf="mainDocument.reference">Référence : </p> - <p class="ellipsis" *ngIf="mainDocument.reference">{{mainDocument.reference}}</p> - <p class="c-active-color bold" *ngIf="mainDocument.subject">Sujet : </p> - <p class="ellipsis" *ngIf="mainDocument.subject">{{mainDocument.subject}}</p> - </div> - <div class="header-info"> - <p class="c-active-color bold" *ngIf="mainDocument.sender">Émis par : </p> - <p class="ellipsis" *ngIf="mainDocument.sender">{{mainDocument.sender}} ({{mainDocument.sender_entity}})</p> - <p class="c-active-color bold" *ngIf="mainDocument.recipient">Pour : </p> - <p class="ellipsis" *ngIf="mainDocument.recipient">{{mainDocument.recipient}}</p> - </div> - <div class="header-info"> - <p class="c-active-color bold" *ngIf="mainDocument.limit_date">Date limite de traitement : </p> - <p class="ellipsis" *ngIf="mainDocument.limit_date">{{mainDocument.limit_date}} (<b>{{mainDocument.priority}}</b>)</p> - <p class="c-active-color bold" *ngIf="mainDocument.processingUserDisplay">À signer par : </p> - <p class="ellipsis" *ngIf="mainDocument.processingUserDisplay">{{mainDocument.processingUserDisplay}}</p> - </div> + <mat-accordion class="header-expand"> + <mat-expansion-panel> + <mat-expansion-panel-header> + <mat-panel-title> + <div> + <mat-form-field> + <input matInput [value]="mainDocument.reference" title="{{mainDocument.reference}}" + placeholder="Référence" disabled> + </mat-form-field> + + </div> + <div> + <mat-form-field> + <input matInput [value]="mainDocument.description" title="{{mainDocument.description}}" + placeholder="Description" disabled> + </mat-form-field> + </div> + <div> + <mat-form-field *ngIf="mainDocument.deadLine != null"> + <input matInput [value]="mainDocument.deadLine" title="{{mainDocument.deadLine}}" + placeholder="Date limite de traitement" disabled> + </mat-form-field> + </div> + </mat-panel-title> + </mat-expansion-panel-header> + <div class="header-expand-content"> + <mat-form-field> + <input matInput [value]="mainDocument.title" title="{{mainDocument.title}}" placeholder="Sujet" + disabled> + </mat-form-field> + </div> + <div class="header-expand-content"> + <mat-form-field> + <input matInput [value]="mainDocument.sender" title="{{mainDocument.sender}}" placeholder="Émis par" + disabled> + </mat-form-field> + </div> + <div class="header-expand-content"> + <mat-form-field> + <input matInput [value]="mainDocument.processingUserDisplay" + title="{{mainDocument.processingUserDisplay}}" placeholder="À signer par" 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}}" placeholder="{{data.label}}" disabled> + </mat-form-field> + </div> + </mat-expansion-panel> + </mat-accordion> + <section class="header-action"> <button mat-icon-button [matMenuTriggerFor]="menu"> <mat-icon fontSet="fas" fontIcon="fa-cog"></mat-icon> @@ -47,13 +80,16 @@ </article> </header> <ng-container *ngIf="!freezeSidenavClose"> - <button class="btn-previous" [disabled]="disableState" (tap)="prevPage()" *ngIf="pageNum > 1 && !this.signaturesService.annotationMode"><i - class="fas fa-chevron-left fa-3x"></i></button> - <button class="btn-previous" (tap)="prevDoc()" *ngIf="currentDoc > 0 && pageNum === 1 && !this.signaturesService.annotationMode"><i + <button class="btn-previous" [disabled]="disableState" (tap)="prevPage()" + *ngIf="pageNum > 1 && !this.signaturesService.annotationMode"><i class="fas fa-chevron-left fa-3x"></i></button> + <button class="btn-previous" (tap)="prevDoc()" + *ngIf="currentDoc > 0 && pageNum === 1 && !this.signaturesService.annotationMode"><i class="fas fa-chevron-left fa-3x"></i><i class="fas fa-chevron-left fa-3x"></i></button> - <button class="btn-next" [disabled]="disableState" (tap)="nextPage()" *ngIf="pageNum < totalPages && !this.signaturesService.annotationMode"><i + <button class="btn-next" [disabled]="disableState" (tap)="nextPage()" + *ngIf="pageNum < totalPages && !this.signaturesService.annotationMode"><i class="fas fa-chevron-right fa-3x"></i></button> - <button class="btn-next" (tap)="nextDoc()" *ngIf="pageNum == totalPages && docList.length > currentDoc+1 && !this.signaturesService.annotationMode"><i + <button class="btn-next" (tap)="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> </ng-container> <article class="article" style="position: fixed;" #article [style.left.px]="this.signaturesService.x" @@ -70,28 +106,29 @@ 'pdf-page-canvas-loading-doc':signaturesService.renderingDoc }" *ngIf="currentDoc == 0"></app-document-note-list> <div [style.width.px]="signaturesService.workingAreaWidth*signaturesService.scale" (tap)="addAnnotation($event)" - [style.height.px]="signaturesService.workingAreaHeight*signaturesService.scale" style="position:absolute;left:0;top:0;"></div> + [style.height.px]="signaturesService.workingAreaHeight*signaturesService.scale" + style="position:absolute;left:0;top:0;"></div> <app-document-sign-list [ngClass]="{ 'pdf-page-canvas':!signaturesService.renderingDoc, 'pdf-page-canvas-loading-doc':signaturesService.renderingDoc }" [canvas]="canvasWrapper" *ngIf="currentDoc == 0"></app-document-sign-list> - <app-document-note-pad (triggerEvent)="zoomMinus()" #appDocumentNotePad *ngIf="currentDoc == 0"></app-document-note-pad> + <app-document-note-pad (triggerEvent)="zoomMinus()" #appDocumentNotePad *ngIf="currentDoc == 0"> + </app-document-note-pad> </div> <div class="page-under"> <div class="page-under-fold"></div> </div> <section class="page-info" *ngIf="!this.signaturesService.annotationMode && docList[currentDoc]"> - <div class="page-info-doc">Doc {{currentDoc+1}}/{{docList.length}} : {{docList[currentDoc].subject}}</div> + <div class="page-info-doc">Doc {{currentDoc+1}}/{{docList.length}} : {{docList[currentDoc].title}}</div> <div class="page-info-page">page {{ pageNum }} / {{ totalPages }}</div> </section> </article> - <footer class="footer" *ngIf="!this.signaturesService.annotationMode && !freezeSidenavClose" - [@slideUp]> + <footer class="footer" *ngIf="!this.signaturesService.annotationMode && !freezeSidenavClose" [@slideUp]> <ng-container *ngFor="let action of actionsList;"> - <button [style.color]="action.color" [style.borderColor]="action.color" class="btn" (click)="launchEvent(action)"><i - class="{{action.logo}} fa-2x"></i>{{action.label}}</button> + <button *ngIf="action.allowed" [style.color]="action.color" [style.borderColor]="action.color" class="btn" + (click)="launchEvent(action)"><i class="{{action.logo}} fa-2x"></i>{{action.label}}</button> </ng-container> </footer> <app-drawer></app-drawer> diff --git a/src/frontend/app/document/document.component.scss b/src/frontend/app/document/document.component.scss index 3ecdbef653c1197f2f7f01ad58f4775f31428f45..1950518e200a33656d8f4dc5da54bb093faf3616 100644 --- a/src/frontend/app/document/document.component.scss +++ b/src/frontend/app/document/document.component.scss @@ -71,13 +71,15 @@ canvas { justify-content: center; align-items: center; padding: 0; + /*&-left position absolute top 15px left -60px*/ - &-action { - color: $primary; - } + &-action { + color: $primary; + } + &-infos { background: #F1F4F4; border-radius: 5px; @@ -89,20 +91,63 @@ canvas { padding-bottom: 12px; position: relative; } + &-info { border-right: 1px solid #979797; width: 200px; height: 60px; font-size: 12px; padding-left: 20px; + &:last-of-type { border: none; } + p { margin: 0; padding: 0; } } + + &-expand { + width: 80%; + position: absolute; + left: 50%; + transform: translateX(-50%); + top: 25px; + border: solid 1px #F1F4F4; + + .mat-form-field { + padding-top: 10px; + } + + ::ng-deep.mat-expansion-panel { + box-shadow: none; + } + + ::ng-deep.mat-form-field-label { + color: $primary; + } + + ::ng-deep .mat-form-field-underline { + display: none; + } + + &-content { + width: 33%; + display: inline-block; + } + + input:disabled { + opacity: 1; + color: #666; + } + + div { + flex: 1; + font-size: 12px; + } + } } @@ -122,6 +167,7 @@ canvas { opacity: 0.8; left: 50%; transform: translateX(-50%); + &-doc { max-width: 80%; background-color: #F1F4F4; @@ -132,6 +178,7 @@ canvas { overflow: hidden; text-overflow: ellipsis; } + &-page { max-width: 20%; text-align: center; @@ -157,10 +204,12 @@ canvas { top: 50%; cursor: pointer; z-index: 1; + &.disabled { cursor: not-allowed; } } + .btn-previous { color: #666; background: #c6c6c680; @@ -173,6 +222,7 @@ canvas { top: 50%; cursor: pointer; z-index: 1; + &.disabled { cursor: not-allowed; } @@ -206,4 +256,4 @@ button.disabled { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -} +} \ 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 27b30c334984821142954e2bb2f991b07ddd35a7..1708c6ab31dca4a6267c8a76197a3baf4d581522 100755 --- a/src/frontend/app/document/document.component.ts +++ b/src/frontend/app/document/document.component.ts @@ -121,9 +121,23 @@ export class DocumentComponent implements OnInit { this.http.get('../rest/documents/' + params['id']) .subscribe((data: any) => { this.mainDocument = data.document; + this.signaturesService.mainDocumentId = this.mainDocument.id; this.initDoc(); - this.actionsList = data.document.actionsAllowed; + if (this.actionsList.length === 0) { + this.http.get('../rest/actions') + .subscribe((dataActionsList: any) => { + this.actionsList = dataActionsList.actions; + this.actionsList.forEach((element: any) => { + if (this.mainDocument.actionsAllowed.indexOf(element.id) > -1) { + element.allowed = true; + } else { + element.allowed = false; + } + }); + }); + } + if (this.signaturesService.signaturesList.length === 0) { this.http.get('../rest/users/' + this.signaturesService.userLogged.id + '/signatures') .subscribe((dataSign: any) => { @@ -132,8 +146,8 @@ export class DocumentComponent implements OnInit { }); } this.docList.push({ 'id': this.mainDocument.id, 'encodedDocument': this.mainDocument.encodedDocument, 'subject': this.mainDocument.subject }); - this.mainDocument.attachments.forEach((attach: any, index: any) => { - this.docList.push({ 'id': attach.id, 'encodedDocument': '', 'title': '' }); + this.mainDocument.attachments.forEach((attach: any) => { + this.docList.push({ 'id': attach, 'encodedDocument': '', 'title': '' }); }); this.pdfRender(this.docList[this.currentDoc]); diff --git a/src/frontend/app/sidebar/sidebar.component.html b/src/frontend/app/sidebar/sidebar.component.html index 43bcf428fb5cc48aa32625e7cd0e33278fbe1e36..8afcaee55999ba898e96bbe821ff11901333136a 100755 --- a/src/frontend/app/sidebar/sidebar.component.html +++ b/src/frontend/app/sidebar/sidebar.component.html @@ -27,8 +27,8 @@ <i class="fas fa-mail-bulk"></i> </div> <div class="nav-item-middle"> - <div class="nav-item-title">{{document.reference}}</div> - <div class="">{{document.subject}}</div> + <div class="">{{document.reference}}</div> + <div class="nav-item-title">{{document.title}}</div> </div> <div class="nav-item-right"> <i class="fas fa-arrow-right"></i> diff --git a/src/frontend/app/sidebar/sidebar.component.scss b/src/frontend/app/sidebar/sidebar.component.scss index 9882b847acfec945cfa1233faf5e02c486d465b8..9bd82f19d68e195a5a684b3993199cf015d43324 100644 --- a/src/frontend/app/sidebar/sidebar.component.scss +++ b/src/frontend/app/sidebar/sidebar.component.scss @@ -94,6 +94,7 @@ &-title { font-weight: 600; color: #135F7F; + font-size: 14px; } } }