From 4e0eeb409eb76ae2037cf9f45507ec2a68364004 Mon Sep 17 00:00:00 2001 From: Alex Orluc <alex.orluc@maarch.org> Date: Sun, 3 Nov 2019 23:18:03 +0100 Subject: [PATCH] FEAT #12033 TIME 2:30 add resume module in process --- src/frontend/app/app.module.ts | 15 ++++- .../attachment-show-modal.component.html | 5 ++ .../attachment-show-modal.component.scss | 12 ++++ .../attachment-show-modal.component.ts | 31 ++++++++++ .../attachments-resume.component.html | 21 +++++++ .../attachments-resume.component.scss | 24 ++++++++ .../attachments-resume.component.ts | 57 +++++++++++++++++++ .../history-workflow-resume.component.html | 11 ++++ .../history-workflow-resume.component.scss | 18 ++++++ .../history-workflow-resume.component.ts | 50 ++++++++++++++++ .../mail-resume/mail-resume.component.html | 11 ++++ .../mail-resume/mail-resume.component.scss | 18 ++++++ .../mail/mail-resume/mail-resume.component.ts | 50 ++++++++++++++++ .../note-resume/note-resume.component.html | 14 +++++ .../note-resume/note-resume.component.scss | 18 ++++++ .../note-resume/note-resume.component.ts | 50 ++++++++++++++++ .../app/process/process.component.html | 9 ++- .../app/process/process.component.scss | 2 +- 18 files changed, 408 insertions(+), 8 deletions(-) create mode 100644 src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.html create mode 100644 src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.scss create mode 100644 src/frontend/app/attachments/attachment-show-modal/attachment-show-modal.component.ts create mode 100644 src/frontend/app/attachments/attachments-resume/attachments-resume.component.html create mode 100644 src/frontend/app/attachments/attachments-resume/attachments-resume.component.scss create mode 100644 src/frontend/app/attachments/attachments-resume/attachments-resume.component.ts create mode 100644 src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.html create mode 100644 src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.scss create mode 100644 src/frontend/app/history/history-workflow-resume/history-workflow-resume.component.ts create mode 100644 src/frontend/app/mail/mail-resume/mail-resume.component.html create mode 100644 src/frontend/app/mail/mail-resume/mail-resume.component.scss create mode 100644 src/frontend/app/mail/mail-resume/mail-resume.component.ts create mode 100644 src/frontend/app/notes/note-resume/note-resume.component.html create mode 100644 src/frontend/app/notes/note-resume/note-resume.component.scss create mode 100644 src/frontend/app/notes/note-resume/note-resume.component.ts diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index f78c5421e6b..397a7581922 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 00000000000..4df11bd2ded --- /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 00000000000..eedd4afc56f --- /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 00000000000..45f0acfd273 --- /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 00000000000..3b7cbce6cc0 --- /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 00000000000..8442336e034 --- /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 00000000000..f1febcad6a5 --- /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 00000000000..27d51ea8408 --- /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 00000000000..b85e66a4b8b --- /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 00000000000..87d07eda637 --- /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 00000000000..9b720348c3f --- /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 00000000000..b6c9a9b3ee9 --- /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 00000000000..deb9b73d7c2 --- /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 00000000000..93fa3109799 --- /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 00000000000..e5095f11d66 --- /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 00000000000..3a678edee83 --- /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 ad2ff267f1f..67e040f2f1a 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 b385bc12aad..97efa68635c 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; -- GitLab