+15
@@ -0,0 +1,15 @@
|
||||
<h1 mat-dialog-title>Delete Client Signature</h1>
|
||||
|
||||
<div *ngIf="signatureId" mat-dialog-content>
|
||||
<p>Are you sure you want to delete this clients signature ?</p>
|
||||
</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>Cancel</button>
|
||||
<button mat-raised-button *ngIf="signatureId" color="warn" [mat-dialog-close]="{ delete: true, id: signatureId }">Confirm</button>
|
||||
<button mat-raised-button *ngIf="!signatureId" color="primary" [mat-dialog-close]="{ upload: true }">Upload</button>
|
||||
</mat-dialog-actions>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DeleteSignatureDialogComponent } from './delete-signature-dialog.component';
|
||||
|
||||
describe('DeleteSignatureDialogComponent', () => {
|
||||
let component: DeleteSignatureDialogComponent;
|
||||
let fixture: ComponentFixture<DeleteSignatureDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DeleteSignatureDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DeleteSignatureDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/** Angular Imports */
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
|
||||
/**
|
||||
* Delete signature dialog component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-delete-signature-dialog',
|
||||
templateUrl: './delete-signature-dialog.component.html',
|
||||
styleUrls: ['./delete-signature-dialog.component.scss']
|
||||
})
|
||||
export class DeleteSignatureDialogComponent {
|
||||
|
||||
/** Id of client signature in documents */
|
||||
signatureId: any;
|
||||
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Documents data
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<h1 mat-dialog-title>Upload Client Signature</h1>
|
||||
|
||||
<div>
|
||||
|
||||
<mifosx-file-upload flex="60%" (change)="onFileSelect($event)"></mifosx-file-upload>
|
||||
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-dialog-close>Cancel</button>
|
||||
<button mat-raised-button color="primary" [disabled]="!signature" [mat-dialog-close]="signature">Confirm</button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
</div>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UploadSignatureDialogComponent } from './upload-signature-dialog.component';
|
||||
|
||||
describe('UploadSignatureDialogComponent', () => {
|
||||
let component: UploadSignatureDialogComponent;
|
||||
let fixture: ComponentFixture<UploadSignatureDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ UploadSignatureDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UploadSignatureDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/** Angular Imports */
|
||||
import { Component } from '@angular/core';
|
||||
import { MatDialogRef } from '@angular/material';
|
||||
|
||||
/**
|
||||
* Upload signature dialog component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-upload-signature-dialog',
|
||||
templateUrl: './upload-signature-dialog.component.html',
|
||||
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>) { }
|
||||
|
||||
/**
|
||||
* Sets file form control value.
|
||||
* @param {any} $event file change event.
|
||||
*/
|
||||
onFileSelect($event: any) {
|
||||
if ($event.target.files.length > 0) {
|
||||
this.signature = $event.target.files[0];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+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