,
@Inject(MAT_DIALOG_DATA) public data: any) { }
diff --git a/src/app/shared/file-upload/file-upload.component.html b/src/app/shared/file-upload/file-upload.component.html
index 2be02ec58..0d09dff92 100644
--- a/src/app/shared/file-upload/file-upload.component.html
+++ b/src/app/shared/file-upload/file-upload.component.html
@@ -1,7 +1,13 @@
-
-{{ filename || 'No File Uploaded' }}
-
+
+
+
+
+
+
+
+
+
diff --git a/src/app/shared/file-upload/file-upload.component.ts b/src/app/shared/file-upload/file-upload.component.ts
index 80c01c528..f8e388376 100644
--- a/src/app/shared/file-upload/file-upload.component.ts
+++ b/src/app/shared/file-upload/file-upload.component.ts
@@ -1,5 +1,9 @@
+/** Angular Imports */
import { Component, OnInit } from '@angular/core';
+/**
+ * Custom file upload component based on angular material.
+ */
@Component({
selector: 'mifosx-file-upload',
templateUrl: './file-upload.component.html',
@@ -7,15 +11,20 @@ import { Component, OnInit } from '@angular/core';
})
export class FileUploadComponent implements OnInit {
- filename: string;
+ /** Name of file. */
+ fileName = '';
constructor() { }
ngOnInit() {
}
+ /**
+ * Uploads a file.
+ * @param {any} $event The file input change event.
+ */
onFileSelected($event: any) {
- this.filename = $event.target.files[0].name;
+ this.fileName = $event.target.files[0].name;
}
}
diff --git a/src/app/shared/icons.module.ts b/src/app/shared/icons.module.ts
index 59a5881a3..99045f6d3 100644
--- a/src/app/shared/icons.module.ts
+++ b/src/app/shared/icons.module.ts
@@ -1,5 +1,7 @@
+/** Angular Imports */
import { NgModule } from '@angular/core';
+/** Angular Font Awesome Imports */
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { library } from '@fortawesome/fontawesome-svg-core';
import {
@@ -7,15 +9,17 @@ import {
faSearch
} from '@fortawesome/free-solid-svg-icons';
-// Add an icon to the library for convenient access in other components
+/** Add icons to the library for convenient access in other components. */
library.add(
faFileUpload,
faSearch
);
+/**
+ * Icons Module
+ * Angular Font Awesome module is exported here.
+ */
@NgModule({
- imports: [],
- declarations: [],
exports: [FontAwesomeModule]
})
export class IconsModule { }
diff --git a/src/app/shared/index.ts b/src/app/shared/index.ts
index 625069ab2..436ae53e4 100644
--- a/src/app/shared/index.ts
+++ b/src/app/shared/index.ts
@@ -1,2 +1,2 @@
export * from './shared.module';
-export * from './loader/loader.component';
+export { DeleteDialogComponent } from './delete-dialog/delete-dialog.component';
diff --git a/src/app/shared/loader/loader.component.html b/src/app/shared/loader/loader.component.html
deleted file mode 100644
index f3aa6ed73..000000000
--- a/src/app/shared/loader/loader.component.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{message}}
-
-
diff --git a/src/app/shared/loader/loader.component.scss b/src/app/shared/loader/loader.component.scss
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/app/shared/loader/loader.component.spec.ts b/src/app/shared/loader/loader.component.spec.ts
deleted file mode 100644
index 275168a36..000000000
--- a/src/app/shared/loader/loader.component.spec.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { LoaderComponent } from './loader.component';
-
-describe('LoaderComponent', () => {
- let component: LoaderComponent;
- let fixture: ComponentFixture;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [LoaderComponent]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(LoaderComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should not be visible by default', () => {
- // Arrange
- const element = fixture.nativeElement;
- const div = element.querySelectorAll('div')[0];
-
- // Assert
- expect(div.getAttribute('hidden')).not.toBeNull();
- });
-
- it('should be visible when app is loading', () => {
- // Arrange
- const element = fixture.nativeElement;
- const div = element.querySelectorAll('div')[0];
-
- // Act
- fixture.componentInstance.isLoading = true;
- fixture.detectChanges();
-
- // Assert
- expect(div.getAttribute('hidden')).toBeNull();
- });
-
- it('should not display a message by default', () => {
- // Arrange
- const element = fixture.nativeElement;
- const span = element.querySelectorAll('span')[0];
-
- // Assert
- expect(span.innerText).toBe('');
- });
-
- it('should display specified message', () => {
- // Arrange
- const element = fixture.nativeElement;
- const span = element.querySelectorAll('span')[0];
-
- // Act
- fixture.componentInstance.message = 'testing';
- fixture.detectChanges();
-
- // Assert
- expect(span.innerText).toBe('testing');
- });
-});
diff --git a/src/app/shared/loader/loader.component.ts b/src/app/shared/loader/loader.component.ts
deleted file mode 100644
index cb4e24de5..000000000
--- a/src/app/shared/loader/loader.component.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Component, OnInit, Input } from '@angular/core';
-
-@Component({
- selector: 'mifosx-loader',
- templateUrl: './loader.component.html',
- styleUrls: ['./loader.component.scss']
-})
-export class LoaderComponent implements OnInit {
-
- @Input() isLoading = false;
- @Input() message: string;
-
- constructor() { }
-
- ngOnInit() { }
-
-}
diff --git a/src/app/shared/material.module.ts b/src/app/shared/material.module.ts
index 5c0c4aee8..7eb1e17d2 100644
--- a/src/app/shared/material.module.ts
+++ b/src/app/shared/material.module.ts
@@ -1,7 +1,9 @@
+/** Angular Imports */
import { NgModule } from '@angular/core';
import { LayoutModule } from '@angular/cdk/layout';
import { FlexLayoutModule } from '@angular/flex-layout';
import {
+ MAT_FORM_FIELD_DEFAULT_OPTIONS,
MatAutocompleteModule,
MatButtonModule,
MatButtonToggleModule,
@@ -37,9 +39,11 @@ import {
MatTreeModule
} from '@angular/material';
+/**
+ * Material Module
+ * Angular CDK, Angular Material and Flex Layout modules are exported here.
+ */
@NgModule({
- imports: [],
- declarations: [],
exports: [
FlexLayoutModule,
LayoutModule,
@@ -76,6 +80,12 @@ import {
MatToolbarModule,
MatTooltipModule,
MatTreeModule
+ ],
+ providers: [
+ {
+ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
+ useValue: { appearance: 'standard' }
+ }
]
})
export class MaterialModule { }
diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts
index a120610ea..d541d094c 100644
--- a/src/app/shared/shared.module.ts
+++ b/src/app/shared/shared.module.ts
@@ -1,13 +1,19 @@
-import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+ /** Angular Imports */
+import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
-import { LoaderComponent } from './loader/loader.component';
+/** Custom Components */
import { FileUploadComponent } from './file-upload/file-upload.component';
import { DeleteDialogComponent } from './delete-dialog/delete-dialog.component';
+/** Custom Modules */
import { MaterialModule } from './material.module';
import { IconsModule } from './icons.module';
+/**
+ * Shared Module
+ * Modules and components that are shared throughout the application should be here.
+ */
@NgModule({
imports: [
CommonModule,
@@ -15,15 +21,13 @@ import { IconsModule } from './icons.module';
MaterialModule
],
declarations: [
- LoaderComponent,
- FileUploadComponent,
- DeleteDialogComponent
+ DeleteDialogComponent,
+ FileUploadComponent
],
exports: [
- CommonModule,
FileUploadComponent,
+ CommonModule,
IconsModule,
- LoaderComponent,
MaterialModule
],
entryComponents: [