diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 67a867d..ca0eaa9 100755 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -85,6 +85,7 @@ import { PdfViewerModule } from 'ng2-pdf-viewer'; import { BrowserModule, HAMMER_GESTURE_CONFIG, HammerGestureConfig } from '@angular/platform-browser'; //--> import the HAMMER_GESTURE_CONFIG import { ReportViewer } from '../pages/sales_pd/pages/report-pdf-viewer/pdf-modal'; import { AndroidPermissions } from '@ionic-native/android-permissions'; +import { AdvanceFilterPage } from '../pages/sales_pd/pages/advance-filter/advance-filter'; // need the hammerConnfig export class HammerConfig extends HammerGestureConfig { overrides = { @@ -112,7 +113,8 @@ export class HammerConfig extends HammerGestureConfig { PdAllocationPage, InputPage, SalesPDlistPage, - ReportViewer + ReportViewer, + AdvanceFilterPage ], imports: [ BrowserModule,ReactiveFormsModule,FormsModule, @@ -167,7 +169,8 @@ export class HammerConfig extends HammerGestureConfig { PdAllocationPage, InputPage, SalesPDlistPage, - ReportViewer + ReportViewer, + AdvanceFilterPage ], providers: [ diff --git a/src/app/app.scss b/src/app/app.scss index 2f4917d..81e3b7f 100755 --- a/src/app/app.scss +++ b/src/app/app.scss @@ -256,5 +256,7 @@ ion-content { border:1px solid green; border-radius: 10px; } + } +@import "theme/filter-modal"; diff --git a/src/pages/sales_pd/pages/advance-filter/advance-filter.html b/src/pages/sales_pd/pages/advance-filter/advance-filter.html new file mode 100644 index 0000000..edef84e --- /dev/null +++ b/src/pages/sales_pd/pages/advance-filter/advance-filter.html @@ -0,0 +1,83 @@ + + + + + Advance Filter + + + + + + + + + + + + + + + + + {{status}} + + + + + + + + + + + + + + + + {{pro.abbr}} + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/pages/sales_pd/pages/advance-filter/advance-filter.scss b/src/pages/sales_pd/pages/advance-filter/advance-filter.scss new file mode 100644 index 0000000..70a8dda --- /dev/null +++ b/src/pages/sales_pd/pages/advance-filter/advance-filter.scss @@ -0,0 +1,8 @@ +page-advance-filter { + .scroll-content { + background-color: #fff; + } + .mat-raised-button{ + background-color: #e2412f; + } +} diff --git a/src/pages/sales_pd/pages/advance-filter/advance-filter.ts b/src/pages/sales_pd/pages/advance-filter/advance-filter.ts new file mode 100644 index 0000000..c95ca5c --- /dev/null +++ b/src/pages/sales_pd/pages/advance-filter/advance-filter.ts @@ -0,0 +1,140 @@ +import { Component, Input, EventEmitter, Output } from '@angular/core'; +import { IonicPage, NavController, NavParams, ActionSheetController, ViewController } from 'ionic-angular'; +import { FormGroup, FormBuilder } from '@angular/forms'; +import { DatePipe } from '@angular/common'; +import { SalesPdProvider } from '../../providers/sales-pd/sales-pd'; +import { ToastProvider } from '../../../../providers/common-provider/toast'; +import { LoadingProvider } from '../../../../providers/common-provider/loading'; + +/** + * Generated class for the AdvanceFilterPage page. + * + * See https://ionicframework.com/docs/components/#navigation for more info on + * Ionic pages and navigation. + */ + +// @IonicPage() +@Component({ + selector: 'page-advance-filter', + templateUrl: 'advance-filter.html', +}) +export class AdvanceFilterPage { + 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,public navCtrl: NavController, public navParams: NavParams,public actionSheetCtrl: ActionSheetController,private salesPDService:SalesPdProvider,private toastProvider:ToastProvider,private loaderProvider:LoadingProvider,private viewCtrl:ViewController ) { + this.todaydate = new Date(); + this.getDropdown(); + } + + ionViewDidLoad() { + console.log('ionViewDidLoad AdvanceFilterPage'); + } + ngOnInit() { + let local:any = localStorage.getItem('user_details') + this.drop_down_datas = this.navParams.get('drop_down_datas'); + this.setDropDownDatas() + console.log(this.drop_down_datas); + this.searchForm=this._fb.group({ + pd_status:[''], + pd_from_date:[''], + pd_to_date:[''], + pd_products:[''], + pd_lender:[local.fk_entity_id], + pd_applicant_name:[''], + pd_officer:[''], + }) + console.log(this.drop_down_datas) + } + getDropdown(){ + // this.salesPDService.getAllMasterDatas('PDSTATUS').subscribe(res=> + // { + // if(res.dataStatus==true) + // { + // this.pdStatus_all = res.records.filter(status=>status.isactive==1); + // } + // }); + this.salesPDService.getAllMasterDatas('ENTITY').subscribe(res=> + { + if(res.dataStatus==true) + { + this.ENTITY = res.records.filter(ent=>ent.isactive==1); + } + }); + this.salesPDService.getAllMasterDatas('PRODUCTS').subscribe(res=> + { + if(res.dataStatus==true) + { + this.PRODUCTS = res.records.filter(pro=>pro.isactive==1); + } + }); + + } + setDropDownDatas(){ + 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 + this.viewCtrl.dismiss(res['records']) + } + else{ + // this.filteredlistData.emit(res) + this.toastProvider.lenderappmessage('No Records Found...!') + } + }) + } + onReset(){ + this.searchForm.reset(); + this.xpandStatus=false + this.resetFilter.emit(true); + } + closeModal() { + this.viewCtrl.dismiss(); +} + +} diff --git a/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.html b/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.html index 0530ef9..eb16f61 100755 --- a/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.html +++ b/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.html @@ -10,13 +10,19 @@ -Sales PD List +Sales PD List + + + + + - - - + + + + { + // console.log('Async operation has ended'); + event.complete(); + }, 1000); + } getListofPD(){ this.salesPDService.getSalesPDList().subscribe(res=>{ if(res['dataStatus']){ this.sales_displayValue=res['records'] this.loader_access=false + if(this.sales_displayValue.length > 0){ + let products=[] + let lenders=[] + let pd_status=[] + this.sales_displayValue.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.loader_access=false @@ -113,7 +157,20 @@ export class SalesPDlistPage { }) } - + advancefilter(){ + const modalOption:ModalOptions={ + cssClass:'filterModal' + } + const modalCtrl=this.modalCtrl.create(AdvanceFilterPage,{'drop_down_datas':this.filter_drop_down_data},modalOption) + modalCtrl.present(); + modalCtrl.onDidDismiss((data)=>{ + console.log(data) + if(data){ + this.sales_displayValue = data; + } + + }) + } presentActionSheet(value_obj) { let actionSheet = this.actionSheetCtrl.create({ title: 'Select Option', diff --git a/src/pages/sales_pd/providers/sales-pd/sales-pd.ts b/src/pages/sales_pd/providers/sales-pd/sales-pd.ts index d5de17f..1366779 100755 --- a/src/pages/sales_pd/providers/sales-pd/sales-pd.ts +++ b/src/pages/sales_pd/providers/sales-pd/sales-pd.ts @@ -160,4 +160,14 @@ current_section:any; clear_local_key(key){ return this.storage.remove(key) } + + getAllMasterDatas(TableName: string): Observable { + return this.http.post(this.apiUrl + 'getListOfMaster', { "master_name": TableName }) + .pipe( + // catchError(this.handleError('role', [])) + ) + } + advancedFilter(params): Observable{ + return this.http.post(this.apiUrl+'filterSalesPDList',{"records":params}) + } } diff --git a/src/providers/constants/constants.ts b/src/providers/constants/constants.ts index d01afad..e635d10 100755 --- a/src/providers/constants/constants.ts +++ b/src/providers/constants/constants.ts @@ -51,7 +51,7 @@ export class ConstantsProvider { lenUserPoolId: "ap-south-1_hFiGyr1Gw", // Username lenClientId: "38v9rpp1495v60e1gd14mj6rjr", // ClientName for Mobile } - return production; + return testing; } diff --git a/src/theme/filter-modal.scss b/src/theme/filter-modal.scss new file mode 100644 index 0000000..32e3e68 --- /dev/null +++ b/src/theme/filter-modal.scss @@ -0,0 +1,68 @@ +.filterModal{ + padding: 6.4%; + // padding: 30px; + background-color: rgba(0, 0, 0, 0.56); + // padding: 30px; + color:red; + // filter:blur(5px); + //color:lightcyan; + // background-color:gray; + .modal-wrapper { + // border-radius: 7px; + // background: rgba(0, 0, 0, 0.5); + // color: gray; + + height: 80% !important; + width:100% !important; + // margin-top: 13.5%; + border-radius: 10px; + margin-top:10%; + + mat-card{ + // background-color:rgb(252, 252, 161); + background-color:white; + box-shadow: 2px 2px lavender; + border-radius: 5px; + min-height: 13em; + // height: 16.5em; + max-height: 16.5em; + border:1px solid lavender; + } + .mat-card-title{ + + font-weight: bold; + font-size: 16px; + color:#e2412f; + } + mat-card-content{ + margin-left: 4%; + } + ion-item{ + // background-color:rgb(252, 252, 161); + background-color: lightcyan; + } + // margin-right: 15%; + + button{ + font-size: 12px; + // height: 40px; + color:#e2412f; + // margin-bottom: 10px; + position: relative; + bottom:0.5em; + } + // input{ + // // border:1px solid blueviolet; + // } + mat-form-field{ + width: 100%; + margin-top: 3%; + } + mat-radio-button{ + margin-top: 2%; + } + + + } + + } \ No newline at end of file