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('GlAccountDisplayComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GlAccountDisplayComponent ]
})
.compileComponents();
declarations: [GlAccountDisplayComponent]
}).compileComponents();
fixture = TestBed.createComponent(GlAccountDisplayComponent);
component = fixture.componentInstance;
@@ -7,19 +7,22 @@ import { GLAccount } from 'app/shared/models/general.model';
styleUrls: ['./gl-account-display.component.scss']
})
export class GlAccountDisplayComponent {
@Input() glAccount: GLAccount | null = null;
@Input() accountTitle: string | null = null;
@Input() withTitle = '50%';
@Input() withAccount = '50%';
constructor() { }
constructor() {}
glAccountValue(): string {
if (this.glAccount) {
return '(' + this.glAccount.glCode + ') ' + (this.glAccount.nameDecorated ? this.glAccount.nameDecorated : this.glAccount.name);
return (
'(' +
this.glAccount.glCode +
') ' +
(this.glAccount.nameDecorated ? this.glAccount.nameDecorated : this.glAccount.name)
);
}
return '';
}
}
@@ -8,9 +8,8 @@ describe('GlAccountSelectorComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GlAccountSelectorComponent ]
})
.compileComponents();
declarations: [GlAccountSelectorComponent]
}).compileComponents();
fixture = TestBed.createComponent(GlAccountSelectorComponent);
component = fixture.componentInstance;
@@ -11,7 +11,6 @@ import { takeUntil } from 'rxjs/operators';
styleUrls: ['./gl-account-selector.component.scss']
})
export class GlAccountSelectorComponent implements OnInit, OnChanges, OnDestroy {
@Input() inputFormControl: UntypedFormControl;
@Input() glAccountList: GLAccount[] = [];
@Input() required = false;
@@ -29,15 +28,13 @@ export class GlAccountSelectorComponent implements OnInit, OnChanges, OnDestroy
placeHolderLabel = '';
noEntriesFoundLabel = '';
constructor(private translateService: TranslateService) { }
constructor(private translateService: TranslateService) {}
ngOnInit(): void {
// listen for search field value changes
this.filterFormCtrl.valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(() => {
this.searchGLAccount();
});
this.filterFormCtrl.valueChanges.pipe(takeUntil(this._onDestroy)).subscribe(() => {
this.searchGLAccount();
});
this.placeHolderLabel = this.translateService.instant('labels.inputs.Filter');
this.noEntriesFoundLabel = this.translateService.instant('labels.text.No data found');
@@ -59,13 +56,14 @@ export class GlAccountSelectorComponent implements OnInit, OnChanges, OnDestroy
const search: string = this.filterFormCtrl.value.toLowerCase();
if (!search) {
this.glAccountData.next(this.glAccountList.slice());
this.glAccountData.next(this.glAccountList.slice());
} else {
this.glAccountData.next(this.glAccountList.filter((option: GLAccount) => {
return option.name.toLowerCase().indexOf(search) >= 0 || option.glCode.toLowerCase().indexOf(search) >= 0;
}));
this.glAccountData.next(
this.glAccountList.filter((option: GLAccount) => {
return option.name.toLowerCase().indexOf(search) >= 0 || option.glCode.toLowerCase().indexOf(search) >= 0;
})
);
}
}
}
}
@@ -8,9 +8,8 @@ describe('ViewJournalEntryTransactionComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ViewJournalEntryTransactionComponent ]
})
.compileComponents();
declarations: [ViewJournalEntryTransactionComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -15,7 +15,6 @@ import { Location } from '@angular/common';
styleUrls: ['./view-journal-entry-transaction.component.scss']
})
export class ViewJournalEntryTransactionComponent implements OnInit {
title: string;
journalEntriesData: any[];
/** Transaction data. */
@@ -23,7 +22,14 @@ export class ViewJournalEntryTransactionComponent implements OnInit {
/** Transaction ID. */
transactionId: string;
/** Columns to be displayed in transaction table. */
displayedColumns: string[] = ['id', 'glAccountType', 'glAccountCode', 'glAccountName', 'debit', 'credit'];
displayedColumns: string[] = [
'id',
'glAccountType',
'glAccountCode',
'glAccountName',
'debit',
'credit'
];
/** Data source for transaction table. */
dataSource: MatTableDataSource<any>;
@@ -40,17 +46,19 @@ export class ViewJournalEntryTransactionComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {MatDialog} dialog Dialog reference.
*/
constructor(private accountingService: AccountingService,
private route: ActivatedRoute,
private router: Router,
public dialog: MatDialog,
private location: Location) { }
constructor(
private accountingService: AccountingService,
private route: ActivatedRoute,
private router: Router,
public dialog: MatDialog,
private location: Location
) {}
/**
* Retrieves the transaction data from `resolve` and sets the transaction table.
*/
ngOnInit() {
this.route.data.subscribe((data: { title: string, transaction: any, transferJournalEntryData: any }) => {
this.route.data.subscribe((data: { title: string; transaction: any; transferJournalEntryData: any }) => {
this.title = data.title;
this.isJournalEntryLoaded = false;
if (this.isViewTransaction()) {
@@ -68,11 +76,11 @@ export class ViewJournalEntryTransactionComponent implements OnInit {
}
isViewTransaction(): boolean {
return (this.title === 'View Transaction');
return this.title === 'View Transaction';
}
isViewTransfer(): boolean {
return (this.title === 'View Transfer');
return this.title === 'View Transfer';
}
/**
@@ -85,10 +93,14 @@ export class ViewJournalEntryTransactionComponent implements OnInit {
this.dataSource = new MatTableDataSource(this.transaction.pageItems);
this.dataSource.sortingDataAccessor = (transaction: any, property: any) => {
switch (property) {
case 'glAccountType': return transaction.glAccountType.value;
case 'debit': return transaction.amount;
case 'credit': return transaction.amount;
default: return transaction[property];
case 'glAccountType':
return transaction.glAccountType.value;
case 'debit':
return transaction.amount;
case 'credit':
return transaction.amount;
default:
return transaction[property];
}
};
}
@@ -116,12 +128,20 @@ export class ViewJournalEntryTransactionComponent implements OnInit {
});
revertTransactionDialogRef.afterClosed().subscribe((response: any) => {
if (response.revert) {
this.accountingService.revertTransaction(this.transactionId, response.comments).subscribe((reversedTransaction: any) => {
this.dataSource.data[0].reversed = true;
this.revertTransaction(reversedTransaction.transactionId);
});
this.accountingService
.revertTransaction(this.transactionId, response.comments)
.subscribe((reversedTransaction: any) => {
this.dataSource.data[0].reversed = true;
this.revertTransaction(reversedTransaction.transactionId);
});
} else if (response.redirect) {
this.router.navigate(['../', transactionId], { relativeTo: this.route });
this.router.navigate(
[
'../',
transactionId
],
{ relativeTo: this.route }
);
}
});
}
@@ -8,9 +8,8 @@ describe('ViewJournalEntryComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewJournalEntryComponent ]
})
.compileComponents();
declarations: [ViewJournalEntryComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,16 +11,16 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./view-journal-entry.component.scss']
})
export class ViewJournalEntryComponent {
existsPaymentDetails = false;
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
* @param {any} data Provides journal entry.
*/
constructor(public dialogRef: MatDialogRef<ViewJournalEntryComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.existsPaymentDetails = (data.journalEntry.transactionDetails != null && data.journalEntry.transactionDetails.paymentDetails != null);
constructor(
public dialogRef: MatDialogRef<ViewJournalEntryComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.existsPaymentDetails =
data.journalEntry.transactionDetails != null && data.journalEntry.transactionDetails.paymentDetails != null;
}
}
@@ -8,9 +8,8 @@ describe('ViewSavingsAccountingDetailsComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ViewSavingsAccountingDetailsComponent ]
})
.compileComponents();
declarations: [ViewSavingsAccountingDetailsComponent]
}).compileComponents();
fixture = TestBed.createComponent(ViewSavingsAccountingDetailsComponent);
component = fixture.componentInstance;
@@ -8,11 +8,10 @@ import { OptionData } from 'app/shared/models/option-data.model';
styleUrls: ['./view-savings-accounting-details.component.scss']
})
export class ViewSavingsAccountingDetailsComponent {
@Input() accountingRule: OptionData;
@Input() accountingMappings: any[] = [];
constructor(private accounting: Accounting) { }
constructor(private accounting: Accounting) {}
isCashOrAccrualAccounting(): boolean {
if (this.accountingRule) {
@@ -31,5 +30,4 @@ export class ViewSavingsAccountingDetailsComponent {
getAccountingRuleName(value: string): string {
return this.accounting.getAccountRuleName(value.toUpperCase());
}
}