From a302235274b9a682cf4e764f62f90be5679f6116 Mon Sep 17 00:00:00 2001 From: Sada Shiva Date: Tue, 2 Feb 2016 18:37:19 +0530 Subject: [PATCH] Merging Branch --- .env | 2 +- .../Agent/helpdesk/DashboardController.php | 58 ++-- config/app.php | 2 +- config/database.php | 2 +- .../helpdesk/dashboard/dashboard.blade.php | 250 +++++++++++++++++- 5 files changed, 268 insertions(+), 46 deletions(-) diff --git a/.env b/.env index d17775abc..ca7085ebf 100644 --- a/.env +++ b/.env @@ -2,7 +2,7 @@ APP_ENV=local APP_DEBUG=true APP_KEY=SomeRandomString DB_HOST=localhost -DB_DATABASE=testaaaa +DB_DATABASE=faveov5 DB_USERNAME=root DB_PASSWORD= CACHE_DRIVER=file diff --git a/app/Http/Controllers/Agent/helpdesk/DashboardController.php b/app/Http/Controllers/Agent/helpdesk/DashboardController.php index 65b707a10..1225864d0 100644 --- a/app/Http/Controllers/Agent/helpdesk/DashboardController.php +++ b/app/Http/Controllers/Agent/helpdesk/DashboardController.php @@ -59,51 +59,47 @@ class DashboardController extends Controller { * Fetching dashboard graph data to implement graph * @return type Json */ - public function ChartData() + public function ChartData($date111 = "",$date122 = "") { - - // $date11 = strtotime(\Input::get('start_date')); - // $date12 = strtotime(\Input::get('end_date')); - // if($date11 && $date12){ - // $date2 = $date12; - // $date1 = $date11; - // } else { + + $date11 = strtotime($date122); + $date12 = strtotime($date111); + if($date11 && $date12){ + $date2 = $date12; + $date1 = $date11; + } else { // generating current date $date2 = strtotime(Date('Y-m-d')); $date3 = Date('Y-m-d'); $format = 'Y-m-d'; // generating a date range of 1 month $date1 = strtotime(Date($format,strtotime('-1 month'. $date3))); - // } + } + $return = ""; + $last = ""; + for ( $i = $date1; $i <= $date2; $i = $i + 86400 ) { + $thisDate = date( 'Y-m-d', $i ); + + $created = \DB::table('tickets')->select('created_at')->where('created_at','LIKE','%'.$thisDate.'%')->count(); + $closed = \DB::table('tickets')->select('closed_at')->where('closed_at','LIKE','%'.$thisDate.'%')->count(); + $reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at','LIKE','%'.$thisDate.'%')->count(); + + $value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened]; + $array = array_map('htmlentities',$value); + $json = html_entity_decode(json_encode($array)); + $return .= $json.','; + } + $last = rtrim($return,','); - $return = ""; - $last = ""; - // fetching dashboard data for each day on a 1 month fixed range - // this range can also be fetched on a requested rannge of date - for ( $i = $date1; $i <= $date2; $i = $i + 86400 ) { - $thisDate = date( 'Y-m-d', $i ); - // created tickets - $created = \DB::table('tickets')->select('created_at')->where('created_at','LIKE','%'.$thisDate.'%')->count(); - // closed tickets - $closed = \DB::table('tickets')->select('closed_at')->where('closed_at','LIKE','%'.$thisDate.'%')->count(); - // reopened tickets - $reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at','LIKE','%'.$thisDate.'%')->count(); - // storing in array format - $value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened]; - $array = array_map('htmlentities',$value); - // encoding the values in jsom format - $json = html_entity_decode(json_encode($array)); - $return .= $json.','; - } - // combining all the values in a single variable and returning that variable in Json. - $last = rtrim($return,','); - return '['.$last.']'; + return '['.$last.']'; + // $ticketlist = DB::table('tickets') // ->select(DB::raw('MONTH(updated_at) as month'),DB::raw('SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) as closed'),DB::raw('SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as reopened'),DB::raw('SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) as open'),DB::raw('SUM(CASE WHEN status = 5 THEN 1 ELSE 0 END) as deleted'), // DB::raw('count(*) as totaltickets')) // ->groupBy('month') // ->orderBy('month', 'asc') // ->get(); + // return $ticketlist; } diff --git a/config/app.php b/config/app.php index 37ae8256e..26330eb5b 100644 --- a/config/app.php +++ b/config/app.php @@ -13,7 +13,7 @@ return [ | */ - 'debug' => false, + 'debug' => true, /* |-------------------------------------------------------------------------- diff --git a/config/database.php b/config/database.php index 37b3424ac..2f57acb84 100644 --- a/config/database.php +++ b/config/database.php @@ -112,7 +112,7 @@ return [ | */ - 'install' => '%0%', + 'install' => '1', /* |-------------------------------------------------------------------------- diff --git a/resources/views/themes/default1/agent/helpdesk/dashboard/dashboard.blade.php b/resources/views/themes/default1/agent/helpdesk/dashboard/dashboard.blade.php index 8b81d4675..5a22bf9ce 100644 --- a/resources/views/themes/default1/agent/helpdesk/dashboard/dashboard.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/dashboard/dashboard.blade.php @@ -26,17 +26,54 @@ class="active"
- @if(Session::has('content')) +
+
+
+ +
+ + {!! Form::label('date', 'Date:') !!} + + {!! Form::text('start_date',null,['class'=>'form-control','id'=>'datepicker4'])!!} + +
+ + +
+ + {!! Form::label('start_time', 'End Date:') !!} + + {!! Form::text('end_date',null,['class'=>'form-control','id'=>'datetimepicker3'])!!} + +
+ + +
+ {!! Form::label('filter', 'Filter:') !!}
+ +
+
+
+
+
-
- + +
- @else -
-
- -
- @endif +

@@ -81,8 +118,8 @@ $delete = App\Model\helpdesk\Ticket\Tickets::where('dept_id','=',$department->id