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-select>
</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-select placeholder="Branch" formControlName="pd_branch_id" (selectionChange)="getContactPerson()">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->

View File

@ -63,6 +63,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
pincodeData:any=[];
cityData: any=[];
stateData: any=[];
billingtolist: any;
constructor(notifier: NotifierService, private _fb: FormBuilder, private route: ActivatedRoute,
private router: Router, private _pd: PdTrigerService, private _aws: AwsService, private ListPdComponent: ListPdComponent,
private titleCase : TitleCasePipe) {
@ -119,6 +120,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
loadFormData() {
this._PDtriggerForm = this._fb.group({
fk_lender_id: [null],
sub_entity_id: [''],
pd_branch_id: [null],
lender_applicant_id: [null, Validators.compose([Validators.required])],
lender_sales_person:[null],
@ -157,7 +159,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
lenderShortName:string;
/** FOR Dropdowns */
selectedLender(lender) {
// console.log('lender',lender);
console.log('lender',lender);
this.lenderBranchList = lender['branches'];
this.lenderShortName = lender['short_name'];
// console.log(this.lenderShortName);
@ -191,6 +193,18 @@ export class AddPdComponent implements OnInit, OnDestroy {
this._PDtriggerForm.controls['fk_pd_type'].setValue('');
this._PDtriggerForm.controls['fk_customer_segment'].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
// // console.log("entered");
@ -676,6 +690,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
let pd_details: any = {
"fk_lender_id": formValue.fk_lender_id,
"sub_entity_id": this._PDtriggerForm.controls['sub_entity_id'].value,
"lender_applicant_id": formValue.lender_applicant_id,
"pd_branch_id": formValue.pd_branch_id,
"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-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-select placeholder="Branch" formControlName="pd_branch_id" (selectionChange)="getContactPerson()">
<!-- (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_person: any=[];
finInstitutionList: any;
billingtolist: any;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef<EditPdMasterComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,private titleCase : TitleCasePipe) {
@ -208,6 +209,16 @@ if(!option){
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
// console.log("entered");
// this._EditPDtriggerForm.controls['fk_product_id'].setValue("3")
@ -322,6 +333,7 @@ if(!option){
this._EditPDtriggerForm = this._fb.group({
pd_id: [this.data.records.pd_id],
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])],
pd_branch_id:[this.data.records.pd_branch_id],
// pd_contact_person: [this.data.records.pd_contact_person],
@ -696,6 +708,7 @@ if(!option){
let lenderMasterArray = {
"pd_id": my_array.pd_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,
"pd_branch_id":my_array.pd_branch_id,
// "pd_contact_person": my_array.pd_contact_person,

View File

@ -13,7 +13,12 @@
<mat-form-field fxFlex="30%">
<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-error *ngIf="submitted && region['controls'].fk_city_id.hasError('required')" class="mat-text-warn">City Required.!</mat-error>
</mat-form-field>

View File

@ -9,6 +9,8 @@ import { NotifierService } from 'angular-notifier';
import { MastersService } from './../../../service/masters/masters.service';
import { EntityService } from './../../../service/entity/entity.service';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
@Component({
selector: 'app-entity-edit-region',
@ -36,6 +38,8 @@ export class EntityEditRegionComponent implements OnInit {
* Notifier service
*/
private notifier: NotifierService;
protected _onDestroy = new Subject<void>();
cityData: any = [];
constructor(
notifier: NotifierService,
@ -61,6 +65,7 @@ export class EntityEditRegionComponent implements OnInit {
setFormDatas(record) {
if (record.length > 0) {
console.log('setFormDatas');
for (let val of record) {
let vals = {
entity_region_map_id: val.entity_region_map_id,
@ -97,7 +102,8 @@ export class EntityEditRegionComponent implements OnInit {
getCityHierarchyMaster() {
this.entityService.getCityHierarchyMaster().subscribe(
data => {
this.m_city = data.records;
this.m_city[0] = data.records;
this.cityData = this.m_city[0];
},
error => {
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_region_id: [data.fk_region_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_branch_id: [data.fk_branch_id, Validators.compose([Validators.required])],
isactive: [data.isactive],
@ -162,6 +169,7 @@ export class EntityEditRegionComponent implements OnInit {
const control = <FormArray>this._editEntityRegionFrom.controls['region_lender'];
control.push(this.initRegionFormLoad(data));
}
this.m_city[this._editEntityRegionFrom.value.region_lender.length-1]=this.cityData
}
removeLanguage(i: number) {
const control = <FormArray>this._editEntityRegionFrom.controls['region_lender'];
@ -182,6 +190,14 @@ export class EntityEditRegionComponent implements OnInit {
//To Remove The "Null" With Key also
Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]);
// 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)) {
this.entityService.updateEntityIdRegionInfoDetails(formValues.region_lender).subscribe(
dataresult => {
@ -232,4 +248,39 @@ export class EntityEditRegionComponent implements OnInit {
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 { EntityFinancialInstitutionComponent } from './entity-edit/entity-financial-institution/entity-financial-institution.component';
import { EntityOtherPreferenceComponent } from './entity-edit/entity-other-preference/entity-other-preference.component';
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
/**
* Custom angular notifier options
*/
@ -107,6 +108,7 @@ const customNotifierOptions: NotifierOptions = {
MatExpansionModule,
MatSlideToggleModule,
FormsModule,
NgxMatSelectSearchModule,
ReactiveFormsModule,
MatFormFieldModule
],