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('SavingsAccountChargesStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountChargesStepComponent ]
})
.compileComponents();
declarations: [SavingsAccountChargesStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -23,7 +23,6 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./savings-account-charges-step.component.scss']
})
export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
/** Savings Account Product Template */
@Input() savingsAccountProductTemplate: any;
/** Savings Account Template */
@@ -42,7 +41,15 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
/** For Edit Savings Account Form */
isChargesPatched = false;
/** Display columns for charges table */
displayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date', 'repaymentsEvery', 'action'];
displayedColumns: string[] = [
'name',
'chargeCalculationType',
'amount',
'chargeTimeType',
'date',
'repaymentsEvery',
'action'
];
/** Table Data Source */
dataSource: any;
/** Check for select all the Clients List */
@@ -50,34 +57,41 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
/** Loan Purpose Options */
loanPurposeOptions: string[] = [];
/** Table Displayed Columns */
displayedColumn: string[] = ['check', 'id', 'name'];
displayedColumn: string[] = [
'check',
'id',
'name'
];
/**
* @param {MatDialog} dialog Mat Dialog
*/
constructor(private dialog: MatDialog,
private dateUtils: Dates,
private translateService: TranslateService) {}
constructor(
private dialog: MatDialog,
private dateUtils: Dates,
private translateService: TranslateService
) {}
ngOnInit() {
ngOnInit() {
if (this.savingsAccountTemplate) {
if (!this.isChargesPatched && this.savingsAccountTemplate.charges) {
this.chargesDataSource = this.savingsAccountProductTemplate.charges.map((charge: any) => ({...charge, id: charge.chargeId})) || [];
this.chargesDataSource =
this.savingsAccountProductTemplate.charges.map((charge: any) => ({ ...charge, id: charge.chargeId })) || [];
this.isChargesPatched = true;
} else {
this.chargesDataSource = [];
}
this.dataSource = new MatTableDataSource<any>(this.activeClientMembers);
}
}
}
ngOnChanges() {
ngOnChanges() {
if (this.savingsAccountProductTemplate) {
this.chargeData = this.savingsAccountProductTemplate.chargeOptions;
this.chargesDataSource = this.savingsAccountProductTemplate.charges.map((charge: any) => ({...charge, id: charge.chargeId})) || [];
this.chargesDataSource =
this.savingsAccountProductTemplate.charges.map((charge: any) => ({ ...charge, id: charge.chargeId })) || [];
}
}
}
/**
* Adds the charge to charges table
@@ -101,7 +115,8 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
value: charge.amount,
type: 'number',
required: false
}),
})
];
const data = {
title: this.translateService.instant('labels.heading.Edit Charge Amount'),
@@ -131,7 +146,8 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
value: charge.dueDate || charge.feeOnMonthDay || '',
type: 'datetime-local',
required: false
}),
})
];
const data = {
title: this.translateService.instant('labels.heading.Edit Charge Date'),
@@ -148,12 +164,12 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
case 'Specified due date':
case 'Weekly Fee':
newCharge = { ...charge, dueDate: date };
break;
break;
case 'Annual Fee':
case 'Monthly Fee':
const dateMonthDay = this.dateUtils.formatDate(response.data.value.date, 'dd MMMM');
newCharge = { ...charge, feeOnMonthDay: dateMonthDay };
break;
break;
}
console.log(newCharge);
this.chargesDataSource.splice(this.chargesDataSource.indexOf(charge), 1, newCharge);
@@ -175,7 +191,8 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
value: charge.feeInterval,
type: 'text',
required: false
}),
})
];
const data = {
title: 'Edit Charge Fee Interval',
@@ -211,7 +228,7 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
}
get selectedClientMembers() {
return { selectedMembers: this.activeClientMembers.filter( (item: any) => item.selected ) };
return { selectedMembers: this.activeClientMembers.filter((item: any) => item.selected) };
}
/** Toggle all checks */
@@ -224,7 +241,7 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
/** Check if all the checks are selected */
toggleSelect() {
const len = this.activeClientMembers.length;
this.selectAllItems = len === 0 ? false : this.activeClientMembers.filter( (item: any) => item.selected ).length === len;
this.selectAllItems =
len === 0 ? false : this.activeClientMembers.filter((item: any) => item.selected).length === len;
}
}
@@ -8,9 +8,8 @@ describe('SavingsAccountDetailsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountDetailsStepComponent ]
})
.compileComponents();
declarations: [SavingsAccountDetailsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./savings-account-details-step.component.scss']
})
export class SavingsAccountDetailsStepComponent implements OnInit {
/** Savings Account Template */
@Input() savingsAccountTemplate: any;
@@ -43,9 +42,11 @@ export class SavingsAccountDetailsStepComponent implements OnInit {
* @param {SavingsService} savingsService Savings Service.
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private settingsService: SettingsService
) {
this.createSavingsAccountDetailsForm();
}
@@ -56,13 +57,15 @@ export class SavingsAccountDetailsStepComponent implements OnInit {
this.productData = this.savingsAccountTemplate.productOptions;
if (this.savingsAccountTemplate.savingsProductId) {
this.savingsAccountDetailsForm.patchValue({
'productId': this.savingsAccountTemplate.savingsProductId,
'submittedOnDate': this.savingsAccountTemplate.timeline.submittedOnDate && new Date(this.savingsAccountTemplate.timeline.submittedOnDate),
'externalId': this.savingsAccountTemplate.externalId
productId: this.savingsAccountTemplate.savingsProductId,
submittedOnDate:
this.savingsAccountTemplate.timeline.submittedOnDate &&
new Date(this.savingsAccountTemplate.timeline.submittedOnDate),
externalId: this.savingsAccountTemplate.externalId
});
} else {
this.savingsAccountDetailsForm.patchValue({
'submittedOnDate': new Date()
submittedOnDate: new Date()
});
}
}
@@ -73,10 +76,16 @@ export class SavingsAccountDetailsStepComponent implements OnInit {
*/
createSavingsAccountDetailsForm() {
this.savingsAccountDetailsForm = this.formBuilder.group({
'productId': ['', Validators.required],
'submittedOnDate': ['', Validators.required],
'fieldOfficerId': [''],
'externalId': ['']
productId: [
'',
Validators.required
],
submittedOnDate: [
'',
Validators.required
],
fieldOfficerId: [''],
externalId: ['']
});
}
@@ -86,18 +95,19 @@ export class SavingsAccountDetailsStepComponent implements OnInit {
buildDependencies() {
const entityId = this.savingsAccountTemplate.clientId || this.savingsAccountTemplate.groupId;
this.savingsAccountDetailsForm.get('productId').valueChanges.subscribe((productId: string) => {
this.savingsService.getSavingsAccountTemplate(entityId, productId, this.savingsAccountTemplate.groupId ? true : false)
.subscribe((response: any) => {
this.savingsAccountProductTemplate.emit(response);
this.fieldOfficerData = response.fieldOfficerOptions;
this.savingsProductSelected = true;
if (!this.isFieldOfficerPatched && this.savingsAccountTemplate.fieldOfficerId) {
this.savingsAccountDetailsForm.get('fieldOfficerId').patchValue(this.savingsAccountTemplate.fieldOfficerId);
this.isFieldOfficerPatched = true;
} else {
this.savingsAccountDetailsForm.get('fieldOfficerId').patchValue('');
}
});
this.savingsService
.getSavingsAccountTemplate(entityId, productId, this.savingsAccountTemplate.groupId ? true : false)
.subscribe((response: any) => {
this.savingsAccountProductTemplate.emit(response);
this.fieldOfficerData = response.fieldOfficerOptions;
this.savingsProductSelected = true;
if (!this.isFieldOfficerPatched && this.savingsAccountTemplate.fieldOfficerId) {
this.savingsAccountDetailsForm.get('fieldOfficerId').patchValue(this.savingsAccountTemplate.fieldOfficerId);
this.isFieldOfficerPatched = true;
} else {
this.savingsAccountDetailsForm.get('fieldOfficerId').patchValue('');
}
});
});
}
@@ -107,5 +117,4 @@ export class SavingsAccountDetailsStepComponent implements OnInit {
get savingsAccountDetails() {
return this.savingsAccountDetailsForm.getRawValue();
}
}
@@ -8,9 +8,8 @@ describe('SavingsAccountPreviewStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountPreviewStepComponent ]
})
.compileComponents();
declarations: [SavingsAccountPreviewStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,7 +11,6 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./savings-account-preview-step.component.scss']
})
export class SavingsAccountPreviewStepComponent {
/** Savings Account Product Template */
@Input() savingsAccountProductTemplate: any;
/** Savings Account Template */
@@ -22,12 +21,19 @@ export class SavingsAccountPreviewStepComponent {
@Input() savingsAccount: any;
/** Display columns for charges table */
chargesDisplayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date', 'repaymentsEvery'];
chargesDisplayedColumns: string[] = [
'name',
'chargeCalculationType',
'amount',
'chargeTimeType',
'date',
'repaymentsEvery'
];
/** Form submission event */
@Output() submitEvent = new EventEmitter();
constructor(private translateService: TranslateService) { }
constructor(private translateService: TranslateService) {}
getCatalogTranslation(text: string): string {
return this.translateService.instant('labels.catalogs.' + text);
@@ -8,9 +8,8 @@ describe('SavingsAccountTermsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SavingsAccountTermsStepComponent ]
})
.compileComponents();
declarations: [SavingsAccountTermsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -12,7 +12,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./savings-account-terms-step.component.scss']
})
export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
/** Savings Account and Product Template */
@Input() savingsAccountProductTemplate: any;
/** Savings Account Template */
@@ -39,8 +38,10 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
* @param {FormBuilder} formBuilder Form Builder
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService
) {
this.createSavingsAccountTermsForm();
this.buildDependencies();
}
@@ -48,22 +49,22 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
ngOnChanges() {
if (this.savingsAccountProductTemplate) {
this.savingsAccountTermsForm.patchValue({
'currencyCode': this.savingsAccountProductTemplate.currency.code,
'decimal': this.savingsAccountProductTemplate.currency.decimalPlaces,
'minBalanceForInterestCalculation': this.savingsAccountProductTemplate.minBalanceForInterestCalculation,
'nominalAnnualInterestRate': this.savingsAccountProductTemplate.nominalAnnualInterestRate,
'interestCompoundingPeriodType': this.savingsAccountProductTemplate.interestCompoundingPeriodType.id,
'interestPostingPeriodType': this.savingsAccountProductTemplate.interestPostingPeriodType.id,
'interestCalculationType': this.savingsAccountProductTemplate.interestCalculationType.id,
'interestCalculationDaysInYearType': this.savingsAccountProductTemplate.interestCalculationDaysInYearType.id,
'minRequiredOpeningBalance': this.savingsAccountProductTemplate.minRequiredOpeningBalance,
'allowOverdraft': this.savingsAccountProductTemplate.allowOverdraft,
'overdraftLimit': this.savingsAccountProductTemplate.overdraftLimit,
'enforceMinRequiredBalance': this.savingsAccountProductTemplate.enforceMinRequiredBalance,
'minOverdraftForInterestCalculation': this.savingsAccountProductTemplate.minOverdraftForInterestCalculation,
'nominalAnnualInterestRateOverdraft': this.savingsAccountProductTemplate.nominalAnnualInterestRateOverdraft,
'minRequiredBalance': this.savingsAccountProductTemplate.minRequiredBalance,
'withdrawalFeeForTransfers': this.savingsAccountProductTemplate.withdrawalFeeForTransfers
currencyCode: this.savingsAccountProductTemplate.currency.code,
decimal: this.savingsAccountProductTemplate.currency.decimalPlaces,
minBalanceForInterestCalculation: this.savingsAccountProductTemplate.minBalanceForInterestCalculation,
nominalAnnualInterestRate: this.savingsAccountProductTemplate.nominalAnnualInterestRate,
interestCompoundingPeriodType: this.savingsAccountProductTemplate.interestCompoundingPeriodType.id,
interestPostingPeriodType: this.savingsAccountProductTemplate.interestPostingPeriodType.id,
interestCalculationType: this.savingsAccountProductTemplate.interestCalculationType.id,
interestCalculationDaysInYearType: this.savingsAccountProductTemplate.interestCalculationDaysInYearType.id,
minRequiredOpeningBalance: this.savingsAccountProductTemplate.minRequiredOpeningBalance,
allowOverdraft: this.savingsAccountProductTemplate.allowOverdraft,
overdraftLimit: this.savingsAccountProductTemplate.overdraftLimit,
enforceMinRequiredBalance: this.savingsAccountProductTemplate.enforceMinRequiredBalance,
minOverdraftForInterestCalculation: this.savingsAccountProductTemplate.minOverdraftForInterestCalculation,
nominalAnnualInterestRateOverdraft: this.savingsAccountProductTemplate.nominalAnnualInterestRateOverdraft,
minRequiredBalance: this.savingsAccountProductTemplate.minRequiredBalance,
withdrawalFeeForTransfers: this.savingsAccountProductTemplate.withdrawalFeeForTransfers
});
this.setOptions();
}
@@ -73,18 +74,20 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
this.maxDate = this.settingsService.businessDate;
if (this.savingsAccountTemplate) {
this.savingsAccountTermsForm.patchValue({
'nominalAnnualInterestRate': this.savingsAccountTemplate.nominalAnnualInterestRate,
'interestCompoundingPeriodType': this.savingsAccountTemplate.interestCompoundingPeriodType.id,
'interestPostingPeriodType': this.savingsAccountTemplate.interestPostingPeriodType.id,
'interestCalculationType': this.savingsAccountTemplate.interestCalculationType.id,
'interestCalculationDaysInYearType': this.savingsAccountTemplate.interestCalculationDaysInYearType.id,
'minRequiredOpeningBalance': this.savingsAccountTemplate.minRequiredOpeningBalance,
'withdrawalFeeForTransfers': this.savingsAccountTemplate.withdrawalFeeForTransfers,
'lockinPeriodFrequency': this.savingsAccountTemplate.lockinPeriodFrequency,
'lockinPeriodFrequencyType': this.savingsAccountTemplate.lockinPeriodFrequencyType && this.savingsAccountTemplate.lockinPeriodFrequencyType.id,
'allowOverdraft': this.savingsAccountTemplate.allowOverdraft,
'enforceMinRequiredBalance': this.savingsAccountTemplate.enforceMinRequiredBalance,
'minRequiredBalance': this.savingsAccountTemplate.minRequiredBalance,
nominalAnnualInterestRate: this.savingsAccountTemplate.nominalAnnualInterestRate,
interestCompoundingPeriodType: this.savingsAccountTemplate.interestCompoundingPeriodType.id,
interestPostingPeriodType: this.savingsAccountTemplate.interestPostingPeriodType.id,
interestCalculationType: this.savingsAccountTemplate.interestCalculationType.id,
interestCalculationDaysInYearType: this.savingsAccountTemplate.interestCalculationDaysInYearType.id,
minRequiredOpeningBalance: this.savingsAccountTemplate.minRequiredOpeningBalance,
withdrawalFeeForTransfers: this.savingsAccountTemplate.withdrawalFeeForTransfers,
lockinPeriodFrequency: this.savingsAccountTemplate.lockinPeriodFrequency,
lockinPeriodFrequencyType:
this.savingsAccountTemplate.lockinPeriodFrequencyType &&
this.savingsAccountTemplate.lockinPeriodFrequencyType.id,
allowOverdraft: this.savingsAccountTemplate.allowOverdraft,
enforceMinRequiredBalance: this.savingsAccountTemplate.enforceMinRequiredBalance,
minRequiredBalance: this.savingsAccountTemplate.minRequiredBalance
});
}
}
@@ -94,21 +97,36 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
*/
createSavingsAccountTermsForm() {
this.savingsAccountTermsForm = this.formBuilder.group({
'currencyCode': [{value: '', disabled: true}],
'decimal': [{value: '', disabled: true}],
'nominalAnnualInterestRate': ['', Validators.required],
'interestCompoundingPeriodType': ['', Validators.required],
'interestPostingPeriodType': ['', Validators.required],
'interestCalculationType': ['', Validators.required],
'interestCalculationDaysInYearType': ['', Validators.required],
'minRequiredOpeningBalance': [''],
'withdrawalFeeForTransfers': [false],
'lockinPeriodFrequency': [''],
'lockinPeriodFrequencyType': [''],
'allowOverdraft': [false],
'enforceMinRequiredBalance': [false],
'minRequiredBalance': [''],
'minBalanceForInterestCalculation': [{value: '', disabled: true}]
currencyCode: [{ value: '', disabled: true }],
decimal: [{ value: '', disabled: true }],
nominalAnnualInterestRate: [
'',
Validators.required
],
interestCompoundingPeriodType: [
'',
Validators.required
],
interestPostingPeriodType: [
'',
Validators.required
],
interestCalculationType: [
'',
Validators.required
],
interestCalculationDaysInYearType: [
'',
Validators.required
],
minRequiredOpeningBalance: [''],
withdrawalFeeForTransfers: [false],
lockinPeriodFrequency: [''],
lockinPeriodFrequencyType: [''],
allowOverdraft: [false],
enforceMinRequiredBalance: [false],
minRequiredBalance: [''],
minBalanceForInterestCalculation: [{ value: '', disabled: true }]
});
}
@@ -120,7 +138,8 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
this.interestCompoundingPeriodTypeData = this.savingsAccountProductTemplate.interestCompoundingPeriodTypeOptions;
this.interestPostingPeriodTypeData = this.savingsAccountProductTemplate.interestPostingPeriodTypeOptions;
this.interestCalculationTypeData = this.savingsAccountProductTemplate.interestCalculationTypeOptions;
this.interestCalculationDaysInYearTypeData = this.savingsAccountProductTemplate.interestCalculationDaysInYearTypeOptions;
this.interestCalculationDaysInYearTypeData =
this.savingsAccountProductTemplate.interestCalculationDaysInYearTypeOptions;
}
/**
@@ -150,5 +169,4 @@ export class SavingsAccountTermsStepComponent implements OnChanges, OnInit {
delete payload.minBalanceForInterestCalculation; // Backend is not accepting minBalanceForInterestCalculation value
return payload;
}
}