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('CaptureImageDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CaptureImageDialogComponent ]
})
.compileComponents();
declarations: [CaptureImageDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,7 +11,6 @@ import { MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./capture-image-dialog.component.scss']
})
export class CaptureImageDialogComponent implements AfterViewInit, OnDestroy {
/** Video element reference */
@ViewChild('video', { static: true }) video: ElementRef;
/** Canvas element reference */
@@ -30,8 +29,10 @@ export class CaptureImageDialogComponent implements AfterViewInit, OnDestroy {
* @param {MatDialogRef} dialogRef Mat Dialog Reference
* @param {Renderer2} renderer Template Renderer
*/
constructor(public dialogRef: MatDialogRef<CaptureImageDialogComponent>,
private renderer: Renderer2) {}
constructor(
public dialogRef: MatDialogRef<CaptureImageDialogComponent>,
private renderer: Renderer2
) {}
ngAfterViewInit() {
this.startCamera();
@@ -48,14 +49,15 @@ export class CaptureImageDialogComponent implements AfterViewInit, OnDestroy {
*/
startCamera() {
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({ video: true })
.then((stream: MediaStream) => {
this.renderer.setProperty(this.video.nativeElement, 'srcObject', stream);
this.video.nativeElement.play();
})
.catch((error: Error) => {
this.handleError(error);
});
navigator.mediaDevices
.getUserMedia({ video: true })
.then((stream: MediaStream) => {
this.renderer.setProperty(this.video.nativeElement, 'srcObject', stream);
this.video.nativeElement.play();
})
.catch((error: Error) => {
this.handleError(error);
});
} else {
throw new Error('Cannot connect to camera');
}
@@ -104,5 +106,4 @@ export class CaptureImageDialogComponent implements AfterViewInit, OnDestroy {
this.isCaptured = false;
this.video.nativeElement.play();
}
}
@@ -8,9 +8,8 @@ describe('DeleteSignatureDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DeleteSignatureDialogComponent ]
})
.compileComponents();
declarations: [DeleteSignatureDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,7 +11,6 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./delete-signature-dialog.component.scss']
})
export class DeleteSignatureDialogComponent {
/** Id of client signature in documents */
signatureId: any;
@@ -19,10 +18,11 @@ export class DeleteSignatureDialogComponent {
* @param {MatDialogRef} dialogRef Component reference to dialog.
* @param {any} data Documents data
*/
constructor(public dialogRef: MatDialogRef<DeleteSignatureDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any[]) {
constructor(
public dialogRef: MatDialogRef<DeleteSignatureDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any[]
) {
const signature = this.data.find((document: any) => document.name === 'clientSignature') || {};
this.signatureId = signature.id;
}
}
@@ -8,9 +8,8 @@ describe('EditNotesDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditNotesDialogComponent ]
})
.compileComponents();
declarations: [EditNotesDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,9 +11,11 @@ import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms
export class EditNotesDialogComponent implements OnInit {
noteForm: UntypedFormGroup;
constructor(public dialogRef: MatDialogRef<EditNotesDialogComponent>,
constructor(
public dialogRef: MatDialogRef<EditNotesDialogComponent>,
private formBuilder: UntypedFormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any) { }
@Inject(MAT_DIALOG_DATA) public data: any
) {}
ngOnInit() {
this.createNoteForm();
@@ -21,7 +23,10 @@ export class EditNotesDialogComponent implements OnInit {
createNoteForm() {
this.noteForm = this.formBuilder.group({
'note': [this.data.noteContent, Validators.required]
note: [
this.data.noteContent,
Validators.required
]
});
}
}
@@ -8,9 +8,8 @@ describe('UnassignStaffDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UnassignStaffDialogComponent ]
})
.compileComponents();
declarations: [UnassignStaffDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,10 +11,8 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./unassign-staff-dialog.component.scss']
})
export class UnassignStaffDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
*/
constructor(public dialogRef: MatDialogRef<UnassignStaffDialogComponent>) { }
constructor(public dialogRef: MatDialogRef<UnassignStaffDialogComponent>) {}
}
@@ -8,9 +8,8 @@ describe('UploadDocumentDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UploadDocumentDialogComponent ]
})
.compileComponents();
declarations: [UploadDocumentDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -8,7 +8,6 @@ import { UntypedFormGroup, UntypedFormBuilder, Validators, FormControl } from '@
styleUrls: ['./upload-document-dialog.component.scss']
})
export class UploadDocumentDialogComponent implements OnInit {
/** Upload Document form. */
uploadDocumentForm: UntypedFormGroup;
/** Upload Document Data */
@@ -23,9 +22,11 @@ export class UploadDocumentDialogComponent implements OnInit {
* @param {FormBuilder} formBuilder Form Builder
* @param {any} data Dialog Data
*/
constructor(public dialogRef: MatDialogRef<UploadDocumentDialogComponent>,
private formBuilder: UntypedFormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any) {
constructor(
public dialogRef: MatDialogRef<UploadDocumentDialogComponent>,
private formBuilder: UntypedFormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.documentIdentifier = data.documentIdentifier;
this.entityType = data.entityType;
}
@@ -39,9 +40,12 @@ export class UploadDocumentDialogComponent implements OnInit {
*/
createUploadDocumentForm() {
this.uploadDocumentForm = this.formBuilder.group({
'fileName': ['', Validators.required],
'description': [''],
'file': ['']
fileName: [
'',
Validators.required
],
description: [''],
file: ['']
});
}
@@ -55,7 +59,4 @@ export class UploadDocumentDialogComponent implements OnInit {
this.uploadDocumentForm.get('file').setValue(file);
}
}
}
@@ -8,9 +8,8 @@ describe('UploadImageDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UploadImageDialogComponent ]
})
.compileComponents();
declarations: [UploadImageDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,14 +11,13 @@ import { MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./upload-image-dialog.component.scss']
})
export class UploadImageDialogComponent {
/** Client Image */
image: File;
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
*/
constructor(public dialogRef: MatDialogRef<UploadImageDialogComponent>) { }
constructor(public dialogRef: MatDialogRef<UploadImageDialogComponent>) {}
/**
* Sets file form control value.
@@ -29,5 +28,4 @@ export class UploadImageDialogComponent {
this.image = $event.target.files[0];
}
}
}
@@ -8,9 +8,8 @@ describe('UploadSignatureDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UploadSignatureDialogComponent ]
})
.compileComponents();
declarations: [UploadSignatureDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,14 +11,13 @@ import { MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./upload-signature-dialog.component.scss']
})
export class UploadSignatureDialogComponent {
/** Client Signature */
signature: File;
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
*/
constructor(public dialogRef: MatDialogRef<UploadSignatureDialogComponent>) { }
constructor(public dialogRef: MatDialogRef<UploadSignatureDialogComponent>) {}
/**
* Sets file form control value.
@@ -29,5 +28,4 @@ export class UploadSignatureDialogComponent {
this.signature = $event.target.files[0];
}
}
}
@@ -8,9 +8,8 @@ describe('ViewSignatureDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewSignatureDialogComponent ]
})
.compileComponents();
declarations: [ViewSignatureDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Buffer } from 'buffer';
styleUrls: ['./view-signature-dialog.component.scss']
})
export class ViewSignatureDialogComponent implements OnInit {
/** Id of client signature in documents */
signatureId: any;
/** Signature Image */
@@ -30,10 +29,12 @@ export class ViewSignatureDialogComponent implements OnInit {
* @param {MatDialogRef} dialogRef Component reference to dialog.
* @param {any} data Documents data
*/
constructor(public dialogRef: MatDialogRef<ViewSignatureDialogComponent>,
private clientsService: ClientsService,
private sanitizer: DomSanitizer,
@Inject(MAT_DIALOG_DATA) public data: { documents: any[], id: string }) {
constructor(
public dialogRef: MatDialogRef<ViewSignatureDialogComponent>,
private clientsService: ClientsService,
private sanitizer: DomSanitizer,
@Inject(MAT_DIALOG_DATA) public data: { documents: any[]; id: string }
) {
const signature = this.data.documents.find((document: any) => document.name === 'clientSignature') || {};
this.signatureId = signature.id;
this.clientId = this.data.id;
@@ -43,11 +44,11 @@ export class ViewSignatureDialogComponent implements OnInit {
if (this.signatureId) {
this.clientsService.getClientSignatureImage(this.clientId, this.signatureId).subscribe(
async (blob: any) => {
const buffer = Buffer.from(await blob.arrayBuffer())
const buffer = Buffer.from(await blob.arrayBuffer());
this.signatureImage = 'data:' + blob.type + ';base64,' + buffer.toString('base64');
}, (error: any) => {}
},
(error: any) => {}
);
}
}
}