From 93b2911394ded20def740a446af9276208482d1a Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Fri, 16 Oct 2020 12:04:41 +0530 Subject: [PATCH] Schedule api changes and start button issue --- src/app/pages/authentication/auth/auth.ts | 2 +- src/app/pages/pd/input/input.html | 8 +-- src/app/pages/pd/input/input.ts | 65 ++++++++++++--------- src/app/services/common-provider/loading.ts | 4 +- src/app/services/constants/constants.ts | 2 +- 5 files changed, 47 insertions(+), 34 deletions(-) diff --git a/src/app/pages/authentication/auth/auth.ts b/src/app/pages/authentication/auth/auth.ts index e724414..ac71e06 100755 --- a/src/app/pages/authentication/auth/auth.ts +++ b/src/app/pages/authentication/auth/auth.ts @@ -50,7 +50,7 @@ pin:any; } getuserDetails() { - this.loadingCtrl.pdloader('loading...'); + // this.loadingCtrl.pdloader('loading...'); let userid = this.aws.getlocale(); this.aws.getuserprofile(userid).subscribe(res=>{ this.userDetails = res; diff --git a/src/app/pages/pd/input/input.html b/src/app/pages/pd/input/input.html index 72a7a32..122ac56 100755 --- a/src/app/pages/pd/input/input.html +++ b/src/app/pages/pd/input/input.html @@ -107,9 +107,9 @@
- Scheduled On
+ Scheduled On
- {{status.scheduled_on}} + {{status.vendor_scheduled_on}} @@ -145,7 +145,7 @@   Scheduled On
- {{address_allocated_data.scheduled_on}} + {{address_allocated_data.vendor_scheduled_on}}
@@ -390,7 +390,7 @@ - + Start diff --git a/src/app/pages/pd/input/input.ts b/src/app/pages/pd/input/input.ts index 9f69ce0..15b46a7 100755 --- a/src/app/pages/pd/input/input.ts +++ b/src/app/pages/pd/input/input.ts @@ -297,7 +297,7 @@ checkOtpAccess:boolean = false; if(this.address_allocated_data != '' && this.address_allocated_data !=undefined){ let courrentDateTime: string = this.pipe.transform(new Date(), 'yyyy-MM-dd HH:mm'); - let scheduledDateTime: string=this.address_allocated_data.scheduled_on_for_validation; + let scheduledDateTime: string=this.address_allocated_data.vendor_scheduled_on_validation; let diffInMs: number = Date.parse(courrentDateTime) - Date.parse(scheduledDateTime); let diffInHours: number = Math.floor(diffInMs / 1000 / 60 / 60); console.log(diffInHours); @@ -365,16 +365,18 @@ checkOtpAccess:boolean = false; pdschedule(scheduledate,appdetails) { - let data :any;let param : any; + // let data :any; + let param : any; if(scheduledate != undefined){ let schDate = scheduledate.slice(0,19).replace('T',' '); - data = {'pd_id':this.address_pd_id,'vendor_status':'SCHEDULED','scheduled_on':schDate,'fk_updatedby':this.users,'updatedon':currentdate,'random_string':this.applicatentDetails.random_string}; + // data = {'pd_id':this.address_pd_id,'vendor_status':'SCHEDULED','scheduled_on':schDate,'fk_updatedby':this.users,'updatedon':currentdate,'random_string':this.applicatentDetails.random_string}; // this.pdDetails.updatepdStatus(data).subscribe(res=> //sample format : fk_pd_id: "868", schedule_time: "2019-05-30 18:51", fk_scheduled_by: "165"; - param = {'fk_pd_id': this.address_pd_id, 'schedule_time':schDate, 'fk_scheduled_by': this.users,app_client:"3"} - this.pdDetails.updateSchedule(param).subscribe(res=> + // param = {'fk_pd_id': this.address_pd_id, 'schedule_time':schDate, 'fk_scheduled_by': this.users,app_client:"3"} + param ={"pd_id": this.address_pd_id,"vendor_status":"SCHEDULED","vendor_scheduled_on":schDate,"fk_updatedby":this.users} + this.pdDetails.updatepdStatus(param).subscribe(res=> { this.updateSchedule = res; if(this.updateSchedule.dataStatus == true) @@ -621,7 +623,7 @@ checkOtpAccess:boolean = false; this.geolocation.getCurrentPosition().then((resp) => { this.currentPosPDofficer = resp.coords.latitude+","+resp.coords.longitude; - + // this.loading.pdloader("Please wait...") this.pdDetails.updatepdStatus(data).subscribe(res=> { this.updatestarted = res; @@ -631,21 +633,25 @@ if(this.updatestarted.dataStatus == true) //clearInterval(this.timeInterval); //this.navCtrl.setRoot(OtpPage,{'pdDetails':appdetails}); - this.getNewpdupdate(); +// this.getNewpdupdate(); this.startedAccess=false -// this.checkOtpAccess=true + this.checkOtpAccess=true this.startPdDiscussion() } else{ this.checkOtpAccess=false + // this.loading.dismissLoader() } -},err=>alert(JSON.stringify(err))); +},err=>{alert(JSON.stringify(err)); + // this.loading.dismissLoader() +}); // console.log('Buy clicked'); },err=>{ alert("Cordova Error " +JSON.stringify(err)) this.updateStartedStatus(data) + // this.loading.dismissLoader() }) } @@ -675,21 +681,21 @@ else{ { // let data:any; - let alert = await this.alertCtrl.create({ - header: 'Start Discussion', - message: 'Are you starting the Discussion', - buttons: [ - { - text: 'No', - role: 'cancel', - handler: () => { + // let alert = await this.alertCtrl.create({ + // header: 'Start Discussion', + // message: 'Are you starting the Discussion', + // buttons: [ + // { + // text: 'No', + // role: 'cancel', + // handler: () => { - } - }, - { - text: 'YES', - handler: () => { + // } + // }, + // { + // text: 'YES', + // handler: () => { // this.geolocation.getCurrentPosition().then((resp) => { // this.currentPosPDofficer = resp.coords.latitude+","+resp.coords.longitude; @@ -730,13 +736,16 @@ else{ pdDetails:pdValues } } + this.loading.dismissLoader() this.navCtrl.navigateForward('/pd/OtpPage',navigationExtras); } else{ let data:any; data = {'pd_id':this.address_pd_id,'vendor_status':"INPROGRESS",'fk_updatedby':this.users,'updatedon':currentdate,'random_string':this.applicatentDetails.random_string}; this.pdDetails.updatepdStatus(data).subscribe(res=>{ + // this.loading.dismissLoader() if(res['dataStatus']){ + // this.loading.dismissLoader() let navigationExtras:NavigationExtras={ state:{ pdDetails:pdValues, @@ -754,13 +763,15 @@ else{ else{ this.toast.pdTriggerappmessage("Something went wrong") } + },err=>{ + // this.loading.dismissLoader() }) } - } - } - ] - }); - await alert.present(); + // } + // } + // ] + // }); + // await alert.present(); } getNewpdupdate() { diff --git a/src/app/services/common-provider/loading.ts b/src/app/services/common-provider/loading.ts index 28bc6b7..2d76fdb 100755 --- a/src/app/services/common-provider/loading.ts +++ b/src/app/services/common-provider/loading.ts @@ -58,8 +58,10 @@ export class LoadingProvider { setTimeout(()=>{ console.log(this.loading) + if(this.loading) { this.loading.dismiss() - },800) + } + }) } diff --git a/src/app/services/constants/constants.ts b/src/app/services/constants/constants.ts index d62411e..238481f 100755 --- a/src/app/services/constants/constants.ts +++ b/src/app/services/constants/constants.ts @@ -93,7 +93,7 @@ public commonimage = "http://pdgenie.com/logo/avatar.jpg"; officeruserPoolId:'ap-south-1_qQ85yQZJO', officerclientId:'2o5c3cs9k3als16nqhp3irh8rs' //for mobile } - return production; + return testing; } getcurrentDate()