approx image in address : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-06-09 11:44:24 +05:30
parent 081657b00a
commit baf1976d40
5 changed files with 87 additions and 47 deletions

View File

@ -8,7 +8,7 @@
<ion-title *ngIf="!viewchange">{{FormId.form_name}}</ion-title>
<ion-buttons end>
<a (click)="savePhoto()">
<a (click)="savePhoto(1)">
<!-- <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>
@ -55,21 +55,19 @@
<ion-grid *ngIf="imageDisplay.length >0 ">
<ion-row>
<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/>
<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>
</ion-col>
</ion-col>
<hr/>
</ion-row>
</ion-grid>
<hr/>
<hr/>
<ion-grid *ngIf="imageBucket.length >0 ">
<label style="font-size:14px;color:gray">Newly Captured Pics</label><br/>
<ion-row>
@ -204,8 +202,8 @@
autocomplete="off">
</mat-form-field> -->
<div fxLayout="column" fxLayoutAlign="start stretch">
<mat-form-field style="width: 100%;">
<!-- <div fxLayout="column" fxLayoutAlign="start stretch"> -->
<!-- <mat-form-field style="width: 100%;">
<mat-select placeholder="Approach to PD Location" name="pd_location" formControlName="pd_location" required>
<mat-option>Select</mat-option>
<mat-option value="{{data.pd_location_approach_id}}"
@ -213,8 +211,35 @@
</mat-option>
</mat-select>
<mat-error align="end" style="font-size:13px" *ngIf="item.controls['pd_location'].errors?.required || item.controls['pd_location'].touched">PD Location is Required</mat-error>
</mat-form-field>
</div>
</mat-form-field> -->
<!-- </div> -->
<ion-row>
<mat-form-field style="width: 85%;">
<mat-select placeholder="Approach to PD Location" name="pd_location" formControlName="pd_location" required>
<mat-option>Select</mat-option>
<mat-option value="{{data.pd_location_approach_id}}"
*ngFor="let data of pdlocation">{{data.description}}
</mat-option>
</mat-select>
<mat-error align="end" style="font-size:13px" *ngIf="item.controls['pd_location'].errors?.required || item.controls['pd_location'].touched">PD Location is Required</mat-error>
</mat-form-field>
<div style="width: 10%;" *ngIf="item.get('pd_location').value != ''">
<button mini ion-fab color="optblue" slot="fixed" (click)="savePhoto(2)"><ion-icon name="md-camera" style="font-size: 24px"></ion-icon></button>
</div>
</ion-row>
<div layout="row" flex>
<!-- <md-input-container flex class="md-icon-float md-block md-title">
<label>Your font number</label>
!-- below is the material icons --
<md-icon class="material-icons">phone</md-icon>
<input type="text">
</md-input-container> -->
</div>
<div fxLayout="column" fxLayoutAlign="start stretch">
<mat-form-field style="width: 100%;">

View File

@ -14,6 +14,9 @@ page-pd-question-address {
textarea {
resize: none;
}
.my-width{
width:600px;
}
//FOR IMAGE AND INPUT FIELD
img{
padding:0 5px 0 0;

View File

@ -13,6 +13,7 @@ import { takeUntil } from 'rxjs/operators';
import{LoadingProvider} from '../../../providers/common-provider/loading'
import {StorageProvider} from '../../../providers/storage/storage'
import 'rxjs/add/observable/interval';
import { DatePipe } from '@angular/common';
// import{CacheService} from 'ionic-cache-observable'
/**
* Generated class for the PdQuestionAddressPage page.
@ -71,7 +72,8 @@ export class PdQuestionAddressPage {
pincodeValue:any=[]
cityDataValue:any=[]
complete_status : boolean = false;
pipe = new DatePipe('en-US');
AppxPDLocationImgValid : boolean = false;
// counts:number = 1;
private search:searchValue[]
protected _onDestroy = new Subject<void>();
@ -643,6 +645,10 @@ countRowsForTextarea(text){
this.toast.pdTriggerappmessage("Please Fill all the Mandatory Fields marked with ' * '")
return
}
if(this.AppxPDLocationImgValid == false){
this.toast.pdTriggerappmessage("Please Take the Image for Approach to PD Location");
return
}
records.addresses=answerData.addresses
// records.addressess
records.address_form_remark=answerData.address_form_remark
@ -980,12 +986,14 @@ countRowsForTextarea(text){
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('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','is_show_report': result.is_show_report == null ? 0 : result.is_show_report })
let img_title = (result.pd_document_title).split('(');
if(img_title[0] == 'Approach to PD Location '){
this.AppxPDLocationImgValid = true;
}
})
console.log("image Display Data Are",this.imageDisplay);
}
@ -994,34 +1002,34 @@ countRowsForTextarea(text){
}
changeName(value,index,img){
console.log('inside changeName Fn - its param are ',value,'Index are ',index,'active are');
// 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);
// 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);
// 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}
}
changeOptions(event: any,index: any){
console.log('Option Changed ' + event);
// console.log('Option Changed ' + event);
this.imageBucket[index].is_show_report=event;
console.log('this.imageBucket',JSON.stringify(this.imageBucket));
// console.log('this.imageBucket',JSON.stringify(this.imageBucket));
}
removeImg(index){
console.log('inside removeImg Fn - its param are - Index only ',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);
// console.log('inside removeImgForBucket Fn - its param are - Index only ',index);
this.imageBucket.splice(index,1)
console.log("image Display Data Are",this.imageDisplay);
// console.log("image Display Data Are",this.imageDisplay);
}
savePhoto(){
console.log('savePhoto');
savePhoto(flag){
// console.log('savePhoto');
let currentDate = this.pipe.transform(new Date(), 'yyyy-MM-dd hh:mm:ss');
this.camera.getPicture({
quality: 100,
destinationType: this.camera.DestinationType.DATA_URL,
@ -1029,11 +1037,16 @@ countRowsForTextarea(text){
targetHeight: 600,
correctOrientation: true
}).then((imageData)=>{
console.log('inside savePhoto Fn - its response ',imageData);
// console.log('inside savePhoto Fn - its response ',imageData);
this.base64='data:image/png;base64,'+imageData
this.imageBucket.push({'image':this.base64,'Name':'','is_show_report':''});
// this.imageDisplay.push({'image':this.base64,'Name':''})
this.getImageName(this.imageBucket.length-1)
if(flag == 1){
this.imageBucket.push({'image':this.base64,'Name':'','is_show_report':''});
// this.imageDisplay.push({'image':this.base64,'Name':''})
this.getImageName(this.imageBucket.length-1)
}else if(flag == 2){
// console.log('flag');
this.imageBucket.push({'image':this.base64,'Name':'Approach to PD Location ( ' + currentDate + ' )','is_show_report':''});
}
},(err)=>{
//alert("error");
})
@ -1045,12 +1058,12 @@ countRowsForTextarea(text){
}
getImageName(index){
console.log('inside get Image Name Fn - its param are - Index only ',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('Reponse',value,'Reponse AS Name',value.Name,value.IsShowReport);
// console.log('Reponse',value,'Reponse AS Name',value.Name,value.IsShowReport);
this.imageBucket[index].Name=value.Name;
});
@ -1086,7 +1099,6 @@ countRowsForTextarea(text){
sendImage(){
this.loading.loaderForSendImage()
let records:any={
'pd_id':this.pdDetails.pd_id,
'formid':this.FormId.form_id,
@ -1094,7 +1106,7 @@ countRowsForTextarea(text){
'company_id':''
}
console.log("inside SendImage Function - records array",JSON.stringify(records))
// console.log("inside SendImage Function - records array",JSON.stringify(records))
this.qustCat.savePDImages(records).subscribe(res=>{
if(res['dataStatus']== true){
@ -1117,7 +1129,7 @@ countRowsForTextarea(text){
this.storagedb.insertData(datas).then(res=>{
// let alert=this.toast.setAlert('data',JSON.stringify(res))
// alert.present();
console.log("inside localInsert Fn - its Response",res);
// console.log("inside localInsert Fn - its Response",res);
})
}
}

View File

@ -32,7 +32,7 @@
">{{expense.expense_item}}</mat-option>
</mat-select>
</mat-form-field >
<mat-form-field style="width: 100%" *ngIf="item.get('annual_expenses_value').value == 1">
<mat-form-field style="width: 100%" *ngIf="item.get('expense_item_id').value == 1">
<input type="text" matInput placeholder="Specify Business Expense" formControlName="other_expense_item" >
</mat-form-field>
<mat-form-field style="width: 100%">

View File

@ -361,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']