From 37f41d93f16c692ce99f41ca68cfd2e46a8ebe36 Mon Sep 17 00:00:00 2001 From: sriram-at-840620226347 Date: Mon, 18 Nov 2019 19:05:54 +0530 Subject: [PATCH] sales PD List added --- ng6-seed/src/app/app.module.ts | 5 +- ng6-seed/src/app/app.routing.ts | 5 + .../layouts/admin/admin-layout.component.ts | 2 + .../list-pd/add-pd/add-pd.component.ts | 32 ++-- .../edit-pd-master.component.ts | 36 ++--- .../pd-service/pd-triger.service.ts | 15 ++ .../src/app/sales-pd/sales-pd.component.html | 143 ++++++++++++++++++ .../src/app/sales-pd/sales-pd.component.scss | 20 +++ .../app/sales-pd/sales-pd.component.spec.ts | 25 +++ .../src/app/sales-pd/sales-pd.component.ts | 97 ++++++++++++ .../src/app/sales-pd/sales-pd.service.spec.ts | 12 ++ ng6-seed/src/app/sales-pd/sales-pd.service.ts | 9 ++ .../src/app/session/login/login.component.ts | 2 +- .../user-profile/user-profile.component.ts | 2 +- .../menu-items/horizontal-menu-items.ts | 6 + .../src/app/shared/menu-items/menu-items.ts | 6 + 16 files changed, 382 insertions(+), 35 deletions(-) create mode 100644 ng6-seed/src/app/sales-pd/sales-pd.component.html create mode 100644 ng6-seed/src/app/sales-pd/sales-pd.component.scss create mode 100644 ng6-seed/src/app/sales-pd/sales-pd.component.spec.ts create mode 100644 ng6-seed/src/app/sales-pd/sales-pd.component.ts create mode 100644 ng6-seed/src/app/sales-pd/sales-pd.service.spec.ts create mode 100644 ng6-seed/src/app/sales-pd/sales-pd.service.ts diff --git a/ng6-seed/src/app/app.module.ts b/ng6-seed/src/app/app.module.ts index 608970b..79ece1d 100755 --- a/ng6-seed/src/app/app.module.ts +++ b/ng6-seed/src/app/app.module.ts @@ -44,6 +44,8 @@ import { NewPasswordDialog, ForgotPass } from './session/login/login.component'; import { AuthGuard } from './_guard/auth.guard'; import { RoleMenuItemsPipe } from './layouts/role-menu-items.pipe'; import { ResizableModule } from 'angular-resizable-element'; +import { SalesPdComponent } from './sales-pd/sales-pd.component'; +import { PdTrigerService } from './personal-discussion/pd-service/pd-triger.service'; export function HttpLoaderFactory(http: HttpClient) { return new TranslateHttpLoader(http); } @@ -61,7 +63,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { AppComponent, AdminLayoutComponent, AuthLayoutComponent, - NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe, + NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe, SalesPdComponent, ], imports: [ BrowserModule, @@ -103,6 +105,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { }, AwsService,AuthGuard, TranslateService, + PdTrigerService, // { // provide: PERFECT_SCROLLBAR_CONFIG, // useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG diff --git a/ng6-seed/src/app/app.routing.ts b/ng6-seed/src/app/app.routing.ts index e3b79b2..2f736ea 100755 --- a/ng6-seed/src/app/app.routing.ts +++ b/ng6-seed/src/app/app.routing.ts @@ -4,6 +4,7 @@ import { AdminLayoutComponent } from './layouts/admin/admin-layout.component'; import { AuthLayoutComponent } from './layouts/auth/auth-layout.component'; import { CognitoService} from './AwsService/cognito.service'; import { AuthGuard } from './_guard/auth.guard'; +import { SalesPdComponent } from './sales-pd/sales-pd.component'; export const AppRoutes: Routes = [{ path: '', redirectTo: 'personal_discussion', @@ -28,6 +29,10 @@ export const AppRoutes: Routes = [{ path:'quality_check_discussion', loadChildren:'./quality-check/quality-check.module#QualityCheckModule' }, + { + path:'sales-pd-list', + component:SalesPdComponent + }, { path:'reports', loadChildren:'./reports/reports.module#ReportsModule' diff --git a/ng6-seed/src/app/layouts/admin/admin-layout.component.ts b/ng6-seed/src/app/layouts/admin/admin-layout.component.ts index cbe571b..bc35a18 100755 --- a/ng6-seed/src/app/layouts/admin/admin-layout.component.ts +++ b/ng6-seed/src/app/layouts/admin/admin-layout.component.ts @@ -61,6 +61,8 @@ export class AdminLayoutComponent implements OnInit, OnDestroy { if(this.currentUser.dataStatus == true){ this.currentUser = this.currentUser.records[0]; + + localStorage.setItem("LocalSetEntity",this.currentUser.fk_entity_id); this.fullName = this.currentUser.user_first_name +' '+this.currentUser.user_last_name; this.roleName = this.currentUser.role_name; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts index 879c2eb..1af63f6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts @@ -128,7 +128,7 @@ export class AddPdComponent implements OnInit, OnDestroy { //lender_billing: [null], fk_product_id: [null], fk_subproduct_id: [null], - fk_pd_type: [null], + fk_pd_type: ['1'], fk_customer_segment: [null], loan_amount: [null, Validators.compose([Validators.pattern('^[0-9]*$')])], applicant_title_name: [''], @@ -171,21 +171,23 @@ export class AddPdComponent implements OnInit, OnDestroy { this.lenderShortName = lender['short_name']; // console.log(this.lenderShortName); this._PDtriggerForm.controls.pd_branch_id.setValue(null); - - if(this.lenderShortName == 'CLIX'){ - let getProductAbbr = this.productAllList.map(dval => dval.product_abbr); - let ClixProductAbbr = ['BL','LAEP']; - let FilteredAbbr: any = []; - FilteredAbbr = ClixProductAbbr.map(x => { - let findIndex = getProductAbbr.indexOf(x); - return this.productAllList[findIndex]; - }); - this.productList = FilteredAbbr.length > 0 ? FilteredAbbr : this.productAllList; - } - else{ this.productList = this.productAllList; - } + + // if(this.lenderShortName == 'CLIX'){ + + // let getProductAbbr = this.productAllList.map(dval => dval.product_abbr); + // let ClixProductAbbr = ['BL','LAEP']; + // let FilteredAbbr: any = []; + // FilteredAbbr = ClixProductAbbr.map(x => { + // let findIndex = getProductAbbr.indexOf(x); + // return this.productAllList[findIndex]; + // }); + // this.productList = FilteredAbbr.length > 0 ? FilteredAbbr : this.productAllList; + // } + // else{ + // this.productList = this.productAllList; + // } @@ -195,7 +197,7 @@ export class AddPdComponent implements OnInit, OnDestroy { // console.log('this.productList',this.productList); this._PDtriggerForm.controls['fk_product_id'].setValue(''); this._PDtriggerForm.controls['fk_subproduct_id'].setValue(''); - this._PDtriggerForm.controls['fk_pd_type'].setValue(''); + // this._PDtriggerForm.controls['fk_pd_type'].setValue(''); this._PDtriggerForm.controls['fk_customer_segment'].setValue(''); this._PDtriggerForm.controls['loan_amount'].setValue(''); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts index 4a1049e..ae2d01b 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts @@ -168,21 +168,23 @@ export class EditPdMasterComponent implements OnInit { this.lenderShortName = lender['short_name']; // console.log(this.lenderShortName); this._EditPDtriggerForm.controls.pd_branch_id.setValue(null); - - if(this.lenderShortName == 'CLIX'){ - let getProductAbbr = this.productAllList.map(dval => dval.product_abbr); - let ClixProductAbbr = ['BL','LAEP']; - let FilteredAbbr: any = []; - FilteredAbbr = ClixProductAbbr.map(x => { - let findIndex = getProductAbbr.indexOf(x); - return this.productAllList[findIndex]; - }); - this.productList = FilteredAbbr.length > 0 ? FilteredAbbr : this.productAllList; - } - else{ this.productList = this.productAllList; - } + + // if(this.lenderShortName == 'CLIX'){ + + // let getProductAbbr = this.productAllList.map(dval => dval.product_abbr); + // let ClixProductAbbr = ['BL','LAEP']; + // let FilteredAbbr: any = []; + // FilteredAbbr = ClixProductAbbr.map(x => { + // let findIndex = getProductAbbr.indexOf(x); + // return this.productAllList[findIndex]; + // }); + // this.productList = FilteredAbbr.length > 0 ? FilteredAbbr : this.productAllList; + // } + // else{ + // this.productList = this.productAllList; + // } @@ -218,9 +220,9 @@ export class EditPdMasterComponent implements OnInit { return this.productAllList[findIndex]; }); // console.log('FilteredAbbr',FilteredAbbr); - this.productList = FilteredAbbr.length > 0 ? FilteredAbbr : this.productAllList; + // this.productList = FilteredAbbr.length > 0 ? FilteredAbbr : this.productAllList; - // this.productList = this.productAllList; + this.productList = this.productAllList; } else{ this.productList = this.productAllList; @@ -401,14 +403,14 @@ export class EditPdMasterComponent implements OnInit { // console.log(1); this.customerSegmentList = this.customerSegmentAllList.filter(s => (s.customer_segment).includes('Self')); if(this.lenderShortName == 'CLIX' && flag==2 ){ this._EditPDtriggerForm.controls['fk_customer_segment'].setValue('5'); } - this._EditPDtriggerForm.controls['fk_subproduct_id'].setValue(null); + // this._EditPDtriggerForm.controls['fk_subproduct_id'].setValue(null); this.subProductList=[]; this.isSubproductShown = false; break; case 'LAEP': // console.log(2); this.customerSegmentList = this.customerSegmentAllList.filter(s => (s.customer_segment).includes('Self')); - this._EditPDtriggerForm.controls['fk_subproduct_id'].setValue(null); + // this._EditPDtriggerForm.controls['fk_subproduct_id'].setValue(null); if(this.lenderShortName == 'CLIX' && flag==2 ){ this._EditPDtriggerForm.controls['fk_customer_segment'].setValue('5'); } this.subProductList=[]; this.isSubproductShown = false; diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 06b0dff..2bc1967 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -537,6 +537,21 @@ export class PdTrigerService { catchError(this.handleError('operation', [])) ) } + getSalesPd(): Observable { + var value= localStorage.getItem('LocalSetEntity') + console.log('555',value); + return this._http.get(this.apiUrl + "listSalesPD/" + value) + .pipe( + catchError(this.handleError('operation', [])) + ) + } + getSalesPdpdf(pdfdetail): Observable { + return this._http.get(this.apiUrl + "downloadSalesPDReport/" + pdfdetail) + .pipe( + catchError(this.handleError('operation', [])) + ) + } + /* To get TypeofActivity's Product From About Business, diff --git a/ng6-seed/src/app/sales-pd/sales-pd.component.html b/ng6-seed/src/app/sales-pd/sales-pd.component.html new file mode 100644 index 0000000..3969d5b --- /dev/null +++ b/ng6-seed/src/app/sales-pd/sales-pd.component.html @@ -0,0 +1,143 @@ + +
+
+ + + +
+
+ + + Sales PD + + + + + + + filter_list + + Advance Filter + + + + + + + +
+ + + + + {{details.sales_pd_id}} + + + + + + -- + + + {{details.applicant_name}} +
+ {{details.applicant_id}} +
+
+ + + {{details.short_name}} + + + + + {{details.abbr}} + + + + + + -- + + + {{details.officer_name}} + + + + + + {{details.createdon | date: 'dd/MM/yyyy'}} + + + + + + + + + +
+ +
+ + + + +
+
+
\ No newline at end of file diff --git a/ng6-seed/src/app/sales-pd/sales-pd.component.scss b/ng6-seed/src/app/sales-pd/sales-pd.component.scss new file mode 100644 index 0000000..51db574 --- /dev/null +++ b/ng6-seed/src/app/sales-pd/sales-pd.component.scss @@ -0,0 +1,20 @@ +.ic-change:hover { + transform: scale(1.1); + color: green; +} +.cell{ + display:inline !important; + text-align: center !important; +} +.cellhide{ + display: none !important; +} +.center{ + text-align:center; +} +.fontsize{ + font-size:14px; +} +.toolbar-space { + flex: 0.01 0 auto; +} diff --git a/ng6-seed/src/app/sales-pd/sales-pd.component.spec.ts b/ng6-seed/src/app/sales-pd/sales-pd.component.spec.ts new file mode 100644 index 0000000..60fd919 --- /dev/null +++ b/ng6-seed/src/app/sales-pd/sales-pd.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SalesPdComponent } from './sales-pd.component'; + +describe('SalesPdComponent', () => { + let component: SalesPdComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SalesPdComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SalesPdComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/sales-pd/sales-pd.component.ts b/ng6-seed/src/app/sales-pd/sales-pd.component.ts new file mode 100644 index 0000000..e5f168c --- /dev/null +++ b/ng6-seed/src/app/sales-pd/sales-pd.component.ts @@ -0,0 +1,97 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatTableDataSource, MatPaginator, MatSort, PageEvent } from '@angular/material'; +import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service'; +import { UserService } from 'app/settings/service/user.service'; + +@Component({ + selector: 'app-sales-pd', + templateUrl: './sales-pd.component.html', + styleUrls: ['./sales-pd.component.scss'] +}) +export class SalesPdComponent implements OnInit { + public dataLengthTab4: number; + public dataSourceTab4 = new MatTableDataSource(); + + displayedColumns = ['SalesPdId','Applicant Name','Short Name','Abbr','Officer Name','Create On','Action']; + + @ViewChild(MatPaginator) paginator: MatPaginator; + @ViewChild(MatSort) sort: MatSort; + + // data source variable details + salesPdData:any[] = []; + salesPdpdf:any[] = []; + + errorMessage:any[]=[]; + recordStatus: boolean; + + xpandStatus: boolean = false; + + // pagination variable details + length = 5; + pageIndex = 0; + pageSize = 10; + pageEvent: PageEvent; + todaydate:Date = new Date(); + + constructor(private _pdSales: PdTrigerService,private userService:UserService) { } + + ngOnInit() { + this.loadSalesPDDetails(); + // this.salesPDpdf(); + } + + + + loadSalesPDDetails() { + this._pdSales.getSalesPd() + .subscribe( + data => { + if (data.status == 200) { + this.salesPdData = data.records; + this.dataLengthTab4 = data.records.length; + this.dataSourceTab4.data = this.salesPdData; + } + else{ + this.salesPdData=[]; + this.dataLengthTab4= null; + this.recordStatus=true; + } + } + // , error => this.errorMessage = error); + ,error => { + this.errorMessage.push(error); + // this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); + alert(error.html_format); + }); + } + + salesPDpdf(pdfdetail){ + this._pdSales.getSalesPdpdf(pdfdetail) + .subscribe( + data => { + if (data.status == 200) { + // window.location.href=data.records; + window.open(data.records, '_blank'); + } + + } + // , error => this.errorMessage = error); + ,error => { + this.errorMessage.push(error); + // this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); + alert(error.html_format); + }); + + } + pageChange(e) { + console.log(e); + } + ngAfterViewInit() { + this.dataSourceTab4.paginator = this.paginator; + this.dataSourceTab4.sort = this.sort; + } + + applyFilter(filterValue: string) { + this.dataSourceTab4.filter = filterValue.trim().toLowerCase(); + } +} diff --git a/ng6-seed/src/app/sales-pd/sales-pd.service.spec.ts b/ng6-seed/src/app/sales-pd/sales-pd.service.spec.ts new file mode 100644 index 0000000..3371d18 --- /dev/null +++ b/ng6-seed/src/app/sales-pd/sales-pd.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { SalesPdService } from './sales-pd.service'; + +describe('SalesPdService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: SalesPdService = TestBed.get(SalesPdService); + expect(service).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/sales-pd/sales-pd.service.ts b/ng6-seed/src/app/sales-pd/sales-pd.service.ts new file mode 100644 index 0000000..1ea766a --- /dev/null +++ b/ng6-seed/src/app/sales-pd/sales-pd.service.ts @@ -0,0 +1,9 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class SalesPdService { + + constructor() { } +} diff --git a/ng6-seed/src/app/session/login/login.component.ts b/ng6-seed/src/app/session/login/login.component.ts index 6758559..d0f918b 100755 --- a/ng6-seed/src/app/session/login/login.component.ts +++ b/ng6-seed/src/app/session/login/login.component.ts @@ -140,7 +140,7 @@ const confirmPassword = new FormControl('', CustomValidators.equalTo(newpassword - Passwords do not math. + Passwords do not match.
diff --git a/ng6-seed/src/app/settings/users/user-profile/user-profile.component.ts b/ng6-seed/src/app/settings/users/user-profile/user-profile.component.ts index 89081d5..05d865c 100755 --- a/ng6-seed/src/app/settings/users/user-profile/user-profile.component.ts +++ b/ng6-seed/src/app/settings/users/user-profile/user-profile.component.ts @@ -98,7 +98,7 @@ export class UserProfileComponent implements OnInit { - Passwords do not math. + Passwords do not match.
diff --git a/ng6-seed/src/app/shared/menu-items/horizontal-menu-items.ts b/ng6-seed/src/app/shared/menu-items/horizontal-menu-items.ts index 65cfbd7..4c0016c 100755 --- a/ng6-seed/src/app/shared/menu-items/horizontal-menu-items.ts +++ b/ng6-seed/src/app/shared/menu-items/horizontal-menu-items.ts @@ -38,6 +38,12 @@ const HORIZONTALMENUITEMS = [ // {state:'pdtriggerlist',name:'Pd Trigger Listing'} // ] }, + { + state:'sales-pd-list', + name:'Sales PD', + type:'link', + icon:'work', + }, // { // state:'quality_check_discussion', // name:'Quality Check', diff --git a/ng6-seed/src/app/shared/menu-items/menu-items.ts b/ng6-seed/src/app/shared/menu-items/menu-items.ts index 80a4589..0e6648a 100755 --- a/ng6-seed/src/app/shared/menu-items/menu-items.ts +++ b/ng6-seed/src/app/shared/menu-items/menu-items.ts @@ -79,6 +79,12 @@ const MENUITEMS : Menu[] = [ // {state:'pdtriggerlist',name:'Pd Trigger Listing'} // ] }, + { + state:'sales-pd-list', + name:'Sales PD', + type:'link', + icon:'work', + }, // { // state:'quality_check_discussion', // name:'Quality Check',