Schedule api changes and start button issue

This commit is contained in:
venbatechnologies@gmail.com 2020-10-16 12:04:41 +05:30
parent 13e858a4b0
commit 93b2911394
5 changed files with 47 additions and 34 deletions

View File

@ -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;

View File

@ -107,9 +107,9 @@
<div *ngFor="let status of addr.addtional_pd_data;let i=index">
<!-- <ion-button fill="clear" color="optblue" class="inprogress_btn"><i class="material-icons" style="font-size:24px;">where_to_vote</i></ion-button> -->
<!-- <button mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" ><mat-icon>where_to_vote</mat-icon></ion-button> -->
<mat-label *ngIf="status.scheduled_on != null" style="font-size:12px;color:gray">Scheduled On</mat-label><br/>
<mat-label *ngIf="status.vendor_scheduled_on != null" style="font-size:12px;color:gray">Scheduled On</mat-label><br/>
<ion-row size="12">
<ion-col size="7" class="ion-align-self-start" style="font-size: 14.5px;"><ion-icon *ngIf="status.scheduled_on != null" class="schdule_time" name="calendar"> </ion-icon> {{status.scheduled_on}}</ion-col>
<ion-col size="7" class="ion-align-self-start" style="font-size: 14.5px;"><ion-icon *ngIf="status.vendor_scheduled_on != null" class="schdule_time" name="calendar"> </ion-icon> {{status.vendor_scheduled_on}}</ion-col>
<!-- <ion-col size="5" class="ion-align-self-end" style="text-align: right"><ion-icon class="addressinfo" name="people"> </ion-icon> {{status.customer_segment_abbr}}</ion-col> -->
</ion-row>
<!-- <ion-row class="ion-justify-content-end"> -->
@ -145,7 +145,7 @@
<ion-row *ngIf="initiatedAccess || startedAccess">
<ion-row>
<ion-label><ion-icon name="calendar"></ion-icon> &nbsp; Scheduled On</ion-label><br/>
<ion-col size="12" class="cardinfo"> {{address_allocated_data.scheduled_on}}</ion-col>
<ion-col size="12" class="cardinfo"> {{address_allocated_data.vendor_scheduled_on}}</ion-col>
</ion-row>
</ion-row>
@ -390,7 +390,7 @@
</ion-col>
</ion-row>
<ion-row *ngIf="startedAccess">
<ion-row *ngIf="startedAccess || checkOtpAccess">
<ion-col size="12" style="padding:0px !important;">
<ion-button expand="full" color="tertiary" style="background-color: green !important;" (click)="checkOTP(applicatentDetails)">
Start</ion-button>

View File

@ -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()
{

View File

@ -58,8 +58,10 @@ export class LoadingProvider {
setTimeout(()=>{
console.log(this.loading)
if(this.loading) {
this.loading.dismiss()
},800)
}
})
}

View File

@ -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()