Added: 5000 Page size in Balance Sheet
Added: Employee Download
This commit is contained in:
parent
08fedaa44d
commit
b8c2e9eeb1
@ -57,7 +57,7 @@
|
|||||||
[length]="dataSource.data.length"
|
[length]="dataSource.data.length"
|
||||||
[pageIndex]="0"
|
[pageIndex]="0"
|
||||||
[pageSize]="50"
|
[pageSize]="50"
|
||||||
[pageSizeOptions]="[25, 50, 100, 250, 300]">
|
[pageSizeOptions]="[25, 50, 100, 250, 300, 5000]">
|
||||||
</mat-paginator>
|
</mat-paginator>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-card-title-group>
|
<mat-card-title-group>
|
||||||
<mat-card-title>Employees</mat-card-title>
|
<mat-card-title>Employees</mat-card-title>
|
||||||
|
<button mat-button mat-icon-button *ngIf="dataSource.data.length" (click)="exportCsv()">
|
||||||
|
<mat-icon>save_alt</mat-icon>
|
||||||
|
</button>
|
||||||
<a mat-button [routerLink]="['/Employee']">
|
<a mat-button [routerLink]="['/Employee']">
|
||||||
<mat-icon>add_box</mat-icon>
|
<mat-icon>add_box</mat-icon>
|
||||||
Add
|
Add
|
||||||
|
@ -6,6 +6,7 @@ import {ActivatedRoute} from '@angular/router';
|
|||||||
import {FormBuilder, FormGroup} from '@angular/forms';
|
import {FormBuilder, FormGroup} from '@angular/forms';
|
||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
import {debounceTime, distinctUntilChanged, startWith} from 'rxjs/operators';
|
import {debounceTime, distinctUntilChanged, startWith} from 'rxjs/operators';
|
||||||
|
import {ToCsvService} from '../../shared/to-csv.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-employee-list',
|
selector: 'app-employee-list',
|
||||||
@ -24,7 +25,7 @@ export class EmployeeListComponent implements OnInit, AfterViewInit {
|
|||||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||||
displayedColumns = ['code', 'name', 'designation', 'salary', 'points', 'department', 'joiningDate', 'leavingDate'];
|
displayedColumns = ['code', 'name', 'designation', 'salary', 'points', 'department', 'joiningDate', 'leavingDate'];
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private fb: FormBuilder) {
|
constructor(private route: ActivatedRoute, private fb: FormBuilder, private toCsv: ToCsvService) {
|
||||||
this.createForm();
|
this.createForm();
|
||||||
this.filter = this.listenToFilterChange();
|
this.filter = this.listenToFilterChange();
|
||||||
}
|
}
|
||||||
@ -57,4 +58,25 @@ export class EmployeeListComponent implements OnInit, AfterViewInit {
|
|||||||
this.filterElement.nativeElement.focus();
|
this.filterElement.nativeElement.focus();
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exportCsv() {
|
||||||
|
const headers = {
|
||||||
|
Code: 'code',
|
||||||
|
Name: 'name',
|
||||||
|
Designation: 'designation',
|
||||||
|
Salary: 'salary',
|
||||||
|
Points: 'points',
|
||||||
|
Department: 'department',
|
||||||
|
JoiningDate: 'joiningDate',
|
||||||
|
LeavingDate: 'leavingDate'
|
||||||
|
};
|
||||||
|
|
||||||
|
const csvData = new Blob([this.toCsv.toCsv(headers, this.dataSource.data)], {type: 'text/csv;charset=utf-8;'});
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = window.URL.createObjectURL(csvData);
|
||||||
|
link.setAttribute('download', 'employees.csv');
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user