build: Use prettier for typescript

Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
Ralph Hopman
2025-01-15 11:59:30 +00:00
committed by Adam Saghy
parent 9d6cf1514a
commit cac1d11ad7
1812 changed files with 22516 additions and 16862 deletions
@@ -8,9 +8,8 @@ describe('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;
}
}