diff --git a/src/app/pages/dashboard/pieChart/pieChart.service.ts b/src/app/pages/dashboard/pieChart/pieChart.service.ts index b5f77697..13ba0124 100644 --- a/src/app/pages/dashboard/pieChart/pieChart.service.ts +++ b/src/app/pages/dashboard/pieChart/pieChart.service.ts @@ -1,33 +1,36 @@ import {Injectable} from '@angular/core'; +import {BaThemeConfigProvider, colorHelper} from '../../../theme'; @Injectable() export class PieChartService { - private _data = [ - { - color: 'rgba(255,255,255,0.4)', - description: 'New Visits', - stats: '57,820', - icon: 'person', - }, { - color: 'rgba(255,255,255,0.4)', - description: 'Purchases', - stats: '$ 89,745', - icon: 'money', - }, { - color: 'rgba(255,255,255,0.4)', - description: 'Active Users', - stats: '178,391', - icon: 'face', - }, { - color: 'rgba(255,255,255,0.4)', - description: 'Returned', - stats: '32,592', - icon: 'refresh', - } - ]; + constructor(private _baConfig:BaThemeConfigProvider) { + } getData() { - return this._data; + let pieColor = colorHelper.hexToRgbA(this._baConfig.get().colors.defaultText, 0.2); + return [ + { + color: pieColor, + description: 'New Visits', + stats: '57,820', + icon: 'person', + }, { + color: pieColor, + description: 'Purchases', + stats: '$ 89,745', + icon: 'money', + }, { + color: pieColor, + description: 'Active Users', + stats: '178,391', + icon: 'face', + }, { + color: pieColor, + description: 'Returned', + stats: '32,592', + icon: 'refresh', + } + ]; } } diff --git a/src/app/pages/dashboard/todo/todo.component.ts b/src/app/pages/dashboard/todo/todo.component.ts index 6fb9818f..db80f377 100644 --- a/src/app/pages/dashboard/todo/todo.component.ts +++ b/src/app/pages/dashboard/todo/todo.component.ts @@ -1,4 +1,5 @@ import {Component, ViewEncapsulation} from '@angular/core'; +import {BaThemeConfigProvider} from '../../../theme'; import {TodoService} from './todo.service'; @@ -11,37 +12,24 @@ import {TodoService} from './todo.service'; }) export class Todo { - public marks:Array; + public transparent = this._baConfig.get().theme.blur; + public dashboardColors = this._baConfig.get().colors.dashboard; + public todoList:Array; public newTodoText:string = ''; - constructor(private _todoService:TodoService) { - this.marks = this._todoService.getMarks(); + constructor(private _baConfig:BaThemeConfigProvider, private _todoService:TodoService) { this.todoList = this._todoService.getTodoList(); + + this.todoList.forEach((item) => { + item.color = this._getRandomColor(); + }); } getNotDeleted() { - return this.todoList.filter((item:any) => {return !item.deleted}) - } - - getMarkColor(id) { - return this.marks.filter((item) => { return item.id === id;} )[0].color || ''; - } - - changeColor(todo) { - for (var i = 0; i < this.marks.length; ++i) { - if (this.marks[i].id === todo.markId) { - var next = (i + 1 !== this.marks.length) ? i + 1 : 0; - todo.markId = this.marks[next].id; - return false; - } - } - } - - blurOnEnter(event, item) { - if (event.which === 13) { - item.edit = false; - } + return this.todoList.filter((item:any) => { + return !item.deleted + }) } addToDoItem($event) { @@ -50,10 +38,16 @@ export class Todo { this.todoList.unshift({ text: this.newTodoText, - edit: false, - markId: 0 + color: this._getRandomColor(), }); this.newTodoText = ''; } } + + private _getRandomColor() { + let colors = Object.keys(this.dashboardColors).map(key => this.dashboardColors[key]); + + var i = Math.floor(Math.random() * (colors.length - 1)); + return colors[i]; + } } diff --git a/src/app/pages/dashboard/todo/todo.html b/src/app/pages/dashboard/todo/todo.html index 1041202b..76b1e06f 100644 --- a/src/app/pages/dashboard/todo/todo.html +++ b/src/app/pages/dashboard/todo/todo.html @@ -1,17 +1,19 @@ - - -
+
+ + +
-
    -
  • +
      +
    • -
      - - - -
    • -
    +
    + + + +
  • +
+
diff --git a/src/app/pages/dashboard/todo/todo.service.ts b/src/app/pages/dashboard/todo/todo.service.ts index d2ec9115..b6b050f7 100644 --- a/src/app/pages/dashboard/todo/todo.service.ts +++ b/src/app/pages/dashboard/todo/todo.service.ts @@ -3,81 +3,19 @@ import {Injectable} from '@angular/core'; @Injectable() export class TodoService { - private _marks = [ - { - id: 0, - color: 'default' - }, - { - id: 1, - color: 'primary' - }, - { - id: 2, - color: 'success' - }, - { - id: 3, - color: 'warning' - }, - { - id: 4, - color: 'danger' - } - ]; - private _todoList = [ - { - text: 'Check me out', - edit: false, - markId: 4 - }, - { - text: 'Lorem ipsum dolor sit amet, possit denique oportere at his, etiam corpora deseruisse te pro', - edit: false, - markId: 3 - }, - { - text: 'Ex has semper alterum, expetenda dignissim', - edit: false, - markId: 2 - }, - { - text: 'Vim an eius ocurreret abhorreant, id nam aeque persius ornatus.', - edit: false, - markId: 1 - }, - { - text: 'Simul erroribus ad usu', - edit: false, - markId: 0 - }, - { - text: 'Ei cum solet appareat, ex est graeci mediocritatem', - edit: false, - markId: 4 - }, - { - text: 'Get in touch with akveo team', - edit: false, - markId: 1 - }, - { - text: 'Write email to business cat', - edit: false, - markId: 3 - }, - { - text: 'Have fun with blur admin', - edit: false, - markId: 2 - }, + { text: 'Check me out' }, + { text: 'Lorem ipsum dolor sit amet, possit denique oportere at his, etiam corpora deseruisse te pro' }, + { text: 'Ex has semper alterum, expetenda dignissim' }, + { text: 'Vim an eius ocurreret abhorreant, id nam aeque persius ornatus.' }, + { text: 'Simul erroribus ad usu' }, + { text: 'Ei cum solet appareat, ex est graeci mediocritatem' }, + { text: 'Get in touch with akveo team' }, + { text: 'Write email to business cat' }, + { text: 'Have fun with blur admin' }, + { text: 'What do you think?' }, ]; - getMarks() { - return this._marks; - } - getTodoList() { return this._todoList; }