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('CreateEmployeeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateEmployeeComponent ]
})
.compileComponents();
declarations: [CreateEmployeeComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -1,5 +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';
@@ -23,7 +23,6 @@ import { ContinueSetupDialogComponent } from '../../../configuration-wizard/cont
styleUrls: ['./create-employee.component.scss']
})
export class CreateEmployeeComponent implements OnInit, AfterViewInit {
/** Minimum joining date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum joining date allowed. */
@@ -50,15 +49,17 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
* @param {PopoverService} popoverService PopoverService.
* @param {MatDialog} dialog MatDialog.
*/
constructor(private formBuilder: UntypedFormBuilder,
private organizationService: OrganizationService,
private settingsService: SettingsService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private configurationWizardService: ConfigurationWizardService,
private popoverService: PopoverService,
public dialog: MatDialog) {
constructor(
private formBuilder: UntypedFormBuilder,
private organizationService: OrganizationService,
private settingsService: SettingsService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private configurationWizardService: ConfigurationWizardService,
private popoverService: PopoverService,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { offices: any }) => {
this.officeData = data.offices;
});
@@ -77,12 +78,28 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
*/
createEmployeeForm() {
this.employeeForm = this.formBuilder.group({
'officeId': ['', Validators.required],
'firstname': ['', [Validators.required, Validators.pattern('(^[A-z]).*')]],
'lastname': ['', [Validators.required, Validators.pattern('(^[A-z]).*')]],
'isLoanOfficer': [false],
'mobileNo': [''],
'joiningDate': ['', Validators.required],
officeId: [
'',
Validators.required
],
firstname: [
'',
[
Validators.required,
Validators.pattern('(^[A-z]).*')]
],
lastname: [
'',
[
Validators.required,
Validators.pattern('(^[A-z]).*')]
],
isLoanOfficer: [false],
mobileNo: [''],
joiningDate: [
'',
Validators.required
]
});
}
@@ -120,7 +137,12 @@ export class CreateEmployeeComponent 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);
}
@@ -130,7 +152,7 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
ngAfterViewInit() {
if (this.configurationWizardService.showEmployeeForm === true) {
setTimeout(() => {
this.showPopover(this.templateCreateEmployeeForm, this.createEmployeeFormRef.nativeElement, 'right', true);
this.showPopover(this.templateCreateEmployeeForm, this.createEmployeeFormRef.nativeElement, 'right', true);
});
}
}
@@ -160,7 +182,7 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
const continueSetupDialogRef = this.dialog.open(ContinueSetupDialogComponent, {
data: {
stepName: 'employee'
},
}
});
continueSetupDialogRef.afterClosed().subscribe((response: { step: number }) => {
if (response.step === 1) {
@@ -178,5 +200,4 @@ export class CreateEmployeeComponent implements OnInit, AfterViewInit {
}
});
}
}
@@ -13,7 +13,6 @@ import { OrganizationService } from '../organization.service';
*/
@Injectable()
export class EditEmployeeResolver implements Resolve<Object> {
/**
* @param {OrganizationService} organizationService Organization service.
*/
@@ -24,8 +23,7 @@ export class EditEmployeeResolver implements Resolve<Object> {
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const employeeId = route.paramMap.get('id');
const employeeId = route.paramMap.get('id');
return this.organizationService.getEmployee(employeeId);
}
}
@@ -8,9 +8,8 @@ describe('EditEmployeeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditEmployeeComponent ]
})
.compileComponents();
declarations: [EditEmployeeComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./edit-employee.component.scss']
})
export class EditEmployeeComponent implements OnInit {
/** Employee data. */
employeeData: any;
/** Minimum joining date allowed. */
@@ -38,13 +37,15 @@ export class EditEmployeeComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {Dates} dateUtils Date Utils to format date.
*/
constructor(private formBuilder: UntypedFormBuilder,
private organizationService: OrganizationService,
private settingsService: SettingsService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates) {
this.route.data.subscribe((data: { employee: any, offices: any }) => {
constructor(
private formBuilder: UntypedFormBuilder,
private organizationService: OrganizationService,
private settingsService: SettingsService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates
) {
this.route.data.subscribe((data: { employee: any; offices: any }) => {
this.employeeData = data.employee;
this.officeData = data.employee.allowedOffices;
});
@@ -63,13 +64,29 @@ export class EditEmployeeComponent implements OnInit {
*/
createEditEmployeeForm() {
this.editEmployeeForm = this.formBuilder.group({
'officeId': [this.employeeData.officeId, Validators.required],
'firstname': [this.employeeData.firstname, [Validators.required, Validators.pattern('(^[A-z]).*')]],
'lastname': [this.employeeData.lastname, [Validators.required, Validators.pattern('(^[A-z]).*')]],
'isLoanOfficer': [this.employeeData.isLoanOfficer],
'mobileNo': [this.employeeData.mobileNo],
'isActive': [this.employeeData.isActive],
'joiningDate': [this.employeeData.joiningDate && new Date(this.employeeData.joiningDate), Validators.required]
officeId: [
this.employeeData.officeId,
Validators.required
],
firstname: [
this.employeeData.firstname,
[
Validators.required,
Validators.pattern('(^[A-z]).*')]
],
lastname: [
this.employeeData.lastname,
[
Validators.required,
Validators.pattern('(^[A-z]).*')]
],
isLoanOfficer: [this.employeeData.isLoanOfficer],
mobileNo: [this.employeeData.mobileNo],
isActive: [this.employeeData.isActive],
joiningDate: [
this.employeeData.joiningDate && new Date(this.employeeData.joiningDate),
Validators.required
]
});
}
@@ -91,8 +108,13 @@ export class EditEmployeeComponent implements OnInit {
locale
};
this.organizationService.updateEmployee(this.employeeData.id, data).subscribe((response: any) => {
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
this.router.navigate(
[
'../../',
response.resourceId
],
{ relativeTo: this.route }
);
});
}
}
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
*/
@Injectable()
export class EmployeeResolver implements Resolve<Object> {
/**
* @param {OrganizationService} organizationService Organization service.
*/
@@ -24,8 +23,7 @@ export class EmployeeResolver implements Resolve<Object> {
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const employeeId = route.paramMap.get('id');
const employeeId = route.paramMap.get('id');
return this.organizationService.getEmployee(employeeId);
}
}
@@ -8,9 +8,8 @@ describe('EmployeesComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EmployeesComponent ]
})
.compileComponents();
declarations: [EmployeesComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -21,11 +21,15 @@ import { ConfigurationWizardService } from '../../configuration-wizard/configura
styleUrls: ['./employees.component.scss']
})
export class EmployeesComponent implements OnInit, AfterViewInit {
/** Employees data. */
employeesData: any;
/** Columns to be displayed in employees table. */
displayedColumns: string[] = ['displayName', 'isLoanOfficer', 'officeName', 'isActive'];
displayedColumns: string[] = [
'displayName',
'isLoanOfficer',
'officeName',
'isActive'
];
/** Data source for employees table. */
dataSource: MatTableDataSource<any>;
@@ -50,11 +54,13 @@ export class EmployeesComponent 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: { employees: any }) => {
constructor(
private route: ActivatedRoute,
private router: Router,
private configurationWizardService: ConfigurationWizardService,
private popoverService: PopoverService
) {
this.route.data.subscribe((data: { employees: any }) => {
this.employeesData = data.employees;
});
}
@@ -90,7 +96,12 @@ export class EmployeesComponent 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);
}
@@ -100,12 +111,12 @@ export class EmployeesComponent implements OnInit, AfterViewInit {
ngAfterViewInit() {
if (this.configurationWizardService.showEmployeeList === true) {
setTimeout(() => {
this.showPopover(this.templateButtonImportEmployees, this.buttonImportEmployees.nativeElement, 'bottom', true);
this.showPopover(this.templateButtonImportEmployees, this.buttonImportEmployees.nativeElement, 'bottom', true);
});
}
if (this.configurationWizardService.showEmployeeTable === true) {
setTimeout(() => {
this.showPopover(this.templateTableEmployees, this.tableEmployees.nativeElement, 'top', true);
this.showPopover(this.templateTableEmployees, this.tableEmployees.nativeElement, 'top', true);
});
}
}
@@ -129,5 +140,4 @@ export class EmployeesComponent implements OnInit, AfterViewInit {
this.configurationWizardService.showCreateEmployee = true;
this.router.navigate(['/organization']);
}
}
@@ -13,7 +13,6 @@ import { OrganizationService } from '../organization.service';
*/
@Injectable()
export class EmployeesResolver implements Resolve<Object> {
/**
* @param {OrganizationService} organizationService Organization service.
*/
@@ -26,5 +25,4 @@ export class EmployeesResolver implements Resolve<Object> {
resolve(): Observable<any> {
return this.organizationService.getEmployees();
}
}
@@ -8,9 +8,8 @@ describe('ViewEmployeeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewEmployeeComponent ]
})
.compileComponents();
declarations: [ViewEmployeeComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,7 +11,6 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./view-employee.component.scss']
})
export class ViewEmployeeComponent {
/** Employee data. */
employeeData: any;
@@ -24,5 +23,4 @@ export class ViewEmployeeComponent {
this.employeeData = data.employee;
});
}
}