diff --git a/src/frontend/app/administration/basket/list/list-administration.component.html b/src/frontend/app/administration/basket/list/list-administration.component.html index ad220b515986e177450ee5f75ef22b73013f6cdf..8f5ef96cc72b68c10c198c31f5f85c9ed84e583e 100644 --- a/src/frontend/app/administration/basket/list/list-administration.component.html +++ b/src/frontend/app/administration/basket/list/list-administration.component.html @@ -6,7 +6,10 @@ </mat-option> </mat-select> </mat-form-field> -<div style="display: grid;grid-template-columns: 1fr auto;grid-gap: 10px;align-items: center;" *ngIf="selectedListEvent === 'processDocument'"> +<div class="formType ratio-2 col-sm-12" *ngIf="selectedListEvent === 'processDocument'"> + <div class="formType-title"> + {{lang.options}} + </div> <mat-form-field class="eventList" appearance="outline"> <mat-label>{{lang.tabProcessPosition}}</mat-label> <mat-select [(ngModel)]="selectedProcessTool.defaultTab"> @@ -15,9 +18,13 @@ </mat-option> </mat-select> </mat-form-field> - <mat-slide-toggle color="primary" [(ngModel)]="selectedProcessTool.canUpdate">{{lang.canUpdateData}}</mat-slide-toggle> + <div style="padding: 10px;"> + <mat-slide-toggle color="primary" [(ngModel)]="selectedProcessTool.canUpdate" (change)="toggleCanUpdate($event.checked)">{{lang.canUpdateData}}</mat-slide-toggle> + </div> + <div style="padding: 10px;"> + <mat-slide-toggle color="primary" [(ngModel)]="selectedProcessTool.canUpdateModel" [disabled]="!selectedProcessTool.canUpdate">{{lang.canUpdateIndexingModel}}</mat-slide-toggle> + </div> </div> - <hr /> <mat-toolbar class="editorTool"> <span> diff --git a/src/frontend/app/administration/basket/list/list-administration.component.scss b/src/frontend/app/administration/basket/list/list-administration.component.scss index 54f04dce9700505a16df39403bc227d1b7d9a926..a612cec9971c64d8d58fd9e53d175e7cffdd6fe4 100644 --- a/src/frontend/app/administration/basket/list/list-administration.component.scss +++ b/src/frontend/app/administration/basket/list/list-administration.component.scss @@ -237,3 +237,31 @@ overflow: hidden; text-overflow: ellipsis; } + +.formType { + align-items: center; + // display: flex; + // margin: 10px; + margin-bottom: 10px; + border-radius: 4px; + border: solid 1px #ccc; + position: relative; + padding: 10px; + + &-title { + white-space: pre; + overflow: hidden; + max-width: 85%; + text-overflow: ellipsis; + z-index: 1; + font-size: 10px; + font-weight: bold; + background: white; + position: absolute; + top: -7px; + left: 10px; + padding: 0px; + margin: 0px; + color: #135f7f; + } +} diff --git a/src/frontend/app/administration/basket/list/list-administration.component.ts b/src/frontend/app/administration/basket/list/list-administration.component.ts index 3314786f881aa5cd40d4932f0eb40f8878f7d9f1..2e9590f39ee605261a6c32c556c051dacb417bae 100644 --- a/src/frontend/app/administration/basket/list/list-administration.component.ts +++ b/src/frontend/app/administration/basket/list/list-administration.component.ts @@ -213,6 +213,7 @@ export class ListAdministrationComponent implements OnInit { selectedProcessTool: any = { defaultTab: null, canUpdate: false, + canUpdateModel: false, }; selectedProcessToolClone: string = null; @@ -242,6 +243,7 @@ export class ListAdministrationComponent implements OnInit { if (this.basketGroup.list_event === 'processDocument') { this.selectedProcessTool.defaultTab = this.basketGroup.list_event_data === null ? 'dashboard' : this.basketGroup.list_event_data.defaultTab; this.selectedProcessTool.canUpdate = this.basketGroup.list_event_data === null ? false : this.basketGroup.list_event_data.canUpdate; + this.selectedProcessTool.canUpdateModel = this.basketGroup.list_event_data === null ? false : this.basketGroup.list_event_data.canUpdateModel; } this.selectedProcessToolClone = JSON.parse(JSON.stringify(this.selectedProcessTool)); @@ -385,4 +387,10 @@ export class ListAdministrationComponent implements OnInit { this.selectedProcessTool = null; } } + + toggleCanUpdate(state: boolean) { + if (!state) { + this.selectedProcessTool.canUpdateModel = state; + } + } } diff --git a/src/frontend/app/process/process.component.html b/src/frontend/app/process/process.component.html index e6436af3cd5c7073887c0b20b89922f8bc8e1005..58a628401685561f4de4f8684f87314cffecabe0 100644 --- a/src/frontend/app/process/process.component.html +++ b/src/frontend/app/process/process.component.html @@ -101,7 +101,7 @@ [resId]="currentResourceInformations.resId" [autoOpenCreation]="isMailing" [target]="'process'" (reloadBadgeAttachments)="refreshBadge($event,'attachments')"> </app-attachments-list> - <app-select-indexing-model *ngIf="currentTool === 'info' && !loading" #appSelectIndexingModel [adminMode]="canEditData" [indexingForm]="indexingForm" (afterSelectedListModel)="this.currentIndexingModel = $event;indexingForm.loadForm($event.id, false)"></app-select-indexing-model> + <app-select-indexing-model *ngIf="currentTool === 'info' && !loading" #appSelectIndexingModel [adminMode]="canChangeModel" [indexingForm]="indexingForm" (afterSelectedListModel)="this.currentIndexingModel = $event;indexingForm.loadForm($event.id, false)"></app-select-indexing-model> <app-indexing-form *ngIf="currentTool === 'info' && !loading" #indexingForm [groupId]="currentGroupId" [resId]="currentResourceInformations.resId" [indexingFormId]="currentResourceInformations.modelId" [mode]="'process'" [canEdit]="canEditData" [hideDiffusionList]="true" @@ -287,7 +287,7 @@ <app-attachments-list *ngIf="modal.id === 'attachments' && !loading" #appAttachmentsList [resId]="currentResourceInformations.resId" [autoOpenCreation]="isMailing" (reloadBadgeAttachments)="refreshBadge($event,'attachments')"> </app-attachments-list> - <app-select-indexing-model *ngIf="modal.id === 'info' && !loading" #appSelectIndexingModel [adminMode]="canEditData" [indexingForm]="indexingForm" (afterSelectedListModel)="this.currentIndexingModel = $event;indexingForm.loadForm($event.id, false)"></app-select-indexing-model> + <app-select-indexing-model *ngIf="modal.id === 'info' && !loading" #appSelectIndexingModel [adminMode]="canChangeModel" [indexingForm]="indexingForm" (afterSelectedListModel)="this.currentIndexingModel = $event;indexingForm.loadForm($event.id, false)"></app-select-indexing-model> <app-indexing-form *ngIf="modal.id === 'info' && !loading" #indexingForm [groupId]="currentGroupId" [indexingFormId]="currentResourceInformations.modelId" [resId]="currentResourceInformations.resId" [mode]="'process'" [canEdit]="canEditData" [hideDiffusionList]="true" diff --git a/src/frontend/app/process/process.component.ts b/src/frontend/app/process/process.component.ts index e2d04f17222dafc4a08b13da6f187177677b6da0..3ec732dda4db90eaa8345be7b20c820fc5f7365f 100755 --- a/src/frontend/app/process/process.component.ts +++ b/src/frontend/app/process/process.component.ts @@ -13,7 +13,6 @@ import { Overlay } from '@angular/cdk/overlay'; import { AppService } from '../../service/app.service'; import { ActionsService } from '../actions/actions.service'; import { tap, catchError, map, finalize, filter } from 'rxjs/operators'; -import { of, Subscription } from 'rxjs'; import { DocumentViewerComponent } from '../viewer/document-viewer.component'; import { IndexingFormComponent } from '../indexation/indexing-form/indexing-form.component'; import { ConfirmComponent } from '../../plugins/modal/confirm.component'; @@ -26,10 +25,12 @@ import { PrivilegeService } from '../../service/privileges.service'; import { AvisWorkflowComponent } from '../avis/avis-workflow.component'; import { FunctionsService } from '../../service/functions.service'; import { PrintedFolderModalComponent } from '../printedFolder/printed-folder-modal.component'; +import { Subscription } from 'rxjs/internal/Subscription'; +import { of } from 'rxjs/internal/observable/of'; @Component({ - templateUrl: "process.component.html", + templateUrl: 'process.component.html', styleUrls: [ 'process.component.scss', '../indexation/indexing-form/indexing-form.component.scss' @@ -135,6 +136,7 @@ export class ProcessComponent implements OnInit, OnDestroy { actionEnded: boolean = false; canEditData: boolean = false; + canChangeModel: boolean = false; autoAction: boolean = false; @@ -186,7 +188,7 @@ export class ProcessComponent implements OnInit, OnDestroy { this.headerService.showMenuNav = false; this.headerService.sideBarAdmin = true; - if (typeof params['detailResId'] !== "undefined") { + if (typeof params['detailResId'] !== 'undefined') { this.initDetailPage(params); } else { this.initProcessPage(params); @@ -196,7 +198,7 @@ export class ProcessComponent implements OnInit, OnDestroy { }); - // Event after process action + // Event after process action this.subscription = this.actionService.catchAction().subscribe(message => { this.actionEnded = true; clearInterval(this.currentResourceLock); @@ -248,7 +250,7 @@ export class ProcessComponent implements OnInit, OnDestroy { icon: 'fa fa-inbox', label: this.lang.backBasket, route: `/basketList/users/${this.currentUserId}/groups/${this.currentGroupId}/baskets/${this.currentBasketId}` - } + }; await this.checkAccesDocument(this.currentResourceInformations.resId); @@ -270,7 +272,7 @@ export class ProcessComponent implements OnInit, OnDestroy { label: action.label, component: action.component, categoryUse: action.categories - } + }; }); return data; }), @@ -299,7 +301,7 @@ export class ProcessComponent implements OnInit, OnDestroy { icon: 'fas fa-arrow-left', label: this.lang.back, route: `__GOBACK` - } + }; await this.checkAccesDocument(this.currentResourceInformations.resId); @@ -317,7 +319,7 @@ export class ProcessComponent implements OnInit, OnDestroy { return this.actionEnded; } - loadResource() { + loadResource(redirectDefautlTool: boolean = true) { this.http.get(`../rest/resources/${this.currentResourceInformations.resId}?light=true`).pipe( tap((data: any) => { this.currentResourceInformations = data; @@ -327,7 +329,10 @@ export class ProcessComponent implements OnInit, OnDestroy { } else { this.loadRecipients(); } - this.setEditDataPrivilege(); + if (redirectDefautlTool) { + this.setEditDataPrivilege(); + } + this.loadAvaibleIntegrations(data.integrations); this.headerService.setHeader(this.detailMode ? this.lang.detailDoc : this.lang.eventProcessDoc, this.lang[this.currentResourceInformations.categoryId]); }), @@ -358,6 +363,7 @@ export class ProcessComponent implements OnInit, OnDestroy { this.currentTool = data.listEventData.defaultTab; } this.canEditData = data.listEventData.canUpdate; + this.canChangeModel = data.listEventData.canUpdateModel; } }), catchError((err: any) => { @@ -377,7 +383,7 @@ export class ProcessComponent implements OnInit, OnDestroy { if (connectionId === 'maileva') { this.integrationsInfo['inShipping'] = { icon: 'fas fa-shipping-fast' - } + }; } }); }), @@ -420,7 +426,7 @@ export class ProcessComponent implements OnInit, OnDestroy { if (this.currentResourceInformations.senders === undefined || this.currentResourceInformations.senders.length === 0) { this.hasContact = false; this.senderLightInfo = { 'displayName': this.lang.noSelectedContact, 'filling': null }; - } else if (this.currentResourceInformations.senders.length == 1) { + } else if (this.currentResourceInformations.senders.length === 1) { this.hasContact = true; if (this.currentResourceInformations.senders[0].type === 'contact') { this.http.get('../rest/contacts/' + this.currentResourceInformations.senders[0].id).pipe( @@ -448,13 +454,13 @@ export class ProcessComponent implements OnInit, OnDestroy { } }) ).subscribe(); - } else if (this.currentResourceInformations.senders[0].type == 'entity') { + } else if (this.currentResourceInformations.senders[0].type === 'entity') { this.http.get('../rest/entities/' + this.currentResourceInformations.senders[0].id).pipe( tap((data: any) => { this.senderLightInfo = { 'displayName': data.entity_label, 'filling': null }; }) ).subscribe(); - } else if (this.currentResourceInformations.senders[0].type == 'user') { + } else if (this.currentResourceInformations.senders[0].type === 'user') { this.http.get('../rest/users/' + this.currentResourceInformations.senders[0].id).pipe( tap((data: any) => { this.senderLightInfo = { 'displayName': data.firstname + ' ' + data.lastname, 'filling': null }; @@ -472,7 +478,7 @@ export class ProcessComponent implements OnInit, OnDestroy { if (this.currentResourceInformations.recipients === undefined || this.currentResourceInformations.recipients.length === 0) { this.hasContact = false; this.senderLightInfo = { 'displayName': this.lang.noSelectedContact, 'filling': null }; - } else if (this.currentResourceInformations.recipients.length == 1) { + } else if (this.currentResourceInformations.recipients.length === 1) { this.hasContact = true; if (this.currentResourceInformations.recipients[0].type === 'contact') { this.http.get('../rest/contacts/' + this.currentResourceInformations.recipients[0].id).pipe( @@ -500,13 +506,13 @@ export class ProcessComponent implements OnInit, OnDestroy { } }) ).subscribe(); - } else if (this.currentResourceInformations.recipients[0].type == 'entity') { + } else if (this.currentResourceInformations.recipients[0].type === 'entity') { this.http.get('../rest/entities/' + this.currentResourceInformations.recipients[0].id).pipe( tap((data: any) => { this.senderLightInfo = { 'displayName': data.entity_label, 'filling': null }; }) ).subscribe(); - } else if (this.currentResourceInformations.recipients[0].type == 'user') { + } else if (this.currentResourceInformations.recipients[0].type === 'user') { this.http.get('../rest/users/' + this.currentResourceInformations.recipients[0].id).pipe( tap((data: any) => { this.senderLightInfo = { 'displayName': data.firstname + ' ' + data.lastname, 'filling': null }; @@ -530,7 +536,7 @@ export class ProcessComponent implements OnInit, OnDestroy { this.currentResourceLock = setInterval(() => { this.http.put(`../rest/resourcesList/users/${this.currentUserId}/groups/${this.currentGroupId}/baskets/${this.currentBasketId}/lock`, { resources: [this.currentResourceInformations.resId] }).pipe( catchError((err: any) => { - if (err.status == 403) { + if (err.status === 403) { clearInterval(this.currentResourceLock); } this.notify.handleErrors(err); @@ -604,7 +610,7 @@ export class ProcessComponent implements OnInit, OnDestroy { await this.appDocumentViewer.saveMainDocument(); } - this.actionService.launchAction(this.selectedAction, this.currentUserId, this.currentGroupId, this.currentBasketId, [this.currentResourceInformations.resId], this.currentResourceInformations, false) + this.actionService.launchAction(this.selectedAction, this.currentUserId, this.currentGroupId, this.currentBasketId, [this.currentResourceInformations.resId], this.currentResourceInformations, false); }), catchError((err: any) => { this.notify.handleSoftErrors(err); @@ -626,9 +632,9 @@ export class ProcessComponent implements OnInit, OnDestroy { showActionInCurrentCategory(action: any) { if (this.selectedAction.categoryUse.indexOf(this.currentResourceInformations.categoryId) === -1) { - const newAction = this.actionsList.filter(action => action.categoryUse.indexOf(this.currentResourceInformations.categoryId) > -1)[0]; + const newAction = this.actionsList.filter(actionItem => actionItem.categoryUse.indexOf(this.currentResourceInformations.categoryId) > -1)[0]; if (newAction !== undefined) { - this.selectedAction = this.actionsList.filter(action => action.categoryUse.indexOf(this.currentResourceInformations.categoryId) > -1)[0]; + this.selectedAction = this.actionsList.filter(actionItem => actionItem.categoryUse.indexOf(this.currentResourceInformations.categoryId) > -1)[0]; } else { this.selectedAction = { id: 0, @@ -664,7 +670,7 @@ export class ProcessComponent implements OnInit, OnDestroy { tap(() => { this.indexingForm.saveData(); setTimeout(() => { - this.loadResource(); + this.loadResource(false); }, 400); this.modalModule.splice(index, 1); }), @@ -705,7 +711,7 @@ export class ProcessComponent implements OnInit, OnDestroy { tap(() => { this.saveTool(); setTimeout(() => { - this.loadResource(); + this.loadResource(false); }, 400); this.currentTool = tabId; }), @@ -726,7 +732,7 @@ export class ProcessComponent implements OnInit, OnDestroy { confirmModification() { this.indexingForm.saveData(); setTimeout(() => { - this.loadResource(); + this.loadResource(false); }, 400); } @@ -783,6 +789,9 @@ export class ProcessComponent implements OnInit, OnDestroy { async saveTool() { if (this.currentTool === 'info' && this.indexingForm !== undefined) { await this.indexingForm.saveData(); + setTimeout(() => { + this.loadResource(false); + }, 400); } else if (this.currentTool === 'diffusionList' && this.appDiffusionsList !== undefined) { await this.appDiffusionsList.saveListinstance(); this.loadBadges(); @@ -838,7 +847,7 @@ export class ProcessComponent implements OnInit, OnDestroy { isToolEnabled(id: string) { if (id === 'history') { if (!this.privilegeService.hasCurrentUserPrivilege('view_full_history') && !this.privilegeService.hasCurrentUserPrivilege('view_doc_history')) { - return false + return false; } else { return true; } diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index 70e438d59a175faaa6612e839fd31a2d5db0756c..4b3b94a11d28672c23f2d7d7dfa661ba45573ec9 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -1691,4 +1691,6 @@ export const LANG_EN = { "alfrescoAPI": "API Alfresco address", "testSucceeded": "Test succeeded", "test": "Test", + "canUpdateIndexingModel": "Can change indexing model", + "options": "Options", }; diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index e07369295209acbb0383abe8b92f060c0c027ea6..844a831c092c447ce32c6248f6734eef053c9f60 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -1693,4 +1693,6 @@ export const LANG_FR = { "alfrescoAPI": "Adresse de l'API Alfresco", "testSucceeded": "Le test à réussi", "test": "Tester", + "canUpdateIndexingModel": "Pouvoir changer le modèle d'indexation", + "options": "Options", }; diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts index 5a1bbc1461957611704bb56c144838aa1d82d893..b1ad164daa2743f7c6a87ebceb4453538253237f 100755 --- a/src/frontend/lang/lang-nl.ts +++ b/src/frontend/lang/lang-nl.ts @@ -1674,5 +1674,7 @@ export const LANG_NL = { "chooseEntityAssociationAccount": "Choose entities who will be able to use this account", //_TO_TRANSLATE "alfrescoAPI": "API Alfresco address", //_TO_TRANSLATE "testSucceeded": "Test succeeded", //_TO_TRANSLATE - "test": "Test", //_TO_TRANSLATE + "test": "Test", //_TO_TRANSLATE + "canUpdateIndexingModel": "Can change indexing model", //_TO_TRANSLATE + "options": "Options", //_TO_TRANSLATE };