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>
<img src="{{image.image}}" imageViewer><br/>
<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)">
<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>
<img src="{{image.image}}" imageViewer><br/>
<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)">
<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>
</ion-col>
<hr/>

View File

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

View File

@ -1648,7 +1648,7 @@
Image </label>
</div>
<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>
@ -1857,10 +1857,24 @@
<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"
[formGroupName]="i">
<mat-form-field style="width:80%">
<mat-form-field style="width:65%">
<input matInput placeholder="Specify Document Details" formControlName="document">
</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">
<ion-icon name="md-trash"></ion-icon>
</button>

View File

@ -150,10 +150,6 @@ export class PdQuestionBusinessInfoPage {
other_documents: [''],
documents: this.fb.array([]),
business_remarks:['']
})
this.getdropdown();
@ -354,7 +350,7 @@ changeOfStartedBusiness(members,i,e){
otherDoc.push(this.createDocument());
});
} else {
DocArray = [{document: ''}];
DocArray = [{document: '',document_pic: ''}];
otherDoc.push(this.createDocument());
}
businessVal.parent_pdid=this.pdDetails.parent_pd_id
@ -1437,7 +1433,8 @@ maxSaleState():FormGroup{
}
createDocument() {
return this.fb.group({
document: ['']
document: [''],
document_pic: [''],
});
}
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) {
this.relativeNames = [];
event.value.forEach(option => {
@ -1997,7 +2004,7 @@ if(records.pos_machines_details){
otherDoc.push(this.createDocument());
});
} else {
DocArray = [{document: ''}];
DocArray = [{document: '',document_pic: ''}];
otherDoc.push(this.createDocument());
}
if (data['records'].ownership_setup != 'others') {
@ -2276,6 +2283,7 @@ toGetPOSMachinesDetails(e,flag){
//FOR RETRIEVING PICTURES
this.imageDisplay=[]
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=>{
if(!val['msg']){
console.log(val['records'])

View File

@ -5,9 +5,9 @@
</button>
<ion-title *ngIf="!viewchange">{{formDetails.form_name}}</ion-title>
<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>
</a>
</a> -->
<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>
</a>
@ -79,6 +79,7 @@
<div *ngFor="let items of item.controls.main_raw_materials['controls']; let l=index;let last =last"
[formGroupName]="l">
<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>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<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"
[formGroupName]="l">
<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>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<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"
[formGroupName]="l">
<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>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">

View File

@ -672,6 +672,26 @@ this.complete_status = this.pdDetails.pd_status == 'COMPLETED' ? true : false;
removeImgForBucket(index){
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(){
//FOR CAPTURING PICS
this.cameraProvider.getpicture().then(res=>{

View File

@ -77,6 +77,7 @@
<mat-card-header>
<mat-card-title>
<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-header>
<mat-form-field>

View File

@ -48,6 +48,7 @@ export class PdQuestionFinancialInfoPage {
formDetails: any;
CustSegAbbr:any;
temparray : any = [];
picsArrayLength :any = 0;
ServiceDataAvailability:boolean = false;
av : any =[{id:6, name:'Letter of Credit'},
@ -310,8 +311,7 @@ submitDetails(){
if(this.CustSegAbbr == 'AI'){
this.financialForm.removeControl('estimated_value');
this.financialForm.controls['is_financial_customer'].setValue('');
}
}
if(this.financialForm.value.date_per_financial['finanical_profit_or_loss'] == 1){
this.financialForm.value.date_per_financial['financial_net_profit'].setValidators([Validators.required]);
@ -342,6 +342,12 @@ submitDetails(){
}
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);
if(records.is_there_working_capital_available == "no"){
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 ;
}
this.qustCat.saveForm(records).subscribe(res=>{
if(res['status']== 200){
this.financialForm.markAsUntouched();
this.toast.pdTriggerappmessage("Record Saved Successfully");
setTimeout(()=>{
this.navCtrl.pop();
},2000);
}
else{
this.toast.pdTriggerappmessage("Warning !! Something went Wrong");
}
},err=>{
this.toast.pdTriggerappmessage("Server is not Responding");
})
// this.qustCat.saveForm(records).subscribe(res=>{
// if(res['status']== 200){
// this.financialForm.markAsUntouched();
// this.toast.pdTriggerappmessage("Record Saved Successfully");
// setTimeout(()=>{
// this.navCtrl.pop();
// },2000);
// }
// else{
// this.toast.pdTriggerappmessage("Warning !! Something went Wrong");
// }
// },err=>{
// this.toast.pdTriggerappmessage("Server is not Responding");
// })
}
getDetails(){
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}
this.qustCat.getPDImages(record_for_pic).subscribe(val=>{
if(!val['msg']){
this.picsArrayLength = val['records'].length;
console.log(val['records'])
if(val['records'].length>0){
val['records'].forEach(result=>{
@ -1495,6 +1502,15 @@ calculateLossAmount( i, details){
removeImgForBucket(index){
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(){
//FOR CAPTURING PICS
this.cameraProvider.getpicture().then(res=>{

View File

@ -5,9 +5,9 @@
</button>
<ion-title>{{formDetails.form_name}}</ion-title>
<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>
</a>
</a> -->
<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>
</a>
@ -69,6 +69,7 @@
<div *ngIf="noRecordsFound">
<form [formGroup]="supplierInfoForm">
<div fxLayout="row" fxLayoutAlign="start none">
<mat-card *ngIf="manufacturingForm">
<mat-card-title>
<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"
[formGroupName]="l">
<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>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<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"
[formGroupName]="l">
<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>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">

View File

@ -535,6 +535,28 @@ export class PdQuestionSupplierInfoPage {
removeImgForBucket(index){
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(){
//FOR CAPTURING PICS
this.cameraProvider.getpicture().then(res=>{

View File

@ -1,5 +1,5 @@
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 { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
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,
public qustCat:QuestionCategoryProvider,public aws:AwsServiceProvider,
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.pdid=this.pdDetails.pd_id;
@ -310,6 +310,10 @@ submitOtherIncome(answerData)
{
let records: any = {};
let rentOptionCount: number = 0;
let validateFlag: number = 0;
let TextMessage :any;
records.parent_pdid=this.pdDetails.parent_pd_id
records.pdid = this.pdDetails.pd_id;
records.formid = this.FormId.form_id;
@ -317,16 +321,75 @@ submitOtherIncome(answerData)
records.other_income = answerData.other_income;
records.income_details = answerData.income_details;
records.otherincome_remarks = answerData.otherincome_remarks;
this.qustCat.saveForm(records).subscribe(data => {
//TO CHANGE THE FORM STATE
this.otherIncomeForm.reset(this.otherIncomeForm.value);
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
setTimeout(()=>{
this.navCtrl.pop();
},2000);
}, error => {
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 => {
//TO CHANGE THE FORM STATE
this.otherIncomeForm.reset(this.otherIncomeForm.value);
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
setTimeout(()=>{
this.navCtrl.pop();
},2000);
}, error => {
})
}
getOtherIncome()

View File

@ -5,9 +5,9 @@
</button>
<ion-title *ngIf="!viewchange">{{pageTitle}}</ion-title>
<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>
</a>
</a> -->
<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>
</a>
@ -71,6 +71,7 @@
<mat-card>
<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>

View File

@ -82,7 +82,7 @@ export class PdQuestionRentalInfoPage {
private loading:LoadingProvider,private cameraProvider:CameraProvider)
{
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.FormId = this.navParams.get('FormId');
this.pdDetails = this.navParams.get('pdDetails');
@ -1483,6 +1483,7 @@ forSearchableDropdown(val:any,Flag:any){
this.imageDisplay=[]
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=>{
console.log('From getPDImages',val);
if(!val['msg']){
console.log(val['records'])
if(val['records'].length>0){
@ -1509,6 +1510,19 @@ removeImg(index){
removeImgForBucket(index){
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(){
//FOR CAPTURING PICS
this.cameraProvider.getpicture().then(res=>{

View File

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