pd map view and compoents changes

This commit is contained in:
gandhimathi 2018-10-12 10:59:16 +05:30
parent f82dd664e7
commit 27ad8d75ff
50 changed files with 548 additions and 1692 deletions

View File

@ -20,8 +20,8 @@ export const AppRoutes: Routes = [{
loadChildren:'./settings/settings.module#SettingsModule'
}
,{
path:'pdtrigger',
loadChildren:'./pd-triger/pd-triger.module#PdTrigerModule'
path:'personal_discussion',
loadChildren:'./personal-discussion/personal-discussion.module#PersonalDiscussionModule'
},{
path:'template',
loadChildren:'./template/template.module#TemplateModule'

View File

@ -1,75 +0,0 @@
<mat-card class="p-1">
<form [formGroup]="_EditApplicantForm" (submit)="updatePdApplicant(_EditApplicantForm.value)">
<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">
<mat-card class="p-2">
<h5>Main Applicant</h5>
<mat-form-field style="width: 100%">
<input matInput placeholder="Name" formControlName="applicant_name" required>
<mat-error *ngIf="pdMainApplicant.applicant_name.hasError('required')">Name is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Email" formControlName="email" type="email" required>
<mat-error *ngIf="pdMainApplicant.email.hasError('required')">Email number is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Phone" formControlName="mobile_no" type="text" required>
<mat-error *ngIf="pdMainApplicant.mobile_no.hasError('required')">Mobile number is required.</mat-error>
</mat-form-field>
</mat-card>
</div>
</div>
<div fxLayout="row" fxLayoutWrap="wrap" formArrayName="coApplicantItems" *ngFor="let coDetails of pdCoApplicant.controls; let i = index;">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2">
<h5>{{coDetails.controls.label.value}} {{i+1}}</h5>
<div [formGroupName]="i">
<mat-form-field style="width: 100%">
<input matInput placeholder="Name" formControlName="coapplicantName" type="text" required>
<!-- <mat-error *ngIf="pdCoApplicant.coapplicantName.hasError('required')">Name is required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Phone" formControlName="coapplicant_mobile_no" type="text">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Relation" formControlName="relationship" type="text">
</mat-form-field>
</div>
</mat-card>
</div>
</div>
<div fxLayout="row" fxLayoutWrap="wrap">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2" style="opacity: 0.5;">
<button _ngcontent-c39="" class="mr-1 mb-1 mat-button" type="button"><span style="opacity: 0.5;" (click)="addCoApplicant(emptyData)" class="mat-button-wrapper">Add More Co-Applicant</span><div class="mat-button-ripple mat-ripple" matripple=""></div><div class="mat-button-focus-overlay"></div></button>
</mat-card>
</div>
</div>
</mat-card-content>
<mat-card-actions style="text-align: right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"
(click)="loadPdMasterCompoent()"><mat-icon>close</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit"><mat-icon>save</mat-icon></button>
</mat-card-actions>
</form>
</mat-card>
<!-- <notifier-container></notifier-container> -->

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EditPdApplicantComponent } from './edit-pd-applicant.component';
describe('EditPdApplicantComponent', () => {
let component: EditPdApplicantComponent;
let fixture: ComponentFixture<EditPdApplicantComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditPdApplicantComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EditPdApplicantComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,122 +0,0 @@
import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../pd-service/pd-triger.service';
@Component({
selector: 'app-edit-pd-applicant',
templateUrl: './edit-pd-applicant.component.html',
styleUrls: ['./edit-pd-applicant.component.scss'],
encapsulation: ViewEncapsulation.None,
})
export class EditPdApplicantComponent implements OnInit {
errorMessage: any;
@Input() applicantChild: any;
@Output() loadPdView = new EventEmitter<string>();
public _EditApplicantForm:FormGroup;
public notifier: NotifierService;
mainApplicantData: any[];
coApplicantData: any[];
coApplicantItems:FormArray;
emptyData:any;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService,) {
this.notifier=notifier
}
ngOnInit() {
this.mainApplicantData= this.applicantChild.filter(item => item.applicant_type == 1);
this.coApplicantData= this.applicantChild.filter(item => item.applicant_type == 0);
this.loadApplicantFormData();
}
loadApplicantFormData() {
this._EditApplicantForm = this._fb.group({
fk_applicant_primary_id: [this.mainApplicantData[0].pd_co_applicant_id],
applicant_name: [this.mainApplicantData[0].applicant_name, Validators.compose([Validators.required])],
mobile_no: [this.mainApplicantData[0].mobile_no, Validators.compose([Validators.required])],
email: [this.mainApplicantData[0].email, Validators.compose([Validators.required, CustomValidators.email])],
applicant_type: [this.mainApplicantData[0].applicant_type, Validators.compose([Validators.required])],
coApplicantItems: this._fb.array([]),
});
// bind dynamic co applicant data
if(this.coApplicantData.length > 0){
for(let value of this.coApplicantData){
this.addCoApplicant(value);
}
}
}
createItem(listData): FormGroup {
if(listData){
return this._fb.group({
label: ['Co Applicant'],
fk_applicant_primary_id: [listData.pd_co_applicant_id],
coapplicantName: [listData.applicant_name, Validators.compose([Validators.required])],
coapplicant_mobile_no: [listData.mobile_no],
relationship: [listData.relation],
applicant_type: [listData.applicant_type, Validators.compose([Validators.required])],
});
}
else{
return this._fb.group({
label: ['Co Applicant'],
fk_applicant_primary_id: [null],
coapplicantName: [null, Validators.compose([Validators.required])],
coapplicant_mobile_no: [],
relationship: [null],
applicant_type: [0],
});
}
};
addCoApplicant(listData) {
if(this._EditApplicantForm.valid){
this.coApplicantItems = this._EditApplicantForm.get('coApplicantItems') as FormArray;
this.coApplicantItems.push(this.createItem(listData));
}
}
get pdMainApplicant() { return this._EditApplicantForm.controls; }
get pdCoApplicant() { return this._EditApplicantForm.get('coApplicantItems') as FormArray; }
updatePdApplicant(formValue: any) {
if(this._EditApplicantForm.valid){
let pd_applicant_details : any=[{
"fk_pd_id": this.mainApplicantData[0].fk_pd_id,
"pd_co_applicant_id": formValue.fk_applicant_primary_id,
"applicant_name":formValue.applicant_name,
"email":formValue.email,
"mobile_no":formValue.mobile_no,
"applicant_type":formValue.applicant_type,
"relation":formValue.relationship,
"isactive":1
}];
formValue.coApplicantItems.forEach((itemElement, itemIndex) => {
let obj1 = {
"fk_pd_id": this.mainApplicantData[0].fk_pd_id,
"pd_co_applicant_id": itemElement.fk_applicant_primary_id,
"applicant_name":itemElement.coapplicantName,
"relation":itemElement.relationship,
"email":"",
"mobile_no":itemElement.coapplicant_mobile_no,
"applicant_type":itemElement.applicant_type,
"isactive":1
}
pd_applicant_details.push(obj1)
});
this._pd.updatePdApplicant(pd_applicant_details).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'Applicants updated..');
this.loadPdMasterCompoent();
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
}
loadPdMasterCompoent() {
this.loadPdView.emit('2')
}
}

View File

@ -1,117 +0,0 @@
<mat-card>
<form [formGroup]="_EditPDtriggerForm" (submit)="submitPdDetails(_EditPDtriggerForm.value)">
<mat-card-content>
<div class="mb-2"></div>
<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" required>
<mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" >
{{LL.full_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender name is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Lender Applicant ID" formControlName="lender_applicant_id" type="text" required>
<mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant id is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Product Name" formControlName="fk_product_id" (selectionChange)="getSubproductList(pdMain.fk_product_id.value)" required>
<mat-option *ngFor="let PL of productList" [value]="PL.product_id" >
{{PL.product_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_product_id.hasError('required')">Product is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Sub product Name" formControlName="fk_subproduct_id" required>
<mat-option *ngFor="let SPL of subProductList" [value]="SPL.subproduct_id" >
{{SPL.subproduct_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_subproduct_id.hasError('required')">Sub product is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment" required>
<mat-option *ngFor="let CSL of customerSegmentList" [value]="CSL.customer_segment_id" >
{{CSL.customer_segment}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer segment is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type" required>
<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 is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Loan Amount" formControlName="loan_amount" required>
<mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 1" formControlName="addressline1" required></textarea>
<mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 2" formControlName="addressline2"></textarea>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 3" formControlName="addressline3"></textarea>
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Select State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)" required>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.state_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_state.hasError('required')">State is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Select City" formControlName="fk_city" required>
` <mat-option *ngFor="let CL of cityList" [value]="CL.city_id">
{{CL.city_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_city.hasError('required')">City is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%;">
<input matInput placeholder="Pincode" formControlName="pincode" required>
<mat-error *ngIf="pdMain.pincode.hasError('required')">Pincode is required.</mat-error>
</mat-form-field>
</div>
</div>
</div>
</mat-card-content>
<mat-card-actions style="text-align: right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"
(click)="loadPdMasterCompoent()"><mat-icon>close</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>
</mat-card-actions>
</form>
</mat-card>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EditPdMasterComponent } from './edit-pd-master.component';
describe('EditPdMasterComponent', () => {
let component: EditPdMasterComponent;
let fixture: ComponentFixture<EditPdMasterComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditPdMasterComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EditPdMasterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,130 +0,0 @@
import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../pd-service/pd-triger.service';
@Component({
selector: 'app-edit-pd-master',
templateUrl: './edit-pd-master.component.html',
styleUrls: ['./edit-pd-master.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class EditPdMasterComponent implements OnInit {
errorMessage: any;
productList:any;
subProductList:any;
lenderList:any;
customerSegmentList:any;
stateList:any;
cityList:any;
pdTypeList:any;
@Input() masterChild: any;
@Output() loadPdView = new EventEmitter<string>();
public _EditPDtriggerForm:FormGroup;
public notifier: NotifierService;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, notifier: NotifierService,) {
this.notifier=notifier
}
ngOnInit() {
this.getLenderList();
this.getProductsList();
this.getCustomerSegmentList();
this.getStateCityList();
this.getPDTypeList();
this.loadFormData();
}
getLenderList(){
this._pd.getLenderDetails().subscribe(
data => {
if (data.status == 200) {
this.lenderList=data.records
}
}, error => this.errorMessage = <any> error);
}
getProductsList(){
this._pd.getProductsDetails().subscribe(
data => {
if (data.status == 200) {
this.productList=data.records
this.getSubproductList(this.masterChild.fk_product_id);
}
}, error => this.errorMessage = <any> error);
}
getCustomerSegmentList(){
this._pd.getCustomersDetails().subscribe(
data => {
if (data.status == 200) {
this.customerSegmentList=data.records
}
}, error => this.errorMessage = <any> error);
}
getStateCityList(){
this._pd.getStateCityDetails().subscribe(
data => {
if (data.status == 200) {
this.stateList=data.records
this.getCityList(this.masterChild.fk_state);
}
}, error => this.errorMessage = <any> error);
}
getPDTypeList(){
this._pd.getPDTypeDetails().subscribe(
data => {
if (data.status == 200) {
this.pdTypeList=data.records.pd_type;
}
}, error => this.errorMessage = <any> error);
}
loadFormData() {
this._EditPDtriggerForm = this._fb.group({
fk_primary_id: [this.masterChild.pd_id],
fk_lender_id: [this.masterChild.fk_lender_id, Validators.compose([Validators.required])],
lender_applicant_id: [this.masterChild.lender_applicant_id, Validators.compose([Validators.required])],
fk_product_id: [this.masterChild.fk_product_id, Validators.compose([Validators.required])],
fk_subproduct_id: [this.masterChild.fk_subproduct_id, Validators.compose([Validators.required])],
fk_pd_type: [this.masterChild.fk_pd_type, Validators.compose([Validators.required])],
fk_customer_segment: [this.masterChild.fk_customer_segment, Validators.compose([Validators.required])],
loan_amount: [this.masterChild.loan_amount, Validators.compose([Validators.required])],
  addressline1: [this.masterChild.addressline1, Validators.compose([Validators.required])],
addressline2: [this.masterChild.addressline2],
addressline3: [this.masterChild.addressline3],
fk_city: [this.masterChild.fk_city, Validators.compose([Validators.required])],
fk_state: [this.masterChild.fk_state, Validators.compose([Validators.required])],
  pincode : [this.masterChild.pincode, Validators.compose([Validators.required])],
});
}
get pdMain() { return this._EditPDtriggerForm.controls; }
//get sub product list based on prokduct id
getSubproductList(productID:string){
this.subProductList= this.productList.filter(item => item.product_id == productID);
this.subProductList=this.subProductList[0].subproducts;
}
//get city list details based on state id
getCityList(stateID:string){
this.cityList= this.stateList.filter(item => item.state_id == stateID);
this.cityList=this.cityList[0].cities;
}
submitPdDetails(formValue: any) {
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();
}
}
loadPdMasterCompoent() {
// this.notifier.notify('success', 'Your Changes Updated.!');
this.loadPdView.emit('1')
}
}

View File

@ -1,123 +0,0 @@
<mat-card class="p-1">
<form [formGroup]="_EditPDtriggerForm" (submit)="submitPdDetails(_EditPDtriggerForm.value)">
<mat-card-content>
<div class="mb-2"></div>
<div fxLayout="row" fxLayoutWrap="wrap">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2">
<h5>PD Details</h5>
<div fxLayout="column" fxLayoutAlign="start stretch">
<mat-form-field style="width: 100%">
<mat-select placeholder="Lender Name" formControlName="fk_lender_id" required>
<mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" >
{{LL.full_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender name is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Lender Applicant ID" formControlName="lender_applicant_id" type="text">
<mat-error *ngIf="pdMain.lender_applicant_id.hasError('required')">Applicant id is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Product Name" formControlName="fk_product_id" (selectionChange)="getSubproductList(pdMain.fk_product_id.value.product_id)">
<mat-option *ngFor="let PL of productList" [value]="PL" >
{{PL.product_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_product_id.hasError('required')">Product is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Sub product Name" formControlName="fk_subproduct_id">
<mat-option *ngFor="let SPL of subProductList" [value]="SPL" >
{{SPL.subproduct_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_subproduct_id.hasError('required')">Sub product is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment">
<mat-option *ngFor="let CSL of customerSegmentList" [value]="CSL.customer_segment_id" >
{{CSL.customer_segment}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer segment is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type">
<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 is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Loan Amount" formControlName="loan_amount">
<mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 1" formControlName="addressline1"></textarea>
<mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 2" formControlName="addressline2"></textarea>
</mat-form-field>
<mat-form-field style="width: 100%">
<textarea matInput placeholder="Address 3" formControlName="addressline3"></textarea>
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Select State" formControlName="fk_state" >
<mat-option *ngFor="let SL of stateList" [value]="SL">
{{SL.state_name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_state.hasError('required')">State is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%;">
<mat-select placeholder="Select City" (selectionChange)="getCityList(pdMain.fk_state.value.state_id)" formControlName="fk_city" >
` <mat-option *ngFor="let CL of cityList" [value]="CL">
{{CL.name}}
</mat-option>
</mat-select>
<mat-error *ngIf="pdMain.fk_city.hasError('required')">City is required.</mat-error>
</mat-form-field>
<mat-form-field style="width: 100%;">
<input matInput placeholder="Pincode" formControlName="pincode">
<mat-error *ngIf="pdMain.pincode.hasError('required')">Pincode is required.</mat-error>
</mat-form-field>
</div>
</mat-card>
</div>
</div>
</mat-card-content>
<hr>
<!-- <mat-card-actions style="text-align: right">
<button mat-button color="accent" type="button" (click)="loadPdListCompoent()">Cancel</button>
<button mat-button color="primary" type="submit" [disabled]="!PDtriggerForm.valid">Submit</button>
</mat-card-actions> -->
</form>
</mat-card>

View File

@ -1,156 +0,0 @@
import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';
import { PdTrigerService } from '../pd-service/pd-triger.service';
import { AwsService } from '../../AwsService/aws.service';
@Component({
selector: 'app-edit-pd',
templateUrl: './edit-pd.component.html',
styleUrls: ['./edit-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class EditPdComponent implements OnInit {
errorMessage: any;
public editData: any;
public productList:any;
subProductList:any;
lenderList:any;
customerSegmentList:any;
public stateList:any;
cityList:any;
pdTypeList:any;
@Input() childData: string;
@Output() loadParent = new EventEmitter<string>();
public _EditPDtriggerForm:FormGroup;
constructor(private _fb: FormBuilder,
private _pd: PdTrigerService, private _aws:AwsService) {
}
ngOnInit() {
this.getLenderList();
this.getProductsList();
this.getCustomerSegmentList();
this.getStateCityList();
this.getPDTypeList();
this.editPdDetails(this.childData);
this.beforeLoadFormData();
}
editPdDetails(editID:string){
this._pd.editPdDetails(editID).subscribe(
data => {
if (data.status == 200) {
this.editData=data.records
this.afterLoadFormData();
}
}, error => this.errorMessage = <any> error);
}
loadPdListCompoent() {
this.loadParent.emit('2')
}
getLenderList(){
this._pd.getLenderDetails().subscribe(
data => {
if (data.status == 200) {
this.lenderList=data.records
}
}, error => this.errorMessage = <any> error);
}
getProductsList(){
this._pd.getProductsDetails().subscribe(
data => {
if (data.status == 200) {
this.productList=data.records
}
}, error => this.errorMessage = <any> error);
}
getCustomerSegmentList(){
this._pd.getCustomersDetails().subscribe(
data => {
if (data.status == 200) {
this.customerSegmentList=data.records
}
}, error => this.errorMessage = <any> error);
}
getStateCityList(){
this._pd.getStateCityDetails().subscribe(
data => {
if (data.status == 200) {
this.stateList=data.records
}
}, error => this.errorMessage = <any> error);
}
getPDTypeList(){
this._pd.getPDTypeDetails().subscribe(
data => {
if (data.status == 200) {
this.pdTypeList=data.records.pd_type;
}
}, error => this.errorMessage = <any> error);
}
beforeLoadFormData(){
this._EditPDtriggerForm = this._fb.group({
fk_lender_id: [null, Validators.compose([Validators.required])],
lender_applicant_id: [null, Validators.compose([Validators.required])],
fk_product_id: [null, Validators.compose([Validators.required])],
fk_subproduct_id: [null, Validators.compose([Validators.required])],
fk_pd_type: [null, Validators.compose([Validators.required])],
fk_customer_segment: [null, Validators.compose([Validators.required])],
loan_amount: [null, Validators.compose([Validators.required])],
applicant_name: [null, Validators.compose([Validators.required])],
mobile_no: [null, Validators.compose([Validators.required])],
email: [null, Validators.compose([Validators.required, CustomValidators.email])],
  addressline1: [null, Validators.compose([Validators.required])],
addressline2: [null],
addressline3: [null],
fk_city: [null, Validators.compose([Validators.required])],
fk_state: [null, Validators.compose([Validators.required])],
  pincode : [null, Validators.compose([Validators.required])],
items: this._fb.array([]),
documents: this._fb.array([])
});
}
afterLoadFormData() {
this._EditPDtriggerForm = this._fb.group({
fk_lender_id: [null, Validators.compose([Validators.required])],
lender_applicant_id: [null, Validators.compose([Validators.required])],
fk_product_id: [null, Validators.compose([Validators.required])],
fk_subproduct_id: [null, Validators.compose([Validators.required])],
fk_pd_type: [null, Validators.compose([Validators.required])],
fk_customer_segment: [null, Validators.compose([Validators.required])],
loan_amount: [null, Validators.compose([Validators.required])],
applicant_name: [null, Validators.compose([Validators.required])],
mobile_no: [null, Validators.compose([Validators.required])],
email: [null, Validators.compose([Validators.required, CustomValidators.email])],
  addressline1: [null, Validators.compose([Validators.required])],
addressline2: [null],
addressline3: [null],
fk_city: [null, Validators.compose([Validators.required])],
fk_state: [null, Validators.compose([Validators.required])],
  pincode : [null, Validators.compose([Validators.required])],
items: this._fb.array([]),
documents: this._fb.array([])
});
}
get pdMain() { return this._EditPDtriggerForm.controls; }
//get sub product list based on prokduct id
getSubproductList(productID:string){
this.subProductList= this.productList.filter(item => item.product_id == productID);
this.subProductList=this.subProductList[0].subproducts;
}
//get city list details based on state id
getCityList(stateID:string){
this.cityList= this.stateList.filter(item => item.state_id == stateID);
this.cityList=this.cityList[0].city;
}
submitPdDetails(formValue: any) {
if(this._EditPDtriggerForm.valid){
}
}
}

View File

@ -1,175 +0,0 @@
import { Component, ViewChild, OnInit, ViewEncapsulation, EventEmitter, Output } from '@angular/core';
import { PdTrigerService } from '../pd-service/pd-triger.service';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
//import { MapPdViewComponent } from '../map-pd-view/map-pd-view.component';
@Component({
selector: 'app-list-pd',
templateUrl: './list-pd.component.html',
styleUrls: ['./list-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class ListPdComponent implements OnInit {
recordStatus: boolean;
parentEditData :string;
parentViewData :string;
showParentComponent:boolean;
showAddComponent:boolean;
showEditComponent:boolean;
showViewComponent:boolean;
showMapViewComponent:boolean;
errorMessage: any;
public paginationList: any[] = [];
// pagination variable details
length = 50;
pageIndex = 0;
pageSize = 10;
pageEvent: PageEvent;
// data source variable details
pdListData = null;
public dataLength: number;
public dataSource = new MatTableDataSource();
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
pdList:any[] = [];
tiles: any[] = [{
text: 'One',
cols: 3,
rows: 1,
color: 'lightblue'
}, {
text: 'Two',
cols: 1,
rows: 1,
color: 'lightgreen'
}, {
text: 'Three',
cols: 1,
rows: 1,
color: 'lightpink'
}, {
text: 'Four',
cols: 2,
rows: 1,
color: '#DDBDF1'
}];
dogs: Object[] = [{
name: 'Porter',
human: 'Kara'
}, {
name: 'Mal',
human: 'Jeremy'
}, {
name: 'Koby',
human: 'Igor'
}, {
name: 'Razzle',
human: 'Ward'
}, {
name: 'Molly',
human: 'Rob'
}, {
name: 'Husi',
human: 'Matias'
}];
basicRowHeight = 80;
fixedCols = 4;
fixedRowHeight = 50;
ratioGutter = 1;
fitListHeight = '400px';
ratio = '8:1';
addTileCols() {
this.tiles[2].cols++;
}
constructor(private _pd: PdTrigerService) {
}
ngOnInit() {
this.recordStatus=false
this.showParentComponent=true
this.showAddComponent=false
this.showEditComponent=false
this.showViewComponent=false
this.showMapViewComponent=false
this._pd.getPdDetails()
.subscribe(
data => {
if (data.status == 200) {
this.pdList = data.records;
this.pdListData = data.records;
this.dataLength = data.records.length;
this.dataSource.data = this.pdListData;
}
else{
this.pdList=[];
this.dataLength = null;
this.recordStatus=true;
}
}, error => this.errorMessage = <any> error);
}
addPdDetails(){
this.showParentComponent=false
this.showEditComponent=false
this.showViewComponent=false
this.showAddComponent=!this.showAddComponent
}
editPdDetails(editID:string){
this.showParentComponent=false
this.showAddComponent=false
this.showViewComponent=false
this.showEditComponent=!this.showEditComponent
this.parentEditData=editID
}
viewPdDetails(editID:string){
this.showParentComponent=false
this.showAddComponent=false
this.showEditComponent=false
this.showViewComponent=!this.showViewComponent
this.parentViewData=editID
}
viewMapPdDetails(){
this.showParentComponent=false
this.showAddComponent=false
this.showEditComponent=false
this.showMapViewComponent=!this.showMapViewComponent;
}
updateParentComponent(event:string) {
this.showParentComponent=!this.showParentComponent
if(event=='1'){
this.showAddComponent=!this.showAddComponent
}
else if(event=='2'){
this.showEditComponent=!this.showEditComponent
}
else if(event=='3'){
this.showViewComponent=!this.showViewComponent
}
this._pd.getPdDetails()
.subscribe(
data => {
if (data.status == 200) {
this.pdList = data.records;
this.pdListData = data.records;
this.dataLength = data.records.length;
this.dataSource.data = this.pdListData;
}
else{
this.pdList=[];
this.dataLength = null;
this.recordStatus=true;
}
}, error => this.errorMessage = <any> error);
}
pageChange(e) {
console.log(e);
}
}

View File

@ -1,213 +0,0 @@
<div fxLayout="row">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="mb-2" >
<mat-card-header>
<!-- <img mat-card-avatar src="assets/images/avatar.jpg"> -->
<mat-card-title>Search Options</mat-card-title>
<mat-card-subtitle>Header subtitle</mat-card-subtitle>
</mat-card-header>
<!-- <img mat-card-image src="assets/images/coridoor.jpg"> -->
<mat-card-content>
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="33.33" fxFlex.lg="33.33" fxFlex.xl="33.33">
<!-- <mat-card class="mb-2" >
<mat-card-content> -->
<!-- <mat-list dense>
<mat-list-item > -->
<!-- <img mat-list-avatar src="assets/images/lime.jpg" alt=""> -->
<!-- <h3 mat-line>Icci</h3>
<p mat-line>9159996676</p> -->
<!-- <h3 mat-line>{{details.applicat_details[0].applicant_name}} </h3>
<p mat-line><span style="padding-right: 7%;">{{details.lender_full_name}} </span><span style="padding-right: 7%">{{details.lender_applicant_id}}</span></p>
<p mat-line> {{details.pd_date_of_initiation}}</p> -->
<!-- <mat-card class="mb-2" *ngFor="let details of dataSource.connect() | async">
<mat-card-title>{{details.applicat_details[0].applicant_name}}</mat-card-title>
<mat-card-subtitle >{{details.applicat_details[0].applicant_name}}</mat-card-subtitle>
<mat-card-content>
<p mat-line class="hover-icon"><i class="fa-1x fa fa-map-rupee"> </i> &nbsp;{{details.loan_amount}}</p>
<p mat-line class="hover-icon"><i class="fa-1x fa fa-map-marker"> </i> &nbsp;{{details.city_name}}/{{details.state_name}}-{{details.pincode}}</p>
</mat-card-content>
<hr>
<mat-card-actions>
<button mat-button color="accent">Action</button>
<button mat-button>Cancel</button>
</mat-card-actions>
</mat-card> -->
<mat-expansion-panel *ngFor="let details of dataSource.connect() | async">
<mat-expansion-panel-header>
<mat-panel-title>
<b> {{details.applicat_details[0].applicant_name}} </b>
</mat-panel-title>
<mat-panel-description>
{{details.product_abbr}}/{{details.subproduct_abbr}}
</mat-panel-description>
</mat-expansion-panel-header>
<p mat-line>Lendor ID:{{details.lender_applicant_id}}</p>
<p mat-line>Lendor Name:{{details.lender_full_name}}</p>
<p mat-line>Date Of Initiation:{{details.pd_date_of_initiation}}</p>
<p mat-line class="hover-icon"><i class="fa-1x fa fa-rupee">&nbsp;</i>{{details.loan_amount}}
</p>
<p mat-line>
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="pdAllocationTo(master)"><mat-icon>directions_run</mat-icon></button>
</p>
</mat-expansion-panel>
<!-- <p mat-line><a style="padding-right: 7%;">{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}}</a><a style="padding-right: 7%;"><span class="hover-icon"><i class="fa-1x fa fa-rupee">&nbsp;</i>{{details.loan_amount}}</span></a><span class="hover-icon"><i class="fa-1x fa fa-map-marker"> </i> &nbsp;{{details.city_name}}/{{details.state_name}}-{{details.pincode}}</span></p> -->
<!-- <mat-divider></mat-divider>
</mat-list-item>
</mat-list> -->
<mat-list *ngIf="recordStatus">
<mat-list-item>
<p mat-line>No Record Found ...</p>
</mat-list-item>
</mat-list>
<!-- </mat-card-content> -->
<!-- <mat-card-actions *ngIf="!recordStatus"> -->
<mat-paginator #paginator [length]="pdList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25, 100]" (page)="pageEvent = $event; pageChange($event)">
</mat-paginator>
<!-- </mat-card-actions>
</mat-card> -->
</div>
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="66.66" fxFlex.lg="66.66" fxFlex.xl="66.66">
<mat-card class="mb-2">
<agm-map [latitude]="lat" [longitude]="lng">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map>
</mat-card>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
<div fxLayout="row">
<div align="right">
<button mat-fab class="mr-1 mb-1" color="accent"><mat-icon>close</mat-icon></button>
</div>
<mat-card>
<mat-tab-group>
<mat-tab>
<ng-template mat-tab-label>All</ng-template>
<mat-card-content>
<div class="card-comment-widget">
<mat-list *ngIf="pdList.length > 0">
<mat-list-item *ngFor="let details of dataSource.connect() | async">
<img mat-list-avatar src="assets/images/lime.jpg" alt="">
<!-- {{details.applicat_details[0].applicant_name}} -->
<p mat-line>{{details.applicat_details[0].applicant_name}} </p>
<p mat-line><a style="padding-right: 7%;">{{details.lender_full_name}} </a><a style="padding-right: 7%">{{details.lender_applicant_id}}</a>{{details.pd_date_of_initiation}}</p>
<p mat-line><a style="padding-right: 7%;">{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}}</a><a style="padding-right: 7%;"><span class="hover-icon"><i class="fa-1x fa fa-rupee">&nbsp;</i>{{details.loan_amount}}</span></a><span class="hover-icon"><i class="fa-1x fa fa-map-marker"> </i> &nbsp;{{details.city_name}}/{{details.state_name}}-{{details.pincode}}</span></p>
<!-- <span class="text-mat mat-text-muted">Chennai</span> -->
<!-- <div class="comment-time">
<button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" type="button" color="primary" (click)="editPdDetails(details.pd_id)"><mat-icon>edit</mat-icon></button>
</div> -->
<div class="comment-time">
<!-- <button mat-raised-button mat-icon-button mat-button-sm class="mr-1 mb-1" color="accent" type="button" (click)="viewPdDetails(details.pd_id)"><mat-icon>visibility</mat-icon></button> -->
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="viewPdDetails(details.pd_id)"><mat-icon>visibility</mat-icon></button>
</div>
</mat-list-item>
<hr>
</mat-list>
<mat-list *ngIf="recordStatus">
<mat-list-item>
<p mat-line>No Record Found ...</p>
</mat-list-item>
</mat-list>
</div>
</mat-card-content>
<mat-card-actions *ngIf="!recordStatus">
<mat-paginator #paginator class="mat-elevation-z1" [length]="pdList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25, 100]" (page)="pageEvent = $event; pageChange($event)">
</mat-paginator>
</mat-card-actions>
</mat-tab>
<!-- <mat-tab>
<ng-template mat-tab-label>Confirmed PD Details</ng-template>
<mat-card-content>
<mat-grid-list cols="2" [rowHeight]="ratio" gutterSize="4px">
<mat-grid-tile *ngFor="let tile of tiles" [style.background]="'lightblue'">
{{tile.text}}
</mat-grid-tile>
</mat-grid-list>
<div fxLayout="row" fxLayoutAlign="start center" class="mt-2">
<mat-form-field>
<input matInput placeholder="Change ratio" [(ngModel)]="ratio">
</mat-form-field>
</div>
</mat-card-content>
</mat-tab>-->
<mat-tab>
<ng-template mat-tab-label>In Progress </ng-template>
<mat-card-content>
<!--<mat-grid-list cols="2" rowHeight="fit" [gutterSize]="ratioGutter"
[style.height]="fitListHeight">
<mat-grid-tile *ngFor="let tile of tiles" [style.background]="'#F1EBBA'">
{{tile.text}}
</mat-grid-tile>
</mat-grid-list>
<div fxLayout="row" fxLayoutAlign="start center" class="mt-2">
<mat-form-field>
<input matInput placeholder="Change list height" [(ngModel)]="fitListHeight">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Change gutter" type="number" [(ngModel)]="ratioGutter">
</mat-form-field>
</div>-->
</mat-card-content>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label>Scheduled </ng-template>
<mat-card-content>
<!--<mat-grid-list cols="2" rowHeight="fit" [gutterSize]="ratioGutter"
[style.height]="fitListHeight">
<mat-grid-tile *ngFor="let tile of tiles" [style.background]="'#F1EBBA'">
{{tile.text}}
</mat-grid-tile>
</mat-grid-list>
<div fxLayout="row" fxLayoutAlign="start center" class="mt-2">
<mat-form-field>
<input matInput placeholder="Change list height" [(ngModel)]="fitListHeight">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Change gutter" type="number" [(ngModel)]="ratioGutter">
</mat-form-field>
</div>-->
</mat-card-content>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label>Completed </ng-template>
<mat-card-content>
<!--<mat-grid-list cols="2" rowHeight="fit" [gutterSize]="ratioGutter"
[style.height]="fitListHeight">
<mat-grid-tile *ngFor="let tile of tiles" [style.background]="'#F1EBBA'">
{{tile.text}}
</mat-grid-tile>
</mat-grid-list>
<div fxLayout="row" fxLayoutAlign="start center" class="mt-2">
<mat-form-field>
<input matInput placeholder="Change list height" [(ngModel)]="fitListHeight">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Change gutter" type="number" [(ngModel)]="ratioGutter">
</mat-form-field>
</div>-->
</mat-card-content>
</mat-tab>
</mat-tab-group>
</mat-card>
</div>

View File

@ -1,54 +0,0 @@
import { Component, ViewChild, OnInit } from '@angular/core';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../pd-service/pd-triger.service';
@Component({
selector: 'app-map-pd-view',
templateUrl: './map-pd-view.component.html',
styleUrls: ['./map-pd-view.component.scss']
})
export class MapPdViewComponent implements OnInit {
lat = -34.397;
lng = 150.644;
recordStatus: boolean;
errorMessage: any;
// pagination variable details
length = 50;
pageIndex = 0;
pageSize = 10;
pageEvent: PageEvent;
// data source variable details
pdListData = null;
public dataLength: number;
public dataSource = new MatTableDataSource();
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
pdList:any[] = [];
constructor(private _pd: PdTrigerService) {
}
ngOnInit() {
this.recordStatus=false
this._pd.getPdDetails()
.subscribe(
data => {
if (data.status == 200) {
this.pdList = data.records;
this.pdListData = data.records;
this.dataLength = data.records.length;
this.dataSource.data = this.pdListData;
}
else{
this.pdList=[];
this.dataLength = null;
this.recordStatus=true;
}
}, error => this.errorMessage = <any> error);
}
}

View File

@ -1,43 +0,0 @@
<div style="max-height: 480px;">
<mat-card style="width: 580px; padding: 2px;">
<mat-card-header>
<mat-card-title>{{pageTitle}}</mat-card-title>
</mat-card-header>
<mat-card-content>
<!-- <form [formGroup]="_pdAllocationForm" (submit)="onSubmit()"> -->
<mat-list *ngIf="pdOfficerList.length > 0">
<mat-list-item *ngFor="let officer of pdOfficerList">
<p><mat-radio-button (change)="selectPdOfficer(officer)"></mat-radio-button>
{{officer.first_name}}
</p>
<p style="padding-left: 8%;">
<span matBadge="{{officer.allocated}}" matBadgeOverlap="false" matBadgeColor="accent">Allocated</span>
</p>
<p style="padding-left: 8%;">
<span matBadge="{{officer.scheduled}}" matBadgeOverlap="false" >Scheduled</span>
</p>
<p style="padding-left: 8%;">
<span matBadge="{{officer.inprogress}}" matBadgeOverlap="false" matBadgeColor="warn">Inprogress</span>
</p>
</mat-list-item>
</mat-list>
<mat-list *ngIf="pdOfficerList.length == 0">
<mat-list-item>
<p>PD officer not available..</p>
</mat-list-item>
</mat-list>
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"
(click)="closeAllocationComponent()"><mat-icon>close</mat-icon></button>
<button mat-raised-button mat-icon-button (click)="updatePdOfficer(selectedItem)" class="mr-1 mb-1 hover-icon" type="button"><mat-icon>save</mat-icon></button>
</div>
<!-- </form> -->
</mat-card-content>
</mat-card>
</div>
<notifier-container></notifier-container>

View File

@ -1,3 +0,0 @@
.example-full-width{
width: 100%;
}

View File

@ -1,90 +0,0 @@
import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../pd-service/pd-triger.service';
@Component({
selector: 'app-pd-allocation',
templateUrl: './pd-allocation.component.html',
styleUrls: ['./pd-allocation.component.scss']
})
export class PdAllocationComponent implements OnInit {
public pageTitle: string = "PD Allocation To";
public _pdAllocationForm: FormGroup;
public pdOfficerList: any = [];
errorMessage: any;
notifier : NotifierService;
selectedItem:any;
isDisabled: boolean;
constructor( notifier: NotifierService,
private _fb: FormBuilder,
private dialogRef: MatDialogRef<PdAllocationComponent>,
private _pd: PdTrigerService,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.notifier=notifier;
}
ngOnInit() {
this.isDisabled=true;
this.getPDOfficerList(this.data.pd_id);
// this._pdAllocationForm = this._fb.group({
// pd_primary_id: [null],
// allocation_id: [null],
// });
}
// convenience getter for easy access to form fields
// get readForm() { return this._pdAllocationForm.controls; }
// pd officer list
getPDOfficerList(pdID:string){
this._pd.getPdOfficerList(pdID).subscribe(
data => {
if (data.status == 200) {
this.pdOfficerList=data.records;
}
}, error => this.errorMessage = <any> error);
}
// select pd officer list
selectPdOfficer(selected:any){
this.isDisabled=false;
this.selectedItem=selected;
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
/** To update pd officer*/
updatePdOfficer(allocateDate:any) {
if(this.isDisabled){
this.notifier.notify('warning', 'Please Choose PD Officer.!');
}
else {
let updateData = {
"pd_id":this.data.pd_id,
"fk_pd_allocated_to":allocateDate.fk_user_id,
}
this._pd.updatePdOfficer(updateData).subscribe(
result => {
if (result.status == 200) {
this.notifier.notify('success', 'PD Allocated.!');
this.dialogRef.close();
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.errorMessage = "Something Wents Wrong Try Again.!";
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
// this.dialogRef.close();
});
}
}
/** For Popup Close Button */
closeAllocationComponent(): void {
this.dialogRef.close();
}
}

View File

@ -1,19 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ListPdComponent } from './list-pd/list-pd.component';
import { AddPdComponent } from './add-pd/add-pd.component';
export const PdTrigerRoutes: Routes = [
{
path: '',
component: ListPdComponent
// children:
// [{
// path: 'pdtriggerlist',
// component: AddPdComponent
// }]
}
];

View File

@ -1,13 +0,0 @@
import { PdTrigerModule } from './pd-triger.module';
describe('PdTrigerModule', () => {
let pdTrigerModule: PdTrigerModule;
beforeEach(() => {
pdTrigerModule = new PdTrigerModule();
});
it('should create an instance', () => {
expect(pdTrigerModule).toBeTruthy();
});
});

View File

@ -1,91 +0,0 @@
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="loadPdListCompoent()"><mat-icon>close</mat-icon></button>
</div>
<div *ngIf="!showEditMasterComponent">
<mat-card *ngFor="let master of pdMasterData">
<div class="cardEdit">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="pdAllocationTo(master)"><mat-icon>directions_run</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"><mat-icon>schedule</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdMaster(master)"><mat-icon>edit</mat-icon></button>
</div>
<mat-card-header>
<img mat-card-avatar src="assets/images/avatar.jpg">
<mat-card-title>{{master.lender_full_name}} - {{master.lender_applicant_id}}
</mat-card-title>
<mat-card-subtitle class="hover-icon"><i class="fa-1x fa fa-map-marker"> </i> &nbsp;<span>{{master.city_name}} / {{master.state_name}}-{{master.pincode}}</span></mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<p>{{master.product_name}} / {{master.subproduct_name}}</p>
<p><span>{{master.pd_type_name}}&nbsp;&nbsp;&nbsp;{{master.pd_allocation_type_name}} &nbsp;&nbsp;&nbsp;{{master.pd_allocated_to}}</span></p>
<p><span>{{master.addressline1}}</span></p>
<p><span>{{master.addressline2}}</span></p>
<p><span>{{master.addressline3}}</span></p>
<p><span class="hover-icon"><i class="fa-1x fa fa-rupee">&nbsp;</i>{{master.loan_amount}}</span> &nbsp;&nbsp;&nbsp;<span>{{master.pd_status_name}}</span>&nbsp;&nbsp;&nbsp;<span>{{master.pd_date_of_initiation}}</span></p>
</mat-card-content>
</mat-card>
</div>
<app-edit-pd-master *ngIf="showEditMasterComponent" [masterChild]="editMasterData" (loadPdView)="updateViewComponent($event)"></app-edit-pd-master>
<!-- applicant card -->
<mat-card *ngIf="!showEditApplicantComponent">
<div class="cardEdit">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="editPdApplicant(pdApplicantData)"><mat-icon>edit</mat-icon></button>
</div>
<mat-card-header>
<mat-card-title>Applicants</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-list *ngFor="let applicant of pdApplicantData">
<mat-list-item>
<p><span *ngIf="applicant.applicant_name!=null" class="mb-2 text-center hover-icon">
<i class="fa-1x fa fa-user-o"></i>
&nbsp;{{applicant.applicant_name}} </span> &nbsp;&nbsp;&nbsp;<span *ngIf="applicant.mobile_no!=null" class="mb-2 text-center hover-icon">
<i class="fa-1x fa fa-phone"></i>
&nbsp;{{applicant.mobile_no}} </span> &nbsp;&nbsp;&nbsp;<span *ngIf="applicant.applicant_type=='1';else codetails"> Main Applicant</span>
<ng-template #codetails>&nbsp;&nbsp;&nbsp;<span>{{applicant.relation}}</span></ng-template>
</p>
</mat-list-item>
</mat-list>
</mat-card-content>
</mat-card>
<app-edit-pd-applicant *ngIf="showEditApplicantComponent" [applicantChild]="editApplicantData" (loadPdView)="updateViewComponent($event)"></app-edit-pd-applicant>
<!-- pd documents details -->
<mat-card>
<!-- <div class="cardEdit">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon"><mat-icon>edit</mat-icon></button>
</div> -->
<mat-card-header>
<mat-card-title>Documents</mat-card-title>
<!-- <mat-card-subtitle><i class="fa-1x fa fa-map-marker"> </i> &nbsp;{{master.city_name}} / {{master.state_name}}-{{master.pincode}}</mat-card-subtitle> -->
</mat-card-header>
<mat-list *ngFor="let documents of pdDocumentsData">
<mat-list-item>
<p><span>
{{documents.pd_document_title}} </span> &nbsp;&nbsp;&nbsp;<span class="mb-2 text-center hover-icon">
<i class="fa-1x fa fa-file"></i>
&nbsp;{{documents.pd_document_name}} </span>
</p>
</mat-list-item>
</mat-list>
</mat-card>
<!-- pd logs card -->
<mat-card>
<mat-card-header>
<mat-card-title>PD History</mat-card-title>
</mat-card-header>
<mat-card-content>
</mat-card-content>
</mat-card>
<notifier-container></notifier-container>

View File

@ -1,3 +0,0 @@
.cardEdit {
display: inline;float:right;padding-top:3%;
}

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ViewPdComponent } from './view-pd.component';
describe('ViewPdComponent', () => {
let component: ViewPdComponent;
let fixture: ComponentFixture<ViewPdComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewPdComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ViewPdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,92 +0,0 @@
import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { MatDialog } from '@angular/material';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../pd-service/pd-triger.service';
import { PdAllocationComponent } from '../pd-allocation/pd-allocation.component';
@Component({
selector: 'app-view-pd',
templateUrl: './view-pd.component.html',
styleUrls: ['./view-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class ViewPdComponent implements OnInit {
private notifier:NotifierService;
errorMessage: any;
pdMasterData: any;
pdApplicantData: any;
pdDocumentsData: any;
pdLogsData: any;
editMasterData: any[];
editApplicantData: any[];
showEditMasterComponent: boolean;
showEditApplicantComponent: boolean;
showEditDocumentComponent: boolean;
@Input() childData: string;
@Output() loadParent = new EventEmitter<string>();
public _EditPDtriggerForm:FormGroup;
constructor(notifier:NotifierService,private dialog: MatDialog,private _fb: FormBuilder,
private _pd: PdTrigerService) {
this.notifier=notifier
}
ngOnInit() {
this.viewPdDetails(this.childData);
this.showEditMasterComponent=false;
this.showEditApplicantComponent=false;
this.showEditDocumentComponent=false;
}
viewPdDetails(editID:string){
this._pd.editPdDetails(editID).subscribe(
data => {
if (data.status == 200) {
this.pdMasterData=data.records.pd_master_details;
this.pdApplicantData= data.records.applicants_details;
this.pdDocumentsData=data.records.pd_documnets;
this.pdLogsData=data.records.pd_logs;
}
}, error => this.errorMessage = <any> error);
}
loadPdListCompoent() {
this.loadParent.emit('3')
}
editPdMaster(masterData:any){
this.editMasterData=masterData;
this.showEditMasterComponent=!this.showEditMasterComponent;
}
editPdApplicant(applicantData:any){
this.editApplicantData=applicantData;
this.showEditApplicantComponent=!this.showEditApplicantComponent;
}
// pd allocation to
// edit questions master details popup model
pdAllocationTo(pdID:any) {
const dialogRef = this.dialog.open(PdAllocationComponent, {
data: pdID,
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
this.viewPdDetails(this.childData)
});
}
updateViewComponent(editBack:string) {
if(editBack=='1'){
this.showEditMasterComponent=!this.showEditMasterComponent
}
else if(editBack=='2'){
this.showEditApplicantComponent=!this.showEditApplicantComponent
}
else if(editBack=='3'){
this.showEditMasterComponent=!this.showEditMasterComponent
}
this.viewPdDetails(this.childData);
}
}

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { GetGeometricLocationService } from './get-geometric-location.service';
describe('GetGeometricLocationService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: GetGeometricLocationService = TestBed.get(GetGeometricLocationService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,24 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';//for Datatables
import { Http } from '@angular/http';
@Injectable()
export class GetGeometricLocationService {
MAP_API_KEY: string;
MAP_API_URL: string;
constructor(private _http: Http) {
this.MAP_API_KEY = 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'
this.MAP_API_URL = `https://maps.googleapis.com/maps/api/geocode/json?key=${this.MAP_API_KEY}&address=`;
}
findLocations(address:string, postalCode?: string,state?:string, city?: string): Observable<any> {
let compositeAddress = [address];
if (postalCode) compositeAddress.push(postalCode);
if (state) compositeAddress.push(state);
if (city) compositeAddress.push(city);
let url = `${this.MAP_API_URL}${compositeAddress.join(',')}`;
return this._http.get(url).map(response => <any> response.json());
}
}

View File

@ -229,7 +229,7 @@
<mat-card-actions style="text-align: right">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button"
(click)="loadPdListCompoent()"><mat-icon>close</mat-icon></button>
(click)="loadPdListCompoent(cancelStatus)"><mat-icon>close</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit"><mat-icon>save</mat-icon></button>
</mat-card-actions>
</form>

View File

@ -1,17 +1,20 @@
import { Component, OnInit, ViewEncapsulation, Output, EventEmitter } from '@angular/core';
import { Component, OnInit, ViewEncapsulation, Output, EventEmitter, OnDestroy } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { CustomValidators } from 'ng2-validation';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../pd-service/pd-triger.service';
import { AwsService } from '../../AwsService/aws.service';
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
import { ListPdComponent } from '../list-pd.component';
import { AwsService } from '../../../../AwsService/aws.service';
@Component({
selector: 'app-add-pd',
templateUrl: './add-pd.component.html',
styleUrls: ['./add-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class AddPdComponent implements OnInit {
@Output() loadParent = new EventEmitter<string>();
export class AddPdComponent implements OnInit, OnDestroy {
//@Output() loadParent = new EventEmitter<string>();
cancelStatus: boolean;
private notifier: NotifierService;
public _PDtriggerForm: FormGroup;
items: FormArray;
@ -31,14 +34,16 @@ export class AddPdComponent implements OnInit {
subAllocationTypeCheck: boolean;
allocationLabel: string;
subAllocationLabel: string;
constructor(notifier: NotifierService,private _fb: FormBuilder,
private _pd: PdTrigerService, private _aws:AwsService) {
constructor(notifier: NotifierService,private _fb: FormBuilder,private route: ActivatedRoute,
private router: Router,private _pd: PdTrigerService, private _aws:AwsService, private ListPdComponent: ListPdComponent) {
this.notifier = notifier;
}
public totalfiles: Array<File> =[];
public totalFileName = [];
public lengthCheckToaddMore =0;
ngOnInit() {
this.cancelStatus = false;
this.ListPdComponent.pdListLoad(false);
this.getLenderList();
this.getProductsList();
this.getCustomerSegmentList();
@ -291,7 +296,7 @@ export class AddPdComponent implements OnInit {
this._pd.addPdDetails(pd_form).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'PD Saved.');
this.loadPdListCompoent();
this.loadPdListCompoent(true);
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
@ -324,7 +329,18 @@ export class AddPdComponent implements OnInit {
this.subAllocationLabel="Load Balance";
}
}
loadPdListCompoent() {
this.loadParent.emit('1')
loadPdListCompoent(from:boolean) {
if(from){
this.router.navigate([ '../../' ], { relativeTo: this.route });
this.ListPdComponent.pdListLoad(true);
}
else{
this.router.navigate([ '../../' ], { relativeTo: this.route });
this.ListPdComponent.showListView(true);
}
}
ngOnDestroy(): void {
this.ListPdComponent.showListView(true);
}
}

View File

@ -1,8 +1,8 @@
<div align="right" *ngIf="showParentComponent">
<button mat-fab class="mr-1 mb-1" color="primary" (click)="addPdDetails()"><mat-icon>add</mat-icon></button>
<button mat-fab class="mr-1 mb-1" color="accent" (click)="viewMapPdDetails()"><mat-icon>navigation</mat-icon></button>
</div>
<mat-card *ngIf="showParentComponent">
<div align="right" *ngIf="viewPdList">
<button mat-raised-button mat-button-sm color="primary" (click)="viewMapPdDetails()" class="mr-1 mb-1"><mat-icon>map</mat-icon>Map List</button>
<button mat-raised-button mat-button-sm color="primary" (click)="addPdDetails()" class="mr-1 mb-1"><mat-icon>add</mat-icon>Add PD</button>
</div>
<mat-card *ngIf="viewPdList">
<mat-tab-group>
<mat-tab>
<ng-template mat-tab-label>All</ng-template>
@ -124,9 +124,6 @@
</mat-tab-group>
</mat-card>
<router-outlet></router-outlet>
<app-edit-pd *ngIf="showEditComponent" [childData]="parentEditData" (loadParent)="updateParentComponent($event)"></app-edit-pd>
<app-add-pd *ngIf="showAddComponent" (loadParent)="updateParentComponent($event)"></app-add-pd>
<app-view-pd *ngIf="showViewComponent" [childData]="parentViewData" (loadParent)="updateParentComponent($event)"></app-view-pd>
<app-map-pd-view *ngIf="showMapViewComponent"></app-map-pd-view>
<notifier-container></notifier-container>

View File

@ -0,0 +1,86 @@
import { Component,ViewChild, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../../pd-service/pd-triger.service';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
@Component({
selector: 'app-list-pd',
templateUrl: './list-pd.component.html',
styleUrls: ['./list-pd.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class ListPdComponent implements OnInit, OnDestroy {
private notifier: NotifierService;
recordStatus: boolean;
viewPdList:boolean;
viewMapPdList:boolean;
errorMessage: any;
// pagination variable details
length = 50;
pageIndex = 0;
pageSize = 10;
pageEvent: PageEvent;
// data source variable details
pdListData = null;
public dataLength: number;
public dataSource = new MatTableDataSource();
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
pdList:any[] = [];
constructor( notifier: NotifierService, private route: ActivatedRoute,
private router: Router, private _pd: PdTrigerService) {
this.notifier = notifier;
}
ngOnInit() {
this.viewPdList = true;
this.recordStatus=false;
this.loadPDDetails();
}
//load pd details
loadPDDetails() {
this._pd.getPdDetails()
.subscribe(
data => {
if (data.status == 200) {
this.pdList = data.records;
this.pdListData = data.records;
this.dataLength = data.records.length;
this.dataSource.data = this.pdListData;
}
else{
this.pdList=[];
this.dataLength = null;
this.recordStatus=true;
}
}, error => this.errorMessage = <any> error);
}
pageChange(e) {
console.log(e);
}
// view pd list in map view
viewMapPdDetails(){
this.viewPdList = !this.viewPdList;
this.router.navigate([ '../pdlist/pdmaplist'], { relativeTo: this.route });
}
// add pd
addPdDetails() {
this.viewPdList = !this.viewPdList;
this.router.navigate([ '../pdlist/addpd'], { relativeTo: this.route });
}
showListView(status: boolean){
this.viewPdList = status;
}
pdListLoad(status: boolean){
this.viewPdList = status;
this.loadPDDetails();
}
ngOnDestroy(): void {
this.viewPdList=false;
}
}

View File

@ -0,0 +1,73 @@
<div fxLayout="row">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<div align="right">
<button mat-raised-button mat-button-sm color="primary" (click)="goList()" class="mr-1 mb-1"><mat-icon>arrow_back</mat-icon>List</button>
</div>
<mat-card class="mb-2" >
<mat-card-header>
<mat-card-title>Search Options</mat-card-title>
<mat-card-subtitle>Header subtitle</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="33.33" fxFlex.lg="33.33" fxFlex.xl="33.33">
<!-- <mat-expansion-panel *ngFor="let details of dataSource.connect() | async">
<mat-expansion-panel-header>
<mat-panel-title>
<b> {{details.applicat_details[0].applicant_name}} </b>
</mat-panel-title>
<mat-panel-description>
{{details.product_abbr}}/{{details.subproduct_abbr}}
</mat-panel-description>
</mat-expansion-panel-header>
<p mat-line>Lendor ID:{{details.lender_applicant_id}}</p>
<p mat-line>Lendor Name:{{details.lender_full_name}}</p>
<p mat-line>Date Of Initiation:{{details.pd_date_of_initiation}}</p>
<p mat-line class="hover-icon"><i class="fa-1x fa fa-rupee">&nbsp;</i>{{details.loan_amount}}
</p>
<p mat-line>
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="pdAllocationTo(master)"><mat-icon>directions_run</mat-icon></button>
</p>
</mat-expansion-panel> -->
<mat-card [style.overflow]="'auto'" [style.height.px]="'500'" *ngIf="pdList.length > 0">
<mat-card class="mb-2" *ngFor="let details of dataSource.connect() | async">
<mat-card-title>{{details.applicat_details[0].applicant_name}}</mat-card-title>
<mat-card-subtitle><p class="hover-icon"><i class="fa-1x fa fa-map-marker">&nbsp;</i>{{details.city_name}}/{{details.state_name}}-{{details.pincode}}</p>
<p>{{details.lender_full_name}}({{details.lender_applicant_id}})</p>
<p>{{details.product_abbr}}/{{details.subproduct_abbr}}/{{details.customer_segment_abbr}}</p>
<p>{{details.pd_date_of_initiation}} <span style="padding-left: 4%;" class="hover-icon"><i class="fa-1x fa fa-rupee">&nbsp;</i>{{details.loan_amount}}</span></p>
</mat-card-subtitle>
<mat-card-actions>
<button mat-raised-button mat-button-sm mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="pdAllocationTo(master)"><mat-icon>directions_run</mat-icon></button>
<!-- <button mat-button>Cancel</button> -->
</mat-card-actions>
</mat-card>
</mat-card>
<mat-list *ngIf="recordStatus">
<mat-list-item>
<p mat-line>No Record Found ...</p>
</mat-list-item>
</mat-list>
<!-- </mat-card-content> -->
<!-- <mat-card-actions *ngIf="!recordStatus"> -->
<mat-paginator #paginator [length]="pdList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25, 100]" (page)="pageEvent = $event; pageChange($event)">
</mat-paginator>
<!-- </mat-card-actions>
</mat-card> -->
</div>
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="66.66" fxFlex.lg="66.66" fxFlex.xl="66.66">
<mat-card class="mb-2" *ngIf="pdList.length > 0">
<agm-map [latitude]="lat" [longitude]="lng">
<agm-marker *ngFor="let getMap of mapDetails" [latitude]="getMap.lat" [longitude]="getMap.lng"></agm-marker>
</agm-map>
</mat-card>
</div>
</mat-card-content>
</mat-card>
</div>
</div>

View File

@ -1,4 +1,4 @@
@import "../../../assets/styles/scss/material.variables";
@import "../../../../../assets/styles/scss/material.variables";
:host {
margin-left: -5px;

View File

@ -0,0 +1,94 @@
import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core';
import { MatPaginator, MatSort, MatTableDataSource, PageEvent } from '@angular/material';
import { ActivatedRoute, Router } from '@angular/router';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
import { GetGeometricLocationService } from '../../../location-service/get-geometric-location.service';
import { ListPdComponent } from '../list-pd.component';
@Component({
selector: 'app-map-pd-view',
templateUrl: './map-pd-view.component.html',
styleUrls: ['./map-pd-view.component.scss']
})
export class MapPdViewComponent implements OnInit, OnDestroy {
lat:string
lng:string
mapDetails:any[] = [];
recordStatus: boolean;
errorMessage: any;
// pagination variable details
length = 50;
pageIndex = 0;
pageSize = 10;
pageEvent: PageEvent;
// data source variable details
pdListData = null;
public dataLength: number;
public dataSource = new MatTableDataSource();
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
pdList:any[] = [];
constructor(private route: ActivatedRoute,
private router: Router,private _pd: PdTrigerService,private _geolocation: GetGeometricLocationService, private ListPdComponent : ListPdComponent) {
}
ngOnInit() {
this.ListPdComponent.showListView(false);
this.recordStatus=false
this._pd.getPdDetails()
.subscribe(
data => {
if (data.status == 200) {
this.pdList = data.records;
this.pdListData = data.records;
this.dataLength = data.records.length;
this.dataSource.data = this.pdListData;
this.getMapViewLocations(this.pdList);
}
else{
this.pdList=[];
this.dataLength = null;
this.recordStatus=true;
}
}, error => this.errorMessage = <any> error);
}
getMapViewLocations(getData:any){
getData.forEach(element => {
this._geolocation.findLocations(element.addressline1,element.pincode,element.state_name,element.city_name)
.subscribe(response => {
if (response.status == 'OK') {
this.lat = response.results[0].geometry.location.lat;
this.lng = response.results[0].geometry.location.lng;
this.mapDetails.push(response.results[0].geometry.location)
}
// else if (response.status == 'ZERO_RESULTS') {
// console.log('geocodingAPIService', 'ZERO_RESULTS', response.status);
// } else {
// console.log('geocodingAPIService', 'Other error', response.status);
// }
});
});
}
pageChange(e) {
console.log(e);
}
// go list view
goList(){
this.ListPdComponent.showListView(true);
this.router.navigate([ '../../' ], { relativeTo: this.route });
}
ngOnDestroy(): void {
this.ListPdComponent.showListView(true);
}
}

View File

@ -0,0 +1,3 @@
<p>
manage-pd works!
</p>

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EditPdComponent } from './edit-pd.component';
import { ManagePdComponent } from './manage-pd.component';
describe('EditPdComponent', () => {
let component: EditPdComponent;
let fixture: ComponentFixture<EditPdComponent>;
describe('ManagePdComponent', () => {
let component: ManagePdComponent;
let fixture: ComponentFixture<ManagePdComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditPdComponent ]
declarations: [ ManagePdComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EditPdComponent);
fixture = TestBed.createComponent(ManagePdComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
template: `
<div>
<router-outlet></router-outlet>
</div>
`
})
export class ManagePdComponent {
}

View File

@ -0,0 +1,13 @@
import { ManagePdModule } from './manage-pd.module';
describe('ManagePdModule', () => {
let managePdModule: ManagePdModule;
beforeEach(() => {
managePdModule = new ManagePdModule();
});
it('should create an instance', () => {
expect(managePdModule).toBeTruthy();
});
});

View File

@ -1,6 +1,5 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import {
MatCardModule,
MatIconModule,
@ -18,20 +17,18 @@ import { FlexLayoutModule } from '@angular/flex-layout';
import { MatTooltipModule } from '@angular/material/tooltip';
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
import 'hammerjs';
import { NotifierModule, NotifierOptions } from 'angular-notifier';
import { AgmCoreModule } from '@agm/core';
import 'hammerjs';
import { PdTrigerRoutes } from './pd-triger-routing.module';
import { AddPdComponent } from './add-pd/add-pd.component';
import { PdTrigerService } from './pd-service/pd-triger.service';
import { ManagePdRoutingModule } from './manage-pd.routing';
import { ListPdComponent } from './list-pd/list-pd.component';
import { EditPdComponent } from './edit-pd/edit-pd.component';
import { ViewPdComponent } from './view-pd/view-pd.component';
import { EditPdMasterComponent } from './edit-pd-master/edit-pd-master.component';
import { EditPdApplicantComponent } from './edit-pd-applicant/edit-pd-applicant.component';
import { PdAllocationComponent } from './pd-allocation/pd-allocation.component';
import { MapPdViewComponent } from './map-pd-view/map-pd-view.component';
import { ManagePdComponent } from './manage-pd.component';
import { MapPdViewComponent } from './list-pd/map-pd-view/map-pd-view.component';
import { AddPdComponent } from '../manage-pd/list-pd/add-pd/add-pd.component';
import { PdTrigerService } from '../pd-service/pd-triger.service';
import { GetGeometricLocationService } from '../location-service/get-geometric-location.service';
/**
* Custom angular notifier options
*/
@ -78,7 +75,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
@NgModule({
imports: [
CommonModule,
RouterModule.forChild(PdTrigerRoutes),
ManagePdRoutingModule,
NotifierModule.withConfig(pdCustomNotifierOptions),
MatCardModule,
MatIconModule,
@ -100,8 +97,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
NgxMatSelectSearchModule,MatTooltipModule, MatExpansionModule,
AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}),
],
declarations: [AddPdComponent, ListPdComponent, EditPdComponent, ViewPdComponent, EditPdMasterComponent, EditPdApplicantComponent, PdAllocationComponent, MapPdViewComponent],
entryComponents:[PdAllocationComponent],
providers: [PdTrigerService]
declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent],
providers: [PdTrigerService, GetGeometricLocationService]
})
export class PdTrigerModule { }
export class ManagePdModule { }

View File

@ -0,0 +1,41 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ManagePdComponent } from './manage-pd.component';
import { ListPdComponent } from './list-pd/list-pd.component';
import { MapPdViewComponent } from './list-pd/map-pd-view/map-pd-view.component';
import { AddPdComponent } from '../manage-pd/list-pd/add-pd/add-pd.component';
/*
* manage pd router
*/
const routes: Routes = [
{
path: '',
component: ManagePdComponent,
children: [
{
path: '',
pathMatch: 'full',
redirectTo: 'pdlist'
},{
path: 'pdlist',
component: ListPdComponent,
children: [
{
path: 'pdmaplist',
component: MapPdViewComponent,
},
{
path: 'addpd',
component: AddPdComponent,
},
]
}
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ManagePdRoutingModule { }

View File

@ -2,7 +2,7 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';//for Datatables
import { HttpClient,HttpParams } from '@angular/common/http';
import { catchError } from 'rxjs/operators';
import { catchError, map } from 'rxjs/operators';
import { of } from 'rxjs';
/** Imported Service Files Are., */
@ -23,9 +23,13 @@ export class PdTrigerService {
//private apiUrl = "http://ssa.sineedge.com/sparqapi/api/";
//private apiUrl = "http://192.168.0.5:9999/AWSEC2/sparqapi/api/";
private apiUrl = "http://ssa.sineedge.com/sparqapi/api/";
MAP_API_KEY: string;
MAP_API_URL: string;
constructor(private _http: HttpClient,
private _aws:AwsService) { }
private _aws:AwsService) {
this.MAP_API_KEY = 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'
this.MAP_API_URL = `https://maps.googleapis.com/maps/api/geocode/json?key=${this.MAP_API_KEY}&address=`;
}
// get add pd master details
getAllMasterDatas(TableName:string): Observable<any> {
return this._http.post<any>(this.apiUrl+'getListOfMaster', { "master_name":TableName })
@ -87,55 +91,54 @@ export class PdTrigerService {
return this._http.get<any>(this.apiUrl+"listLessPDDetails/get")
.pipe(
catchError(this.handleError('operation', []))
)
)
}
// get edit row pd details
editPdDetails(editId:string):Observable<any>{
let httpParams = new HttpParams().set('pdid', editId);
return this._http.post<any>(this.apiUrl+"getFullPDDetails",httpParams)
.pipe(
catchError(this.handleError('operation', []))
)
}
// update pd master details
editPdMasterDetails(editData:any):Observable<any>{
editData.fk_updatedby = this._aws.getlocale();
editData.updatedon = currentdate;
return this._http.post<any>(this.apiUrl+"triggerNewPD",{records:editData})
.pipe(
catchError(this.handleError('operation', []))
)
}
// update pd applicant
updatePdApplicant(editData:any):Observable<any>{
// editData.fk_updatedby = this._aws.getlocale();
// editData.updatedon = currentdate;
return this._http.post<any>(this.apiUrl+"updatePDApplicants",{"pd_applicant_details":editData})
// get edit row pd details
editPdDetails(editId:string):Observable<any>{
let httpParams = new HttpParams().set('pdid', editId);
return this._http.post<any>(this.apiUrl+"getFullPDDetails",httpParams)
.pipe(
catchError(this.handleError('operation', []))
)
catchError(this.handleError('operation', []))
)
}
// update pd master details
editPdMasterDetails(editData:any):Observable<any>{
editData.fk_updatedby = this._aws.getlocale();
editData.updatedon = currentdate;
return this._http.post<any>(this.apiUrl+"triggerNewPD",{records:editData})
.pipe(
catchError(this.handleError('operation', []))
)
}
// update pd applicant
updatePdApplicant(editData:any):Observable<any>{
// editData.fk_updatedby = this._aws.getlocale();
// editData.updatedon = currentdate;
console.log(editData)
return this._http.post<any>(this.apiUrl+"updatePDApplicants",{"pd_applicant_details":editData})
.pipe(
catchError(this.handleError('operation', []))
)
}
// get pd allocation to details
getPdOfficerList(pdID:string): Observable<any> {
return this._http.post<any>(this.apiUrl+"getListPDOfficers",{"pdid":pdID})
.pipe(
catchError(this.handleError('operation', []))
)
}
// update pd officer
updatePdOfficer(updateData: any): Observable<any> {
updateData.fk_updatedby = this._aws.getlocale();
updateData.updatedon = currentdate;
return this._http.post<any>(this.apiUrl+"allocatePD",{"records":updateData})
.pipe(
catchError(this.handleError('operation', []))
)
}
// get pd allocation to details
getPdOfficerList(pdID:string): Observable<any> {
return this._http.post<any>(this.apiUrl+"getListPDOfficers",{"pdid":pdID})
.pipe(
catchError(this.handleError('operation', []))
)
}
// update pd officer
updatePdOfficer(updateData: any): Observable<any> {
updateData.fk_updatedby = this._aws.getlocale();
updateData.updatedon = currentdate;
return this._http.post<any>(this.apiUrl+"allocatePD",{"records":updateData})
.pipe(
catchError(this.handleError('operation', []))
)
}
private handleError<T>(operation = 'operation', result?: T) {
return (error: any): Observable<T> => {

View File

@ -0,0 +1,13 @@
import { PersonalDiscussionModule } from './personal-discussion.module';
describe('PersonalDiscussionModule', () => {
let personalDiscussionModule: PersonalDiscussionModule;
beforeEach(() => {
personalDiscussionModule = new PersonalDiscussionModule();
});
it('should create an instance', () => {
expect(personalDiscussionModule).toBeTruthy();
});
});

View File

@ -0,0 +1,52 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import {
MatCardModule,
MatIconModule,
MatInputModule,
MatRadioModule,
MatButtonModule,MatTableModule,MatPaginatorModule,
MatProgressBarModule,MatDialogModule, MatSortModule,
MatToolbarModule,MatSelectModule, MatListModule, MatGridListModule, MatTabsModule, MatCheckboxModule, MatBadgeModule, MatExpansionModule } from '@angular/material';
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload';
import { TreeModule } from 'angular-tree-component';
import { NgxDatatableModule } from '@swimlane/ngx-datatable';
import { FlexLayoutModule } from '@angular/flex-layout';
import { MatTooltipModule } from '@angular/material/tooltip';
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
import 'hammerjs';
import { ManagePdModule } from './manage-pd/manage-pd.module';
import { personalDiscussionRoutes } from './personal-discussion.routing';
@NgModule({
imports: [
CommonModule,
RouterModule.forChild(personalDiscussionRoutes),
ManagePdModule,
MatCardModule,
MatIconModule,
MatInputModule,
MatRadioModule,
MatTableModule,
MatPaginatorModule,
MatButtonModule,
MatProgressBarModule,
MatToolbarModule,
FlexLayoutModule,
NgxDatatableModule,
FormsModule,MatSlideToggleModule,
MatSelectModule, MatListModule,MatGridListModule, MatTabsModule, MatBadgeModule, MatCheckboxModule,
ReactiveFormsModule,
FileUploadModule,
TreeModule,
MatDialogModule,MatSortModule,
NgxMatSelectSearchModule,MatTooltipModule, MatExpansionModule,
],
declarations: []
})
export class PersonalDiscussionModule { }

View File

@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ManagePdModule } from './manage-pd/manage-pd.module';
export const personalDiscussionRoutes: Routes = [{
path: '',
loadChildren:'./manage-pd/manage-pd.module#ManagePdModule',
// children:[{
// path:'managepd',
// loadChildren:'./manage-pd/manage-pd.module#ManagePdModule'
// }
// ]
}];
// @NgModule({
// imports: [RouterModule.forChild(routes)],
// exports: [RouterModule]
// })
// export class PersonalDiscussionRoutingModule { }

View File

@ -72,7 +72,7 @@ const MENUITEMS : Menu[] = [
},
{
state:'pdtrigger',
state:'personal_discussion',
name:'Personal Discussion',
type:'link',
icon:'forum',