brewman/overlord/src/app/ledger/ledger.component.html

157 lines
5.6 KiB
HTML
Raw Normal View History

<mat-card>
<mat-card-title-group>
<mat-card-title>Ledger</mat-card-title>
<button mat-button mat-icon-button *ngIf="dataSource.data.length" (click)="exportCsv()">
<mat-icon>save_alt</mat-icon>
</button>
</mat-card-title-group>
<mat-card-content>
<form [formGroup]="form" fxLayout="column">
<div
fxLayout="row"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
fxLayoutAlign="space-around start"
>
<mat-form-field fxFlex>
<input
matInput
[matDatepicker]="startDate"
(focus)="startDate.open()"
placeholder="Start Date"
formControlName="startDate"
autocomplete="off"
/>
<mat-datepicker-toggle matSuffix [for]="startDate"></mat-datepicker-toggle>
<mat-datepicker #startDate></mat-datepicker>
</mat-form-field>
<mat-form-field fxFlex>
<input
matInput
[matDatepicker]="finishDate"
(focus)="finishDate.open()"
placeholder="Finish Date"
formControlName="finishDate"
autocomplete="off"
/>
<mat-datepicker-toggle matSuffix [for]="finishDate"></mat-datepicker-toggle>
<mat-datepicker #finishDate></mat-datepicker>
</mat-form-field>
</div>
<div
fxLayout="row"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
fxLayoutAlign="space-around start"
>
<mat-form-field fxFlex="80">
<input
type="text"
matInput
#accountElement
placeholder="Account"
[matAutocomplete]="auto"
formControlName="account"
autocomplete="off"
/>
<mat-autocomplete
#auto="matAutocomplete"
autoActiveFirstOption
[displayWith]="displayFn"
(optionSelected)="selected($event)"
>
<mat-option *ngFor="let account of accounts | async" [value]="account">{{
account.name
}}</mat-option>
</mat-autocomplete>
</mat-form-field>
<button fxFlex="20" mat-raised-button color="primary" (click)="show()">Show</button>
</div>
</form>
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements">
<!-- Date Column -->
<ng-container matColumnDef="date">
<mat-header-cell *matHeaderCellDef mat-sort-header>Date</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.date }}</mat-cell>
<mat-footer-cell *matFooterCellDef></mat-footer-cell>
</ng-container>
<!-- Particulars Column -->
<ng-container matColumnDef="particulars">
<mat-header-cell *matHeaderCellDef mat-sort-header>Particulars</mat-header-cell>
<mat-cell *matCellDef="let row"
><a [routerLink]="row.url">{{ row.name }}</a></mat-cell
>
<mat-footer-cell *matFooterCellDef>Closing Balance</mat-footer-cell>
</ng-container>
<!-- Type Column -->
<ng-container matColumnDef="type">
<mat-header-cell *matHeaderCellDef mat-sort-header>Type</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.type }}</mat-cell>
<mat-footer-cell *matFooterCellDef>Closing Balance</mat-footer-cell>
</ng-container>
<!-- Narration Column -->
<ng-container matColumnDef="narration">
<mat-header-cell *matHeaderCellDef mat-sort-header>Narration</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.narration }}</mat-cell>
<mat-footer-cell *matFooterCellDef></mat-footer-cell>
</ng-container>
<!-- Debit Column -->
<ng-container matColumnDef="debit">
<mat-header-cell *matHeaderCellDef mat-sort-header class="right">Debit</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{
row.debit | currency: 'INR' | clear
}}</mat-cell>
<mat-footer-cell *matFooterCellDef class="right">{{
debit | currency: 'INR'
}}</mat-footer-cell>
</ng-container>
<!-- Credit Column -->
<ng-container matColumnDef="credit">
<mat-header-cell *matHeaderCellDef mat-sort-header class="right">Credit</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{
row.credit | currency: 'INR' | clear
}}</mat-cell>
<mat-footer-cell *matFooterCellDef class="right">{{
credit | currency: 'INR'
}}</mat-footer-cell>
</ng-container>
<!-- Running Column -->
<ng-container matColumnDef="running">
<mat-header-cell *matHeaderCellDef mat-sort-header class="right">Running</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{
row.running | currency: 'INR' | accounting
}}</mat-cell>
<mat-footer-cell *matFooterCellDef class="right">{{
running | currency: 'INR' | accounting
}}</mat-footer-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row
*matRowDef="let row; columns: displayedColumns"
[class.selected]="selectedRowId === row.id"
[class.unposted]="!row.posted && selectedRowId !== row.id"
(click)="selectRow(row.id)"
></mat-row>
<mat-footer-row *matFooterRowDef="displayedColumns"></mat-footer-row>
</mat-table>
<mat-paginator
#paginator
[length]="dataSource.data.length"
[pageIndex]="0"
[pageSize]="50"
[pageSizeOptions]="[25, 50, 100, 250, 300, 5000]"
>
</mat-paginator>
</mat-card-content>
</mat-card>