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('ClosingEntriesComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClosingEntriesComponent ]
})
.compileComponents();
declarations: [ClosingEntriesComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -22,9 +22,13 @@ import { ConfigurationWizardService } from '../../configuration-wizard/configura
styleUrls: ['./closing-entries.component.scss']
})
export class ClosingEntriesComponent implements OnInit, AfterViewInit {
/** Columns to be displayed in closing entries table. */
displayedColumns: string[] = ['officeName', 'closingDate', 'comments', 'createdByUsername'];
displayedColumns: string[] = [
'officeName',
'closingDate',
'comments',
'createdByUsername'
];
/** Data source for closing entries table. */
dataSource: MatTableDataSource<any>;
/** Office name filter form control. */
@@ -57,14 +61,13 @@ export class ClosingEntriesComponent 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: {
offices: any,
glAccountClosures: any
}) => {
constructor(
private route: ActivatedRoute,
private router: Router,
private configurationWizardService: ConfigurationWizardService,
private popoverService: PopoverService
) {
this.route.data.subscribe((data: { offices: any; glAccountClosures: any }) => {
this.officeData = data.offices;
this.glAccountClosureData = data.glAccountClosures;
});
@@ -101,11 +104,10 @@ export class ClosingEntriesComponent implements OnInit, AfterViewInit {
* Sets filtered offices for autocomplete.
*/
setFilteredOffices() {
this.filteredOfficeData = this.officeName.valueChanges
.pipe(
this.filteredOfficeData = this.officeName.valueChanges.pipe(
startWith(''),
map((office: any) => typeof office === 'string' ? office : office.name),
map((officeName: string) => officeName ? this.filterOfficeAutocompleteData(officeName) : this.officeData)
map((office: any) => (typeof office === 'string' ? office : office.name)),
map((officeName: string) => (officeName ? this.filterOfficeAutocompleteData(officeName) : this.officeData))
);
}
@@ -125,7 +127,12 @@ export class ClosingEntriesComponent 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);
}
@@ -13,7 +13,6 @@ import { AccountingService } from '../accounting.service';
*/
@Injectable()
export class ClosingEntriesResolver implements Resolve<Object> {
/**
* @param {AccountingService} accountingService Accounting service.
*/
@@ -26,5 +25,4 @@ export class ClosingEntriesResolver implements Resolve<Object> {
resolve(): Observable<any> {
return this.accountingService.getAccountingClosures();
}
}
@@ -13,7 +13,6 @@ import { AccountingService } from '../accounting.service';
*/
@Injectable()
export class ClosingEntryResolver implements Resolve<Object> {
/**
* @param {AccountingService} accountingService Accounting service.
*/
@@ -27,5 +26,4 @@ export class ClosingEntryResolver implements Resolve<Object> {
const glAccountClosureId = route.paramMap.get('id');
return this.accountingService.getAccountingClosure(glAccountClosureId);
}
}
@@ -8,9 +8,8 @@ describe('CreateClosureComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateClosureComponent ]
})
.compileComponents();
declarations: [CreateClosureComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./create-closure.component.scss']
})
export class CreateClosureComponent implements OnInit {
/** Minimum closing date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum closing date allowed. */
@@ -34,12 +33,14 @@ export class CreateClosureComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private accountingService: AccountingService,
private settingsService: SettingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router) {
private router: Router
) {
this.route.data.subscribe((data: { offices: any }) => {
this.officeData = data.offices;
});
@@ -58,9 +59,15 @@ export class CreateClosureComponent implements OnInit {
*/
createAccountingClosureForm() {
this.accountingClosureForm = this.formBuilder.group({
'officeId': ['', Validators.required],
'closingDate': ['', Validators.required],
'comments': ['']
officeId: [
'',
Validators.required
],
closingDate: [
'',
Validators.required
],
comments: ['']
});
}
@@ -74,11 +81,19 @@ export class CreateClosureComponent implements OnInit {
accountingClosure.locale = this.settingsService.language.code;
accountingClosure.dateFormat = this.settingsService.dateFormat;
if (accountingClosure.closingDate) {
accountingClosure.closingDate = this.dateUtils.formatDate(accountingClosure.closingDate, this.settingsService.dateFormat);
accountingClosure.closingDate = this.dateUtils.formatDate(
accountingClosure.closingDate,
this.settingsService.dateFormat
);
}
this.accountingService.createAccountingClosure(accountingClosure).subscribe((response: any) => {
this.router.navigate(['../view', response.resourceId], { relativeTo: this.route });
this.router.navigate(
[
'../view',
response.resourceId
],
{ relativeTo: this.route }
);
});
}
}
@@ -8,9 +8,8 @@ describe('EditClosureComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditClosureComponent ]
})
.compileComponents();
declarations: [EditClosureComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { AccountingService } from '../../accounting.service';
styleUrls: ['./edit-closure.component.scss']
})
export class EditClosureComponent implements OnInit {
/** Accounting closure form. */
accountingClosureForm: UntypedFormGroup;
/** GL Account closure. */
@@ -30,10 +29,12 @@ export class EditClosureComponent 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: { glAccountClosure: any }) => {
this.glAccountClosure = data.glAccountClosure;
});
@@ -52,9 +53,15 @@ export class EditClosureComponent implements OnInit {
*/
createAccountingClosureForm() {
this.accountingClosureForm = this.formBuilder.group({
'officeId': [{ value: '', disabled: true }, Validators.required],
'closingDate': [{ value: '', disabled: true }, Validators.required],
'comments': ['']
officeId: [
{ value: '', disabled: true },
Validators.required
],
closingDate: [
{ value: '', disabled: true },
Validators.required
],
comments: ['']
});
}
@@ -68,17 +75,21 @@ export class EditClosureComponent implements OnInit {
this.accountingClosureForm.get('comments').setValue(this.glAccountClosure.comments);
}
/**
* Submits the accounting closure form and updates accounting closure,
* if successful redirects to view updated closure.
*/
submit() {
this.accountingService.updateAccountingClosure(this.glAccountClosure.id,
{ comments: this.accountingClosureForm.value.comments })
this.accountingService
.updateAccountingClosure(this.glAccountClosure.id, { comments: this.accountingClosureForm.value.comments })
.subscribe((response: any) => {
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
this.router.navigate(
[
'../../',
response.resourceId
],
{ relativeTo: this.route }
);
});
}
}
@@ -8,9 +8,8 @@ describe('ViewClosureComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewClosureComponent ]
})
.compileComponents();
declarations: [ViewClosureComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dial
styleUrls: ['./view-closure.component.scss']
})
export class ViewClosureComponent {
/** GL Account closure. */
glAccountClosure: any;
@@ -29,10 +28,12 @@ export class ViewClosureComponent {
* @param {Router} router Router for navigation.
* @param {MatDialog} dialog Dialog reference.
*/
constructor(private accountingService: AccountingService,
private route: ActivatedRoute,
private router: Router,
public dialog: MatDialog) {
constructor(
private accountingService: AccountingService,
private route: ActivatedRoute,
private router: Router,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { glAccountClosure: any }) => {
this.glAccountClosure = data.glAccountClosure;
});
@@ -47,12 +48,10 @@ export class ViewClosureComponent {
});
deleteAccountingClosureDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.accountingService.deleteAccountingClosure(this.glAccountClosure.id)
.subscribe(() => {
this.router.navigate(['/accounting/closing-entries']);
});
this.accountingService.deleteAccountingClosure(this.glAccountClosure.id).subscribe(() => {
this.router.navigate(['/accounting/closing-entries']);
});
}
});
}
}