Fairoj : Sales PD MIS Report created and issue fixed

This commit is contained in:
venbatechnologies@gmail.com 2020-01-11 16:02:32 +05:30
parent 3d7bd1d99f
commit c335b6f3a7
28 changed files with 850 additions and 55 deletions

View File

@ -54,7 +54,7 @@ import { AngularFireModule } from '@angular/fire';
import { MessagingService } from './shared/messaging.service';
import { environment } from '../environments/environment';
import { AsyncPipe } from '../../node_modules/@angular/common';
import { SalesPdComponent } from './sales-pd/sales-pd.component';
// import { SalesPdComponent } from './sales-pd/sales-pd.component';
import { PdTrigerService } from './personal-discussion/pd-service/pd-triger.service';
@ -75,7 +75,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
AppComponent,
AdminLayoutComponent,
AuthLayoutComponent,
NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe, SalesPdComponent,
NewPasswordDialog,ForgotPass,ChangePasswordDialog, RoleMenuItemsPipe
],
imports: [
BrowserModule,

View File

@ -4,7 +4,6 @@ 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: 'home',
@ -33,7 +32,7 @@ export const AppRoutes: Routes = [{
},
{
path:'sales-pd-list',
component:SalesPdComponent
loadChildren:'./sales-pd/sales-pd.module#SalesPdModule'
},
{
path:'reports',

View File

@ -131,7 +131,7 @@
<!--<span>{{ menuitem.name | translate }}</span>-->
</button>
</span>
<!-- <span *ngFor="let menuitem of horizontalMenuItems.getAll()">
<span *ngFor="let menuitem of horizontalMenuItems.getAll()">
<span *ngIf="menuitem.type === 'multi'">
<button [mat-menu-trigger-for]="multi" matTooltip="{{ menuitem.name}}" matTooltipPosition="below" mat-icon-button class="ml-xs" *ngIf="userRoleType=='10'">
<mat-icon>{{ menuitem.icon }}</mat-icon>
@ -147,8 +147,10 @@
</div>
</mat-menu>
</span>
</span> -->
<button [mat-menu-trigger-for]="multi" matTooltip="Settings" matTooltipPosition="below" mat-icon-button class="ml-xs" *ngIf="userRoleType=='10'">
</span>
<!-- old worked code -->
<!-- <button [mat-menu-trigger-for]="multi" matTooltip="Settings" matTooltipPosition="below" mat-icon-button class="ml-xs" *ngIf="userRoleType=='10'">
<mat-icon>settings</mat-icon>
</button>
<mat-menu #multi="matMenu" class="opt-menu" x-position="before">
@ -158,16 +160,20 @@
<div *ngFor="let menuitem of horizontalMenuItems.getAll()">
<div class="dropdown" *ngIf="menuitem.type === 'multi'">
<div *ngFor="let childitem of menuitem.children">
<button mat-menu-item [routerLink]="['/'+childitem.state ]">{{ childitem.name | translate }}</button>
<button mat-menu-item [routerLink]="['/'+childitem.state ]">{{ childitem.name | translate }}</button> -->
<!-- COMMENTED CODE -->
<!--<ul class="dropdown" *ngIf="childitem.type === 'super-sub'">
<li *ngFor="let subchild of childitem.subchildren">
<a [routerLink]="['/'+subchild.state ]">{{subchild.name | translate}}</a>
</li>
</ul>-->
</div>
<!-- END OF COMMENTED CODE -->
<!-- </div>
</div>
</div>
</mat-menu>
</mat-menu> -->
<button appToggleFullscreen matTooltip="Fullscreen" matTooltipPosition="below" mat-icon-button>
<mat-icon>fullscreen</mat-icon>
</button>

View File

@ -78,13 +78,13 @@
<ng-container matColumnDef="PDType">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="13" fxFlex.lg="16" fxFlex.xl="13" class="cell" *matCellDef="let details;" style="justify-content:flex-end">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="15" fxFlex.lg="16" fxFlex.xl="13" class="cell" *matCellDef="let details;" style="justify-content:flex-end">
<div [ngStyle]="{'color': '#e00201','font-weight': 'bold','font-size':'16px'}" mat-line>{{details.pd_sno}}</div>
<small mat-line>{{details.pd_type_name}}</small>
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell class="cell" *matCellDef="let details;">
<mat-cell fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="22" fxFlex.lg="24" fxFlex.xl="16" class="cell" *matCellDef="let details;">
<span *ngIf="details.is_child" mat-line>
<!-- <b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD - ' + details.parent_pd_id }}</b> -->
<b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD' }}</b>

View File

@ -84,7 +84,7 @@
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell class="cell" *matCellDef="let details;">
<mat-cell class="cell" *matCellDef="let details;" fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="22" fxFlex.lg="24" fxFlex.xl="16">
<!-- <span *ngIf="details.applicant_name" mat-line><b>{{details.applicant_name}}</b></span><br> -->
<span *ngIf="details.is_child" mat-line>
<!-- <b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD - ' + details.parent_pd_id }}</b> -->

View File

@ -81,7 +81,7 @@
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell class="cell" *matCellDef="let details;">
<mat-cell class="cell" *matCellDef="let details;" fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="22" fxFlex.lg="24" fxFlex.xl="16">
<!-- <span *ngIf="details.applicant_name" mat-line><b>{{details.applicant_name}}</b></span><br> -->
<span *ngIf="details.is_child" mat-line>
<!-- <b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD - ' + details.parent_pd_id }}</b> -->

View File

@ -83,7 +83,7 @@
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell class="cell" *matCellDef="let details;">
<mat-cell class="cell" *matCellDef="let details;" fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="22" fxFlex.lg="24" fxFlex.xl="16">
<!-- <span *ngIf="details.applicant_name" mat-line><b>{{details.applicant_name}}</b></span><br> -->
<span *ngIf="details.is_child" mat-line>
<!-- <b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD - ' + details.parent_pd_id }}</b> -->

View File

@ -81,7 +81,7 @@
</mat-cell>
</ng-container>
<ng-container matColumnDef="Name">
<mat-cell class="cell" *matCellDef="let details;">
<mat-cell class="cell" *matCellDef="let details;" fxFlex.xs="20" fxFlex.sm="15" fxFlex.md="22" fxFlex.lg="24" fxFlex.xl="16">
<!-- <span *ngIf="details.applicant_name" mat-line><b>{{details.applicant_name}}</b></span><br> -->
<span *ngIf="details.is_child" mat-line>
<!-- <b>{{details.is_child == 0 ? details.applicant_name : 'Add On PD - ' + details.parent_pd_id }}</b> -->

View File

@ -135,6 +135,7 @@ export class BusinessInfoComponent implements OnInit {
console.log(this.product_abbr);
console.log("com",this.company_id)
this.image_doc_params={pdid:this.pdid,form_id:this.form_id,company_id:this.company_id}
this.getActivity();
}
documentsAndFilesList: any = [];
pdf(fileURL){
@ -165,7 +166,6 @@ export class BusinessInfoComponent implements OnInit {
this.getBusinessEntity();
this.getRelation();
//this.getIndustry();
this.getActivity();
this.getStateCityList();
this.getCountryDataList();
this.initBusinessForm();

View File

@ -21,11 +21,11 @@
<mat-list-item role="listitem" style="height:48px !important;">
<div fxFlex="row">
<div fxFlex="100">
<div fxFlex="50" align="left">
<div fxFlex="30" align="left">
<strong>{{master.lender_short_name}}</strong><br>
<span *ngIf="master.fin_institute_name != null">{{master.fin_institute_name}}</span>
</div>
<div fxFlex="50" align="right">
<div fxFlex="70" align="right">
{{master.branch_name}}
</div>
</div>
@ -36,17 +36,17 @@
<mat-list-item role="listitem" style="height:auto !important;">
<div fxFlex="row">
<div fxFlex="100">
<div fxFlex="50" align="left" *ngIf="master.lender_applicant_id">
<div fxFlex="65" align="left" *ngIf="master.lender_applicant_id">
{{master.lender_applicant_id}}
</div>
<div fxFlex="50" align="right" *ngIf="master.lender_applicant_id">
<div fxFlex="35" align="right" *ngIf="master.lender_applicant_id">
{{master.pd_date_of_initiation}}
</div>
</div>
</div>
</mat-list-item>
<mat-list-item role="listitem" style="height:48px !important;">
<mat-list-item role="listitem" style="height:auto;">
<div fxFlex="row">
<div fxFlex="100">
<div fxFlex="100" align="left" *ngIf="master.product_name">
@ -61,10 +61,10 @@
<mat-list-item role="listitem" style="height:48px !important;" *ngIf="master.loan_amount != 0">
<div fxFlex="row wrap">
<div fxFlex="100">
<div fxFlex="50" align="left" style="color:#e00201;">
<div fxFlex="40" align="left" style="color:#e00201;">
Loan Amount
</div>
<div fxFlex="50" align="right" *ngIf="master.loan_amount">
<div fxFlex="60" align="right" *ngIf="master.loan_amount">
<i class="fa-1x fa fa-rupee"></i><small style="margin-left: 2%; font-size: inherit">{{master.loan_amount}}</small><br>
</div>
</div>

View File

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

View File

@ -0,0 +1,95 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatIconModule, MatInputModule, MatTableModule, MatListModule, MatToolbarModule, MatFormFieldModule, MatTabsModule, MatCardModule, MatPaginatorModule, MatButtonModule, MatExpansionModule, MatProgressBarModule, MatProgressSpinnerModule, MatDatepickerModule } from '@angular/material';
import { FlexLayoutModule } from '@angular/flex-layout';
import { MatTableExporterModule } from 'mat-table-exporter';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { NotifierOptions, NotifierModule } from 'angular-notifier';
const pdCustomNotifierOptions: NotifierOptions = {
position: {
horizontal: {
position: 'right',
distance: 12
},
vertical: {
position: 'top',
distance: 32,
gap: 10
}
},
theme: 'material',
behaviour: {
autoHide: 2000,
onClick: 'hide',
onMouseover: 'pauseAutoHide',
showDismissButton: true,
stacking: 4
},
animations: {
enabled: true,
show: {
preset: 'slide',
speed: 300,
easing: 'ease'
},
hide: {
preset: 'fade',
speed: 300,
easing: 'ease',
offset: 50
},
shift: {
speed: 300,
easing: 'ease'
},
overlap: 150
}
};
@NgModule({
imports: [
CommonModule,
MatInputModule,
MatIconModule,
MatTableModule,
MatListModule,
MatToolbarModule,
MatFormFieldModule,
MatTabsModule,
MatCardModule,
MatPaginatorModule,
MatButtonModule,
FlexLayoutModule,
MatExpansionModule,
MatProgressBarModule,MatProgressSpinnerModule,
MatTableExporterModule,
ReactiveFormsModule,
FormsModule,
MatDatepickerModule,
NotifierModule.withConfig(pdCustomNotifierOptions),
],
exports:[
CommonModule,
MatInputModule,
MatIconModule,
MatTableModule,
MatListModule,
MatToolbarModule,
MatFormFieldModule,
MatTabsModule,
MatCardModule,
MatPaginatorModule,
MatButtonModule,
FlexLayoutModule,
MatExpansionModule,
MatProgressBarModule,MatProgressSpinnerModule,
MatTableExporterModule,
ReactiveFormsModule,
FormsModule,
MatDatepickerModule,
NotifierModule,
],
declarations: []
})
export class MaterialModule { }

View File

@ -0,0 +1,177 @@
<!-- <div *ngIf="listView"> -->
<mat-card>
<div fxLayout="row" fxLayoutAlign="start center" class="mb-1">
<div class="ml-xs mr-xs" style="width: 100%;">
<mat-card-title><span>Sales PD MIS Report </span>
<button class="btn_export" mat-raised-button color="primary" (click)="exp.exportTable('xlsx',{fileName:'Sales PD MIS Report'})" [disabled]="dataLength == 0 ? true : false || dataLength == -1 ? true : false" >Excel Export</button>
<!-- (click)="ExportTOExcel()" -->
</mat-card-title>
</div>
</div>
<mat-card-content no-padding #card_c>
<div *ngIf="!Loading" class="report-card-container mat-elevation-z8">
<div class="relative" *ngIf="error.length > 0;else anotherdata;">
<div class="form-back">
<div class="relative error-wrapper" *ngFor="let er of error let i = index;">
<mat-icon class="error-icon" style="color:red;">error</mat-icon>
<h1 style="color:red;"> Error! </h1>
<span *ngIf="er.error_type == 2" class="error-text" style="color:red;">{{er.error_status}}</span>
<h2 style="color:red;"> {{er.error_text}} </h2>
<div class="error-details" style="color:red;">
<p>Sorry, but the page you were trying to view does not exist</p>
<p *ngIf="er.error_type == 2" >{{er.error_message}}</p>
</div>
</div>
</div>
</div>
<ng-template #anotherdata>
<br/>
<div fxLayout="row" fxLayoutAlign="start center" class="filter-header">
<div class="ml-xs mr-xs" style="width: 100%;">
<form [formGroup]="reportform">
<mat-expansion-panel [(expanded)]="expandStatus">
<mat-expansion-panel-header>
<mat-panel-title class="text-xs-left">
<h6 class="mt-0">
<mat-icon>filter_list</mat-icon> Filter</h6>
</mat-panel-title>
</mat-expansion-panel-header>
<div>
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
<input matInput type="text" placeholder="Officer Name" formControlName="officer_name">
</mat-form-field>
<mat-form-field class="ml-xs mr-xs" style="width:30%">
<input matInput [max]="maxDate" [matDatepicker]="picker" formControlName="from_date" placeholder="From Date" (dateChange)="getDateObjects($event.target.value)">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
<mat-form-field class="ml-xs mr-xs" style="width:30%">
<input matInput [matDatepicker]="picker1" [min]="minDate" [max]="maxDate" formControlName="to_date" placeholder="To Date">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1 ></mat-datepicker>
</mat-form-field>
<!-- <mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 30%;">
<input matInput type="text" placeholder="Lender Short Name" formControlName="lender_id">
</mat-form-field> -->
<div align="right">
<button type="button" mat-raised-button mat-icon-button (click)="onReset()"
matTooltip="Reset" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary">
<mat-icon>settings_backup_restore</mat-icon>
</button>
<button type="button" mat-raised-button mat-icon-button
matTooltip="Search" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" type="button" (click)="searchPanel()">
<mat-icon>search</mat-icon>
</button>
</div>
</div>
</mat-expansion-panel>
</form>
<br/>
</div>
</div>
<div class="report-table-container mat-elevation-z8 " #TABLE>
<div *ngIf="dataLength != 0 && dataLength != -1" #table_start>
<table mat-table matTableExporter [dataSource]="dataSource" matSort #exporter="matTableExporter">
<ng-container matColumnDef="serialno">
<th mat-header-cell *matHeaderCellDef mat-sort-header >Sr. No. </th>
<td mat-cell *matCellDef="let row; let i = index;"> {{i+1}} </td>
</ng-container>
<ng-container matColumnDef="sales_pd_id" >
<th mat-header-cell *matHeaderCellDef mat-sort-header>Sales PD ID</th>
<td mat-cell *matCellDef="let row">
<span *ngIf="row.sales_pd_id" mat-line>{{row.sales_pd_id}}</span> </td>
</ng-container>
<ng-container matColumnDef="sales_pd_sno">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Reference Number</th>
<td mat-cell *matCellDef="let row">
<span *ngIf="row.sales_pd_sno" mat-line>{{row.sales_pd_sno}}</span> </td>
</ng-container>
<ng-container matColumnDef="applicant_name" sticky>
<th mat-header-cell *matHeaderCellDef mat-sort-header>Main Loan Applicant </th>
<td mat-cell *matCellDef="let row">
<span *ngIf="row.applicant_name" mat-line>{{row.applicant_name}}</span> </td>
</ng-container>
<ng-container matColumnDef="officer_name">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Sales Person</th>
<td mat-cell *matCellDef="let row">
<span *ngIf="row.officer_name" mat-line>{{row.officer_name}}</span> </td>
</ng-container>
<ng-container matColumnDef="status">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Status</th>
<td mat-cell *matCellDef="let row">
<span *ngIf="row.status" mat-line>{{row.status}}</span> </td>
</ng-container>
<ng-container matColumnDef="createdon">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Date</th>
<td mat-cell *matCellDef="let row">
<span *ngIf="row.createdon" mat-line> {{row.createdon | date: 'dd-MM-yyyy hh:mm a'}}</span> </td>
</ng-container>
<ng-container matColumnDef="mail_status">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Mail Status</th>
<td mat-cell *matCellDef="let row">
<span *ngIf="row.mail_status" mat-line> {{row.mail_status}}</span> </td>
</ng-container>
<!-- <ng-container matColumnDef="applicant_id">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Applicant ID</th>
<td mat-cell *matCellDef="let row">
<span *ngIf="row.applicant_id" mat-line>{{row.applicant_id}}</span> </td>
</ng-container>
<ng-container matColumnDef="abbr">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Product</th>
<td mat-cell *matCellDef="let row">
<span *ngIf="row.abbr" mat-line>{{row.abbr}}</span> </td>
</ng-container> -->
<!-- <ng-container matColumnDef="short_name">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Lender</th>
<td mat-cell *matCellDef="let row">
<span *ngIf="row.short_name" mat-line>{{row.short_name}}</span> </td>
</ng-container> -->
<tr mat-header-row *matHeaderRowDef="displayedColumns" ></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;">
</tr>
</table>
</div>
<div *ngIf="dataLength == 0" class="nocontent ml-xs mr-xs" style="padding: 1rem !important;">No records found</div>
</div>
</ng-template>
</div>
<div *ngIf="Loading">
<div fxLayoutAlign="center">
<mat-progress-spinner mode="indeterminate" class="primary"></mat-progress-spinner>
</div>
<p class="nocontent">Fetching Report...</p>
</div>
</mat-card-content>
</mat-card>
<!-- </div> -->
<!-- <div *ngIf="!listView">
<app-pd-team-edit [childMessage]="parentMessage"></app-pd-team-edit>
</div> -->

View File

@ -0,0 +1,99 @@
/** Card title */
.mat-card-title{
font-size: 25px !important;
}
/** CSS for "No record Found Text " and "Loading Text" */
.nocontent {
color: red;
font-size: 16px;
text-align: center;
width: 100%;
}
/** Filter Header Css (Overall) */
.filter-header {
min-height: 64px;
padding: 8px 24px 0;
}
/** Export Button CSS */
.btn_export
{
float: right;
}
/** Report Card Common Css (Overall) */
.report-card-container {
display: flex;
flex-direction: column;
min-width: 300px;
}
/** Report Table Common Css (Overall)*/
.report-table-container {
max-height:540px;
width: auto;
overflow: auto;
margin-top: 2%;
}
/** Table Header Cell Css*/
.mat-header-cell {
padding: 0 10px 0 10px;
white-space: pre-wrap;
font-size: 1rem !important;
}
/** Table Body Cell Css*/
.mat-cell {
padding: 0 10px 0 10px;
white-space: nowrap;
}
/** Table Static Columns Css*/
.mat-table-sticky {
border-right: 1px solid #e0e0e0;
}
/** Table Footer Cell Css - not In use*/
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
padding: 0 10px 0 10px;
}
/* Error Text Font Size*/
.error-text{
font-size: 6rem !important;
}
.error-wrapper{
padding-top: 2rem !important;//default is 5 rem
}
.error-icon{
width: 100px;
font-size: 79px !important;
}
.form-back{
background-position: top center;
min-height: calc(100vh + 100px);
height: auto;
background-color: #fff !important;
color:red !important;
}
.mat-column-status{
text-align: center;
}
.mat-column-serialno{
text-align: center;
}
.mat-column-sales_pd_id{
text-align: center;
}
.mat-column-createdon{
text-align: center;
}

View File

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

View File

@ -0,0 +1,273 @@
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { PageEvent, MatTableDataSource, MatPaginator, MatSort } from '@angular/material';
import { DatePipe } from '@angular/common';
import { FormGroup, FormBuilder } from '@angular/forms';
import { SalesPdService } from '../services/sales-pd.service';
import { Router } from '@angular/router';
import { NotifierService } from 'angular-notifier';
import { AngularCsv } from 'angular-csv-ext/dist/Angular-csv';
import * as XLSX from 'xlsx';
import { start } from 'repl';
@Component({
selector: 'app-mis-reports',
templateUrl: './mis-reports.component.html',
styleUrls: ['./mis-reports.component.scss']
})
export class MisReportsComponent implements OnInit {
@ViewChild('card_c') scroll_table:ElementRef
pageEvent:PageEvent;
pipe = new DatePipe('en-US');
maxDate: any;
minDate: any;
api_data:any=[];
filtered_data:any=[];
public Loading: boolean;
public reportform: FormGroup;
public dataLength:number=-1;
public pageSize : number;
public dataSource = new MatTableDataSource();
error:any=[];
pageNumber:number=10;
pageIndex:number=0
displayedColumns = ['serialno',
'sales_pd_id',
'sales_pd_sno',
'applicant_name',
'officer_name',
'status',
'createdon',
'mail_status'
];
expandStatus: boolean=true;
constructor(private salesPDService:SalesPdService,private router:Router,private form_builder:FormBuilder,private notifier:NotifierService) {
this.reportform = this.form_builder.group({
from_date:[null],to_date:[null],officer_name:[null],lender_id:[null]});
}
ngOnInit(){
this.maxDate = new Date();
// this.getMISDailyReport();
}
getMISDailyReport() {
let array=[]
this.salesPDService.salesPDMisReport(array).subscribe(
data => {
if(data.dataStatus == true){
this.api_data = data.records;
this.dataLength = data.records.length;
this.pageSize = data.records.length;
// if(data.records.length >= 1){
// this.api_data = this.api_data.map((val, i)=>{
// val['serialno'] = i + 1;
// return val;
// })
// }
this.dataSource.data = this.api_data;
this.Loading = false;
}else{
this.dataLength = 0;
// this.Loading = true;
}
},
error => {
this.error.push(error);
this.dataLength = 0;
this.Loading = false;
})
}
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
// @ViewChild('TABLE') table: ElementRef;
@ViewChild('TABLE',{ read: ElementRef }) table: ElementRef;
@ViewChild('exporter') exp
// exportAsExcel():void {
// const ws: XLSX.WorkSheet=XLSX.utils.table_to_sheet(this.table.nativeElement);
// const wb: XLSX.WorkBook = XLSX.utils.book_new();
// XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
// /* save to file */
// XLSX.writeFile(wb, 'Daily MIS Report.xlsx');
// }
// exportAsCSV(){
// console.log(this.exp)
// var options = {
// fieldSeparator: ',',
// quoteStrings: '"',
// decimalseparator: '.',
// showLabels: true,
// showTitle: true,
// title: 'Your title',
// useBom: true,
// noDownload: true,
// headers: this.displayedColumns,
// nullToEmptyString: true,
// };
// // console.log(this.table.nativeElement)
// new AngularCsv(this.dataSource.data,'sample')
// }
ngAfterViewInit() {
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}
/** For Display Tables Filtering */
applyFilter(filterValue: string) {
filterValue = filterValue.trim(); // Remove whitespace
filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches
this.dataSource.filter = filterValue;
}
pageChange(e) {
console.log(e);
}
searchPanel(){
this.Loading=true;
this.reportform.value.from_date=this.pipe.transform(this.reportform.value.from_date,'yyyy-MM-dd')
this.reportform.value.to_date=this.pipe.transform(this.reportform.value.to_date,'yyyy-MM-dd')
// OLD API
// this.reportsService.retirveDataForMISDailyReport(this.reportform.value).subscribe(res=>{
this.salesPDService.salesPDMisReport(this.reportform.value).subscribe(res=>{
if(res['dataStatus'] == true){
this.dataSource.data=res['records'];
this.dataLength=res['records'].length;
setTimeout(()=>{
console.log(this.exp);
})
this.expandStatus=false
// const element = document.querySelector('.report-card-container');
// this.scroll_table.nativeElement.scrollIntoView(true)
setTimeout(()=>{
this.scroll_table.nativeElement.scrollIntoView({block:"end"})
console.log("Console",this.scroll_table,this.table,this.exp)
})
if(this.dataLength == 0){
console.log("data length",this.dataLength)
this.notifier.notify('warning', 'No Records Found !');
this.dataSource.data = [];
this.dataLength=0
}
}
else{
this.notifier.notify('Warning', 'Something Went Wrong');
this.dataSource.data = [];
this.dataLength=0
}
this.Loading=false
},error => {
//this.errorMessage.push(error);
this.error.push(error)
this.dataLength=0
this.Loading = false;
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);
});
}
onReset(){
// if(this.reportform.value.filter(val=>val.))
// this.Loading=true
this.reportform.reset();
this.dataLength = -1;
// this.getMISDailyReport()
// this.expandStatus=false
}
filterForApplicantID(arrayData: any, Values: any) {
Values = Values.toLowerCase();
if (Values) {
let Filter: any = [];
let getAllApplicationIDOnly = arrayData.map(v => v.application_id.replace(/[^A-Za-z0-9]/ig, "").toLowerCase());
let searched_filter_array = getAllApplicationIDOnly.filter(val => val.includes(Values));
Filter = searched_filter_array.map(x => {
let findIndex = getAllApplicationIDOnly.indexOf(x);
return arrayData[findIndex];
});
return Filter.length > 0 ? Filter : arrayData;
}
else{
return arrayData;
}
}
filterForCity(arrayData: any, Values: any) {
Values = Values.toLowerCase();
if (Values) {
let Filter: any = [];
// console.log("arra",JSON.parse(arrayData),Values);
let getAllCityOnly = arrayData.map(v => v.city.replace(/[^A-Za-z0-9]/ig, "").toLowerCase());
console.log("getall ",getAllCityOnly)
let searched_filter_array = getAllCityOnly.filter(val => val.includes(Values));
Filter = searched_filter_array.map(x => {
console.log("x",x);
let findIndex = getAllCityOnly.indexOf(x);
return arrayData[findIndex];
});
return Filter.length > 0 ? Filter : arrayData;
}
else{
return arrayData;
}
}
filterForBranch(arrayData: any, Values: any) {
Values = Values.toLowerCase();
if (Values) {
let Filter: any = [];
let getAllBranchOnly = arrayData.map(v => v.branch.replace(/[^A-Za-z0-9]/ig, "").toLowerCase());
let searched_filter_array = getAllBranchOnly.filter(val => val.includes(Values));
Filter = searched_filter_array.map(x => {
let findIndex = getAllBranchOnly.indexOf(x);
return arrayData[findIndex];
});
return Filter.length > 0 ? Filter : arrayData;
}
else{
return arrayData;
}
}
// customFilter(array,value,flag){
// if(flag == 3){
// var str = array.branch.split("").join("").toLowercase();
// return str.includes(value)?array:null;
// }
// }
getDateObjects(values: any) {
let selected_date = this.pipe.transform(values, 'yyyy/MM/dd');
this.minDate = new Date(selected_date);
}
}

View File

@ -1,15 +1,23 @@
<mat-card class="p-2" style="box-shadow: 0 0 1px rgba(0,0,0,.18), 0 0 1px rgba(0,0,0,.15) !important">
<div fxLayout="row">
<!-- <mat-card-header> -->
<mat-card-title style="padding:0!important;">
<h5 style="margin: 0">Sales PD List</h5>
</mat-card-title>
<!-- </mat-card-header> -->
<div fxLayout="row" style="margin-left:3%;">
<div fxFlex="50" class="pb-0 text-sm-left">
<mat-form-field dividerColor="primary" style="width: 50%;">
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter" [(ngModel)]="filter_input">
<span matSuffix class="close_btn_filter" *ngIf="filter_input != ''" (click)="filter_input = '';applyFilter(filter_input)"><mat-icon>close</mat-icon></span>
</mat-form-field>
</div>
</div>
<mat-tab-group class="mt-1">
<mat-tab>
<ng-template mat-tab-label>Sales PD</ng-template>
<mat-card-content>
<!-- <mat-tab-group class="mt-1">
<mat-tab> -->
<!-- <ng-template mat-tab-label>Sales PD</ng-template> -->
<mat-card-content [hidden]="salesPdData.length == 0">
<!-- <mat-expansion-panel [(expanded)]="xpandStatus"> -->
<!-- <mat-expansion-panel-header>
<mat-panel-title class="text-xs-left">
@ -92,7 +100,7 @@
</mat-cell>
</ng-container>
<ng-container matColumnDef="Applicant Name">
<mat-cell class="cell" *matCellDef="let details;" fxFlex.xs="20" fxFlex.sm="17" fxFlex.md="18" fxFlex.lg="20" fxFlex.xl="18">
<mat-cell class="cell" *matCellDef="let details;" fxFlex.xs="20" fxFlex.sm="17" fxFlex.md="19" fxFlex.lg="23" fxFlex.xl="18">
<span *ngIf="!details.applicant_name" mat-line>
<small>--</small>
</span>
@ -142,13 +150,13 @@
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">
</mat-row>
</mat-table>
<mat-paginator *ngIf="!recordStatus" #paginator [length]="salesPdData.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>
</mat-card-content>
<mat-paginator *ngIf="!recordStatus" #paginator class="mat-elevation-z1" [length]="salesPdData.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25,50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>
</mat-tab>
</mat-tab-group>
<!-- </mat-tab>
</mat-tab-group> -->
</mat-card>

View File

@ -18,3 +18,10 @@
.toolbar-space {
flex: 0.01 0 auto;
}
.close_btn_filter{
color: gainsboro
}
.close_btn_filter:hover{
color: black;
cursor: pointer;
}

View File

@ -11,6 +11,7 @@ import { UserService } from 'app/settings/service/user.service';
export class SalesPdComponent implements OnInit {
public dataLengthTab4: number;
public dataSourceTab4 = new MatTableDataSource();
filter_input:string='';
displayedColumns = ['SalesPdId','SalesPdSno','Applicant Name','Short Name','Officer Name','status','Create On','Action'];

View File

@ -0,0 +1,25 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SalesPdComponent } from './sales-pd-list/sales-pd.component';
import { MisReportsComponent } from './mis-reports/mis-reports.component';
const routes: Routes = [
{
path:'',
redirectTo:'list-pd',
pathMatch:'full'
},
{
path:'list-pd',
component:SalesPdComponent
},
{
path:'reports',
component:MisReportsComponent
}];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class SalesPdRoutingModule { }

View File

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

View File

@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SalesPdRoutingModule } from './sales-pd-routing.module';
import { SalesPdComponent } from './sales-pd-list/sales-pd.component';
import { MaterialModule } from './material_modules/material.module';
import { MisReportsComponent } from './mis-reports/mis-reports.component';
import { MAT_DATE_LOCALE } from '@angular/material';
@NgModule({
imports: [
CommonModule,
SalesPdRoutingModule,
MaterialModule
],
declarations: [SalesPdComponent, MisReportsComponent],
providers:[{ provide: MAT_DATE_LOCALE, useValue: 'en-GB' }]
})
export class SalesPdModule { }

View File

@ -1,9 +0,0 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class SalesPdService {
constructor() { }
}

View File

@ -0,0 +1,22 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import {environment} from 'environments/environment'
import { catchError } from 'rxjs/operators';
import { Observable } from 'rxjs';
const api_url=environment.apiEndpoint
@Injectable({
providedIn: 'root'
})
export class SalesPdService {
constructor(private _http:HttpClient) { }
salesPDMisReport(params): Observable<any>{
return this._http.post(api_url+'salesPDMisReport',params)
}
}

View File

@ -28,6 +28,16 @@ const HORIZONTALMENUITEMS = [
// type: 'link',
// icon: 'home'
// },
{
state:'reports',
name:'MIS Reports',
type:'multi',
icon:'report',
children:[
{state:'reports',name:'Credit PD'},
{state:'sales-pd-list/reports',name:'Sales PD'}
]
},
{
state:'setting',
name:'Manage',
@ -64,13 +74,15 @@ const HORIZONTALMENUITEMS = [
name:'Sales PD',
type:'link',
icon:'work',
},
{
state:'reports',
name:'Reports',
type:'link',
icon:'report',
},
}
// {
// state:'reports',
// name:'Reports',
// type:'link',
// icon:'report',
// },
];
@Injectable()

View File

@ -106,11 +106,21 @@ const MENUITEMS : Menu[] = [
type:'link',
icon:'work',
},
// {
// state:'reports',
// name:'Reports',
// type:'link',
// icon:'report',
// }
{
state:'reports',
name:'Reports',
type:'link',
name:'MIS Reports',
type:'multi',
icon:'report',
children:[
{state:'reports',name:'Credit PD'},
{state:'sales-pd-list/reports',name:'Sales PD'}
]
}
];