Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecommerce dashboard #1754

Merged
merged 127 commits into from
Aug 8, 2018
Merged
Show file tree
Hide file tree
Changes from 125 commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
b99c1cb
feat(dashboard): prepare component for e-commerce dashboard
ESadouski Feb 5, 2018
a2f1217
feat(dashboard): update nebular version. use flip cards. add test cha…
ESadouski Feb 6, 2018
ef01d7e
feat(dashboard): stats card draft makeup
ESadouski Feb 13, 2018
c0370fb
feat(dashboard): flip card area. add tab to charts panel
ESadouski Feb 26, 2018
e10c346
feat(dashboard): add chart for back side
ESadouski Mar 8, 2018
f4472a3
feat(dashboard): add leaflet map
ESadouski Mar 12, 2018
adbdef2
feat(dashboard): leaflet add country shapes
ESadouski Mar 12, 2018
c8cafaf
fix(dashboard): lint errors
ESadouski Mar 12, 2018
e0e5754
feat(dashboard): highlight and click on map
Mar 13, 2018
713c885
feat(dashboard): update chart by clicking on country
Mar 22, 2018
9d4e316
fix(dashboard): lint errors
Mar 22, 2018
434f07c
feat(dashboard): rework front part of statisctic card
May 1, 2018
69b7858
fix(dashboard): lint errors
May 2, 2018
b8a6ad1
fix(ecDashboard): change map background
Jun 4, 2018
6b76dad
fix(ecDashboard): make charts smaller
Jun 7, 2018
a407b19
fix(ecDashboard): use two cards
Jun 7, 2018
b505e59
fix(ecDashboard): update colors
Jun 17, 2018
dfca89c
fix(ecDashboard): merge with upstream master
Jun 17, 2018
488bca0
feat(ecDashboard): update statistic front side card. merge fixes.
Jun 18, 2018
c92111f
feat(ecDashboard): back side profit component
Jun 19, 2018
82212ab
feat(ecDashboard): add traffic component
Jun 20, 2018
aaf117b
feat(ecDashboard): hide axes line. show labels under chart
Jun 20, 2018
eee6d6f
fix(ecDashboard): lint errors
Jun 20, 2018
338b811
feat(ecDashboard): add period dropdown to header
Jun 20, 2018
befe6de
feat(ecDashboard): redraw traffic chart
Jun 21, 2018
8f66a0f
fix(ecDashboard): lint
Jun 21, 2018
d0a774a
Merge branch 'master' of https://github.com/akveo/ngx-admin into ecom…
Jun 21, 2018
7ea7235
feat(ecommerce): add order chart, add profit chart template
Jun 26, 2018
4af118b
feat(ecommerce): add order chart fix lint
Jun 26, 2018
5357c63
feat(ecommerce): update css styles for order, profit charts
Jun 27, 2018
730fa9c
Merge pull request #1 from denStrigo/ecommerce-dashboard-orders-profi…
ESadouski Jun 27, 2018
362d28d
feat(ecDashboard): add meaningful data. align chart
Jun 28, 2018
77661f4
feat(ecommerce): add visitors analytics, user activity sections
Jun 30, 2018
c7c15c9
feat(ecommerce): fix lint
Jun 30, 2018
46e8d92
feat(ecommerce): change lines data for order chart, set expand-collap…
Jun 30, 2018
a7dc732
feat(ecDashboard): statistics card change structure, fix mockup
Jul 2, 2018
df3f2b0
feat(ecDashboard): style zoom control
Jul 3, 2018
d4c3f44
feat(ecDashboard): add max/min zoom properties
Jul 3, 2018
f06cde5
feat(ecommerce): add user activity service
Jul 4, 2018
45703f2
feat(ecommerce): add progress section, update styles, update user act…
Jul 4, 2018
82848e9
feat(ecommerce): add ltr, add order chart service
Jul 5, 2018
a578ef4
Merge pull request #2 from denStrigo/feat/ecommerce-visitors-analytic…
ESadouski Jul 5, 2018
8d829c7
feat(ecDashboard): style countries statistics card
Jul 5, 2018
cef068a
fix(ecDashboard): lint errors
Jul 5, 2018
5df5062
feat(ecDashboard): style countries map
Jul 5, 2018
53ea274
feat(ecDashboard): select country
Jul 6, 2018
e1ddca0
feat(ecommerce): update order chart service
Jul 6, 2018
aeeeca8
feat(ecommerce): update profit card flip container
Jul 6, 2018
3281968
feat(ecommerce): fix cut text when changing direction
Jul 6, 2018
f6ac932
feat(ecDashboard): update chart data by selecting country
Jul 6, 2018
82fb986
feat(ecDashboard): select country by id
Jul 7, 2018
c9fe72d
fix(ecDashboard): lint errors
Jul 7, 2018
652b1fa
Merge branch 'ecommerce-dashboard' into ESad/eccomerce
Jul 7, 2018
3cfc29a
feat(ecDashboard): rename country orders feature
Jul 7, 2018
b716d8d
fix(ecDashboard): code fixes
Jul 7, 2018
bbf8f1d
Merge pull request #3 from ESadouski/ESad/eccomerce
ESadouski Jul 7, 2018
7d37be0
feat(ecommerce): add slide out component
Jul 7, 2018
9bfa8f0
Merge branch 'ecommerce-dashboard' into fix/fix-issuis-refactoring
Jul 7, 2018
b8a85be
Merge pull request #4 from denStrigo/fix/fix-issuis-refactoring
ESadouski Jul 9, 2018
7bd3174
feat(ecommerce): add profit chart service
Jul 9, 2018
a51727a
feat(ecommerce): add profit chart service
Jul 9, 2018
a2aefb7
Merge branch 'ecommerce-dashboard' into fix/fix-issuis-refactoring
Jul 9, 2018
d5618b7
feat(ecommerce): change responsive resolution, fix slide out backgrou…
Jul 9, 2018
7866cca
feat(ecommerce): update styles fot charts after map
Jul 9, 2018
895070a
feat(ecommerce): generate random data for map
Jul 9, 2018
9f1a9a6
feat(ecommerce): remove onInit hook for map
Jul 9, 2018
44e5a21
Merge pull request #5 from denStrigo/fix/fix-issuis-refactoring
ESadouski Jul 9, 2018
87c62de
fix(ecDashboard): fix animation in bottom line chart
Jul 9, 2018
5fe0de0
fix(ecDashboard): map colors
Jul 9, 2018
a2975c8
fix(ecDashboard): change default country
Jul 9, 2018
3368f20
fix(ecDashboard): traffic chart make bars smaller. use variables for
Jul 10, 2018
932f64c
feat(ecommerce): change ec to ecommerce, change route
Jul 10, 2018
f90814e
feat(ecommerce): change font size for charts, update styles for chart…
Jul 10, 2018
5cf6f9c
feat(ecommerce): change map width, align value in active value card
Jul 10, 2018
7a6b31b
feat(ecommerce): change default country and center
Jul 10, 2018
c818617
Merge pull request #6 from denStrigo/fix/improvements-and-fixes
ESadouski Jul 10, 2018
ef6da68
feat(ecommerce): add earning card container
Jul 11, 2018
c5ecfd5
feat(ecommerce): add default theme
Jul 11, 2018
ad054b2
Merge pull request #7 from denStrigo/feat/ecommerse-default-theme
ESadouski Jul 12, 2018
6d3d9c8
feat(ecommerce): add reveal traffic card
Jul 12, 2018
24c8f26
feat(ecommerce): add traffic bar fot reveal card
Jul 17, 2018
02e8508
Merge remote-tracking branch 'upstream/ecommerce-dashboard' into feat…
Jul 17, 2018
00d0876
feat(ecommerce): add traffic bar fix lint
Jul 17, 2018
c540cf1
Merge branch 'ecommerce-dashboard' into feat/earning-card
Jul 17, 2018
d6ff75a
Merge pull request #8 from denStrigo/feat/reveal-traffic-card
ESadouski Jul 18, 2018
1807df1
feat(ecommerce): earning chart back card, charts for front and back c…
Jul 19, 2018
906f4b6
Merge branch 'ecommerce-dashboard' into feat/earning-card
Jul 19, 2018
b8e0914
feat(ecommerce): earning chart fix lint
Jul 19, 2018
ae1a2eb
Merge pull request #9 from denStrigo/feat/earning-card
ESadouski Jul 20, 2018
c0c7001
feat(ecommerce): add summary panel for order profit charts
Jul 20, 2018
eaa97fa
Merge branch 'ecommerce-dashboard' into feat/summary-panel
Jul 20, 2018
0b28ac4
feat(ecommerce): add arrows to user activity card
Jul 20, 2018
0752655
feat(ecommerce): apply new styles fot order profit charts
Jul 20, 2018
48f55d9
Merge pull request #10 from denStrigo/feat/summary-panel
ESadouski Jul 20, 2018
4597b08
Merge pull request #11 from denStrigo/feat/user-activity-arrow
ESadouski Jul 20, 2018
83114b1
fix(ecDashboard): profit cart remove result arrow
Jul 20, 2018
cfb3c45
Merge branch 'ecommerce-dashboard' into feat/order-profit-charts-new-…
Jul 23, 2018
a6a8856
Merge pull request #12 from denStrigo/feat/order-profit-charts-new-style
ESadouski Jul 23, 2018
8e3f227
feat(ecommerce): add styles for corporate theme
Jul 23, 2018
aa31429
Merge pull request #13 from denStrigo/feat/corporate-theme
ESadouski Jul 23, 2018
e638a55
feat(ecDashboard): update earning chert with live data
Jul 24, 2018
4d55177
feat(ecommerce): add rtl ltr support
Jul 24, 2018
b434f7d
feat(ecommerce): update logic for delivering live update chart data
Jul 24, 2018
de160f8
Merge pull request #15 from denStrigo/feat/rtl-ltr-support
ESadouski Jul 24, 2018
70525e0
Merge pull request #16 from denStrigo/ESad/live_data
ESadouski Jul 24, 2018
cb70ee3
Merge branch 'ecommerce-dashboard' into ESad/live_data
Jul 24, 2018
90e478b
fix(ecDashboard): earning card merge conflicts
Jul 24, 2018
0377729
Merge pull request #14 from ESadouski/ESad/live_data
ESadouski Jul 24, 2018
286395f
feat(ecommerce): fix safari issues
Jul 25, 2018
9b644e3
feat(ecommerce): fix lint
Jul 25, 2018
5c02a0b
Merge pull request #17 from denStrigo/fix/safati_charts_issues
ESadouski Jul 25, 2018
2a2e6e3
feat(ecommerce): apply review comments
Jul 31, 2018
bb673d1
feat(ecommerce): apply review comments
Jul 31, 2018
5f50f65
feat(ecommerce): remove to do comment
Jul 31, 2018
ab6118f
feat(ecommerce): add traffic bar service
Jul 31, 2018
82e78a7
Merge pull request #18 from denStrigo/feat/ecommerce_fix_review
ESadouski Aug 1, 2018
220041a
feat(ecommerce): add responsive
Aug 2, 2018
6c27483
feat(ecommerce): fix issues for responsive
Aug 3, 2018
57fbea2
Merge pull request #19 from denStrigo/feat/ecommerce_responsive
ESadouski Aug 3, 2018
f35ec98
feat(ecommerce): fix comments, add e-commerce icon, update profit car…
Aug 7, 2018
372295e
Merge branch 'ecommerce-dashboard' into feat/ecommerce_fix_review
Aug 7, 2018
ca509a0
feat(ecommerce): fix review comments
Aug 8, 2018
e20da6f
feat(ecommerce): fix legend, earning chart
Aug 8, 2018
86c1681
feat(ecommerce): fix e commerce layout size
Aug 8, 2018
4dc2484
Merge pull request #20 from denStrigo/feat/ecommerce_fix_review
ESadouski Aug 8, 2018
ee3bacd
feat(ecommerce): fix lint issues
Aug 8, 2018
60a8d2f
Merge pull request #21 from denStrigo/fix/ecommerce_lint
ESadouski Aug 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"node_modules/nebular-icons/scss/nebular-icons.scss",
"node_modules/angular-tree-component/dist/angular-tree-component.css",
"node_modules/pace-js/templates/pace-theme-flash.tmpl.css",
"node_modules/leaflet/dist/leaflet.css",
"src/app/@theme/styles/styles.scss"
],
"scripts": [
Expand Down
18 changes: 18 additions & 0 deletions src/app/@core/data/data.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,31 @@ import { ElectricityService } from './electricity.service';
import { StateService } from './state.service';
import { SmartTableService } from './smart-table.service';
import { PlayerService } from './player.service';
import { UserActivityService } from './user-activity.service';
import { OrdersChartService } from './orders-chart.service';
import { ProfitChartService } from './profit-chart.service';
import { TrafficListService } from './traffic-list.service';
import { PeriodsService } from './periods.service';
import { EarningService } from './earning.service';
import { OrdersProfitChartService } from './orders-profit-chart.service';
import { TrafficBarService } from './traffic-bar.service';
import { ProfitBarAnimationChartService } from './profit-bar-animation-chart.service';

const SERVICES = [
UserService,
ElectricityService,
StateService,
SmartTableService,
PlayerService,
UserActivityService,
OrdersChartService,
ProfitChartService,
TrafficListService,
PeriodsService,
EarningService,
OrdersProfitChartService,
TrafficBarService,
ProfitBarAnimationChartService,
];

@NgModule({
Expand Down
116 changes: 116 additions & 0 deletions src/app/@core/data/earning.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import { Injectable } from '@angular/core';
import { of as observableOf, Observable } from 'rxjs';

export class LiveUpdateChart {
liveChart: { value: [string, number] }[];
delta: {
up: boolean;
value: number;
};
dailyIncome: number;
}

export class PieChart {
value: number;
name: string;
}

@Injectable()
export class EarningService {

private currentDate: Date = new Date();
private currentValue = Math.random() * 1000;
private ONE_DAY = 24 * 3600 * 1000;

private pieChartData = [
{
value: 50,
name: 'Bitcoin',
},
{
value: 25,
name: 'Tether',
},
{
value: 25,
name: 'Ethereum',
},
];

private liveUpdateChartData = {
bitcoin: {
liveChart: [],
delta: {
up: true,
value: 4,
},
dailyIncome: 45895,
},
tether: {
liveChart: [],
delta: {
up: false,
value: 9,
},
dailyIncome: 5862,
},
ethereum: {
liveChart: [],
delta: {
up: false,
value: 21,
},
dailyIncome: 584,
},
};

getDefaultLiveChartData(elementsNumber: number) {
this.currentDate = new Date();
this.currentValue = Math.random() * 1000;

return Array.from(Array(elementsNumber))
.map(item => this.generateRandomLiveChartData());
}

generateRandomLiveChartData() {
this.currentDate = new Date(+this.currentDate + this.ONE_DAY);
this.currentValue = this.currentValue + Math.random() * 20 - 11;

if (this.currentValue < 0) {
this.currentValue = Math.random() * 100;
}

return {
value: [
[
this.currentDate.getFullYear(),
this.currentDate.getMonth(),
this.currentDate.getDate(),
].join('/'),
Math.round(this.currentValue),
],
}
}

generateRandomEarningData(currency) {
const data = this.liveUpdateChartData[currency.toLowerCase()];
const newValue = this.generateRandomLiveChartData();

data.liveChart.shift();
data.liveChart.push(newValue);

return observableOf(data.liveChart);
}

getEarningLiveUpdateCardData(currency: string) {
const data = this.liveUpdateChartData[currency.toLowerCase()];

data.liveChart = this.getDefaultLiveChartData(150);

return observableOf(data);
}

getEarningPieChartData(): Observable<PieChart[]> {
return observableOf(this.pieChartData);
}
}
158 changes: 158 additions & 0 deletions src/app/@core/data/orders-chart.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import { Injectable } from '@angular/core';
import { PeriodsService } from './periods.service';

export class OrdersChart {
chartLabel: string[];
linesData: number[][];
}

@Injectable()
export class OrdersChartService {

private year = [
'2012',
'2013',
'2014',
'2015',
'2016',
'2017',
'2018',
];

private data = { };

constructor(private period: PeriodsService) {
this.data = {
week: this.getDataForWeekPeriod(),
month: this.getDataForMonthPeriod(),
year: this.getDataForYearPeriod(),
};
}

private getDataForWeekPeriod(): OrdersChart {
return {
chartLabel: this.getDataLabels(42, this.period.getWeeks()),
linesData: [
[
184, 267, 326, 366, 389, 399,
392, 371, 340, 304, 265, 227,
191, 158, 130, 108, 95, 91, 97,
109, 125, 144, 166, 189, 212,
236, 259, 280, 300, 316, 329,
338, 342, 339, 329, 312, 288,
258, 221, 178, 128, 71,
],
[
158, 178, 193, 205, 212, 213,
204, 190, 180, 173, 168, 164,
162, 160, 159, 158, 159, 166,
179, 195, 215, 236, 257, 276,
292, 301, 304, 303, 300, 293,
284, 273, 262, 251, 241, 234,
232, 232, 232, 232, 232, 232,
],
[
58, 137, 202, 251, 288, 312,
323, 324, 311, 288, 257, 222,
187, 154, 124, 100, 81, 68, 61,
58, 61, 69, 80, 96, 115, 137,
161, 186, 210, 233, 254, 271,
284, 293, 297, 297, 297, 297,
297, 297, 297, 297, 297,
],
],
};
}

private getDataForMonthPeriod(): OrdersChart {
return {
chartLabel: this.getDataLabels(47, this.period.getMonths()),
linesData: [
[
5, 63, 113, 156, 194, 225,
250, 270, 283, 289, 290,
286, 277, 264, 244, 220,
194, 171, 157, 151, 150,
152, 155, 160, 166, 170,
167, 153, 135, 115, 97,
82, 71, 64, 63, 62, 61,
62, 65, 73, 84, 102,
127, 159, 203, 259, 333,
],
[
6, 83, 148, 200, 240,
265, 273, 259, 211,
122, 55, 30, 28, 36,
50, 68, 88, 109, 129,
146, 158, 163, 165,
173, 187, 208, 236,
271, 310, 346, 375,
393, 400, 398, 387,
368, 341, 309, 275,
243, 220, 206, 202,
207, 222, 247, 286, 348,
],
[
398, 348, 315, 292, 274,
261, 251, 243, 237, 231,
222, 209, 192, 172, 152,
132, 116, 102, 90, 80, 71,
64, 58, 53, 49, 48, 54, 66,
84, 104, 125, 142, 156, 166,
172, 174, 172, 167, 159, 149,
136, 121, 105, 86, 67, 45, 22,
],
],
};
}

private getDataForYearPeriod(): OrdersChart {
return {
chartLabel: this.getDataLabels(42, this.year),
linesData: [
[
190, 269, 327, 366, 389, 398,
396, 387, 375, 359, 343, 327,
312, 298, 286, 276, 270, 268,
265, 258, 247, 234, 220, 204,
188, 172, 157, 142, 128, 116,
106, 99, 95, 94, 92, 89, 84,
77, 69, 60, 49, 36, 22,
],
[
265, 307, 337, 359, 375, 386,
393, 397, 399, 397, 390, 379,
365, 347, 326, 305, 282, 261,
241, 223, 208, 197, 190, 187,
185, 181, 172, 160, 145, 126,
105, 82, 60, 40, 26, 19, 22,
43, 82, 141, 220, 321,
],
[
9, 165, 236, 258, 244, 206,
186, 189, 209, 239, 273, 307,
339, 365, 385, 396, 398, 385,
351, 300, 255, 221, 197, 181,
170, 164, 162, 161, 159, 154,
146, 135, 122, 108, 96, 87,
83, 82, 82, 82, 82, 82, 82,
],
],
};
}

getDataLabels(nPoints: number, labelsArray: string[]): string[] {
const labelsArrayLength = labelsArray.length;
const step = Math.round(nPoints / labelsArrayLength);

return Array.from(Array(nPoints)).map((item, index) => {
const dataIndex = Math.round(index / step);

return index % step === 0 ? labelsArray[dataIndex] : '';
});
}

getOrdersChartData(period: string): OrdersChart {
return this.data[period];
}
}
48 changes: 48 additions & 0 deletions src/app/@core/data/orders-profit-chart.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { of as observableOf, Observable } from 'rxjs';
import { Injectable } from '@angular/core';
import { OrdersChart, OrdersChartService } from './orders-chart.service';
import { ProfitChart, ProfitChartService } from './profit-chart.service';

export class OrderProfitChartSummary {
title: string;
value: number;
}

@Injectable()
export class OrdersProfitChartService {

private summary = [
{
title: 'Marketplace',
value: 3654,
},
{
title: 'Last Month',
value: 946,
},
{
title: 'Last Week',
value: 654,
},
{
title: 'Today',
value: 230,
},
];

constructor(private ordersChartService: OrdersChartService,
private profitChartService: ProfitChartService) {
}

getOrderProfitChartSummary(): Observable<OrderProfitChartSummary[]> {
return observableOf(this.summary);
}

getOrdersChartData(period: string): Observable<OrdersChart> {
return observableOf(this.ordersChartService.getOrdersChartData(period));
}

getProfitChartData(period: string): Observable<ProfitChart> {
return observableOf(this.profitChartService.getProfitChartData(period));
}
}
33 changes: 33 additions & 0 deletions src/app/@core/data/periods.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Injectable } from '@angular/core';

@Injectable()
export class PeriodsService {
getYears() {
return [
'2010', '2011', '2012',
'2013', '2014', '2015',
'2016', '2017', '2018',
];
}

getMonths() {
return [
'Jan', 'Feb', 'Mar',
'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep',
'Oct', 'Nov', 'Dec',
];
}

getWeeks() {
return [
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat',
'Sun',
];
}
}
Loading