pd changes: kms
This commit is contained in:
parent
1a645dd5a1
commit
8a74da43bc
@ -263,8 +263,8 @@
|
||||
</mat-card-actions> -->
|
||||
|
||||
<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"
|
||||
(click)="loadPdListCompoent(cancelStatus)"><mat-icon>close</mat-icon></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>
|
||||
|
||||
<!-- <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>
|
||||
|
||||
@ -16,8 +16,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
//@Output() loadParent = new EventEmitter<string>();
|
||||
cancelStatus: boolean;
|
||||
enablePDButton: boolean;
|
||||
draftStatus: boolean;
|
||||
PDTriggerStatus: boolean;
|
||||
draftStatus: string;
|
||||
PDTriggerStatus: string;
|
||||
private notifier: NotifierService;
|
||||
public _PDtriggerForm: FormGroup;
|
||||
items: FormArray;
|
||||
@ -47,8 +47,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
public totalFileName = [];
|
||||
public lengthCheckToaddMore =0;
|
||||
ngOnInit() {
|
||||
this.draftStatus=false;
|
||||
this.PDTriggerStatus=true;
|
||||
this.draftStatus="DRAFT";
|
||||
this.PDTriggerStatus="TRIGGERED";
|
||||
this.enablePDButton=false;
|
||||
this.cancelStatus = false;
|
||||
this.ListPdComponent.pdListLoad(false);
|
||||
@ -58,34 +58,39 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
this.getStateCityList();
|
||||
this.getPDTypeList();
|
||||
this.getRelationMaster();
|
||||
this._PDtriggerForm = this._fb.group({
|
||||
fk_lender_id: [null],
|
||||
lender_applicant_id: [null, Validators.compose([Validators.required])],
|
||||
lender_contact_person: [null, Validators.compose([Validators.required])],
|
||||
lender_contact_mobile: [null, Validators.compose([Validators.required])],
|
||||
lender_billing: [null],
|
||||
fk_product_id: [null],
|
||||
fk_subproduct_id: [null],
|
||||
fk_pd_type: [null],
|
||||
fk_customer_segment: [null],
|
||||
loan_amount: [null],
|
||||
applicant_name: [null],
|
||||
mobile_no: [null],
|
||||
email: [null],
|
||||
addressline1: [null],
|
||||
addressline2: [null],
|
||||
addressline3: [null],
|
||||
fk_city: [null],
|
||||
fk_state: [null],
|
||||
pincode : [null],
|
||||
// allocation_type: [null],
|
||||
// sub_allocation_type: [null],
|
||||
items: this._fb.array([]),
|
||||
documents: this._fb.array([])
|
||||
});
|
||||
this.loadFormData();
|
||||
this.OnChanges();
|
||||
|
||||
}
|
||||
|
||||
// load form data
|
||||
loadFormData(){
|
||||
this._PDtriggerForm = this._fb.group({
|
||||
fk_lender_id: [null],
|
||||
lender_applicant_id: [null, Validators.compose([Validators.required])],
|
||||
lender_contact_person: [null, Validators.compose([Validators.required])],
|
||||
lender_contact_mobile: [null, Validators.compose([Validators.required])],
|
||||
lender_billing: [null],
|
||||
fk_product_id: [null],
|
||||
fk_subproduct_id: [null],
|
||||
fk_pd_type: [null],
|
||||
fk_customer_segment: [null],
|
||||
loan_amount: [null],
|
||||
applicant_name: [null],
|
||||
mobile_no: [null],
|
||||
email: [null],
|
||||
addressline1: [null],
|
||||
addressline2: [null],
|
||||
addressline3: [null],
|
||||
fk_city: [null],
|
||||
fk_state: [null],
|
||||
pincode : [null],
|
||||
// allocation_type: [null],
|
||||
// sub_allocation_type: [null],
|
||||
items: this._fb.array([]),
|
||||
documents: this._fb.array([])
|
||||
});
|
||||
}
|
||||
// enable pd trigger submit function
|
||||
OnChanges(): void{
|
||||
this._PDtriggerForm.valueChanges.subscribe(val => {
|
||||
@ -399,4 +404,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
ngOnDestroy(): void {
|
||||
this.ListPdComponent.showListView(true);
|
||||
}
|
||||
/** To Reset Popup Data */
|
||||
onReset() {
|
||||
this.loadFormData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
(click)="closeEditMasterComponent()"><mat-icon>close</mat-icon></button>
|
||||
</div>
|
||||
<mat-card>
|
||||
<form [formGroup]="_EditPDtriggerForm" (submit)="submitPdDetails(_EditPDtriggerForm.value)">
|
||||
<form [formGroup]="_EditPDtriggerForm" (submit)="submitPdDetails(_EditPDtriggerForm.value, PDTriggerStatus)">
|
||||
<mat-card-content>
|
||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
|
||||
<div fxLayout="column" fxLayoutAlign="start stretch">
|
||||
<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" >
|
||||
{{LL.full_name}}
|
||||
</mat-option>
|
||||
@ -24,12 +24,11 @@
|
||||
<mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant ID Required</mat-error>
|
||||
</mat-form-field>
|
||||
<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" >
|
||||
{{billL.billing_name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<!-- <mat-error *ngIf="pdMain.fk_enitity__billing_id.hasError('required')">Billing Address Required</mat-error> -->
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 100%">
|
||||
<input matInput placeholder="Contact Person" formControlName="pd_contact_person" type="text" required>
|
||||
@ -129,7 +128,9 @@
|
||||
<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"
|
||||
(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>
|
||||
</form>
|
||||
</mat-card>
|
||||
|
||||
@ -21,6 +21,10 @@ export class EditPdMasterComponent implements OnInit {
|
||||
cityList:any;
|
||||
pdTypeList:any;
|
||||
billingList:any;
|
||||
allicantLength:number;
|
||||
draftStatus: string;
|
||||
PDTriggerStatus: string;
|
||||
enablePDButton: boolean
|
||||
public _EditPDtriggerForm:FormGroup;
|
||||
public notifier: NotifierService;
|
||||
constructor(private _fb: FormBuilder,
|
||||
@ -30,22 +34,28 @@ export class EditPdMasterComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.data)
|
||||
this.draftStatus="DRAFT";
|
||||
this.PDTriggerStatus="TRIGGERED";
|
||||
this.getLenderList();
|
||||
this.getProductsList();
|
||||
this.getCustomerSegmentList();
|
||||
this.getStateCityList();
|
||||
this.getPDTypeList();
|
||||
this.loadFormData();
|
||||
this.allicantLength=this.data.allicantLength
|
||||
this.OnChanges();
|
||||
}
|
||||
|
||||
|
||||
|
||||
getLenderList(){
|
||||
this._pd.getLenderDetails().subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
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);
|
||||
@ -55,8 +65,8 @@ export class EditPdMasterComponent implements OnInit {
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.productList=data.records
|
||||
if(this.data.fk_product_id){
|
||||
this.getSubproductList(this.data.fk_product_id);
|
||||
if(this.data.records.fk_product_id){
|
||||
this.getSubproductList(this.data.records.fk_product_id);
|
||||
}
|
||||
|
||||
}
|
||||
@ -75,8 +85,8 @@ export class EditPdMasterComponent implements OnInit {
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.stateList=data.records
|
||||
if(this.data.fk_state){
|
||||
this.getCityList(this.data.fk_state);
|
||||
if(this.data.records.fk_state){
|
||||
this.getCityList(this.data.records.fk_state);
|
||||
}
|
||||
|
||||
}
|
||||
@ -94,25 +104,36 @@ export class EditPdMasterComponent implements OnInit {
|
||||
|
||||
loadFormData() {
|
||||
this._EditPDtriggerForm = this._fb.group({
|
||||
fk_primary_id: [this.data.pd_id],
|
||||
fk_lender_id: [this.data.fk_lender_id, Validators.compose([Validators.required])],
|
||||
lender_applicant_id: [this.data.lender_applicant_id, Validators.compose([Validators.required])],
|
||||
pd_contact_person: [this.data.pd_contact_person, Validators.compose([Validators.required])],
|
||||
pd_contact_mobileno: [this.data.pd_contact_mobileno, Validators.compose([Validators.required])],
|
||||
fk_enitity_billing_id: [this.data.fk_enitity_billing_id],
|
||||
fk_product_id: [this.data.fk_product_id],
|
||||
fk_subproduct_id: [this.data.fk_subproduct_id],
|
||||
fk_pd_type: [this.data.fk_pd_type],
|
||||
fk_customer_segment: [this.data.fk_customer_segment],
|
||||
loan_amount: [this.data.loan_amount],
|
||||
addressline1: [this.data.addressline1],
|
||||
addressline2: [this.data.addressline2],
|
||||
addressline3: [this.data.addressline3],
|
||||
fk_city: [this.data.fk_city],
|
||||
fk_state: [this.data.fk_state],
|
||||
pincode : [this.data.pincode],
|
||||
pd_id: [this.data.records.pd_id],
|
||||
fk_lender_id: [this.data.records.fk_lender_id, Validators.compose([Validators.required])],
|
||||
lender_applicant_id: [this.data.records.lender_applicant_id, Validators.compose([Validators.required])],
|
||||
pd_contact_person: [this.data.records.pd_contact_person, Validators.compose([Validators.required])],
|
||||
pd_contact_mobileno: [this.data.records.pd_contact_mobileno, Validators.compose([Validators.required])],
|
||||
fk_entity_billing_id: [this.data.records.fk_entity_billing_id],
|
||||
fk_product_id: [this.data.records.fk_product_id],
|
||||
fk_subproduct_id: [this.data.records.fk_subproduct_id],
|
||||
fk_pd_type: [this.data.records.fk_pd_type],
|
||||
fk_customer_segment: [this.data.records.fk_customer_segment],
|
||||
loan_amount: [this.data.records.loan_amount],
|
||||
addressline1: [this.data.records.addressline1],
|
||||
addressline2: [this.data.records.addressline2],
|
||||
addressline3: [this.data.records.addressline3],
|
||||
fk_city: [this.data.records.fk_city],
|
||||
fk_state: [this.data.records.fk_state],
|
||||
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 sub product list based on prokduct id
|
||||
@ -129,15 +150,28 @@ export class EditPdMasterComponent implements OnInit {
|
||||
}
|
||||
// lendor billing address
|
||||
getBillingDetails(lendorID:string){
|
||||
console.log(lendorID)
|
||||
// this.billingList= this.lenderList.filter(item => item.fk_entity_id == lendorID);
|
||||
// this.billingList=this.billingList[0].billing_address;
|
||||
console.log(this.lenderList)
|
||||
this.billingList= this.lenderList.filter(item => item.entity_id == lendorID);
|
||||
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){
|
||||
let my_array = this._EditPDtriggerForm.value;
|
||||
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 */
|
||||
|
||||
@ -61,9 +61,12 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
editPdMaster(masterData:any){
|
||||
|
||||
let record = {
|
||||
"records":masterData,
|
||||
"applicantLength": this.pdApplicantData.length
|
||||
}
|
||||
const dialogPDMaster = this.dialog.open(EditPdMasterComponent, {
|
||||
data: masterData,
|
||||
data: record,
|
||||
disableClose: true
|
||||
});
|
||||
dialogPDMaster.afterClosed()
|
||||
|
||||
@ -103,10 +103,11 @@ export class PdTrigerService {
|
||||
)
|
||||
}
|
||||
// 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.updatedon = currentdate;
|
||||
return this._http.post<any>(this.apiUrl+"triggerNewPD",{records:editData})
|
||||
return this._http.post<any>(this.apiUrl+"updatePDMaster",{records:editData})
|
||||
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user