Apply fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
857d3004eb
commit
88f3df2180
@@ -6,9 +6,9 @@ namespace App\Http\Controllers\Agent\helpdesk;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
// request
|
||||
use Illuminate\Http\Request;
|
||||
// Model
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
// Model
|
||||
use Illuminate\Http\Request;
|
||||
// classes
|
||||
use PDF;
|
||||
|
||||
@@ -18,8 +18,8 @@ use PDF;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ReportController extends Controller {
|
||||
|
||||
class ReportController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
@@ -29,7 +29,8 @@ class ReportController extends Controller {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking for authentication
|
||||
$this->middleware('auth');
|
||||
// checking if the role is agent
|
||||
@@ -38,23 +39,26 @@ class ReportController extends Controller {
|
||||
|
||||
/**
|
||||
* Get the Report page.
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
return view('themes.default1.agent.helpdesk.report.index');
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function to get help_topic graph
|
||||
* function to get help_topic graph.
|
||||
*
|
||||
* @param type $date111
|
||||
* @param type $date122
|
||||
* @param type $helptopic
|
||||
*/
|
||||
public function chartdataHelptopic(Request $request, $date111 = '', $date122 = '', $helptopic = '') {
|
||||
public function chartdataHelptopic(Request $request, $date111 = '', $date122 = '', $helptopic = '')
|
||||
{
|
||||
$date11 = strtotime($date122);
|
||||
$date12 = strtotime($date111);
|
||||
$help_topic = $helptopic;
|
||||
@@ -73,25 +77,24 @@ class ReportController extends Controller {
|
||||
$format = 'Y-m-d';
|
||||
// generating a date range of 1 month
|
||||
if ($request->input('duration') == 'day') {
|
||||
$date1 = strtotime(date($format, strtotime('-15 day' . $date3)));
|
||||
$date1 = strtotime(date($format, strtotime('-15 day'.$date3)));
|
||||
} elseif ($request->input('duration') == 'week') {
|
||||
$date1 = strtotime(date($format, strtotime('-69 days' . $date3)));
|
||||
$date1 = strtotime(date($format, strtotime('-69 days'.$date3)));
|
||||
} elseif ($request->input('duration') == 'month') {
|
||||
$date1 = strtotime(date($format, strtotime('-179 days' . $date3)));
|
||||
$date1 = strtotime(date($format, strtotime('-179 days'.$date3)));
|
||||
} else {
|
||||
$date1 = strtotime(date($format, strtotime('-30 days' . $date3)));
|
||||
$date1 = strtotime(date($format, strtotime('-30 days'.$date3)));
|
||||
}
|
||||
// $help_topic = Help_topic::where('status', '=', '1')->min('id');
|
||||
}
|
||||
|
||||
|
||||
$return = '';
|
||||
$last = '';
|
||||
$j = 0;
|
||||
$created1 = '';
|
||||
$closed1 = '';
|
||||
$reopened1 = '';
|
||||
$in_progress = \DB::table('tickets')->where('help_topic_id', '=', $help_topic)->where('status','=',1)->count();
|
||||
$in_progress = \DB::table('tickets')->where('help_topic_id', '=', $help_topic)->where('status', '=', 1)->count();
|
||||
|
||||
for ($i = $date1; $i <= $date2; $i = $i + 86400) {
|
||||
$j++;
|
||||
@@ -103,15 +106,15 @@ class ReportController extends Controller {
|
||||
|
||||
if ($request->input('open') || $request->input('closed') || $request->input('reopened')) {
|
||||
if ($request->input('open') && $request->input('open') == 'on') {
|
||||
$created = \DB::table('tickets')->select('created_at')->where('help_topic_id', '=', $help_topic)->where('created_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$created = \DB::table('tickets')->select('created_at')->where('help_topic_id', '=', $help_topic)->where('created_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$open_array = ['open' => $created];
|
||||
}
|
||||
if ($request->input('closed') && $request->input('closed') == 'on') {
|
||||
$closed = \DB::table('tickets')->select('closed_at')->where('help_topic_id', '=', $help_topic)->where('closed_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$closed = \DB::table('tickets')->select('closed_at')->where('help_topic_id', '=', $help_topic)->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$closed_array = ['closed' => $closed];
|
||||
}
|
||||
if ($request->input('reopened') && $request->input('reopened') == 'on') {
|
||||
$reopened = \DB::table('tickets')->select('reopened_at')->where('help_topic_id', '=', $help_topic)->where('reopened_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$reopened = \DB::table('tickets')->select('reopened_at')->where('help_topic_id', '=', $help_topic)->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$reopened_array = ['reopened' => $reopened];
|
||||
}
|
||||
// if ($request->input('overdue') && $request->input('overdue') == 'on') {
|
||||
@@ -131,14 +134,14 @@ class ReportController extends Controller {
|
||||
// }
|
||||
$array = array_map('htmlentities', $value);
|
||||
$json = html_entity_decode(json_encode($array));
|
||||
$return .= $json . ',';
|
||||
$return .= $json.',';
|
||||
} else {
|
||||
if ($duration == 'week') {
|
||||
$created = \DB::table('tickets')->select('created_at')->where('help_topic_id', '=', $help_topic)->where('created_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$created = \DB::table('tickets')->select('created_at')->where('help_topic_id', '=', $help_topic)->where('created_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$created1 += $created;
|
||||
$closed = \DB::table('tickets')->select('closed_at')->where('help_topic_id', '=', $help_topic)->where('closed_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$closed = \DB::table('tickets')->select('closed_at')->where('help_topic_id', '=', $help_topic)->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$closed1 += $closed;
|
||||
$reopened = \DB::table('tickets')->select('reopened_at')->where('help_topic_id', '=', $help_topic)->where('reopened_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$reopened = \DB::table('tickets')->select('reopened_at')->where('help_topic_id', '=', $help_topic)->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$reopened1 += $reopened;
|
||||
if ($j % 7 == 0) {
|
||||
$open_array = ['open' => $created1];
|
||||
@@ -158,14 +161,14 @@ class ReportController extends Controller {
|
||||
// }
|
||||
$array = array_map('htmlentities', $value);
|
||||
$json = html_entity_decode(json_encode($array));
|
||||
$return .= $json . ',';
|
||||
$return .= $json.',';
|
||||
}
|
||||
} elseif ($duration == 'month') {
|
||||
$created_month = \DB::table('tickets')->select('created_at')->where('help_topic_id', '=', $help_topic)->where('created_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$created_month = \DB::table('tickets')->select('created_at')->where('help_topic_id', '=', $help_topic)->where('created_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$created1 += $created_month;
|
||||
$closed_month = \DB::table('tickets')->select('closed_at')->where('help_topic_id', '=', $help_topic)->where('closed_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$closed_month = \DB::table('tickets')->select('closed_at')->where('help_topic_id', '=', $help_topic)->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$closed1 += $closed_month;
|
||||
$reopened_month = \DB::table('tickets')->select('reopened_at')->where('help_topic_id', '=', $help_topic)->where('reopened_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$reopened_month = \DB::table('tickets')->select('reopened_at')->where('help_topic_id', '=', $help_topic)->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$reopened1 += $reopened_month;
|
||||
if ($j % 30 == 0) {
|
||||
$open_array = ['open' => $created1];
|
||||
@@ -183,17 +186,17 @@ class ReportController extends Controller {
|
||||
|
||||
$array = array_map('htmlentities', $value);
|
||||
$json = html_entity_decode(json_encode($array));
|
||||
$return .= $json . ',';
|
||||
$return .= $json.',';
|
||||
}
|
||||
} else {
|
||||
if ($request->input('default') == null) {
|
||||
$help_topic = Help_topic::where('status', '=', '1')->min('id');
|
||||
}
|
||||
$created = \DB::table('tickets')->select('created_at')->where('help_topic_id', '=', $help_topic)->where('created_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$created = \DB::table('tickets')->select('created_at')->where('help_topic_id', '=', $help_topic)->where('created_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$open_array = ['open' => $created];
|
||||
$closed = \DB::table('tickets')->select('closed_at')->where('help_topic_id', '=', $help_topic)->where('closed_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$closed = \DB::table('tickets')->select('closed_at')->where('help_topic_id', '=', $help_topic)->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$closed_array = ['closed' => $closed];
|
||||
$reopened = \DB::table('tickets')->select('reopened_at')->where('help_topic_id', '=', $help_topic)->where('reopened_at', 'LIKE', '%' . $thisDate . '%')->count();
|
||||
$reopened = \DB::table('tickets')->select('reopened_at')->where('help_topic_id', '=', $help_topic)->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count();
|
||||
$reopened_array = ['reopened' => $reopened];
|
||||
if ($j % 1 == 0) {
|
||||
$open_array = ['open' => $created];
|
||||
@@ -232,7 +235,7 @@ class ReportController extends Controller {
|
||||
// }
|
||||
$array = array_map('htmlentities', $value);
|
||||
$json = html_entity_decode(json_encode($array));
|
||||
$return .= $json . ',';
|
||||
$return .= $json.',';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,20 +250,19 @@ class ReportController extends Controller {
|
||||
// if($reopened_array) {
|
||||
// $value = array_merge($value,$reopened_array);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
$last = rtrim($return, ',');
|
||||
|
||||
return '[' . $last . ']';
|
||||
return '['.$last.']';
|
||||
}
|
||||
|
||||
public function helptopicPdf(Request $request){
|
||||
public function helptopicPdf(Request $request)
|
||||
{
|
||||
$table_datas = json_decode($request->input('pdf_form'));
|
||||
$table_help_topic = json_decode($request->input('pdf_form_help_topic'));
|
||||
$html = view('themes.default1.agent.helpdesk.report.pdf', compact('table_datas', 'table_help_topic'))->render();
|
||||
$html1 = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
|
||||
|
||||
return PDF::load($html1)->show();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user