add pd Case Booked In added

This commit is contained in:
sriram-at-840620226347 2020-02-25 17:39:53 +05:30
parent 055483f259
commit c7ce9cdcca
7 changed files with 110 additions and 3 deletions

View File

@ -22,6 +22,15 @@
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 28%">
<mat-select placeholder="Case Booked In" formControlName="sub_entity_id">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
<mat-option> Select </mat-option>
<mat-option *ngFor="let LL of billingtolist" [value]="LL.entity_id" >
{{LL.full_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 28%"> <mat-form-field style="width: 28%">
<mat-select placeholder="Branch" formControlName="pd_branch_id" (selectionChange)="getContactPerson()"> <mat-select placeholder="Branch" formControlName="pd_branch_id" (selectionChange)="getContactPerson()">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" --> <!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->

View File

@ -63,6 +63,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
pincodeData:any=[]; pincodeData:any=[];
cityData: any=[]; cityData: any=[];
stateData: any=[]; stateData: any=[];
billingtolist: any;
constructor(notifier: NotifierService, private _fb: FormBuilder, private route: ActivatedRoute, constructor(notifier: NotifierService, private _fb: FormBuilder, private route: ActivatedRoute,
private router: Router, private _pd: PdTrigerService, private _aws: AwsService, private ListPdComponent: ListPdComponent, private router: Router, private _pd: PdTrigerService, private _aws: AwsService, private ListPdComponent: ListPdComponent,
private titleCase : TitleCasePipe) { private titleCase : TitleCasePipe) {
@ -119,6 +120,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
loadFormData() { loadFormData() {
this._PDtriggerForm = this._fb.group({ this._PDtriggerForm = this._fb.group({
fk_lender_id: [null], fk_lender_id: [null],
sub_entity_id: [''],
pd_branch_id: [null], pd_branch_id: [null],
lender_applicant_id: [null, Validators.compose([Validators.required])], lender_applicant_id: [null, Validators.compose([Validators.required])],
lender_sales_person:[null], lender_sales_person:[null],
@ -157,7 +159,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
lenderShortName:string; lenderShortName:string;
/** FOR Dropdowns */ /** FOR Dropdowns */
selectedLender(lender) { selectedLender(lender) {
// console.log('lender',lender); console.log('lender',lender);
this.lenderBranchList = lender['branches']; this.lenderBranchList = lender['branches'];
this.lenderShortName = lender['short_name']; this.lenderShortName = lender['short_name'];
// console.log(this.lenderShortName); // console.log(this.lenderShortName);
@ -192,6 +194,18 @@ export class AddPdComponent implements OnInit, OnDestroy {
this._PDtriggerForm.controls['fk_customer_segment'].setValue(''); this._PDtriggerForm.controls['fk_customer_segment'].setValue('');
this._PDtriggerForm.controls['loan_amount'].setValue(''); this._PDtriggerForm.controls['loan_amount'].setValue('');
this.billingtolist = this.lenderList
if(lender.short_name != 'CHFPL'){
this._PDtriggerForm.controls['sub_entity_id'].disable()
} else{
this.billingtolist = this.lenderList.filter(item=> item.short_name == 'CHFPL' || item.short_name == 'CLIX');
console.log('filter lender',this.billingtolist);
this._PDtriggerForm.controls['sub_entity_id'].enable()
}
this._PDtriggerForm.controls['sub_entity_id'].setValue(lender.entity_id)
// if(this.lenderShortName == "IIB"){ //FOR INDUSLAND BANK // if(this.lenderShortName == "IIB"){ //FOR INDUSLAND BANK
// // console.log("entered"); // // console.log("entered");
// this._PDtriggerForm.controls['fk_product_id'].setValue("3") // this._PDtriggerForm.controls['fk_product_id'].setValue("3")
@ -676,6 +690,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
let pd_details: any = { let pd_details: any = {
"fk_lender_id": formValue.fk_lender_id, "fk_lender_id": formValue.fk_lender_id,
"sub_entity_id": this._PDtriggerForm.controls['sub_entity_id'].value,
"lender_applicant_id": formValue.lender_applicant_id, "lender_applicant_id": formValue.lender_applicant_id,
"pd_branch_id": formValue.pd_branch_id, "pd_branch_id": formValue.pd_branch_id,
"lender_sales_person":formValue.lender_sales_person, "lender_sales_person":formValue.lender_sales_person,

View File

@ -34,6 +34,18 @@
<!-- <mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender Name Required.</mat-error> --> <!-- <mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender Name Required.</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Case Booked In" formControlName="sub_entity_id">
<mat-option>
Select
</mat-option>
<!-- <mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" > -->
<mat-option *ngFor="let LL of billingtolist"
[value]="LL.entity_id">
{{LL.full_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 28%"> <mat-form-field style="width: 28%">
<mat-select placeholder="Branch" formControlName="pd_branch_id" (selectionChange)="getContactPerson()"> <mat-select placeholder="Branch" formControlName="pd_branch_id" (selectionChange)="getContactPerson()">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" --> <!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->

View File

@ -72,6 +72,7 @@ export class EditPdMasterComponent implements OnInit {
sales_and_credit_enable: boolean=false; sales_and_credit_enable: boolean=false;
sales_and_credit_person: any=[]; sales_and_credit_person: any=[];
finInstitutionList: any; finInstitutionList: any;
billingtolist: any;
constructor(private _fb: FormBuilder, constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef<EditPdMasterComponent>, private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef<EditPdMasterComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,private titleCase : TitleCasePipe) { @Inject(MAT_DIALOG_DATA) public data: any,private titleCase : TitleCasePipe) {
@ -208,6 +209,16 @@ if(!option){
this._EditPDtriggerForm.controls['loan_amount'].setValue(''); this._EditPDtriggerForm.controls['loan_amount'].setValue('');
} }
this.billingtolist = this.lenderList
if(lender.short_name != 'CHFPL'){
this._EditPDtriggerForm.controls['sub_entity_id'].disable()
} else{
this.billingtolist = this.lenderList.filter(item=> item.short_name == 'CHFPL' || item.short_name == 'CLIX');
console.log('filter lender',this.billingtolist);
this._EditPDtriggerForm.controls['sub_entity_id'].enable()
}
this._EditPDtriggerForm.controls['sub_entity_id'].setValue(lender.entity_id)
if(this.lenderShortName == "IIB"){ //FOR INDUSLAND BANK if(this.lenderShortName == "IIB"){ //FOR INDUSLAND BANK
// console.log("entered"); // console.log("entered");
// this._EditPDtriggerForm.controls['fk_product_id'].setValue("3") // this._EditPDtriggerForm.controls['fk_product_id'].setValue("3")
@ -322,6 +333,7 @@ if(!option){
this._EditPDtriggerForm = this._fb.group({ this._EditPDtriggerForm = this._fb.group({
pd_id: [this.data.records.pd_id], pd_id: [this.data.records.pd_id],
fk_lender_id: [this.data.records.fk_lender_id, Validators.compose([Validators.required])], fk_lender_id: [this.data.records.fk_lender_id, Validators.compose([Validators.required])],
sub_entity_id: [this.data.records.sub_entity_id],
lender_applicant_id: [this.data.records.lender_applicant_id, Validators.compose([Validators.required])], lender_applicant_id: [this.data.records.lender_applicant_id, Validators.compose([Validators.required])],
pd_branch_id:[this.data.records.pd_branch_id], pd_branch_id:[this.data.records.pd_branch_id],
// pd_contact_person: [this.data.records.pd_contact_person], // pd_contact_person: [this.data.records.pd_contact_person],
@ -696,6 +708,7 @@ if(!option){
let lenderMasterArray = { let lenderMasterArray = {
"pd_id": my_array.pd_id, "pd_id": my_array.pd_id,
"fk_lender_id": my_array.fk_lender_id, "fk_lender_id": my_array.fk_lender_id,
"sub_entity_id": this._EditPDtriggerForm.controls['sub_entity_id'].value,
"lender_applicant_id": my_array.lender_applicant_id, "lender_applicant_id": my_array.lender_applicant_id,
"pd_branch_id":my_array.pd_branch_id, "pd_branch_id":my_array.pd_branch_id,
// "pd_contact_person": my_array.pd_contact_person, // "pd_contact_person": my_array.pd_contact_person,

View File

@ -13,7 +13,12 @@
<mat-form-field fxFlex="30%"> <mat-form-field fxFlex="30%">
<mat-select placeholder="City *" formControlName="fk_city_id"> <mat-select placeholder="City *" formControlName="fk_city_id">
<mat-option *ngFor="let city of m_city" [value]="city.city_id">{{ city.city_name }}({{city.state_name}})</mat-option> <mat-option>
<ngx-mat-select-search formControlName="citySearch" (keyup)="searchFun(region,i,'city')"
[placeholderLabel]="'Search City...'"
[noEntriesFoundLabel]="'no matching records found'"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let city of m_city[i]" [value]="city.city_id">{{ city.city_name }}({{city.state_name}})</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="submitted && region['controls'].fk_city_id.hasError('required')" class="mat-text-warn">City Required.!</mat-error> <mat-error *ngIf="submitted && region['controls'].fk_city_id.hasError('required')" class="mat-text-warn">City Required.!</mat-error>
</mat-form-field> </mat-form-field>

View File

@ -9,6 +9,8 @@ import { NotifierService } from 'angular-notifier';
import { MastersService } from './../../../service/masters/masters.service'; import { MastersService } from './../../../service/masters/masters.service';
import { EntityService } from './../../../service/entity/entity.service'; import { EntityService } from './../../../service/entity/entity.service';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
@Component({ @Component({
selector: 'app-entity-edit-region', selector: 'app-entity-edit-region',
@ -36,6 +38,8 @@ export class EntityEditRegionComponent implements OnInit {
* Notifier service * Notifier service
*/ */
private notifier: NotifierService; private notifier: NotifierService;
protected _onDestroy = new Subject<void>();
cityData: any = [];
constructor( constructor(
notifier: NotifierService, notifier: NotifierService,
@ -61,6 +65,7 @@ export class EntityEditRegionComponent implements OnInit {
setFormDatas(record) { setFormDatas(record) {
if (record.length > 0) { if (record.length > 0) {
console.log('setFormDatas');
for (let val of record) { for (let val of record) {
let vals = { let vals = {
entity_region_map_id: val.entity_region_map_id, entity_region_map_id: val.entity_region_map_id,
@ -97,7 +102,8 @@ export class EntityEditRegionComponent implements OnInit {
getCityHierarchyMaster() { getCityHierarchyMaster() {
this.entityService.getCityHierarchyMaster().subscribe( this.entityService.getCityHierarchyMaster().subscribe(
data => { data => {
this.m_city = data.records; this.m_city[0] = data.records;
this.cityData = this.m_city[0];
}, },
error => { error => {
this.notifier.notify('warning', 'No City Master Records Found.!'); this.notifier.notify('warning', 'No City Master Records Found.!');
@ -140,6 +146,7 @@ export class EntityEditRegionComponent implements OnInit {
fk_entity_id: [data.fk_entity_id], fk_entity_id: [data.fk_entity_id],
fk_region_id: [data.fk_region_id, Validators.compose([Validators.required])], fk_region_id: [data.fk_region_id, Validators.compose([Validators.required])],
fk_city_id: [data.fk_city_id, Validators.compose([Validators.required])], fk_city_id: [data.fk_city_id, Validators.compose([Validators.required])],
citySearch:[''],
// fk_state_id: [data.fk_state_id, Validators.compose([Validators.required])], // fk_state_id: [data.fk_state_id, Validators.compose([Validators.required])],
// fk_branch_id: [data.fk_branch_id, Validators.compose([Validators.required])], // fk_branch_id: [data.fk_branch_id, Validators.compose([Validators.required])],
isactive: [data.isactive], isactive: [data.isactive],
@ -162,6 +169,7 @@ export class EntityEditRegionComponent implements OnInit {
const control = <FormArray>this._editEntityRegionFrom.controls['region_lender']; const control = <FormArray>this._editEntityRegionFrom.controls['region_lender'];
control.push(this.initRegionFormLoad(data)); control.push(this.initRegionFormLoad(data));
} }
this.m_city[this._editEntityRegionFrom.value.region_lender.length-1]=this.cityData
} }
removeLanguage(i: number) { removeLanguage(i: number) {
const control = <FormArray>this._editEntityRegionFrom.controls['region_lender']; const control = <FormArray>this._editEntityRegionFrom.controls['region_lender'];
@ -182,6 +190,14 @@ export class EntityEditRegionComponent implements OnInit {
//To Remove The "Null" With Key also //To Remove The "Null" With Key also
Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]); Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]);
// alert(JSON.stringify(formValues.temp_lender)); // alert(JSON.stringify(formValues.temp_lender));
formValues.region_lender.forEach(val=>{
console.log('city val',val);
if(val.hasOwnProperty('citySearch')){
console.log('city val search',val.hasOwnProperty('citySearch'));
delete val.citySearch;
}
})
if (!this.checkDuplicateInObject(formValues.region_lender)) { if (!this.checkDuplicateInObject(formValues.region_lender)) {
this.entityService.updateEntityIdRegionInfoDetails(formValues.region_lender).subscribe( this.entityService.updateEntityIdRegionInfoDetails(formValues.region_lender).subscribe(
dataresult => { dataresult => {
@ -232,4 +248,39 @@ export class EntityEditRegionComponent implements OnInit {
ngOnDestroy(): void { ngOnDestroy(): void {
} }
searchFun(control:any,i:number,option){
console.log("control",control)
if (option == 'city') {
// this.cityData[i]=this.filterCity(this.stateList,control.value.state_name)
control.controls['citySearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(() => {
this.SearchCity(control.controls['citySearch'].value, i);
})
}
}
SearchCity(val: any, i: number) {
// let cityData=
console.log(this.cityData)
if (!this.cityData) {
return
}
let searchValue = val
if (!searchValue) {
this.m_city[i]=this.cityData.slice()
return
} else {
searchValue = searchValue.toLowerCase()
}
console.log("City value",this.cityData)
this.m_city[i]=
this.cityData.filter(val=>val.city_name.toLowerCase().indexOf(searchValue)> -1)
console.log("City Data value",this.m_city[i])
// this.filteredCity.next(
// this.cityData[i].filter(value => value.city_name.toLowerCase().indexOf(searchValue) > -1)
// )
}
} }

View File

@ -44,6 +44,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { EntityDescriptionComponent } from './entity-edit/entity-description/entity-description.component'; import { EntityDescriptionComponent } from './entity-edit/entity-description/entity-description.component';
import { EntityFinancialInstitutionComponent } from './entity-edit/entity-financial-institution/entity-financial-institution.component'; import { EntityFinancialInstitutionComponent } from './entity-edit/entity-financial-institution/entity-financial-institution.component';
import { EntityOtherPreferenceComponent } from './entity-edit/entity-other-preference/entity-other-preference.component'; import { EntityOtherPreferenceComponent } from './entity-edit/entity-other-preference/entity-other-preference.component';
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
/** /**
* Custom angular notifier options * Custom angular notifier options
*/ */
@ -107,6 +108,7 @@ const customNotifierOptions: NotifierOptions = {
MatExpansionModule, MatExpansionModule,
MatSlideToggleModule, MatSlideToggleModule,
FormsModule, FormsModule,
NgxMatSelectSearchModule,
ReactiveFormsModule, ReactiveFormsModule,
MatFormFieldModule MatFormFieldModule
], ],