pd changes: kms

This commit is contained in:
gandhimathi 2018-10-16 10:48:32 +05:30
parent 1a645dd5a1
commit 8a74da43bc
6 changed files with 117 additions and 69 deletions

View File

@ -263,8 +263,8 @@
</mat-card-actions> --> </mat-card-actions> -->
<mat-card-actions style="text-align: right"> <mat-card-actions style="text-align: right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="above" <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button"
(click)="loadPdListCompoent(cancelStatus)"><mat-icon>close</mat-icon></button> (click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button>
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Click To Draft" matTooltipPosition="above" type="button" (click)="addCoApplicant()"><mat-icon>drafts</mat-icon></button> --> <!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Click To Draft" matTooltipPosition="above" type="button" (click)="addCoApplicant()"><mat-icon>drafts</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" (click)="submitPdDetails(_PDtriggerForm.value,draftStatus)" matTooltip="PD Draft" matTooltipPosition="above"><mat-icon>drafts</mat-icon></button> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" (click)="submitPdDetails(_PDtriggerForm.value,draftStatus)" matTooltip="PD Draft" matTooltipPosition="above"><mat-icon>drafts</mat-icon></button>

View File

@ -16,8 +16,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
//@Output() loadParent = new EventEmitter<string>(); //@Output() loadParent = new EventEmitter<string>();
cancelStatus: boolean; cancelStatus: boolean;
enablePDButton: boolean; enablePDButton: boolean;
draftStatus: boolean; draftStatus: string;
PDTriggerStatus: boolean; PDTriggerStatus: string;
private notifier: NotifierService; private notifier: NotifierService;
public _PDtriggerForm: FormGroup; public _PDtriggerForm: FormGroup;
items: FormArray; items: FormArray;
@ -47,8 +47,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
public totalFileName = []; public totalFileName = [];
public lengthCheckToaddMore =0; public lengthCheckToaddMore =0;
ngOnInit() { ngOnInit() {
this.draftStatus=false; this.draftStatus="DRAFT";
this.PDTriggerStatus=true; this.PDTriggerStatus="TRIGGERED";
this.enablePDButton=false; this.enablePDButton=false;
this.cancelStatus = false; this.cancelStatus = false;
this.ListPdComponent.pdListLoad(false); this.ListPdComponent.pdListLoad(false);
@ -58,6 +58,13 @@ export class AddPdComponent implements OnInit, OnDestroy {
this.getStateCityList(); this.getStateCityList();
this.getPDTypeList(); this.getPDTypeList();
this.getRelationMaster(); this.getRelationMaster();
this.loadFormData();
this.OnChanges();
}
// load form data
loadFormData(){
this._PDtriggerForm = this._fb.group({ this._PDtriggerForm = this._fb.group({
fk_lender_id: [null], fk_lender_id: [null],
lender_applicant_id: [null, Validators.compose([Validators.required])], lender_applicant_id: [null, Validators.compose([Validators.required])],
@ -72,19 +79,17 @@ export class AddPdComponent implements OnInit, OnDestroy {
applicant_name: [null], applicant_name: [null],
mobile_no: [null], mobile_no: [null],
email: [null], email: [null],
  addressline1: [null],   addressline1: [null],
addressline2: [null], addressline2: [null],
addressline3: [null], addressline3: [null],
fk_city: [null], fk_city: [null],
fk_state: [null], fk_state: [null],
  pincode : [null],   pincode : [null],
  // allocation_type: [null],   // allocation_type: [null],
  // sub_allocation_type: [null],   // sub_allocation_type: [null],
items: this._fb.array([]), items: this._fb.array([]),
documents: this._fb.array([]) documents: this._fb.array([])
}); });
this.OnChanges();
} }
// enable pd trigger submit function // enable pd trigger submit function
OnChanges(): void{ OnChanges(): void{
@ -398,5 +403,9 @@ export class AddPdComponent implements OnInit, OnDestroy {
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.ListPdComponent.showListView(true); this.ListPdComponent.showListView(true);
}
/** To Reset Popup Data */
onReset() {
this.loadFormData();
} }
} }

View File

@ -4,13 +4,13 @@
(click)="closeEditMasterComponent()"><mat-icon>close</mat-icon></button> (click)="closeEditMasterComponent()"><mat-icon>close</mat-icon></button>
</div> </div>
<mat-card> <mat-card>
<form [formGroup]="_EditPDtriggerForm" (submit)="submitPdDetails(_EditPDtriggerForm.value)"> <form [formGroup]="_EditPDtriggerForm" (submit)="submitPdDetails(_EditPDtriggerForm.value, PDTriggerStatus)">
<mat-card-content> <mat-card-content>
<div fxLayout="row" fxLayoutWrap="wrap"> <div fxLayout="row" fxLayoutWrap="wrap">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100"> <div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<div fxLayout="column" fxLayoutAlign="start stretch"> <div fxLayout="column" fxLayoutAlign="start stretch">
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<mat-select placeholder="Lender Name" formControlName="fk_lender_id" (billingList)="getBillingDetails(pdMain.fk_lender_id.value)"> <mat-select placeholder="Lender Name" formControlName="fk_lender_id" (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)">
<mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" > <mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" >
{{LL.full_name}} {{LL.full_name}}
</mat-option> </mat-option>
@ -24,12 +24,11 @@
<mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant ID Required</mat-error> <mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant ID Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<mat-select placeholder="Billing Address" formControlName="fk_enitity__billing_id"> <mat-select placeholder="Billing Address" formControlName="fk_entity_billing_id">
<mat-option *ngFor="let billL of billingList" [value]="billL.entity_billing_id" > <mat-option *ngFor="let billL of billingList" [value]="billL.entity_billing_id" >
{{billL.billing_name}} {{billL.billing_name}}
</mat-option> </mat-option>
</mat-select> </mat-select>
<!-- <mat-error *ngIf="pdMain.fk_enitity__billing_id.hasError('required')">Billing Address Required</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person" formControlName="pd_contact_person" type="text" required> <input matInput placeholder="Contact Person" formControlName="pd_contact_person" type="text" required>
@ -129,7 +128,9 @@
<mat-card-actions style="text-align: right"> <mat-card-actions style="text-align: right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button"
(click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button> (click)="onReset()"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" (click)="submitPdDetails(this._EditPDtriggerForm.value,draftStatus)" matTooltip="PD Draft" matTooltipPosition="above"><mat-icon>drafts</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" [disabled]="allicantLength>0 || !_EditPDtriggerForm.valid || !enablePDButton" type="submit"><mat-icon>save</mat-icon></button>
</mat-card-actions> </mat-card-actions>
</form> </form>
</mat-card> </mat-card>

View File

@ -21,6 +21,10 @@ export class EditPdMasterComponent implements OnInit {
cityList:any; cityList:any;
pdTypeList:any; pdTypeList:any;
billingList:any; billingList:any;
allicantLength:number;
draftStatus: string;
PDTriggerStatus: string;
enablePDButton: boolean
public _EditPDtriggerForm:FormGroup; public _EditPDtriggerForm:FormGroup;
public notifier: NotifierService; public notifier: NotifierService;
constructor(private _fb: FormBuilder, constructor(private _fb: FormBuilder,
@ -30,22 +34,28 @@ export class EditPdMasterComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
console.log(this.data) this.draftStatus="DRAFT";
this.PDTriggerStatus="TRIGGERED";
this.getLenderList(); this.getLenderList();
this.getProductsList(); this.getProductsList();
this.getCustomerSegmentList(); this.getCustomerSegmentList();
this.getStateCityList(); this.getStateCityList();
this.getPDTypeList(); this.getPDTypeList();
this.loadFormData(); this.loadFormData();
this.allicantLength=this.data.allicantLength
this.OnChanges();
} }
getLenderList(){ getLenderList(){
this._pd.getLenderDetails().subscribe( this._pd.getLenderDetails().subscribe(
data => { data => {
if (data.status == 200) { if (data.status == 200) {
this.lenderList=data.records this.lenderList=data.records
if(this.data.fk_lender_id){
this.getBillingDetails(this.data.fk_lender_id); if(this.data.records.fk_lender_id){
this.getBillingDetails(this.data.records.fk_lender_id);
} }
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
@ -55,8 +65,8 @@ export class EditPdMasterComponent implements OnInit {
data => { data => {
if (data.status == 200) { if (data.status == 200) {
this.productList=data.records this.productList=data.records
if(this.data.fk_product_id){ if(this.data.records.fk_product_id){
this.getSubproductList(this.data.fk_product_id); this.getSubproductList(this.data.records.fk_product_id);
} }
} }
@ -75,8 +85,8 @@ export class EditPdMasterComponent implements OnInit {
data => { data => {
if (data.status == 200) { if (data.status == 200) {
this.stateList=data.records this.stateList=data.records
if(this.data.fk_state){ if(this.data.records.fk_state){
this.getCityList(this.data.fk_state); this.getCityList(this.data.records.fk_state);
} }
} }
@ -94,23 +104,34 @@ export class EditPdMasterComponent implements OnInit {
loadFormData() { loadFormData() {
this._EditPDtriggerForm = this._fb.group({ this._EditPDtriggerForm = this._fb.group({
fk_primary_id: [this.data.pd_id], pd_id: [this.data.records.pd_id],
fk_lender_id: [this.data.fk_lender_id, Validators.compose([Validators.required])], fk_lender_id: [this.data.records.fk_lender_id, Validators.compose([Validators.required])],
lender_applicant_id: [this.data.lender_applicant_id, Validators.compose([Validators.required])], lender_applicant_id: [this.data.records.lender_applicant_id, Validators.compose([Validators.required])],
pd_contact_person: [this.data.pd_contact_person, Validators.compose([Validators.required])], pd_contact_person: [this.data.records.pd_contact_person, Validators.compose([Validators.required])],
pd_contact_mobileno: [this.data.pd_contact_mobileno, Validators.compose([Validators.required])], pd_contact_mobileno: [this.data.records.pd_contact_mobileno, Validators.compose([Validators.required])],
fk_enitity_billing_id: [this.data.fk_enitity_billing_id], fk_entity_billing_id: [this.data.records.fk_entity_billing_id],
fk_product_id: [this.data.fk_product_id], fk_product_id: [this.data.records.fk_product_id],
fk_subproduct_id: [this.data.fk_subproduct_id], fk_subproduct_id: [this.data.records.fk_subproduct_id],
fk_pd_type: [this.data.fk_pd_type], fk_pd_type: [this.data.records.fk_pd_type],
fk_customer_segment: [this.data.fk_customer_segment], fk_customer_segment: [this.data.records.fk_customer_segment],
loan_amount: [this.data.loan_amount], loan_amount: [this.data.records.loan_amount],
  addressline1: [this.data.addressline1],   addressline1: [this.data.records.addressline1],
addressline2: [this.data.addressline2], addressline2: [this.data.records.addressline2],
addressline3: [this.data.addressline3], addressline3: [this.data.records.addressline3],
fk_city: [this.data.fk_city], fk_city: [this.data.records.fk_city],
fk_state: [this.data.fk_state], fk_state: [this.data.records.fk_state],
  pincode : [this.data.pincode],   pincode : [this.data.records.pincode],
});
}
// enable pd trigger submit function
OnChanges(): void{
this._EditPDtriggerForm.valueChanges.subscribe(val => {
if(val.fk_lender_id && val.fk_product_id && val.fk_subproduct_id && val.fk_pd_type && val.fk_customer_segment && val.loan_amount && val.addressline1 && val.fk_city && val.fk_state && val.pincode){
this.enablePDButton=true;
}
else{
this.enablePDButton=false;
}
}); });
} }
get pdMain() { return this._EditPDtriggerForm.controls; } get pdMain() { return this._EditPDtriggerForm.controls; }
@ -129,15 +150,28 @@ export class EditPdMasterComponent implements OnInit {
} }
// lendor billing address // lendor billing address
getBillingDetails(lendorID:string){ getBillingDetails(lendorID:string){
console.log(lendorID) console.log(this.lenderList)
// this.billingList= this.lenderList.filter(item => item.fk_entity_id == lendorID); this.billingList= this.lenderList.filter(item => item.entity_id == lendorID);
// this.billingList=this.billingList[0].billing_address; console.log(this.billingList)
this.billingList=this.billingList[0].billing_address;
console.log(this.billingList)
} }
submitPdDetails(formValue: any) { submitPdDetails(formValue: any, status:string) {
console.log(status)
if(this._EditPDtriggerForm.valid){ if(this._EditPDtriggerForm.valid){
let my_array = this._EditPDtriggerForm.value; let my_array = this._EditPDtriggerForm.value;
Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]); Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]);
this._pd.editPdMasterDetails(my_array).subscribe(); this._pd.editPdMasterDetails(my_array, status).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'PD Master Updated.');
this.dialogRef.close();
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
} }
} }
/** To Reset Popup Data */ /** To Reset Popup Data */

View File

@ -61,9 +61,12 @@ export class ViewPdComponent implements OnInit, OnDestroy {
} }
editPdMaster(masterData:any){ editPdMaster(masterData:any){
let record = {
"records":masterData,
"applicantLength": this.pdApplicantData.length
}
const dialogPDMaster = this.dialog.open(EditPdMasterComponent, { const dialogPDMaster = this.dialog.open(EditPdMasterComponent, {
data: masterData, data: record,
disableClose: true disableClose: true
}); });
dialogPDMaster.afterClosed() dialogPDMaster.afterClosed()

View File

@ -103,10 +103,11 @@ export class PdTrigerService {
) )
} }
// update pd master details // update pd master details
editPdMasterDetails(editData:any):Observable<any>{ editPdMasterDetails(editData:any,status:string):Observable<any>{
editData.pd_status = status;
editData.fk_updatedby = this._aws.getlocale(); editData.fk_updatedby = this._aws.getlocale();
editData.updatedon = currentdate; editData.updatedon = currentdate;
return this._http.post<any>(this.apiUrl+"triggerNewPD",{records:editData}) return this._http.post<any>(this.apiUrl+"updatePDMaster",{records:editData})
.pipe( .pipe(
catchError(this.handleError('operation', [])) catchError(this.handleError('operation', []))