Verified Commit 17b8d04b authored by Alex ORLUC's avatar Alex ORLUC

FEAT #11296 TIME 2 add filters for folder

parent dcc58c40
...@@ -23,7 +23,11 @@ ...@@ -23,7 +23,11 @@
</div> </div>
</div> </div>
<div class="bg-head-content" [class.fullContainer]="appService.getViewMode()"> <div class="bg-head-content" [class.fullContainer]="appService.getViewMode()">
<app-filters-tool style="flex:1;overflow-x: auto;overflow-y: hidden;" #filtersTool
[listProperties]="this.listProperties" [snavR]="snav2" [totalRes]="allResInBasket.length"
[selectedRes]="selectedRes" [routeDatas]="'/rest/folders/' + folderInfo.id + '/resources/filters'" (toggleAllRes)="toggleAllRes($event)"
(refreshEventAfterAction)="refreshDaoAfterAction()" (refreshEvent)="refreshDao()" [title]="lang.searchMailInFolder">
</app-filters-tool>
</div> </div>
</div> </div>
<div class="container" [class.fullContainer]="appService.getViewMode()"> <div class="container" [class.fullContainer]="appService.getViewMode()">
...@@ -73,7 +77,7 @@ ...@@ -73,7 +77,7 @@
</mat-checkbox> </mat-checkbox>
</span> </span>
<span *ngIf="!appService.getViewMode()" style="cursor:pointer;" <span *ngIf="!appService.getViewMode()" style="cursor:pointer;"
class="main-info-status" (click)="launch(defaultAction,row);"> class="main-info-status" (click)="open($event,row);">
<mat-icon *ngIf="row.isLocked !== true" title="{{row.statusLabel}}" <mat-icon *ngIf="row.isLocked !== true" title="{{row.statusLabel}}"
[ngStyle]="{'color': row.priorityColor}" color="primary" [ngStyle]="{'color': row.priorityColor}" color="primary"
class="{{row.statusImage.charAt(0)}}{{row.statusImage.charAt(1)}} {{row.statusImage}} {{row.statusImage.charAt(0)}}{{row.statusImage.charAt(1)}}-2x statusIcon"> class="{{row.statusImage.charAt(0)}}{{row.statusImage.charAt(1)}} {{row.statusImage}} {{row.statusImage.charAt(0)}}{{row.statusImage.charAt(1)}}-2x statusIcon">
...@@ -103,7 +107,7 @@ ...@@ -103,7 +107,7 @@
</span> </span>
<span class="main-info-data" style="font-weight:bold;flex:1;cursor:pointer;" <span class="main-info-data" style="font-weight:bold;flex:1;cursor:pointer;"
[class.undefined]="row.subject == lang.undefined" title="{{row.subject}}" [class.undefined]="row.subject == lang.undefined" title="{{row.subject}}"
(click)="launch(defaultAction,row);">{{row.subject | shorten: 150: '...'}}</span> (click)="open($event,row);">{{row.subject | shorten: 150: '...'}}</span>
<span class="main-info-action"> <span class="main-info-action">
<button mat-icon-button title="{{lang.notes}}" <button mat-icon-button title="{{lang.notes}}"
(click)="$event.stopPropagation();togglePanel('note',row)" (click)="$event.stopPropagation();togglePanel('note',row)"
......
...@@ -20,6 +20,7 @@ import { PanelFolderComponent } from '../panel/panel-folder.component'; ...@@ -20,6 +20,7 @@ import { PanelFolderComponent } from '../panel/panel-folder.component';
import { BasketHomeComponent } from '../../basket/basket-home.component'; import { BasketHomeComponent } from '../../basket/basket-home.component';
import { ConfirmComponent } from '../../../plugins/modal/confirm.component'; import { ConfirmComponent } from '../../../plugins/modal/confirm.component';
import { FolderActionListComponent } from '../folder-action-list/folder-action-list.component'; import { FolderActionListComponent } from '../folder-action-list/folder-action-list.component';
import { FiltersListService } from '../../../service/filtersList.service';
declare function $j(selector: any): any; declare function $j(selector: any): any;
...@@ -105,6 +106,7 @@ export class FolderDocumentListComponent implements OnInit { ...@@ -105,6 +106,7 @@ export class FolderDocumentListComponent implements OnInit {
public dialog: MatDialog, public dialog: MatDialog,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private headerService: HeaderService, private headerService: HeaderService,
public filtersListService: FiltersListService,
private notify: NotificationService, private notify: NotificationService,
public overlay: Overlay, public overlay: Overlay,
public viewContainerRef: ViewContainerRef, public viewContainerRef: ViewContainerRef,
...@@ -137,11 +139,14 @@ export class FolderDocumentListComponent implements OnInit { ...@@ -137,11 +139,14 @@ export class FolderDocumentListComponent implements OnInit {
this.headerService.setHeader('Dossier : ' + this.folderInfo.label); this.headerService.setHeader('Dossier : ' + this.folderInfo.label);
}); });
this.basketUrl = '../../rest/folders/' + params['folderId'] + '/resources'; this.basketUrl = '../../rest/folders/' + params['folderId'] + '/resources';
this.filtersListService.filterMode = false;
this.selectedRes = []; this.selectedRes = [];
this.sidenavRight.close(); this.sidenavRight.close();
window['MainHeaderComponent'].setSnav(this.sidenavLeft); window['MainHeaderComponent'].setSnav(this.sidenavLeft);
window['MainHeaderComponent'].setSnavRight(null); window['MainHeaderComponent'].setSnavRight(null);
this.listProperties = this.filtersListService.initListsProperties(this.headerService.user.id, 0, this.folderInfo.id, 'folder');
setTimeout(() => { setTimeout(() => {
this.dragInit = false; this.dragInit = false;
}, 1000); }, 1000);
......
...@@ -49,7 +49,7 @@ export class FolderActionListComponent implements OnInit { ...@@ -49,7 +49,7 @@ export class FolderActionListComponent implements OnInit {
open(x: number, y: number, row: any) { open(x: number, y: number, row: any) {
//this.loadActionList(); //this.loadActionList(row.res_id);
// Adjust the menu anchor position // Adjust the menu anchor position
this.contextMenuPosition.x = x + 'px'; this.contextMenuPosition.x = x + 'px';
...@@ -114,33 +114,17 @@ export class FolderActionListComponent implements OnInit { ...@@ -114,33 +114,17 @@ export class FolderActionListComponent implements OnInit {
}); });
} }
} } */
loadActionList() {
if (JSON.stringify(this.basketInfo) != JSON.stringify(this.currentBasketInfo)) {
this.basketInfo = JSON.parse(JSON.stringify(this.currentBasketInfo));
this.http.get('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/actions') loadActionList(resId: number) {
.subscribe((data: any) => { this.http.get('../../rest/folders/' + this.currentFolderInfo.id + '/resources/' + resId + '/events').pipe(
if (data.actions.length > 0) { tap((data) => {
this.actionsList = data.actions; console.log(data);
} else { })
this.actionsList = [{ ).subscribe();
id: 0,
label_action: this.lang.noAction,
component: ''
}];
}
this.loading = false;
}, (err: any) => {
this.notify.handleErrors(err);
});
}
} }
lock() { /* lock() {
this.currentLock = setInterval(() => { this.currentLock = setInterval(() => {
this.http.put('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/lock', { resources: this.arrRes }) this.http.put('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/lock', { resources: this.arrRes })
.subscribe((data: any) => { }, (err: any) => { }); .subscribe((data: any) => { }, (err: any) => { });
......
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
</div> </div>
</div> </div>
<div class="bg-head-content" [class.fullContainer]="appService.getViewMode()"> <div class="bg-head-content" [class.fullContainer]="appService.getViewMode()">
<app-filters-tool style="flex:1;overflow-x: auto;overflow-y: hidden;" #filtersTool [currentBasketInfo]="currentBasketInfo" <app-filters-tool style="flex:1;overflow-x: auto;overflow-y: hidden;" #filtersTool
[listProperties]="this.listProperties" [snavR]="snav2" [totalRes]="allResInBasket.length" [listProperties]="this.listProperties" [snavR]="snav2" [totalRes]="allResInBasket.length"
[selectedRes]="selectedRes" (toggleAllRes)="toggleAllRes($event)" [selectedRes]="selectedRes" [routeDatas]="'/rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + currentBasketInfo.groupId + '/baskets/' + currentBasketInfo.basketId + '/filters'" (toggleAllRes)="toggleAllRes($event)"
(refreshEventAfterAction)="refreshDaoAfterAction()" (refreshEvent)="refreshDao()"> (refreshEventAfterAction)="refreshDaoAfterAction()" (refreshEvent)="refreshDao()" [title]="lang.searchMailInBasket">
</app-filters-tool> </app-filters-tool>
</div> </div>
</div> </div>
......
...@@ -142,7 +142,7 @@ export class BasketListComponent implements OnInit { ...@@ -142,7 +142,7 @@ export class BasketListComponent implements OnInit {
window['MainHeaderComponent'].setSnav(this.sidenavLeft); window['MainHeaderComponent'].setSnav(this.sidenavLeft);
window['MainHeaderComponent'].setSnavRight(null); window['MainHeaderComponent'].setSnavRight(null);
this.listProperties = this.filtersListService.initListsProperties(this.currentBasketInfo.ownerId, this.currentBasketInfo.groupId, this.currentBasketInfo.basketId); this.listProperties = this.filtersListService.initListsProperties(this.currentBasketInfo.ownerId, this.currentBasketInfo.groupId, this.currentBasketInfo.basketId, 'basket');
setTimeout(() => { setTimeout(() => {
......
<div class="filtersContent"> <div class="filtersContent">
<form [formGroup]="stateForm" class="filterTool"> <form [formGroup]="stateForm" class="filterTool">
<mat-form-field floatLabel="never" class="basket-search"> <mat-form-field floatLabel="never" class="basket-search">
<input class="metaSearch" type="text" matInput placeholder="{{lang.searchMailInBasket}}" <input class="metaSearch" type="text" matInput placeholder="{{title}}"
formControlName="stateGroup" [matAutocomplete]="autoGroup" (focus)="initFilters()" formControlName="stateGroup" [matAutocomplete]="autoGroup" (focus)="initFilters()"
(keyup.enter)="metaSearch($event);"> (keyup.enter)="metaSearch($event);">
<button mat-icon-button matPrefix> <button mat-icon-button matPrefix>
......
...@@ -59,8 +59,9 @@ export class FiltersToolComponent implements OnInit { ...@@ -59,8 +59,9 @@ export class FiltersToolComponent implements OnInit {
isLoading: boolean = false; isLoading: boolean = false;
@Input('listProperties') listProperties: any; @Input('listProperties') listProperties: any;
@Input('currentBasketInfo') currentBasketInfo: any;
@Input('title') title: string;
@Input('routeDatas') routeDatas: string;
@Input('snavR') sidenavRight: MatSidenav; @Input('snavR') sidenavRight: MatSidenav;
@Input('selectedRes') selectedRes: any; @Input('selectedRes') selectedRes: any;
@Input('totalRes') totalRes: number; @Input('totalRes') totalRes: number;
...@@ -197,7 +198,7 @@ export class FiltersToolComponent implements OnInit { ...@@ -197,7 +198,7 @@ export class FiltersToolComponent implements OnInit {
}, },
]; ];
this.http.get('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/filters?init' + this.filtersListService.getUrlFilters()) this.http.get('../..' + this.routeDatas + '?init' + this.filtersListService.getUrlFilters())
.subscribe((data: any) => { .subscribe((data: any) => {
data.categories.forEach((element: any) => { data.categories.forEach((element: any) => {
if (this.listProperties.categories.map((category: any) => (category.id)).indexOf(element.id) === -1) { if (this.listProperties.categories.map((category: any) => (category.id)).indexOf(element.id) === -1) {
......
...@@ -1056,4 +1056,5 @@ export const LANG_EN = { ...@@ -1056,4 +1056,5 @@ export const LANG_EN = {
"searchFolder" : "Search folder", "searchFolder" : "Search folder",
"shareToEntities" : "Share to entities ...", "shareToEntities" : "Share to entities ...",
"canManageFolder" : "Can manage this folder", "canManageFolder" : "Can manage this folder",
"searchMailInFolder" : "Search mails in folder",
}; };
...@@ -1093,4 +1093,5 @@ export const LANG_FR = { ...@@ -1093,4 +1093,5 @@ export const LANG_FR = {
"searchFolder" : "Recherche un dossier", "searchFolder" : "Recherche un dossier",
"shareToEntities" : "Partager aux entités ...", "shareToEntities" : "Partager aux entités ...",
"canManageFolder" : "Droit de modification / suppression du dossier", "canManageFolder" : "Droit de modification / suppression du dossier",
"searchMailInFolder" : "Rechercher des courriers dans le dossier",
}; };
...@@ -1082,4 +1082,5 @@ export const LANG_NL = { ...@@ -1082,4 +1082,5 @@ export const LANG_NL = {
"searchFolder" : "Search folder", //_TO_TRANSLATE "searchFolder" : "Search folder", //_TO_TRANSLATE
"shareToEntities" : "Share to entities ...", //_TO_TRANSLATE "shareToEntities" : "Share to entities ...", //_TO_TRANSLATE
"canManageFolder" : "Can manage this folder", //_TO_TRANSLATE "canManageFolder" : "Can manage this folder", //_TO_TRANSLATE
"searchMailInFolder" : "Search mails in folder", //_TO_TRANSLATE
}; };
...@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core'; ...@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
interface listProperties { interface listProperties {
'id': number, 'id': number,
'groupId': number, 'groupId': number,
'basketId': number, 'targetId': number,
'page': string, 'page': string,
'order': string, 'order': string,
'orderDir': string, 'orderDir': string,
...@@ -22,19 +22,21 @@ export class FiltersListService { ...@@ -22,19 +22,21 @@ export class FiltersListService {
listsProperties: any[] = []; listsProperties: any[] = [];
listsPropertiesIndex: number = 0; listsPropertiesIndex: number = 0;
filterMode: boolean = false; filterMode: boolean = false;
mode: string = 'basket';
constructor() { constructor() { }
this.listsProperties = JSON.parse(sessionStorage.getItem('propertyList'));
} initListsProperties(userId: number, groupId: number, targetId: number, mode: string) {
initListsProperties(userId: number, groupId: number, basketId: number) { this.listsProperties = JSON.parse(sessionStorage.getItem('propertyList' + mode));
this.listsPropertiesIndex = 0; this.listsPropertiesIndex = 0;
this.mode = mode;
let listProperties: listProperties; let listProperties: listProperties;
if (this.listsProperties != null) { if (this.listsProperties != null) {
this.listsProperties.forEach((element, index) => { this.listsProperties.forEach((element, index) => {
if (element.id == userId && element.groupId == groupId && element.basketId == basketId) { if (element.id == userId && element.groupId == groupId && element.targetId == targetId) {
this.listsPropertiesIndex = index; this.listsPropertiesIndex = index;
listProperties = element; listProperties = element;
} }
...@@ -47,7 +49,7 @@ export class FiltersListService { ...@@ -47,7 +49,7 @@ export class FiltersListService {
listProperties = { listProperties = {
'id': userId, 'id': userId,
'groupId': groupId, 'groupId': groupId,
'basketId': basketId, 'targetId': targetId,
'page': '0', 'page': '0',
'order': '', 'order': '',
'orderDir': 'DESC', 'orderDir': 'DESC',
...@@ -81,7 +83,7 @@ export class FiltersListService { ...@@ -81,7 +83,7 @@ export class FiltersListService {
} }
saveListsProperties() { saveListsProperties() {
sessionStorage.setItem('propertyList', JSON.stringify(this.listsProperties)); sessionStorage.setItem('propertyList' + this.mode, JSON.stringify(this.listsProperties));
} }
getUrlFilters() { getUrlFilters() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment