Fairoj : image uploading handled and some issue fixes

This commit is contained in:
venbatechnologies@gmail.com 2019-11-29 20:24:33 +05:30
parent af28503976
commit efdf96c4c7
35 changed files with 552 additions and 1267 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.sineedge.pdgenie" version="0.0.20" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="com.sineedge.pdgenie" version="0.0.21" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>PD Genie Officer </name>
<description>info@pdgenie.com</description>
<author email="info@pdgenie.com" href="https://pdgenie.com">PD Genie</author>

View File

@ -83,19 +83,31 @@
<label style="font-size:14px;color:gray">Newly Captured Pics</label><hr/><br/>
<ion-row>
<ion-col col-6 *ngFor="let image of imageBucket; let i=index" no-padding>
<!-- <ion-row> -->
<ion-col col-8>
<img src="{{image.image}}" imageViewer class="doc-image-bucket"><br/>
<label *ngIf="image.Name != ''"><strong>{{image.Name}}</strong></label>
<label *ngIf="image.Name != ''"><strong>{{image.Name}}</strong> </label>
<input #focusName *ngIf="image.Name ==''" width="20px" ion-input type="text" placeholder="Document Name" (blur)="changeNameForBucket($event.target.value,i,image.image)">
<div *ngIf="pdDetails.form_id == '5'">
<label *ngIf="image.is_show_report == 1"><small>Showned on Report</small></label>
<br/>
<mat-radio-group aria-label="Select an option" (change)="changeOptions($event.value,i)">
<!-- <input #focusName *ngIf="image.Name ==''" width="20px" ion-input type="text" placeholder="Document Name" (blur)="changeNameForBucket($event.target.value,i,image.image)"> -->
<span *ngIf="pdDetails.form_id == '5' && image.is_show_report == 1">
<br/> <label *ngIf="image.is_show_report == 1"><small>Showned on Report</small></label>
<!-- <mat-radio-group aria-label="Select an option" (change)="changeOptions($event.value,i)">
<mat-radio-button value=1>Shown On Report</mat-radio-button>
<mat-radio-button value=0>Hide On Report</mat-radio-button>
</mat-radio-group>
</div>
<button float-right ion-button clear color="optblue" (click)="removeImgForBucket(i)"><ion-icon style="font-size:22px" name="md-trash"></ion-icon></button>
</mat-radio-group> -->
</span>
</ion-col>
<ion-col col-2>
<span *ngIf="image.isLoader && !image.isSaved" style="text-align: end;float:right;"><ion-spinner color="optblue" style="height: 24px;width: 24px" name="crescent" ></ion-spinner></span>
<span *ngIf="image.isSaved && image.isLoader == false" style="text-align: end;float:right;"><ion-icon style="margin-right: 3px;font-size: 20px;color: mediumseagreen;" name="checkmark"></ion-icon></span>
<span *ngIf="!image.isSaved && !image.isLoader" style="float:right;"><button ion-button clear (click)="reSendImage(image,i)"> <ion-icon style="margin-right:5px;font-size: 34px;color: orange;" name="cloud-upload"></ion-icon></button><br>
<label style="font-size: 8px;text-align: center;position: relative;
bottom: 15px;
left: 5px;">Click to Upload</label> </span>
</ion-col>
<!-- <button float-right ion-button clear color="optblue" (click)="removeImgForBucket(i)"><ion-icon style="font-size:22px" name="md-trash"></ion-icon></button> -->
<!-- </ion-row> -->
</ion-col>
<hr/>
</ion-row>

View File

@ -7,6 +7,7 @@ import { LoadingProvider } from '../../providers/common-provider/loading';
import { ConstantsProvider } from '../../providers/constants/constants';
import * as watermark from 'watermarkjs'
import { ImageNameModelPage } from '../Modal/image-name-model/image-name-model';
import { StorageProvider } from '../../providers/storage/storage';
/**
* Generated class for the PdGeneralImagesPage page.
@ -36,7 +37,7 @@ export class PdGeneralImagesPage {
geoCoordinates:any='-';
@Output() imageDatalength_forParent = new EventEmitter<any>();
constructor(public navCtrl: NavController, public navParams: NavParams,public camera:CameraProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider,private loading:LoadingProvider,private cameraProvider:CameraProvider,private constant:ConstantsProvider,private modalCtrl:ModalController) {
constructor(public navCtrl: NavController, public navParams: NavParams,public camera:CameraProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider,private loading:LoadingProvider,private cameraProvider:CameraProvider,private constant:ConstantsProvider,private modalCtrl:ModalController,private ionicStorageProvider:StorageProvider) {
// this.applicatentDetails = this.navParams.get('pdDetails');
@ -48,6 +49,7 @@ export class PdGeneralImagesPage {
this.pdDetails=this.pd_values
console.log("ionViewDidEnter",this.pdDetails)
this.getPDImages()
this.getPDImagesFromLocal()
console.log("avctrl",this.navCtrl)
}
@ -92,7 +94,7 @@ export class PdGeneralImagesPage {
/*IMAGE SECTION*/
getPDImages(){
//FOR RETRIEVING PICTURES
this.imageDisplay=[]
// this.imageDisplay=[]
let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.pdDetails.form_id,'company_id':this.pdDetails.company_id,'rental_count_id':this.pdDetails.hasOwnProperty('rental_count_id') ?this.pdDetails.rental_count_id : null,'is_common':this.pdDetails.form_id == null ? 1 : null }
this.qustCat.getPDImages(record_for_pic).subscribe(val=>{
if(!val['msg']){
@ -110,13 +112,75 @@ export class PdGeneralImagesPage {
}
})
console.log("dis",this.imageDisplay);
//FOR TESTING PURPOSE
// this.imageBucket=[]
// let dis=this.imageDisplay.splice(1,1);
// // let dis3=this.imageDisplay.splice(1,1);
// dis[0].isLoader=true
// dis[0].isSaved=false
// // dis3[0].isLoader=true
// // dis3[0].isSaved=false
// // dis3[0].Name="ffRR"
// let dis1=this.imageDisplay.splice(0,1);
// dis1[0].isLoader=true
// dis1[0].isSaved=false
// dis1[0].Name="Approach to PD Location 11-12-19 Pictures"
// // let dis4=this.imageDisplay.splice(0,1);
// // dis4[0].isLoader=true
// // dis4[0].isSaved=false
// // dis4[0].Name="Sample chekc"
// this.imageBucket.push(dis[0])
// this.imageBucket.push(dis1[0])
// // this.imageBucket.push(dis3[0])
// // this.imageBucket.push(dis4[0])
// console.log("buckins",this.imageBucket)
// setTimeout(()=>{
// this.sendImage(dis[0])
// console.log("First api called",dis)
// },7000)
// setTimeout(()=>{
// this.sendImage(dis1[0])
// console.log("Second api called",dis1)
// },4000)
let imageData={imageDisplay:this.imageDisplay,imageBucket:this.imageBucket}
this.imageDatalength_forParent.emit(imageData)
}
}
})
}
getPDImagesFromLocal(){
this.ionicStorageProvider.getItem('pd_images').then(loc_result=>{
if(loc_result){
let local_bucket=loc_result.filter(val=>val.form_id == this.pdDetails.form_id)
console.log("local bu",local_bucket)
if(local_bucket.length > 0){
this.imageBucket=local_bucket[0].form_value
let check_status=this.imageBucket.filter(val=>val.isSaved == false && val.isLoader == false)
if(check_status.length > 0){
this.toast.pdTriggerappmessage("Some Images are not saved. click the upload to Save")
}
}
}
})
}
reSendImage(img_data,index){
img_data.isLoader=true;
this.imageBucket[index].isLoader=true;
this.sendImage(img_data);
}
capture(value?) {
console.log("value", value)
//FOR CAPTURING PICS
this.cameraProvider.getpicture().then(res => {
@ -133,12 +197,14 @@ export class PdGeneralImagesPage {
this.geoCoordinates=localStorage.getItem('current_coordinates')
this.cameraProvider.addWatermarks(res).then(watermarkedImage=>{
let bucket_value: any;
let bucket_value: any=[];
if (this.pdDetails.form_id != "5") {
bucket_value = {
'image': watermarkedImage,
'Name': '',
'link': this.geoCoordinates,
'isLoader':true,
'isSaved':false
}
}
else {
@ -148,7 +214,9 @@ export class PdGeneralImagesPage {
'image': watermarkedImage,
'Name': '',
'link': this.geoCoordinates,
'is_show_report': ''
'is_show_report': '',
'isLoader':true,
'isSaved':false
}
}
@ -162,13 +230,13 @@ export class PdGeneralImagesPage {
}
bucket_value.Name = value
this.imageBucket.push(bucket_value)
this.sendImage()
this.sendImage(bucket_value)
// this.imageBucket.push(bucket_value);
})
}else if(this.pdDetails.form_id == '5' && value && value != '' && value != undefined){
bucket_value.Name=value
this.imageBucket.push(bucket_value)
this.modalForImageDet(value)
this.modalForImageDet(value,bucket_value)
return
}
else{
@ -177,7 +245,7 @@ export class PdGeneralImagesPage {
bucket_value.Name = value
this.imageBucket.push(bucket_value)
this.sendImage()
this.sendImage(bucket_value)
// this.imageBucket.push({ 'image': res, 'Name': value, 'link': geoCoordinates });
// this.cardLast.nativeElement.scrollIntoView({behavior:"smooth",block:"start"})
return
@ -207,7 +275,7 @@ export class PdGeneralImagesPage {
// }
//
// })
this.modalForImageDet('')
this.modalForImageDet('',bucket_value)
}
// this.loading.dismissLoader()
})
@ -217,7 +285,7 @@ export class PdGeneralImagesPage {
console.log("Camera Error ", JSON.stringify(error));
})
}
modalForImageDet(doc_name?){
modalForImageDet(doc_name?,bucket_value?){
const modalOption:ModalOptions={
cssClass:'imageNameModal'
}
@ -227,12 +295,14 @@ export class PdGeneralImagesPage {
modalCtrl.onDidDismiss((data)=>{
console.log("Image Data",data);
if(data){
bucket_value.Name=data.doc_name
this.imageBucket[this.imageBucket.length - 1].Name = data.doc_name
if(this.pdDetails.form_id == '5'){
bucket_value.is_show_report=data.is_show_report
this.imageBucket[this.imageBucket.length - 1].is_show_report = data.is_show_report
}
}
this.sendImage();
this.sendImage(bucket_value);
// this.cardLast.nativeElement.scrollIntoView({behavior:"smooth",block:"start"})
})
}
@ -283,35 +353,94 @@ export class PdGeneralImagesPage {
})
}
sendImage(){
// this.loading.loaderForSendImage()
// console.log("ll",JSON.stringify(this.imageBucket));
let records:any={
sendImageDummy(bucket_value){
let records:any=[]
let loca_buck:any=[]
loca_buck=bucket_value
records={
'pd_id':this.pdDetails.pd_id,
'formid':this.pdDetails.form_id,
'images':this.imageBucket,
'images':loca_buck,
'company_id':this.pdDetails.company_id,
'rental_count_id':this.pdDetails.rental_count_id,
}
// console.log("records",JSON.stringify(records))
setTimeout(()=>{
console.log("bb",loca_buck,this.imageBucket,records.images);
this.imageBucket.forEach(val=>{
console.log("response",val)
if(loca_buck[0].Name == val.Name){
val.isLoader=false;
val.isSaved=true
return val
}
})
},2000)
}
sendImage(bucket_value){
let local_bucket:any=[]
local_bucket.push(bucket_value)
this.cardLast.nativeElement.scrollIntoView({behavior:"smooth",block:"start"})
// this.loading.loaderForSendImage()
// console.log("ll",JSON.stringify(this.imageBucket));
let records:any=[]
records={
'pd_id':this.pdDetails.pd_id,
'formid':this.pdDetails.form_id,
'images':local_bucket,
'company_id':this.pdDetails.company_id,
'rental_count_id':this.pdDetails.rental_count_id,
}
// this.imageBucket=[]
console.log("records",JSON.stringify(records))
this.qustCat.savePDImages(records).subscribe(res=>{
if(res['dataStatus']== true){
this.toast.pdTriggerappmessage(this.imageBucket[0].Name+" Saved Successfully")
let imageData={imageDisplay:this.imageDisplay,imageBucket:this.imageBucket}
this.imageDatalength_forParent.emit(imageData)
// local_arr.forEach(val=>{
// if(val.Name == this.)
// })
console.log("bb",local_bucket);
this.imageBucket.forEach(val=>{
if(local_bucket[0].Name == val.Name){
val.isLoader=false;
val.isSaved=true
return val
}
})
console.log("response",this.imageBucket)
// let img_name=records.images[0].Name
// this.imageBucket[0].Name
// this.toast.pdTriggerappmessage(img_name+" Saved Successfully")
// this.imageDisplay.push(this.imageBucket)
// console.log("length",this.imageDisplay.length)
this.imageBucket=[]
this.getPDImages();
this.cardLast.nativeElement.scrollIntoView({behavior:"smooth",block:"start"})
// this.getPDImages();
// this.cardLast.nativeElement.scrollIntoView({behavior:"smooth",block:"start"})
}
else{
this.toast.pdTriggerappmessage('Something went wrong');
this.imageBucket.forEach(val=>{
if(local_bucket[0].Name == val.Name){
val.isLoader=false;
val.isSaved=false;
return val
}
})
}
// this.loading.dismissLoader();
},err=>{
// this.loading.dismissLoader();
this.toast.pdTriggerappmessage("Network Error")
this.imageBucket.forEach(val=>{
if(local_bucket[0].Name == val.Name){
val.isLoader=false;
val.isSaved=false;
return val
}
})
})
}
@ -359,7 +488,17 @@ export class PdGeneralImagesPage {
ngOnDestroy($event){
console.log("Destroy event called")
console.log("leave")
console.log("leave",this.imageBucket.filter(val=>val.isSaved == false))
let unSavedImages:any=[]
unSavedImages.img_bucket=this.imageBucket.filter(val=>val.isSaved == false)
if(unSavedImages.img_bucket.length > 0){
unSavedImages.storage_key="pd_images"
unSavedImages.form_id=this.pdDetails.form_id //Storage Key
this.ionicStorageProvider.insertPDImageLocally(unSavedImages);
}
// let imageData={imageDisplay:this.imageDisplay,imageBucket:this.imageBucket}
// this.imageDatalength_forParent.emit(imageData)
// if (this.imageBucket.length > 0) {
// return new Promise((resolve, reject) => {
// let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")

View File

@ -102,7 +102,7 @@ searchitem:any;
ionViewCanEnter()
{
this.getcategoryList();
this.viewCtrl.dismiss();
// this.viewCtrl.dismiss();
}
ionViewCanLeave(){
// this.storage.clearItem('qc_notes')

View File

@ -87,7 +87,7 @@ export class PdQuestionAddressPage {
base64: string;
imageBucket: any=[];
tab:string='0';
imageDisplay: any=[];
private imageDisplay: any=[];
public data$:Observable<any>
timer:any;
alertnativeCityData: any=[];
@ -330,67 +330,12 @@ countRowsForTextarea(text){
ionViewCanLeave(){
// this.timer.unsubscribe();
if(this.pdQuestionAddress.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Form is Modified","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
//For Inserting the data locally
// this.localInsert(true);
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
}
ionViewCanLeave(){
// this.timer.unsubscribe();
if(this.pdQuestionAddress.dirty){
return this.constant.chekAlertOnLeave()
}
}
/** To Get City And Pincode Data For Address Form
* Param 'stateID' -> selected StateId
@ -1633,15 +1578,36 @@ else{
})
}
imageDataFun($event){
console.log($event)
this.imageDisplay=$event.imageDisplay
imageDataFun(event){
console.log(event)
this.imageDisplay=event.imageDisplay
this.imageBucket=event.imageBucket
// this.imageDisplay.push(this.imageBucket)
// this.imageBucket=$event.imageBucket
// if($event.imageBucket != ''){
// this.imageDisplay.push($event.imageBucket);
// }
console.log("image display event emiiter",this.imageDisplay,this.imageBucket)
if(this.imageDisplay.length > 0){
this.imageDisplay.forEach(result=>{
let img_title = (result.Name).split('(');
if(img_title[0] == 'Approach to PD Location '){
this.AppxPDLocationImgValid = true;
//this.imageDisplay = this.imageDisplay.filter (value=>value.is_show_report != 0 && value.name.split('(')[0] != 'Approach to PD Location ')
}
})
}
if(this.imageBucket.length > 0){
this.imageBucket.forEach(result=>{
let img_title = (result.Name).split('(');
if(img_title[0] == 'Approach to PD Location '){
this.AppxPDLocationImgValid = true;
//this.imageDisplay = this.imageDisplay.filter (value=>value.is_show_report != 0 && value.name.split('(')[0] != 'Approach to PD Location ')
}
})
}
}
}

View File

@ -147,68 +147,10 @@ export class PdQuestionAssestsPage {
// }
ionViewCanLeave(){
console.log("dirty",this.AssetsDetailsForm.dirty);
// this.timer.unsubscribe();
if(this.AssetsDetailsForm.dirty){
// console.log("dirty",this.AssetsDetailsForm.dirty)
//return false;
// let val=this.toast.setAlert('Form is Modified','Are you sure want to Go Back');
// console.log("v",val)
// if(val==1){
// }
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Form is Modified","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.constprovider.chekAlertOnLeave()
}
}
tabChange(){

View File

@ -99,60 +99,11 @@ export class PdQuestionBankingPage {
this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this.bankDetails.dirty);
// this.timer.unsubscribe();
if(this.bankDetails.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Form is Modified","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.cons.chekAlertOnLeave()
}
}
checkImage(){
let value

View File

@ -113,7 +113,7 @@
<mat-select placeholder="Is this the business address ? "
(selectionChange)="setRequiredValidation($event.value,'',1,i);"
formControlName="business_address_availability">
<mat-option>Select</mat-option>
<mat-option value="">Select</mat-option>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
@ -137,7 +137,7 @@
<mat-select
[placeholder]="placeholderName[i] ? placeholderName[i] :'Was any business activity seen at the Address Type during PD visit?'"
formControlName="business_is_pd_visited" (selectionChange)="setRequiredValidation($event.value,'',11,i)">
<mat-option>Select</mat-option>
<mat-option value="">Select</mat-option>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>

View File

@ -120,63 +120,10 @@ export class PdQuestionBusinessAssetsPage {
// this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this._businessAssetsQuesFrom.dirty);
// this.timer.unsubscribe();
if(this._businessAssetsQuesFrom.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.cons.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){

View File

@ -110,63 +110,10 @@ step:number
// this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this.bankingForm.dirty);
// this.timer.unsubscribe();
if(this.bankingForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.cons.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){

View File

@ -187,64 +187,14 @@ export class PdQuestionBusinessInfoPage {
// this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this.businessForm.dirty);
// this.timer.unsubscribe();
if(this.businessForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.cons.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){
const modalOption:ModalOptions={

View File

@ -133,63 +133,10 @@ console.log("form values",this.clientInfoForm);
}
ionViewCanLeave(){
// console.log("dirty",this.clientInfoForm.dirty);
// this.timer.unsubscribe();
if(this.clientInfoForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.constantProvider.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){
@ -1142,6 +1089,8 @@ else{
imageDataFun($event){
console.log($event)
this.imageDisplay=$event.imageDisplay
this.imageBucket=$event.imageBucket
}
onBlurMethod(v,items,option) {

View File

@ -146,64 +146,11 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
// console.log("ngAfter View Init")
// }
ionViewCanLeave(){
console.log("dirty",this.financialForm.dirty);
ionViewCanLeave(){
// this.timer.unsubscribe();
if(this.financialForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.cons.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){
@ -1700,7 +1647,10 @@ calculateLossAmount( i, details){
}
imageDataFun($event){
console.log($event)
this.imageDisplay=$event.imageDisplay
this.imageBucket=$event.imageBucket;
this.picsArrayLength=$event.imageDisplay.length
this.picsArrayLength=this.picsArrayLength+(parseInt(this.imageBucket.length))
}
}

View File

@ -85,64 +85,11 @@ export class PdQuestionFuturePlansAndBusinessEnvironmentPage {
// this.getPDImages();
}
ionViewCanLeave() {
if (this._futurePlansForm.dirty) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("Data will be Lost", "Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data) => {
if (data == false) {
reject();
return true;
}
else {
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else {
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
ionViewCanLeave(){
// this.timer.unsubscribe();
if(this._futurePlansForm.dirty){
return this.constantProvider.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){

View File

@ -124,63 +124,10 @@ this.pd_value_params={pd_id:this.pdDetails.pd_id,form_id:this.formDetails.form_i
// this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this.stockForm.dirty);
// this.timer.unsubscribe();
if(this.stockForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.constant.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){

View File

@ -128,63 +128,10 @@ export class PdQuestionSupplierInfoPage {
this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this.supplierInfoForm.dirty);
// this.timer.unsubscribe();
if(this.supplierInfoForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.constantProvider.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){
@ -1124,6 +1071,7 @@ export class PdQuestionSupplierInfoPage {
imageDataFun($event){
console.log($event)
this.imageDisplay=$event.imageDisplay
this.imageBucket=$event.imageBucket
}

View File

@ -105,60 +105,11 @@ this.pd_value_params={pd_id:this.pdDetails.pd_id,form_id:this.FormId.form_id,com
// this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this.currentLoans.dirty);
// this.timer.unsubscribe();
if(this.currentLoans.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.constant.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){
const modalOption:ModalOptions={

View File

@ -138,63 +138,10 @@ this.pd_value_params={pd_id:this.pdDetails.pd_id,form_id:this.FormId.form_id,com
// this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this.employmentForm.dirty);
// this.timer.unsubscribe();
if(this.employmentForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.constant.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){

View File

@ -123,63 +123,10 @@ data:any;
// this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this.familyForm.dirty);
// this.timer.unsubscribe();
if(this.familyForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.cons.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){

View File

@ -119,63 +119,10 @@ export class PdQuestionFinalRemarkPage {
}
ionViewCanLeave(){
console.log("dirty",this._finalRemarkForm.dirty);
// this.timer.unsubscribe();
if(this._finalRemarkForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.constantProvider.chekAlertOnLeave()
}
}
tabChange(){

View File

@ -195,65 +195,10 @@ export class PdQuestionGeneralInfoPage {
}
ionViewCanLeave(){
console.table("dirty",this.generalForm.dirty);
// this.timer.unsubscribe();
if(this.generalForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
// console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
// console.log('if part . this.imageBucket.length',this.imageBucket.length);
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
// console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
// console.log('else part . this.imageBucket.length',this.imageBucket.length)
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
// console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.cons.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){

View File

@ -63,63 +63,10 @@ export class PdQuestionLenderRepresentativePage {
}
ionViewCanLeave(){
console.log("dirty",this.representativeForm.dirty);
// this.timer.unsubscribe();
if(this.representativeForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.constantProvider.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){

View File

@ -201,64 +201,11 @@ export class PdQuestionLoansPage {
this._onDestroy.complete();
}
ionViewCanLeave(){
// console.log("dirty",this.loanDetailsForm.dirty);
ionViewCanLeave(){
// this.timer.unsubscribe();
if(this.loanDetailsForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
// console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
// console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
// this.localInsert(true)
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
// console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.constant.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){

View File

@ -92,63 +92,10 @@ export class PdQuestionNeighbourHoodPage {
// this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this.neighbourhoodForm.dirty);
// this.timer.unsubscribe();
if(this.neighbourhoodForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.constant.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){

View File

@ -106,63 +106,10 @@ export class PdQuestionOtherIncomePage {
// this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this.otherIncomeForm.dirty);
if(this.otherIncomeForm.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
// this.timer.unsubscribe();
if(this.otherIncomeDetails.dirty){
return this.constant.chekAlertOnLeave()
}
}
tabChange(){

View File

@ -229,63 +229,10 @@ this.pd_value_params={pd_id:this.pdDetails.pd_id,form_id:this.FormId.form_id,com
// this.getPDImages();
}
ionViewCanLeave(){
console.log("dirty",this.rentalForms.dirty);
// this.timer.unsubscribe();
if(this.rentalForms.dirty){
return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
else{
//AFTER FORM DIRTY CHECK
if (this.imageBucket.length > 0) {
return new Promise((resolve1, reject1) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
//reject1();
reject();
}
else {
resolve1();
resolve();
}
})
})
}
resolve();
}
})
})
}
else{
//REGULAR CHECK FOR IMAGE IS CAPTURED
if (this.imageBucket.length > 0) {
return new Promise((resolve, reject) => {
let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
alert.present();
alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) {
reject();
}
else {
resolve();
}
})
})
}
}
return this.constprovider.chekAlertOnLeave()
}
}
tabChange(){
if(this.tab == '2'){

View File

@ -30,11 +30,14 @@
<mat-card-content formArrayName="addtional_requirements">
<div *ngFor="let qu of docsCollectedForm.controls.addtional_requirements['controls'];let i=index;" [formGroupName]="i">
<div *ngFor="let item of queries_docs">
<mat-form-field style="width:100%">
<mat-placeholder>
{{item.add_requirement}}
</mat-placeholder>
<mat-form-field style="width:100%">
<!-- <mat-placeholder>
{{item.add_requirement}}
</mat-placeholder>
<input matInput type="text" [formControlName]="item.add_req_id" >
</mat-placeholder> -->
<input matInput type="text" [formControlName]="item.add_req_id" placeholder="Enter the Text">
</mat-form-field>
</div>
</div>

View File

@ -10,7 +10,7 @@ import {
HttpUserEvent
} from '@angular/common/http';
// import { AuthGuard } from './auth.guard';
import { Observable, of, BehaviorSubject} from 'rxjs';
import { Observable, of, BehaviorSubject, throwError} from 'rxjs';
// import { Router } from '@angular/router';
@ -23,6 +23,9 @@ import { ConstantsProvider } from '../constants/constants';
// import { catchError } from 'rxjs/operators';
import 'rxjs/add/operator/catch';
import { AwsServiceProvider } from '../aws-service/aws-service';
import { ToastProvider } from '../common-provider/toast';
import { NavController, Nav } from 'ionic-angular';
import { LoginPage } from '../../pages/login/login';
// const cognitoService=this.injector.get(CognitoServiceProvider)
// const constantProvider=this.injector.get(ConstantsProvider)
@ -66,10 +69,14 @@ intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpSentEvent |
}
return <any>next.handle(this.addToken(req, token)).pipe(
catchError(error => {
console.log("Initial Error",error);
if (error instanceof HttpErrorResponse) {
if((<HttpErrorResponse>error).status) {
return this.handle401Error(req,next,error)
}
else{
return this.handle401Error(req,next,error)
}
} else {
console.log("observable error")
return Observable.throw(error);
@ -78,12 +85,14 @@ intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpSentEvent |
}
handle401Error(req: HttpRequest<any>, next: HttpHandler,err) {
console.log("err",err)
// console.log("err",err)
const cognitoService=this.injector.get(CognitoServiceProvider)
console.log("entered",this.isRefreshingToken,this.tokenSubject);
// console.log("entered",this.isRefreshingToken,this.tokenSubject);
if (err instanceof HttpErrorResponse) {
if(err.status == 401 && err.error.error.toLowerCase() == 'invalid token!'){
console.log("Refreshing Token",err.status)
if (!this.isRefreshingToken) {
this.isRefreshingToken = true;
@ -136,7 +145,8 @@ intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpSentEvent |
}
}
else{
this.handleError('Error From Token Interceptor',err);
// return Observable.throw("Observable throw",err);
return this.handleError('',err)
}
}
else{
@ -145,16 +155,25 @@ intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpSentEvent |
}
private handleError<T> (operation = 'operation', result?: T) {
return (error: any): Observable<T> => {
if(error instanceof HttpErrorResponse){
console.error("Error: " + error.status);
private handleError<T> (operation = 'operation', error?: HttpErrorResponse) {
// return (error: any): Observable<T> => {
// if(error instanceof HttpErrorResponse){
console.log("Error: " ,error);
if(error.status == 401){
localStorage.clear();
// this.router.navigate(['/authentication/login']);
const NavCtrl=this.injector.get(NavController)
NavCtrl.setRoot(LoginPage);
}
return of(result as T);
else
// if(error.status == 0)
{
const toastProvider=this.injector.get(ToastProvider)
toastProvider.pdTriggerappmessage("Network Error")
}
return throwError(error)
// return of(result as T);
}
};
}
// };
// }
}

View File

@ -178,7 +178,10 @@ apiurl:any;
getlocale(){
let session:any = this.shared.getToken() || null;
let userid = session.idToken.payload.locale;
let userid=''
if(session != null){
userid = session.idToken.payload.locale;
}
return userid;
}
getuserprofile(userid)

View File

@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import {Geolocation} from '@ionic-native/geolocation'
import { LocationAccuracy } from '@ionic-native/location-accuracy';
import { ToastProvider } from '../common-provider/toast';
// import {C} from '../../constants'
// import {environment as ENV} from '../../environments/environment'
@ -15,7 +16,7 @@ import { LocationAccuracy } from '@ionic-native/location-accuracy';
@Injectable()
export class ConstantsProvider {
public commonimage = "http://pdgenie.com/logo/avatar.jpg";
constructor(public http: HttpClient,private geo:Geolocation,private locationAccuracy:LocationAccuracy) {
constructor(public http: HttpClient,private geo:Geolocation,private locationAccuracy:LocationAccuracy,private toastProvider:ToastProvider) {
console.log('Hello ConstantsProvider Provider');
}
@ -65,7 +66,7 @@ public commonimage = "http://pdgenie.com/logo/avatar.jpg";
userPoolId:'ap-south-1_qQ85yQZJO',
clientId:'2o5c3cs9k3als16nqhp3irh8rs' //for mobile
}
return testing;
return production;
}
getcurrentDate()
@ -312,4 +313,79 @@ searchData(data,val: any,option) {
})
}
chekAlertOnLeave(){
// ionViewCanLeave(){
// console.log("dirty",this.rentalForms.dirty);
// if(this.rentalForms.dirty){
// return new Promise((resolve,reject)=>{
// let alert=this.toast.setAlert("Data will be Lost","Are you sure want to Go Back")
// alert.present();
// alert.onDidDismiss((data)=>{
// console.log("d",data);
// if(data== false){
// reject();
// return true;
// }
// else{
// //AFTER FORM DIRTY CHECK
// if (this.imageBucket.length > 0) {
// return new Promise((resolve1, reject1) => {
// let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the Save Image button</small></strong><br> Are you sure want to Go Back?")
// alert.present();
// alert.onDidDismiss((data) => {
// console.log("d", data);
// if (data == false) {
// //reject1();
// reject();
// }
// else {
// resolve1();
// resolve();
// }
// })
// })
// }
// resolve();
// }
// })
// })
// }
// else{
// //REGULAR CHECK FOR IMAGE IS CAPTURED
// if (this.imageBucket.length > 0) {
// return new Promise((resolve, reject) => {
// let alert = this.toast.setAlert("<small>Captured Images are not Saved<small>", "<strong><small>Note:To Save the image press the 'Save Image' button</small></strong><br> Are you sure want to Go Back?")
// alert.present();
// alert.onDidDismiss((data) => {
// console.log("d", data);
// if (data == false) {
// reject();
// }
// else {
// resolve();
// }
// })
// })
// }
// }
// }
return new Promise((resolve,reject)=>{
let alert=this.toastProvider.setAlert("Data will be Lost","Are you sure want to Go Back")
alert.present();
alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){
reject();
return true;
}
resolve();
})
})
}
}

View File

@ -5,6 +5,8 @@ import { Observable } from 'rxjs';
import {CacheService} from 'ionic-cache'
import { state } from '@angular/animations';
import { AwsServiceProvider } from '../aws-service/aws-service';
import { Storage } from '@ionic/storage';
import { StorageProvider } from '../storage/storage';
/*
Generated class for the QuestionCategoryProvider provider.
@ -17,7 +19,7 @@ const ttl = 60 * 60 * 24 * 7;
export class QuestionCategoryProvider {
apiurl:any;
constructor(private _aws: AwsServiceProvider,public http: HttpClient,public constant:ConstantsProvider,private cache:CacheService) {
constructor(private _aws: AwsServiceProvider,public http: HttpClient,public constant:ConstantsProvider,private cache:CacheService,private ionicStrorageService:StorageProvider) {
console.log('Hello QuestionCategoryProvider Provider');
this.apiurl = constant.environment();
this.apiurl=this.apiurl.url
@ -142,15 +144,89 @@ stockFormAccess(pdid: any,companyid: any) {
savePDImages(imagesDetails)
{
let record = {'records':imagesDetails};
return this.http.post(this.apiurl+'savePDPhotos',record);
return this.http.post(this.apiurl+'savePDPhotos',record)
.map(response=>{
console.log(response);
this.checkSavedPics(response['dataStatus'],imagesDetails)
return response;
},err=>{
console.log("Error in savePDImages",err)
this.checkSavedPics('',imagesDetails)
// return err
})
}
getPDImages(records){
let record={'records':records};
return this.http.post(this.apiurl+'getPDImages',record);
return this.http.post(this.apiurl+'getPDImages',record)
// .map(response=>{
// console.log(response);
// this.checkSavedPics(response['dataStatus'],records)
// return response;
// },err=>{
// })
}
getFamilyDetails(pdid:any){
return this.http.post<any>(this.apiurl+'getFamilyDetails',{"pd_id":pdid})
}
checkSavedPics(response,sended_param){
console.log("checkSavedPics",response,sended_param);
this.ionicStrorageService.getItem('pd_images').then(local_arr=>{
switch(response){
case true:
if(local_arr){
console.log("local pics",local_arr)
let checked= local_arr.filter((val,index)=>{
if(val.form_value.length > 0){
let curr_form_value=val.form_value.filter(form_val=>form_val.Name != sended_param.images[0].Name)
console.log("filtered",curr_form_value);
if(curr_form_value.length > 0){
val.form_value=curr_form_value
// alert("Updated")
return val
}
else{
val.form_value=[]
// alert("Deleted")
return val;
}
}
})
if(checked.length > 0){
this.ionicStrorageService.updateImagesLocally(checked[0]);
}
console.log(checked[0]);
}
break;
case false || '' :
if(local_arr){
let checked= local_arr.filter((val,index)=>{
if(val.form_value.length > 0){
let curr_form_value=val.form_value.filter(form_val=>form_val.Name == sended_param.images[0].Name)
console.log("Error filtered",curr_form_value);
if(curr_form_value.length > 0){
curr_form_value[0].isLoader=false;
curr_form_value[0].isSaved=false;
// alert("Updated status")
return val
}
else{
// alert("Deleted status")
return;
}
}
})
if(checked.length > 0){
this.ionicStrorageService.updateImagesLocally(checked[0]);
}
console.log(checked);
}
break;
}
})
}
getAddressDetails(pdid:any){
return this.http.post<any>(this.apiurl+'getPDAddress',{'pd_id':pdid})
}

View File

@ -18,7 +18,7 @@ export class StorageProvider {
console.log('Hello StorageProvider Provider');
}
insertData(data){
this.toast.pdTriggerappmessage(this.storage.driver);
// this.toast.pdTriggerappmessage(this.storage.driver);
const storage_key=data.pd_id
console.log("storage provider")
console.log(data);
@ -63,6 +63,67 @@ insertData(data){
}
insertPDImageLocally(data){
this.toast.pdTriggerappmessage(this.storage.driver);
const storage_key=data.storage_key
console.log("storage provider")
console.log(data);
console.log(JSON.stringify(data));
console.log("sto",this.storage.get(storage_key))
return this.storage.get(storage_key).then((res)=>{
console.log("res",res)
if(res != null ){
if( res.length != 0 && res.length != undefined){
// res.forEach((value)=>{
// if(value.form_id==data.form_id){
// option=true
// }
// })
let current_form=res.filter(val=>val.form_id!=data.form_id)
console.log("current",current_form);
if(current_form.length > 0){
let value:any=current_form
let temp={form_id:data.form_id,form_value:data.img_bucket}
value.push(temp)
return this.storage.set(storage_key,value)
}
}
// let old_Data:any=[]
// old_Data=res
// console.log("old data",old_Data)
// old_Data.push(data)
// return this.storage.set(storage_key,old_Data)
}
else{
//res.push(data)
// let dataValue=Object.keys(data).map(function(key){
// return data[key];
// })
let value:any=[]
let temp={form_id:data.form_id,form_value:data.img_bucket}
value.push(temp)
return this.storage.set(storage_key,value)
}
})
}
updateImagesLocally(data){
let storage_key='pd_images'
this.getItem(storage_key).then(result=>{
if(result){
let filter_result=result.filter(val=>val.form_id != data.form_id)
filter_result.push(data)
return this.storage.set(storage_key,filter_result);
}
})
}
retrieveLocalStorage(data){
const storage_key=data.pd_id

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long