build: Use prettier for typescript

Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
Ralph Hopman
2025-01-15 11:59:30 +00:00
committed by Adam Saghy
parent 9d6cf1514a
commit cac1d11ad7
1812 changed files with 22516 additions and 16862 deletions
@@ -8,9 +8,8 @@ describe('ChargesTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChargesTabComponent ]
})
.compileComponents();
declarations: [ChargesTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -30,7 +30,6 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./charges-tab.component.scss']
})
export class ChargesTabComponent implements OnInit {
/** Savings Account Data */
savingsAccountData: any;
/** Charges Data */
@@ -66,13 +65,15 @@ export class ChargesTabComponent implements OnInit {
* @param {Dates} dateUtils Date Utils.
* @param {SettingsService} settingsService Setting service
*/
constructor(private savingsService: SavingsService,
private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
private dialog: MatDialog,
private settingsService: SettingsService,
private translateService: TranslateService) {
constructor(
private savingsService: SavingsService,
private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
private dialog: MatDialog,
private settingsService: SettingsService,
private translateService: TranslateService
) {
this.route.parent.data.subscribe((data: { savingsAccountData: any }) => {
this.savingsAccountData = data.savingsAccountData;
this.chargesData = this.savingsAccountData.charges;
@@ -80,7 +81,7 @@ export class ChargesTabComponent implements OnInit {
}
ngOnInit() {
const activeCharges = this.chargesData ? this.chargesData.filter(charge => charge.isActive) : [];
const activeCharges = this.chargesData ? this.chargesData.filter((charge) => charge.isActive) : [];
this.dataSource = new MatTableDataSource(activeCharges);
}
@@ -90,16 +91,15 @@ export class ChargesTabComponent implements OnInit {
toggleCharges() {
this.showInactiveCharges = !this.showInactiveCharges;
if (!this.showInactiveCharges) {
const activeCharges = this.chargesData.filter(charge => charge.isActive);
const activeCharges = this.chargesData.filter((charge) => charge.isActive);
this.dataSource.data = activeCharges;
} else {
const inActiveCharges = this.chargesData.filter(charge => !charge.isActive);
const inActiveCharges = this.chargesData.filter((charge) => !charge.isActive);
this.dataSource.data = inActiveCharges;
}
this.chargesTableRef.renderRows();
}
/**
* Pays the charge.
* @param {any} chargeId Charge Id
@@ -120,6 +120,7 @@ export class ChargesTabComponent implements OnInit {
type: 'date',
required: true
})
];
const data = {
title: `Pay Charge ${chargeId}`,
@@ -137,7 +138,8 @@ export class ChargesTabComponent implements OnInit {
dateFormat,
locale
};
this.savingsService.executeSavingsAccountChargesCommand(this.savingsAccountData.id, 'paycharge', dataObject, chargeId)
this.savingsService
.executeSavingsAccountChargesCommand(this.savingsAccountData.id, 'paycharge', dataObject, chargeId)
.subscribe(() => {
this.reload();
});
@@ -153,7 +155,8 @@ export class ChargesTabComponent implements OnInit {
const waiveChargeDialogRef = this.dialog.open(WaiveChargeDialogComponent, { data: { id: chargeId } });
waiveChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountChargesCommand(this.savingsAccountData.id, 'waive', {}, chargeId)
this.savingsService
.executeSavingsAccountChargesCommand(this.savingsAccountData.id, 'waive', {}, chargeId)
.subscribe(() => {
this.reload();
});
@@ -169,7 +172,8 @@ export class ChargesTabComponent implements OnInit {
const inactivateChargeDialogRef = this.dialog.open(InactivateChargeDialogComponent, { data: { id: chargeId } });
inactivateChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountChargesCommand(this.savingsAccountData.id, 'inactivate', {}, chargeId)
this.savingsService
.executeSavingsAccountChargesCommand(this.savingsAccountData.id, 'inactivate', {}, chargeId)
.subscribe(() => {
this.reload();
});
@@ -190,6 +194,7 @@ export class ChargesTabComponent implements OnInit {
type: 'number',
required: true
})
];
const data = {
title: `Edit Charge ${charge.id}`,
@@ -206,7 +211,8 @@ export class ChargesTabComponent implements OnInit {
dateFormat,
locale
};
this.savingsService.editSavingsAccountCharge(this.savingsAccountData.id, dataObject, charge.id)
this.savingsService
.editSavingsAccountCharge(this.savingsAccountData.id, dataObject, charge.id)
.subscribe(() => {
this.reload();
});
@@ -224,10 +230,9 @@ export class ChargesTabComponent implements OnInit {
});
deleteChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.savingsService.deleteSavingsAccountCharge(this.savingsAccountData.id, chargeId)
.subscribe(() => {
this.reload();
});
this.savingsService.deleteSavingsAccountCharge(this.savingsAccountData.id, chargeId).subscribe(() => {
this.reload();
});
}
});
}
@@ -237,7 +242,11 @@ export class ChargesTabComponent implements OnInit {
* @param {any} charge Charge
*/
isRecurringCharge(charge: any) {
return charge.chargeTimeType.value === 'Monthly Fee' || charge.chargeTimeType.value === 'Annual Fee' || charge.chargeTimeType.value === 'Weekly Fee';
return (
charge.chargeTimeType.value === 'Monthly Fee' ||
charge.chargeTimeType.value === 'Annual Fee' ||
charge.chargeTimeType.value === 'Weekly Fee'
);
}
/**
@@ -254,13 +263,14 @@ export class ChargesTabComponent implements OnInit {
*/
private reload() {
const url: string = this.router.url;
const refreshUrl: string = this.router.url.slice(0, this.router.url.indexOf('savings-accounts') + 'savings-accounts'.length);
this.router.navigateByUrl(refreshUrl, {skipLocationChange: true})
.then(() => this.router.navigate([url]));
const refreshUrl: string = this.router.url.slice(
0,
this.router.url.indexOf('savings-accounts') + 'savings-accounts'.length
);
this.router.navigateByUrl(refreshUrl, { skipLocationChange: true }).then(() => this.router.navigate([url]));
}
viewAllChargeButtons(text: string): string {
return this.translateService.instant('labels.buttons.' + text);
}
}
@@ -8,9 +8,8 @@ describe('CalculateInterestDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CalculateInterestDialogComponent ]
})
.compileComponents();
declarations: [CalculateInterestDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,10 +11,8 @@ import { MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./calculate-interest-dialog.component.scss']
})
export class CalculateInterestDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
*/
constructor(public dialogRef: MatDialogRef<CalculateInterestDialogComponent>) { }
constructor(public dialogRef: MatDialogRef<CalculateInterestDialogComponent>) {}
}
@@ -8,9 +8,8 @@ describe('InactivateChargeDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ InactivateChargeDialogComponent ]
})
.compileComponents();
declarations: [InactivateChargeDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,12 +11,12 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./inactivate-charge-dialog.component.scss']
})
export class InactivateChargeDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
* @param {any} data.
*/
constructor(public dialogRef: MatDialogRef<InactivateChargeDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
constructor(
public dialogRef: MatDialogRef<InactivateChargeDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {}
}
@@ -8,9 +8,8 @@ describe('PostInterestDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PostInterestDialogComponent ]
})
.compileComponents();
declarations: [PostInterestDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,10 +11,8 @@ import { MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./post-interest-dialog.component.scss']
})
export class PostInterestDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
*/
constructor(public dialogRef: MatDialogRef<PostInterestDialogComponent>) { }
constructor(public dialogRef: MatDialogRef<PostInterestDialogComponent>) {}
}
@@ -8,9 +8,8 @@ describe('ReleaseAmountDialogComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ReleaseAmountDialogComponent ]
})
.compileComponents();
declarations: [ReleaseAmountDialogComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -7,10 +7,8 @@ import { MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./release-amount-dialog.component.scss']
})
export class ReleaseAmountDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
*/
constructor(public dialogRef: MatDialogRef<ReleaseAmountDialogComponent>) { }
constructor(public dialogRef: MatDialogRef<ReleaseAmountDialogComponent>) {}
}
@@ -8,9 +8,8 @@ describe('ToggleWithholdTaxDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ToggleWithholdTaxDialogComponent ]
})
.compileComponents();
declarations: [ToggleWithholdTaxDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,12 +11,12 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./toggle-withhold-tax-dialog.component.scss']
})
export class ToggleWithholdTaxDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
* @param {any} data.
*/
constructor(public dialogRef: MatDialogRef<ToggleWithholdTaxDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
constructor(
public dialogRef: MatDialogRef<ToggleWithholdTaxDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {}
}
@@ -8,9 +8,8 @@ describe('UndoTransactionDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UndoTransactionDialogComponent ]
})
.compileComponents();
declarations: [UndoTransactionDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,10 +11,8 @@ import { MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./undo-transaction-dialog.component.scss']
})
export class UndoTransactionDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
*/
constructor(public dialogRef: MatDialogRef<UndoTransactionDialogComponent>) { }
constructor(public dialogRef: MatDialogRef<UndoTransactionDialogComponent>) {}
}
@@ -8,9 +8,8 @@ describe('WaiveChargeDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WaiveChargeDialogComponent ]
})
.compileComponents();
declarations: [WaiveChargeDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,12 +11,12 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./waive-charge-dialog.component.scss']
})
export class WaiveChargeDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
* @param {any} data.
*/
constructor(public dialogRef: MatDialogRef<WaiveChargeDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
constructor(
public dialogRef: MatDialogRef<WaiveChargeDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {}
}
@@ -8,9 +8,8 @@ describe('DatatableTabsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatatableTabsComponent ]
})
.compileComponents();
declarations: [DatatableTabsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -29,5 +29,4 @@ export class DatatableTabsComponent {
this.multiRowDatatableFlag = this.entityDatatable.columnHeaders[0].columnName === 'id' ? true : false;
});
}
}
@@ -8,9 +8,8 @@ describe('GeneralTabComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GeneralTabComponent ]
})
.compileComponents();
declarations: [GeneralTabComponent]
}).compileComponents();
fixture = TestBed.createComponent(GeneralTabComponent);
component = fixture.componentInstance;
@@ -15,14 +15,16 @@ export class GeneralTabComponent {
savingsAccountData: any;
currency: Currency;
constructor(private route: ActivatedRoute,
private router: Router) {
constructor(
private route: ActivatedRoute,
private router: Router
) {
this.route.parent.parent.data.subscribe((data: { savingsAccountData: any }) => {
this.savingsAccountData = data.savingsAccountData;
this.currency = this.savingsAccountData.currency;
this.isLoading = false;
const status = this.savingsAccountData.status.value;
this.isActive = (status === 'Active');
this.isActive = status === 'Active';
});
if (this.router.url.includes('clients')) {
this.entityType = 'Client';
@@ -32,5 +34,4 @@ export class GeneralTabComponent {
this.entityType = 'Center';
}
}
}
@@ -8,9 +8,8 @@ describe('NotesTabComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ NotesTabComponent ]
})
.compileComponents();
declarations: [NotesTabComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -9,14 +9,15 @@ import { SavingsService } from 'app/savings/savings.service';
styleUrls: ['./notes-tab.component.scss']
})
export class NotesTabComponent {
entityId: string;
username: string;
entityNotes: any;
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private savingsService: SavingsService,
private authenticationService: AuthenticationService) {
private authenticationService: AuthenticationService
) {
const savedCredentials = this.authenticationService.getCredentials();
this.username = savedCredentials.username;
this.entityId = this.route.parent.snapshot.params['savingAccountId'];
@@ -37,16 +38,14 @@ export class NotesTabComponent {
}
editNote(noteId: string, noteContent: any, index: number) {
this.savingsService.editSavingsNote(this.entityId, noteId, noteContent).subscribe(() => {
this.entityNotes[index].note = noteContent.note;
});
this.savingsService.editSavingsNote(this.entityId, noteId, noteContent).subscribe(() => {
this.entityNotes[index].note = noteContent.note;
});
}
deleteNote(noteId: string, index: number) {
this.savingsService.deleteSavingsNote(this.entityId, noteId)
.subscribe(() => {
this.entityNotes.splice(index, 1);
});
this.savingsService.deleteSavingsNote(this.entityId, noteId).subscribe(() => {
this.entityNotes.splice(index, 1);
});
}
}
@@ -8,9 +8,8 @@ describe('SavingsAccountViewComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountViewComponent ]
})
.compileComponents();
declarations: [SavingsAccountViewComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -25,7 +25,6 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./savings-account-view.component.scss']
})
export class SavingsAccountViewComponent implements OnInit {
/** Savings Account Data */
savingsAccountData: any;
/** Savings Data Tables */
@@ -44,12 +43,14 @@ export class SavingsAccountViewComponent implements OnInit {
* @param {Router} router Router
* @param {SavingsService} savingsService Savings Service
*/
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private router: Router,
private savingsService: SavingsService,
private translateService: TranslateService,
public dialog: MatDialog) {
this.route.data.subscribe((data: { savingsAccountData: any, savingsDatatables: any }) => {
public dialog: MatDialog
) {
this.route.data.subscribe((data: { savingsAccountData: any; savingsDatatables: any }) => {
this.savingsAccountData = data.savingsAccountData;
this.currency = this.savingsAccountData.currency;
this.savingsDatatables = data.savingsDatatables;
@@ -72,7 +73,7 @@ export class SavingsAccountViewComponent implements OnInit {
*/
setConditionalButtons() {
const status = this.savingsAccountData.status.value;
this.isActive = (status === 'Active');
this.isActive = status === 'Active';
const subStatus = this.savingsAccountData.subStatus;
this.buttonConfig = new SavingsButtonsConfiguration(status, subStatus);
if (this.savingsAccountData.clientId) {
@@ -124,9 +125,11 @@ export class SavingsAccountViewComponent implements OnInit {
*/
private reload() {
const url: string = this.router.url;
const refreshUrl: string = this.router.url.slice(0, this.router.url.indexOf('savings-accounts') + 'savings-accounts'.length);
this.router.navigateByUrl(refreshUrl, { skipLocationChange: true })
.then(() => this.router.navigate([url]));
const refreshUrl: string = this.router.url.slice(
0,
this.router.url.indexOf('savings-accounts') + 'savings-accounts'.length
);
this.router.navigateByUrl(refreshUrl, { skipLocationChange: true }).then(() => this.router.navigate([url]));
}
/**
@@ -176,7 +179,10 @@ export class SavingsAccountViewComponent implements OnInit {
break;
case 'Transfer Funds':
const queryParams: any = { savingsId: this.savingsAccountData.id, accountType: 'fromsavings' };
this.router.navigate(['transfer-funds/make-account-transfer'], { relativeTo: this.route, queryParams: queryParams });
this.router.navigate(['transfer-funds/make-account-transfer'], {
relativeTo: this.route,
queryParams: queryParams
});
break;
case 'Unblock Account':
case 'Unblock Deposit':
@@ -209,9 +215,11 @@ export class SavingsAccountViewComponent implements OnInit {
const calculateInterestAccountDialogRef = this.dialog.open(CalculateInterestDialogComponent);
calculateInterestAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountCommand(this.savingsAccountData.id, 'calculateInterest', {}).subscribe(() => {
this.reload();
});
this.savingsService
.executeSavingsAccountCommand(this.savingsAccountData.id, 'calculateInterest', {})
.subscribe(() => {
this.reload();
});
}
});
}
@@ -223,9 +231,11 @@ export class SavingsAccountViewComponent implements OnInit {
const postInterestAccountDialogRef = this.dialog.open(PostInterestDialogComponent);
postInterestAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountCommand(this.savingsAccountData.id, 'postInterest', {}).subscribe(() => {
this.reload();
});
this.savingsService
.executeSavingsAccountCommand(this.savingsAccountData.id, 'postInterest', {})
.subscribe(() => {
this.reload();
});
}
});
}
@@ -239,7 +249,8 @@ export class SavingsAccountViewComponent implements OnInit {
});
deleteSavingsAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountUpdateCommand(this.savingsAccountData.id, 'updateWithHoldTax', { withHoldTax: true })
this.savingsService
.executeSavingsAccountUpdateCommand(this.savingsAccountData.id, 'updateWithHoldTax', { withHoldTax: true })
.subscribe(() => {
this.reload();
});
@@ -256,7 +267,8 @@ export class SavingsAccountViewComponent implements OnInit {
});
disableWithHoldTaxDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountUpdateCommand(this.savingsAccountData.id, 'updateWithHoldTax', { withHoldTax: false })
this.savingsService
.executeSavingsAccountUpdateCommand(this.savingsAccountData.id, 'updateWithHoldTax', { withHoldTax: false })
.subscribe(() => {
this.reload();
});
@@ -269,7 +281,13 @@ export class SavingsAccountViewComponent implements OnInit {
*/
private unblockSavingsAccount(action: string) {
const unblockSavingsAccountDialogRef = this.dialog.open(ConfirmationDialogComponent, {
data: { heading: this.translateService.instant('labels.heading.Savings Account'), dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want') + action + this.translateService.instant('this Savings Account') }
data: {
heading: this.translateService.instant('labels.heading.Savings Account'),
dialogContext:
this.translateService.instant('labels.dialogContext.Are you sure you want') +
action +
this.translateService.instant('this Savings Account')
}
});
let command = 'unblock';
if (action === 'Unblock Deposit') {
@@ -280,10 +298,9 @@ export class SavingsAccountViewComponent implements OnInit {
}
unblockSavingsAccountDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountCommand(this.savingsAccountData.id, command, {})
.subscribe(() => {
this.reload();
});
this.savingsService.executeSavingsAccountCommand(this.savingsAccountData.id, command, {}).subscribe(() => {
this.reload();
});
}
});
}
@@ -1,15 +1,14 @@
/** Savings Account Buttons Configuration */
export class SavingsButtonsConfiguration {
optionArray: {
name: string,
taskPermissionName: string,
name: string;
taskPermissionName: string;
}[];
buttonsArray: {
name: string,
icon: string,
taskPermissionName: string,
name: string;
icon: string;
taskPermissionName: string;
}[];
constructor(status: string, substatus: any) {
@@ -44,13 +43,11 @@ export class SavingsButtonsConfiguration {
}
);
} else {
this.buttonsArray.push(
{
name: 'Unblock Deposit',
icon: 'lock-open',
taskPermissionName: 'UNBLOCKDEPOSIT_SAVINGSACCOUNT'
}
);
this.buttonsArray.push({
name: 'Unblock Deposit',
icon: 'lock-open',
taskPermissionName: 'UNBLOCKDEPOSIT_SAVINGSACCOUNT'
});
}
if (!substatus.blockDebit) {
this.buttonsArray.push(
@@ -66,13 +63,11 @@ export class SavingsButtonsConfiguration {
}
);
} else {
this.buttonsArray.push(
{
name: 'Unblock Withdrawal',
icon: 'lock-open',
taskPermissionName: 'UNBLOCKWITHDRAWAL_SAVINGSACCOUNT'
}
);
this.buttonsArray.push({
name: 'Unblock Withdrawal',
icon: 'lock-open',
taskPermissionName: 'UNBLOCKWITHDRAWAL_SAVINGSACCOUNT'
});
}
this.buttonsArray = this.buttonsArray.concat([
{
@@ -93,16 +88,16 @@ export class SavingsButtonsConfiguration {
{
name: 'Post Interest As On',
icon: 'arrow-right',
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT',
},
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT'
}
]);
} else {
this.buttonsArray = [
{
name: 'Unblock Account',
icon: 'lock-open',
taskPermissionName: 'UNBLOCK_SAVINGSACCOUNT'
}
{
name: 'Unblock Account',
icon: 'lock-open',
taskPermissionName: 'UNBLOCK_SAVINGSACCOUNT'
}
];
}
break;
@@ -138,7 +133,7 @@ export class SavingsButtonsConfiguration {
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
}
];
break;
break;
default:
this.buttonsArray = [];
}
@@ -188,8 +183,7 @@ export class SavingsButtonsConfiguration {
}
}
addOption(option: {name: string, taskPermissionName: string}) {
addOption(option: { name: string; taskPermissionName: string }) {
this.optionArray.push(option);
}
}
@@ -8,9 +8,8 @@ describe('SavingsDocumentsTabComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SavingsDocumentsTabComponent ]
})
.compileComponents();
declarations: [SavingsDocumentsTabComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -11,7 +11,6 @@ import { environment } from 'environments/environment';
styleUrls: ['./savings-documents-tab.component.scss']
})
export class SavingsDocumentsTabComponent {
/** Stores the resolved savings documents data */
entityDocuments: any;
/** Stores the saving Account Id */
@@ -22,10 +21,12 @@ export class SavingsDocumentsTabComponent {
* Retrieves the savings data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private savingsService: SavingsService,
private settingsService: SettingsService,
public dialog: MatDialog) {
public dialog: MatDialog
) {
this.route.data.subscribe((data: { savingsDocuments: any }) => {
this.setSavingsDocumentsData(data.savingsDocuments);
});
@@ -34,9 +35,20 @@ export class SavingsDocumentsTabComponent {
setSavingsDocumentsData(data: any) {
data.forEach((ele: any) => {
ele.docUrl = this.settingsService.serverUrl + '/savings/' + ele.parentEntityId + '/documents/' + ele.id + '/attachment?tenantIdentifier=' + environment.fineractPlatformTenantId;
ele.docUrl =
this.settingsService.serverUrl +
'/savings/' +
ele.parentEntityId +
'/documents/' +
ele.id +
'/attachment?tenantIdentifier=' +
environment.fineractPlatformTenantId;
if (ele.fileName) {
if (ele.fileName.toLowerCase().indexOf('.jpg') !== -1 || ele.fileName.toLowerCase().indexOf('.jpeg') !== -1 || ele.fileName.toLowerCase().indexOf('.png') !== -1) {
if (
ele.fileName.toLowerCase().indexOf('.jpg') !== -1 ||
ele.fileName.toLowerCase().indexOf('.jpeg') !== -1 ||
ele.fileName.toLowerCase().indexOf('.png') !== -1
) {
ele.fileIsImage = true;
}
}
@@ -50,7 +62,7 @@ export class SavingsDocumentsTabComponent {
}
downloadDocument(documentId: string) {
this.savingsService.downloadSavingsDocument(this.entityId, documentId).subscribe(res => {
this.savingsService.downloadSavingsDocument(this.entityId, documentId).subscribe((res) => {
const url = window.URL.createObjectURL(res);
window.open(url);
});
@@ -63,5 +75,4 @@ export class SavingsDocumentsTabComponent {
deleteDocument(documentId: any) {
this.savingsService.deleteSavingsDocument(this.entityId, documentId).subscribe((res: any) => {});
}
}
@@ -8,9 +8,8 @@ describe('StandingInstructionsTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ StandingInstructionsTabComponent ]
})
.compileComponents();
declarations: [StandingInstructionsTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -21,7 +21,6 @@ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.co
styleUrls: ['./standing-instructions-tab.component.scss']
})
export class StandingInstructionsTabComponent implements OnInit {
/** Savings Data */
savingsData: any;
/** Instructions Data */
@@ -47,11 +46,13 @@ export class StandingInstructionsTabComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
* @param {SettingsService} settingsService Setting service
*/
constructor(private route: ActivatedRoute,
private savingsService: SavingsService,
private dialog: MatDialog,
private accountTransfersService: AccountTransfersService,
private settingsService: SettingsService) {
constructor(
private route: ActivatedRoute,
private savingsService: SavingsService,
private dialog: MatDialog,
private accountTransfersService: AccountTransfersService,
private settingsService: SettingsService
) {
this.route.parent.data.subscribe((data: { savingsAccountData: any }) => {
this.savingsData = data.savingsAccountData;
});
@@ -70,11 +71,13 @@ export class StandingInstructionsTabComponent implements OnInit {
const accountId = this.savingsData.id;
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
this.savingsService.getStandingInstructions(clientId, clientName, accountId, locale, dateFormat).subscribe((response: any) => {
this.instructionsData = response.pageItems;
this.dataSource.data = this.instructionsData;
this.instructionTableRef.renderRows();
});
this.savingsService
.getStandingInstructions(clientId, clientName, accountId, locale, dateFormat)
.subscribe((response: any) => {
this.instructionsData = response.pageItems;
this.dataSource.data = this.instructionsData;
this.instructionTableRef.renderRows();
});
}
deleteStandingInstruction(instructionId: any) {
@@ -83,10 +86,8 @@ export class StandingInstructionsTabComponent implements OnInit {
});
deleteStandingInstructionDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.accountTransfersService.deleteStandingInstrucions(instructionId)
.subscribe(() => { });
this.accountTransfersService.deleteStandingInstrucions(instructionId).subscribe(() => {});
}
});
}
}
@@ -8,9 +8,8 @@ describe('ExportTransactionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ExportTransactionsComponent ]
})
.compileComponents();
declarations: [ExportTransactionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./export-transactions.component.scss']
})
export class ExportTransactionsComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -41,18 +40,19 @@ export class ExportTransactionsComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {SettingsService} settingsService Settings Service
*/
constructor(private sanitizer: DomSanitizer,
private reportsService: ReportsService,
private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
private route: ActivatedRoute,
private settingsService: SettingsService) {
constructor(
private sanitizer: DomSanitizer,
private reportsService: ReportsService,
private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
private route: ActivatedRoute,
private settingsService: SettingsService
) {
this.route.parent.parent.data.subscribe((data: { savingsAccountData: any }) => {
this.savingsAccountId = data.savingsAccountData.accountNo;
});
}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
this.createTransactionsReportForm();
@@ -63,8 +63,14 @@ export class ExportTransactionsComponent implements OnInit {
*/
createTransactionsReportForm() {
this.transactionsReportForm = this.formBuilder.group({
'fromDate': ['', Validators.required],
'toDate': ['', Validators.required],
fromDate: [
'',
Validators.required
],
toDate: [
'',
Validators.required
]
});
}
@@ -73,19 +79,28 @@ export class ExportTransactionsComponent implements OnInit {
*/
generate() {
const data = {
'output-type': 'PDF',
R_startDate: this.dateUtils.formatDate(this.transactionsReportForm.value.fromDate, this.settingsService.dateFormat),
R_endDate: this.dateUtils.formatDate(this.transactionsReportForm.value.toDate, this.settingsService.dateFormat),
R_savingsAccountId: this.savingsAccountId
'output-type': 'PDF',
R_startDate: this.dateUtils.formatDate(
this.transactionsReportForm.value.fromDate,
this.settingsService.dateFormat
),
R_endDate: this.dateUtils.formatDate(this.transactionsReportForm.value.toDate, this.settingsService.dateFormat),
R_savingsAccountId: this.savingsAccountId
};
this.reportsService.getPentahoRunReportData('Client Saving Transactions', data, 'default', this.settingsService.language.code, this.settingsService.dateFormat)
.subscribe( (res: any) => {
this.reportsService
.getPentahoRunReportData(
'Client Saving Transactions',
data,
'default',
this.settingsService.language.code,
this.settingsService.dateFormat
)
.subscribe((res: any) => {
const contentType = res.headers.get('Content-Type');
const file = new Blob([res.body], {type: contentType});
const file = new Blob([res.body], { type: contentType });
const filecontent = URL.createObjectURL(file);
this.pentahoUrl = this.sanitizer.bypassSecurityTrustResourceUrl(filecontent);
this.hideOutput = false;
});
}
}
@@ -8,9 +8,8 @@ describe('TransactionsTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TransactionsTabComponent ]
})
.compileComponents();
declarations: [TransactionsTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -6,7 +6,10 @@ import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { ActivatedRoute, Router } from '@angular/router';
import { Dates } from 'app/core/utils/dates';
import { SavingsAccountTransaction, SavingsAccountTransactionType } from 'app/savings/models/savings-account-transaction.model';
import {
SavingsAccountTransaction,
SavingsAccountTransactionType
} from 'app/savings/models/savings-account-transaction.model';
import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
import { UndoTransactionDialogComponent } from '../custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component';
@@ -21,7 +24,6 @@ import { MatDialog } from '@angular/material/dialog';
styleUrls: ['./transactions-tab.component.scss']
})
export class TransactionsTabComponent implements OnInit {
/** Savings Account Status */
status: any;
/** Transactions Data */
@@ -30,7 +32,17 @@ export class TransactionsTabComponent implements OnInit {
hideAccrualsParam: UntypedFormControl;
hideReversedParam: UntypedFormControl;
/** Columns to be displayed in transactions table. */
displayedColumns: string[] = ['row', 'id', 'date', 'externalId', 'transactionType', 'debit', 'credit', 'balance', 'actions'];
displayedColumns: string[] = [
'row',
'id',
'date',
'externalId',
'transactionType',
'debit',
'credit',
'balance',
'actions'
];
/** Data source for transactions table. */
dataSource: MatTableDataSource<any>;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
@@ -44,12 +56,14 @@ export class TransactionsTabComponent implements OnInit {
* Retrieves savings account data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute,
private router: Router,
private savingsService: SavingsService,
private settingsService: SettingsService,
private dialog: MatDialog,
private dateUtils: Dates) {
constructor(
private route: ActivatedRoute,
private router: Router,
private savingsService: SavingsService,
private settingsService: SettingsService,
private dialog: MatDialog,
private dateUtils: Dates
) {
this.route.parent.parent.data.subscribe((data: { savingsAccountData: any }) => {
this.transactionsData = data.savingsAccountData.transactions;
this.status = data.savingsAccountData.status.value;
@@ -65,7 +79,7 @@ export class TransactionsTabComponent implements OnInit {
setTransactions(): void {
this.dataSource = new MatTableDataSource(this.transactionsData);
this.accountWithTransactions = (this.transactionsData && this.transactionsData.length > 0);
this.accountWithTransactions = this.transactionsData && this.transactionsData.length > 0;
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}
@@ -75,20 +89,30 @@ export class TransactionsTabComponent implements OnInit {
* @param {any} transactionType Transaction Type
*/
isDebit(transactionType: SavingsAccountTransactionType) {
return transactionType.withdrawal === true || transactionType.feeDeduction === true
|| transactionType.overdraftInterest === true || transactionType.withholdTax === true;
return (
transactionType.withdrawal === true ||
transactionType.feeDeduction === true ||
transactionType.overdraftInterest === true ||
transactionType.withholdTax === true
);
}
isAccrual(transactionType: SavingsAccountTransactionType): boolean {
return (transactionType.accrual || transactionType.code === 'savingsAccountTransactionType.accrual');
return transactionType.accrual || transactionType.code === 'savingsAccountTransactionType.accrual';
}
/**
* Checks transaction status.
*/
checkStatus() {
if (this.status === 'Active' || this.status === 'Closed' || this.status === 'Transfer in progress' ||
this.status === 'Transfer on hold' || this.status === 'Premature Closed' || this.status === 'Matured') {
if (
this.status === 'Active' ||
this.status === 'Closed' ||
this.status === 'Transfer in progress' ||
this.status === 'Transfer on hold' ||
this.status === 'Premature Closed' ||
this.status === 'Matured'
) {
return true;
}
return false;
@@ -100,9 +124,17 @@ export class TransactionsTabComponent implements OnInit {
*/
showTransactions(transactionsData: SavingsAccountTransaction) {
if (transactionsData.transfer) {
this.router.navigate([`../transfer-funds/account-transfers/${transactionsData.transfer.id}`], { relativeTo: this.route });
this.router.navigate([`../transfer-funds/account-transfers/${transactionsData.transfer.id}`], {
relativeTo: this.route
});
} else {
this.router.navigate([transactionsData.id, 'general'], { relativeTo: this.route });
this.router.navigate(
[
transactionsData.id,
'general'
],
{ relativeTo: this.route }
);
}
}
@@ -127,7 +159,7 @@ export class TransactionsTabComponent implements OnInit {
if (hideAccrual || hideReversed) {
transactions = this.transactionsData.filter((t: SavingsAccountTransaction) => {
return (!(hideReversed && t.reversed) && !(hideAccrual && t.transactionType.accrual));
return !(hideReversed && t.reversed) && !(hideAccrual && t.transactionType.accrual);
});
}
this.dataSource = new MatTableDataSource(transactions);
@@ -159,9 +191,11 @@ export class TransactionsTabComponent implements OnInit {
dateFormat,
locale
};
this.savingsService.executeSavingsAccountTransactionsCommand(this.accountId, 'undo', data, transactionData.id).subscribe(() => {
this.reload();
});
this.savingsService
.executeSavingsAccountTransactionsCommand(this.accountId, 'undo', data, transactionData.id)
.subscribe(() => {
this.reload();
});
}
});
}
@@ -169,7 +203,8 @@ export class TransactionsTabComponent implements OnInit {
private reload() {
const clientId = this.route.parent.parent.snapshot.params['clientId'];
const url: string = this.router.url;
this.router.navigateByUrl(`/clients/${clientId}/savings-accounts`, { skipLocationChange: true })
this.router
.navigateByUrl(`/clients/${clientId}/savings-accounts`, { skipLocationChange: true })
.then(() => this.router.navigate([url]));
}
}
@@ -8,9 +8,8 @@ describe('EditTransactionComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditTransactionComponent ]
})
.compileComponents();
declarations: [EditTransactionComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./edit-transaction.component.scss']
})
export class EditTransactionComponent implements OnInit {
/** Minimum Due Date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum Due Date allowed. */
@@ -27,11 +26,11 @@ export class EditTransactionComponent implements OnInit {
editTransactionForm: UntypedFormGroup;
/** savings account transaction payment options. */
paymentTypeOptions: {
id: number,
name: string,
description: string,
isCashPayment: boolean,
position: number
id: number;
name: string;
description: string;
isCashPayment: boolean;
position: number;
}[];
/** Flag to enable payment details fields. */
showPaymentDetails: Boolean = false;
@@ -50,12 +49,14 @@ export class EditTransactionComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private savingsService: SavingsService,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private savingsService: SavingsService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { savingsAccountTransactionTemplate: any }) => {
this.transactionTemplateData = data.savingsAccountTransactionTemplate;
if (data.savingsAccountTransactionTemplate.currency) {
@@ -73,9 +74,9 @@ export class EditTransactionComponent implements OnInit {
this.maxDate = this.settingsService.businessDate;
this.createEditTransactionForm();
this.editTransactionForm.patchValue({
'transactionDate': this.transactionTemplateData.date && new Date(this.transactionTemplateData.date),
'transactionAmount': this.transactionTemplateData.amount,
'paymentTypeId': this.transactionTemplateData.paymentTypeId
transactionDate: this.transactionTemplateData.date && new Date(this.transactionTemplateData.date),
transactionAmount: this.transactionTemplateData.amount,
paymentTypeId: this.transactionTemplateData.paymentTypeId
});
}
@@ -84,9 +85,15 @@ export class EditTransactionComponent implements OnInit {
*/
createEditTransactionForm() {
this.editTransactionForm = this.formBuilder.group({
'transactionDate': ['', Validators.required],
'transactionAmount': ['', Validators.required],
'paymentTypeId': [''],
transactionDate: [
'',
Validators.required
],
transactionAmount: [
'',
Validators.required
],
paymentTypeId: ['']
});
}
@@ -126,10 +133,10 @@ export class EditTransactionComponent implements OnInit {
dateFormat,
locale
};
this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, 'modify', data, this.transactionTemplateData.id)
.subscribe(res => {
this.savingsService
.executeSavingsAccountTransactionsCommand(this.savingAccountId, 'modify', data, this.transactionTemplateData.id)
.subscribe((res) => {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ViewRecieptComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewRecieptComponent ]
})
.compileComponents();
declarations: [ViewRecieptComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -12,7 +12,6 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./view-reciept.component.scss']
})
export class ViewRecieptComponent implements OnInit {
/** trusted resource url for pentaho output */
pentahoUrl: any;
/** Transaction Reciept Data */
@@ -23,8 +22,10 @@ export class ViewRecieptComponent implements OnInit {
* @param {DomSanitizer} sanitizer DOM Sanitizer
* @param {ActivatedRoute} route Activated Route
*/
constructor(private sanitizer: DomSanitizer,
private route: ActivatedRoute) {
constructor(
private sanitizer: DomSanitizer,
private route: ActivatedRoute
) {
this.route.data.subscribe((data: { savingsTransactionReciept: any }) => {
this.transactionRecieptData = data.savingsTransactionReciept;
});
@@ -32,9 +33,8 @@ export class ViewRecieptComponent implements OnInit {
ngOnInit() {
const contentType = this.transactionRecieptData.headers.get('Content-Type');
const file = new Blob([this.transactionRecieptData.body], {type: contentType});
const file = new Blob([this.transactionRecieptData.body], { type: contentType });
const filecontent = URL.createObjectURL(file);
this.pentahoUrl = this.sanitizer.bypassSecurityTrustResourceUrl(filecontent);
}
}
@@ -8,9 +8,8 @@ describe('DatatableTransactionTabComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ DatatableTransactionTabComponent ]
})
.compileComponents();
declarations: [DatatableTransactionTabComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -6,7 +6,6 @@ import { ActivatedRoute } from '@angular/router';
templateUrl: './datatable-transaction-tab.component.html',
styleUrls: ['./datatable-transaction-tab.component.scss']
})
export class DatatableTransactionTabComponent {
/** Transaction Id */
entityId: string;
@@ -8,9 +8,8 @@ describe('SavingsTransactionDatatableTabComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SavingsTransactionDatatableTabComponent ]
})
.compileComponents();
declarations: [SavingsTransactionDatatableTabComponent]
}).compileComponents();
fixture = TestBed.createComponent(SavingsTransactionDatatableTabComponent);
component = fixture.componentInstance;
@@ -6,7 +6,5 @@ import { Component } from '@angular/core';
styleUrls: ['./savings-transaction-datatable-tab.component.scss']
})
export class SavingsTransactionDatatableTabComponent {
constructor() { }
constructor() {}
}
@@ -8,9 +8,8 @@ describe('SavingsTransactionGeneralTabComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SavingsTransactionGeneralTabComponent ]
})
.compileComponents();
declarations: [SavingsTransactionGeneralTabComponent]
}).compileComponents();
fixture = TestBed.createComponent(SavingsTransactionGeneralTabComponent);
component = fixture.componentInstance;
@@ -13,22 +13,23 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./savings-transaction-general-tab.component.scss']
})
export class SavingsTransactionGeneralTabComponent {
accountId: string;
transactionId: string;
transactionData: any;
constructor(private savingsService: SavingsService,
constructor(
private savingsService: SavingsService,
private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
public dialog: MatDialog,
private settingsService: SettingsService) {
this.route.data.subscribe((data: { savingsAccountTransaction: any }) => {
this.accountId = this.route.parent.snapshot.params['savingAccountId'];
this.transactionData = data.savingsAccountTransaction;
});
}
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { savingsAccountTransaction: any }) => {
this.accountId = this.route.parent.snapshot.params['savingAccountId'];
this.transactionData = data.savingsAccountTransaction;
});
}
allowUndo(): boolean {
if (this.transactionData.reversed && this.transactionData.transactionType.amountHold) {
@@ -42,9 +43,11 @@ export class SavingsTransactionGeneralTabComponent {
releaseAmountDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
const data = {};
this.savingsService.executeSavingsAccountTransactionsCommand(this.accountId, 'releaseAmount', data, this.transactionData.id).subscribe(() => {
this.router.navigate(['../..'], { relativeTo: this.route });
});
this.savingsService
.executeSavingsAccountTransactionsCommand(this.accountId, 'releaseAmount', data, this.transactionData.id)
.subscribe(() => {
this.router.navigate(['../..'], { relativeTo: this.route });
});
}
});
}
@@ -56,14 +59,19 @@ export class SavingsTransactionGeneralTabComponent {
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const data = {
transactionDate: this.dateUtils.formatDate(this.transactionData.date && new Date(this.transactionData.date), dateFormat),
transactionDate: this.dateUtils.formatDate(
this.transactionData.date && new Date(this.transactionData.date),
dateFormat
),
transactionAmount: 0,
dateFormat,
locale
};
this.savingsService.executeSavingsAccountTransactionsCommand(this.accountId, 'undo', data, this.transactionData.id).subscribe(() => {
this.router.navigate(['../..'], { relativeTo: this.route });
});
this.savingsService
.executeSavingsAccountTransactionsCommand(this.accountId, 'undo', data, this.transactionData.id)
.subscribe(() => {
this.router.navigate(['../..'], { relativeTo: this.route });
});
}
});
}
@@ -8,9 +8,8 @@ describe('ViewTransactionComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewTransactionComponent ]
})
.compileComponents();
declarations: [ViewTransactionComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -9,7 +9,6 @@ import { MatDialog } from '@angular/material/dialog';
styleUrls: ['./view-transaction.component.scss']
})
export class ViewTransactionComponent {
/** Transaction data. */
transactionData: any;
@@ -21,11 +20,13 @@ export class ViewTransactionComponent {
* @param {Router} router Router for navigation.
* @param {MatDialog} dialog Dialog reference.
*/
constructor(private route: ActivatedRoute,
public dialog: MatDialog) {
this.route.data.subscribe((data: { transactionDatatables: any}) => {
this.accountId = this.route.snapshot.params['savingAccountId'];
this.entityDatatables = data.transactionDatatables;
});
constructor(
private route: ActivatedRoute,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { transactionDatatables: any }) => {
this.accountId = this.route.snapshot.params['savingAccountId'];
this.entityDatatables = data.transactionDatatables;
});
}
}
@@ -8,9 +8,8 @@ describe('ViewChargeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewChargeComponent ]
})
.compileComponents();
declarations: [ViewChargeComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -28,7 +28,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./view-charge.component.scss']
})
export class ViewChargeComponent {
/** Charge data. */
chargeData: any;
/** Savings Account Data */
@@ -43,12 +42,14 @@ export class ViewChargeComponent {
* @param {Dates} dateUtils Date Utils.
* @param {SettingsService} settingsService Setting service
*/
constructor(private savingsService: SavingsService,
private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
public dialog: MatDialog,
private settingsService: SettingsService) {
constructor(
private savingsService: SavingsService,
private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
public dialog: MatDialog,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { savingsAccountCharge: any }) => {
this.chargeData = data.savingsAccountCharge;
});
@@ -76,6 +77,7 @@ export class ViewChargeComponent {
type: 'date',
required: true
})
];
const data = {
title: 'Pay Charge',
@@ -93,7 +95,8 @@ export class ViewChargeComponent {
dateFormat,
locale
};
this.savingsService.executeSavingsAccountChargesCommand(this.chargeData.accountId, 'pay', dataObject, this.chargeData.id)
this.savingsService
.executeSavingsAccountChargesCommand(this.chargeData.accountId, 'pay', dataObject, this.chargeData.id)
.subscribe(() => {
this.reload();
});
@@ -108,7 +111,8 @@ export class ViewChargeComponent {
const waiveChargeDialogRef = this.dialog.open(WaiveChargeDialogComponent, { data: { id: this.chargeData.id } });
waiveChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountChargesCommand(this.chargeData.accountId, 'waive', {}, this.chargeData.id)
this.savingsService
.executeSavingsAccountChargesCommand(this.chargeData.accountId, 'waive', {}, this.chargeData.id)
.subscribe(() => {
this.reload();
});
@@ -120,10 +124,13 @@ export class ViewChargeComponent {
* Inactivate's the charge
*/
inactivateCharge() {
const inactivateChargeDialogRef = this.dialog.open(InactivateChargeDialogComponent, { data: { id: this.chargeData.id } });
const inactivateChargeDialogRef = this.dialog.open(InactivateChargeDialogComponent, {
data: { id: this.chargeData.id }
});
inactivateChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountChargesCommand(this.chargeData.accountId, 'inactivate', {}, this.chargeData.id)
this.savingsService
.executeSavingsAccountChargesCommand(this.chargeData.accountId, 'inactivate', {}, this.chargeData.id)
.subscribe(() => {
this.reload();
});
@@ -143,6 +150,7 @@ export class ViewChargeComponent {
type: 'number',
required: true
})
];
const data = {
title: 'Edit Charge',
@@ -159,7 +167,8 @@ export class ViewChargeComponent {
dateFormat,
locale
};
this.savingsService.editSavingsAccountCharge(this.chargeData.accountId, dataObject, this.chargeData.id)
this.savingsService
.editSavingsAccountCharge(this.chargeData.accountId, dataObject, this.chargeData.id)
.subscribe(() => {
this.reload();
});
@@ -176,10 +185,9 @@ export class ViewChargeComponent {
});
deleteChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.savingsService.deleteSavingsAccountCharge(this.chargeData.accountId, this.chargeData.id)
.subscribe(() => {
this.reload();
});
this.savingsService.deleteSavingsAccountCharge(this.chargeData.accountId, this.chargeData.id).subscribe(() => {
this.reload();
});
}
});
}
@@ -198,9 +206,10 @@ export class ViewChargeComponent {
*/
private reload() {
const url: string = this.router.url.replace(`/${this.chargeData.id}`, '');
const refreshUrl: string = this.router.url.slice(0, this.router.url.indexOf('savings-accounts') + 'savings-accounts'.length);
this.router.navigateByUrl(refreshUrl, {skipLocationChange: true})
.then(() => this.router.navigate([url]));
const refreshUrl: string = this.router.url.slice(
0,
this.router.url.indexOf('savings-accounts') + 'savings-accounts'.length
);
this.router.navigateByUrl(refreshUrl, { skipLocationChange: true }).then(() => this.router.navigate([url]));
}
}