130 lines
4.1 KiB
TypeScript
130 lines
4.1 KiB
TypeScript
import { Router } from '@angular/router';
|
|
import { Component, OnInit } from '@angular/core';
|
|
import { WrenchService } from 'src/app/services/wrench.service';
|
|
import {SessionDataProviderService} from "../../store/session-data-provider.service";
|
|
|
|
@Component({
|
|
selector: 'app-mytasks',
|
|
templateUrl: './mytasks.page.html',
|
|
styleUrls: ['./mytasks.page.scss'],
|
|
})
|
|
export class MytasksPage implements OnInit {
|
|
|
|
|
|
tabs: any = 'tasks';
|
|
|
|
active_job_count:number =0;
|
|
pastdue_job_count:number =0;
|
|
review_job_count:number =0;
|
|
|
|
|
|
constructor(
|
|
private router: Router,
|
|
public sessionDataProviderService: SessionDataProviderService,
|
|
private wrenchService: WrenchService
|
|
) { }
|
|
|
|
ngOnInit() {
|
|
// debugger;
|
|
this.getJobsData();
|
|
// this.getPastDueJobsData();
|
|
// this.getInReviewJobsData();
|
|
}
|
|
|
|
onCall() {
|
|
this.router.navigate(['call']);
|
|
}
|
|
|
|
onMessage() {
|
|
this.router.navigate(['message']);
|
|
}
|
|
activeSeleted(item) {
|
|
this.router.navigate(['activetask'],{state: item});
|
|
}
|
|
|
|
usrData: {
|
|
action:number,
|
|
member_id: number,
|
|
uid: string, sessionid: string,
|
|
limit:20,
|
|
page:0,
|
|
offset: 0,
|
|
job_mode: string,
|
|
allstatus: number
|
|
};
|
|
|
|
jobsTotalData:any;
|
|
jobsData: [];
|
|
getJobsData(){
|
|
|
|
this.usrData = {
|
|
action:11200,
|
|
member_id: this.sessionDataProviderService.member_id,
|
|
uid: this.sessionDataProviderService.member_uid,
|
|
sessionid: this.sessionDataProviderService.session ,
|
|
limit:20,
|
|
page:0,
|
|
offset:0,
|
|
job_mode: 'ACTIVE',
|
|
allstatus: 100
|
|
}
|
|
this.wrenchService.getMyActiveJobsData(this.usrData).subscribe(
|
|
jobsTotalData => {
|
|
this.jobsTotalData = jobsTotalData;
|
|
console.log("getMyActiveJobsData RETURN->", this.jobsTotalData);
|
|
|
|
let AllResult = this.jobsTotalData.result_list;;
|
|
this.jobsData = AllResult.filter((item) => item.status_description == 'ACTIVE')
|
|
this.jobsPastDueData =AllResult.filter((item) => item.status_description == 'PASTDUE')
|
|
this.jobsInReviewData =AllResult.filter((item) => item.status_description == 'REVIEW')
|
|
this.active_job_count = this.jobsData.length;
|
|
this.review_job_count = this.jobsInReviewData.length;
|
|
this.pastdue_job_count = this.jobsPastDueData.length;
|
|
// debugger;
|
|
}
|
|
);
|
|
}
|
|
|
|
jobsTotalPastDueData:any;
|
|
jobsPastDueData: [];
|
|
// getPastDueJobsData(){
|
|
//
|
|
// this.usrData = {action:11200, member_id: this.sessionDataProviderService.member_id, uid: this.sessionDataProviderService.member_uid,
|
|
// sessionid: this.sessionDataProviderService.session , limit:20, page:0, offset:0, job_mode: 'PASTDUE'}
|
|
// this.wrenchService.getMyActiveJobsData(this.usrData).subscribe(
|
|
// jobsTotalPastDueData => {
|
|
// this.jobsTotalPastDueData = jobsTotalPastDueData;
|
|
// console.log("PAST DUE TOTAL RETURN->", this.jobsTotalPastDueData);
|
|
// this.jobsPastDueData = this.jobsTotalPastDueData.result_list;
|
|
// // debugger;
|
|
// console.log("PAST DUE JOBS RETURN DATA->", this.jobsPastDueData);
|
|
// // this.blogDataService.setBlogData(this.blogResult.blog_data);
|
|
// }
|
|
// );
|
|
//
|
|
// }
|
|
|
|
jobsTotalInReviewData:any;
|
|
jobsInReviewData: [];
|
|
// getInReviewJobsData(){
|
|
//
|
|
// this.usrData = {action:11200,
|
|
// member_id: this.sessionDataProviderService.member_id,
|
|
// uid: this.sessionDataProviderService.member_uid,
|
|
// sessionid: this.sessionDataProviderService.session ,
|
|
// limit:20, page:0, offset:0, job_mode: 'REVIEW'}
|
|
// this.wrenchService.getMyActiveJobsData(this.usrData).subscribe(
|
|
// jobsTotalInReviewData => {
|
|
// this.jobsTotalInReviewData = jobsTotalInReviewData;
|
|
// console.log("JOBS IN REVIEW TOTAL RETURN->", this.jobsTotalInReviewData);
|
|
// this.jobsInReviewData = this.jobsTotalInReviewData.result_list;
|
|
// // debugger;
|
|
// console.log("JOBS IN REVIEW RETURN DATA->", this.jobsInReviewData);
|
|
// // this.blogDataService.setBlogData(this.blogResult.blog_data);
|
|
// }
|
|
// );
|
|
//
|
|
// }
|
|
|
|
}
|