Commit bdd086cc7ba00664245dde582683363bdbfb165a
1 parent
3cb418c1
Exists in
master
page 6
Showing
2 changed files
with
107 additions
and
3 deletions
Show diff stats
src/app/dashboard/dashboard.component.html
| ... | ... | @@ -574,7 +574,7 @@ |
| 574 | 574 | </div> |
| 575 | 575 | <div class="panel-body"> |
| 576 | 576 | <div class="row"> |
| 577 | - <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultData | filter:FilterSearch: '' "> | |
| 577 | + <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultData6 | filter:FilterSearch: '' "> | |
| 578 | 578 | <a class="dashboard-stat dashboard-stat-v2 red " |
| 579 | 579 | href="{{item.link}}" |
| 580 | 580 | target="_blank" |
| ... | ... | @@ -628,7 +628,7 @@ |
| 628 | 628 | </div> |
| 629 | 629 | <div class="panel-body"> |
| 630 | 630 | <div class="row"> |
| 631 | - <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultDataOnHold | filter:FilterSearchOnHold: '' "> | |
| 631 | + <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultDataOnHold6 | filter:FilterSearchOnHold: '' "> | |
| 632 | 632 | <a class="dashboard-stat dashboard-stat-v2 red " |
| 633 | 633 | href="{{item.link}}" |
| 634 | 634 | target="_blank" | ... | ... |
src/app/dashboard/dashboard.component.ts
| ... | ... | @@ -347,6 +347,61 @@ export class DashboardComponent implements OnInit { |
| 347 | 347 | await this.getDataOnHold5(); |
| 348 | 348 | }, 600000); |
| 349 | 349 | //----------------------------6------------------------ |
| 350 | + try { | |
| 351 | + const data6 = { | |
| 352 | + // tslint:disable-next-line:max-line-length | |
| 353 | + "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) = 'CUS (ตรวจสอบเครื่องลูกค้า)' 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", | |
| 354 | + "params": ["vtiger_crmentity"] | |
| 355 | + }; | |
| 356 | + let response = await this._apiService.post('dynamic', data6); | |
| 357 | + if (response !== null) { | |
| 358 | + this.resultData6 = response; | |
| 359 | + this.resultData6.link = decodeURIComponent(decodeURIComponent(this.resultData6.link)); | |
| 360 | + console.log('link: ', this.resultData6.link); | |
| 361 | + // tslint:disable-next-line:forin | |
| 362 | + for (const i in this.resultData6) { | |
| 363 | + this.resultData6[i].link = this._common.decodeURI(this.resultData6[i].link); | |
| 364 | + this.resultData6[i].birth_date = this._common.convertDate(this.resultData6[i].birth_date); | |
| 365 | + } | |
| 366 | + } else { | |
| 367 | + this.resultData6 = []; | |
| 368 | + } | |
| 369 | + } catch (error) { | |
| 370 | + console.log(error); | |
| 371 | + } | |
| 372 | + | |
| 373 | + setInterval(async() => { | |
| 374 | + await this.getData6(); | |
| 375 | + }, 600000); | |
| 376 | + | |
| 377 | + | |
| 378 | + //OnHold | |
| 379 | + try { | |
| 380 | + const dataOnHold6 = { | |
| 381 | + // tslint:disable-next-line:max-line-length | |
| 382 | + "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) = 'CUS (ตรวจสอบเครื่องลูกค้า)' AND LCASE(vtiger_troubletickets. STATUS) IN('Wait For Customer')) GROUP BY vtiger_troubletickets.ticketid ORDER BY vtiger_crmentity.createdtime ASC LIMIT 0 , 100", | |
| 383 | + "params": ["vtiger_crmentity"] | |
| 384 | + }; | |
| 385 | + let response = await this._apiService.post('dynamic', dataOnHold6); | |
| 386 | + if (response !== null) { | |
| 387 | + this.resultDataOnHold6 = response; | |
| 388 | + this.resultDataOnHold6.link = decodeURIComponent(decodeURIComponent(this.resultDataOnHold6.link)); | |
| 389 | + console.log('link: ', this.resultDataOnHold6.link); | |
| 390 | + // tslint:disable-next-line:forin | |
| 391 | + for (const i in this.resultDataOnHold6) { | |
| 392 | + this.resultDataOnHold6[i].link = this._common.decodeURI(this.resultDataOnHold6[i].link); | |
| 393 | + this.resultDataOnHold6[i].birth_date = this._common.convertDate(this.resultDataOnHold6[i].birth_date); | |
| 394 | + } | |
| 395 | + } else { | |
| 396 | + this.resultDataOnHold6 = []; | |
| 397 | + } | |
| 398 | + } catch (error) { | |
| 399 | + console.log(error); | |
| 400 | + } | |
| 401 | + | |
| 402 | + setInterval(async() => { | |
| 403 | + await this.getDataOnHold6(); | |
| 404 | + }, 600000); | |
| 350 | 405 | } |
| 351 | 406 | |
| 352 | 407 | /////////////Get data come to use////////////////////// |
| ... | ... | @@ -612,5 +667,54 @@ export class DashboardComponent implements OnInit { |
| 612 | 667 | } |
| 613 | 668 | |
| 614 | 669 | //----------------------------6------------------------ |
| 615 | - | |
| 670 | + // Active | |
| 671 | + async getData6() { | |
| 672 | + try { | |
| 673 | + const data6 = { | |
| 674 | + // tslint:disable-next-line:max-line-length | |
| 675 | + "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) = 'CUS (ตรวจสอบเครื่องลูกค้า)' 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", | |
| 676 | + "params": ["vtiger_crmentity"] | |
| 677 | + }; | |
| 678 | + let response = await this._apiService.post('dynamic', data6); | |
| 679 | + if (response !== null) { | |
| 680 | + this.resultData6 = response; | |
| 681 | + this.resultData6.link = decodeURIComponent(decodeURIComponent(this.resultData6.link)); | |
| 682 | + console.log('link: ', this.resultData6.link); | |
| 683 | + // tslint:disable-next-line:forin | |
| 684 | + for (const i in this.resultData6) { | |
| 685 | + this.resultData6[i].link = this._common.decodeURI(this.resultData6[i].link); | |
| 686 | + this.resultData6[i].birth_date = this._common.convertDate(this.resultData6[i].birth_date); | |
| 687 | + } | |
| 688 | + } else { | |
| 689 | + this.resultData6 = []; | |
| 690 | + } | |
| 691 | + } catch (error) { | |
| 692 | + console.log(error); | |
| 693 | + } | |
| 694 | +} | |
| 695 | +//On Hold | |
| 696 | +async getDataOnHold6() { | |
| 697 | + try { | |
| 698 | + const dataOnHold6 = { | |
| 699 | + // tslint:disable-next-line:max-line-length | |
| 700 | + "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) = 'CUS (ตรวจสอบเครื่องลูกค้า)' AND LCASE(vtiger_troubletickets. STATUS) IN('Wait For Customer')) GROUP BY vtiger_troubletickets.ticketid ORDER BY vtiger_crmentity.createdtime ASC LIMIT 0 , 100", | |
| 701 | + "params": ["vtiger_crmentity"] | |
| 702 | + }; | |
| 703 | + let response = await this._apiService.post('dynamic', dataOnHold6); | |
| 704 | + if (response !== null) { | |
| 705 | + this.resultDataOnHold6 = response; | |
| 706 | + this.resultDataOnHold6.link = decodeURIComponent(decodeURIComponent(this.resultDataOnHold6.link)); | |
| 707 | + console.log('link: ', this.resultDataOnHold6.link); | |
| 708 | + // tslint:disable-next-line:forin | |
| 709 | + for (const i in this.resultDataOnHold6) { | |
| 710 | + this.resultDataOnHold6[i].link = this._common.decodeURI(this.resultDataOnHold6[i].link); | |
| 711 | + this.resultDataOnHold6[i].birth_date = this._common.convertDate(this.resultDataOnHold6[i].birth_date); | |
| 712 | + } | |
| 713 | + } else { | |
| 714 | + this.resultDataOnHold6 = []; | |
| 715 | + } | |
| 716 | + } catch (error) { | |
| 717 | + console.log(error); | |
| 718 | + } | |
| 719 | +} | |
| 616 | 720 | } |
| 617 | 721 | \ No newline at end of file | ... | ... |