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
@@ -1,8 +1,5 @@
import { Injectable } from '@angular/core';
import {
Resolve,
ActivatedRouteSnapshot
} from '@angular/router';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
import { SavingsService } from '../savings.service';
@@ -10,18 +7,17 @@ import { SavingsService } from '../savings.service';
providedIn: 'root'
})
export class SavingDocumentsResolver implements Resolve<boolean> {
/**
* @param {SavingsService} savingsService Savings service.
*/
constructor(private savingsService: SavingsService) {}
/**
* @param {SavingsService} savingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
/**
* Returns the Savings data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const savingAccountId = route.parent.paramMap.get('savingAccountId');
return this.savingsService.getSavingsDocuments(savingAccountId);
}
/**
* Returns the Savings data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const savingAccountId = route.parent.paramMap.get('savingAccountId');
return this.savingsService.getSavingsDocuments(savingAccountId);
}
}
@@ -1,8 +1,5 @@
import { Injectable } from '@angular/core';
import {
Resolve,
ActivatedRouteSnapshot
} from '@angular/router';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
import { SavingsService } from '../savings.service';
@@ -10,18 +7,17 @@ import { SavingsService } from '../savings.service';
providedIn: 'root'
})
export class SavingNotesResolver implements Resolve<boolean> {
/**
* @param {SavingsService} savingsService Savings service.
*/
constructor(private savingsService: SavingsService) {}
/**
* @param {SavingsService} savingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
/**
* Returns the Savings data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const savingAccountId = route.parent.paramMap.get('savingAccountId');
return this.savingsService.getSavingsNotes(savingAccountId);
}
/**
* Returns the Savings data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const savingAccountId = route.parent.paramMap.get('savingAccountId');
return this.savingsService.getSavingsNotes(savingAccountId);
}
}
@@ -13,11 +13,10 @@ import { SavingsService } from '../savings.service';
*/
@Injectable()
export class SavingsAccountActionsResolver implements Resolve<Object> {
/**
* @param {SavingsService} SavingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
* Returns the Savings account actions data.
@@ -26,7 +25,8 @@ export class SavingsAccountActionsResolver implements Resolve<Object> {
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const actionName = route.paramMap.get('name');
const savingAccountId = route.paramMap.get('savingAccountId') || route.parent.parent.paramMap.get('savingAccountId');
const savingAccountId =
route.paramMap.get('savingAccountId') || route.parent.parent.paramMap.get('savingAccountId');
switch (actionName) {
case 'Assign Staff':
return this.savingsService.getSavingsAccountAndTemplate(savingAccountId, true);
@@ -39,13 +39,11 @@ export class SavingsAccountActionsResolver implements Resolve<Object> {
case 'Close':
return forkJoin([
this.savingsService.getSavingsTransactionTemplateResource(savingAccountId),
this.savingsService.getSavingsAccountData(savingAccountId)
]);
this.savingsService.getSavingsAccountData(savingAccountId)]);
case 'Apply Annual Fees':
return this.savingsService.getSavingsAccountData(savingAccountId);
default:
return undefined;
}
}
}
@@ -13,11 +13,10 @@ import { SavingsService } from '../savings.service';
*/
@Injectable()
export class SavingsAccountAndTemplateResolver implements Resolve<Object> {
/**
* @param {SavingsService} SavingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
* Returns the Savings Account data and template.
@@ -28,5 +27,4 @@ export class SavingsAccountAndTemplateResolver implements Resolve<Object> {
const savingAccountId = route.paramMap.get('savingAccountId');
return this.savingsService.getSavingsAccountAndTemplate(savingAccountId, true);
}
}
@@ -13,11 +13,10 @@ import { SavingsService } from '../savings.service';
*/
@Injectable()
export class SavingsAccountChargeResolver implements Resolve<Object> {
/**
* @param {SavingsService} SavingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
* Returns the Savings Account Charge data.
@@ -29,5 +28,4 @@ export class SavingsAccountChargeResolver implements Resolve<Object> {
const chargeId = route.paramMap.get('id');
return this.savingsService.getSavingsAccountCharge(savingAccountId, chargeId);
}
}
@@ -13,11 +13,10 @@ import { SavingsService } from '../savings.service';
*/
@Injectable()
export class SavingsAccountTemplateResolver implements Resolve<Object> {
/**
* @param {savingsService} SavingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
* Returns the Shares Account Template.
@@ -26,8 +25,7 @@ export class SavingsAccountTemplateResolver implements Resolve<Object> {
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const entityId = route.paramMap.get('clientId') || route.paramMap.get('groupId') || route.paramMap.get('centerId');
const isGroup = (route.paramMap.get('groupId') || route.paramMap.get('centerId')) ? true : false;
const isGroup = route.paramMap.get('groupId') || route.paramMap.get('centerId') ? true : false;
return this.savingsService.getSavingsAccountTemplate(entityId, undefined, isGroup);
}
}
@@ -13,11 +13,10 @@ import { SavingsService } from '../savings.service';
*/
@Injectable()
export class SavingsAccountTransactionTemplateResolver implements Resolve<Object> {
/**
* @param {SavingsService} SavingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
* Returns the Savings Account Transaction Template data.
@@ -29,5 +28,4 @@ export class SavingsAccountTransactionTemplateResolver implements Resolve<Object
const transactionId = route.paramMap.get('id');
return this.savingsService.getSavingsAccountTransactionTemplate(savingAccountId, transactionId);
}
}
@@ -13,11 +13,10 @@ import { SavingsService } from '../savings.service';
*/
@Injectable()
export class SavingsAccountTransactionResolver implements Resolve<Object> {
/**
* @param {SavingsService} SavingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
* Returns the Savings Account Transaction data.
@@ -29,5 +28,4 @@ export class SavingsAccountTransactionResolver implements Resolve<Object> {
const transactionId = route.parent.paramMap.get('id');
return this.savingsService.getSavingsAccountTransaction(savingAccountId, transactionId);
}
}
@@ -13,11 +13,10 @@ import { SavingsService } from '../savings.service';
*/
@Injectable()
export class SavingsAccountViewResolver implements Resolve<Object> {
/**
* @param {SavingsService} SavingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
* Returns the Savings Account data.
@@ -28,5 +27,4 @@ export class SavingsAccountViewResolver implements Resolve<Object> {
const savingAccountId = route.paramMap.get('savingAccountId');
return this.savingsService.getSavingsAccountData(savingAccountId);
}
}
@@ -13,20 +13,21 @@ import { SavingsService } from '../savings.service';
*/
@Injectable()
export class SavingsDatatableResolver implements Resolve<Object> {
/**
* @param {SavingsService} SavingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
* Returns the Savings Account's Datatable data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const accountId = route.parent.parent.paramMap.get('savingAccountId') || route.parent.parent.paramMap.get('fixedDepositAccountId') || route.parent.parent.paramMap.get('recurringDepositAccountId');
const accountId =
route.parent.parent.paramMap.get('savingAccountId') ||
route.parent.parent.paramMap.get('fixedDepositAccountId') ||
route.parent.parent.paramMap.get('recurringDepositAccountId');
const datatableName = route.paramMap.get('datatableName');
return this.savingsService.getSavingsDatatable(accountId, datatableName);
}
}
@@ -13,11 +13,10 @@ import { SavingsService } from '../savings.service';
*/
@Injectable()
export class SavingsDatatablesResolver implements Resolve<Object> {
/**
* @param {SavingsService} SavingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
* Returns the Saving Account's Datatables data.
@@ -26,5 +25,4 @@ export class SavingsDatatablesResolver implements Resolve<Object> {
resolve(): Observable<any> {
return this.savingsService.getSavingsDatatables();
}
}
@@ -14,13 +14,14 @@ import { SettingsService } from 'app/settings/settings.service';
*/
@Injectable()
export class SavingsTransactionRecieptResolver implements Resolve<Object> {
/**
* @param {ReportsService} reportsService Reports service.
* @param {SettingsService} settingsService Settings Service.
*/
constructor(private reportsService: ReportsService,
private settingsService: SettingsService) { }
constructor(
private reportsService: ReportsService,
private settingsService: SettingsService
) {}
/**
* Returns the Savings Transaction Reciept
@@ -30,10 +31,15 @@ export class SavingsTransactionRecieptResolver implements Resolve<Object> {
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const transactionId = route.paramMap.get('id');
const data = {
'output-type': 'PDF',
R_transactionId: transactionId
'output-type': 'PDF',
R_transactionId: transactionId
};
return this.reportsService.getPentahoRunReportData('Savings Transaction Receipt', data, 'default', this.settingsService.language.code, this.settingsService.dateFormat);
return this.reportsService.getPentahoRunReportData(
'Savings Transaction Receipt',
data,
'default',
this.settingsService.language.code,
this.settingsService.dateFormat
);
}
}
@@ -14,7 +14,7 @@ export class TransactionDatatableResolver implements Resolve<Object> {
*
* @param {SavingsService} savingsService
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
* Returns the Transactions Account's Datatable data.
* @returns {Observable<any>}
@@ -10,12 +10,11 @@ import { SavingsService } from '../savings.service';
@Injectable()
export class TransactionDatatablesResolver implements Resolve<Object> {
/**
*
* @param savingsService Savings Service
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
*
* @param route
@@ -8,9 +8,8 @@ describe('CreateSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateSavingsAccountComponent ]
})
.compileComponents();
declarations: [CreateSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -21,18 +21,20 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./create-savings-account.component.scss']
})
export class CreateSavingsAccountComponent {
/** Savings Account Template */
savingsAccountTemplate: any;
/** Savings Account Product Template */
savingsAccountProductTemplate: any;
/** Savings Account Details Step */
@ViewChild(SavingsAccountDetailsStepComponent, { static: true }) savingsAccountDetailsStep: SavingsAccountDetailsStepComponent;
@ViewChild(SavingsAccountDetailsStepComponent, { static: true })
savingsAccountDetailsStep: SavingsAccountDetailsStepComponent;
/** Savings Account Terms Step */
@ViewChild(SavingsAccountTermsStepComponent, { static: true }) savingsAccountTermsStep: SavingsAccountTermsStepComponent;
@ViewChild(SavingsAccountTermsStepComponent, { static: true })
savingsAccountTermsStep: SavingsAccountTermsStepComponent;
/** Savings Account Charges Step */
@ViewChild(SavingsAccountChargesStepComponent, { static: true }) savingsAccountChargesStep: SavingsAccountChargesStepComponent;
@ViewChild(SavingsAccountChargesStepComponent, { static: true })
savingsAccountChargesStep: SavingsAccountChargesStepComponent;
/**
* Fetches savings account template from `resolve`
@@ -42,12 +44,13 @@ export class CreateSavingsAccountComponent {
* @param {SavingsService} savingsService Savings Service
* @param {SettingsService} settingsService Settings Service
*/
constructor(private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private savingsService: SavingsService,
private settingsService: SettingsService
) {
constructor(
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private savingsService: SavingsService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { savingsAccountTemplate: any }) => {
this.savingsAccountTemplate = data.savingsAccountTemplate;
});
@@ -79,10 +82,7 @@ export class CreateSavingsAccountComponent {
* Checks validity of overall savings account form.
*/
get savingsAccountFormValid() {
return (
this.savingsAccountDetailsForm.valid &&
this.savingsAccountTermsForm.valid
);
return this.savingsAccountDetailsForm.valid && this.savingsAccountTermsForm.valid;
}
/**
@@ -124,8 +124,13 @@ export class CreateSavingsAccountComponent {
savingsAccount.groupId = this.savingsAccountTemplate.groupId;
}
this.savingsService.createSavingsAccount(savingsAccount).subscribe((response: any) => {
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
this.router.navigate(
[
'../',
response.resourceId
],
{ relativeTo: this.route }
);
});
}
}
@@ -8,9 +8,8 @@ describe('EditSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditSavingsAccountComponent ]
})
.compileComponents();
declarations: [EditSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -21,18 +21,20 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./edit-savings-account.component.scss']
})
export class EditSavingsAccountComponent {
/** Savings Account Template */
savingsAccountAndTemplate: any;
/** Savings Account Product Template */
savingsAccountProductTemplate: any;
/** Savings Account Details Step */
@ViewChild(SavingsAccountDetailsStepComponent, { static: true }) savingsAccountDetailsStep: SavingsAccountDetailsStepComponent;
@ViewChild(SavingsAccountDetailsStepComponent, { static: true })
savingsAccountDetailsStep: SavingsAccountDetailsStepComponent;
/** Savings Account Terms Step */
@ViewChild(SavingsAccountTermsStepComponent, { static: true }) savingsAccountTermsStep: SavingsAccountTermsStepComponent;
@ViewChild(SavingsAccountTermsStepComponent, { static: true })
savingsAccountTermsStep: SavingsAccountTermsStepComponent;
/** Savings Account Charges Step */
@ViewChild(SavingsAccountChargesStepComponent, { static: true }) savingsAccountChargesStep: SavingsAccountChargesStepComponent;
@ViewChild(SavingsAccountChargesStepComponent, { static: true })
savingsAccountChargesStep: SavingsAccountChargesStepComponent;
/**
* Fetches savings account template from `resolve`
@@ -42,12 +44,13 @@ export class EditSavingsAccountComponent {
* @param {SavingsService} savingsService Savings Service
* @param {SettingsService} settingsService Settings Service
*/
constructor(private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private savingsService: SavingsService,
private settingsService: SettingsService
) {
constructor(
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private savingsService: SavingsService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { savingsAccountAndTemplate: any }) => {
this.savingsAccountAndTemplate = data.savingsAccountAndTemplate;
});
@@ -82,11 +85,9 @@ export class EditSavingsAccountComponent {
return (
this.savingsAccountDetailsForm.valid &&
this.savingsAccountTermsForm.valid &&
(
!this.savingsAccountDetailsForm.pristine ||
(!this.savingsAccountDetailsForm.pristine ||
!this.savingsAccountTermsForm.pristine ||
!this.savingsAccountChargesStep.pristine
)
!this.savingsAccountChargesStep.pristine)
);
}
@@ -128,9 +129,10 @@ export class EditSavingsAccountComponent {
} else {
savingsAccount.groupId = this.savingsAccountAndTemplate.groupId;
}
this.savingsService.updateSavingsAccount(this.savingsAccountAndTemplate.id, savingsAccount).subscribe((response: any) => {
this.router.navigate(['../'], { relativeTo: this.route });
});
this.savingsService
.updateSavingsAccount(this.savingsAccountAndTemplate.id, savingsAccount)
.subscribe((response: any) => {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CreateGsimAccountComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ CreateGsimAccountComponent ]
})
.compileComponents();
declarations: [CreateGsimAccountComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -20,9 +20,7 @@ import { Dates } from 'app/core/utils/dates';
templateUrl: './create-gsim-account.component.html',
styleUrls: ['./create-gsim-account.component.scss']
})
export class CreateGsimAccountComponent {
/** Savings Account Template */
savingsAccountTemplate: any;
/** Savings Account Product Template */
@@ -33,11 +31,14 @@ export class CreateGsimAccountComponent {
selectedMembers: any;
/** Savings Account Details Step */
@ViewChild(SavingsAccountDetailsStepComponent, { static: true }) savingsAccountDetailsStep: SavingsAccountDetailsStepComponent;
@ViewChild(SavingsAccountDetailsStepComponent, { static: true })
savingsAccountDetailsStep: SavingsAccountDetailsStepComponent;
/** Savings Account Terms Step */
@ViewChild(SavingsAccountTermsStepComponent, { static: true }) savingsAccountTermsStep: SavingsAccountTermsStepComponent;
@ViewChild(SavingsAccountTermsStepComponent, { static: true })
savingsAccountTermsStep: SavingsAccountTermsStepComponent;
/** Savings Account Charges Step */
@ViewChild(SavingsAccountChargesStepComponent, { static: true }) savingsAccountChargesStep: SavingsAccountChargesStepComponent;
@ViewChild(SavingsAccountChargesStepComponent, { static: true })
savingsAccountChargesStep: SavingsAccountChargesStepComponent;
/**
* Fetches savings account template from `resolve`
@@ -47,13 +48,14 @@ export class CreateGsimAccountComponent {
* @param {SavingsService} savingsService Savings Service
* @param {SettingsService} settingsService Settings Service
*/
constructor(private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private savingsService: SavingsService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { savingsAccountTemplate: any, groupsData: any }) => {
constructor(
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private savingsService: SavingsService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { savingsAccountTemplate: any; groupsData: any }) => {
this.savingsAccountTemplate = data.savingsAccountTemplate;
this.dataSource = data.groupsData.activeClientMembers;
});
@@ -63,7 +65,7 @@ export class CreateGsimAccountComponent {
* Sets savings account product template.
* @param {any} $event API response
*/
setTemplate($event: any) {
setTemplate($event: any) {
this.savingsAccountProductTemplate = $event;
}
@@ -84,7 +86,7 @@ export class CreateGsimAccountComponent {
/**
* Retrieves savings account terms form.
*/
get activeClientMembers() {
get activeClientMembers() {
return this.dataSource;
}
@@ -92,10 +94,7 @@ export class CreateGsimAccountComponent {
* Checks validity of overall savings account form.
*/
get savingsAccountFormValid() {
return (
this.savingsAccountDetailsForm.valid &&
this.savingsAccountTermsForm.valid
);
return this.savingsAccountDetailsForm.valid && this.savingsAccountTermsForm.valid;
}
/**
@@ -119,7 +118,7 @@ export class CreateGsimAccountComponent {
...this.savingsAccount,
charges: this.savingsAccount.charges.map((charge: any) => ({
chargeId: charge.id,
amount: charge.amount,
amount: charge.amount
})),
clientId: client.id,
isGSIM: true,
@@ -132,7 +131,6 @@ export class CreateGsimAccountComponent {
data.groupId = this.savingsAccountTemplate.groupId;
return data;
}
/** Request Body Data */
@@ -140,9 +138,7 @@ export class CreateGsimAccountComponent {
const requestData = [];
const memberSelected = this.selectedMembers.selectedMembers;
for (let index = 0; index < 1; index++) {
requestData.push(
this.setData( memberSelected[ index ] ),
);
requestData.push(this.setData(memberSelected[index]));
}
return requestData;
}
@@ -153,11 +149,16 @@ export class CreateGsimAccountComponent {
submit() {
const data = this.buildRequestData();
const gsimData = {
clientArray: data,
clientArray: data
};
this.savingsService.createGsimAcccount(gsimData).subscribe((response: any) => {
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
this.router.navigate(
[
'../',
response.resourceId
],
{ relativeTo: this.route }
);
});
}
}
@@ -8,9 +8,8 @@ describe('GsimAccountComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GsimAccountComponent ]
})
.compileComponents();
declarations: [GsimAccountComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -13,9 +13,14 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./gsim-account.component.scss']
})
export class GsimAccountComponent implements OnInit {
/** Columns to be displayed in charge overview table. */
displayedColumns: string[] = ['clientDetails', 'savingsAccount', 'products', 'balance', 'Actions'];
displayedColumns: string[] = [
'clientDetails',
'savingsAccount',
'products',
'balance',
'Actions'
];
/** Data source for charge overview table. */
dataSource: MatTableDataSource<any>;
/** Charge Overview data */
@@ -33,9 +38,11 @@ export class GsimAccountComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
* @param {MatDialog} dialog Dialog reference.
*/
constructor(private route: ActivatedRoute,
public dialog: MatDialog) {
this.route.data.subscribe((data: { gsimData: any, savingAccountData: any, groupsData: any }) => {
constructor(
private route: ActivatedRoute,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { gsimData: any; savingAccountData: any; groupsData: any }) => {
this.gsimOverviewData = data.gsimData[0].childGSIMAccounts;
this.savingAccountData = data.savingAccountData;
this.groupsData = data.groupsData;
@@ -49,7 +56,7 @@ export class GsimAccountComponent implements OnInit {
/**
* Set Client Charge Overview.
*/
setLoanClientChargeOverview() {
setLoanClientChargeOverview() {
this.dataSource = new MatTableDataSource(this.gsimOverviewData);
// this.dataSource.paginator = this.paginator;
}
@@ -58,8 +65,7 @@ export class GsimAccountComponent implements OnInit {
* Stops the propagation to view pages.
* @param $event Mouse Event
*/
routeEdit($event: MouseEvent) {
routeEdit($event: MouseEvent) {
$event.stopPropagation();
}
}
@@ -13,11 +13,10 @@ import { SavingsService } from '../savings.service';
*/
@Injectable()
export class GSIMViewResolver implements Resolve<Object> {
/**
* @param {SavingsService} savingsService Savings service.
*/
constructor(private savingsService: SavingsService) { }
constructor(private savingsService: SavingsService) {}
/**
* Returns the Savings Account data.
@@ -29,5 +28,4 @@ export class GSIMViewResolver implements Resolve<Object> {
const savingAccountId = route.paramMap.get('savingAccountId');
return this.savingsService.getGSIMAccountData(savingAccountId, groupId);
}
}
@@ -1,57 +1,56 @@
import { Currency } from 'app/shared/models/general.model';
export interface SavingsAccountTransaction {
id: number;
transactionType: SavingsAccountTransactionType;
entryType: string;
accountId: number;
accountNo: string;
date: number[];
currency: Currency;
amount: number;
runningBalance: number;
reversed: boolean;
transfer: Transfer;
submittedOnDate: number[];
interestedPostedAsOn: boolean;
submittedByUsername: string;
isManualTransaction: boolean;
isReversal: boolean;
originalTransactionId: number;
lienTransaction: boolean;
releaseTransactionId: number;
chargesPaidByData: any[];
id: number;
transactionType: SavingsAccountTransactionType;
entryType: string;
accountId: number;
accountNo: string;
date: number[];
currency: Currency;
amount: number;
runningBalance: number;
reversed: boolean;
transfer: Transfer;
submittedOnDate: number[];
interestedPostedAsOn: boolean;
submittedByUsername: string;
isManualTransaction: boolean;
isReversal: boolean;
originalTransactionId: number;
lienTransaction: boolean;
releaseTransactionId: number;
chargesPaidByData: any[];
}
export interface SavingsAccountTransactionType {
id: number;
code: string;
value: string;
deposit: boolean;
dividendPayout: boolean;
withdrawal: boolean;
interestPosting: boolean;
feeDeduction: boolean;
initiateTransfer: boolean;
approveTransfer: boolean;
withdrawTransfer: boolean;
rejectTransfer: boolean;
overdraftInterest: boolean;
writtenoff: boolean;
overdraftFee: boolean;
withholdTax: boolean;
escheat: boolean;
amountHold: boolean;
amountRelease: boolean;
accrual: boolean;
id: number;
code: string;
value: string;
deposit: boolean;
dividendPayout: boolean;
withdrawal: boolean;
interestPosting: boolean;
feeDeduction: boolean;
initiateTransfer: boolean;
approveTransfer: boolean;
withdrawTransfer: boolean;
rejectTransfer: boolean;
overdraftInterest: boolean;
writtenoff: boolean;
overdraftFee: boolean;
withholdTax: boolean;
escheat: boolean;
amountHold: boolean;
amountRelease: boolean;
accrual: boolean;
}
export interface Transfer {
id: number;
reversed: boolean;
currency: Currency;
transferAmount: number;
transferDate: number[];
transferDescription: string;
id: number;
reversed: boolean;
currency: Currency;
transferAmount: number;
transferDate: number[];
transferDescription: string;
}
@@ -8,9 +8,8 @@ describe('ActivateSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ActivateSavingsAccountComponent ]
})
.compileComponents();
declarations: [ActivateSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./activate-savings-account.component.scss']
})
export class ActivateSavingsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class ActivateSavingsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.accountId = this.route.snapshot.params['savingAccountId'];
}
@@ -57,7 +58,10 @@ export class ActivateSavingsAccountComponent implements OnInit {
*/
createActivateSavingsAccountForm() {
this.activateSavingsAccountForm = this.formBuilder.group({
'activatedOnDate': ['', Validators.required]
activatedOnDate: [
'',
Validators.required
]
});
}
@@ -82,5 +86,4 @@ export class ActivateSavingsAccountComponent implements OnInit {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('AddChargeSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddChargeSavingsAccountComponent ]
})
.compileComponents();
declarations: [AddChargeSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./add-charge-savings-account.component.scss']
})
export class AddChargeSavingsAccountComponent implements OnInit {
/** Minimum Due Date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum Due Date allowed. */
@@ -40,12 +39,14 @@ export class AddChargeSavingsAccountComponent implements OnInit {
* @param {SavingsService} savingsService Savings Service
* @param {SettingsService} settingsService Settings 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: { savingsAccountActionData: any }) => {
this.savingsChargeOptions = data.savingsAccountActionData.chargeOptions;
});
@@ -62,7 +63,7 @@ export class AddChargeSavingsAccountComponent implements OnInit {
}
buildDependencies() {
this.savingsChargeForm.controls.chargeId.valueChanges.subscribe(chargeId => {
this.savingsChargeForm.controls.chargeId.valueChanges.subscribe((chargeId) => {
this.savingsService.getChargeTemplate(chargeId).subscribe((data: any) => {
this.chargeDetails = data;
const chargeTimeType = data.chargeTimeType.id;
@@ -83,14 +84,17 @@ export class AddChargeSavingsAccountComponent implements OnInit {
this.savingsChargeForm.removeControl('feeOnMonthDay');
}
if (chargeTimeType.value === 'Monthly Fee') {
this.savingsChargeForm.addControl('feeInterval', new UntypedFormControl(data.feeInterval, Validators.required));
this.savingsChargeForm.addControl(
'feeInterval',
new UntypedFormControl(data.feeInterval, Validators.required)
);
} else {
this.savingsChargeForm.removeControl('feeInterval');
}
this.savingsChargeForm.patchValue({
'amount': data.amount,
'chargeCalculationType': data.chargeCalculationType.id,
'chargeTimeType': data.chargeTimeType.id
amount: data.amount,
chargeCalculationType: data.chargeCalculationType.id,
chargeTimeType: data.chargeTimeType.id
});
});
});
@@ -101,10 +105,16 @@ export class AddChargeSavingsAccountComponent implements OnInit {
*/
createSavingsChargeForm() {
this.savingsChargeForm = this.formBuilder.group({
'chargeId': ['', Validators.required],
'amount': ['', Validators.required],
'chargeCalculationType': [{ value: '', disabled: true }],
'chargeTimeType': [{ value: '', disabled: true }]
chargeId: [
'',
Validators.required
],
amount: [
'',
Validators.required
],
chargeCalculationType: [{ value: '', disabled: true }],
chargeTimeType: [{ value: '', disabled: true }]
});
}
@@ -134,9 +144,8 @@ export class AddChargeSavingsAccountComponent implements OnInit {
}
}
}
this.savingsService.createSavingsCharge(this.savingAccountId, 'charges', savingsCharge).subscribe( () => {
this.savingsService.createSavingsCharge(this.savingAccountId, 'charges', savingsCharge).subscribe(() => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ApplyAnnualFeesSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ApplyAnnualFeesSavingsAccountComponent ]
})
.compileComponents();
declarations: [ApplyAnnualFeesSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./apply-annual-fees-savings-account.component.scss']
})
export class ApplyAnnualFeesSavingsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -39,12 +38,14 @@ export class ApplyAnnualFeesSavingsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.accountId = this.route.snapshot.params['savingAccountId'];
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
this.savingsAccountData = data.savingsAccountActionData;
@@ -65,8 +66,11 @@ export class ApplyAnnualFeesSavingsAccountComponent implements OnInit {
*/
createApplyAnnualFeesForm() {
this.applyAnnualFeesForm = this.formBuilder.group({
'dueDate': ['', Validators.required],
'amount': ['']
dueDate: [
'',
Validators.required
],
amount: ['']
});
}
@@ -75,12 +79,12 @@ export class ApplyAnnualFeesSavingsAccountComponent implements OnInit {
*/
applyCharge() {
const charges: any[] = this.savingsAccountData.charges;
charges.forEach((charge: any) => {
if (charge.name === 'Annual fee - INR') {
this.chargeId = charge.id;
this.applyAnnualFeesForm.get('amount').patchValue(charge.amount);
}
});
charges.forEach((charge: any) => {
if (charge.name === 'Annual fee - INR') {
this.chargeId = charge.id;
this.applyAnnualFeesForm.get('amount').patchValue(charge.amount);
}
});
}
/**
@@ -100,9 +104,10 @@ export class ApplyAnnualFeesSavingsAccountComponent implements OnInit {
dateFormat,
locale
};
this.savingsService.executeSavingsAccountChargesCommand(this.accountId, 'paycharge', data, this.chargeId).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.savingsService
.executeSavingsAccountChargesCommand(this.accountId, 'paycharge', data, this.chargeId)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ApproveSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ApproveSavingsAccountComponent ]
})
.compileComponents();
declarations: [ApproveSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./approve-savings-account.component.scss']
})
export class ApproveSavingsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class ApproveSavingsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.accountId = this.route.snapshot.params['savingAccountId'];
}
@@ -57,8 +58,11 @@ export class ApproveSavingsAccountComponent implements OnInit {
*/
createApproveSavingsAccountForm() {
this.approveSavingsAccountForm = this.formBuilder.group({
'approvedOnDate': ['', Validators.required],
'note': ['']
approvedOnDate: [
'',
Validators.required
],
note: ['']
});
}
@@ -83,5 +87,4 @@ export class ApproveSavingsAccountComponent implements OnInit {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CloseSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CloseSavingsAccountComponent ]
})
.compileComponents();
declarations: [CloseSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./close-savings-account.component.scss']
})
export class CloseSavingsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -41,12 +40,14 @@ export class CloseSavingsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
this.paymentTypeOptions = data.savingsAccountActionData[0].paymentTypeOptions;
this.transactionAmount = data.savingsAccountActionData[1].summary.accountBalance;
@@ -68,10 +69,13 @@ export class CloseSavingsAccountComponent implements OnInit {
*/
createCloseSavingsAccountForm() {
this.closeSavingsAccountForm = this.formBuilder.group({
'closedOnDate': ['', Validators.required],
'withdrawBalance': [false],
'postInterestValidationOnClosure': [false],
'note': ['']
closedOnDate: [
'',
Validators.required
],
withdrawBalance: [false],
postInterestValidationOnClosure: [false],
note: ['']
});
}
@@ -81,7 +85,10 @@ export class CloseSavingsAccountComponent implements OnInit {
buildDependencies() {
this.closeSavingsAccountForm.get('withdrawBalance').valueChanges.subscribe((value: boolean) => {
if (value) {
this.closeSavingsAccountForm.addControl('amount', new UntypedFormControl({value: this.transactionAmount, disabled: true}));
this.closeSavingsAccountForm.addControl(
'amount',
new UntypedFormControl({ value: this.transactionAmount, disabled: true })
);
this.closeSavingsAccountForm.addControl('paymentTypeId', new UntypedFormControl(''));
} else {
this.closeSavingsAccountForm.removeControl('amount');
@@ -131,5 +138,4 @@ export class CloseSavingsAccountComponent implements OnInit {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ManageSavingsAccountComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ManageSavingsAccountComponent ]
})
.compileComponents();
declarations: [ManageSavingsAccountComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -13,7 +13,6 @@ import { SystemService } from 'app/system/system.service';
styleUrls: ['./manage-savings-account.component.scss']
})
export class ManageSavingsAccountComponent implements OnInit {
@Input() currency: Currency;
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
@@ -28,16 +27,16 @@ export class ManageSavingsAccountComponent implements OnInit {
reasonOptions: any = [];
transactionType: {
holdamount: boolean,
blockaccount: boolean,
blockdeposit: boolean,
blockwithdrawal: boolean
holdamount: boolean;
blockaccount: boolean;
blockdeposit: boolean;
blockwithdrawal: boolean;
} = {
holdamount: false,
blockaccount: false,
blockdeposit: false,
blockwithdrawal: false
};
holdamount: false,
blockaccount: false,
blockdeposit: false,
blockwithdrawal: false
};
/**
* @param {FormBuilder} formBuilder Form Builder
@@ -47,13 +46,15 @@ export class ManageSavingsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private systemService: SystemService,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.transactionCommand = this.route.snapshot.params['name'].toLowerCase().replaceAll(' ', '');
this.transactionType[this.transactionCommand] = true;
this.savingAccountId = this.route.snapshot.params['savingAccountId'];
@@ -65,8 +66,12 @@ export class ManageSavingsAccountComponent implements OnInit {
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
this.createManageSavingsAccountForm();
if (this.transactionType.holdamount || this.transactionType.blockaccount
|| this.transactionType.blockdeposit || this.transactionType.blockwithdrawal) {
if (
this.transactionType.holdamount ||
this.transactionType.blockaccount ||
this.transactionType.blockdeposit ||
this.transactionType.blockwithdrawal
) {
this.getCodeValues();
}
}
@@ -100,13 +105,25 @@ export class ManageSavingsAccountComponent implements OnInit {
createManageSavingsAccountForm() {
if (this.transactionType.holdamount) {
this.manageSavingsAccountForm = this.formBuilder.group({
'reasonForBlock': ['', Validators.required],
'transactionDate': ['', Validators.required],
'transactionAmount': [0.0, Validators.required]
reasonForBlock: [
'',
Validators.required
],
transactionDate: [
'',
Validators.required
],
transactionAmount: [
0.0,
Validators.required
]
});
} else {
this.manageSavingsAccountForm = this.formBuilder.group({
'reasonForBlock': ['', Validators.required]
reasonForBlock: [
'',
Validators.required
]
});
}
}
@@ -131,12 +148,14 @@ export class ManageSavingsAccountComponent implements OnInit {
command = 'holdAmount';
payload['transactionAmount'] = payload['transactionAmount'] * 1;
this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, command, payload).subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
this.savingsService
.executeSavingsAccountTransactionsCommand(this.savingAccountId, command, payload)
.subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
} else {
payload = {
... this.manageSavingsAccountForm.value
...this.manageSavingsAccountForm.value
};
command = 'block';
if (this.transactionType.blockdeposit) {
@@ -145,10 +164,11 @@ export class ManageSavingsAccountComponent implements OnInit {
command = 'blockDebit';
}
this.savingsService.executeSavingsAccountCommand(this.savingAccountId, command, payload).subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
this.savingsService
.executeSavingsAccountCommand(this.savingAccountId, command, payload)
.subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
}
@@ -8,9 +8,8 @@ describe('PostInterestAsOnSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PostInterestAsOnSavingsAccountComponent ]
})
.compileComponents();
declarations: [PostInterestAsOnSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./post-interest-as-on-savings-account.component.scss']
})
export class PostInterestAsOnSavingsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class PostInterestAsOnSavingsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.accountId = this.route.snapshot.params['savingAccountId'];
}
@@ -57,7 +58,10 @@ export class PostInterestAsOnSavingsAccountComponent implements OnInit {
*/
createPostInterestSavingsAccountForm() {
this.postInterestSavingsAccountForm = this.formBuilder.group({
'transactionDate': ['', Validators.required]
transactionDate: [
'',
Validators.required
]
});
}
@@ -79,9 +83,10 @@ export class PostInterestAsOnSavingsAccountComponent implements OnInit {
dateFormat,
locale
};
this.savingsService.executeSavingsAccountTransactionsCommand(this.accountId, 'postInterestAsOn', data).subscribe(() => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
this.savingsService
.executeSavingsAccountTransactionsCommand(this.accountId, 'postInterestAsOn', data)
.subscribe(() => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('RejectSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RejectSavingsAccountComponent ]
})
.compileComponents();
declarations: [RejectSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./reject-savings-account.component.scss']
})
export class RejectSavingsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class RejectSavingsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.accountId = this.route.snapshot.params['savingAccountId'];
}
@@ -57,8 +58,11 @@ export class RejectSavingsAccountComponent implements OnInit {
*/
createRejectSavingsAccountForm() {
this.rejectSavingsAccountForm = this.formBuilder.group({
'rejectedOnDate': ['', Validators.required],
'note': ['']
rejectedOnDate: [
'',
Validators.required
],
note: ['']
});
}
@@ -83,5 +87,4 @@ export class RejectSavingsAccountComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('SavingAccountActionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingAccountActionsComponent ]
})
.compileComponents();
declarations: [SavingAccountActionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -12,36 +12,35 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./saving-account-actions.component.scss']
})
export class SavingAccountActionsComponent {
/** Flag object to store possible actions and render appropriate UI to the user */
actions: {
'Approve': boolean
'Reject': boolean
'Withdrawal': boolean
'Deposit': boolean
'Activate': boolean
'Close': boolean
'Undo Approval': boolean
'Post Interest As On': boolean
'Assign Staff': boolean
'Add Charge': boolean
'Unassign Staff': boolean
'Withdrawn by Client': boolean
'Apply Annual Fees': boolean
'Hold Amount': boolean
'Block Account': boolean
'Unblock Account': boolean
'Block Deposit': boolean
'Unblock Deposit': boolean
'Block Withdrawal': boolean
'Unblock Withdrawal': boolean
Approve: boolean;
Reject: boolean;
Withdrawal: boolean;
Deposit: boolean;
Activate: boolean;
Close: boolean;
'Undo Approval': boolean;
'Post Interest As On': boolean;
'Assign Staff': boolean;
'Add Charge': boolean;
'Unassign Staff': boolean;
'Withdrawn by Client': boolean;
'Apply Annual Fees': boolean;
'Hold Amount': boolean;
'Block Account': boolean;
'Unblock Account': boolean;
'Block Deposit': boolean;
'Unblock Deposit': boolean;
'Block Withdrawal': boolean;
'Unblock Withdrawal': boolean;
} = {
'Approve': false,
'Reject': false,
'Withdrawal': false,
'Deposit': false,
'Activate': false,
'Close': false,
Approve: false,
Reject: false,
Withdrawal: false,
Deposit: false,
Activate: false,
Close: false,
'Undo Approval': false,
'Post Interest As On': false,
'Assign Staff': false,
@@ -72,5 +71,4 @@ export class SavingAccountActionsComponent {
const name = this.route.snapshot.params['name'];
this.actions[name] = true;
}
}
@@ -8,9 +8,8 @@ describe('SavingsAccountAssignStaffComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountAssignStaffComponent ]
})
.compileComponents();
declarations: [SavingsAccountAssignStaffComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./savings-account-assign-staff.component.scss']
})
export class SavingsAccountAssignStaffComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -39,12 +38,14 @@ export class SavingsAccountAssignStaffComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.accountId = this.route.snapshot.params['savingAccountId'];
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
this.savingsAccountData = data.savingsAccountActionData;
@@ -65,8 +66,11 @@ export class SavingsAccountAssignStaffComponent implements OnInit {
*/
createSavingsAssignStaffForm() {
this.savingsAssignStaffForm = this.formBuilder.group({
'toSavingsOfficerId': [''],
'assignmentDate': ['', Validators.required]
toSavingsOfficerId: [''],
assignmentDate: [
'',
Validators.required
]
});
}
@@ -92,5 +96,4 @@ export class SavingsAccountAssignStaffComponent implements OnInit {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('TransactionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountTransactionsComponent ]
})
.compileComponents();
declarations: [SavingsAccountTransactionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./savings-account-transactions.component.scss']
})
export class SavingsAccountTransactionsComponent implements OnInit {
/** Minimum Due Date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum Due Date allowed. */
@@ -27,16 +26,16 @@ export class SavingsAccountTransactionsComponent implements OnInit {
savingAccountTransactionForm: 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. */
addPaymentDetailsFlag: Boolean = false;
/** transaction type flag to render required UI */
transactionType: { deposit: boolean, withdrawal: boolean } = { deposit: false, withdrawal: false };
transactionType: { deposit: boolean; withdrawal: boolean } = { deposit: false, withdrawal: false };
/** transaction command for submit request */
transactionCommand: string;
/** saving account's Id */
@@ -52,12 +51,14 @@ export class SavingsAccountTransactionsComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings 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: { savingsAccountActionData: any }) => {
this.paymentTypeOptions = data.savingsAccountActionData.paymentTypeOptions;
if (data.savingsAccountActionData.currency) {
@@ -82,10 +83,16 @@ export class SavingsAccountTransactionsComponent implements OnInit {
*/
createSavingAccountTransactionForm() {
this.savingAccountTransactionForm = this.formBuilder.group({
'transactionDate': [this.settingsService.businessDate, Validators.required],
'transactionAmount': [0, Validators.required],
'paymentTypeId': [''],
'note': ['']
transactionDate: [
this.settingsService.businessDate,
Validators.required
],
transactionAmount: [
0,
Validators.required
],
paymentTypeId: [''],
note: ['']
});
}
@@ -126,8 +133,10 @@ export class SavingsAccountTransactionsComponent implements OnInit {
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, this.transactionCommand, data).subscribe(res => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
this.savingsService
.executeSavingsAccountTransactionsCommand(this.savingAccountId, this.transactionCommand, data)
.subscribe((res) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('SavingsAccountUnassignStaffComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountUnassignStaffComponent ]
})
.compileComponents();
declarations: [SavingsAccountUnassignStaffComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./savings-account-unassign-staff.component.scss']
})
export class SavingsAccountUnassignStaffComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class SavingsAccountUnassignStaffComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.accountId = this.route.snapshot.params['savingAccountId'];
}
@@ -57,7 +58,10 @@ export class SavingsAccountUnassignStaffComponent implements OnInit {
*/
createSavingsUnassignStaffForm() {
this.savingsUnassignStaffForm = this.formBuilder.group({
'unassignedDate': ['', Validators.required]
unassignedDate: [
'',
Validators.required
]
});
}
@@ -82,5 +86,4 @@ export class SavingsAccountUnassignStaffComponent implements OnInit {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('UndoApprovalSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UndoApprovalSavingsAccountComponent ]
})
.compileComponents();
declarations: [UndoApprovalSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { SavingsService } from 'app/savings/savings.service';
styleUrls: ['./undo-approval-savings-account.component.scss']
})
export class UndoApprovalSavingsAccountComponent implements OnInit {
/** Undo Approval Savings Account form. */
undoApprovalSavingsAccountForm: UntypedFormGroup;
/** Savings Account Id */
@@ -27,10 +26,12 @@ export class UndoApprovalSavingsAccountComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private route: ActivatedRoute,
private router: Router
) {
this.accountId = this.route.snapshot.params['savingAccountId'];
}
@@ -46,7 +47,7 @@ export class UndoApprovalSavingsAccountComponent implements OnInit {
*/
createUndoApprovalSavingsAccountForm() {
this.undoApprovalSavingsAccountForm = this.formBuilder.group({
'note': ['']
note: ['']
});
}
@@ -56,11 +57,10 @@ export class UndoApprovalSavingsAccountComponent implements OnInit {
*/
submit() {
const data = {
...this.undoApprovalSavingsAccountForm.value,
...this.undoApprovalSavingsAccountForm.value
};
this.savingsService.executeSavingsAccountCommand(this.accountId, 'undoapproval', data).subscribe(() => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('WithdrawByClientSavingsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WithdrawByClientSavingsAccountComponent ]
})
.compileComponents();
declarations: [WithdrawByClientSavingsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./withdraw-by-client-savings-account.component.scss']
})
export class WithdrawByClientSavingsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class WithdrawByClientSavingsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService
) {
this.accountId = this.route.snapshot.params['savingAccountId'];
}
@@ -57,8 +58,11 @@ export class WithdrawByClientSavingsAccountComponent implements OnInit {
*/
createWithdrawSavingsAccountForm() {
this.withdrawSavingsAccountForm = this.formBuilder.group({
'withdrawnOnDate': ['', Validators.required],
'note': ['']
withdrawnOnDate: [
'',
Validators.required
],
note: ['']
});
}
@@ -83,5 +87,4 @@ export class WithdrawByClientSavingsAccountComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('SavingsAccountChargesStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountChargesStepComponent ]
})
.compileComponents();
declarations: [SavingsAccountChargesStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -23,7 +23,6 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./savings-account-charges-step.component.scss']
})
export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
/** Savings Account Product Template */
@Input() savingsAccountProductTemplate: any;
/** Savings Account Template */
@@ -42,7 +41,15 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
/** For Edit Savings Account Form */
isChargesPatched = false;
/** Display columns for charges table */
displayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date', 'repaymentsEvery', 'action'];
displayedColumns: string[] = [
'name',
'chargeCalculationType',
'amount',
'chargeTimeType',
'date',
'repaymentsEvery',
'action'
];
/** Table Data Source */
dataSource: any;
/** Check for select all the Clients List */
@@ -50,34 +57,41 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
/** Loan Purpose Options */
loanPurposeOptions: string[] = [];
/** Table Displayed Columns */
displayedColumn: string[] = ['check', 'id', 'name'];
displayedColumn: string[] = [
'check',
'id',
'name'
];
/**
* @param {MatDialog} dialog Mat Dialog
*/
constructor(private dialog: MatDialog,
private dateUtils: Dates,
private translateService: TranslateService) {}
constructor(
private dialog: MatDialog,
private dateUtils: Dates,
private translateService: TranslateService
) {}
ngOnInit() {
ngOnInit() {
if (this.savingsAccountTemplate) {
if (!this.isChargesPatched && this.savingsAccountTemplate.charges) {
this.chargesDataSource = this.savingsAccountProductTemplate.charges.map((charge: any) => ({...charge, id: charge.chargeId})) || [];
this.chargesDataSource =
this.savingsAccountProductTemplate.charges.map((charge: any) => ({ ...charge, id: charge.chargeId })) || [];
this.isChargesPatched = true;
} else {
this.chargesDataSource = [];
}
this.dataSource = new MatTableDataSource<any>(this.activeClientMembers);
}
}
}
ngOnChanges() {
ngOnChanges() {
if (this.savingsAccountProductTemplate) {
this.chargeData = this.savingsAccountProductTemplate.chargeOptions;
this.chargesDataSource = this.savingsAccountProductTemplate.charges.map((charge: any) => ({...charge, id: charge.chargeId})) || [];
this.chargesDataSource =
this.savingsAccountProductTemplate.charges.map((charge: any) => ({ ...charge, id: charge.chargeId })) || [];
}
}
}
/**
* Adds the charge to charges table
@@ -101,7 +115,8 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
value: charge.amount,
type: 'number',
required: false
}),
})
];
const data = {
title: this.translateService.instant('labels.heading.Edit Charge Amount'),
@@ -131,7 +146,8 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
value: charge.dueDate || charge.feeOnMonthDay || '',
type: 'datetime-local',
required: false
}),
})
];
const data = {
title: this.translateService.instant('labels.heading.Edit Charge Date'),
@@ -148,12 +164,12 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
case 'Specified due date':
case 'Weekly Fee':
newCharge = { ...charge, dueDate: date };
break;
break;
case 'Annual Fee':
case 'Monthly Fee':
const dateMonthDay = this.dateUtils.formatDate(response.data.value.date, 'dd MMMM');
newCharge = { ...charge, feeOnMonthDay: dateMonthDay };
break;
break;
}
console.log(newCharge);
this.chargesDataSource.splice(this.chargesDataSource.indexOf(charge), 1, newCharge);
@@ -175,7 +191,8 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
value: charge.feeInterval,
type: 'text',
required: false
}),
})
];
const data = {
title: 'Edit Charge Fee Interval',
@@ -211,7 +228,7 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
}
get selectedClientMembers() {
return { selectedMembers: this.activeClientMembers.filter( (item: any) => item.selected ) };
return { selectedMembers: this.activeClientMembers.filter((item: any) => item.selected) };
}
/** Toggle all checks */
@@ -224,7 +241,7 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
/** Check if all the checks are selected */
toggleSelect() {
const len = this.activeClientMembers.length;
this.selectAllItems = len === 0 ? false : this.activeClientMembers.filter( (item: any) => item.selected ).length === len;
this.selectAllItems =
len === 0 ? false : this.activeClientMembers.filter((item: any) => item.selected).length === len;
}
}
@@ -8,9 +8,8 @@ describe('SavingsAccountDetailsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountDetailsStepComponent ]
})
.compileComponents();
declarations: [SavingsAccountDetailsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./savings-account-details-step.component.scss']
})
export class SavingsAccountDetailsStepComponent implements OnInit {
/** Savings Account Template */
@Input() savingsAccountTemplate: any;
@@ -43,9 +42,11 @@ export class SavingsAccountDetailsStepComponent implements OnInit {
* @param {SavingsService} savingsService Savings Service.
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private settingsService: SettingsService
) {
this.createSavingsAccountDetailsForm();
}
@@ -56,13 +57,15 @@ export class SavingsAccountDetailsStepComponent implements OnInit {
this.productData = this.savingsAccountTemplate.productOptions;
if (this.savingsAccountTemplate.savingsProductId) {
this.savingsAccountDetailsForm.patchValue({
'productId': this.savingsAccountTemplate.savingsProductId,
'submittedOnDate': this.savingsAccountTemplate.timeline.submittedOnDate && new Date(this.savingsAccountTemplate.timeline.submittedOnDate),
'externalId': this.savingsAccountTemplate.externalId
productId: this.savingsAccountTemplate.savingsProductId,
submittedOnDate:
this.savingsAccountTemplate.timeline.submittedOnDate &&
new Date(this.savingsAccountTemplate.timeline.submittedOnDate),
externalId: this.savingsAccountTemplate.externalId
});
} else {
this.savingsAccountDetailsForm.patchValue({
'submittedOnDate': new Date()
submittedOnDate: new Date()
});
}
}
@@ -73,10 +76,16 @@ export class SavingsAccountDetailsStepComponent implements OnInit {
*/
createSavingsAccountDetailsForm() {
this.savingsAccountDetailsForm = this.formBuilder.group({
'productId': ['', Validators.required],
'submittedOnDate': ['', Validators.required],
'fieldOfficerId': [''],
'externalId': ['']
productId: [
'',
Validators.required
],
submittedOnDate: [
'',
Validators.required
],
fieldOfficerId: [''],
externalId: ['']
});
}
@@ -86,18 +95,19 @@ export class SavingsAccountDetailsStepComponent implements OnInit {
buildDependencies() {
const entityId = this.savingsAccountTemplate.clientId || this.savingsAccountTemplate.groupId;
this.savingsAccountDetailsForm.get('productId').valueChanges.subscribe((productId: string) => {
this.savingsService.getSavingsAccountTemplate(entityId, productId, this.savingsAccountTemplate.groupId ? true : false)
.subscribe((response: any) => {
this.savingsAccountProductTemplate.emit(response);
this.fieldOfficerData = response.fieldOfficerOptions;
this.savingsProductSelected = true;
if (!this.isFieldOfficerPatched && this.savingsAccountTemplate.fieldOfficerId) {
this.savingsAccountDetailsForm.get('fieldOfficerId').patchValue(this.savingsAccountTemplate.fieldOfficerId);
this.isFieldOfficerPatched = true;
} else {
this.savingsAccountDetailsForm.get('fieldOfficerId').patchValue('');
}
});
this.savingsService
.getSavingsAccountTemplate(entityId, productId, this.savingsAccountTemplate.groupId ? true : false)
.subscribe((response: any) => {
this.savingsAccountProductTemplate.emit(response);
this.fieldOfficerData = response.fieldOfficerOptions;
this.savingsProductSelected = true;
if (!this.isFieldOfficerPatched && this.savingsAccountTemplate.fieldOfficerId) {
this.savingsAccountDetailsForm.get('fieldOfficerId').patchValue(this.savingsAccountTemplate.fieldOfficerId);
this.isFieldOfficerPatched = true;
} else {
this.savingsAccountDetailsForm.get('fieldOfficerId').patchValue('');
}
});
});
}
@@ -107,5 +117,4 @@ export class SavingsAccountDetailsStepComponent implements OnInit {
get savingsAccountDetails() {
return this.savingsAccountDetailsForm.getRawValue();
}
}
@@ -8,9 +8,8 @@ describe('SavingsAccountPreviewStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountPreviewStepComponent ]
})
.compileComponents();
declarations: [SavingsAccountPreviewStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,7 +11,6 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./savings-account-preview-step.component.scss']
})
export class SavingsAccountPreviewStepComponent {
/** Savings Account Product Template */
@Input() savingsAccountProductTemplate: any;
/** Savings Account Template */
@@ -22,12 +21,19 @@ export class SavingsAccountPreviewStepComponent {
@Input() savingsAccount: any;
/** Display columns for charges table */
chargesDisplayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date', 'repaymentsEvery'];
chargesDisplayedColumns: string[] = [
'name',
'chargeCalculationType',
'amount',
'chargeTimeType',
'date',
'repaymentsEvery'
];
/** Form submission event */
@Output() submitEvent = new EventEmitter();
constructor(private translateService: TranslateService) { }
constructor(private translateService: TranslateService) {}
getCatalogTranslation(text: string): string {
return this.translateService.instant('labels.catalogs.' + text);
@@ -8,9 +8,8 @@ describe('SavingsAccountTermsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountTermsStepComponent ]
})
.compileComponents();
declarations: [SavingsAccountTermsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -12,7 +12,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./savings-account-terms-step.component.scss']
})
export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
/** Savings Account and Product Template */
@Input() savingsAccountProductTemplate: any;
/** Savings Account Template */
@@ -39,8 +38,10 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
* @param {FormBuilder} formBuilder Form Builder
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService
) {
this.createSavingsAccountTermsForm();
this.buildDependencies();
}
@@ -48,22 +49,22 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
ngOnChanges() {
if (this.savingsAccountProductTemplate) {
this.savingsAccountTermsForm.patchValue({
'currencyCode': this.savingsAccountProductTemplate.currency.code,
'decimal': this.savingsAccountProductTemplate.currency.decimalPlaces,
'minBalanceForInterestCalculation': this.savingsAccountProductTemplate.minBalanceForInterestCalculation,
'nominalAnnualInterestRate': this.savingsAccountProductTemplate.nominalAnnualInterestRate,
'interestCompoundingPeriodType': this.savingsAccountProductTemplate.interestCompoundingPeriodType.id,
'interestPostingPeriodType': this.savingsAccountProductTemplate.interestPostingPeriodType.id,
'interestCalculationType': this.savingsAccountProductTemplate.interestCalculationType.id,
'interestCalculationDaysInYearType': this.savingsAccountProductTemplate.interestCalculationDaysInYearType.id,
'minRequiredOpeningBalance': this.savingsAccountProductTemplate.minRequiredOpeningBalance,
'allowOverdraft': this.savingsAccountProductTemplate.allowOverdraft,
'overdraftLimit': this.savingsAccountProductTemplate.overdraftLimit,
'enforceMinRequiredBalance': this.savingsAccountProductTemplate.enforceMinRequiredBalance,
'minOverdraftForInterestCalculation': this.savingsAccountProductTemplate.minOverdraftForInterestCalculation,
'nominalAnnualInterestRateOverdraft': this.savingsAccountProductTemplate.nominalAnnualInterestRateOverdraft,
'minRequiredBalance': this.savingsAccountProductTemplate.minRequiredBalance,
'withdrawalFeeForTransfers': this.savingsAccountProductTemplate.withdrawalFeeForTransfers
currencyCode: this.savingsAccountProductTemplate.currency.code,
decimal: this.savingsAccountProductTemplate.currency.decimalPlaces,
minBalanceForInterestCalculation: this.savingsAccountProductTemplate.minBalanceForInterestCalculation,
nominalAnnualInterestRate: this.savingsAccountProductTemplate.nominalAnnualInterestRate,
interestCompoundingPeriodType: this.savingsAccountProductTemplate.interestCompoundingPeriodType.id,
interestPostingPeriodType: this.savingsAccountProductTemplate.interestPostingPeriodType.id,
interestCalculationType: this.savingsAccountProductTemplate.interestCalculationType.id,
interestCalculationDaysInYearType: this.savingsAccountProductTemplate.interestCalculationDaysInYearType.id,
minRequiredOpeningBalance: this.savingsAccountProductTemplate.minRequiredOpeningBalance,
allowOverdraft: this.savingsAccountProductTemplate.allowOverdraft,
overdraftLimit: this.savingsAccountProductTemplate.overdraftLimit,
enforceMinRequiredBalance: this.savingsAccountProductTemplate.enforceMinRequiredBalance,
minOverdraftForInterestCalculation: this.savingsAccountProductTemplate.minOverdraftForInterestCalculation,
nominalAnnualInterestRateOverdraft: this.savingsAccountProductTemplate.nominalAnnualInterestRateOverdraft,
minRequiredBalance: this.savingsAccountProductTemplate.minRequiredBalance,
withdrawalFeeForTransfers: this.savingsAccountProductTemplate.withdrawalFeeForTransfers
});
this.setOptions();
}
@@ -73,18 +74,20 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
this.maxDate = this.settingsService.businessDate;
if (this.savingsAccountTemplate) {
this.savingsAccountTermsForm.patchValue({
'nominalAnnualInterestRate': this.savingsAccountTemplate.nominalAnnualInterestRate,
'interestCompoundingPeriodType': this.savingsAccountTemplate.interestCompoundingPeriodType.id,
'interestPostingPeriodType': this.savingsAccountTemplate.interestPostingPeriodType.id,
'interestCalculationType': this.savingsAccountTemplate.interestCalculationType.id,
'interestCalculationDaysInYearType': this.savingsAccountTemplate.interestCalculationDaysInYearType.id,
'minRequiredOpeningBalance': this.savingsAccountTemplate.minRequiredOpeningBalance,
'withdrawalFeeForTransfers': this.savingsAccountTemplate.withdrawalFeeForTransfers,
'lockinPeriodFrequency': this.savingsAccountTemplate.lockinPeriodFrequency,
'lockinPeriodFrequencyType': this.savingsAccountTemplate.lockinPeriodFrequencyType && this.savingsAccountTemplate.lockinPeriodFrequencyType.id,
'allowOverdraft': this.savingsAccountTemplate.allowOverdraft,
'enforceMinRequiredBalance': this.savingsAccountTemplate.enforceMinRequiredBalance,
'minRequiredBalance': this.savingsAccountTemplate.minRequiredBalance,
nominalAnnualInterestRate: this.savingsAccountTemplate.nominalAnnualInterestRate,
interestCompoundingPeriodType: this.savingsAccountTemplate.interestCompoundingPeriodType.id,
interestPostingPeriodType: this.savingsAccountTemplate.interestPostingPeriodType.id,
interestCalculationType: this.savingsAccountTemplate.interestCalculationType.id,
interestCalculationDaysInYearType: this.savingsAccountTemplate.interestCalculationDaysInYearType.id,
minRequiredOpeningBalance: this.savingsAccountTemplate.minRequiredOpeningBalance,
withdrawalFeeForTransfers: this.savingsAccountTemplate.withdrawalFeeForTransfers,
lockinPeriodFrequency: this.savingsAccountTemplate.lockinPeriodFrequency,
lockinPeriodFrequencyType:
this.savingsAccountTemplate.lockinPeriodFrequencyType &&
this.savingsAccountTemplate.lockinPeriodFrequencyType.id,
allowOverdraft: this.savingsAccountTemplate.allowOverdraft,
enforceMinRequiredBalance: this.savingsAccountTemplate.enforceMinRequiredBalance,
minRequiredBalance: this.savingsAccountTemplate.minRequiredBalance
});
}
}
@@ -94,21 +97,36 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
*/
createSavingsAccountTermsForm() {
this.savingsAccountTermsForm = this.formBuilder.group({
'currencyCode': [{value: '', disabled: true}],
'decimal': [{value: '', disabled: true}],
'nominalAnnualInterestRate': ['', Validators.required],
'interestCompoundingPeriodType': ['', Validators.required],
'interestPostingPeriodType': ['', Validators.required],
'interestCalculationType': ['', Validators.required],
'interestCalculationDaysInYearType': ['', Validators.required],
'minRequiredOpeningBalance': [''],
'withdrawalFeeForTransfers': [false],
'lockinPeriodFrequency': [''],
'lockinPeriodFrequencyType': [''],
'allowOverdraft': [false],
'enforceMinRequiredBalance': [false],
'minRequiredBalance': [''],
'minBalanceForInterestCalculation': [{value: '', disabled: true}]
currencyCode: [{ value: '', disabled: true }],
decimal: [{ value: '', disabled: true }],
nominalAnnualInterestRate: [
'',
Validators.required
],
interestCompoundingPeriodType: [
'',
Validators.required
],
interestPostingPeriodType: [
'',
Validators.required
],
interestCalculationType: [
'',
Validators.required
],
interestCalculationDaysInYearType: [
'',
Validators.required
],
minRequiredOpeningBalance: [''],
withdrawalFeeForTransfers: [false],
lockinPeriodFrequency: [''],
lockinPeriodFrequencyType: [''],
allowOverdraft: [false],
enforceMinRequiredBalance: [false],
minRequiredBalance: [''],
minBalanceForInterestCalculation: [{ value: '', disabled: true }]
});
}
@@ -120,7 +138,8 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
this.interestCompoundingPeriodTypeData = this.savingsAccountProductTemplate.interestCompoundingPeriodTypeOptions;
this.interestPostingPeriodTypeData = this.savingsAccountProductTemplate.interestPostingPeriodTypeOptions;
this.interestCalculationTypeData = this.savingsAccountProductTemplate.interestCalculationTypeOptions;
this.interestCalculationDaysInYearTypeData = this.savingsAccountProductTemplate.interestCalculationDaysInYearTypeOptions;
this.interestCalculationDaysInYearTypeData =
this.savingsAccountProductTemplate.interestCalculationDaysInYearTypeOptions;
}
/**
@@ -150,5 +169,4 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
delete payload.minBalanceForInterestCalculation; // Backend is not accepting minBalanceForInterestCalculation value
return payload;
}
}
@@ -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;

Some files were not shown because too many files have changed in this diff Show More