diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index 794879d4572d9d9448e45b9bc2c9c47e9ca8ce96..842b2f2252c8c312800ddbae3ea967c4d7dbcf8e 100755 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -23,6 +23,7 @@ import { ActivateUserComponent } from './activate-user.component' import { FiltersListComponent } from './list/filters/filters-list.component'; +import { FiltersToolComponent } from './list/filters/filters-tool.component'; @NgModule({ imports: [ @@ -47,7 +48,8 @@ import { FiltersListComponent } from './list/filters/filters-list BottomSheetNoteList, BottomSheetAttachmentList, BottomSheetDiffusionList, - FiltersListComponent + FiltersListComponent, + FiltersToolComponent ], entryComponents: [ CustomSnackbarComponent, diff --git a/src/frontend/app/list/basket-list.component.html b/src/frontend/app/list/basket-list.component.html index 6238ddb6850c10b25cda8b63fb4e5ab3d716e87e..ea1177ecca0e63d73be7a8ca1184485082a11ace 100644 --- a/src/frontend/app/list/basket-list.component.html +++ b/src/frontend/app/list/basket-list.component.html @@ -17,51 +17,7 @@ </div> <div class="row" style="margin:0px;"> <div class="col-md-9 col-xs-9"> - <mat-button-toggle-group #group="matButtonToggleGroup" class="envFilter" (change)="updateFiltersTool($event)" multiple> - <mat-checkbox color="primary" style="margin: 10px;" title="Sélectionner tous les courriers de la bannette"></mat-checkbox> - <button mat-stroked-button (click)="openFilter()">{{lang.filters}}</button> - <mat-button-toggle [checked]="this.listProperties.delayed" value="delayed" title="{{lang.displayProcessLimitRes}}"> - <mat-icon fontSet="fas" fontIcon="fa-stopwatch fa-2x"></mat-icon> - </mat-button-toggle> - <mat-form-field appearance="outline" [style.fontSize.px]="10" style="width:200px !important;"> - <mat-label>{{lang.orderBy}}</mat-label> - <mat-select [(ngModel)]="this.listProperties.order" (selectionChange)="updateFilters()"> - <mat-option value="" style="text-align: center;">{{lang.defaultOrder}}</mat-option> - <mat-option [value]="column.id" *ngFor="let column of displayColsOrder"> - {{lang[column.id]}} - </mat-option> - </mat-select> - </mat-form-field> - <button [disabled]="this.listProperties.order == ''" mat-icon-button title="{{lang.descOrder}}" style="color: rgba(0,0,0,0.38);" (click)="changeOrderDir();"> - <mat-icon *ngIf="this.listProperties.orderDir == 'DESC'" fontSet="fas" fontIcon="fa-sort-amount-up fa-2x"></mat-icon> - <mat-icon *ngIf="this.listProperties.orderDir == 'ASC'" fontSet="fas" fontIcon="fa-sort-amount-down fa-2x"></mat-icon> - </button> - <button mat-icon-button [matMenuTriggerFor]="menuParamList"> - <mat-icon color="primary" fontSet="fas" fontIcon="fa-cog fa-2x"></mat-icon> - </button> - <mat-menu #menuParamList="matMenu"> - <button mat-menu-item> - <mat-icon fontSet="fas" fontIcon="fa-print fa-2x"></mat-icon> - <span>{{lang.printResultList}}</span> - </button> - <button mat-menu-item> - <mat-icon fontSet="fas" fontIcon="fa-file-export fa-2x"></mat-icon> - <span>{{lang.exportDatas}}</span> - </button> - <button mat-menu-item> - <mat-icon fontSet="far" fontIcon="fa-list-alt fa-2x"></mat-icon> - <span>{{lang.settingsList}}</span> - </button> - </mat-menu> - </mat-button-toggle-group> - <div class="filterBadges"> - <span class="label label-info" title="{{lang.currentFilters}}" *ngFor="let category of this.listProperties.categories" (click)="openFilter()">{{category.label}}</span> - <span class="label label-info" title="{{lang.currentFilters}}" *ngFor="let status of this.listProperties.statuses" (click)="openFilter()">{{status.label}}</span> - <span class="label label-info" title="{{lang.currentFilters}}" (click)="openFilter()">{{this.listProperties.reference}}</span> - <span class="label label-info" title="{{lang.currentFilters}}" (click)="openFilter()">{{this.listProperties.subject}}</span> - <span class="label label-info" title="{{lang.currentFilters}}" *ngFor="let priority of this.listProperties.priorities" (click)="openFilter()">{{priority.label}}</span> - <span class="label label-info" title="{{lang.currentFilters}}" *ngFor="let entity of this.listProperties.entities" (click)="openFilter()">{{entity.label}}</span> - </div> + <app-filters-tool [listProperties]="this.listProperties" [snavR]="snav2" (refreshEvent)="refreshDao()"></app-filters-tool> </div> <div class="col-md-3 col-xs-3"> <mat-paginator [length]="resultsLength" [pageSize]="10"></mat-paginator> @@ -151,9 +107,9 @@ </mat-sidenav-content> <mat-sidenav #snav2 mode="over" [fixedInViewport]="mobileQuery.matches" fixedTopGap="56" position='end' [opened]="mobileQuery.matches ? false : false" style="overflow-x:hidden;" [class.docView]="!filterMode" [ngStyle]="{'width': mobileMode ? '80%' : '40%'}" autoFocus="false"> - <div *ngIf="innerHtml && !filterMode" [innerHTML]="innerHtml" style="height: 100%;overflow: hidden;"></div> + <div *ngIf="innerHtml && !filtersListService.filterMode" [innerHTML]="innerHtml" style="height: 100%;overflow: hidden;"></div> - <app-filters-list *ngIf="filterMode" [listProperties]="this.listProperties" (triggerEvent)="updateFilters()"></app-filters-list> + <app-filters-list *ngIf="filtersListService.filterMode" [listProperties]="this.listProperties" (refreshEvent)="refreshDao()"></app-filters-list> <mat-divider></mat-divider> </mat-sidenav> </mat-sidenav-container> diff --git a/src/frontend/app/list/basket-list.component.scss b/src/frontend/app/list/basket-list.component.scss index 42aec0d03763d8bf13a1c12414f5bfa4af289b52..cae576406fda50a57f614c1dfeb17419806b8934 100644 --- a/src/frontend/app/list/basket-list.component.scss +++ b/src/frontend/app/list/basket-list.component.scss @@ -2,13 +2,6 @@ overflow: hidden; } -mat-toolbar { - border: solid 1px #F9983066; - font-size: 10px; - height: 20px; - color: #666; -} - .resultContainer { // color : rgb(102, 102, 102); padding: 10px; @@ -63,19 +56,6 @@ mat-toolbar { } } -.envFilter { - height: 40px; - - mat-icon{ - height: auto; - } - - .mat-button-toggle-checked { - background-color: #F99830; - color: white; - } -} - .checkThis { width: 40px; text-align: center; @@ -119,10 +99,4 @@ mat-toolbar { .longData { flex: 3; -} - -.filterBadges>.label { - margin: 5px; - background: #F99830; - cursor: pointer; } \ No newline at end of file diff --git a/src/frontend/app/list/basket-list.component.ts b/src/frontend/app/list/basket-list.component.ts index 9631a8aaa7d8269f40a208453a282cafb044f6c0..5d34a753b72220d8ee4e21f91e3d9bbdbb10323b 100755 --- a/src/frontend/app/list/basket-list.component.ts +++ b/src/frontend/app/list/basket-list.component.ts @@ -37,7 +37,6 @@ export class BasketListComponent implements OnInit { basketUrl: string; homeData: any; - filterMode: boolean = false; filtersChange = new EventEmitter(); @ViewChild('snav') sidenavLeft: MatSidenav; @@ -92,25 +91,12 @@ export class BasketListComponent implements OnInit { // }, // ]; - displayColsOrder = [ - { 'id': 'dest_user' }, - { 'id': 'creation_date' }, - { 'id': 'process_limit_date' }, - { 'id': 'destination' }, - { 'id': 'subject' }, - { 'id': 'alt_identifier' }, - { 'id': 'priority' }, - { 'id': 'status' }, - { 'id': 'type_id' } - ] - exampleDatabase: ResultListHttpDao | null; data: any[] = []; resultsLength = 0; isLoadingResults = true; listProperties: any = {}; listPropertiesIndex: number = 0; - filters: string = ''; @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild('tableBasketListSort') sort: MatSort; @@ -143,13 +129,12 @@ export class BasketListComponent implements OnInit { this.http.get(this.basketUrl) .subscribe((data: any) => { this.headerService.headerMessage = data.basketLabel; - this.filterMode = false; + this.filtersListService.filterMode = false; window['MainHeaderComponent'].setSnav(this.sidenavLeft); window['MainHeaderComponent'].setSnavRight(this.sidenavRight); this.listProperties = this.filtersListService.initListsProperties('bbain', params['groupSerialId'], params['basketId']); - this.filters = this.filtersListService.getUrlFilters(); this.initResultList(); }, () => { @@ -171,7 +156,7 @@ export class BasketListComponent implements OnInit { switchMap(() => { this.isLoadingResults = true; return this.exampleDatabase!.getRepoIssues( - this.sort.active, this.sort.direction, this.paginator.pageIndex, this.basketUrl, this.filters); + this.sort.active, this.sort.direction, this.paginator.pageIndex, this.basketUrl, this.filtersListService.getUrlFilters()); }), map(data => { // Flip flag to show that loading has finished. @@ -188,7 +173,7 @@ export class BasketListComponent implements OnInit { } goTo(row: any) { - this.filterMode = false; + this.filtersListService.filterMode = false; if (this.docUrl == this.coreUrl + 'rest/res/' + row.res_id + '/content' && this.sidenavRight.opened) { this.sidenavRight.close(); } else { @@ -200,11 +185,6 @@ export class BasketListComponent implements OnInit { } } - openFilter() { - this.filterMode = true; - this.sidenavRight.open(); - } - goToDetail(row: any) { location.href = "index.php?page=details&dir=indexing_searching&id=" + row.res_id; } @@ -228,38 +208,8 @@ export class BasketListComponent implements OnInit { }); } - updateFiltersTool(e: any) { - this.listProperties.delayed = false; - this.listProperties.page = 0; - - e.value.forEach((element: any) => { - this.listProperties[element] = true; - }); - this.filtersListService.updateListsProperties(this.listProperties); - - this.filters = this.filtersListService.getUrlFilters(); - - this.filtersChange.emit(); - - } - - updateFilters() { - this.listProperties.page = 0; - - this.filtersListService.updateListsProperties(this.listProperties); - this.filters = this.filtersListService.getUrlFilters(); - + refreshDao() { this.filtersChange.emit(); - - } - - changeOrderDir() { - if (this.listProperties.orderDir == 'ASC') { - this.listProperties.orderDir = 'DESC'; - } else { - this.listProperties.orderDir = 'ASC'; - } - this.updateFilters(); } } export interface BasketList { diff --git a/src/frontend/app/list/filters/filters-list.component.html b/src/frontend/app/list/filters/filters-list.component.html index 738bf6d2a2631185d3d1d48158c0b7bff37cb18f..3cb8eda04ad86bab069d00843533b14ab1653c4e 100644 --- a/src/frontend/app/list/filters/filters-list.component.html +++ b/src/frontend/app/list/filters/filters-list.component.html @@ -13,10 +13,10 @@ </mat-panel-description> </mat-expansion-panel-header> <mat-form-field appearance="outline"> - <input #reference matInput [(ngModel)]="this.listProperties.reference" (keyup.enter)="this.triggerEvent.emit();" + <input #reference matInput [(ngModel)]="this.listProperties.reference" (keyup.enter)="this.updateFilters();" placeholder="3 {{lang.passwordminLength}}"> <button mat-button *ngIf="this.listProperties.reference" matSuffix mat-icon-button aria-label="Clear" - (click)="this.listProperties.reference='';this.triggerEvent.emit();"> + (click)="this.listProperties.reference='';this.updateFilters();"> <mat-icon color="primary" fontSet="fas" fontIcon="fa-times"></mat-icon> </button> </mat-form-field> @@ -30,10 +30,10 @@ </mat-panel-description> </mat-expansion-panel-header> <mat-form-field appearance="outline"> - <input #subject matInput [(ngModel)]="this.listProperties.subject" (keyup.enter)="this.triggerEvent.emit();" + <input #subject matInput [(ngModel)]="this.listProperties.subject" (keyup.enter)="this.updateFilters();" placeholder="3 {{lang.passwordminLength}}"> <button mat-button *ngIf="this.listProperties.subject" matSuffix mat-icon-button aria-label="Clear" - (click)="this.listProperties.subject='';this.triggerEvent.emit();"> + (click)="this.listProperties.subject='';this.updateFilters();"> <mat-icon color="primary" fontSet="fas" fontIcon="fa-times"></mat-icon> </button> </mat-form-field> @@ -46,7 +46,7 @@ <mat-panel-description> </mat-panel-description> </mat-expansion-panel-header> - <mat-selection-list #categories (selectionChange)="updateFilters(categories, 'categories')"> + <mat-selection-list #categories (selectionChange)="setFilters(categories, 'categories')"> <mat-list-option checkboxPosition="before" color="primary" [value]="category.id" *ngFor="let category of categoriesList" [selected]="category.selected"> {{category.label}} @@ -61,7 +61,7 @@ <mat-panel-description> </mat-panel-description> </mat-expansion-panel-header> - <mat-selection-list #priorities (selectionChange)="updateFilters(priorities, 'priorities')"> + <mat-selection-list #priorities (selectionChange)="setFilters(priorities, 'priorities')"> <mat-list-option checkboxPosition="before" color="primary" [value]="priority.id" *ngFor="let priority of prioritiesList" [selected]="priority.selected"> {{priority.label}} @@ -79,7 +79,7 @@ <mat-form-field floatLabel="never"> <input matInput placeholder="Filtrer" #listFilter> </mat-form-field> - <mat-selection-list #statuses (selectionChange)="updateFilters(statuses, 'statuses')"> + <mat-selection-list #statuses (selectionChange)="setFilters(statuses, 'statuses')"> <mat-list-option checkboxPosition="before" color="primary" [value]="status.id" *ngFor="let status of statusesList | filterList:listFilter.value:'label_status'" [selected]="status.selected"> {{status.label_status}} @@ -95,7 +95,7 @@ </mat-panel-description> </mat-expansion-panel-header> Coming soon... - <mat-selection-list #entities (selectionChange)="updateFilters(entities, 'entities')"> + <mat-selection-list #entities (selectionChange)="setFilters(entities, 'entities')"> <mat-list-option checkboxPosition="before" color="primary" [value]="entity.id" *ngFor="let entity of entitiesList" [selected]="entity.selected"> {{entity.label}} diff --git a/src/frontend/app/list/filters/filters-list.component.ts b/src/frontend/app/list/filters/filters-list.component.ts index b7fbe85a246122a3a2856d07d79429b9f541a1dd..39b437aea83b088765871e00c06714fb7d2fedae 100644 --- a/src/frontend/app/list/filters/filters-list.component.ts +++ b/src/frontend/app/list/filters/filters-list.component.ts @@ -37,7 +37,7 @@ export class FiltersListComponent implements OnInit { @ViewChild('referencePan') referencePan: MatExpansionPanel; @ViewChild('statusesPan') statusesPan: MatExpansionPanel; - @Output() triggerEvent = new EventEmitter<string>(); + @Output('refreshEvent') refreshEvent = new EventEmitter<string>(); constructor(public http: HttpClient, private filtersListService: FiltersListService) { } @@ -108,7 +108,7 @@ export class FiltersListComponent implements OnInit { }); } - updateFilters(e: MatSelectionList, id: string) { + setFilters(e: MatSelectionList, id: string) { this.listProperties[id] = []; e.selectedOptions.selected.forEach(element => { this.listProperties[id].push({ @@ -116,7 +116,15 @@ export class FiltersListComponent implements OnInit { 'label': element._text.nativeElement.innerText }); }); - this.triggerEvent.emit(); + this.updateFilters(); + } + + updateFilters() { + this.listProperties.page = 0; + + this.filtersListService.updateListsProperties(this.listProperties); + + this.refreshEvent.emit(); } setFocus(elem: MatInput) { diff --git a/src/frontend/app/list/filters/filters-tool.component.html b/src/frontend/app/list/filters/filters-tool.component.html new file mode 100644 index 0000000000000000000000000000000000000000..9138f8585dfc79ff0008bb27a2fb885b8dc7e9ef --- /dev/null +++ b/src/frontend/app/list/filters/filters-tool.component.html @@ -0,0 +1,50 @@ +<mat-button-toggle-group #group="matButtonToggleGroup" class="envFilter" (change)="updateFiltersTool($event)" multiple> + <mat-checkbox color="primary" style="margin: 10px;" title="Sélectionner tous les courriers de la bannette"></mat-checkbox> + <button mat-stroked-button (click)="openFilter()">{{lang.filters}}</button> + <mat-button-toggle [checked]="this.listProperties.delayed" value="delayed" title="{{lang.displayProcessLimitRes}}"> + <mat-icon fontSet="fas" fontIcon="fa-stopwatch fa-2x"></mat-icon> + </mat-button-toggle> + <mat-form-field appearance="outline" [style.fontSize.px]="10" style="width:200px !important;"> + <mat-label>{{lang.orderBy}}</mat-label> + <mat-select [(ngModel)]="this.listProperties.order" (selectionChange)="updateFilters()"> + <mat-option value="" style="text-align: center;">{{lang.defaultOrder}}</mat-option> + <mat-option [value]="column.id" *ngFor="let column of displayColsOrder"> + {{lang[column.id]}} + </mat-option> + </mat-select> + </mat-form-field> + <button [disabled]="this.listProperties.order == ''" mat-icon-button title="{{lang.descOrder}}" style="color: rgba(0,0,0,0.38);" + (click)="changeOrderDir();"> + <mat-icon *ngIf="this.listProperties.orderDir == 'DESC'" fontSet="fas" fontIcon="fa-sort-amount-up fa-2x"></mat-icon> + <mat-icon *ngIf="this.listProperties.orderDir == 'ASC'" fontSet="fas" fontIcon="fa-sort-amount-down fa-2x"></mat-icon> + </button> + <button mat-icon-button [matMenuTriggerFor]="menuParamList"> + <mat-icon color="primary" fontSet="fas" fontIcon="fa-cog fa-2x"></mat-icon> + </button> + <mat-menu #menuParamList="matMenu"> + <button mat-menu-item> + <mat-icon fontSet="fas" fontIcon="fa-print fa-2x"></mat-icon> + <span>{{lang.printResultList}}</span> + </button> + <button mat-menu-item> + <mat-icon fontSet="fas" fontIcon="fa-file-export fa-2x"></mat-icon> + <span>{{lang.exportDatas}}</span> + </button> + <button mat-menu-item> + <mat-icon fontSet="far" fontIcon="fa-list-alt fa-2x"></mat-icon> + <span>{{lang.settingsList}}</span> + </button> + </mat-menu> +</mat-button-toggle-group> +<div class="filterBadges"> + <span class="label label-info" title="{{lang.currentFilters}}" *ngFor="let category of this.listProperties.categories" + (click)="openFilter()">{{category.label}}</span> + <span class="label label-info" title="{{lang.currentFilters}}" *ngFor="let status of this.listProperties.statuses" + (click)="openFilter()">{{status.label}}</span> + <span class="label label-info" title="{{lang.currentFilters}}" (click)="openFilter()">{{this.listProperties.reference}}</span> + <span class="label label-info" title="{{lang.currentFilters}}" (click)="openFilter()">{{this.listProperties.subject}}</span> + <span class="label label-info" title="{{lang.currentFilters}}" *ngFor="let priority of this.listProperties.priorities" + (click)="openFilter()">{{priority.label}}</span> + <span class="label label-info" title="{{lang.currentFilters}}" *ngFor="let entity of this.listProperties.entities" + (click)="openFilter()">{{entity.label}}</span> +</div> \ No newline at end of file diff --git a/src/frontend/app/list/filters/filters-tool.component.scss b/src/frontend/app/list/filters/filters-tool.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..09bfbd8e5c8b3ecf1da8c6d7f51ee86c35e7274d --- /dev/null +++ b/src/frontend/app/list/filters/filters-tool.component.scss @@ -0,0 +1,23 @@ +mat-toolbar { + border: solid 1px #F9983066; + font-size: 10px; + height: 20px; + color: #666; +} +.envFilter { + height: 40px; + + mat-icon{ + height: auto; + } + + .mat-button-toggle-checked { + background-color: #F99830; + color: white; + } +} +.filterBadges>.label { + margin: 5px; + background: #F99830; + cursor: pointer; +} \ No newline at end of file diff --git a/src/frontend/app/list/filters/filters-tool.component.ts b/src/frontend/app/list/filters/filters-tool.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..60d0541878adbdcde36cdabcd589e0042ceea282 --- /dev/null +++ b/src/frontend/app/list/filters/filters-tool.component.ts @@ -0,0 +1,76 @@ +import { Component, OnInit, ViewEncapsulation, Input, EventEmitter, Output } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { LANG } from '../../translate.component'; +import { MatSidenav } from '@angular/material'; +import { FiltersListService } from '../../../service/filtersList.service'; + +declare function $j(selector: any): any; + +@Component({ + selector: 'app-filters-tool', + templateUrl: 'filters-tool.component.html', + styleUrls: ['filters-tool.component.scss'], + encapsulation: ViewEncapsulation.None +}) +export class FiltersToolComponent implements OnInit { + + lang: any = LANG; + + displayColsOrder = [ + { 'id': 'dest_user' }, + { 'id': 'creation_date' }, + { 'id': 'process_limit_date' }, + { 'id': 'destination' }, + { 'id': 'subject' }, + { 'id': 'alt_identifier' }, + { 'id': 'priority' }, + { 'id': 'status' }, + { 'id': 'type_id' } + ] + + @Input('listProperties') listProperties: any; + @Input('snavR') sidenavRight: MatSidenav; + + @Output('refreshEvent') refreshEvent = new EventEmitter<string>(); + + constructor(public http: HttpClient, private filtersListService: FiltersListService) { } + + ngOnInit(): void { + + } + + changeOrderDir() { + if (this.listProperties.orderDir == 'ASC') { + this.listProperties.orderDir = 'DESC'; + } else { + this.listProperties.orderDir = 'ASC'; + } + this.updateFilters(); + } + + updateFilters() { + this.listProperties.page = 0; + + this.filtersListService.updateListsProperties(this.listProperties); + + this.refreshEvent.emit(); + } + + updateFiltersTool(e: any) { + this.listProperties.delayed = false; + this.listProperties.page = 0; + + e.value.forEach((element: any) => { + this.listProperties[element] = true; + }); + this.filtersListService.updateListsProperties(this.listProperties); + + this.refreshEvent.emit(); + + } + + openFilter() { + this.filtersListService.filterMode = true; + this.sidenavRight.open(); + } +} \ No newline at end of file diff --git a/src/frontend/service/filtersList.service.ts b/src/frontend/service/filtersList.service.ts index cf65fdb84e7debb10d63fc5796c12b36975b53a9..08ec3e65c924cbacb4b5e90d449df911fd4d7776 100644 --- a/src/frontend/service/filtersList.service.ts +++ b/src/frontend/service/filtersList.service.ts @@ -21,6 +21,7 @@ export class FiltersListService { listsProperties: any[] = []; listsPropertiesIndex: number = 0; + filterMode: boolean = false; constructor() { this.listsProperties = JSON.parse(sessionStorage.getItem('propertyList'));