diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php index 722f1495b..40a477ac8 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(); @@ -1459,59 +1464,63 @@ 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; + } } } @@ -2537,7 +2546,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 +2557,14 @@ class TicketController extends Controller $name = $from->user_name; } } + $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)).''; + 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'); diff --git a/app/Http/Controllers/Agent/helpdesk/UserController.php b/app/Http/Controllers/Agent/helpdesk/UserController.php index 538842d04..c291fb4ee 100644 --- a/app/Http/Controllers/Agent/helpdesk/UserController.php +++ b/app/Http/Controllers/Agent/helpdesk/UserController.php @@ -734,7 +734,7 @@ class UserController extends Controller return redirect('profile-edit')->with('success1', Lang::get('lang.password_updated_sucessfully')); } catch (Exception $e) { - return redirect('profile-edit')->with('fails', $e->getMessage()); + return redirect('profile-edit')->with('fails1', $e->getMessage()); } } else { return redirect('profile-edit')->with('fails1', Lang::get('lang.password_was_not_updated_incorrect_old_password')); @@ -1003,4 +1003,19 @@ class UserController extends Controller return $message; } } + + /** + * @category function to get user details and show in select field + * + * @param null + * + * @return data + */ + public function getAgentDetails() + { + $users = User::where('role', '<>', 'user')->where('active', '=', 1)->get(); + foreach ($users as $user) { + echo "'; + } + } } diff --git a/app/Http/Controllers/Client/helpdesk/FormController.php b/app/Http/Controllers/Client/helpdesk/FormController.php index 98d29e3b0..15de23f29 100644 --- a/app/Http/Controllers/Client/helpdesk/FormController.php +++ b/app/Http/Controllers/Client/helpdesk/FormController.php @@ -146,7 +146,7 @@ class FormController extends Controller */ public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code) { - $form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token', 'mobile', 'Code'); + $form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token', 'mobile', 'Code', 'priority'); $name = $request->input('Name'); $phone = $request->input('Phone'); if ($request->input('Email')) { @@ -179,7 +179,7 @@ class FormController extends Controller // $priority = $ticket_settings->first()->priority; $default_priority = Ticket_Priority::where('is_default', '=', 1)->first(); - $user_priority = CommonSettings::where('id', '=', 6)->first(); + $user_priority = CommonSettings::select('status')->where('option_name', '=', 'user_priority')->first(); if (!($request->input('priority'))) { $priority = $default_priority->priority_id; } else { diff --git a/app/Http/routes.php b/app/Http/routes.php index 3071be0b7..687311ec4 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/app/Model/helpdesk/Ticket/Ticket_Form_Data.php b/app/Model/helpdesk/Ticket/Ticket_Form_Data.php index 26472aee9..5726c21f8 100644 --- a/app/Model/helpdesk/Ticket/Ticket_Form_Data.php +++ b/app/Model/helpdesk/Ticket/Ticket_Form_Data.php @@ -4,8 +4,39 @@ namespace App\Model\helpdesk\Ticket; use App\BaseModel; -class Ticket_Form_Data extends BaseModel -{ +class Ticket_Form_Data extends BaseModel { + protected $table = 'ticket_form_data'; protected $fillable = ['id', 'ticket_id', 'title', 'content', 'created_at', 'updated_at']; + + public function getFieldKeyLabel() { + $value = $this->attributes['title']; + $fields = new \App\Model\helpdesk\Form\Fields(); + $field = $fields->where('name', $value)->first(); + if ($field) { + $value = $field->label; + } + return $value; + } + + public function isHidden(){ + $check = false; + $value = $this->attributes['title']; + $fields = new \App\Model\helpdesk\Form\Fields(); + $field = $fields->where('name', $value)->first(); + if ($field && $field->type=='hidden') { + $check = true; + } + return $check; + } + + public function getHidden(){ + $value = $this->attributes['title']; + $fields = new \App\Model\helpdesk\Form\Fields(); + $field = $fields->where('name', $value)->first(); + if ($field && $field->type=='hidden') { + return $field->label; + } + } + } diff --git a/resources/lang/en/lang.php b/resources/lang/en/lang.php index fe2f19a0a..21a5b0868 100644 --- a/resources/lang/en/lang.php +++ b/resources/lang/en/lang.php @@ -1549,5 +1549,6 @@ 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', + 'updated-internal-note' => 'Your note has been added successfully', ]; diff --git a/resources/views/themes/default1/agent/helpdesk/approval/approval_index.blade.php b/resources/views/themes/default1/agent/helpdesk/approval/approval_index.blade.php deleted file mode 100644 index 93fad90de..000000000 --- a/resources/views/themes/default1/agent/helpdesk/approval/approval_index.blade.php +++ /dev/null @@ -1,427 +0,0 @@ -@extends('themes.default1.agent.layout.agent') - -@section('Tickets') -class="active" -@stop - -@section('ticket-bar') -active -@stop - -@section('approvel') -class="active" -@stop - -@section('PageHeader') -

{{Lang::get('lang.approval_tickets')}}

-@stop -@section('content') -role == 'agent') { - $dept = App\Model\helpdesk\Agent\Department::where('id', '=', Auth::user()->primary_dpt)->first(); - $tickets = App\Model\helpdesk\Ticket\Tickets::whereIn('status', array(1, 7))->where('dept_id', '=', $dept->id)->orderBy('id', 'DESC')->paginate(20); -} else { - $tickets = App\Model\helpdesk\Ticket\Tickets::whereIn('status', array(1, 7))->orderBy('id', 'DESC')->paginate(20); -} -?> - -
-
-

{!! Lang::get('lang.inbox') !!}

{!! $tickets->total() !!} {!! Lang::get('lang.tickets') !!} -
- -
- @if(Session::has('success')) -
- - - {{Session::get('success')}} -
- @endif - - @if(Session::has('fails')) -
- {!! Lang::get('lang.alert') !!}! - - {{Session::get('fails')}} -
- @endif - {!! Form::open(['id'=>'modalpopup', 'route'=>'select_all','method'=>'post']) !!} - - - @if(Auth::user()->role == 'admin') - - {{-- --}} - - - - @endif - -

-

- - {!! Datatable::table() - ->addColumn( - "", - Lang::get('lang.subject'), - Lang::get('lang.ticket_id'), - Lang::get('lang.priority'), - Lang::get('lang.from'), - Lang::get('lang.assigned_to'), - Lang::get('lang.last_activity')) - ->setUrl(route('get.approval.ticket')) - - ->setOrder(array(6=>'desc')) - ->setClass('table table-hover table-bordered table-striped') - ->setCallbacks("fnCreatedRow", 'function( nRow, aData, iDataIndex ) { - var str = aData[3]; - if(str.search("#000") == -1) { - $("td", nRow).css({"background-color":"#F3F3F3", "font-weight":"600", "border-bottom":"solid 0.5px #ddd", "border-right":"solid 0.5px #F3F3F3"}); - $("td", nRow).mouseenter(function(){ - $("td", nRow).css({"background-color":"#DEDFE0", "font-weight":"600", "border-bottom":"solid 0.5px #ddd", "border-right":"solid 0.5px #DEDFE0"}); - }); - $("td", nRow).mouseleave(function(){ - $("td", nRow).css({"background-color":"#F3F3F3", "font-weight":"600", "border-bottom":"solid 0.5px #ddd","border-right":"solid 0.5px #F3F3F3"}); - }); - } else { - $("td", nRow).css({"background-color":"white", "border-bottom":"solid 0.5px #ddd", "border-right":"solid 0.5px white"}); - $("td", nRow).mouseenter(function(){ - $("td", nRow).css({"background-color":"#DEDFE0", "border-bottom":"solid 0.5px #ddd", "border-right":"solid 0.5px #DEDFE0"}); - }); - $("td", nRow).mouseleave(function(){ - $("td", nRow).css({"background-color":"white", "border-bottom":"solid 0.5px #ddd", "border-right":"solid 0.5px white"}); - }); - } - }') - ->render();!!} - -
- {!! Form::close() !!} -
-
- - - - - - - - - -@stop \ No newline at end of file diff --git a/resources/views/themes/default1/agent/helpdesk/dept-ticket/inprogress.blade.php b/resources/views/themes/default1/agent/helpdesk/dept-ticket/inprogress.blade.php index 0b6c4b237..51833b9e9 100644 --- a/resources/views/themes/default1/agent/helpdesk/dept-ticket/inprogress.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/dept-ticket/inprogress.blade.php @@ -63,6 +63,7 @@ if (Auth::user()->role == 'agent') { +

@@ -107,7 +108,40 @@ if (Auth::user()->role == 'agent') { {!! Form::close() !!}
- + + + + + + + + - + + + - + + + - + + + - + + + - + + +