From a410cc94659de4c951a57539aa282877bf2a2806 Mon Sep 17 00:00:00 2001 From: venbainfotech Date: Tue, 5 Jul 2022 18:39:02 +0530 Subject: [PATCH] Flyhi issue fix --- .../fly-hi-list/fly-hi-list.component.html | 8 +- .../fly-hi-list/fly-hi-list.component.scss | 3 +- .../flyhi-advance-filter.component.html | 114 +++++++++++++ .../flyhi-advance-filter.component.scss | 10 ++ .../flyhi-advance-filter.component.spec.ts | 25 +++ .../flyhi-advance-filter.component.ts | 153 ++++++++++++++++++ .../src/app/fly-hi/services/flyhi.service.ts | 5 +- ng6-seed/src/app/sales-pd/sales-pd.module.ts | 3 +- ng6-seed/src/assets/data/flyhi.json | 25 ++- 9 files changed, 323 insertions(+), 23 deletions(-) create mode 100644 ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.html create mode 100644 ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.scss create mode 100644 ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.spec.ts create mode 100644 ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.ts diff --git a/ng6-seed/src/app/fly-hi/fly-hi-list/fly-hi-list.component.html b/ng6-seed/src/app/fly-hi/fly-hi-list/fly-hi-list.component.html index 0463cc0..6c75cd5 100644 --- a/ng6-seed/src/app/fly-hi/fly-hi-list/fly-hi-list.component.html +++ b/ng6-seed/src/app/fly-hi/fly-hi-list/fly-hi-list.component.html @@ -19,8 +19,8 @@ - +

Showing data for last {{common}}. To see older records, please use advanced filter


@@ -29,7 +29,7 @@
Name Not Given {{details.applicant_name}}
- {{details.sales_pd_type == '1' ? 'Physical PD' : 'Telephonic PD'}} +
@@ -55,7 +55,7 @@
{{details.sales_pd_sno}}
- {{details.sales_pd_type == '1' ? 'Physical PD' : 'Telephonic PD'}} +
diff --git a/ng6-seed/src/app/fly-hi/fly-hi-list/fly-hi-list.component.scss b/ng6-seed/src/app/fly-hi/fly-hi-list/fly-hi-list.component.scss index 2d64c11..537921a 100644 --- a/ng6-seed/src/app/fly-hi/fly-hi-list/fly-hi-list.component.scss +++ b/ng6-seed/src/app/fly-hi/fly-hi-list/fly-hi-list.component.scss @@ -13,7 +13,8 @@ // } ::ng-deep .mat-tab-group.mat-primary .mat-ink-bar, .mat-tab-nav-bar.mat-primary .mat-ink-bar { - background-color: #0d93a9; + // background-color: #0d93a9; + display: none; } .fontTitle{ font-weight:bold; diff --git a/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.html b/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.html new file mode 100644 index 0000000..1b1df36 --- /dev/null +++ b/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.html @@ -0,0 +1,114 @@ + + + + + + filter_list + + Advanced Filter + + + + + +
+
+
+ + + + {{item.pd_type_name}} + + + +
+
+ + + + {{status.pd_status_name}} + + + +
+ +
+
+
+ + + + + +
+
+ + + + + +
+
+ + + +
+
+ + + + + + + + + + + + +
+
+
+ + + + + + +
+ + +
\ No newline at end of file diff --git a/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.scss b/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.scss new file mode 100644 index 0000000..3a2115b --- /dev/null +++ b/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.scss @@ -0,0 +1,10 @@ +@media(min-width: 600px) { + .web{ + width: 80% !important; + } + } + @media(max-width: 600px) { + .mobile{ + width: 100% !important; + } + } \ No newline at end of file diff --git a/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.spec.ts b/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.spec.ts new file mode 100644 index 0000000..49e4ca2 --- /dev/null +++ b/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FlyhiAdvanceFilterComponent } from './flyhi-advance-filter.component'; + +describe('FlyhiAdvanceFilterComponent', () => { + let component: FlyhiAdvanceFilterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ FlyhiAdvanceFilterComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FlyhiAdvanceFilterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.ts b/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.ts new file mode 100644 index 0000000..7669768 --- /dev/null +++ b/ng6-seed/src/app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component.ts @@ -0,0 +1,153 @@ +import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; +import { DatePipe } from '@angular/common'; +import { FormGroup, FormBuilder } from '@angular/forms'; +import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service'; +import { SalesPdService } from 'app/sales-pd/services/sales-pd.service'; +import { FlyhiService } from 'app/fly-hi/services/flyhi.service'; + +@Component({ + selector: 'app-flyhi-advance-filter', + templateUrl: './flyhi-advance-filter.component.html', + styleUrls: ['./flyhi-advance-filter.component.scss'] +}) +export class FlyhiAdvanceFilterComponent implements OnInit { + + searchForm:FormGroup; + todaydate: any; + pdStatus: any=[]; + // pdStatus_all: any=[]; + ENTITY: any =[]; + is_sales_login: boolean = false; + @Input()drop_down_datas + @Output() filteredlistData = new EventEmitter(); + @Output() resetFilter = new EventEmitter(); + PRODUCTS: any =[]; + xpandStatus:boolean=false; + pipe=new DatePipe('en-US'); + salesPdTypeList = [ + { + id:'4', + pd_type_name:"Residence" + }, + { + id:'3', + pd_type_name:"Office" + } + ] + constructor(private _fb:FormBuilder,private _pd:PdTrigerService,private _flyHi:FlyhiService) { + this.todaydate = new Date(); + this.getDropdown(); + let local:any = JSON.parse(localStorage.getItem('user_details')); + + if(local.userid != ''){ + this.is_sales_login = true + } + } + + ngOnInit() { + let local:any = JSON.parse(localStorage.getItem('user_details')); + let entity_id=localStorage.getItem('LocalSetEntity'); + + // 'drop_down_datas':this.filter_drop_down_data,is_sales_login:this.is_sales_login + this.searchForm=this._fb.group({ + pd_status:[''], + sales_pd_type:[''], + pd_from_date:[''], + pd_to_date:[''], + // pd_products:[''], + // pd_lender:[entity_id], + pd_applicant_name:[''], + // pd_officer:[''], + sales_pd_officer_id:[this.is_sales_login ? local.userid : ''] + }) + console.log('testing'); + console.log(this.drop_down_datas) + } + + getDropdown(){ + this._pd.getAllMasterDatas('PDSTATUS').subscribe(res=>{ + console.log(res) + if(res.dataStatus==true) + { + this.pdStatus = res.records.filter(status=>status.isactive==1 && status.hasOwnProperty('avail_pd_types') && (status.avail_pd_types == '2' || status.avail_pd_types == '3' )) + console.log(this.pdStatus) + } + }); + this._pd.getAllMasterDatas('ENTITY').subscribe(res=> + { + if(res.dataStatus==true) + { + this.ENTITY = res.records.filter(ent=>ent.isactive==1 && ent.hasOwnProperty('avail_pd_types') && (ent.avail_pd_types == '2' || ent.avail_pd_types == '3' )); + } + }); + this._pd.getAllMasterDatas('PRODUCTS').subscribe(res=> + { + if(res.dataStatus==true) + { + this.PRODUCTS = res.records.filter(pro=>pro.isactive==1 && pro.hasOwnProperty('avail_pd_types') && (pro.avail_pd_types == '2' || pro.avail_pd_types == '3' )); + } + }); + + } + setDropDownDatas(){ + console.log(this.drop_down_datas) + if(this.drop_down_datas != undefined){ + this.pdStatus=this.drop_down_datas.pd_status + console.log(this.pdStatus) + 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(this.searchForm.value); + //console.log('testing'); + + this.xpandStatus=true; + this._flyHi.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(); + let local:any = JSON.parse(localStorage.getItem('user_details')); + // this.searchForm.controls['pd_lender'].setValue(local.fk_entity_id); + this.searchForm.controls['sales_pd_officer_id'].setValue(local.userid); + this.xpandStatus=false + this.resetFilter.emit(true); + + } + +} diff --git a/ng6-seed/src/app/fly-hi/services/flyhi.service.ts b/ng6-seed/src/app/fly-hi/services/flyhi.service.ts index 3f50d97..729f1f9 100644 --- a/ng6-seed/src/app/fly-hi/services/flyhi.service.ts +++ b/ng6-seed/src/app/fly-hi/services/flyhi.service.ts @@ -227,7 +227,10 @@ loadTemplate(form_id,mapid,Formname) { // getSalesPdpdf(pdfdetail){ // return this._http.get(api_url + "downloadFlyhiPDReport/" + pdfdetail) - // } + // } + advancedFilter(params): Observable{ + return this._http.post(api_url+'filterFlyPDList',{"records":params}) + } } diff --git a/ng6-seed/src/app/sales-pd/sales-pd.module.ts b/ng6-seed/src/app/sales-pd/sales-pd.module.ts index 449bc29..92039ec 100755 --- a/ng6-seed/src/app/sales-pd/sales-pd.module.ts +++ b/ng6-seed/src/app/sales-pd/sales-pd.module.ts @@ -23,6 +23,7 @@ import { CommonModule } from '@angular/common'; import { ReGenerateReportComponent } from './sales-pd-list/re-generate-report/re-generate-report.component'; import { FlyHiListComponent } from 'app/fly-hi/fly-hi-list/fly-hi-list.component'; import { ImageVideoComponent } from 'app/fly-hi/image-video/image-video.component'; +import { FlyhiAdvanceFilterComponent } from 'app/fly-hi/fly-hi-list/flyhi-advance-filter/flyhi-advance-filter.component'; @NgModule({ imports: [ SalesPdRoutingModule, @@ -35,7 +36,7 @@ import { ImageVideoComponent } from 'app/fly-hi/image-video/image-video.componen MatDialogModule, MatTooltipModule ], - declarations: [ImageVideoComponent,AlertDialogComponent,FlyHiListComponent,SalesPdComponent,AdvanceFilterComponent, ReGenerateReportComponent], + declarations: [FlyhiAdvanceFilterComponent,ImageVideoComponent,AlertDialogComponent,FlyHiListComponent,SalesPdComponent,AdvanceFilterComponent, ReGenerateReportComponent], entryComponents:[ImageVideoComponent,AlertDialogComponent,SalesPdComponent,ReGenerateReportComponent], providers:[ConstantsProvider,{ provide: MAT_DATE_LOCALE, useValue: 'en-GB' },{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS},{ provide: MatDialogRef, useValue: {} },{ provide: MAT_DIALOG_DATA, useValue: [] }], diff --git a/ng6-seed/src/assets/data/flyhi.json b/ng6-seed/src/assets/data/flyhi.json index 069c4e8..3e58211 100644 --- a/ng6-seed/src/assets/data/flyhi.json +++ b/ng6-seed/src/assets/data/flyhi.json @@ -977,7 +977,7 @@ ] }, { - "question":"Constitution Of Employer /Business Applicant", + "question":"Constitution of Employer /Business Applicant", "question_key":"constitution_of_employer_business_applicant", "type":"2", "field_width":"66", @@ -1048,7 +1048,7 @@ "onchange_properties":null }, { - "question":"Occupation Of The Loan Applicant", + "question":"Occupation of The Loan Applicant", "question_key":"occupation_of_the_loan_applicant", "field_width":"33", "type":"2", @@ -1247,7 +1247,7 @@ ] }, { - "question":"Name Of Student", + "question":"Name of Student", "sub_title":"Additional Question", "question_key":"name_of_student", "field_width":"100", @@ -1365,7 +1365,7 @@ "answers":null, "api_properties":null, "is_repeatable":null, - "field_type":"string", + "field_type":"str&num", "validations":[ { "name":"required", @@ -1373,13 +1373,6 @@ "validator":"Validators.required", "message":"Class /Section/ Course Name Required", "value":null - }, - { - "name":"pattern", - "isactive":"1", - "validator":"[A-Za-z ]*", - "message":"alphabets only ", - "value":null } ], "onchange_properties":null @@ -1406,7 +1399,7 @@ ] }, { - "question":"Duration Of The Course", + "question":"Duration of The Course", "question_key":"duration_of_the_course", "place_holder":"Enter text", "field_width":"33", @@ -1415,7 +1408,7 @@ "answers":null, "onchange_properties":null, "is_repeatable":null, - "field_type":"numtoword", + "field_type":"str&num", "validations":[ { "name":"required", @@ -1448,7 +1441,7 @@ ] }, { - "question":"Loan Tenor", + "question":"Loan Tenure", "question_key":"loan_tenor", "place_holder":"Enter text", "field_width":"33", @@ -1457,13 +1450,13 @@ "answers":null, "onchange_properties":null, "is_repeatable":null, - "field_type":"numtoword", + "field_type":"string", "validations":[ { "name":"required", "isactive":"1", "validator":"Validators.required", - "message":"Loan amount Required", + "message":"Loan Tenure Required", "value":null } ]