imagee changes - ps

This commit is contained in:
saravanakumarkandasami 2019-06-03 10:18:34 +05:30
parent 06a6a0daa0
commit 3c1807160f
14 changed files with 278 additions and 93 deletions

View File

@ -58,6 +58,7 @@
<ion-col col-6 *ngFor="let image of imageDisplay; let i=index" no-padding> <ion-col col-6 *ngFor="let image of imageDisplay; let i=index" no-padding>
<img src="{{image.image}}" imageViewer><br/> <img src="{{image.image}}" imageViewer><br/>
<label *ngIf="image.Name != ''"><strong>{{image.Name}}</strong></label> <label *ngIf="image.Name != ''"><strong>{{image.Name}}</strong></label>
<br/><label *ngIf="image.is_show_report != '0'">Shown On Report</label>
<input *ngIf="image.Name =='' && image.option != 'dummy'" width="20px" ion-input type="text" placeholder="Document Name" (blur)="changeName($event.target.value,i,image.image)"> <input *ngIf="image.Name =='' && image.option != 'dummy'" width="20px" ion-input type="text" placeholder="Document Name" (blur)="changeName($event.target.value,i,image.image)">
<button *ngIf="image.option != 'dummy'" ion-button clear color="optblue" (click)="removeImg(i)"><ion-icon style="font-size:22px" name="md-trash"></ion-icon></button> <button *ngIf="image.option != 'dummy'" ion-button clear color="optblue" (click)="removeImg(i)"><ion-icon style="font-size:22px" name="md-trash"></ion-icon></button>
@ -75,8 +76,15 @@
<ion-col col-6 *ngFor="let image of imageBucket; let i=index" no-padding> <ion-col col-6 *ngFor="let image of imageBucket; let i=index" no-padding>
<img src="{{image.image}}" imageViewer><br/> <img src="{{image.image}}" imageViewer><br/>
<label *ngIf="image.Name != ''"><strong>{{image.Name}}</strong></label> <label *ngIf="image.Name != ''"><strong>{{image.Name}}</strong></label>
<br/><label *ngIf="image.is_show_report == 1"><small>Showned on Report</small></label>
<input #focusName *ngIf="image.Name ==''" width="20px" ion-input type="text" placeholder="Document Name" (blur)="changeNameForBucket($event.target.value,i,image.image)"> <input #focusName *ngIf="image.Name ==''" width="20px" ion-input type="text" placeholder="Document Name" (blur)="changeNameForBucket($event.target.value,i,image.image)">
<br/>
<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>
<button float-right ion-button clear color="optblue" (click)="removeImgForBucket(i)"><ion-icon style="font-size:22px" name="md-trash"></ion-icon></button> <button float-right ion-button clear color="optblue" (click)="removeImgForBucket(i)"><ion-icon style="font-size:22px" name="md-trash"></ion-icon></button>
</ion-col> </ion-col>
<hr/> <hr/>

View File

@ -113,7 +113,6 @@ export class PdQuestionAddressPage {
this.getdropdownlist(); this.getdropdownlist();
//const control=this.pdQuestionAddress.controls['addresses'] //const control=this.pdQuestionAddress.controls['addresses']
// console.log("co",control)
this.pdQuestionAddress = this.fb.group( this.pdQuestionAddress = this.fb.group(
{ {
@ -159,7 +158,7 @@ export class PdQuestionAddressPage {
searchFun(control:any,i:number,option){ searchFun(control:any,i:number,option){
// console.log(control,i)
if (option == 'city') { if (option == 'city') {
control.controls['citySearch'].valueChanges control.controls['citySearch'].valueChanges
.pipe(takeUntil(this._onDestroy)) .pipe(takeUntil(this._onDestroy))
@ -168,7 +167,7 @@ export class PdQuestionAddressPage {
}) })
} }
if (option == 'state') { if (option == 'state') {
console.log("state")
control.controls['stateSearch'].valueChanges control.controls['stateSearch'].valueChanges
.pipe(takeUntil(this._onDestroy)) .pipe(takeUntil(this._onDestroy))
.subscribe(()=>{ .subscribe(()=>{
@ -176,7 +175,7 @@ export class PdQuestionAddressPage {
}) })
} }
if (option == 'pin') { if (option == 'pin') {
console.log("Pin")
control.controls['pinSearch'].valueChanges control.controls['pinSearch'].valueChanges
.pipe(takeUntil(this._onDestroy)) .pipe(takeUntil(this._onDestroy))
.subscribe(()=>{ .subscribe(()=>{
@ -216,7 +215,7 @@ export class PdQuestionAddressPage {
} }
searchState(val: any) { searchState(val: any) {
console.log("statedata")
if (!this.stateData) { if (!this.stateData) {
return return
} }
@ -235,8 +234,8 @@ export class PdQuestionAddressPage {
countRowsForTextarea(text){ countRowsForTextarea(text){
// console.log('text.length%100',text.length%190);
// console.log('text.length/100',text.length/100);
if(text !='' && text != undefined){ if(text !='' && text != undefined){
if(text.length%100 > 5) if(text.length%100 > 5)
return 5; return 5;
@ -279,13 +278,13 @@ countRowsForTextarea(text){
ionViewCanLeave(){ ionViewCanLeave(){
this.timer.unsubscribe(); this.timer.unsubscribe();
console.log("dirty",this.pdQuestionAddress.dirty);
if(this.pdQuestionAddress.dirty){ if(this.pdQuestionAddress.dirty){
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
let alert=this.toast.setAlert("Form is Modified","Are you sure want to Go Back") let alert=this.toast.setAlert("Form is Modified","Are you sure want to Go Back")
alert.present(); alert.present();
alert.onDidDismiss((data)=>{ alert.onDidDismiss((data)=>{
console.log("d",data);
if(data== false){ if(data== false){
reject(); reject();
return true; return true;
@ -297,7 +296,6 @@ countRowsForTextarea(text){
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?") 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.present();
alert.onDidDismiss((data) => { alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) { if (data == false) {
//reject1(); //reject1();
reject(); reject();
@ -326,7 +324,6 @@ countRowsForTextarea(text){
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?") 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.present();
alert.onDidDismiss((data) => { alert.onDidDismiss((data) => {
console.log("d", data);
if (data == false) { if (data == false) {
reject(); reject();
} }
@ -345,14 +342,13 @@ countRowsForTextarea(text){
* Param 'stateID' -> selected StateId * Param 'stateID' -> selected StateId
*/ */
getCityAndPincodeDetails(stateID: string,i,pincode) { getCityAndPincodeDetails(stateID: string,i,pincode) {
// console.log(this.pdQuestionAddress.controls['addresses']['controls'][0].controls['citySearch'])
console.log(this.pdQuestionAddress)
//this.pdQuestionAddress.controls['addresses']['controls'].controls //this.pdQuestionAddress.controls['addresses']['controls'].controls
this.qustCat.getStateWiseCities(stateID).subscribe(data => { this.qustCat.getStateWiseCities(stateID).subscribe(data => {
if (data.status == 200) { if (data.status == 200) {
this.cityData[i] = data.records.cities; this.cityData[i] = data.records.cities;
this.search=this.cityData[i] this.search=this.cityData[i]
console.log("Slice",this.cityData[i].slice);
//this.filteredCity.next(this.cityData[i].slice()) //this.filteredCity.next(this.cityData[i].slice())
this.cityDataValue[i]=this.cityData[i].slice() this.cityDataValue[i]=this.cityData[i].slice()
this.pincodeData[i] = data.records.pincode; this.pincodeData[i] = data.records.pincode;
@ -364,8 +360,7 @@ countRowsForTextarea(text){
// if(pincode != 1){ // if(pincode != 1){
// this.pincodeValue[i]=this.pincodeData[i].filter(res=>res.pincode_id == pincode).map(val=>val.pincode)[0] // this.pincodeValue[i]=this.pincodeData[i].filter(res=>res.pincode_id == pincode).map(val=>val.pincode)[0]
// //this.pincodeValue[i]=[].concat.apply([],this.pincodeValue[i]) // //this.pincodeValue[i]=[].concat.apply([],this.pincodeValue[i])
// console.log(this.pincodeValue[i])
// console.log(this.pdQuestionAddress)
// } // }
// } // }
@ -393,10 +388,8 @@ countRowsForTextarea(text){
{ {
if(res['dataStatus']==true){ if(res['dataStatus']==true){
this.addressTypes = res['records'].filter(add=>add.isactive==1); this.addressTypes = res['records'].filter(add=>add.isactive==1);
console.log("dk",this.addressTypes)
// this.cacheObservable.register('addressType',this.addressTypes).subscribe(res=>{ // this.cacheObservable.register('addressType',this.addressTypes).subscribe(res=>{
// this.data$=res.get$ // this.data$=res.get$
// console.log("data",this.data$)
// }) // })
} }
// this.cacheObservable.loadFromObservable() // this.cacheObservable.loadFromObservable()
@ -534,7 +527,7 @@ countRowsForTextarea(text){
} }
initAddress(AddressDetails){ initAddress(AddressDetails){
console.log("pin init", this.pincodeValue[0])
if(AddressDetails != null){ if(AddressDetails != null){
return this.fb.group({ return this.fb.group({
address: [AddressDetails.address], address: [AddressDetails.address],
@ -650,7 +643,6 @@ countRowsForTextarea(text){
this.toast.pdTriggerappmessage("Please Fill all the Mandatory Fields marked with ' * '") this.toast.pdTriggerappmessage("Please Fill all the Mandatory Fields marked with ' * '")
return return
} }
console.log("Answer DAta",answerData)
records.addresses=answerData.addresses records.addresses=answerData.addresses
// records.addressess // records.addressess
records.address_form_remark=answerData.address_form_remark records.address_form_remark=answerData.address_form_remark
@ -673,7 +665,6 @@ countRowsForTextarea(text){
this.qustCat.saveForm(records).subscribe(data => { this.qustCat.saveForm(records).subscribe(data => {
console.log(data);
// let params: any = {}; // let params: any = {};
// params.pd_id = '250'; // params.pd_id = '250';
// params.pd_form_id = '250'; // params.pd_form_id = '250';
@ -702,7 +693,7 @@ countRowsForTextarea(text){
// data.pd_id=this.pdDetails.pd_id // data.pd_id=this.pdDetails.pd_id
// data.form_id=this.FormId.form_id // data.form_id=this.FormId.form_id
this.storagedb.retrieveLocalStorage(data).then(res=>{ this.storagedb.retrieveLocalStorage(data).then(res=>{
console.log("address get",res)
if(res){ if(res){
let val_rec:any={} let val_rec:any={}
val_rec.records=res[0] val_rec.records=res[0]
@ -727,7 +718,7 @@ countRowsForTextarea(text){
if(datas.pincode == 1){ if(datas.pincode == 1){
this.pincodeValue[index]=datas.pincode_others this.pincodeValue[index]=datas.pincode_others
}//if(val==true){ }//if(val==true){
console.log( "Pin" ,this.pincodeValue[index]);
let val={ let val={
'address': datas.address, 'address': datas.address,
'address_type': datas.address_type, 'address_type': datas.address_type,
@ -747,7 +738,7 @@ countRowsForTextarea(text){
} }
// let selectedAddressType = this.addressTypes.filter(element => element.address_type_id == datas.address_type)[0]; // let selectedAddressType = this.addressTypes.filter(element => element.address_type_id == datas.address_type)[0];
// console.log("selected add type",selectedAddressType)
if(datas.address_type != ''){ if(datas.address_type != ''){
this.selectedAddressType(datas.address_type,index); this.selectedAddressType(datas.address_type,index);
// this.selectedAddressType(selectedAddressType.address_type,index); // this.selectedAddressType(selectedAddressType.address_type,index);
@ -775,13 +766,12 @@ countRowsForTextarea(text){
}) })
// console.log("add",local_value)
} }
getaddressForm() getaddressForm()
{ {
console.log("pd",this.pdDetails);
let res:any; let res:any;
@ -807,7 +797,7 @@ countRowsForTextarea(text){
if(datas.pincode == 1){ if(datas.pincode == 1){
this.pincodeValue[index]=datas.pincode_others this.pincodeValue[index]=datas.pincode_others
}//if(val==true){ }//if(val==true){
console.log( "Pin" ,this.pincodeValue[index]);
let val={ let val={
'address': datas.address, 'address': datas.address,
'address_type': datas.address_type, 'address_type': datas.address_type,
@ -949,7 +939,7 @@ countRowsForTextarea(text){
this.qustCat.getAddressDetails(this.pdDetails.pd_id).subscribe(res=>{ this.qustCat.getAddressDetails(this.pdDetails.pd_id).subscribe(res=>{
if(res.dataStatus == true){ if(res.dataStatus == true){
this.addressesList = res.records.filter(item => item.isactive == 1 && item.assigned_pd == this.pdDetails.pd_id); this.addressesList = res.records.filter(item => item.isactive == 1 && item.assigned_pd == this.pdDetails.pd_id);
console.log('this.addressesList',this.addressesList);
if(this.addressesList.length > 0){ if(this.addressesList.length > 0){
this.addressesList.forEach((datas,index)=>{ this.addressesList.forEach((datas,index)=>{
this.getCityAndPincodeDetails(datas.fk_state,index,datas.pincode) this.getCityAndPincodeDetails(datas.fk_state,index,datas.pincode)
@ -985,36 +975,53 @@ countRowsForTextarea(text){
}) })
} }
getPDImages(){ getPDImages(){
//FOR RETRIEVING PICTURES //FOR RETRIEVING PICTURES
this.imageDisplay=[] this.imageDisplay=[]
let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.FormId.form_id,'company_id':null} let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.FormId.form_id,'company_id':null}
this.qustCat.getPDImages(record_for_pic).subscribe(val=>{ this.qustCat.getPDImages(record_for_pic).subscribe(val=>{
console.log('inside getPDImages Fn - its response ',val);
if(!val['msg']){ if(!val['msg']){
console.log(val['records']) console.log('Response Data - records only',val['records'])
if(val['records'].length>0){ if(val['records'].length>0){
val['records'].forEach(result=>{ val['records'].forEach(result=>{
this.imageDisplay.push({'image':result.doc_url,'Name':result.pd_document_title,'option':'dummy'}) this.imageDisplay.push({'image':result.doc_url,'Name':result.pd_document_title,'option':'dummy','is_show_report': result.is_show_report == null ? 0 : result.is_show_report })
}) })
console.log("imageBuck",this.imageDisplay); console.log("image Display Data Are",this.imageDisplay);
} }
} }
}) })
} }
changeName(value,index,img){ changeName(value,index,img){
console.log(value); console.log('inside changeName Fn - its param are ',value,'Index are ',index,'active are');
this.imageDisplay[index]={'image':img,'Name':value} this.imageDisplay[index]={'image':img,'Name':value,'is_show_report':0}
console.log("image Display Data Are",this.imageDisplay);
}
changeNameForBucket(value,index,img,active){
console.log('inside change-Name-For-Bucket Fn - its param are',value,'Index are ',index,'active are',active);
this.imageBucket[index]={'image':img,'Name':value,'is_show_report':0}
} }
changeNameForBucket(value,index,img){ changeOptions(event: any,index: any){
this.imageBucket[index]={'image':img,'Name':value} console.log('Option Changed ' + event);
this.imageBucket[index].is_show_report=event;
console.log('this.imageBucket',JSON.stringify(this.imageBucket));
} }
removeImg(index){ removeImg(index){
console.log('inside removeImg Fn - its param are - Index only ',index);
this.imageDisplay.splice(index,1); this.imageDisplay.splice(index,1);
} }
removeImgForBucket(index){ removeImgForBucket(index){
console.log('inside removeImgForBucket Fn - its param are - Index only ',index);
this.imageBucket.splice(index,1) this.imageBucket.splice(index,1)
console.log("image Display Data Are",this.imageDisplay);
} }
savePhoto(){ savePhoto(){
console.log('savePhoto');
this.camera.getPicture({ this.camera.getPicture({
quality: 100, quality: 100,
destinationType: this.camera.DestinationType.DATA_URL, destinationType: this.camera.DestinationType.DATA_URL,
@ -1022,11 +1029,11 @@ countRowsForTextarea(text){
targetHeight: 600, targetHeight: 600,
correctOrientation: true correctOrientation: true
}).then((imageData)=>{ }).then((imageData)=>{
console.log('inside savePhoto Fn - its response ',imageData);
this.base64='data:image/png;base64,'+imageData this.base64='data:image/png;base64,'+imageData
this.imageBucket.push({'image':this.base64,'Name':''}); this.imageBucket.push({'image':this.base64,'Name':'','is_show_report':''});
// this.imageDisplay.push({'image':this.base64,'Name':''}) // this.imageDisplay.push({'image':this.base64,'Name':''})
this.getImageName(this.imageBucket.length-1) this.getImageName(this.imageBucket.length-1)
},(err)=>{ },(err)=>{
//alert("error"); //alert("error");
}) })
@ -1036,15 +1043,16 @@ countRowsForTextarea(text){
// this.content.scrollTo(0, dimensions.contentHeight+100, 100); // this.content.scrollTo(0, dimensions.contentHeight+100, 100);
// this.inputFocus.setFocus(); // this.inputFocus.setFocus();
} }
getImageName(index){
console.log("index",index);
let alert =this.toast.setAlertForDocName()
alert.present()
getImageName(index){
console.log('inside get Image Name Fn - its param are - Index only ',index);
let alert =this.toast.setAlertForDocName()
alert.present()
alert.onDidDismiss(value=>{ alert.onDidDismiss(value=>{
console.log(value.Name) console.log('Reponse',value,'Reponse AS Name',value.Name,value.IsShowReport);
this.imageBucket[index].Name=value.Name this.imageBucket[index].Name=value.Name;
}) });
// let alert=this.alerCtrl.create({ // let alert=this.alerCtrl.create({
@ -1062,7 +1070,6 @@ countRowsForTextarea(text){
// { // {
// text:'Submit', // text:'Submit',
// handler:data=>{ // handler:data=>{
// console.log(data.Name)
// this.imageBucket[index].Name=data.Name // this.imageBucket[index].Name=data.Name
// alert.dismiss // alert.dismiss
// } // }
@ -1078,14 +1085,16 @@ countRowsForTextarea(text){
// } // }
sendImage(){ sendImage(){
this.loading.loaderForSendImage() this.loading.loaderForSendImage()
console.log("ll",JSON.stringify(this.imageBucket));
let records:any={ let records:any={
'pd_id':this.pdDetails.pd_id, 'pd_id':this.pdDetails.pd_id,
'formid':this.FormId.form_id, 'formid':this.FormId.form_id,
'images':this.imageBucket, 'images':this.imageBucket,
'company_id':'' 'company_id':''
} }
console.log("records",JSON.stringify(records))
console.log("inside SendImage Function - records array",JSON.stringify(records))
this.qustCat.savePDImages(records).subscribe(res=>{ this.qustCat.savePDImages(records).subscribe(res=>{
if(res['dataStatus']== true){ if(res['dataStatus']== true){
@ -1098,6 +1107,7 @@ countRowsForTextarea(text){
} }
}) })
} }
localInsert(option){ localInsert(option){
let datas:any=this.pdQuestionAddress.value let datas:any=this.pdQuestionAddress.value
datas.pd_id=this.pdDetails.pd_id datas.pd_id=this.pdDetails.pd_id
@ -1107,7 +1117,7 @@ countRowsForTextarea(text){
this.storagedb.insertData(datas).then(res=>{ this.storagedb.insertData(datas).then(res=>{
// let alert=this.toast.setAlert('data',JSON.stringify(res)) // let alert=this.toast.setAlert('data',JSON.stringify(res))
// alert.present(); // alert.present();
console.log("insert add",res); console.log("inside localInsert Fn - its Response",res);
}) })
} }
} }

View File

@ -1648,7 +1648,7 @@
Image </label> Image </label>
</div> </div>
<div style="text-align: -webkit-center;" > <div style="text-align: -webkit-center;" >
<ion-icon title="Click Here For Person Met Image" name="md-camera" (click)="ImageUpload(1)"></ion-icon> <ion-icon title="Click Here For Shop and Est Act Cert Image" name="md-camera" (click)="ImageUpload(1)"></ion-icon>
</div> </div>
</div> </div>
</div> </div>
@ -1857,10 +1857,24 @@
<div style="margin-top:10px" formArrayName="documents" *ngIf="businessForm.controls['other_documents'].value == 'yes'"> <div style="margin-top:10px" formArrayName="documents" *ngIf="businessForm.controls['other_documents'].value == 'yes'">
<div *ngFor="let members of businessForm.controls.documents['controls']; let i=index" <div *ngFor="let members of businessForm.controls.documents['controls']; let i=index"
[formGroupName]="i"> [formGroupName]="i">
<mat-form-field style="width:80%">
<mat-form-field style="width:65%">
<input matInput placeholder="Specify Document Details" formControlName="document"> <input matInput placeholder="Specify Document Details" formControlName="document">
</mat-form-field> </mat-form-field>
<div *ngIf="members.value.document_pic !== ''" >
<img src="{{members.value.document_pic}}" imageViewer style ="width: 40px;height: 35px;">
</div>
<div *ngIf="members.value.document_pic === ''" >
<label style="display: block; text-align: center !important;"> Documents
Image </label>
</div>
<div style="text-align: -webkit-center;" >
<ion-icon title="Click Here Documents Image" name="md-camera" (click)="UploadDocuments(i)"></ion-icon>
</div>
<button ion-button color="optblue" float-right clear (click)="deleteDocuments(i)" *ngIf="i>0"> <button ion-button color="optblue" float-right clear (click)="deleteDocuments(i)" *ngIf="i>0">
<ion-icon name="md-trash"></ion-icon> <ion-icon name="md-trash"></ion-icon>
</button> </button>

View File

@ -150,10 +150,6 @@ export class PdQuestionBusinessInfoPage {
other_documents: [''], other_documents: [''],
documents: this.fb.array([]), documents: this.fb.array([]),
business_remarks:[''] business_remarks:['']
}) })
this.getdropdown(); this.getdropdown();
@ -354,7 +350,7 @@ changeOfStartedBusiness(members,i,e){
otherDoc.push(this.createDocument()); otherDoc.push(this.createDocument());
}); });
} else { } else {
DocArray = [{document: ''}]; DocArray = [{document: '',document_pic: ''}];
otherDoc.push(this.createDocument()); otherDoc.push(this.createDocument());
} }
businessVal.parent_pdid=this.pdDetails.parent_pd_id businessVal.parent_pdid=this.pdDetails.parent_pd_id
@ -1437,7 +1433,8 @@ maxSaleState():FormGroup{
} }
createDocument() { createDocument() {
return this.fb.group({ return this.fb.group({
document: [''] document: [''],
document_pic: [''],
}); });
} }
addDesignation() { addDesignation() {
@ -1662,6 +1659,16 @@ deleteDocuments(index) {
} }
} }
UploadDocuments(index) {
const control = <FormArray>this.businessForm.controls['documents'];
const control_with_index = <FormArray>control.controls[index];
this.cameraProvider.getpicture().then(res=>{
control_with_index.controls['document_pic'].setValue(res !='error' ? res : '');
},error=>{
console.log("Camera Error ",JSON.stringify(error));
})
}
relationChanged(event) { relationChanged(event) {
this.relativeNames = []; this.relativeNames = [];
event.value.forEach(option => { event.value.forEach(option => {
@ -1997,7 +2004,7 @@ if(records.pos_machines_details){
otherDoc.push(this.createDocument()); otherDoc.push(this.createDocument());
}); });
} else { } else {
DocArray = [{document: ''}]; DocArray = [{document: '',document_pic: ''}];
otherDoc.push(this.createDocument()); otherDoc.push(this.createDocument());
} }
if (data['records'].ownership_setup != 'others') { if (data['records'].ownership_setup != 'others') {
@ -2276,6 +2283,7 @@ toGetPOSMachinesDetails(e,flag){
//FOR RETRIEVING PICTURES //FOR RETRIEVING PICTURES
this.imageDisplay=[] this.imageDisplay=[]
let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.FormId,'company_id':this.pdDetails.company_id} let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.FormId,'company_id':this.pdDetails.company_id}
this.qustCat.getPDImages(record_for_pic).subscribe(val=>{ this.qustCat.getPDImages(record_for_pic).subscribe(val=>{
if(!val['msg']){ if(!val['msg']){
console.log(val['records']) console.log(val['records'])

View File

@ -5,9 +5,9 @@
</button> </button>
<ion-title *ngIf="!viewchange">{{formDetails.form_name}}</ion-title> <ion-title *ngIf="!viewchange">{{formDetails.form_name}}</ion-title>
<ion-buttons end> <ion-buttons end>
<a (click)="capture()"> <!-- <a (click)="capture()">
<span style="padding: 0px;margin-right: 14px;color:white;font-size:25px;"><ion-icon name="md-camera"></ion-icon></span> <span style="padding: 0px;margin-right: 14px;color:white;font-size:25px;"><ion-icon name="md-camera"></ion-icon></span>
</a> </a> -->
<a (click)="saveClientInfo(clientInfoForm.value)" *ngIf="!complete_status"> <a (click)="saveClientInfo(clientInfoForm.value)" *ngIf="!complete_status">
<span style="padding: 0px;margin-right: 14px;color:white;font-size:20px;"><ion-icon name="fn-save"></ion-icon></span> <span style="padding: 0px;margin-right: 14px;color:white;font-size:20px;"><ion-icon name="fn-save"></ion-icon></span>
</a> </a>
@ -79,6 +79,7 @@
<div *ngFor="let items of item.controls.main_raw_materials['controls']; let l=index;let last =last" <div *ngFor="let items of item.controls.main_raw_materials['controls']; let l=index;let last =last"
[formGroupName]="l"> [formGroupName]="l">
<mat-card-subtitle>Product #{{l+1}}</mat-card-subtitle> <mat-card-subtitle>Product #{{l+1}}</mat-card-subtitle>
<button mini ion-fab color="optblue" slot="fixed" (click)="captureTheClientPics('Product',l,items.get('manufacturing_client_name').value)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
<mat-card-content> <mat-card-content>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:100%"> <mat-form-field style="width:100%">
@ -194,6 +195,7 @@
<div *ngFor="let items of item.controls.trading_products['controls']; let l=index;let last =last" <div *ngFor="let items of item.controls.trading_products['controls']; let l=index;let last =last"
[formGroupName]="l"> [formGroupName]="l">
<mat-card-subtitle>Trading Product #{{l+1}}</mat-card-subtitle> <mat-card-subtitle>Trading Product #{{l+1}}</mat-card-subtitle>
<button mini ion-fab color="optblue" slot="fixed" (click)="captureTheClientPics('Trading Product',l,items.get('trade_client_name').value)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
<mat-card-content> <mat-card-content>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
@ -316,6 +318,7 @@
<div *ngFor="let items of item.controls.service_products['controls']; let l=index;let last =last" <div *ngFor="let items of item.controls.service_products['controls']; let l=index;let last =last"
[formGroupName]="l"> [formGroupName]="l">
<mat-card-subtitle>Service Provided #{{l+1}}</mat-card-subtitle> <mat-card-subtitle>Service Provided #{{l+1}}</mat-card-subtitle>
<button mini ion-fab color="optblue" slot="fixed" (click)="captureTheClientPics('Service Provided',l,items.get('service_provider_client_name').value)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
<mat-card-content> <mat-card-content>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">

View File

@ -672,6 +672,26 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
removeImgForBucket(index){ removeImgForBucket(index){
this.imageBucket.splice(index,1) this.imageBucket.splice(index,1)
} }
captureTheClientPics(materialName,index,clientName){
if(clientName != ''){
// 'Raw Material','l',items.get('manufacturing_supplier_name').value
this.cameraProvider.getpicture().then(res=>{
if(res != 'error'){
this.imageBucket.push({'image':res,'Name':clientName + ' - ' + materialName + ' ' + (index+1)});
}
},error=>{
console.log("Camera Error ",JSON.stringify(error));
})
this.tab='1';
}
else if(clientName == ''){
alert('Please Fill The Client Name');
}
}
capture(){ capture(){
//FOR CAPTURING PICS //FOR CAPTURING PICS
this.cameraProvider.getpicture().then(res=>{ this.cameraProvider.getpicture().then(res=>{

View File

@ -77,6 +77,7 @@
<mat-card-header> <mat-card-header>
<mat-card-title> <mat-card-title>
<h5>Data As Per Financial Statements</h5> <h5>Data As Per Financial Statements</h5>
<button mini ion-fab color="optblue" slot="fixed" (click)="capture()"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<mat-form-field> <mat-form-field>

View File

@ -48,6 +48,7 @@ export class PdQuestionFinancialInfoPage {
formDetails: any; formDetails: any;
CustSegAbbr:any; CustSegAbbr:any;
temparray : any = []; temparray : any = [];
picsArrayLength :any = 0;
ServiceDataAvailability:boolean = false; ServiceDataAvailability:boolean = false;
av : any =[{id:6, name:'Letter of Credit'}, av : any =[{id:6, name:'Letter of Credit'},
@ -311,7 +312,6 @@ submitDetails(){
this.financialForm.removeControl('estimated_value'); this.financialForm.removeControl('estimated_value');
this.financialForm.controls['is_financial_customer'].setValue(''); this.financialForm.controls['is_financial_customer'].setValue('');
} }
if(this.financialForm.value.date_per_financial['finanical_profit_or_loss'] == 1){ if(this.financialForm.value.date_per_financial['finanical_profit_or_loss'] == 1){
this.financialForm.value.date_per_financial['financial_net_profit'].setValidators([Validators.required]); this.financialForm.value.date_per_financial['financial_net_profit'].setValidators([Validators.required]);
@ -342,6 +342,12 @@ submitDetails(){
} }
let records=this.financialForm.value; let records=this.financialForm.value;
if(records.is_financial_statements == 'yes' && this.picsArrayLength == 0){
this.toast.pdTriggerappmessage("Photos of Finanical Statements are Required");
return;
}
records.select_working_capital_facilities_availed = records.select_working_capital_facilities_availed.filter(value => value.exist_status == 1); records.select_working_capital_facilities_availed = records.select_working_capital_facilities_availed.filter(value => value.exist_status == 1);
if(records.is_there_working_capital_available == "no"){ if(records.is_there_working_capital_available == "no"){
records.select_working_capital_facilities_availed = []; records.select_working_capital_facilities_availed = [];
@ -355,20 +361,20 @@ submitDetails(){
if(records.reason_for_working_capital_facilities_availed) delete records.reason_for_working_capital_facilities_availed ; if(records.reason_for_working_capital_facilities_availed) delete records.reason_for_working_capital_facilities_availed ;
} }
this.qustCat.saveForm(records).subscribe(res=>{ // this.qustCat.saveForm(records).subscribe(res=>{
if(res['status']== 200){ // if(res['status']== 200){
this.financialForm.markAsUntouched(); // this.financialForm.markAsUntouched();
this.toast.pdTriggerappmessage("Record Saved Successfully"); // this.toast.pdTriggerappmessage("Record Saved Successfully");
setTimeout(()=>{ // setTimeout(()=>{
this.navCtrl.pop(); // this.navCtrl.pop();
},2000); // },2000);
} // }
else{ // else{
this.toast.pdTriggerappmessage("Warning !! Something went Wrong"); // this.toast.pdTriggerappmessage("Warning !! Something went Wrong");
} // }
},err=>{ // },err=>{
this.toast.pdTriggerappmessage("Server is not Responding"); // this.toast.pdTriggerappmessage("Server is not Responding");
}) // })
} }
getDetails(){ getDetails(){
const financeDate=<FormArray>this.financialForm.controls['date_per_financial'] const financeDate=<FormArray>this.financialForm.controls['date_per_financial']
@ -1471,6 +1477,7 @@ calculateLossAmount( i, details){
let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.formDetails.form_id,'company_id':this.pdDetails.company_id} let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.formDetails.form_id,'company_id':this.pdDetails.company_id}
this.qustCat.getPDImages(record_for_pic).subscribe(val=>{ this.qustCat.getPDImages(record_for_pic).subscribe(val=>{
if(!val['msg']){ if(!val['msg']){
this.picsArrayLength = val['records'].length;
console.log(val['records']) console.log(val['records'])
if(val['records'].length>0){ if(val['records'].length>0){
val['records'].forEach(result=>{ val['records'].forEach(result=>{
@ -1495,6 +1502,15 @@ calculateLossAmount( i, details){
removeImgForBucket(index){ removeImgForBucket(index){
this.imageBucket.splice(index,1) this.imageBucket.splice(index,1)
} }
captureTheFinancialPics(value){
alert('Value '+value+' - '+this.picsArrayLength);
if(value == 'yes' && this.picsArrayLength == 0){
alert('You Must Take The Finanical Pic');
}
else{
alert('No Need');
}
}
capture(){ capture(){
//FOR CAPTURING PICS //FOR CAPTURING PICS
this.cameraProvider.getpicture().then(res=>{ this.cameraProvider.getpicture().then(res=>{

View File

@ -5,9 +5,9 @@
</button> </button>
<ion-title>{{formDetails.form_name}}</ion-title> <ion-title>{{formDetails.form_name}}</ion-title>
<ion-buttons end> <ion-buttons end>
<a (click)="capture()"> <!-- <a (click)="capture()">
<span style="padding: 0px;margin-right: 14px;color:white;font-size:25px;"><ion-icon name="md-camera"></ion-icon></span> <span style="padding: 0px;margin-right: 14px;color:white;font-size:25px;"><ion-icon name="md-camera"></ion-icon></span>
</a> </a> -->
<a (click)="saveSupplierInfo(supplierInfoForm.value)" *ngIf="!complete_status"> <a (click)="saveSupplierInfo(supplierInfoForm.value)" *ngIf="!complete_status">
<span style="padding: 0px;margin-right: 14px;color:white;font-size:20px;"><ion-icon name="fn-save"></ion-icon></span> <span style="padding: 0px;margin-right: 14px;color:white;font-size:20px;"><ion-icon name="fn-save"></ion-icon></span>
</a> </a>
@ -69,6 +69,7 @@
<div *ngIf="noRecordsFound"> <div *ngIf="noRecordsFound">
<form [formGroup]="supplierInfoForm"> <form [formGroup]="supplierInfoForm">
<div fxLayout="row" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutAlign="start none">
<mat-card *ngIf="manufacturingForm"> <mat-card *ngIf="manufacturingForm">
<mat-card-title> <mat-card-title>
<h5>Manufacturing Product Details</h5> <h5>Manufacturing Product Details</h5>
@ -80,6 +81,7 @@
<div *ngFor="let items of item.controls.main_raw_materials['controls']; let l=index let last =last" <div *ngFor="let items of item.controls.main_raw_materials['controls']; let l=index let last =last"
[formGroupName]="l"> [formGroupName]="l">
<mat-card-subtitle>Raw Material #{{l+1}}</mat-card-subtitle> <mat-card-subtitle>Raw Material #{{l+1}}</mat-card-subtitle>
<button mini ion-fab color="optblue" slot="fixed" (click)="captureTheSupplierPics('Raw Material',l,items.get('manufacturing_supplier_name').value)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
<mat-card-content> <mat-card-content>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
@ -186,6 +188,7 @@
<div *ngFor="let items of item.controls.trading_products['controls']; let l=index; let last = last" <div *ngFor="let items of item.controls.trading_products['controls']; let l=index; let last = last"
[formGroupName]="l"> [formGroupName]="l">
<mat-card-subtitle>Trading Product #{{l+1}}</mat-card-subtitle> <mat-card-subtitle>Trading Product #{{l+1}}</mat-card-subtitle>
<button mini ion-fab color="optblue" slot="fixed" (click)="captureTheSupplierPics('Trading Product',l,items.get('trade_supplier_name').value)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
<mat-card-content> <mat-card-content>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">

View File

@ -535,6 +535,28 @@ export class PdQuestionSupplierInfoPage {
removeImgForBucket(index){ removeImgForBucket(index){
this.imageBucket.splice(index,1) this.imageBucket.splice(index,1)
} }
captureTheSupplierPics(materialName,index,supplierName){
console.log('ds');
alert('dsa');
if(supplierName != ''){
// 'Raw Material','l',items.get('manufacturing_supplier_name').value
this.cameraProvider.getpicture().then(res=>{
if(res != 'error'){
this.imageBucket.push({'image':res,'Name':supplierName + ' - ' + materialName + ' ' + (index+1)});
}
},error=>{
console.log("Camera Error ",JSON.stringify(error));
})
this.tab='1';
}
else if(supplierName == ''){
alert('Please Fill The Supplier Name');
}
}
capture(){ capture(){
//FOR CAPTURING PICS //FOR CAPTURING PICS
this.cameraProvider.getpicture().then(res=>{ this.cameraProvider.getpicture().then(res=>{

View File

@ -1,5 +1,5 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { IonicPage, NavController, NavParams,AlertController } from 'ionic-angular';
import { FormGroup, FormBuilder,FormArray, Validators } from '@angular/forms'; import { FormGroup, FormBuilder,FormArray, Validators } from '@angular/forms';
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category'; import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
import { AwsServiceProvider } from '../../../providers/aws-service/aws-service'; import { AwsServiceProvider } from '../../../providers/aws-service/aws-service';
@ -49,7 +49,7 @@ export class PdQuestionOtherIncomePage {
constructor(public navCtrl: NavController, public navParams: NavParams,public fb:FormBuilder, constructor(public navCtrl: NavController, public navParams: NavParams,public fb:FormBuilder,
public qustCat:QuestionCategoryProvider,public aws:AwsServiceProvider, public qustCat:QuestionCategoryProvider,public aws:AwsServiceProvider,
public toast:ToastProvider, public constant:ConstantsProvider,private cameraProvider:CameraProvider, public toast:ToastProvider, public constant:ConstantsProvider,private cameraProvider:CameraProvider,
private loading:LoadingProvider) private loading:LoadingProvider,public alertCtrl:AlertController)
{ {
this.pdDetails = this.navParams.get('pdDetails'); this.pdDetails = this.navParams.get('pdDetails');
this.pdid=this.pdDetails.pd_id; this.pdid=this.pdDetails.pd_id;
@ -310,6 +310,10 @@ submitOtherIncome(answerData)
{ {
let records: any = {}; let records: any = {};
let rentOptionCount: number = 0;
let validateFlag: number = 0;
let TextMessage :any;
records.parent_pdid=this.pdDetails.parent_pd_id records.parent_pdid=this.pdDetails.parent_pd_id
records.pdid = this.pdDetails.pd_id; records.pdid = this.pdDetails.pd_id;
records.formid = this.FormId.form_id; records.formid = this.FormId.form_id;
@ -317,6 +321,65 @@ submitOtherIncome(answerData)
records.other_income = answerData.other_income; records.other_income = answerData.other_income;
records.income_details = answerData.income_details; records.income_details = answerData.income_details;
records.otherincome_remarks = answerData.otherincome_remarks; records.otherincome_remarks = answerData.otherincome_remarks;
console.log(records);
// this.callSaveApi(records);
if (records.other_income == 'Yes') {
records.income_details.forEach(option => {
if (+option.source == 5) {
rentOptionCount++;
validateFlag = 1;
}
});
if(validateFlag == 1){
let params: any = {};
params.parent_pdid = this.pdDetails.parent_pd_id;
params.pd_id = this.pdDetails.pd_id;
params.pd_form_id = 17;
this.qustCat.retiverForm(params).subscribe(data=>{
if(!data['dataStatus']){
let text : any = rentOptionCount > 1 ? rentOptionCount + ' properties' : rentOptionCount + ' property' ;
TextMessage = '<center> You have chosen '+ text +' as rental income, but rental verification form is not filled </center>';
let alert=this.alertCtrl.create({
title:'Please Confirm',
message:TextMessage,
buttons:[
{
text:'Cancel',
role:'cancel',
handler:()=>{
alert.dismiss
}
},
{
text:'Confirm',
handler:()=>{
this.callSaveApi(records);
}
}
]
});
alert.present();
}
else if(data['dataStatus']){
this.callSaveApi(records);
}
})
}
else{
this.callSaveApi(records);
}
}
else{
this.callSaveApi(records);
}
}
callSaveApi(records){
this.qustCat.saveForm(records).subscribe(data => { this.qustCat.saveForm(records).subscribe(data => {
//TO CHANGE THE FORM STATE //TO CHANGE THE FORM STATE
this.otherIncomeForm.reset(this.otherIncomeForm.value); this.otherIncomeForm.reset(this.otherIncomeForm.value);

View File

@ -5,9 +5,9 @@
</button> </button>
<ion-title *ngIf="!viewchange">{{pageTitle}}</ion-title> <ion-title *ngIf="!viewchange">{{pageTitle}}</ion-title>
<ion-buttons end> <ion-buttons end>
<a (click)="capture()"> <!-- <a (click)="capture()">
<span style="padding: 0px;margin-right: 14px;color:white;font-size:25px;"><ion-icon name="md-camera"></ion-icon></span> <span style="padding: 0px;margin-right: 14px;color:white;font-size:25px;"><ion-icon name="md-camera"></ion-icon></span>
</a> </a> -->
<a (click)="saveAlert(rentalForms.value)" *ngIf="!complete_status"> <a (click)="saveAlert(rentalForms.value)" *ngIf="!complete_status">
<span style="padding: 0px;margin-right: 14px;color:white;font-size:20px;"><ion-icon name="fn-save"></ion-icon></span> <span style="padding: 0px;margin-right: 14px;color:white;font-size:20px;"><ion-icon name="fn-save"></ion-icon></span>
</a> </a>
@ -71,6 +71,7 @@
<mat-card> <mat-card>
<mat-card-title><strong>Property Details</strong></mat-card-title> <mat-card-title><strong>Property Details</strong></mat-card-title>
<button mini ion-fab color="optblue" slot="fixed" (click)="captureThePropertyPics()"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
<mat-card-content> <mat-card-content>

View File

@ -82,7 +82,7 @@ export class PdQuestionRentalInfoPage {
private loading:LoadingProvider,private cameraProvider:CameraProvider) private loading:LoadingProvider,private cameraProvider:CameraProvider)
{ {
this.data=this.navParams.get('values'); // for get the data from dash page this.data=this.navParams.get('values'); // for get the data from dash page
console.log("values",this.data) console.log("From Dashboard of Rental - values are ",this.data);
this.pageTitle = this.data.manage_status==1 ? 'Add RI Details' : 'Update RI Details'; this.pageTitle = this.data.manage_status==1 ? 'Add RI Details' : 'Update RI Details';
this.FormId = this.navParams.get('FormId'); this.FormId = this.navParams.get('FormId');
this.pdDetails = this.navParams.get('pdDetails'); this.pdDetails = this.navParams.get('pdDetails');
@ -1483,6 +1483,7 @@ forSearchableDropdown(val:any,Flag:any){
this.imageDisplay=[] this.imageDisplay=[]
let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.FormId.form_id,'company_id':null} let record_for_pic = {'pd_id':this.pdDetails.pd_id,'form_id':this.FormId.form_id,'company_id':null}
this.qustCat.getPDImages(record_for_pic).subscribe(val=>{ this.qustCat.getPDImages(record_for_pic).subscribe(val=>{
console.log('From getPDImages',val);
if(!val['msg']){ if(!val['msg']){
console.log(val['records']) console.log(val['records'])
if(val['records'].length>0){ if(val['records'].length>0){
@ -1509,6 +1510,19 @@ removeImg(index){
removeImgForBucket(index){ removeImgForBucket(index){
this.imageBucket.splice(index,1) this.imageBucket.splice(index,1)
} }
captureThePropertyPics(){
alert('rentalDataCount '+this.data.existing_rental_count_id);
this.cameraProvider.getpicture().then(res=>{
if(res != 'error'){
this.imageBucket.push({'image':res,'Name':'Property '+this.data.existing_rental_count_id});
}
},error=>{
console.log("Camera Error ",JSON.stringify(error));
})
this.tab='1';
}
capture(){ capture(){
//FOR CAPTURING PICS //FOR CAPTURING PICS
this.cameraProvider.getpicture().then(res=>{ this.cameraProvider.getpicture().then(res=>{

View File

@ -30,6 +30,7 @@ export class CameraProvider {
return this.camera.getPicture(options).then(imageData => { return this.camera.getPicture(options).then(imageData => {
console.log('From Camera.ts - getPicture fn image are',imageData)
const base64Image = 'data:image/png;base64,' + imageData; const base64Image = 'data:image/png;base64,' + imageData;
console.log("base 64",base64Image); console.log("base 64",base64Image);
return base64Image; return base64Image;
@ -54,6 +55,7 @@ export class CameraProvider {
return this.camera.getPicture(options).then(imageData => { return this.camera.getPicture(options).then(imageData => {
console.log('From Camera.ts - getcommonpicture fn image are',imageData)
const base64Image = 'data:image/png;base64,' + imageData.filter(data=>data.fk_form_id == null); const base64Image = 'data:image/png;base64,' + imageData.filter(data=>data.fk_form_id == null);
console.log("base 64",base64Image); console.log("base 64",base64Image);
return base64Image; return base64Image;