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('ClientAddressStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientAddressStepComponent ]
})
.compileComponents();
declarations: [ClientAddressStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -21,7 +21,6 @@ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.componen
styleUrls: ['./client-address-step.component.scss']
})
export class ClientAddressStepComponent {
/** Client Address Field Config */
@Input() clientAddressFieldConfig: any;
/** Client Template */
@@ -34,8 +33,10 @@ export class ClientAddressStepComponent {
* @param {MatDialog} dialog Mat Dialog
* @param {TranslateService} translateService Translate Service.
*/
constructor(private dialog: MatDialog,
private translateService: TranslateService) {
constructor(
private dialog: MatDialog,
private translateService: TranslateService
) {
this.clientAddressData = [];
}
@@ -44,7 +45,12 @@ export class ClientAddressStepComponent {
*/
addAddress() {
const data = {
title: this.translateService.instant('labels.buttons.Add') + ' ' + this.translateService.instant('labels.catalogs.Client') + ' ' + this.translateService.instant('labels.heading.Address'),
title:
this.translateService.instant('labels.buttons.Add') +
' ' +
this.translateService.instant('labels.catalogs.Client') +
' ' +
this.translateService.instant('labels.heading.Address'),
formfields: this.getAddressFormFields()
};
const addAddressDialogRef = this.dialog.open(FormDialogComponent, { data, width: '50rem' });
@@ -69,7 +75,12 @@ export class ClientAddressStepComponent {
*/
editAddress(address: any, index: number) {
const data = {
title: this.translateService.instant('labels.buttons.Edit') + ' ' + this.translateService.instant('labels.catalogs.Client') + ' ' + this.translateService.instant('labels.heading.Address'),
title:
this.translateService.instant('labels.buttons.Edit') +
' ' +
this.translateService.instant('labels.catalogs.Client') +
' ' +
this.translateService.instant('labels.heading.Address'),
formfields: this.getAddressFormFields(address),
layout: { addButtonText: 'Edit' }
};
@@ -94,7 +105,9 @@ export class ClientAddressStepComponent {
*/
deleteAddress(address: any, index: number) {
const deleteAddressDialogRef = this.dialog.open(DeleteDialogComponent, {
data: { deleteContext: `${this.translateService.instant('labels.heading.Address')} ${this.translateService.instant('labels.inputs.Type')} : ${address.addressType} ${index}` }
data: {
deleteContext: `${this.translateService.instant('labels.heading.Address')} ${this.translateService.instant('labels.inputs.Type')} : ${address.addressType} ${index}`
}
});
deleteAddressDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
@@ -116,7 +129,7 @@ export class ClientAddressStepComponent {
* @param {any} address Address
*/
isFieldEnabled(fieldName: any) {
return (this.clientAddressFieldConfig.find((fieldObj: any) => fieldObj.field === fieldName))?.isEnabled;
return this.clientAddressFieldConfig.find((fieldObj: any) => fieldObj.field === fieldName)?.isEnabled;
}
/**
@@ -125,7 +138,7 @@ export class ClientAddressStepComponent {
* @param {any} address Address
*/
getSelectedValue(fieldName: any, fieldId: any) {
return (this.clientTemplate.address[0][fieldName].find((fieldObj: any) => fieldObj.id === fieldId));
return this.clientTemplate.address[0][fieldName].find((fieldObj: any) => fieldObj.id === fieldId);
}
/**
@@ -136,89 +149,135 @@ export class ClientAddressStepComponent {
let formfields: FormfieldBase[] = [];
for (let index = 0; index < this.clientTemplate.address[0].addressTypeIdOptions.length; index++) {
this.clientTemplate.address[0].addressTypeIdOptions[index].name = this.translateService.instant(`labels.catalogs.${this.clientTemplate.address[0].addressTypeIdOptions[index].name}`);
this.clientTemplate.address[0].addressTypeIdOptions[index].name = this.translateService.instant(
`labels.catalogs.${this.clientTemplate.address[0].addressTypeIdOptions[index].name}`
);
}
formfields.push(this.isFieldEnabled('addressType') ? new SelectBase({
controlName: 'addressTypeId',
label: this.translateService.instant('labels.inputs.Address Type'),
value: address ? address.addressTypeId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].addressTypeIdOptions },
order: 1,
required: true
}) : null);
formfields.push(this.isFieldEnabled('street') ? new InputBase({
controlName: 'street',
label: this.translateService.instant('labels.inputs.Street'),
value: address ? address.street : '',
type: 'text',
required: true,
order: 2
}) : null);
formfields.push(this.isFieldEnabled('addressLine1') ? new InputBase({
controlName: 'addressLine1',
label: this.translateService.instant('labels.inputs.Address Line') + ' 1',
value: address ? address.addressLine1 : '',
type: 'text',
order: 3
}) : null);
formfields.push(this.isFieldEnabled('addressLine2') ? new InputBase({
controlName: 'addressLine2',
label: this.translateService.instant('labels.inputs.Address Line') + ' 2',
value: address ? address.addressLine2 : '',
type: 'text',
order: 4
}) : null);
formfields.push(this.isFieldEnabled('addressLine3') ? new InputBase({
controlName: 'addressLine3',
label: this.translateService.instant('labels.inputs.Address Line') + ' 3',
value: address ? address.addressLine3 : '',
type: 'text',
order: 5
}) : null);
formfields.push(this.isFieldEnabled('townVillage') ? new InputBase({
controlName: 'townVillage',
label: this.translateService.instant('labels.inputs.Town / Village'),
value: address ? address.townVillage : '',
type: 'text',
order: 6
}) : null);
formfields.push(this.isFieldEnabled('city') ? new InputBase({
controlName: 'city',
label: this.translateService.instant('labels.inputs.City'),
value: address ? address.city : '',
type: 'text',
order: 7
}) : null);
formfields.push(this.isFieldEnabled('stateProvinceId') ? new SelectBase({
controlName: 'stateProvinceId',
label: this.translateService.instant('labels.inputs.State / Province'),
value: address ? address.stateProvinceId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].stateProvinceIdOptions },
order: 8
}) : null);
formfields.push(this.isFieldEnabled('countyDistrict') ? new InputBase({
controlName: 'countryDistrict',
label: this.translateService.instant('labels.inputs.Country District'),
value: address ? address.countyDistrict : '',
type: 'text',
order: 11
}) : null);
formfields.push(this.isFieldEnabled('countryId') ? new SelectBase({
controlName: 'countryId',
label: this.translateService.instant('labels.inputs.Country'),
value: address ? address.countryId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].countryIdOptions },
order: 10
}) : null);
formfields.push(this.isFieldEnabled('postalCode') ? new InputBase({
controlName: 'postalCode',
label: this.translateService.instant('labels.inputs.Postal Code'),
value: address ? address.postalCode : '',
type: 'text',
order: 11
}) : null);
formfields = formfields.filter(field => field !== null);
formfields.push(
this.isFieldEnabled('addressType')
? new SelectBase({
controlName: 'addressTypeId',
label: this.translateService.instant('labels.inputs.Address Type'),
value: address ? address.addressTypeId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].addressTypeIdOptions },
order: 1,
required: true
})
: null
);
formfields.push(
this.isFieldEnabled('street')
? new InputBase({
controlName: 'street',
label: this.translateService.instant('labels.inputs.Street'),
value: address ? address.street : '',
type: 'text',
required: true,
order: 2
})
: null
);
formfields.push(
this.isFieldEnabled('addressLine1')
? new InputBase({
controlName: 'addressLine1',
label: this.translateService.instant('labels.inputs.Address Line') + ' 1',
value: address ? address.addressLine1 : '',
type: 'text',
order: 3
})
: null
);
formfields.push(
this.isFieldEnabled('addressLine2')
? new InputBase({
controlName: 'addressLine2',
label: this.translateService.instant('labels.inputs.Address Line') + ' 2',
value: address ? address.addressLine2 : '',
type: 'text',
order: 4
})
: null
);
formfields.push(
this.isFieldEnabled('addressLine3')
? new InputBase({
controlName: 'addressLine3',
label: this.translateService.instant('labels.inputs.Address Line') + ' 3',
value: address ? address.addressLine3 : '',
type: 'text',
order: 5
})
: null
);
formfields.push(
this.isFieldEnabled('townVillage')
? new InputBase({
controlName: 'townVillage',
label: this.translateService.instant('labels.inputs.Town / Village'),
value: address ? address.townVillage : '',
type: 'text',
order: 6
})
: null
);
formfields.push(
this.isFieldEnabled('city')
? new InputBase({
controlName: 'city',
label: this.translateService.instant('labels.inputs.City'),
value: address ? address.city : '',
type: 'text',
order: 7
})
: null
);
formfields.push(
this.isFieldEnabled('stateProvinceId')
? new SelectBase({
controlName: 'stateProvinceId',
label: this.translateService.instant('labels.inputs.State / Province'),
value: address ? address.stateProvinceId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].stateProvinceIdOptions },
order: 8
})
: null
);
formfields.push(
this.isFieldEnabled('countyDistrict')
? new InputBase({
controlName: 'countryDistrict',
label: this.translateService.instant('labels.inputs.Country District'),
value: address ? address.countyDistrict : '',
type: 'text',
order: 11
})
: null
);
formfields.push(
this.isFieldEnabled('countryId')
? new SelectBase({
controlName: 'countryId',
label: this.translateService.instant('labels.inputs.Country'),
value: address ? address.countryId : '',
options: { label: 'name', value: 'id', data: this.clientTemplate.address[0].countryIdOptions },
order: 10
})
: null
);
formfields.push(
this.isFieldEnabled('postalCode')
? new InputBase({
controlName: 'postalCode',
label: this.translateService.instant('labels.inputs.Postal Code'),
value: address ? address.postalCode : '',
type: 'text',
order: 11
})
: null
);
formfields = formfields.filter((field) => field !== null);
return formfields;
}
@@ -228,5 +287,4 @@ export class ClientAddressStepComponent {
get address() {
return { address: this.clientAddressData ? this.clientAddressData : [] };
}
}
@@ -8,9 +8,8 @@ describe('ClientDatatableStepComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ClientDatatableStepComponent ]
})
.compileComponents();
declarations: [ClientDatatableStepComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -16,9 +16,11 @@ export class ClientDatatableStepComponent implements OnInit {
datatableInputs: any = [];
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService,
private datatableService: Datatables) { }
private datatableService: Datatables
) {}
ngOnInit(): void {
this.datatableInputs = this.datatableService.filterSystemColumns(this.datatableData.columnHeaderData);
@@ -70,13 +72,13 @@ export class ClientDatatableStepComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const datatableDataValues = this.datatableForm.value;
const data = this.datatableService.buildPayload(this.datatableInputs, datatableDataValues, dateFormat,
{ locale: this.settingsService.language.code });
const data = this.datatableService.buildPayload(this.datatableInputs, datatableDataValues, dateFormat, {
locale: this.settingsService.language.code
});
return {
registeredTableName: this.datatableData.registeredTableName,
data: data
};
}
}
@@ -8,9 +8,8 @@ describe('ClientFamilyMemberDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientFamilyMemberDialogComponent ]
})
.compileComponents();
declarations: [ClientFamilyMemberDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./client-family-member-dialog.component.scss']
})
export class ClientFamilyMemberDialogComponent implements OnInit {
/** Maximum Due Date allowed. */
maxDate = new Date();
@@ -30,28 +29,30 @@ export class ClientFamilyMemberDialogComponent implements OnInit {
* @param {any} data Dialog Data
* @param {SettingsService} settingsService Setting service
*/
constructor(public dialogRef: MatDialogRef<ClientFamilyMemberDialogComponent>,
private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
@Inject(MAT_DIALOG_DATA) public data: any,
private settingsService: SettingsService) { }
constructor(
public dialogRef: MatDialogRef<ClientFamilyMemberDialogComponent>,
private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
@Inject(MAT_DIALOG_DATA) public data: any,
private settingsService: SettingsService
) {}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
this.createFamilyMemberForm();
if (this.data.context === 'Edit') {
this.familyMemberForm.patchValue({
'firstName': this.data.member.firstName,
'middleName': this.data.member.middleName,
'lastName': this.data.member.lastName,
'qualification': this.data.member.qualification,
'age': this.data.member.age,
'isDependent': this.data.member.isDependent,
'relationshipId': this.data.member.relationshipId,
'genderId': this.data.member.genderId,
'professionId': this.data.member.professionId,
'maritalStatusId': this.data.member.maritalStatusId,
'dateOfBirth': this.data.member.dateOfBirth && new Date(this.data.member.dateOfBirth)
firstName: this.data.member.firstName,
middleName: this.data.member.middleName,
lastName: this.data.member.lastName,
qualification: this.data.member.qualification,
age: this.data.member.age,
isDependent: this.data.member.isDependent,
relationshipId: this.data.member.relationshipId,
genderId: this.data.member.genderId,
professionId: this.data.member.professionId,
maritalStatusId: this.data.member.maritalStatusId,
dateOfBirth: this.data.member.dateOfBirth && new Date(this.data.member.dateOfBirth)
});
}
}
@@ -61,17 +62,35 @@ export class ClientFamilyMemberDialogComponent implements OnInit {
*/
createFamilyMemberForm() {
this.familyMemberForm = this.formBuilder.group({
'firstName': ['', Validators.required],
'middleName': [''],
'lastName': ['', Validators.required],
'qualification': [''],
'age': ['', Validators.required],
'isDependent': [''],
'relationshipId': ['', Validators.required],
'genderId': ['', Validators.required],
'professionId': [''],
'maritalStatusId': [''],
'dateOfBirth': ['', Validators.required]
firstName: [
'',
Validators.required
],
middleName: [''],
lastName: [
'',
Validators.required
],
qualification: [''],
age: [
'',
Validators.required
],
isDependent: [''],
relationshipId: [
'',
Validators.required
],
genderId: [
'',
Validators.required
],
professionId: [''],
maritalStatusId: [''],
dateOfBirth: [
'',
Validators.required
]
});
}
@@ -97,5 +116,4 @@ export class ClientFamilyMemberDialogComponent implements OnInit {
}
return familyMember;
}
}
@@ -8,9 +8,8 @@ describe('ClientFamilyMembersStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientFamilyMembersStepComponent ]
})
.compileComponents();
declarations: [ClientFamilyMembersStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { ClientFamilyMemberDialogComponent } from './client-family-member-dialog
styleUrls: ['./client-family-members-step.component.scss']
})
export class ClientFamilyMembersStepComponent {
/** Cient Template */
@Input() clientTemplate: any;
/** Client Family Members */
@@ -26,8 +25,10 @@ export class ClientFamilyMembersStepComponent {
* @param {MatDialog} dialog Mat Dialog
* @param {TranslateService} translateService Translate Service.
*/
constructor(public dialog: MatDialog,
private translateService: TranslateService) { }
constructor(
public dialog: MatDialog,
private translateService: TranslateService
) {}
/**
* Adds a family member.
@@ -36,7 +37,7 @@ export class ClientFamilyMembersStepComponent {
const addFamilyMemberDialogRef = this.dialog.open(ClientFamilyMemberDialogComponent, {
data: {
context: this.translateService.instant('labels.buttons.Add'),
options: this.clientTemplate.familyMemberOptions,
options: this.clientTemplate.familyMemberOptions
},
width: '50rem'
});
@@ -57,7 +58,7 @@ export class ClientFamilyMembersStepComponent {
data: {
context: 'Edit',
member: member,
options: this.clientTemplate.familyMemberOptions,
options: this.clientTemplate.familyMemberOptions
},
width: '50rem'
});
@@ -88,5 +89,4 @@ export class ClientFamilyMembersStepComponent {
get familyMembers() {
return { familyMembers: this.clientFamilyMembers };
}
}
@@ -8,9 +8,8 @@ describe('ClientGeneralStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientGeneralStepComponent ]
})
.compileComponents();
declarations: [ClientGeneralStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./client-general-step.component.scss']
})
export class ClientGeneralStepComponent implements OnInit {
@Output() legalFormChangeEvent = new EventEmitter<{ legalForm: number }>();
/** Minimum date allowed. */
@@ -54,10 +53,12 @@ export class ClientGeneralStepComponent implements OnInit {
* @param {SettingsService} settingsService Setting service
* @param {ClientsService} clientService Client service
*/
constructor(private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
private settingsService: SettingsService,
private clientService: ClientsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private dateUtils: Dates,
private settingsService: SettingsService,
private clientService: ClientsService
) {
this.setClientForm();
}
@@ -72,21 +73,33 @@ export class ClientGeneralStepComponent implements OnInit {
*/
setClientForm() {
this.createClientForm = this.formBuilder.group({
'officeId': ['', Validators.required],
'staffId': [''],
'legalFormId': ['', Validators.required],
'isStaff': [false],
'active': [false],
'addSavings': [false],
'accountNo': [''],
'externalId': [''],
'genderId': [''],
'mobileNo': [''],
'emailAddress': ['', Validators.email],
'dateOfBirth': [''],
'clientTypeId': [''],
'clientClassificationId': [''],
'submittedOnDate': [this.settingsService.businessDate, Validators.required]
officeId: [
'',
Validators.required
],
staffId: [''],
legalFormId: [
'',
Validators.required
],
isStaff: [false],
active: [false],
addSavings: [false],
accountNo: [''],
externalId: [''],
genderId: [''],
mobileNo: [''],
emailAddress: [
'',
Validators.email
],
dateOfBirth: [''],
clientTypeId: [''],
clientClassificationId: [''],
submittedOnDate: [
this.settingsService.businessDate,
Validators.required
]
});
}
@@ -114,21 +127,42 @@ export class ClientGeneralStepComponent implements OnInit {
if (legalFormId === 1) {
this.createClientForm.removeControl('fullname');
this.createClientForm.removeControl('clientNonPersonDetails');
this.createClientForm.addControl('firstname', new UntypedFormControl('', [Validators.required, Validators.pattern('(^[A-z]).*')]));
this.createClientForm.addControl(
'firstname',
new UntypedFormControl('', [
Validators.required,
Validators.pattern('(^[A-z]).*')])
);
this.createClientForm.addControl('middlename', new UntypedFormControl('', Validators.pattern('(^[A-z]).*')));
this.createClientForm.addControl('lastname', new UntypedFormControl('', [Validators.required, Validators.pattern('(^[A-z]).*')]));
this.createClientForm.addControl(
'lastname',
new UntypedFormControl('', [
Validators.required,
Validators.pattern('(^[A-z]).*')])
);
} else {
this.createClientForm.removeControl('firstname');
this.createClientForm.removeControl('middlename');
this.createClientForm.removeControl('lastname');
this.createClientForm.addControl('fullname', new UntypedFormControl('', [Validators.required, Validators.pattern('(^[A-z]).*')]));
this.createClientForm.addControl('clientNonPersonDetails', this.formBuilder.group({
'constitutionId': ['', Validators.required],
'incorpValidityTillDate': [''],
'incorpNumber': [''],
'mainBusinessLineId': [''],
'remarks': ['']
}));
this.createClientForm.addControl(
'fullname',
new UntypedFormControl('', [
Validators.required,
Validators.pattern('(^[A-z]).*')])
);
this.createClientForm.addControl(
'clientNonPersonDetails',
this.formBuilder.group({
constitutionId: [
'',
Validators.required
],
incorpValidityTillDate: [''],
incorpNumber: [''],
mainBusinessLineId: [''],
remarks: ['']
})
);
}
});
this.createClientForm.get('legalFormId').patchValue(1);
@@ -189,5 +223,4 @@ export class ClientGeneralStepComponent implements OnInit {
}
return generalDetails;
}
}
@@ -8,9 +8,8 @@ describe('ClientPreviewStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClientPreviewStepComponent ]
})
.compileComponents();
declarations: [ClientPreviewStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -10,7 +10,6 @@ import { Component, Output, EventEmitter, Input } from '@angular/core';
styleUrls: ['./client-preview-step.component.scss']
})
export class ClientPreviewStepComponent {
/** Client Address field configuration */
@Input() clientAddressFieldConfig: any;
/** Client Template */
@@ -21,7 +20,7 @@ export class ClientPreviewStepComponent {
/** Form submission event */
@Output() submitEvent = new EventEmitter();
constructor() { }
constructor() {}
/**
* Utilized in address preview.
@@ -30,7 +29,7 @@ export class ClientPreviewStepComponent {
* @param {any} fieldId Field Id
*/
getSelectedValue(fieldName: any, fieldId: any) {
return (this.clientTemplate.address[0][fieldName].find((fieldObj: any) => fieldObj.id === fieldId));
return this.clientTemplate.address[0][fieldName].find((fieldObj: any) => fieldObj.id === fieldId);
}
/**
@@ -38,7 +37,6 @@ export class ClientPreviewStepComponent {
* @param {any} fieldName Field Name
*/
isFieldEnabled(fieldName: any) {
return (this.clientAddressFieldConfig.find((fieldObj: any) => fieldObj.field === fieldName))?.isEnabled;
return this.clientAddressFieldConfig.find((fieldObj: any) => fieldObj.field === fieldName)?.isEnabled;
}
}