From 3660e97785716ed155ef66160cf41d65ea22efab Mon Sep 17 00:00:00 2001 From: venbaSriram Date: Tue, 18 Dec 2018 19:13:21 +0530 Subject: [PATCH] form changes --- src/app/app.component.ts | 0 src/app/app.html | 1 + src/app/app.module.ts | 18 + src/app/main.ts | 0 src/assets/img/misc/login.jpg | Bin src/assets/img/misc/sidemenubg.jpg | Bin src/index.html | 0 src/manifest.json | 0 src/pages/auth/auth.html | 4 +- src/pages/googleplaytab/googleplaytab.html | 0 src/pages/googleplaytab/googleplaytab.scss | 0 src/pages/googleplaytab/googleplaytab.ts | 0 .../input/bounced-reject/bounced-reject.html | 36 + .../input/bounced-reject/bounced-reject.scss | 3 + .../input/bounced-reject/bounced-reject.ts | 65 ++ src/pages/input/input.html | 2 +- src/pages/input/input.ts | 57 +- src/pages/otp/otp.html | 0 src/pages/otp/otp.scss | 0 src/pages/otp/otp.ts | 0 src/pages/pd-list/pd-list.html | 4 +- .../pd-question-category.html | 8 +- .../pd-question-category.scss | 0 .../pd-question-category.ts | 13 + .../pd-question-address.html | 106 +-- .../pd-question-address.scss | 0 .../pd-question-address.ts | 273 +++++++- .../pd-question-assessed-business.html | 0 .../pd-question-assessed-business.scss | 0 .../pd-question-assessed-business.ts | 23 +- .../pd-question-assessed-daily-sales.html | 21 +- .../pd-question-assessed-daily-sales.scss | 0 .../pd-question-assessed-daily-sales.ts | 272 +++++--- .../pd-question-assessed-dash.html | 134 ++-- .../pd-question-assessed-dash.scss | 0 .../pd-question-assessed-dash.ts | 101 ++- .../pd-question-assessed-household.html | 2 +- .../pd-question-assessed-household.scss | 0 .../pd-question-assessed-household.ts | 27 +- .../pd-question-assessed-info.html | 34 +- .../pd-question-assessed-info.scss | 34 +- .../pd-question-assessed-info.ts | 35 +- .../pd-question-assessed-purchase.html | 0 .../pd-question-assessed-purchase.ts | 0 .../pd-question-assessed-sales.html | 20 +- .../pd-question-assessed-sales.scss | 0 .../pd-question-assessed-sales.ts | 47 +- .../pd-question-assests.html | 367 +++++++++-- .../pd-question-assests.scss | 0 .../pd-question-assests.ts | 281 ++++++-- .../pd-question-banking.html | 25 +- .../pd-question-banking.scss | 0 .../pd-question-banking.ts | 19 +- .../pd-question-business-info.html | 0 .../pd-question-business-info.scss | 0 .../pd-question-business-info.ts | 0 .../pd-question-client-info.html | 0 .../pd-question-client-info.scss | 0 .../pd-question-client-info.ts | 0 .../pd-question-current-loans.html | 0 .../pd-question-current-loans.scss | 0 .../pd-question-current-loans.ts | 0 .../pd-question-emp-info.html | 0 .../pd-question-emp-info.scss | 0 .../pd-question-emp-info.ts | 0 .../pd-question-family.html | 2 +- .../pd-question-family.scss | 0 .../pd-question-family/pd-question-family.ts | 19 +- .../pd-question-financial-info.html | 0 .../pd-question-financial-info.scss | 0 .../pd-question-financial-info.ts | 0 .../pd-question-general-info.html | 92 +++ .../pd-question-general-info.scss | 3 + .../pd-question-general-info.ts | 300 +++++++++ .../pd-question-general-other-applicant.html | 48 ++ .../pd-question-general-other-applicant.scss | 3 + .../pd-question-general-other-applicant.ts | 71 ++ .../pd-question-lender-representative.html | 60 ++ .../pd-question-lender-representative.scss | 3 + .../pd-question-lender-representative.ts | 121 ++++ .../pd-question-loans/pd-question-loans.html | 57 +- .../pd-question-loans/pd-question-loans.scss | 0 .../pd-question-loans/pd-question-loans.ts | 141 +++- .../pd-question-neighbour-hood.html | 137 ++++ .../pd-question-neighbour-hood.scss | 3 + .../pd-question-neighbour-hood.ts | 251 +++++++ .../pd-question-other-income.html | 0 .../pd-question-other-income.scss | 0 .../pd-question-other-income.ts | 0 .../pd-question-personal-info.html | 352 +++++----- .../pd-question-personal-info.scss | 0 .../pd-question-personal-info.ts | 620 ++++++++++++------ .../pd-question-rental-info.html | 0 .../pd-question-rental-info.scss | 0 .../pd-question-rental-info.ts | 10 +- .../pd-question-stock-info.html | 40 +- .../pd-question-stock-info.scss | 0 .../pd-question-stock-info.ts | 32 + .../pd-question-supplier-info.html | 12 +- .../pd-question-supplier-info.scss | 0 .../pd-question-supplier-info.ts | 4 +- src/pages/pd-question/pd-question.html | 0 src/pages/pd-question/pd-question.scss | 0 src/pages/pd-question/pd-question.ts | 0 src/providers/aws-service/aws-service.ts | 0 src/providers/aws-service/cognito.service.ts | 2 + src/providers/common-provider/camera.ts | 3 +- src/providers/common-provider/loading.ts | 0 .../question-category/question-category.ts | 8 + src/service-worker.js | 0 110 files changed, 3557 insertions(+), 869 deletions(-) mode change 100644 => 100755 src/app/app.component.ts mode change 100644 => 100755 src/app/app.html mode change 100644 => 100755 src/app/app.module.ts mode change 100644 => 100755 src/app/main.ts mode change 100644 => 100755 src/assets/img/misc/login.jpg mode change 100644 => 100755 src/assets/img/misc/sidemenubg.jpg mode change 100644 => 100755 src/index.html mode change 100644 => 100755 src/manifest.json mode change 100644 => 100755 src/pages/googleplaytab/googleplaytab.html mode change 100644 => 100755 src/pages/googleplaytab/googleplaytab.scss mode change 100644 => 100755 src/pages/googleplaytab/googleplaytab.ts create mode 100755 src/pages/input/bounced-reject/bounced-reject.html create mode 100755 src/pages/input/bounced-reject/bounced-reject.scss create mode 100755 src/pages/input/bounced-reject/bounced-reject.ts mode change 100644 => 100755 src/pages/otp/otp.html mode change 100644 => 100755 src/pages/otp/otp.scss mode change 100644 => 100755 src/pages/otp/otp.ts mode change 100644 => 100755 src/pages/pd-question-category/pd-question-category.html mode change 100644 => 100755 src/pages/pd-question-category/pd-question-category.scss mode change 100644 => 100755 src/pages/pd-question-category/pd-question-category.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-address/pd-question-address.html mode change 100644 => 100755 src/pages/pd-question/pd-question-address/pd-question-address.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-address/pd-question-address.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-business/pd-question-assessed-business.html mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-business/pd-question-assessed-business.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-business/pd-question-assessed-business.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.html mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.html mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.html mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.html mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-purchase/pd-question-assessed-purchase.html mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-purchase/pd-question-assessed-purchase.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.html mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-assests/pd-question-assests.html mode change 100644 => 100755 src/pages/pd-question/pd-question-assests/pd-question-assests.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-assests/pd-question-assests.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-banking/pd-question-banking.html mode change 100644 => 100755 src/pages/pd-question/pd-question-banking/pd-question-banking.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-banking/pd-question-banking.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-business-info/pd-question-business-info.html mode change 100644 => 100755 src/pages/pd-question/pd-question-business-info/pd-question-business-info.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-business-info/pd-question-business-info.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-client-info/pd-question-client-info.html mode change 100644 => 100755 src/pages/pd-question/pd-question-client-info/pd-question-client-info.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-client-info/pd-question-client-info.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-current-loans/pd-question-current-loans.html mode change 100644 => 100755 src/pages/pd-question/pd-question-current-loans/pd-question-current-loans.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-current-loans/pd-question-current-loans.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-emp-info/pd-question-emp-info.html mode change 100644 => 100755 src/pages/pd-question/pd-question-emp-info/pd-question-emp-info.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-emp-info/pd-question-emp-info.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-family/pd-question-family.html mode change 100644 => 100755 src/pages/pd-question/pd-question-family/pd-question-family.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-family/pd-question-family.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-financial-info/pd-question-financial-info.html mode change 100644 => 100755 src/pages/pd-question/pd-question-financial-info/pd-question-financial-info.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-financial-info/pd-question-financial-info.ts create mode 100644 src/pages/pd-question/pd-question-general-info/pd-question-general-info.html create mode 100644 src/pages/pd-question/pd-question-general-info/pd-question-general-info.scss create mode 100644 src/pages/pd-question/pd-question-general-info/pd-question-general-info.ts create mode 100644 src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.html create mode 100644 src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.scss create mode 100644 src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.ts create mode 100644 src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.html create mode 100644 src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.scss create mode 100644 src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-loans/pd-question-loans.html mode change 100644 => 100755 src/pages/pd-question/pd-question-loans/pd-question-loans.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-loans/pd-question-loans.ts create mode 100644 src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.html create mode 100644 src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.scss create mode 100644 src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-other-income/pd-question-other-income.html mode change 100644 => 100755 src/pages/pd-question/pd-question-other-income/pd-question-other-income.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-other-income/pd-question-other-income.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.html mode change 100644 => 100755 src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.html mode change 100644 => 100755 src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.html mode change 100644 => 100755 src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.ts mode change 100644 => 100755 src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.html mode change 100644 => 100755 src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.scss mode change 100644 => 100755 src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.ts mode change 100644 => 100755 src/pages/pd-question/pd-question.html mode change 100644 => 100755 src/pages/pd-question/pd-question.scss mode change 100644 => 100755 src/pages/pd-question/pd-question.ts mode change 100644 => 100755 src/providers/aws-service/aws-service.ts mode change 100644 => 100755 src/providers/common-provider/camera.ts mode change 100644 => 100755 src/providers/common-provider/loading.ts mode change 100644 => 100755 src/providers/question-category/question-category.ts mode change 100644 => 100755 src/service-worker.js diff --git a/src/app/app.component.ts b/src/app/app.component.ts old mode 100644 new mode 100755 diff --git a/src/app/app.html b/src/app/app.html old mode 100644 new mode 100755 index fd667fd7..40d2e3de --- a/src/app/app.html +++ b/src/app/app.html @@ -22,5 +22,6 @@ + \ No newline at end of file diff --git a/src/app/app.module.ts b/src/app/app.module.ts old mode 100644 new mode 100755 index a575351b..790aaab0 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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: [ diff --git a/src/app/main.ts b/src/app/main.ts old mode 100644 new mode 100755 diff --git a/src/assets/img/misc/login.jpg b/src/assets/img/misc/login.jpg old mode 100644 new mode 100755 diff --git a/src/assets/img/misc/sidemenubg.jpg b/src/assets/img/misc/sidemenubg.jpg old mode 100644 new mode 100755 diff --git a/src/index.html b/src/index.html old mode 100644 new mode 100755 diff --git a/src/manifest.json b/src/manifest.json old mode 100644 new mode 100755 diff --git a/src/pages/auth/auth.html b/src/pages/auth/auth.html index 0582bd7f..b4f4830b 100755 --- a/src/pages/auth/auth.html +++ b/src/pages/auth/auth.html @@ -21,7 +21,7 @@ - + @@ -59,7 +59,7 @@ - + diff --git a/src/pages/googleplaytab/googleplaytab.html b/src/pages/googleplaytab/googleplaytab.html old mode 100644 new mode 100755 diff --git a/src/pages/googleplaytab/googleplaytab.scss b/src/pages/googleplaytab/googleplaytab.scss old mode 100644 new mode 100755 diff --git a/src/pages/googleplaytab/googleplaytab.ts b/src/pages/googleplaytab/googleplaytab.ts old mode 100644 new mode 100755 diff --git a/src/pages/input/bounced-reject/bounced-reject.html b/src/pages/input/bounced-reject/bounced-reject.html new file mode 100755 index 00000000..94f04ba4 --- /dev/null +++ b/src/pages/input/bounced-reject/bounced-reject.html @@ -0,0 +1,36 @@ + + + + Bounced Reject Reason + + + + + + + + + + {{bouns.bounce_reason_name}} + + + + + + + + + + + + + + + + + + + diff --git a/src/pages/input/bounced-reject/bounced-reject.scss b/src/pages/input/bounced-reject/bounced-reject.scss new file mode 100755 index 00000000..fe1f2dc3 --- /dev/null +++ b/src/pages/input/bounced-reject/bounced-reject.scss @@ -0,0 +1,3 @@ +page-bounced-reject { + +} diff --git a/src/pages/input/bounced-reject/bounced-reject.ts b/src/pages/input/bounced-reject/bounced-reject.ts new file mode 100755 index 00000000..117aa656 --- /dev/null +++ b/src/pages/input/bounced-reject/bounced-reject.ts @@ -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); + } + }) + } + } +} diff --git a/src/pages/input/input.html b/src/pages/input/input.html index a4b24522..53965b03 100755 --- a/src/pages/input/input.html +++ b/src/pages/input/input.html @@ -44,7 +44,7 @@
- + Schedule Date diff --git a/src/pages/input/input.ts b/src/pages/input/input.ts index 1201436a..317fce7a 100755 --- a/src/pages/input/input.ts +++ b/src/pages/input/input.ts @@ -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; }) } } + + diff --git a/src/pages/otp/otp.html b/src/pages/otp/otp.html old mode 100644 new mode 100755 diff --git a/src/pages/otp/otp.scss b/src/pages/otp/otp.scss old mode 100644 new mode 100755 diff --git a/src/pages/otp/otp.ts b/src/pages/otp/otp.ts old mode 100644 new mode 100755 diff --git a/src/pages/pd-list/pd-list.html b/src/pages/pd-list/pd-list.html index a1fdacfc..7ef74de1 100755 --- a/src/pages/pd-list/pd-list.html +++ b/src/pages/pd-list/pd-list.html @@ -144,8 +144,8 @@
-

{{pdlistdetails}}

+

test

- + \ No newline at end of file diff --git a/src/pages/pd-question-category/pd-question-category.html b/src/pages/pd-question-category/pd-question-category.html old mode 100644 new mode 100755 index b98566a1..bfa4d7a7 --- a/src/pages/pd-question-category/pd-question-category.html +++ b/src/pages/pd-question-category/pd-question-category.html @@ -3,7 +3,7 @@ - PD Questions Category + {{pddetails.applicat_details[0].applicant_name | titlecase}} - + +
diff --git a/src/pages/pd-question-category/pd-question-category.scss b/src/pages/pd-question-category/pd-question-category.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question-category/pd-question-category.ts b/src/pages/pd-question-category/pd-question-category.ts old mode 100644 new mode 100755 index 907bacb8..9d21ae41 --- a/src/pages/pd-question-category/pd-question-category.ts +++ b/src/pages/pd-question-category/pd-question-category.ts @@ -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){ diff --git a/src/pages/pd-question/pd-question-address/pd-question-address.html b/src/pages/pd-question/pd-question-address/pd-question-address.html old mode 100644 new mode 100755 index e2681ec7..4be7ebd0 --- a/src/pages/pd-question/pd-question-address/pd-question-address.html +++ b/src/pages/pd-question/pd-question-address/pd-question-address.html @@ -99,15 +99,19 @@
- + +

Type Of Premises

+ + {{at.address_type}} +
@@ -115,58 +119,54 @@ Applicant ID Required
-
+
- + + {{CL.name}} - - - -
- -
--> + + + + + + + + {{ownerShip.name}} + + + + + + + + + + + + + + + + +
diff --git a/src/pages/pd-question/pd-question-address/pd-question-address.scss b/src/pages/pd-question/pd-question-address/pd-question-address.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-address/pd-question-address.ts b/src/pages/pd-question/pd-question-address/pd-question-address.ts old mode 100644 new mode 100755 index 988ce8df..e8e7502a --- a/src/pages/pd-question/pd-question-address/pd-question-address.ts +++ b/src/pages/pd-question/pd-question-address/pd-question-address.ts @@ -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 = 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 = 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 = 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 = 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 = 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); + } } diff --git a/src/pages/pd-question/pd-question-assessed-business/pd-question-assessed-business.html b/src/pages/pd-question/pd-question-assessed-business/pd-question-assessed-business.html old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-assessed-business/pd-question-assessed-business.scss b/src/pages/pd-question/pd-question-assessed-business/pd-question-assessed-business.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-assessed-business/pd-question-assessed-business.ts b/src/pages/pd-question/pd-question-assessed-business/pd-question-assessed-business.ts old mode 100644 new mode 100755 index 539a17e5..3b829f9c --- a/src/pages/pd-question/pd-question-assessed-business/pd-question-assessed-business.ts +++ b/src/pages/pd-question/pd-question-assessed-business/pd-question-assessed-business.ts @@ -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'); } diff --git a/src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.html b/src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.html old mode 100644 new mode 100755 index 901ac5b0..74b8e4bd --- a/src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.html +++ b/src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.html @@ -19,15 +19,26 @@ [formGroupName]="sale_i"> - + +
+ + + + + + +
+
+ +

{{item.get('sales_item').value | titlecase}}

- + - + @@ -38,7 +49,7 @@ - + @@ -60,7 +71,7 @@ - + diff --git a/src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.scss b/src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.ts b/src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.ts old mode 100644 new mode 100755 index eef3bdbc..3a2c8dda --- a/src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.ts +++ b/src/pages/pd-question/pd-question-assessed-daily-sales/pd-question-assessed-daily-sales.ts @@ -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 = 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 = (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 = 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 = (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 = (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 = (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 = (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 = this.salesDailyForm.get('sales_product') as FormArray; - let salesChildControl; - let salesChildControlarr = []; - dailySalesData.forEach((val,index) => { - console.log(val); - control.push(this.dailySalesWithData(val)); - salesChildControl = (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 = (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'], + }) + } } diff --git a/src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.html b/src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.html old mode 100644 new mode 100755 index a569957c..1c4c5168 --- a/src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.html +++ b/src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.html @@ -12,42 +12,63 @@ - + + + + + Purchase Calculation + + -
+ - - Purchase - Margin +

Purchase

+ + Yes + No
- - + +

Sales

+ Gross Margin Net Margin
- +
- - +
+
+
+
+ - - -- - + + -- + + + + -- + +

SALES

- + - - -- - + + -- + + + + -- + +

PURCHASE

@@ -56,96 +77,91 @@ - - -- - + + -- + + + + -- + + -

BUSSINESS EXPENSE

+

BUSINESS EXPENSE

- - -- - + + -- + + + + -- + +

HOUSE HOLD

- +

INCOME


-
Employee Salary
+
Sales Revenue
-
1000000
-
-
- - -
Employee Salary
-
- -
1000000
-
-
- - -
Employee Salary
-
- -
1000000
-
-
- - -
Employee Salary
-
- -
1000000
+
{{finalIncome.sales_revenue}}
+
Total Income - 1200000 + {{finalIncome.sales_revenue}}
- +

EXPENSE


-
Employee Salary
+
Business Expense
-
1000000
+
{{finalExpense.business_expense}}
-
Employee Salary
+
Net Profit
-
1000000
+
{{finalExpense.net_profit}}
+ + +
Purchase
+
+ +
{{finalExpense.purchase}}
+
+

Total Expense - 1200000 + {{finalExpense.business_expense + finalExpense.purchase +finalExpense.net_profit}}
- +
\ No newline at end of file diff --git a/src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.scss b/src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.ts b/src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.ts old mode 100644 new mode 100755 index b66d2620..7079dd6d --- a/src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.ts +++ b/src/pages/pd-question/pd-question-assessed-dash/pd-question-assessed-dash.ts @@ -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; + } + }); + } + + } diff --git a/src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.html b/src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.html old mode 100644 new mode 100755 index 7cb7d38a..7476b28d --- a/src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.html +++ b/src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.html @@ -4,7 +4,7 @@ - {{FormId.form_name}} + House Hold Expense diff --git a/src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.scss b/src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.ts b/src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.ts old mode 100644 new mode 100755 index 32ae45b9..726c7ad2 --- a/src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.ts +++ b/src/pages/pd-question/pd-question-assessed-household/pd-question-assessed-household.ts @@ -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( diff --git a/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.html b/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.html old mode 100644 new mode 100755 index 03ac1093..7bba840e --- a/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.html +++ b/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.html @@ -19,9 +19,16 @@

Sales declared by the customer as the annual sales actually done.

- + - +
+ + + + + + +
@@ -39,10 +46,12 @@ +

Monthwise Form

- + + - Edit +

{{"✎"}}

@@ -76,7 +85,8 @@

- +

Dailywise Form

+ @@ -92,7 +102,7 @@ {{eachItem.header}}
- {{eachmonthItem.sales_date | date:'dd-mm-yyyy'}} {{"₹"}} {{eachmonthItem.sales_value + {{eachmonthItem.sales_date | date:'dd-MM-yyyy'}} {{"₹"}} {{eachmonthItem.sales_value }}
@@ -145,8 +155,9 @@
+

HouseHold Form

+ -
Edit + +

{{"✎"}}

diff --git a/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.scss b/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.scss old mode 100644 new mode 100755 index eeb6ad20..2e398f9b --- a/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.scss +++ b/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.scss @@ -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; diff --git a/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.ts b/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.ts old mode 100644 new mode 100755 index ece7b5d5..d0ad603a --- a/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.ts +++ b/src/pages/pd-question/pd-question-assessed-info/pd-question-assessed-info.ts @@ -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}) } diff --git a/src/pages/pd-question/pd-question-assessed-purchase/pd-question-assessed-purchase.html b/src/pages/pd-question/pd-question-assessed-purchase/pd-question-assessed-purchase.html old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-assessed-purchase/pd-question-assessed-purchase.ts b/src/pages/pd-question/pd-question-assessed-purchase/pd-question-assessed-purchase.ts old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.html b/src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.html old mode 100644 new mode 100755 index 42f53ee8..e9bec5a7 --- a/src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.html +++ b/src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.html @@ -17,15 +17,15 @@
-

Sales calculated by itemwise

+

itemwise Calculated

- + - + - + {{uom.name}} @@ -41,7 +41,17 @@ - +
+ + + + + + + + + +
diff --git a/src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.scss b/src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.ts b/src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.ts old mode 100644 new mode 100755 index 40bdac0c..f2e137c6 --- a/src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.ts +++ b/src/pages/pd-question/pd-question-assessed-sales/pd-question-assessed-sales.ts @@ -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 = 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], }); } } diff --git a/src/pages/pd-question/pd-question-assests/pd-question-assests.html b/src/pages/pd-question/pd-question-assests/pd-question-assests.html old mode 100644 new mode 100755 index 170ac2b9..c3d65858 --- a/src/pages/pd-question/pd-question-assests/pd-question-assests.html +++ b/src/pages/pd-question/pd-question-assests/pd-question-assests.html @@ -16,26 +16,37 @@ + + + Business Assets Details + + + Others Assets Details + + +
-
-
+
+
+
+
- + {{ asset.name }}
-
+
-
+
-
+
@@ -49,9 +60,9 @@
-
+
-
+
@@ -63,9 +74,9 @@
-
+
-
+
@@ -91,9 +102,9 @@
--> -
+
-
+
@@ -105,9 +116,9 @@
-
+
-
+
@@ -147,9 +158,9 @@
-
+
-
+
@@ -175,9 +186,9 @@
-
+
-
+
@@ -191,23 +202,23 @@
-
+
- +
-
+
- +
-
+ +

Is there a loan?

- + YES NO @@ -238,32 +249,37 @@
-
+
- +
-
+
+ + + +
+
- - -
-
- - +
+
+ + + +
- + - + @@ -274,6 +290,283 @@
+
+
+ +
+
+
+
+ + +
+
+ + + {{ asset.name }} + + +
+ +
+ +
+
+
+
+
+ + + {{ prop.name }} + + +
+
+
+
+
+ +
+
+
+
+
+ + + +
+
+
+
+
+ +
+
+
+
+
+ + + +
+
+
+
+
+ + + +
+
+
+
+
+ + + +
+
+
+
+
+ +
+
+
+
+
+
+ + + {{ ins_type.name }} + + +
+
+ + + +
+
+ + + {{ freqn.name }} + + +
+
+
+
+ + + +
+
+ + + +
+
+
+
+
+
+ +
+
+
+
+
+
+ + + {{ ins_type.name }} + + +
+
+ + + +
+
+ + + +
+
+
+
+
+
+ +
+
+
+
+
+ + + +
+
+
+
+
+
+ +
+
+
+ + + +
+
+
+ + + + + {{owner.applicant_name}} + + + +
+
+ + + +
+
+
+ +
+ + + + + + +
+
+
+
+
+ + +

Is there a loan?

+ + + YES + NO + + +
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+ + + + + + + + + + + + + +
+
+
+
+
+
+
+
- + diff --git a/src/pages/pd-question/pd-question-family/pd-question-family.scss b/src/pages/pd-question/pd-question-family/pd-question-family.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-family/pd-question-family.ts b/src/pages/pd-question/pd-question-family/pd-question-family.ts old mode 100644 new mode 100755 index 377e69a3..dc5cfbf3 --- a/src/pages/pd-question/pd-question-family/pd-question-family.ts +++ b/src/pages/pd-question/pd-question-family/pd-question-family.ts @@ -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){ diff --git a/src/pages/pd-question/pd-question-financial-info/pd-question-financial-info.html b/src/pages/pd-question/pd-question-financial-info/pd-question-financial-info.html old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-financial-info/pd-question-financial-info.scss b/src/pages/pd-question/pd-question-financial-info/pd-question-financial-info.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-financial-info/pd-question-financial-info.ts b/src/pages/pd-question/pd-question-financial-info/pd-question-financial-info.ts old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-general-info/pd-question-general-info.html b/src/pages/pd-question/pd-question-general-info/pd-question-general-info.html new file mode 100644 index 00000000..248bcb0e --- /dev/null +++ b/src/pages/pd-question/pd-question-general-info/pd-question-general-info.html @@ -0,0 +1,92 @@ + + + + + {{FormId.form_name}} + + + + + + + + + + + + + Name of Person Met +
+ + + {{applicant.controls.applicant_name.value}} + + +
+ +
+ +
+
+ {{relation.controls.applicant_name.value}} + + + + + + + Select + + {{comrelShip.name | titlecase}} + + + + + + + Select + + + {{rel | titlecase}} + + + + + + + + Select + + {{relShip.name | titlecase}} + + + + + + + + +
+ +
+
+
+ + + + + + + + + + + + + + + +
diff --git a/src/pages/pd-question/pd-question-general-info/pd-question-general-info.scss b/src/pages/pd-question/pd-question-general-info/pd-question-general-info.scss new file mode 100644 index 00000000..e7a0d4da --- /dev/null +++ b/src/pages/pd-question/pd-question-general-info/pd-question-general-info.scss @@ -0,0 +1,3 @@ +page-pd-question-general-info { + +} diff --git a/src/pages/pd-question/pd-question-general-info/pd-question-general-info.ts b/src/pages/pd-question/pd-question-general-info/pd-question-general-info.ts new file mode 100644 index 00000000..0387e5a2 --- /dev/null +++ b/src/pages/pd-question/pd-question-general-info/pd-question-general-info.ts @@ -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 = this.generalForm.controls['applicant_list']; + let relationControl = 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 = this.generalForm.controls['applicant_relation']; + let applicantControl = 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 = 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 = 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 = 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'}); + + } + }) + } + +} diff --git a/src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.html b/src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.html new file mode 100644 index 00000000..2be173c0 --- /dev/null +++ b/src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.html @@ -0,0 +1,48 @@ + + + + + + + Other Applicant Details Added + + + + + + + +
+ + + + + + + + + + + + + + +
+ diff --git a/src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.scss b/src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.scss new file mode 100644 index 00000000..9eaaaeea --- /dev/null +++ b/src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.scss @@ -0,0 +1,3 @@ +page-pd-question-general-other-applicant { + +} diff --git a/src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.ts b/src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.ts new file mode 100644 index 00000000..93e87ae1 --- /dev/null +++ b/src/pages/pd-question/pd-question-general-info/pd-question-general-other-applicant/pd-question-general-other-applicant.ts @@ -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 = this.otherForm.controls['otherName']; + control.push(this.createName(this.applicantInfo)); + } + } + + deleteappdata(index) + { + const control = 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); + } + } + + +} diff --git a/src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.html b/src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.html new file mode 100644 index 00000000..45bdab97 --- /dev/null +++ b/src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.html @@ -0,0 +1,60 @@ + + + + + {{FormId.form_name}} + + + + + + + + + + +
+ + + + Yes + No + + +
+
+
+ + + + + + +
+
+
+ +
+ + + Remarks + + + + + + + + + + + + +
+ +
diff --git a/src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.scss b/src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.scss new file mode 100644 index 00000000..b490cebb --- /dev/null +++ b/src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.scss @@ -0,0 +1,3 @@ +page-pd-question-lender-representative { + +} diff --git a/src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.ts b/src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.ts new file mode 100644 index 00000000..f2cc4abf --- /dev/null +++ b/src/pages/pd-question/pd-question-lender-representative/pd-question-lender-representative.ts @@ -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 = this.representativeForm.controls['lender_representative_details']; + control.push(this.createlenReDetails()); + } else if (e.value == 'No') { + const arr = 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 = 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); + } + } + }) + } +} diff --git a/src/pages/pd-question/pd-question-loans/pd-question-loans.html b/src/pages/pd-question/pd-question-loans/pd-question-loans.html old mode 100644 new mode 100755 index 636c91f4..367d1914 --- a/src/pages/pd-question/pd-question-loans/pd-question-loans.html +++ b/src/pages/pd-question/pd-question-loans/pd-question-loans.html @@ -4,7 +4,7 @@ - Loan Category + {{FormId.form_name}} @@ -19,12 +19,12 @@ - + {{"₹"}} {{loanAmtInWords}} Only - - {{ enduse.name }} + + {{ enduse.name }} - - + + + + formControlName="percentage_of_construction" type="number" required> +
diff --git a/src/pages/pd-question/pd-question-loans/pd-question-loans.scss b/src/pages/pd-question/pd-question-loans/pd-question-loans.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-loans/pd-question-loans.ts b/src/pages/pd-question/pd-question-loans/pd-question-loans.ts old mode 100644 new mode 100755 index 01f1cbb7..0c9f2a0a --- a/src/pages/pd-question/pd-question-loans/pd-question-loans.ts +++ b/src/pages/pd-question/pd-question-loans/pd-question-loans.ts @@ -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); diff --git a/src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.html b/src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.html new file mode 100644 index 00000000..cd9b1da1 --- /dev/null +++ b/src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.html @@ -0,0 +1,137 @@ + + + + + {{FormId.form_name}} + + + + + + + +
+ + + {{types.type_name}} + + + + +
+
+ + + + + + Yes + No + + + + + + + + + Yes + No + + + + + + + + + + + + +
+ +
+
+ + + +
+
+ + + + + + + + +

Landline Number

+ + + +   -   + + + + + + + + + + + Select + + {{relationship.relation_with_business_name | titlecase}} + + + + + + +

Period of Relationship

+ + + + + + + + + + + + Select + + {{volume.name | titlecase}} + + + + + + + + + + + + + +
+
+
+ + + + + + + + +
+
\ No newline at end of file diff --git a/src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.scss b/src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.scss new file mode 100644 index 00000000..951bf652 --- /dev/null +++ b/src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.scss @@ -0,0 +1,3 @@ +page-pd-question-neighbour-hood { + +} diff --git a/src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.ts b/src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.ts new file mode 100644 index 00000000..bce05de5 --- /dev/null +++ b/src/pages/pd-question/pd-question-neighbour-hood/pd-question-neighbour-hood.ts @@ -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 = this.neighbourhoodForm.controls['referencecheck_list']; + control.push(this.createreferance()); + } + + removereferance(i) + { + const control = 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 = this.neighbourhoodForm.controls['neighbourhood_list']; + control.push(this.createNeighbourhood()); + } + + removeneighbourhood(i) + { + const control = 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 = this.neighbourhoodForm.controls['referencecheck_list']; + const neicontrol = 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(); + } + }) + } + + +} + \ No newline at end of file diff --git a/src/pages/pd-question/pd-question-other-income/pd-question-other-income.html b/src/pages/pd-question/pd-question-other-income/pd-question-other-income.html old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-other-income/pd-question-other-income.scss b/src/pages/pd-question/pd-question-other-income/pd-question-other-income.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-other-income/pd-question-other-income.ts b/src/pages/pd-question/pd-question-other-income/pd-question-other-income.ts old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.html b/src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.html old mode 100644 new mode 100755 index 675b65dd..b27024e7 --- a/src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.html +++ b/src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.html @@ -1,157 +1,213 @@ - - - {{FormId.form_name}} - - - - - + + + {{FormId.form_name}} + + + + + - -
+ + + Main Applicant + +
+
+ + + + + + + + Individual + Non-Individual + + - - - -
- -
- - - Main Applicant - -
-
- - - - - - - - - - - - - - - - - {{education.qualification_name}} - - - - - - - - {{earning.earning_member_status}} - - - -
-
- -
-
- - + + + + Enter Valid Age. + + + + + + + + {{NE.non_individual_entity_name}} + + + + + + + + + + + + + + {{earning.earning_member_status}} + + + + + + + + Enter Valid Vintage. + + + + + + + + + + + + {{education.qualification_name}} + + + + + + + +
- + +
+ +
+ + + + + + + Co Applicant + +
+ + + + + + + + + + + + Individual + Non-Individual + + + + + + + Enter Valid Age. + + + + + + + {{NE.non_individual_entity_name}} + + + + + + + + + + + + + + {{earning.earning_member_status}} + + + + + + + Enter Valid Vintage. + + + + + + + + {{education.qualification_name}} + + + + + + + + + + + + + + {{rel.name}} + + + + + + + + + + + - - - -
- - - Co Applicant - -
-
- - - - - - - - - - - - - - - - - - - - - - {{education.qualification_name}} - - - - - - - - {{earning.earning_member_status}} - - - - - - - - {{rel.name}} - - - -
-
- - -
- -
- - -
- -
-
- -
-
- - Remarks - - -
-
-
- -
+
- - - - - - - - - - + + + + + + + + + + + + + + + Remarks + + + + + + + + + + + \ No newline at end of file diff --git a/src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.scss b/src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.ts b/src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.ts old mode 100644 new mode 100755 index 76acbfcf..321ba551 --- a/src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.ts +++ b/src/pages/pd-question/pd-question-personal-info/pd-question-personal-info.ts @@ -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 = this._personalForm.controls['main_applicant_details']; + const coValue = 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 { + 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 = 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 = 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 = this._personalForm.controls['co_applicant_details']; + control.push(this.loadCoApplicant(this.const_co_applicant)); + +} + +// remove co applicant details +removeCoApplicant(renoveIndex) { + const remove_control = 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 = 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 = this.bankingForm.controls['itemRows']; +// // console.log(control.controls['limit'].value); + +// } +// else{ +// //alert('sd'); +// }} + + selectedEntityChanges(event: any){ + const control = 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 = 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(); + + } + +} + } diff --git a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.html b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.html old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.scss b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts old mode 100644 new mode 100755 index cf6511e2..3ce89ffa --- a/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts +++ b/src/pages/pd-question/pd-question-rental-info/pd-question-rental-info.ts @@ -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() diff --git a/src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.html b/src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.html old mode 100644 new mode 100755 index 4c0509e8..3c824573 --- a/src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.html +++ b/src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.html @@ -31,17 +31,35 @@ - - - - - - - - - - - + + Yes + No + + +
+ + + + + + {{uom.name}} + + + + + + + + + + + + + + +
diff --git a/src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.scss b/src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.ts b/src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.ts old mode 100644 new mode 100755 index 297b0f9a..8dc30cb7 --- a/src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.ts +++ b/src/pages/pd-question/pd-question-stock-info/pd-question-stock-info.ts @@ -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 = (this.stockForm.controls['raw_materials']).at(1); + + const control = (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: [''], diff --git a/src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.html b/src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.html old mode 100644 new mode 100755 index 260594e0..9100a0eb --- a/src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.html +++ b/src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.html @@ -43,9 +43,13 @@
+ + + +
- +
@@ -79,7 +83,7 @@
-
+ + diff --git a/src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.scss b/src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.ts b/src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.ts old mode 100644 new mode 100755 index bc0b937b..6a9da423 --- a/src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.ts +++ b/src/pages/pd-question/pd-question-supplier-info/pd-question-supplier-info.ts @@ -85,10 +85,10 @@ export class PdQuestionSupplierInfoPage { contact_person: [''], mobile_number: [''], payment_mode: [''], + main_raw_materials:[''], per_of_immediate_advance_payment:[''], credit_period:[''], - frequency_of_purchase: [''], - freq_purchase_others_text_value: [''] + }); } diff --git a/src/pages/pd-question/pd-question.html b/src/pages/pd-question/pd-question.html old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question.scss b/src/pages/pd-question/pd-question.scss old mode 100644 new mode 100755 diff --git a/src/pages/pd-question/pd-question.ts b/src/pages/pd-question/pd-question.ts old mode 100644 new mode 100755 diff --git a/src/providers/aws-service/aws-service.ts b/src/providers/aws-service/aws-service.ts old mode 100644 new mode 100755 diff --git a/src/providers/aws-service/cognito.service.ts b/src/providers/aws-service/cognito.service.ts index a968ff06..9310e852 100755 --- a/src/providers/aws-service/cognito.service.ts +++ b/src/providers/aws-service/cognito.service.ts @@ -1,12 +1,14 @@ import { Injectable } from '@angular/core'; // import { CanActivateChild, Router } from '@angular/router'; + import { AuthenticationDetails, CognitoUserPool, CognitoUser, } from "amazon-cognito-identity-js"; + // import { IonicPage, NavController, NavParams, MenuController } from 'ionic-angular'; // import { environment } from '../../environments/environment'; diff --git a/src/providers/common-provider/camera.ts b/src/providers/common-provider/camera.ts old mode 100644 new mode 100755 index 136805f8..a9230378 --- a/src/providers/common-provider/camera.ts +++ b/src/providers/common-provider/camera.ts @@ -20,7 +20,8 @@ export class CameraProvider { destinationType: this.camera.DestinationType.DATA_URL, targetWidth: 500, targetHeight: 600, - correctOrientation: true + correctOrientation: true, + }; // If set to crop, restricts the image to a square of 600 by 600 diff --git a/src/providers/common-provider/loading.ts b/src/providers/common-provider/loading.ts old mode 100644 new mode 100755 diff --git a/src/providers/question-category/question-category.ts b/src/providers/question-category/question-category.ts old mode 100644 new mode 100755 index 13305b5f..10a3d9fd --- a/src/providers/question-category/question-category.ts +++ b/src/providers/question-category/question-category.ts @@ -64,4 +64,12 @@ apiurl:any; return this.http.post(this.apiurl+api,records); } + updatePdApplicant(editData: any) { + // editData.fk_updatedby = this._aws.getlocale(); + // editData.updatedon = currentdate; + return this.http.post(this.apiurl + "updatePDApplicants", {"pd_applicant_details": editData}) + + +} + } diff --git a/src/service-worker.js b/src/service-worker.js old mode 100644 new mode 100755