All section Camera Option available Please Refer Input.ts WIthout OTP Done

This commit is contained in:
venbaSriram 2019-01-29 10:06:01 +05:30
parent 26049f9353
commit c523f09636
5 changed files with 131 additions and 24 deletions

View File

@ -57,28 +57,40 @@
<mat-card-header>
</mat-card-header>
<ion-row>
<ion-col text-center>
<!-- <ion-col text-center>
<img [src]="commonImage || '../../assets/img/misc/avatar.jpg'" alt="Circle Image" class="rounded-circle img-fluid">
</ion-col>
</ion-col> -->
</ion-row>
<mat-card-content>
<ion-row>
<ion-col text-center>
<h4>OTP</h4>
<h4>With out OTP Reason</h4>
</ion-col>
</ion-row>
<ion-row>
<form [formGroup]="reasonForm">
<!-- {{reason_otp | json}} -->
<ion-col text-center>
<mat-form-field>
<input matInput placeholder="OTP" #pin style="width: 100%;" required>
<mat-form-field style="width: 100%">
<mat-select placeholder="Rejection Reason OTP" formControlName="reason" >
<mat-option *ngFor="let otp of reason_otp" [value]="otp.otp_rejection_id
">{{otp.rejection_reason}}</mat-option>
</mat-select>
</mat-form-field>
{{reason}}
<mat-form-field style="width: 100%" *ngIf="reasonForm.get('reason').value == 1">
<input type='text' matInput name="others_reason" formControlName="others_reason" placeholder="Other Reason">
</mat-form-field>
</ion-col>
</form>
</ion-row>
</mat-card-content>
<mat-card-footer>
<mat-card-actions text-center>
<!-- <button mat-raised-button color="primary" (click)="checkotp(pin.value)">OTP Verify</button> -->
<button mat-raised-button color="primary" (click)="saveotpreasno()">Process</button>
</mat-card-actions>
</mat-card-footer>
</mat-card>
</ion-content>

View File

@ -5,6 +5,8 @@ import { PdQuestionCategoryPage } from '../pd-question-category/pd-question-cate
import { ToastProvider } from '../../providers/common-provider/toast';
import { ConstantsProvider } from '../../providers/constants/constants';
import { AwsServiceProvider } from '../../providers/aws-service/aws-service';
import { QuestionCategoryProvider } from '../../providers/question-category/question-category';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
/**
@ -22,6 +24,8 @@ import { AwsServiceProvider } from '../../providers/aws-service/aws-service';
export class OtpPage {
timeLimit: any;
reason_otp: any;
users: any;
timerOn: boolean = true;
balance_time: string;
@ -31,9 +35,17 @@ export class OtpPage {
applicatentDetails: any;
commonImage:any;
maxtime: any=30;
constructor(public navCtrl: NavController, public navParams: NavParams,public pddetails:PdtriggerProvider,public toast:ToastProvider,public Menu:MenuController,public commonconstant:ConstantsProvider,public aws:AwsServiceProvider,public alertCtrl:AlertController) {
reasonForm:FormGroup
constructor(public navCtrl: NavController, public navParams: NavParams,public pddetails:PdtriggerProvider,public toast:ToastProvider,public Menu:MenuController,public commonconstant:ConstantsProvider,public aws:AwsServiceProvider,public alertCtrl:AlertController,public qustCat:QuestionCategoryProvider,public fb:FormBuilder) {
this.commonImage = this.commonconstant.commonimage;
this.applicatentDetails = this.navParams.get('pdDetails');
this.reasonForm = this.fb.group(
{
reason:[null,Validators.compose([Validators.required])],
others_reason:[null],
})
this.getDropdown();
}
ionViewDidLoad() {
@ -41,11 +53,23 @@ export class OtpPage {
}
ionViewDidEnter(){
//this.Menu.enable(false);
this.timer(5);
this.timer(1);
}
ionViewWillLeave(){
//this.Menu.enable(true);
clearTimeout(this.timeLimit);
}
getDropdown()
{
this.qustCat.getcommondrop('OTPREJECTION').subscribe(res=>
{
if(res['dataStatus']==true)
{
this.reason_otp = res['records'].filter(otp=>otp.isactive==1);
// console.log(this.reason_otp);
}
})
}
checkotp(otp)
{
@ -73,9 +97,9 @@ export class OtpPage {
// var balance_time = m + ':' + s;
this.balance_time = m + ':' + s;
remaining -=1;
console.log(this.balance_time);
// console.log(this.balance_time);
if(remaining >= 0 && this.timerOn) {
setTimeout(()=> {
this.timeLimit = setTimeout(()=> {
this.timer(remaining);
}, 1000);
return;
@ -90,19 +114,19 @@ export class OtpPage {
this.users = this.aws.getlocale();
let data:any;
let alert = this.alertCtrl.create({
title: 'Starting PD Officer',
message: 'Do you want sure PD officer Start',
title: 'OTP Expired ',
message: 'Do you want sure resend OTP',
buttons: [
{
text: 'No',
role: 'cancel',
text: 'OTP Without Start',
handler: () => {
this.otpStatusAccess = false;
}
},
{
text: 'YES',
text: 'Resend OTP',
handler: () => {
@ -122,9 +146,27 @@ export class OtpPage {
alert.present();
}
check()
saveotpreasno()
{
console.log('check');
console.log(this.reasonForm.value);
if(this.reasonForm.valid)
{
let data = {'pd_id':this.applicatentDetails.pd_id,'reason':this.reasonForm.value.reason,'other_reason':this.reasonForm.value.others_reason};
this.pddetails.checkotp(data).subscribe(res=>
{
this.otpStatus = res;
if(this.otpStatus.dataStatus == true)
{
this.navCtrl.setRoot(PdQuestionCategoryPage,{'pdDetails':this.applicatentDetails});
}else
{
// this.toast.pdTriggerappmessage('Enter the Correct OTP');
}
})
}else
{
this.toast.pdTriggerappmessage('Enter The All Field');
}
}
}

View File

@ -24,11 +24,29 @@
<img class="img-responsive" src="{{img.image}}" imageViewer/>
<div *ngIf="img.name !=''">
{{img.name}}
</div>
<div *ngIf="img.name == ''">
<input matInput type="text" name="docName" (blur)="docnames($event.target.value,i,img.image)" placeholder="File Name" required>
<!-- <mat-error *ngIf="pdforms.controls['docName'].hasError('required')">File Name Required</mat-error> -->
</div>
<div *ngIf="img.name !=''">
{{img.Name}}
</div>
</ion-col>
</ion-row>
<ion-row>
<!-- <ion-buttons >
<ion-button color="optblue"
full[disabled]="!pdforms.valid" mat-raised-button style="width:100%" (click)="savepdDetails(pdforms.value)">Save <ion-icon name="md-disc"></ion-icon></ion-button> -->
<!-- </ion-buttons> -->
</ion-row>
</mat-card>
<ion-footer>
<ion-row>
<button ion-button full color="primary" style="background-color: green !important;" [disabled]="saveAccess" (click)="savePDImages()">
Save</button>
</ion-row>
</ion-footer>
</ion-content>

View File

@ -1,6 +1,8 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { CameraProvider } from '../../providers/common-provider/camera';
import { QuestionCategoryProvider } from '../../providers/question-category/question-category';
import { ToastProvider } from '../../providers/common-provider/toast';
/**
* Generated class for the PdGeneralImagesPage page.
@ -19,9 +21,13 @@ export class PdGeneralImagesPage {
cameraArr:any = [];
applicatentDetails: any;
count:any = 0;
constructor(public navCtrl: NavController, public navParams: NavParams,public camera:CameraProvider) {
saveAccess:boolean =false;
FormId:any = '';
constructor(public navCtrl: NavController, public navParams: NavParams,public camera:CameraProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider) {
this.applicatentDetails = this.navParams.get('pdDetails');
this.FormId = this.navParams.get('FormId');
}
ionViewDidLoad() {
@ -34,7 +40,7 @@ export class PdGeneralImagesPage {
{
this.count = this.count+1;
this.cameraArr.push({'image':image,'name':'images-'+this.count});
this.cameraArr.push({'image':image,'name':''});
});
}
@ -44,4 +50,26 @@ export class PdGeneralImagesPage {
this.cameraArr.splice(i,1);
}
docnames(doc,i,img)
{
this.cameraArr[i] = {'image':img,'Name':doc};
// console.log(JSON.stringify(this.pddocdata));
}
savePDImages()
{
this.saveAccess = true;
let records :any = {'pd_id':this.applicatentDetails.pd_id,'formid':''};
records.images = this.cameraArr;
this.qustCat.savePDImages(records).subscribe(res=>
{
if(res['dataStatus']==true){
this.saveAccess = false;
this.navCtrl.pop();
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
}
})
}
}

View File

@ -76,4 +76,11 @@ getTypeofActivityForSuppliedInfoForm(pd_id: any){
return this.http.post<any>(this.apiurl+"getTypeOfActivetyFromBusinessForm", {"records": { "pd_id" : pd_id }});
}
/*****Save Images */
savePDImages(imagesDetails)
{
let record = {'records':imagesDetails};
return this.http.post(this.apiurl+'savePDPhotos',record);
}
}