forked from xurror/web-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provisioning-entries): view journal entries
Add view provisioning journal entries component. Also, add feature to create provisioning journal entries and recreate provisioning.
- Loading branch information
1 parent
493246b
commit 314fd2b
Showing
11 changed files
with
234 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...nting/provisioning-entries/view-provisioning-entry/view-provisioning-entry.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...ntries/view-provisioning-journal-entries/view-provisioning-journal-entries.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<div class="container"> | ||
|
||
<div fxLayout="row" fxLayoutGap="20px"> | ||
<mat-form-field fxFlex> | ||
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter"> | ||
</mat-form-field> | ||
</div> | ||
|
||
<div class="mat-elevation-z8"> | ||
|
||
<table mat-table [dataSource]="dataSource" matSort> | ||
|
||
<ng-container matColumnDef="id"> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Entry ID </th> | ||
<td mat-cell *matCellDef="let provisioningJournalEntry"> {{ provisioningJournalEntry.id }} </td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="officeName"> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Office </th> | ||
<td mat-cell *matCellDef="let provisioningJournalEntry"> {{ provisioningJournalEntry.officeName }} </td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="transactionDate"> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Transaction Date </th> | ||
<td mat-cell *matCellDef="let provisioningJournalEntry"> {{ provisioningJournalEntry.transactionDate }} </td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="transactionId"> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Transaction ID </th> | ||
<td mat-cell *matCellDef="let provisioningJournalEntry"> {{ provisioningJournalEntry.transactionId }} </td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="glAccountType"> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Type </th> | ||
<td mat-cell *matCellDef="let provisioningJournalEntry"> {{ provisioningJournalEntry.glAccountType.value }} </td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="createdByUserName"> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Type </th> | ||
<td mat-cell *matCellDef="let provisioningJournalEntry"> {{ provisioningJournalEntry.createdByUserName }} </td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="glAccountCode"> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Account Code </th> | ||
<td mat-cell *matCellDef="let provisioningJournalEntry"> {{ provisioningJournalEntry.glAccountCode }} </td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="glAccountName"> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Account Name </th> | ||
<td mat-cell *matCellDef="let provisioningJournalEntry"> {{ provisioningJournalEntry.glAccountName }} </td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="debit"> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Debit </th> | ||
<td mat-cell *matCellDef="let provisioningJournalEntry"><span *ngIf="provisioningJournalEntry.entryType.value === 'DEBIT'"> {{ (provisioningJournalEntry.currency.displaySymbol || provisioningJournalEntry.currency.code) + ' ' + provisioningJournalEntry.amount }} </span></td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="credit"> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Credit </th> | ||
<td mat-cell *matCellDef="let provisioningJournalEntry"><span *ngIf="provisioningJournalEntry.entryType.value === 'CREDIT'"> {{ (provisioningJournalEntry.currency.displaySymbol || provisioningJournalEntry.currency.code) + ' ' + provisioningJournalEntry.amount }} </span></td> | ||
</ng-container> | ||
|
||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> | ||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> | ||
|
||
</table> | ||
|
||
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator> | ||
|
||
</div> | ||
|
||
</div> |
3 changes: 3 additions & 0 deletions
3
...ntries/view-provisioning-journal-entries/view-provisioning-journal-entries.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
table { | ||
width: 100%; | ||
} |
25 changes: 25 additions & 0 deletions
25
...ies/view-provisioning-journal-entries/view-provisioning-journal-entries.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ViewProvisioningJournalEntriesComponent } from './view-provisioning-journal-entries.component'; | ||
|
||
describe('ViewProvisioningJournalEntriesComponent', () => { | ||
let component: ViewProvisioningJournalEntriesComponent; | ||
let fixture: ComponentFixture<ViewProvisioningJournalEntriesComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ ViewProvisioningJournalEntriesComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ViewProvisioningJournalEntriesComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
51 changes: 51 additions & 0 deletions
51
...-entries/view-provisioning-journal-entries/view-provisioning-journal-entries.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Component, OnInit, ViewChild } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material'; | ||
|
||
import { AccountingService } from '../../accounting.service'; | ||
|
||
@Component({ | ||
selector: 'mifosx-view-provisioning-journal-entries', | ||
templateUrl: './view-provisioning-journal-entries.component.html', | ||
styleUrls: ['./view-provisioning-journal-entries.component.scss'] | ||
}) | ||
export class ViewProvisioningJournalEntriesComponent implements OnInit { | ||
|
||
provisioningEntryId: string; | ||
|
||
displayedColumns: string[] = ['id', 'officeName', 'transactionDate', 'transactionId', 'glAccountType', 'createdByUserName', 'glAccountCode', 'glAccountName', 'debit', 'credit']; | ||
dataSource: any; | ||
|
||
@ViewChild(MatPaginator) paginator: MatPaginator; | ||
@ViewChild(MatSort) sort: MatSort; | ||
|
||
constructor(private route: ActivatedRoute, | ||
private accountingService: AccountingService) { } | ||
|
||
ngOnInit() { | ||
this.provisioningEntryId = this.route.snapshot.paramMap.get('id'); | ||
this.getProvisioningJournalEntry(); | ||
} | ||
|
||
getProvisioningJournalEntry() { | ||
this.accountingService.getProvisioningJournalEntries(this.provisioningEntryId) | ||
.subscribe((provisioningJournalEntryData: any) => { | ||
this.dataSource = new MatTableDataSource(provisioningJournalEntryData.pageItems); | ||
this.dataSource.paginator = this.paginator; | ||
this.dataSource.sortingDataAccessor = (transaction: any, property: any) => { | ||
switch (property) { | ||
case 'glAccountType': return transaction.glAccountType.value; | ||
case 'debit': return transaction.amount; | ||
case 'credit': return transaction.amount; | ||
default: return transaction[property]; | ||
} | ||
}; | ||
this.dataSource.sort = this.sort; | ||
}); | ||
} | ||
|
||
applyFilter(filterValue: string) { | ||
this.dataSource.filter = filterValue.trim().toLowerCase(); | ||
} | ||
|
||
} |