Commit 81eadae46d2d31387037a5f5df044d8ae12eb17f
1 parent
8d9696c2
Exists in
master
3-4 active ไม่ขึ้น ขึ้นแค่ onhold
Showing
2 changed files
with
161 additions
and
51 deletions
Show diff stats
src/app/dashboard/dashboard.component.html
@@ -362,7 +362,7 @@ | @@ -362,7 +362,7 @@ | ||
362 | </div> | 362 | </div> |
363 | <div class="panel-body"> | 363 | <div class="panel-body"> |
364 | <div class="row"> | 364 | <div class="row"> |
365 | - <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultData | filter:FilterSearch: '' "> | 365 | + <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultData4 | filter:FilterSearch: '' "> |
366 | <a class="dashboard-stat dashboard-stat-v2 red " | 366 | <a class="dashboard-stat dashboard-stat-v2 red " |
367 | href="{{item.link}}" | 367 | href="{{item.link}}" |
368 | target="_blank" | 368 | target="_blank" |
@@ -416,7 +416,7 @@ | @@ -416,7 +416,7 @@ | ||
416 | </div> | 416 | </div> |
417 | <div class="panel-body"> | 417 | <div class="panel-body"> |
418 | <div class="row"> | 418 | <div class="row"> |
419 | - <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultDataOnHold | filter:FilterSearchOnHold: '' "> | 419 | + <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12" *ngFor="let item of resultDataOnHold4 | filter:FilterSearchOnHold: '' "> |
420 | <a class="dashboard-stat dashboard-stat-v2 red " | 420 | <a class="dashboard-stat dashboard-stat-v2 red " |
421 | href="{{item.link}}" | 421 | href="{{item.link}}" |
422 | target="_blank" | 422 | target="_blank" |
src/app/dashboard/dashboard.component.ts
@@ -172,35 +172,36 @@ export class DashboardComponent implements OnInit { | @@ -172,35 +172,36 @@ export class DashboardComponent implements OnInit { | ||
172 | 172 | ||
173 | setInterval(async() => { | 173 | setInterval(async() => { |
174 | await this.getDataOnHold2(); | 174 | await this.getDataOnHold2(); |
175 | + | ||
175 | }, 600000); | 176 | }, 600000); |
176 | //----------------------------3------------------------ | 177 | //----------------------------3------------------------ |
177 | // Active | 178 | // Active |
178 | - try { | ||
179 | - const data3 = { | ||
180 | - // tslint:disable-next-line:max-line-length | ||
181 | - "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", | ||
182 | - "params": ["vtiger_crmentity"] | ||
183 | - }; | ||
184 | - let response = await this._apiService.post('dynamic', data3); | ||
185 | - if (response !== null) { | ||
186 | - this.resultData3 = response; | ||
187 | - this.resultData3.link = decodeURIComponent(decodeURIComponent(this.resultData3.link)); | ||
188 | - console.log('link: ', this.resultData3.link); | ||
189 | - // tslint:disable-next-line:forin | ||
190 | - for (const i in this.resultData3) { | ||
191 | - this.resultData3[i].link = this._common.decodeURI(this.resultData3[i].link); | ||
192 | - this.resultData3[i].birth_date = this._common.convertDate(this.resultData3[i].birth_date); | ||
193 | - } | ||
194 | - } else { | ||
195 | - this.resultData3 = []; | ||
196 | - } | ||
197 | - } catch (error) { | ||
198 | - console.log(error); | ||
199 | - } | 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 | + // } | ||
200 | 201 | ||
201 | - setInterval(async() => { | ||
202 | - await this.getData3(); | ||
203 | - }, 600000); | 202 | + // setInterval(async() => { |
203 | + // await this.getData3(); | ||
204 | + // }, 600000); | ||
204 | 205 | ||
205 | 206 | ||
206 | //OnHold | 207 | //OnHold |
@@ -230,7 +231,64 @@ export class DashboardComponent implements OnInit { | @@ -230,7 +231,64 @@ export class DashboardComponent implements OnInit { | ||
230 | setInterval(async() => { | 231 | setInterval(async() => { |
231 | await this.getDataOnHold3(); | 232 | await this.getDataOnHold3(); |
232 | }, 600000); | 233 | }, 600000); |
234 | + | ||
233 | //----------------------------4------------------------ | 235 | //----------------------------4------------------------ |
236 | + try { | ||
237 | + const data4 = { | ||
238 | + // tslint:disable-next-line:max-line-length | ||
239 | + "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 ('ADE (AP Down มีปัญหาบ่อย)','APD (อุปกรณ์กระจายสัญญาณขัดข้อง)') 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", | ||
240 | + "params": ["vtiger_crmentity"] | ||
241 | + }; | ||
242 | + let response = await this._apiService.post('dynamic', data4); | ||
243 | + if (response !== null) { | ||
244 | + this.resultData4 = response; | ||
245 | + this.resultData4.link = decodeURIComponent(decodeURIComponent(this.resultData4.link)); | ||
246 | + console.log('link: ', this.resultData4.link); | ||
247 | + // tslint:disable-next-line:forin | ||
248 | + for (const i in this.resultData4) { | ||
249 | + this.resultData4[i].link = this._common.decodeURI(this.resultData4[i].link); | ||
250 | + this.resultData4[i].birth_date = this._common.convertDate(this.resultData4[i].birth_date); | ||
251 | + } | ||
252 | + } else { | ||
253 | + this.resultData4 = []; | ||
254 | + } | ||
255 | + } catch (error) { | ||
256 | + console.log(error); | ||
257 | + } | ||
258 | + | ||
259 | + setInterval(async() => { | ||
260 | + await this.getData4(); | ||
261 | + }, 600000); | ||
262 | + | ||
263 | + | ||
264 | + //OnHold | ||
265 | + try { | ||
266 | + const dataOnHold4 = { | ||
267 | + // tslint:disable-next-line:max-line-length | ||
268 | + "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 ('ADE (AP Down มีปัญหาบ่อย)','APD (อุปกรณ์กระจายสัญญาณขัดข้อง)') AND LCASE(vtiger_troubletickets. STATUS) IN('Wait For Customer')) GROUP BY vtiger_troubletickets.ticketid ORDER BY vtiger_crmentity.createdtime ASC LIMIT 0 , 100", | ||
269 | + "params": ["vtiger_crmentity"] | ||
270 | + }; | ||
271 | + let response = await this._apiService.post('dynamic', dataOnHold4); | ||
272 | + if (response !== null) { | ||
273 | + this.resultDataOnHold4 = response; | ||
274 | + this.resultDataOnHold4.link = decodeURIComponent(decodeURIComponent(this.resultDataOnHold4.link)); | ||
275 | + console.log('link: ', this.resultDataOnHold4.link); | ||
276 | + // tslint:disable-next-line:forin | ||
277 | + for (const i in this.resultDataOnHold4) { | ||
278 | + this.resultDataOnHold4[i].link = this._common.decodeURI(this.resultDataOnHold4[i].link); | ||
279 | + this.resultDataOnHold4[i].birth_date = this._common.convertDate(this.resultDataOnHold4[i].birth_date); | ||
280 | + } | ||
281 | + } else { | ||
282 | + this.resultDataOnHold4 = []; | ||
283 | + } | ||
284 | + } catch (error) { | ||
285 | + console.log(error); | ||
286 | + } | ||
287 | + | ||
288 | + setInterval(async() => { | ||
289 | + await this.getDataOnHold4(); | ||
290 | + | ||
291 | + }, 600000); | ||
234 | //----------------------------5------------------------ | 292 | //----------------------------5------------------------ |
235 | //----------------------------6------------------------ | 293 | //----------------------------6------------------------ |
236 | } | 294 | } |
@@ -343,30 +401,31 @@ export class DashboardComponent implements OnInit { | @@ -343,30 +401,31 @@ export class DashboardComponent implements OnInit { | ||
343 | } | 401 | } |
344 | //----------------------------3------------------------ | 402 | //----------------------------3------------------------ |
345 | // Active | 403 | // Active |
346 | - async getData3() { | ||
347 | - try { | ||
348 | - const data3 = { | ||
349 | - // tslint:disable-next-line:max-line-length | ||
350 | - "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", | ||
351 | - "params": ["vtiger_crmentity"] | ||
352 | - }; | ||
353 | - let response = await this._apiService.post('dynamic', data3); | ||
354 | - if (response !== null) { | ||
355 | - this.resultData3 = response; | ||
356 | - this.resultData3.link = decodeURIComponent(decodeURIComponent(this.resultData3.link)); | ||
357 | - console.log('link: ', this.resultData3.link); | ||
358 | - // tslint:disable-next-line:forin | ||
359 | - for (const i in this.resultData3) { | ||
360 | - this.resultData3[i].link = this._common.decodeURI(this.resultData3[i].link); | ||
361 | - this.resultData3[i].birth_date = this._common.convertDate(this.resultData3[i].birth_date); | ||
362 | - } | ||
363 | - } else { | ||
364 | - this.resultData3 = []; | ||
365 | - } | ||
366 | - } catch (error) { | ||
367 | - console.log(error); | ||
368 | - } | ||
369 | - } | 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 | + // } | ||
428 | + | ||
370 | //On Hold | 429 | //On Hold |
371 | async getDataOnHold3() { | 430 | async getDataOnHold3() { |
372 | try { | 431 | try { |
@@ -392,7 +451,58 @@ export class DashboardComponent implements OnInit { | @@ -392,7 +451,58 @@ export class DashboardComponent implements OnInit { | ||
392 | console.log(error); | 451 | console.log(error); |
393 | } | 452 | } |
394 | } | 453 | } |
454 | + | ||
395 | //----------------------------4------------------------ | 455 | //----------------------------4------------------------ |
456 | + // Active | ||
457 | + async getData4() { | ||
458 | + try { | ||
459 | + const data4 = { | ||
460 | + // tslint:disable-next-line:max-line-length | ||
461 | + "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 ('ADE (AP Down มีปัญหาบ่อย)','APD (อุปกรณ์กระจายสัญญาณขัดข้อง)') 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", | ||
462 | + "params": ["vtiger_crmentity"] | ||
463 | + }; | ||
464 | + let response = await this._apiService.post('dynamic', data4); | ||
465 | + if (response !== null) { | ||
466 | + this.resultData4 = response; | ||
467 | + this.resultData4.link = decodeURIComponent(decodeURIComponent(this.resultData4.link)); | ||
468 | + console.log('link: ', this.resultData4.link); | ||
469 | + // tslint:disable-next-line:forin | ||
470 | + for (const i in this.resultData4) { | ||
471 | + this.resultData4[i].link = this._common.decodeURI(this.resultData4[i].link); | ||
472 | + this.resultData4[i].birth_date = this._common.convertDate(this.resultData4[i].birth_date); | ||
473 | + } | ||
474 | + } else { | ||
475 | + this.resultData4 = []; | ||
476 | + } | ||
477 | + } catch (error) { | ||
478 | + console.log(error); | ||
479 | + } | ||
480 | + } | ||
481 | + //On Hold | ||
482 | + async getDataOnHold4() { | ||
483 | + try { | ||
484 | + const dataOnHold4 = { | ||
485 | + // tslint:disable-next-line:max-line-length | ||
486 | + "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 ('ADE (AP Down มีปัญหาบ่อย)','APD (อุปกรณ์กระจายสัญญาณขัดข้อง)') AND LCASE(vtiger_troubletickets. STATUS) IN('Wait For Customer')) GROUP BY vtiger_troubletickets.ticketid ORDER BY vtiger_crmentity.createdtime ASC LIMIT 0 , 100", | ||
487 | + "params": ["vtiger_crmentity"] | ||
488 | + }; | ||
489 | + let response = await this._apiService.post('dynamic', dataOnHold4); | ||
490 | + if (response !== null) { | ||
491 | + this.resultDataOnHold4 = response; | ||
492 | + this.resultDataOnHold4.link = decodeURIComponent(decodeURIComponent(this.resultDataOnHold4.link)); | ||
493 | + console.log('link: ', this.resultDataOnHold4.link); | ||
494 | + // tslint:disable-next-line:forin | ||
495 | + for (const i in this.resultDataOnHold4) { | ||
496 | + this.resultDataOnHold4[i].link = this._common.decodeURI(this.resultDataOnHold4[i].link); | ||
497 | + this.resultDataOnHold4[i].birth_date = this._common.convertDate(this.resultDataOnHold4[i].birth_date); | ||
498 | + } | ||
499 | + } else { | ||
500 | + this.resultDataOnHold4 = []; | ||
501 | + } | ||
502 | + } catch (error) { | ||
503 | + console.log(error); | ||
504 | + } | ||
505 | + } | ||
396 | //----------------------------5------------------------ | 506 | //----------------------------5------------------------ |
397 | //----------------------------6------------------------ | 507 | //----------------------------6------------------------ |
398 | 508 |