diff --git a/src/frontend/app/app-routing.module.ts b/src/frontend/app/app-routing.module.ts index ff34433d6698471024c655d4c4ace76db22253b0..e825c5c0029fb5bbb02c3bc46dc9445c1d8e1dad 100755 --- a/src/frontend/app/app-routing.module.ts +++ b/src/frontend/app/app-routing.module.ts @@ -36,6 +36,7 @@ import {FollowedDocumentListComponent} from "./home/followed-list/followed-docum { path: 'forgot-password', component: ForgotPasswordComponent }, { path: 'update-password', component: UpdatePasswordComponent }, { path: 'followed', canActivate: [AppGuard], component: FollowedDocumentListComponent }, + { path: 'resources/:detailResId', canActivate: [AppGuard], canDeactivate: [AfterProcessGuard], component: ProcessComponent }, { path: '**', redirectTo: 'home', pathMatch: 'full' }, ], { useHash: true }), ], diff --git a/src/frontend/app/folder/document-list/folder-document-list.component.ts b/src/frontend/app/folder/document-list/folder-document-list.component.ts index e04f6bae074f9070ba94aa87ad8d92f6bb42d37a..9d52d42feefb43fea33d0e3c09858020f992f206 100644 --- a/src/frontend/app/folder/document-list/folder-document-list.component.ts +++ b/src/frontend/app/folder/document-list/folder-document-list.component.ts @@ -247,7 +247,7 @@ export class FolderDocumentListComponent implements OnInit { } goToDetail(row: any) { - location.href = "index.php?page=details&dir=indexing_searching&id=" + row.resId; + this.router.navigate([`/resources/${row.resId}`]); } togglePanel(mode: string, row: any) { diff --git a/src/frontend/app/header/header-panel.component.ts b/src/frontend/app/header/header-panel.component.ts index 6af0486d221b7e75ac05d05a2416db14ff22e12d..b87b7379ae3b611491488b9c282cbd6a435c0b30 100644 --- a/src/frontend/app/header/header-panel.component.ts +++ b/src/frontend/app/header/header-panel.component.ts @@ -1,6 +1,7 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { LANG } from '../translate.component'; -import { HeaderService } from '../../service/header.service'; +import { Component, OnInit, Input } from '@angular/core'; +import { Location } from '@angular/common'; +import { LANG } from '../translate.component'; +import { HeaderService } from '../../service/header.service'; import { MatDialogRef } from '@angular/material/dialog'; import { MatSidenav } from '@angular/material/sidenav'; import { AppService } from '../../service/app.service'; @@ -9,29 +10,35 @@ import { Router } from '@angular/router'; @Component({ selector: 'header-panel', styleUrls: ['header-panel.component.scss'], - templateUrl : "header-panel.component.html", + templateUrl: "header-panel.component.html", }) export class HeaderPanelComponent implements OnInit { - lang : any = LANG; + lang: any = LANG; - dialogRef : MatDialogRef<any>; - config : any = {}; + dialogRef: MatDialogRef<any>; + config: any = {}; @Input('navButton') navButton: any = null; @Input('snavLeft') snavLeft: MatSidenav; - + constructor( public headerService: HeaderService, public appService: AppService, - private router: Router + private router: Router, + private _location: Location ) { } ngOnInit(): void { } goTo() { - this.router.navigate([this.navButton.route]); + if (this.navButton.route === '__GOBACK') { + this._location.back(); + } else { + this.router.navigate([this.navButton.route]); + } + } goToHome() { diff --git a/src/frontend/app/home/followed-list/followed-document-list.component.ts b/src/frontend/app/home/followed-list/followed-document-list.component.ts index bab8bb150e01bcc8437dbbb801bf4f4d5a5be562..57dc1b64c8b372f99799318e24636f01bc45b410 100644 --- a/src/frontend/app/home/followed-list/followed-document-list.component.ts +++ b/src/frontend/app/home/followed-list/followed-document-list.component.ts @@ -210,7 +210,7 @@ export class FollowedDocumentListComponent implements OnInit { } goToDetail(row: any) { - location.href = "index.php?page=details&dir=indexing_searching&id=" + row.resId; + this.router.navigate([`/resources/${row.resId}`]); } togglePanel(mode: string, row: any) { diff --git a/src/frontend/app/home/home.component.ts b/src/frontend/app/home/home.component.ts index 91292f1ba7333d21c8513d7ee69830980d65a227..179bf287961fa8f9de11f7dd16076c5a9d361ba2 100644 --- a/src/frontend/app/home/home.component.ts +++ b/src/frontend/app/home/home.component.ts @@ -9,6 +9,7 @@ import { NotificationService } from '../notification.service'; import { HeaderService } from '../../service/header.service'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { AppService } from '../../service/app.service'; +import { Router } from '@angular/router'; declare function $j(selector: any): any; @@ -44,7 +45,8 @@ export class HomeComponent implements OnInit { private sanitizer: DomSanitizer, private notify: NotificationService, private headerService: HeaderService, - public appService: AppService + public appService: AppService, + private router: Router ) { $j("link[href='merged_css.php']").remove(); (<any>window).pdfWorkerSrc = '../../node_modules/pdfjs-dist/build/pdf.worker.min.js'; @@ -101,7 +103,7 @@ export class HomeComponent implements OnInit { this.http.get("../../rest/resources/" + row.res_id + "/isAllowed") .subscribe((data: any) => { if (data['isAllowed']) { - location.href = "index.php?page=details&dir=indexing_searching&id=" + row.res_id; + this.router.navigate([`/resources/${row.res_id}`]); } else { this.notify.error(this.lang.documentOutOfPerimeter); } diff --git a/src/frontend/app/linkedResource/linked-resource-list.component.html b/src/frontend/app/linkedResource/linked-resource-list.component.html index 99603bd7aa77cd110a593f4474a5909062a94a09..c141469f5e76dff811137e58947d18b8225db90e 100644 --- a/src/frontend/app/linkedResource/linked-resource-list.component.html +++ b/src/frontend/app/linkedResource/linked-resource-list.component.html @@ -67,8 +67,8 @@ </div> </mat-cell> </ng-container> - <mat-row *matRowDef="let row; columns: displayedColumns;" (mouseenter)="viewThumbnail(row);" - (mouseleave)="closeThumbnail();"></mat-row> + <mat-row *matRowDef="let row; columns: displayedColumns;" routerLink="/resources/{{row.resId}}" (mouseenter)="viewThumbnail(row);" + (mouseleave)="closeThumbnail();" style="cursor: pointer;"></mat-row> </mat-table> <button *ngIf="privilegeService.hasCurrentUserPrivilege('add_links')" mat-fab class="linkRes" color="primary" [title]="lang.linkResource" (click)="openSearchResourceModal()"> <mat-icon class="fa fa-link" style="height:auto;"></mat-icon> diff --git a/src/frontend/app/list/basket-list.component.ts b/src/frontend/app/list/basket-list.component.ts index 4a374dcddc1118bfc118e13ea2d1bd567b2f79da..ea68a3214efc86e3d42fff44dd3b4e49ce1e35eb 100755 --- a/src/frontend/app/list/basket-list.component.ts +++ b/src/frontend/app/list/basket-list.component.ts @@ -235,7 +235,7 @@ export class BasketListComponent implements OnInit { } goToDetail(row: any) { - location.href = "index.php?page=details&dir=indexing_searching&id=" + row.resId; + this.router.navigate([`/resources/${row.resId}`]); } togglePanel(mode: string, row: any) { diff --git a/src/frontend/app/process/process.component.html b/src/frontend/app/process/process.component.html index 41d23528af14bed003dcaa0b9da9e09df0c74981..8c9980a428590885b9b8704bc349faf1dbbf6c6b 100644 --- a/src/frontend/app/process/process.component.html +++ b/src/frontend/app/process/process.component.html @@ -2,8 +2,7 @@ <mat-sidenav #snavLeft class="panel-left" #snav [mode]="appService.getViewMode() ? 'over' : 'side'" [fixedInViewport]="appService.getViewMode()" [opened]="appService.getViewMode() ? false : true" autoFocus="false" style="overflow-x:hidden;" [ngStyle]="{'width': appService.getViewMode() ? '95%' : '600px'}"> - <header-panel [snavLeft]="snav" - [navButton]="{icon: 'fa fa-inbox', label: lang.backBasket, route : '/basketList/users/'+currentUserId+'/groups/'+currentGroupId+'/baskets/'+currentBasketId}"> + <header-panel [snavLeft]="snav" [navButton]="navButton"> </header-panel> <div class="listModels"> <div class="processTool"> @@ -85,14 +84,17 @@ [adminMode]="false" [resId]="currentResourceInformations.resId" [expanded]="true"> </app-diffusions-list> <app-sended-resource-list *ngIf="currentTool === 'emails' && !loading" #appSendedResource - [resId]="currentResourceInformations.resId" (reloadBadgeSendedResource)="refreshBadge($event,'emails')"> + [resId]="currentResourceInformations.resId" + (reloadBadgeSendedResource)="refreshBadge($event,'emails')"> </app-sended-resource-list> <app-visa-workflow *ngIf="currentTool === 'visaCircuit' && !loading" #appVisaWorkflow [resId]="currentResourceInformations.resId" - [adminMode]="privilegeService.hasCurrentUserPrivilege('config_visa_workflow')"></app-visa-workflow> + [adminMode]="detailMode ? privilegeService.hasCurrentUserPrivilege('config_visa_workflow_in_detail') : privilegeService.hasCurrentUserPrivilege('config_visa_workflow')"> + </app-visa-workflow> <app-avis-workflow *ngIf="currentTool === 'opinionCircuit' && !loading" #appAvisWorkflow [resId]="currentResourceInformations.resId" - [adminMode]="privilegeService.hasCurrentUserPrivilege('config_avis_workflow')"></app-avis-workflow> + [adminMode]="detailMode ? privilegeService.hasCurrentUserPrivilege('config_avis_workflow_in_detail') : privilegeService.hasCurrentUserPrivilege('config_avis_workflow')"> + </app-avis-workflow> <app-attachments-list *ngIf="currentTool === 'attachments' && !loading" #appAttachmentsList [resId]="currentResourceInformations.resId" [target]="'process'" (reloadBadgeAttachments)="refreshBadge($event,'attachments')"> @@ -117,7 +119,7 @@ </div> </ng-template> </div> - <div class="actions-indexing-form"> + <div class="actions-indexing-form" *ngIf="!detailMode"> <ng-container *ngIf="actionsList.length > 0 && selectedAction !== undefined"> <button mat-button class="button-form-primary" [disabled]="selectedAction.id === 0" [matMenuTriggerFor]="menu" style="width:350px;margin-right:20px;" [title]="selectedAction.label"> @@ -169,8 +171,10 @@ <div class="resourceInfo"> <ng-container *ngIf="!loading; else elseInfoRes"> <div class="title"> - <span style="white-space: nowrap; padding-left: 10px; padding-right: 10px"> - {{this.currentResourceInformations.subject}} + <span style="white-space: nowrap; padding-left: 10px; padding-right: 10px" + [title]="this.currentResourceInformations.subject + ' (' + this.currentResourceInformations.statusLabel + ')'"> + {{this.currentResourceInformations.subject}} <small + class="subSubject">{{this.currentResourceInformations.statusLabel}}</small> </span> <div class="title-divider"></div> </div> @@ -278,12 +282,12 @@ [resId]="currentResourceInformations.resId" (reloadBadgeSendedResource)="refreshBadge($event,'emails')"> </app-sended-resource-list> <app-visa-workflow *ngIf="modal.id === 'visaCircuit' && !loading" - [adminMode]="privilegeService.hasCurrentUserPrivilege('config_visa_workflow')" #appVisaWorkflow - [resId]="currentResourceInformations.resId"> + [adminMode]="detailMode ? privilegeService.hasCurrentUserPrivilege('config_visa_workflow_in_detail') : privilegeService.hasCurrentUserPrivilege('config_visa_workflow')" + #appVisaWorkflow [resId]="currentResourceInformations.resId"> </app-visa-workflow> <app-avis-workflow *ngIf="modal.id === 'opinionCircuit' && !loading" #appAvisWorkflow [resId]="currentResourceInformations.resId" - [adminMode]="privilegeService.hasCurrentUserPrivilege('config_avis_workflow')"> + [adminMode]="detailMode ? privilegeService.hasCurrentUserPrivilege('config_avis_workflow_in_detail') : privilegeService.hasCurrentUserPrivilege('config_avis_workflow')"> </app-avis-workflow> <app-attachments-list *ngIf="modal.id === 'attachments' && !loading" #appAttachmentsList [resId]="currentResourceInformations.resId" (reloadBadgeAttachments)="refreshBadge($event,'attachments')"> diff --git a/src/frontend/app/process/process.component.scss b/src/frontend/app/process/process.component.scss index c14240e989ddfa6dfbf551d5adc200da4f83fa27..9f8a17d6cc5d7512bfd1880ee4f68ef76454f2c0 100644 --- a/src/frontend/app/process/process.component.scss +++ b/src/frontend/app/process/process.component.scss @@ -432,4 +432,8 @@ .emails, .linkedResources { width: 600px; +} + +.subSubject { + color: $secondary; } \ No newline at end of file diff --git a/src/frontend/app/process/process.component.ts b/src/frontend/app/process/process.component.ts index 47cb74f9e2787657436d54edbc1d61c2c54d5bd7..b2d2b5420cd47dd3959aa6ffd10e7e7cc30c1d3c 100755 --- a/src/frontend/app/process/process.component.ts +++ b/src/frontend/app/process/process.component.ts @@ -42,6 +42,9 @@ export class ProcessComponent implements OnInit { loading: boolean = false; + detailMode: boolean = false; + navButton: any = null; + currentResourceLock: any = null; actionsList: any[] = []; @@ -186,65 +189,88 @@ export class ProcessComponent implements OnInit { this.headerService.setHeader(this.lang.eventProcessDoc); this.route.params.subscribe(params => { - this.currentUserId = params['userSerialId']; - this.currentGroupId = params['groupSerialId']; - this.currentBasketId = params['basketId']; + if (typeof params['detailResId'] !== "undefined") { + this.initDetailPage(params); + } else { + this.initProcessPage(params); + } + console.log(params); + }, (err: any) => { + this.notify.handleErrors(err); + }); + } - this.currentResourceInformations = { - resId: params['resId'], - mailtracking: false - }; + initProcessPage(params: any) { + this.detailMode = false; - this.lockResource(); - this.loadBadges(); - this.loadResource(); + this.currentUserId = params['userSerialId']; + this.currentGroupId = params['groupSerialId']; + this.currentBasketId = params['basketId']; - if (this.appService.getViewMode()) { - setTimeout(() => { - this.sidenavLeft.open(); - }, 800); - } + this.currentResourceInformations = { + resId: params['resId'], + mailtracking: false + }; - this.http.get(`../../rest/resources/${this.currentResourceInformations.resId}/users/${this.currentUserId}/groups/${this.currentGroupId}/baskets/${this.currentBasketId}/processingData`).pipe( - tap((data: any) => { - if (data.listEventData !== null) { - if (this.isToolEnabled(data.listEventData.defaultTab)) { - this.currentTool = data.listEventData.defaultTab; - } - this.canEditData = data.listEventData.canUpdate; + this.navButton = { + icon: 'fa fa-inbox', + label: this.lang.backBasket, + route: `/basketList/users/${this.currentUserId}/groups/${this.currentGroupId}/baskets/${this.currentBasketId}` + } + + this.lockResource(); + this.loadBadges(); + this.loadResource(); + + if (this.appService.getViewMode()) { + setTimeout(() => { + this.sidenavLeft.open(); + }, 800); + } + + this.http.get(`../../rest/resourcesList/users/${this.currentUserId}/groups/${this.currentGroupId}/baskets/${this.currentBasketId}/actions?resId=${this.currentResourceInformations.resId}`).pipe( + map((data: any) => { + data.actions = data.actions.map((action: any, index: number) => { + return { + id: action.id, + label: action.label, + component: action.component, + categoryUse: action.categories } - }), - catchError((err: any) => { - this.notify.handleErrors(err); - return of(false); - }) - ).subscribe(); + }); + return data; + }), + tap((data: any) => { + this.selectedAction = data.actions[0]; + this.actionsList = data.actions; + }), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } - this.http.get(`../../rest/resourcesList/users/${this.currentUserId}/groups/${this.currentGroupId}/baskets/${this.currentBasketId}/actions?resId=${this.currentResourceInformations.resId}`).pipe( - map((data: any) => { - data.actions = data.actions.map((action: any, index: number) => { - return { - id: action.id, - label: action.label, - component: action.component, - categoryUse: action.categories - } - }); - return data; - }), - tap((data: any) => { - this.selectedAction = data.actions[0]; - this.actionsList = data.actions; - }), - catchError((err: any) => { - this.notify.handleErrors(err); - return of(false); - }) - ).subscribe(); + initDetailPage(params: any) { + this.detailMode = true; + this.currentResourceInformations = { + resId: params['detailResId'], + mailtracking: false + }; + this.navButton = { + icon: 'fas fa-arrow-left', + label: this.lang.back, + route: `__GOBACK` + } - }, (err: any) => { - this.notify.handleErrors(err); - }); + this.loadBadges(); + this.loadResource(); + + if (this.appService.getViewMode()) { + setTimeout(() => { + this.sidenavLeft.open(); + }, 800); + } } isActionEnded() { @@ -257,8 +283,9 @@ export class ProcessComponent implements OnInit { this.currentResourceInformations = data; this.resourceFollowed = data.followed; this.loadSenders(); + this.setEditDataPrivilege(); this.loadAvaibleIntegrations(data.integrations); - this.headerService.setHeader(this.lang.eventProcessDoc, this.lang[this.currentResourceInformations.categoryId]); + this.headerService.setHeader(this.detailMode ? this.lang.detailDoc : this.lang.eventProcessDoc, this.lang[this.currentResourceInformations.categoryId]); }), finalize(() => this.loading = false), catchError((err: any) => { @@ -268,6 +295,27 @@ export class ProcessComponent implements OnInit { ).subscribe(); } + setEditDataPrivilege() { + if (this.detailMode) { + this.canEditData = this.privilegeService.hasCurrentUserPrivilege('edit_resource') && this.currentResourceInformations.statusAlterable; + } else { + this.http.get(`../../rest/resources/${this.currentResourceInformations.resId}/users/${this.currentUserId}/groups/${this.currentGroupId}/baskets/${this.currentBasketId}/processingData`).pipe( + tap((data: any) => { + if (data.listEventData !== null) { + if (this.isToolEnabled(data.listEventData.defaultTab)) { + this.currentTool = data.listEventData.defaultTab; + } + this.canEditData = data.listEventData.canUpdate; + } + }), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } + } + loadAvaibleIntegrations(integrationsData: any) { this.integrationsInfo['inSignatureBook'].enable = !this.functions.empty(integrationsData['inSignatureBook']) ? integrationsData['inSignatureBook'] : false; @@ -276,7 +324,8 @@ export class ProcessComponent implements OnInit { Object.keys(data.connection).filter(connectionId => connectionId !== 'maarchParapheur').forEach(connectionId => { if (connectionId === 'maileva') { this.integrationsInfo['inShipping'] = { - icon: 'fas fa-shipping-fast' } + icon: 'fas fa-shipping-fast' + } } }); }), @@ -288,10 +337,10 @@ export class ProcessComponent implements OnInit { } toggleIntegration(integrationId: string) { - this.http.put(`../../rest/resourcesList/integrations`, {resources : [this.currentResourceInformations.resId],integrations : { [integrationId] : !this.currentResourceInformations.integrations[integrationId]}}).pipe( + this.http.put(`../../rest/resourcesList/integrations`, { resources: [this.currentResourceInformations.resId], integrations: { [integrationId]: !this.currentResourceInformations.integrations[integrationId] } }).pipe( tap(() => { this.currentResourceInformations.integrations[integrationId] = !this.currentResourceInformations.integrations[integrationId]; - this.notify.success(this.lang.actionDone); + this.notify.success(this.lang.actionDone); }), catchError((err: any) => { this.notify.handleSoftErrors(err); @@ -561,7 +610,7 @@ export class ProcessComponent implements OnInit { }, 400); } - refreshBadge(nbRres: any, id: string) { + refreshBadge(nbRres: any, id: string) { this.processTool.filter(tool => tool.id === id)[0].count = nbRres; } diff --git a/src/frontend/app/signature-book.component.ts b/src/frontend/app/signature-book.component.ts index 27e5390b3b9749685683502b1a32b0de342e4693..fc341c6b24416e90988debf9b1189a5c32745f40 100755 --- a/src/frontend/app/signature-book.component.ts +++ b/src/frontend/app/signature-book.component.ts @@ -440,8 +440,7 @@ export class SignatureBookComponent implements OnInit { backToDetails() { this.http.put('../../rest/resourcesList/users/' + this.userId + '/groups/' + this.groupId + '/baskets/' + this.basketId + '/unlock', { resources: [this.resId] }) .subscribe((data: any) => { - location.hash = ""; - location.search = "?page=details&dir=indexing_searching&id=" + this.resId; + this.router.navigate([`/resources/${this.resId}`]); }, (err: any) => { }); } diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index b4e011efbb6391e0fdde0977fead21e440dbe568..66423071d2c5d64319561e18aeaa5e0a5e8e5d76 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -1546,4 +1546,5 @@ export const LANG_EN = { "tagMerged" : "Tag merged", "mergeWith" : "Merge with", "willBeTransferedToNewTag" : "will be transfered to selected tag", + "detailDoc" : "Detail page", }; diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index 2e279cc39dcea4514bb91d6a7b58540aca39f156..810bcf35088ac246199141b91a3603dd1db07aad 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -1585,4 +1585,5 @@ export const LANG_FR = { "tagMerged" : "Mot-clé fusionné", "mergeWith" : "Fusionner avec", "willBeTransferedToNewTag" : "seront transférés au mot clé sélectionné", + "detailDoc" : "Fiche détaillé", }; diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts index 33c74ab8feb321f524fb268c0ff72a3e38d89ab7..9a89bc8165afaba79189447516f97b996b7766ac 100755 --- a/src/frontend/lang/lang-nl.ts +++ b/src/frontend/lang/lang-nl.ts @@ -1571,4 +1571,5 @@ export const LANG_NL = { "tagMerged" : "Tag merged", //_TO_TRANSLATE "mergeWith" : "Merge with", //_TO_TRANSLATE "willBeTransferedToNewTag" : "will be transfered to selected tag", //_TO_TRANSLATE + "detailDoc" : "Detail page", //_TO_TRANSLATE }; diff --git a/src/frontend/service/app.guard.ts b/src/frontend/service/app.guard.ts index 963a3d9480452a10f287c1938380f021e6a815e5..26deadab743db4dec3eb2fa01a246ef6496ec46f 100644 --- a/src/frontend/service/app.guard.ts +++ b/src/frontend/service/app.guard.ts @@ -52,7 +52,7 @@ export class AppGuard implements CanActivate { }) export class AfterProcessGuard implements CanDeactivate<ProcessComponent> { canDeactivate(component: ProcessComponent): boolean { - if (!component.isActionEnded()) { + if (!component.isActionEnded() && !component.detailMode) { component.unlockResource(); } if (component.currentTool === 'info' && component.indexingForm.isResourceModified()) { diff --git a/src/frontend/service/privileges.service.ts b/src/frontend/service/privileges.service.ts index 87f0e4dc00a50c2ca38a958ad363a12a062b3d66..56c18fb38e3e2e451d93b284ff256d02e90f5936 100644 --- a/src/frontend/service/privileges.service.ts +++ b/src/frontend/service/privileges.service.ts @@ -314,12 +314,6 @@ export class PrivilegeService { "comment": this.lang.addLinks, "unit": 'application' }, - { - "id": "delete_document_in_detail", - "label": this.lang.deleteDocumentInDetail, - "comment": this.lang.deleteDocumentInDetail, - "unit": 'application' - }, { "id": "manage_tags_application", "label": this.lang.manageTagsInApplication,