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
@@ -14,13 +14,14 @@ import { RecurringDepositsService } from '../recurring-deposits.service';
*/
@Injectable()
export class RecurringDepositsAccountActionsResolver implements Resolve<Object> {
/**
* @param {SavingsService} SavingsService Savings service.
* @param {RecurringDepositsService} recurringDepositsService Recurring Deposits Service.
*/
constructor(private savingsService: SavingsService,
private recurringDepositsService: RecurringDepositsService) { }
constructor(
private savingsService: SavingsService,
private recurringDepositsService: RecurringDepositsService
) {}
/**
* Returns the Recurring deposits account actions data.
@@ -29,18 +30,24 @@ export class RecurringDepositsAccountActionsResolver implements Resolve<Object>
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const actionName: string = route.paramMap.get('name');
const recurringDepositAccountId = route.paramMap.get('recurringDepositAccountId') || route.parent.parent.paramMap.get('recurringDepositAccountId');
const recurringDepositAccountId =
route.paramMap.get('recurringDepositAccountId') || route.parent.parent.paramMap.get('recurringDepositAccountId');
switch (actionName) {
case 'Add Charge':
return this.savingsService.getSavingsChargeTemplateResource(recurringDepositAccountId);
case 'Close':
return this.recurringDepositsService.getRecurringDepositAccountActionResource(recurringDepositAccountId, 'close');
return this.recurringDepositsService.getRecurringDepositAccountActionResource(
recurringDepositAccountId,
'close'
);
case 'Deposit':
case 'Withdrawal':
return this.recurringDepositsService.getRecurringDepositAccountTransactionTemplateResource(recurringDepositAccountId, actionName.toLocaleLowerCase());
return this.recurringDepositsService.getRecurringDepositAccountTransactionTemplateResource(
recurringDepositAccountId,
actionName.toLocaleLowerCase()
);
default:
return undefined;
}
}
}
@@ -13,20 +13,18 @@ import { RecurringDepositsService } from '../recurring-deposits.service';
*/
@Injectable()
export class RecurringDepositsAccountAndTemplateResolver implements Resolve<Object> {
/**
* @param {RecurringDepositsService} recurringDepositsService Recurring Deposits service.
*/
constructor(private recurringDepositsService: RecurringDepositsService) {}
/**
* @param {RecurringDepositsService} recurringDepositsService Recurring Deposits service.
*/
constructor(private recurringDepositsService: RecurringDepositsService) { }
/**
* Returns the Recurring Deposits Account Template.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const recurringDepositAccountId = route.paramMap.get('recurringDepositAccountId');
return this.recurringDepositsService.getRecurringDepositsAccountAndTemplate(recurringDepositAccountId);
}
/**
* Returns the Recurring Deposits Account Template.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const recurringDepositAccountId = route.paramMap.get('recurringDepositAccountId');
return this.recurringDepositsService.getRecurringDepositsAccountAndTemplate(recurringDepositAccountId);
}
}
@@ -13,21 +13,22 @@ import { RecurringDepositsService } from '../recurring-deposits.service';
*/
@Injectable()
export class RecurringDepositsAccountTransactionTemplateResolver implements Resolve<Object> {
/**
* @param {RecurringDepositsService} recurringDepositsService Recurring Deposits service.
*/
constructor(private recurringDepositsService: RecurringDepositsService) {}
/**
* @param {RecurringDepositsService} recurringDepositsService Recurring Deposits service.
*/
constructor(private recurringDepositsService: RecurringDepositsService) { }
/**
* Returns the Recurring Deposits Account Transaction data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const recurringDepositAccountId = route.parent.paramMap.get('recurringDepositAccountId');
const transactionId = route.paramMap.get('id');
return this.recurringDepositsService.getRecurringDepositsAccountTransactionTemplate(recurringDepositAccountId, transactionId);
}
/**
* Returns the Recurring Deposits Account Transaction data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const recurringDepositAccountId = route.parent.paramMap.get('recurringDepositAccountId');
const transactionId = route.paramMap.get('id');
return this.recurringDepositsService.getRecurringDepositsAccountTransactionTemplate(
recurringDepositAccountId,
transactionId
);
}
}
@@ -13,21 +13,22 @@ import { RecurringDepositsService } from '../recurring-deposits.service';
*/
@Injectable()
export class RecurringDepositsAccountTransactionResolver implements Resolve<Object> {
/**
* @param {RecurringDepositsService} recurringDepositsService Recurring Deposits service.
*/
constructor(private recurringDepositsService: RecurringDepositsService) {}
/**
* @param {RecurringDepositsService} recurringDepositsService Recurring Deposits service.
*/
constructor(private recurringDepositsService: RecurringDepositsService) { }
/**
* Returns the Recurring Deposits Account Transaction data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const recurringDepositAccountId = route.parent.paramMap.get('recurringDepositAccountId');
const transactionId = route.paramMap.get('id');
return this.recurringDepositsService.getRecurringDepositsAccountTransaction(recurringDepositAccountId, transactionId);
}
/**
* Returns the Recurring Deposits Account Transaction data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const recurringDepositAccountId = route.parent.paramMap.get('recurringDepositAccountId');
const transactionId = route.paramMap.get('id');
return this.recurringDepositsService.getRecurringDepositsAccountTransaction(
recurringDepositAccountId,
transactionId
);
}
}
@@ -13,11 +13,10 @@ import { RecurringDepositsService } from '../recurring-deposits.service';
*/
@Injectable()
export class RecurringDepositsAccountDataResolver implements Resolve<Object> {
/**
* @param {RecurringDepositsService} RecurringDepositsService RecurringDeposits service.
*/
constructor(private recurringDepositsService: RecurringDepositsService) { }
constructor(private recurringDepositsService: RecurringDepositsService) {}
/**
* Returns the RecurringDeposits Account data.
@@ -28,5 +27,4 @@ export class RecurringDepositsAccountDataResolver implements Resolve<Object> {
const recurringDepositAccountId = route.parent.paramMap.get('recurringDepositAccountId');
return this.recurringDepositsService.getRecurringDepositsAccountData(recurringDepositAccountId);
}
}
@@ -13,11 +13,10 @@ import { RecurringDepositsService } from '../recurring-deposits.service';
*/
@Injectable()
export class RecurringDepositsAccountTemplateResolver implements Resolve<Object> {
/**
* @param {recurringDepositsService} RecurringDepositsService Savings service.
*/
constructor(private recurringDepositsService: RecurringDepositsService) { }
constructor(private recurringDepositsService: RecurringDepositsService) {}
/**
* Returns the Shares Account Template.
@@ -28,5 +27,4 @@ export class RecurringDepositsAccountTemplateResolver implements Resolve<Object>
const clientId = route.parent.parent.paramMap.get('clientId');
return this.recurringDepositsService.getRecurringDepositsAccountTemplate(clientId);
}
}
@@ -13,11 +13,10 @@ import { RecurringDepositsService } from '../recurring-deposits.service';
*/
@Injectable()
export class RecurringDepositsAccountViewResolver implements Resolve<Object> {
/**
* @param {RecurringDepositsService} RecurringDepositsService RecurringDeposits service.
*/
constructor(private recurringDepositsService: RecurringDepositsService) { }
constructor(private recurringDepositsService: RecurringDepositsService) {}
/**
* Returns the RecurringDeposits Account data.
@@ -28,5 +27,4 @@ export class RecurringDepositsAccountViewResolver implements Resolve<Object> {
const recurringDepositAccountId = route.paramMap.get('recurringDepositAccountId');
return this.recurringDepositsService.getRecurringDepositsAccountData(recurringDepositAccountId);
}
}
@@ -8,9 +8,8 @@ describe('CreateRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [CreateRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -22,23 +22,27 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./create-recurring-deposits-account.component.scss']
})
export class CreateRecurringDepositsAccountComponent {
/** Imports all the step component */
@ViewChild(RecurringDepositsAccountDetailsStepComponent, { static: true }) recurringDepositsAccountDetailsStep: RecurringDepositsAccountDetailsStepComponent;
@ViewChild(RecurringDepositsAccountTermsStepComponent, { static: true }) recurringDepositAccountTermsStep: RecurringDepositsAccountTermsStepComponent;
@ViewChild(RecurringDepositsAccountSettingsStepComponent, { static: true }) recurringDepositAccountSettingsStep: RecurringDepositsAccountSettingsStepComponent;
@ViewChild(RecurringDepositsAccountChargesStepComponent, { static: true }) recurringDepositAccountChargesStep: RecurringDepositsAccountChargesStepComponent;
@ViewChild(RecurringDepositsAccountDetailsStepComponent, { static: true })
recurringDepositsAccountDetailsStep: RecurringDepositsAccountDetailsStepComponent;
@ViewChild(RecurringDepositsAccountTermsStepComponent, { static: true })
recurringDepositAccountTermsStep: RecurringDepositsAccountTermsStepComponent;
@ViewChild(RecurringDepositsAccountSettingsStepComponent, { static: true })
recurringDepositAccountSettingsStep: RecurringDepositsAccountSettingsStepComponent;
@ViewChild(RecurringDepositsAccountChargesStepComponent, { static: true })
recurringDepositAccountChargesStep: RecurringDepositsAccountChargesStepComponent;
/** Recurring Deposits Account Template */
recurringDepositsAccountTemplate: any;
/** Recurring Deposit Account Product Template */
recurringDepositsAccountProductTemplate: any;
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private recurringDepositsService: RecurringDepositsService,
private settingsService: SettingsService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { recurringDepositsAccountTemplate: any }) => {
this.recurringDepositsAccountTemplate = data.recurringDepositsAccountTemplate;
@@ -83,18 +87,17 @@ export class CreateRecurringDepositsAccountComponent {
...this.recurringDepositsAccountDetailsStep.recurringDepositAccountDetails,
...this.recurringDepositAccountTermsStep.recurringDepositAccountTerms,
...this.recurringDepositAccountSettingsStep.recurringDepositAccountSettings,
...this.recurringDepositAccountChargesStep.recurringDepositAccountCharges,
...this.recurringDepositAccountChargesStep.recurringDepositAccountCharges
};
}
/** Retrieves Data of all forms except Currency to submit the data */
get recurringDepositAccount() {
return {
...this.recurringDepositsAccountDetailsStep.recurringDepositAccountDetails,
...this.recurringDepositAccountTermsStep.recurringDepositAccountTerms,
...this.recurringDepositAccountSettingsStep.recurringDepositAccountSettings,
...this.recurringDepositAccountChargesStep.recurringDepositAccountCharges,
...this.recurringDepositAccountChargesStep.recurringDepositAccountCharges
};
}
@@ -115,16 +118,27 @@ export class CreateRecurringDepositsAccountComponent {
feeOnMonthDay: charge.feeOnMonthDay,
feeInterval: charge.feeInterval
})),
isCalendarInherited: this.recurringDepositAccount.recurringDepositAccount ? this.recurringDepositAccount.recurringDepositAccount : false,
isCalendarInherited: this.recurringDepositAccount.recurringDepositAccount
? this.recurringDepositAccount.recurringDepositAccount
: false,
submittedOnDate: this.dateUtils.formatDate(this.recurringDepositAccount.submittedOnDate, dateFormat),
expectedFirstDepositOnDate: this.dateUtils.formatDate(this.recurringDepositAccount.expectedFirstDepositOnDate, dateFormat),
expectedFirstDepositOnDate: this.dateUtils.formatDate(
this.recurringDepositAccount.expectedFirstDepositOnDate,
dateFormat
),
dateFormat,
monthDayFormat,
locale
};
this.recurringDepositsService.createRecurringDepositAccount(recurringDepositAccount).subscribe((response: any) => {
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
this.router.navigate(
[
'../',
response.resourceId
],
{ relativeTo: this.route }
);
});
}
}
@@ -8,9 +8,8 @@ describe('EditRecurringDepositAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditRecurringDepositAccountComponent ]
})
.compileComponents();
declarations: [EditRecurringDepositAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -22,23 +22,27 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./edit-recurring-deposit-account.component.scss']
})
export class EditRecurringDepositAccountComponent {
/** Imports all the step component */
@ViewChild(RecurringDepositsAccountDetailsStepComponent, { static: true }) recurringDepositsAccountDetailsStep: RecurringDepositsAccountDetailsStepComponent;
@ViewChild(RecurringDepositsAccountTermsStepComponent, { static: true }) recurringDepositAccountTermsStep: RecurringDepositsAccountTermsStepComponent;
@ViewChild(RecurringDepositsAccountSettingsStepComponent, { static: true }) recurringDepositAccountSettingsStep: RecurringDepositsAccountSettingsStepComponent;
@ViewChild(RecurringDepositsAccountChargesStepComponent, { static: true }) recurringDepositAccountChargesStep: RecurringDepositsAccountChargesStepComponent;
@ViewChild(RecurringDepositsAccountDetailsStepComponent, { static: true })
recurringDepositsAccountDetailsStep: RecurringDepositsAccountDetailsStepComponent;
@ViewChild(RecurringDepositsAccountTermsStepComponent, { static: true })
recurringDepositAccountTermsStep: RecurringDepositsAccountTermsStepComponent;
@ViewChild(RecurringDepositsAccountSettingsStepComponent, { static: true })
recurringDepositAccountSettingsStep: RecurringDepositsAccountSettingsStepComponent;
@ViewChild(RecurringDepositsAccountChargesStepComponent, { static: true })
recurringDepositAccountChargesStep: RecurringDepositsAccountChargesStepComponent;
/** Recurring Deposits Account And Template */
recurringDepositsAccountAndTemplate: any;
/** Recurring Deposit Account Product Template */
recurringDepositsAccountProductTemplate: any;
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private recurringDepositsService: RecurringDepositsService,
private settingsService: SettingsService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { recurringDepositsAccountAndTemplate: any }) => {
this.recurringDepositsAccountAndTemplate = data.recurringDepositsAccountAndTemplate;
@@ -74,12 +78,10 @@ export class EditRecurringDepositAccountComponent {
this.recurringDepositAccountDetailsForm.valid &&
this.recurringDepositAccountTermsForm.valid &&
this.recurringDepositAccountSettingsForm.valid &&
(
!this.recurringDepositAccountDetailsForm.pristine ||
(!this.recurringDepositAccountDetailsForm.pristine ||
!this.recurringDepositAccountTermsForm.pristine ||
!this.recurringDepositAccountSettingsForm.pristine ||
!this.recurringDepositAccountChargesStep.pristine
)
!this.recurringDepositAccountChargesStep.pristine)
);
}
@@ -89,18 +91,17 @@ export class EditRecurringDepositAccountComponent {
...this.recurringDepositsAccountDetailsStep.recurringDepositAccountDetails,
...this.recurringDepositAccountTermsStep.recurringDepositAccountTerms,
...this.recurringDepositAccountSettingsStep.recurringDepositAccountSettings,
...this.recurringDepositAccountChargesStep.recurringDepositAccountCharges,
...this.recurringDepositAccountChargesStep.recurringDepositAccountCharges
};
}
/** Retrieves Data of all forms except Currency to submit the data */
get recurringDepositAccount() {
return {
...this.recurringDepositsAccountDetailsStep.recurringDepositAccountDetails,
...this.recurringDepositAccountTermsStep.recurringDepositAccountTerms,
...this.recurringDepositAccountSettingsStep.recurringDepositAccountSettings,
...this.recurringDepositAccountChargesStep.recurringDepositAccountCharges,
...this.recurringDepositAccountChargesStep.recurringDepositAccountCharges
};
}
@@ -121,17 +122,23 @@ export class EditRecurringDepositAccountComponent {
feeOnMonthDay: charge.feeOnMonthDay,
feeInterval: charge.feeInterval
})),
isCalendarInherited: this.recurringDepositAccount.recurringDepositAccount ? this.recurringDepositAccount.recurringDepositAccount : false,
isCalendarInherited: this.recurringDepositAccount.recurringDepositAccount
? this.recurringDepositAccount.recurringDepositAccount
: false,
submittedOnDate: this.dateUtils.formatDate(this.recurringDepositAccount.submittedOnDate, dateFormat),
expectedFirstDepositOnDate: this.dateUtils.formatDate(this.recurringDepositAccount.expectedFirstDepositOnDate, dateFormat),
expectedFirstDepositOnDate: this.dateUtils.formatDate(
this.recurringDepositAccount.expectedFirstDepositOnDate,
dateFormat
),
dateFormat,
monthDayFormat,
locale
};
this.recurringDepositsService.updateRecurringDepositAccount(this.recurringDepositsAccountAndTemplate.id, recurringDepositAccount).subscribe((response: any) => {
this.router.navigate(['../'], { relativeTo: this.route });
});
this.recurringDepositsService
.updateRecurringDepositAccount(this.recurringDepositsAccountAndTemplate.id, recurringDepositAccount)
.subscribe((response: any) => {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ActivateRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ActivateRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [ActivateRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./activate-recurring-deposits-account.component.scss']
})
export class ActivateRecurringDepositsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class ActivateRecurringDepositsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SavingsService} savingsService Savings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -57,7 +58,10 @@ export class ActivateRecurringDepositsAccountComponent implements OnInit {
*/
createActivateRecurringDepositsAccountForm() {
this.activateRecurringDepositsAccountForm = this.formBuilder.group({
'activatedOnDate': ['', Validators.required]
activatedOnDate: [
'',
Validators.required
]
});
}
@@ -71,15 +75,20 @@ export class ActivateRecurringDepositsAccountComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const prevActivatedOnDate: Date = this.activateRecurringDepositsAccountForm.value.activatedOnDate;
if (activateRecurringDepositsAccountFormData.activatedOnDate instanceof Date) {
activateRecurringDepositsAccountFormData.activatedOnDate = this.dateUtils.formatDate(prevActivatedOnDate, dateFormat);
activateRecurringDepositsAccountFormData.activatedOnDate = this.dateUtils.formatDate(
prevActivatedOnDate,
dateFormat
);
}
const data = {
...activateRecurringDepositsAccountFormData,
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'activate', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'activate', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('AddChargeRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddChargeRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [AddChargeRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./add-charge-recurring-deposits-account.component.scss']
})
export class AddChargeRecurringDepositsAccountComponent implements OnInit {
/** Minimum Due Date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum Due Date allowed. */
@@ -64,7 +63,7 @@ export class AddChargeRecurringDepositsAccountComponent implements OnInit {
}
buildDependencies() {
this.recurringDepositsChargeForm.controls.chargeId.valueChanges.subscribe(chargeId => {
this.recurringDepositsChargeForm.controls.chargeId.valueChanges.subscribe((chargeId) => {
this.savingsService.getChargeTemplate(chargeId).subscribe((data: any) => {
this.chargeDetails = data;
const chargeTimeType = data.chargeTimeType.id;
@@ -85,14 +84,17 @@ export class AddChargeRecurringDepositsAccountComponent implements OnInit {
this.recurringDepositsChargeForm.removeControl('feeOnMonthDay');
}
if (chargeTimeType.value === 'Monthly Fee') {
this.recurringDepositsChargeForm.addControl('feeInterval', new UntypedFormControl(data.feeInterval, Validators.required));
this.recurringDepositsChargeForm.addControl(
'feeInterval',
new UntypedFormControl(data.feeInterval, Validators.required)
);
} else {
this.recurringDepositsChargeForm.removeControl('feeInterval');
}
this.recurringDepositsChargeForm.patchValue({
'amount': data.amount,
'chargeCalculationType': data.chargeCalculationType.id,
'chargeTimeType': data.chargeTimeType.id
amount: data.amount,
chargeCalculationType: data.chargeCalculationType.id,
chargeTimeType: data.chargeTimeType.id
});
});
});
@@ -103,10 +105,16 @@ export class AddChargeRecurringDepositsAccountComponent implements OnInit {
*/
createRecurringDepositsChargeForm() {
this.recurringDepositsChargeForm = 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 }]
});
}
@@ -140,5 +148,4 @@ export class AddChargeRecurringDepositsAccountComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ApproveRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ApproveRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [ApproveRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./approve-recurring-deposits-account.component.scss']
})
export class ApproveRecurringDepositsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -35,12 +34,14 @@ export class ApproveRecurringDepositsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -57,8 +58,11 @@ export class ApproveRecurringDepositsAccountComponent implements OnInit {
*/
createApproveRecurringDepositsAccountForm() {
this.approveRecurringDepositsAccountForm = this.formBuilder.group({
'approvedOnDate': ['', Validators.required],
'note': ['']
approvedOnDate: [
'',
Validators.required
],
note: ['']
});
}
@@ -72,16 +76,20 @@ export class ApproveRecurringDepositsAccountComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const prevApprovedOnDate: Date = this.approveRecurringDepositsAccountForm.value.approvedOnDate;
if (approveRecurringDepositsAccountFormData.approvedOnDate instanceof Date) {
approveRecurringDepositsAccountFormData.approvedOnDate = this.dateUtils.formatDate(prevApprovedOnDate, dateFormat);
approveRecurringDepositsAccountFormData.approvedOnDate = this.dateUtils.formatDate(
prevApprovedOnDate,
dateFormat
);
}
const data = {
...approveRecurringDepositsAccountFormData,
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'approve', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'approve', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CloseRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CloseRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [CloseRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./close-recurring-deposits-account.component.scss']
})
export class CloseRecurringDepositsAccountComponent implements OnInit {
/** Maturity Amount */
maturityAmount: any;
/** On Account Closure Options */
@@ -76,16 +75,25 @@ export class CloseRecurringDepositsAccountComponent implements OnInit {
*/
createcloseRecurringDepositForm() {
this.closeRecurringDepositForm = this.formBuilder.group({
'closedOnDate': [new Date(), Validators.required],
'maturityAmount': [{ value: this.maturityAmount, disabled: true}],
'onAccountClosureId': ['', Validators.required],
'paymentTypeId': ['', Validators.required],
'accountNumber': '',
'chequeNumber': '',
'routingCode': '',
'receiptNumber': '',
'bankNumber': '',
'note': ''
closedOnDate: [
new Date(),
Validators.required
],
maturityAmount: [{ value: this.maturityAmount, disabled: true }],
onAccountClosureId: [
'',
Validators.required
],
paymentTypeId: [
'',
Validators.required
],
accountNumber: '',
chequeNumber: '',
routingCode: '',
receiptNumber: '',
bankNumber: '',
note: ''
});
}
@@ -93,7 +101,7 @@ export class CloseRecurringDepositsAccountComponent implements OnInit {
* Toggles the display of payment details
*/
toggleDisplay() {
this.showPaymentDetails = !(this.showPaymentDetails);
this.showPaymentDetails = !this.showPaymentDetails;
}
/**
@@ -112,9 +120,10 @@ export class CloseRecurringDepositsAccountComponent implements OnInit {
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'close', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'close', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('DepositRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DepositRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [DepositRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./deposit-recurring-deposits-account.component.scss']
})
export class DepositRecurringDepositsAccountComponent implements OnInit {
@Input() currency: Currency;
/** Transactions Amount */
@@ -41,7 +40,7 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
action: string;
actionName: string;
transactionCommand: string;
transactionType: { deposit: boolean, withdrawal: boolean } = { deposit: false, withdrawal: false };
transactionType: { deposit: boolean; withdrawal: boolean } = { deposit: false, withdrawal: false };
/**
* Retrieves action details transactions template data from `resolve`
@@ -62,7 +61,10 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
this.route.data.subscribe((data: { recurringDepositsAccountActionData: any }) => {
this.transactionAmount = data.recurringDepositsAccountActionData.amount;
this.paymentTypes = data.recurringDepositsAccountActionData.paymentTypeOptions;
if (data.recurringDepositsAccountActionData.outstandingChargeAmount && data.recurringDepositsAccountActionData.outstandingChargeAmount > 0) {
if (
data.recurringDepositsAccountActionData.outstandingChargeAmount &&
data.recurringDepositsAccountActionData.outstandingChargeAmount > 0
) {
this.outstandingChargeAmount = data.recurringDepositsAccountActionData.outstandingChargeAmount;
this.transactionAmount = this.transactionAmount + this.outstandingChargeAmount;
}
@@ -84,10 +86,19 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
*/
createdepositRecurringDepositForm() {
this.depositRecurringDepositForm = this.formBuilder.group({
'transactionDate': [new Date(), Validators.required],
'transactionAmount': [0.0, Validators.required],
'paymentTypeId': ['', Validators.required],
'note': ''
transactionDate: [
new Date(),
Validators.required
],
transactionAmount: [
0.0,
Validators.required
],
paymentTypeId: [
'',
Validators.required
],
note: ''
});
}
@@ -115,7 +126,7 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
* Toggles the display of payment details
*/
toggleDisplay() {
this.showPaymentDetails = !(this.showPaymentDetails);
this.showPaymentDetails = !this.showPaymentDetails;
}
/**
@@ -137,9 +148,10 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
delete data['note'];
data['transactionAmount'] = data['transactionAmount'] * 1;
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, this.action, data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, this.action, data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('PrematureCloseRecurringDepositAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PrematureCloseRecurringDepositAccountComponent ]
})
.compileComponents();
declarations: [PrematureCloseRecurringDepositAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./premature-close-recurring-deposit-account.component.scss']
})
export class PrematureCloseRecurringDepositAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -36,12 +35,14 @@ export class PrematureCloseRecurringDepositAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService, ) {
private settingsService: SettingsService
) {
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -58,7 +59,10 @@ export class PrematureCloseRecurringDepositAccountComponent implements OnInit {
*/
createprematureCloseRecurringDepositsAccountForm() {
this.prematureCloseRecurringDepositsAccountForm = this.formBuilder.group({
'closedOnDate': ['', Validators.required]
closedOnDate: [
'',
Validators.required
]
});
}
@@ -72,16 +76,20 @@ export class PrematureCloseRecurringDepositAccountComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const prevClosedOnDate: Date = this.prematureCloseRecurringDepositsAccountForm.value.closedOnDate;
if (prematureCloseRecurringDepositsAccountFormData.closedOnDate instanceof Date) {
prematureCloseRecurringDepositsAccountFormData.closedOnDate = this.dateUtils.formatDate(prevClosedOnDate, dateFormat);
prematureCloseRecurringDepositsAccountFormData.closedOnDate = this.dateUtils.formatDate(
prevClosedOnDate,
dateFormat
);
}
const data = {
...prematureCloseRecurringDepositsAccountFormData,
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'prematureClose', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'prematureClose', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('RecurringDepositsAccountActionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecurringDepositsAccountActionsComponent ]
})
.compileComponents();
declarations: [RecurringDepositsAccountActionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -8,35 +8,34 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./recurring-deposits-account-actions.component.scss']
})
export class RecurringDepositsAccountActionsComponent {
/** Flag object to store possible actions and render appropriate UI to the user */
actions: {
'Activate': boolean
'Undo Activation': boolean
'Undo Approval': boolean
'Approve': boolean
'Reject': boolean
'Withdrawn by Client': boolean
'Add Charge': boolean
'Premature Close': boolean
'Close': boolean
'Deposit': boolean
'Withdrawal': boolean
Activate: boolean;
'Undo Activation': boolean;
'Undo Approval': boolean;
Approve: boolean;
Reject: boolean;
'Withdrawn by Client': boolean;
'Add Charge': boolean;
'Premature Close': boolean;
Close: boolean;
Deposit: boolean;
Withdrawal: boolean;
} = {
'Activate': false,
'Undo Activation': false,
'Undo Approval': false,
'Approve': false,
'Reject': false,
'Withdrawn by Client': false,
'Add Charge': false,
'Premature Close': false,
'Close': false,
'Deposit': false,
'Withdrawal': false
};
Activate: false,
'Undo Activation': false,
'Undo Approval': false,
Approve: false,
Reject: false,
'Withdrawn by Client': false,
'Add Charge': false,
'Premature Close': false,
Close: false,
Deposit: false,
Withdrawal: false
};
currency: Currency;
currency: Currency;
/**
* @param {ActivatedRoute} route Activated Route
@@ -50,5 +49,4 @@ export class RecurringDepositsAccountActionsComponent {
const name = this.route.snapshot.params['name'];
this.actions[name] = true;
}
}
@@ -8,9 +8,8 @@ describe('RejectRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RejectRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [RejectRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -8,7 +8,6 @@ import { RecurringDepositsService } from '../../recurring-deposits.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
/**
* Reject Recurring Deposits Account Component
*/
@@ -18,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./reject-recurring-deposits-account.component.scss']
})
export class RejectRecurringDepositsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -36,12 +34,14 @@ export class RejectRecurringDepositsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -58,8 +58,11 @@ export class RejectRecurringDepositsAccountComponent implements OnInit {
*/
createRejectRecurringDepositsAccountForm() {
this.rejectRecurringDepositsAccountForm = this.formBuilder.group({
'rejectedOnDate': ['', Validators.required],
'note': ['']
rejectedOnDate: [
'',
Validators.required
],
note: ['']
});
}
@@ -80,9 +83,10 @@ export class RejectRecurringDepositsAccountComponent implements OnInit {
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'reject', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'reject', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('UndoApprovalRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UndoApprovalRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [UndoApprovalRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { RecurringDepositsService } from '../../recurring-deposits.service';
styleUrls: ['./undo-approval-recurring-deposits-account.component.scss']
})
export class UndoApprovalRecurringDepositsAccountComponent implements OnInit {
/** Undo Approval Recurring Deposits Account form. */
undoApprovalRecurringDepositsAccountForm: UntypedFormGroup;
/** Recurring Deposits Account Id */
@@ -30,10 +29,12 @@ export class UndoApprovalRecurringDepositsAccountComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private route: ActivatedRoute,
private router: Router) {
private router: Router
) {
this.undoCommand = 'undoapproval'; // Default command
this.undoAction = this.route.snapshot.params['name'];
if (this.undoAction === 'Undo Activation') {
@@ -54,7 +55,7 @@ export class UndoApprovalRecurringDepositsAccountComponent implements OnInit {
*/
createUndoApprovalRecurringDepositsAccountForm() {
this.undoApprovalRecurringDepositsAccountForm = this.formBuilder.group({
'note': ['']
note: ['']
});
}
@@ -64,17 +65,20 @@ export class UndoApprovalRecurringDepositsAccountComponent implements OnInit {
*/
submit() {
const data = {
...this.undoApprovalRecurringDepositsAccountForm.value,
...this.undoApprovalRecurringDepositsAccountForm.value
};
if (this.undoAction === 'Undo Activation') {
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, this.undoCommand, data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, this.undoCommand, data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
} else {
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'undoapproval', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'undoapproval', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
}
@@ -8,9 +8,8 @@ describe('WithdrawByClientRecurringDepositsAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WithdrawByClientRecurringDepositsAccountComponent ]
})
.compileComponents();
declarations: [WithdrawByClientRecurringDepositsAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./withdraw-by-client-recurring-deposits-account.component.scss']
})
export class WithdrawByClientRecurringDepositsAccountComponent implements OnInit {
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -34,12 +33,14 @@ export class WithdrawByClientRecurringDepositsAccountComponent implements OnInit
* @param {Router} router Router
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -56,8 +57,11 @@ export class WithdrawByClientRecurringDepositsAccountComponent implements OnInit
*/
createWithdrawRecurringDepositsAccountForm() {
this.withdrawRecurringDepositsAccountForm = this.formBuilder.group({
'withdrawnOnDate': ['', Validators.required],
'note': ['']
withdrawnOnDate: [
'',
Validators.required
],
note: ['']
});
}
@@ -71,16 +75,20 @@ export class WithdrawByClientRecurringDepositsAccountComponent implements OnInit
const dateFormat = this.settingsService.dateFormat;
const prevWithdrawnOnDate: Date = this.withdrawRecurringDepositsAccountForm.value.withdrawnOnDate;
if (withdrawRecurringDepositsAccountFormData.withdrawnOnDate instanceof Date) {
withdrawRecurringDepositsAccountFormData.withdrawnOnDate = this.dateUtils.formatDate(prevWithdrawnOnDate, dateFormat);
withdrawRecurringDepositsAccountFormData.withdrawnOnDate = this.dateUtils.formatDate(
prevWithdrawnOnDate,
dateFormat
);
}
const data = {
...withdrawRecurringDepositsAccountFormData,
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'withdrawnByApplicant', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.accountId, 'withdrawnByApplicant', data)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('RecurringDepositsAccountChargesStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecurringDepositsAccountChargesStepComponent ]
})
.compileComponents();
declarations: [RecurringDepositsAccountChargesStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -24,7 +24,6 @@ import { Charge, Currency } from 'app/shared/models/general.model';
styleUrls: ['./recurring-deposits-account-charges-step.component.scss']
})
export class RecurringDepositsAccountChargesStepComponent implements OnInit, OnChanges {
@Input() recurringDepositsAccountTemplate: any;
@Input() recurringDepositsAccountProductTemplate: any;
@Input() currencyCode: UntypedFormControl;
@@ -35,7 +34,15 @@ export class RecurringDepositsAccountChargesStepComponent implements OnInit, OnC
/** Charges Data Source */
chargesDataSource: {}[] = [];
/** Charges table columns */
displayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date', 'repaymentsEvery', 'action'];
displayedColumns: string[] = [
'name',
'chargeCalculationType',
'amount',
'chargeTimeType',
'date',
'repaymentsEvery',
'action'
];
/** Component is pristine if there has been no changes by user interaction */
pristine = true;
/** For Edit Recurring Deposits Account Form */
@@ -43,15 +50,17 @@ export class RecurringDepositsAccountChargesStepComponent implements OnInit, OnC
/** Currency Code */
currency: Currency | null = null;
constructor(public dialog: MatDialog,
constructor(
public dialog: MatDialog,
private dateUtils: Dates,
private settingsService: SettingsService, ) {
}
private settingsService: SettingsService
) {}
ngOnInit() {
this.chargesDataSource = [];
if (this.recurringDepositsAccountTemplate.id && this.recurringDepositsAccountTemplate.charges) {
this.chargesDataSource = this.recurringDepositsAccountTemplate.charges.map((charge: any) => ({...charge, id: charge.chargeId})) || [];
this.chargesDataSource =
this.recurringDepositsAccountTemplate.charges.map((charge: any) => ({ ...charge, id: charge.chargeId })) || [];
}
}
@@ -59,17 +68,20 @@ export class RecurringDepositsAccountChargesStepComponent implements OnInit, OnC
if (this.currency == null) {
if (this.recurringDepositsAccountTemplate.currency) {
this.currency = this.recurringDepositsAccountTemplate.currency;
} else if (this.recurringDepositsAccountProductTemplate && this.recurringDepositsAccountProductTemplate.currency) {
} else if (
this.recurringDepositsAccountProductTemplate &&
this.recurringDepositsAccountProductTemplate.currency
) {
this.currency = this.recurringDepositsAccountProductTemplate.currency;
}
}
if (this.recurringDepositsAccountProductTemplate) {
this.chargeData = this.recurringDepositsAccountProductTemplate.chargeOptions
.filter((c: Charge) => c.currency.code === this.currency.code);
this.chargeData = this.recurringDepositsAccountProductTemplate.chargeOptions.filter(
(c: Charge) => c.currency.code === this.currency.code
);
}
}
/**
* Add a charge
*/
@@ -91,7 +103,8 @@ export class RecurringDepositsAccountChargesStepComponent implements OnInit, OnC
value: charge.amount,
type: 'number',
required: false
}),
})
];
const data = {
title: 'Edit Charge Amount',
@@ -121,7 +134,8 @@ export class RecurringDepositsAccountChargesStepComponent implements OnInit, OnC
value: charge.dueDate || charge.feeOnMonthDay || '',
type: 'datetime-local',
required: false
}),
})
];
const data = {
title: 'Edit Charge Date',
@@ -162,7 +176,8 @@ export class RecurringDepositsAccountChargesStepComponent implements OnInit, OnC
value: charge.feeInterval,
type: 'text',
required: false
}),
})
];
const data = {
title: 'Edit Charge Fee Interval',
@@ -205,5 +220,4 @@ export class RecurringDepositsAccountChargesStepComponent implements OnInit, OnC
charges: this.chargesDataSource
};
}
}
@@ -8,9 +8,8 @@ describe('RecurringDepositsAccountDetailsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecurringDepositsAccountDetailsStepComponent ]
})
.compileComponents();
declarations: [RecurringDepositsAccountDetailsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { RecurringDepositsService } from '../../recurring-deposits.service';
styleUrls: ['./recurring-deposits-account-details-step.component.scss']
})
export class RecurringDepositsAccountDetailsStepComponent implements OnInit {
/** Recurring Deposits Account Template */
@Input() recurringDepositsAccountTemplate: any;
@@ -43,9 +42,11 @@ export class RecurringDepositsAccountDetailsStepComponent implements OnInit {
* @param {RecurringDepositsService} recurringDepositsService Recurring Deposits Service.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private recurringDepositsService: RecurringDepositsService,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.createRecurringDepositsAccountDetailsForm();
}
@@ -56,9 +57,11 @@ export class RecurringDepositsAccountDetailsStepComponent implements OnInit {
this.productData = this.recurringDepositsAccountTemplate.productOptions;
if (this.recurringDepositsAccountTemplate.depositProductId) {
this.recurringDepositAccountDetailsForm.patchValue({
'productId': this.recurringDepositsAccountTemplate.depositProductId,
'submittedOnDate': this.recurringDepositsAccountTemplate.timeline.submittedOnDate && new Date(this.recurringDepositsAccountTemplate.timeline.submittedOnDate),
'externalId': this.recurringDepositsAccountTemplate.externalId
productId: this.recurringDepositsAccountTemplate.depositProductId,
submittedOnDate:
this.recurringDepositsAccountTemplate.timeline.submittedOnDate &&
new Date(this.recurringDepositsAccountTemplate.timeline.submittedOnDate),
externalId: this.recurringDepositsAccountTemplate.externalId
});
}
}
@@ -69,10 +72,16 @@ export class RecurringDepositsAccountDetailsStepComponent implements OnInit {
*/
createRecurringDepositsAccountDetailsForm() {
this.recurringDepositAccountDetailsForm = this.formBuilder.group({
'productId': ['', Validators.required],
'submittedOnDate': ['', Validators.required],
'fieldOfficerId': [''],
'externalId': ['']
productId: [
'',
Validators.required
],
submittedOnDate: [
'',
Validators.required
],
fieldOfficerId: [''],
externalId: ['']
});
}
@@ -82,17 +91,21 @@ export class RecurringDepositsAccountDetailsStepComponent implements OnInit {
buildDependencies() {
const clientId = this.recurringDepositsAccountTemplate.clientId;
this.recurringDepositAccountDetailsForm.get('productId').valueChanges.subscribe((productId: string) => {
this.recurringDepositsService.getRecurringDepositsAccountTemplate(clientId, productId).subscribe((response: any) => {
this.recurringDepositsAccountProductTemplate.emit(response);
this.fieldOfficerData = response.fieldOfficerOptions;
this.isProductSelected = true;
if (!this.isFieldOfficerPatched && this.recurringDepositsAccountTemplate.fieldOfficerId) {
this.recurringDepositAccountDetailsForm.get('fieldOfficerId').patchValue(this.recurringDepositsAccountTemplate.fieldOfficerId);
this.isFieldOfficerPatched = true;
} else {
this.recurringDepositAccountDetailsForm.get('fieldOfficerId').patchValue('');
}
});
this.recurringDepositsService
.getRecurringDepositsAccountTemplate(clientId, productId)
.subscribe((response: any) => {
this.recurringDepositsAccountProductTemplate.emit(response);
this.fieldOfficerData = response.fieldOfficerOptions;
this.isProductSelected = true;
if (!this.isFieldOfficerPatched && this.recurringDepositsAccountTemplate.fieldOfficerId) {
this.recurringDepositAccountDetailsForm
.get('fieldOfficerId')
.patchValue(this.recurringDepositsAccountTemplate.fieldOfficerId);
this.isFieldOfficerPatched = true;
} else {
this.recurringDepositAccountDetailsForm.get('fieldOfficerId').patchValue('');
}
});
});
}
@@ -8,9 +8,8 @@ describe('RecurringDepositsAccountInterestRateChartStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecurringDepositsAccountInterestRateChartStepComponent ]
})
.compileComponents();
declarations: [RecurringDepositsAccountInterestRateChartStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -14,21 +14,33 @@ import { trigger, state, style, transition, animate } from '@angular/animations'
trigger('expandChartSlab', [
state('collapsed', style({ height: '0px', minHeight: '0' })),
state('expanded', style({ height: '*' })),
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))
])
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))])
]
})
export class RecurringDepositsAccountInterestRateChartStepComponent implements OnInit, OnChanges {
@Input() recurringDepositsAccountTemplate: any;
@Input() recurringDepositsAccountProductTemplate: any;
/** Interest Rate Chart Data */
interestRateChartData: any = [];
/** Columns to be displayed in interest rate chart table. */
chartSlabsDisplayedColumns: any[] = ['period', 'amountRange', 'interest', 'description', 'actions'];
chartSlabsDisplayedColumns: any[] = [
'period',
'amountRange',
'interest',
'description',
'actions'
];
/** Columns to be displayed in incentives sub-table. */
incentivesDisplayedColumns: string[] = ['entityType', 'attributeName', 'conditionType', 'attributeValue', 'incentiveType', 'amount'];
incentivesDisplayedColumns: string[] = [
'entityType',
'attributeName',
'conditionType',
'attributeValue',
'incentiveType',
'amount'
];
/** Additional Column to disblac incentives table */
chartSlabsIncentivesDisplayedColumns: string[] = ['incentives'];
/** Expand Chart Slab Index used in the view */
@@ -36,8 +48,7 @@ export class RecurringDepositsAccountInterestRateChartStepComponent implements O
@ViewChild('chartsTable', { static: true }) chartsTableRef: MatTable<Element>;
constructor() {
}
constructor() {}
ngOnChanges() {
if (this.recurringDepositsAccountProductTemplate) {
@@ -48,5 +59,4 @@ export class RecurringDepositsAccountInterestRateChartStepComponent implements O
ngOnInit() {
this.interestRateChartData = [];
}
}
@@ -8,9 +8,8 @@ describe('RecurringDepositsAccountPreviewStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecurringDepositsAccountPreviewStepComponent ]
})
.compileComponents();
declarations: [RecurringDepositsAccountPreviewStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -13,12 +13,11 @@ import { animate, state, style, transition, trigger } from '@angular/animations'
trigger('expandChartSlab', [
state('collapsed', style({ height: '0px', minHeight: '0' })),
state('expanded', style({ height: '*' })),
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))
])
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))])
]
})
export class RecurringDepositsAccountPreviewStepComponent implements OnChanges {
/** Input Data */
@Input() recurringDepositsAccountTemplate: any;
@Input() recurringDepositsAccountProductTemplate: any;
@@ -27,24 +26,43 @@ export class RecurringDepositsAccountPreviewStepComponent implements OnChanges {
@Output() submitEvent = new EventEmitter();
/** Charges Displayed Columns */
chargesDisplayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date', 'repaymentsEvery'];
chargesDisplayedColumns: string[] = [
'name',
'chargeCalculationType',
'amount',
'chargeTimeType',
'date',
'repaymentsEvery'
];
/** Interest Rate Chart Data */
interestRateChartData: any = [];
/** Columns to be displayed in interest rate chart table. */
chartSlabsDisplayedColumns: any[] = ['period', 'amountRange', 'interest', 'description', 'actions'];
chartSlabsDisplayedColumns: any[] = [
'period',
'amountRange',
'interest',
'description',
'actions'
];
/** Columns to be displayed in incentives sub-table. */
incentivesDisplayedColumns: string[] = ['entityType', 'attributeName', 'conditionType', 'attributeValue', 'incentiveType', 'amount'];
incentivesDisplayedColumns: string[] = [
'entityType',
'attributeName',
'conditionType',
'attributeValue',
'incentiveType',
'amount'
];
/** Additional Column to disblac incentives table */
chartSlabsIncentivesDisplayedColumns: string[] = ['incentives'];
/** Expand Chart Slab Index used in the view */
expandChartSlabIndex: number;
constructor() { }
constructor() {}
ngOnChanges() {
if (this.recurringDepositsAccountProductTemplate) {
this.interestRateChartData = this.recurringDepositsAccountProductTemplate.accountChart.chartSlabs;
}
}
}
@@ -8,9 +8,8 @@ describe('RecurringDepositsAccountSettingsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecurringDepositsAccountSettingsStepComponent ]
})
.compileComponents();
declarations: [RecurringDepositsAccountSettingsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -14,7 +14,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./recurring-deposits-account-settings-step.component.scss']
})
export class RecurringDepositsAccountSettingsStepComponent implements OnInit, OnChanges {
@Input() isNew = true;
@Input() recurringDepositsAccountTemplate: any;
@Input() recurringDepositsAccountProductTemplate: any;
@@ -38,48 +37,73 @@ export class RecurringDepositsAccountSettingsStepComponent implements OnInit, On
* @param {FormBuilder} formBuilder Form Builder
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService
) {
this.createRecurringDepositAccountSettingsForm();
this.buildDependencies();
}
ngOnChanges() {
const recurringDepositsAccount: any = this.isNew ? this.recurringDepositsAccountProductTemplate : this.recurringDepositsAccountTemplate;
const recurringDepositsAccount: any = this.isNew
? this.recurringDepositsAccountProductTemplate
: this.recurringDepositsAccountTemplate;
if (recurringDepositsAccount) {
this.recurringDepositAccountSettingsForm.patchValue({
'isMandatoryDeposit': recurringDepositsAccount.isMandatoryDeposit,
'adjustAdvanceTowardsFuturePayments': recurringDepositsAccount.adjustAdvanceTowardsFuturePayments,
'allowWithdrawal': recurringDepositsAccount.allowWithdrawal,
'lockinPeriodFrequency': recurringDepositsAccount.lockinPeriodFrequency,
'lockinPeriodFrequencyType': recurringDepositsAccount.lockinPeriodFrequencyType ? recurringDepositsAccount.lockinPeriodFrequencyType.id : '',
'minDepositTerm': recurringDepositsAccount.minDepositTerm,
'minDepositTermTypeId': recurringDepositsAccount.minDepositTermType ? recurringDepositsAccount.minDepositTermType.id : '',
'inMultiplesOfDepositTerm': recurringDepositsAccount.inMultiplesOfDepositTerm,
'inMultiplesOfDepositTermTypeId': recurringDepositsAccount.inMultiplesOfDepositTermType ? recurringDepositsAccount.inMultiplesOfDepositTermType.id : '',
'maxDepositTerm': recurringDepositsAccount.maxDepositTerm,
'maxDepositTermTypeId': recurringDepositsAccount.maxDepositTermType ? recurringDepositsAccount.maxDepositTermType.id : '',
'preClosurePenalApplicable': recurringDepositsAccount.preClosurePenalApplicable,
'preClosurePenalInterest': recurringDepositsAccount.preClosurePenalInterest,
'preClosurePenalInterestOnTypeId': recurringDepositsAccount.preClosurePenalInterestOnType ? recurringDepositsAccount.preClosurePenalInterestOnType.id : '',
'minBalanceForInterestCalculation': recurringDepositsAccount.minBalanceForInterestCalculation,
'depositPeriod': recurringDepositsAccount.minDepositTerm,
'depositPeriodFrequencyId': recurringDepositsAccount.minDepositTermType.id,
'expectedFirstDepositOnDate': recurringDepositsAccount.expectedFirstDepositOnDate && new Date(recurringDepositsAccount.expectedFirstDepositOnDate),
'recurringFrequency': recurringDepositsAccount.recurringFrequency,
'recurringFrequencyType': recurringDepositsAccount.recurringFrequencyType ? recurringDepositsAccount.recurringFrequencyType.id : ''
isMandatoryDeposit: recurringDepositsAccount.isMandatoryDeposit,
adjustAdvanceTowardsFuturePayments: recurringDepositsAccount.adjustAdvanceTowardsFuturePayments,
allowWithdrawal: recurringDepositsAccount.allowWithdrawal,
lockinPeriodFrequency: recurringDepositsAccount.lockinPeriodFrequency,
lockinPeriodFrequencyType: recurringDepositsAccount.lockinPeriodFrequencyType
? recurringDepositsAccount.lockinPeriodFrequencyType.id
: '',
minDepositTerm: recurringDepositsAccount.minDepositTerm,
minDepositTermTypeId: recurringDepositsAccount.minDepositTermType
? recurringDepositsAccount.minDepositTermType.id
: '',
inMultiplesOfDepositTerm: recurringDepositsAccount.inMultiplesOfDepositTerm,
inMultiplesOfDepositTermTypeId: recurringDepositsAccount.inMultiplesOfDepositTermType
? recurringDepositsAccount.inMultiplesOfDepositTermType.id
: '',
maxDepositTerm: recurringDepositsAccount.maxDepositTerm,
maxDepositTermTypeId: recurringDepositsAccount.maxDepositTermType
? recurringDepositsAccount.maxDepositTermType.id
: '',
preClosurePenalApplicable: recurringDepositsAccount.preClosurePenalApplicable,
preClosurePenalInterest: recurringDepositsAccount.preClosurePenalInterest,
preClosurePenalInterestOnTypeId: recurringDepositsAccount.preClosurePenalInterestOnType
? recurringDepositsAccount.preClosurePenalInterestOnType.id
: '',
minBalanceForInterestCalculation: recurringDepositsAccount.minBalanceForInterestCalculation,
depositPeriod: recurringDepositsAccount.minDepositTerm,
depositPeriodFrequencyId: recurringDepositsAccount.minDepositTermType.id,
expectedFirstDepositOnDate:
recurringDepositsAccount.expectedFirstDepositOnDate &&
new Date(recurringDepositsAccount.expectedFirstDepositOnDate),
recurringFrequency: recurringDepositsAccount.recurringFrequency,
recurringFrequencyType: recurringDepositsAccount.recurringFrequencyType
? recurringDepositsAccount.recurringFrequencyType.id
: ''
});
if (recurringDepositsAccount.withHoldTax) {
this.recurringDepositAccountSettingsForm.addControl('withHoldTax', new UntypedFormControl(false));
this.recurringDepositAccountSettingsForm.get('withHoldTax').valueChanges.subscribe((value: boolean) => {
if (value) {
this.recurringDepositAccountSettingsForm.addControl('taxGroupId', new UntypedFormControl({ value: '', disabled: true }));
this.recurringDepositAccountSettingsForm.get('taxGroupId').patchValue(recurringDepositsAccount.taxGroup && recurringDepositsAccount.taxGroup.name);
this.recurringDepositAccountSettingsForm.addControl(
'taxGroupId',
new UntypedFormControl({ value: '', disabled: true })
);
this.recurringDepositAccountSettingsForm
.get('taxGroupId')
.patchValue(recurringDepositsAccount.taxGroup && recurringDepositsAccount.taxGroup.name);
} else {
this.recurringDepositAccountSettingsForm.removeControl('taxGroupId');
}
});
this.recurringDepositAccountSettingsForm.get('withHoldTax').patchValue(this.recurringDepositsAccountTemplate.withHoldTax);
this.recurringDepositAccountSettingsForm
.get('withHoldTax')
.patchValue(this.recurringDepositsAccountTemplate.withHoldTax);
} else {
this.recurringDepositAccountSettingsForm.removeControl('withHoldTax');
}
@@ -92,9 +116,11 @@ export class RecurringDepositsAccountSettingsStepComponent implements OnInit, On
this.maxDate = this.settingsService.businessDate;
if (this.recurringDepositsAccountTemplate) {
this.recurringDepositAccountSettingsForm.patchValue({
'lockinPeriodFrequency': this.recurringDepositsAccountTemplate.lockinPeriodFrequency,
'lockinPeriodFrequencyType': this.recurringDepositsAccountTemplate.lockinPeriodFrequencyType && this.recurringDepositsAccountTemplate.lockinPeriodFrequencyType.id,
'mandatoryRecommendedDepositAmount': this.recurringDepositsAccountTemplate.mandatoryRecommendedDepositAmount,
lockinPeriodFrequency: this.recurringDepositsAccountTemplate.lockinPeriodFrequency,
lockinPeriodFrequencyType:
this.recurringDepositsAccountTemplate.lockinPeriodFrequencyType &&
this.recurringDepositsAccountTemplate.lockinPeriodFrequencyType.id,
mandatoryRecommendedDepositAmount: this.recurringDepositsAccountTemplate.mandatoryRecommendedDepositAmount
});
}
}
@@ -104,28 +130,43 @@ export class RecurringDepositsAccountSettingsStepComponent implements OnInit, On
*/
createRecurringDepositAccountSettingsForm() {
this.recurringDepositAccountSettingsForm = this.formBuilder.group({
'isMandatoryDeposit': [''],
'adjustAdvanceTowardsFuturePayments': [''],
'allowWithdrawal': [''],
'lockinPeriodFrequency': [''],
'lockinPeriodFrequencyType': [''],
'mandatoryRecommendedDepositAmount': ['', Validators.required],
'depositPeriod': ['', Validators.required],
'depositPeriodFrequencyId': ['', Validators.required],
'isCalendarInherited': [''],
'expectedFirstDepositOnDate': [''],
'recurringFrequency': ['', Validators.required],
'recurringFrequencyType': ['', Validators.required],
'minDepositTerm': [{value: '', disabled: true}],
'minDepositTermTypeId': [{ value: '', disabled: true }],
'inMultiplesOfDepositTerm': [{ value: '', disabled: true }],
'inMultiplesOfDepositTermTypeId': [{ value: '', disabled: true }],
'maxDepositTerm': [{ value: '', disabled: true }],
'maxDepositTermTypeId': [{ value: '', disabled: true }],
'preClosurePenalApplicable': [{ value: '', disabled: true }],
'preClosurePenalInterest': [{ value: '', disabled: true }],
'preClosurePenalInterestOnTypeId': [{ value: '', disabled: true }],
'minBalanceForInterestCalculation': [{ value: '', disabled: true }]
isMandatoryDeposit: [''],
adjustAdvanceTowardsFuturePayments: [''],
allowWithdrawal: [''],
lockinPeriodFrequency: [''],
lockinPeriodFrequencyType: [''],
mandatoryRecommendedDepositAmount: [
'',
Validators.required
],
depositPeriod: [
'',
Validators.required
],
depositPeriodFrequencyId: [
'',
Validators.required
],
isCalendarInherited: [''],
expectedFirstDepositOnDate: [''],
recurringFrequency: [
'',
Validators.required
],
recurringFrequencyType: [
'',
Validators.required
],
minDepositTerm: [{ value: '', disabled: true }],
minDepositTermTypeId: [{ value: '', disabled: true }],
inMultiplesOfDepositTerm: [{ value: '', disabled: true }],
inMultiplesOfDepositTermTypeId: [{ value: '', disabled: true }],
maxDepositTerm: [{ value: '', disabled: true }],
maxDepositTermTypeId: [{ value: '', disabled: true }],
preClosurePenalApplicable: [{ value: '', disabled: true }],
preClosurePenalInterest: [{ value: '', disabled: true }],
preClosurePenalInterestOnTypeId: [{ value: '', disabled: true }],
minBalanceForInterestCalculation: [{ value: '', disabled: true }]
});
}
@@ -142,17 +183,19 @@ export class RecurringDepositsAccountSettingsStepComponent implements OnInit, On
* Subscribes to value changes and sets new form controls accordingly.
*/
buildDependencies() {
this.recurringDepositAccountSettingsForm.get('isCalendarInherited').valueChanges.subscribe((isCalendarInherited: any) => {
if (isCalendarInherited) {
this.recurringDepositAccountSettingsForm.removeControl('expectedFirstDepositOnDate');
this.recurringDepositAccountSettingsForm.removeControl('recurringFrequency');
this.recurringDepositAccountSettingsForm.removeControl('recurringFrequencyType');
} else {
this.recurringDepositAccountSettingsForm.addControl('expectedFirstDepositOnDate', new UntypedFormControl());
this.recurringDepositAccountSettingsForm.addControl('recurringFrequency', new UntypedFormControl(''));
this.recurringDepositAccountSettingsForm.addControl('recurringFrequencyType', new UntypedFormControl(''));
}
});
this.recurringDepositAccountSettingsForm
.get('isCalendarInherited')
.valueChanges.subscribe((isCalendarInherited: any) => {
if (isCalendarInherited) {
this.recurringDepositAccountSettingsForm.removeControl('expectedFirstDepositOnDate');
this.recurringDepositAccountSettingsForm.removeControl('recurringFrequency');
this.recurringDepositAccountSettingsForm.removeControl('recurringFrequencyType');
} else {
this.recurringDepositAccountSettingsForm.addControl('expectedFirstDepositOnDate', new UntypedFormControl());
this.recurringDepositAccountSettingsForm.addControl('recurringFrequency', new UntypedFormControl(''));
this.recurringDepositAccountSettingsForm.addControl('recurringFrequencyType', new UntypedFormControl(''));
}
});
}
/**
@@ -161,5 +204,4 @@ export class RecurringDepositsAccountSettingsStepComponent implements OnInit, On
get recurringDepositAccountSettings() {
return this.recurringDepositAccountSettingsForm.value;
}
}
@@ -8,9 +8,8 @@ describe('RecurringDepositsAccountTermsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecurringDepositsAccountTermsStepComponent ]
})
.compileComponents();
declarations: [RecurringDepositsAccountTermsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -12,7 +12,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./recurring-deposits-account-terms-step.component.scss']
})
export class RecurringDepositsAccountTermsStepComponent implements OnInit, OnChanges {
@Input() recurringDepositsAccountTemplate: any;
@Input() recurringDepositsAccountProductTemplate: any;
@@ -35,8 +34,10 @@ export class RecurringDepositsAccountTermsStepComponent implements OnInit, OnCha
* @param {FormBuilder} formBuilder Form Builder
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService
) {
this.createRecurringDepositsAccountTermsForm();
}
@@ -50,10 +51,10 @@ export class RecurringDepositsAccountTermsStepComponent implements OnInit, OnCha
this.maxDate = this.settingsService.businessDate;
if (this.recurringDepositsAccountTemplate.id) {
this.recurringDepositAccountTermsForm.patchValue({
'interestCompoundingPeriodType': this.recurringDepositsAccountTemplate.interestCompoundingPeriodType.id,
'interestPostingPeriodType': this.recurringDepositsAccountTemplate.interestPostingPeriodType.id,
'interestCalculationType': this.recurringDepositsAccountTemplate.interestCalculationType.id,
'interestCalculationDaysInYearType': this.recurringDepositsAccountTemplate.interestCalculationDaysInYearType.id,
interestCompoundingPeriodType: this.recurringDepositsAccountTemplate.interestCompoundingPeriodType.id,
interestPostingPeriodType: this.recurringDepositsAccountTemplate.interestPostingPeriodType.id,
interestCalculationType: this.recurringDepositsAccountTemplate.interestCalculationType.id,
interestCalculationDaysInYearType: this.recurringDepositsAccountTemplate.interestCalculationDaysInYearType.id
});
}
}
@@ -63,10 +64,22 @@ export class RecurringDepositsAccountTermsStepComponent implements OnInit, OnCha
*/
createRecurringDepositsAccountTermsForm() {
this.recurringDepositAccountTermsForm = this.formBuilder.group({
'interestCompoundingPeriodType': ['', Validators.required],
'interestPostingPeriodType': ['', Validators.required],
'interestCalculationType': ['', Validators.required],
'interestCalculationDaysInYearType': ['', Validators.required],
interestCompoundingPeriodType: [
'',
Validators.required
],
interestPostingPeriodType: [
'',
Validators.required
],
interestCalculationType: [
'',
Validators.required
],
interestCalculationDaysInYearType: [
'',
Validators.required
]
});
}
@@ -74,16 +87,19 @@ export class RecurringDepositsAccountTermsStepComponent implements OnInit, OnCha
* Sets all select dropdown options.
*/
setOptions() {
this.interestCompoundingPeriodTypeData = this.recurringDepositsAccountProductTemplate.interestCompoundingPeriodTypeOptions;
this.interestCompoundingPeriodTypeData =
this.recurringDepositsAccountProductTemplate.interestCompoundingPeriodTypeOptions;
this.interestPostingPeriodTypeData = this.recurringDepositsAccountProductTemplate.interestPostingPeriodTypeOptions;
this.interestCalculationTypeData = this.recurringDepositsAccountProductTemplate.interestCalculationTypeOptions;
this.interestCalculationDaysInYearTypeData = this.recurringDepositsAccountProductTemplate.interestCalculationDaysInYearTypeOptions;
this.interestCalculationDaysInYearTypeData =
this.recurringDepositsAccountProductTemplate.interestCalculationDaysInYearTypeOptions;
if (!this.recurringDepositsAccountTemplate.id) {
this.recurringDepositAccountTermsForm.patchValue({
'interestCompoundingPeriodType': this.recurringDepositsAccountProductTemplate.interestCompoundingPeriodType.id,
'interestPostingPeriodType': this.recurringDepositsAccountProductTemplate.interestPostingPeriodType.id,
'interestCalculationType': this.recurringDepositsAccountProductTemplate.interestCalculationType.id,
'interestCalculationDaysInYearType': this.recurringDepositsAccountProductTemplate.interestCalculationDaysInYearType.id,
interestCompoundingPeriodType: this.recurringDepositsAccountProductTemplate.interestCompoundingPeriodType.id,
interestPostingPeriodType: this.recurringDepositsAccountProductTemplate.interestPostingPeriodType.id,
interestCalculationType: this.recurringDepositsAccountProductTemplate.interestCalculationType.id,
interestCalculationDaysInYearType:
this.recurringDepositsAccountProductTemplate.interestCalculationDaysInYearType.id
});
}
}
@@ -94,5 +110,4 @@ export class RecurringDepositsAccountTermsStepComponent implements OnInit, OnCha
get recurringDepositAccountTerms() {
return this.recurringDepositAccountTermsForm.value;
}
}
@@ -8,9 +8,8 @@ describe('ChargesTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChargesTabComponent ]
})
.compileComponents();
declarations: [ChargesTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -29,7 +29,6 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./charges-tab.component.scss']
})
export class ChargesTabComponent implements OnInit {
/** Recurring Deposits Account Data */
recurringDepositsAccountData: any;
/** Charges Data */
@@ -60,13 +59,15 @@ export class ChargesTabComponent implements OnInit {
* Retrieves Recurring Deposits Account Data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private savingsService: SavingsService,
private dateUtils: Dates,
private router: Router,
public dialog: MatDialog,
private translateService: TranslateService,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.route.parent.data.subscribe((data: { recurringDepositsAccountData: any }) => {
this.recurringDepositsAccountData = data.recurringDepositsAccountData;
this.chargesData = this.recurringDepositsAccountData.charges;
@@ -74,7 +75,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);
}
@@ -98,6 +99,7 @@ export class ChargesTabComponent implements OnInit {
type: 'date',
required: true
})
];
const data = {
title: `Pay Charge ${chargeId}`,
@@ -115,7 +117,8 @@ export class ChargesTabComponent implements OnInit {
dateFormat,
locale
};
this.savingsService.executeSavingsAccountChargesCommand(this.recurringDepositsAccountData.id, 'paycharge', dataObject, chargeId)
this.savingsService
.executeSavingsAccountChargesCommand(this.recurringDepositsAccountData.id, 'paycharge', dataObject, chargeId)
.subscribe(() => {
this.reload();
});
@@ -128,12 +131,18 @@ export class ChargesTabComponent implements OnInit {
* @param {any} chargeId Charge Id
*/
waiveCharge(chargeId: any) {
const waiveChargeDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent,
{ data: { heading: this.translateService.instant('labels.heading.Waive Charge'),
dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want to waive charge with id: ') + `${chargeId} ?` } });
const waiveChargeDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent, {
data: {
heading: this.translateService.instant('labels.heading.Waive Charge'),
dialogContext:
this.translateService.instant('labels.dialogContext.Are you sure you want to waive charge with id: ') +
`${chargeId} ?`
}
});
waiveChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountChargesCommand(this.recurringDepositsAccountData.id, 'waive', {}, chargeId)
this.savingsService
.executeSavingsAccountChargesCommand(this.recurringDepositsAccountData.id, 'waive', {}, chargeId)
.subscribe(() => {
this.reload();
});
@@ -154,6 +163,7 @@ export class ChargesTabComponent implements OnInit {
type: 'number',
required: true
})
];
const data = {
title: `Edit Charge ${charge.id}`,
@@ -170,7 +180,8 @@ export class ChargesTabComponent implements OnInit {
dateFormat,
locale
};
this.savingsService.editSavingsAccountCharge(this.recurringDepositsAccountData.id, dataObject, charge.id)
this.savingsService
.editSavingsAccountCharge(this.recurringDepositsAccountData.id, dataObject, charge.id)
.subscribe(() => {
this.reload();
});
@@ -188,10 +199,9 @@ export class ChargesTabComponent implements OnInit {
});
deleteChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.savingsService.deleteSavingsAccountCharge(this.recurringDepositsAccountData.id, chargeId)
.subscribe(() => {
this.reload();
});
this.savingsService.deleteSavingsAccountCharge(this.recurringDepositsAccountData.id, chargeId).subscribe(() => {
this.reload();
});
}
});
}
@@ -211,8 +221,8 @@ export class ChargesTabComponent implements OnInit {
private reload() {
const clientId = this.recurringDepositsAccountData.clientId;
const url: string = this.router.url;
this.router.navigateByUrl(`/clients/${clientId}/recurring-deposits-accounts`, { skipLocationChange: true })
this.router
.navigateByUrl(`/clients/${clientId}/recurring-deposits-accounts`, { skipLocationChange: true })
.then(() => this.router.navigate([url]));
}
}
@@ -8,9 +8,8 @@ describe('RecurringDepositConfirmationDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecurringDepositConfirmationDialogComponent ]
})
.compileComponents();
declarations: [RecurringDepositConfirmationDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -7,12 +7,12 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./recurring-deposit-confirmation-dialog.component.scss']
})
export class RecurringDepositConfirmationDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
* @param {any} data Provides a confirmation for all the recurring deposit actions.
*/
constructor(public dialogRef: MatDialogRef<RecurringDepositConfirmationDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
constructor(
public dialogRef: MatDialogRef<RecurringDepositConfirmationDialogComponent>,
@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;
@@ -8,14 +8,15 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./general-tab.component.scss']
})
export class GeneralTabComponent {
recurringDepositsAccountData: any;
isprematureAllowed = false;
entityType: string;
currency: Currency;
constructor(private route: ActivatedRoute,
private router: Router) {
constructor(
private route: ActivatedRoute,
private router: Router
) {
this.route.parent.data.subscribe((data: { recurringDepositsAccountData: any }) => {
this.recurringDepositsAccountData = data.recurringDepositsAccountData;
this.currency = this.recurringDepositsAccountData.currency;
@@ -29,5 +30,4 @@ export class GeneralTabComponent {
}
});
}
}
@@ -8,9 +8,8 @@ describe('InterestRateChartTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ InterestRateChartTabComponent ]
})
.compileComponents();
declarations: [InterestRateChartTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -14,24 +14,35 @@ import { animate, state, style, transition, trigger } from '@angular/animations'
trigger('expandChartSlab', [
state('collapsed', style({ height: '0px', minHeight: '0' })),
state('expanded', style({ height: '*' })),
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))
])
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))])
]
})
export class InterestRateChartTabComponent {
/** Interest Rate Chart Data */
interestRateChartData: any = [];
/** Columns to be displayed in interest rate chart table. */
chartSlabsDisplayedColumns: any[] = ['period', 'amountRange', 'interest', 'description', 'actions'];
chartSlabsDisplayedColumns: any[] = [
'period',
'amountRange',
'interest',
'description',
'actions'
];
/** Columns to be displayed in incentives sub-table. */
incentivesDisplayedColumns: string[] = ['entityType', 'attributeName', 'conditionType', 'attributeValue', 'incentiveType', 'amount'];
incentivesDisplayedColumns: string[] = [
'entityType',
'attributeName',
'conditionType',
'attributeValue',
'incentiveType',
'amount'
];
/** Additional Column to display in incentives table */
chartSlabsIncentivesDisplayedColumns: string[] = ['incentives'];
/** Expand Chart Slab Index used in the view */
expandChartSlabIndex: number;
/**
* Retrieves recurring deposits account data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
@@ -41,5 +52,4 @@ export class InterestRateChartTabComponent {
this.interestRateChartData = data.recurringDepositsAccountData.accountChart.chartSlabs;
});
}
}
@@ -8,9 +8,8 @@ describe('RecurringDepositsAccountViewComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecurringDepositsAccountViewComponent ]
})
.compileComponents();
declarations: [RecurringDepositsAccountViewComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { RecurringDepositConfirmationDialogComponent } from './custom-dialogs/re
import { Currency } from 'app/shared/models/general.model';
import { TranslateService } from '@ngx-translate/core';
/**
* RecurringDeposits Account View Component
*/
@@ -26,7 +25,6 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./recurring-deposits-account-view.component.scss']
})
export class RecurringDepositsAccountViewComponent implements OnInit {
/** RecurringDeposits Account Data */
recurringDepositsAccountData: any;
/** Button Configuration */
@@ -46,13 +44,15 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
* @param {Router} router Router
* @param {RecurringDepositsService} recurringDepositsService RecurringDeposits Service
*/
constructor(private route: ActivatedRoute,
private router: Router,
private recurringDepositsService: RecurringDepositsService,
private savingsService: SavingsService,
public dialog: MatDialog,
private translateService: TranslateService) {
this.route.data.subscribe((data: { recurringDepositsAccountData: any, savingsDatatables: any }) => {
constructor(
private route: ActivatedRoute,
private router: Router,
private recurringDepositsService: RecurringDepositsService,
private savingsService: SavingsService,
public dialog: MatDialog,
private translateService: TranslateService
) {
this.route.data.subscribe((data: { recurringDepositsAccountData: any; savingsDatatables: any }) => {
this.recurringDepositsAccountData = data.recurringDepositsAccountData;
this.charges = this.recurringDepositsAccountData.charges;
this.savingsDatatables = data.savingsDatatables;
@@ -66,7 +66,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
this.entityType = 'Center';
}
const status: any = data.recurringDepositsAccountData.status;
this.showTransactions = (status.id >= 300);
this.showTransactions = status.id >= 300;
});
}
@@ -138,7 +138,6 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
}
}
}
}
/**
@@ -148,7 +147,8 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
reload() {
const clientId = this.recurringDepositsAccountData.clientId;
const url: string = this.router.url;
this.router.navigateByUrl(`/clients/${clientId}/recurring-deposits-accounts`, { skipLocationChange: true })
this.router
.navigateByUrl(`/clients/${clientId}/recurring-deposits-accounts`, { skipLocationChange: true })
.then(() => this.router.navigate([url]));
}
@@ -201,9 +201,11 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
});
deleteRecurringDepositsAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.recurringDepositsService.deleteRecurringDepositsAccount(this.recurringDepositsAccountData.id).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.recurringDepositsService
.deleteRecurringDepositsAccount(this.recurringDepositsAccountData.id)
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
});
}
@@ -213,13 +215,20 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
*/
private calculateInterest() {
const calculateInterestAccountDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent, {
data: { heading: this.translateService.instant('labels.heading.Calculate Interest'), dialogContext: this.translateService.instant(`labels.dialogContext.Are you sure you want to calculate interest ?`) }
data: {
heading: this.translateService.instant('labels.heading.Calculate Interest'),
dialogContext: this.translateService.instant(
`labels.dialogContext.Are you sure you want to calculate interest ?`
)
}
});
calculateInterestAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.recurringDepositsAccountData.id, 'calculateInterest', {}).subscribe(() => {
this.reload();
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.recurringDepositsAccountData.id, 'calculateInterest', {})
.subscribe(() => {
this.reload();
});
}
});
}
@@ -229,31 +238,39 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
*/
private postInterest() {
const postInterestAccountDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent, {
data: { heading: this.translateService.instant('labels.heading.Post Interest'),
data: {
heading: this.translateService.instant('labels.heading.Post Interest'),
dialogContext: this.translateService.instant('labels.text.Are you sure you want to post interest') + ' ?'
}
});
postInterestAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.recurringDepositsAccountData.id, 'postInterest', {}).subscribe(() => {
this.reload();
});
this.recurringDepositsService
.executeRecurringDepositsAccountCommand(this.recurringDepositsAccountData.id, 'postInterest', {})
.subscribe(() => {
this.reload();
});
}
});
}
/**
* Enables withhold tax for recurring deposits account.
* Recurring deposits endpoint is not supported so using Savings endpoint.
*/
private enableWithHoldTax() {
const deleteSavingsAccountDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent, {
data: { heading: this.translateService.instant('labels.heading.Enable Withhold Tax'), dialogContext: this.translateService.instant('labels.dialogContext.Enable withhold tax for this account ?') }
data: {
heading: this.translateService.instant('labels.heading.Enable Withhold Tax'),
dialogContext: this.translateService.instant('labels.dialogContext.Enable withhold tax for this account ?')
}
});
deleteSavingsAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountUpdateCommand(this.recurringDepositsAccountData.id, 'updateWithHoldTax', { withHoldTax: true })
this.savingsService
.executeSavingsAccountUpdateCommand(this.recurringDepositsAccountData.id, 'updateWithHoldTax', {
withHoldTax: true
})
.subscribe(() => {
this.reload();
});
@@ -267,16 +284,21 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
*/
private disableWithHoldTax() {
const disableWithHoldTaxDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent, {
data: { heading: this.translateService.instant('labels.heading.Disable Withhold Tax'), dialogContext: this.translateService.instant('labels.dialogContext.Disable withhold tax for this account ?') }
data: {
heading: this.translateService.instant('labels.heading.Disable Withhold Tax'),
dialogContext: this.translateService.instant('labels.dialogContext.Disable withhold tax for this account ?')
}
});
disableWithHoldTaxDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountUpdateCommand(this.recurringDepositsAccountData.id, 'updateWithHoldTax', { withHoldTax: false })
this.savingsService
.executeSavingsAccountUpdateCommand(this.recurringDepositsAccountData.id, 'updateWithHoldTax', {
withHoldTax: false
})
.subscribe(() => {
this.reload();
});
}
});
}
}
@@ -1,16 +1,15 @@
/** Recurring Deposits Account Buttons Configuration */
export class RecurringDepositsButtonsConfiguration {
optionArray: {
name: string,
icon?: string,
taskPermissionName: string,
name: string;
icon?: string;
taskPermissionName: string;
}[];
buttonsArray: {
name: string,
icon: string,
taskPermissionName: string,
name: string;
icon: string;
taskPermissionName: string;
}[];
constructor(status: string) {
@@ -84,7 +83,7 @@ export class RecurringDepositsButtonsConfiguration {
taskPermissionName: 'ACTIVATE_RECURRINGDEPOSITACCOUNT'
}
];
break;
break;
case 'Matured':
this.buttonsArray = [
{
@@ -103,7 +102,7 @@ export class RecurringDepositsButtonsConfiguration {
taskPermissionName: 'POSTINTEREST_RECURRINGDEPOSITACCOUNT'
}
];
break;
break;
default:
this.buttonsArray = [];
}
@@ -164,12 +163,11 @@ export class RecurringDepositsButtonsConfiguration {
}
}
addOption(option: {name: string, icon?: string, taskPermissionName: string}) {
addOption(option: { name: string; icon?: string; taskPermissionName: string }) {
this.optionArray.push(option);
}
addButton(option: { name: string, icon: string, taskPermissionName: string }) {
addButton(option: { name: string; icon: string; taskPermissionName: string }) {
this.buttonsArray.push(option);
}
}
@@ -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 {
/** Recurring Deposits Data */
recurringDepositsData: any;
/** Instructions Data */
@@ -29,7 +28,15 @@ export class StandingInstructionsTabComponent implements OnInit {
/** Data source for instructions table. */
dataSource = new MatTableDataSource();
/** Columns to be displayed in instructions table. */
displayedColumns: string[] = ['client', 'fromAccount', 'beneficiary', 'toAccount', 'amount', 'validity', 'actions'];
displayedColumns: string[] = [
'client',
'fromAccount',
'beneficiary',
'toAccount',
'amount',
'validity',
'actions'
];
/** Instruction Table Reference */
@ViewChild('instructionsTable', { static: true }) instructionTableRef: MatTable<Element>;
@@ -38,11 +45,13 @@ export class StandingInstructionsTabComponent implements OnInit {
* Retrieves Recurring Deposits Account Data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private recurringDepositsService: RecurringDepositsService,
private dialog: MatDialog,
private accountTransfersService: AccountTransfersService,
private settingsService: SettingsService, ) {
private settingsService: SettingsService
) {
this.route.parent.data.subscribe((data: { recurringDepositsAccountData: any }) => {
this.recurringDepositsData = data.recurringDepositsAccountData;
});
@@ -61,11 +70,13 @@ export class StandingInstructionsTabComponent implements OnInit {
const accountId = this.recurringDepositsData.id;
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
this.recurringDepositsService.getStandingInstructions(clientId, clientName, accountId, locale, dateFormat).subscribe((response: any) => {
this.instructionsData = response.pageItems;
this.dataSource.data = this.instructionsData;
this.instructionTableRef.renderRows();
});
this.recurringDepositsService
.getStandingInstructions(clientId, clientName, accountId, locale, dateFormat)
.subscribe((response: any) => {
this.instructionsData = response.pageItems;
this.dataSource.data = this.instructionsData;
this.instructionTableRef.renderRows();
});
}
deleteStandingInstruction(instructionId: any) {
@@ -74,10 +85,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('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;
/** Recurring Deposits 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;
@@ -50,12 +49,14 @@ export class EditTransactionComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private recurringDepositsService: RecurringDepositsService,
private settingsService: SettingsService, ) {
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { recurringDepositsAccountTransactionTemplate: any }) => {
this.transactionTemplateData = data.recurringDepositsAccountTransactionTemplate;
if (this.transactionTemplateData.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: ['']
});
}
@@ -127,10 +134,15 @@ export class EditTransactionComponent implements OnInit {
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.recurringDepositsService.executeRecurringDepositsAccountTransactionsCommand(this.recurringDepositAccountId, 'modify', data, this.transactionTemplateData.id)
.subscribe(res => {
this.recurringDepositsService
.executeRecurringDepositsAccountTransactionsCommand(
this.recurringDepositAccountId,
'modify',
data,
this.transactionTemplateData.id
)
.subscribe((res) => {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('TransactionsTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TransactionsTabComponent ]
})
.compileComponents();
declarations: [TransactionsTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { SavingsAccountTransaction } from 'app/savings/models/savings-account-tr
styleUrls: ['./transactions-tab.component.scss']
})
export class TransactionsTabComponent implements OnInit {
/** Recurring Deposits Account Status */
status: any;
/** Transactions Data */
@@ -25,7 +24,16 @@ export class TransactionsTabComponent implements OnInit {
hideAccrualsParam: UntypedFormControl;
hideReversedParam: UntypedFormControl;
/** Columns to be displayed in transactions table. */
displayedColumns: string[] = ['row', 'id', 'transactionDate', 'transactionType', 'debit', 'credit', 'balance', 'actions'];
displayedColumns: string[] = [
'row',
'id',
'transactionDate',
'transactionType',
'debit',
'credit',
'balance',
'actions'
];
/** Data source for transactions table. */
dataSource: MatTableDataSource<any>;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
@@ -35,8 +43,10 @@ export class TransactionsTabComponent implements OnInit {
* Retrieves recurring deposits account data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute,
private router: Router) {
constructor(
private route: ActivatedRoute,
private router: Router
) {
this.route.parent.data.subscribe((data: { recurringDepositsAccountData: any }) => {
this.transactionsData = data.recurringDepositsAccountData.transactions;
this.status = data.recurringDepositsAccountData.status.value;
@@ -54,8 +64,12 @@ export class TransactionsTabComponent implements OnInit {
* @param {any} transactionType Transaction Type
*/
isDebit(transactionType: any) {
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
);
}
hideAccruals() {
@@ -71,7 +85,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);
@@ -95,8 +109,14 @@ export class TransactionsTabComponent implements OnInit {
* 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;
@@ -108,10 +128,11 @@ 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], { relativeTo: this.route });
}
}
}
@@ -8,9 +8,8 @@ describe('ViewTransactionComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewTransactionComponent ]
})
.compileComponents();
declarations: [ViewTransactionComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -23,7 +23,6 @@ import { Location } from '@angular/common';
styleUrls: ['./view-transaction.component.scss']
})
export class ViewTransactionComponent {
/** Transaction data. */
transactionData: any;
@@ -36,14 +35,16 @@ export class ViewTransactionComponent {
* @param {Dates} dateUtils Date Utils.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private recurringDepositsService: RecurringDepositsService,
constructor(
private recurringDepositsService: RecurringDepositsService,
private route: ActivatedRoute,
private location: Location,
private dateUtils: Dates,
private router: Router,
public dialog: MatDialog,
private translateService: TranslateService,
private settingsService: SettingsService, ) {
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { recurringDepositsAccountTransaction: any }) => {
this.transactionData = data.recurringDepositsAccountTransaction;
});
@@ -54,20 +55,32 @@ export class ViewTransactionComponent {
*/
undoTransaction() {
const accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
const undoTransactionAccountDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent, { data: { heading: this.translateService.instant('labels.heading.Undo Transaction'), dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want to undo this transaction ?') } });
const undoTransactionAccountDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent, {
data: {
heading: this.translateService.instant('labels.heading.Undo Transaction'),
dialogContext: this.translateService.instant(
'labels.dialogContext.Are you sure you want to undo this transaction ?'
)
}
});
undoTransactionAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const data = {
transactionDate: this.dateUtils.formatDate(this.transactionData.date && new Date(this.transactionData.date), dateFormat),
transactionDate: this.dateUtils.formatDate(
this.transactionData.date && new Date(this.transactionData.date),
dateFormat
),
transactionAmount: 0,
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountTransactionsCommand(accountId, 'undo', data, this.transactionData.id).subscribe(() => {
this.router.navigate(['../'], { relativeTo: this.route });
});
this.recurringDepositsService
.executeRecurringDepositsAccountTransactionsCommand(accountId, 'undo', data, this.transactionData.id)
.subscribe(() => {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
});
}
@@ -60,17 +60,25 @@ const routes: Routes = [
{
path: 'general',
component: GeneralTabComponent,
data: { title: 'Recurring Deposit Account Details', breadcrumb: 'General', routeParamBreadcrumb: false },
data: { title: 'Recurring Deposit Account Details', breadcrumb: 'General', routeParamBreadcrumb: false }
},
{
path: 'interest-rate-chart',
component: InterestRateChartTabComponent,
data: { title: 'Recurring Deposit Account Interest Rate Chart', breadcrumb: 'Interest Rate Chart', routeParamBreadcrumb: false },
data: {
title: 'Recurring Deposit Account Interest Rate Chart',
breadcrumb: 'Interest Rate Chart',
routeParamBreadcrumb: false
}
},
{
path: 'transactions',
component: TransactionsTabComponent,
data: { title: 'Recurring Deposit Account Transactions', breadcrumb: 'Transactions', routeParamBreadcrumb: false },
data: {
title: 'Recurring Deposit Account Transactions',
breadcrumb: 'Transactions',
routeParamBreadcrumb: false
}
},
{
path: 'charges',
@@ -80,7 +88,11 @@ const routes: Routes = [
{
path: 'standing-instructions-tab',
component: StandingInstructionsTabComponent,
data: { title: 'Recurring Deposit Account Standing Instructions', breadcrumb: 'Standing Instructions', routeParamBreadcrumb: false },
data: {
title: 'Recurring Deposit Account Standing Instructions',
breadcrumb: 'Standing Instructions',
routeParamBreadcrumb: false
}
},
{
path: 'datatables',
@@ -94,7 +106,7 @@ const routes: Routes = [
}
}
]
},
}
]
},
{
@@ -107,11 +119,16 @@ const routes: Routes = [
},
{
path: 'transactions',
data: { title: 'Recurring Deposits Account Transactions', breadcrumb: 'Transactions', routeParamBreadcrumb: false },
data: {
title: 'Recurring Deposits Account Transactions',
breadcrumb: 'Transactions',
routeParamBreadcrumb: false
},
children: [
{
path: '',
redirectTo: '../transactions', pathMatch: 'prefix'
redirectTo: '../transactions',
pathMatch: 'prefix'
},
{
path: ':id',
@@ -147,7 +164,8 @@ const routes: Routes = [
},
{
path: ':recurringDepositAccountId/transfer-funds',
loadChildren: () => import('../../account-transfers/account-transfers.module').then(m => m.AccountTransfersModule)
loadChildren: () =>
import('../../account-transfers/account-transfers.module').then((m) => m.AccountTransfersModule)
}
]
},
@@ -161,8 +179,9 @@ const routes: Routes = [
children: [
{
path: 'standing-instructions',
loadChildren: () => import('../../account-transfers/account-transfers.module').then(m => m.AccountTransfersModule)
},
loadChildren: () =>
import('../../account-transfers/account-transfers.module').then((m) => m.AccountTransfersModule)
}
]
}
]
@@ -81,6 +81,6 @@ import { GeneralTabComponent } from './recurring-deposits-account-view/general-t
EditTransactionComponent,
GeneralTabComponent
],
providers: [ ]
providers: []
})
export class RecurringDepositsModule {}
@@ -12,16 +12,14 @@ import { Observable } from 'rxjs';
providedIn: 'root'
})
export class RecurringDepositsService {
constructor(private http: HttpClient) { }
constructor(private http: HttpClient) {}
/**
* @params recurringDepositAccountId
* Returns the details of a particular Recurring Deposit Account
*/
getRecurringDepositsAccountData(recurringDepositAccountId: any): Observable<any> {
const httpParams = new HttpParams()
.set('associations', 'all');
const httpParams = new HttpParams().set('associations', 'all');
return this.http.get(`/recurringdepositaccounts/${recurringDepositAccountId}`, { params: httpParams });
}
@@ -34,8 +32,12 @@ export class RecurringDepositsService {
* @returns {Observable<any>} Standing Instructions
*/
getStandingInstructions(
clientId: string, clientName: string, fromAccountId: string,
locale: string, dateFormat: string): Observable<any> {
clientId: string,
clientName: string,
fromAccountId: string,
locale: string,
dateFormat: string
): Observable<any> {
const httpParams = new HttpParams()
.set('clientId', clientId)
.set('clientName', clientName)
@@ -92,8 +94,7 @@ export class RecurringDepositsService {
* @param accountId Account ID
*/
getRecurringDepositsAccountAndTemplate(accountId: any) {
const httpParams = new HttpParams().set('associations', 'charges')
.set('template', 'true');
const httpParams = new HttpParams().set('associations', 'charges').set('template', 'true');
return this.http.get(`/recurringdepositaccounts/${accountId}`, { params: httpParams });
}
@@ -141,7 +142,9 @@ export class RecurringDepositsService {
*/
getRecurringDepositsAccountTransactionTemplate(accountId: string, transactionId: string): Observable<any> {
const httpParams = new HttpParams().set('template', 'true');
return this.http.get(`/recurringdepositaccounts/${accountId}/transactions/${transactionId}`, { params: httpParams });
return this.http.get(`/recurringdepositaccounts/${accountId}/transactions/${transactionId}`, {
params: httpParams
});
}
/**
@@ -151,9 +154,15 @@ export class RecurringDepositsService {
* @param {string} transactionId Transaction Id
* @returns {Observable<any>}
*/
executeRecurringDepositsAccountTransactionsCommand(accountId: string, command: string, data: any, transactionId?: any): Observable<any> {
executeRecurringDepositsAccountTransactionsCommand(
accountId: string,
command: string,
data: any,
transactionId?: any
): Observable<any> {
const httpParams = new HttpParams().set('command', command);
return this.http.post(`/recurringdepositaccounts/${accountId}/transactions/${transactionId}`, data, { params: httpParams });
return this.http.post(`/recurringdepositaccounts/${accountId}/transactions/${transactionId}`, data, {
params: httpParams
});
}
}