Commit 1a55036127aab324bac50b477e480e4bf82c78a4

Authored by trainee
1 parent 37cd3a69
Exists in master

no message

src/app/dashboard/dashboard.component.html
@@ -2,20 +2,22 @@ @@ -2,20 +2,22 @@
2 <!-- งานใหม่ --> 2 <!-- งานใหม่ -->
3 <div class="row"> 3 <div class="row">
4 <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultData"> 4 <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultData">
5 - <a class="dashboard-stat dashboard-stat-v2 green" href="#">  
6 - <!-- <div [ngStyle]="{'background-color':item.days === '418' ? 'green' : 'red' }"></<div> -->  
7 - <div class="avater">{{(item.days/60).toFixed(0)}} D</div> 5 + <a class="dashboard-stat dashboard-stat-v2 green" href="http://vtiger.sourcecode.co.th/index.php?action=DetailView&module=HelpDesk&parenttab=Support&record=195885" target="_blank"
  6 + [ngStyle]="{'background-color': getColorDay(item.days.toFixed(0))}">
  7 + <!-- <div [ngStyle]="{'background-color':item.days === '366.0098' ? 'green' : 'red' }"></<div> -->
  8 + <!-- <div class="avater">{{(item.days).toFixed(0)}} D</div> -->
  9 + <div class="avater" [ngStyle]="{'background-color': getColorDay(item.days.toFixed(0))}">{{(item.days).toFixed(0)}} D</div>
8 <div class="visual"> 10 <div class="visual">
9 <i class="fa fa-comments"></i> 11 <i class="fa fa-comments"></i>
10 </div> 12 </div>
11 13
12 <div class="details" style="width: calc(100% - 50px);"> 14 <div class="details" style="width: calc(100% - 50px);">
13 - <div style="text-align: right; margin-top: -50px; color:aliceblue;">{{item.status}}</div> 15 + <div style="text-align: right; margin-top: -50px; ">{{item.status}}</div>
14 <div class="number" style="margin-top: -8px;"> 16 <div class="number" style="margin-top: -8px;">
15 - <span data-counter="counterup" data-value="">{{item.custgroupName}}</span> 17 + <span data-counter="counterup" data-value="" style=" color: black;">{{item.custgroupName}}</span>
16 </div> 18 </div>
17 - <div class="desc">{{item.team}}</div><br>  
18 - <div class="desc" style="text-align: left;">{{item.COMMENT | slice:0:40 }} ....</div> 19 + <div class="desc" style=" color: black;">{{item.team}}</div><br>
  20 + <div class="desc" style="text-align: left; color: black;">{{item.COMMENT | slice:0:45 }} ....</div>
19 </div> 21 </div>
20 </a> 22 </a>
21 </div> 23 </div>
src/app/dashboard/dashboard.component.scss
1 .avater { 1 .avater {
2 background-color: black; 2 background-color: black;
3 - color: white; 3 + color: black;
4 position: relative; 4 position: relative;
5 width: 70px; 5 width: 70px;
6 height: 70px; 6 height: 70px;
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 text-align: center; 8 text-align: center;
9 padding-top: 25px; 9 padding-top: 25px;
10 top: -20px; 10 top: -20px;
11 - &.11 { 11 + &.red {
12 background-color: red; 12 background-color: red;
13 } 13 }
14 &.yellow { 14 &.yellow {
@@ -21,7 +21,8 @@ @@ -21,7 +21,8 @@
21 } 21 }
22 22
23 23
  24 +
24 .dashboard-stat { 25 .dashboard-stat {
25 overflow: visible; 26 overflow: visible;
26 - height: 200px; 27 + height: 210px;
27 } 28 }
src/app/dashboard/dashboard.component.ts
@@ -11,28 +11,23 @@ import { CommonService } from &#39;../services/common/common.service&#39;; @@ -11,28 +11,23 @@ import { CommonService } from &#39;../services/common/common.service&#39;;
11 export class DashboardComponent implements OnInit { 11 export class DashboardComponent implements OnInit {
12 12
13 resultData: any; 13 resultData: any;
14 -  
15 - // getColor(days) {  
16 - // switch (days) {  
17 - // case 'greenDay':  
18 - // return 'green';  
19 - // case 'yellowDay':  
20 - // return 'yellow';  
21 - // case 'redDay':  
22 - // return 'red';  
23 - // }  
24 - // }  
25 14
26 - // ColorDays: any[] = [  
27 - // {  
28 - // "Days": ['0','1','2','3','4','5','6','7']  
29 - // },  
30 - // {  
31 - // "Days": ['8','9','10','11','12','13','14','15']  
32 - // },  
33 -  
34 - // ]; 15 + getColorDay(days){
  16 + console.log(days)
35 17
  18 + if(days > 0 && days <= 7){
  19 + return 'red';
  20 + }
  21 +
  22 + if (days > 8 && days <= 15){
  23 + return 'yellow';
  24 + }
  25 +
  26 + if (days >= 16){
  27 + return 'green';
  28 + }
  29 + }
  30 +
36 constructor( 31 constructor(
37 private _apiService: ApiService, 32 private _apiService: ApiService,
38 private _common: CommonService, 33 private _common: CommonService,
@@ -46,7 +41,9 @@ export class DashboardComponent implements OnInit { @@ -46,7 +41,9 @@ export class DashboardComponent implements OnInit {
46 "params": ["vtiger_crmentity"] 41 "params": ["vtiger_crmentity"]
47 } 42 }
48 43
49 - 44 + setInterval(() => {
  45 +
  46 + }, );
50 47
51 try { 48 try {
52 let response = await this._apiService.post('dynamic', data); 49 let response = await this._apiService.post('dynamic', data);