+15
@@ -0,0 +1,15 @@
|
||||
<h1 mat-dialog-title>View Client Signature</h1>
|
||||
|
||||
<div *ngIf="signatureId" mat-dialog-content>
|
||||
<img [src]="signatureImage" alt="Signature">
|
||||
</div>
|
||||
|
||||
<div *ngIf="!signatureId" mat-dialog-content>
|
||||
<p>Client Signature is not provided.</p>
|
||||
</div>
|
||||
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-dialog-close>Close</button>
|
||||
<button mat-raised-button *ngIf="signatureId" color="warn" [mat-dialog-close]="{ delete: true }">Delete</button>
|
||||
<button mat-raised-button color="primary" [mat-dialog-close]="{ upload: true }">{{ signatureId ? 'Reupload' : 'Upload'}}</button>
|
||||
</mat-dialog-actions>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ViewSignatureDialogComponent } from './view-signature-dialog.component';
|
||||
|
||||
describe('ViewSignatureDialogComponent', () => {
|
||||
let component: ViewSignatureDialogComponent;
|
||||
let fixture: ComponentFixture<ViewSignatureDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewSignatureDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ViewSignatureDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/** Angular Imports */
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
/** Custom Services */
|
||||
import { ClientsService } from 'app/clients/clients.service';
|
||||
|
||||
/**
|
||||
* View signature dialog component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-view-signature-dialog',
|
||||
templateUrl: './view-signature-dialog.component.html',
|
||||
styleUrls: ['./view-signature-dialog.component.scss']
|
||||
})
|
||||
export class ViewSignatureDialogComponent implements OnInit {
|
||||
|
||||
/** Id of client signature in documents */
|
||||
signatureId: any;
|
||||
/** Signature Image */
|
||||
signatureImage: any;
|
||||
/** Client Id */
|
||||
clientId: any;
|
||||
|
||||
/**
|
||||
* @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 }) {
|
||||
const signature = this.data.documents.find((document: any) => document.name === 'clientSignature') || {};
|
||||
this.signatureId = signature.id;
|
||||
this.clientId = this.data.id;
|
||||
console.log(this.clientId);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.signatureId) {
|
||||
this.clientsService.getClientSignatureImage(this.clientId, this.signatureId).subscribe(
|
||||
(base64Image: any) => {
|
||||
this.signatureImage = this.sanitizer.bypassSecurityTrustResourceUrl(base64Image);
|
||||
}, (error: any) => {}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user