+12
@@ -0,0 +1,12 @@
|
||||
<h1 mat-dialog-title>Upload Client Image</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]="!image" [mat-dialog-close]="image">Confirm</button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
</div>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UploadImageDialogComponent } from './upload-image-dialog.component';
|
||||
|
||||
describe('UploadImageDialogComponent', () => {
|
||||
let component: UploadImageDialogComponent;
|
||||
let fixture: ComponentFixture<UploadImageDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ UploadImageDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UploadImageDialogComponent);
|
||||
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 image dialog component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-upload-image-dialog',
|
||||
templateUrl: './upload-image-dialog.component.html',
|
||||
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>) { }
|
||||
|
||||
/**
|
||||
* Sets file form control value.
|
||||
* @param {any} $event file change event.
|
||||
*/
|
||||
onFileSelect($event: any) {
|
||||
if ($event.target.files.length > 0) {
|
||||
this.image = $event.target.files[0];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user