From 3802620b1b1db47ceae459f1270d3de2c22f0e96 Mon Sep 17 00:00:00 2001 From: Manish Verma Date: Mon, 5 Dec 2016 10:47:06 +0530 Subject: [PATCH 1/6] Bug-fix-patch-1 # unverifeied user tickets issue(now showing tickets in inbox and concating exclaimation marks on user name if account not verified) --- .../Agent/helpdesk/TicketController.php | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php index 722f1495b..cbc8300be 100644 --- a/app/Http/Controllers/Agent/helpdesk/TicketController.php +++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php @@ -1124,23 +1124,28 @@ class TicketController extends Controller $ticket->source = $source; $ticket_status = $this->checkUserVerificationStatus(); //dd($ticket_status); - if ($ticket_status == 0) { - //check if user active then allow ticket creation else create unverified ticket - if ($user_status->active == 1) { - if ($status == null) { - $ticket->status = 1; - } else { - $ticket->status = $status; - } - } else { - $ticket->status = 6; - } + // if ($ticket_status == 0) { + // //check if user active then allow ticket creation else create unverified ticket + // if ($user_status->active == 1) { + // if ($status == null) { + // $ticket->status = 1; + // } else { + // $ticket->status = $status; + // } + // } else { + // $ticket->status = 6; + // } + // } else { + // if ($status == null) { + // $ticket->status = 1; + // } else { + // $ticket->status = $status; + // } + // } + if ($status == null) { + $ticket->status = 1; } else { - if ($status == null) { - $ticket->status = 1; - } else { - $ticket->status = $status; - } + $ticket->status = $status; } $ticket->save(); @@ -2537,7 +2542,8 @@ class TicketController extends Controller return $prio; }) ->addColumn('from', function ($ticket) { - $from = DB::table('users')->select('user_name', 'first_name', 'last_name')->where('id', '=', $ticket->user_id)->first(); + $verify = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first(); + $from = DB::table('users')->select('user_name', 'first_name', 'last_name', 'active')->where('id', '=', $ticket->user_id)->first(); $url = route('user.show', $ticket->user_id); $name = ''; if ($from) { @@ -2547,8 +2553,13 @@ class TicketController extends Controller $name = $from->user_name; } } - - return "user_name).'''.Lang::get('lang.see-profile2')."'>".ucfirst(str_limit($name, 30)).''; + $color = ""; + if($verify->status == 1 || $verify->status == '1') { + if($from->active == 0 || $from->active == '0') { + $color = ""; + } + } + return "user_name).'''.Lang::get('lang.see-profile2')."'>".ucfirst(str_limit($name, 30)).' '.$color.''; }) // ->addColumn('Last Replier', function ($ticket) { // $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->where('is_internal', '=', 0)->max('id'); From 77fa3fe32673c49349e03e5e660956585f260f0a Mon Sep 17 00:00:00 2001 From: Manish Verma Date: Mon, 5 Dec 2016 14:09:26 +0530 Subject: [PATCH 2/6] #update-patch # multiple assignment option in inbox --- .../Agent/helpdesk/TicketController.php | 105 +++++++++--------- .../Agent/helpdesk/UserController.php | 10 ++ app/Http/routes.php | 2 + resources/lang/en/lang.php | 2 +- .../agent/helpdesk/ticket/inbox.blade.php | 91 +++++++++++++++ 5 files changed, 158 insertions(+), 52 deletions(-) diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php index cbc8300be..8b5f6fe99 100644 --- a/app/Http/Controllers/Agent/helpdesk/TicketController.php +++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php @@ -1464,62 +1464,65 @@ class TicketController extends Controller */ public function assign($id) { + $ticket_array = []; + if(strpos($id, ',') !== false) { + $ticket_array = explode(',', $id); + } else { + array_push($ticket_array, $id); + } $UserEmail = Input::get('assign_to'); $assign_to = explode('_', $UserEmail); - $ticket = Tickets::where('id', '=', $id)->first(); + $user_detail = null; + foreach ($ticket_array as $id) { + $ticket = Tickets::where('id', '=', $id)->first(); + if ($assign_to[0] == 'team') { + $ticket->team_id = $assign_to[1]; + $team_detail = Teams::where('id', '=', $assign_to[1])->first(); + $assignee = $team_detail->name; + $ticket_number = $ticket->ticket_number; + $ticket->save(); + $ticket_thread = Ticket_Thread::where('ticket_id', '=', $id)->first(); + $ticket_subject = $ticket_thread->title; + $thread = new Ticket_Thread(); + $thread->ticket_id = $ticket->id; + $thread->user_id = Auth::user()->id; + $thread->is_internal = 1; + $thread->body = 'This Ticket has been assigned to '.$assignee; + $thread->save(); + } elseif ($assign_to[0] == 'user') { + $ticket->assigned_to = $assign_to[1]; + if( $user_detail === null) { + $user_detail = User::where('id', '=', $assign_to[1])->first(); + $assignee = $user_detail->first_name.' '.$user_detail->last_name; + } + $company = $this->company(); + $system = $this->system(); + $ticket_number = $ticket->ticket_number; + $ticket->save(); + $data = [ + 'id' => $id, + ]; + \Event::fire('ticket-assignment', [$data]); + $ticket_thread = Ticket_Thread::where('ticket_id', '=', $id)->first(); + $ticket_subject = $ticket_thread->title; + $thread = new Ticket_Thread(); + $thread->ticket_id = $ticket->id; + $thread->user_id = Auth::user()->id; + $thread->is_internal = 1; + $thread->body = 'This Ticket has been assigned to '.$assignee; + $thread->save(); - if ($assign_to[0] == 'team') { - $ticket->team_id = $assign_to[1]; - $team_detail = Teams::where('id', '=', $assign_to[1])->first(); - $assignee = $team_detail->name; - - $ticket_number = $ticket->ticket_number; - $ticket->save(); - - $ticket_thread = Ticket_Thread::where('ticket_id', '=', $id)->first(); - $ticket_subject = $ticket_thread->title; - - $thread = new Ticket_Thread(); - $thread->ticket_id = $ticket->id; - $thread->user_id = Auth::user()->id; - $thread->is_internal = 1; - $thread->body = 'This Ticket has been assigned to '.$assignee; - $thread->save(); - } elseif ($assign_to[0] == 'user') { - $ticket->assigned_to = $assign_to[1]; - $user_detail = User::where('id', '=', $assign_to[1])->first(); - $assignee = $user_detail->first_name.' '.$user_detail->last_name; - - $company = $this->company(); - $system = $this->system(); - - $ticket_number = $ticket->ticket_number; - $ticket->save(); - $data = [ - 'id' => $id, - ]; - \Event::fire('ticket-assignment', [$data]); - $ticket_thread = Ticket_Thread::where('ticket_id', '=', $id)->first(); - $ticket_subject = $ticket_thread->title; - - $thread = new Ticket_Thread(); - $thread->ticket_id = $ticket->id; - $thread->user_id = Auth::user()->id; - $thread->is_internal = 1; - $thread->body = 'This Ticket has been assigned to '.$assignee; - $thread->save(); - - $agent = $user_detail->first_name; - $agent_email = $user_detail->email; - $ticket_link = route('ticket.thread', $id); - $master = Auth::user()->first_name.' '.Auth::user()->last_name; - try { - $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master, 'ticket_link' => $ticket_link]); - } catch (\Exception $e) { - return 0; + $agent = $user_detail->first_name; + $agent_email = $user_detail->email; + $ticket_link = route('ticket.thread', $id); + $master = Auth::user()->first_name.' '.Auth::user()->last_name; + try { + $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticket->dept_id), $to = ['name' => $agent, 'email' => $agent_email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'assign-ticket'], $template_variables = ['ticket_agent_name' => $agent, 'ticket_number' => $ticket_number, 'ticket_assigner' => $master, 'ticket_link' => $ticket_link]); + } catch (\Exception $e) { + return 0; + } } } - return 1; } diff --git a/app/Http/Controllers/Agent/helpdesk/UserController.php b/app/Http/Controllers/Agent/helpdesk/UserController.php index 538842d04..c86b5dd61 100644 --- a/app/Http/Controllers/Agent/helpdesk/UserController.php +++ b/app/Http/Controllers/Agent/helpdesk/UserController.php @@ -1003,4 +1003,14 @@ class UserController extends Controller return $message; } } + + /** + */ + public function getAgentDetails() + { + $users = User::where('role', '<>', 'user')->where('active', '=', 1)->get(); + foreach ($users as $user) { + echo "'; + } + } } diff --git a/app/Http/routes.php b/app/Http/routes.php index 3071be0b7..865b50155 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -724,6 +724,8 @@ Route::group(['middleware' => ['web']], function () { // route to get the data on change Route::post('help-topic-report/{date1}/{date2}/{id}', ['as' => 'report.helptopic', 'uses' => 'Agent\helpdesk\ReportController@chartdataHelptopic']); /* To show dashboard pages */ Route::post('help-topic-pdf', ['as' => 'help.topic.pdf', 'uses' => 'Agent\helpdesk\ReportController@helptopicPdf']); + // Route to get details of agents + Route::post('get-agents', ['as' => 'get-agents', 'uses' => 'Agent\helpdesk\UserController@getAgentDetails']); }); /* diff --git a/resources/lang/en/lang.php b/resources/lang/en/lang.php index fe2f19a0a..12b6dccfc 100644 --- a/resources/lang/en/lang.php +++ b/resources/lang/en/lang.php @@ -1549,5 +1549,5 @@ return [ /*********** Updated 3-12-2016 **********/ 'activate' => 'Activate', 'system-email-not-configured' => 'We are unable to process email request as the system has no configured email for sending mails. Please contact and report system admin.', - + 'assign-ticket' => 'Assign tickets', ]; diff --git a/resources/views/themes/default1/agent/helpdesk/ticket/inbox.blade.php b/resources/views/themes/default1/agent/helpdesk/ticket/inbox.blade.php index 3c61dfcbd..1d7da33ce 100644 --- a/resources/views/themes/default1/agent/helpdesk/ticket/inbox.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/ticket/inbox.blade.php @@ -58,6 +58,7 @@ if (Auth::user()->role == 'agent') { {{--@endif--}} +

@@ -166,6 +167,42 @@ if (Auth::user()->role == 'agent') {
+ + + + - + + + + + + + + - + + + - + + + @@ -236,12 +236,10 @@ if (Auth::user()->role == 'agent') { //Uncheck all checkboxes $(".mailbox-messages input[type='checkbox']").iCheck("uncheck"); $(".fa", this).removeClass("fa-check-square-o").addClass('fa-square-o'); - $('#assign_Ticket').css('display', 'none'); } else { //Check all checkboxes $(".mailbox-messages input[type='checkbox']").iCheck("check"); $(".fa", this).removeClass("fa-square-o").addClass('fa-check-square-o'); - $('#assign_Ticket').css('display', 'inline'); } $(this).data("clicks", !clicks); }); @@ -260,11 +258,13 @@ if (Auth::user()->role == 'agent') { return $(this).val(); }).get(); // alert(checkboxValues); + showAssign(t_id); } else { //Check all checkboxes $("input[type='checkbox']", ".mailbox-messages").iCheck("check"); // alert('Hallo'); t_id = []; + showAssign(t_id); } $(this).data("clicks", !clicks); @@ -446,7 +446,6 @@ if (Auth::user()->role == 'agent') { }); $('#AssignTickets').on('show.bs.modal', function() { - alert(t_id); $.ajax({ type: "POST", url: "{{route('get-agents')}}", @@ -509,6 +508,11 @@ if (Auth::user()->role == 'agent') { t_id.splice(index, 1); // alert(t_id); } + showAssign(t_id); + } + + function showAssign(t_id) + { if (t_id.length >= 1) { $('#assign_Ticket').css('display', 'inline'); } else { diff --git a/resources/views/themes/default1/agent/helpdesk/ticket/myticket.blade.php b/resources/views/themes/default1/agent/helpdesk/ticket/myticket.blade.php index 91f21b467..e7582b092 100644 --- a/resources/views/themes/default1/agent/helpdesk/ticket/myticket.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/ticket/myticket.blade.php @@ -55,6 +55,7 @@ if (Auth::user()->role == 'agent') { +

@@ -164,6 +165,41 @@ if (Auth::user()->role == 'agent') {
+ + + @@ -221,12 +257,14 @@ if (Auth::user()->role == 'agent') { t_id = $('.selectval').map(function() { return $(this).val(); }).get(); + showAssign(t_id); // alert(checkboxValues); } else { //Check all checkboxes $("input[type='checkbox']", ".mailbox-messages").iCheck("check"); // alert('Hallo'); t_id = []; + showAssign(t_id); } $(this).data("clicks", !clicks); @@ -414,6 +452,95 @@ if (Auth::user()->role == 'agent') { return false; }); + $('#AssignTickets').on('show.bs.modal', function() { + $.ajax({ + type: "POST", + url: "{{route('get-agents')}}", + dataType: "html", + beforeSend: function() { + $("#assign_body").hide(); + $("#assign_loader").show(); + }, + success: function(data) { + $("#assign_loader").hide(); + $("#assign_body").show(); + $('#select-assign-agent').html(data); + } + }); + }); + + // Assign a ticket + $('#assign-form').on('submit', function() { + $.ajax({ + type: "POST", + url: "../ticket/assign/"+t_id, + dataType: "html", + data: $(this).serialize(), + beforeSend: function() { + $("#assign_body").hide(); + $("#assign_loader").show(); + }, + success: function(response) { + if (response == 1) + { + location.reload(); + var message = "Success!"; + $("#alert11").show(); + $('#message-success1').html(message); + setInterval(function(){$("#dismiss11").trigger("click"); }, 2000); + } + $("#assign_body").show(); + $("#assign_loader").hide(); + $("#dismis4").trigger("click"); + } + }) + return false; + }); + $('#AssignTickets').on('show.bs.modal', function() { + $.ajax({ + type: "POST", + url: "{{route('get-agents')}}", + dataType: "html", + beforeSend: function() { + $("#assign_body").hide(); + $("#assign_loader").show(); + }, + success: function(data) { + $("#assign_loader").hide(); + $("#assign_body").show(); + $('#select-assign-agent').html(data); + } + }); + }); + + // Assign a ticket + $('#assign-form').on('submit', function() { + $.ajax({ + type: "POST", + url: "../ticket/assign/"+t_id, + dataType: "html", + data: $(this).serialize(), + beforeSend: function() { + $("#assign_body").hide(); + $("#assign_loader").show(); + }, + success: function(response) { + if (response == 1) + { + location.reload(); + var message = "Success!"; + $("#alert11").show(); + $('#message-success1').html(message); + setInterval(function(){$("#dismiss11").trigger("click"); }, 2000); + } + $("#assign_body").show(); + $("#assign_loader").hide(); + $("#dismis4").trigger("click"); + } + }) + return false; + }); + }); @@ -436,6 +563,16 @@ if (Auth::user()->role == 'agent') { t_id.splice(index, 1); // alert(t_id); } + showAssign(t_id); + } + + function showAssign(t_id) + { + if (t_id.length >= 1) { + $('#assign_Ticket').css('display', 'inline'); + } else { + $('#assign_Ticket').css('display', 'none'); + } } diff --git a/resources/views/themes/default1/agent/helpdesk/ticket/open.blade.php b/resources/views/themes/default1/agent/helpdesk/ticket/open.blade.php index d426ff63e..3da56047f 100644 --- a/resources/views/themes/default1/agent/helpdesk/ticket/open.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/ticket/open.blade.php @@ -60,6 +60,7 @@ if (Auth::user()->role == 'agent') { +

@@ -167,7 +168,41 @@ if (Auth::user()->role == 'agent') {
- + + + - + + + - + + +