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 @@
</div>
</div>
<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 class="container" [class.fullContainer]="appService.getViewMode()">
......@@ -73,7 +77,7 @@
</mat-checkbox>
</span>
<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}}"
[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">
......@@ -103,7 +107,7 @@
</span>
<span class="main-info-data" style="font-weight:bold;flex:1;cursor:pointer;"
[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">
<button mat-icon-button title="{{lang.notes}}"
(click)="$event.stopPropagation();togglePanel('note',row)"
......
......@@ -20,6 +20,7 @@ import { PanelFolderComponent } from '../panel/panel-folder.component';
import { BasketHomeComponent } from '../../basket/basket-home.component';
import { ConfirmComponent } from '../../../plugins/modal/confirm.component';
import { FolderActionListComponent } from '../folder-action-list/folder-action-list.component';
import { FiltersListService } from '../../../service/filtersList.service';
declare function $j(selector: any): any;
......@@ -105,6 +106,7 @@ export class FolderDocumentListComponent implements OnInit {
public dialog: MatDialog,
private sanitizer: DomSanitizer,
private headerService: HeaderService,
public filtersListService: FiltersListService,
private notify: NotificationService,
public overlay: Overlay,
public viewContainerRef: ViewContainerRef,
......@@ -137,11 +139,14 @@ export class FolderDocumentListComponent implements OnInit {
this.headerService.setHeader('Dossier : ' + this.folderInfo.label);
});
this.basketUrl = '../../rest/folders/' + params['folderId'] + '/resources';
this.filtersListService.filterMode = false;
this.selectedRes = [];
this.sidenavRight.close();
window['MainHeaderComponent'].setSnav(this.sidenavLeft);
window['MainHeaderComponent'].setSnavRight(null);
this.listProperties = this.filtersListService.initListsProperties(this.headerService.user.id, 0, this.folderInfo.id, 'folder');
setTimeout(() => {
this.dragInit = false;
}, 1000);
......
......@@ -49,7 +49,7 @@ export class FolderActionListComponent implements OnInit {
open(x: number, y: number, row: any) {
//this.loadActionList();
//this.loadActionList(row.res_id);
// Adjust the menu anchor position
this.contextMenuPosition.x = x + 'px';
......@@ -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')
.subscribe((data: any) => {
if (data.actions.length > 0) {
this.actionsList = data.actions;
} else {
this.actionsList = [{
id: 0,
label_action: this.lang.noAction,
component: ''
}];
}
this.loading = false;
}, (err: any) => {
this.notify.handleErrors(err);
});
}
loadActionList(resId: number) {
this.http.get('../../rest/folders/' + this.currentFolderInfo.id + '/resources/' + resId + '/events').pipe(
tap((data) => {
console.log(data);
})
).subscribe();
}
lock() {
/* lock() {
this.currentLock = setInterval(() => {
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) => { });
......
......@@ -22,10 +22,10 @@
</div>
</div>
<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"
[selectedRes]="selectedRes" (toggleAllRes)="toggleAllRes($event)"
(refreshEventAfterAction)="refreshDaoAfterAction()" (refreshEvent)="refreshDao()">
[selectedRes]="selectedRes" [routeDatas]="'/rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + currentBasketInfo.groupId + '/baskets/' + currentBasketInfo.basketId + '/filters'" (toggleAllRes)="toggleAllRes($event)"
(refreshEventAfterAction)="refreshDaoAfterAction()" (refreshEvent)="refreshDao()" [title]="lang.searchMailInBasket">
</app-filters-tool>
</div>
</div>
......
......@@ -142,7 +142,7 @@ export class BasketListComponent implements OnInit {
window['MainHeaderComponent'].setSnav(this.sidenavLeft);
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(() => {
......
<div class="filtersContent">
<form [formGroup]="stateForm" class="filterTool">
<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()"
(keyup.enter)="metaSearch($event);">
<button mat-icon-button matPrefix>
......
......@@ -59,8 +59,9 @@ export class FiltersToolComponent implements OnInit {
isLoading: boolean = false;
@Input('listProperties') listProperties: any;
@Input('currentBasketInfo') currentBasketInfo: any;
@Input('title') title: string;
@Input('routeDatas') routeDatas: string;
@Input('snavR') sidenavRight: MatSidenav;
@Input('selectedRes') selectedRes: any;
@Input('totalRes') totalRes: number;
......@@ -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) => {
data.categories.forEach((element: any) => {
if (this.listProperties.categories.map((category: any) => (category.id)).indexOf(element.id) === -1) {
......
......@@ -1056,4 +1056,5 @@ export const LANG_EN = {
"searchFolder" : "Search folder",
"shareToEntities" : "Share to entities ...",
"canManageFolder" : "Can manage this folder",
"searchMailInFolder" : "Search mails in folder",
};
......@@ -1093,4 +1093,5 @@ export const LANG_FR = {
"searchFolder" : "Recherche un dossier",
"shareToEntities" : "Partager aux entités ...",
"canManageFolder" : "Droit de modification / suppression du dossier",
"searchMailInFolder" : "Rechercher des courriers dans le dossier",
};
......@@ -1082,4 +1082,5 @@ export const LANG_NL = {
"searchFolder" : "Search folder", //_TO_TRANSLATE
"shareToEntities" : "Share to entities ...", //_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';
interface listProperties {
'id': number,
'groupId': number,
'basketId': number,
'targetId': number,
'page': string,
'order': string,
'orderDir': string,
......@@ -22,19 +22,21 @@ export class FiltersListService {
listsProperties: any[] = [];
listsPropertiesIndex: number = 0;
filterMode: boolean = false;
mode: string = 'basket';
constructor() {
this.listsProperties = JSON.parse(sessionStorage.getItem('propertyList'));
}
constructor() { }
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.mode = mode;
let listProperties: listProperties;
if (this.listsProperties != null) {
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;
listProperties = element;
}
......@@ -47,7 +49,7 @@ export class FiltersListService {
listProperties = {
'id': userId,
'groupId': groupId,
'basketId': basketId,
'targetId': targetId,
'page': '0',
'order': '',
'orderDir': 'DESC',
......@@ -81,7 +83,7 @@ export class FiltersListService {
}
saveListsProperties() {
sessionStorage.setItem('propertyList', JSON.stringify(this.listsProperties));
sessionStorage.setItem('propertyList' + this.mode, JSON.stringify(this.listsProperties));
}
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