diff --git a/core/xml/actions_pages.xml b/core/xml/actions_pages.xml index c7b1fc0ffeb98044617e62f740b281e0723bba23..cfdfab978680278d924396410fddde79a4016164 100755 --- a/core/xml/actions_pages.xml +++ b/core/xml/actions_pages.xml @@ -19,7 +19,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_REDIRECTION_DESC</DESC> <component>redirectAction</component> <ORIGIN>module</ORIGIN> - <MODULE>entities</MODULE> + <MODULE>application</MODULE> <KEYWORD>redirect</KEYWORD> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> @@ -30,7 +30,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_SIMPLE_CONFIRM_DESC</DESC> <component>confirmAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>application</MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> <ACTIONPAGE> @@ -40,7 +40,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_SIMPLE_CONFIRM_DESC</DESC> <component>updateDepartureDateAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>application</MODULE> <FLAG_CREATE>false</FLAG_CREATE> <COLLECTIONS> <COLL_ID>letterbox_coll</COLL_ID> @@ -53,7 +53,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_CLOSE_MAIL_DESC</DESC> <component>closeMailAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>application</MODULE> <FLAG_CREATE>false</FLAG_CREATE> <COLLECTIONS> <COLL_ID>letterbox_coll</COLL_ID> @@ -66,7 +66,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_SET_PERSISTENT_MODE_ON_DESC</DESC> <component>enabledBasketPersistenceAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>application</MODULE> <FLAG_CREATE>false</FLAG_CREATE> <COLLECTIONS> <COLL_ID>letterbox_coll</COLL_ID> @@ -79,7 +79,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_SET_PERSISTENT_MODE_OFF_DESC</DESC> <component>disabledBasketPersistenceAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>application</MODULE> <FLAG_CREATE>false</FLAG_CREATE> <COLLECTIONS> <COLL_ID>letterbox_coll</COLL_ID> @@ -92,7 +92,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_MARK_AS_READ_DESC</DESC> <component>resMarkAsReadAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>application</MODULE> <FLAG_CREATE>false</FLAG_CREATE> <COLLECTIONS> <COLL_ID>letterbox_coll</COLL_ID> @@ -105,7 +105,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_CREATE_ACKNOWLEDGEMENT_RECEIPT</DESC> <component>createAcknowledgementReceiptsAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>acknowledgementReceipt</MODULE> <FLAG_CREATE>false</FLAG_CREATE> <COLLECTIONS> <COLL_ID>letterbox_coll</COLL_ID> @@ -118,7 +118,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_UPDATE_ACKNOWLEDGEMENT_SEND_DATE</DESC> <component>updateAcknowledgementSendDateAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>acknowledgementReceipt</MODULE> <FLAG_CREATE>false</FLAG_CREATE> <COLLECTIONS> <COLL_ID>letterbox_coll</COLL_ID> @@ -130,7 +130,7 @@ An action page is described in a ACTIONPAGE tag : <NAME>sendToExternalSignatureBook</NAME> <component>sendExternalSignatoryBookAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>externalSignatoryBook</MODULE> <FLAG_CREATE>false</FLAG_CREATE> <COLLECTIONS> <COLL_ID>letterbox_coll</COLL_ID> @@ -142,7 +142,7 @@ An action page is described in a ACTIONPAGE tag : <NAME>sendToExternalNoteBook</NAME> <component>sendExternalNoteBookAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>externalSignatoryBook</MODULE> <FLAG_CREATE>false</FLAG_CREATE> <COLLECTIONS> <COLL_ID>letterbox_coll</COLL_ID> @@ -155,7 +155,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_CLOSE_MAIL_AND_INDEX_DESC</DESC> <component>closeAndIndexAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>application</MODULE> <FLAG_CREATE>false</FLAG_CREATE> <COLLECTIONS> <COLL_ID>letterbox_coll</COLL_ID> @@ -168,7 +168,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_CLOSE_MAIL_WITH_ATTACHMENT_DESC</DESC> <component>closeMailWithAttachmentsOrNotesAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>application</MODULE> <FLAG_CREATE>false</FLAG_CREATE> <COLLECTIONS> <COLL_ID>letterbox_coll</COLL_ID> @@ -383,7 +383,7 @@ An action page is described in a ACTIONPAGE tag : <NAME>send_shipping</NAME> <component>sendShippingAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>maileva</MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> <ACTIONPAGE> @@ -393,7 +393,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_NO_CONFIRM_DESC</DESC> <component>noConfirmAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>application</MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> <ACTIONPAGE> @@ -403,7 +403,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_RECONCILE_RESOURCE_DESC</DESC> <component>reconcileAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>application</MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> <ACTIONPAGE> @@ -413,7 +413,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_SEND_ALFRESCO</DESC> <component>sendAlfrescoAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>alfresco</MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> <ACTIONPAGE> @@ -423,7 +423,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_SAVE_REGISTERED_MAIL</DESC> <component>saveRegisteredMailAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>registeredMail</MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> <ACTIONPAGE> @@ -433,7 +433,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_SAVE_PRINT_REGISTERED_MAIL</DESC> <component>saveAndPrintRegisteredMailAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>registeredMail</MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> <ACTIONPAGE> @@ -443,7 +443,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_SAVE_INDEX_REGISTERED_MAIL</DESC> <component>saveAndIndexRegisteredMailAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>registeredMail</MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> <ACTIONPAGE> @@ -453,7 +453,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_PRINT_REGISTERED_MAIL</DESC> <component>printRegisteredMailAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>registeredMail</MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> <ACTIONPAGE> @@ -463,7 +463,7 @@ An action page is described in a ACTIONPAGE tag : <DESC>_PRINT_DEPOSIT_LIST</DESC> <component>printDepositListAction</component> <ORIGIN>apps</ORIGIN> - <MODULE></MODULE> + <MODULE>registeredMail</MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> </ROOT> diff --git a/src/app/action/models/ActionModelAbstract.php b/src/app/action/models/ActionModelAbstract.php index 7e335e8a7fc0b9d56f9c1796cfa4de11554e0dbf..893c876282473aa88d2a0331f547bb324cf8d6c9 100755 --- a/src/app/action/models/ActionModelAbstract.php +++ b/src/app/action/models/ActionModelAbstract.php @@ -178,6 +178,7 @@ abstract class ActionModelAbstract 'label' => $label, 'name' => (string)$actionPage->NAME, 'component' => $component, + 'category' => (string)$actionPage->MODULE, 'desc' => $desc ]; } diff --git a/src/frontend/app/administration/action/action-administration.component.html b/src/frontend/app/administration/action/action-administration.component.html index d289c6849de4896d8137cef000193101fa033a60..0036f5d6a55a33b5b1914aecec31540a91d76f60 100755 --- a/src/frontend/app/administration/action/action-administration.component.html +++ b/src/frontend/app/administration/action/action-administration.component.html @@ -19,36 +19,40 @@ </div> <mat-card *ngIf="!loading" class="card-app-content"> <div *ngIf="action.is_system == true" class="alert alert-danger" role="alert"> - <b>{{'lang.isSytemAction' | translate}} !</b> {{'lang.doNotModifyUnlessExpert' | translate}}</div> + <b>{{'lang.isSytemAction' | translate}} !</b> {{'lang.doNotModifyUnlessExpert' | translate}} + </div> <form class="form-horizontal" (ngSubmit)="onSubmit()" #actionsFormUp="ngForm"> <div class="form-group"> <div class="col-sm-12"> <mat-form-field> <input matInput [(ngModel)]="action.label_action" required name="action_name" - id="action_name" title="{{'lang.label' | translate}}" type="text" placeholder="{{'lang.label' | translate}}" - maxlength="255"> + id="action_name" title="{{'lang.label' | translate}}" type="text" + placeholder="{{'lang.label' | translate}}" maxlength="255"> </mat-form-field> </div> </div> <div class="form-group"> <div class="col-sm-12"> - <plugin-select-search [showLabel]="true" [class]="''" [label]="this.translate.instant('lang.actionCarriedOut')" - [placeholderLabel]="this.translate.instant('lang.actionCarriedOut')" [formControlSelect]="selectActionPageId" - [datas]="actionPages" (afterSelected)="getCustomFields()" style="width:100%;"> + <plugin-select-search [showLabel]="true" [class]="''" + [label]="this.translate.instant('lang.actionCarriedOut')" + [placeholderLabel]="this.translate.instant('lang.actionCarriedOut')" + [formControlSelect]="selectActionPageId" [datas]="actionPages" + [optGroupList]="group" [optGroupTarget]="'category'" (afterSelected)="getCustomFields()" style="width:100%;"> </plugin-select-search> </div> </div> <div class="form-group" - *ngIf="!this.functions.empty(availableCustomFields) && action.actionPageId=='close_mail'"> + *ngIf="!this.functions.empty(availableCustomFields) && action.actionPageId=='close_mail'"> <div class="col-sm-12"> <plugin-select-search [showLabel]="true" [class]="''" - [label]="this.translate.instant('lang.checkEmptyFields')" [placeholderLabel]="this.translate.instant('lang.checkEmptyFields')" - [formControlSelect]="customFieldsFormControl" [datas]="availableCustomFields" - (afterSelected)="getSelectedFields()" style="width:100%;"> + [label]="this.translate.instant('lang.checkEmptyFields')" + [placeholderLabel]="this.translate.instant('lang.checkEmptyFields')" + [formControlSelect]="customFieldsFormControl" [datas]="availableCustomFields" + (afterSelected)="getSelectedFields()" style="width:100%;"> </plugin-select-search> <mat-chip-list class="checkbox-selected-list"> <mat-chip *ngFor="let fieldValue of selectedFieldsValue; let i = index" selected - [removable]="true" (removed)="removeSelectedFields(i)"> + [removable]="true" (removed)="removeSelectedFields(i)"> {{fieldValue}} <mat-icon matChipRemove class="fa fa-times-circle"></mat-icon> </mat-chip> @@ -59,8 +63,9 @@ <div class="col-sm-12"> <mat-form-field> <mat-select [required]="action.actionPageId=='create_acknowledgement_receipt'" - id="generateARmode" name="generateARmode" title="{{'lang.generateARMode' | translate}}" - placeholder="{{'lang.generateARMode' | translate}}" [(ngModel)]="arMode"> + id="generateARmode" name="generateARmode" + title="{{'lang.generateARMode' | translate}}" + placeholder="{{'lang.generateARMode' | translate}}" [(ngModel)]="arMode"> <mat-option value="auto">{{'lang.autoAR' | translate}}</mat-option> <mat-option value="manual">{{'lang.manualAR' | translate}}</mat-option> <mat-option value="both">{{'lang.bothAR' | translate}}</mat-option> @@ -70,10 +75,11 @@ </div> <div class="form-group" *ngIf="action.actionPageId!='reconcile'"> <div class="col-sm-12"> - <plugin-select-search [showLabel]="true" [class]="''" [label]="this.translate.instant('lang.associatedStatus')" - [placeholderLabel]="this.translate.instant('lang.associatedStatus')" [formControlSelect]="selectStatusId" - [datas]="statuses" (afterSelected)="action.id_status = selectStatusId.value" - style="width:100%;"> + <plugin-select-search [showLabel]="true" [class]="''" + [label]="this.translate.instant('lang.associatedStatus')" + [placeholderLabel]="this.translate.instant('lang.associatedStatus')" + [formControlSelect]="selectStatusId" [datas]="statuses" + (afterSelected)="action.id_status = selectStatusId.value" style="width:100%;"> </plugin-select-search> </div> </div> @@ -81,7 +87,7 @@ <div class="col-sm-12"> <mat-form-field> <mat-select id="keyword" name="keyword" title="{{'lang.keyword' | translate}}" - placeholder="{{'lang.keyword' | translate}}" [(ngModel)]="action.keyword"> + placeholder="{{'lang.keyword' | translate}}" [(ngModel)]="action.keyword"> <mat-option *ngFor="let keyword of keywordsList" [value]="keyword.value"> {{keyword.label}} </mat-option> @@ -91,8 +97,9 @@ </div> <div class="form-group"> <div class="col-sm-12" style="text-align:center;"> - <mat-slide-toggle name="history" title="{{'lang.actionHistoryDesc' | translate}}" id="history" - color="primary" [(ngModel)]="action.history" [checked]="action.history == 'Y'"> + <mat-slide-toggle name="history" title="{{'lang.actionHistoryDesc' | translate}}" + id="history" color="primary" [(ngModel)]="action.history" + [checked]="action.history == 'Y'"> {{'lang.actionHistory' | translate}}</mat-slide-toggle> </div> </div> @@ -100,10 +107,10 @@ <div class="col-sm-12"> <mat-form-field> <mat-select id="categorieslist" name="categorieslist" - title="{{'lang.chooseCategoryAssociation' | translate}}" - placeholder="{{'lang.chooseCategoryAssociation' | translate}}" - [(ngModel)]="action.actionCategories" multiple required> - <mat-option *ngFor="let category of categoriesList" [value]="category.id"> + title="{{'lang.chooseCategoryAssociation' | translate}}" + placeholder="{{'lang.chooseCategoryAssociation' | translate}}" + [(ngModel)]="action.actionCategories" multiple required> + <mat-option *ngFor="let category of categoriesList" [value]="category.id" [disabled]="category.id !== 'registeredMail' && action.actionPageGroup === 'registeredMail'"> {{category.label}} </mat-option> </mat-select> @@ -113,7 +120,7 @@ <div class="form-group"> <div class="col-sm-12" style="text-align:center;"> <button mat-raised-button color="primary" type="submit" - [disabled]="!actionsFormUp.form.valid">{{'lang.save' | translate}}</button> + [disabled]="!actionsFormUp.form.valid">{{'lang.save' | translate}}</button> </div> </div> </form> @@ -121,4 +128,4 @@ </div> </div> </mat-sidenav-content> -</mat-sidenav-container> +</mat-sidenav-container> \ No newline at end of file diff --git a/src/frontend/app/administration/action/action-administration.component.ts b/src/frontend/app/administration/action/action-administration.component.ts index 63e95eb456cd5fb9996c1e9f3a2e4060bded9601..87f45152bd27ed310d9354f75d19c732f7eac6e5 100755 --- a/src/frontend/app/administration/action/action-administration.component.ts +++ b/src/frontend/app/administration/action/action-administration.component.ts @@ -27,6 +27,8 @@ export class ActionAdministrationComponent implements OnInit { categoriesList: any[] = []; keywordsList: any[] = []; + group: any[] = []; + loading: boolean = false; availableCustomFields: Array<any> = []; customFieldsFormControl = new FormControl({ value: '', disabled: false }); @@ -71,6 +73,13 @@ export class ActionAdministrationComponent implements OnInit { }); this.actionPages = data['actionPages']; + this.actionPages.map(action => action.category).filter((cat, index, self) => self.indexOf(cat) === index).forEach(element => { + this.group.push({ + id : element, + label : this.translate.instant('lang.' + element) + }); + }); + this.keywordsList = data.keywordsList; this.headerService.setHeader(this.translate.instant('lang.actionCreation')); this.loading = false; @@ -119,6 +128,12 @@ export class ActionAdministrationComponent implements OnInit { getCustomFields() { this.action.actionPageId = this.selectActionPageId.value; + this.action.actionPageGroup = this.actionPages.filter(action => action.id === this.action.actionPageId)[0].category; + + if (this.action.actionPageGroup === 'registeredMail') { + this.action.actionCategories = ['registeredMail']; + } + return new Promise((resolve, reject) => { if (this.action.actionPageId === 'close_mail' && this.functions.empty(this.availableCustomFields)) { this.http.get('../rest/customFields').pipe( diff --git a/src/frontend/plugins/select-search/select-search.component.ts b/src/frontend/plugins/select-search/select-search.component.ts index 2dd742e4a240be849c7aff7ed33a02f9496d61b3..8c003e473b01ed28c8ca623ae9cdc718482d76a6 100755 --- a/src/frontend/plugins/select-search/select-search.component.ts +++ b/src/frontend/plugins/select-search/select-search.component.ts @@ -13,11 +13,13 @@ import { Subject, ReplaySubject, Observable } from 'rxjs'; import { LatinisePipe } from 'ngx-pipes'; import { TranslateService } from '@ngx-translate/core'; import { AppService } from '../../service/app.service'; +import { SortPipe } from '../../plugins/sorting.pipe'; @Component({ selector: 'plugin-select-search', templateUrl: 'select-search.component.html', - styleUrls: ['select-search.component.scss', '../../app/indexation/indexing-form/indexing-form.component.scss'] + styleUrls: ['select-search.component.scss', '../../app/indexation/indexing-form/indexing-form.component.scss'], + providers: [SortPipe] }) export class PluginSelectSearchComponent implements OnInit, OnDestroy, AfterViewInit, ControlValueAccessor { /** Label of the search placeholder */ @@ -41,6 +43,14 @@ export class PluginSelectSearchComponent implements OnInit, OnDestroy, AfterView @Input() hideErrorDesc: boolean = true; + @Input() optGroupTarget: string = null; + + /** + * ex : [ { id : 'group1' , label: 'Group 1'} ] + */ + @Input() optGroupList: any = null; + + /** * ex : {class:'fa-circle', color:'#fffff', title: 'foo'} */ @@ -94,9 +104,14 @@ export class PluginSelectSearchComponent implements OnInit, OnDestroy, AfterView private latinisePipe: LatinisePipe, private changeDetectorRef: ChangeDetectorRef, private renderer: Renderer2, - public appService: AppService) { } + public appService: AppService, + private sortPipe: SortPipe) { } ngOnInit() { + if (this.optGroupList !== null) { + this.initOptGroups(); + } + // set custom panel class const panelClass = 'mat-select-search-panel'; if (this.matSelect.panelClass) { @@ -157,6 +172,26 @@ export class PluginSelectSearchComponent implements OnInit, OnDestroy, AfterView } + initOptGroups() { + this.datas.unshift({ id : 0, label : 'toto', disabled : true}); + + let tmpArr = []; + + this.optGroupList = this.sortPipe.transform(this.optGroupList, 'label'); + this.optGroupList.forEach(group => { + tmpArr.push({ id : group.id, label : group.label, disabled : true}); + tmpArr = tmpArr.concat(this.datas.filter(data => data[this.optGroupTarget] === group.id).map(data => { + return { + ...data, + title: data.label, + label : '  ' + data.label + }; + })); + }); + + this.datas = tmpArr; + } + ngOnDestroy() { this._onDestroy.next(); this._onDestroy.complete();