refractor: self service module (#291)
* Refractor components. * Improve responsiveness of components. * Add task management component. * Add users data resolver. * Add relative router links. * Replace mat-icons by font-awesome icons. * Add comments. Fixes #290
This commit is contained in:
@@ -52,7 +52,7 @@ export class BreadcrumbComponent implements OnInit {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the breadcrumbs.
|
* Generates the breadcrumbs.
|
||||||
* @param {ActivatedRoute} activatedRoute Activate Route.
|
* @param {ActivatedRoute} activatedRoute Activated Route.
|
||||||
* @param {Router} router Router for navigation.
|
* @param {Router} router Router for navigation.
|
||||||
*/
|
*/
|
||||||
constructor(private activatedRoute: ActivatedRoute,
|
constructor(private activatedRoute: ActivatedRoute,
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ export class ShellComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
toggleCollapse($event: boolean) {
|
toggleCollapse($event: boolean) {
|
||||||
this.sidenavCollapsed = $event;
|
this.sidenavCollapsed = $event;
|
||||||
|
this.cdr.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
<mat-menu #selfServiceMenu="matMenu" [overlapTrigger]="false">
|
<mat-menu #selfServiceMenu="matMenu" [overlapTrigger]="false">
|
||||||
<button mat-menu-item [routerLink]="['/self-service/users']">User Management</button>
|
<button mat-menu-item [routerLink]="['/self-service/users']">User Management</button>
|
||||||
<button mat-menu-item [routerLink]="['/self-service/app-configuration']">App Configuration</button>
|
<button mat-menu-item [routerLink]="['/self-service/app-configuration']">App Configuration</button>
|
||||||
<button mat-menu-item>Task Management</button>
|
<button mat-menu-item [routerLink]="['/self-service/task-management']">Task Management</button>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
|
|
||||||
<!-- Application User Help Menu -->
|
<!-- Application User Help Menu -->
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<mat-card class="container">
|
<div class="container">
|
||||||
|
|
||||||
<mat-accordion>
|
<mat-accordion>
|
||||||
|
|
||||||
@@ -13,29 +13,34 @@
|
|||||||
<div fxLayout="column">
|
<div fxLayout="column">
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput placeholder="Name of the Organisation">
|
<mat-label>Name of the Organisation</mat-label>
|
||||||
|
<input matInput>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<textarea matInput placeholder="Description"></textarea>
|
<mat-label>Description</mat-label>
|
||||||
|
<textarea matInput></textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<textarea matInput placeholder="Summary"></textarea>
|
<mat-label>Summary</mat-label>
|
||||||
|
<textarea matInput></textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Default Language">
|
<mat-label>Default Language</mat-label>
|
||||||
<mat-option *ngFor="let language of languages" [value]="language.value">
|
<mat-select>
|
||||||
{{ language.viewValue }}
|
<mat-option *ngFor="let language of languages" [value]="language">
|
||||||
|
{{ language }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Default Date Format">
|
<mat-label>Default Date Format</mat-label>
|
||||||
<mat-option *ngFor="let dateFormat of dateFormats" [value]="dateFormat.value">
|
<mat-select>
|
||||||
{{ dateFormat.viewValue }}
|
<mat-option *ngFor="let dateFormat of dateFormats" [value]="dateFormat">
|
||||||
|
{{ dateFormat }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@@ -54,10 +59,17 @@
|
|||||||
|
|
||||||
<div fxLayout="column">
|
<div fxLayout="column">
|
||||||
|
|
||||||
Favicon <mifosx-file-upload></mifosx-file-upload>
|
<span class="header">Favicon</span>
|
||||||
Cover Image <mifosx-file-upload></mifosx-file-upload>
|
<mifosx-file-upload></mifosx-file-upload>
|
||||||
Logo <mifosx-file-upload></mifosx-file-upload>
|
|
||||||
Logo with Organisation Name <mifosx-file-upload></mifosx-file-upload>
|
<span class="header">Cover Image</span>
|
||||||
|
<mifosx-file-upload></mifosx-file-upload>
|
||||||
|
|
||||||
|
<span class="header">Logo</span>
|
||||||
|
<mifosx-file-upload></mifosx-file-upload>
|
||||||
|
|
||||||
|
<span class="header">Logo with Organisation Name</span>
|
||||||
|
<mifosx-file-upload></mifosx-file-upload>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -73,36 +85,40 @@
|
|||||||
|
|
||||||
<div fxLayout="column">
|
<div fxLayout="column">
|
||||||
|
|
||||||
Mobile Banking App
|
<span class="header">Mobile Banking App</span>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Default Theme">
|
<mat-label>Default Theme</mat-label>
|
||||||
<mat-option *ngFor="let theme of mobileAppThemes" [value]="theme.value">
|
<mat-select>
|
||||||
{{ theme.viewValue }}
|
<mat-option *ngFor="let theme of mobileAppThemes" [value]="theme">
|
||||||
|
{{ theme }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Default Font">
|
<mat-label>Default Font</mat-label>
|
||||||
<mat-option *ngFor="let font of mobileAppFonts" [value]="font.value">
|
<mat-select>
|
||||||
{{ font.viewValue }}
|
<mat-option *ngFor="let font of mobileAppFonts" [value]="font">
|
||||||
|
{{ font }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
Online Banking App
|
<span class="header">Online Banking App</span>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Default Theme">
|
<mat-label>Default Theme</mat-label>
|
||||||
<mat-option *ngFor="let theme of onlineBankingAppThemes" [value]="theme.value">
|
<mat-select>
|
||||||
{{ theme.viewValue }}
|
<mat-option *ngFor="let theme of onlineBankingAppThemes" [value]="theme">
|
||||||
|
{{ theme }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Default Font">
|
<mat-label>Default Font</mat-label>
|
||||||
<mat-option *ngFor="let font of onlineBankingAppFonts" [value]="font.value">
|
<mat-select>
|
||||||
{{ font.viewValue }}
|
<mat-option *ngFor="let font of onlineBankingAppFonts" [value]="font">
|
||||||
|
{{ font }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@@ -122,15 +138,18 @@
|
|||||||
<div fxLayout="column">
|
<div fxLayout="column">
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input type="url" matInput placeholder="Website">
|
<mat-label>Website</mat-label>
|
||||||
|
<input type="url" matInput>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input type="email" matInput placeholder="Email">
|
<mat-label>Email</mat-label>
|
||||||
|
<input type="email" matInput>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input type="tel" matInput placeholder="Contact No">
|
<mat-label>Contact No</mat-label>
|
||||||
|
<input type="tel" matInput>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -139,4 +158,4 @@
|
|||||||
|
|
||||||
</mat-accordion>
|
</mat-accordion>
|
||||||
|
|
||||||
</mat-card>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
.header {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
|
/** Angular Imports */
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Self service app configuration component.
|
||||||
|
*
|
||||||
|
* TODO: Complete functionality once API is available.
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-app-configuration',
|
selector: 'mifosx-app-configuration',
|
||||||
templateUrl: './app-configuration.component.html',
|
templateUrl: './app-configuration.component.html',
|
||||||
@@ -7,12 +13,18 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class AppConfigurationComponent implements OnInit {
|
export class AppConfigurationComponent implements OnInit {
|
||||||
|
|
||||||
languages: string[];
|
/** Placeholder for languages. */
|
||||||
dateFormats: string[];
|
languages: any;
|
||||||
mobileAppThemes: string[];
|
/** Placeholder for date formats. */
|
||||||
mobileAppFonts: string[];
|
dateFormats: any;
|
||||||
onlineBankingAppThemes: string[];
|
/** Placeholder for mobile app themes. */
|
||||||
onlineBankingAppFonts: string[];
|
mobileAppThemes: any;
|
||||||
|
/** Placeholder for mobile app fonts. */
|
||||||
|
mobileAppFonts: any;
|
||||||
|
/** Placeholder for online banking app themes. */
|
||||||
|
onlineBankingAppThemes: any;
|
||||||
|
/** Placeholder for online banking app fonts. */
|
||||||
|
onlineBankingAppFonts: any;
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,27 @@
|
|||||||
|
/** Angular Imports */
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { Routes, RouterModule } from '@angular/router';
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
import { Route, extract } from '../core';
|
/** Routing Imports */
|
||||||
|
import { Route } from '../core';
|
||||||
|
|
||||||
|
/** Translation Imports */
|
||||||
|
import { extract } from '../core';
|
||||||
|
|
||||||
|
/** Custom Components */
|
||||||
|
import { SelfServiceComponent } from './self-service.component';
|
||||||
import { UsersComponent } from './users/users.component';
|
import { UsersComponent } from './users/users.component';
|
||||||
import { CreateUserComponent } from './users/create-user/create-user.component';
|
import { CreateUserComponent } from './users/create-user/create-user.component';
|
||||||
import { ViewUserComponent } from './users/view-user/view-user.component';
|
import { ViewUserComponent } from './users/view-user/view-user.component';
|
||||||
import { EditUserComponent } from './users/edit-user/edit-user.component';
|
import { EditUserComponent } from './users/edit-user/edit-user.component';
|
||||||
import { AppConfigurationComponent } from './app-configuration/app-configuration.component';
|
import { AppConfigurationComponent } from './app-configuration/app-configuration.component';
|
||||||
import { SelfServiceComponent } from './self-service.component';
|
import { TaskManagementComponent } from './task-management/task-management.component';
|
||||||
|
|
||||||
|
/** Custom Resolvers */
|
||||||
|
import { UsersResolver } from './users/users.resolver';
|
||||||
import { ViewUserResolver } from './users/view-user/view-user.resolver';
|
import { ViewUserResolver } from './users/view-user/view-user.resolver';
|
||||||
|
|
||||||
|
/** Self Service Admin Portal Routes */
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
Route.withShell([
|
Route.withShell([
|
||||||
{
|
{
|
||||||
@@ -23,7 +35,10 @@ const routes: Routes = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: UsersComponent
|
component: UsersComponent,
|
||||||
|
resolve: {
|
||||||
|
users: UsersResolver
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'create',
|
path: 'create',
|
||||||
@@ -53,16 +68,29 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: 'app-configuration',
|
path: 'app-configuration',
|
||||||
component: AppConfigurationComponent,
|
component: AppConfigurationComponent,
|
||||||
data: { title: extract('App Configuration'), breadcrumb: 'App Configuration' },
|
data: { title: extract('Self Service App Configuration'), breadcrumb: 'App Configuration' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'task-management',
|
||||||
|
component: TaskManagementComponent,
|
||||||
|
data: { title: extract('Self Service Task Management'), breadcrumb: 'Task Management' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Self Service Routing Module
|
||||||
|
*
|
||||||
|
* Configures the self service admin portal routes.
|
||||||
|
*/
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
providers: [ViewUserResolver]
|
providers: [
|
||||||
|
UsersResolver,
|
||||||
|
ViewUserResolver
|
||||||
|
]
|
||||||
})
|
})
|
||||||
export class SelfServiceRoutingModule { }
|
export class SelfServiceRoutingModule { }
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
|
/** Angular Imports */
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Self service component.
|
||||||
|
*
|
||||||
|
* All components related to self service admin portal are routed here.
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-self-service',
|
selector: 'mifosx-self-service',
|
||||||
templateUrl: './self-service.component.html',
|
templateUrl: './self-service.component.html',
|
||||||
|
|||||||
@@ -1,23 +1,29 @@
|
|||||||
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
/** Angular Imports */
|
||||||
import { CommonModule } from '@angular/common';
|
import { NgModule } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
import { CoreModule } from '../core/core.module';
|
/** Custom Modules */
|
||||||
|
import { SharedModule } from '../shared/shared.module';
|
||||||
import { SelfServiceRoutingModule } from './self-service-routing.module';
|
import { SelfServiceRoutingModule } from './self-service-routing.module';
|
||||||
|
|
||||||
|
/** Custom Components */
|
||||||
|
import { SelfServiceComponent } from './self-service.component';
|
||||||
|
import { UsersComponent } from './users/users.component';
|
||||||
import { CreateUserComponent } from './users/create-user/create-user.component';
|
import { CreateUserComponent } from './users/create-user/create-user.component';
|
||||||
import { ViewUserComponent } from './users/view-user/view-user.component';
|
import { ViewUserComponent } from './users/view-user/view-user.component';
|
||||||
import { EditUserComponent } from './users/edit-user/edit-user.component';
|
import { EditUserComponent } from './users/edit-user/edit-user.component';
|
||||||
import { AppConfigurationComponent } from './app-configuration/app-configuration.component';
|
import { AppConfigurationComponent } from './app-configuration/app-configuration.component';
|
||||||
import { SharedModule } from '../shared/shared.module';
|
import { TaskManagementComponent } from './task-management/task-management.component';
|
||||||
import { SelfServiceComponent } from './self-service.component';
|
|
||||||
import { UsersComponent } from './users/users.component';
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Self Service Module
|
||||||
|
*
|
||||||
|
* All components related to self service admin portal functions should be declared here.
|
||||||
|
*/
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
|
||||||
CoreModule,
|
|
||||||
FormsModule,
|
|
||||||
SharedModule,
|
SharedModule,
|
||||||
|
FormsModule,
|
||||||
SelfServiceRoutingModule
|
SelfServiceRoutingModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
@@ -26,10 +32,8 @@ import { UsersComponent } from './users/users.component';
|
|||||||
CreateUserComponent,
|
CreateUserComponent,
|
||||||
ViewUserComponent,
|
ViewUserComponent,
|
||||||
EditUserComponent,
|
EditUserComponent,
|
||||||
AppConfigurationComponent
|
AppConfigurationComponent,
|
||||||
],
|
TaskManagementComponent
|
||||||
schemas: [
|
]
|
||||||
CUSTOM_ELEMENTS_SCHEMA
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
export class SelfServiceModule { }
|
export class SelfServiceModule { }
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<p>
|
||||||
|
TODO: task-management component.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { TaskManagementComponent } from './task-management.component';
|
||||||
|
|
||||||
|
describe('TaskManagementComponent', () => {
|
||||||
|
let component: TaskManagementComponent;
|
||||||
|
let fixture: ComponentFixture<TaskManagementComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ TaskManagementComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(TaskManagementComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-task-management',
|
||||||
|
templateUrl: './task-management.component.html',
|
||||||
|
styleUrls: ['./task-management.component.scss']
|
||||||
|
})
|
||||||
|
export class TaskManagementComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,140 +1,148 @@
|
|||||||
<mat-card class="container m-t-40">
|
<div class="container" [class.small-width-container]="userType.value === 'Existing User'">
|
||||||
|
|
||||||
<mat-card-header>
|
<mat-card>
|
||||||
<mat-radio-group class="example-radio-group" [(ngModel)]="currentUserType" fxLayout="row" fxLayoutGap="50px">
|
|
||||||
<mat-radio-button class="example-radio-button" *ngFor="let userType of userTypes" [value]="userType">
|
|
||||||
{{ userType }}
|
|
||||||
</mat-radio-button>
|
|
||||||
</mat-radio-group>
|
|
||||||
</mat-card-header>
|
|
||||||
|
|
||||||
<ng-container *ngIf="currentUserType === 'Existing User'">
|
<mat-card-header class="m-b-20">
|
||||||
|
<mat-radio-group fxLayout="row" fxLayoutGap="20px" [formControl]="userType">
|
||||||
|
<mat-radio-button *ngFor="let type of userTypes" [value]="type">
|
||||||
|
{{ type }}
|
||||||
|
</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
</mat-card-header>
|
||||||
|
|
||||||
<mat-card-content class="m-t-20">
|
<div *ngIf="userType.value === 'Existing User'">
|
||||||
|
|
||||||
<form fxLayout="column" fxLayoutGap="10px">
|
|
||||||
<mat-form-field>
|
|
||||||
<mat-select placeholder="Office">
|
|
||||||
<mat-option *ngFor="let office of officeData" [value]="office.value">
|
|
||||||
{{ office.viewValue }}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field>
|
|
||||||
<mat-select placeholder="Staff">
|
|
||||||
<mat-option *ngFor="let staff of staffData" [value]="staff.value">
|
|
||||||
{{ staff.viewValue }}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field>
|
|
||||||
<mat-select placeholder="Client">
|
|
||||||
<mat-option *ngFor="let client of clientData" [value]="client.value">
|
|
||||||
{{ client.viewValue }}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</mat-card-content>
|
|
||||||
|
|
||||||
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
|
||||||
<button mat-raised-button color="primary"><mat-icon>lock_open</mat-icon> Activate Self Service User</button>
|
|
||||||
<button mat-raised-button>Cancel</button>
|
|
||||||
</mat-card-actions>
|
|
||||||
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<ng-container *ngIf="currentUserType === 'New User'">
|
|
||||||
|
|
||||||
<mat-card-content class="m-t-20">
|
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
<mat-grid-list cols="2" rowHeight="80px"> <!-- TODO: Dynamic columns to make responsive and hide the blank tile or find some other way -->
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-card-content>
|
||||||
<mat-form-field fxFlex class="m-10">
|
|
||||||
<mat-select placeholder="Office">
|
<div fxLayout="column">
|
||||||
<mat-option *ngFor="let office of officeData" [value]="office.value">
|
|
||||||
{{ office.viewValue }}
|
<mat-form-field>
|
||||||
|
<mat-label>Office</mat-label>
|
||||||
|
<mat-select>
|
||||||
|
<mat-option *ngFor="let office of officeData" [value]="office">
|
||||||
|
{{ office }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-form-field>
|
||||||
<mat-form-field fxFlex class="m-10">
|
<mat-label>Staff</mat-label>
|
||||||
<mat-select placeholder="Staff">
|
<mat-select>
|
||||||
<mat-option *ngFor="let staff of staffData" [value]="staff.value">
|
<mat-option *ngFor="let staff of staffData" [value]="staff">
|
||||||
{{ staff.viewValue }}
|
{{ staff }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-form-field>
|
||||||
<mat-form-field fxFlex class="m-10">
|
<mat-label>Client</mat-label>
|
||||||
<input matInput placeholder="Username">
|
<mat-select>
|
||||||
</mat-form-field>
|
<mat-option *ngFor="let client of clientData" [value]="client">
|
||||||
</mat-grid-tile>
|
{{ client }}
|
||||||
|
|
||||||
<mat-grid-tile>
|
|
||||||
|
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
|
||||||
<mat-form-field fxFlex class="m-10">
|
|
||||||
<input matInput placeholder="First Name">
|
|
||||||
</mat-form-field>
|
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
|
||||||
<mat-form-field fxFlex class="m-10">
|
|
||||||
<input matInput placeholder="Last Name">
|
|
||||||
</mat-form-field>
|
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
|
||||||
<mat-form-field fxFlex class="m-10">
|
|
||||||
<mat-select placeholder="Gender">
|
|
||||||
<mat-option *ngFor="let gender of genderData" [value]="gender.value">
|
|
||||||
{{ gender.viewValue }}
|
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
</div>
|
||||||
<mat-form-field fxFlex class="m-10">
|
|
||||||
<input matInput [matDatepicker]="picker" placeholder="Date of Birth">
|
|
||||||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
|
||||||
<mat-datepicker #picker></mat-datepicker>
|
|
||||||
</mat-form-field>
|
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
</mat-card-content>
|
||||||
<mat-form-field fxFlex class="m-10">
|
|
||||||
<input matInput placeholder="Email">
|
|
||||||
</mat-form-field>
|
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||||
<mat-form-field fxFlex class="m-10">
|
<button type="button" mat-raised-button [routerLink]="['../']">Cancel</button>
|
||||||
<input matInput placeholder="Mobile No">
|
<button mat-raised-button color="accent">
|
||||||
</mat-form-field>
|
<fa-icon icon="lock-open"></fa-icon>
|
||||||
</mat-grid-tile>
|
Activate Self Service User
|
||||||
|
</button>
|
||||||
</mat-grid-list>
|
</mat-card-actions>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</mat-card-content>
|
</div>
|
||||||
|
|
||||||
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
<div *ngIf="userType.value === 'New User'">
|
||||||
<button mat-raised-button color="primary"><mat-icon>create</mat-icon> Create Self Service User</button>
|
|
||||||
<button mat-raised-button>Cancel</button>
|
|
||||||
</mat-card-actions>
|
|
||||||
|
|
||||||
</ng-container>
|
<form>
|
||||||
|
|
||||||
</mat-card>
|
<mat-card-content>
|
||||||
|
|
||||||
|
<div fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>Office</mat-label>
|
||||||
|
<mat-select>
|
||||||
|
<mat-option *ngFor="let office of officeData" [value]="office">
|
||||||
|
{{ office }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>Staff</mat-label>
|
||||||
|
<mat-select>
|
||||||
|
<mat-option *ngFor="let staff of staffData" [value]="staff">
|
||||||
|
{{ staff }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>Username</mat-label>
|
||||||
|
<input type="text" matInput>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<span fxFlex="48%" fxHide.lt-md></span>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>First Name</mat-label>
|
||||||
|
<input type="text" matInput>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>Last Name</mat-label>
|
||||||
|
<input type="text" matInput>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>Gender</mat-label>
|
||||||
|
<mat-select>
|
||||||
|
<mat-option *ngFor="let gender of genderData" [value]="gender">
|
||||||
|
{{ gender }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>Date of Birth</mat-label>
|
||||||
|
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="dateOfBirthDatePicker">
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="dateOfBirthDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #dateOfBirthDatePicker></mat-datepicker>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>Email</mat-label>
|
||||||
|
<input type="email" matInput>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>Mobile No</mat-label>
|
||||||
|
<input type="tel" matInput>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
|
|
||||||
|
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||||
|
<button type="button" mat-raised-button [routerLink]="['../']">Cancel</button>
|
||||||
|
<button mat-raised-button color="primary">Submit</button>
|
||||||
|
</mat-card-actions>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
.small-width-container {
|
||||||
|
max-width: 37rem;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
|
/** Angular Imports */
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { FormControl } from '@angular/forms';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create self service user component.
|
||||||
|
*
|
||||||
|
* TODO: Complete functionality once API is available.
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-create-user',
|
selector: 'mifosx-create-user',
|
||||||
templateUrl: './create-user.component.html',
|
templateUrl: './create-user.component.html',
|
||||||
@@ -7,13 +14,22 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class CreateUserComponent implements OnInit {
|
export class CreateUserComponent implements OnInit {
|
||||||
|
|
||||||
isCollapsed = false;
|
/** Denotes type of user. */
|
||||||
userTypes = ['Existing User', 'New User'];
|
userTypes = ['Existing User', 'New User'];
|
||||||
currentUserType = this.userTypes[0];
|
/** Radio button group form control for type of user. */
|
||||||
officeData: string[];
|
userType = new FormControl(this.userTypes[0]);
|
||||||
staffData: string[];
|
/** Placeholder for office data. */
|
||||||
clientData: string[];
|
officeData = ['Office 1', 'Office 2'];
|
||||||
genderData: string[];
|
/** Placeholder for staff data. */
|
||||||
|
staffData = ['Staff 1', 'Staff 2'];
|
||||||
|
/** Placeholder for client data. */
|
||||||
|
clientData = ['Client 1', 'Client 2'];
|
||||||
|
/** Placeholder for gender data. */
|
||||||
|
genderData = ['Male', 'Female'];
|
||||||
|
/** Minimum date of birth of user allowed. */
|
||||||
|
minDate = new Date(1900, 0, 1);
|
||||||
|
/** Maximum date of birth of user allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
|
|||||||
@@ -1,94 +1,85 @@
|
|||||||
<mat-card class="container m-t-40">
|
<div class="container">
|
||||||
|
|
||||||
<mat-card-header>
|
<mat-card>
|
||||||
</mat-card-header>
|
|
||||||
|
|
||||||
<mat-card-content class="m-t-20">
|
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
<mat-grid-list cols="2" rowHeight="80px"> <!-- TODO: Dynamic columns to make responsive and hide the blank tile or find some other way -->
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-card-content>
|
||||||
<mat-form-field fxFlex class="m-10">
|
|
||||||
<mat-select placeholder="Office">
|
<div fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
|
||||||
<mat-option *ngFor="let office of officeData" [value]="office.value">
|
|
||||||
{{ office.viewValue }}
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>Office</mat-label>
|
||||||
|
<mat-select>
|
||||||
|
<mat-option *ngFor="let office of officeData" [value]="office">
|
||||||
|
{{ office }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-form-field fxFlex="48%">
|
||||||
<mat-form-field fxFlex class="m-10">
|
<mat-label>Staff</mat-label>
|
||||||
<mat-select placeholder="Staff">
|
<mat-select>
|
||||||
<mat-option *ngFor="let staff of staffData" [value]="staff.value">
|
<mat-option *ngFor="let staff of staffData" [value]="staff">
|
||||||
{{ staff.viewValue }}
|
{{ staff }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-form-field fxFlex="48%">
|
||||||
<mat-form-field fxFlex class="m-10">
|
<mat-label>Username</mat-label>
|
||||||
<input matInput placeholder="Username">
|
<input type="text" matInput>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<span fxFlex="48%" fxHide.lt-md></span>
|
||||||
|
|
||||||
</mat-grid-tile>
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>First Name</mat-label>
|
||||||
<mat-grid-tile>
|
<input type="text" matInput>
|
||||||
<mat-form-field fxFlex class="m-10">
|
|
||||||
<input matInput placeholder="First Name">
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-form-field fxFlex="48%">
|
||||||
<mat-form-field fxFlex class="m-10">
|
<mat-label>Last Name</mat-label>
|
||||||
<input matInput placeholder="Last Name">
|
<input type="text" matInput>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-form-field fxFlex="48%">
|
||||||
<mat-form-field fxFlex class="m-10">
|
<mat-label>Gender</mat-label>
|
||||||
<mat-select placeholder="Gender">
|
<mat-select>
|
||||||
<mat-option *ngFor="let gender of genderData" [value]="gender.value">
|
<mat-option *ngFor="let gender of genderData" [value]="gender">
|
||||||
{{ gender.viewValue }}
|
{{ gender }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-form-field fxFlex="48%">
|
||||||
<mat-form-field fxFlex class="m-10">
|
<mat-label>Date of Birth</mat-label>
|
||||||
<input matInput [matDatepicker]="picker" placeholder="Date of Birth">
|
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="dateOfBirthDatePicker">
|
||||||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matSuffix [for]="dateOfBirthDatePicker"></mat-datepicker-toggle>
|
||||||
<mat-datepicker #picker></mat-datepicker>
|
<mat-datepicker #dateOfBirthDatePicker></mat-datepicker>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-form-field fxFlex="48%">
|
||||||
<mat-form-field fxFlex class="m-10">
|
<mat-label>Email</mat-label>
|
||||||
<input matInput placeholder="Email">
|
<input type="email" matInput>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
<mat-grid-tile>
|
<mat-form-field fxFlex="48%">
|
||||||
<mat-form-field fxFlex class="m-10">
|
<mat-label>Mobile No</mat-label>
|
||||||
<input matInput placeholder="Mobile No">
|
<input type="tel" matInput>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-grid-tile>
|
|
||||||
|
|
||||||
</mat-grid-list>
|
</div>
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
|
|
||||||
|
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||||
|
<button type="button" mat-raised-button [routerLink]="['../']">Cancel</button>
|
||||||
|
<button mat-raised-button color="primary">Submit</button>
|
||||||
|
</mat-card-actions>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</mat-card-content>
|
</mat-card>
|
||||||
|
|
||||||
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
</div>
|
||||||
<button mat-raised-button color="primary">Submit</button>
|
|
||||||
<button mat-raised-button>Cancel</button>
|
|
||||||
</mat-card-actions>
|
|
||||||
|
|
||||||
</mat-card>
|
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
|
/** Angular Imports */
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit self service user component.
|
||||||
|
*
|
||||||
|
* TODO: Complete functionality once API is available.
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-edit-user',
|
selector: 'mifosx-edit-user',
|
||||||
templateUrl: './edit-user.component.html',
|
templateUrl: './edit-user.component.html',
|
||||||
@@ -7,9 +13,16 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class EditUserComponent implements OnInit {
|
export class EditUserComponent implements OnInit {
|
||||||
|
|
||||||
officeData: string[];
|
/** Placeholder for office data. */
|
||||||
staffData: string[];
|
officeData: any;
|
||||||
genderData: string[];
|
/** Placeholder for staff data. */
|
||||||
|
staffData: any;
|
||||||
|
/** Placeholder for gender data. */
|
||||||
|
genderData: any;
|
||||||
|
/** Minimum date of birth of user allowed. */
|
||||||
|
minDate = new Date(1900, 0, 1);
|
||||||
|
/** Maximum date of birth of user allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
/** Self Service User model. */
|
||||||
|
export interface User {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
email: string;
|
||||||
|
isSelfServiceUser: boolean;
|
||||||
|
officeName: string;
|
||||||
|
staff: string;
|
||||||
|
}
|
||||||
@@ -1,32 +1,57 @@
|
|||||||
|
/** Angular Routes */
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import { Observable } from 'rxjs/internal/Observable';
|
|
||||||
import { map } from 'rxjs/internal/operators/map';
|
|
||||||
|
|
||||||
|
/** rxjs Imports */
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
|
/** Custom Models */
|
||||||
|
import { User } from './user.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Self service users service.
|
||||||
|
*
|
||||||
|
* TODO: Complete functionality once API is available.
|
||||||
|
*/
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {HttpClient} http Http Client to send requests.
|
||||||
|
*/
|
||||||
constructor(private http: HttpClient) { }
|
constructor(private http: HttpClient) { }
|
||||||
|
|
||||||
getUsers(): Observable<any> {
|
/**
|
||||||
return this.http.get<any>(`/users?fields=id,firstname,lastname,email,officeName,staff&tenantIdentifier=default&pretty=true`)
|
* Gets all the self service users.
|
||||||
|
*
|
||||||
|
* TODO: To be replaced once API is available.
|
||||||
|
*/
|
||||||
|
getUsers(): Observable<User[]> {
|
||||||
|
const httpParams = new HttpParams().set('fields', 'id,firstname,lastname,email,officeName,staff');
|
||||||
|
return this.http.get('/users', { params: httpParams })
|
||||||
.pipe(
|
.pipe(
|
||||||
map((res) => {
|
map((users: any) => {
|
||||||
res.forEach((user: any) => {
|
users.forEach((user: any) => {
|
||||||
user.name = `${user.firstname} ${user.lastname}`;
|
user.name = `${user.firstname} ${user.lastname}`;
|
||||||
user.staff = user.staff ? `${user.staff.firstname} ${user.staff.lastname}` : '';
|
user.staff = user.staff ? `${user.staff.firstname} ${user.staff.lastname}` : '';
|
||||||
delete user.firstname;
|
delete user.firstname;
|
||||||
delete user.lastname;
|
delete user.lastname;
|
||||||
});
|
});
|
||||||
return res;
|
return users as User[];
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a self service user.
|
||||||
|
*
|
||||||
|
* TODO: Mock data to be replaced once API is available.
|
||||||
|
*/
|
||||||
getUser(): Observable<any> {
|
getUser(): Observable<any> {
|
||||||
return this.http.disableApiPrefix().get('http://localhost:4200/assets/mock/user.mock.json');
|
return this.http.disableApiPrefix().get('/assets/mock/user.mock.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,29 @@
|
|||||||
<mat-card class="container m-t-40">
|
<div class="container m-b-20" fxLayout="row" fxLayout.lt-md="column" fxLayoutAlign="end" fxLayoutGap="20px">
|
||||||
|
<!-- TODO: Update to show only Activate/Inactivate button at a time according to selection in table. -->
|
||||||
|
<button mat-raised-button color="accent">
|
||||||
|
<fa-icon icon="lock-open"></fa-icon>
|
||||||
|
Activate
|
||||||
|
</button>
|
||||||
|
<button mat-raised-button color="warn">
|
||||||
|
<fa-icon icon="lock"></fa-icon>
|
||||||
|
Deactivate
|
||||||
|
</button>
|
||||||
|
<button mat-raised-button color="primary" [routerLink]="['create']">
|
||||||
|
<fa-icon icon="plus"></fa-icon>
|
||||||
|
Create User
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div fxLayout="row" fxLayoutGap="30px" class="m-b-20">
|
<div class="container">
|
||||||
<!-- <mat-card-header> -->
|
|
||||||
|
|
||||||
<!-- <mat-grid-list cols="1" rowHeight="80px">
|
<div fxLayout="row">
|
||||||
|
<mat-form-field fxFlex>
|
||||||
<mat-grid-tile> -->
|
<mat-label>Filter</mat-label>
|
||||||
<mat-form-field fxFlex>
|
<input matInput type="text" (keyup)="applyFilter($event.target.value)">
|
||||||
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
|
</mat-form-field>
|
||||||
</mat-form-field>
|
|
||||||
<!-- </mat-grid-tile> -->
|
|
||||||
|
|
||||||
<!-- <mat-grid-tile> -->
|
|
||||||
<!-- <mat-card-actions> -->
|
|
||||||
<!-- <button mat-raised-button color="primary"><mat-icon>lock_open</mat-icon> Activate</button> -->
|
|
||||||
<!-- <button mat-raised-button color="primary"><mat-icon>lock</mat-icon> Deactivate</button> -->
|
|
||||||
<button mat-raised-button color="primary" [routerLink]="['/self-service/users/create']"><mat-icon>add</mat-icon> Create User</button>
|
|
||||||
<!-- </mat-card-actions> -->
|
|
||||||
<!-- </mat-grid-tile> -->
|
|
||||||
|
|
||||||
<!-- </mat-grid-list> -->
|
|
||||||
|
|
||||||
<!-- </mat-card-header> -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<mat-card-content class="mat-elevation-z8">
|
<div class="mat-elevation-z8">
|
||||||
|
|
||||||
<table mat-table [dataSource]="dataSource" matSort>
|
<table mat-table [dataSource]="dataSource" matSort>
|
||||||
|
|
||||||
@@ -45,46 +44,46 @@
|
|||||||
|
|
||||||
<ng-container matColumnDef="name">
|
<ng-container matColumnDef="name">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Name </th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Name </th>
|
||||||
<td mat-cell *matCellDef="let user"><span class="mobile-label">Name: </span>{{ user.name }} </td>
|
<td mat-cell *matCellDef="let user"> {{ user.name }} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="id">
|
<ng-container matColumnDef="id">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> User ID </th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> User ID </th>
|
||||||
<td mat-cell *matCellDef="let user"><span class="mobile-label">User ID: </span>{{ user.id }}</td>
|
<td mat-cell *matCellDef="let user"> {{ user.id }} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="email">
|
<ng-container matColumnDef="email">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Email ID </th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Email ID </th>
|
||||||
<td mat-cell *matCellDef="let user"><span class="mobile-label">Email ID: </span>{{ user.email }}</td>
|
<td mat-cell *matCellDef="let user"> {{ user.email }} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="status">
|
<ng-container matColumnDef="status">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header="isSelfServiceUser"> Status </th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header="isSelfServiceUser"> Status </th>
|
||||||
<td mat-cell *matCellDef="let user">
|
<td mat-cell *matCellDef="let user">
|
||||||
<span class="mobile-label">Status: </span>
|
|
||||||
<div [className]="user.isSelfServiceUser === true ? 'active' : 'inactive'">
|
<div [className]="user.isSelfServiceUser === true ? 'active' : 'inactive'">
|
||||||
<mat-icon matTooltip="{{ user.isSelfServiceUser === true ? 'Active' : 'Inactive' }}" matTooltipPosition="right">lens</mat-icon>
|
<fa-icon matTooltip="{{ user.isSelfServiceUser === true ? 'Active' : 'Inactive' }}" matTooltipPosition="right" icon="circle" size="lg"></fa-icon>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="officeName">
|
<ng-container matColumnDef="officeName">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Office </th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Office </th>
|
||||||
<td mat-cell *matCellDef="let user"><span class="mobile-label">Office: </span>{{ user.officeName }}</td>
|
<td mat-cell *matCellDef="let user"> {{ user.officeName }} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="staff">
|
<ng-container matColumnDef="staff">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Staff </th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Staff </th>
|
||||||
<td mat-cell *matCellDef="let user"><span class="mobile-label">Staff: </span>{{ user.staff }}</td>
|
<td mat-cell *matCellDef="let user"> {{ user.staff }} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="selection.toggle(row)"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="['view/1600']"></tr>
|
||||||
|
<!-- TODO: Update route once API is setup. -->
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||||
|
|
||||||
</mat-card-content>
|
</div>
|
||||||
|
|
||||||
</mat-card>
|
</div>
|
||||||
|
|||||||
@@ -1,53 +1,12 @@
|
|||||||
// td, th {
|
table {
|
||||||
// text-align: center;
|
|
||||||
// }
|
|
||||||
// ngb-pagination {
|
|
||||||
// margin: 20px 0px;
|
|
||||||
// }
|
|
||||||
|
|
||||||
.mat-table {
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .mat-form-field {
|
// TODO: CONFIGURE THESE CLASSES GLOBALLY
|
||||||
// width: 100%;
|
|
||||||
// }
|
|
||||||
|
|
||||||
.mobile-label {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inactive {
|
.inactive {
|
||||||
color: grey;
|
color: #d3d3d3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.active {
|
.active {
|
||||||
color: green;
|
color: #32cd32;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @media(max-width: 600px) {
|
|
||||||
// .mobile-label {
|
|
||||||
// width: 80px;
|
|
||||||
// display: inline-block;
|
|
||||||
// font-weight: bold;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .mat-header-row {
|
|
||||||
// display: none;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .mat-row {
|
|
||||||
// display: flex;
|
|
||||||
// flex-direction: column;
|
|
||||||
// align-items: start;
|
|
||||||
// padding: 68px 24px;
|
|
||||||
// min-height: 108px;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .mat-cell {
|
|
||||||
// flex: 1;
|
|
||||||
// display: flex;
|
|
||||||
// align-items: center;
|
|
||||||
// min-height: inherit;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
|
/** Angular Imports */
|
||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { SelectionModel } from '@angular/cdk/collections';
|
import { SelectionModel } from '@angular/cdk/collections';
|
||||||
import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
|
import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
import { UserService } from './user.service';
|
import { UserService } from './user.service';
|
||||||
|
|
||||||
export interface User {
|
/** Custom Model */
|
||||||
name: string;
|
import { User } from './user.model';
|
||||||
id: number;
|
|
||||||
email: string;
|
|
||||||
isSelfServiceUser: boolean;
|
|
||||||
officeName: string;
|
|
||||||
staff: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Self service users component.
|
||||||
|
*
|
||||||
|
* TODO: Complete functionality once API is available.
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-users',
|
selector: 'mifosx-users',
|
||||||
templateUrl: './users.component.html',
|
templateUrl: './users.component.html',
|
||||||
@@ -19,33 +22,60 @@ export interface User {
|
|||||||
})
|
})
|
||||||
export class UsersComponent implements OnInit {
|
export class UsersComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Self service users. */
|
||||||
|
userData: User[];
|
||||||
|
/** Columns to be displayed in users table. */
|
||||||
displayedColumns: string[] = ['select', 'name', 'id', 'email', 'status', 'officeName', 'staff'];
|
displayedColumns: string[] = ['select', 'name', 'id', 'email', 'status', 'officeName', 'staff'];
|
||||||
dataSource: any;
|
/** Data source for users table. */
|
||||||
|
dataSource: MatTableDataSource<User>;
|
||||||
|
/** Selection model for users table. */
|
||||||
selection = new SelectionModel<User>(true, []);
|
selection = new SelectionModel<User>(true, []);
|
||||||
|
|
||||||
|
/** Paginator for users table. */
|
||||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
/** Sorter for users table. */
|
||||||
@ViewChild(MatSort) sort: MatSort;
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
constructor(private userService: UserService) { }
|
/**
|
||||||
|
* Retrieves the users data from `resolve`.
|
||||||
ngOnInit() {
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
this.userService.getUsers().subscribe((data: User[]) => {
|
*/
|
||||||
this.dataSource = new MatTableDataSource(data);
|
constructor(private route: ActivatedRoute) {
|
||||||
this.dataSource.paginator = this.paginator;
|
this.route.data.subscribe((data: { users: User[] }) => {
|
||||||
this.dataSource.sort = this.sort;
|
this.userData = data.users;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the data source, paginator and sorter for users table.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.dataSource = new MatTableDataSource(this.userData);
|
||||||
|
this.dataSource.paginator = this.paginator;
|
||||||
|
this.dataSource.sort = this.sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters data in users table based on passed value.
|
||||||
|
* @param {string} filterValue Value to filter data.
|
||||||
|
*/
|
||||||
applyFilter(filterValue: string) {
|
applyFilter(filterValue: string) {
|
||||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
isAllSelected() {
|
/**
|
||||||
|
* Checks if all rows of users table are selected.
|
||||||
|
* @returns {boolean} True if all rows are selected.
|
||||||
|
*/
|
||||||
|
isAllSelected(): boolean {
|
||||||
const numSelected = this.selection.selected.length;
|
const numSelected = this.selection.selected.length;
|
||||||
const numRows = this.dataSource.data.length;
|
const numRows = this.dataSource.data.length;
|
||||||
return numSelected === numRows;
|
return numSelected === numRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles selection for all rows of users table.
|
||||||
|
*/
|
||||||
masterToggle() {
|
masterToggle() {
|
||||||
this.isAllSelected() ?
|
this.isAllSelected() ?
|
||||||
this.selection.clear() :
|
this.selection.clear() :
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/** Angular Routes */
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Resolve } from '@angular/router';
|
||||||
|
|
||||||
|
/** rxjs Imports */
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { UserService } from './user.service';
|
||||||
|
|
||||||
|
/** Custom Model */
|
||||||
|
import { User } from './user.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Self service users data resolver.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class UsersResolver implements Resolve<Object> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {UserService} userService Self service user service.
|
||||||
|
*/
|
||||||
|
constructor(private userService: UserService) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the users data.
|
||||||
|
* @returns {Observable<User[]>}
|
||||||
|
*/
|
||||||
|
resolve(): Observable<User[]> {
|
||||||
|
return this.userService.getUsers();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,102 +1,120 @@
|
|||||||
<mat-card class="container m-t-40">
|
<div class="container m-b-20" fxLayout="row" fxLayout.lt-md="column" fxLayoutAlign="end" fxLayoutGap="2%">
|
||||||
|
<!-- TODO: Update to show only Activate/Inactivate button at a time according to status of user. -->
|
||||||
|
<button mat-raised-button color="accent">
|
||||||
|
<fa-icon icon="lock-open"></fa-icon>
|
||||||
|
Activate
|
||||||
|
</button>
|
||||||
|
<button mat-raised-button color="warn">
|
||||||
|
<fa-icon icon="lock"></fa-icon>
|
||||||
|
Deactivate
|
||||||
|
</button>
|
||||||
|
<button mat-raised-button color="primary" (click)="openDialog()">
|
||||||
|
<fa-icon icon="cog"></fa-icon>
|
||||||
|
Change Password
|
||||||
|
</button>
|
||||||
|
<button mat-raised-button color="primary" [routerLink]="['edit']">
|
||||||
|
<fa-icon icon="edit"></fa-icon>
|
||||||
|
Edit
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<mat-card-header>
|
<div class="container">
|
||||||
<mat-icon matTooltip="Status" matTooltipPosition="above">lens</mat-icon> User ID: 123456
|
|
||||||
</mat-card-header>
|
|
||||||
|
|
||||||
<mat-card-actions align="right">
|
<mat-card>
|
||||||
<button mat-raised-button color="primary" [routerLink]="['/self-service/users/view/123456/edit']"><mat-icon>edit</mat-icon> Edit</button>
|
|
||||||
<button mat-raised-button color="primary" (click)="openDialog()"><mat-icon>settings</mat-icon> Change Password</button>
|
|
||||||
<button mat-raised-button color="primary"><mat-icon>lock</mat-icon> Deactivate</button>
|
|
||||||
</mat-card-actions>
|
|
||||||
|
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
|
|
||||||
<mat-grid-list cols="2" rowHeight="40px" style="width: 600px;">
|
<div fxLayout="row wrap" class="content">
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="100%" class="header">
|
||||||
Username
|
<fa-icon icon="circle" size="lg" matTooltip="{{ user.status }}" matTooltipPosition="above"></fa-icon>
|
||||||
</mat-grid-tile>
|
ID: {{ user.id }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%" class="header">
|
||||||
abhaychawla
|
Username
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%">
|
||||||
First Name
|
{{ user.username }}
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%" class="header">
|
||||||
Abhay
|
First Name
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%">
|
||||||
Last Name
|
{{ user.firstName }}
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%" class="header">
|
||||||
Chawla
|
Last Name
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%">
|
||||||
Gender
|
{{ user.lastName }}
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%" class="header">
|
||||||
Male
|
Gender
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%">
|
||||||
Date of Birth
|
{{ user.gender }}
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%" class="header">
|
||||||
18/06/1997
|
Date of Birth
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%">
|
||||||
Email
|
{{ user.dateOfBirth }}
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%" class="header">
|
||||||
abhay.chawla97@gmail.com
|
Email
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%">
|
||||||
Mobile
|
{{ user.email }}
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%" class="header">
|
||||||
9871105236
|
Mobile
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%">
|
||||||
Office
|
{{ user.mobile }}
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%" class="header">
|
||||||
Head Office
|
Office
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex="50%">
|
||||||
|
{{ user.office }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%" class="header">
|
||||||
Staff
|
Staff
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%">
|
||||||
Smith W
|
{{ user.staff }}
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%" class="header">
|
||||||
Activation Date
|
Activation Date
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
<mat-grid-tile>
|
<div fxFlex="50%">
|
||||||
12/03/2018
|
{{ user.activationDate }}
|
||||||
</mat-grid-tile>
|
</div>
|
||||||
|
|
||||||
</mat-grid-list>
|
</div>
|
||||||
|
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
.container {
|
||||||
|
max-width: 37rem;
|
||||||
|
|
||||||
|
.content {
|
||||||
|
div {
|
||||||
|
margin: 1rem 0;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
|
/** Angular Imports */
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View self service user component.
|
||||||
|
*
|
||||||
|
* TODO: Complete functionality once API is available.
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-view-user',
|
selector: 'mifosx-view-user',
|
||||||
templateUrl: './view-user.component.html',
|
templateUrl: './view-user.component.html',
|
||||||
@@ -7,13 +14,24 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class ViewUserComponent implements OnInit {
|
export class ViewUserComponent implements OnInit {
|
||||||
|
|
||||||
constructor() { }
|
/** Self service user. */
|
||||||
|
user: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the user data from `resolve`.
|
||||||
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
|
*/
|
||||||
|
constructor(private route: ActivatedRoute) {
|
||||||
|
this.route.data.subscribe((data: { user: any }) => {
|
||||||
|
this.user = data.user;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
openDialog() {
|
openDialog() {
|
||||||
// TODO: Change Password Dialog
|
// TODO: Open change password dialog.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,32 @@
|
|||||||
|
/** Angular Imports */
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Resolve } from '@angular/router';
|
import { Resolve } from '@angular/router';
|
||||||
|
|
||||||
import { Observable, of } from 'rxjs';
|
/** rxjs Imports */
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
import { UserService } from '../user.service';
|
import { UserService } from '../user.service';
|
||||||
|
|
||||||
|
/** Custom Model */
|
||||||
|
import { User } from '../user.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View self service user data resolver.
|
||||||
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ViewUserResolver implements Resolve<Object> {
|
export class ViewUserResolver implements Resolve<Object> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {UserService} userService Self service user service.
|
||||||
|
*/
|
||||||
constructor(private userService: UserService) {}
|
constructor(private userService: UserService) {}
|
||||||
|
|
||||||
resolve(): Observable<any> {
|
/**
|
||||||
|
* Returns the user data.
|
||||||
|
* @returns {Observable<User>}
|
||||||
|
*/
|
||||||
|
resolve(): Observable<User> {
|
||||||
return this.userService.getUser();
|
return this.userService.getUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ import {
|
|||||||
faCheckCircle,
|
faCheckCircle,
|
||||||
faChevronLeft,
|
faChevronLeft,
|
||||||
faChevronRight,
|
faChevronRight,
|
||||||
|
faCircle,
|
||||||
faCog,
|
faCog,
|
||||||
|
faEdit,
|
||||||
faEye,
|
faEye,
|
||||||
faEyeSlash,
|
faEyeSlash,
|
||||||
faFileUpload,
|
faFileUpload,
|
||||||
@@ -19,6 +21,7 @@ import {
|
|||||||
faHome,
|
faHome,
|
||||||
faLocationArrow,
|
faLocationArrow,
|
||||||
faLock,
|
faLock,
|
||||||
|
faLockOpen,
|
||||||
faMoneyBillAlt,
|
faMoneyBillAlt,
|
||||||
faPlus,
|
faPlus,
|
||||||
faSearch,
|
faSearch,
|
||||||
@@ -41,7 +44,9 @@ library.add(
|
|||||||
faCheckCircle,
|
faCheckCircle,
|
||||||
faChevronLeft,
|
faChevronLeft,
|
||||||
faChevronRight,
|
faChevronRight,
|
||||||
|
faCircle,
|
||||||
faCog,
|
faCog,
|
||||||
|
faEdit,
|
||||||
faEye,
|
faEye,
|
||||||
faEyeSlash,
|
faEyeSlash,
|
||||||
faFileUpload,
|
faFileUpload,
|
||||||
@@ -49,6 +54,7 @@ library.add(
|
|||||||
faHome,
|
faHome,
|
||||||
faLocationArrow,
|
faLocationArrow,
|
||||||
faLock,
|
faLock,
|
||||||
|
faLockOpen,
|
||||||
faMoneyBillAlt,
|
faMoneyBillAlt,
|
||||||
faPlus,
|
faPlus,
|
||||||
faSearch,
|
faSearch,
|
||||||
|
|||||||
@@ -1,4 +1,14 @@
|
|||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1600,
|
||||||
"username": "abhaychawla"
|
"username": "abhaychawla",
|
||||||
|
"status": "status",
|
||||||
|
"firstName": "Abhay",
|
||||||
|
"lastName": "Chawla",
|
||||||
|
"gender": "Male",
|
||||||
|
"dateOfBirth": "18/06/1997",
|
||||||
|
"email": "abhay.chawla97@gmail.com",
|
||||||
|
"mobile": "9871105236",
|
||||||
|
"office": "Head Office",
|
||||||
|
"staff": "Smith W",
|
||||||
|
"activationDate": "12/03/2018"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user