diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html
index 2a5d48c1b..c435cd69f 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html
@@ -10,17 +10,13 @@
-
- PD Details
-
+ PD Details
-
- Select
-
+ Select
{{LL.full_name}}
@@ -126,67 +122,61 @@
Enter valid amount.
-
-
-
-
-
+
+
+
+
+ Address Details
+
+
+
+
+
+
+
+
-
-
-
-
- Select
-
-
- {{SL.name}}
-
-
-
-
-
-
-
-
-
-
- Select
-
-
- {{CL.city_name}}
-
-
-
-
-
-
+
+
+
+ Select
+
+
+ {{SL.name}}
+
+
-
-
-
-
-
-
- Select
- {{PL.pincode}}
-
-
-
-
-
- Enter Valid Pincode.
-
+
+
+
+
+
+
+ Select
+
+ {{CL.city_name}}
+
+
+
+
+
+
+
+
+ Select
+ {{PL.pincode}}
+
+
+
+
+
+ Enter Valid Pincode.
+
-
+
Applicant Details
@@ -223,9 +213,69 @@
Enter Valid LandLine Number.
+
+
+
+
+
+
+
Additional Requirements
@@ -306,4 +356,86 @@
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts
index 42ebf4240..0b550386e 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts
@@ -18,551 +18,549 @@ export class AddPdComponent implements OnInit, OnDestroy {
//@Output() loadParent = new EventEmitter();
cancelStatus: boolean;
enablePDButton: boolean;
+ coapplicantFlag: boolean = false;
draftStatus: string;
PDTriggerStatus: string;
private notifier: NotifierService;
public _PDtriggerForm: FormGroup;
items: FormArray;
addtional_requirements: FormArray;
- productList:any;
- subProductList:any;
- lenderList:any;
+ productList: any;
+ subProductList: any;
+ lenderList: any;
lenderBranchList: any;
- customerSegmentList:any;
- stateList:any;
- cityList:any;
- pdTypeList:any;
+ customerSegmentList: any;
+ stateList: any;
+ cityList: any;
+ pdTypeList: any;
billingList: any;
relationShipList: any;
pincodeList: any = [];
errorMessage: any;
- loanAmtInWords : any;
+ loanAmtInWords: any;
titleList: any;
- // Dynamic co applicant
- createWithLongContent = false;
- dynamicCoApplicant = [];
- disableAfterSubmit: boolean;
- constructor(notifier: NotifierService,private _fb: FormBuilder,private route: ActivatedRoute,
- private router: Router,private _pd: PdTrigerService, private _aws:AwsService, private ListPdComponent: ListPdComponent) {
- this.notifier = notifier;
- this.disableAfterSubmit = false;
- }
- public totalfiles: Array =[];
- public totalFileName = [];
- public lengthCheckToaddMore =0;
- ngOnInit() {
- this.draftStatus="DRAFT";
- this.PDTriggerStatus="TRIGGERED";
- this.enablePDButton=false;
- this.cancelStatus = false;
- this.ListPdComponent.showListView(false);
- this.getLenderList();
- this.getProductsList();
- this.getCustomerSegmentList();
- this.getStateCityList();
- this.getPDTypeList();
- this.getRelationMaster();
- this.getTitleMaster();
- this.loadFormData();
-
+ // Dynamic co applicant
+ createWithLongContent = false;
+ dynamicCoApplicant = [];
+ disableAfterSubmit: boolean;
+ constructor(notifier: NotifierService, private _fb: FormBuilder, private route: ActivatedRoute,
+ private router: Router, private _pd: PdTrigerService, private _aws: AwsService, private ListPdComponent: ListPdComponent) {
+ this.notifier = notifier;
+ this.disableAfterSubmit = false;
+ }
+ public totalfiles: Array = [];
+ public totalFileName = [];
+ public lengthCheckToaddMore = 0;
+ ngOnInit() {
+ this.draftStatus = "DRAFT";
+ this.PDTriggerStatus = "TRIGGERED";
+ this.enablePDButton = false;
+ this.cancelStatus = false;
+ this.ListPdComponent.showListView(false);
+ this.getLenderList();
+ this.getProductsList();
+ this.getCustomerSegmentList();
+ this.getStateCityList();
+ this.getPDTypeList();
+ this.getRelationMaster();
+ this.getTitleMaster();
+ this.loadFormData();
+
}
// load form data
- loadFormData(){
+ loadFormData() {
this._PDtriggerForm = this._fb.group({
fk_lender_id: [null],
pd_branch_id: [null],
lender_applicant_id: [null, Validators.compose([Validators.required])],
lender_contact_person: [null, Validators.compose([Validators.required])],
- lender_contact_mobile: [null, Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])],
- lender_stdcode:[null, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
- lender_landline:[null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
+ lender_contact_mobile: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(12), Validators.pattern('^[0-9]*$')])],
+ lender_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
+ lender_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])],
//lender_billing: [null],
fk_product_id: [null],
fk_subproduct_id: [null],
fk_pd_type: [null],
fk_customer_segment: [null],
- loan_amount: [null,Validators.compose([Validators.pattern('^[0-9]*$')])],
+ loan_amount: [null, Validators.compose([Validators.pattern('^[0-9]*$')])],
applicant_title_name: [''],
applicant_name: [null],
- mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
+ mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10)])],
// landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
// email: [null],
- applicant_stdcode:[null, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
- applicant_landline:[null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
+ applicant_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
+ applicant_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])],
company_name: [null],
- addressline1: [null],
+ addressline1: [null],
fk_city: [null],
fk_state: [null],
- pincode : [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
- other_pincode:[null,Validators.compose([Validators.minLength(6),Validators.maxLength(6)])],
- remarks:[null],
- // allocation_type: [null],
- // sub_allocation_type: [null],
- //items: this._fb.array([]),
+ pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
+ other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
+ remarks: [null],
+ // allocation_type: [null],
+ // sub_allocation_type: [null],
+ items: this._fb.array([]),
documents: this._fb.array([]),
addtional_requirements: this._fb.array([this.createRequiremnt()])
-});
+ });
}
- selectedLender(lender){
+ selectedLender(lender) {
// console.log(JSON.stringify(lender));
// alert(JSON.stringify(lender['branches ']));
this.lenderBranchList = lender['branches'];
this._PDtriggerForm.controls.pd_branch_id.setValue(null);
-
+
}
- getLenderList(){
+ getLenderList() {
this._pd.getLenderDetails().subscribe(
data => {
if (data.status == 200) {
- this.lenderList=data.records
+ this.lenderList = data.records
}
- }, error => this.errorMessage = error);
- }
- getProductsList(){
+ }, error => this.errorMessage = error);
+ }
+ getProductsList() {
this._pd.getProductsDetails().subscribe(
data => {
if (data.status == 200) {
- this.productList=data.records
+ this.productList = data.records
}
- }, error => this.errorMessage = error);
- }
- getCustomerSegmentList(){
- this._pd.getCustomersDetails().subscribe(
- data => {
- if (data.status == 200) {
- this.customerSegmentList=data.records
- }
- }, error => this.errorMessage = error);
+ }, error => this.errorMessage = error);
+ }
+ getCustomerSegmentList() {
+ this._pd.getCustomersDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.customerSegmentList = data.records
+ }
+ }, error => this.errorMessage = error);
+ }
+ // getStateCityList(){
+ // this._pd.getStateCityDetails().subscribe(
+ // data => {
+ // if (data.status == 200) {
+ // this.stateList=data.records
+ // }
+ // }, error => this.errorMessage = error);
+ // }
+ getStateCityList() {
+ this._pd.getAllMasterDatas('STATE').subscribe(
+ data => {
+ if (data.status == 200) {
+ this.stateList = data.records.filter(item => item.isactive == 1);
+ }
+ });
+ }
+ getPDTypeList() {
+ this._pd.getPDTypeDetails().subscribe(
+ data => {
+ if (data.status == 200) {
+ this.pdTypeList = data.records.pd_type;
+
+ }
+ }, error => this.errorMessage = error);
+ }
+ //get sub product list based on prokduct id
+ getSubproductList(productID: string) {
+
+ this.subProductList = this.productList.filter(item => item.product_id == productID);
+ this.subProductList = this.subProductList[0].subproducts;
+ this.subProductList = this.subProductList.filter(item => item.is_others == 0);
+ }
+
+ // get city list details based on state id
+ // getCityList(stateID:string){
+ // console.log(this.cityList);
+ // this.cityList= this.stateList.filter(item => item.state_id == stateID);
+ // console.log(this.cityList);
+ // this.cityList=this.cityList[0].cities;
+ // console.log(this.cityList);
+ // }
+
+ //get city list details based on state id
+ getCityList(stateID: string) {
+ // console.log('getCityList',stateID);
+ this._pd.getStateWiseCities(stateID).subscribe(data => {
+ if (data.status == 200) {
+ // console.log(data);
+ this.cityList = data.records.cities;
+ this.pincodeList = data.records.pincode;
}
- // getStateCityList(){
- // this._pd.getStateCityDetails().subscribe(
- // data => {
- // if (data.status == 200) {
- // this.stateList=data.records
- // }
- // }, error => this.errorMessage = error);
- // }
- getStateCityList(){
- this._pd.getAllMasterDatas('STATE').subscribe(
- data => {
- if (data.status == 200) {
- this.stateList = data.records.filter(item => item.isactive == 1);
- }
- });
- }
- getPDTypeList(){
- this._pd.getPDTypeDetails().subscribe(
- data => {
- if (data.status == 200) {
- this.pdTypeList=data.records.pd_type;
-
- }
- }, error => this.errorMessage = error);
- }
- //get sub product list based on prokduct id
- getSubproductList(productID:string){
-
- this.subProductList= this.productList.filter(item => item.product_id == productID);
- this.subProductList=this.subProductList[0].subproducts;
- this.subProductList = this.subProductList.filter(item => item.is_others == 0);
- }
-
- // get city list details based on state id
- // getCityList(stateID:string){
- // console.log(this.cityList);
- // this.cityList= this.stateList.filter(item => item.state_id == stateID);
- // console.log(this.cityList);
- // this.cityList=this.cityList[0].cities;
- // console.log(this.cityList);
- // }
+ });
+ }
- //get city list details based on state id
- getCityList(stateID:string){
- // console.log('getCityList',stateID);
- this._pd.getStateWiseCities(stateID).subscribe(data=>{
- if (data.status == 200) {
- // console.log(data);
- this.cityList = data.records.cities;
- this.pincodeList = data.records.pincode;
- }
- });
- }
+ // get relation master details
+ getRelationMaster() {
+ let relation = "RELATIONSHIPS";
+ this._pd.getAllMasterDatas(relation).subscribe(
+ data => {
+ if (data.status == 200) {
+ this.relationShipList = data.records;
- // get relation master details
- getRelationMaster(){
- let relation ="RELATIONSHIPS";
- this._pd.getAllMasterDatas(relation).subscribe(
- data => {
- if (data.status == 200) {
- this.relationShipList=data.records;
-
- }
- }, error => this.errorMessage = error);
}
- // get title master
- getTitleMaster() {
- let relation ="TITLES";
- this._pd.getAllMasterDatas(relation).subscribe(
- data => {
- if (data.status == 200) {
- this.titleList=data.records.filter(val=>val.isactive==1);
- // console.log(this.titleList);
- // let index1 = this.titleList.map(data => data.name).indexOf("Master");
- // this.titleList.splice(index1, 1);
- }
- }, error => this.errorMessage = error);
-
+ }, error => this.errorMessage = error);
+ }
+ // get title master
+ getTitleMaster() {
+ let relation = "TITLES";
+ this._pd.getAllMasterDatas(relation).subscribe(
+ data => {
+ if (data.status == 200) {
+ this.titleList = data.records.filter(val => val.isactive == 1);
+ // console.log(this.titleList);
+ // let index1 = this.titleList.map(data => data.name).indexOf("Master");
+ // this.titleList.splice(index1, 1);
}
+ }, error => this.errorMessage = error);
+
+ }
createItem(): FormGroup {
return this._fb.group({
- label: ['Co Applicant'],
+
coapplicantName: [null, Validators.compose([Validators.required])],
- coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10),Validators.required])],
- coapplicant_landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
- relationship: [null],
+ // coapplicantTitleName: [null],
+ // companyName: [null],
+ // applicantType: 0,
+ // coapplicant_mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10), Validators.required])],
+ // coapplicant_landline: [null, Validators.compose([Validators.minLength(12), Validators.maxLength(13)])],
+ // relationship: [null],
});
};
+
addCoApplicant() {
- if(this._PDtriggerForm.valid){
- this.items = this._PDtriggerForm.get('items') as FormArray;
- this.items.push(this.createItem());
- }
- }
-
- addMoreDocs() {
- if(this.totalfiles.length!=0){
+ this.items = this._PDtriggerForm.get('items') as FormArray;
+ this.items.push(this.createItem());
+ }
-
- if( this.documents.value[0].doc_name != "" && ((this.lengthCheckToaddMore) === (this.totalfiles.length)) )
- {
- this.documents.insert(0, this.generateDocuments())
- this.lengthCheckToaddMore=this.lengthCheckToaddMore+1;
+ addMoreDocs() {
+ if (this.totalfiles.length != 0) {
+ if (this.documents.value[0].doc_name != "" && ((this.lengthCheckToaddMore) === (this.totalfiles.length))) {
+ this.documents.insert(0, this.generateDocuments())
+ this.lengthCheckToaddMore = this.lengthCheckToaddMore + 1;
}
}
- else if(this.totalfiles.length===0 && this.lengthCheckToaddMore===0){
+ else if (this.totalfiles.length === 0 && this.lengthCheckToaddMore === 0) {
this.documents.insert(0, this.generateDocuments())
- this.lengthCheckToaddMore=this.lengthCheckToaddMore+1;
- }
- }
- generateDocuments(): FormGroup {
- return this._fb.group({
- doc_name: [null],//Validators.compose([Validators.required])
- documentFile : [null],//, Validators.compose([Validators.required])
- });
+ this.lengthCheckToaddMore = this.lengthCheckToaddMore + 1;
}
+ }
- get documents(): FormArray {
- return this._PDtriggerForm.get('documents') as FormArray;
- };
- get pdMain() {
- return this._PDtriggerForm.controls; }
- // get pdCoApplicant() { return this._PDtriggerForm.get('items') as FormArray; }
-
- removeCoApplicant(i: number) {
- const control = this._PDtriggerForm.controls['items'];
- control.removeAt(i);
- }
- removeItem(index: number) {
- this.totalfiles.splice(index,1);
- this.totalFileName.splice(index,1);
- this.documents.removeAt(index);
- this.lengthCheckToaddMore=this.lengthCheckToaddMore-1;
- }
+ generateDocuments(): FormGroup {
+ return this._fb.group({
+ doc_name: [null],//Validators.compose([Validators.required])
+ documentFile: [null],//, Validators.compose([Validators.required])
+ });
+ }
- get pdRequirements() { return this._PDtriggerForm.get('addtional_requirements') as FormArray; }
- createRequiremnt(): FormGroup {
- return this._fb.group({
- add_req_id:[null],
- add_requirement: [null],
- isactive: [1],
- });
- };
- addRequiremnts() {
- this.addtional_requirements = this._PDtriggerForm.get('addtional_requirements') as FormArray;
- this.addtional_requirements.push(this.createRequiremnt());
+ get documents(): FormArray {
+ return this._PDtriggerForm.get('documents') as FormArray;
+ };
+ get pdMain() {
+ return this._PDtriggerForm.controls;
+ }
+ // get pdCoApplicant() { return this._PDtriggerForm.get('items') as FormArray; }
+
+ removeCoApplicant(i: number) {
+ const control = this._PDtriggerForm.controls['items'];
+ control.removeAt(i);
+ }
+ removeItem(index: number) {
+ this.totalfiles.splice(index, 1);
+ this.totalFileName.splice(index, 1);
+ this.documents.removeAt(index);
+ this.lengthCheckToaddMore = this.lengthCheckToaddMore - 1;
+ }
+
+ get pdRequirements() { return this._PDtriggerForm.get('addtional_requirements') as FormArray; }
+ createRequiremnt(): FormGroup {
+ return this._fb.group({
+ add_req_id: [null],
+ add_requirement: [null],
+ isactive: [1],
+ });
+ };
+ addRequiremnts() {
+ this.addtional_requirements = this._PDtriggerForm.get('addtional_requirements') as FormArray;
+ this.addtional_requirements.push(this.createRequiremnt());
+ }
+
+ removeRequirements(index: number) {
+ const requirement_control = this._PDtriggerForm.controls['addtional_requirements'];
+ requirement_control.removeAt(index);
+ }
+
+ public fileSelectionEvent(fileInput: any, oldIndex: number) {
+
+
+ if (fileInput.target.files && fileInput.target.files[0]) {
+ var reader = new FileReader();
+ reader.onload = (event: any) => {
}
- removeRequirements(index: number) {
- const requirement_control = this._PDtriggerForm.controls['addtional_requirements'];
- requirement_control.removeAt(index);
- }
-
- public fileSelectionEvent(fileInput: any,oldIndex:number) {
-
-
- if (fileInput.target.files && fileInput.target.files[0]) {
- var reader = new FileReader();
- reader.onload = (event: any) => {
- }
-
- if(oldIndex==0)
- {
+ if (oldIndex == 0) {
this.totalfiles.unshift((fileInput.target.files[0]))
this.totalFileName.unshift(fileInput.target.files[0].name)
}
- else
- {
- this.totalfiles[oldIndex]=(fileInput.target.files[0]);
- this.totalFileName[oldIndex]=fileInput.target.files[0].name
+ else {
+ this.totalfiles[oldIndex] = (fileInput.target.files[0]);
+ this.totalFileName[oldIndex] = fileInput.target.files[0].name
}
-
- reader.readAsDataURL(fileInput.target.files[0]);
- }
-
- if(this.totalfiles.length == 1)
- {
- this.lengthCheckToaddMore=1;
- }
+
+ reader.readAsDataURL(fileInput.target.files[0]);
}
- // save pd in draft
- saveDraftPD(formValue: any, status:string){
- //alert('Inside The Draft PD');
- this.submitPdDetails(formValue, status);
+ if (this.totalfiles.length == 1) {
+ this.lengthCheckToaddMore = 1;
}
- //trigger pd
- triggerPD(formValue: any, status:string){
- this._PDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
-
- this._PDtriggerForm.controls['fk_product_id'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
-
- this._PDtriggerForm.controls['fk_subproduct_id'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
-
- this._PDtriggerForm.controls['fk_pd_type'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
+ }
- this._PDtriggerForm.controls['fk_customer_segment'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
+ // save pd in draft
+ saveDraftPD(formValue: any, status: string) {
+ //alert('Inside The Draft PD');
+ this.submitPdDetails(formValue, status);
+ }
+ //trigger pd
+ triggerPD(formValue: any, status: string) {
+ this._PDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
- this._PDtriggerForm.controls['loan_amount'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity();
-
- this._PDtriggerForm.controls['applicant_name'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
- this._PDtriggerForm.controls['applicant_title_name'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
-
- this._PDtriggerForm.controls['mobile_no'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
+ this._PDtriggerForm.controls['fk_product_id'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
- this._PDtriggerForm.controls['addressline1'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['addressline1'].updateValueAndValidity();
+ this._PDtriggerForm.controls['fk_subproduct_id'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
- this._PDtriggerForm.controls['fk_city'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['fk_city'].updateValueAndValidity();
+ this._PDtriggerForm.controls['fk_pd_type'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
- this._PDtriggerForm.controls['fk_state'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['fk_state'].updateValueAndValidity();
+ this._PDtriggerForm.controls['fk_customer_segment'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
- this._PDtriggerForm.controls['pincode'].setValidators([Validators.required]);
- this._PDtriggerForm.controls['pincode'].updateValueAndValidity();
- setTimeout(() => {
- this.clearCustomValidatorFields();
+ this._PDtriggerForm.controls['loan_amount'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity();
+
+ this._PDtriggerForm.controls['applicant_name'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
+ this._PDtriggerForm.controls['applicant_title_name'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
+
+ this._PDtriggerForm.controls['mobile_no'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
+
+ this._PDtriggerForm.controls['addressline1'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['addressline1'].updateValueAndValidity();
+
+ this._PDtriggerForm.controls['fk_city'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['fk_city'].updateValueAndValidity();
+
+ this._PDtriggerForm.controls['fk_state'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['fk_state'].updateValueAndValidity();
+
+ this._PDtriggerForm.controls['pincode'].setValidators([Validators.required]);
+ this._PDtriggerForm.controls['pincode'].updateValueAndValidity();
+ setTimeout(() => {
+ this.clearCustomValidatorFields();
}, 10000);
- this.submitPdDetails(formValue, status);
- }
+ this.submitPdDetails(formValue, status);
+ }
- // this is for clear custom validator required fields
- clearCustomValidatorFields(){
- this._PDtriggerForm.controls['fk_lender_id'].clearValidators();
- this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
+ // this is for clear custom validator required fields
+ clearCustomValidatorFields() {
+ this._PDtriggerForm.controls['fk_lender_id'].clearValidators();
+ this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
- this._PDtriggerForm.controls['fk_product_id'].clearValidators();
- this._PDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
+ this._PDtriggerForm.controls['fk_product_id'].clearValidators();
+ this._PDtriggerForm.controls['fk_product_id'].updateValueAndValidity();
- this._PDtriggerForm.controls['fk_subproduct_id'].clearValidators();
- this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
+ this._PDtriggerForm.controls['fk_subproduct_id'].clearValidators();
+ this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity();
- this._PDtriggerForm.controls['fk_pd_type'].clearValidators();
- this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
+ this._PDtriggerForm.controls['fk_pd_type'].clearValidators();
+ this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity();
- this._PDtriggerForm.controls['fk_customer_segment'].clearValidators();
- this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
+ this._PDtriggerForm.controls['fk_customer_segment'].clearValidators();
+ this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity();
- this._PDtriggerForm.controls['loan_amount'].clearValidators();
- this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity();
+ this._PDtriggerForm.controls['loan_amount'].clearValidators();
+ this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity();
- this._PDtriggerForm.controls['applicant_name'].clearValidators();
- this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
-
- this._PDtriggerForm.controls['applicant_title_name'].clearValidators();
- this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
-
- this._PDtriggerForm.controls['mobile_no'].clearValidators();
- this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
+ this._PDtriggerForm.controls['applicant_name'].clearValidators();
+ this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity();
- this._PDtriggerForm.controls['addressline1'].clearValidators();
- this._PDtriggerForm.controls['addressline1'].updateValueAndValidity();
+ this._PDtriggerForm.controls['applicant_title_name'].clearValidators();
+ this._PDtriggerForm.controls['applicant_title_name'].updateValueAndValidity();
- this._PDtriggerForm.controls['fk_city'].clearValidators();
- this._PDtriggerForm.controls['fk_city'].updateValueAndValidity();
+ this._PDtriggerForm.controls['mobile_no'].clearValidators();
+ this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity();
- this._PDtriggerForm.controls['fk_state'].clearValidators();
- this._PDtriggerForm.controls['fk_state'].updateValueAndValidity();
+ this._PDtriggerForm.controls['addressline1'].clearValidators();
+ this._PDtriggerForm.controls['addressline1'].updateValueAndValidity();
- this._PDtriggerForm.controls['pincode'].clearValidators();
- this._PDtriggerForm.controls['pincode'].updateValueAndValidity();
+ this._PDtriggerForm.controls['fk_city'].clearValidators();
+ this._PDtriggerForm.controls['fk_city'].updateValueAndValidity();
+ this._PDtriggerForm.controls['fk_state'].clearValidators();
+ this._PDtriggerForm.controls['fk_state'].updateValueAndValidity();
+
+ this._PDtriggerForm.controls['pincode'].clearValidators();
+ this._PDtriggerForm.controls['pincode'].updateValueAndValidity();
+
+ this.validateAllFormFields(this._PDtriggerForm);
+ }
+
+ // common function for both draft and process pd
+ submitPdDetails(formValue: any, status: string) {
+ if (this._PDtriggerForm.invalid) {
this.validateAllFormFields(this._PDtriggerForm);
+ this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
+ return;
}
-
- // common function for both draft and process pd
- submitPdDetails(formValue: any, status:string) {
- if(this._PDtriggerForm.invalid) {
- this.validateAllFormFields(this._PDtriggerForm);
- this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
+ else {
+ if ((formValue.lender_contact_mobile == '' || formValue.lender_contact_mobile == null) && (formValue.lender_stdcode == '' || formValue.lender_stdcode == null && formValue.lender_landline == '' || formValue.lender_landline == null)) {
+ this.notifier.notify('warning', 'Either Mobile or Landline Need.!');
return;
}
else {
- if((formValue.lender_contact_mobile == '' || formValue.lender_contact_mobile == null) && (formValue.lender_stdcode == '' || formValue.lender_stdcode == null && formValue.lender_landline == '' || formValue.lender_landline == null )){
- this.notifier.notify('warning', 'Either Mobile or Landline Need.!');
- return;
- }
- else{
- this.disableAfterSubmit=true;
- let concat_landline
- let concat_landline1
- if(formValue.lender_stdcode != null || formValue.lender_landline != null){
- if(formValue.lender_stdcode != '' && formValue.lender_landline != ''){
- concat_landline = formValue.lender_stdcode +'-'+formValue.lender_landline;
+ this.disableAfterSubmit = true;
+ let concat_landline
+ let concat_landline1
+ if (formValue.lender_stdcode != null || formValue.lender_landline != null) {
+ if (formValue.lender_stdcode != '' && formValue.lender_landline != '') {
+ concat_landline = formValue.lender_stdcode + '-' + formValue.lender_landline;
}
else {
- concat_landline = null;
+ concat_landline = null;
}
}
- else{
- concat_landline = null;
- }
-
- if(formValue.applicant_stdcode != null || formValue.applicant_landline != null){
- if(formValue.applicant_stdcode != '' && formValue.applicant_landline != ''){
- concat_landline1 = formValue.applicant_stdcode +'-'+formValue.applicant_landline;
- }
- else{
- concat_landline1 = null;
- }
- }
- else{
- concat_landline1 = null;
+ else {
+ concat_landline = null;
}
- let pd_details:any={
- "fk_lender_id":formValue.fk_lender_id,
- "lender_applicant_id":formValue.lender_applicant_id,
- "pd_branch_id":formValue.pd_branch_id,
- "pd_contact_person":formValue.lender_contact_person,
- "pd_contact_mobileno":formValue.lender_contact_mobile,
- "pd_contact_landline":concat_landline,
- "fk_product_id":formValue.fk_product_id,
- "fk_subproduct_id":formValue.fk_subproduct_id,
- "fk_pd_type":formValue.fk_pd_type,
- "fk_customer_segment":formValue.fk_customer_segment,
- "loan_amount":formValue.loan_amount,
- "addressline1":formValue.addressline1.toUpperCase(),
- "fk_city":formValue.fk_city,
- "fk_state":formValue.fk_state,
- "pincode":formValue.pincode,
- "other_pincode":formValue.other_pincode ,
- "remarks":formValue.remarks,
+ if (formValue.applicant_stdcode != null || formValue.applicant_landline != null) {
+ if (formValue.applicant_stdcode != '' && formValue.applicant_landline != '') {
+ concat_landline1 = formValue.applicant_stdcode + '-' + formValue.applicant_landline;
+ }
+ else {
+ concat_landline1 = null;
+ }
+ }
+ else {
+ concat_landline1 = null;
+ }
+
+ let pd_details: any = {
+ "fk_lender_id": formValue.fk_lender_id,
+ "lender_applicant_id": formValue.lender_applicant_id,
+ "pd_branch_id": formValue.pd_branch_id,
+ "pd_contact_person": formValue.lender_contact_person,
+ "pd_contact_mobileno": formValue.lender_contact_mobile,
+ "pd_contact_landline": concat_landline,
+ "fk_product_id": formValue.fk_product_id,
+ "fk_subproduct_id": formValue.fk_subproduct_id,
+ "fk_pd_type": formValue.fk_pd_type,
+ "fk_customer_segment": formValue.fk_customer_segment,
+ "loan_amount": formValue.loan_amount,
+ "addressline1": formValue.addressline1.toUpperCase(),
+ "fk_city": formValue.fk_city,
+ "fk_state": formValue.fk_state,
+ "pincode": formValue.pincode,
+ "other_pincode": formValue.other_pincode,
+ "remarks": formValue.remarks,
"pd_status": status,
- "fk_createdby" : this._aws.getlocale(),
+ "fk_createdby": this._aws.getlocale(),
};
- var pd_applicant_details: any=[];
- if(formValue.applicant_name){
+ var pd_applicant_details: any = [];
+ if (formValue.applicant_name) {
pd_applicant_details.push({
- "applicant_name":formValue.applicant_name,
- "applicant_title_name":formValue.applicant_title_name,
- "company_name":formValue.company_name,
- "mobile_no":formValue.mobile_no,
- "landline":concat_landline1 ,
- "applicant_type":1,
- "relation":"",
+ "applicant_name": formValue.applicant_name,
+ "applicant_title_name": formValue.applicant_title_name,
+ "company_name": formValue.company_name,
+ "mobile_no": formValue.mobile_no,
+ "landline": concat_landline1,
+ "applicant_type": 1,
+ "relation": "",
});
}
-
- // formValue.items.forEach((itemElement, itemIndex) => {
- // let obj1 = {
- // "applicant_name":itemElement.coapplicantName,
- // "relation":itemElement.relationship,
- // "email":"",
- // "mobile_no":itemElement.coapplicant_mobile_no,
- // "landline":itemElement.coapplicant_landline,
- // "applicant_type":0,
- // }
- // pd_applicant_details.push(obj1)
- // });
-
- // docs details
- let pd_form: FormData = new FormData();
-
- for(let j=0;jthis.totalfiles[j])
- }
-
- //reverseFileNames=this.totalFileName.reverse();
-
- let AllFilesObj= []
-
- formValue.documents.forEach((element, index) => {
- AllFilesObj.push(element.doc_name);
- });
- pd_form.append("pd_details",JSON.stringify(pd_details))
- if(pd_applicant_details.length>0){
- pd_form.append("pd_applicant_details",JSON.stringify(pd_applicant_details))
- }
-
- pd_form.append("pd_document_titles",JSON.stringify(AllFilesObj))
- if(formValue.addtional_requirements.length > 0){
- pd_form.append("addtional_requirements",JSON.stringify(formValue.addtional_requirements))
+ formValue.items.forEach((itemElement, itemIndex) => {
+ let obj1 = {
+ "applicant_name": itemElement.coapplicantName,
+ "applicant_title_name": itemElement.applicant_title_name,
+ "company_name": itemElement.company_name,
+ "mobile_no": itemElement.coapplicant_mobile_no,
+ "landline": itemElement.coapplicant_landline,
+ "applicant_type": 0,
+ "relation": "",
+ }
+ pd_applicant_details.push(obj1)
+ });
- }
- // console.log('pd_form',pd_form);
- // console.log('pd_details',pd_details);
- this._pd.addPdDetails(pd_form).subscribe(result => {
- if (result.status == 200) {
+ // docs details
+ let pd_form: FormData = new FormData();
+
+ for (let j = 0; j < this.totalfiles.length; j++) {
+ pd_form.append('pddocuments[]', this.totalfiles[j])
+ }
+
+ //reverseFileNames=this.totalFileName.reverse();
+
+ let AllFilesObj = []
+
+ formValue.documents.forEach((element, index) => {
+ AllFilesObj.push(element.doc_name);
+ });
+ pd_form.append("pd_details", JSON.stringify(pd_details))
+ if (pd_applicant_details.length > 0) {
+ pd_form.append("pd_applicant_details", JSON.stringify(pd_applicant_details))
+ }
+
+ pd_form.append("pd_document_titles", JSON.stringify(AllFilesObj))
+ if (formValue.addtional_requirements.length > 0) {
+ pd_form.append("addtional_requirements", JSON.stringify(formValue.addtional_requirements))
+
+ }
+ // console.log('pd_form',pd_form);
+ // console.log('pd_details',pd_details);
+ this._pd.addPdDetails(pd_form).subscribe(result => {
+ if (result.status == 200) {
+ this.disableAfterSubmit = false;
+ this.notifier.notify('success', 'PD Saved.');
+ this.loadPdListCompoent(true);
+ }
+ else {
+ this.disableAfterSubmit = false;
+ this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
+ }
+ }, error => {
this.disableAfterSubmit = false;
- this.notifier.notify('success', 'PD Saved.');
- this.loadPdListCompoent(true);
- }
- else {
- this.disableAfterSubmit = false;
- this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
- }
- }, error => {
- this.disableAfterSubmit = false;
- this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
- });
+ this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
+ });
}
}
+ }
+ loadPdListCompoent(from: boolean) {
+ //alert(from);
+ if (from) {
+ // alert('if'+from);
+ this.router.navigate(['../../'], { relativeTo: this.route });
+ this.ListPdComponent.pdListLoad(true);
}
- loadPdListCompoent(from:boolean) {
- //alert(from);
- if(from){
- // alert('if'+from);
- this.router.navigate([ '../../' ], { relativeTo: this.route });
- this.ListPdComponent.pdListLoad(true);
- }
- else{
- // alert(from);
- this.router.navigate([ '../../' ], { relativeTo: this.route });
- this.ListPdComponent.showListView(true);
- }
-
- }
- ngOnDestroy(): void {
+ else {
+ // alert(from);
+ this.router.navigate(['../../'], { relativeTo: this.route });
this.ListPdComponent.showListView(true);
}
- /** To Reset Popup Data */
- onReset() {
+
+ }
+ ngOnDestroy(): void {
+ this.ListPdComponent.showListView(true);
+ }
+ /** To Reset Popup Data */
+ onReset() {
this.loadFormData();
this.disableAfterSubmit = false;
}
@@ -577,30 +575,29 @@ export class AddPdComponent implements OnInit, OnDestroy {
}
}
// validate all form group and form array fields
-validateAllFormFields(formGroup: any) {
- Object.keys(formGroup.controls).forEach(field => {
+ 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);
+ control.markAsTouched({ onlySelf: true });
+ } else if (control instanceof FormGroup) {
+ this.validateAllFormFields(control);
+ } else if (control instanceof FormArray) {
+ this.validateAllFormFields(control);
}
- });
-}
+ });
+ }
-/** To Convert Amount into Words */
-inWords(e,flag:number){
- switch(flag){
- case 1 :
- this.loanAmtInWords = this._pd.convertNumberToWords(e.target.value);
- break;
- default:
- break;
-}
-}
+ /** To Convert Amount into Words */
+ inWords(e, flag: number) {
+ switch (flag) {
+ case 1:
+ this.loanAmtInWords = this._pd.convertNumberToWords(e.target.value);
+ break;
+ default:
+ break;
+ }
+ }
-
-}
+}
\ No newline at end of file