Merge remote-tracking branch 'origin/TBSliver/CoreUI' into finn/MoreCoreUI

This commit is contained in:
piratefinn 2017-08-31 11:11:14 +01:00
commit ccb743ec43
11 changed files with 200 additions and 941 deletions

View file

@ -17,6 +17,8 @@ import { AppRoutingModule } from './app.routing';
import { AuthGuard } from './_guards/auth.guard'; import { AuthGuard } from './_guards/auth.guard';
import { ApiService } from './providers/api-service'; import { ApiService } from './providers/api-service';
import { OrgGraphsService } from './providers/org-graphs.service';
// Layouts // Layouts
import { FullLayoutComponent } from './layouts/full-layout.component'; import { FullLayoutComponent } from './layouts/full-layout.component';
import { SimpleLayoutComponent } from './layouts/simple-layout.component'; import { SimpleLayoutComponent } from './layouts/simple-layout.component';
@ -54,6 +56,7 @@ import { DashboardModule } from './dashboard/dashboard.module';
providers: [ providers: [
AuthGuard, AuthGuard,
ApiService, ApiService,
OrgGraphsService,
{ {
provide: LocationStrategy, provide: LocationStrategy,
useClass: HashLocationStrategy useClass: HashLocationStrategy

View file

@ -36,6 +36,9 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div *ngFor="let widget of widgetList" class="col-sm-6 col-lg-3">
<widget-graph *ngIf="widget.type == 'graph'" [graphName]="widget.name" [graphTitle]="widget.title" [graphIcon]="widget.icon"></widget-graph>
</div>
<div *ngIf="showGraph.noofcustomerssector" class="col-sm-6 col-lg-3"> <div *ngIf="showGraph.noofcustomerssector" class="col-sm-6 col-lg-3">
<div class="card card-inverse card-primary"> <div class="card card-inverse card-primary">
<div class="card-block"> <div class="card-block">
@ -60,79 +63,6 @@
</div> </div>
</div> </div>
</div><!--/.col--> </div><!--/.col-->
<div *ngIf="showGraph.customersthisweek" class="col-sm-6 col-lg-3">
<div class="card card-inverse card-primary">
<div class="card-block pb-0">
<div class="btn-group float-right" dropdown>
<button type="button" class="btn btn-transparent dropdown-toggle p-0" dropdownToggle>
<i class="icon-settings"></i>
</button>
<div class="dropdown-menu dropdown-menu-right" *dropdownMenu>
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
<h4 class="mb-0">138</h4>
<p>Customers this week</p>
</div>
<div class="chart-wrapper px-3" style="height:70px;">
<canvas baseChart class="chart"
[datasets]="lineChart1Data"
[labels]="lineChart1Labels"
[options]="lineChart1Options"
[colors]="lineChart1Colours"
[legend]="lineChart1Legend"
[chartType]="lineChart1Type"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>
</div><!--/.col-->
<div *ngIf="showGraph.customerslastweek" class="col-sm-6 col-lg-3">
<div class="card card-inverse card-info">
<div class="card-block pb-0">
<button type="button" class="btn btn-transparent p-0 float-right">
<i class="icon-location-pin"></i>
</button>
<h4 class="mb-0">9.823</h4>
<p>Customers last week</p>
</div>
<div class="chart-wrapper px-3" style="height:70px;">
<canvas baseChart class="chart"
[datasets]="lineChart2Data"
[labels]="lineChart2Labels"
[options]="lineChart2Options"
[colors]="lineChart2Colours"
[legend]="lineChart2Legend"
[chartType]="lineChart2Type"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>
</div><!--/.col-->
<div *ngIf="showGraph.customerslastmonth" class="col-sm-6 col-lg-3">
<div class="card card-inverse card-info">
<div class="card-block pb-0">
<button type="button" class="btn btn-transparent p-0 float-right">
<i class="icon-location-pin"></i>
</button>
<h4 class="mb-0">9.823</h4>
<p>Customers last month</p>
</div>
<div class="chart-wrapper px-3" style="height:70px;">
<canvas baseChart class="chart"
[datasets]="lineChart3Data"
[labels]="lineChart3Labels"
[options]="lineChart3Options"
[colors]="lineChart3Colours"
[legend]="lineChart3Legend"
[chartType]="lineChart3Type"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>
</div><!--/.col-->
<div *ngIf="showGraph.customerslastyear" class="col-sm-6 col-lg-3"> <div *ngIf="showGraph.customerslastyear" class="col-sm-6 col-lg-3">
<div class="card card-inverse card-info"> <div class="card card-inverse card-info">
<div class="card-block pb-0"> <div class="card-block pb-0">
@ -378,755 +308,4 @@
</ul> </ul>
</div> </div>
</div> </div>
<!--/.card-->
<div class="row">
<div class="col-sm-6 col-lg-3">
<div class="social-box facebook">
<i class="fa fa-facebook"></i>
<div class="chart-wrapper">
<canvas baseChart class="chart"
[datasets]="socialChartData1"
[labels]="socialChartLabels"
[options]="socialChartOptions"
[colors]="socialChartColours"
[legend]="socialChartLegend"
[chartType]="socialChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
<ul>
<li>
<strong>89k</strong>
<span>friends</span>
</li>
<li>
<strong>459</strong>
<span>feeds</span>
</li>
</ul>
</div>
<!--/.social-box-->
</div><!--/.col-->
<div class="col-sm-6 col-lg-3">
<div class="social-box twitter">
<i class="fa fa-twitter"></i>
<div class="chart-wrapper">
<canvas baseChart class="chart"
[datasets]="socialChartData2"
[labels]="socialChartLabels"
[options]="socialChartOptions"
[colors]="socialChartColours"
[legend]="socialChartLegend"
[chartType]="socialChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
<ul>
<li>
<strong>973k</strong>
<span>followers</span>
</li>
<li>
<strong>1.792</strong>
<span>tweets</span>
</li>
</ul>
</div>
<!--/.social-box-->
</div><!--/.col-->
<div class="col-sm-6 col-lg-3">
<div class="social-box linkedin">
<i class="fa fa-linkedin"></i>
<div class="chart-wrapper">
<canvas baseChart class="chart"
[datasets]="socialChartData3"
[labels]="socialChartLabels"
[options]="socialChartOptions"
[colors]="socialChartColours"
[legend]="socialChartLegend"
[chartType]="socialChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
<ul>
<li>
<strong>500+</strong>
<span>contacts</span>
</li>
<li>
<strong>292</strong>
<span>feeds</span>
</li>
</ul>
</div>
<!--/.social-box-->
</div><!--/.col-->
<div class="col-sm-6 col-lg-3">
<div class="social-box google-plus">
<i class="fa fa-google-plus"></i>
<div class="chart-wrapper">
<canvas baseChart class="chart"
[datasets]="socialChartData4"
[labels]="socialChartLabels"
[options]="socialChartOptions"
[colors]="socialChartColours"
[legend]="socialChartLegend"
[chartType]="socialChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
<ul>
<li>
<strong>894</strong>
<span>followers</span>
</li>
<li>
<strong>92</strong>
<span>circles</span>
</li>
</ul>
</div>
<!--/.social-box-->
</div><!--/.col-->
</div><!--/.row-->
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
Traffic &amp; Sales
</div>
<div class="card-block">
<div class="row">
<div class="col-sm-12 col-lg-4">
<div class="row">
<div class="col-sm-6">
<div class="callout callout-info">
<small class="text-muted">New Clients</small>
<br>
<strong class="h4">9,123</strong>
<div class="chart-wrapper" style="width:100px;height:30px;">
<canvas baseChart class="chart"
[datasets]="sparklineChartData1"
[labels]="sparklineChartLabels"
[options]="sparklineChartOptions"
[colors]="sparklineChartInfo"
[legend]="sparklineChartLegend"
[chartType]="sparklineChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>
</div><!--/.col-->
<div class="col-sm-6">
<div class="callout callout-danger">
<small class="text-muted">Recuring Clients</small>
<br>
<strong class="h4">22,643</strong>
<div class="chart-wrapper" style="width:100px;height:30px;">
<canvas baseChart class="chart"
[datasets]="sparklineChartData2"
[labels]="sparklineChartLabels"
[options]="sparklineChartOptions"
[colors]="sparklineChartDanger"
[legend]="sparklineChartLegend"
[chartType]="sparklineChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>
</div><!--/.col-->
</div><!--/.row-->
<hr class="mt-0">
<ul class="horizontal-bars">
<li>
<div class="title">
Monday
</div>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-info" role="progressbar" style="width: 34%" aria-valuenow="34" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-danger" role="progressbar" style="width: 78%" aria-valuenow="78" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li>
<div class="title">
Tuesday
</div>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-info" role="progressbar" style="width: 56%" aria-valuenow="56" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-danger" role="progressbar" style="width: 94%" aria-valuenow="94" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li>
<div class="title">
Wednesday
</div>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-info" role="progressbar" style="width: 12%" aria-valuenow="12" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-danger" role="progressbar" style="width: 67%" aria-valuenow="67" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li>
<div class="title">
Thursday
</div>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-info" role="progressbar" style="width: 43%" aria-valuenow="43" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-danger" role="progressbar" style="width: 91%" aria-valuenow="91" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li>
<div class="title">
Friday
</div>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-info" role="progressbar" style="width: 22%" aria-valuenow="22" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-danger" role="progressbar" style="width: 73%" aria-valuenow="73" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li>
<div class="title">
Saturday
</div>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-info" role="progressbar" style="width: 53%" aria-valuenow="53" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-danger" role="progressbar" style="width: 82%" aria-valuenow="82" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li>
<div class="title">
Sunday
</div>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-info" role="progressbar" style="width: 9%" aria-valuenow="9" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-danger" role="progressbar" style="width: 69%" aria-valuenow="69" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li class="legend">
<span class="badge badge-pill badge-info"></span> <small>New clients</small> &nbsp; <span class="badge badge-pill badge-danger"></span> <small>Recurring clients</small>
</li>
</ul>
</div><!--/.col-->
<div class="col-sm-6 col-lg-4">
<div class="row">
<div class="col-sm-6">
<div class="callout callout-warning">
<small class="text-muted">Pageviews</small>
<br>
<strong class="h4">78,623</strong>
<div class="chart-wrapper" style="width:100px;height:30px;">
<canvas baseChart class="chart"
[datasets]="sparklineChartData1"
[labels]="sparklineChartLabels"
[options]="sparklineChartOptions"
[colors]="sparklineChartWarning"
[legend]="sparklineChartLegend"
[chartType]="sparklineChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>
</div><!--/.col-->
<div class="col-sm-6">
<div class="callout callout-success">
<small class="text-muted">Organic</small>
<br>
<strong class="h4">49,123</strong>
<div class="chart-wrapper" style="width:100px;height:30px;">
<canvas baseChart class="chart"
[datasets]="sparklineChartData2"
[labels]="sparklineChartLabels"
[options]="sparklineChartOptions"
[colors]="sparklineChartSuccess"
[legend]="sparklineChartLegend"
[chartType]="sparklineChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>
</div><!--/.col-->
</div><!--/.row-->
<hr class="mt-0">
<ul class="horizontal-bars type-2">
<li>
<i class="icon-user"></i>
<span class="title">Male</span>
<span class="value">43%</span>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-warning" role="progressbar" style="width: 43%" aria-valuenow="43" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li>
<i class="icon-user-female"></i>
<span class="title">Female</span>
<span class="value">37%</span>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-warning" role="progressbar" style="width: 37%" aria-valuenow="37" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<i class="icon-globe"></i>
<span class="title">Organic Search</span>
<span class="value">191,235 <span class="text-muted small">(56%)</span></span>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-success" role="progressbar" style="width: 56%" aria-valuenow="56" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li>
<i class="icon-social-facebook"></i>
<span class="title">Facebook</span>
<span class="value">51,223 <span class="text-muted small">(15%)</span></span>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-success" role="progressbar" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li>
<i class="icon-social-twitter"></i>
<span class="title">Twitter</span>
<span class="value">37,564 <span class="text-muted small">(11%)</span></span>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-success" role="progressbar" style="width: 11%" aria-valuenow="11" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li>
<i class="icon-social-linkedin"></i>
<span class="title">LinkedIn</span>
<span class="value">27,319 <span class="text-muted small">(8%)</span></span>
<div class="bars">
<div class="progress progress-xs">
<div class="progress-bar bg-success" role="progressbar" style="width: 8%" aria-valuenow="8" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</li>
<li class="divider text-center">
<button type="button" class="btn btn-sm btn-link text-muted" data-toggle="tooltip" data-placement="top" title="" data-original-title="show more"><i class="icon-options"></i></button>
</li>
</ul>
</div><!--/.col-->
<div class="col-sm-6 col-lg-4">
<div class="row">
<div class="col-sm-6">
<div class="callout">
<small class="text-muted">CTR</small>
<br>
<strong class="h4">23%</strong>
<div class="chart-wrapper" style="width:100px;height:30px;">
<canvas baseChart class="chart"
[datasets]="sparklineChartData1"
[labels]="sparklineChartLabels"
[options]="sparklineChartOptions"
[colors]="sparklineChartDefault"
[legend]="sparklineChartLegend"
[chartType]="sparklineChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>
</div><!--/.col-->
<div class="col-sm-6">
<div class="callout callout-primary">
<small class="text-muted">Bounce Rate</small>
<br>
<strong class="h4">5%</strong>
<div class="chart-wrapper" style="width:100px;height:30px;">
<canvas baseChart class="chart"
[datasets]="sparklineChartData2"
[labels]="sparklineChartLabels"
[options]="sparklineChartOptions"
[colors]="sparklineChartPrimary"
[legend]="sparklineChartLegend"
[chartType]="sparklineChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>
</div><!--/.col-->
</div><!--/.row-->
<hr class="mt-0">
<ul class="icons-list">
<li>
<i class="icon-screen-desktop bg-primary"></i>
<div class="desc">
<div class="title">iMac 4k</div>
<small>Lorem ipsum dolor sit amet</small>
</div>
<div class="value">
<div class="small text-muted">Sold this week</div>
<strong>1.924</strong>
</div>
<div class="actions">
<button type="button" class="btn btn-link text-muted"><i class="icon-settings"></i></button>
</div>
</li>
<li>
<i class="icon-screen-smartphone bg-info"></i>
<div class="desc">
<div class="title">Samsung Galaxy Edge</div>
<small>Lorem ipsum dolor sit amet</small>
</div>
<div class="value">
<div class="small text-muted">Sold this week</div>
<strong>1.224</strong>
</div>
<div class="actions">
<button type="button" class="btn btn-link text-muted"><i class="icon-settings"></i></button>
</div>
</li>
<li>
<i class="icon-screen-smartphone bg-warning"></i>
<div class="desc">
<div class="title">iPhone 6S</div>
<small>Lorem ipsum dolor sit amet</small>
</div>
<div class="value">
<div class="small text-muted">Sold this week</div>
<strong>1.163</strong>
</div>
<div class="actions">
<button type="button" class="btn btn-link text-muted"><i class="icon-settings"></i></button>
</div>
</li>
<li>
<i class="icon-user bg-danger"></i>
<div class="desc">
<div class="title">Premium accounts</div>
<small>Lorem ipsum dolor sit amet</small>
</div>
<div class="value">
<div class="small text-muted">Sold this week</div>
<strong>928</strong>
</div>
<div class="actions">
<button type="button" class="btn btn-link text-muted"><i class="icon-settings"></i></button>
</div>
</li>
<li>
<i class="icon-social-spotify bg-success"></i>
<div class="desc">
<div class="title">Spotify Subscriptions</div>
<small>Lorem ipsum dolor sit amet</small>
</div>
<div class="value">
<div class="small text-muted">Sold this week</div>
<strong>893</strong>
</div>
<div class="actions">
<button type="button" class="btn btn-link text-muted"><i class="icon-settings"></i></button>
</div>
</li>
<li>
<i class="icon-cloud-download bg-danger"></i>
<div class="desc">
<div class="title">Ebook</div>
<small>Lorem ipsum dolor sit amet</small>
</div>
<div class="value">
<div class="small text-muted">Downloads</div>
<strong>121.924</strong>
</div>
<div class="actions">
<button type="button" class="btn btn-link text-muted"><i class="icon-settings"></i></button>
</div>
</li>
<li>
<i class="icon-camera bg-warning"></i>
<div class="desc">
<div class="title">Photos</div>
<small>Lorem ipsum dolor sit amet</small>
</div>
<div class="value">
<div class="small text-muted">Uploaded</div>
<strong>12.125</strong>
</div>
<div class="actions">
<button type="button" class="btn btn-link text-muted"><i class="icon-settings"></i></button>
</div>
</li>
<li class="divider text-center">
<button type="button" class="btn btn-sm btn-link text-muted" data-toggle="tooltip" data-placement="top" title="show more"><i class="icon-options"></i></button>
</li>
</ul>
</div><!--/.col-->
</div><!--/.row-->
<br>
<div class="table-responsive"></div>
<table class="table table-responsive table-hover table-outline mb-0">
<thead class="thead-default">
<tr>
<th class="text-center"><i class="icon-people"></i></th>
<th>User</th>
<th class="text-center">Country</th>
<th>Usage</th>
<th class="text-center">Payment Method</th>
<th>Activity</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center">
<div class="avatar">
<img src="assets/img/avatars/1.jpg" class="img-avatar" alt="admin@bootstrapmaster.com" src="assets/img/avatars/1.jpg">
<span class="avatar-status badge-success"></span>
</div>
</td>
<td>
<div>Yiorgos Avraamu</div>
<div class="small text-muted">
<span>New</span> | Registered: Jan 1, 2015
</div>
</td>
<td class="text-center">
<img src="assets/img/flags/USA.png" alt="USA" style="height:24px;" src="assets/img/flags/USA.png">
</td>
<td>
<div class="clearfix">
<div class="float-left">
<strong>50%</strong>
</div>
<div class="float-right">
<small class="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
</div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-success" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</td>
<td class="text-center">
<i class="fa fa-cc-mastercard" style="font-size:24px"></i>
</td>
<td>
<div class="small text-muted">Last login</div>
<strong>10 sec ago</strong>
</td>
</tr>
<tr>
<td class="text-center">
<div class="avatar">
<img src="assets/img/avatars/2.jpg" class="img-avatar" alt="admin@bootstrapmaster.com" src="assets/img/avatars/2.jpg">
<span class="avatar-status badge-danger"></span>
</div>
</td>
<td>
<div>Avram Tarasios</div>
<div class="small text-muted">
<span>Recurring</span> | Registered: Jan 1, 2015
</div>
</td>
<td class="text-center">
<img src="assets/img/flags/Brazil.png" alt="Brazil" style="height:24px;" src="assets/img/flags/Brazil.png">
</td>
<td>
<div class="clearfix">
<div class="float-left">
<strong>10%</strong>
</div>
<div class="float-right">
<small class="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
</div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-info" role="progressbar" style="width: 10%" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</td>
<td class="text-center">
<i class="fa fa-cc-visa" style="font-size:24px"></i>
</td>
<td>
<div class="small text-muted">Last login</div>
<strong>5 minutes ago</strong>
</td>
</tr>
<tr>
<td class="text-center">
<div class="avatar">
<img src="assets/img/avatars/3.jpg" class="img-avatar" alt="admin@bootstrapmaster.com" src="assets/img/avatars/3.jpg">
<span class="avatar-status badge-warning"></span>
</div>
</td>
<td>
<div>Quintin Ed</div>
<div class="small text-muted">
<span>New</span> | Registered: Jan 1, 2015
</div>
</td>
<td class="text-center">
<img src="assets/img/flags/India.png" alt="India" style="height:24px;" src="assets/img/flags/India.png">
</td>
<td>
<div class="clearfix">
<div class="float-left">
<strong>74%</strong>
</div>
<div class="float-right">
<small class="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
</div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-warning" role="progressbar" style="width: 74%" aria-valuenow="74" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</td>
<td class="text-center">
<i class="fa fa-cc-stripe" style="font-size:24px"></i>
</td>
<td>
<div class="small text-muted">Last login</div>
<strong>1 hour ago</strong>
</td>
</tr>
<tr>
<td class="text-center">
<div class="avatar">
<img src="assets/img/avatars/4.jpg" class="img-avatar" alt="admin@bootstrapmaster.com" src="assets/img/avatars/4.jpg">
<span class="avatar-status badge-default"></span>
</div>
</td>
<td>
<div>Enéas Kwadwo</div>
<div class="small text-muted">
<span>New</span> | Registered: Jan 1, 2015
</div>
</td>
<td class="text-center">
<img src="assets/img/flags/France.png" alt="France" style="height:24px;" src="assets/img/flags/France.png">
</td>
<td>
<div class="clearfix">
<div class="float-left">
<strong>98%</strong>
</div>
<div class="float-right">
<small class="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
</div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-danger" role="progressbar" style="width: 98%" aria-valuenow="98" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</td>
<td class="text-center">
<i class="fa fa-paypal" style="font-size:24px"></i>
</td>
<td>
<div class="small text-muted">Last login</div>
<strong>Last month</strong>
</td>
</tr>
<tr>
<td class="text-center">
<div class="avatar">
<img src="assets/img/avatars/5.jpg" class="img-avatar" alt="admin@bootstrapmaster.com" src="assets/img/avatars/5.jpg">
<span class="avatar-status badge-success"></span>
</div>
</td>
<td>
<div>Agapetus Tadeáš</div>
<div class="small text-muted">
<span>New</span> | Registered: Jan 1, 2015
</div>
</td>
<td class="text-center">
<img src="assets/img/flags/Spain.png" alt="Spain" style="height:24px;" src="assets/img/flags/Spain.png">
</td>
<td>
<div class="clearfix">
<div class="float-left">
<strong>22%</strong>
</div>
<div class="float-right">
<small class="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
</div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-info" role="progressbar" style="width: 22%" aria-valuenow="22" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</td>
<td class="text-center">
<i class="fa fa-google-wallet" style="font-size:24px"></i>
</td>
<td>
<div class="small text-muted">Last login</div>
<strong>Last week</strong>
</td>
</tr>
<tr>
<td class="text-center">
<div class="avatar">
<img src="assets/img/avatars/6.jpg" class="img-avatar" alt="admin@bootstrapmaster.com" src="assets/img/avatars/6.jpg">
<span class="avatar-status badge-danger"></span>
</div>
</td>
<td>
<div>Friderik Dávid</div>
<div class="small text-muted">
<span>New</span> | Registered: Jan 1, 2015
</div>
</td>
<td class="text-center">
<img src="assets/img/flags/Poland.png" alt="Poland" style="height:24px;" src="assets/img/flags/Poland.png">
</td>
<td>
<div class="clearfix">
<div class="float-left">
<strong>43%</strong>
</div>
<div class="float-right">
<small class="text-muted">Jun 11, 2015 - Jul 10, 2015</small>
</div>
</div>
<div class="progress progress-xs">
<div class="progress-bar bg-success" role="progressbar" style="width: 43%" aria-valuenow="43" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</td>
<td class="text-center">
<i class="fa fa-cc-amex" style="font-size:24px"></i>
</td>
<td>
<div class="small text-muted">Last login</div>
<strong>Yesterday</strong>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div><!--/.col-->
</div><!--/.row-->
</div> </div>

View file

@ -2,6 +2,7 @@ import { Directive, Component, OnInit } from '@angular/core';
import { Http, Response } from '@angular/http'; import { Http, Response } from '@angular/http';
import { ApiService } from '../providers/api-service'; import { ApiService } from '../providers/api-service';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { GraphWidget } from '../widgets/graph-widget.component';
@Component({ @Component({
templateUrl: 'dashboard.component.html' templateUrl: 'dashboard.component.html'
@ -25,14 +26,29 @@ export class DashboardComponent implements OnInit {
percentOfLocalSuppliers: any; percentOfLocalSuppliers: any;
percentOfSingleCompetitorLocalSuppliers: any; percentOfSingleCompetitorLocalSuppliers: any;
public widgetList = [
{
type: 'graph',
name: 'customers_last_7_days',
icon: 'icon-people',
title: 'Customers Last 7 Days',
},
{
type: 'graph',
name: 'customers_last_30_days',
icon: 'icon-people',
title: 'Customers Last 30 Days',
},
];
constructor( constructor(
private http: Http, private http: Http,
private api: ApiService, private api: ApiService,
) { ) {
this.shuffle = this.shuffledArray; this.shuffle = this.shuffledArray;
this.api.graph_data(undefined) this.api.graph_data(undefined)
.subscribe( .subscribe(
result => { result => {
console.log(result); console.log(result);
// Return what data to show 4 of // Return what data to show 4 of
this.showGraph = result.elementstoshow.graphs; this.showGraph = result.elementstoshow.graphs;
@ -47,14 +63,6 @@ export class DashboardComponent implements OnInit {
this.customersThisWeek = result.data.customersthisweek; this.customersThisWeek = result.data.customersthisweek;
this.lineChart1Data[0].data = this.customersThisWeek.customerno; this.lineChart1Data[0].data = this.customersThisWeek.customerno;
this.lineChart1Labels = this.customersThisWeek.day; this.lineChart1Labels = this.customersThisWeek.day;
// Chart 2
this.customersLastWeek = result.data.customerslastweek;
this.lineChart2Data[0].data = this.customersLastWeek.customerno;
this.lineChart2Labels = this.customersLastWeek.day;
// Chart 3
this.customersLastMonth = result.data.customerslastmonth;
this.lineChart3Data[0].data = this.customersLastMonth.customerno;
this.lineChart3Labels = this.customersLastMonth.day;
// Chart 4 // Chart 4
this.customersLastYear = result.data.customerslastyear; this.customersLastYear = result.data.customerslastyear;
this.lineChart4Data[0].data = this.customersLastYear.customerno; this.lineChart4Data[0].data = this.customersLastYear.customerno;
@ -83,16 +91,16 @@ export class DashboardComponent implements OnInit {
), ),
this.api.breadcrumb_data(undefined) this.api.breadcrumb_data(undefined)
.subscribe( .subscribe(
result => { result => {
console.log(result); console.log(result);
this.customersThisMonth = result.customersthismonth; this.customersThisMonth = result.customersthismonth;
this.moneySpentThisMonth = result.moneyspentthismonth; this.moneySpentThisMonth = result.moneyspentthismonth;
this.pointsTotal = result.pointstotal; this.pointsTotal = result.pointstotal;
this.averageTransactionToday = result.averagetransactiontoday; this.averageTransactionToday = result.averagetransactiontoday;
} }
) );
} }
// Fisher-Yates shuffle function // Fisher-Yates shuffle function
public shuffle(array) { public shuffle(array) {
return new Promise(resolve => { return new Promise(resolve => {
@ -101,13 +109,13 @@ export class DashboardComponent implements OnInit {
// While there are elements in the array // While there are elements in the array
while (counter > 0) { while (counter > 0) {
// Pick a random index // Pick a random index
let index = Math.floor(Math.random() * counter); const index = Math.floor(Math.random() * counter);
// Decrease counter by 1 // Decrease counter by 1
counter--; counter--;
// And swap the last element with it // And swap the last element with it
let temp = array[counter]; const temp = array[counter];
array[counter] = array[index]; array[counter] = array[index];
array[index] = temp; array[index] = temp;
} }
@ -116,7 +124,7 @@ export class DashboardComponent implements OnInit {
resolve(true); resolve(true);
}); });
} }
public brandPrimary = '#20a8d8'; public brandPrimary = '#20a8d8';
public brandSuccess = '#4dbd74'; public brandSuccess = '#4dbd74';
public brandInfo = '#63c2de'; public brandInfo = '#63c2de';
@ -203,100 +211,6 @@ export class DashboardComponent implements OnInit {
public lineChart1Legend = false; public lineChart1Legend = false;
public lineChart1Type = 'line'; public lineChart1Type = 'line';
// lineChart2
public lineChart2Data: Array<any> = [
{
data: [],
label: 'Series B'
}
];
public lineChart2Labels: Array<any> = [];
public lineChart2Options: any = {
maintainAspectRatio: false,
scales: {
xAxes: [{
gridLines: {
color: 'transparent',
zeroLineColor: 'transparent'
},
ticks: {
fontSize: 2,
fontColor: 'transparent',
}
}],
yAxes: [{
display: false,
ticks: {
display: false,
}
}],
},
elements: {
line: {
tension: 0.00001,
borderWidth: 1
},
point: {
radius: 4,
hitRadius: 10,
hoverRadius: 4,
},
},
legend: {
display: false
}
};
public lineChart2Colours: Array<any> = [
{ // grey
backgroundColor: this.brandInfo,
borderColor: 'rgba(255,255,255,.55)'
}
];
public lineChart2Legend = false;
public lineChart2Type = 'line';
// lineChart3
public lineChart3Data: Array<any> = [
{
data: [],
label: 'Series B'
}
];
public lineChart3Labels: Array<any> = [];
public lineChart3Options: any = {
maintainAspectRatio: false,
scales: {
xAxes: [{
display: false
}],
yAxes: [{
display: false
}]
},
elements: {
line: {
borderWidth: 2
},
point: {
radius: 2,
hitRadius: 10,
hoverRadius: 4,
},
},
legend: {
display: false
}
};
public lineChart3Colours: Array<any> = [
{ // grey
backgroundColor: this.brandInfo,
borderColor: 'rgba(255,255,255,.55)'
}
];
public lineChart3Legend = false;
public lineChart3Type = 'line';
// lineChart4 // lineChart4
public lineChart4Data: Array<any> = [ public lineChart4Data: Array<any> = [
{ {
@ -349,7 +263,7 @@ export class DashboardComponent implements OnInit {
]; ];
public lineChart4Legend = false; public lineChart4Legend = false;
public lineChart4Type = 'line'; public lineChart4Type = 'line';
// lineChart6 // lineChart6
public lineChart6Data: Array<any> = [ public lineChart6Data: Array<any> = [
{ {
@ -402,7 +316,7 @@ export class DashboardComponent implements OnInit {
]; ];
public lineChart6Legend = false; public lineChart6Legend = false;
public lineChart6Type = 'line'; public lineChart6Type = 'line';
// lineChart7 // lineChart7
public lineChart7Data: Array<any> = [ public lineChart7Data: Array<any> = [
{ {
@ -443,7 +357,7 @@ export class DashboardComponent implements OnInit {
]; ];
public lineChart7Legend = false; public lineChart7Legend = false;
public lineChart7Type = 'line'; public lineChart7Type = 'line';
// lineChart8 // lineChart8
public lineChart8Data: Array<any> = [ public lineChart8Data: Array<any> = [
{ {
@ -496,7 +410,7 @@ export class DashboardComponent implements OnInit {
]; ];
public lineChart8Legend = false; public lineChart8Legend = false;
public lineChart8Type = 'line'; public lineChart8Type = 'line';
// lineChart5 // lineChart5
public lineChart5Data: Array<any> = [ public lineChart5Data: Array<any> = [
{ {

View file

@ -9,6 +9,8 @@ import { LeaderboardsComponent } from './leaderboards.component';
import { AccountEditComponent } from './account-edit.component'; import { AccountEditComponent } from './account-edit.component';
import { AddDataComponent } from './add-data.component'; import { AddDataComponent } from './add-data.component';
import { GraphWidget } from '../widgets/graph-widget.component';
import { DashboardRoutingModule } from './dashboard.routing'; import { DashboardRoutingModule } from './dashboard.routing';
import { OrgResultComponent } from '../shared/org-result.component'; import { OrgResultComponent } from '../shared/org-result.component';
import { OrgTableComponent } from '../shared/org-table.component'; import { OrgTableComponent } from '../shared/org-table.component';
@ -30,6 +32,7 @@ import { OrgTableComponent } from '../shared/org-table.component';
AddDataComponent, AddDataComponent,
OrgResultComponent, OrgResultComponent,
OrgTableComponent, OrgTableComponent,
GraphWidget,
] ]
}) })
export class DashboardModule { } export class DashboardModule { }

View file

@ -18,6 +18,16 @@ export class ApiService {
} }
} }
public post(url, data) {
if ( this.sessionKey != null ) {
data.session_key = this.sessionKey;
}
return this.http.post(
this.apiUrl + url,
data
).map( response => response.json() );
}
// Login API // Login API
public getSessionKey() { public getSessionKey() {

View file

@ -0,0 +1,13 @@
import { Injectable } from '@angular/core';
import { ApiService } from './api-service';
@Injectable()
export class OrgGraphsService {
private orgGraphUrl = '/v1/organisation/graphs';
constructor(private api: ApiService) { }
public getGraph(name: string) {
return this.api.post(this.orgGraphUrl, { graph: name });
}
}

View file

@ -0,0 +1,21 @@
<div class="card card-inverse card-primary">
<div class="card-block pb-0">
<button type="button" class="btn btn-transparent p-0 float-right">
<i [ngClass]="graphIcon"></i>
</button>
<h4 class="mb-0">{{ graphSum }}</h4>
<p>{{ graphTitle }}</p>
</div>
<div class="chart-wrapper px-3" style="height:70px;">
<canvas baseChart
class="chart"
[datasets]="lineChartData"
[labels]="lineChartLabels"
[options]="lineChartOptions"
[colors]="lineChartColours"
[legend]="lineChartLegend"
[chartType]="lineChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
</div>
</div>

View file

@ -0,0 +1,115 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { OrgGraphsService } from '../providers/org-graphs.service';
interface ChartData {
data: Array<number>;
label: string;
}
@Component({
selector: 'widget-graph',
templateUrl: 'graph-widget.component.html',
})
export class GraphWidget implements OnInit {
@Input() public graphName: string;
@Input() public graphTitle = 'Graph';
@Input() public graphIcon = 'icon-graph';
@Output() public graphHover = new EventEmitter();
@Output() public graphClick = new EventEmitter();
public graphSum: Number = 0;
public lineChartData: Array<ChartData> = [
{
data: [],
label: 'Series A'
}
];
public lineChartLabels: Array<string>;
public lineChartOptions: any = {
maintainAspectRatio: false,
scales: {
xAxes: [{
gridLines: {
color: 'transparent',
zeroLineColor: 'transparent'
},
ticks: {
fontSize: 2,
fontColor: 'transparent',
}
}],
yAxes: [{
display: false,
ticks: {
display: false,
}
}],
},
elements: {
line: {
borderWidth: 1
},
point: {
radius: 4,
hitRadius: 10,
hoverRadius: 4,
},
},
legend: {
display: false
}
};
public lineChartColours: Array<any> = [
{
backgroundColor: '#20a8d8',
borderColor: 'rgba(255,255,255,.55)'
}
];
public lineChartLegend = false;
public lineChartType = 'line';
constructor(private graphService: OrgGraphsService) { }
ngOnInit(): void {
if ( this.graphName == null ) {
throw new Error('Attribute \'graphName\' is required on component \'widget-graph\'');
}
this.graphService.getGraph(this.graphName)
.subscribe( result => this.setData(result.graph) );
}
private setData(data: any) {
this.setChartData(data.count);
this.setChartLabels(data.day);
}
private setChartData(data: Array<number>) {
this.lineChartData[0].data = data;
this.graphSum = data.reduce((a, b) => a + b, 0);
// Set point size based on data
if ( data.length < 15 ) {
this.lineChartOptions.elements.point.radius = 4;
this.lineChartOptions.elements.line.borderWidth = 1;
} else {
this.lineChartOptions.elements.point.radius = 2;
this.lineChartOptions.elements.line.borderWidth = 2;
}
}
private setChartLabels(data: Array<string>) {
this.lineChartLabels = data;
}
// events
public chartClicked(e: any): void {
console.log(e);
}
public chartHovered(e: any): void {
console.log(e);
}
}

View file

@ -15,6 +15,7 @@
<!-- Icons --> <!-- Icons -->
<link href="assets/css/font-awesome.min.css" rel="stylesheet"> <link href="assets/css/font-awesome.min.css" rel="stylesheet">
<link href="assets/css/simple-line-icons.css" rel="stylesheet"> <link href="assets/css/simple-line-icons.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
</head> </head>

View file

@ -87,4 +87,4 @@
} }
} }
} }
} }

View file

@ -99,7 +99,7 @@
], ],
"directive-selector": [true, "attribute", "app", "camelCase"], "directive-selector": [true, "attribute", "app", "camelCase"],
"component-selector": [true, "element", "app", "kebab-case"], "component-selector": [true, "element", ["app", "widget"], "kebab-case"],
"use-input-property-decorator": true, "use-input-property-decorator": true,
"use-output-property-decorator": true, "use-output-property-decorator": true,
"use-host-property-decorator": true, "use-host-property-decorator": true,
@ -107,7 +107,7 @@
"no-output-rename": true, "no-output-rename": true,
"use-life-cycle-interface": true, "use-life-cycle-interface": true,
"use-pipe-transform-interface": true, "use-pipe-transform-interface": true,
"component-class-suffix": true, "component-class-suffix": [true, "Component", "Widget"],
"directive-class-suffix": true, "directive-class-suffix": true,
"no-access-missing-member": true, "no-access-missing-member": true,
"templates-use-public": true, "templates-use-public": true,