1 |
61381
|
k.triantaf
|
/*
|
2 |
|
|
import { Pipe, PipeTransform} from '@angular/core'
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
@Pipe({
|
6 |
|
|
name: 'claimsDatatable'
|
7 |
|
|
})
|
8 |
|
|
export class ClaimsDatatablePipe implements PipeTransform {
|
9 |
|
|
|
10 |
|
|
transform(array: any[], args: any[]): any {
|
11 |
|
|
let query: string = args[0];
|
12 |
|
|
let counter:any = args[1];
|
13 |
|
|
let active: any = args[2];
|
14 |
|
|
|
15 |
|
|
active.page = 1;
|
16 |
|
|
|
17 |
|
|
if (query) {
|
18 |
|
|
var result = array.filter(row=>this.filterAll(row, query));
|
19 |
|
|
counter.count = result.length;
|
20 |
|
|
return result;
|
21 |
|
|
}
|
22 |
|
|
return array;
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
filterAll(row: any, query: string) {
|
26 |
|
|
if(row.userMail.indexOf(query) > -1) {
|
27 |
|
|
return true;
|
28 |
|
|
}
|
29 |
|
|
if(row.targetType != 'project' && row.target.title.indexOf(query) > -1) {
|
30 |
|
|
return true;
|
31 |
|
|
}
|
32 |
|
|
if(row.sourceType != 'project' && row.source.title.indexOf(query) > -1) {
|
33 |
|
|
return true;
|
34 |
|
|
}
|
35 |
|
|
if(row.date.indexOf(query) > -1) {
|
36 |
|
|
return true;
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
if(row.curatedBy != null && row.curatedBy.indexOf(query) > -1) {
|
40 |
|
|
return true;
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
if(row.curationDate != null && row.curationDate.indexOf(query) > -1) {
|
44 |
|
|
return true;
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
return false;
|
48 |
|
|
}
|
49 |
|
|
}
|
50 |
|
|
*/
|