fix: Client signature
The functionality to store and show client signatures was broken.
This commit is contained in:
+1
-1
@@ -11,5 +11,5 @@
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-dialog-close>{{"labels.buttons.Close" | translate}}</button>
|
||||
<button mat-raised-button *ngIf="signatureId" color="warn" [mat-dialog-close]="{ delete: true }">{{"labels.buttons.Delete" | translate}}</button>
|
||||
<button mat-raised-button color="primary" [mat-dialog-close]="{ upload: true }">{{ signatureId ? 'Reupload' : 'Upload'}}</button>
|
||||
<button mat-raised-button *ngIf="!signatureId" color="primary" [mat-dialog-close]="{ upload: true }">{{"labels.buttons.Upload" | translate}}</button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
+6
-2
@@ -6,6 +6,9 @@ import { DomSanitizer } from '@angular/platform-browser';
|
||||
/** Custom Services */
|
||||
import { ClientsService } from 'app/clients/clients.service';
|
||||
|
||||
/** Node Types */
|
||||
import { Buffer } from 'buffer';
|
||||
|
||||
/**
|
||||
* View signature dialog component.
|
||||
*/
|
||||
@@ -39,8 +42,9 @@ export class ViewSignatureDialogComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
if (this.signatureId) {
|
||||
this.clientsService.getClientSignatureImage(this.clientId, this.signatureId).subscribe(
|
||||
(base64Image: any) => {
|
||||
this.signatureImage = this.sanitizer.bypassSecurityTrustResourceUrl(base64Image);
|
||||
async (blob: any) => {
|
||||
const buffer = Buffer.from(await blob.arrayBuffer())
|
||||
this.signatureImage = 'data:' + blob.type + ';base64,' + buffer.toString('base64');
|
||||
}, (error: any) => {}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -181,13 +181,13 @@ export class ClientsService {
|
||||
uploadClientSignatureImage(clientId: string, signature: File) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', signature);
|
||||
formData.append('filename', signature.name);
|
||||
return this.http.post(`/clients/${clientId}/images`, formData);
|
||||
formData.append('name', 'clientSignature');
|
||||
formData.append('description', 'Client signature');
|
||||
return this.http.post(`/clients/${clientId}/documents`, formData);
|
||||
}
|
||||
|
||||
getClientSignatureImage(clientId: string, documentId: string) {
|
||||
const httpParams = new HttpParams().set('tenantIdentifier', 'default');
|
||||
return this.http.get(`/clients/${clientId}/documents/${documentId}/attachment`, { params: httpParams, responseType: 'blob' });
|
||||
return this.http.get(`/clients/${clientId}/documents/${documentId}/attachment`, { responseType: 'blob' });
|
||||
}
|
||||
|
||||
getClientFamilyMembers(clientId: string) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"baseUrl": "./",
|
||||
"types": []
|
||||
"types": ["node"]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": true,
|
||||
|
||||
Reference in New Issue
Block a user