feat: savings account transactions (view-reciept) (#949)

Fixes: #948
This commit is contained in:
Karan Takalkar
2020-06-29 17:36:11 +05:30
committed by GitHub
parent be0e7032a7
commit b1c4efccbf
13 changed files with 156 additions and 11 deletions
@@ -47,7 +47,7 @@
<ng-container matColumnDef="viewReciept">
<th mat-header-cell *matHeaderCellDef> View Reciept </th>
<td mat-cell *matCellDef="let transaction">
<button class="account-action-button" mat-raised-button color="primary">
<button class="account-action-button" mat-raised-button color="primary" (click)="routeEdit($event)" [routerLink]="[transaction.id, 'reciept']">
<i class="fa fa-file" matTooltip="View Reciept"></i>
</button>
</td>
@@ -57,4 +57,12 @@ export class TransactionsTabComponent implements OnInit {
return false;
}
/**
* Stops the propagation to view pages.
* @param $event Mouse Event
*/
routeEdit($event: MouseEvent) {
$event.stopPropagation();
}
}
@@ -0,0 +1,11 @@
<mat-card class="container">
<div class="back-button">
<button type="button" color="primary" mat-raised-button [routerLink]="['../../']">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;Back</button>
</div>
<iframe [src]="pentahoUrl" frameborder="0" width=100% height="600px;"></iframe>
</mat-card>
@@ -0,0 +1,8 @@
.container {
max-width: 50rem;
.back-button {
max-height: 2%;
margin-bottom: 2%;
}
}
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ViewRecieptComponent } from './view-reciept.component';
describe('ViewRecieptComponent', () => {
let component: ViewRecieptComponent;
let fixture: ComponentFixture<ViewRecieptComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewRecieptComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ViewRecieptComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,40 @@
/** Angular Imports */
import { Component, OnInit } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { ActivatedRoute } from '@angular/router';
/**
* View Transaction Reciept Component
*/
@Component({
selector: 'mifosx-view-reciept',
templateUrl: './view-reciept.component.html',
styleUrls: ['./view-reciept.component.scss']
})
export class ViewRecieptComponent implements OnInit {
/** trusted resource url for pentaho output */
pentahoUrl: any;
/** Transaction Reciept Data */
transactionRecieptData: any;
/**
* Fetches transaction reciept `resolve`
* @param {DomSanitizer} sanitizer DOM Sanitizer
* @param {ActivatedRoute} route Activated Route
*/
constructor(private sanitizer: DomSanitizer,
private route: ActivatedRoute) {
this.route.data.subscribe((data: { savingsTransactionReciept: any }) => {
this.transactionRecieptData = data.savingsTransactionReciept;
});
}
ngOnInit() {
const contentType = this.transactionRecieptData.headers.get('Content-Type');
const file = new Blob([this.transactionRecieptData.body], {type: contentType});
const filecontent = URL.createObjectURL(file);
this.pentahoUrl = this.sanitizer.bypassSecurityTrustResourceUrl(filecontent);
}
}
@@ -8,7 +8,7 @@ import { DatePipe } from '@angular/common';
import { SavingsService } from 'app/savings/savings.service';
/** Custom Dialogs */
import { UndoTransactionDialogComponent } from '../custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component';
import { UndoTransactionDialogComponent } from '../../custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component';
/**
* View Transaction Component.