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('CreateFinancialActivityMappingComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateFinancialActivityMappingComponent ]
})
.compileComponents();
declarations: [CreateFinancialActivityMappingComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { GLAccount } from 'app/shared/models/general.model';
styleUrls: ['./create-financial-activity-mapping.component.scss']
})
export class CreateFinancialActivityMappingComponent implements OnInit {
/** Financial activity mapping form. */
financialActivityMappingForm: UntypedFormGroup;
/** GL Account options. */
@@ -33,10 +32,12 @@ export class CreateFinancialActivityMappingComponent 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: { financialActivityAccountsTemplate: any }) => {
this.glAccountOptions = data.financialActivityAccountsTemplate.glAccountOptions;
this.financialActivityData = data.financialActivityAccountsTemplate.financialActivityOptions;
@@ -56,8 +57,14 @@ export class CreateFinancialActivityMappingComponent implements OnInit {
*/
createFinancialActivityMappingForm() {
this.financialActivityMappingForm = this.formBuilder.group({
'financialActivityId': ['', Validators.required],
'glAccountId': ['', Validators.required]
financialActivityId: [
'',
Validators.required
],
glAccountId: [
'',
Validators.required
]
});
}
@@ -65,21 +72,23 @@ export class CreateFinancialActivityMappingComponent implements OnInit {
* Sets the gl account data on the basis of selected financial activity.
*/
setGlAccountData() {
this.financialActivityMappingForm.get('financialActivityId').valueChanges
.subscribe(financialActivityId => {
switch (financialActivityId) {
case 100:
case 101:
case 102:
case 103: this.glAccountData = this.glAccountOptions.assetAccountOptions;
this.financialActivityMappingForm.get('financialActivityId').valueChanges.subscribe((financialActivityId) => {
switch (financialActivityId) {
case 100:
case 101:
case 102:
case 103:
this.glAccountData = this.glAccountOptions.assetAccountOptions;
break;
case 200:
case 201: this.glAccountData = this.glAccountOptions.liabilityAccountOptions;
case 200:
case 201:
this.glAccountData = this.glAccountOptions.liabilityAccountOptions;
break;
case 300: this.glAccountData = this.glAccountOptions.equityAccountOptions;
case 300:
this.glAccountData = this.glAccountOptions.equityAccountOptions;
break;
}
});
}
});
}
/**
@@ -87,10 +96,16 @@ export class CreateFinancialActivityMappingComponent implements OnInit {
* if successful redirects to view created account.
*/
submit() {
this.accountingService.createFinancialActivityAccount(this.financialActivityMappingForm.value)
this.accountingService
.createFinancialActivityAccount(this.financialActivityMappingForm.value)
.subscribe((response: any) => {
this.router.navigate(['../view', response.resourceId], { relativeTo: this.route });
});
this.router.navigate(
[
'../view',
response.resourceId
],
{ relativeTo: this.route }
);
});
}
}
@@ -13,7 +13,6 @@ import { AccountingService } from '../../accounting.service';
*/
@Injectable()
export class FinancialActivityMappingsTemplateResolver implements Resolve<Object> {
/**
* @param {AccountingService} accountingService Accounting service.
*/
@@ -26,5 +25,4 @@ export class FinancialActivityMappingsTemplateResolver implements Resolve<Object
resolve(): Observable<any> {
return this.accountingService.getFinancialActivityAccountsTemplate();
}
}
@@ -8,9 +8,8 @@ describe('EditFinancialActivityMappingComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditFinancialActivityMappingComponent ]
})
.compileComponents();
declarations: [EditFinancialActivityMappingComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { GLAccount } from 'app/shared/models/general.model';
styleUrls: ['./edit-financial-activity-mapping.component.scss']
})
export class EditFinancialActivityMappingComponent implements OnInit {
/** Financial activity mapping form. */
financialActivityMappingForm: UntypedFormGroup;
/** GL Account options. */
@@ -39,10 +38,12 @@ export class EditFinancialActivityMappingComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
*/
constructor(private formBuider: UntypedFormBuilder,
private accountingService: AccountingService,
private route: ActivatedRoute,
private router: Router) {
constructor(
private formBuider: UntypedFormBuilder,
private accountingService: AccountingService,
private route: ActivatedRoute,
private router: Router
) {
this.route.data.subscribe((data: { financialActivityAccountAndTemplate: any }) => {
this.financialActivityAccountId = data.financialActivityAccountAndTemplate.id;
console.log(data.financialActivityAccountAndTemplate.financialActivityData);
@@ -68,8 +69,14 @@ export class EditFinancialActivityMappingComponent implements OnInit {
*/
createFinancialActivityMappingForm() {
this.financialActivityMappingForm = this.formBuider.group({
'financialActivityId': ['', Validators.required],
'glAccountId': ['', Validators.required]
financialActivityId: [
'',
Validators.required
],
glAccountId: [
'',
Validators.required
]
});
}
@@ -77,21 +84,23 @@ export class EditFinancialActivityMappingComponent implements OnInit {
* Sets the gl account data on the basis of selected financial activity.
*/
setGLAccountData() {
this.financialActivityMappingForm.get('financialActivityId').valueChanges
.subscribe(financialActivityId => {
switch (financialActivityId) {
case 100:
case 101:
case 102:
case 103: this.glAccountData = this.glAccountOptions.assetAccountOptions;
this.financialActivityMappingForm.get('financialActivityId').valueChanges.subscribe((financialActivityId) => {
switch (financialActivityId) {
case 100:
case 101:
case 102:
case 103:
this.glAccountData = this.glAccountOptions.assetAccountOptions;
break;
case 200:
case 201: this.glAccountData = this.glAccountOptions.liabilityAccountOptions;
case 200:
case 201:
this.glAccountData = this.glAccountOptions.liabilityAccountOptions;
break;
case 300: this.glAccountData = this.glAccountOptions.equityAccountOptions;
case 300:
this.glAccountData = this.glAccountOptions.equityAccountOptions;
break;
}
});
}
});
}
/**
@@ -99,10 +108,16 @@ export class EditFinancialActivityMappingComponent implements OnInit {
* if successful redirects to view updated account.
*/
submit() {
this.accountingService.updateFinancialActivityAccount(this.financialActivityAccountId, this.financialActivityMappingForm.value)
this.accountingService
.updateFinancialActivityAccount(this.financialActivityAccountId, this.financialActivityMappingForm.value)
.subscribe((response: any) => {
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
});
this.router.navigate(
[
'../../',
response.resourceId
],
{ relativeTo: this.route }
);
});
}
}
@@ -13,7 +13,6 @@ import { AccountingService } from '../../accounting.service';
*/
@Injectable()
export class FinancialActivityMappingAndTemplateResolver implements Resolve<Object> {
/**
* @param {AccountingService} accountingService Accounting service.
*/
@@ -27,5 +26,4 @@ export class FinancialActivityMappingAndTemplateResolver implements Resolve<Obje
const financialActivityAccountId = route.paramMap.get('id');
return this.accountingService.getFinancialActivityAccount(financialActivityAccountId, true);
}
}
@@ -8,9 +8,8 @@ describe('FinancialActivityMappingsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FinancialActivityMappingsComponent ]
})
.compileComponents();
declarations: [FinancialActivityMappingsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,11 +18,15 @@ import { ConfigurationWizardService } from '../../configuration-wizard/configura
styleUrls: ['./financial-activity-mappings.component.scss']
})
export class FinancialActivityMappingsComponent implements OnInit, AfterViewInit {
/** Financial activity account data. */
financialActivityAccountData: any;
/** Columns to be displayed in financial activity mappings table. */
displayedColumns: string[] = ['financialActivity', 'glAccountType', 'glAccountCode', 'glAccountName'];
displayedColumns: string[] = [
'financialActivity',
'glAccountType',
'glAccountCode',
'glAccountName'
];
/** Data source for financial activity mappings table. */
dataSource: MatTableDataSource<any>;
@@ -47,11 +51,13 @@ export class FinancialActivityMappingsComponent implements OnInit, AfterViewInit
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
* @param {PopoverService} popoverService PopoverService.
*/
constructor(private route: ActivatedRoute,
private router: Router,
private configurationWizardService: ConfigurationWizardService,
private popoverService: PopoverService) {
this.route.data.subscribe(( data: { financialActivityAccounts: any }) => {
constructor(
private route: ActivatedRoute,
private router: Router,
private configurationWizardService: ConfigurationWizardService,
private popoverService: PopoverService
) {
this.route.data.subscribe((data: { financialActivityAccounts: any }) => {
this.financialActivityAccountData = data.financialActivityAccounts;
});
}
@@ -71,10 +77,14 @@ export class FinancialActivityMappingsComponent implements OnInit, AfterViewInit
this.dataSource.paginator = this.paginator;
this.dataSource.sortingDataAccessor = (financialActivityAccount: any, property: any) => {
switch (property) {
case 'financialActivity': return financialActivityAccount.financialActivityData.name;
case 'glAccountName': return financialActivityAccount.glAccountData.name;
case 'glAccountCode': return financialActivityAccount.glAccountData.glCode;
default: return financialActivityAccount[property];
case 'financialActivity':
return financialActivityAccount.financialActivityData.name;
case 'glAccountName':
return financialActivityAccount.glAccountData.name;
case 'glAccountCode':
return financialActivityAccount.glAccountData.glCode;
default:
return financialActivityAccount[property];
}
};
this.dataSource.sort = this.sort;
@@ -87,7 +97,12 @@ export class FinancialActivityMappingsComponent implements OnInit, AfterViewInit
* @param position String.
* @param backdrop Boolean.
*/
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
showPopover(
template: TemplateRef<any>,
target: HTMLElement | ElementRef<any>,
position: string,
backdrop: boolean
): void {
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
}
@@ -127,5 +142,4 @@ export class FinancialActivityMappingsComponent implements OnInit, AfterViewInit
this.configurationWizardService.showAccountsLinked = true;
this.router.navigate(['/accounting']);
}
}
@@ -13,7 +13,6 @@ import { AccountingService } from '../accounting.service';
*/
@Injectable()
export class FinancialActivityMappingsResolver implements Resolve<Object> {
/**
* @param {AccountingService} accountingService Accounting service.
*/
@@ -26,5 +25,4 @@ export class FinancialActivityMappingsResolver implements Resolve<Object> {
resolve(): Observable<any> {
return this.accountingService.getFinancialActivityAccounts();
}
}
@@ -13,7 +13,6 @@ import { AccountingService } from '../../accounting.service';
*/
@Injectable()
export class FinancialActivityMappingResolver implements Resolve<Object> {
/**
* @param {AccountingService} accountingService Accounting service.
*/
@@ -27,5 +26,4 @@ export class FinancialActivityMappingResolver implements Resolve<Object> {
const financialActivityAccountId = route.paramMap.get('id');
return this.accountingService.getFinancialActivityAccount(financialActivityAccountId, false);
}
}
@@ -8,9 +8,8 @@ describe('ViewFinancialActivityMappingComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewFinancialActivityMappingComponent ]
})
.compileComponents();
declarations: [ViewFinancialActivityMappingComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -19,7 +19,6 @@ import { Location } from '@angular/common';
styleUrls: ['./view-financial-activity-mapping.component.scss']
})
export class ViewFinancialActivityMappingComponent {
/** Financial activity account ID. */
financialActivityAccountId: any;
/** Financial activity account data. */
@@ -32,11 +31,13 @@ export class ViewFinancialActivityMappingComponent {
* @param {Router} router Router for navigation.
* @param {MatDialog} dialog Dialog reference.
*/
constructor(private accountingService: AccountingService,
private route: ActivatedRoute,
private router: Router,
private dialog: MatDialog,
private location: Location) {
constructor(
private accountingService: AccountingService,
private route: ActivatedRoute,
private router: Router,
private dialog: MatDialog,
private location: Location
) {
this.route.data.subscribe((data: { financialActivityAccount: any }) => {
this.financialActivityAccount = data.financialActivityAccount;
this.financialActivityAccountId = data.financialActivityAccount.id;
@@ -52,10 +53,9 @@ export class ViewFinancialActivityMappingComponent {
});
deleteFinancialActivityAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.accountingService.deleteFinancialActivityAccount(this.financialActivityAccountId)
.subscribe(() => {
this.router.navigate(['/accounting/financial-activity-mappings']);
});
this.accountingService.deleteFinancialActivityAccount(this.financialActivityAccountId).subscribe(() => {
this.router.navigate(['/accounting/financial-activity-mappings']);
});
}
});
}
@@ -63,5 +63,4 @@ export class ViewFinancialActivityMappingComponent {
goBack(): void {
this.location.back();
}
}