form changes

This commit is contained in:
venbaSriram 2018-12-18 19:13:21 +05:30
parent a2d8b364d8
commit 3660e97785
110 changed files with 3557 additions and 869 deletions

0
src/app/app.component.ts Normal file → Executable file
View File

1
src/app/app.html Normal file → Executable file
View File

@ -22,5 +22,6 @@
</ion-list>
</ion-content>
</ion-menu>
<!-- Disable swipe-to-go-back because it's poor UX to combine STGB with side menus -->
<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>

18
src/app/app.module.ts Normal file → Executable file
View File

@ -95,6 +95,12 @@ import { PdQuestionAssessedSalesPage } from '../pages/pd-question/pd-question-as
import { PdQuestionAssessedHouseholdPage } from '../pages/pd-question/pd-question-assessed-household/pd-question-assessed-household';
import { PdQuestionAssessedPurchasePage } from '../pages/pd-question/pd-question-assessed-purchase/pd-question-assessed-purchase';
import { PdQuestionAssessedDashPage } from '../pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash';
import { BouncedRejectPage } from '../pages/input/bounced-reject/bounced-reject';
import { PdQuestionAssessedBusinessPage } from '../pages/pd-question/pd-question-assessed-business/pd-question-assessed-business';
import { PdQuestionLenderRepresentativePage } from '../pages/pd-question/pd-question-lender-representative/pd-question-lender-representative';
import { PdQuestionGeneralInfoPage } from '../pages/pd-question/pd-question-general-info/pd-question-general-info';
import { PdQuestionGeneralOtherApplicantPage } from '../pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant';
import { PdQuestionNeighbourHoodPage } from '../pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood';
@NgModule({
declarations: [
@ -131,6 +137,12 @@ import { PdQuestionAssessedDashPage } from '../pages/pd-question/pd-question-ass
PdQuestionAssessedHouseholdPage,
PdQuestionAssessedPurchasePage,
PdQuestionAssessedDashPage,
BouncedRejectPage,
PdQuestionAssessedBusinessPage,
PdQuestionLenderRepresentativePage,
PdQuestionGeneralInfoPage,
PdQuestionGeneralOtherApplicantPage,
PdQuestionNeighbourHoodPage,
],
imports: [
BrowserModule,ReactiveFormsModule,FormsModule,
@ -203,6 +215,12 @@ import { PdQuestionAssessedDashPage } from '../pages/pd-question/pd-question-ass
PdQuestionAssessedHouseholdPage,
PdQuestionAssessedPurchasePage,
PdQuestionAssessedDashPage,
BouncedRejectPage,
PdQuestionAssessedBusinessPage,
PdQuestionLenderRepresentativePage,
PdQuestionGeneralInfoPage,
PdQuestionGeneralOtherApplicantPage,
PdQuestionNeighbourHoodPage,
],
providers: [

0
src/app/main.ts Normal file → Executable file
View File

0
src/assets/img/misc/login.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 628 KiB

After

Width:  |  Height:  |  Size: 628 KiB

0
src/assets/img/misc/sidemenubg.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

0
src/index.html Normal file → Executable file
View File

0
src/manifest.json Normal file → Executable file
View File

View File

@ -21,7 +21,7 @@
<ion-row>
<ion-col text-center>
<mat-form-field>
<input matInput placeholder="New PIN" #newpassword pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required>
<input matInput type="password" placeholder="New PIN" #newpassword pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required>
</mat-form-field>
@ -59,7 +59,7 @@
<ion-row>
<ion-col text-center>
<mat-form-field>
<input matInput placeholder="PIN" #pin pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required>
<input matInput type="password" placeholder="PIN" #pin pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required>
</mat-form-field>
</ion-col>
</ion-row>

0
src/pages/googleplaytab/googleplaytab.html Normal file → Executable file
View File

0
src/pages/googleplaytab/googleplaytab.scss Normal file → Executable file
View File

0
src/pages/googleplaytab/googleplaytab.ts Normal file → Executable file
View File

View File

@ -0,0 +1,36 @@
<ion-header>
<ion-navbar color="optblue">
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Bounced Reject Reason</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<mat-card>
<mat-form-field style="width:100%">
<mat-select [(ngModel)]="bounce_reason" name="bounce_reason" placeholder="Reason">
<mat-option *ngFor="let bouns of bounseMaster" [value]="bouns.bounce_id">{{bouns.bounce_reason_name}}</mat-option>
</mat-select>
</mat-form-field>
<!-- {{bounce_reason}} -->
<mat-form-field style="width:100%" *ngIf="bounce_reason=='4'">
<input matInput placeholder="reason Others" name="bounce_reason_others" [(ngModel)]="bounce_reason_others"></mat-form-field>
<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> -->
<button ion-button full color="optblue" (click)="updatePDStatus()"> Save</button>
<!-- </ion-buttons> -->
</ion-row>
</mat-card>
</ion-content>

View File

@ -0,0 +1,3 @@
page-bounced-reject {
}

View File

@ -0,0 +1,65 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ViewController } from 'ionic-angular';
import { AwsServiceProvider } from '../../../providers/aws-service/aws-service';
import { PdtriggerProvider } from '../../../providers/pdtrigger/pdtrigger';
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { PdListPage } from '../../pd-list/pd-list';
/**
* Generated class for the BouncedRejectPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@Component({
selector: 'page-bounced-reject',
templateUrl: 'bounced-reject.html',
})
export class BouncedRejectPage {
users: any;
bounseMaster: any;
pdDetails: any;
status: any;
bounce_reason:any;
bounce_reason_others:any = null;
constructor(public navCtrl: NavController, public navParams: NavParams,public viewCtrl:ViewController,public aws:AwsServiceProvider,public pdservice:PdtriggerProvider,public qustCat:QuestionCategoryProvider,public fb:FormBuilder) {
this.pdDetails = this.navParams.get('appdetails');
this.status = this.navParams.get('status');
this.users = this.aws.getlocale();
this.getDropdown();
}
getDropdown()
{
this.qustCat.getcommondrop('BOUNCEMASTER').subscribe(res=>
{
if(res['dataStatus']==true){
this.bounseMaster = res['records'].filter(bouns=>bouns.isactive==1);
console.log(this.bounseMaster);
}
})
}
updatePDStatus()
{
if(this.bounce_reason !=null)
{
let data = {'pd_id':this.pdDetails.pd_id,'pd_status':this.status,'fk_updatedby':this.users,'bounce_reason':this.bounce_reason,'bounce_reason_others':this.bounce_reason_others};
this.pdservice.updatepdStatus(data).subscribe(res=>
{
// this.updateStatus = res;
if(res['dataStatus'] == true)
{
this.navCtrl.setRoot(PdListPage);
}
})
}
}
}

View File

@ -44,7 +44,7 @@
<hr>
<ion-row *ngIf="scheduleAccess || scheduleCancel">
<ion-col col-1 class="cusicon"></ion-col>
<!-- <ion-col col-1 class="cusicon"></ion-col> -->
<ion-item>
<ion-label color="primary" floating>Schedule Date</ion-label>
<ion-input type="datetime-local" min="{{CurrentDate}}" (blur)="changeDate(scheduleDate)" [(ngModel)]="scheduleDate" placeholder="Text Input"></ion-input>

View File

@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, AlertController } from 'ionic-angular';
import { IonicPage, NavController, NavParams, AlertController, ModalController } from 'ionic-angular';
import {Validators, FormBuilder, FormGroup, FormArray } from '@angular/forms';
// import {MomentDateAdapter} from '@angular/material-moment-adapter';
import {DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/core';
@ -17,6 +17,8 @@ import { DatePicker } from '@ionic-native/date-picker';
import { Geolocation, PositionError, Geoposition } from '@ionic-native/geolocation';
import { ToastProvider } from '../../providers/common-provider/toast';
import { ConstantsProvider } from '../../providers/constants/constants';
import { BouncedRejectPage } from './bounced-reject/bounced-reject';
import {DatePipe } from '@angular/common';
/**
* Generated class for the InputPage page.
*
@ -33,6 +35,8 @@ const currentdate = new Date().toJSON().slice(0,19).replace('T',' ');
export class InputPage {
diffInHours: any;
pipe = new DatePipe('en-US');
leaveDayName: string;
pickdayName: string;
CurrentDate: string;
@ -51,27 +55,36 @@ acceptedAccess:boolean = false;
startedAccess:boolean = false;
currentPosPDofficer:any;
constructor(public navCtrl: NavController, public navParams: NavParams,public fb:FormBuilder,public statusBar:StatusBar,public platform: Platform,public launchNavigator:LaunchNavigator,public aws:AwsServiceProvider,public pdDetails:PdtriggerProvider,public geolocation:Geolocation,public datePicker:DatePicker,public toast:ToastProvider,public constant:ConstantsProvider,public alertCtrl:AlertController) {
constructor(public navCtrl: NavController, public navParams: NavParams,public fb:FormBuilder,public statusBar:StatusBar,public platform: Platform,public launchNavigator:LaunchNavigator,public aws:AwsServiceProvider,public pdDetails:PdtriggerProvider,public geolocation:Geolocation,public datePicker:DatePicker,public toast:ToastProvider,public constant:ConstantsProvider,public alertCtrl:AlertController,public modalCtrl:ModalController) {
this.CurrentDate = this.constant.getcurrentDate();
// console.log(this.CurrentDate);
/***Header value pass */
this.statusBar.styleDefault();
let timeStart:string = this.pipe.transform(new Date(),'dd/MM/yyyy hh:mm a');
// let timesch = (new Date().getHours() +4);
this.statusBar.overlaysWebView(false);
this.statusBar.backgroundColorByHexString('#db4437');
this.applicatentDetails = this.navParams.get('pdDetails');
let timeEnd:string = this.applicatentDetails.scheduled_on;
console.log(timeEnd,timeStart);
let hourDiff:number = Date.parse(timeStart)-Date.parse(timeEnd);
console.log(hourDiff);
this.diffInHours = Math.floor(hourDiff / 1000 / 60 / 60);
// console.log(diffInHours);
// console.log(this.applicatentDetails);
if(this.applicatentDetails.pd_status == 'ALLOCATED')
{
this.acceptedAccess = true;
}
if(this.applicatentDetails.pd_status == 'ACCEPTED')
if(this.applicatentDetails.pd_status == 'ACCEPTED' )
{
this.scheduleAccess = true;
}
if(this.applicatentDetails.pd_status == 'SCHEDULED')
if(this.applicatentDetails.pd_status == 'SCHEDULED' && this.diffInHours>=-4)
{
this.initiatedAccess = true;
@ -83,7 +96,7 @@ currentPosPDofficer:any;
}
this.users = this.aws.getlocale();
this.checkScheduleDate();
// this.checkScheduleDate();
}
@ -118,12 +131,8 @@ currentPosPDofficer:any;
checkScheduleDate(){
// alert();
// console.log((this.applicatentDetails.scheduled_on).get);
// console.log(new Date("2000/01-01 10:30 AM").getHours());
// let timeStart = new Date(this.applicatentDetails.scheduled_on).getHours();
// let timeEnd = new Date().getHours();
// console.log(new Date());
// let hourDiff = timeEnd-timeStart;
// console.log(hourDiff);
}
locationnavicate(address)
{
@ -146,15 +155,17 @@ currentPosPDofficer:any;
if(status == 'BOUNCED')
{
data = {'pd_id':appdetails.pd_id,'pd_status':status,'fk_updatedby':this.users,'updatedon':currentdate};
this.pdDetails.updatepdStatus(data).subscribe(res=>
{
this.updateStatus = res;
if(this.updateStatus.dataStatus == true)
{
this.navCtrl.setRoot(PdListPage);
}
})
let bouseModal = this.modalCtrl.create(BouncedRejectPage,{'status':status,'appdetails':appdetails});
bouseModal.present();
// this.pdDetails.updatepdStatus(data).subscribe(res=>
// {
// this.updateStatus = res;
// if(this.updateStatus.dataStatus == true)
// {
// this.navCtrl.setRoot(PdListPage);
// }
// })
}else if(status == 'ACCEPTED')
{
data = {'pd_id':appdetails.pd_id,'pd_status':status,'fk_updatedby':this.users,'updatedon':currentdate};
@ -292,7 +303,7 @@ currentPosPDofficer:any;
{
this.scheduleAccess = true;
}
if(this.applicatentDetails.pd_status == 'SCHEDULED')
if(this.applicatentDetails.pd_status == 'SCHEDULED' && this.diffInHours>=-4)
{
this.initiatedAccess = true;
}
@ -306,3 +317,5 @@ currentPosPDofficer:any;
})
}
}

0
src/pages/otp/otp.html Normal file → Executable file
View File

0
src/pages/otp/otp.scss Normal file → Executable file
View File

0
src/pages/otp/otp.ts Normal file → Executable file
View File

View File

@ -144,8 +144,8 @@
<div *ngIf="!pdlistaccess && pdlistaccess !=null" text-center>
<!-- <ion-icon name="md-folder-open" style="font-size:35.5rem;"></ion-icon> -->
<h1>{{pdlistdetails}}</h1>
<h1>test</h1>
</div>
</ion-content>

View File

@ -3,7 +3,7 @@
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title *ngIf="!viewchange">PD Questions Category</ion-title>
<ion-title *ngIf="!viewchange">{{pddetails.applicat_details[0].applicant_name | titlecase}}</ion-title>
<ion-title *ngIf="viewchange"> <ion-searchbar
@ -67,14 +67,14 @@
<ion-list >
<ion-grid>
<mat-card class="md-box" reorder="true">
<!-- <mat-card class="md-box" reorder="true">
<ion-list >
<ion-item >
<ion-icon item-start="" class="lettericon" style="background-color: #c30915">{{pddetails.applicat_details[0].applicant_name | slice : 0 :1 | uppercase}}</ion-icon>
<ion-row>
<ion-col *ngIf="pddetails.applicat_details.length !=0 && pddetails.applicat_details[0].applicant_type == 1">
<h1>{{pddetails.applicat_details[0].applicant_name | titlecase}}</h1>
<!--<p>28 Sep 2018 10:00 AM</p>-->
<!--<p>28 Sep 2018 10:00 AM</p>-
</ion-col>
</ion-row>
<ion-row>
@ -101,7 +101,7 @@
</ion-list>
<hr/>
</mat-card>
</mat-card> -->
<div *ngIf="questionCateAccess">
<mat-card *ngFor="let category of questionCate.question_answers;let i=index" >
<!-- <pre>{{category.answerd_count}}</pre> -->

View File

13
src/pages/pd-question-category/pd-question-category.ts Normal file → Executable file
View File

@ -27,6 +27,9 @@ import { PdQuestionBusinessInfoPage } from '../pd-question/pd-question-business-
import { PdQuestionRentalInfoPage } from '../pd-question/pd-question-rental-info/pd-question-rental-info';
import { PdQuestionAssessedInfoPage } from '../pd-question/pd-question-assessed-info/pd-question-assessed-info';
import { PdQuestionAssessedDashPage } from '../pd-question/pd-question-assessed-dash/pd-question-assessed-dash';
import { PdQuestionLenderRepresentativePage } from '../pd-question/pd-question-lender-representative/pd-question-lender-representative';
import { PdQuestionGeneralInfoPage } from '../pd-question/pd-question-general-info/pd-question-general-info';
import { PdQuestionNeighbourHoodPage } from '../pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood';
/**
* Generated class for the PdQuestionCategoryPage page.
*
@ -255,6 +258,16 @@ searchitem:any;
{
this.navCtrl.push(PdQuestionAssessedDashPage,{'FormId':formName,'pdDetails':this.pdinfo});
}else if(categroyId==15)
{
this.navCtrl.push(PdQuestionLenderRepresentativePage,{'FormId':formName,'pdDetails':this.pdinfo});
}else if(categroyId==18)
{
this.navCtrl.push(PdQuestionGeneralInfoPage,{'FormId':formName,'pdDetails':this.pdinfo});
}else if(categroyId==19)
{
this.navCtrl.push(PdQuestionNeighbourHoodPage,{'FormId':formName,'pdDetails':this.pdinfo});
}
}
filter(view){

View File

@ -99,15 +99,19 @@
</mat-select>
</mat-form-field>
<div fxLayout="column" fxLayoutAlign="start stretch" *ngIf="pdQuestionAddress.controls['bussiness_activity'].value == 'yes'">
<mat-form-field style="width: 100%">
<!-- <mat-form-field style="width: 100%">
<mat-select matInput placeholder="Bussiness Address Type" name="bussiness_address_type" formControlName="bussiness_address_type" (selectionChange)="checkaddress($event.value)">
<mat-select matInput multiple (change)="SelectedPremises($event.value)" placeholder="Bussiness Address Type" name="bussiness_address_type" formControlName="bussiness_address_type" >
<mat-option>--</mat-option>
<mat-option *ngFor="let at of addressTypes" [value]="at.address_type_id">{{at.address_type}}</mat-option>
</mat-select>
</mat-form-field>
</mat-form-field> -->
<p>Type Of Premises</p>
<mat-list *ngFor="let at of addressTypes;let i = index;">
<mat-checkbox [value]="at.address_type_id" (change)="SelectedPremises($event)" [checked]="at.status==1 ? true:false">{{at.address_type}}</mat-checkbox>
</mat-list>
</div>
<div fxLayout="column" fxLayoutAlign="start stretch" *ngIf="pdQuestionAddress.get('bussiness_address_type').value=='12'">
<mat-form-field style="width: 100%">
@ -115,58 +119,54 @@
<mat-error *ngIf="pdforms.controls['lenAppID'].hasError('required')">Applicant ID Required</mat-error>
</mat-form-field>
</div>
</mat-card>
<br/>
<!-- <mat-card *ngIf="neighbourDetailsAccess">
<div formArrayName="neighbourhood">
<div *ngFor="let item of pdQuestionAddress.get('neighbourhood').controls; let i=index">
<!-- <ion-row>
<h5>Neighbour hood Details {{i+1}}</h5>
<ion-col col-3>
<ion-buttons end >
<a (click)="remove(i)">
<ion-icon name="close" color="optblue" style="font-size: 22px;"></ion-icon></a>
</ion-buttons>
</ion-col>
</ion-row>
<mat-card-content class="matcard" [formGroupName]="i">
<mat-form-field style="width: 100%">
<input matInput placeholder="Neighbour name"
formControlName="name">
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Do you know"
formControlName="do_you_know">
<mat-option value="{{m_neighbourStatus}}"
*ngFor="let m_neighbourStatus of neighbourStatusData">{{m_neighbourStatus}}
</mat-option>
</mat-select>
</mat-form-field >
<p>How long do you know the applicant</p>
<!-- <mat-form-field style="width: 100%">
<input type="number" matInput placeholder="Month"
formControlName="how_long_month">
</mat-form-field>
<mat-form-field style="width: 100%">
<input type="number" matInput placeholder="Year"
formControlName="how_long_year">
</mat-form-field>
<mat-form-field style="width: 100%">
<input type="number" matInput placeholder="Year" formControlName="how_long">
</mat-form-field>
<!-- <mat-form-field style="width: 100%">
<mat-select placeholder="Is the applicant owner"
formControlName="is_owner">
<mat-option value="{{m_applicantOwner}}"
*ngFor="let m_applicantOwner of applicantOwnerData">{{m_applicantOwner}}
<mat-form-field *ngIf="PremisesOtherFlag == true" style="width: 100%">
<input matInput placeholder="Specify Other Premises Type" (change)="otherValueset()"formControlName="bussiness_address_type_others" autocomplete="off">
</mat-form-field>
</mat-card>
<div formArrayName="additional_premises">
<div
*ngFor="let item of pdQuestionAddress.controls.additional_premises['controls']; let i = index;" [formGroupName]="i">
<mat-card>
<mat-card-title>{{i+1}} . {{PremisesLabel[i]}}</mat-card-title>
<mat-form-field style="width: 100%;">
<input matInput type = "number" placeholder="Number Of Additional Units"
formControlName="no_of_additional_units" autocomplete="off">
</mat-form-field>
<mat-form-field *ngIf="item.get('no_of_additional_units').value > 2" style="width: 100%;">
<mat-select placeholder="City" (change)="getCity($event.value)"formControlName="premises_city" multiple > <!-- (selectionChange)="relationChanged($event)"> -->
<mat-option *ngFor="let CL of CITY" [value]="CL.city_id">
{{CL.name}}
</mat-option>
</mat-select>
</mat-form-field>
</mat-card-content>
</div>
</div>
</mat-card> -->
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="item.get('no_of_additional_units').value <= 2 && item.get('no_of_additional_units').value != '' " style="width: 100%;">
<mat-select placeholder="Ownership" formControlName="premises_ownership">
<mat-option value="{{ownerShip.id}}" *ngFor="let ownerShip of residence">
{{ownerShip.name}}
</mat-option>
</mat-select>
</mat-form-field>
<!-- <mat-form-field *ngIf="addressForm.controls['premises_ownership'].value == 4 "> -->
<mat-form-field *ngIf="item.get('premises_ownership').value == 4" style="width: 100%;">
<input matInput placeholder="Specify Other Ownership" formControlName="premises_ownership_others" autocomplete="off">
</mat-form-field>
<mat-form-field *ngIf="item.get('premises_ownership').value == 3" style="width: 100%;">
<input matInput placeholder="What is the monthly rent paid?" formControlName="premises_rent_amt" autocomplete="off">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Remarks"
formControlName="premises_remarks" style="width: 65%;" autocomplete="off">
</mat-form-field>
</mat-card>
</div>
</div>
<br/>
<mat-card>
<mat-form-field style="width: 100%">

View File

View File

@ -18,6 +18,17 @@ import { ToastProvider } from '../../../providers/common-provider/toast';
})
export class PdQuestionAddressPage {
additional_premises: any=[];
bussiness_address_type: any=[];
formPremisesCityArray: any=[];
tempArr: any[];
cityData: any = [];
PremisesLabel: any=[];
formPremisesArray: any=[];
z:number = 0;
PremisesOtherFlag: boolean;
CITY: any;
residence: any;
FormId: any;
getaddressDetails: any;
@ -52,7 +63,7 @@ export class PdQuestionAddressPage {
this.address = this.pdDetails.addressline1+', - , -';
}
this.getaddressForm();
this.getdropdownlist();
this.pdQuestionAddress = this.fb.group(
{
@ -68,10 +79,11 @@ export class PdQuestionAddressPage {
address_ownership:[null],
bussiness_activity:[null],
bussiness_address_type:[null],
bussiness_address_type_others:[null],
bussiness_address_type_others:[null],
additional_premises: this.fb.array([]),
});
this.getaddressForm();
this.getdropdownlist();
}
ionViewDidLoad() {
@ -112,7 +124,10 @@ export class PdQuestionAddressPage {
{
if(res['dataStatus']==true){
this.addressTypes = res['records'].filter(add=>add.isactive==1);
}
})
this.qustCat.getcommondrop('PDLOCATIONAPPROACH').subscribe(res=>
@ -154,9 +169,135 @@ export class PdQuestionAddressPage {
this.residence = res['records'].filter(red=>red.isactive==1);
}
})
this.qustCat.getcommondrop('CITY').subscribe(res=>
{
if(res['dataStatus']==true)
{
this.CITY = res['records'].filter(red=>red.isactive==1);
}
})
}
createPremises(): FormGroup {
return this.fb.group({
no_of_additional_units: [''],
premises_city: [''],
premises_remarks: [''],
premises_ownership: [''],
premises_ownership_others: [''],
premises_rent_amt:[''],
});
}
// SelectedPremises($event){
// // console.log($event);
// // console.log(data);
// console.log($event);
// if($event.checked){
// let premisesData = $event.source.value;
// // console.log(this.formPremisesArray);
// let tempArr=[];
// premisesData.forEach((val,index)=>
// {
// this.formPremisesArray.push({premises_types: val});
// tempArr.push(this.addressTypes.filter(add=>add.address_type_id==val)[0]);
// console.log(tempArr);
// this.PremisesLabel[index] = tempArr[index].address_type;
// });
// const control = <FormArray>this.pdQuestionAddress.controls['additional_premises'] as FormArray;
// // control.removeAt(0);
// tempArr.forEach((item,index)=>
// {
// control.push(this.createPremises());
// });
// }
// }
SelectedPremises($event){
let premisesData = $event.source.value;
console.log(premisesData);
if($event.checked === true ){
//this.formPremisesArray.push({member: $event.source.value});
//this.selectedSegmentDatas.push(CustomerSegmentName.name);
//console.log('true',premisesData);
//console.log(this.formPremisesArray);
this.formPremisesArray.push({premises_types: $event.source.value});
console.log(this.formPremisesArray);
const control = <FormArray>this.pdQuestionAddress.controls['additional_premises'];
let array = this.addressTypes.filter(data => data.address_type_id == premisesData)[0];
console.log(array);
if(premisesData == 12){
this.PremisesOtherFlag = true;
// this.PremisesLabel[this.z] = this.pdQuestionAddress.get('bussiness_address_type_others').value;
control.push(this.createPremises());
}
else{
this.PremisesLabel[this.z] = array.address_type;
control.push(this.createPremises());
}
console.log(this.PremisesLabel);
this.z++;
}
else if($event.checked === false ){
console.log('false',premisesData);
if(premisesData == 12){
this.PremisesOtherFlag = false;
}
console.log(this.formPremisesArray);
let index = this.formPremisesArray.findIndex(form=>form.premises_types== $event.source.value);
console.log(index);
const control = <FormArray>this.pdQuestionAddress.controls['additional_premises'];
control.removeAt(index);
this.PremisesLabel.splice(index,1);
this.formPremisesArray.splice(index,1);
console.log(this.formPremisesArray);
console.log(this.z);
this.z--;
//let index = this.selectedSegmentDatas.indexOf(CustomerSegmentName.name);
//this.selectedSegmentDatas.splice(index,1);
}
}
getCity(e)
{
this.cityData = [];
e.forEach(val=>
{
this.cityData.push({additional_premises_city:val});
});
console.log(this.cityData);
}
otherValueset()
{
let z = this.z;
this.PremisesLabel[z-1] = this.pdQuestionAddress.get('bussiness_address_type_others').value;
}
checkaddress(value)
{
// console.log(value);
@ -178,17 +319,17 @@ export class PdQuestionAddressPage {
});
};
addNeighbourApplicant(len) {
// addNeighbourApplicant(len) {
// if(this.pd.valid){
// // if(this.pd.valid){
for(let i=0; i<=len;i++){
this.items = this.pdQuestionAddress.get('neighbourhood') as FormArray;
this.items.push(this.createItem());
//console.log(this.pdQuestionAddress.get('items')['controls']);
}
}
// for(let i=0; i<=len;i++){
// this.items = this.pdQuestionAddress.get('neighbourhood') as FormArray;
// this.items.push(this.createItem());
// //console.log(this.pdQuestionAddress.get('items')['controls']);
// }
// }
remove(i){
this.counts--;
@ -226,12 +367,35 @@ export class PdQuestionAddressPage {
records.address_form_remark = answerData.address_form_remark;
records.address_ownership = answerData.address_ownership;
records.bussiness_activity = answerData.bussiness_activity;
if (answerData.bussiness_activity == 'yes') {
records.bussiness_address_type = answerData.bussiness_address_type;
if (records.bussiness_address_type == 12) {
records.bussiness_address_type_others = answerData.bussiness_address_type_others;
}
if (records.bussiness_activity == 'yes') {
// records.bussiness_address_type = this.addressForm.controls.bussiness_address_type.value;
records.bussiness_address_type = this.formPremisesArray;
console.log(369,this.formPremisesArray);
if (records.bussiness_address_type == 12) {
records.bussiness_address_type_others = this.pdQuestionAddress.controls.bussiness_address_type_others.value;
}
}
this.pdQuestionAddress.controls.additional_premises.value.forEach((val,index)=>
{
console.log(val);
if(val.premises_city != ''){
this.formPremisesCityArray = [];
val.premises_city.forEach(option => {
this.formPremisesCityArray.push({additional_premises_city: option});
this.pdQuestionAddress.controls.additional_premises.value[index].premises_city = this.formPremisesCityArray;
// console.log(val);
});
}else
{
this.formPremisesCityArray = null;
}
});
records.additional_premises = this.pdQuestionAddress.controls.additional_premises.value;
console.log('params', records);
this.qustCat.saveForm(records).subscribe(data => {
console.log('data', data);
@ -279,13 +443,28 @@ export class PdQuestionAddressPage {
this.pdQuestionAddress.controls['address_form_remark'].setValue(this.getaddressDetails.address_form_remark)
this.pdQuestionAddress.controls['bussiness_activity'].setValue(this.getaddressDetails.bussiness_activity);
this.pdQuestionAddress.controls['address_ownership'].setValue(this.getaddressDetails.address_ownership);
if(this.getaddressDetails.bussiness_activity == 'yes') {
this.pdQuestionAddress.controls['bussiness_address_type'].setValue(this.getaddressDetails.bussiness_address_type);
if(this.getaddressDetails.bussiness_address_type == 12) {
console.log(286,this.getaddressDetails.bussiness_address_type_others);
this.pdQuestionAddress.controls['bussiness_address_type_others'].setValue(this.getaddressDetails.bussiness_address_type_others);
if(this.getaddressDetails.bussiness_activity == 'yes' && this.getaddressDetails.bussiness_address_type !=null) {
let that = this;
this.bussiness_address_type = [];
this.bussiness_address_type = (Object.keys(this.getaddressDetails.bussiness_address_type).map(function(key)
{
return that.getaddressDetails.bussiness_address_type[key].premises_types;
}));
// console.log(bussiness_address_type);
this.additional_premises = Object.keys(this.getaddressDetails.additional_premises).map(function(key)
{
return that.getaddressDetails.additional_premises[key];
})
this.selectedValue(this.bussiness_address_type,this.additional_premises);
// this.SelectedPremises(bussiness_address_type,additional_premises);
//const control = <FormArray>this.pdQuestionAddress.controls['additional_premises'] as FormArray;
// if(this.getaddressDetails.bussiness_address_type == 12) {
// console.log(286,this.getaddressDetails.bussiness_address_type_others);
// this.pdQuestionAddress.controls['bussiness_address_type_others'].setValue(this.getaddressDetails.bussiness_address_type_others);
}
// }
}
// this.items = this.pdQuestionAddress.get('neighbourhood') as FormArray;
@ -325,4 +504,54 @@ export class PdQuestionAddressPage {
}
});
}
selectedValue(e,data)
{
console.log('501 function',e);
let premisesData = e ;
this.tempArr = [];
let that = this;
this.addressTypes = Object.keys(this.addressTypes).map(function(key)
{
that.addressTypes[key].status = 0;
return that.addressTypes[key];
})
console.log(this.addressTypes);
premisesData.forEach((val,index)=>
{
// console.log(data[index]);
this.z++;
// console.log(this.addressTypes);
this.formPremisesArray.push({premises_types: val});
this.tempArr.push(this.addressTypes.filter(add=>add.address_type_id==val)[0]);
this.PremisesLabel[index] = this.tempArr[index].address_type;
if(data[index] !==undefined && data[index].premises_ownership < 2 ){
data[index].premises_city = Object.keys(data[index].premises_city).map(function(key)
{
return data[index].premises_city[key].additional_premises_city;
});
}
this.addressTypes.forEach(data=>
{
if(data.address_type_id == val)
{
data.status = 1;
}
});
});
const control = <FormArray>this.pdQuestionAddress.controls['additional_premises'] as FormArray;
// control.removeAt(0);
this.tempArr.forEach((item,index)=>
{
control.push(this.createPremises());
});
this.pdQuestionAddress.controls['additional_premises'].setValue(data);
}
}

View File

@ -18,15 +18,17 @@ import { ToastProvider } from '../../../providers/common-provider/toast';
templateUrl: 'pd-question-assessed-business.html',
})
export class PdQuestionAssessedBusinessPage {
m_freqOfPurchase: any;
expenseDetails: any;
grandpurchaseTotal(arg0: any): any {
throw new Error("Method not implemented.");
}
grandExpenseTotal: any;
expenseannual: any;
grandExpenseTotal: any=[];
expenseannual: any=[];
users: any;
pdDetails: any;
BuissnessForm:FormGroup;
businessExpenses:any;
constructor(public navCtrl: NavController, public navParams: NavParams,public fb:FormBuilder,public aws:AwsServiceProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider) {
this.pdDetails = this.navParams.get('pdDetails');
this.expenseDetails = this.navParams.get('expense');
@ -43,8 +45,25 @@ export class PdQuestionAssessedBusinessPage {
{
this.addBusinessDetails();
}
this.getdropdown();
}
getdropdown()
{
this.qustCat.getcommondrop('BUSINESSEXPENSES').subscribe(res=>
{
if(res['dataStatus']==true){
this.businessExpenses = res['records'].filter(bus=>bus.isactive==1);
}
});
this.qustCat.getcommondrop('FREQUENCY').subscribe(res=>
{
if(res['dataStatus'] == true){
this.m_freqOfPurchase = res['records'].filter(frq=>frq.isactive==1);
}
})
}
ionViewDidLoad() {
console.log('ionViewDidLoad PdQuestionAssessedBusinessPage');
}

View File

@ -19,15 +19,26 @@
[formGroupName]="sale_i">
<mat-card>
<mat-form-field style="width: 100%">
<input matInput type="text" placeholder="Sales Items" formControlName="sales_item" name="sales_item">
<input matInput type="text" placeholder="Sales Item" formControlName="sales_item" name="sales_item">
</mat-form-field>
<div *ngIf="grossprofitCalc.mode ==2">
<mat-form-field style="width: 100%">
<input matInput type="text" placeholder="Magin Percetage %" formControlName="margin_per" name="margin_per">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput type="text" placeholder="Margin Value" formControlName="margin_value" name="margin_value" readonly>
</mat-form-field>
</div>
</mat-card>
<mat-card>
<mat-card-header><h2>{{item.get('sales_item').value | titlecase}}</h2></mat-card-header>
<div formArrayName="child">
<div *ngFor="let tenants of item['controls'].child['controls']; let i =index;let dailylast = last" [formGroupName]="i">
<mat-form-field style="width: 100%">
<input matInput type="date" placeholder="Sales Items" formControlName="sales_date" name="sales_date">
<input matInput type="date" max="{{currentDate}}" placeholder="Sales Date" formControlName="sales_date" name="sales_date">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput type="number" placeholder="Sales Items" formControlName="sales_value" name="sales_value">
<input matInput type="number" (blur)="getSalesCalc(tenants,item,sale_i)" placeholder="Value" formControlName="sales_value" name="sales_value">
</mat-form-field>
<ion-buttons end>
@ -38,7 +49,7 @@
</ion-col>
<ion-col col-2>
<a (click)="deletedailyChildSaleProduct(sale_i,i)">
<ion-icon name="md-close" color="optblue" style="font-size: 22px;"></ion-icon>
<ion-icon name="md-trash" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
@ -60,7 +71,7 @@
<!-- <a (click)="deleterentalHome(rent_i)">
<ion-icon name="md-close" color="optblue" style="font-size: 22px;"></ion-icon>
</a> -->
<button ion-button (click)="deletedailySalesProduct(rent_i)" color="primary">Remove</button>
<button ion-button (click)="deletedailySalesProduct(sale_i)" color="primary">Remove</button>
</ion-col>
</ion-row>
</mat-card>

View File

@ -4,6 +4,7 @@ import { AwsServiceProvider } from '../../../providers/aws-service/aws-service';
import { FormGroup, FormBuilder, Validators, FormArray } from '@angular/forms';
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
import { ToastProvider } from '../../../providers/common-provider/toast';
import { ConstantsProvider } from '../../../providers/constants/constants';
/**
* Generated class for the PdQuestionAssessedDailySalesPage page.
@ -19,160 +20,217 @@ import { ToastProvider } from '../../../providers/common-provider/toast';
})
export class PdQuestionAssessedDailySalesPage {
currentDate: string;
grossprofitCalc: any;
salesDaily: any;
users: any;
FormId: any;
pdDetails: any;
salesDailyForm:FormGroup;
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider,public fb:FormBuilder) {
salesDailyForm: FormGroup;
constructor(public navCtrl: NavController, public navParams: NavParams, public aws: AwsServiceProvider, public qustCat: QuestionCategoryProvider, public toast: ToastProvider, public fb: FormBuilder,public constant:ConstantsProvider) {
this.pdDetails = this.navParams.get('pdDetails');
this.FormId = this.navParams.get('FormId');
this.salesDaily = this.navParams.get('salesDaily');
this.grossprofitCalc = this.navParams.get('grossprofit');
this.users = this.aws.getlocale();
this.currentDate = constant.getcurrentDate().replace("T00:00",'');
console.log(this.currentDate);
this.salesDailyForm = this.fb.group(
{
sales_product:this.fb.array([]),
sales_product: this.fb.array([]),
})
if(this.salesDaily !=null)
{
this.getDailySalesData(this.salesDaily);
}else
{
if (this.salesDaily != null) {
this.getDailySalesData(this.salesDaily);
} else {
this.adddailySalaesProduct();
}
}
ionViewDidLoad() {
console.log('ionViewDidLoad PdQuestionAssessedDailySalesPage');
}
createdailysalesProduct()
{
createdailysalesProduct() {
return this.fb.group(
{
sim_id:[null],
sales_item:[null,Validators.compose([Validators.required])],
child:this.fb.array([]),
fk_pd_id:[this.pdDetails.pd_id],
fk_createdby:[this.users],
isactive:['1'],
sim_id: [null],
sales_item: [null, Validators.compose([Validators.required])],
child: this.fb.array([]),
fk_pd_id: [this.pdDetails.pd_id],
margin_per: [null],
margin_value: [null],
fk_createdby: [this.users],
isactive: ['1'],
});
}
createdailyChildSaleProduct()
{
createdailyChildSaleProduct() {
return this.fb.group({
simc_id:[null],
fk_sim_id:[null],
sales_date:[null,Validators.compose([Validators.required])],
sales_value:[null,Validators.compose([Validators.required])],
isactive:['1'],
})
simc_id: [null],
fk_sim_id: [null],
sales_date: [null, Validators.compose([Validators.required])],
sales_value: [null, Validators.compose([Validators.required])],
isactive: ['1'],
})
}
temparr = [];
tempdate = [];
getSalesCalc(subchild,child,key) {
console.log(key);
let saledate: any = new Date(subchild.value.sales_date).getMonth() + 1;
let totalitemmargin = child.value.margin_per;
if (totalitemmargin != null && subchild.value.sales_value !=null) {
let loopAccess = false;
let loopindex = 0;
if (this.tempdate.length != 0) {
for (var i = 0; i < this.tempdate.length; i++) {
adddailySalaesProduct()
{
if(this.salesDailyForm.valid){
const control = <FormArray>this.salesDailyForm.get('sales_product') as FormArray;
control.push(this.createdailysalesProduct());
// console.log(control.length);
this.adddailyChildSaleProduct(control.length-1);
}
}
adddailyChildSaleProduct(index)
{
// if(this.salesDailyForm.valid){
const control = (<FormArray>this.salesDailyForm.get('sales_product')).at(index).get('child') as FormArray;
if (this.tempdate[i].month == saledate) {
loopAccess = true;
loopindex = i;
}
}
if (loopAccess) {
// console.log(loopAccess,loopindex);
this.tempdate[loopindex].value = this.tempdate[loopindex].value + subchild.value.sales_value;
this.temparr.push(subchild.value.sales_value);
loopAccess = false;
loopindex = 0;
// console.log('merge');
} else {
// console.log(loopAccess,loopindex);
// console.log('push');
this.tempdate.push({ 'month': saledate, 'value': subchild.value.sales_value }); this.temparr.push(subchild.value.sales_value);
}
} else {
// console.log('else')
this.tempdate.push({ 'month': saledate, 'value': subchild.value.sales_value });
this.temparr.push(subchild.value.sales_value);
}
let totalMonth = 12 / this.tempdate.length;
console.log(this.tempdate);
let tempgrandTotal = this.tempdate.reduce((a, b) => (+a + +b.value), 0);
console.log(tempgrandTotal);
// let value = tempgrandTotal * (totalitemmargin / 100);
let value = tempgrandTotal*totalMonth ;
console.log(value);
let grandValue = value * (totalitemmargin / 100);
child.controls['margin_value'].setValue(grandValue);
control.push(this.createdailyChildSaleProduct());
}
}
adddailySalaesProduct() {
this.tempdate = [];
if (this.salesDailyForm.valid) {
const control = <FormArray>this.salesDailyForm.get('sales_product') as FormArray;
control.push(this.createdailysalesProduct());
// console.log(control.length);
this.adddailyChildSaleProduct(control.length - 1);
}
}
adddailyChildSaleProduct(index) {
// if(this.salesDailyForm.valid){
const control = (<FormArray>this.salesDailyForm.get('sales_product')).at(index).get('child') as FormArray;
control.push(this.createdailyChildSaleProduct());
// }
}
deletedailySalesProduct(index)
{
deletedailySalesProduct(index) {
console.log(index);
this.tempdate.slice(index,1);
const control = (<FormArray>this.salesDailyForm.controls['sales_product']) as FormArray;
if(control.length==1)
{
if (control.length == 1) {
this.salesDailyForm.controls['sales_product'].reset();
}else
{
} else {
control.removeAt(index);
}
}
deletedailyChildSaleProduct(saleIndex,saleChildIndex)
{
const control = (<FormArray>this.salesDailyForm.controls['sales_product']).at(saleIndex).get('child') as FormArray;
control.removeAt(saleChildIndex);
}
saveData(answerData)
{
if(this.salesDailyForm.valid)
deletedailyChildSaleProduct(saleIndex, saleChildIndex) {
this.tempdate = [];
const control = (<FormArray>this.salesDailyForm.controls['sales_product']).at(saleIndex).get('child') as FormArray;
if(control.length==1)
{
let records = {'records':answerData.sales_product};
this.qustCat.saveassessedForms('saveAssessedIncomeMonthwiseItems',records).subscribe(res=>
{
if(res['dataStatus']==true)
{
console.log(res);
}
});
control.removeAt(saleChildIndex);
this.adddailyChildSaleProduct(saleIndex);
}else{
control.removeAt(saleChildIndex);
}
}
getDailySalesData(dailySalesData)
{
saveData(answerData) {
if (this.salesDailyForm.valid) {
let records = { 'records': answerData.sales_product };
this.qustCat.saveassessedForms('saveAssessedIncomeMonthwiseItems', records).subscribe(res => {
if (res['dataStatus'] == true) {
this.navCtrl.pop();
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
}
});
}
}
getDailySalesData(dailySalesData) {
console.log(dailySalesData);
const control = <FormArray>this.salesDailyForm.get('sales_product') as FormArray;
let salesChildControl;
let salesChildControlarr = [];
dailySalesData.forEach((val,index) => {
console.log(val);
control.push(this.dailySalesWithData(val));
salesChildControl = (<FormArray>this.salesDailyForm.controls['sales_product']).at(index).get('child') as FormArray;
salesChildControlarr[index] = Object.keys(val['items']).map(key=>val['items'][key]);
salesChildControlarr[index].forEach(vals=>
{
// console.log(140,vals);
let saleDate = new Date(vals[0].sales_date);
// console.log(saleDate);
vals[0].sales_date = saleDate.getFullYear()+'-'+("0" + (saleDate.getMonth()+1)).slice(-2)+'-'+("0" + (saleDate.getDay()+1)).slice(-2);
console.log(144,vals);
salesChildControl.push(this.dailySalesChildWithData(vals[0],val.sim_id));
});
console.log(control);
let salesChildControl;
let salesChildControlarr = [];
dailySalesData.forEach((val, index) => {
control.push(this.dailySalesWithData(val));
salesChildControl = (<FormArray>this.salesDailyForm.controls['sales_product']).at(index).get('child') as FormArray;
salesChildControlarr[index] = Object.keys(val['items']).map(key => val['items'][key]);
salesChildControlarr[index].forEach((vals, i) => {
vals.forEach((item, key) => {
let saleDate = new Date(item.sales_date);
item.sales_date = saleDate.getFullYear() + '-' + ("0" + (saleDate.getMonth() + 1)).slice(-2) + '-' + ("0" + (saleDate.getDay() + 1)).slice(-2);
salesChildControl.push(this.dailySalesChildWithData(item, val.sim_id));
})
});
});
}
dailySalesWithData(data)
{
return this.fb.group(
{
sim_id:[data.sim_id],
sales_item:[data.sales_item,Validators.compose([Validators.required])],
child:this.fb.array([]),
fk_pd_id:[this.pdDetails.pd_id],
fk_createdby:[this.users],
isactive:['1'],
})
}
dailySalesChildWithData(data,fk_id)
{
dailySalesWithData(data) {
return this.fb.group(
{
simc_id:[data.simc_id],
fk_sim_id:[fk_id],
sales_date:[data.sales_date,Validators.compose([Validators.required])],
sales_value:[data.sales_value,Validators.compose([Validators.required])],
isactive:['1'],
sim_id: [data.sim_id],
sales_item: [data.sales_item, Validators.compose([Validators.required])],
child: this.fb.array([]),
fk_pd_id: [this.pdDetails.pd_id],
fk_createdby: [this.users],
isactive: ['1'],
margin_per: [data.margin_per],
margin_value: [data.margin_value],
})
}
dailySalesChildWithData(data, fk_id) {
return this.fb.group(
{
simc_id: [data.simc_id],
fk_sim_id: [fk_id],
sales_date: [data.sales_date, Validators.compose([Validators.required])],
sales_value: [data.sales_value, Validators.compose([Validators.required])],
isactive: ['1'],
})
}
}

View File

@ -12,42 +12,63 @@
</ion-header>
<ion-content padding>
<mat-accordion>
<mat-expansion-panel [ngClass]="!grossAccess?expanded:''">
<mat-expansion-panel-header>
<mat-panel-title>
Purchase Calculation
</mat-panel-title>
</mat-expansion-panel-header>
<mat-card>
<form [formGroup]="">
<form [formGroup]="assessedForm">
<mat-list style="width: 100%">
<mat-radio-group >
<mat-radio-button value="1">Purchase</mat-radio-button>
<mat-radio-button value="2">Margin</mat-radio-button>
<p>Purchase</p>
<mat-radio-group formControlName="mode">
<mat-radio-button value="1">Yes</mat-radio-button>
<mat-radio-button value="2">No</mat-radio-button>
</mat-radio-group>
</mat-list>
<mat-list style="width: 100%">
<mat-radio-group >
<mat-list style="width: 100%" *ngIf="assessedForm.get('mode').value==2">
<p>Sales</p>
<mat-radio-group formControlName="margin">
<mat-radio-button value="1">Gross Margin</mat-radio-button>
<mat-radio-button value="2">Net Margin</mat-radio-button>
</mat-radio-group>
</mat-list>
<ion-row>
<button ion-button full color="optblue" (click)="saveAssessedForm(familyForm.value)"> Save</button>
<button ion-button full color="optblue" (click)="saveAssessedForm(assessedForm.value)"> Proceed</button>
</ion-row>
</form>
</mat-card>
<ion-row>
</mat-expansion-panel>
</mat-accordion>
<br/>
<div *ngIf="assessedProcess">
<ion-row >
<ion-col col-6 text-center>
<mat-card (click)="getViewPage(1)" class="item-ribbon" style="height: 110px;">
<span class="ribbon cruzeiro">
<span>--</span>
</span>
<span *ngIf="salesData;else noSalesData"class="ribbon cruzeiro">
<span>--</span>
</span>
<ng-template #noSalesData>
<span class="ribbon defalut">
<span>--</span>
</span>
</ng-template>
<ion-icon class="ion-icon-custome" name="logo-android"></ion-icon>
<h1 class="htag">SALES</h1>
</mat-card>
</ion-col>
<ion-col col-6 text-center>
<ion-col col-6 text-center *ngIf="grossprofit.mode==1">
<mat-card class="ion-icon-custome" (click)="getViewPage(2)" class="item-ribbon" style="height: 110px;">
<span class="ribbon default">
<span>--</span>
</span>
<span *ngIf="purchaseData;else nopurchaseData"class="ribbon cruzeiro">
<span>--</span>
</span>
<ng-template #nopurchaseData>
<span class="ribbon defalut">
<span>--</span>
</span>
</ng-template>
<ion-icon class="ion-icon-custome" name="logo-android"></ion-icon>
<h1 class="htag">PURCHASE</h1>
</mat-card>
@ -56,96 +77,91 @@
<ion-row>
<ion-col col-6 text-center>
<mat-card (click)="getViewPage(3)" class="item-ribbon" style="height: 110px;">
<span class="ribbon cruzeiro">
<span>--</span>
</span>
<span *ngIf="businessData;else nobusinessData"class="ribbon cruzeiro">
<span>--</span>
</span>
<ng-template #nobusinessData>
<span class="ribbon defalut">
<span>--</span>
</span>
</ng-template>
<ion-icon class="ion-icon-custome" name="logo-android"></ion-icon>
<h1 class="htag">BUSSINESS EXPENSE</h1>
<h1 class="htag">BUSINESS EXPENSE</h1>
</mat-card>
</ion-col>
<ion-col col-6 text-center>
<mat-card (click)="getViewPage(4)" class="item-ribbon" style="height: 110px;">
<span class="ribbon default">
<span>--</span>
</span>
<span *ngIf="houseExpenseData;else nohouseExpenseData"class="ribbon cruzeiro">
<span>--</span>
</span>
<ng-template #nohouseExpenseData>
<span class="ribbon defalut">
<span>--</span>
</span>
</ng-template>
<ion-icon class="ion-icon-custome" name="logo-android"></ion-icon>
<h1 class="htag">HOUSE HOLD</h1>
</mat-card>
</ion-col>
</ion-row>
<mat-card style="margin-bottom:10px;">
<mat-card *ngIf="finalAccess" style="margin-bottom:10px;">
<h4 text-center>INCOME</h4>
<hr>
<ion-row>
<ion-col col-6>
<h6>Employee Salary</h6>
<h6>Sales Revenue</h6>
</ion-col>
<ion-col col-6 text-right>
<h6>1000000</h6>
</ion-col>
</ion-row>
<ion-row>
<ion-col col-6>
<h6>Employee Salary</h6>
</ion-col>
<ion-col col-6 text-right>
<h6>1000000</h6>
</ion-col>
</ion-row>
<ion-row>
<ion-col col-6>
<h6>Employee Salary</h6>
</ion-col>
<ion-col col-6 text-right>
<h6>1000000</h6>
</ion-col>
</ion-row>
<ion-row>
<ion-col col-6>
<h6>Employee Salary</h6>
</ion-col>
<ion-col col-6 text-right>
<h6>1000000</h6>
<h6>{{finalIncome.sales_revenue}}</h6>
</ion-col>
</ion-row>
<hr>
<ion-row>
<ion-col col-6>
Total Income
</ion-col>
<ion-col col-6 text-right>
1200000
{{finalIncome.sales_revenue}}
</ion-col>
</ion-row>
</mat-card>
<mat-card style="margin-bottom:10px;">
<mat-card *ngIf="finalAccess" style="margin-bottom:10px;">
<h4 text-center>EXPENSE</h4>
<hr>
<ion-row>
<ion-col col-6>
<h6>Employee Salary</h6>
<h6>Business Expense</h6>
</ion-col>
<ion-col col-6 text-right>
<h6>1000000</h6>
<h6>{{finalExpense.business_expense}}</h6>
</ion-col>
</ion-row>
<ion-row>
<ion-col col-6>
<h6>Employee Salary</h6>
<h6>Net Profit</h6>
</ion-col>
<ion-col col-6 text-right>
<h6>1000000</h6>
<h6>{{finalExpense.net_profit}}</h6>
</ion-col>
</ion-row>
<ion-row>
<ion-col col-6>
<h6>Purchase</h6>
</ion-col>
<ion-col col-6 text-right>
<h6>{{finalExpense.purchase}}</h6>
</ion-col>
</ion-row>
<hr>
<ion-row>
<ion-col col-6>
Total Expense
</ion-col>
<ion-col col-6 text-right>
1200000
{{finalExpense.business_expense + finalExpense.purchase +finalExpense.net_profit}}
</ion-col>
</ion-row>
</mat-card>
</div>
</ion-content>

View File

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { AwsServiceProvider } from '../../../providers/aws-service/aws-service';
import { FormBuilder } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
import { ToastProvider } from '../../../providers/common-provider/toast';
import { PdQuestionAssessedInfoPage } from '../pd-question-assessed-info/pd-question-assessed-info';
@ -20,24 +20,121 @@ import { PdQuestionAssessedInfoPage } from '../pd-question-assessed-info/pd-ques
})
export class PdQuestionAssessedDashPage {
grossAccess: boolean;
finalAccess: boolean;
finalExpense: any;
finalIncome: any;
finalData: any;
houseExpenseData: boolean;
businessData: boolean;
salesData: boolean;
purchaseData: boolean;
grossprofit: any;
assessedProcess: boolean;
users: any;
FormId: any;
pdDetails: any;
assessedForm:FormGroup;
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public fb:FormBuilder,public qustCat:QuestionCategoryProvider,public toast:ToastProvider) {
this.pdDetails = this.navParams.get('pdDetails');
this.FormId = this.navParams.get('FormId');
this.users = this.aws.getlocale();
this.assessedForm = this.fb.group(
{
calc_type_id:[null],
fk_pd_id:[this.pdDetails.pd_id],
mode:[null,Validators.compose([Validators.required])],
margin:[null],
fk_createdby:[this.users],
fk_updatedby:[null],
})
}
ionViewDidLoad() {
console.log('ionViewDidLoad PdQuestionAssessedDashPage');
}
ionViewCanEnter()
{
this.getassessedIncome();
}
getViewPage(pageId)
{
this.navCtrl.push(PdQuestionAssessedInfoPage,{'pdDetails':this.pdDetails,'pageId':pageId});
}
saveAssessedForm(answerData)
{
console.log(this.assessedForm.value);
if(this.assessedForm.valid)
{
let records = {'records':this.assessedForm.value};
console.log('data',records);
this.qustCat.saveassessedForms('saveAssessedIncomeCalculateMode',records).subscribe(res=>
{
if(res['dataStatus']==true)
{
this.getassessedIncome();
}else
{
}
})
}
}
getassessedIncome()
{
let records = {'pd_id':this.pdDetails.pd_id};
this.qustCat.retiverassessedForm('getAssessedIncome',records).subscribe(res=>
{
if(res['dataStatus']==true)
{
this.assessedProcess = true;
this.grossprofit = res['records'].gross_profit_calculation_type[0];
if(res['records'].purchase_details.length !=0)
{
this.purchaseData = true;
}
if(res['records'].sales_items_by_monthwise.length !=0 || res['records'].sales_declared_by_customer.length !=0 || res['records'].sales_calculated_by_itemwise.length !=0)
{
this.salesData = true;
}
if(res['records'].business_expenses.length !=0)
{
this.businessData = true;
}
if(res['records'].house_hold_expenses.length !=0)
{
this.houseExpenseData = true;
}
console.log(res['records'].final_data.length);
if(res['records'].final_data.length !=0){
this.finalAccess = true;
this.finalData = res['records'].final_data[0];
this.finalIncome = this.finalData.income;
this.finalExpense = this.finalData.expense;
}
console.log(this.grossprofit);
if(this.grossprofit !==undefined)
{
this.grossAccess = true;
this.assessedForm.controls['mode'].setValue(this.grossprofit.mode);
this.assessedForm.controls['margin'].setValue(this.grossprofit.margin);
this.assessedForm.controls['calc_type_id'].setValue(this.grossprofit.calc_type_id);
}
}else
{
this.assessedProcess = false;
}
});
}
}

View File

@ -4,7 +4,7 @@
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title *ngIf="!viewchange">{{FormId.form_name}}</ion-title>
<ion-title *ngIf="!viewchange">House Hold Expense</ion-title>
</ion-navbar>

View File

@ -19,27 +19,46 @@ import { QuestionCategoryProvider } from '../../../providers/question-category/q
})
export class PdQuestionAssessedHouseholdPage {
m_freqOfPurchase: any;
expenseDetails: any;
houseExpenseDetails: any;
users: any;
pdDetails: any;
houseannual: any;
grandHouseExpenseTotal: any;
houseannual: any =[];
grandHouseExpenseTotal: any=[];
houseHoldForm:FormGroup;
constructor(public navCtrl: NavController, public navParams: NavParams,public fb:FormBuilder,public aws:AwsServiceProvider,public toast:ToastProvider,public qustCat:QuestionCategoryProvider) {
this.pdDetails = this.navParams.get('pdDetails');
this.houseExpenseDetails = this.navParams.get('FormId');
this.expenseDetails = this.navParams.get('expense');
this.users = this.aws.getlocale();
this.houseHoldForm = this.fb.group(
{
houseExpense:this.fb.array([]),
})
});
if(this.expenseDetails !=null)
{
this.getHouseholdExpense(this.expenseDetails);
}else
{
this.addHouseExpenses();
}
this.getdropdown();
}
ionViewDidLoad() {
console.log('ionViewDidLoad PdQuestionAssessedHouseholdPage');
}
getdropdown()
{
this.qustCat.getcommondrop('FREQUENCY').subscribe(res=>
{
if(res['dataStatus'] == true){
this.m_freqOfPurchase = res['records'].filter(frq=>frq.isactive==1);
}
})
}
createHouseExpense()
{
return this.fb.group(

View File

@ -19,9 +19,16 @@
<mat-card>
<p>Sales declared by the customer as the annual sales actually done.</p>
<mat-form-field style="width: 100%">
<textarea matInput type="text" placeholder="" formControlName="sales_declared_by_customer" name="sales_declared_by_customer"></textarea>
<textarea matInput type="text" placeholder="" formControlName="sales_declared_by_customer" (blur)="getMarginCalc()" name="sales_declared_by_customer"></textarea>
</mat-form-field>
<div *ngIf="mode==2">
<mat-form-field style="width: 100%">
<input matInput type="number" placeholder="Margin percentage %" formControlName="margin_per" name="margin_per" (blur)="getMarginCalc()">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput type="number" placeholder="Value" formControlName="margin_value" name="margin_value">
</mat-form-field>
</div>
<ion-row>
@ -39,10 +46,12 @@
<!-- <mat-card style="padding:16px;" class="mat-card-custom"> -->
<mat-card>
<mat-card-header><h4>Monthwise Form</h4></mat-card-header>
<ion-row>
<ion-col col-3>
<ion-col col-3 *ngIf="sales_item_value">
<a (click)="editAllDetails(sales_item_value)">
Edit
<h2>{{"&#9998;"}}</h2>
</a>
</ion-col>
<ion-col offset-4 col-3>
@ -76,7 +85,8 @@
<br/>
<br/>
<mat-card>
<ion-col offset-4 col-3>
<mat-card-header><h4>Dailywise Form</h4></mat-card-header>
<ion-col offset-8 col-3>
<a (click)="AddAssessedDailyForm()">
@ -92,7 +102,7 @@
<ion-col col-6 *ngFor="let eachItem of monthwise.expandElements">
<mat-card-title text-right>{{eachItem.header}}</mat-card-title>
<div *ngFor="let eachmonthItem of eachItem.value">
<mat-card-subtitle>{{eachmonthItem.sales_date | date:'dd-mm-yyyy'}} {{"&#8377;"}} {{eachmonthItem.sales_value
<mat-card-subtitle>{{eachmonthItem.sales_date | date:'dd-MM-yyyy'}} {{"&#8377;"}} {{eachmonthItem.sales_value
}}</mat-card-subtitle>
</div>
</ion-col>
@ -145,8 +155,9 @@
</div>
<div *ngIf="pageId==2">
<mat-card>
<mat-card-header><h4>Purchase Form</h4></mat-card-header>
<ion-row>
<ion-col col-3 ><a (click)="editPurchaseAllDetails(purchse_details)">Edit</a></ion-col>
<ion-col col-3 *ngIf="purchse_details !=''"><a (click)="editPurchaseAllDetails(purchse_details)"><h2>{{"&#9998;"}}</h2></a></ion-col>
<ion-col offset-6 col-3>
<a (click)="AddPurchaseForm()">
<ion-icon name="md-add" color="optblue" style="font-size: 22px;"></ion-icon>
@ -171,8 +182,10 @@
</div>
<div *ngIf="pageId==3">
<mat-card>
<mat-card-header><h4>BusinessExpenses Form</h4></mat-card-header>
<ion-row>
<ion-col col-3 ><a (click)="editExpenseAllDetails(businessExpenses_details)">Edit</a></ion-col>
<ion-col col-3 *ngIf="businessExpenses_details!=''"><a (click)="editExpenseAllDetails(businessExpenses_details)"><h2>{{"&#9998;"}}</h2></a></ion-col>
<ion-col offset-6 col-3>
<a (click)="AddExpenseForm()">
<ion-icon name="md-add" color="optblue" style="font-size: 22px;"></ion-icon>
@ -197,8 +210,11 @@
</div>
<div *ngIf="pageId==4">
<mat-card>
<mat-card-header><h4>HouseHold Form</h4></mat-card-header>
<ion-row>
<ion-col col-3 ><a (click)="editHouseExpenseAllDetails(houseHold_details)">Edit</a></ion-col>
<ion-col col-3 *ngIf="houseHold_details !=''"><a (click)="editHouseExpenseAllDetails(houseHold_details)"><h2>{{"&#9998;"}}</h2></a></ion-col>
<ion-col offset-6 col-3>
<a (click)="AddHouseExpenseForm()">
<ion-icon name="md-add" color="optblue" style="font-size: 22px;"></ion-icon>

View File

@ -1,37 +1,5 @@
page-pd-question-assessed-info {
.SwipedTabs-indicatorSegment
{
-webkit-transition: 0.3s all;
-moz-transition: 0.3s all;
-o-transition: 0.3s all;
transition: 0.3s all;
transform-origin: top 0 left 0;
height: 1px;
position: relative;
top: -2px;
background-color: black !important;
}
.SwipedTabs-tabs ion-segment-button
{
border:none !important;
color:gray!important;
background-color:white!important;
}
.SwipedTabs-tabs ion-segment-button.SwipedTabs-activeTab
{
color:black !important;
}
.SwipedTabs-tabs
{
border-bottom: solid 1px #e6e6e6 !important;
}
ion-slides.slides {
height: auto;
}
.swiper-pagination {
bottom: 0px;
}
// .mat-card-custom{
// padding:0px !important;

View File

@ -26,6 +26,8 @@ import { PdQuestionAssessedHouseholdPage } from '../pd-question-assessed-househo
})
export class PdQuestionAssessedInfoPage {
mode: any;
grossprofitCalc: any;
houseHold_details: any;
grandHouseExpenseTotal: any;
houseannual: any=[];
@ -78,6 +80,8 @@ export class PdQuestionAssessedInfoPage {
sdc_id:[null],
sales_declared_by_customer:[null],
fk_pd_id:[this.pdDetails.pd_id],
margin_per:[null],
margin_value:[null],
isactive:[1],
fk_createdby:[this.users],
@ -114,7 +118,16 @@ export class PdQuestionAssessedInfoPage {
getMarginCalc()
{
let margin_per = this.assessedForm.controls['margin_per'].value;
let sales_declared_by_customer = this.assessedForm.controls['sales_declared_by_customer'].value;
if(margin_per !=null && sales_declared_by_customer !=null)
{
let value = sales_declared_by_customer * (margin_per/100);
this.assessedForm.controls['margin_value'].setValue(value);
}
}
saveData(answerData)
{
@ -147,8 +160,11 @@ export class PdQuestionAssessedInfoPage {
this.sales_item_value = res['records'].sales_calculated_by_itemwise;
this.sales_item_month_value = res['records'].sales_items_by_monthwise;
this.purchse_details = res['records'].purchase_details;
this.grossprofitCalc = res['records'].gross_profit_calculation_type[0];
this.mode = this.grossprofitCalc.mode;
console.log(this.grossprofitCalc);
var result = this.purchse_details.reduce(function(p, c) {
return p;
},[]);
console.log(result);
@ -189,9 +205,12 @@ export class PdQuestionAssessedInfoPage {
console.log(this.sales_month_wise_data);
if(sales_value.length!=0){
if(sales_value!==undefined){
this.assessedForm.controls['sdc_id'].setValue(sales_value.sdc_id);
this.assessedForm.controls['sales_declared_by_customer'].setValue(sales_value.sales_declared_by_customer);
this.assessedForm.controls['margin_value'].setValue(sales_value.margin_value);
this.assessedForm.controls['margin_per'].setValue(sales_value.margin_per);
}
}
@ -205,7 +224,7 @@ export class PdQuestionAssessedInfoPage {
AddAssessedForm()
{
this.navCtrl.push(PdQuestionAssessedSalesPage,{'pdDetails':this.pdDetails,'sales':null});
this.navCtrl.push(PdQuestionAssessedSalesPage,{'pdDetails':this.pdDetails,'sales':null,'grossprofit':this.grossprofitCalc});
}
@ -213,25 +232,25 @@ export class PdQuestionAssessedInfoPage {
{
let salesData = this.sales_item_value.filter(sal=>sal.sci_id==salesCal);
console.log(salesData);
this.navCtrl.push(PdQuestionAssessedSalesPage,{'pdDetails':this.pdDetails,'sales':salesData});
this.navCtrl.push(PdQuestionAssessedSalesPage,{'pdDetails':this.pdDetails,'sales':salesData,'grossprofit':this.grossprofitCalc});
}
editAllDetails(AllsalesData)
{
this.navCtrl.push(PdQuestionAssessedSalesPage,{'pdDetails':this.pdDetails,'sales':AllsalesData});
this.navCtrl.push(PdQuestionAssessedSalesPage,{'pdDetails':this.pdDetails,'sales':AllsalesData,'grossprofit':this.grossprofitCalc});
}
/**Assessed Daily Form Details */
AddAssessedDailyForm()
{
this.navCtrl.push(PdQuestionAssessedDailySalesPage,{'pdDetails':this.pdDetails,'salesDaily':null})
this.navCtrl.push(PdQuestionAssessedDailySalesPage,{'pdDetails':this.pdDetails,'salesDaily':null,'grossprofit':this.grossprofitCalc})
}
editAssessedDailyForm(simId)
{
let dailySaleDetails = this.sales_item_month_value.filter(ass=>ass.sim_id==simId);
console.log(dailySaleDetails);
this.navCtrl.push(PdQuestionAssessedDailySalesPage,{'pdDetails':this.pdDetails,'salesDaily':dailySaleDetails})
this.navCtrl.push(PdQuestionAssessedDailySalesPage,{'pdDetails':this.pdDetails,'salesDaily':dailySaleDetails,'grossprofit':this.grossprofitCalc})
}

View File

@ -17,15 +17,15 @@
<div formArrayName="salesCalItemwise">
<div *ngFor="let item of assessedForm.get('salesCalItemwise').controls; let i = index;let last = last" [formGroupName]="i">
<mat-card>
<h3>Sales calculated by itemwise</h3>
<h3>itemwise Calculated</h3>
<mat-form-field style="width: 100%">
<input type="text" matInput placeholder="Product/Services" formControlName="sales_item" name="sales_item">
<input type="text" matInput placeholder="Product/Services" formControlName="sales_item" (blur)="salecalculat(i,item)" name="sales_item">
</mat-form-field>
<mat-form-field style="width: 100%">
<input type="number" matInput placeholder="Sale Quantity" formControlName="sales_qty" name="sales_qty">
<input type="number" matInput placeholder="Sale Quantity" (blur)="salecalculat(i,item)" formControlName="sales_qty" name="sales_qty">
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="UOM" name="fk_uom_id" formControlName="fk_uom_id">
<mat-select placeholder="UOM" name="fk_uom_id" formControlName="fk_uom_id" >
<mat-option *ngFor="let uom of UOM" [value]="uom.uom_id">{{uom.name}}</mat-option>
</mat-select>
</mat-form-field>
@ -41,7 +41,17 @@
<mat-form-field style="width: 100%">
<input matInput type="number" placeholder="Annual Sales" formControlName="annual_sale_value" name="annual_sale_value" readonly>
</mat-form-field>
<div *ngIf="grossprofitCalc.mode==2">
<mat-form-field style="width: 100%">
<input matInput type="number" placeholder="Margin percentage %" (blur)="getSalesCalc(item)" formControlName="margin_per" name="margin_per" >
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput type="number" placeholder="Margin Amount" (blur)="getSalesCalc(item)" formControlName="margin_per_uom" name="margin_per_uom">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput type="number" placeholder="Final Value" formControlName="margin_final_value" name="margin_final_value" readonly>
</mat-form-field>
</div>
<ion-buttons end >
<ion-col offset-3 col-3>
<a (click)="addSalesCal()" *ngIf="last">

View File

@ -19,6 +19,7 @@ import { ToastProvider } from '../../../providers/common-provider/toast';
})
export class PdQuestionAssessedSalesPage {
grossprofitCalc: any;
salesData: any =[];
annual: any=[];
grandTotal: any;
@ -31,6 +32,7 @@ export class PdQuestionAssessedSalesPage {
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public fb:FormBuilder,public qustCat:QuestionCategoryProvider,public toast:ToastProvider) {
this.pdDetails = this.navParams.get('pdDetails');
this.FormId = this.navParams.get('FormId');
this.grossprofitCalc = this.navParams.get('grossprofit');
this.users = this.aws.getlocale();
this.assessedForm = this.fb.group(
{
@ -59,13 +61,13 @@ export class PdQuestionAssessedSalesPage {
{
if(res['dataStatus']==true)
{
this.m_freqOfPurchase = res['records'];
this.m_freqOfPurchase = res['records'].filter(frq=>frq.isactive==1);
}
})
this.qustCat.getcommondrop('UOM').subscribe(res=>
{
if(res['dataStatus']==true){
this.UOM = res['records'];
this.UOM = res['records'].filter(uom=>uom.isactive==1);
}
});
}
@ -83,6 +85,9 @@ export class PdQuestionAssessedSalesPage {
rate_per_unit:[null,Validators.compose([Validators.required])],
fk_frequency_id:[null,Validators.compose([Validators.required])],
annual_sale_value:[null],
margin_per:[null],
margin_per_uom:[null],
margin_final_value:[null],
});
}
@ -107,10 +112,11 @@ export class PdQuestionAssessedSalesPage {
const control = <FormArray>this.assessedForm.get('salesCalItemwise') as FormArray;
if(control.length==1)
{
this.assessedForm.controls['salesCalItemwise'].reset();
control.removeAt(i);
this.addSalesCal();
} else{
control.removeAt(i);
}
control.removeAt(i);
}
}
/**
* frequency Type
@ -125,7 +131,7 @@ export class PdQuestionAssessedSalesPage {
*/
salecalculat(index,details)
{
console.log(details,index);
// console.log(details,index);
let frequencyId = details.value.fk_frequency_id;
let salesQty = details.value.sales_qty;
let UOM = details.value.rate_per_unit;
@ -170,7 +176,7 @@ export class PdQuestionAssessedSalesPage {
this.grandTotal = this.annual.reduce((a,b)=> a+b,0);
}else
{
this.toast.pdTriggerappmessage('Enter the Sales Quantity and UOM');
// this.toast.pdTriggerappmessage('Enter the Sales Quantity and UOM');
}
@ -179,6 +185,28 @@ export class PdQuestionAssessedSalesPage {
console.log(this.annual);
}
getSalesCalc(details)
{
// console.log(details);
let margin_per = details.value.margin_per;
let margin_amount = details.value.margin_per_uom;
let annual_sale_value = details.value.annual_sale_value;
let sales_qty = details.value.sales_qty;
// console.log(sales_qty,margin_amount);
let value:any = '';
if(margin_per !=null || margin_amount !=null){
if(margin_per !=null)
{
value = +annual_sale_value * (+margin_per/100);
}else
{
console.log('else');
value = +sales_qty* +margin_amount;
}
console.log(value);
details.controls['margin_final_value'].setValue(value);
}
}
saveData(answerData)
{
let records = {'records':answerData.salesCalItemwise};
@ -219,7 +247,10 @@ export class PdQuestionAssessedSalesPage {
fk_uom_id:[data.fk_uom_id,Validators.compose([Validators.required])],
rate_per_unit:[data.rate_per_unit,Validators.compose([Validators.required])],
fk_frequency_id:[data.fk_frequency_id,Validators.compose([Validators.required])],
annual_sale_value:[data.annual_sale_value]
annual_sale_value:[data.annual_sale_value],
margin_per:[data.margin_per],
margin_per_uom:[data.margin_per_uom],
margin_final_value:[data.margin_final_value],
});
}
}

View File

@ -16,26 +16,37 @@
<ion-content>
<ion-segment [(ngModel)]="assestInfo" color="optblue">
<ion-segment-button value="busass" (click)="showButton = !showButton">
Business Assets Details
</ion-segment-button>
<ion-segment-button value="otherass" >
Others Assets Details
</ion-segment-button>
</ion-segment>
<form *ngIf="apiLoadFinish && loadDetails" [formGroup]="AssetsDetailsForm" >
<div fxLayout="row" fxLayoutAlign="start none">
<div formArrayName="assets_details" fxFill>
<div *ngFor="let sup of AssetsDetailsForm.controls.assets_details['controls']; let i=index;let last=last;">
<div [ngSwitch]="assestInfo">
<div *ngSwitchCase="'busass'">
<div formArrayName="business_assets_details" fxFill>
<div *ngFor="let sup of AssetsDetailsForm.controls.business_assets_details['controls']; let i=index;let last=last;">
<mat-card>
<mat-card-content>
<div [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedAssetsType($event, i)" placeholder="Assets Type" formControlName="assets_mode">
<mat-select (selectionChange)="selectedAssetsType($event, i,2)" placeholder="Assets Type" formControlName="business_assets_mode">
<mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<!--Desction Dynamic details: START-->
<div formArrayName="details" class="example-full-width">
<div formArrayName="business_details" class="example-full-width">
<!--Property-->
<div *ngIf="sup.get('assets_mode').value == 1 ">
<div *ngIf="sup.get('business_assets_mode').value == 1 ">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
@ -49,9 +60,9 @@
</div>
</div>
<!--Four Wheeler-->
<div *ngIf="sup.get('assets_mode').value == 2">
<div *ngIf="sup.get('business_assets_mode').value == 2">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
@ -63,9 +74,9 @@
</div>
</div>
<!--Two Wheeler-->
<div *ngIf="sup.get('assets_mode').value == 3">
<div *ngIf="sup.get('business_assets_mode').value == 3">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
@ -91,9 +102,9 @@
</div>
</div>-->
<!--Consumer Durable-->
<div *ngIf="sup.get('assets_mode').value == 5">
<div *ngIf="sup.get('business_assets_mode').value == 5">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
@ -105,9 +116,9 @@
</div>
</div>
<!--Insurance-->
<div *ngIf="sup.get('assets_mode').value == 6">
<div *ngIf="sup.get('business_assets_mode').value == 6">
<div fxFill>
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
@ -147,9 +158,9 @@
</div>
</div>
<!--Investments-->
<div *ngIf="sup.get('assets_mode').value == 7">
<div *ngIf="sup.get('business_assets_mode').value == 7">
<div>
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
@ -175,9 +186,9 @@
</div>
</div>
<!--other assets-->
<div *ngIf="sup.get('assets_mode').value == 8">
<div *ngIf="sup.get('business_assets_mode').value == 8">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
@ -191,23 +202,23 @@
</div>
<!--Desction Dynamic details : END -->
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 4">
<div *ngIf="sup.get('business_assets_mode').value == 1 || sup.get('business_assets_mode').value == 4">
<div fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="Approximate Market Value" formControlName="approximate_market_value">
<input matInput placeholder="Approximate Market Value" formControlName="business_approximate_market_value">
</mat-form-field>
</div>
</div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5">
<div *ngIf="sup.get('business_assets_mode').value == 1 || sup.get('business_assets_mode').value == 2 || sup.get('business_assets_mode').value == 3 || sup.get('business_assets_mode').value == 4 || sup.get('business_assets_mode').value == 5">
<div fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="Name of the Owner" formControlName="name_of_the_owner">
<input matInput placeholder="Name of the Owner" formControlName="business_name_of_the_owner">
</mat-form-field>
</div>
</div>
</div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 5">
<!-- <div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 5">
<label>Year and Month of Purchase?</label>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:100%">
@ -217,8 +228,8 @@
<input matInput type="number" placeholder="Month" formControlName="purchase_month">
</mat-form-field>
</div>
</div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5">
</div> -->
<div *ngIf="sup.get('business_assets_mode').value == 1 || sup.get('business_assets_mode').value == 2 || sup.get('business_assets_mode').value == 3 || sup.get('business_assets_mode').value == 4 || sup.get('business_assets_mode').value == 5">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<!-- <mat-form-field style="width:100%">
@ -230,7 +241,7 @@
</mat-form-field> -->
<mat-list>
<p>Is there a loan?</p>
<mat-radio-group formControlName="emi">
<mat-radio-group formControlName="business_emi">
<mat-radio-button value="yes">YES</mat-radio-button>
<mat-radio-button value="no">NO</mat-radio-button>
@ -238,32 +249,37 @@
</mat-radio-group>
</mat-list>
</div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<div *ngIf="sup.get('business_emi').value === 'yes'" fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="EMI Paid" formControlName="emi_paid">
<input matInput placeholder="EMI Paid" formControlName="business_emi_paid">
</mat-form-field>
</div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<div *ngIf="sup.get('business_emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:100%">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="business_original_loan_tenure" (change)="loanCalc(sup,2)" autocomplete="off">
</mat-form-field>
</div>
<div *ngIf="sup.get('business_emi').value === 'yes'" >
<mat-form-field style="width:100%">
<input matInput placeholder="Elapsed Tenure in Months" formControlName="elapsed_tenure">
</mat-form-field>
</div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="Balance Tenure in Months" formControlName="balance_tenure">
<input matInput placeholder="Balance Tenure in Months" formControlName="business_balance_tenure" (change)="loanCalc(sup,2)">
</mat-form-field>
</div>
<div *ngIf="sup.get('business_emi').value === 'yes'" fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="Elapsed Tenure in Months" formControlName="business_elapsed_tenure">
</mat-form-field>
</div>
</div>
</div>
<ion-buttons end>
<ion-col col-3>
<a (click)="addAsset()" *ngIf="last">
<a (click)="addAsset(2)" *ngIf="last">
<ion-icon name="md-add" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
<ion-col offset-3 col-3>
<a (click)="deleteAsset(i)">
<a (click)="deleteAsset(i,2)">
<ion-icon name="md-close" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
@ -274,6 +290,283 @@
<br/>
</div>
</div>
</div>
</div>
<div [ngSwitch]="assestInfo">
<div *ngSwitchCase="'otherass'">
<div formArrayName="assets_details" fxFill>
<div *ngFor="let sup of AssetsDetailsForm.controls.assets_details['controls']; let i=index;let last=last;">
<mat-card>
<mat-card-content>
<div [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedAssetsType($event, i,1)" placeholder="Assets Type" formControlName="assets_mode">
<mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<!--Desction Dynamic details: START-->
<div formArrayName="details" class="example-full-width">
<!--Property-->
<div *ngIf="sup.get('assets_mode').value == 1 ">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
<mat-select placeholder="Property" formControlName="property_type">
<mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--Four Wheeler-->
<div *ngIf="sup.get('assets_mode').value == 2">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--Two Wheeler-->
<div *ngIf="sup.get('assets_mode').value == 3">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_two_weeler">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--jwell details -->
<!--<div *ngIf="sup.get('assets_mode').value == 4">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Description" formControlName="jwell_description">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>-->
<!--Consumer Durable-->
<div *ngIf="sup.get('assets_mode').value == 5">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
<input matInput placeholder="Description" formControlName="consumer_durable_description">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<!--Insurance-->
<div *ngIf="sup.get('assets_mode').value == 6">
<div fxFill>
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<mat-form-field style="width:100%">
<mat-select placeholder="Type" formControlName="insurance_type">
<mat-option *ngFor="let ins_type of m_insuranceType" [value]="ins_type.id">{{ ins_type.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="Premium Paid" formControlName="premium_paid">
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field style="width:100%">
<mat-select placeholder="Frequency" formControlName="frequency_mode">
<mat-option *ngFor="let freqn of m_freqOfPurchase" [value]="freqn.frequency_id">{{ freqn.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="Sum Assured" formControlName="sum_assured">
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="Members Covered" formControlName="members_coverd">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
</div>
<!--Investments-->
<div *ngIf="sup.get('assets_mode').value == 7">
<div>
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<mat-form-field style="width:100%">
<mat-select placeholder="Type" formControlName="investments_type">
<mat-option *ngFor="let ins_type of m_investmentType" [value]="ins_type.id">{{ ins_type.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="Amount of Investment" formControlName="amount_of_invest">
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="Bank Name" formControlName="bank_name">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
</div>
<!--other assets-->
<div *ngIf="sup.get('assets_mode').value == 8">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div>
<mat-form-field style="width:100%">
<input matInput placeholder="Description of the Assets" formControlName="any_other_assets">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
</div>
<!--Desction Dynamic details : END -->
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 4">
<div fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="Approximate Market Value" formControlName="approximate_market_value">
</mat-form-field>
</div>
</div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5">
<mat-form-field style="width:100%;">
<mat-select placeholder="Name of the Owner"
formControlName="name_of_the_owner" required>
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxFlex="33">
<mat-form-field class="ml-xs example-full-width" *ngIf="sup.get('name_of_the_owner').value == 0 && sup.get('name_of_the_owner').value != ''">
<input matInput placeholder="Specify Other Owner Name"
formControlName="other_owner" autocomplete="off">
</mat-form-field>
</div>
</div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 5">
<label>Year and Month of Purchase?</label>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:100%">
<input matInput type="number" placeholder="Year" formControlName="purchase_year">
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput type="number" placeholder="Month" formControlName="purchase_month">
</mat-form-field>
</div>
</div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="33">
<!-- <mat-form-field style="width:100%">
<mat-select placeholder="Is there a loan?" formControlName="emi">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field> -->
<mat-list>
<p>Is there a loan?</p>
<mat-radio-group formControlName="emi">
<mat-radio-button value="yes">YES</mat-radio-button>
<mat-radio-button value="no">NO</mat-radio-button>
</mat-radio-group>
</mat-list>
</div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="EMI Paid" formControlName="emi_paid">
</mat-form-field>
</div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field class="ml-xs example-full-width" style="width:100%">
<input matInput placeholder="Original Loan Tenure in Months" formControlName="original_loan_tenure" (change)="loanCalc(sup,1)" autocomplete="off">
</mat-form-field>
</div>
<div *ngIf="sup.get('emi').value === 'yes'" >
<mat-form-field style="width:100%">
<input matInput placeholder="Balance Tenure in Months" formControlName="balance_tenure" (change)="loanCalc(sup,1)">
</mat-form-field>
</div>
<div *ngIf="sup.get('emi').value === 'yes'" fxFlex="33">
<mat-form-field style="width:100%">
<input matInput placeholder="Elapsed Tenure in Months" formControlName="elapsed_tenure">
</mat-form-field>
</div>
</div>
</div>
<ion-buttons end>
<ion-col col-3>
<a (click)="addAsset(1)" *ngIf="last">
<ion-icon name="md-add" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
<ion-col offset-3 col-3>
<a (click)="deleteAsset(i,1)">
<ion-icon name="md-close" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
</ion-buttons>
</div>
</mat-card-content>
</mat-card>
<br/>
</div>
</div>
</div>
</div>
</div>
<!--<div fxLayout="row">
<div fxFlex="60" class="pb-0 text-sm-left">

View File

View File

@ -18,6 +18,8 @@ import { ToastProvider } from '../../../providers/common-provider/toast';
templateUrl: 'pd-question-assests.html',
})
export class PdQuestionAssestsPage {
m_relation: any;
applicants: any = [];
users: any;
FormId: any;
m_freqOfPurchase: { 'id': string; 'name': string; }[];
@ -32,15 +34,19 @@ export class PdQuestionAssestsPage {
details:FormArray;
FormList:boolean = false;
loadDetails:boolean = true;
assestInfo:any;
constructor(public navCtrl: NavController, public navParams: NavParams,public fb:FormBuilder,public aws:AwsServiceProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider) {
this.assestInfo = "busass";
this.FormId = this.navParams.get('FormId');
console.log(this.FormId);
this.pdDetails = this.navParams.get('pdDetails');
this.users = this.aws.getlocale();
this.applicants = this.pdDetails.applicat_details;
this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'});
this.AssetsDetailsForm = this.fb.group(
{
assets_details:this.fb.array([]),
business_assets_details:this.fb.array([]),
})
@ -93,7 +99,12 @@ export class PdQuestionAssestsPage {
this.m_freqOfPurchase = res['records'];
}
})
this.qustCat.getcommondrop('RELATIONSHIPS').subscribe(
data => {
if(data['dataStatus']==true){
this.m_relation = data['records'].filter(data => data.isactive == 1);
}
});
}
@ -110,18 +121,26 @@ export class PdQuestionAssestsPage {
emi: [null],
emi_paid: [null],
elapsed_tenure: [null],
balance_tenure: [null]
balance_tenure: [null],
original_loan_tenure :[null],
});
}
addAsset()
addAsset(flag)
{
if(flag==1){
this.assetItem = this.AssetsDetailsForm.get('assets_details') as FormArray;
this.assetItem.push(this.createAsset());
}else if(flag==2)
{
this.assetItem = this.AssetsDetailsForm.get('business_assets_details') as FormArray;
this.assetItem.push(this.createBusinessDetails());
}
}
deleteAsset(i)
deleteAsset(i,flag)
{
if(flag==1){
this.assetItem = this.AssetsDetailsForm.get('assets_details') as FormArray;
if(this.assetItem.length==1)
{
@ -129,70 +148,121 @@ export class PdQuestionAssestsPage {
}else{
this.assetItem.removeAt(i);
}
}else if(flag ==2)
{
this.assetItem = this.AssetsDetailsForm.get('business_assets_details') as FormArray;
if(this.assetItem.length==1)
{
this.AssetsDetailsForm.controls['assets_details'].reset();
}else{
this.assetItem.removeAt(i);
}
}
}
createBusinessDetails() {
return this.fb.group({
business_assets_mode: [''],
business_details: this.fb.array([]),
business_approximate_market_value: [''],
business_name_of_the_owner: [''],
// other_owner:[''],
// relation:[''],
// purchase_year: ['', Validators.compose([])],
//purchase_month: ['', Validators.compose([])],
business_emi: [''],
business_emi_paid: [''],
business_original_loan_tenure: [''],
business_balance_tenure: [''],
business_elapsed_tenure: [''],
});
}
loanCalc(details ,flag)
{
if(flag == 1){
//console.log(details.value);
let ElapsedValues;
if(details.value.original_loan_tenure != null && details.value.original_loan_tenure != '' && details.value.balance_tenure != null && details.value.balance_tenure != ''){
ElapsedValues = details.value.original_loan_tenure - details.value.balance_tenure ;
details.controls['elapsed_tenure'].setValue(ElapsedValues);
}
}
else if(flag == 2){
let BusinessElapsedValues;
if(details.value.business_original_loan_tenure != null && details.value.business_original_loan_tenure != '' && details.value.business_balance_tenure != null && details.value.business_balance_tenure != ''){
BusinessElapsedValues = details.value.business_original_loan_tenure - details.value.business_balance_tenure ;
details.controls['business_elapsed_tenure'].setValue(BusinessElapsedValues);
}
}
}
show: boolean;
selectedAssetsType(e: any, i: any): void {
selectedAssetsType(e: any, i: any,flag : any): void {
console.log(e);
console.log(i);
console.log(flag);
let val = i;
console.log('function',e);
const arr = (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray;
var arrayControl = this.AssetsDetailsForm.get('assets_details') as FormArray;
arr.controls.splice(0);
if(flag == 1){
const arr = (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray;
arr.controls.splice(0);
}
else if(flag == 2){
const arr = (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray;
arr.controls.splice(0);
}
switch (e.value) {
case '1': {
let val = i;
this.FormList = true;
const control = (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray;
const control = (flag == 1) ? (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadProperty());
break;
}
case '2': {
this.FormList = true;
const control = (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray;
const control = (flag == 1) ? (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Four_Weeler());
break;
}
case '3': {
this.FormList = true;
const control = (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray;
const control = (flag == 1) ? (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Two_Weeler());
break;
}
case '4': {
this.FormList = true;
const control = (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.loadJwellDescription());
const control = (flag == 1) ? (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
//control.push(this.loadJwellDescription());
break;
}
case '5': {
this.FormList = true;
const control = (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray;
const control = (flag == 1) ? (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadConsumerDurableDescription());
break;
}
case '6': {
this.FormList = true;
const control = (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray;
const control = (flag == 1) ? (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInsuranceDescription());
break;
}
case '7': {
this.FormList = true;
const control = (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray;
const control = (flag == 1) ? (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInvestDescription());
break;
}
case '8': {
this.FormList = true;
const control = (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray;
const control = (flag == 1) ? (<FormArray>this.AssetsDetailsForm.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('details') as FormArray ;
control.push(this.otherAssetsDescription());
break;
}
@ -326,6 +396,7 @@ export class PdQuestionAssestsPage {
val.emi_paid = '';
val.elapsed_tenure = '';
val.balance_tenure = '';
val.original_loan_tenure ='';
}
});
answerData.pdid = this.pdDetails.pd_id;
@ -353,6 +424,11 @@ export class PdQuestionAssestsPage {
var assetArray = Object.keys(res['records'].assets_details).map(function(key) {
return res['records'].assets_details[key];
});
var busarray = Object.keys(res['records'].business_assets_details).map(function(key)
{
return res['records'].business_assets_details[key];
});
this.addBusinessAssetsDetailsWithData(busarray);
if (assetArray.length > 0) {
for (let val of assetArray) {
let vals = {
@ -364,7 +440,8 @@ export class PdQuestionAssestsPage {
emi: val.emi,
emi_paid: val.emi_paid,
elapsed_tenure: val.elapsed_tenure,
balance_tenure: val.balance_tenure
balance_tenure: val.balance_tenure,
original_loan_tenure:val.original_loan_tenure,
};
const control = <FormArray>this.AssetsDetailsForm.controls['assets_details'];
control.push(this.initDetailsWithdata(vals));
@ -373,15 +450,92 @@ export class PdQuestionAssestsPage {
}
}
// if (busarray.length > 0) {
// for (let val of busarray) {
// let vals = {
// assets_mode: val.assets_mode,
// approximate_market_value: val.approximate_market_value,
// name_of_the_owner: val.name_of_the_owner,
// purchase_year: val.purchase_year,
// purchase_month: val.purchase_month,
// emi: val.emi,
// emi_paid: val.emi_paid,
// elapsed_tenure: val.elapsed_tenure,
// balance_tenure: val.balance_tenure,
// original_loan_tenure:val.original_loan_tenure,
// };
// const control = <FormArray>this.AssetsDetailsForm.controls['assets_details'];
// control.push(this.initBusinessDetailsWithdata(vals));
// this.setAssetsDetailsWithData2(vals.assets_mode, val.details, control.length-1);
// }
// }
this.apiLoadFinish = true;
console.log(assetArray);
//this.AssetsDetailsForm.controls['assets_details'].setValue(assetArray);
}else{
this.apiLoadFinish = true;
this.addAsset();
this.addAsset(1);
this.addAsset(2);
}
})
}
addBusinessAssetsDetailsWithData(supp_data) {
console.log(supp_data);
var result = Object.keys(supp_data).map(function (key) {
return supp_data[key];
});
if (result.length > 0) {
for (let val of result) {
let vals = {
business_assets_mode: val.business_assets_mode,
business_approximate_market_value: val.business_approximate_market_value,
business_name_of_the_owner: val.business_name_of_the_owner,
// other_owner: val.other_owner,
// relation : val.relation,
// purchase_year: val.purchase_year,
// purchase_month: val.purchase_month,
business_emi: val.business_emi,
business_emi_paid: val.business_emi_paid,
business_original_loan_tenure: val.business_original_loan_tenure,
business_elapsed_tenure: val.business_elapsed_tenure,
business_balance_tenure: val.business_balance_tenure
};
// const control = <FormArray>this.AssetsDetailsForm.controls['assets_details'];
// control.push(this.initDetailsWithdata(vals));
// this.setAssetsDetailsWithData(vals.business_assets_mode, val.details, control.length - 1)
const control = <FormArray>this.AssetsDetailsForm.controls['business_assets_details'];
control.push(this.initBusinessDetailsWithdata(vals));
this.setAssetsDetailsWithData2(vals.business_assets_mode, val.business_details, control.length - 1)
}
}
//this.loadDetails = true;
}
initBusinessDetailsWithdata(data) {
return this.fb.group({
business_assets_mode: [data.business_assets_mode],
business_details: this.fb.array([]),
business_approximate_market_value: [data.business_approximate_market_value],
business_name_of_the_owner: [data.business_name_of_the_owner],
// other_owner:[data.other_owner || ''],
// relation: [data.relation || ''],
// purchase_year: [data.purchase_year, Validators.compose([])],
// purchase_month: [data.purchase_month, Validators.compose([])],
business_emi: [data.business_emi || 0],
business_emi_paid: [data.business_emi_paid || ''],
business_original_loan_tenure: [data.business_original_loan_tenure || ''],
business_balance_tenure: [data.business_balance_tenure || ''],
business_elapsed_tenure: [data.business_elapsed_tenure || '']
});
}
initDetailsWithdata(data) {
return this.fb.group({
assets_mode: [data.assets_mode],
@ -393,7 +547,8 @@ export class PdQuestionAssestsPage {
emi: [data.emi || 0],
emi_paid: [data.emi_paid || ''],
elapsed_tenure: [data.elapsed_tenure || ''],
balance_tenure: [data.balance_tenure || '']
balance_tenure: [data.balance_tenure || ''],
original_loan_tenure:[data.original_loan_tenure ||'']
});
}
setAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void {
@ -460,4 +615,56 @@ export class PdQuestionAssestsPage {
}
}
}
setAssetsDetailsWithData2(assets_details_mode: any, datas: any, i: any): void {
let val = i;
let data = datas;
const arr = (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
arr.controls.splice(0);
switch (assets_details_mode) {
case '1': {
const control = (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadPropertyWithData(data));
break;
}
case '2': {
const control = (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Four_WeelerWithData(data));
break;
}
case '3': {
const control = (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Two_WeelerWithData(data));
break;
}
case '4': {
break;
}
case '5': {
const control = (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadConsumerDurableDescriptionWithData(data));
break;
}
case '6': {
const control = (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInsuranceDescriptionWithData(data));
break;
}
case '7': {
const control = (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.loadInvestDescriptionWithData(data));
break;
}
case '8': {
const control = (<FormArray>this.AssetsDetailsForm.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.otherAssetsDescriptionWithData(data));
break;
}
default: {
break;
}
}
}
}

View File

@ -35,15 +35,29 @@
</ion-row>
<div [formGroupName]="i">
<div fxLayout="column" fxLayoutAlign="start stretch">
<mat-form-field style="width: 100%">
<input type="text" matInput placeholder="Applicant Name" name="applicant_name" formControlName="applicant_name">
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Applicant Name"
formControlName="applicant_name" required>
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
</mat-select>
</mat-form-field>
</div>
<mat-form-field style="width: 100%" *ngIf="bankinfo.get('applicant_name').value==0">
<input type="text" matInput placeholder="Other Applicant Name" name="other_applicant" formControlName="other_applicant">
</mat-form-field>
<div fxLayout="column" fxLayoutAlign="start stretch">
<mat-form-field style="width: 100%">
<input type="text" matInput placeholder="Bank Name" name="bank_name" formControlName="bank_name">
<mat-select placeholder="Bank Name" formControlName="bank_name" required>
<mat-option *ngFor="let btLen of m_btLenderList" [value]="btLen.bt_lender_list_id">{{ btLen.lender_name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<mat-form-field *ngIf="bankinfo.get('bank_name').value == 3" style="width: 100%">
<input matInput placeholder="Specify Other Bank Name"
formControlName="other_bank" autocomplete="off">
</mat-form-field>
<div fxLayout="column" fxLayoutAlign="start stretch">
<mat-form-field style="width: 100%">
@ -56,11 +70,12 @@
</mat-form-field>
</div>
<div fxLayout="column" fxLayoutAlign="start stretch">
<mat-form-field style="width: 100%">
<mat-form-field style="width: 100%" *ngIf="salaryField">
<mat-select placeholder="Salary Credited in this account" formControlName="salary" >
<mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option>
<mat-option value="NA">NA</mat-option>
</mat-select>
</mat-form-field>

View File

View File

@ -19,6 +19,9 @@ import { ToastProvider } from '../../../providers/common-provider/toast';
})
export class PdQuestionBankingPage {
m_btLenderList: any;
applicants: any = [];
salaryField: boolean;
FormId: any;
accountType: any;
users: any;
@ -26,6 +29,7 @@ export class PdQuestionBankingPage {
pdDetails: any;
bankitems:FormArray
constructor(public navCtrl: NavController, public navParams: NavParams,public fb:FormBuilder,public aws:AwsServiceProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider) {
this.applicants.pop();
this.pdDetails = this.navParams.get('pdDetails');
this.FormId = this.navParams.get('FormId');
console.log(this.pdDetails);
@ -38,6 +42,9 @@ export class PdQuestionBankingPage {
});
this.retiveBankDetails();
this.getdropdown();
this.salaryField = this.pdDetails.customer_segment_abbr.substring(0,2) == 'SE' ? false : true;
this.applicants = this.pdDetails.applicat_details;
this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'});
}
ionViewDidLoad() {
@ -52,16 +59,24 @@ export class PdQuestionBankingPage {
{
this.accountType=res['records'];
}
})
});
this.qustCat.getcommondrop('BTLENDERLIST').subscribe(
data => {
if(data['dataStatus']==true){
this.m_btLenderList = data['records'].filter(data => data.isactive == 1);
}
})
}
createBankItem(name): FormGroup {
return this.fb.group({
applicant_name: [name],
applicant_name: [],
bank_name: [null],
account_type: [null],
salary: [null],
limit: [null],
other_bank:[null],
other_applicant:[null],
is_main: [null],
vintage_year: [null],
vintage_month: [null],

View File

View File

View File

View File

@ -27,7 +27,7 @@
<input matInput placeholder="Enter the relationship" formControlName="personOther">
</mat-form-field> -->
<mat-form-field style="width: 100%">
<input matInput placeholder="No. Of family members" formControlName="members">
<input matInput placeholder="No. Of family members" (blur)="checkfamilystatus()"formControlName="members">
</mat-form-field>
</mat-card>
<mat-card>

View File

View File

@ -118,7 +118,7 @@ addearningMembers()
this.items = this.familyForm.get('earningMembers') as FormArray;
this.items.push(this.createMembers());
this.count++;
this.checkfamilystatus(this.count);
this.checkfamilystatus(this.count,'');
console.log(120,this.count);
}
@ -134,7 +134,7 @@ deleteEarningMembers(i)
}
this.count--;
console.log(134,this.count);
this.checkfamilystatus(this.count);
this.checkfamilystatus(this.count,'');
}
createNonMembers(): FormGroup {
return this.fb.group({
@ -150,7 +150,7 @@ addMembers()
{
this.membersitem =this.familyForm.get('nonEarningMembers') as FormArray;
this.count++;
this.checkfamilystatus(this.count);
this.checkfamilystatus(this.count,'');
this.membersitem.push(this.createNonMembers());
}
@ -163,11 +163,15 @@ deleteMembers(i)
this.membersitem.removeAt(i);
}
this.count--;
this.checkfamilystatus(this.count);
this.checkfamilystatus(this.count,'');
}
checkfamilystatus(count)
checkfamilystatus(count,familystatus)
{
let familystatus = this.familyForm.get('members').value;
if(familystatus !='' && familystatus !==undefined){
}else{
familystatus = this.familyForm.get('members').value;
}
console.log(familystatus);
console.log(count);
if(familystatus !== null ){
@ -239,6 +243,7 @@ savepdfamily(answerData)
});
console.log(earning);
let familyDetails = res['records'];
this.checkfamilystatus(non_earning.length + earning.length,familyDetails.family_members);
// this.familyForm.controls['person'].setValue(familyDetails.person_met);
this.familyForm.controls['personOther'].setValue(familyDetails.personOther);
this.familyForm.controls['members'].setValue(familyDetails.family_members);
@ -281,7 +286,7 @@ savepdfamily(answerData)
});
this.familyForm.controls['nonEarningMembers'].setValue(non_earning);
this.checkfamilystatus(this.count);
// this.checkfamilystatus(this.count);
}
// for(let earningDetails of earning){

View File

@ -0,0 +1,92 @@
<ion-header>
<ion-navbar color="optblue">
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title *ngIf="!viewchange">{{FormId.form_name}}</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<form [formGroup]="generalForm">
<mat-card>
<mat-card-title>Name of Person Met</mat-card-title>
<div formArrayName="applicant_list">
<mat-list *ngFor="let applicant of generalForm.controls.applicant_list['controls']; let c = index;" [formGroupName]="c">
<mat-checkbox class="example-margin" color="primary" formControlName="exist_status" (change)="coapplicantChange($event, c, applicant.controls)">{{applicant.controls.applicant_name.value}}</mat-checkbox>
</mat-list>
</div>
</mat-card>
<mat-card>
<div formArrayName="applicant_relation">
<div *ngFor="let relation of generalForm.controls.applicant_relation['controls']; let r = index;" [formGroupName]="r">
<mat-card-title>{{relation.controls.applicant_name.value}}</mat-card-title>
<mat-form-field style="width: 100%" *ngIf="relation.controls.company_name.value">
<input matInput placeholder="Company / Firm" formControlName="company_name" type="text">
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="relation.controls.company_name.value">
<mat-select placeholder="Relation" formControlName="company_relationship">
<mat-option>Select</mat-option>
<mat-option *ngFor="let comrelShip of companyRelationShipList" [value]="comrelShip.company_relationship_id">
{{comrelShip.name | titlecase}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Relation to" formControlName="applicant_relation_to">
<mat-option>Select</mat-option>
<mat-option *ngFor="let rel of fetch_related_details" [value]="rel">
<!-- [disabled]="relation.controls.applicant_name.value == rel" -->
{{rel | titlecase}}
</mat-option>
</mat-select>
<!-- <input matInput placeholder="Relation to" formControlName="applicant_relation_to" type="text"> -->
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="relation.controls.applicant_relation_to.value">
<mat-select placeholder="Relation" formControlName="relationship">
<mat-option>Select</mat-option>
<mat-option *ngFor="let relShip of relationShipList" [value]="relShip.relationship_id">
{{relShip.name | titlecase}}
</mat-option>
</mat-select>
</mat-form-field>
<ion-col offset-1 col-3 *ngIf="relation.controls.pd_co_applicant_id.value==0">
<a (click)="removereferance(r)">
<ion-icon name="md-trash" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
<hr/>
</div>
</div>
</mat-card>
<mat-card>
<mat-form-field style="width:100%">
<textarea matInput placeholder="Remarks" formControlName="general_remark" name="general_remark"></textarea>
</mat-form-field>
</mat-card>
<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> -->
<button ion-button full color="optblue" (click)="submitData(generalForm.value)"> Save</button>
<!-- </ion-buttons> -->
</ion-row>
</form>
</ion-content>

View File

@ -0,0 +1,3 @@
page-pd-question-general-info {
}

View File

@ -0,0 +1,300 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';
import { AwsServiceProvider } from '../../../providers/aws-service/aws-service';
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
import { ToastProvider } from '../../../providers/common-provider/toast';
import { FormGroup, FormBuilder,FormArray,Validator, Validators } from '@angular/forms';
import { PdQuestionGeneralOtherApplicantPage } from './pd-question-general-other-applicant/pd-question-general-other-applicant';
/**
* Generated class for the PdQuestionGeneralInfoPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@Component({
selector: 'page-pd-question-general-info',
templateUrl: 'pd-question-general-info.html',
})
export class PdQuestionGeneralInfoPage {
applicant_name: any;
otherapp: any;
fetch_related_details: any = [];
checkApplicantExist: any;
pd_applicants_details: any = [];
companyRelationShipList: any;
relationShipList: any;
users: any;
FormId: any;
pdDetails: any;
generalForm:FormGroup;
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider,public fb:FormBuilder,public modal:ModalController) {
this.pd_applicants_details = [];
this.pd_applicants_details.pop();
this.pdDetails = this.navParams.get('pdDetails');
this.FormId = this.navParams.get('FormId');
console.log(this.pdDetails);
this.users = this.aws.getlocale();
this.generalForm = this.fb.group({
pdid:this.pdDetails.pd_id,
formid:this.FormId.form_id,
applicant_list: this.fb.array([]),
applicant_relation: this.fb.array([]),
general_remark:''
});
this.pd_applicants_details = this.pdDetails.applicat_details;
// console.log(this.pd_applicants_details);
// console.log(this.pd_applicants_details);
this.getGeneralForm();
this.getdropdown();
// this.getcoapplicantDetails();
}
ionViewDidLoad() {
this.pd_applicants_details.pop();
console.log('ionViewDidLoad PdQuestionGeneralInfoPage');
}
getdropdown()
{
this.qustCat.getcommondrop('RELATIONSHIPS').subscribe(res=>
{
if(res['dataStatus']==true)
{
this.relationShipList = res['records'].filter(rel=>rel.isactive==1);
}
});
this.qustCat.getcommondrop('COMPANYRELATIONSHIPS').subscribe(res=>
{
if(res['dataStatus']==true)
{
this.companyRelationShipList = res['records'].filter(com=>com.isactive==1);
}
});
}
getcoapplicantDetails(checkApplicantExist,exist_applicant_relation)
{
let applicantControl = <FormArray>this.generalForm.controls['applicant_list'];
let relationControl = <FormArray>this.generalForm.controls['applicant_relation'];
if(checkApplicantExist.length > 0)
{
checkApplicantExist.forEach(val => {
applicantControl.push(this.createApplicant(val));
});
}
if(exist_applicant_relation.length > 0){
exist_applicant_relation.forEach(val => {
console.log(val);
relationControl.push(this.createApplicantRelation(val));
//push related to details
this.fetch_related_details.push(val.applicant_name);
});
}
}
createApplicant(elementValue:any){
return this.fb.group({
pd_co_applicant_id: [elementValue.pd_co_applicant_id],
applicant_name: [elementValue.applicant_name],
company_name: [elementValue.company_name],
exist_status:[elementValue.exist_status==1 && elementValue.pd_co_applicant_id > 0 ? true : false],
});
}
coapplicantChange(event,index,item)
{
let relationControl = <FormArray>this.generalForm.controls['applicant_relation'];
let applicantControl = <FormArray>this.generalForm.controls['applicant_list'];
if(item.exist_status.value)
{
if(item.pd_co_applicant_id.value==0){
let modal = this.modal.create(PdQuestionGeneralOtherApplicantPage);
modal.onDidDismiss(data => {
if(data!=1){
data.otherName.forEach(val=>
{
let applicant_details: any= {'pd_co_applicant_id':val.pd_co_applicant_id,'applicant_name':val.applicant_name,'applicant_relation_to':'','relation':'','company_name':'','company_relation':''};
relationControl.push(this.createApplicantRelation(applicant_details));
// push related to details
this.fetch_related_details.push(val.applicant_name);
});
}else
{
applicantControl.at(index).get('exist_status').setValue(false);
}
});
modal.present();
}else
{
let applicant_details: any= {'pd_co_applicant_id':item.pd_co_applicant_id.value,'applicant_name':item.applicant_name.value,'applicant_relation_to':'','relation':'','company_name':item.company_name.value,'company_relation':''};
relationControl.push(this.createApplicantRelation(applicant_details));
// push related to details
this.fetch_related_details.push(item.applicant_name.value);
}
}
else
{
let relationControl = <FormArray>this.generalForm.controls['applicant_relation'];
let pos_id = relationControl.value.map(e=>
e.pd_co_applicant_id).indexOf(item.pd_co_applicant_id.value);
console.log(pos_id,item.pd_co_applicant_id.value);
if(item.pd_co_applicant_id.value !=0){
relationControl.removeAt(pos_id);
let pos_name=this.fetch_related_details.indexOf(item.applicant_name.value);
this.fetch_related_details.splice(pos_name, 1);
}else
{
applicantControl.at(index).get('exist_status').setValue(false);
}
// remove related to details
}
}
createApplicantRelation(elementValue: any) {
console.log('function in 156');
return this.fb.group({
pd_co_applicant_id: [elementValue.pd_co_applicant_id],
applicant_name: [elementValue.applicant_name],
company_name: [elementValue.company_name,elementValue.company_name ? Validators.required : Validators.nullValidator],
company_relationship: [elementValue.company_relationship],
applicant_relation_to: [elementValue.applicant_relation_to, Validators.required],
relationship: [elementValue.relationship],
});
}
// temparr=[];
removereferance(index)
{
let relationControl = <FormArray>this.generalForm.controls['applicant_relation'];
relationControl.removeAt(index);
// this.temparr = [];
}
// createApplicateOthers()
// {
// return this.fb.group(
// {
// Name:
// })
// }
submitData(answerData)
{
console.log(answerData);
if(this.generalForm.valid)
{
let saveRecords:any = {}
let applicantList:any=[];
let applicantRelationList:any=[];
// this for applicant list for selected
answerData.applicant_list.forEach((element,key) => {
if(element.exist_status==1){
applicantList.push({
"pd_co_applicant_id":element.pd_co_applicant_id,
"applicant_name":element.applicant_name,
})
}
});
// this is for selected applicant relation
answerData.applicant_relation.forEach((element,key) => {
applicantRelationList.push({
"pd_co_applicant_id":element.pd_co_applicant_id,
"applicant_name":element.applicant_name,
"company_name":element.company_name,
"company_relationship":element.company_relationship,
"applicant_relation_to":element.applicant_relation_to,
"relationship":element.relationship,
})
});
saveRecords.pdid=answerData.pdid;
saveRecords.formid=answerData.formid;
saveRecords.general_remark=answerData.general_remark;
saveRecords.selected_applicant=applicantList;
saveRecords.applicant_relation=applicantRelationList;
saveRecords.fk_createdby = this.users;
console.log(saveRecords);
this.qustCat.saveForm(saveRecords).subscribe(res=>
{
if(res['dataStatus']==true)
{
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
this.navCtrl.pop();
}
})
}
}
getGeneralForm()
{
let records = {'pd_id':this.pdDetails.pd_id,'pd_form_id':this.FormId.form_id};
console.log('function in');
this.qustCat.retiverForm(records).subscribe(res=>
{
if(res['dataStatus']==true)
{
this.pd_applicants_details.push({'pd_co_applicant_id':"0",'applicant_name':'Others'});
let generalDetails = res['records'];
this.generalForm.controls['general_remark'].setValue(generalDetails.general_remark);
let applicant_relation = Object.keys(res['records'].applicant_relation).map(function(key)
{
console.log(key);
return res['records'].applicant_relation[key];
});
let selected_applicant = Object.keys(res['records'].selected_applicant).map(function(key)
{
return res['records'].selected_applicant[key].pd_co_applicant_id;
});
let applicantControl = <FormArray>this.generalForm.controls['applicant_list'];
let actual_applicant = this.pd_applicants_details.map(item => item.pd_co_applicant_id);
let checkApplicantExist =actual_applicant.map((id, index) => {
if (selected_applicant.indexOf(id) < 0) {
this.pd_applicants_details[index].exist_status=0;
return this.pd_applicants_details[index];
}
else{
this.pd_applicants_details[index].exist_status=1;
this.pd_applicants_details[index].applicant_relation_to='';
this.pd_applicants_details[index].relation='';
return this.pd_applicants_details[index];
}
}).filter(item => item != undefined);
this.getcoapplicantDetails(checkApplicantExist,applicant_relation);
}else
{
this.pd_applicants_details.push({'pd_co_applicant_id':"0",'applicant_name':'Others'});
}
})
}
}

View File

@ -0,0 +1,48 @@
<ion-header>
<ion-navbar color="optblue">
<ion-buttons end>
<button ion-button (click)="closeModal()">Close</button>
</ion-buttons>
<ion-title *ngIf="!viewchange">Other Applicant Details Added</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<form [formGroup]="otherForm">
<mat-card>
<div formArrayName="otherName">
<div *ngFor = "let item of otherForm.controls.otherName['controls'];let i=index;let last=last;" [formGroupName]="i">
<mat-form-field style="width: 100%">
<input type="text" matInput placeholder="Name" formControlName="applicant_name" name="applicant_name">
</mat-form-field>
<ion-col offset-6 col-3>
<a (click)="addmore()" *ngIf="last">
<ion-icon name="md-add" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
<ion-col offset-1 col-3>
<a (click)="deleteappdata(i)">
<ion-icon name="md-close" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
</div>
</div>
</mat-card>
<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> -->
<button ion-button full color="optblue" (click)="submitData(otherForm.value)"> Save</button>
<!-- </ion-buttons> -->
</ion-row>
</form>
</ion-content>

View File

@ -0,0 +1,3 @@
page-pd-question-general-other-applicant {
}

View File

@ -0,0 +1,71 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,ViewController } from 'ionic-angular';
import { FormGroup, FormBuilder,FormArray, Validators } from '@angular/forms';
/**
* Generated class for the PdQuestionGeneralOtherApplicantPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@Component({
selector: 'page-pd-question-general-other-applicant',
templateUrl: 'pd-question-general-other-applicant.html',
})
export class PdQuestionGeneralOtherApplicantPage {
otherForm:FormGroup;
applicantInfo:any={'pd_co_applicant_id':"0",'applicant_name':'','company_name':''};
constructor(public navCtrl: NavController, public navParams: NavParams,public fb:FormBuilder,public viewCtrl:ViewController) {
this.otherForm = this.fb.group(
{
otherName:this.fb.array([]),
})
this.addmore();
}
ionViewDidLoad() {
console.log('ionViewDidLoad PdQuestionGeneralOtherApplicantPage');
}
createName(elementValue:any)
{
return this.fb.group(
{
pd_co_applicant_id: [elementValue.pd_co_applicant_id],
applicant_name: [elementValue.applicant_name, Validators.required],
})
}
addmore()
{
if(this.otherForm.valid)
{
const control = <FormArray>this.otherForm.controls['otherName'];
control.push(this.createName(this.applicantInfo));
}
}
deleteappdata(index)
{
const control = <FormArray>this.otherForm.controls['otherName'];
if(control.length==1){
control.reset();
}else{
control.removeAt(index);
}
}
closeModal(){
this.viewCtrl.dismiss(1);
}
submitData(answerData)
{
if(this.otherForm.valid){
this.viewCtrl.dismiss(this.otherForm.value);
}
}
}

View File

@ -0,0 +1,60 @@
<ion-header>
<ion-navbar color="optblue">
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title *ngIf="!viewchange">{{FormId.form_name}}</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<form [formGroup]="representativeForm">
<mat-card>
<mat-form-field style="width: 100%">
<mat-select (selectionChange)="selectedLoanChanges($event)" placeholder="Did the lender representative accompany the PD officer for PD?"
formControlName="lender_representative_accompany">
<mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option>
</mat-select>
</mat-form-field>
<div *ngIf="representativeForm.controls.lender_representative_accompany.value == 'Yes'">
<div formArrayName="lender_representative_details">
<div *ngFor="let details of representativeForm.get('lender_representative_details').controls; let i=index"
[formGroupName]="i">
<mat-form-field style="width: 100%">
<input matInput placeholder="What is the name of lender representative who accompanies the PD officer, If any?" formControlName="lender_representative_who_accompanies" required>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Did the lender representative carry the loan file during PD?" formControlName="lender_representative_carry_loan_files" required>
</mat-form-field>
</div>
</div>
</div>
</mat-card>
<mat-card>
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="representative_remarks"></textarea>
</mat-form-field>
</mat-card>
<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> -->
<button ion-button full color="optblue" (click)="sumbitData(representativeForm.value)"> Save</button>
<!-- </ion-buttons> -->
</ion-row>
</form>
</ion-content>

View File

@ -0,0 +1,3 @@
page-pd-question-lender-representative {
}

View File

@ -0,0 +1,121 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { AwsServiceProvider } from '../../../providers/aws-service/aws-service';
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
import { ToastProvider } from '../../../providers/common-provider/toast';
import { FormGroup, FormBuilder,FormArray, Validators } from '@angular/forms';
/**
* Generated class for the PdQuestionLenderRepresentativePage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@Component({
selector: 'page-pd-question-lender-representative',
templateUrl: 'pd-question-lender-representative.html',
})
export class PdQuestionLenderRepresentativePage {
users: any;
FormId: any;
pdDetails: any;
representativeForm:FormGroup;
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider,public fb:FormBuilder) {
this.pdDetails = this.navParams.get('pdDetails');
this.FormId = this.navParams.get('FormId');
this.users = this.aws.getlocale();
this.representativeForm = this.fb.group({
pdid:[this.pdDetails.pd_id],
formid:[this.FormId.form_id],
fk_createdby:[this.users],
lender_representative_accompany: ['', Validators.compose([Validators.required])],
representative_remarks: ['', Validators.compose([Validators.required])],
lender_representative_details: this.fb.array([]),
});
this.getLenderReDetails();
}
ionViewDidLoad() {
console.log('ionViewDidLoad PdQuestionLenderRepresentativePage');
}
createlenReDetails()
{
return this.fb.group({
lender_representative_who_accompanies : ['', Validators.compose([Validators.required])],
lender_representative_carry_loan_files: ['', Validators.compose([Validators.required])],
});
}
selectedLoanChanges(e): void {
if (e.value == 'Yes') {
const control = <FormArray>this.representativeForm.controls['lender_representative_details'];
control.push(this.createlenReDetails());
} else if (e.value == 'No') {
const arr = <FormArray>this.representativeForm.controls.lender_representative_details;
arr.removeAt(0);
}
}
sumbitData(answerData)
{
if(this.representativeForm.valid)
{
let records = this.representativeForm.value;
this.qustCat.saveForm(records).subscribe(res=>
{
if(res['dataStatus']==true)
{
this.navCtrl.pop();
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
}
});
}else
{
this.toast.pdTriggerappmessage('Enter All Field');
}
}
getLenderReDetails()
{
let records = {'pd_id':this.pdDetails.pd_id,'pd_form_id':this.FormId.form_id}
this.qustCat.retiverForm(records).subscribe(res=>
{
if(res['dataStatus']==true)
{
let lenderReDetails = res['records'];
if(lenderReDetails.lender_representative_accompany=='Yes'){
this.representativeForm.controls['lender_representative_accompany'].setValue(lenderReDetails.lender_representative_accompany);
this.representativeForm.controls['representative_remarks'].setValue(lenderReDetails.representative_remarks);
let lender_represent_details = Object.keys(res['records'].lender_representative_details).map(function(key)
{
return res['records'].lender_representative_details[key];
});
console.log(lender_represent_details);
const control = <FormArray>this.representativeForm.controls['lender_representative_details'] as FormArray;
lender_represent_details.forEach(val=>
{
control.push(this.createlenReDetails());
})
this.representativeForm.controls['lender_representative_details'].setValue(lender_represent_details);
}else
{
this.representativeForm.controls['lender_representative_accompany'].setValue(lenderReDetails.lender_representative_accompany);
this.representativeForm.controls['representative_remarks'].setValue(lenderReDetails.representative_remarks);
}
}
})
}
}

View File

@ -4,7 +4,7 @@
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title *ngIf="!viewchange">Loan Category</ion-title>
<ion-title *ngIf="!viewchange">{{FormId.form_name}}</ion-title>
</ion-navbar>
@ -19,12 +19,12 @@
<mat-card style="padding: 12px;">
<mat-form-field style="width: 100%">
<input matInput placeholder="Loan Amount Applied for ? " formControlName="loan_amount" (keyup)="inWords($event,1)" required >
<input matInput placeholder="Loan Amount Applied for ? " formControlName="loan_amount" (keyup)="inWords($event,1)" (blur)="loanCalc()" required >
<mat-hint align="end" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}} {{loanAmtInWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select multiple (selectionChange)="endUserChange($event)" placeholder="What is the end use" formControlName="end_use" required>
<mat-option *ngFor="let enduse of m_endUseofLoad" [value]="enduse.id">{{ enduse.name }}</mat-option>
<mat-select multiple (selectionChange)="endUserChange($event.value)" placeholder="What is the end use" formControlName="end_use" required>
<mat-option *ngFor="let enduse of m_endUseofLoad" [value]="enduse.subproduct_id">{{ enduse.name }}</mat-option>
</mat-select>
<!--<mat-select multiple placeholder="What is the end use"
formControlName="end_use" (selectionChange)="endUserChange($event)">
@ -50,7 +50,7 @@
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'">
<input matInput placeholder="What is the amount required for Balance Transfer ? " (keypress)="keyPress($event)" formControlName="balance_transfer_amount" (keyup)="inWords($event,2)">
<input type="number" matInput placeholder="What is the amount required for Balance Transfer ? " (blur)="loanCalc()"formControlName="balance_transfer_amount" (keyup)="inWords($event,2)">
<mat-hint align="end" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}} {{balTxrfAmtInWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'">
@ -71,15 +71,15 @@
<input matInput placeholder="Specify Others Lender" formControlName="other_bt_lender">
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes' && loanDetailsForm.controls['is_topup'].value == 'yes'">
<input matInput placeholder="Top Up Amt" (keypress)="keyPress($event)" formControlName="topup_amount" (keyup)="inWords($event,5)">
<input matInput placeholder="Top Up Amt" type="text" formControlName="topup_amount" (keyup)="inWords($event,5)">
<mat-hint align="end" *ngIf="loanDetailsForm.controls['topup_amount'].value != ''">{{"&#8377;"}} {{topUpAmtInWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Amount of Own Contribution" formControlName="own_contribution" (keypress)="keyPress($event)" required (keyup)="inWords($event,4)">
<mat-form-field style="width: 100%" *ngIf="loanDetailsForm.controls['is_transfer'].value == 'no'">
<input matInput placeholder="Amount of Own Contribution" formControlName="own_contribution" type="number" required (keyup)="inWords($event,4)">
<mat-hint align="end" *ngIf="loanDetailsForm.controls['own_contribution'].value != ''">{{"&#8377;"}} {{ownContributionInWords}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-form-field style="width: 100%" *ngIf="loanDetailsForm.controls['is_transfer'].value == 'no'">
<mat-select placeholder="Source" formControlName="source" required>
<mat-option *ngFor="let sour of m_sourceofamount" [value]="sour.id">{{ sour.name }}</mat-option>
</mat-select>
@ -95,40 +95,26 @@
<input matInput placeholder="Specify Lender Name and Type" formControlName="lender_name_type">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="EMI Comfort Level" formControlName="emi_level" (keypress)="keyPress($event)" required>
<input matInput placeholder="EMI Comfort Level" formControlName="emi_level" type="number" required>
</mat-form-field>
</mat-card>
<br/>
<mat-card>
<div *ngIf="mortagetypeAccess">
<mat-card >
<mat-card-header>
<p>Mortgage
<p>
</mat-card-header>
<mat-card-content class="matcard">
<mat-form-field style="width: 100%">
<mat-select placeholder="Type of Property" formControlName="property_type" required>
<mat-option *ngFor="let typeprop of m_mortageTypeProperty" [value]="typeprop.mortage_property_id">{{ typeprop.property_name }}</mat-option>
<mat-select placeholder="Type of Property" formControlName="property_type" (selectionChange)="mortage_type($event.value)" required>
<mat-option *ngFor="let typeprop of m_mortageTypeProperty" [value]="typeprop.mortage_property_id">{{ typeprop.property_name }}</mat-option>
</mat-select>
<!--<mat-select placeholder="Type of property" formControlName="property_type">
<mat-option value="bungalow">Bungalow</mat-option>
<mat-option value="flat">Flat</mat-option>
<mat-option value="row_house">Row House</mat-option>
<mat-option value="floor">Floor</mat-option>
<mat-option value="chawl">Chawl</mat-option>
<mat-option value="shed">Shed</mat-option>
<mat-option value="office">Office</mat-option>
<mat-option value="shop_in_market">Shop in a market</mat-option>
<mat-option value="shop_in_mall">shop in a mall</mat-option>
<mat-option value="standalone_shop">standalone shop</mat-option>
<mat-option value="clinic">clinic</mat-option>
<mat-option value="factory">Factory</mat-option>
<mat-option value="vacant_land">Vacant Land</mat-option>
<mat-option value="others">Others</mat-option>
</mat-select>-->
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="loanDetailsForm.controls['property_type'].value =='6'">
<input matInput placeholder="Specify Type of Property" formControlName="ownershipOther">
<mat-form-field style="width: 100%" *ngIf="mortageAccess">
<input matInput placeholder="Specify Type of Property" formControlName="property_type_others">
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select multiple placeholder="Name of Owner"
@ -147,7 +133,7 @@
<mat-form-field style="width: 100%" *ngIf="loanDetailsForm.controls['construction_status'].value == 4">
<input matInput placeholder="What is the approximate stage of construction (%)?"
formControlName="percentage_of_construction" (keypress)="keyPress($event)" required>
formControlName="percentage_of_construction" type="number" required>
</mat-form-field>
<!--<mat-select placeholder="Status of construction"
@ -159,15 +145,16 @@
<mat-form-field style="width: 100%">
<input matInput placeholder="Estimate Market Value as Per Customer"
formControlName="emv_per_customer" (keypress)="keyPress($event)" required>
formControlName="emv_per_customer" type="number" required>
</mat-form-field>
<!-- <mat-form-field>
<input matInput placeholder="Value as Per Agreement"
formControlName="value_per_agreement" (keypress)="keyPress($event)" required (keyup)="inWords($event,3)">
formControlName="value_per_agreement" type="number" required (keyup)="inWords($event,3)">
<mat-hint align="end" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}} {{valAsPerAgmtInWords}} Only</mat-hint>
</mat-form-field> -->
</mat-card-content>
</mat-card>
</div>
<div fxLayout="row">
<div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%">

View File

View File

@ -19,6 +19,10 @@ import { ConstantsProvider } from '../../../providers/constants/constants';
templateUrl: 'pd-question-loans.html',
})
export class PdQuestionLoansPage {
enduse: any = [];
propertyType: any;
mortagetypeAccess: boolean;
mortageAccess: boolean = false;
topUpAmtInWords: any;
ownContributionInWords: any;
valAsPerAgmtInWords: any;
@ -61,6 +65,7 @@ export class PdQuestionLoansPage {
lender_name_type: [''],
emi_level: ['', Validators.compose([Validators.required])],
property_type: ['', Validators.compose([Validators.required])],
property_type_others:[''],
owner_name: ['', Validators.compose([Validators.required])],
construction_status: ['', Validators.compose([Validators.required])],
percentage_of_construction : [''],
@ -69,6 +74,15 @@ export class PdQuestionLoansPage {
loandetails_remarks: ['', Validators.compose([Validators.required])],
});
this.getLoanDetails();
console.log(75,this.pdDetails.product_abbr);
if(this.pdDetails.product_abbr !="BL" || this.pdDetails.product_abbr !="PL" || this.pdDetails.product_abbr !="LL")
{
this.mortagetypeAccess = true;
}else
{
this.mortagetypeAccess = false;
}
console.log(this.mortagetypeAccess);
this.getDropdown();
}
@ -86,30 +100,117 @@ export class PdQuestionLoansPage {
this.qustCat.getcommondrop('MORTAGEPROPERTIES').subscribe(
data => {
this.m_mortageTypeProperty = data['records'].filter(data => data.isactive == 1 && data.group == this.pdDetails.product_abbr);
if(data['dataStatus']==true){
// console.log(data['records']);
let that = this;
this.m_mortageTypeProperty = data['records'].filter(
function(data){
if(that.pdDetails.product_abbr !="LAP" && data.group_name==that.pdDetails.product_abbr && data.isactive==1 )
{
return data;
}else if(that.pdDetails.product_abbr =="LAP" && data.sub_group_name==that.pdDetails.subproduct_name)
{
return data;
}else
{
return ;
}
});
console.log(this.m_mortageTypeProperty);
this.mortage_type(this.propertyType);
}
});
this.qustCat.getcommondrop('SOURCEOFBALANCETRANSFER').subscribe(
data => {
this.m_sourceofamount = data['records'].filter(data => data.isactive == 1);
});
this.qustCat.getcommondrop('ENDUSEOFLOAN').subscribe(
data => {
this.m_endUseofLoad = data['records'].filter(data => data.isactive == 1);
this.qustCat.getcommondrop('SUBPRODUCTS').subscribe(
subdata => {
if(subdata['dataStatus']==true){
let that = this;
this.m_endUseofLoad = subdata['records'].filter(
function(data)
{
if(that.pdDetails.fk_product_id == data.fk_product_id && data.isactive==1)
{
return data;
}
});
this.endUserChange(this.enduse);
}
});
this.qustCat.getcommondrop('BTLENDERLIST').subscribe(
data => {
this.m_btLenderList = data['records'].filter(data => data.isactive == 1);
})
}
selectedBalancesTransferChanges(event: any){
// console.log('First Time',event);
// console.log('First Time Value',event.value);
if(event.value == 'no') {
this.loanDetailsForm.controls['is_topup'].clearValidators();
this.loanDetailsForm.controls['is_topup'].updateValueAndValidity();
// console.log('no',event.value);
}
else if(event.value == 'yes'){
this.loanDetailsForm.controls['is_topup'].setValidators([Validators.required]);
this.loanDetailsForm.controls['is_topup'].updateValueAndValidity();
// console.log('yes',event.value);
}
}
mortage_type(mortage_value)
{
console.log(mortage_value);
let mortagetypes = this.m_mortageTypeProperty.filter(mor=>mor.mortage_property_id==mortage_value)[0];
console.log(mortagetypes);
if(mortagetypes.property_name=='Others (Please Specify)')
{
this.mortageAccess = true;
}else
{
this.mortageAccess = false;
}
}
loanCalc()
{
let BtAmount = this.loanDetailsForm.value.balance_transfer_amount;
let loanAmount = this.loanDetailsForm.value.loan_amount;
let topupAmt ;
if(BtAmount !=null && BtAmount !='' && loanAmount !=null && loanAmount!='')
{
topupAmt = loanAmount - BtAmount;
}
this.loanDetailsForm.controls['topup_amount'].setValue(topupAmt);
}
endUserChange(event) {
console.log(event);
this.endUserList = [];
event.value.forEach(option => {
event.forEach(option => {
let othresData = this.m_endUseofLoad.filter(sub=>sub.subproduct_id==option)[0];
othresData = othresData.name.substr(0,6).toLowerCase();
this.endUserList.push({ end_use: option });
if (option == 'other') {
console.log(201,othresData);
if (othresData == 'others') {
this.isOtherPurpose = true;
return ;
}else
{
//console.log('else');
this.isOtherPurpose = false;
}
});
// console.log()
console.log(this.endUserList);
}
ownerNameChange(event) {
this.ownerNames = [];
@ -141,9 +242,9 @@ export class PdQuestionLoansPage {
submitLoanDetails() {
// console.log(answerData);
// console.log(this.endUserList);
if(this.loanDetailsForm.valid){
// if(this.loanDetailsForm.valid){
let records: any = {};
records.pdid = this.pdDetails.pdid;
records.pdid = this.pdDetails.pd_id;
records.formid = this.FormId.form_id;
records.fk_createdby = this.users;
records.loan_amount = this.loanDetailsForm.controls['loan_amount'].value;
@ -180,6 +281,9 @@ export class PdQuestionLoansPage {
}
records.emi_level = this.loanDetailsForm.controls['emi_level'].value;
records.property_type = this.loanDetailsForm.controls['property_type'].value;
if(this.loanDetailsForm.value.property_type_others !='' && this.loanDetailsForm.value.property_type_others !=null){
records.property_type_others = this.loanDetailsForm.controls['property_type_others'].value;
};
// records.owner_name_group = this.ownerNames;
// console.log(this.loanDetailsForm.controls['owner_name'].value);
let dataOwner_name = [];
@ -199,10 +303,10 @@ export class PdQuestionLoansPage {
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
// this.notifier.notify('success', 'Saved Successfully.');
})
}else
{
this.toast.pdTriggerappmessage('Enter The All Field');
}
// }else
// {
// this.toast.pdTriggerappmessage('Enter The All Field');
// }
}
getLoanDetails() {
@ -220,9 +324,9 @@ export class PdQuestionLoansPage {
return loanDetails.owner_name_group[key];
});
let enduse: any = [];
this.enduse
result.forEach(val => {
enduse.push(val.end_use);
this.enduse.push(val.end_use);
this.endUserList.push({'end_use':val.end_use});
});
let ownername: any = [];
@ -230,11 +334,12 @@ export class PdQuestionLoansPage {
ownername.push(val.owner_name);
this.ownerNames.push({'end_use':val.end_use});
});
console.log('enduse', enduse);
// console.log('enduse', enduse);
console.log('ownername', loanDetails);
this.loanDetailsForm.controls['loan_amount'].setValue(loanDetails.loan_amount);
if(loanDetails.loan_amount){ this.loanAmtInWords = this.constant.convertNumberToWords(loanDetails.loan_amount); }
this.loanDetailsForm.controls['end_use'].setValue(enduse);
this.loanDetailsForm.controls['end_use'].setValue(this.enduse);
if (loanDetails.end_use_other) {
this.loanDetailsForm.controls['end_use_other'].setValue(loanDetails.end_use_other);
}
@ -270,6 +375,8 @@ export class PdQuestionLoansPage {
this.loanDetailsForm.controls['emi_level'].setValue(loanDetails.emi_level);
this.loanDetailsForm.controls['other_bt_lender'].setValue(loanDetails.other_bt_lender);
this.loanDetailsForm.controls['property_type'].setValue(loanDetails.property_type);
this.propertyType =loanDetails.property_type;
this.loanDetailsForm.controls['property_type_others'].setValue(loanDetails.property_type_others);
this.loanDetailsForm.controls['owner_name'].setValue(ownername);
this.loanDetailsForm.controls['construction_status'].setValue(loanDetails.construction_status);
this.loanDetailsForm.controls['emv_per_customer'].setValue(loanDetails.emv_per_customer);

View File

@ -0,0 +1,137 @@
<ion-header>
<ion-navbar color="optblue">
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title *ngIf="!viewchange">{{FormId.form_name}}</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<form [formGroup]="neighbourhoodForm">
<mat-card>
<mat-radio-group formControlName="check_type" class="example-radio-group" style="width: 100%;">
<mat-radio-button class="example-radio-button" color="primary" [value]="types.id" *ngFor="let types of check_type; let t = index">{{types.type_name}}</mat-radio-button>
</mat-radio-group>
</mat-card>
<mat-card *ngIf="neighbourhoodForm.get('check_type').value==0">
<div formArrayName="neighbourhood_list">
<div *ngFor="let neighbourhood of neighbourhoodForm.controls.neighbourhood_list['controls']; let n = index;let last=last;"
[formGroupName]="n">
<mat-form-field style="width: 100%">
<input matInput placeholder="Neighbour Name" formControlName="neighbourhood_name" type="text">
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Do You Know" formControlName="do_know">
<mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="neighbourhood.controls.do_know.value=='Yes'">
<input matInput placeholder="How Long to Know the Applicant " formControlName="how_long_do_know" type="text">
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="neighbourhood.controls.do_know.value=='Yes'">
<mat-select placeholder="Is the Applicant Owner" formControlName="is_applicant_owner">
<mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option>
</mat-select>
</mat-form-field>
<ion-col offset-6 col-3>
<a (click)="addneighbourhood()" *ngIf="last">
<ion-icon name="md-add" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
<ion-col offset-1 col-3>
<a (click)="removeneighbourhood(n)">
<ion-icon name="md-trash" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
</div>
</div>
</mat-card>
<mat-card *ngIf="neighbourhoodForm.get('check_type').value=='1'">
<div formArrayName="referencecheck_list">
<div *ngFor="let reference of neighbourhoodForm.controls.referencecheck_list['controls'];let r=index;let last=last" [formGroupName]="r">
<mat-form-field style="width: 100%">
<input matInput placeholder="Name" formControlName="reference_name" type="text">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Mobile Number" formControlName="mobile" type="tel" maxlength="10">
</mat-form-field>
<p> Landline Number</p>
<mat-form-field style="width: 30%">
<input matInput placeholder="Code" formControlName="statecode" minlength="2" type="tel" maxlength="4">
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 60%">
<input matInput placeholder="Number" formControlName="landline" minlength="6" type="tel" maxlength="8">
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Location" formControlName="location"></textarea>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Relation With Business" formControlName="relationship_with">
<mat-option>Select</mat-option>
<mat-option *ngFor="let relationship of relationBusiness" [value]="relationship.relation_with_business_id">
{{relationship.relation_with_business_name | titlecase}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="reference.controls.relationship_with.value==5">
<input matInput placeholder="Others" formControlName="others" type="text">
</mat-form-field>
<p #period_paragraph>Period of Relationship</p>
<mat-form-field style="width: 100%">
<input matInput placeholder="Year" formControlName="year_relation_applicant" type="text" >
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Month" formControlName="months_relation_applicant" type="text">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput [placeholder]="reference.controls.relationship_with.value ==4 ? 'Rent Amount' : 'Volume of Business'" formControlName="business_volume_amount"
type="text">
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Unit" formControlName="business_volume_unit">
<mat-option>Select</mat-option>
<mat-option *ngFor="let volume of frequency" [value]="volume.frequency_id">
{{volume.name | titlecase}}
</mat-option>
</mat-select>
</mat-form-field>
<ion-col offset-6 col-3>
<a (click)="addreferance()" *ngIf="last">
<ion-icon name="md-add" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
<ion-col offset-1 col-3>
<a (click)="removereferance(r)">
<ion-icon name="md-trash" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
</div>
</div>
</mat-card>
<mat-card>
<textarea matInput type="text" placeholder="Remarks" name="neighbour_reference_remark" formControlName="neighbour_reference_remark"></textarea>
</mat-card>
<ion-row>
<button ion-button full color="optblue" (click)="submitData(neighbourhoodForm.value)"> Save</button>
<!-- </ion-buttons> -->
</ion-row>
</form>
</ion-content>

View File

@ -0,0 +1,3 @@
page-pd-question-neighbour-hood {
}

View File

@ -0,0 +1,251 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { AwsServiceProvider } from '../../../providers/aws-service/aws-service';
import { QuestionCategoryProvider } from '../../../providers/question-category/question-category';
import { ToastProvider } from '../../../providers/common-provider/toast';
import { FormGroup, FormBuilder,FormArray,Validators } from '@angular/forms';
/**
* Generated class for the PdQuestionNeighbourHoodPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@Component({
selector: 'page-pd-question-neighbour-hood',
templateUrl: 'pd-question-neighbour-hood.html',
})
export class PdQuestionNeighbourHoodPage {
frequency: any;
relationBusiness: any;
users: any;
FormId: any;
pdDetails: any;
neighbourhoodForm:FormGroup;
check_type:any=[{'id':0,'type_name':'Neighbourhood'},{'id':1,'type_name':'Reference Check'}]
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider,public fb:FormBuilder) {
this.pdDetails = this.navParams.get('pdDetails');
this.FormId = this.navParams.get('FormId');
this.neighbourhoodForm = this.fb.group(
{
pdid:this.pdDetails.pd_id,
formid:this.FormId.form_id,
check_type:0,
neighbourhood_list: this.fb.array([]),
referencecheck_list: this.fb.array([]),
neighbour_reference_remark:''
})
// console.log(this.pdDetails);
this.users = this.aws.getlocale();
this.getneighbourhood();
this.getdropdown();
}
ionViewDidLoad() {
console.log('ionViewDidLoad PdQuestionNeighbourHoodPage');
}
getdropdown()
{
this.qustCat.getcommondrop('RELATIONWITHBUSINESS').subscribe(res=>
{
if(res['dataStatus']==true)
{
this.relationBusiness = res['records'].filter(rel=>rel.isactive==1);
}
});
this.qustCat.getcommondrop('FREQUENCY').subscribe(res=>
{
if(res['dataStatus']==true)
{
this.frequency = res['records'].filter(frq=>frq.isactive==1);
}
})
}
createreferance()
{
return this.fb.group({
reference_name: [null],
mobile: [null],
statecode:[null],
landline: [null],
location:[null],
relationship_with:[null],
others: [null],
year_relation_applicant:[null],
months_relation_applicant:[null],
business_volume_amount:[null],
business_volume_unit:[null],
});
}
addreferance()
{
const control = <FormArray>this.neighbourhoodForm.controls['referencecheck_list'];
control.push(this.createreferance());
}
removereferance(i)
{
const control = <FormArray>this.neighbourhoodForm.controls['referencecheck_list'];
if(control.length==1)
{
control.reset();
}else{
control.removeAt(i);
}
}
createNeighbourhood(){
return this.fb.group({
neighbourhood_name: [null],
do_know: [],
how_long_do_know: [],
is_applicant_owner: [],
});
}
addneighbourhood()
{
const control = <FormArray>this.neighbourhoodForm.controls['neighbourhood_list'];
control.push(this.createNeighbourhood());
}
removeneighbourhood(i)
{
const control = <FormArray>this.neighbourhoodForm.controls['neighbourhood_list'];
if(control.length==1)
{
control.reset();
}else{
control.removeAt(i);
}
}
submitData(answerData)
{
console.log(answerData);
let saveRecords:any = {}
let referencecheck_list:any=[];
let neighbourhood_list:any=[];
if(answerData.check_type==0){
answerData.neighbourhood_list.forEach((element,key) => {
neighbourhood_list.push({
"neighbourhood_name":element.neighbourhood_name,
"do_know":element.do_know,
"how_long_do_know":element.how_long_do_know,
"is_applicant_owner":element.is_applicant_owner,
})
});
saveRecords.neighbourhood_list=neighbourhood_list;
}
else{
// this for referencecheck_list for selected
answerData.referencecheck_list.forEach((element,key) => {
referencecheck_list.push({
"reference_name":element.reference_name,
"mobile":element.mobile,
"landline":element.statecode+'-'+element.landline,
"location":element.location,
"relationship_with":element.relationship_with,
"others":element.others,
"year_relation_applicant":element.year_relation_applicant,
"months_relation_applicant":element.months_relation_applicant,
"business_volume_amount":element.business_volume_amount,
"business_volume_unit":element.business_volume_unit,
})
});
saveRecords.referencecheck_list=referencecheck_list;
}
saveRecords.pdid=answerData.pdid;
saveRecords.formid=answerData.formid;
saveRecords.check_type=answerData.check_type;
saveRecords.fk_createdby = this.users;
saveRecords.neighbour_reference_remark=answerData.neighbour_reference_remark;
console.log(saveRecords);
this.qustCat.saveForm(saveRecords).subscribe(res=>
{
if(res['dataStatus']==true)
{
this.navCtrl.pop();
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
}
})
}
getneighbourhood()
{
let records = {'pd_id':this.pdDetails.pd_id,'pd_form_id':this.FormId.form_id};
const control = <FormArray>this.neighbourhoodForm.controls['referencecheck_list'];
const neicontrol = <FormArray>this.neighbourhoodForm.controls['neighbourhood_list'];
this.qustCat.retiverForm(records).subscribe(res=>
{
if(res['dataStatus']==true)
{
let neighbourDetails = res['records'];
if(neighbourDetails.check_type==0)
{
this.neighbourhoodForm.controls['check_type'].setValue(neighbourDetails.check_type);
this.neighbourhoodForm.controls['neighbour_reference_remark'].setValue(neighbourDetails.neighbour_reference_remark);
let neighbourhood_list = Object.keys(res['records'].neighbourhood_list).map(function(key)
{
return res['records'].neighbourhood_list[key];
});
neighbourhood_list.forEach(val=>
{
neicontrol.push(this.createNeighbourhood());
});
this.neighbourhoodForm.controls['neighbourhood_list'].setValue(neighbourhood_list);
}else
{
this.addneighbourhood();
}
if(neighbourDetails.check_type==1)
{
let referencecheck_list = Object.keys(res['records'].referencecheck_list).map(function(key)
{
return res['records'].referencecheck_list[key];
});
console.log(referencecheck_list);
this.neighbourhoodForm.controls['check_type'].setValue(neighbourDetails.check_type);
this.neighbourhoodForm.controls['neighbour_reference_remark'].setValue(neighbourDetails.neighbour_reference_remark);
referencecheck_list.forEach((val,index)=>
{
let statecodesearch = val.landline.search("-");
referencecheck_list[index].statecode = val.landline.substr(0,statecodesearch);
console.log(val);
referencecheck_list[index].landline = val.landline.substr(+statecodesearch + 1,8);
control.push(this.createreferance());
});
console.log(referencecheck_list);
this.neighbourhoodForm.controls['referencecheck_list'].setValue(referencecheck_list);
}else
{
this.addreferance();
}
}else
{
this.addneighbourhood();
this.addreferance();
}
})
}
}

View File

@ -1,157 +1,213 @@
<ion-header>
<ion-navbar color="optblue">
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title *ngIf="!viewchange">{{FormId.form_name}}</ion-title>
</ion-navbar>
</ion-header>
<ion-navbar color="optblue">
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title *ngIf="!viewchange">{{FormId.form_name}}</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<form *ngIf="loadDataStatus" [formGroup]="_personalForm">
<form [formGroup]="_personalForm">
<mat-card>
<mat-card-title>Main Applicant</mat-card-title>
<mat-card-content formArrayName="main_applicant_details">
<div *ngFor="let mainDetails of _personalForm.controls.main_applicant_details['controls']; let i = index;" >
<div [formGroupName]="i">
<mat-form-field style="width: 100%">
<input matInput placeholder="Name" formControlName="name_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%">
<!-- <input matInput placeholder="Entity" formControlName="entity_ans" type="text" required> -->
<mat-select placeholder="Entity" formControlName="entity_ans" required (selectionChange)="selectedEntityChanges($event)">
<mat-option value="individual" >Individual</mat-option>
<mat-option value="non-individual" >Non-Individual</mat-option>
</mat-select>
</mat-form-field>
<mat-card-content>
<!-- start main applicant details -->
<div fxLayout="row wrap">
<div fxFlex="50" class="text-xs-left">
<mat-card>
<mat-card-title>Main Applicant</mat-card-title>
<mat-card-content>
<div [formArrayName]="'mainItem'" *ngFor="let mainDetails of pdMainapplicant.controls; let i = index;">
<div [formGroup]="mainDetails">
<mat-form-field style="width: 100%">
<input matInput placeholder="Name" formControlName="name_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput type="number" placeholder="Age" formControlName="age_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Entity" formControlName="entity_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Educational Qualification" formControlName="qualification_ans" required>
<mat-option *ngFor="let education of qualifications" [value]="education.qualification_id" >
{{education.qualification_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Earning Status" formControlName="earning_ans" required>
<mat-option *ngFor="let earning of earningStatus" [value]="earning.earning_member_status_id" >
{{earning.earning_member_status}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</mat-card-content>
</mat-card>
<mat-form-field *ngIf="mainDetails['controls'].entity_ans.value=='individual'" style="width: 100%">
<input matInput placeholder="Age" formControlName="age_ans" type="text" required (keypress)="keyPress($event)">
<mat-error *ngIf="mainDetails['controls'].age_ans.hasError('pattern') || mainDetails['controls'].age_ans.hasError('maxlength') || mainDetails['controls'].age_ans.hasError('minlength')">Enter Valid Age. </mat-error>
</mat-form-field>
<mat-form-field *ngIf="mainDetails['controls'].entity_ans.value=='non-individual'" style="width: 100%">
<!-- <input matInput placeholder="Entity" formControlName="entity_ans" type="text" required> -->
<mat-select placeholder="Non-Individual Entity" formControlName="non_individual_entity_ans" required>
<mat-option *ngFor="let NE of nonindividualentities" [value]="NE.non_individual_entity_id">
{{NE.non_individual_entity_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="mainDetails['controls'].non_individual_entity_ans.value==10" style="width: 100%">
<input matInput placeholder="Specify Others" formControlName="other_non_individual_entity_ans" type="text">
</mat-form-field>
<mat-form-field *ngIf="mainDetails['controls'].entity_ans.value=='individual'" style="width: 100%">
<mat-select placeholder="Earning Status" formControlName="earning_ans" required>
<mat-option *ngFor="let earning of earningStatus" [value]="earning.earning_member_status_id" >
{{earning.earning_member_status}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="mainDetails['controls'].entity_ans.value=='non-individual'" style="width: 100%">
<input matInput placeholder="Vintage" formControlName="vintage_ans" type="text" required (keypress)="keyPress($event)">
<mat-error *ngIf="mainDetails['controls'].vintage_ans.hasError('pattern') || mainDetails['controls'].vintage_ans.hasError('maxlength') || mainDetails['controls'].vintage_ans.hasError('minlength')">Enter Valid Vintage. </mat-error>
</mat-form-field>
<!-- <mat-form-field style="width: 15%">
<input matInput placeholder="Entity" formControlName="entity_ans" type="text" required>
</mat-form-field> -->
<mat-form-field *ngIf="mainDetails['controls'].entity_ans.value=='individual'" style="width: 100%">
<mat-select placeholder="Educational Qualification" formControlName="qualification_ans" required>
<mat-option *ngFor="let education of qualifications" [value]="education.qualification_id" >
{{education.qualification_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="mainDetails['controls'].entity_ans.value=='individual' && mainDetails['controls'].qualification_ans.value == 2" style="width: 100%">
<input matInput placeholder="Education Level" formControlName="edu_level_ans" type="text">
</mat-form-field>
</div>
</div>
</mat-card-content>
</mat-card>
<!-- end main applicant -->
<!-- start co applicant form details -->
<mat-card>
<mat-card-title>Co Applicant</mat-card-title>
<mat-card-content formArrayName="co_applicant_details">
<div *ngFor="let coDetails of _personalForm.controls.co_applicant_details['controls']; let c = index;" [formGroupName]="c">
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<input matInput placeholder="Name" formControlName="name_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<!-- <input matInput placeholder="Entity" formControlName="entity_ans" type="text" required> -->
<mat-select placeholder="Entity" formControlName="entity_ans" required (selectionChange)="selectedCoApplicantEntityChanges($event,c)">
<mat-option value="individual" >Individual</mat-option>
<mat-option value="non-individual" >Non-Individual</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="coDetails['controls'].entity_ans.value=='individual'" style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<input matInput placeholder="Age" formControlName="age_ans" type="text" required>
<mat-error *ngIf="coDetails['controls'].age_ans.hasError('pattern') || coDetails['controls'].age_ans.hasError('maxlength') || coDetails['controls'].age_ans.hasError('minlength')">Enter Valid Age. </mat-error>
</mat-form-field>
<mat-form-field *ngIf="coDetails['controls'].entity_ans.value=='non-individual'" style="width: 100%">
<!-- <input matInput placeholder="Entity" formControlName="entity_ans" type="text" required> -->
<mat-select placeholder="Non-Individual Entity" formControlName="non_individual_entity_ans" required>
<mat-option *ngFor="let NE of nonindividualentities" [value]="NE.non_individual_entity_id">
{{NE.non_individual_entity_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="coDetails['controls'].non_individual_entity_ans.value==10" style="width: 100%">
<input matInput placeholder="Specify Others" formControlName="other_non_individual_entity_ans" type="text">
</mat-form-field>
<mat-form-field *ngIf="coDetails['controls'].entity_ans.value=='individual'" style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<mat-select placeholder="Earning Status" formControlName="earning_ans" required>
<mat-option *ngFor="let earning of earningStatus" [value]="earning.earning_member_status_id" >
{{earning.earning_member_status}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="coDetails['controls'].entity_ans.value=='non-individual'" style="width: 100%">
<input matInput placeholder="Vintage" formControlName="vintage_ans" type="text" required (keypress)="keyPress($event)">
<mat-error *ngIf="coDetails['controls'].vintage_ans.hasError('pattern') || coDetails['controls'].vintage_ans.hasError('maxlength') || coDetails['controls'].vintage_ans.hasError('minlength')">Enter Valid Vintage.</mat-error>
</mat-form-field>
<mat-form-field *ngIf="coDetails['controls'].entity_ans.value=='individual'" style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<mat-select placeholder="Educational Qualification" formControlName="qualification_ans" required>
<mat-option *ngFor="let education of qualifications" [value]="education.qualification_id" >
{{education.qualification_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="coDetails['controls'].entity_ans.value=='individual' && coDetails['controls'].qualification_ans.value == 2" style="width: 100%">
<input matInput placeholder="Education Level" formControlName="edu_level_ans" type="text">
</mat-form-field>
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<mat-select placeholder="Relationship With Main Applicant" formControlName="relation_ans" required>
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
{{rel.name}}
</mat-option>
</mat-select>
</mat-form-field>
<ion-col offset-1 col-3>
<a (click)="removeCoApplicant(c)">
<ion-icon name="md-trash" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
<!-- end main applicant details -->
<!-- start co applicant form details -->
<div fxFlex="50" class="text-xs-left" [formArrayName]="'coItem'" *ngFor="let coDetails of pdCoapplicant.controls; let i = index;">
<mat-card>
<mat-card-title>Co Applicant</mat-card-title>
<mat-card-content>
<div >
<div [formGroup]="coDetails">
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<input matInput placeholder="Name" formControlName="name_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<input matInput placeholder="Age" formControlName="age_ans" type="text" required>
</mat-form-field>
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<input matInput placeholder="Entity" formControlName="entity_ans" type="text" required>
</mat-form-field>
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<mat-form-field style="width: 100%">
<mat-select placeholder="Educational Qualification" formControlName="qualification_ans" required>
<mat-option *ngFor="let education of qualifications" [value]="education.qualification_id" >
{{education.qualification_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Earning Status" formControlName="earning_ans" required>
<mat-option *ngFor="let earning of earningStatus" [value]="earning.earning_member_status_id" >
{{earning.earning_member_status}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%">
<!-- <mat-label>{{coDetails.controls.pd_question.value}}</mat-label> -->
<mat-select placeholder="Relationship" formControlName="relation_ans" required>
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
{{rel.name}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
<br/>
<mat-card>
<div fxLayout="row">
<div fxFlex="60" class="pb-0 text-sm-left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="personal_info_form_remark"></textarea>
</mat-form-field>
</div>
</div>
</mat-card>
<!-- end co applicant form details -->
</mat-card-content>
</div>
<mat-card-actions>
<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> -->
<button ion-button full color="optblue" (click)="submitPersonalForm(_personalForm.value)" > Save</button>
<!-- </ion-buttons> -->
</ion-row>
</mat-card-actions>
</form>
</ion-content>
</mat-card-content>
<mat-card-actions align="end">
<ion-col offset-6 col-3>
<a (click)="addCoApplicant()">
<ion-icon name="md-add" color="optblue" style="font-size: 22px;"></ion-icon>
</a>
</ion-col>
</mat-card-actions>
</mat-card>
<mat-card>
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="personal_info_form_remark" required></textarea>
</mat-form-field>
</mat-card>
<ion-row>
<button ion-button full color="optblue" (click)="submitPersonalForm(_personalForm.value)"> Save</button>
<!-- </ion-buttons> -->
</ion-row>
</form>
</ion-content>

View File

@ -19,6 +19,7 @@ import { FormArray, FormGroup, FormControl, Validators, FormBuilder } from '@ang
})
export class PdQuestionPersonalInfoPage implements OnInit{
nonindividualentities: any;
questionDetails: any;
pdDetails: any;
users: any;
@ -32,10 +33,34 @@ export class PdQuestionPersonalInfoPage implements OnInit{
public mainApplicantQuestions : any = ["Name","Age","Entity","Educational Qualification","Earning Status"];
public coApplicantQuestions : any = ["Name","Age","Entity","Educational Qualification","Earning Status","Relationship"];
public const_main_applicant : any = {
"name_ans": '',
"age_ans":'',
"vintage_ans":'',
"non_individual_entity_ans":'',
"other_non_individual_entity_ans":'',
"earning_ans": '',
"entity_ans": '',
"qualification_ans": '',
"edu_level_ans":'',
"current_added_status":1
};
public const_co_applicant : any = {
"name_ans": '',
"age_ans":'',
"vintage_ans":'',
"non_individual_entity_ans":'',
"other_non_individual_entity_ans":'',
"earning_ans": '',
"entity_ans": '',
"qualification_ans": '',
"edu_level_ans":'',
"relation_ans": '',
"current_added_status":1
};
public mainApplicantDetails :any=[];
public coApplicantDetails :any=[];
loadDataStatus:boolean;
errorMessage:any;
//coItem:any;
//mainItem:any;
@ -58,259 +83,438 @@ export class PdQuestionPersonalInfoPage implements OnInit{
}
ngOnInit() {
this.initFormDetails();
this.loadPDDetails();
this.getRelationMaster();
// this.getRelationMaster();
this.mainApplicantDetails = this.pdDetails.applicat_details
.filter(item => item.applicant_type == 1);
// console.log(this.mainApplicantDetails)
console.log(this.mainApplicantDetails)
this.coApplicantDetails = this.pdDetails.applicat_details
.filter(item => item.applicant_type == 0);
this.getMasterDetails('RELATIONSHIPS',1);
this.getMasterDetails('EARNINGMEMBERSSTATUS',2);
this.getMasterDetails('EDUQUALIFICATION',3);
this.getMasterDetails('NONINDIVIDUALENTITIES',4);
}
// load form pd details
loadPDDetails(){
let records = {'pd_id':this.pdDetails.pd_id,'pd_form_id':this.FormId.form_id};
let records = {'pd_id':this.pdDetails.pd_id,'pd_form_id':this.FormId.form_id};
this.qustCat.retiverForm(records).subscribe(
data => {
if (data['status'] == 200) {
this.loadFormWithIDData(data['records']);
const mainValue = <FormArray>this._personalForm.controls['main_applicant_details'];
const coValue = <FormArray>this._personalForm.controls['co_applicant_details'];
mainValue.controls = [];
coValue.controls = [];
this.loadDataStatus = true;
if (data['dataStatus'] == true) {
let retriveData = data['records'];
this._personalForm.controls['personal_info_form_remark'].setValue(data['records'].personal_info_form_remark ? data['records'].personal_info_form_remark : '');
let pullMainApplicant = Object.keys(data['records'].main_applicant_details).map(function(key) {
return data['records'].main_applicant_details[key];
});
if (pullMainApplicant.length > 0) {
pullMainApplicant.forEach(val => {
val.current_added_status=0
mainValue.push(this.loadMainApplicant(val));
});
// retriveData.main_applicant_details = pullMainApplicant;
} else {
mainValue.push(this.loadMainApplicant(this.const_main_applicant));
}
if(data['records'].co_applicant_details){
let pullCoApplicant = Object.keys(data['records'].co_applicant_details).map(function(key) {
return data['records'].co_applicant_details[key];
});
if (pullCoApplicant.length > 0) {
pullCoApplicant.forEach(val => {
val.current_added_status=0
coValue.push(this.loadCoApplicant(val));
});
// retriveData.co_applicant_details = pullCoApplicant;
} else {
coValue.push(this.loadCoApplicant(this.const_co_applicant));
}
}
else {
coValue.push(this.loadCoApplicant(this.const_co_applicant));
}
}
else{
let defaultMainApp=[];
let defaultCoApp=[];
// generate default main applicant form details
if(this.mainApplicantDetails.length>0){
for(let j=0;j<this.mainApplicantQuestions.length; j++)
{
if(j==0){
let generateRow = {
"pd_question":"",
"pd_answer": this.mainApplicantDetails[0].applicant_name,
}
defaultMainApp.push(generateRow);
}
else{
let generateRow = {
"pd_question":"",
"pd_answer": "",
}
defaultMainApp.push(generateRow);
}
else if(data['dataStatus'] == false){
this.mainApplicantDetails.forEach(item => {
item.current_added_status=0
mainValue.push(this.loadDefaultMainApplicant(item))
});
console.log(mainValue);
this.loadDataStatus = true;
// check co applicant
if(this.coApplicantDetails.length > 0){
this.coApplicantDetails.forEach(coItem => {
coItem.current_added_status=0
coValue.push(this.loadDefaultCoApplicant(coItem)
)
});
}
else {
coValue.push(this.loadCoApplicant(this.const_co_applicant))
}
this.loadFormData(defaultMainApp,this.coApplicantDetails);
}
}
}, error => this.errorMessage = <any> error);
}
loadDataStatus: boolean = false;
loadFormWithIDData(data) {
var main_result = Object.keys(data.main_applicant_details).map(function(key) {
return data.main_applicant_details[key];
});
let co_result;
if(data.co_applicant_details !==undefined && data.co_applicant_details !='' && data.co_applicant_details !=null){
co_result = Object.keys(data.co_applicant_details).map(function(key) {
return data.co_applicant_details[key];
});
}else
{
co_result = '';
}
// main applicant
let mainApplicantGroup = new FormArray(main_result.map((item,key) => new FormGroup({
name_ans:new FormControl(item.name_ans, Validators.required),
age_ans:new FormControl(item.age_ans, Validators.required),
entity_ans:new FormControl(item.entity_ans, Validators.required),
qualification_ans:new FormControl(item.qualification_ans, Validators.required),
earning_ans:new FormControl(item.earning_ans, Validators.required),
})));
// co applicant
let iterateCoApp=[];
let coApplicantGroup
if(co_result !=''){
coApplicantGroup = new FormArray(co_result.map((item,key) => new FormGroup({
name_ans:new FormControl(item.name_ans, Validators.required),
age_ans:new FormControl(item.age_ans, Validators.required),
entity_ans:new FormControl(item.entity_ans, Validators.required),
qualification_ans:new FormControl(item.qualification_ans, Validators.required),
earning_ans:new FormControl(item.earning_ans, Validators.required),
relation_ans:new FormControl(item.relation_ans, Validators.required),
})));
}else
{
coApplicantGroup = '';
}
let form_remarks ;
if(form_remarks!=null){
form_remarks = data.personal_info_form_remark;
}else
{
form_remarks = '';
}
this._personalForm = this._fb.group({
pdid:null,
form_id:null,
mainItem: mainApplicantGroup,
coItem: coApplicantGroup,
personal_info_form_remark: [form_remarks]
});
//console.log(this._personalForm);
this.loadDataStatus = true;
}
loadFormData(mainApp,coApp){
// main applicant
let mainApplicantGroup = new FormArray(this.mainApplicantDetails.map((item,key) => new FormGroup({
name_ques:new FormControl(this.mainApplicantQuestions[0]),
name_ans:new FormControl(item.applicant_name, Validators.required),
name_id:new FormControl(0),
age_ques:new FormControl(this.mainApplicantQuestions[1]),
age_id:new FormControl(1),
age_ans:new FormControl(null, Validators.required),
entity_ques: new FormControl(this.mainApplicantQuestions[2]),
entity_id: new FormControl(2),
entity_ans:new FormControl(this.pdDetails.customer_segment_abbr.substring(0,3).toUpperCase()==='SAL' ? 'Individual' : '', Validators.required),
qualification_ques: new FormControl(this.mainApplicantQuestions[3]),
qualification_id: new FormControl(3),
qualification_ans:new FormControl(null, Validators.required),
earningStatus_ques:new FormControl(this.mainApplicantQuestions[4]),
earning_id: new FormControl(4),
earning_ans:new FormControl(null, Validators.required),
})));
// co applicant
let iterateCoApp=[];
let coApplicantGroup = new FormArray(this.coApplicantDetails.map((item,key) => new FormGroup({
name_ques:new FormControl(this.coApplicantQuestions[0]),
name_ans:new FormControl(item.applicant_name, Validators.required),
name_id:new FormControl(0),
age_ques:new FormControl(this.coApplicantQuestions[1]),
age_id:new FormControl(1),
age_ans:new FormControl(null, Validators.required),
entity_ques: new FormControl(this.coApplicantQuestions[2]),
entity_id: new FormControl(2),
entity_ans:new FormControl(this.pdDetails.customer_segment_abbr.substring(0,3).toUpperCase()==='SAL' ? 'Individual' : '', Validators.required),
qualification_ques: new FormControl(this.coApplicantQuestions[3]),
qualification_id: new FormControl(3),
qualification_ans:new FormControl(null, Validators.required),
earningStatus_ques:new FormControl(this.coApplicantQuestions[4]),
earning_id: new FormControl(4),
earning_ans:new FormControl(null, Validators.required),
relationShip_ques:new FormControl(this.coApplicantQuestions[5]),
relation_id:new FormControl(5),
relation_ans:new FormControl(null, Validators.required),
})));
this._personalForm = this._fb.group({
pdid:null,
form_id:null,
mainItem: mainApplicantGroup,
coItem: coApplicantGroup,
personal_info_form_remark:null
});
//console.log(this._personalForm);
this.loadDataStatus = true;
}
//get pd main applicant array values
get pdMainapplicant() { return this._personalForm.get('mainItem') as FormArray; }
// get pd co applicant array values
get pdCoapplicant() {return this._personalForm.get('coItem') as FormArray;}
// get relation master details
getRelationMaster(){
let relation ="RELATIONSHIPS";
this.qustCat.getcommondrop(relation).subscribe(
// get all master details
getMasterDetails(table:string,type:number){
console.log('function in');
this.qustCat.getcommondrop(table).subscribe(
data => {
if (data['status'] == 200) {
this.relationShipList=data['records'];
console.log(data);
if (data['dataStaus'] == 200) {
if(type==1){
this.relationShipList=data['records'].filter(item => item.isactive == 1);
}
else if(type==2){
this.earningStatus=data['records'].filter(item => item.isactive == 1);
}
else if(type==3){
this.qualifications=data['records'].filter(item => item.isactive == 1);
}
else if(type==4){
this.nonindividualentities=data['records'].filter(item => item.isactive == 1);
}
}
}, error => this.errorMessage = <any> error);
this.qustCat.getcommondrop('EARNINGMEMBERSSTATUS').subscribe(res=>
{
if(res['dataStatus']==true)
{
this.earningStatus = res['records'].filter(ear=>ear.isactive==1);
}
});
this.qustCat.getcommondrop('EDUQUALIFICATION').subscribe(res=>
{
if(res['dataStatus']==true)
{
this.qualifications = res['records'].filter(qul=>qul.isactive==1);
}
})
}
/** On Key Press Event For Mobile Number */
keyPress(event: any) {
const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
// submit forms details
// init form details
public initFormDetails(): void {
this._personalForm = this._fb.group({
pdid:this.pdDetails.pd_id,
formid:this.FormId.form_id,
main_applicant_details: this._fb.array([]),
co_applicant_details: this._fb.array([]),
personal_info_form_remark:null
});
}
// add more co applicant details
addCoApplicant() {
const control = <FormArray>this._personalForm.controls['co_applicant_details'];
control.push(this.loadCoApplicant(this.const_co_applicant));
}
// remove co applicant details
removeCoApplicant(renoveIndex) {
const remove_control = <FormArray>this._personalForm.controls['co_applicant_details'];
remove_control.removeAt(renoveIndex)
}
// load main applicant
loadMainApplicant(applicant:any) {
return this._fb.group({
name_ans: [applicant.name_ans, Validators.required],
age_ans: [applicant.age_ans, Validators.compose([Validators.minLength(1),Validators.maxLength(3),Validators.pattern('^[0-9]*$')])],
vintage_ans: [applicant.vintage_ans, Validators.compose([Validators.minLength(1),Validators.maxLength(3),Validators.pattern('^[0-9]*$')])],
non_individual_entity_ans: [applicant.non_individual_entity_ans],
other_non_individual_entity_ans:[applicant.other_non_individual_entity_ans],
entity_ans: [applicant.entity_ans, Validators.required],
qualification_ans: [applicant.qualification_ans],
earning_ans: [applicant.earning_ans],
edu_level_ans: [applicant.edu_level_ans],
current_added_status: [applicant.current_added_status],
});
}
// load co applicant
loadCoApplicant(applicant:any) {
return this._fb.group({
name_ans: [applicant.name_ans, Validators.required],
age_ans: [applicant.age_ans, Validators.compose([Validators.minLength(1),Validators.maxLength(3),Validators.pattern('^[0-9]*$')])],
entity_ans: [applicant.entity_ans, Validators.required],
qualification_ans: [applicant.qualification_ans],
vintage_ans: [applicant.vintage_ans, Validators.compose([Validators.minLength(1),Validators.maxLength(3),Validators.pattern('^[0-9]*$')])],
non_individual_entity_ans: [applicant.non_individual_entity_ans],
other_non_individual_entity_ans:[applicant.other_non_individual_entity_ans],
earning_ans: [applicant.earning_ans],
relation_ans: [applicant.relation_ans, Validators.required],
edu_level_ans: [applicant.edu_level_ans],
current_added_status: [applicant.current_added_status],
});
}
// load default main applicant form data
loadDefaultMainApplicant(applicant:any){
// console.log('function in');
return this._fb.group({
name_ans: [applicant.applicant_name, Validators.required],
age_ans: ['', Validators.compose([Validators.minLength(1),Validators.maxLength(3),Validators.pattern('^[0-9]*$')])],
vintage_ans:['', Validators.compose([Validators.minLength(1),Validators.maxLength(3),Validators.pattern('^[0-9]*$')])],
non_individual_entity_ans:[''],
other_non_individual_entity_ans:[''],
entity_ans: [this.pdDetails.customer_segment_abbr.substring(0,3).toUpperCase()==='SAL' ? 'individual' : '', Validators.required],
qualification_ans: [''],
earning_ans: [''],
edu_level_ans:[''],
current_added_status: [applicant.current_added_status],
});
}
// load co applicant details
loadDefaultCoApplicant(applicant:any){
return this._fb.group({
name_ans: [applicant.applicant_name, Validators.required],
age_ans: ['', Validators.compose([Validators.minLength(1),Validators.maxLength(3),Validators.pattern('^[0-9]*$')])],
vintage_ans:['', Validators.compose([Validators.minLength(1),Validators.maxLength(3),Validators.pattern('^[0-9]*$')])],
non_individual_entity_ans:[''],
other_non_individual_entity_ans:[''],
entity_ans: [this.pdDetails.customer_segment_abbr.substring(0,3).toUpperCase()==='SAL' ? 'individual' : '', Validators.required],
edu_level_ans:[''],
qualification_ans: [''],
earning_ans: [''],
relation_ans: ['', Validators.required],
current_added_status: [applicant.current_added_status],
});
}
// submit forms details
submitPersonalForm(formData:any) {
if(this._personalForm.valid){
// if (this._personalForm.invalid) {
// this.validateAllFormFields(this._personalForm);
// //this.notifier.notify('warning', 'All Fields Are Required.!');
// return;
// }
// else{
//this.notifier.notify('warning', 'Fields Are Required.!');
let main_applicantDetails:any=[];
let co_applicantDetails:any=[];
formData.mainItem.forEach((element,key) => {
let new_co_applicant:any=[];
formData.main_applicant_details.forEach((element,key) => {
if(key==0){
main_applicantDetails.push({
"name_ans":element.name_ans,
"age_ans":element.age_ans,
"vintage_ans":element.vintage_ans,
"non_individual_entity_ans":element.non_individual_entity_ans,
"other_non_individual_entity_ans":element.other_non_individual_entity_ans,
"entity_ans":element.entity_ans,
"qualification_ans":element.qualification_ans,
"edu_level_ans":element.edu_level_ans,
"earning_ans":element.earning_ans,
})
}
});
if(formData.coItem !=''){
formData.coItem.forEach((Coelement,Cokey) => {
formData.co_applicant_details.forEach((Coelement,Cokey) => {
co_applicantDetails.push({
"name_ans":Coelement.name_ans,
"age_ans":Coelement.age_ans,
"qualification_ans":Coelement.qualification_ans,
"entity_ans":Coelement.entity_ans,
"earning_ans":Coelement.earning_ans,
"vintage_ans":Coelement.vintage_ans,
"non_individual_entity_ans":Coelement.non_individual_entity_ans,
"other_non_individual_entity_ans":Coelement.other_non_individual_entity_ans,
"edu_level_ans":Coelement.edu_level_ans,
"relation_ans":Coelement.relation_ans,
})
// get new co applicant list for applicant table
if(Coelement.current_added_status==1){
new_co_applicant.push({
"fk_pd_id": this.pdDetails.pd_id,
"pd_co_applicant_id": '',
"applicant_name":Coelement.name_ans,
"relation":Coelement.relation_ans,
"email":'',
"mobile_no":'',
"landline":'',
"applicant_type":0,
"isactive":1
});
}
});
}
let save_details:any={
"pdid" : this.pdDetails.pd_id,
"formid" : this.FormId.form_id,
"fk_createdby":this.users,
"main_applicant_details":main_applicantDetails,
"co_applicant_details":co_applicantDetails,
"personal_info_form_remark": this._personalForm.get('personal_info_form_remark').value
};
console.log(save_details);
this.qustCat.saveForm(save_details).subscribe(result => {
if (result['dataStatus']==true) {
this.navCtrl.pop();
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
// this.notifier.notify('success', 'Success.');
}
else {
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
let save_details:any={
"pdid": this.pdDetails.pd_id,
"formid": this.FormId.form_id,
"main_applicant_details":main_applicantDetails,
"co_applicant_details":co_applicantDetails,
"personal_info_form_remark": this._personalForm.get('personal_info_form_remark').value
};
if(new_co_applicant.length > 0){
this.qustCat.updatePdApplicant(new_co_applicant).subscribe(result => {
if (result.status == 200) {
this.questionsSubmitCheck(save_details);
}
else {
}
}, error => {
});
}
else{
this.questionsSubmitCheck(save_details);
}
//}
}
// submit and check all questions
questionsSubmitCheck(questionAns: any) {
this.qustCat.saveForm(questionAns).subscribe(result => {
if (result['dataStatus'] == true) {
this.navCtrl.pop();
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
}
else {
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
});
}
// validate all form group and form array fields
validateAllFormFields(formGroup: any) {
Object.keys(formGroup.controls).forEach(field => {
const control = formGroup.get(field);
if (control instanceof FormControl) {
control.markAsTouched({ onlySelf: true });
} else if (control instanceof FormGroup) {
this.validateAllFormFields(control);
} else if (control instanceof FormArray) {
this.validateAllFormFields(control);
}
});
}
// selectedAccTypeChanges(event: any){
// console.log('First Time',event);
// console.log('First Time Value',event.value);
// if(event.value == 2) {
// const control = <FormArray>this.bankingForm.controls['itemRows'];
// console.log('Inside If Condition');
// console.log(control);
// console.log(control.controls);
// control.controls[0].get('limit').clearValidators();
// control.controls[0].get('limit').updateValueAndValidity();
// //this.loanDetailsForm.controls['is_topup'].setValidators([Validators.required]);
// // this.bankingForm.controls['itemRows'].
// // this.bankingForm.controls.get('limit').clearValidators();
// // this.bankingForm.controls.itemRows['controls'].get('limit').updateValueAndValidity();
// // const control = <FormArray>this.bankingForm.controls['itemRows'];
// // console.log(control.controls['limit'].value);
// }
// else{
// //alert('sd');
// }}
selectedEntityChanges(event: any){
const control = <FormArray>this._personalForm.controls['main_applicant_details'];
if(event.value == 'individual') {
control.controls[0].get('vintage_ans').clearValidators();
control.controls[0].get('vintage_ans').updateValueAndValidity();
control.controls[0].get('age_ans').setValidators([Validators.required]);
control.controls[0].get('age_ans').updateValueAndValidity();
control.controls[0].get('earning_ans').setValidators([Validators.required]);
control.controls[0].get('earning_ans').updateValueAndValidity();
control.controls[0].get('qualification_ans').setValidators([Validators.required]);
control.controls[0].get('qualification_ans').updateValueAndValidity();
control.controls[0].get('non_individual_entity_ans').clearValidators();
control.controls[0].get('non_individual_entity_ans').updateValueAndValidity();
}
else if(event.value == 'non-individual'){
control.controls[0].get('vintage_ans').setValidators([Validators.required]);
control.controls[0].get('vintage_ans').updateValueAndValidity();
control.controls[0].get('age_ans').clearValidators();
control.controls[0].get('age_ans').updateValueAndValidity();
control.controls[0].get('earning_ans').clearValidators();
control.controls[0].get('earning_ans').updateValueAndValidity();
control.controls[0].get('qualification_ans').clearValidators();
control.controls[0].get('qualification_ans').updateValueAndValidity();
control.controls[0].get('non_individual_entity_ans').setValidators([Validators.required]);
control.controls[0].get('non_individual_entity_ans').updateValueAndValidity();
}
}
selectedCoApplicantEntityChanges(event: any,c){
const control = <FormArray>this._personalForm.controls['co_applicant_details'];
if(event.value == 'individual') {
control.controls[0].get('vintage_ans').clearValidators();
control.controls[0].get('vintage_ans').updateValueAndValidity();
control.controls[0].get('age_ans').setValidators([Validators.required]);
control.controls[0].get('age_ans').updateValueAndValidity();
control.controls[0].get('earning_ans').setValidators([Validators.required]);
control.controls[0].get('earning_ans').updateValueAndValidity();
control.controls[0].get('qualification_ans').setValidators([Validators.required]);
control.controls[0].get('qualification_ans').updateValueAndValidity();
control.controls[0].get('non_individual_entity_ans').clearValidators();
control.controls[0].get('non_individual_entity_ans').updateValueAndValidity();
}
else if(event.value == 'non-individual'){
control.controls[0].get('vintage_ans').setValidators([Validators.required]);
control.controls[0].get('vintage_ans').updateValueAndValidity();
control.controls[0].get('age_ans').clearValidators();
control.controls[0].get('age_ans').updateValueAndValidity();
control.controls[0].get('earning_ans').clearValidators();
control.controls[0].get('earning_ans').updateValueAndValidity();
control.controls[0].get('qualification_ans').clearValidators();
control.controls[0].get('qualification_ans').updateValueAndValidity();
control.controls[0].get('non_individual_entity_ans').setValidators([Validators.required]);
control.controls[0].get('non_individual_entity_ans').updateValueAndValidity();
}
}
}

View File

@ -126,7 +126,7 @@ export class PdQuestionRentalInfoPage {
console.log(this.rentalForms.value);
if(this.rentalForms.valid){
// if(this.rentalForms.valid){
records.pdid = this.pdDetails.pd_id;
records.formid = this.FormId.form_id;
records.fk_createdby = this.users;
@ -149,10 +149,10 @@ if(this.rentalForms.valid){
this.navCtrl.pop();
}
})
}else
{
this.toast.pdTriggerappmessage('Enter All Field');
}
// }else
// {
// this.toast.pdTriggerappmessage('Enter All Field');
// }
}
getRentalDetails()

View File

@ -31,17 +31,35 @@
<input matInput placeholder="Name" formControlName="raw_name">
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput placeholder="Quantity" formControlName="raw_quantity">
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput placeholder="Value" formControlName="raw_value">
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput placeholder="Value of raw materials as per financial Statements" formControlName="rawmaterial_value">
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput placeholder="Is the stock of raw materials sufficient ?" formControlName="is_sufficiant_raw">
</mat-form-field>
<mat-select placeholder="is the Stock is Observed ?"
formControlName="stock_observed" required>
<mat-option value="yes" >Yes</mat-option>
<mat-option value="no" >No</mat-option>
</mat-select>
</mat-form-field>
<div *ngIf="details.get('stock_observed').value == 'no'" >
<mat-form-field style="width:100%">
<input matInput placeholder="Estimated Quantity" formControlName="raw_quantity" required>
</mat-form-field>
<mat-form-field style="width:100%">
<mat-select placeholder="Unit of Mearsurement"
formControlName="raw_uom" required>
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">{{uom.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:100%" *ngIf="details.get('raw_uom').value == 61" >
<input matInput placeholder="Specify Other UOM" formControlName="other_uom" required>
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput placeholder="Value" formControlName="raw_value" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput placeholder="Value of raw materials as per latest financial Statements" formControlName="rawmaterial_value" (keypress)="keyPress($event)" required>
</mat-form-field>
<mat-form-field style="width:100%">
<input matInput placeholder="Is the stock of raw materials observed ?" formControlName="is_sufficiant_raw" required>
</mat-form-field>
</div>
<ion-buttons end>
<ion-col offset-3 col-3>
<a (click)="addRawMaterials()" *ngIf="last">

View File

@ -19,6 +19,8 @@ import { FormArray, FormGroup, FormBuilder } from '@angular/forms';
})
export class PdQuestionStockInfoPage {
uomData: any;
rawmaterial: any;
users: any;
FormId: any;
pdDetails: any;
@ -33,6 +35,22 @@ export class PdQuestionStockInfoPage {
finished_goods: this.fb.array([])
});
this.getStockDetails();
this.qustCat.retiverForm({pd_id:this.pdDetails.pd_id,pd_form_id:'1'}).subscribe(value => {
// console.log('Raw material Name',value.records.main_raw_materials);
// const faControl = (<FormArray>this.stockForm.controls['raw_materials']).at(1);
const control = (<FormArray>this.stockForm.controls['raw_materials']).at(0);
console.log(control);
// this.stockForm.controls['raw_materials'].setValue(value.records.main_raw_materials);
if (value['dataStatus'] == true) {
this.rawmaterial = value['records'].main_raw_materials;
}else{ this.rawmaterial = ''; }
})
this.getdropdown();
}
@ -41,10 +59,24 @@ export class PdQuestionStockInfoPage {
}
getdropdown()
{
this.qustCat.getcommondrop('UOM').subscribe(data => {
if(data['dataStatus']==true){
this.uomData = data['records'].filter(uom=>uom.isactive==1);
}
});
}
createRawmaterial() {
return this.fb.group({
raw_name: [''],
stock_observed:[''],
raw_quantity: [''],
raw_uom: [''],
other_uom : [''],
raw_value: [''],
rawmaterial_value: [''],
is_sufficiant_raw: [''],

View File

@ -43,9 +43,13 @@
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field>
</div>
<mat-form-field style="width: 100%">
<input matInput placeholder="Main Raw Material" formControlName="main_raw_materials">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field>
<div fxFlex="30">
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Name" formControlName="contact_person">
<input matInput type="tel" maxlength="10" placeholder="Contact Person Name" formControlName="contact_person">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field>
</div>
@ -79,7 +83,7 @@
</div>
</div>
<div fxLayout="row" fxLayoutGap="14px" fxLayoutAlign="start none">
<div fxFlex="30">
<!-- <div fxFlex="30">
<mat-form-field style="width: 100%">
<mat-select (selectionChange)="selectedFreqPurchase($event)" placeholder="Frequency of Purchase" formControlName="frequency_of_purchase">
<mat-option *ngFor="let feq of m_freqOfPurchase" [value]="feq.frequency_id">{{ feq.name }}</mat-option>
@ -89,9 +93,9 @@
<div *ngIf="sup.get('frequency_of_purchase').value == 8" fxFlex="30">
<mat-form-field style="width: 100%">
<input matInput placeholder="Others Details" formControlName="freq_purchase_others_text_value">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>
</mat-form-field>
</div>
</div> -->
<ion-buttons end>

Some files were not shown because too many files have changed in this diff Show More