Commit 3cb418c1199a45ad3a44ee5401933fd5ea36a980
1 parent
81eadae4
Exists in
master
3-4-5 ได้แล้วว ><
Showing
3 changed files
with
177 additions
and
55 deletions
Show diff stats
src/app/dashboard/dashboard.component.html
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | <a href="#tab3" data-toggle="tab" aria-expanded="false">SDE+SDN</a> | 15 | <a href="#tab3" data-toggle="tab" aria-expanded="false">SDE+SDN</a> |
16 | </li> | 16 | </li> |
17 | <li class="sbold"> | 17 | <li class="sbold"> |
18 | - <a href="#tab4" data-toggle="tab" aria-expanded="false">AP Down+APD</a> | 18 | + <a href="#tab4" data-toggle="tab" aria-expanded="false">AP Down</a> |
19 | </li> | 19 | </li> |
20 | <li class="sbold"> | 20 | <li class="sbold"> |
21 | <a href="#tab5" data-toggle="tab" aria-expanded="false">BNW+NDS+NED+NES+NET</a> | 21 | <a href="#tab5" data-toggle="tab" aria-expanded="false">BNW+NDS+NED+NES+NET</a> |
@@ -468,7 +468,7 @@ | @@ -468,7 +468,7 @@ | ||
468 | </div> | 468 | </div> |
469 | <div class="panel-body"> | 469 | <div class="panel-body"> |
470 | <div class="row"> | 470 | <div class="row"> |
471 | - <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultData | filter:FilterSearch: '' "> | 471 | + <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultData5 | filter:FilterSearch: '' "> |
472 | <a class="dashboard-stat dashboard-stat-v2 red " | 472 | <a class="dashboard-stat dashboard-stat-v2 red " |
473 | href="{{item.link}}" | 473 | href="{{item.link}}" |
474 | target="_blank" | 474 | target="_blank" |
@@ -522,7 +522,7 @@ | @@ -522,7 +522,7 @@ | ||
522 | </div> | 522 | </div> |
523 | <div class="panel-body"> | 523 | <div class="panel-body"> |
524 | <div class="row"> | 524 | <div class="row"> |
525 | - <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultDataOnHold | filter:FilterSearchOnHold: '' "> | 525 | + <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultDataOnHold5 | filter:FilterSearchOnHold: '' "> |
526 | <a class="dashboard-stat dashboard-stat-v2 red " | 526 | <a class="dashboard-stat dashboard-stat-v2 red " |
527 | href="{{item.link}}" | 527 | href="{{item.link}}" |
528 | target="_blank" | 528 | target="_blank" |
src/app/dashboard/dashboard.component.ts
@@ -50,7 +50,7 @@ export class DashboardComponent implements OnInit { | @@ -50,7 +50,7 @@ export class DashboardComponent implements OnInit { | ||
50 | resultData4: any; | 50 | resultData4: any; |
51 | resultDataOnHold4: any; | 51 | resultDataOnHold4: any; |
52 | 52 | ||
53 | - resultDat5: any; | 53 | + resultData5: any; |
54 | resultDataOnHold5: any; | 54 | resultDataOnHold5: any; |
55 | 55 | ||
56 | resultData6: any; | 56 | resultData6: any; |
@@ -176,32 +176,33 @@ export class DashboardComponent implements OnInit { | @@ -176,32 +176,33 @@ export class DashboardComponent implements OnInit { | ||
176 | }, 600000); | 176 | }, 600000); |
177 | //----------------------------3------------------------ | 177 | //----------------------------3------------------------ |
178 | // Active | 178 | // Active |
179 | - // try { | ||
180 | - // const data3 = { | ||
181 | - // // tslint:disable-next-line:max-line-length | ||
182 | - // "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) IN ('SDE (Site Down บ่อย)','SDN (Site Down Reset แล้วใช้งานไม่ได้)') 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", | ||
183 | - // "params": ["vtiger_crmentity"] | ||
184 | - // }; | ||
185 | - // let response = await this._apiService.post('dynamic', data3); | ||
186 | - // if (response !== null) { | ||
187 | - // this.resultData3 = response; | ||
188 | - // this.resultData3.link = decodeURIComponent(decodeURIComponent(this.resultData3.link)); | ||
189 | - // console.log('link: ', this.resultData3.link); | ||
190 | - // // tslint:disable-next-line:forin | ||
191 | - // for (const i in this.resultData3) { | ||
192 | - // this.resultData3[i].link = this._common.decodeURI(this.resultData3[i].link); | ||
193 | - // this.resultData3[i].birth_date = this._common.convertDate(this.resultData3[i].birth_date); | ||
194 | - // } | ||
195 | - // } else { | ||
196 | - // this.resultData3 = []; | ||
197 | - // } | ||
198 | - // } catch (error) { | ||
199 | - // console.log(error); | ||
200 | - // } | 179 | + try { |
180 | + const data3 = { | ||
181 | + // tslint:disable-next-line:max-line-length | ||
182 | + "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) IN ('SDE (Site Down บ่อย)','SDN (Site Down Reset แล้วใช้งานไม่ได้)') 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", | ||
183 | + "params": ["vtiger_crmentity"] | ||
184 | + }; | ||
185 | + let response = await this._apiService.post('dynamic', data3); | ||
186 | + if (response !== null) { | ||
187 | + this.resultData3 = response; | ||
188 | + console.log(this.resultData3); | ||
189 | + this.resultData3.link = decodeURIComponent(decodeURIComponent(this.resultData3.link)); | ||
190 | + console.log('link: ', this.resultData3.link); | ||
191 | + // tslint:disable-next-line:forin | ||
192 | + for (const i in this.resultData3) { | ||
193 | + this.resultData3[i].link = this._common.decodeURI(this.resultData3[i].link); | ||
194 | + this.resultData3[i].birth_date = this._common.convertDate(this.resultData3[i].birth_date); | ||
195 | + } | ||
196 | + } else { | ||
197 | + this.resultData3 = []; | ||
198 | + } | ||
199 | + } catch (error) { | ||
200 | + console.log(error); | ||
201 | + } | ||
201 | 202 | ||
202 | - // setInterval(async() => { | ||
203 | - // await this.getData3(); | ||
204 | - // }, 600000); | 203 | + setInterval(async() => { |
204 | + await this.getData3(); | ||
205 | + }, 600000); | ||
205 | 206 | ||
206 | 207 | ||
207 | //OnHold | 208 | //OnHold |
@@ -290,6 +291,61 @@ export class DashboardComponent implements OnInit { | @@ -290,6 +291,61 @@ export class DashboardComponent implements OnInit { | ||
290 | 291 | ||
291 | }, 600000); | 292 | }, 600000); |
292 | //----------------------------5------------------------ | 293 | //----------------------------5------------------------ |
294 | + try { | ||
295 | + const data5 = { | ||
296 | + // tslint:disable-next-line:max-line-length | ||
297 | + "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) IN ('BNW (ตรวจสอบความเร็วเน็ต)','NDS (บางเส้นมีปัญหา Offline, Unplug)','NED (เนตหลุดบ่อย)','NES (Internet ช้า)','NET (Set Internet)') 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", | ||
298 | + "params": ["vtiger_crmentity"] | ||
299 | + }; | ||
300 | + let response = await this._apiService.post('dynamic', data5); | ||
301 | + if (response !== null) { | ||
302 | + this.resultData5 = response; | ||
303 | + this.resultData5.link = decodeURIComponent(decodeURIComponent(this.resultData5.link)); | ||
304 | + console.log('link: ', this.resultData5.link); | ||
305 | + // tslint:disable-next-line:forin | ||
306 | + for (const i in this.resultData5) { | ||
307 | + this.resultData5[i].link = this._common.decodeURI(this.resultData5[i].link); | ||
308 | + this.resultData5[i].birth_date = this._common.convertDate(this.resultData5[i].birth_date); | ||
309 | + } | ||
310 | + } else { | ||
311 | + this.resultData5 = []; | ||
312 | + } | ||
313 | + } catch (error) { | ||
314 | + console.log(error); | ||
315 | + } | ||
316 | + | ||
317 | + setInterval(async() => { | ||
318 | + await this.getData5(); | ||
319 | + }, 600000); | ||
320 | + | ||
321 | + | ||
322 | + //OnHold | ||
323 | + try { | ||
324 | + const dataOnHold5 = { | ||
325 | + // tslint:disable-next-line:max-line-length | ||
326 | + "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) IN ('BNW (ตรวจสอบความเร็วเน็ต)','NDS (บางเส้นมีปัญหา Offline, Unplug)','NED (เนตหลุดบ่อย)','NES (Internet ช้า)','NET (Set Internet)') AND LCASE(vtiger_troubletickets. STATUS) IN('Wait For Customer')) GROUP BY vtiger_troubletickets.ticketid ORDER BY vtiger_crmentity.createdtime ASC LIMIT 0 , 100", | ||
327 | + "params": ["vtiger_crmentity"] | ||
328 | + }; | ||
329 | + let response = await this._apiService.post('dynamic', dataOnHold5); | ||
330 | + if (response !== null) { | ||
331 | + this.resultDataOnHold5 = response; | ||
332 | + this.resultDataOnHold5.link = decodeURIComponent(decodeURIComponent(this.resultDataOnHold5.link)); | ||
333 | + console.log('link: ', this.resultDataOnHold5.link); | ||
334 | + // tslint:disable-next-line:forin | ||
335 | + for (const i in this.resultDataOnHold5) { | ||
336 | + this.resultDataOnHold5[i].link = this._common.decodeURI(this.resultDataOnHold5[i].link); | ||
337 | + this.resultDataOnHold5[i].birth_date = this._common.convertDate(this.resultDataOnHold5[i].birth_date); | ||
338 | + } | ||
339 | + } else { | ||
340 | + this.resultDataOnHold5 = []; | ||
341 | + } | ||
342 | + } catch (error) { | ||
343 | + console.log(error); | ||
344 | + } | ||
345 | + | ||
346 | + setInterval(async() => { | ||
347 | + await this.getDataOnHold5(); | ||
348 | + }, 600000); | ||
293 | //----------------------------6------------------------ | 349 | //----------------------------6------------------------ |
294 | } | 350 | } |
295 | 351 | ||
@@ -401,30 +457,30 @@ export class DashboardComponent implements OnInit { | @@ -401,30 +457,30 @@ export class DashboardComponent implements OnInit { | ||
401 | } | 457 | } |
402 | //----------------------------3------------------------ | 458 | //----------------------------3------------------------ |
403 | // Active | 459 | // Active |
404 | - // async getData3() { | ||
405 | - // try { | ||
406 | - // const data3 = { | ||
407 | - // // tslint:disable-next-line:max-line-length | ||
408 | - // "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) IN ('SDE (Site Down บ่อย)','SDN (Site Down Reset แล้วใช้งานไม่ได้)') 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", | ||
409 | - // "params": ["vtiger_crmentity"] | ||
410 | - // }; | ||
411 | - // let response = await this._apiService.post('dynamic', data3); | ||
412 | - // if (response !== null) { | ||
413 | - // this.resultData3 = response; | ||
414 | - // this.resultData3.link = decodeURIComponent(decodeURIComponent(this.resultData3.link)); | ||
415 | - // console.log('link: ', this.resultData3.link); | ||
416 | - // // tslint:disable-next-line:forin | ||
417 | - // for (const i in this.resultData3) { | ||
418 | - // this.resultData3[i].link = this._common.decodeURI(this.resultData3[i].link); | ||
419 | - // this.resultData3[i].birth_date = this._common.convertDate(this.resultData3[i].birth_date); | ||
420 | - // } | ||
421 | - // } else { | ||
422 | - // this.resultData3 = []; | ||
423 | - // } | ||
424 | - // } catch (error) { | ||
425 | - // console.log(error); | ||
426 | - // } | ||
427 | - // } | 460 | + async getData3() { |
461 | + try { | ||
462 | + const data3 = { | ||
463 | + // tslint:disable-next-line:max-line-length | ||
464 | + "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) IN ('SDE (Site Down บ่อย)','SDN (Site Down Reset แล้วใช้งานไม่ได้)') 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", | ||
465 | + "params": ["vtiger_crmentity"] | ||
466 | + }; | ||
467 | + let response = await this._apiService.post('dynamic', data3); | ||
468 | + if (response !== null) { | ||
469 | + this.resultData3 = response; | ||
470 | + this.resultData3.link = decodeURIComponent(decodeURIComponent(this.resultData3.link)); | ||
471 | + console.log('link: ', this.resultData3.link); | ||
472 | + // tslint:disable-next-line:forin | ||
473 | + for (const i in this.resultData3) { | ||
474 | + this.resultData3[i].link = this._common.decodeURI(this.resultData3[i].link); | ||
475 | + this.resultData3[i].birth_date = this._common.convertDate(this.resultData3[i].birth_date); | ||
476 | + } | ||
477 | + } else { | ||
478 | + this.resultData3 = []; | ||
479 | + } | ||
480 | + } catch (error) { | ||
481 | + console.log(error); | ||
482 | + } | ||
483 | + } | ||
428 | 484 | ||
429 | //On Hold | 485 | //On Hold |
430 | async getDataOnHold3() { | 486 | async getDataOnHold3() { |
@@ -504,6 +560,57 @@ export class DashboardComponent implements OnInit { | @@ -504,6 +560,57 @@ export class DashboardComponent implements OnInit { | ||
504 | } | 560 | } |
505 | } | 561 | } |
506 | //----------------------------5------------------------ | 562 | //----------------------------5------------------------ |
563 | + // Active | ||
564 | + async getData5() { | ||
565 | + try { | ||
566 | + const data5 = { | ||
567 | + // tslint:disable-next-line:max-line-length | ||
568 | + "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) IN ('BNW (ตรวจสอบความเร็วเน็ต)','NDS (บางเส้นมีปัญหา Offline, Unplug)','NED (เนตหลุดบ่อย)','NES (Internet ช้า)','NET (Set Internet)') 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", | ||
569 | + "params": ["vtiger_crmentity"] | ||
570 | + }; | ||
571 | + let response = await this._apiService.post('dynamic', data5); | ||
572 | + if (response !== null) { | ||
573 | + this.resultData5 = response; | ||
574 | + this.resultData5.link = decodeURIComponent(decodeURIComponent(this.resultData5.link)); | ||
575 | + console.log('link: ', this.resultData5.link); | ||
576 | + // tslint:disable-next-line:forin | ||
577 | + for (const i in this.resultData5) { | ||
578 | + this.resultData5[i].link = this._common.decodeURI(this.resultData5[i].link); | ||
579 | + this.resultData5[i].birth_date = this._common.convertDate(this.resultData5[i].birth_date); | ||
580 | + } | ||
581 | + } else { | ||
582 | + this.resultData5 = []; | ||
583 | + } | ||
584 | + } catch (error) { | ||
585 | + console.log(error); | ||
586 | + } | ||
587 | + } | ||
588 | + //On Hold | ||
589 | + async getDataOnHold5() { | ||
590 | + try { | ||
591 | + const dataOnHold5 = { | ||
592 | + // tslint:disable-next-line:max-line-length | ||
593 | + "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) IN ('BNW (ตรวจสอบความเร็วเน็ต)','NDS (บางเส้นมีปัญหา Offline, Unplug)','NED (เนตหลุดบ่อย)','NES (Internet ช้า)','NET (Set Internet)') AND LCASE(vtiger_troubletickets. STATUS) IN('Wait For Customer')) GROUP BY vtiger_troubletickets.ticketid ORDER BY vtiger_crmentity.createdtime ASC LIMIT 0 , 100", | ||
594 | + "params": ["vtiger_crmentity"] | ||
595 | + }; | ||
596 | + let response = await this._apiService.post('dynamic', dataOnHold5); | ||
597 | + if (response !== null) { | ||
598 | + this.resultDataOnHold5 = response; | ||
599 | + this.resultDataOnHold5.link = decodeURIComponent(decodeURIComponent(this.resultDataOnHold5.link)); | ||
600 | + console.log('link: ', this.resultDataOnHold5.link); | ||
601 | + // tslint:disable-next-line:forin | ||
602 | + for (const i in this.resultDataOnHold5) { | ||
603 | + this.resultDataOnHold5[i].link = this._common.decodeURI(this.resultDataOnHold5[i].link); | ||
604 | + this.resultDataOnHold5[i].birth_date = this._common.convertDate(this.resultDataOnHold5[i].birth_date); | ||
605 | + } | ||
606 | + } else { | ||
607 | + this.resultDataOnHold5 = []; | ||
608 | + } | ||
609 | + } catch (error) { | ||
610 | + console.log(error); | ||
611 | + } | ||
612 | + } | ||
613 | + | ||
507 | //----------------------------6------------------------ | 614 | //----------------------------6------------------------ |
508 | 615 | ||
509 | } | 616 | } |
510 | \ No newline at end of file | 617 | \ No newline at end of file |
src/app/dashboard/filter.pipe.ts
@@ -14,9 +14,24 @@ export class FilterPipe implements PipeTransform { | @@ -14,9 +14,24 @@ export class FilterPipe implements PipeTransform { | ||
14 | const resultArray = []; | 14 | const resultArray = []; |
15 | for (const item of value) { | 15 | for (const item of value) { |
16 | console.log('item: ', item); | 16 | console.log('item: ', item); |
17 | - var string1 = item['team'].toLowerCase() + item['COMMENT'].toLowerCase() + item['custgroupName'].toLowerCase() + item['STATUS'].toLowerCase() ; | 17 | + var st = ''; |
18 | + // st = item['team'].toLowerCase() + item['COMMENT'].toLowerCase() + item['custgroupName'].toLowerCase() + item['STATUS'].toLowerCase() ; | ||
19 | + if(item['team']){ | ||
20 | + st = st + item['team'].toLowerCase(); | ||
21 | + } | ||
22 | + if(item['COMMENT']){ | ||
23 | + st = st + item['COMMENT'].toLowerCase(); | ||
24 | + } | ||
25 | + if(item['custgroupName']){ | ||
26 | + st = st + item['custgroupName'].toLowerCase(); | ||
27 | + } | ||
28 | + if(item['STATUS']){ | ||
29 | + st = st + item['STATUS'].toLowerCase(); | ||
30 | + } | ||
31 | + | ||
32 | + | ||
18 | var string2 = filterString.toLowerCase(); | 33 | var string2 = filterString.toLowerCase(); |
19 | - if (string1.indexOf(string2) > -1) { | 34 | + if (st.indexOf(string2) > -1) { |
20 | resultArray.push(item); | 35 | resultArray.push(item); |
21 | } | 36 | } |
22 | } | 37 | } |