diff --git a/ng6-seed/src/app/_guard/token.interceptor.ts b/ng6-seed/src/app/_guard/token.interceptor.ts index becb6d8..38e1575 100755 --- a/ng6-seed/src/app/_guard/token.interceptor.ts +++ b/ng6-seed/src/app/_guard/token.interceptor.ts @@ -4,7 +4,8 @@ import { HttpHandler, HttpEvent, HttpInterceptor, - HttpHeaders + HttpHeaders, + HttpResponse } from '@angular/common/http'; // import { AuthGuard } from './auth.guard'; import { Observable, of } from 'rxjs'; @@ -15,16 +16,18 @@ import { HttpErrorResponse } from "@angular/common/http"; import { CognitoService } from '../AwsService/cognito.service'; import {environment} from '../../environments/environment' +import { LoaderService } from 'app/shared/loaderService/loader.service'; @Injectable() export class TokenInterceptor implements HttpInterceptor{ - constructor( private router: Router,public shared:CognitoService) {} + constructor( private router: Router,public shared:CognitoService,private loaderService:LoaderService) {} intercept(request: HttpRequest, next: HttpHandler): Observable> { // request = request.clone({ // setHeaders: { // Authorization: `${this.auth.getToken()}` // } // }); + this.showLoader(); let token:any = this.shared.getAccessToken() ||""; //console.log(token); let requests = request.clone({ @@ -34,9 +37,15 @@ export class TokenInterceptor implements HttpInterceptor{ 'Token': token.getIdToken().getJwtToken() }) }); - return next.handle(requests).pipe( - catchError(this.handleError('role', [])) - ) + return next.handle(requests).pipe(tap((event:HttpEvent)=>{ + if (event instanceof HttpResponse) { + this.onEnd(); + } + }, + (err: any) => { + this.onEnd(); + this.handleError('role',err); + })); } private handleError (operation = 'operation', result?: T) { @@ -51,4 +60,13 @@ export class TokenInterceptor implements HttpInterceptor{ } }; } + private onEnd(): void { + this.hideLoader(); + } + private showLoader(): void { + this.loaderService.show(); + } + private hideLoader(): void { + this.loaderService.hide(); + } } \ No newline at end of file diff --git a/ng6-seed/src/app/app.module.ts b/ng6-seed/src/app/app.module.ts index 79ece1d..6f58c67 100755 --- a/ng6-seed/src/app/app.module.ts +++ b/ng6-seed/src/app/app.module.ts @@ -2,7 +2,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterModule } from '@angular/router'; import { NgModule } from '@angular/core'; -import { FormsModule } from '@angular/forms'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HttpModule, Http } from '@angular/http'; import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS} from '@angular/common/http'; @@ -46,6 +46,9 @@ 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'; +import { LoaderService } from './shared/loaderService/loader.service'; +import { HttpLoaderComponent } from './layouts/http-loader/http-loader.component'; +import { AdvanceFilterComponent } from './sales-pd/advance-filter/advance-filter.component'; export function HttpLoaderFactory(http: HttpClient) { return new TranslateHttpLoader(http); } @@ -64,6 +67,8 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { AdminLayoutComponent, AuthLayoutComponent, NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe, SalesPdComponent, + HttpLoaderComponent, + AdvanceFilterComponent ], imports: [ BrowserModule, @@ -89,6 +94,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { MatFormFieldModule, HttpClientModule, ResizableModule, + ReactiveFormsModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, @@ -105,7 +111,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { }, AwsService,AuthGuard, TranslateService, - PdTrigerService, + PdTrigerService,LoaderService, // { // provide: PERFECT_SCROLLBAR_CONFIG, // useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG diff --git a/ng6-seed/src/app/layouts/admin/admin-layout.component.html b/ng6-seed/src/app/layouts/admin/admin-layout.component.html index ff43cbc..c906a6a 100755 --- a/ng6-seed/src/app/layouts/admin/admin-layout.component.html +++ b/ng6-seed/src/app/layouts/admin/admin-layout.component.html @@ -339,6 +339,7 @@ --> +
diff --git a/ng6-seed/src/app/layouts/http-loader/http-loader.component.html b/ng6-seed/src/app/layouts/http-loader/http-loader.component.html new file mode 100644 index 0000000..f1e8f54 --- /dev/null +++ b/ng6-seed/src/app/layouts/http-loader/http-loader.component.html @@ -0,0 +1,6 @@ +
+
+ + +
+
\ No newline at end of file diff --git a/ng6-seed/src/app/layouts/http-loader/http-loader.component.scss b/ng6-seed/src/app/layouts/http-loader/http-loader.component.scss new file mode 100644 index 0000000..92e7bc8 --- /dev/null +++ b/ng6-seed/src/app/layouts/http-loader/http-loader.component.scss @@ -0,0 +1,34 @@ +.hidden { + visibility: hidden; + } + .loader-overlay { + position: absolute; + width: 100%; + z-index: 500000; + top: 0; + } + // .loader { + // height: 4px; + // width: 100%; + // position: relative; + // overflow: hidden; + // background-color: #FFF; + // } + // .loader:before { + // display: block; + // position: absolute; + // content: ""; + // left: -200px; + // width: 200px; + // height: 4px; + // background-color: red; + // animation: loading 2s linear infinite; + // } + // @keyframes loading { + // from {left: -200px; width: 30%;} + // 50% {width: 30%;} + // 70% {width: 70%;} + // 80% {left: 50%;} + // 95% {left: 120%;} + // to {left: 100%;} + // } \ No newline at end of file diff --git a/ng6-seed/src/app/layouts/http-loader/http-loader.component.spec.ts b/ng6-seed/src/app/layouts/http-loader/http-loader.component.spec.ts new file mode 100644 index 0000000..1aead06 --- /dev/null +++ b/ng6-seed/src/app/layouts/http-loader/http-loader.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HttpLoaderComponent } from './http-loader.component'; + +describe('HttpLoaderComponent', () => { + let component: HttpLoaderComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HttpLoaderComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HttpLoaderComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/layouts/http-loader/http-loader.component.ts b/ng6-seed/src/app/layouts/http-loader/http-loader.component.ts new file mode 100644 index 0000000..0e4be33 --- /dev/null +++ b/ng6-seed/src/app/layouts/http-loader/http-loader.component.ts @@ -0,0 +1,29 @@ +import { Component, OnInit } from '@angular/core'; +import { LoaderService } from 'app/shared/loaderService/loader.service'; +import { Subscription } from 'rxjs'; +export interface LoaderState { + show: boolean; +} +@Component({ + selector: 'app-http-loader', + templateUrl: './http-loader.component.html', + styleUrls: ['./http-loader.component.scss'] +}) +export class HttpLoaderComponent implements OnInit { + show = false; + private subscription: Subscription; + + constructor( private loaderService: LoaderService) { } + + ngOnInit() { + this.subscription = this.loaderService.loaderState + .subscribe((state: LoaderState) => { + this.show = state.show; + }); + } + ngOnDestroy() { + this.subscription.unsubscribe(); + } + + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html index 705cb86..d433be8 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html @@ -70,6 +70,8 @@ + +

Showing data for last 10 days. To see older records, please use advanced filter


@@ -147,8 +149,13 @@ --> - - + + + +
Showing data for last 10 days. To see older records, please use advanced filter
+
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.scss index 4043f5c..712e0c5 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.scss @@ -18,4 +18,12 @@ .toolbar-space { flex: 0.01 0 auto; } +p.note { + // float: right; + text-align: right; + font-size: 12px; + color: grey; + font-weight: bold; +} + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts index 1f55927..9435343 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.ts @@ -49,6 +49,7 @@ export class AllPdComponent implements OnInit, OnChanges { pageEvent: PageEvent; todaydate:Date = new Date(); user_role_name: string; + limitMsg: boolean = false; constructor(private _pd: PdTrigerService,private _fb:FormBuilder,notifier: NotifierService,private userService:UserService) { this.notifier = notifier; @@ -108,11 +109,14 @@ console.log(this.displayedColumns) this.PdListData = data.records; this.dataLengthTab1 = data.records.length; this.dataSourceTab1.data = this.PdListData; + this.recordStatus=false; + this.limitMsg = true } else{ this.PdListData=[]; - this.dataSourceTab1 = null; + this.dataSourceTab1.data = []; this.recordStatus=true; + this.limitMsg = false } } // , error => {this.errorMessage = error}); @@ -214,16 +218,23 @@ console.log(this.displayedColumns) this._pd.overAllSearchFormDetails(this.searchForm.value).subscribe(res=> { this.xpandStatus = false; - if(res['dataStatus']==true) + console.log("Res",res['dataStatus']) + if(res['dataStatus']) { + this.PdListData = res['records']; this.dataSourceTab1.data = res['records']; // console.log('records',res['records']); this.dataSourceTab1.paginator = this.paginator; + this.recordStatus=false + this.limitMsg = false }else{ this.notifier.notify('warning', 'No Records Found !'); this.dataSourceTab1.paginator['length'] = 0; this.dataSourceTab1.paginator['pageIndex'] = 0; - this.dataSourceTab1.data = []; + this.dataSourceTab1.data = []; + this.PdListData = []; + this.recordStatus = true; + this.limitMsg = false // console.log('records-records',res['records']); } },error => { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html index c7cd87e..af7eda6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html @@ -70,8 +70,8 @@ +

Showing data for last 10 days. To see older records, please use advanced filter


- @@ -120,7 +120,12 @@ - - + + + +
Showing data for last 10 days. To see older records, please use advanced filter
+
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.scss index dc8d754..085a716 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.scss @@ -17,3 +17,11 @@ .toolbar-space { flex: 0.01 0 auto; } +p.note { + // float: right; + text-align: right; + font-size: 12px; + color: grey; + font-weight: bold; +} + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts index f30f70a..7175327 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.ts @@ -48,6 +48,7 @@ export class CompletedPdComponent implements OnInit, OnChanges { pageEvent: PageEvent; todaydate:Date = new Date(); user_role_name: string; + limitMsg: boolean = false; constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,private userService:UserService) { this.notifier = notifier; @@ -104,11 +105,15 @@ public LenderRoleID : any = localStorage.getItem('LenderRoleID'); this.completedPdListData = data.records; this.dataLengthTab4 = data.records.length; this.dataSourceTab4.data = this.completedPdListData; + this.recordStatus = false + this.limitMsg = true } else{ + this.dataSourceTab4.data =[] this.completedPdListData=[]; this.dataLengthTab4= null; this.recordStatus=true; + this.limitMsg = false } } // , error => this.errorMessage = error); @@ -221,14 +226,18 @@ public LenderRoleID : any = localStorage.getItem('LenderRoleID'); if(res['dataStatus']==true) { - this.dataSourceTab4 = res['records']; + this.completedPdListData=res['records']; + this.dataSourceTab4.data = res['records']; this.dataSourceTab4.paginator = this.paginator; + this.recordStatus=false; + this.limitMsg = false }else{ this.notifier.notify('warning', 'No Records Found !'); - + this.recordStatus=true; this.dataSourceTab4.paginator['length'] = 0; this.dataSourceTab4.paginator['pageIndex'] = 0; - this.dataSourceTab4.data = []; + this.dataSourceTab4.data = []; + this.limitMsg = false } },error => { this.errorMessage.push(error); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html index db427c6..c255ae6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html @@ -69,6 +69,7 @@ +

Showing data for last 10 days. To see older records, please use advanced filter


@@ -116,7 +117,12 @@ - - + + + +
Showing data for last 10 days. To see older records, please use advanced filter
+
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.scss index b500faa..b4d53fb 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.scss @@ -16,4 +16,11 @@ } .toolbar-space { flex: 0.01 0 auto; -} \ No newline at end of file +} +p.note { + // float: right; + text-align: right; + font-size: 12px; + color: grey; + font-weight: bold; +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts index a3c1021..6c99ed4 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.ts @@ -46,6 +46,7 @@ export class InprogressPdComponent implements OnInit, OnChanges { pageEvent: PageEvent; searchForm:FormGroup; user_role_name: string; + limitMsg: boolean = false; constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,private userService:UserService) { this.notifier = notifier; @@ -99,10 +100,14 @@ public LenderRoleID : string = localStorage.getItem('LenderRoleID'); this.progressPdListData = data.records; this.dataLengthTab2 = data.records.length; this.dataSourceTab2.data = this.progressPdListData; + this.recordStatus=false + this.limitMsg = true }else{ this.progressPdListData =[]; - this.dataSourceTab2 = null; + this.progressPdListData = []; + this.dataSourceTab2.data = []; this.recordStatus=true; + this.limitMsg = false } },error => { this.errorMessage.push(error); @@ -210,13 +215,19 @@ public LenderRoleID : string = localStorage.getItem('LenderRoleID'); this.xpandStatus = false; if(res['dataStatus']==true) { - this.dataSourceTab2 = res['records']; + this.progressPdListData = res['records']; + this.dataSourceTab2.data = res['records']; this.dataSourceTab2.paginator = this.paginator; + this.recordStatus=false + this.limitMsg = false }else{ this.notifier.notify('warning', 'No Records Found !'); this.dataSourceTab2.paginator['length'] = 0; this.dataSourceTab2.paginator['pageIndex'] = 0; - this.dataSourceTab2.data = []; + this.dataSourceTab2.data = []; + this.progressPdListData = []; + this.recordStatus=true + this.limitMsg = false } },error => { this.errorMessage.push(error); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html index 1c8b6d2..18a4c2e 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html @@ -71,6 +71,7 @@ +

Showing data for last 10 days. To see older records, please use advanced filter


@@ -118,7 +119,12 @@ - - + + + +
Showing data for last 10 days. To see older records, please use advanced filter
+
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.scss index b500faa..b4d53fb 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.scss @@ -16,4 +16,11 @@ } .toolbar-space { flex: 0.01 0 auto; -} \ No newline at end of file +} +p.note { + // float: right; + text-align: right; + font-size: 12px; + color: grey; + font-weight: bold; +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.ts index 6c9400a..b58f825 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.ts @@ -47,6 +47,7 @@ export class QcCompletedPdComponent implements OnInit, OnChanges { pageSize = 10; pageEvent: PageEvent; user_role_name: string; + limitMsg: boolean = false; constructor(private _pd: PdTrigerService, public _fb: FormBuilder,notifier: NotifierService,private userService:UserService) { this.notifier = notifier; @@ -106,11 +107,15 @@ export class QcCompletedPdComponent implements OnInit, OnChanges { this.qcCompletedPdListData = data.records; this.dataLengthTab5 = data.records.length; this.dataSourceTab5.data = this.qcCompletedPdListData; + this.recordStatus = false + this.limitMsg = true } else { this.qcCompletedPdListData = []; + this.dataSourceTab5.data = [] this.dataLengthTab5 = null; this.recordStatus = true; + this.limitMsg = false } } // , error => this.errorMessage = error); @@ -199,13 +204,19 @@ export class QcCompletedPdComponent implements OnInit, OnChanges { this._pd.overAllSearchFormDetails(this.searchForm.value).subscribe(res => { this.xpandStatus = false; if (res['dataStatus'] == true) { - this.dataSourceTab5 = res['records']; + this.qcCompletedPdListData = res['records']; + this.dataSourceTab5.data = res['records']; this.dataSourceTab5.paginator = this.paginator; + this.recordStatus = false; + this.limitMsg = false }else{ + this.qcCompletedPdListData = [] this.notifier.notify('warning', 'No Records Found !'); this.dataSourceTab5.paginator['length'] = 0; this.dataSourceTab5.paginator['pageIndex'] = 0; - this.dataSourceTab5.data = []; + this.dataSourceTab5.data = []; + this.recordStatus = true; + this.limitMsg = false } },error => { this.errorMessage.push(error); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html index 6d95bcb..1fea95a 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html @@ -69,6 +69,7 @@ +

Showing data for last 10 days. To see older records, please use advanced filter


@@ -119,8 +120,13 @@ - - + + + +
Showing data for last 10 days. To see older records, please use advanced filter
+
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.scss index b500faa..b4d53fb 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.scss @@ -16,4 +16,11 @@ } .toolbar-space { flex: 0.01 0 auto; -} \ No newline at end of file +} +p.note { + // float: right; + text-align: right; + font-size: 12px; + color: grey; + font-weight: bold; +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.ts index 02aeb78..db4a095 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.ts @@ -46,6 +46,7 @@ export class ScheduledPdComponent implements OnInit, OnChanges { pageSize = 10; pageEvent: PageEvent; user_role_name: string; + limitMsg: boolean = false; constructor(private _pd: PdTrigerService,public _fb:FormBuilder,notifier: NotifierService,private userService:UserService) { this.notifier = notifier; @@ -104,11 +105,15 @@ public LenderRoleID : any = localStorage.getItem('LenderRoleID'); this.scheduledPdListData = data.records; this.dataLengthTab3 = data.records.length; this.dataSourceTab3.data = this.scheduledPdListData; + this.recordStatus =false + this.limitMsg = true } else{ this.scheduledPdListData=[]; this.dataLengthTab3 = null; + this.dataSourceTab3.data = [] this.recordStatus=true; + this.limitMsg = false } } // , error => this.errorMessage = error); @@ -217,11 +222,17 @@ public LenderRoleID : any = localStorage.getItem('LenderRoleID'); { this.dataSourceTab3 = res['records']; this.dataSourceTab3.paginator = this.paginator; + this.scheduledPdListData = res['records']; + this.recordStatus = false; + this.limitMsg = false }else{ this.notifier.notify('warning', 'No Records Found !'); this.dataSourceTab3.paginator['length'] = 0; this.dataSourceTab3.paginator['pageIndex'] = 0; - this.dataSourceTab3.data = []; + this.dataSourceTab3.data = []; + this.recordStatus = true; + this.scheduledPdListData = [] + this.limitMsg = false } },error => { this.errorMessage.push(error); diff --git a/ng6-seed/src/app/sales-pd/advance-filter/advance-filter.component.html b/ng6-seed/src/app/sales-pd/advance-filter/advance-filter.component.html new file mode 100644 index 0000000..3afdcd8 --- /dev/null +++ b/ng6-seed/src/app/sales-pd/advance-filter/advance-filter.component.html @@ -0,0 +1,78 @@ + + + + + + filter_list + + Advanced Filter + + + + + +
+ + + {{status}} + + + + + + + + + + + + + + + + {{pro.abbr}} + + + + + + {{ent.full_name}} + + + + + + + + +
+
+
+ + + + + + +
+ + +
\ No newline at end of file diff --git a/ng6-seed/src/app/sales-pd/advance-filter/advance-filter.component.scss b/ng6-seed/src/app/sales-pd/advance-filter/advance-filter.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/ng6-seed/src/app/sales-pd/advance-filter/advance-filter.component.spec.ts b/ng6-seed/src/app/sales-pd/advance-filter/advance-filter.component.spec.ts new file mode 100644 index 0000000..748a0b6 --- /dev/null +++ b/ng6-seed/src/app/sales-pd/advance-filter/advance-filter.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AdvanceFilterComponent } from './advance-filter.component'; + +describe('AdvanceFilterComponent', () => { + let component: AdvanceFilterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AdvanceFilterComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AdvanceFilterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/sales-pd/advance-filter/advance-filter.component.ts b/ng6-seed/src/app/sales-pd/advance-filter/advance-filter.component.ts new file mode 100644 index 0000000..84fd3b0 --- /dev/null +++ b/ng6-seed/src/app/sales-pd/advance-filter/advance-filter.component.ts @@ -0,0 +1,119 @@ +import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { FormGroup, FormBuilder } from '@angular/forms'; +import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service'; +import { DatePipe } from '@angular/common'; +import { SalesPdService } from '../sales-pd.service'; + + +@Component({ + selector: 'app-advance-filter', + templateUrl: './advance-filter.component.html', + styleUrls: ['./advance-filter.component.scss'] +}) +export class AdvanceFilterComponent implements OnInit { + searchForm:FormGroup; + todaydate: any; + pdStatus: any=[]; + // pdStatus_all: any=[]; + ENTITY: any =[]; + @Input()drop_down_datas + @Output() filteredlistData = new EventEmitter(); + @Output() resetFilter = new EventEmitter(); + PRODUCTS: any =[]; + xpandStatus:boolean=false; + pipe=new DatePipe('en-US'); + constructor(private _fb:FormBuilder,private _pd:PdTrigerService,private salesPDService:SalesPdService) { + this.todaydate = new Date(); + this.getDropdown(); + } + + ngOnInit() { + this.searchForm=this._fb.group({ + pd_status:[''], + pd_from_date:[''], + pd_to_date:[''], + pd_products:[''], + pd_lender:[''], + pd_applicant_name:[''], + pd_officer:[''], + }) + console.log(this.drop_down_datas) + } + getDropdown(){ + // this._pd.getAllMasterDatas('PDSTATUS').subscribe(res=> + // { + // if(res.dataStatus==true) + // { + // this.pdStatus_all = res.records.filter(status=>status.isactive==1); + // } + // }); + this._pd.getAllMasterDatas('ENTITY').subscribe(res=> + { + if(res.dataStatus==true) + { + this.ENTITY = res.records.filter(ent=>ent.isactive==1); + } + }); + this._pd.getAllMasterDatas('PRODUCTS').subscribe(res=> + { + if(res.dataStatus==true) + { + this.PRODUCTS = res.records.filter(pro=>pro.isactive==1); + } + }); + + } + ngOnChanges(){ + console.log(this.drop_down_datas) + if(this.drop_down_datas != undefined){ + this.pdStatus=this.drop_down_datas.pd_status + if(this.ENTITY.length != 0) { + this.entityCheck() + } + else{ + setTimeout(()=>{this.entityCheck()},500) + } + if(this.PRODUCTS.length != 0) { + this.productCheck() + } + else{ + setTimeout(()=>{this.productCheck()},500) + } + } + } + productCheck(){ + this.PRODUCTS=this.PRODUCTS.filter(val=>{ + if(this.drop_down_datas.product_ids.filter(dp=>dp == val.product_id).length > 0){ + return val + } + }) + } + entityCheck(){ + this.ENTITY=this.ENTITY.filter(val=>{ + if(this.drop_down_datas.lender_ids.filter(dp=>dp == val.entity_id).length > 0){ + return val + } + }) + } + searchItem(){ + this.searchForm.value.pd_from_date = this.pipe.transform(this.searchForm.value.pd_from_date,'yyyy-MM-dd'); + this.searchForm.value.pd_to_date = this.pipe.transform(this.searchForm.value.pd_to_date,'yyyy-MM-dd'); + // console.log(JSON.stringifythis.searchForm.value); + this.xpandStatus=true; + this.salesPDService.advancedFilter(this.searchForm.value).subscribe(res=>{ + if(res.dataStatus){ + console.log(res); + this.filteredlistData.emit(res); + this.xpandStatus=false + } + else{ + this.filteredlistData.emit(res) + } + }) + } + onReset(){ + this.searchForm.reset(); + this.xpandStatus=false + this.resetFilter.emit(true); + } +} diff --git a/ng6-seed/src/app/sales-pd/sales-pd.component.html b/ng6-seed/src/app/sales-pd/sales-pd.component.html index e3a1eab..5566b0c 100644 --- a/ng6-seed/src/app/sales-pd/sales-pd.component.html +++ b/ng6-seed/src/app/sales-pd/sales-pd.component.html @@ -10,77 +10,12 @@ Sales PD - - - - - - + +

Showing data for last 10 days. To see older records, please use advanced filter

+
- + {{details.sales_pd_id}} @@ -148,7 +83,10 @@ - + +
Showing data for last 10 days. To see older records, please use advanced filter
+
\ 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 index 793673f..743bbfe 100644 --- a/ng6-seed/src/app/sales-pd/sales-pd.component.scss +++ b/ng6-seed/src/app/sales-pd/sales-pd.component.scss @@ -18,3 +18,11 @@ .toolbar-space { flex: 0.01 0 auto; } +p.note { + // float: right; + text-align: right; + font-size: 12px; + color: grey; + font-weight: bold; + } + diff --git a/ng6-seed/src/app/sales-pd/sales-pd.component.ts b/ng6-seed/src/app/sales-pd/sales-pd.component.ts index f119b4c..c373a01 100644 --- a/ng6-seed/src/app/sales-pd/sales-pd.component.ts +++ b/ng6-seed/src/app/sales-pd/sales-pd.component.ts @@ -32,6 +32,8 @@ export class SalesPdComponent implements OnInit { pageSize = 10; pageEvent: PageEvent; todaydate:Date = new Date(); + filter_drop_down_data:any; + limitMsg: boolean = false; constructor(private _pdSales: PdTrigerService,private userService:UserService) { } @@ -50,11 +52,47 @@ export class SalesPdComponent implements OnInit { this.salesPdData = data.records; this.dataLengthTab4 = data.records.length; this.dataSourceTab4.data = this.salesPdData; + this.recordStatus=false + this.limitMsg = true + if(this.salesPdData.length > 0){ + let products=[] + let lenders=[] + let pd_status=[] + this.salesPdData.map(val=>{ + if(products.length > 0 ){ + if(products.filter(pro=>pro == val.product_id).length == 0 ){ + products.push(val.product_id) + } + } + else{ + products.push(val.product_id) + } + if(lenders.length > 0 ){ + if(lenders.filter(pro=>pro == val.lender_id).length == 0 ){ + lenders.push(val.lender_id) + } + } + else{ + lenders.push(val.lender_id) + } + if(pd_status.length > 0 ){ + if(pd_status.filter(pro=>pro == val.status).length == 0 ){ + pd_status.push(val.status) + } + } + else{ + pd_status.push(val.status) + } + }) + this.filter_drop_down_data={product_ids:products,lender_ids:lenders,pd_status:pd_status} + // console.log(this.filter_drop_down_data); + } } else{ this.salesPdData=[]; this.dataLengthTab4= null; this.recordStatus=true; + this.limitMsg = false } } // , error => this.errorMessage = error); @@ -64,6 +102,22 @@ export class SalesPdComponent implements OnInit { alert(error.html_format); }); } + filteredDataSource(data){ + console.log("From Parent",data); + if(data.dataStatus){ + this.salesPdData=data.records + this.dataLengthTab4 = data.records.length; + this.dataSourceTab4.data = this.salesPdData; + this.recordStatus=false + this.limitMsg = false + } + else{ + this.salesPdData=[]; + this.dataLengthTab4= null; + this.recordStatus=true; + this.limitMsg = false + } + } salesPDpdf(pdfdetail){ this._pdSales.getSalesPdpdf(pdfdetail) diff --git a/ng6-seed/src/app/sales-pd/sales-pd.service.ts b/ng6-seed/src/app/sales-pd/sales-pd.service.ts index 1ea766a..618ef0d 100644 --- a/ng6-seed/src/app/sales-pd/sales-pd.service.ts +++ b/ng6-seed/src/app/sales-pd/sales-pd.service.ts @@ -1,9 +1,17 @@ import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { environment } from 'environments/environment'; +const api_url = environment.apiEndpoint; @Injectable({ providedIn: 'root' }) + export class SalesPdService { - constructor() { } + constructor(private _http:HttpClient) { } + advancedFilter(params): Observable{ + return this._http.post(api_url+'filterSalesPDList',{"records":params}) + } } diff --git a/ng6-seed/src/app/shared/loaderService/loader.service.spec.ts b/ng6-seed/src/app/shared/loaderService/loader.service.spec.ts new file mode 100644 index 0000000..ff3167a --- /dev/null +++ b/ng6-seed/src/app/shared/loaderService/loader.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { LoaderService } from './loader.service'; + +describe('LoaderService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: LoaderService = TestBed.get(LoaderService); + expect(service).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/shared/loaderService/loader.service.ts b/ng6-seed/src/app/shared/loaderService/loader.service.ts new file mode 100644 index 0000000..07488a7 --- /dev/null +++ b/ng6-seed/src/app/shared/loaderService/loader.service.ts @@ -0,0 +1,19 @@ +import { Injectable } from '@angular/core'; +import { Subject } from 'rxjs'; +export interface LoaderState { + show: boolean; +} +@Injectable({ + providedIn: 'root' +}) +export class LoaderService { + private loaderSubject = new Subject(); + loaderState = this.loaderSubject.asObservable(); + constructor() { } + show() { + this.loaderSubject.next({ show: true }); + } + hide() { + this.loaderSubject.next({ show: false }); + } +} \ No newline at end of file diff --git a/ng6-seed/src/environments/environment.ts b/ng6-seed/src/environments/environment.ts index 144fb1a..20bda0b 100644 --- a/ng6-seed/src/environments/environment.ts +++ b/ng6-seed/src/environments/environment.ts @@ -8,7 +8,7 @@ export const environment = { environmentName: 'Development Environment',//Localhost Environment. - // apiEndpoint: 'https://demo.pdgenie.com/sparqtest/api/', + // apiEndpoint: 'https://apitest.pdgenie.com/sparqtest/api/', apiEndpoint: ' https://apitest.pdgenie.com/sparqapi/api/', authorization: 'sparqvenba2018',