+8
@@ -0,0 +1,8 @@
|
||||
<h1 mat-dialog-title>Undo Transaction</h1>
|
||||
<div mat-dialog-content>
|
||||
<p>Are you sure you want to undo this transaction ?</p>
|
||||
</div>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-dialog-close>Cancel</button>
|
||||
<button mat-raised-button color="warn" [mat-dialog-close]="{ confirm: true }">Confirm</button>
|
||||
</mat-dialog-actions>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UndoTransactionDialogComponent } from './undo-transaction-dialog.component';
|
||||
|
||||
describe('UndoTransactionDialogComponent', () => {
|
||||
let component: UndoTransactionDialogComponent;
|
||||
let fixture: ComponentFixture<UndoTransactionDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ UndoTransactionDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UndoTransactionDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/** Angular Imports */
|
||||
import { Component } from '@angular/core';
|
||||
import { MatDialogRef } from '@angular/material';
|
||||
|
||||
/**
|
||||
* Undo transaction dialog component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-undo-transaction-dialog',
|
||||
templateUrl: './undo-transaction-dialog.component.html',
|
||||
styleUrls: ['./undo-transaction-dialog.component.scss']
|
||||
})
|
||||
export class UndoTransactionDialogComponent {
|
||||
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<UndoTransactionDialogComponent>) { }
|
||||
|
||||
}
|
||||
+1
-1
@@ -54,7 +54,7 @@
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row" [routerLink]="[row.id]"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
@@ -15,5 +15,8 @@
|
||||
margin: 0 10%;
|
||||
line-height: 25px;
|
||||
}
|
||||
.select-row:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export class TransactionsTabComponent implements OnInit {
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.parent.data.subscribe((data: { savingsAccountData: any }) => {
|
||||
this.transactionsData = data.savingsAccountData.transactions;
|
||||
this.transactionsData = data.savingsAccountData.transactions.filter((transaction: any) => !transaction.reversed);
|
||||
this.status = data.savingsAccountData.status.value;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<div fxLayoutAlign="end" class="container m-b-20"
|
||||
*ngIf="!(transactionData.interestedPostedAsOn === false && (transactionData.transactionType.id === 17 || transactionData.transactionType.id === 3))">
|
||||
<button mat-raised-button color="warn"
|
||||
(click)="undoTransaction()">
|
||||
<fa-icon icon="undo"></fa-icon>
|
||||
Undo
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="row wrap" class="content">
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Transaction Id
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ transactionData.id }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Type
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ transactionData.transactionType.value }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Transaction Date
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ transactionData.date | date }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Currency
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ transactionData.currency.displayLabel }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Amount
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ transactionData.amount }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
|
||||
.content {
|
||||
div {
|
||||
margin: 1rem 0;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ViewTransactionComponent } from './view-transaction.component';
|
||||
|
||||
describe('ViewTransactionComponent', () => {
|
||||
let component: ViewTransactionComponent;
|
||||
let fixture: ComponentFixture<ViewTransactionComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewTransactionComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ViewTransactionComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
/** Angular Imports */
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
|
||||
/** Custom Dialogs */
|
||||
import { UndoTransactionDialogComponent } from '../custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component';
|
||||
|
||||
/**
|
||||
* View Transaction Component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-view-transaction',
|
||||
templateUrl: './view-transaction.component.html',
|
||||
styleUrls: ['./view-transaction.component.scss']
|
||||
})
|
||||
export class ViewTransactionComponent {
|
||||
|
||||
/** Transaction data. */
|
||||
transactionData: any;
|
||||
|
||||
/**
|
||||
* Retrieves the Transaction data from `resolve`.
|
||||
* @param {SavingsService} savingsService Savings Service
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {DatePipe} datePipe DatePipe.
|
||||
*/
|
||||
constructor(private savingsService: SavingsService,
|
||||
private route: ActivatedRoute,
|
||||
private datePipe: DatePipe,
|
||||
private router: Router,
|
||||
public dialog: MatDialog) {
|
||||
this.route.data.subscribe((data: { savingsAccountTransaction: any }) => {
|
||||
this.transactionData = data.savingsAccountTransaction;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Undo the savings transaction
|
||||
*/
|
||||
undoTransaction() {
|
||||
const accountId = this.route.parent.snapshot.params['savingAccountId'];
|
||||
const undoTransactionAccountDialogRef = this.dialog.open(UndoTransactionDialogComponent);
|
||||
undoTransactionAccountDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.confirm) {
|
||||
const locale = 'en';
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
const data = {
|
||||
transactionDate: this.datePipe.transform(this.transactionData.date && new Date(this.transactionData.date), dateFormat),
|
||||
transactionAmount: 0,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.savingsService.executeSavingsAccountTransactionsCommand(accountId, 'undo', data, this.transactionData.id).subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user