feat: add UI for settings and app configuration (#90)

Add settings and app configuration UI for web app and self service
applications.
This commit is contained in:
Abhay Chawla
2018-07-03 21:17:58 +05:30
committed by GitHub
parent 4bd7478bac
commit de6a041234
22 changed files with 481 additions and 7 deletions
+2
View File
@@ -23,6 +23,7 @@ import { AccountingModule } from './accounting/accounting.module';
import { SelfServiceModule } from './self-service/self-service.module';
import { AppRoutingModule } from './app-routing.module';
import { SettingsModule } from './settings/settings.module';
@NgModule({
imports: [
@@ -42,6 +43,7 @@ import { AppRoutingModule } from './app-routing.module';
ClientsModule,
AccountingModule,
SelfServiceModule,
SettingsModule,
AppRoutingModule
],
declarations: [WebAppComponent],
+2 -1
View File
@@ -144,7 +144,8 @@ import { BreadcrumbComponent } from './shell/breadcrumb/breadcrumb.component';
MatTableModule,
MatSortModule,
MatPaginatorModule,
MatDividerModule
MatDividerModule,
ThemePickerComponent
],
providers: [
AuthenticationService,
@@ -19,7 +19,7 @@
Abhay Chawla
</span>
<div class="app-user-controls">
<button class="text-muted xs-button" mat-icon-button>
<button class="text-muted xs-button" mat-icon-button matTooltip="Settings" routerLink="/settings">
<mat-icon>settings</mat-icon>
</button>
<button class="text-muted xs-button" mat-icon-button matTooltip="Sign Out" (click)="logout()">
@@ -107,7 +107,7 @@
<mat-menu #selfServiceMenu="matMenu" [overlapTrigger]="false">
<span (mouseleave)="selfServiceMenuTrigger.closeMenu()">
<button mat-menu-item routerLink="/self-service/users">User Management</button>
<button mat-menu-item>App Configuration</button>
<button mat-menu-item routerLink="/self-service/app-configuration">App Configuration</button>
<button mat-menu-item>Task Management</button>
</span>
</mat-menu>
@@ -0,0 +1,142 @@
<mat-card class="container">
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Main Configuration
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="column">
<mat-form-field>
<input matInput placeholder="Name of the Organisation">
</mat-form-field>
<mat-form-field>
<textarea matInput placeholder="Description"></textarea>
</mat-form-field>
<mat-form-field>
<textarea matInput placeholder="Summary"></textarea>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Default Language">
<mat-option *ngFor="let language of languages" [value]="language.value">
{{ language.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Default Date Format">
<mat-option *ngFor="let dateFormat of dateFormats" [value]="dateFormat.value">
{{ dateFormat.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Images
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="column">
Favicon <mifosx-file-upload></mifosx-file-upload>
Cover Image <mifosx-file-upload></mifosx-file-upload>
Logo <mifosx-file-upload></mifosx-file-upload>
Logo with Organisation Name <mifosx-file-upload></mifosx-file-upload>
</div>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Theme and Font
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="column">
Mobile Banking App
<mat-form-field>
<mat-select placeholder="Default Theme">
<mat-option *ngFor="let theme of mobileAppThemes" [value]="theme.value">
{{ theme.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Default Font">
<mat-option *ngFor="let font of mobileAppFonts" [value]="font.value">
{{ font.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
Online Banking App
<mat-form-field>
<mat-select placeholder="Default Theme">
<mat-option *ngFor="let theme of onlineBankingAppThemes" [value]="theme.value">
{{ theme.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Default Font">
<mat-option *ngFor="let font of onlineBankingAppFonts" [value]="font.value">
{{ font.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Contact Information
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="column">
<mat-form-field>
<input type="url" matInput placeholder="Website">
</mat-form-field>
<mat-form-field>
<input type="email" matInput placeholder="Email">
</mat-form-field>
<mat-form-field>
<input type="tel" matInput placeholder="Contact No">
</mat-form-field>
</div>
</mat-expansion-panel>
</mat-accordion>
</mat-card>
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AppConfigurationComponent } from './app-configuration.component';
describe('AppConfigurationComponent', () => {
let component: AppConfigurationComponent;
let fixture: ComponentFixture<AppConfigurationComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AppConfigurationComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AppConfigurationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,22 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'mifosx-app-configuration',
templateUrl: './app-configuration.component.html',
styleUrls: ['./app-configuration.component.scss']
})
export class AppConfigurationComponent implements OnInit {
languages: string[];
dateFormats: string[];
mobileAppThemes: string[];
mobileAppFonts: string[];
onlineBankingAppThemes: string[];
onlineBankingAppFonts: string[];
constructor() { }
ngOnInit() {
}
}
@@ -6,6 +6,7 @@ import { UserManagementComponent } from './user-management/user-management.compo
import { CreateUserComponent } from './create-user/create-user.component';
import { ViewUserComponent } from './view-user/view-user.component';
import { EditUserComponent } from './edit-user/edit-user.component';
import { AppConfigurationComponent } from './app-configuration/app-configuration.component';
const routes: Routes = [
Route.withShell([
@@ -28,6 +29,11 @@ const routes: Routes = [
path: 'self-service/users/edit',
component: EditUserComponent,
data: { title: extract('Edit Self Service User'), breadcrumb: 'Self Service Users > Edit' },
},
{
path: 'self-service/app-configuration',
component: AppConfigurationComponent,
data: { title: extract('App Configuration'), breadcrumb: 'App Configuration' },
}
])
];
+5 -1
View File
@@ -8,19 +8,23 @@ import { UserManagementComponent } from './user-management/user-management.compo
import { CreateUserComponent } from './create-user/create-user.component';
import { ViewUserComponent } from './view-user/view-user.component';
import { EditUserComponent } from './edit-user/edit-user.component';
import { AppConfigurationComponent } from './app-configuration/app-configuration.component';
import { SharedModule } from '../shared/shared.module';
@NgModule({
imports: [
CommonModule,
CoreModule,
FormsModule,
SharedModule,
SelfServiceRoutingModule
],
declarations: [
UserManagementComponent,
CreateUserComponent,
ViewUserComponent,
EditUserComponent
EditUserComponent,
AppConfigurationComponent
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { Route, extract } from '../core';
import { SettingsComponent } from './settings.component';
const routes: Routes = [
Route.withShell([
{
path: 'settings',
component: SettingsComponent,
data: { title: extract('Settings'), breadcrumb: 'Settings' }
}
])
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
providers: []
})
export class SettingsRoutingModule { }
+118
View File
@@ -0,0 +1,118 @@
<mat-card class="container">
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Main Configuration
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="column">
<mat-form-field>
<input matInput placeholder="Name of the Organisation">
</mat-form-field>
<mat-form-field>
<textarea matInput placeholder="Description"></textarea>
</mat-form-field>
<mat-form-field>
<textarea matInput placeholder="Summary"></textarea>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Default Language">
<mat-option *ngFor="let language of languages" [value]="language.value">
{{ language.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Default Date Format">
<mat-option *ngFor="let dateFormat of dateFormats" [value]="dateFormat.value">
{{ dateFormat.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Images
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="column">
Favicon <mifosx-file-upload></mifosx-file-upload>
Cover Image <mifosx-file-upload></mifosx-file-upload>
Logo <mifosx-file-upload></mifosx-file-upload>
Logo with Organisation Name <mifosx-file-upload></mifosx-file-upload>
</div>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Theme and Font
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="column">
Theme <mifosx-theme-picker></mifosx-theme-picker> <!-- TODO: Replace or Change to Show More Detail -->
<mat-form-field>
<mat-select placeholder="Default Font">
<mat-option *ngFor="let font of fonts" [value]="font.value">
{{ font.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Contact Information
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="column">
<mat-form-field>
<input type="url" matInput placeholder="Website">
</mat-form-field>
<mat-form-field>
<input type="email" matInput placeholder="Email">
</mat-form-field>
<mat-form-field>
<input type="tel" matInput placeholder="Contact No">
</mat-form-field>
</div>
</mat-expansion-panel>
</mat-accordion>
</mat-card>
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingsComponent } from './settings.component';
describe('SettingsComponent', () => {
let component: SettingsComponent;
let fixture: ComponentFixture<SettingsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SettingsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SettingsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
+19
View File
@@ -0,0 +1,19 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'mifosx-settings',
templateUrl: './settings.component.html',
styleUrls: ['./settings.component.scss']
})
export class SettingsComponent implements OnInit {
languages: string[];
dateFormats: string[];
fonts: string[];
constructor() { }
ngOnInit() {
}
}
+13
View File
@@ -0,0 +1,13 @@
import { SettingsModule } from './settings.module';
describe('SettingsModule', () => {
let settingsModule: SettingsModule;
beforeEach(() => {
settingsModule = new SettingsModule();
});
it('should create an instance', () => {
expect(settingsModule).toBeTruthy();
});
});
+18
View File
@@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CoreModule } from '../core';
import { SettingsRoutingModule } from './settings-routing.module';
import { SettingsComponent } from './settings.component';
import { SharedModule } from '../shared/shared.module';
@NgModule({
imports: [
CommonModule,
CoreModule,
SharedModule,
SettingsRoutingModule
],
declarations: [SettingsComponent]
})
export class SettingsModule { }
@@ -0,0 +1,6 @@
<button mat-button (click)="inputFile.click()">
<mat-icon>file_upload</mat-icon>
Upload an image
</button>
{{ filename }}
<input type="file" #inputFile (change)="onFileSelected($event)" [style.display]="'none'" />
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FileUploadComponent } from './file-upload.component';
describe('FileUploadComponent', () => {
let component: FileUploadComponent;
let fixture: ComponentFixture<FileUploadComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FileUploadComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FileUploadComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,21 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'mifosx-file-upload',
templateUrl: './file-upload.component.html',
styleUrls: ['./file-upload.component.scss']
})
export class FileUploadComponent implements OnInit {
filename: string;
constructor() { }
ngOnInit() {
}
onFileSelected($event: any) {
this.filename = $event.target.files[0].name;
}
}
+8 -3
View File
@@ -2,16 +2,21 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LoaderComponent } from './loader/loader.component';
import { FileUploadComponent } from './file-upload/file-upload.component';
import { CoreModule } from '../core/core.module';
@NgModule({
imports: [
CommonModule
CommonModule,
CoreModule
],
declarations: [
LoaderComponent
LoaderComponent,
FileUploadComponent
],
exports: [
LoaderComponent
LoaderComponent,
FileUploadComponent
]
})
export class SharedModule { }