Add user settings page.

This commit is contained in:
Spencer Ofwiti 2020-11-25 10:59:48 +03:00
parent 588fd4817d
commit 4ee55c2bc0
14 changed files with 460 additions and 0 deletions

View File

@ -0,0 +1,41 @@
<!-- Begin page -->
<div class="wrapper">
<app-sidebar></app-sidebar>
<!-- ============================================================== -->
<!-- Start Page Content here -->
<!-- ============================================================== -->
<div id="content">
<app-topbar></app-topbar>
<!-- Start Content-->
<div class="container-fluid" appMenuSelection>
<div class="col-md-6">
<div class="card">
<mat-card-title class="card-header text-center">
INVITE NEW USERS
</mat-card-title>
<div class="card-body">
<form>
<mat-form-field appearance="outline">
<mat-label>Email Address: </mat-label>
<input matInput type="email" id="email" placeholder="Email">
</mat-form-field><br>
<mat-radio-group aria-label="Select a role">
<mat-radio-button value="Superadmin">Superadmin</mat-radio-button><br>
<mat-radio-button value="Admin">Admin</mat-radio-button><br>
<mat-radio-button value="Subadmin">Subadmin</mat-radio-button><br>
<mat-radio-button value="View">View</mat-radio-button><br>
</mat-radio-group>
<button mat-raised-button type="submit" class="btn btn-outline-primary">INVITE</button>
</form>
</div>
</div>
</div>
</div>
<app-footer appMenuSelection></app-footer>
</div>
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->
</div>

View File

@ -0,0 +1,37 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { InviteComponent } from './invite.component';
import {FooterStubComponent, SidebarStubComponent, TopbarStubComponent} from '../../../../testing';
import {SettingsModule} from '../settings.module';
import {AppModule} from '../../../app.module';
describe('InviteComponent', () => {
let component: InviteComponent;
let fixture: ComponentFixture<InviteComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
InviteComponent,
FooterStubComponent,
SidebarStubComponent,
TopbarStubComponent
],
imports: [
AppModule,
SettingsModule,
]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(InviteComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-invite',
templateUrl: './invite.component.html',
styleUrls: ['./invite.component.scss']
})
export class InviteComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -0,0 +1,49 @@
<!-- Begin page -->
<div class="wrapper">
<app-sidebar></app-sidebar>
<!-- ============================================================== -->
<!-- Start Page Content here -->
<!-- ============================================================== -->
<div id="content">
<app-topbar></app-topbar>
<!-- Start Content-->
<div class="container-fluid" appMenuSelection>
<div class="col-md-6">
<div class="card">
<mat-card-title class="card-header text-center">
DEFAULT ORGANISATION SETTINGS
</mat-card-title>
<div class="card-body">
<form>
<mat-form-field appearance="outline">
<mat-label>Default Disbursement *</mat-label>
<input matInput type="text" id="amount" placeholder="Amount">
<span matSuffix>RCU</span>
</mat-form-field>
<div class="form-group form-check">
<mat-checkbox id="transferCard">Require Transfer Card *</mat-checkbox>
</div>
<mat-form-field appearance="outline">
<mat-label>Default Country Code *</mat-label>
<mat-select id="countryCode">
<mat-option value="KE">KE Kenya</mat-option>
<mat-option value="US">US United States</mat-option>
<mat-option value="ETH">ETH Ethiopia</mat-option>
<mat-option value="GER">GER Germany</mat-option>
<mat-option value="UG">UG Uganda</mat-option>
</mat-select>
</mat-form-field><br>
<button mat-raised-button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</div>
<app-footer appMenuSelection></app-footer>
</div>
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->
</div>

View File

@ -0,0 +1,37 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { OrganizationComponent } from './organization.component';
import {FooterStubComponent, SidebarStubComponent, TopbarStubComponent} from '../../../../testing';
import {SettingsModule} from '../settings.module';
import {AppModule} from '../../../app.module';
describe('OrganizationComponent', () => {
let component: OrganizationComponent;
let fixture: ComponentFixture<OrganizationComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
OrganizationComponent,
FooterStubComponent,
SidebarStubComponent,
TopbarStubComponent
],
imports: [
AppModule,
SettingsModule,
]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(OrganizationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-organization',
templateUrl: './organization.component.html',
styleUrls: ['./organization.component.scss']
})
export class OrganizationComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SettingsComponent } from './settings.component';
import {InviteComponent} from './invite/invite.component';
import {OrganizationComponent} from './organization/organization.component';
const routes: Routes = [
{ path: '', component: SettingsComponent },
{ path: 'invite', component: InviteComponent },
{ path: 'organization', component: OrganizationComponent },
{ path: '**', redirectTo: '', pathMatch: 'full' }
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class SettingsRoutingModule { }

View File

@ -0,0 +1,129 @@
<!-- Begin page -->
<div class="wrapper">
<app-sidebar></app-sidebar>
<!-- ============================================================== -->
<!-- Start Page Content here -->
<!-- ============================================================== -->
<div id="content">
<app-topbar></app-topbar>
<!-- Start Content-->
<div class="container-fluid" appMenuSelection>
<div class="row">
<div class="col-md-6 mb-2">
<div class="card">
<div class="card-header text-center">
SETTINGS
</div>
<div class="card-body">
<h4>Kobo Toolbox Credentials</h4>
<p><strong>Username: </strong> admin_reserve </p>
<p><strong>Password: </strong> p@55w0rd </p>
</div>
<hr>
<div class="card-body">
<h4>Account Status: </h4>
<span><i class="fa fa-check-circle"></i> Please contact support.</span>
</div>
<hr>
<div class="card-body">
<h4>Support</h4>
<span><i class="fa fa-commenting"></i> Chat</span><br>
<span><i class="fa fa-book"></i> Help Center</span>
</div>
<hr>
<div class="card-body">
<h4>Organization Settings</h4>
<p routerLink="/settings/organization"><i>Update your organization settings</i></p>
</div>
</div>
</div>
<div class="col-md-6 mb-2">
<div class="card">
<div class="card-header text-center">
ACCOUNT MANAGEMENT
</div>
<div class="card-body">
<h4>Change Password</h4>
<p><i>Change your account password</i></p>
</div>
<hr>
<div class="card-body">
<h4>Two-step authentication</h4>
<p><i>Secure your account with two step verification</i></p>
</div>
<hr>
<div class="card-body">
<button mat-raised-button type="button" class="btn btn-outline-primary"> LOGOUT ADMIN </button>
</div>
</div>
</div>
</div>
<div class="col-12">
<div class="card mb-3">
<div class="card-header">
<div class="row">
USERS
<button mat-raised-button routerLink="/settings/invite" type="button" class="btn btn-outline-primary ml-auto"><i class="fa fa-plus"> NEW USER </i></button>
</div>
</div>
<div class="card-body">
<mat-form-field appearance="outline">
<mat-label> Filter </mat-label>
<input matInput type="text" (keyup)="doFilter($event.target.value)" placeholder="Filter">
<mat-icon matSuffix>search</mat-icon>
</mat-form-field>
<mat-table class="mat-elevation-z10" [dataSource]="dataSource" matSort matSortActive="name"
matSortDirection="asc" matSortDisableClear>
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef mat-sort-header> NAME </mat-header-cell>
<mat-cell *matCellDef="let user"> {{user.name}} </mat-cell>
</ng-container>
<ng-container matColumnDef="accountType">
<mat-header-cell *matHeaderCellDef mat-sort-header> ACCOUNT TYPE </mat-header-cell>
<mat-cell *matCellDef="let user"> {{user.accountType}} </mat-cell>
</ng-container>
<ng-container matColumnDef="created">
<mat-header-cell *matHeaderCellDef mat-sort-header> CREATED </mat-header-cell>
<mat-cell *matCellDef="let user"> {{user.created}} </mat-cell>
</ng-container>
<ng-container matColumnDef="status">
<mat-header-cell *matHeaderCellDef mat-sort-header> STATUS </mat-header-cell>
<mat-cell *matCellDef="let user"><span class="badge badge-primary badge-pill"> {{user.status}} </span>
</mat-cell>
</ng-container>
<ng-container matColumnDef="options">
<mat-header-cell *matHeaderCellDef> </mat-header-cell>
<mat-cell *matCellDef="let user" class="dropdown">
<button mat-raised-button [matMenuTriggerFor]="menu" class="btn btn-outline-danger ml-1"><i class="fa fa-ellipsis-h"></i></button>
<mat-menu #menu='matMenu'>
<button mat-menu-item>Change to Super Admin</button>
<button mat-menu-item>Change to Admin</button>
<button mat-menu-item>Change to Enroller</button>
<button mat-menu-item>Change to View Only</button>
<button mat-menu-item>Disable User</button>
</mat-menu>
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let transaction; columns: displayedColumns"></mat-row>
</mat-table>
<mat-paginator [pageSize]="5" [pageSizeOptions]="[5, 10, 20, 50, 100]" showFirstLastButtons></mat-paginator>
</div>
</div>
</div>
</div>
<app-footer appMenuSelection></app-footer>
</div>
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->
</div>

View File

@ -0,0 +1,37 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingsComponent } from './settings.component';
import {FooterStubComponent, SidebarStubComponent, TopbarStubComponent} from '../../../testing';
import {SettingsModule} from './settings.module';
import {AppModule} from '../../app.module';
describe('SettingsComponent', () => {
let component: SettingsComponent;
let fixture: ComponentFixture<SettingsComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
SettingsComponent,
FooterStubComponent,
SidebarStubComponent,
TopbarStubComponent
],
imports: [
AppModule,
SettingsModule,
]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(SettingsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,38 @@
import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core';
import {MatTableDataSource} from '@angular/material/table';
import {MatPaginator} from '@angular/material/paginator';
import {MatSort} from '@angular/material/sort';
@Component({
selector: 'app-settings',
templateUrl: './settings.component.html',
styleUrls: ['./settings.component.scss']
})
export class SettingsComponent implements OnInit, AfterViewInit {
data = [
{ name: 'admin@acme.org', accountType: 'Admin', created: '17/11/2020', status: 'activated'}
];
date: string;
dataSource: MatTableDataSource<any>;
displayedColumns = ['name', 'accountType', 'created', 'status', 'options'];
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
constructor() { }
ngOnInit(): void {
this.dataSource = new MatTableDataSource<any>(this.data);
const d = new Date();
this.date = `${d.getDate()}/${d.getMonth()}/${d.getFullYear()}`;
}
ngAfterViewInit(): void {
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}
doFilter(value: string): void {
this.dataSource.filter = value.trim().toLocaleLowerCase();
}
}

View File

@ -0,0 +1,43 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SettingsRoutingModule } from './settings-routing.module';
import { SettingsComponent } from './settings.component';
import {SharedModule} from '../../shared/shared.module';
import { InviteComponent } from './invite/invite.component';
import { OrganizationComponent } from './organization/organization.component';
import {MatTableModule} from '@angular/material/table';
import {MatSortModule} from '@angular/material/sort';
import {MatPaginatorModule} from '@angular/material/paginator';
import {MatInputModule} from '@angular/material/input';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatButtonModule} from '@angular/material/button';
import {MatIconModule} from '@angular/material/icon';
import {MatCardModule} from '@angular/material/card';
import {MatRadioModule} from '@angular/material/radio';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatSelectModule} from '@angular/material/select';
import {MatMenuModule} from '@angular/material/menu';
@NgModule({
declarations: [SettingsComponent, InviteComponent, OrganizationComponent],
imports: [
CommonModule,
SettingsRoutingModule,
SharedModule,
MatTableModule,
MatSortModule,
MatPaginatorModule,
MatInputModule,
MatFormFieldModule,
MatButtonModule,
MatIconModule,
MatCardModule,
MatRadioModule,
MatCheckboxModule,
MatSelectModule,
MatMenuModule
]
})
export class SettingsModule { }