Merge branch 'master' of https://bitbucket.org/sriramv18/sparqsineedge
This commit is contained in:
parent
9c8cacf18d
commit
40eff8df50
602
ng6-seed/package-lock.json
generated
602
ng6-seed/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -45,7 +45,7 @@
|
|||||||
"core-js": "^2.6.11",
|
"core-js": "^2.6.11",
|
||||||
"d3": "^4.9.1",
|
"d3": "^4.9.1",
|
||||||
"dragula": "3.7.2",
|
"dragula": "3.7.2",
|
||||||
"file-saver": "^2.0.2",
|
"file-saver": "^2.0.5",
|
||||||
"firebase": "^6.6.2",
|
"firebase": "^6.6.2",
|
||||||
"font-awesome": "4.7.0",
|
"font-awesome": "4.7.0",
|
||||||
"hammerjs": "2.0.8",
|
"hammerjs": "2.0.8",
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
import { ExcelExportDirective } from './excel-export.directive';
|
||||||
|
|
||||||
|
describe('ExcelExportDirective', () => {
|
||||||
|
it('should create an instance', () => {
|
||||||
|
const directive = new ExcelExportDirective();
|
||||||
|
expect(directive).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
import { Directive, Input, HostListener } from '@angular/core';
|
||||||
|
import { ExcelExportService } from '../excel-export-service/excel-export.service';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[appExcelExport]'
|
||||||
|
})
|
||||||
|
export class ExcelExportDirective {
|
||||||
|
|
||||||
|
constructor(private excelExportService:ExcelExportService) { }
|
||||||
|
|
||||||
|
@Input('appExcelExport') customers: any[];
|
||||||
|
@Input() fileName: string;
|
||||||
|
|
||||||
|
@HostListener('click', ['$event']) onClick($event) {
|
||||||
|
console.log('clicked: ' + $event);
|
||||||
|
this.excelExportService.exportExcel(this.customers, this.fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ExcelExportService } from './excel-export.service';
|
||||||
|
|
||||||
|
describe('ExcelExportService', () => {
|
||||||
|
beforeEach(() => TestBed.configureTestingModule({}));
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
const service: ExcelExportService = TestBed.get(ExcelExportService);
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import * as FileSaver from 'file-saver';
|
||||||
|
import * as XLSX from 'xlsx';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class ExcelExportService {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
fileType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
||||||
|
fileExtension = '.xlsx';
|
||||||
|
|
||||||
|
|
||||||
|
public exportExcel(jsonData: any[], fileName: string): void {
|
||||||
|
|
||||||
|
const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(jsonData);
|
||||||
|
const wb: XLSX.WorkBook = { Sheets: { 'data': ws }, SheetNames: ['data'] };
|
||||||
|
const excelBuffer: any = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||||
|
this.saveExcelFile(excelBuffer, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private saveExcelFile(buffer: any, fileName: string): void {
|
||||||
|
const data: Blob = new Blob([buffer], {type: this.fileType});
|
||||||
|
FileSaver.saveAs(data, fileName + this.fileExtension);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -29,6 +29,7 @@ import {NotifierModule,NotifierOptions} from 'angular-notifier'
|
|||||||
import { MatTableExporterModule } from 'mat-table-exporter';
|
import { MatTableExporterModule } from 'mat-table-exporter';
|
||||||
import { SmcCreditComponent } from './smc-credit/smc-credit.component';
|
import { SmcCreditComponent } from './smc-credit/smc-credit.component';
|
||||||
import { SmcRemarksComponent } from './smc-remarks/smc-remarks.component';
|
import { SmcRemarksComponent } from './smc-remarks/smc-remarks.component';
|
||||||
|
import { ExcelExportDirective } from './excel-export-directive/excel-export.directive';
|
||||||
|
|
||||||
|
|
||||||
const pdCustomNotifierOptions: NotifierOptions = {
|
const pdCustomNotifierOptions: NotifierOptions = {
|
||||||
@ -98,8 +99,8 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
|||||||
MatDatepickerModule,
|
MatDatepickerModule,
|
||||||
MatTableExporterModule,MatDialogModule
|
MatTableExporterModule,MatDialogModule
|
||||||
],
|
],
|
||||||
exports: [MatExpansionModule,SmcRemarksComponent],
|
exports: [MatExpansionModule,SmcRemarksComponent,ExcelExportDirective],
|
||||||
declarations: [PdMisComponent, SmcCreditComponent, SmcRemarksComponent],
|
declarations: [PdMisComponent, SmcCreditComponent, SmcRemarksComponent, ExcelExportDirective],
|
||||||
providers:[ReportsService,{provide: MAT_DATE_LOCALE, useValue: 'en-GB'},{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
|
providers:[ReportsService,{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: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS},],
|
||||||
entryComponents:[SmcRemarksComponent]
|
entryComponents:[SmcRemarksComponent]
|
||||||
|
|||||||
@ -4,8 +4,10 @@
|
|||||||
<div class="ml-xs mr-xs" style="width: 100%;">
|
<div class="ml-xs mr-xs" style="width: 100%;">
|
||||||
<mat-card-title><span>MW Credit PD MIS Report </span>
|
<mat-card-title><span>MW Credit PD MIS Report </span>
|
||||||
|
|
||||||
<button class="btn_export" mat-raised-button color="primary" (click)="exp.exportTable('xlsx',{fileName:'SMC Credit PD MIS Report'})" [disabled]="dataLength == 0 ? true : false || dataLength == -1 ? true : false" >Excel Export</button>
|
<!-- <button class="btn_export" mat-raised-button color="primary" (click)="exp.exportTable('xlsx',{fileName:'SMC Credit PD MIS Report'})" [disabled]="dataLength == 0 ? true : false || dataLength == -1 ? true : false" >Excel Export</button> -->
|
||||||
|
|
||||||
|
<button class="btn_export" mat-raised-button color="primary" [appExcelExport]="exportExcelTableData" fileName="customers" [disabled]="dataLength == 0 ? true : false || dataLength == -1 ? true : false" >Excel Export</button>
|
||||||
|
|
||||||
<!-- (click)="ExportTOExcel()" -->
|
<!-- (click)="ExportTOExcel()" -->
|
||||||
</mat-card-title>
|
</mat-card-title>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { SalesPdService } from 'app/sales-pd/services/sales-pd.service';
|
|||||||
import { ReportsService } from '../reports.service';
|
import { ReportsService } from '../reports.service';
|
||||||
import {SmcRemarksComponent}from '../smc-remarks/smc-remarks.component';
|
import {SmcRemarksComponent}from '../smc-remarks/smc-remarks.component';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
import { ExcelExportService } from '../excel-export-service/excel-export.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-smc-credit',
|
selector: 'app-smc-credit',
|
||||||
templateUrl: './smc-credit.component.html',
|
templateUrl: './smc-credit.component.html',
|
||||||
@ -50,9 +51,11 @@ export class SmcCreditComponent implements OnInit {
|
|||||||
];
|
];
|
||||||
expandStatus: boolean=true;
|
expandStatus: boolean=true;
|
||||||
|
|
||||||
|
customers: any = [];
|
||||||
|
exportExcelTableData: any;
|
||||||
|
excelExportData: any = [];
|
||||||
|
|
||||||
constructor(private reportService:ReportsService,private dialog: MatDialog,private router:Router,private route: ActivatedRoute,private form_builder:FormBuilder,private notifier:NotifierService) {
|
constructor(private excelExportService:ExcelExportService,private reportService:ReportsService,private dialog: MatDialog,private router:Router,private route: ActivatedRoute,private form_builder:FormBuilder,private notifier:NotifierService) {
|
||||||
this.reportform = this.form_builder.group({
|
this.reportform = this.form_builder.group({
|
||||||
from_date:[null],to_date:[null],officer_name:[null],lender_id:[null]});
|
from_date:[null],to_date:[null],officer_name:[null],lender_id:[null]});
|
||||||
|
|
||||||
@ -79,6 +82,7 @@ export class SmcCreditComponent implements OnInit {
|
|||||||
// }
|
// }
|
||||||
this.dataSource.data = this.api_data;
|
this.dataSource.data = this.api_data;
|
||||||
this.Loading = false;
|
this.Loading = false;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
this.dataLength = 0;
|
this.dataLength = 0;
|
||||||
// this.Loading = true;
|
// this.Loading = true;
|
||||||
@ -139,6 +143,11 @@ export class SmcCreditComponent implements OnInit {
|
|||||||
pageChange(e) {
|
pageChange(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// export() {
|
||||||
|
// this.excelExportService.exportExcel(this.customers, 'customers');
|
||||||
|
// }
|
||||||
|
|
||||||
searchPanel(){
|
searchPanel(){
|
||||||
this.Loading=true;
|
this.Loading=true;
|
||||||
this.reportform.value.from_date=this.pipe.transform(this.reportform.value.from_date,'yyyy-MM-dd')
|
this.reportform.value.from_date=this.pipe.transform(this.reportform.value.from_date,'yyyy-MM-dd')
|
||||||
@ -150,6 +159,23 @@ export class SmcCreditComponent implements OnInit {
|
|||||||
|
|
||||||
this.dataSource.data=res['records'];
|
this.dataSource.data=res['records'];
|
||||||
this.dataLength=res['records'].length;
|
this.dataLength=res['records'].length;
|
||||||
|
|
||||||
|
this.excelExportData = res['records']
|
||||||
|
console.log(this.excelExportData)
|
||||||
|
// return;
|
||||||
|
this.exportExcelTableData = this.excelExportData.map(val=>{
|
||||||
|
console.log('excelExport',val)
|
||||||
|
return {
|
||||||
|
pd_sno:val.pd_sno,
|
||||||
|
applicant_name:val.applicant_name,
|
||||||
|
type_name:val.type_name,
|
||||||
|
abbr:val.abbr,
|
||||||
|
officer_name:val.officer_name,
|
||||||
|
pd_status:val.pd_status,
|
||||||
|
updatedon:val.updatedon
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
console.log(this.exp);
|
console.log(this.exp);
|
||||||
})
|
})
|
||||||
@ -160,6 +186,8 @@ export class SmcCreditComponent implements OnInit {
|
|||||||
this.scroll_table.nativeElement.scrollIntoView({block:"end"})
|
this.scroll_table.nativeElement.scrollIntoView({block:"end"})
|
||||||
console.log("Console",this.scroll_table,this.table,this.exp)
|
console.log("Console",this.scroll_table,this.table,this.exp)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(this.dataLength == 0){
|
if(this.dataLength == 0){
|
||||||
console.log("data length",this.dataLength)
|
console.log("data length",this.dataLength)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user