diff --git a/src/app/pages/jobpastdue/jobpastdue.page.ts b/src/app/pages/jobpastdue/jobpastdue.page.ts index b50a214..41275d3 100644 --- a/src/app/pages/jobpastdue/jobpastdue.page.ts +++ b/src/app/pages/jobpastdue/jobpastdue.page.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import {NavController} from "@ionic/angular"; +import {AlertController, NavController} from "@ionic/angular"; import {Router} from "@angular/router"; import {SessionDataProviderService} from "../../store/session-data-provider.service"; import {WrenchService} from "../../services/wrench.service"; @@ -18,6 +18,7 @@ export class JobpastduePage implements OnInit { constructor( private navctr: NavController, private router: Router, + private alertController:AlertController, public sessionDataProviderService: SessionDataProviderService, private wrenchService: WrenchService ) { @@ -36,10 +37,108 @@ export class JobpastduePage implements OnInit { this.navctr.back(); } - extendJobDueDate(){ + pendingActionResult:string=''; + reqData: { + action:number, + member_id: number, + uid: string, + sessionid: string, + contract: string, + contract_uid: string, + job_action: string, + extension:number, + reason:string + }; + async extendJobDueDate(){ + this.reqData = { + action:14015, + member_id: this.sessionDataProviderService.member_id, + uid: this.sessionDataProviderService.member_uid, + sessionid: this.sessionDataProviderService.session, + contract: this.jobData.contract_uid, + contract_uid: this.jobData .contract_uid, + job_action: 'EXTEND_TIMELINE', + extension: 2, + reason:'' + }; + + //debugger; + + const alert = await this.alertController.create({ + header: "Extend Timeline", + message: "Confirm you are ready to extend timeline now ?", + buttons: [ + { + text: "Cancel", + role: "cancel", + handler: () => { + }, + }, + { + text: "Extend Now", + handler: () => { + this.wrenchService.activeJobStatus(this.reqData).subscribe( + res => { + if (res?.internal_return > 0){ + this.pendingActionResult = "Task due was extended 2 days from today"; + setTimeout(()=>{ + this.pendingActionResult =''; + },3000); + } + } + ); + + }, + }, + ], + }); + await alert.present(); } - cancelThisJob(){ + async cancelThisJob(){ + this.reqData = { + action:14015, + member_id: this.sessionDataProviderService.member_id, + uid: this.sessionDataProviderService.member_uid, + sessionid: this.sessionDataProviderService.session, + contract: this.jobData.contract_uid, + contract_uid: this.jobData .contract_uid, + job_action: 'CANCEL_ACTIVEJOB', + extension: 2, + reason:'' + }; + + //debugger; + + const alert = await this.alertController.create({ + header: "Cancel Job", + message: "Confirm you are cancel this job now ?", + buttons: [ + { + text: "Cancel", + role: "cancel", + handler: () => { + }, + }, + { + text: "Cancel Now", + handler: () => { + this.wrenchService.activeJobStatus(this.reqData).subscribe( + res => { + if (res?.internal_return > 0){ + this.pendingActionResult = "Task due was extended 2 days from today"; + setTimeout(()=>{ + this.pendingActionResult =''; + },3000); + } + } + ); + + }, + }, + ], + }); + await alert.present(); } }