This commit is contained in:
venbatechnologies@gmail.com 2019-10-17 20:08:58 +05:30
commit 9d509dfa10
8 changed files with 301 additions and 16 deletions

View File

@ -6,7 +6,7 @@
<div style="width: 100%;text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above"
(click)="loadPdListCompoent(cancelStatus)"><mat-icon>close</mat-icon></button>
</div>
</div>
<mat-card>
<mat-card-header>
@ -157,7 +157,9 @@
<mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList($event.value,i)">
<mat-option> Select </mat-option>
<mat-option>
<ngx-mat-select-search formControlName="stateSearch" (keyup)="searchFun(addresses,i,'state')"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.name}}
</mat-option>
@ -168,7 +170,9 @@
</mat-form-field>
<mat-form-field style="width: 32%">
<mat-select placeholder="City" formControlName="fk_city">
<mat-option> Select </mat-option>
<mat-option>
<ngx-mat-select-search formControlName="citySearch" (keyup)="searchFun(addresses,i,'city')"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let CL of cityList[i]" [value]="CL.city_id">
{{CL.city_name}}
</mat-option>
@ -178,7 +182,9 @@
<mat-form-field style="width: 24%">
<mat-select placeholder="Pincode" formControlName="pincode" (selectionChange)="getPincode($event.value,i)">
<mat-option>Select</mat-option>
<mat-option>
<ngx-mat-select-search formControlName="pinSearch" (keyup)="searchFun(addresses,i,'pin')"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let PL of pincodeList[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>
</mat-form-field>
@ -380,6 +386,31 @@
</mat-card-actions>
</mat-card>
<mat-card>
<mat-card-content>
<mat-form-field style="width: 28%">
<mat-select placeholder="App Notify (Yes/No)" formControlName="is_notify_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<!-- <mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id" >
{{PDL.type_name}}
</mat-option>
</mat-select> -->
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
</mat-card-content>
</mat-card>
</mat-card-content>
<mat-card-actions>

View File

@ -9,6 +9,8 @@ import { AwsService } from '../../../../AwsService/aws.service';
import { TitleCasePipe } from '@angular/common';
/**sweet alert */
import Swal from 'sweetalert2';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
@Component({
selector: 'app-add-pd',
templateUrl: './add-pd.component.html',
@ -26,6 +28,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
private notifier: NotifierService;
public _PDtriggerForm: FormGroup;
protected _onDestroy = new Subject<void>();
addresses: FormArray;
coapplicants: FormArray;
addtional_requirements: FormArray;
@ -56,6 +60,9 @@ export class AddPdComponent implements OnInit, OnDestroy {
sales_and_credit_enable:boolean=false;
finInstitutionList: any;
selected_cus_abbr: any;
pincodeData:any=[];
cityData: any=[];
stateData: 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) {
@ -65,6 +72,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
public totalfiles: Array<File> = [];
public totalFileName = [];
public lengthCheckToaddMore = 0;
public scoreCardOptions: any = [{'score_option_name':'Yes','score_option_value':'1'},{'score_option_name':'No','score_option_value':'0'}];
ngOnInit() {
this.draftStatus = "DRAFT";
this.PDTriggerStatus = "TRIGGERED";
@ -114,6 +122,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
// 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],
is_notify_enabled:[null],
fk_product_id: [null],
fk_subproduct_id: [null],
fk_pd_type: [null],
@ -219,6 +228,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
data => {
if (data.status == 200) {
this.stateList = data.records.filter(item => item.isactive == 1);
this.stateData = this.stateList;
}
});
}
@ -292,6 +302,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
if (data.status == 200) {
this.cityList[index] = data.records.cities;
this.pincodeList[index] = data.records.pincode;
this.cityData = this.cityList;
this.pincodeData = this.pincodeList;
}
});
}
@ -387,6 +399,9 @@ export class AddPdComponent implements OnInit, OnDestroy {
addressline1: [null],
fk_city: [null],
fk_state: [null],
stateSearch:[''],
citySearch:[''],
pinSearch:[''],
pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
});
@ -654,6 +669,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
"fk_product_id": formValue.fk_product_id,
"fk_subproduct_id": formValue.fk_product_id != 4 ? formValue.fk_subproduct_id != '' || formValue.fk_subproduct_id != 0 ? formValue.fk_subproduct_id : null : null,
"fk_pd_type": formValue.fk_pd_type,
"is_notify_enabled":formValue.is_notify_enabled,
"fk_customer_segment": formValue.fk_customer_segment,
"loan_amount": formValue.loan_amount,
"addressline1": !formValue.addresses[0].addressline1 ? null : this.titleCase.transform(formValue.addresses[0].addressline1),
@ -906,5 +922,86 @@ checkExistPd(value){
}
})
}
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);
})
}
if (option == 'state') {
console.log("state")
control.controls['stateSearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(()=>{
this.searchState(control.controls['stateSearch'].value)
})
}
if (option == 'pin') {
console.log("pin")
control.controls['pinSearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(()=>{
this.searchPin(control.controls['pinSearch'].value,i)
})
}
}
searchPin(val:any,index:number){
if(!this.pincodeData[index]){
return
}
let searchValue=val
if(!searchValue){
this.pincodeList[index]=this.pincodeData[index].slice()
return
}else{
searchValue=searchValue.toLowerCase()
}
this.pincodeList[index]=this.pincodeData[index].filter(value=>value.pincode.toLowerCase().indexOf(searchValue) > -1)
}
SearchCity(val: any, i: number) {
// let cityData=
console.log(this.cityData[i])
if (!this.cityData[i]) {
return
}
let searchValue = val
if (!searchValue) {
this.cityList[i]=this.cityData[i].slice()
return
} else {
searchValue = searchValue.toLowerCase()
}
this.cityList[i]=
this.cityData[i].filter(val=>val.city_name.toLowerCase().indexOf(searchValue)> -1)
console.log("City Data value",this.cityList[i])
// this.filteredCity.next(
// this.cityData[i].filter(value => value.city_name.toLowerCase().indexOf(searchValue) > -1)
// )
}
searchState(val: any) {
console.log("statedata")
if (!this.stateData) {
return
}
let searchVal = val
if (!searchVal) {
// this.filteredState.next(this.stateList.slice())
this.stateList=this.stateData.slice()
return
}
else {
searchVal = searchVal.toLowerCase()
}
this.stateList=this.stateData.filter(res => res.name.toLowerCase().indexOf(searchVal) > -1)
// this.filteredState.next(
// this.stateList.filter(res => res.state_name.toLowerCase().indexOf(searchVal) > -1)
// )
}
}

View File

@ -182,7 +182,9 @@
<mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="fk_state"
(selectionChange)="getCityList($event.value,i)">
<mat-option> Select </mat-option>
<mat-option>
<ngx-mat-select-search formControlName="stateSearch" (keyup)="searchFun(addresses,i,'state')"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.name}}
</mat-option>
@ -192,7 +194,9 @@
<mat-form-field style="width: 32%">
<mat-select placeholder="City" formControlName="fk_city">
<mat-option> Select </mat-option>
<mat-option>
<ngx-mat-select-search formControlName="citySearch" (keyup)="searchFun(addresses,i,'city')"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let CL of cityList[i]" [value]="CL.city_id">
{{CL.city_name}}
</mat-option>
@ -203,7 +207,9 @@
<mat-form-field style="width: 24%">
<mat-select placeholder="Pincode" formControlName="pincode"
(selectionChange)="getPincode($event.value,i)">
<mat-option>Select</mat-option>
<mat-option>
<ngx-mat-select-search formControlName="pinSearch" (keyup)="searchFun(addresses,i,'pin')"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let PL of pincodeList[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>
</mat-form-field>

View File

@ -7,6 +7,8 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service';
import { TitleCasePipe } from '@angular/common';
import { getRandomString } from 'selenium-webdriver/safari';
import Swal from 'sweetalert2'
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
@Component({
selector: 'app-edit-pd-master',
@ -32,7 +34,10 @@ export class EditPdMasterComponent implements OnInit {
lenderBranchList: any;
pincodeList: any = [];
addressesList : any = [];
addressesDeactivited : any = [];
addressesDeactivited : any = [];
pincodeData:any=[];
cityData: any=[];
stateData: any=[];
applicantLength:number;
// draftStatus: string;
// PDTriggerStatus: string;
@ -47,6 +52,9 @@ export class EditPdMasterComponent implements OnInit {
addresses: FormArray;
public masterRandomString : string;
protected _onDestroy = new Subject<void>();
// create values for status check
pdStatusCheck :any={
@ -268,6 +276,7 @@ if(!option){
data => {
if (data.status == 200) {
this.stateList = data.records.filter(item => item.isactive == 1);
this.stateData = this.stateList;
}
});
}
@ -423,6 +432,8 @@ if(!option){
this.cityList[i] = data.records.cities;
this.pincodeList[i] = data.records.pincode;
this.cityData[i] = this.cityList[i];
this.pincodeData[i] = this.pincodeList[i];
}
});
}
@ -436,6 +447,9 @@ if(!option){
addressline1: [null],
fk_city: [null],
fk_state: [null],
stateSearch:[''],
citySearch:[''],
pinSearch:[''],
pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
isactive:[1],
@ -448,6 +462,9 @@ if(!option){
  addressline1: [data.addressline1 != null ? this.titleCase.transform(data.addressline1) : null],
fk_city: [data.fk_city],
fk_state: [data.fk_state],
stateSearch:[''],
citySearch:[''],
pinSearch:[''],
  pincode : [data.pincode],
other_pincode:[data.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])],
isactive:[data.isactive],
@ -835,4 +852,86 @@ checkExistPd(value){
}
})
}
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);
})
}
if (option == 'state') {
console.log("state")
control.controls['stateSearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(()=>{
this.searchState(control.controls['stateSearch'].value)
})
}
if (option == 'pin') {
console.log("pin")
control.controls['pinSearch'].valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(()=>{
this.searchPin(control.controls['pinSearch'].value,i)
})
}
}
searchPin(val:any,index:number){
if(!this.pincodeData[index]){
return
}
let searchValue=val
if(!searchValue){
this.pincodeList[index]=this.pincodeData[index].slice()
return
}else{
searchValue=searchValue.toLowerCase()
}
this.pincodeList[index]=this.pincodeData[index].filter(value=>value.pincode.toLowerCase().indexOf(searchValue) > -1)
}
SearchCity(val: any, i: number) {
// let cityData=
console.log(this.cityData[i])
if (!this.cityData[i]) {
return
}
let searchValue = val
if (!searchValue) {
this.cityList[i]=this.cityData[i].slice()
return
} else {
searchValue = searchValue.toLowerCase()
}
this.cityList[i]=
this.cityData[i].filter(val=>val.city_name.toLowerCase().indexOf(searchValue)> -1)
console.log("City Data value",this.cityList[i])
// this.filteredCity.next(
// this.cityData[i].filter(value => value.city_name.toLowerCase().indexOf(searchValue) > -1)
// )
}
searchState(val: any) {
console.log("statedata")
if (!this.stateData) {
return
}
let searchVal = val
if (!searchVal) {
// this.filteredState.next(this.stateList.slice())
this.stateList=this.stateData.slice()
return
}
else {
searchVal = searchVal.toLowerCase()
}
this.stateList=this.stateData.filter(res => res.name.toLowerCase().indexOf(searchVal) > -1)
// this.filteredState.next(
// this.stateList.filter(res => res.state_name.toLowerCase().indexOf(searchVal) > -1)
// )
}
}

View File

@ -44,6 +44,27 @@
<mat-error *ngIf="submitted && f.is_otp_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
<mat-select placeholder="SMS (Yes/No)" formControlName="is_sms_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_sms_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
<mat-select placeholder="mail (Yes/No)" formControlName="is_mail_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_mail_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
<mat-form-field fxFlex="1 1 auto" class="ml-xs">
<mat-select placeholder="App Notify (Yes/No)" formControlName="is_app_notify_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_app_notify_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
</div>
<div class="row" style="text-align:right;">

View File

@ -71,8 +71,11 @@ export class EntityAddComponent implements OnInit {
fk_entity_type_id: [null, Validators.compose([Validators.required])],
full_name: [null, Validators.compose([Validators.required])],
short_name: [null, Validators.compose([Validators.required])],
is_score_card_enabled: [null, Validators.compose([Validators.required])],
is_score_card_enabled: [null, Validators.compose([Validators.required])],
is_otp_enabled: [null, Validators.compose([Validators.required])],
is_sms_enabled: [null, Validators.compose([Validators.required])],
is_mail_enabled: [null, Validators.compose([Validators.required])],
is_app_notify_enabled: [null, Validators.compose([Validators.required])],
remarks: [null],
isactive: [1]
});

View File

@ -198,32 +198,57 @@
<mat-error *ngIf="submitted && f.full_name.hasError('required')" class="mat-text-warn">You must Include Entity Full Name.</mat-error>
</mat-form-field>
</div>
<div fxFlex="20%">
<div fxFlex="30%">
<mat-form-field class="ml-xs" style="width:100%">
<input matInput placeholder="Entity Short Name" formControlName="short_name">
<mat-error *ngIf="submitted && f.short_name.hasError('required')" class="mat-text-warn">You must Include Entity Short Name.</mat-error>
</mat-form-field>
</div>
<div fxFlex="20%">
<div fxFlex="30%">
<mat-form-field class="ml-xs" style="width:100%">
<mat-select placeholder="Score Card (Yes/No)" formControlName="is_score_card_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_score_card_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
</div>
<div fxFlex="20%">
</div>
</div>
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="center center">
<div fxFlex="30%">
<mat-form-field class="ml-xs" style="width:100%">
<mat-select placeholder="OTP (Yes/No)" formControlName="is_otp_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_otp_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
</div>
</div>
<div fxFlex="30%">
<mat-form-field class="ml-xs" style="width:100%">
<mat-select placeholder="SMS (Yes/No)" formControlName="is_sms_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_sms_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
</div>
<div fxFlex="30%">
<mat-form-field class="ml-xs" style="width:100%">
<mat-select placeholder="mail (Yes/No)" formControlName="is_mail_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_mail_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
</div>
<div fxFlex="30%">
<mat-form-field class="ml-xs" style="width:100%">
<mat-select placeholder="App Notify (Yes/No)" formControlName="is_app_notify_enabled">
<mat-option *ngFor="let opt of scoreCardOptions" [value]="opt.score_option_value">{{ opt.score_option_name }}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.is_app_notify_enabled.hasError('required')" class="mat-text-warn">Field Required.</mat-error>
</mat-form-field>
</div>
</div>
<div></div>
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="100%" fxLayoutAlign="flex-end">
<div fxFlex="20%">

View File

@ -100,6 +100,9 @@ export class EntityEditComponent implements OnInit, OnDestroy {
short_name: [this.entityNameRecord.short_name, Validators.compose([Validators.required]) ],
is_score_card_enabled:[this.entityNameRecord.is_score_card_enabled || '',Validators.compose([Validators.required])],
is_otp_enabled:[this.entityNameRecord.is_otp_enabled || '',Validators.compose([Validators.required])],
is_sms_enabled:[this.entityNameRecord.is_sms_enabled || '',Validators.compose([Validators.required])],
is_mail_enabled:[this.entityNameRecord.is_mail_enabled || '',Validators.compose([Validators.required])],
is_app_notify_enabled:[this.entityNameRecord.is_app_notify_enabled || '',Validators.compose([Validators.required])],
// entity_name: [this.entityNameRecord.entity_name],
fk_entity_type_id: [this.entityNameRecord.fk_entity_type_id],
isactive: [this.entityNameRecord.isactive]