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
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
*/
@Injectable()
export class EditOfficeResolver implements Resolve<Object> {
/**
* @param {OrganizationService} organizationService Organization service.
*/
@@ -27,5 +26,4 @@ export class EditOfficeResolver implements Resolve<Object> {
const officeId = route.paramMap.get('officeId');
return this.organizationService.getOffice(officeId, true);
}
}
@@ -11,11 +11,10 @@ import { Observable } from 'rxjs';
*/
@Injectable()
export class OfficeDatatableResolver implements Resolve<Object> {
/**
* @param {SystemService} systemService Products service.
*/
constructor(private systemService: SystemService) { }
constructor(private systemService: SystemService) {}
/**
* Returns the Office's Datatable data.
@@ -26,5 +25,4 @@ export class OfficeDatatableResolver implements Resolve<Object> {
const datatableName = route.paramMap.get('datatableName');
return this.systemService.getEntityDatatable(officeId, datatableName);
}
}
@@ -11,11 +11,10 @@ import { Observable } from 'rxjs';
*/
@Injectable()
export class OfficeDatatablesResolver implements Resolve<Object> {
/**
* @param {SystemService} systemService Products service.
*/
constructor(private systemService: SystemService) { }
constructor(private systemService: SystemService) {}
/**
* Returns the loan product data.
@@ -24,5 +23,4 @@ export class OfficeDatatablesResolver implements Resolve<Object> {
resolve(route: ActivatedRouteSnapshot): Observable<any> {
return this.systemService.getEntityDatatables('m_office');
}
}
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
*/
@Injectable()
export class OfficeResolver implements Resolve<Object> {
/**
* @param {OrganizationService} organizationService Organization service.
*/
@@ -27,5 +26,4 @@ export class OfficeResolver implements Resolve<Object> {
const officeId = route.parent.paramMap.get('officeId');
return this.organizationService.getOffice(officeId);
}
}
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
*/
@Injectable()
export class OfficesResolver implements Resolve<Object> {
/**
* @param {OrganizationService} organizationService Organization service.
*/
@@ -26,5 +25,4 @@ export class OfficesResolver implements Resolve<Object> {
resolve(): Observable<any> {
return this.organizationService.getOffices();
}
}
@@ -8,9 +8,8 @@ describe('CreateOfficeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateOfficeComponent ]
})
.compileComponents();
declarations: [CreateOfficeComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -1,6 +1,5 @@
/** Angular Imports */
import { Component, OnInit, TemplateRef, ElementRef , ViewChild,
AfterViewInit } from '@angular/core';
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router';
@@ -24,7 +23,6 @@ import { ContinueSetupDialogComponent } from '../../../configuration-wizard/cont
styleUrls: ['./create-office.component.scss']
})
export class CreateOfficeComponent implements OnInit, AfterViewInit {
/** Office form. */
officeForm: UntypedFormGroup;
/** Office Data */
@@ -51,15 +49,17 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
* @param {PopoverService} popoverService PopoverService.
*/
constructor(private formBuilder: UntypedFormBuilder,
private organizationService: OrganizationService,
private settingsService: SettingsService,
private router: Router,
private route: ActivatedRoute,
private dateUtils: Dates,
private popoverService: PopoverService,
private configurationWizardService: ConfigurationWizardService,
public dialog: MatDialog) {
constructor(
private formBuilder: UntypedFormBuilder,
private organizationService: OrganizationService,
private settingsService: SettingsService,
private router: Router,
private route: ActivatedRoute,
private dateUtils: Dates,
private popoverService: PopoverService,
private configurationWizardService: ConfigurationWizardService,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { offices: any }) => {
this.officeData = data.offices;
});
@@ -75,10 +75,19 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
*/
createofficeForm() {
this.officeForm = this.formBuilder.group({
'name': ['', Validators.required],
'parentId': ['', Validators.required],
'openingDate': ['', Validators.required],
'externalId': [''],
name: [
'',
Validators.required
],
parentId: [
'',
Validators.required
],
openingDate: [
'',
Validators.required
],
externalId: ['']
});
}
@@ -99,7 +108,7 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
dateFormat,
locale
};
this.organizationService.createOffice(data).subscribe(response => {
this.organizationService.createOffice(data).subscribe((response) => {
if (this.configurationWizardService.showOfficeForm === true) {
this.configurationWizardService.showOfficeForm = false;
this.openDialog();
@@ -116,21 +125,21 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
const continueSetupDialogRef = this.dialog.open(ContinueSetupDialogComponent, {
data: {
stepName: 'office'
},
}
});
continueSetupDialogRef.afterClosed().subscribe((response: { step: number }) => {
if (response.step === 1) {
this.configurationWizardService.showOfficeForm = false;
this.router.navigate(['../'], { relativeTo: this.route });
} else if (response.step === 2) {
this.configurationWizardService.showOfficeForm = true;
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
this.router.onSameUrlNavigation = 'reload';
this.router.navigate(['/organization/offices/create']);
} else if (response.step === 3) {
this.configurationWizardService.showOfficeForm = false;
this.configurationWizardService.showAddEditCurrency = true;
this.router.navigate(['/organization']);
this.configurationWizardService.showOfficeForm = false;
this.router.navigate(['../'], { relativeTo: this.route });
} else if (response.step === 2) {
this.configurationWizardService.showOfficeForm = true;
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
this.router.onSameUrlNavigation = 'reload';
this.router.navigate(['/organization/offices/create']);
} else if (response.step === 3) {
this.configurationWizardService.showOfficeForm = false;
this.configurationWizardService.showAddEditCurrency = true;
this.router.navigate(['/organization']);
}
});
}
@@ -142,7 +151,12 @@ export class CreateOfficeComponent 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);
}
@@ -152,7 +166,7 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
ngAfterViewInit() {
if (this.configurationWizardService.showOfficeForm === true) {
setTimeout(() => {
this.showPopover(this.templateCreateOfficeForm, this.createOfficeFormRef.nativeElement, 'right', true);
this.showPopover(this.templateCreateOfficeForm, this.createOfficeFormRef.nativeElement, 'right', true);
});
}
}
@@ -8,9 +8,8 @@ describe('EditOfficeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditOfficeComponent ]
})
.compileComponents();
declarations: [EditOfficeComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./edit-office.component.scss']
})
export class EditOfficeComponent implements OnInit {
/** Selected Data. */
officeData: any;
/** Office form. */
@@ -27,26 +26,28 @@ export class EditOfficeComponent implements OnInit {
/** Maximum Date allowed. */
maxDate = new Date();
/**
* Retrieves the charge data from `resolve`.
* @param {ProductsService} organizationService Organization Service.
* @param {SettingsService} settingsService Settings Service.
* @param {FormBuilder} formBuilder Form Builder.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
* @param {MatDialog} dialog Dialog reference.
* @param {Dates} dateUtils Date Utils
*/
constructor(private organizationService: OrganizationService,
private settingsService: SettingsService,
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates) {
this.route.data.subscribe((data: { officeTemplate: any }) => {
this.officeData = data.officeTemplate;
});
}
/**
* Retrieves the charge data from `resolve`.
* @param {ProductsService} organizationService Organization Service.
* @param {SettingsService} settingsService Settings Service.
* @param {FormBuilder} formBuilder Form Builder.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
* @param {MatDialog} dialog Dialog reference.
* @param {Dates} dateUtils Date Utils
*/
constructor(
private organizationService: OrganizationService,
private settingsService: SettingsService,
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates
) {
this.route.data.subscribe((data: { officeTemplate: any }) => {
this.officeData = data.officeTemplate;
});
}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
@@ -58,9 +59,15 @@ export class EditOfficeComponent implements OnInit {
*/
createOfficeForm() {
this.officeForm = this.formBuilder.group({
'name': [this.officeData.name, Validators.required],
'openingDate': [this.officeData.openingDate && new Date(this.officeData.openingDate), Validators.required],
'externalId': [this.officeData.externalId],
name: [
this.officeData.name,
Validators.required
],
openingDate: [
this.officeData.openingDate && new Date(this.officeData.openingDate),
Validators.required
],
externalId: [this.officeData.externalId]
});
if (this.officeData.allowedParents.length) {
this.officeForm.addControl('parentId', this.formBuilder.control(this.officeData.parentId, Validators.required));
@@ -87,5 +94,4 @@ export class EditOfficeComponent implements OnInit {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
}
@@ -1,8 +1,7 @@
/**
* Office Node model.
*/
export class OfficeNode {
export class OfficeNode {
/** Office Node children. */
children: OfficeNode[];
@@ -14,13 +13,15 @@
parentName: string;
openingDate: string;
constructor(name: string,
id: string = '',
parentId: string = '',
hierarchy: string = '',
externalId: string = '',
parentName: string = '',
openingDate: string = '') {
constructor(
name: string,
id: string = '',
parentId: string = '',
hierarchy: string = '',
externalId: string = '',
parentName: string = '',
openingDate: string = ''
) {
this.name = name;
this.id = id;
this.parentId = parentId;
@@ -30,5 +31,4 @@
this.openingDate = openingDate;
this.children = [];
}
}
@@ -14,7 +14,6 @@ import { OfficeNode } from './office-node.model';
providedIn: 'root'
})
export class OfficeTreeService {
/** Office data. */
officesData: any;
/** Offices tree data behavior subject to represent offices tree nodes. */
@@ -23,9 +22,11 @@ export class OfficeTreeService {
/**
* Gets the offices tree nodes.
*/
get treeData(): OfficeNode[] { return this.treeDataChange.value; }
get treeData(): OfficeNode[] {
return this.treeDataChange.value;
}
constructor() { }
constructor() {}
/**
* Builds the offices tree and emits the value.
@@ -60,8 +61,15 @@ export class OfficeTreeService {
// Add offices to any array where index for each is denoted by its id
for (const office of officesData) {
offices[office.id] =
new OfficeNode(office.name, office.id, office.parentId, office.hierarchy, office.externalId, office.parentName, office.openingDate);
offices[office.id] = new OfficeNode(
office.name,
office.id,
office.parentId,
office.hierarchy,
office.externalId,
office.parentName,
office.openingDate
);
}
// Construct offices tree by adding all nodes belonging to headers (with parent id = 0),
@@ -77,5 +85,4 @@ export class OfficeTreeService {
}
return officeTree;
}
}
@@ -8,9 +8,8 @@ describe('OfficesComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ OfficesComponent ]
})
.compileComponents();
declarations: [OfficesComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -3,7 +3,7 @@ import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit }
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { ActivatedRoute, Router, } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
/** rxjs Imports */
import { of } from 'rxjs';
@@ -33,7 +33,12 @@ export class OfficesComponent implements OnInit, AfterViewInit {
/** Offices data. */
officesData: any;
/** Columns to be displayed in offices table. */
displayedColumns: string[] = ['name', 'externalId', 'parentName', 'openingDate'];
displayedColumns: string[] = [
'name',
'externalId',
'parentName',
'openingDate'
];
/** Data source for offices table. */
dataSource: MatTableDataSource<any>;
/** Nested tree control for offices tree. */
@@ -52,7 +57,6 @@ export class OfficesComponent implements OnInit, AfterViewInit {
/** Sorter for offices table. */
@ViewChild(MatSort, { static: true }) sort: MatSort;
/* Reference of tree view button */
@ViewChild('buttonTreeView') buttonTreeView: ElementRef<any>;
/* Template for popover on tree view button */
@@ -70,13 +74,15 @@ export class OfficesComponent implements OnInit, AfterViewInit {
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
* @param {PopoverService} popoverService PopoverService.
*/
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private router: Router,
private officeTreeService: OfficeTreeService,
private treeControlService: TreeControlService,
private configurationWizardService: ConfigurationWizardService,
private popoverService: PopoverService) {
this.route.data.subscribe(( data: { offices: any, officeDataTables: any }) => {
private popoverService: PopoverService
) {
this.route.data.subscribe((data: { offices: any; officeDataTables: any }) => {
this.officesData = data.offices;
officeTreeService.initialize(this.officesData);
this.dataTablesData = data.officeDataTables;
@@ -96,7 +102,7 @@ export class OfficesComponent implements OnInit, AfterViewInit {
/**
* Sets the offices table.
*/
ngOnInit() {
ngOnInit() {
this.setOffices();
this.officeTreeService.treeDataChange.subscribe((officeTreeData: OfficeNode[]) => {
this.nestedTreeDataSource.data = officeTreeData;
@@ -118,7 +124,7 @@ export class OfficesComponent implements OnInit, AfterViewInit {
* View selected office.
* @param {OfficeNode} office Office to be viewed.
*/
viewOfficeNode(office: OfficeNode) {
viewOfficeNode(office: OfficeNode) {
if (office.id) {
this.office = office;
} else {
@@ -150,7 +156,12 @@ export class OfficesComponent 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);
}
@@ -160,12 +171,12 @@ export class OfficesComponent implements OnInit, AfterViewInit {
ngAfterViewInit() {
if (this.configurationWizardService.showOfficeList === true) {
setTimeout(() => {
this.showPopover(this.templateButtonTreeView, this.buttonTreeView.nativeElement, 'bottom', true);
this.showPopover(this.templateButtonTreeView, this.buttonTreeView.nativeElement, 'bottom', true);
});
}
if (this.configurationWizardService.showOfficeTable === true) {
setTimeout(() => {
this.showPopover(this.templateTableOffices, this.tableOffices.nativeElement, 'top', true);
this.showPopover(this.templateTableOffices, this.tableOffices.nativeElement, 'top', true);
});
}
}
@@ -196,5 +207,4 @@ export class OfficesComponent implements OnInit, AfterViewInit {
toggleExpandCollapse() {
this.isTreeExpanded = this.treeControlService.toggleExpandCollapse(this.nestedTreeControl, this.isTreeExpanded);
}
}
@@ -8,9 +8,8 @@ describe('DatatableTabsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatatableTabsComponent ]
})
.compileComponents();
declarations: [DatatableTabsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -29,5 +29,4 @@ export class DatatableTabsComponent {
this.multiRowDatatableFlag = this.entityDatatable.columnHeaders[0].columnName === 'id' ? true : false;
});
}
}
@@ -8,9 +8,8 @@ describe('GeneralTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GeneralTabComponent ]
})
.compileComponents();
declarations: [GeneralTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,7 +11,6 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./general-tab.component.scss']
})
export class GeneralTabComponent {
/** Office data */
officeData: any;
@@ -24,5 +23,4 @@ export class GeneralTabComponent {
this.officeData = data.office;
});
}
}
@@ -8,9 +8,8 @@ describe('ViewOfficeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewOfficeComponent ]
})
.compileComponents();
declarations: [ViewOfficeComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,7 +11,6 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./view-office.component.scss']
})
export class ViewOfficeComponent {
/** Office datatables data */
officeDatatables: any;
@@ -24,5 +23,4 @@ export class ViewOfficeComponent {
this.officeDatatables = data.officeDatatables;
});
}
}