Fairoj : Deduplicate functionality check implemented

This commit is contained in:
venbatechnologies@gmail.com 2019-11-02 17:44:05 +05:30
parent 7224e598a2
commit f1d5dad93b
5 changed files with 59 additions and 8 deletions

View File

@ -35,7 +35,7 @@
</mat-form-field>
<mat-form-field style="width: 28%">
<input matInput autocomplete="off" placeholder=" Loan Application ID" formControlName="lender_applicant_id" type="text" required (change)="checkExistPd($event.target.value)">
<input matInput autocomplete="off" placeholder=" Loan Application ID" formControlName="lender_applicant_id" type="text" required (change)="checkExistPd($event.target.value,1)">
<!-- <mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant ID Required</mat-error> -->
</mat-form-field>
<!-- <div *ngIf="sales_and_credit_enable"> -->
@ -232,7 +232,7 @@
<mat-form-field style="width: 38%">
<input matInput autocomplete="off" placeholder="Name of Individual Applicant" formControlName="applicant_name"
[value]="pdMain.applicant_name.value | titlecase">
[value]="pdMain.applicant_name.value | titlecase" (change)="checkExistPd($event.target.value,2)">
<!-- <mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error> -->
</mat-form-field>
@ -241,7 +241,7 @@
</mat-form-field>
<mat-form-field style="width: 38%">
<input matInput autocomplete="off" placeholder="Mobile Number" formControlName="mobile_no" type="text" ForMobileNumbers maxlength="10" minlength="10">
<input matInput autocomplete="off" placeholder="Mobile Number" formControlName="mobile_no" type="text" ForMobileNumbers maxlength="10" minlength="10" (change)="checkExistPd($event.target.value,2)">
<mat-error *ngIf="pdMain.mobile_no.hasError('required')">Mobile No is Required . </mat-error>
<mat-error *ngIf="pdMain.mobile_no.hasError('maxlength') || pdMain.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>

View File

@ -907,20 +907,53 @@ customerSegmentChange(value){
console.log(this.selected_cus_abbr);
}
checkExistPd(value){
checkExistPd(value,option){
// console.log(value);
let param={lender_applicant_id:value}
let param
let name
let swal_text
switch(option){
case 1:
param={lender_applicant_id:value}
name= "Loan Application Id"
swal_text="The Entered "+name+" ("+value+") is already exists on the Case No. "
break;
case 2:
param={applicant_name:this.pdMain.applicant_name.value,mobile_no:this.pdMain.mobile_no.value}
name= "Applicant Name"
swal_text="The Entered applicant name and mobile number is already exists on the following Case Nos. "
break;
// case 3:
// param={mobile_no:value}
// name= "Mobile Number"
// break;
}
// if(option == 2 || ){
if((this.pdMain.mobile_no.value != null && this.pdMain.applicant_name.value != null && option == 2) || option == 1){
this._pd.checkExistPDDetails(param).subscribe(result=>{
if(result['dataStatus']){
if(result['records'].length > 0){
let exist_pd_sno:string=''
result['records'].forEach(val=>{
if(exist_pd_sno == ''){
exist_pd_sno=val.pd_sno
}
else{
exist_pd_sno=exist_pd_sno+','+val.pd_sno}
})
Swal({
title:"Warning!",
type:'warning',
text:"The Entered Loan Application Id ("+value+") is already exists on the Case No. "+result['records'][0].pd_sno})
text:swal_text+exist_pd_sno
})
// this._PDtriggerForm.controls['lender_applicant_id'].setValue('');
}
}
})
}
}
searchFun(control:any,i:number,option){
console.log("control",control)

View File

@ -1,7 +1,9 @@
<mat-card>
<mat-card style="margin: 0px;padding: 0px;">
<div style="width: 100%; background-color: yellow; text-align: center;justify-content: center" *ngIf="existPDs.length > 0">
<span class="notify_duplicate">This PD is a possible duplicate of PD <span *ngFor="let pd of existPDs">&nbsp;&nbsp; <a class="exist_pd_link" target="_blank" [routerLink]="['../../',pd.pd_id,pd.random_string]">{{pd.pd_sno}}</a>&nbsp;&nbsp;</span></span>
</div>
<mat-card-content>
<div fxLayout="row wrap">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="40" fxFlex.lg="30" fxFlex.xl="30" *ngFor="let master of pdMasterData">
<mat-card style="min-width: 80%;max-width: 100%;box-shadow: 0 5px 11px 0 rgba(0,0,0,.18), 0 4px 15px 0 rgba(0,0,0,.15) !important;margin-top:60px;">

View File

@ -55,6 +55,20 @@
text-align: center;
}
}
.notify_duplicate{
padding: 10px;
//background-color: yellow;
text-align: center;
border-radius: 4px;
font-size: 14px;
}
.exist_pd_link{
text-decoration: underline;
color: red;
}
.exist_pd_link :hover{
text-decoration: none;
}
// .mat-list .mat-list-item.center .mat-list-item-content{
// justify-content: center;

View File

@ -98,6 +98,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
// @Input() childData: string;
// @Output() loadParent = new EventEmitter<string>();
public _EditPDtriggerForm: FormGroup;
existPDs: any=[];
// no_qc_remarks: boolean;
constructor(notifier: NotifierService, private dialog: MatDialog, private _fb: FormBuilder,
private _pd: PdTrigerService, private route: ActivatedRoute, private router: Router, private ListPdComponent: ListPdComponent) {
@ -166,6 +167,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
else {
this.enableStartPD = false;
}
this.existPDs=data.records.exist_pd_details
}
}, error => {
console.log('%c Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!', 'font-weight: bold; font-size: 50px;color: red; ');