Compliance list now shows next hearing date
Search added to case list Export added to compliance and cause list
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
<mat-card>
|
||||
<mat-card-title-group>
|
||||
<mat-card-title>Compliances</mat-card-title>
|
||||
<button mat-button mat-icon-button (click)="exportCsv()">
|
||||
<mat-icon>save_alt</mat-icon>
|
||||
</button>
|
||||
</mat-card-title-group>
|
||||
<mat-card-content>
|
||||
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
|
||||
@ -30,6 +33,12 @@
|
||||
<mat-cell *matCellDef="let row">{{ row.complianceDate }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Next Hearing Date Column -->
|
||||
<ng-container matColumnDef="nextHearingDate">
|
||||
<mat-header-cell *matHeaderCellDef>Next Hearing Date</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.nextHearingDate }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
|
||||
</mat-table>
|
||||
|
||||
@ -4,6 +4,8 @@ import { MatPaginator } from '@angular/material/paginator';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
|
||||
import { Case } from '../core/case';
|
||||
|
||||
import { ComplianceList } from './compliance-list';
|
||||
import { ComplianceListDatasource } from './compliance-list-datasource';
|
||||
|
||||
@ -17,7 +19,13 @@ export class ComplianceListComponent implements OnInit {
|
||||
info: ComplianceList[] = [];
|
||||
dataSource: ComplianceListDatasource = new ComplianceListDatasource(this.info);
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['officeFileNumber', 'title', 'proceedings', 'complianceDate'];
|
||||
displayedColumns = [
|
||||
'officeFileNumber',
|
||||
'title',
|
||||
'proceedings',
|
||||
'complianceDate',
|
||||
'nextHearingDate',
|
||||
];
|
||||
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
@ -29,4 +37,26 @@ export class ComplianceListComponent implements OnInit {
|
||||
this.dataSource = new ComplianceListDatasource(this.info, this.paginator);
|
||||
});
|
||||
}
|
||||
|
||||
exportCsv() {
|
||||
const csvData = new Blob([this.toCsv(this.info)], {
|
||||
type: 'text/csv;charset=utf-8;',
|
||||
});
|
||||
const link = document.createElement('a');
|
||||
link.href = window.URL.createObjectURL(csvData);
|
||||
link.setAttribute('download', 'cause-list.csv');
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
|
||||
toCsv(data: ComplianceList[]): string {
|
||||
const header = ['File No.', 'Title', 'Proceedings', 'Next Hearing', 'Compliance Date'];
|
||||
const csv = data.map(
|
||||
(row) =>
|
||||
`${row.officeFileNumber}\t${row.title}\t${row.proceedings}\t${row.nextHearingDate}\t${row.complianceDate}`,
|
||||
);
|
||||
csv.unshift(header.join('\t'));
|
||||
return csv.join('\r\n');
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ export class ComplianceList {
|
||||
title: string;
|
||||
proceedings: string;
|
||||
complianceDate: string;
|
||||
nextHearingDate: string;
|
||||
|
||||
public constructor(init?: Partial<ComplianceList>) {
|
||||
this.id = '';
|
||||
@ -15,6 +16,7 @@ export class ComplianceList {
|
||||
this.title = '';
|
||||
this.proceedings = '';
|
||||
this.complianceDate = '';
|
||||
this.nextHearingDate = '';
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user