@@ -0,0 +1,36 @@
|
||||
/** Angular Imports */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { ReportsService } from 'app/reports/reports.service';
|
||||
|
||||
/**
|
||||
* Savings Transaction Reciept resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class SavingsTransactionRecieptResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ReportsService} reportsService Reports service.
|
||||
*/
|
||||
constructor(private reportsService: ReportsService) { }
|
||||
|
||||
/**
|
||||
* Returns the Savings Transaction Reciept
|
||||
* @param {ActivatedRouteSnapshot} route Route Snapshot
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const transactionId = route.paramMap.get('id');
|
||||
const data = {
|
||||
'output-type': 'PDF',
|
||||
R_transactionId: transactionId
|
||||
};
|
||||
return this.reportsService.getPentahoRunReportData({name: 'Savings Transaction Receipt'}, data, 'default', 'en', 'dd MMMM yyyy');
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+11
@@ -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> Back</button>
|
||||
</div>
|
||||
|
||||
<iframe [src]="pentahoUrl" frameborder="0" width=100% height="600px;"></iframe>
|
||||
|
||||
</mat-card>
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
.container {
|
||||
max-width: 50rem;
|
||||
.back-button {
|
||||
max-height: 2%;
|
||||
margin-bottom: 2%;
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -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();
|
||||
});
|
||||
});
|
||||
+40
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -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.
|
||||
@@ -14,8 +14,9 @@ import { StandingInstructionsTabComponent } from './savings-account-view/standin
|
||||
import { DatatableTabsComponent } from './savings-account-view/datatable-tabs/datatable-tabs.component';
|
||||
import { CreateSavingsAccountComponent } from './create-savings-account/create-savings-account.component';
|
||||
import { EditSavingsAccountComponent } from './edit-savings-account/edit-savings-account.component';
|
||||
import { ViewTransactionComponent } from './savings-account-view/view-transaction/view-transaction.component';
|
||||
import { ViewTransactionComponent } from './savings-account-view/transactions/view-transaction/view-transaction.component';
|
||||
import { ViewChargeComponent } from './savings-account-view/view-charge/view-charge.component';
|
||||
import { ViewRecieptComponent } from './savings-account-view/transactions/view-reciept/view-reciept.component';
|
||||
|
||||
/** Custom Resolvers */
|
||||
import { SavingsAccountViewResolver } from './common-resolvers/savings-account-view.resolver';
|
||||
@@ -26,6 +27,7 @@ import { SavingsAccountAndTemplateResolver } from './common-resolvers/savings-ac
|
||||
import { SavingsAccountTransactionResolver } from './common-resolvers/savings-account-transaction.resolver';
|
||||
import { SavingsAccountChargeResolver } from './common-resolvers/savings-account-charge.resolver';
|
||||
import { SavingsAccountActionsResolver } from './common-resolvers/savings-account-actions.resolver';
|
||||
import { SavingsTransactionRecieptResolver } from './common-resolvers/savings-transaction-reciept.resolver';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@@ -103,10 +105,23 @@ const routes: Routes = [
|
||||
{
|
||||
path: ':id',
|
||||
data: { routeParamBreadcrumb: 'id' },
|
||||
component: ViewTransactionComponent,
|
||||
resolve: {
|
||||
savingsAccountTransaction: SavingsAccountTransactionResolver
|
||||
}
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: ViewTransactionComponent,
|
||||
resolve: {
|
||||
savingsAccountTransaction: SavingsAccountTransactionResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'reciept',
|
||||
component: ViewRecieptComponent,
|
||||
data: { breadcrumb: 'Reciept', routeParamBreadcrumb: false },
|
||||
resolve: {
|
||||
savingsTransactionReciept: SavingsTransactionRecieptResolver
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -152,6 +167,7 @@ const routes: Routes = [
|
||||
SavingsAccountAndTemplateResolver,
|
||||
SavingsAccountTransactionResolver,
|
||||
SavingsAccountChargeResolver,
|
||||
SavingsAccountActionsResolver]
|
||||
SavingsAccountActionsResolver,
|
||||
SavingsTransactionRecieptResolver]
|
||||
})
|
||||
export class SavingsRoutingModule {}
|
||||
|
||||
@@ -33,7 +33,7 @@ import { SavingsAccountAssignStaffComponent } from './saving-account-actions/sav
|
||||
import { SavingsAccountUnassignStaffComponent } from './saving-account-actions/savings-account-unassign-staff/savings-account-unassign-staff.component';
|
||||
import { CalculateInterestDialogComponent } from './savings-account-view/custom-dialogs/calculate-interest-dialog/calculate-interest-dialog.component';
|
||||
import { PostInterestDialogComponent } from './savings-account-view/custom-dialogs/post-interest-dialog/post-interest-dialog.component';
|
||||
import { ViewTransactionComponent } from './savings-account-view/view-transaction/view-transaction.component';
|
||||
import { ViewTransactionComponent } from './savings-account-view/transactions/view-transaction/view-transaction.component';
|
||||
import { UndoTransactionDialogComponent } from './savings-account-view/custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component';
|
||||
import { ViewChargeComponent } from './savings-account-view/view-charge/view-charge.component';
|
||||
import { WaiveChargeDialogComponent } from './savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component';
|
||||
@@ -42,6 +42,7 @@ import { WithdrawByClientSavingsAccountComponent } from './saving-account-action
|
||||
import { AddChargeSavingsAccountComponent } from './saving-account-actions/add-charge-savings-account/add-charge-savings-account.component';
|
||||
import { CloseSavingsAccountComponent } from './saving-account-actions/close-savings-account/close-savings-account.component';
|
||||
import { ToggleWithholdTaxDialogComponent } from './savings-account-view/custom-dialogs/toggle-withhold-tax-dialog/toggle-withhold-tax-dialog.component';
|
||||
import { ViewRecieptComponent } from './savings-account-view/transactions/view-reciept/view-reciept.component';
|
||||
|
||||
|
||||
/**
|
||||
@@ -89,7 +90,8 @@ import { ToggleWithholdTaxDialogComponent } from './savings-account-view/custom-
|
||||
WithdrawByClientSavingsAccountComponent,
|
||||
AddChargeSavingsAccountComponent,
|
||||
CloseSavingsAccountComponent,
|
||||
ToggleWithholdTaxDialogComponent
|
||||
ToggleWithholdTaxDialogComponent,
|
||||
ViewRecieptComponent
|
||||
],
|
||||
entryComponents: [
|
||||
CalculateInterestDialogComponent,
|
||||
@@ -98,7 +100,6 @@ import { ToggleWithholdTaxDialogComponent } from './savings-account-view/custom-
|
||||
WaiveChargeDialogComponent,
|
||||
InactivateChargeDialogComponent,
|
||||
ToggleWithholdTaxDialogComponent
|
||||
|
||||
],
|
||||
providers: [DatePipe]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user