Commit 85ebe15c756f8439311a5117fa586a015f60f1b8
1 parent
a0f33aed
Exists in
master
ทำ urldecode เสร็จแล้ว เหลือ คอมเม้น
Showing
3 changed files
with
25 additions
and
14 deletions
Show diff stats
src/app/dashboard/dashboard.component.html
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 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 red" | 5 | <a class="dashboard-stat dashboard-stat-v2 red" |
| 6 | - href="http://vtiger.sourcecode.co.th/index.php?action=DetailView&module=HelpDesk&parenttab=Support&record=195885" | 6 | + href="{{item.link}}" |
| 7 | target="_blank" | 7 | target="_blank" |
| 8 | [ngStyle] = "{'background-color': getColorDay(item.days.toFixed(0))}"> | 8 | [ngStyle] = "{'background-color': getColorDay(item.days.toFixed(0))}"> |
| 9 | <!-- <div [ngStyle]="{'background-color':item.days === '366.0098' ? 'green' : 'red' }"></<div> --> | 9 | <!-- <div [ngStyle]="{'background-color':item.days === '366.0098' ? 'green' : 'red' }"></<div> --> |
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | 15 | ||
| 16 | <div class="details" style="width: calc(100% - 50px);"> | 16 | <div class="details" style="width: calc(100% - 50px);"> |
| 17 | <div style="text-align: right; margin-top: -50px; color: black;">{{item.STATUS}}</div> | 17 | <div style="text-align: right; margin-top: -50px; color: black;">{{item.STATUS}}</div> |
| 18 | - <div class= "number" style=" color: black; text-align: right;"> | 18 | + <div class= "number" style=" color: black; display: block; text-align: right;"> |
| 19 | <span data-counter="counterup" data-value="">{{item.custgroupName}}</span> | 19 | <span data-counter="counterup" data-value="">{{item.custgroupName}}</span> |
| 20 | </div> | 20 | </div> |
| 21 | <div class="desc" style=" color: black;">{{item.team}}</div><br> | 21 | <div class="desc" style=" color: black;">{{item.team}}</div><br> |
src/app/dashboard/dashboard.component.ts
| @@ -36,22 +36,22 @@ export class DashboardComponent implements OnInit { | @@ -36,22 +36,22 @@ export class DashboardComponent implements OnInit { | ||
| 36 | ) { } | 36 | ) { } |
| 37 | 37 | ||
| 38 | async ngOnInit() { | 38 | async ngOnInit() { |
| 39 | - let data = { | ||
| 40 | - "query": "SELECT vtiger_account.accountname AS custgroupName , vtiger_troubletickets.ticketid AS id , IF( vtiger_groups.groupname IS NOT NULL , vtiger_groups.groupname , vu.user_name) AS team , vtiger_troubletickets.title , vtiger_troubletickets. STATUS , vtiger_troubletickets.priority , CONCAT( 'http%3A%2F%2Fvtiger.sourcecode.co.th%2Findex.php%3Faction%3DDetailView%26module%3DHelpDesk%26parenttab%3DSupport%26record%3D' , vtiger_troubletickets.ticketid) AS link ,( SELECT xx.comments FROM vtiger_ticketcomments xx WHERE xx.ticketid = vtiger_troubletickets.ticketid ORDER BY xx.createdtime DESC LIMIT 1) AS COMMENT , CASE vtiger_troubletickets. STATUS WHEN 'Closed' THEN( unix_timestamp(vtiger_crmentity.modifiedtime) - unix_timestamp(vtiger_crmentity.createdtime)) / 86400 ELSE( unix_timestamp(now()) - unix_timestamp(vtiger_crmentity.createdtime)) / 86400 END AS days , concat( vtiger_ticketcf.cf_568 , ' (' , vtiger_cf_568.day_amount , ')') AS type , IFNULL(( SELECT 'Wait for response by' FROM vtiger_ticket_history WHERE vtiger_troubletickets.ticketid = vtiger_ticket_history.ticketid AND assigned_type = 'Wait for response' ORDER BY updatetime DESC LIMIT 0 , 1) , 'Created by') userType , IFNULL(( SELECT concat('' , assigned_by , '') FROM vtiger_ticket_history WHERE vtiger_troubletickets.ticketid = vtiger_ticket_history.ticketid AND assigned_type = 'Wait for response' ORDER BY updatetime DESC LIMIT 0 , 1) , vtiger_users.user_name) username , vtiger_crmentity.description , vtiger_crmentity.createdtime , vtiger_crmentity.modifiedtime , vtiger_cf_568.cf_568id FROM vtiger_crmentity JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smcreatorid JOIN vtiger_troubletickets ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid JOIN vtiger_account ON vtiger_account.accountid = vtiger_troubletickets.parent_id JOIN vtiger_ticketcf ON vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid JOIN vtiger_cf_568 ON vtiger_cf_568.cf_568 = vtiger_ticketcf.cf_568 LEFT OUTER JOIN vtiger_groups ON vtiger_crmentity.smownerid = vtiger_groups.groupid LEFT OUTER JOIN vtiger_users vu ON vtiger_crmentity.smownerid = vu.id WHERE 1 AND vtiger_crmentity.setype = 'HelpDesk' AND vtiger_crmentity.deleted = 0 AND vtiger_ticketcf.cf_568 != '' AND vtiger_cf_568.cf_568id NOT IN(8 , 9 , 10) AND( LCASE(vtiger_cf_568.cf_568) = 'set (ติดตั้ง)' AND LCASE(vtiger_troubletickets. STATUS) not in('closed' , 'Wait For Customer')) GROUP BY vtiger_troubletickets.ticketid ORDER BY vtiger_crmentity.createdtime ASC LIMIT 0 , 100", | ||
| 41 | - "params": ["vtiger_crmentity"] | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - setInterval(() => { | ||
| 45 | - | ||
| 46 | - }, ); | ||
| 47 | - | 39 | + const data = { |
| 40 | + // tslint:disable-next-line:max-line-length | ||
| 41 | + 'query': 'SELECT vtiger_account.accountname AS custgroupName , vtiger_troubletickets.ticketid AS id , IF( vtiger_groups.groupname is not null , vtiger_groups.groupname , vu.user_name) as team , vtiger_troubletickets.title , vtiger_troubletickets. STATUS , vtiger_troubletickets.priority , CONCAT( \'http%3A%2F%2Fvtiger.sourcecode.co.th%2Findex.php%3Faction%3DDetailView%26module%3DHelpDesk%26parenttab%3DSupport%26record%3D\' , vtiger_troubletickets.ticketid) AS link ,( SELECT xx.comments FROM vtiger_ticketcomments xx WHERE xx.ticketid = vtiger_troubletickets.ticketid ORDER BY xx.createdtime DESC LIMIT 1) AS COMMENT , CASE vtiger_troubletickets. STATUS WHEN \'Closed\' THEN( unix_timestamp(vtiger_crmentity.modifiedtime) - unix_timestamp(vtiger_crmentity.createdtime)) / 86400 ELSE( unix_timestamp(now()) - unix_timestamp(vtiger_crmentity.createdtime)) / 86400 END AS days , concat( vtiger_ticketcf.cf_568 , \' (\' , vtiger_cf_568.day_amount , \')\') AS type , IFNULL(( SELECT \'Wait for response by\' FROM vtiger_ticket_history WHERE vtiger_troubletickets.ticketid = vtiger_ticket_history.ticketid AND assigned_type = \'Wait for response\' ORDER BY updatetime DESC LIMIT 0 , 1) , \'Created by\') userType , IFNULL(( SELECT concat(\'\' , assigned_by , \'\') FROM vtiger_ticket_history WHERE vtiger_troubletickets.ticketid = vtiger_ticket_history.ticketid AND assigned_type = \'Wait for response\' ORDER BY updatetime DESC LIMIT 0 , 1) , vtiger_users.user_name) username , vtiger_crmentity.description , vtiger_crmentity.createdtime , vtiger_crmentity.modifiedtime , vtiger_cf_568.cf_568id FROM vtiger_crmentity JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smcreatorid JOIN vtiger_troubletickets ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid JOIN vtiger_account ON vtiger_account.accountid = vtiger_troubletickets.parent_id JOIN vtiger_ticketcf ON vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid JOIN vtiger_cf_568 ON vtiger_cf_568.cf_568 = vtiger_ticketcf.cf_568 LEFT OUTER JOIN vtiger_groups ON vtiger_crmentity.smownerid = vtiger_groups.groupid LEFT OUTER JOIN vtiger_users vu ON vtiger_crmentity.smownerid = vu.id WHERE 1 AND vtiger_crmentity.setype = \'HelpDesk\' AND vtiger_crmentity.deleted = 0 AND vtiger_ticketcf.cf_568 != \'\' AND vtiger_cf_568.cf_568id NOT IN(8 , 9 , 10) AND( LCASE(vtiger_cf_568.cf_568) = \'set (ติดตั้ง)\' AND LCASE(vtiger_troubletickets. STATUS) != \'closed\') GROUP BY vtiger_troubletickets.ticketid ORDER BY vtiger_crmentity.createdtime ASC LIMIT 0 , 100', | ||
| 42 | + 'params': ['vtiger_crmentity'] | ||
| 43 | + }; | ||
| 48 | try { | 44 | try { |
| 49 | - let response = await this._apiService.post('dynamic', data); | 45 | + const response = await this._apiService.post('dynamic', data); |
| 50 | if (response !== null) { | 46 | if (response !== null) { |
| 51 | this.resultData = response; | 47 | this.resultData = response; |
| 52 | - for (let i in this.resultData) { | 48 | + this.resultData.link = decodeURIComponent(decodeURIComponent(this.resultData.link)); |
| 49 | + console.log('link: ', this.resultData.link); | ||
| 50 | + // tslint:disable-next-line:forin | ||
| 51 | + for (const i in this.resultData) { | ||
| 52 | + this.resultData[i].link = this._common.decodeURI(this.resultData[i].link); | ||
| 53 | this.resultData[i].birth_date = this._common.convertDate(this.resultData[i].birth_date); | 53 | this.resultData[i].birth_date = this._common.convertDate(this.resultData[i].birth_date); |
| 54 | - }; | 54 | + } |
| 55 | } else { | 55 | } else { |
| 56 | this.resultData = []; | 56 | this.resultData = []; |
| 57 | } | 57 | } |
| @@ -59,6 +59,7 @@ export class DashboardComponent implements OnInit { | @@ -59,6 +59,7 @@ export class DashboardComponent implements OnInit { | ||
| 59 | console.log(error); | 59 | console.log(error); |
| 60 | } | 60 | } |
| 61 | } | 61 | } |
| 62 | + } | ||
| 62 | 63 | ||
| 63 | // getColor(color) { | 64 | // getColor(color) { |
| 64 | // console.log(color) | 65 | // console.log(color) |
src/app/services/common/common.service.ts
| @@ -16,6 +16,16 @@ export class CommonService { | @@ -16,6 +16,16 @@ export class CommonService { | ||
| 16 | } | 16 | } |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | + decodeURI(uri) { | ||
| 20 | + console.log(uri); | ||
| 21 | + if (uri) { | ||
| 22 | + uri = decodeURIComponent(uri); | ||
| 23 | + } else { | ||
| 24 | + | ||
| 25 | + } | ||
| 26 | + return uri | ||
| 27 | + } | ||
| 28 | + | ||
| 19 | convertDate(date: any) { | 29 | convertDate(date: any) { |
| 20 | let dateTime = moment(date, 'YYYY-MM-DD HH:mm'); | 30 | let dateTime = moment(date, 'YYYY-MM-DD HH:mm'); |
| 21 | if (dateTime.isValid()) { | 31 | if (dateTime.isValid()) { |