diff --git a/tasklist/src/pages/detailTask/detailTask.html b/tasklist/src/pages/detailTask/detailTask.html index 87457a6..0865eda 100644 --- a/tasklist/src/pages/detailTask/detailTask.html +++ b/tasklist/src/pages/detailTask/detailTask.html @@ -17,6 +17,7 @@ +

Id: {{task.id}}

{{ task.name }} diff --git a/tasklist/src/pages/listProject/listProject.html b/tasklist/src/pages/listProject/listProject.html index ddf1e62..f6451c7 100644 --- a/tasklist/src/pages/listProject/listProject.html +++ b/tasklist/src/pages/listProject/listProject.html @@ -15,11 +15,18 @@ + + + + + Id + + - {{item.name}} + #{{item.id}} {{item.name}} diff --git a/tasklist/src/pages/listProject/listProject.ts b/tasklist/src/pages/listProject/listProject.ts index 1889eb1..c3fb7cc 100644 --- a/tasklist/src/pages/listProject/listProject.ts +++ b/tasklist/src/pages/listProject/listProject.ts @@ -15,6 +15,8 @@ import { Project } from '../../models/projectModel'; export class ListProject { items: Array; + searchTerm: string = ''; + searchId: string = ''; constructor( public navCtrl: NavController, @@ -68,7 +70,16 @@ export class ListProject { getDataFromApi() { this.projectService.listProjects().subscribe( response => { - this.items = response.json().map(p => new Project(p) ); + this.items = response.json().map(p => new Project(p) ).filter((item) => { + if (this.searchId != "") + { + if(item.id != this.searchId) + { + return false; + } + } + return item.name.toLowerCase().indexOf(this.searchTerm.toLowerCase()) > -1; + });; }, err => { let toast = this.toastCtrl.create({ diff --git a/tasklist/src/pages/listTask/listTask.html b/tasklist/src/pages/listTask/listTask.html index c875bc3..64aff33 100644 --- a/tasklist/src/pages/listTask/listTask.html +++ b/tasklist/src/pages/listTask/listTask.html @@ -18,15 +18,54 @@ + + + + + + + + Id + + + + Status + + All + Open + Closed + + + + Priority + + All + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + + Assigned to + +

- {{item.name}} + #{{item.id}} {{item.name}}

- {{item.name}} + #{{item.id}} {{item.name}}

{{item.description}}

diff --git a/tasklist/src/pages/listTask/listTask.ts b/tasklist/src/pages/listTask/listTask.ts index ff2fea9..e40e4ae 100644 --- a/tasklist/src/pages/listTask/listTask.ts +++ b/tasklist/src/pages/listTask/listTask.ts @@ -25,7 +25,6 @@ import {Project} from '../../models/projectModel'; }) export class PopOverPage { constructor(private navParams: NavParams) { } - } @@ -37,6 +36,13 @@ export class PopOverPage { export class ListTask { items: Array; project: Project; + searchId: string = ''; + searchName: string = ''; + searchDone: string = 'all'; + searchPriority: string = 'all'; + searchAssigned: string = ''; + showFilter: boolean = false; + isPriorityFiltered: boolean = false; constructor( public navCtrl: NavController, @@ -57,7 +63,43 @@ export class ListTask { getDataFromApi(){ this.taskService.getTasksByProject(this.project.id).subscribe( response => { - this.items = response.json().map(t => new Task(t)); + this.items = response.json().map(t => new Task(t)).filter((item) => { + if (this.searchPriority != "all") { + if (item.priority != this.searchPriority) { + return false; + } + } + if (this.searchDone == "done" && item.done != true) { + return false; + } + else if (this.searchDone == "notDone" && item.done != false) { + return false; + } + if (this.searchId != "") + { + if(item.id != this.searchId) + { + return false; + } + } + if (this.searchAssigned != "") + { + console.log(typeof item.assigned); + console.log(typeof item.assigned.username); + if("undefined" != typeof item.assigned.username) + { + if(item.assigned.username.toLowerCase().indexOf(this.searchAssigned.toLowerCase()) == -1) + { + return false; + } + } + else + { + return false; + } + } + return item.name.toLowerCase().indexOf(this.searchName.toLowerCase()) > -1; + }); }, err => { let toast = this.toastCtrl.create({