Merging Branch
This commit is contained in:
2
.env
2
.env
@@ -2,7 +2,7 @@ APP_ENV=local
|
|||||||
APP_DEBUG=true
|
APP_DEBUG=true
|
||||||
APP_KEY=SomeRandomString
|
APP_KEY=SomeRandomString
|
||||||
DB_HOST=localhost
|
DB_HOST=localhost
|
||||||
DB_DATABASE=testaaaa
|
DB_DATABASE=faveov5
|
||||||
DB_USERNAME=root
|
DB_USERNAME=root
|
||||||
DB_PASSWORD=
|
DB_PASSWORD=
|
||||||
CACHE_DRIVER=file
|
CACHE_DRIVER=file
|
||||||
|
@@ -59,51 +59,47 @@ class DashboardController extends Controller {
|
|||||||
* Fetching dashboard graph data to implement graph
|
* Fetching dashboard graph data to implement graph
|
||||||
* @return type Json
|
* @return type Json
|
||||||
*/
|
*/
|
||||||
public function ChartData()
|
public function ChartData($date111 = "",$date122 = "")
|
||||||
{
|
{
|
||||||
|
|
||||||
// $date11 = strtotime(\Input::get('start_date'));
|
$date11 = strtotime($date122);
|
||||||
// $date12 = strtotime(\Input::get('end_date'));
|
$date12 = strtotime($date111);
|
||||||
// if($date11 && $date12){
|
if($date11 && $date12){
|
||||||
// $date2 = $date12;
|
$date2 = $date12;
|
||||||
// $date1 = $date11;
|
$date1 = $date11;
|
||||||
// } else {
|
} else {
|
||||||
// generating current date
|
// generating current date
|
||||||
$date2 = strtotime(Date('Y-m-d'));
|
$date2 = strtotime(Date('Y-m-d'));
|
||||||
$date3 = Date('Y-m-d');
|
$date3 = Date('Y-m-d');
|
||||||
$format = 'Y-m-d';
|
$format = 'Y-m-d';
|
||||||
// generating a date range of 1 month
|
// generating a date range of 1 month
|
||||||
$date1 = strtotime(Date($format,strtotime('-1 month'. $date3)));
|
$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.']';
|
||||||
|
|
||||||
$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.']';
|
|
||||||
// $ticketlist = DB::table('tickets')
|
// $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'),
|
// ->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'))
|
// DB::raw('count(*) as totaltickets'))
|
||||||
// ->groupBy('month')
|
// ->groupBy('month')
|
||||||
// ->orderBy('month', 'asc')
|
// ->orderBy('month', 'asc')
|
||||||
// ->get();
|
// ->get();
|
||||||
|
|
||||||
// return $ticketlist;
|
// return $ticketlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'debug' => false,
|
'debug' => true,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@@ -112,7 +112,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'install' => '%0%',
|
'install' => '1',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@@ -26,17 +26,54 @@ class="active"
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
@if(Session::has('content'))
|
<form id="foo">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class='col-sm-3'>
|
||||||
|
|
||||||
|
{!! Form::label('date', 'Date:') !!}
|
||||||
|
|
||||||
|
{!! Form::text('start_date',null,['class'=>'form-control','id'=>'datepicker4'])!!}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function () {
|
||||||
|
$('#datepicker4').datetimepicker({
|
||||||
|
format: 'DD-MM-YYYY'
|
||||||
|
});
|
||||||
|
// $('#datepicker').datepicker()
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class='col-sm-3'>
|
||||||
|
|
||||||
|
{!! Form::label('start_time', 'End Date:') !!}
|
||||||
|
|
||||||
|
{!! Form::text('end_date',null,['class'=>'form-control','id'=>'datetimepicker3'])!!}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function () {
|
||||||
|
$('#datetimepicker3').datetimepicker({
|
||||||
|
format: 'DD-MM-YYYY'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class='col-sm-3'>
|
||||||
|
{!! Form::label('filter', 'Filter:') !!}<br>
|
||||||
|
<input type="submit" class="btn btn-primary">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div id="legendDiv"></div>
|
||||||
<div class="chart">
|
<div class="chart">
|
||||||
<div id="legendDiv1"></div>
|
|
||||||
<canvas class="chart-data" id="tickets-graph1" width="1000" height="400"></canvas>
|
<canvas class="chart-data" id="tickets-graph" width="1000" height="300"></canvas>
|
||||||
</div>
|
</div>
|
||||||
@else
|
|
||||||
<div class="chart">
|
|
||||||
<div id="legendDiv"></div>
|
|
||||||
<canvas class="chart-data" id="tickets-graph" width="1000" height="400"></canvas>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div><!-- /.box-body -->
|
</div><!-- /.box-body -->
|
||||||
</div><!-- /.box -->
|
</div><!-- /.box -->
|
||||||
<hr/>
|
<hr/>
|
||||||
@@ -81,8 +118,8 @@ $delete = App\Model\helpdesk\Ticket\Tickets::where('dept_id','=',$department->id
|
|||||||
|
|
||||||
<script src="{{asset("lb-faveo/plugins/chartjs/Chart.min.js")}}" type="text/javascript"></script>
|
<script src="{{asset("lb-faveo/plugins/chartjs/Chart.min.js")}}" type="text/javascript"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(document).ready(function() {
|
||||||
$.getJSON("agen", function (result) {
|
$.getJSON("agen", function (result) {
|
||||||
|
|
||||||
var labels=[], open=[], closed=[], reopened=[];
|
var labels=[], open=[], closed=[], reopened=[];
|
||||||
//,data2=[],data3=[],data4=[];
|
//,data2=[],data3=[],data4=[];
|
||||||
@@ -175,7 +212,7 @@ $delete = App\Model\helpdesk\Ticket\Tickets::where('dept_id','=',$department->id
|
|||||||
//Number - Pixel width of dataset stroke
|
//Number - Pixel width of dataset stroke
|
||||||
datasetStrokeWidth: 1,
|
datasetStrokeWidth: 1,
|
||||||
//Boolean - Whether to fill the dataset with a color
|
//Boolean - Whether to fill the dataset with a color
|
||||||
datasetFill: true,
|
datasetFill: false,
|
||||||
//String - A legend template
|
//String - A legend template
|
||||||
//Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
|
//Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
@@ -193,8 +230,197 @@ $delete = App\Model\helpdesk\Ticket\Tickets::where('dept_id','=',$department->id
|
|||||||
});
|
});
|
||||||
document.getElementById("legendDiv").innerHTML = myLineChart.generateLegend();
|
document.getElementById("legendDiv").innerHTML = myLineChart.generateLegend();
|
||||||
});
|
});
|
||||||
|
$('#click me').click(function() {
|
||||||
|
$('#foo').submit();
|
||||||
|
});
|
||||||
|
$('#foo').submit(function(event) {
|
||||||
|
|
||||||
|
// get the form data
|
||||||
|
// there are many ways to get this data using jQuery (you can use the class or id also)
|
||||||
|
var formData = $('#datepicker4').val();
|
||||||
|
var dateData = $('#datetimepicker3').val();
|
||||||
|
//$('#foo').serialize();
|
||||||
|
// process the form
|
||||||
|
$.ajax({
|
||||||
|
type : 'POST', // define the type of HTTP verb we want to use (POST for our form)
|
||||||
|
url : 'chart-range/'+dateData+'/'+formData, // the url where we want to POST
|
||||||
|
data : formData, // our data object
|
||||||
|
dataType : 'json', // what type of data do we expect back from the server
|
||||||
|
|
||||||
|
success : function(result2) {
|
||||||
|
|
||||||
|
// $.getJSON("agen", function (result) {
|
||||||
|
var labels=[], open=[], closed=[], reopened=[];
|
||||||
|
//,data2=[],data3=[],data4=[];
|
||||||
|
for (var i = 0; i < result2.length; i++) {
|
||||||
|
|
||||||
|
|
||||||
|
// $var12 = result[i].day;
|
||||||
|
|
||||||
|
// labels.push($var12);
|
||||||
|
labels.push(result2[i].date);
|
||||||
|
open.push(result2[i].open);
|
||||||
|
closed.push(result2[i].closed);
|
||||||
|
reopened.push(result2[i].reopened);
|
||||||
|
// data4.push(result[i].open);
|
||||||
|
}
|
||||||
|
|
||||||
|
var buyerData = {
|
||||||
|
labels : labels,
|
||||||
|
datasets : [
|
||||||
|
{
|
||||||
|
label : "Total Tickets" ,
|
||||||
|
fillColor : "rgba(240, 127, 110, 0.3)",
|
||||||
|
strokeColor : "#f56954",
|
||||||
|
pointColor : "#A62121",
|
||||||
|
pointStrokeColor : "#E60073",
|
||||||
|
pointHighlightFill : "#FF4DC3",
|
||||||
|
pointHighlightStroke : "rgba(151,187,205,1)",
|
||||||
|
data : open
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
label : "Open Tickets" ,
|
||||||
|
fillColor : "rgba(255, 102, 204, 0.4)",
|
||||||
|
strokeColor : "#f56954",
|
||||||
|
pointColor : "#FF66CC",
|
||||||
|
pointStrokeColor : "#fff",
|
||||||
|
pointHighlightFill : "#FF4DC3",
|
||||||
|
pointHighlightStroke : "rgba(151,187,205,1)",
|
||||||
|
data : closed
|
||||||
|
|
||||||
|
}
|
||||||
|
,{
|
||||||
|
label : "Closed Tickets",
|
||||||
|
fillColor : "rgba(151,187,205,0.2)",
|
||||||
|
strokeColor : "rgba(151,187,205,1)",
|
||||||
|
pointColor : "rgba(151,187,205,1)",
|
||||||
|
pointStrokeColor : "#0000CC",
|
||||||
|
pointHighlightFill : "#0000E6",
|
||||||
|
pointHighlightStroke : "rgba(151,187,205,1)",
|
||||||
|
data : reopened
|
||||||
|
}
|
||||||
|
// ,{
|
||||||
|
// label : "Reopened Tickets",
|
||||||
|
// fillColor : "rgba(102,255,51,0.2)",
|
||||||
|
// strokeColor : "rgba(151,187,205,1)",
|
||||||
|
// pointColor : "rgba(46,184,0,1)",
|
||||||
|
// pointStrokeColor : "#fff",
|
||||||
|
// pointHighlightFill : "#fff",
|
||||||
|
// pointHighlightStroke : "rgba(151,187,205,1)",
|
||||||
|
// data : data3
|
||||||
|
// }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
var myLineChart = new Chart(document.getElementById("tickets-graph").getContext("2d")).Line(buyerData, {
|
||||||
|
showScale: true,
|
||||||
|
//Boolean - Whether grid lines are shown across the chart
|
||||||
|
scaleShowGridLines: false,
|
||||||
|
//String - Colour of the grid lines
|
||||||
|
scaleGridLineColor: "rgba(0,0,0,.05)",
|
||||||
|
//Number - Width of the grid lines
|
||||||
|
scaleGridLineWidth: 1,
|
||||||
|
//Boolean - Whether to show horizontal lines (except X axis)
|
||||||
|
scaleShowHorizontalLines: true,
|
||||||
|
//Boolean - Whether to show vertical lines (except Y axis)
|
||||||
|
scaleShowVerticalLines: true,
|
||||||
|
//Boolean - Whether the line is curved between points
|
||||||
|
bezierCurve: true,
|
||||||
|
//Number - Tension of the bezier curve between points
|
||||||
|
bezierCurveTension: 0.3,
|
||||||
|
//Boolean - Whether to show a dot for each point
|
||||||
|
pointDot: true,
|
||||||
|
//Number - Radius of each point dot in pixels
|
||||||
|
pointDotRadius: 4,
|
||||||
|
//Number - Pixel width of point dot stroke
|
||||||
|
pointDotStrokeWidth: 1,
|
||||||
|
//Number - amount extra to add to the radius to cater for hit detection outside the drawn point
|
||||||
|
pointHitDetectionRadius: 20,
|
||||||
|
//Boolean - Whether to show a stroke for datasets
|
||||||
|
datasetStroke: true,
|
||||||
|
//Number - Pixel width of dataset stroke
|
||||||
|
datasetStrokeWidth: 1,
|
||||||
|
//Boolean - Whether to fill the dataset with a color
|
||||||
|
datasetFill: false,
|
||||||
|
//String - A legend template
|
||||||
|
//Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
|
||||||
|
maintainAspectRatio: false,
|
||||||
|
//Boolean - whether to make the chart responsive to window resizing
|
||||||
|
responsive: true,
|
||||||
|
|
||||||
|
legendTemplate : '<ul style="list-style-type: square;">'
|
||||||
|
+'<% for (var i=0; i<datasets.length; i++) { %>'
|
||||||
|
+'<li style="color: <%=datasets[i].pointColor%>;">'
|
||||||
|
+'<span style=\"background-color:<%=datasets[i].pointColor%>\"></span>'
|
||||||
|
+'<% if (datasets[i].label) { %><%= datasets[i].label %><% } %>'
|
||||||
|
+'</li>'
|
||||||
|
+'<% } %>'
|
||||||
|
+'</ul>'
|
||||||
|
});
|
||||||
|
myLineChart.options.responsive = false;
|
||||||
|
$("#tickets-graph").remove();
|
||||||
|
$(".chart").html("<canvas id='tickets-graph' width='1000' height='300'></canvas>");
|
||||||
|
var myLineChart1 = new Chart(document.getElementById("tickets-graph").getContext("2d")).Line(buyerData, {
|
||||||
|
showScale: true,
|
||||||
|
//Boolean - Whether grid lines are shown across the chart
|
||||||
|
scaleShowGridLines: false,
|
||||||
|
//String - Colour of the grid lines
|
||||||
|
scaleGridLineColor: "rgba(0,0,0,.05)",
|
||||||
|
//Number - Width of the grid lines
|
||||||
|
scaleGridLineWidth: 1,
|
||||||
|
//Boolean - Whether to show horizontal lines (except X axis)
|
||||||
|
scaleShowHorizontalLines: true,
|
||||||
|
//Boolean - Whether to show vertical lines (except Y axis)
|
||||||
|
scaleShowVerticalLines: true,
|
||||||
|
//Boolean - Whether the line is curved between points
|
||||||
|
bezierCurve: true,
|
||||||
|
//Number - Tension of the bezier curve between points
|
||||||
|
bezierCurveTension: 0.3,
|
||||||
|
//Boolean - Whether to show a dot for each point
|
||||||
|
pointDot: true,
|
||||||
|
//Number - Radius of each point dot in pixels
|
||||||
|
pointDotRadius: 4,
|
||||||
|
//Number - Pixel width of point dot stroke
|
||||||
|
pointDotStrokeWidth: 1,
|
||||||
|
//Number - amount extra to add to the radius to cater for hit detection outside the drawn point
|
||||||
|
pointHitDetectionRadius: 20,
|
||||||
|
//Boolean - Whether to show a stroke for datasets
|
||||||
|
datasetStroke: true,
|
||||||
|
//Number - Pixel width of dataset stroke
|
||||||
|
datasetStrokeWidth: 1,
|
||||||
|
//Boolean - Whether to fill the dataset with a color
|
||||||
|
datasetFill: false,
|
||||||
|
//String - A legend template
|
||||||
|
//Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
|
||||||
|
maintainAspectRatio: false,
|
||||||
|
//Boolean - whether to make the chart responsive to window resizing
|
||||||
|
responsive: true,
|
||||||
|
|
||||||
|
legendTemplate : '<ul style="list-style-type: square;">'
|
||||||
|
+'<% for (var i=0; i<datasets.length; i++) { %>'
|
||||||
|
+'<li style="color: <%=datasets[i].pointColor%>;">'
|
||||||
|
+'<span style=\"background-color:<%=datasets[i].pointColor%>\"></span>'
|
||||||
|
+'<% if (datasets[i].label) { %><%= datasets[i].label %><% } %>'
|
||||||
|
+'</li>'
|
||||||
|
+'<% } %>'
|
||||||
|
+'</ul>'
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById("legendDiv").innerHTML = myLineChart1.generateLegend();
|
||||||
|
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// using the done promise callback
|
||||||
|
|
||||||
|
// stop the form from submitting the normal way and refreshing the page
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
Reference in New Issue
Block a user