diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index f78c5421e6b412a02225356e6917bf22bae8d101..397a7581922694d3fc5868d2bacdab805529614a 100755 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -68,6 +68,11 @@ import { AvisWorkflowComponent } from './avis/avis-workflow.componen import { PrintSeparatorComponent } from './separator/print-separator/print-separator.component'; import { IndexationComponent } from './indexation/indexation.component'; +import { HistoryWorkflowResumeComponent } from './history/history-workflow-resume/history-workflow-resume.component'; +import { NoteResumeComponent } from './notes/note-resume/note-resume.component'; +import { AttachmentShowModalComponent } from './attachments/attachment-show-modal/attachment-show-modal.component'; +import { AttachmentsResumeComponent } from './attachments/attachments-resume/attachments-resume.component'; +import { MailResumeComponent } from './mail/mail-resume/mail-resume.component'; import { AddPrivateIndexingModelModalComponent } from './indexation/private-indexing-model/add-private-indexing-model-modal.component'; import { FoldersService } from './folder/folders.service'; @@ -132,7 +137,12 @@ import { FoldersService } from './folder/folders.service'; FolderUpdateComponent, FolderActionListComponent, IndexationComponent, - AddPrivateIndexingModelModalComponent + HistoryWorkflowResumeComponent, + NoteResumeComponent, + AttachmentsResumeComponent, + AddPrivateIndexingModelModalComponent, + AttachmentShowModalComponent, + MailResumeComponent ], entryComponents: [ CustomSnackbarComponent, @@ -157,7 +167,8 @@ import { FoldersService } from './folder/folders.service'; SendShippingActionComponent, ViewDocActionComponent, FolderUpdateComponent, - AddPrivateIndexingModelModalComponent + AddPrivateIndexingModelModalComponent, + AttachmentShowModalComponent ], providers: [ HeaderService, FiltersListService, FoldersService, NotificationService ], bootstrap: [ AppComponent ] diff --git a/src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.html b/src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.html new file mode 100644 index 0000000000000000000000000000000000000000..4df11bd2dedb72162adf2cdfb423d8cee6fcfb45 --- /dev/null +++ b/src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.html @@ -0,0 +1,5 @@ +<h1 mat-dialog-title>{{data.attachment.identifier}} - {{data.attachment.title}}</h1> +<mat-dialog-content class="modal-container"> + <app-document-viewer #appDocumentViewer style="height:100%;width:100%;" [editMode]="false"> + </app-document-viewer> +</mat-dialog-content> \ No newline at end of file diff --git a/src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.scss b/src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..eedd4afc56fa2f6eecfce1524e2ee15c15fc021f --- /dev/null +++ b/src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.scss @@ -0,0 +1,12 @@ +@import '../../../css/vars.scss'; + +.mat-dialog-title { + padding: 10px; +} +.modal-container{ + height: auto; +} + +.modal-body{ + min-height: auto; +} diff --git a/src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.ts b/src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..45f0acfd27352de5c85b8893d2e14b081b45d266 --- /dev/null +++ b/src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.ts @@ -0,0 +1,31 @@ +import { Component, Inject, ViewChild } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { LANG } from '../../translate.component'; +import { HttpClient } from '@angular/common/http'; +import { tap, catchError } from 'rxjs/operators'; +import { of } from 'rxjs'; +import { NotificationService } from '../../notification.service'; +import { DocumentViewerComponent } from '../../viewer/document-viewer.component'; + +@Component({ + templateUrl: 'attachment-show-modal.component.html', + styleUrls: ['attachment-show-modal.component.scss'], +}) +export class AttachmentShowModalComponent { + lang: any = LANG; + + pdfSrc: any = null; + + @ViewChild('appDocumentViewer', { static: true }) appDocumentViewer: DocumentViewerComponent; + + constructor( + public http: HttpClient, + @Inject(MAT_DIALOG_DATA) public data: any, + public dialogRef: MatDialogRef<AttachmentShowModalComponent>, + private notify: NotificationService) { + } + + ngOnInit(): void { + this.appDocumentViewer.loadRessource(100); + } +} diff --git a/src/frontend/app/attachments/attachments-resume/attachments-resume.component.html b/src/frontend/app/attachments/attachments-resume/attachments-resume.component.html new file mode 100644 index 0000000000000000000000000000000000000000..3b7cbce6cc0bcf5568cf5abf82568fb33e1d264e --- /dev/null +++ b/src/frontend/app/attachments/attachments-resume/attachments-resume.component.html @@ -0,0 +1,21 @@ +<ng-container *ngFor="let attachment of attachments"> + <div class="attachmentsList" (click)="showAttachment(attachment)"> + <ng-container *ngIf="attachment.update_date !== null; else elseTemplate"> + <div class="date" [title]="attachment.update_date | fullDate"> + {{attachment.update_date | timeAgo}} + </div> + </ng-container> + <ng-template #elseTemplate> + <div class="date" [title]="attachment.creation_date | fullDate"> + {{attachment.creation_date | timeAgo}} + </div> + </ng-template> + <div class="info"> + {{attachment.title}} + </div> + <div class="attachmentType"> + {{attachment.typeLabel}} + </div> + </div> + <mat-divider></mat-divider> +</ng-container> \ No newline at end of file diff --git a/src/frontend/app/attachments/attachments-resume/attachments-resume.component.scss b/src/frontend/app/attachments/attachments-resume/attachments-resume.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..8442336e0342e62e9f881b4434f13d3e4e3a828d --- /dev/null +++ b/src/frontend/app/attachments/attachments-resume/attachments-resume.component.scss @@ -0,0 +1,24 @@ +@import "../../../css/vars.scss"; + +.attachmentsList { + cursor: pointer; + font-size: 13px; + width: 100%; + display: grid; + grid-template-columns: 15% 65% 20%; + align-items: center; +} + +.date { + padding: 5px; + color: $primary; +} + +.info { + padding: 5px; +} + +.attachmentType { + font-size: 10px; + color: $primary; +} \ No newline at end of file diff --git a/src/frontend/app/attachments/attachments-resume/attachments-resume.component.ts b/src/frontend/app/attachments/attachments-resume/attachments-resume.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..f1febcad6a582fab5c12c2e3d98f2820a98b09b3 --- /dev/null +++ b/src/frontend/app/attachments/attachments-resume/attachments-resume.component.ts @@ -0,0 +1,57 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { LANG } from '../../translate.component'; +import { catchError, tap, finalize } from 'rxjs/operators'; +import { of } from 'rxjs'; +import { NotificationService } from '../../notification.service'; +import { MatDialog } from '@angular/material'; +import { AttachmentShowModalComponent } from '../attachment-show-modal/attachment-show-modal.component'; + + +@Component({ + selector: 'app-attachments-resume', + templateUrl: "attachments-resume.component.html", + styleUrls: [ + 'attachments-resume.component.scss', + ] +}) + +export class AttachmentsResumeComponent implements OnInit { + + lang: any = LANG; + + loading: boolean = true; + + attachments: any[] = []; + + @Input('resId') resId: number = null; + + constructor( + public http: HttpClient, + private notify: NotificationService, + public dialog: MatDialog, + ) { + } + + ngOnInit(): void { + this.loading = true; + this.loadAttachments(this.resId); + } + + loadAttachments(resId: number) { + this.http.get(`../../rest/resources/${resId}/attachments?limit=2`).pipe( + tap((data: any) => { + this.attachments = data.attachments; + }), + finalize(() => this.loading = false), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } + + showAttachment(attachment: any) { + this.dialog.open(AttachmentShowModalComponent, { data: { attachment: attachment } }); + } +} \ No newline at end of file diff --git a/src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.html b/src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.html new file mode 100644 index 0000000000000000000000000000000000000000..27d51ea84082564aa0f78949bd9f9d92f25c588f --- /dev/null +++ b/src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.html @@ -0,0 +1,11 @@ +<ng-container *ngFor="let history of histories"> + <div class="historyList"> + <div class="date" [title]="history.event_date | fullDate"> + {{history.event_date | timeAgo}} + </div> + <div class="info"> + {{history.info}} + </div> + </div> + <mat-divider></mat-divider> +</ng-container> \ No newline at end of file diff --git a/src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.scss b/src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..b85e66a4b8bc3942b630ae2ab3b5600de12ba289 --- /dev/null +++ b/src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.scss @@ -0,0 +1,18 @@ +@import "../../../css/vars.scss"; + +.historyList { + font-size: 13px; + width: 100%; + display: grid; + grid-template-columns: 15% 85%; + align-items: center; +} + +.date { + padding: 5px; + color: $primary; +} + +.info { + padding: 5px; +} diff --git a/src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.ts b/src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..87d07eda6374c06abc3600439cac57f4d4482973 --- /dev/null +++ b/src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.ts @@ -0,0 +1,50 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { LANG } from '../../translate.component'; +import { catchError, tap, finalize } from 'rxjs/operators'; +import { of } from 'rxjs'; +import { NotificationService } from '../../notification.service'; + + +@Component({ + selector: 'app-history-workflow-resume', + templateUrl: "history-workflow-resume.component.html", + styleUrls: [ + 'history-workflow-resume.component.scss', + ] +}) + +export class HistoryWorkflowResumeComponent implements OnInit { + + lang: any = LANG; + + loading: boolean = true; + + histories: any[] = []; + + @Input('resId') resId: number = null; + + constructor( + public http: HttpClient, + private notify: NotificationService, + ) { + } + + ngOnInit(): void { + this.loading = true; + this.loadHistory(this.resId); + } + + loadHistory(resId: number) { + this.http.get(`../../rest/histories/resources/workflow/${resId}?limit=2`).pipe( + tap((data: any) => { + this.histories = data.history; + }), + finalize(() => this.loading = false), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } +} \ No newline at end of file diff --git a/src/frontend/app/mail/mail-resume/mail-resume.component.html b/src/frontend/app/mail/mail-resume/mail-resume.component.html new file mode 100644 index 0000000000000000000000000000000000000000..9b720348c3f99e6eeec8f25db34faea5da918e78 --- /dev/null +++ b/src/frontend/app/mail/mail-resume/mail-resume.component.html @@ -0,0 +1,11 @@ +<ng-container *ngFor="let mail of mails"> + <div class="mailList"> + <div class="date" [title]="mail.creation_date | fullDate"> + {{mail.creation_date | timeAgo}} + </div> + <div class="info"> + {{mail.object}} + </div> + </div> + <mat-divider></mat-divider> +</ng-container> \ No newline at end of file diff --git a/src/frontend/app/mail/mail-resume/mail-resume.component.scss b/src/frontend/app/mail/mail-resume/mail-resume.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..b6c9a9b3ee9e124fa0fc24c46ccab0c9a0ecc7bd --- /dev/null +++ b/src/frontend/app/mail/mail-resume/mail-resume.component.scss @@ -0,0 +1,18 @@ +@import "../../../css/vars.scss"; + +.mailList { + font-size: 13px; + width: 100%; + display: grid; + grid-template-columns: 15% 85%; + align-items: center; +} + +.date { + padding: 5px; + color: $primary; +} + +.info { + padding: 5px; +} diff --git a/src/frontend/app/mail/mail-resume/mail-resume.component.ts b/src/frontend/app/mail/mail-resume/mail-resume.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..deb9b73d7c22d5b6352a9075bcd5a4006c4bc5fa --- /dev/null +++ b/src/frontend/app/mail/mail-resume/mail-resume.component.ts @@ -0,0 +1,50 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { LANG } from '../../translate.component'; +import { catchError, tap, finalize } from 'rxjs/operators'; +import { of } from 'rxjs'; +import { NotificationService } from '../../notification.service'; + + +@Component({ + selector: 'app-mail-resume', + templateUrl: "mail-resume.component.html", + styleUrls: [ + 'mail-resume.component.scss', + ] +}) + +export class MailResumeComponent implements OnInit { + + lang: any = LANG; + + loading: boolean = true; + + mails: any[] = []; + + @Input('resId') resId: number = null; + + constructor( + public http: HttpClient, + private notify: NotificationService, + ) { + } + + ngOnInit(): void { + this.loading = true; + this.loadMails(this.resId); + } + + loadMails(resId: number) { + this.http.get(`../../rest/resources/${resId}/emails?limit=2`).pipe( + tap((data: any) => { + this.mails = data.emails; + }), + finalize(() => this.loading = false), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } +} \ No newline at end of file diff --git a/src/frontend/app/notes/note-resume/note-resume.component.html b/src/frontend/app/notes/note-resume/note-resume.component.html new file mode 100644 index 0000000000000000000000000000000000000000..93fa31097998faaacdee5e8410a55649adff1748 --- /dev/null +++ b/src/frontend/app/notes/note-resume/note-resume.component.html @@ -0,0 +1,14 @@ +<ng-container *ngFor="let note of notes"> + <div class="noteList"> + <div class="date" [title]="note.creation_date | fullDate"> + {{note.creation_date | timeAgo}} + </div> + <div class="info"> + {{note.value}} + </div> + <div class="date"> + {{note.firstname}} {{note.lastname}} + </div> + </div> + <mat-divider></mat-divider> +</ng-container> \ No newline at end of file diff --git a/src/frontend/app/notes/note-resume/note-resume.component.scss b/src/frontend/app/notes/note-resume/note-resume.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..e5095f11d66edd703f319fa698681977fff1e05e --- /dev/null +++ b/src/frontend/app/notes/note-resume/note-resume.component.scss @@ -0,0 +1,18 @@ +@import "../../../css/vars.scss"; + +.noteList { + font-size: 13px; + width: 100%; + display: grid; + grid-template-columns: 15% 70% 15%; + align-items: center; +} + +.date { + padding: 5px; + color: $primary; +} + +.info { + padding: 5px; +} diff --git a/src/frontend/app/notes/note-resume/note-resume.component.ts b/src/frontend/app/notes/note-resume/note-resume.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..3a678edee8335f5c5da5a9a86875a5a93abc64b5 --- /dev/null +++ b/src/frontend/app/notes/note-resume/note-resume.component.ts @@ -0,0 +1,50 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { LANG } from '../../translate.component'; +import { catchError, tap, finalize } from 'rxjs/operators'; +import { of } from 'rxjs'; +import { NotificationService } from '../../notification.service'; + + +@Component({ + selector: 'app-note-resume', + templateUrl: "note-resume.component.html", + styleUrls: [ + 'note-resume.component.scss', + ] +}) + +export class NoteResumeComponent implements OnInit { + + lang: any = LANG; + + loading: boolean = true; + + notes: any[] = []; + + @Input('resId') resId: number = null; + + constructor( + public http: HttpClient, + private notify: NotificationService, + ) { + } + + ngOnInit(): void { + this.loading = true; + this.loadNotes(this.resId); + } + + loadNotes(resId: number) { + this.http.get(`../../rest/resources/${resId}/notes?limit=2`).pipe( + tap((data: any) => { + this.notes = data.notes; + }), + finalize(() => this.loading = false), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } +} \ No newline at end of file diff --git a/src/frontend/app/process/process.component.html b/src/frontend/app/process/process.component.html index ad2ff267f1f3fe4aa14d710419806f5161b81a84..67e040f2f1a3a8fc6ed0579cc58bce4031ed9362 100644 --- a/src/frontend/app/process/process.component.html +++ b/src/frontend/app/process/process.component.html @@ -31,7 +31,7 @@ <div class="title-divider"></div> </div> <div class="content"> - content + <app-history-workflow-resume *ngIf="!loading" [resId]="currentResourceInformations.resId"></app-history-workflow-resume> </div> </div> <div class="banner" [style.borderColor]="currentPriorityColor"> @@ -40,8 +40,7 @@ <div class="title-divider"></div> </div> <div class="content"> - <app-notes-list #appNotesList *ngIf="!loading" [resId]="currentResourceInformations.resId"> - </app-notes-list> + <app-note-resume *ngIf="!loading" [resId]="currentResourceInformations.resId"></app-note-resume> </div> </div> <div class="banner" [style.borderColor]="currentPriorityColor"> @@ -50,7 +49,7 @@ <div class="title-divider"></div> </div> <div class="content"> - content + <app-attachments-resume *ngIf="!loading" [resId]="currentResourceInformations.resId"></app-attachments-resume> </div> </div> <div class="banner" [style.borderColor]="currentPriorityColor"> @@ -59,7 +58,7 @@ <div class="title-divider"></div> </div> <div class="content"> - content + <app-mail-resume *ngIf="!loading" [resId]="currentResourceInformations.resId"></app-mail-resume> </div> </div> </ng-container> diff --git a/src/frontend/app/process/process.component.scss b/src/frontend/app/process/process.component.scss index b385bc12aada7669d8829aa1cf9b560afbc0c886..97efa68635c3aa1d3ccadf86e9872cef83e3e8a2 100644 --- a/src/frontend/app/process/process.component.scss +++ b/src/frontend/app/process/process.component.scss @@ -344,7 +344,7 @@ color: white; padding-left: 10px; padding-right: 10px; - background: $primary; + background: $secondary; margin-top: -10px; margin-left: -10px; margin-right: -10px;