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('FixedDepositAccountChargesStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FixedDepositAccountChargesStepComponent ]
})
.compileComponents();
declarations: [FixedDepositAccountChargesStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -23,7 +23,6 @@ import { Charge, Currency } from 'app/shared/models/general.model';
styleUrls: ['./fixed-deposit-account-charges-step.component.scss']
})
export class FixedDepositAccountChargesStepComponent implements OnInit, OnChanges {
/** Fixed deposits account template */
@Input() fixedDepositsAccountTemplate: any;
/** Fixed deposits account and product template */
@@ -38,7 +37,15 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange
/** 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'
];
/** For Edit Fixed Deposits Account Form */
isChargesPatched = false;
/** Component is pristine if there has been no changes by user interaction */
@@ -49,14 +56,17 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange
* @param {Dates} dateUtils Date Utils
* @param {SettingsService} settingsService Settings Service
*/
constructor(public dialog: MatDialog,
private dateUtils: Dates,
private settingsService: SettingsService) { }
constructor(
public dialog: MatDialog,
private dateUtils: Dates,
private settingsService: SettingsService
) {}
ngOnInit() {
this.chargesDataSource = [];
if (this.fixedDepositsAccountTemplate.id && this.fixedDepositsAccountTemplate.charges) {
this.chargesDataSource = this.fixedDepositsAccountTemplate.charges.map((charge: any) => ({...charge, id: charge.chargeId})) || [];
this.chargesDataSource =
this.fixedDepositsAccountTemplate.charges.map((charge: any) => ({ ...charge, id: charge.chargeId })) || [];
}
}
@@ -69,8 +79,9 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange
}
}
if (this.fixedDepositsAccountProductTemplate) {
this.chargeData = this.fixedDepositsAccountProductTemplate.chargeOptions
.filter((c: Charge) => c.currency.code === this.currency.code);
this.chargeData = this.fixedDepositsAccountProductTemplate.chargeOptions.filter(
(c: Charge) => c.currency.code === this.currency.code
);
}
}
@@ -95,7 +106,8 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange
value: charge.amount,
type: 'number',
required: false
}),
})
];
const data = {
title: 'Edit Charge Amount',
@@ -125,7 +137,8 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange
value: charge.dueDate || charge.feeOnMonthDay || '',
type: 'datetime-local',
required: false
}),
})
];
const data = {
title: 'Edit Charge Date',
@@ -166,7 +179,8 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange
value: charge.feeInterval,
type: 'text',
required: false
}),
})
];
const data = {
title: 'Edit Charge Fee Interval',
@@ -200,5 +214,4 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange
get fixedDepositAccountCharges() {
return { charges: this.chargesDataSource };
}
}
@@ -8,9 +8,8 @@ describe('FixedDepositAccountDetailsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FixedDepositAccountDetailsStepComponent ]
})
.compileComponents();
declarations: [FixedDepositAccountDetailsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { FixedDepositsService } from '../../fixed-deposits.service';
styleUrls: ['./fixed-deposit-account-details-step.component.scss']
})
export class FixedDepositAccountDetailsStepComponent implements OnInit {
/** Fixed Deposits Account Template */
@Input() fixedDepositsAccountTemplate: any;
@@ -43,9 +42,11 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit {
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
private fixedDepositsService: FixedDepositsService,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private fixedDepositsService: FixedDepositsService,
private settingsService: SettingsService
) {
this.createFixedDepositsAccountDetailsForm();
}
@@ -56,10 +57,11 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit {
this.productData = this.fixedDepositsAccountTemplate.productOptions;
if (this.fixedDepositsAccountTemplate.depositProductId) {
this.fixedDepositAccountDetailsForm.patchValue({
'productId': this.fixedDepositsAccountTemplate.depositProductId,
'submittedOnDate': this.fixedDepositsAccountTemplate.timeline.submittedOnDate
&& new Date(this.fixedDepositsAccountTemplate.timeline.submittedOnDate),
'externalId': this.fixedDepositsAccountTemplate.externalId || '',
productId: this.fixedDepositsAccountTemplate.depositProductId,
submittedOnDate:
this.fixedDepositsAccountTemplate.timeline.submittedOnDate &&
new Date(this.fixedDepositsAccountTemplate.timeline.submittedOnDate),
externalId: this.fixedDepositsAccountTemplate.externalId || ''
});
}
}
@@ -70,10 +72,16 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit {
*/
createFixedDepositsAccountDetailsForm() {
this.fixedDepositAccountDetailsForm = this.formBuilder.group({
'productId': ['', Validators.required],
'submittedOnDate': ['', Validators.required],
'fieldOfficerId': [''],
'externalId': ['']
productId: [
'',
Validators.required
],
submittedOnDate: [
'',
Validators.required
],
fieldOfficerId: [''],
externalId: ['']
});
}
@@ -88,7 +96,9 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit {
this.isProductSelected = true;
this.fieldOfficerData = response.fieldOfficerOptions;
if (!this.isFieldOfficerPatched && this.fixedDepositsAccountTemplate.fieldOfficerId) {
this.fixedDepositAccountDetailsForm.get('fieldOfficerId').patchValue(this.fixedDepositsAccountTemplate.fieldOfficerId);
this.fixedDepositAccountDetailsForm
.get('fieldOfficerId')
.patchValue(this.fixedDepositsAccountTemplate.fieldOfficerId);
this.isFieldOfficerPatched = true;
} else {
this.fixedDepositAccountDetailsForm.get('fieldOfficerId').patchValue('');
@@ -109,5 +119,4 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit {
}
return fixedDepositAccountDetails;
}
}
@@ -8,9 +8,8 @@ describe('FixedDepositAccountInterestRateChartStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FixedDepositAccountInterestRateChartStepComponent ]
})
.compileComponents();
declarations: [FixedDepositAccountInterestRateChartStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -14,12 +14,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 FixedDepositAccountInterestRateChartStepComponent implements OnChanges {
/** Fixed deposits account template */
@Input() fixedDepositsAccountTemplate: any;
/** Fixed deposits account and product template */
@@ -28,9 +27,22 @@ export class FixedDepositAccountInterestRateChartStepComponent implements OnChan
/** 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 */
@@ -39,7 +51,7 @@ export class FixedDepositAccountInterestRateChartStepComponent implements OnChan
/** Interest Rate charts table reference */
@ViewChild('chartsTable', { static: true }) chartsTableRef: MatTable<Element>;
constructor() { }
constructor() {}
ngOnChanges() {
if (this.fixedDepositsAccountProductTemplate) {
@@ -47,5 +59,4 @@ export class FixedDepositAccountInterestRateChartStepComponent implements OnChan
this.chartsTableRef.renderRows();
}
}
}
@@ -8,9 +8,8 @@ describe('FixedDepositAccountPreviewStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FixedDepositAccountPreviewStepComponent ]
})
.compileComponents();
declarations: [FixedDepositAccountPreviewStepComponent]
}).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 FixedDepositAccountPreviewStepComponent implements OnChanges {
/** Fixed Deposits Account Template */
@Input() fixedDepositsAccountTemplate: any;
/** Fixed Deposits Account Product Template */
@@ -27,13 +26,33 @@ export class FixedDepositAccountPreviewStepComponent implements OnChanges {
@Input() fixedDepositAccountData: any;
/** 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 */
@@ -42,12 +61,11 @@ export class FixedDepositAccountPreviewStepComponent implements OnChanges {
/** Form submission event */
@Output() submitEvent = new EventEmitter();
constructor() { }
constructor() {}
ngOnChanges() {
if (this.fixedDepositsAccountProductTemplate) {
this.interestRateChartData = this.fixedDepositsAccountProductTemplate.accountChart.chartSlabs;
}
}
}
@@ -8,9 +8,8 @@ describe('FixedDepositAccountSettingsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FixedDepositAccountSettingsStepComponent ]
})
.compileComponents();
declarations: [FixedDepositAccountSettingsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -13,7 +13,6 @@ import { OptionData } from 'app/shared/models/option-data.model';
styleUrls: ['./fixed-deposit-account-settings-step.component.scss']
})
export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChanges {
/** Fixed deposits account template */
@Input() fixedDepositsAccountTemplate: any;
/** Fixed deposits account and product template */
@@ -40,8 +39,10 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
* @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.createFixedDepositAccountSettingsForm();
this.buildDependencies();
}
@@ -49,28 +50,46 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
ngOnChanges() {
if (this.fixedDepositsAccountProductTemplate) {
this.fixedDepositAccountSettingsForm.patchValue({
'minDepositTerm': this.fixedDepositsAccountProductTemplate.minDepositTerm,
'minDepositTermTypeId': this.fixedDepositsAccountProductTemplate.minDepositTermType ? this.fixedDepositsAccountProductTemplate.minDepositTermType.id : '',
'inMultiplesOfDepositTerm': this.fixedDepositsAccountProductTemplate.inMultiplesOfDepositTerm,
'inMultiplesOfDepositTermTypeId': this.fixedDepositsAccountProductTemplate.inMultiplesOfDepositTermType ? this.fixedDepositsAccountProductTemplate.inMultiplesOfDepositTermType.id : '',
'maxDepositTerm': this.fixedDepositsAccountProductTemplate.maxDepositTerm,
'maxDepositTermTypeId': this.fixedDepositsAccountProductTemplate.maxDepositTermType ? this.fixedDepositsAccountProductTemplate.maxDepositTermType.id : '',
'preClosurePenalApplicable': this.fixedDepositsAccountProductTemplate.preClosurePenalApplicable,
'preClosurePenalInterest': this.fixedDepositsAccountProductTemplate.preClosurePenalInterest,
'preClosurePenalInterestOnTypeId': this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnType ? this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnType.id : '',
'maturityInstructionId': this.fixedDepositsAccountProductTemplate.maturityInstructionId
minDepositTerm: this.fixedDepositsAccountProductTemplate.minDepositTerm,
minDepositTermTypeId: this.fixedDepositsAccountProductTemplate.minDepositTermType
? this.fixedDepositsAccountProductTemplate.minDepositTermType.id
: '',
inMultiplesOfDepositTerm: this.fixedDepositsAccountProductTemplate.inMultiplesOfDepositTerm,
inMultiplesOfDepositTermTypeId: this.fixedDepositsAccountProductTemplate.inMultiplesOfDepositTermType
? this.fixedDepositsAccountProductTemplate.inMultiplesOfDepositTermType.id
: '',
maxDepositTerm: this.fixedDepositsAccountProductTemplate.maxDepositTerm,
maxDepositTermTypeId: this.fixedDepositsAccountProductTemplate.maxDepositTermType
? this.fixedDepositsAccountProductTemplate.maxDepositTermType.id
: '',
preClosurePenalApplicable: this.fixedDepositsAccountProductTemplate.preClosurePenalApplicable,
preClosurePenalInterest: this.fixedDepositsAccountProductTemplate.preClosurePenalInterest,
preClosurePenalInterestOnTypeId: this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnType
? this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnType.id
: '',
maturityInstructionId: this.fixedDepositsAccountProductTemplate.maturityInstructionId
});
if (this.fixedDepositsAccountProductTemplate.withHoldTax) {
this.fixedDepositAccountSettingsForm.addControl('withHoldTax', new UntypedFormControl(false));
this.fixedDepositAccountSettingsForm.get('withHoldTax').valueChanges.subscribe((value: boolean) => {
if (value) {
this.fixedDepositAccountSettingsForm.addControl('taxGroupId', new UntypedFormControl({ value: '', disabled: true }));
this.fixedDepositAccountSettingsForm.get('taxGroupId').patchValue(this.fixedDepositsAccountProductTemplate.taxGroup && this.fixedDepositsAccountProductTemplate.taxGroup.name);
this.fixedDepositAccountSettingsForm.addControl(
'taxGroupId',
new UntypedFormControl({ value: '', disabled: true })
);
this.fixedDepositAccountSettingsForm
.get('taxGroupId')
.patchValue(
this.fixedDepositsAccountProductTemplate.taxGroup &&
this.fixedDepositsAccountProductTemplate.taxGroup.name
);
} else {
this.fixedDepositAccountSettingsForm.removeControl('taxGroupId');
}
});
this.fixedDepositAccountSettingsForm.get('withHoldTax').patchValue(this.fixedDepositsAccountTemplate.withHoldTax);
this.fixedDepositAccountSettingsForm
.get('withHoldTax')
.patchValue(this.fixedDepositsAccountTemplate.withHoldTax);
} else {
this.fixedDepositAccountSettingsForm.removeControl('withHoldTax');
}
@@ -82,9 +101,11 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
this.maxDate = this.settingsService.businessDate;
if (this.fixedDepositsAccountTemplate) {
this.fixedDepositAccountSettingsForm.patchValue({
'lockinPeriodFrequency': this.fixedDepositsAccountTemplate.lockinPeriodFrequency,
'lockinPeriodFrequencyType': this.fixedDepositsAccountTemplate.lockinPeriodFrequencyType && this.fixedDepositsAccountTemplate.lockinPeriodFrequencyType.id,
'transferInterestToSavings': this.fixedDepositsAccountTemplate.transferInterestToSavings
lockinPeriodFrequency: this.fixedDepositsAccountTemplate.lockinPeriodFrequency,
lockinPeriodFrequencyType:
this.fixedDepositsAccountTemplate.lockinPeriodFrequencyType &&
this.fixedDepositsAccountTemplate.lockinPeriodFrequencyType.id,
transferInterestToSavings: this.fixedDepositsAccountTemplate.transferInterestToSavings
});
}
}
@@ -94,19 +115,19 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
*/
createFixedDepositAccountSettingsForm() {
this.fixedDepositAccountSettingsForm = this.formBuilder.group({
'lockinPeriodFrequency': [''],
'lockinPeriodFrequencyType': [''],
'minDepositTerm': [{value: '', disabled: true}],
'minDepositTermTypeId': [{ value: '', disabled: true }],
'inMultiplesOfDepositTerm': [{ value: '', disabled: true }],
'inMultiplesOfDepositTermTypeId': [{ value: '', disabled: true }],
'maxDepositTerm': [{ value: '', disabled: true }],
'maxDepositTermTypeId': [{ value: '', disabled: true }],
'transferInterestToSavings': [false],
'preClosurePenalApplicable': [{ value: '', disabled: true }],
'preClosurePenalInterest': [{ value: '', disabled: true }],
'preClosurePenalInterestOnTypeId': [{ value: '', disabled: true }],
'maturityInstructionId': ['']
lockinPeriodFrequency: [''],
lockinPeriodFrequencyType: [''],
minDepositTerm: [{ value: '', disabled: true }],
minDepositTermTypeId: [{ value: '', disabled: true }],
inMultiplesOfDepositTerm: [{ value: '', disabled: true }],
inMultiplesOfDepositTermTypeId: [{ value: '', disabled: true }],
maxDepositTerm: [{ value: '', disabled: true }],
maxDepositTermTypeId: [{ value: '', disabled: true }],
transferInterestToSavings: [false],
preClosurePenalApplicable: [{ value: '', disabled: true }],
preClosurePenalInterest: [{ value: '', disabled: true }],
preClosurePenalInterestOnTypeId: [{ value: '', disabled: true }],
maturityInstructionId: ['']
});
}
@@ -116,16 +137,31 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
buildDependencies() {
this.fixedDepositAccountSettingsForm.get('transferInterestToSavings').valueChanges.subscribe((value: boolean) => {
if (value) {
this.fixedDepositAccountSettingsForm.addControl('linkAccountId', new UntypedFormControl('', Validators.required));
this.fixedDepositAccountSettingsForm.get('linkAccountId').patchValue(this.fixedDepositsAccountTemplate.linkedAccount && this.fixedDepositsAccountTemplate.linkedAccount.id);
this.fixedDepositAccountSettingsForm.addControl(
'linkAccountId',
new UntypedFormControl('', Validators.required)
);
this.fixedDepositAccountSettingsForm
.get('linkAccountId')
.patchValue(
this.fixedDepositsAccountTemplate.linkedAccount && this.fixedDepositsAccountTemplate.linkedAccount.id
);
} else {
this.fixedDepositAccountSettingsForm.removeControl('linkAccountId');
}
});
this.fixedDepositAccountSettingsForm.get('maturityInstructionId').valueChanges.subscribe((value: number) => {
if (value > 100) {
this.fixedDepositAccountSettingsForm.addControl('transferToSavingsId', new UntypedFormControl('', Validators.required));
this.fixedDepositAccountSettingsForm.get('transferToSavingsId').patchValue(this.fixedDepositsAccountTemplate.transferToSavingsId && this.fixedDepositsAccountTemplate.transferToSavingsId.id);
this.fixedDepositAccountSettingsForm.addControl(
'transferToSavingsId',
new UntypedFormControl('', Validators.required)
);
this.fixedDepositAccountSettingsForm
.get('transferToSavingsId')
.patchValue(
this.fixedDepositsAccountTemplate.transferToSavingsId &&
this.fixedDepositsAccountTemplate.transferToSavingsId.id
);
} else {
this.fixedDepositAccountSettingsForm.removeControl('transferToSavingsId');
}
@@ -139,7 +175,8 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
this.lockinPeriodFrequencyTypeData = this.fixedDepositsAccountProductTemplate.lockinPeriodFrequencyTypeOptions;
this.periodFrequencyTypeData = this.fixedDepositsAccountProductTemplate.periodFrequencyTypeOptions;
this.savingsAccountsData = this.fixedDepositsAccountProductTemplate.savingsAccounts;
this.preClosurePenalInterestOnTypeData = this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnTypeOptions;
this.preClosurePenalInterestOnTypeData =
this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnTypeOptions;
this.maturityInstructionOptions = this.fixedDepositsAccountProductTemplate.maturityInstructionOptions;
}
@@ -155,5 +192,4 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
}
return fixedDepositAccountSettings;
}
}
@@ -8,9 +8,8 @@ describe('FixedDepositAccountTermsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FixedDepositAccountTermsStepComponent ]
})
.compileComponents();
declarations: [FixedDepositAccountTermsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -1,6 +1,6 @@
/** Angular Imports */
import { Component, OnInit, Input, OnChanges } from '@angular/core';
import { UntypedFormGroup, UntypedFormBuilder, Validators} from '@angular/forms';
import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms';
import { SettingsService } from 'app/settings/settings.service';
import { Currency } from 'app/shared/models/general.model';
@@ -13,7 +13,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./fixed-deposit-account-terms-step.component.scss']
})
export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges {
/** Fixed deposits account template */
@Input() fixedDepositsAccountTemplate: any;
/** Fixed deposits account and product template */
@@ -33,7 +32,7 @@ export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges
interestCalculationTypeData: any;
/** Interest Calculation Days in Year Data */
interestCalculationDaysInYearTypeData: any;
/** Period Frequency Type Data */
/** Period Frequency Type Data */
periodFrequencyTypeData: any;
currency: Currency | null = null;
@@ -41,8 +40,10 @@ export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges
* @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.createFixedDepositsAccountTermsForm();
}
@@ -57,13 +58,15 @@ export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges
this.maxDate = this.settingsService.businessDate;
if (this.fixedDepositsAccountTemplate.id) {
this.fixedDepositAccountTermsForm.patchValue({
'interestCompoundingPeriodType': this.fixedDepositsAccountTemplate.interestCompoundingPeriodType.id,
'interestPostingPeriodType': this.fixedDepositsAccountTemplate.interestPostingPeriodType.id,
'interestCalculationType': this.fixedDepositsAccountTemplate.interestCalculationType.id,
'interestCalculationDaysInYearType': this.fixedDepositsAccountTemplate.interestCalculationDaysInYearType.id,
'depositAmount': this.fixedDepositsAccountTemplate.depositAmount ? this.fixedDepositsAccountTemplate.depositAmount : 0,
'depositPeriod': this.fixedDepositsAccountTemplate.depositPeriod,
'depositPeriodFrequencyId': this.fixedDepositsAccountTemplate.depositPeriodFrequency.id,
interestCompoundingPeriodType: this.fixedDepositsAccountTemplate.interestCompoundingPeriodType.id,
interestPostingPeriodType: this.fixedDepositsAccountTemplate.interestPostingPeriodType.id,
interestCalculationType: this.fixedDepositsAccountTemplate.interestCalculationType.id,
interestCalculationDaysInYearType: this.fixedDepositsAccountTemplate.interestCalculationDaysInYearType.id,
depositAmount: this.fixedDepositsAccountTemplate.depositAmount
? this.fixedDepositsAccountTemplate.depositAmount
: 0,
depositPeriod: this.fixedDepositsAccountTemplate.depositPeriod,
depositPeriodFrequencyId: this.fixedDepositsAccountTemplate.depositPeriodFrequency.id
});
console.log(this.fixedDepositAccountTermsForm.value);
}
@@ -74,13 +77,34 @@ export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges
*/
createFixedDepositsAccountTermsForm() {
this.fixedDepositAccountTermsForm = this.formBuilder.group({
'interestCompoundingPeriodType': ['', Validators.required],
'interestPostingPeriodType': ['', Validators.required],
'interestCalculationType': ['', Validators.required],
'interestCalculationDaysInYearType': ['', Validators.required],
'depositAmount': [0, Validators.required],
'depositPeriod': ['', Validators.required],
'depositPeriodFrequencyId': ['', Validators.required]
interestCompoundingPeriodType: [
'',
Validators.required
],
interestPostingPeriodType: [
'',
Validators.required
],
interestCalculationType: [
'',
Validators.required
],
interestCalculationDaysInYearType: [
'',
Validators.required
],
depositAmount: [
0,
Validators.required
],
depositPeriod: [
'',
Validators.required
],
depositPeriodFrequencyId: [
'',
Validators.required
]
});
}
@@ -88,20 +112,23 @@ export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges
* Sets all select dropdown options.
*/
setOptions() {
this.interestCompoundingPeriodTypeData = this.fixedDepositsAccountProductTemplate.interestCompoundingPeriodTypeOptions;
this.interestCompoundingPeriodTypeData =
this.fixedDepositsAccountProductTemplate.interestCompoundingPeriodTypeOptions;
this.interestPostingPeriodTypeData = this.fixedDepositsAccountProductTemplate.interestPostingPeriodTypeOptions;
this.interestCalculationTypeData = this.fixedDepositsAccountProductTemplate.interestCalculationTypeOptions;
this.interestCalculationDaysInYearTypeData = this.fixedDepositsAccountProductTemplate.interestCalculationDaysInYearTypeOptions;
this.interestCalculationDaysInYearTypeData =
this.fixedDepositsAccountProductTemplate.interestCalculationDaysInYearTypeOptions;
this.periodFrequencyTypeData = this.fixedDepositsAccountProductTemplate.periodFrequencyTypeOptions;
if (!this.fixedDepositsAccountTemplate.id) {
this.fixedDepositAccountTermsForm.patchValue({
'interestCompoundingPeriodType': this.fixedDepositsAccountProductTemplate.interestCompoundingPeriodType.id,
'interestPostingPeriodType': this.fixedDepositsAccountProductTemplate.interestPostingPeriodType.id,
'interestCalculationType': this.fixedDepositsAccountProductTemplate.interestCalculationType.id,
'interestCalculationDaysInYearType': this.fixedDepositsAccountProductTemplate.interestCalculationDaysInYearType.id,
'depositAmount': this.fixedDepositsAccountProductTemplate.depositAmount,
'depositPeriod': this.fixedDepositsAccountProductTemplate.minDepositTerm,
'depositPeriodFrequencyId': this.fixedDepositsAccountProductTemplate.minDepositTermType.id,
interestCompoundingPeriodType: this.fixedDepositsAccountProductTemplate.interestCompoundingPeriodType.id,
interestPostingPeriodType: this.fixedDepositsAccountProductTemplate.interestPostingPeriodType.id,
interestCalculationType: this.fixedDepositsAccountProductTemplate.interestCalculationType.id,
interestCalculationDaysInYearType:
this.fixedDepositsAccountProductTemplate.interestCalculationDaysInYearType.id,
depositAmount: this.fixedDepositsAccountProductTemplate.depositAmount,
depositPeriod: this.fixedDepositsAccountProductTemplate.minDepositTerm,
depositPeriodFrequencyId: this.fixedDepositsAccountProductTemplate.minDepositTermType.id
});
}
}
@@ -118,5 +145,4 @@ export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges
}
return fixedDepositAccountTerms;
}
}