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('EditGlAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditGlAccountComponent ]
})
.compileComponents();
declarations: [EditGlAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { AccountingService } from '../../accounting.service';
styleUrls: ['./edit-gl-account.component.scss']
})
export class EditGlAccountComponent implements OnInit {
/** GL account form. */
glAccountForm: UntypedFormGroup;
/** GL account and chart of accounts data. */
@@ -36,10 +35,12 @@ export class EditGlAccountComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
*/
constructor(private formBuilder: UntypedFormBuilder,
private accountingService: AccountingService,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuilder: UntypedFormBuilder,
private accountingService: AccountingService,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { glAccountAndChartOfAccountsTemplate: any }) => {
this.glAccount = data.glAccountAndChartOfAccountsTemplate;
});
@@ -58,14 +59,29 @@ export class EditGlAccountComponent implements OnInit {
*/
createGlAccountForm() {
this.glAccountForm = this.formBuilder.group({
'type': ['', Validators.required],
'name': [this.glAccount.name, Validators.required],
'usage': [this.glAccount.usage.id, Validators.required],
'glCode': [this.glAccount.glCode, Validators.required],
'parentId': [this.glAccount.parentId],
'tagId': [this.glAccount.tagId.id],
'manualEntriesAllowed': [this.glAccount.manualEntriesAllowed, Validators.required],
'description': [this.glAccount.description]
type: [
'',
Validators.required
],
name: [
this.glAccount.name,
Validators.required
],
usage: [
this.glAccount.usage.id,
Validators.required
],
glCode: [
this.glAccount.glCode,
Validators.required
],
parentId: [this.glAccount.parentId],
tagId: [this.glAccount.tagId.id],
manualEntriesAllowed: [
this.glAccount.manualEntriesAllowed,
Validators.required
],
description: [this.glAccount.description]
});
}
@@ -75,23 +91,28 @@ export class EditGlAccountComponent implements OnInit {
setGLAccountForm() {
this.accountTypeData = this.glAccount.accountTypeOptions;
this.accountUsageData = this.glAccount.usageOptions;
this.glAccountForm.get('type').valueChanges.subscribe(accountTypeId => {
this.glAccountForm.get('type').valueChanges.subscribe((accountTypeId) => {
switch (accountTypeId) {
case 1: this.parentData = this.glAccount.assetHeaderAccountOptions;
this.tagData = this.glAccount.allowedAssetsTagOptions;
break;
case 2: this.parentData = this.glAccount.liabilityHeaderAccountOptions;
this.tagData = this.glAccount.allowedLiabilitiesTagOptions;
break;
case 3: this.parentData = this.glAccount.equityHeaderAccountOptions;
this.tagData = this.glAccount.allowedEquityTagOptions;
break;
case 4: this.parentData = this.glAccount.incomeHeaderAccountOptions;
this.tagData = this.glAccount.allowedIncomeTagOptions;
break;
case 5: this.parentData = this.glAccount.expenseHeaderAccountOptions;
this.tagData = this.glAccount.allowedExpensesTagOptions;
break;
case 1:
this.parentData = this.glAccount.assetHeaderAccountOptions;
this.tagData = this.glAccount.allowedAssetsTagOptions;
break;
case 2:
this.parentData = this.glAccount.liabilityHeaderAccountOptions;
this.tagData = this.glAccount.allowedLiabilitiesTagOptions;
break;
case 3:
this.parentData = this.glAccount.equityHeaderAccountOptions;
this.tagData = this.glAccount.allowedEquityTagOptions;
break;
case 4:
this.parentData = this.glAccount.incomeHeaderAccountOptions;
this.tagData = this.glAccount.allowedIncomeTagOptions;
break;
case 5:
this.parentData = this.glAccount.expenseHeaderAccountOptions;
this.tagData = this.glAccount.allowedExpensesTagOptions;
break;
}
});
@@ -103,10 +124,14 @@ export class EditGlAccountComponent implements OnInit {
* if successful redirects to view updated account.
*/
submit() {
this.accountingService.updateGlAccount(this.glAccount.id, this.glAccountForm.value)
.subscribe((response: any) => {
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
});
this.accountingService.updateGlAccount(this.glAccount.id, this.glAccountForm.value).subscribe((response: any) => {
this.router.navigate(
[
'../../',
response.resourceId
],
{ relativeTo: this.route }
);
});
}
}