update v 1.0.7.5
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketWorkflowController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
@@ -12,14 +12,14 @@ use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\User;
|
||||
use Auth;
|
||||
// classes
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Lang;
|
||||
|
||||
/**
|
||||
* TicketController2.
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class ClientTicketController extends Controller
|
||||
{
|
||||
@@ -28,11 +28,12 @@ class ClientTicketController extends Controller
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(TicketWorkflowController $TicketWorkflowController)
|
||||
{
|
||||
SettingsController::smtp();
|
||||
$this->TicketWorkflowController = $TicketWorkflowController;
|
||||
// $this->middleware('auth');
|
||||
// $this->middleware('role.user');
|
||||
$this->middleware('board');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,30 +57,35 @@ class ClientTicketController extends Controller
|
||||
* @return type view
|
||||
*/
|
||||
public function reply($id, Request $request)
|
||||
{
|
||||
$comment = $request->input('comment');
|
||||
if ($comment != null) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$tickets->closed_at = null;
|
||||
$tickets->closed = 0;
|
||||
$tickets->reopened_at = date('Y-m-d H:i:s');
|
||||
$tickets->reopened = 1;
|
||||
$tickets->isanswered = 0;
|
||||
$threads = new Ticket_Thread();
|
||||
$threads->user_id = Auth::user()->id;
|
||||
$threads->ticket_id = $tickets->id;
|
||||
$threads->poster = 'client';
|
||||
$threads->body = $comment;
|
||||
try {
|
||||
$threads->save();
|
||||
$tickets->save();
|
||||
{
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first();
|
||||
|
||||
return \Redirect::back()->with('success1', 'Successfully replied');
|
||||
} catch (Exception $e) {
|
||||
return \Redirect::back()->with('fails1', $e->errorInfo[2]);
|
||||
}
|
||||
} else {
|
||||
return \Redirect::back()->with('fails1', 'Please fill some data!');
|
||||
}
|
||||
$subject = $thread->title.'[#'.$tickets->ticket_number.']';
|
||||
$body = $request->input('comment');
|
||||
|
||||
$user_cred = User::where('id', '=', $tickets->user_id)->first();
|
||||
|
||||
$fromaddress = $user_cred->email;
|
||||
$fromname = $user_cred->user_name;
|
||||
$phone = '';
|
||||
$phonecode = '';
|
||||
$mobile_number = '';
|
||||
|
||||
$helptopic = $tickets->help_topic_id;
|
||||
$sla = $tickets->sla;
|
||||
$priority = $tickets->priority_id;
|
||||
$source = $tickets->source;
|
||||
$collaborator = '';
|
||||
$dept = $tickets->dept_id;
|
||||
$assign = $tickets->assigned_to;
|
||||
$form_data = null;
|
||||
$team_assign = null;
|
||||
$ticket_status = null;
|
||||
$auto_response = 0;
|
||||
|
||||
$this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response);
|
||||
|
||||
return \Redirect::back()->with('success1', Lang::get('lang.successfully_replied'));
|
||||
}
|
||||
}
|
||||
|
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Controller;
|
||||
// models
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
|
||||
// classes
|
||||
|
||||
/**
|
||||
* EmailController.
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailController extends Controller
|
||||
{
|
||||
/**
|
||||
* post port.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function port()
|
||||
{
|
||||
$port = Emails::where('id', '=', '1')->first();
|
||||
$portvalue = $port->option_value;
|
||||
|
||||
return $portvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post host.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function host()
|
||||
{
|
||||
$host = Option::where('option_name', '=', 'host')->first();
|
||||
$hostvalue = $host->option_value;
|
||||
|
||||
return $hostvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post username.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function username()
|
||||
{
|
||||
$username = Option::where('option_name', '=', 'username')->first();
|
||||
$uservalue = $username->option_value;
|
||||
|
||||
return $uservalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post passowrd.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function password()
|
||||
{
|
||||
$password = Option::where('option_name', '=', 'password')->first();
|
||||
$passvalue = $password->option_value;
|
||||
|
||||
return $passvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* post encryption.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function encryption()
|
||||
{
|
||||
$encryption = Option::where('option_name', '=', 'encryption')->first();
|
||||
$encryptvalue = $encryption->option_value;
|
||||
|
||||
return $encryptvalue;
|
||||
}
|
||||
}
|
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Agent\helpdesk\TicketWorkflowController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\ClientRequest;
|
||||
@@ -18,13 +17,15 @@ use App\Model\helpdesk\Ticket\Ticket_attachments;
|
||||
use App\Model\helpdesk\Ticket\Ticket_source;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Utility\CountryCode;
|
||||
use App\User;
|
||||
use Exception;
|
||||
// classes
|
||||
use Form;
|
||||
use GeoIP;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Mail;
|
||||
use Lang;
|
||||
use Redirect;
|
||||
|
||||
/**
|
||||
@@ -32,18 +33,16 @@ use Redirect;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class FormController extends Controller
|
||||
{
|
||||
class FormController extends Controller {
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* Constructor to check.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(TicketWorkflowController $TicketWorkflowController)
|
||||
{
|
||||
// mail smtp settings
|
||||
// SettingsController::smtp();
|
||||
public function __construct(TicketWorkflowController $TicketWorkflowController) {
|
||||
$this->middleware('board');
|
||||
// creating a TicketController instance
|
||||
$this->TicketWorkflowController = $TicketWorkflowController;
|
||||
}
|
||||
@@ -55,15 +54,17 @@ class FormController extends Controller
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic)
|
||||
{
|
||||
public function getForm(Help_topic $topic, CountryCode $code) {
|
||||
if (\Config::get('database.install') == '%0%') {
|
||||
return \Redirect::route('license');
|
||||
}
|
||||
$location = GeoIP::getLocation('');
|
||||
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
|
||||
if (System::first()->status == 1) {
|
||||
$topics = $topic->get();
|
||||
$codes = $code->get();
|
||||
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics'));
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode->phonecode);
|
||||
} else {
|
||||
return \Redirect::route('home');
|
||||
}
|
||||
@@ -77,14 +78,13 @@ class FormController extends Controller
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function postForm($id, Help_topic $topic)
|
||||
{
|
||||
// dd($id);
|
||||
public function postForm($id, Help_topic $topic) {
|
||||
if ($id != 0) {
|
||||
$helptopic = $topic->where('id', '=', $id)->first();
|
||||
$custom_form = $helptopic->custom_form;
|
||||
$values = Fields::where('forms_id', '=', $custom_form)->get();
|
||||
if (!$values) {
|
||||
|
||||
}
|
||||
if ($values) {
|
||||
foreach ($values as $value) {
|
||||
@@ -93,29 +93,29 @@ class FormController extends Controller
|
||||
$value = explode(',', $data);
|
||||
echo '<select class="form-control">';
|
||||
foreach ($value as $option) {
|
||||
echo '<option>'.$option.'</option>';
|
||||
echo '<option>' . $option . '</option>';
|
||||
}
|
||||
echo '</select></br>';
|
||||
} elseif ($value->type == 'radio') {
|
||||
$type2 = $value->value;
|
||||
$val = explode(',', $type2);
|
||||
echo '<label class="radio-inline">'.$value->label.'</label>   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[0].'
|
||||
   <input type="'.$value->type.'" name="'.$value->name.'"> '.$val[1].'</br>';
|
||||
echo '<label class="radio-inline">' . $value->label . '</label>   <input type="' . $value->type . '" name="' . $value->name . '"> ' . $val[0] . '
|
||||
   <input type="' . $value->type . '" name="' . $value->name . '"> ' . $val[1] . '</br>';
|
||||
} elseif ($value->type == 'textarea') {
|
||||
$type3 = $value->value;
|
||||
$v = explode(',', $type3);
|
||||
//dd($v);
|
||||
if (array_key_exists(1, $v)) {
|
||||
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="'.$v[0].'" cols="'.$v[1].'"></textarea></br>';
|
||||
echo '<label>' . $value->label . '</label></br><textarea class=form-control rows="' . $v[0] . '" cols="' . $v[1] . '"></textarea></br>';
|
||||
} else {
|
||||
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>';
|
||||
echo '<label>' . $value->label . '</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>';
|
||||
}
|
||||
} elseif ($value->type == 'checkbox') {
|
||||
$type4 = $value->value;
|
||||
$check = explode(',', $type4);
|
||||
echo '<label class="radio-inline">'.$value->label.'   <input type="'.$value->type.'" name="'.$value->name.'">  '.$check[0].'</label><label class="radio-inline"><input type="'.$value->type.'" name="'.$value->name.'">  '.$check[1].'</label></br>';
|
||||
echo '<label class="radio-inline">' . $value->label . '   <input type="' . $value->type . '" name="' . $value->name . '">  ' . $check[0] . '</label><label class="radio-inline"><input type="' . $value->type . '" name="' . $value->name . '">  ' . $check[1] . '</label></br>';
|
||||
} else {
|
||||
echo '<label>'.$value->label.'</label><input type="'.$value->type.'" class="form-control" name="'.$value->name.'" /></br>';
|
||||
echo '<label>' . $value->label . '</label><input type="' . $value->type . '" class="form-control" name="' . $value->name . '" /></br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,8 +130,8 @@ class FormController extends Controller
|
||||
* @param type Request $request
|
||||
* @param type User $user
|
||||
*/
|
||||
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta)
|
||||
{
|
||||
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');
|
||||
|
||||
$name = $request->input('Name');
|
||||
@@ -139,24 +139,46 @@ class FormController extends Controller
|
||||
$email = $request->input('Email');
|
||||
$subject = $request->input('Subject');
|
||||
$details = $request->input('Details');
|
||||
|
||||
$phonecode = $request->input('Code');
|
||||
$System = System::where('id', '=', 1)->first();
|
||||
$departments = Department::where('id', '=', $System->department)->first();
|
||||
$department = $departments->id;
|
||||
|
||||
$mobile_number = $request->input('Mobile');
|
||||
$status = $ticket_settings->first()->status;
|
||||
$helptopic = $ticket_settings->first()->help_topic;
|
||||
$sla = $ticket_settings->first()->sla;
|
||||
$priority = $ticket_settings->first()->priority;
|
||||
$source = $ticket_source->where('name', '=', 'web')->first()->id;
|
||||
$attachments = $request->file('attachment');
|
||||
|
||||
$collaborator = null;
|
||||
$assignto = null;
|
||||
$auto_response = 0;
|
||||
$team_assign = null;
|
||||
if ($phone != null || $mobile_number != null) {
|
||||
$location = GeoIP::getLocation();
|
||||
$geoipcode = $code->where('iso', '=', $location['isoCode'])->first();
|
||||
if ($phonecode == null) {
|
||||
$data = [
|
||||
'fails' => Lang::get('lang.country-code-required-error'),
|
||||
'phonecode' => $geoipcode->phonecode,
|
||||
'country_code_error' => 1,
|
||||
];
|
||||
|
||||
$result = $this->TicketWorkflowController->workflow($email, $name, $subject, $details, $phone, $helptopic, $sla, $priority, $source, $collaborator, $department, $assignto, $team_assign, $status, $form_extras, $auto_response);
|
||||
return Redirect::back()->with($data)->withInput($request->except('password'));
|
||||
} else {
|
||||
$code = CountryCode::select('phonecode')->where('phonecode', '=', $phonecode)->get();
|
||||
if (!count($code)) {
|
||||
$data = [
|
||||
'fails' => Lang::get('lang.incorrect-country-code-error'),
|
||||
'phonecode' => $geoipcode->phonecode,
|
||||
'country_code_error' => 1,
|
||||
];
|
||||
|
||||
return Redirect::back()->with($data)->withInput($request->except('password'));
|
||||
}
|
||||
}
|
||||
}
|
||||
$result = $this->TicketWorkflowController->workflow($email, $name, $subject, $details, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $department, $assignto, $team_assign, $status, $form_extras, $auto_response);
|
||||
|
||||
if ($result[1] == 1) {
|
||||
$ticketId = Tickets::where('ticket_number', '=', $result[0])->first();
|
||||
@@ -174,7 +196,7 @@ class FormController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return Redirect::route('guest.getform')->with('success', 'Ticket has been created successfully, your ticket number is <b>'.$result[0].'</b> Please save this for future reference.');
|
||||
return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is') . ' ' . $result[0] . '. ' . Lang::get('lang.Please-save-this-for-future-reference'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,30 +207,68 @@ class FormController extends Controller
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function post_ticket_reply($id, Request $request)
|
||||
{
|
||||
$comment = $request->input('comment');
|
||||
if ($comment != null) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$threads = new Ticket_Thread();
|
||||
$tickets->closed_at = null;
|
||||
$tickets->closed = 0;
|
||||
$tickets->reopened_at = date('Y-m-d H:i:s');
|
||||
$tickets->reopened = 1;
|
||||
$threads->user_id = $tickets->user_id;
|
||||
$threads->ticket_id = $tickets->id;
|
||||
$threads->poster = 'client';
|
||||
$threads->body = $comment;
|
||||
try {
|
||||
$threads->save();
|
||||
$tickets->save();
|
||||
public function post_ticket_reply($id, Request $request) {
|
||||
try {
|
||||
if ($comment != null) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first();
|
||||
|
||||
return \Redirect::back()->with('success1', 'Successfully replied');
|
||||
} catch (Exception $e) {
|
||||
return \Redirect::back()->with('fails1', $e->errorInfo[2]);
|
||||
$subject = $thread->title . '[#' . $tickets->ticket_number . ']';
|
||||
$body = $request->input('comment');
|
||||
|
||||
$user_cred = User::where('id', '=', $tickets->user_id)->first();
|
||||
|
||||
$fromaddress = $user_cred->email;
|
||||
$fromname = $user_cred->user_name;
|
||||
$phone = '';
|
||||
$phonecode = '';
|
||||
$mobile_number = '';
|
||||
|
||||
$helptopic = $tickets->help_topic_id;
|
||||
$sla = $tickets->sla;
|
||||
$priority = $tickets->priority_id;
|
||||
$source = $tickets->source;
|
||||
$collaborator = '';
|
||||
$dept = $tickets->dept_id;
|
||||
$assign = $tickets->assigned_to;
|
||||
$form_data = null;
|
||||
$team_assign = null;
|
||||
$ticket_status = null;
|
||||
$auto_response = 0;
|
||||
|
||||
$this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response);
|
||||
|
||||
return \Redirect::back()->with('success1', Lang::get('lang.successfully_replied'));
|
||||
} else {
|
||||
return \Redirect::back()->with('fails1', Lang::get('lang.please_fill_some_data'));
|
||||
}
|
||||
} else {
|
||||
return \Redirect::back()->with('fails1', 'Please fill some data!');
|
||||
} catch (Exception $e) {
|
||||
return \Redirect::back()->with('fails1', $e->getMessage());
|
||||
}
|
||||
//
|
||||
// $comment = $request->input('comment');
|
||||
// if ($comment != null) {
|
||||
// $tickets = Tickets::where('id', '=', $id)->first();
|
||||
// $threads = new Ticket_Thread();
|
||||
// $tickets->closed_at = null;
|
||||
// $tickets->closed = 0;
|
||||
// $tickets->reopened_at = date('Y-m-d H:i:s');
|
||||
// $tickets->reopened = 1;
|
||||
// $threads->user_id = $tickets->user_id;
|
||||
// $threads->ticket_id = $tickets->id;
|
||||
// $threads->poster = 'client';
|
||||
// $threads->body = $comment;
|
||||
// try {
|
||||
// $threads->save();
|
||||
// $tickets->save();
|
||||
//
|
||||
// return \Redirect::back()->with('success1', Lang::get('lang.successfully_replied'));
|
||||
// } catch (Exception $e) {
|
||||
// return \Redirect::back()->with('fails1', $e->getMessage());
|
||||
// }
|
||||
// } else {
|
||||
// return \Redirect::back()->with('fails1', Lang::get('lang.please_fill_some_data'));
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,25 +4,27 @@ namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Common\SettingsController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Http\Requests\helpdesk\CheckTicket;
|
||||
use App\Http\Requests\helpdesk\ProfilePassword;
|
||||
use App\Http\Requests\helpdesk\ProfileRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
// models
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
use App\Model\helpdesk\Settings\System;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Utility\CountryCode;
|
||||
use App\User;
|
||||
// classes
|
||||
use Auth;
|
||||
// classes
|
||||
use Exception;
|
||||
use GeoIP;
|
||||
use Hash;
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Lang;
|
||||
|
||||
/**
|
||||
* GuestController.
|
||||
@@ -38,23 +40,25 @@ class GuestController extends Controller
|
||||
*/
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->middleware('board');
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
SettingsController::smtp();
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile()
|
||||
{
|
||||
$user = Auth::user();
|
||||
/**
|
||||
* Get profile.
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getProfile(CountryCode $code)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$location = GeoIP::getLocation('');
|
||||
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
|
||||
|
||||
return view('themes.default1.client.helpdesk.profile', compact('user'));
|
||||
}
|
||||
return view('themes.default1.client.helpdesk.profile', compact('user'))->with('phonecode', $phonecode->phonecode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save profile data.
|
||||
@@ -89,12 +93,24 @@ class GuestController extends Controller
|
||||
Input::file('profile_pic')->move($destinationPath, $fileName);
|
||||
$user->profile_pic = $fileName;
|
||||
} else {
|
||||
if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) {
|
||||
return redirect()->back()->with(['fails1' => Lang::get('lang.country-code-required-error'),
|
||||
'country_code' => 1, ])->withInput();
|
||||
} else {
|
||||
$code = CountryCode::select('phonecode')->where('phonecode', '=', $request->get('country_code'))->get();
|
||||
if (!count($code)) {
|
||||
return redirect()->back()->with(['fails1' => Lang::get('lang.incorrect-country-code-error'),
|
||||
'country_code' => 1, ])->withInput();
|
||||
} else {
|
||||
$user->country_code = $request->input('country_code');
|
||||
}
|
||||
}
|
||||
$user->fill($request->except('profile_pic', 'gender'))->save();
|
||||
|
||||
return redirect()->back()->with('success1', 'Profile Updated sucessfully');
|
||||
return redirect()->back()->with('success1', Lang::get('lang.profile_updated_sucessfully'));
|
||||
}
|
||||
if ($user->fill($request->except('profile_pic'))->save()) {
|
||||
return redirect()->back()->with('success1', 'Profile Updated sucessfully');
|
||||
return redirect()->back()->with('success1', Lang::get('lang.profile_updated_sucessfully'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,12 +211,12 @@ class GuestController extends Controller
|
||||
try {
|
||||
$user->save();
|
||||
|
||||
return redirect()->back()->with('success2', 'Password Updated sucessfully');
|
||||
return redirect()->back()->with('success2', Lang::get('lang.password_updated_sucessfully'));
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with('fails2', $e->errorInfo[2]);
|
||||
return redirect()->back()->with('fails2', $e->getMessage());
|
||||
}
|
||||
} else {
|
||||
return redirect()->back()->with('fails2', 'Password was not Updated. Incorrect old password');
|
||||
return redirect()->back()->with('fails2', Lang::get('lang.password_was_not_updated_incorrect_old_password'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,26 +266,33 @@ class GuestController extends Controller
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function PostCheckTicket()
|
||||
public function PostCheckTicket(Request $request)
|
||||
{
|
||||
$Email = \Input::get('email');
|
||||
$Ticket_number = \Input::get('ticket_number');
|
||||
|
||||
$validator = \Validator::make($request->all(), [
|
||||
'email' => 'required|email',
|
||||
'ticket_number' => 'required',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()
|
||||
->withErrors($validator)
|
||||
->withInput()
|
||||
->with('check', '1');
|
||||
}
|
||||
$Email = $request->input('email');
|
||||
$Ticket_number = $request->input('ticket_number');
|
||||
$ticket = Tickets::where('ticket_number', '=', $Ticket_number)->first();
|
||||
if ($ticket == null) {
|
||||
return \Redirect::route('form')->with('fails', 'There is no such Ticket Number');
|
||||
return \Redirect::route('form')->with('fails', Lang::get('lang.there_is_no_such_ticket_number'));
|
||||
} else {
|
||||
$userId = $ticket->user_id;
|
||||
$user = User::where('id', '=', $userId)->first();
|
||||
|
||||
if ($user->role == 'user') {
|
||||
$username = $user->user_name;
|
||||
} else {
|
||||
$username = $user->first_name.' '.$user->last_name;
|
||||
}
|
||||
|
||||
if ($user->email != $Email) {
|
||||
return \Redirect::route('form')->with('fails', "Email didn't match with Ticket Number");
|
||||
return \Redirect::route('form')->with('fails', Lang::get("lang.email_didn't_match_with_ticket_number"));
|
||||
} else {
|
||||
$code = $ticket->id;
|
||||
$code = \Crypt::encrypt($code);
|
||||
@@ -281,7 +304,7 @@ class GuestController extends Controller
|
||||
);
|
||||
|
||||
return \Redirect::back()
|
||||
->with('success', 'We have sent you a link by Email. Please click on that link to view ticket');
|
||||
->with('success', Lang::get('lang.we_have_sent_you_a_link_by_email_please_click_on_that_link_to_view_ticket'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
278
app/Http/Controllers/Client/helpdesk/UnAuthController.php
Normal file
278
app/Http/Controllers/Client/helpdesk/UnAuthController.php
Normal file
@@ -0,0 +1,278 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Client\helpdesk;
|
||||
|
||||
// controllers
|
||||
use App\Http\Controllers\Common\PhpMailController;
|
||||
use App\Http\Controllers\Controller;
|
||||
// requests
|
||||
use App\Model\helpdesk\Email\Emails;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Status;
|
||||
use App\Model\helpdesk\Ticket\Ticket_Thread;
|
||||
use App\Model\helpdesk\Ticket\Tickets;
|
||||
use App\Model\helpdesk\Ticket\TicketToken;
|
||||
use App\User;
|
||||
use Hash;
|
||||
// classes
|
||||
use Illuminate\Http\Request;
|
||||
use Input;
|
||||
use Lang;
|
||||
|
||||
/**
|
||||
* GuestController.
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class UnAuthController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return type void
|
||||
*/
|
||||
public function __construct(PhpMailController $PhpMailController)
|
||||
{
|
||||
$this->middleware('board');
|
||||
$this->PhpMailController = $PhpMailController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Check ticket.
|
||||
*
|
||||
* @param type CheckTicket $request
|
||||
* @param type User $user
|
||||
* @param type Tickets $ticket
|
||||
* @param type Ticket_Thread $thread
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function PostCheckTicket(Request $request)
|
||||
{
|
||||
try {
|
||||
$validator = \Validator::make($request->all(), [
|
||||
'email_address' => 'required|email',
|
||||
'ticket_number' => 'required',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()
|
||||
->withErrors($validator)
|
||||
->withInput()
|
||||
->with('check', '1');
|
||||
}
|
||||
$email = $request->input('email_address');
|
||||
$ticket_number = $request->input('ticket_number');
|
||||
// get user details
|
||||
$user_details = User::where('email', '=', $email)->first();
|
||||
// get ticket details
|
||||
$ticket = Tickets::where('ticket_number', '=', $ticket_number)->first();
|
||||
if ($ticket == null) {
|
||||
return \Redirect::route('form')->with('fails', Lang::get('lang.there_is_no_such_ticket_number'));
|
||||
}
|
||||
if ($ticket->user_id == $user_details->id) {
|
||||
if ($user_details->role == 'user') {
|
||||
$username = $user_details->user_name;
|
||||
} else {
|
||||
$username = $user_details->first_name.' '.$user_details->last_name;
|
||||
}
|
||||
// check for preentered ticket token
|
||||
$ticket_token = TicketToken::where('ticket_id', '=', $ticket->id)->first();
|
||||
if ($ticket_token) {
|
||||
$token = $this->generate_random_ticket_token();
|
||||
$hashed_token = \Hash::make($token);
|
||||
$ticket_token->token = $hashed_token;
|
||||
$ticket_token->save();
|
||||
} else {
|
||||
$ticket_token = new TicketToken();
|
||||
$ticket_token->ticket_id = $ticket->id;
|
||||
$token = $this->generate_random_ticket_token();
|
||||
$hashed_token = \Hash::make($token);
|
||||
$ticket_token->token = $hashed_token;
|
||||
$ticket_token->save();
|
||||
}
|
||||
try {
|
||||
$this->PhpMailController->sendmail(
|
||||
$from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $username, 'email' => $user_details->email], $message = ['subject' => 'Ticket link Request ['.$ticket_number.']', 'scenario' => 'check-ticket'], $template_variables = ['user' => $username, 'ticket_link_with_number' => url('show-ticket/'.$ticket->id.'/'.$token)]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
|
||||
return redirect()->back()
|
||||
->with('success', Lang::get('lang.we_have_sent_you_a_link_by_email_please_click_on_that_link_to_view_ticket'));
|
||||
} else {
|
||||
return \Redirect::route('form')->with('fails', Lang::get("lang.email_didn't_match_with_ticket_number"));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return \Redirect::route('form')->with('fails', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* generate random string token for ticket.
|
||||
*
|
||||
* @param type $length
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generate_random_ticket_token($length = 10)
|
||||
{
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to check the ticket without loggin In.
|
||||
*
|
||||
* @param type $ticket_id
|
||||
* @param type $token
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function showTicketCode($ticket_id, $token)
|
||||
{
|
||||
try {
|
||||
$check_token = TicketToken::where('ticket_id', '=', $ticket_id)->first();
|
||||
if (Hash::check($token, $check_token->token) == true) {
|
||||
$token_time = CommonSettings::where('option_name', '=', 'ticket_token_time_duration')->first();
|
||||
$time = $token_time->option_value;
|
||||
$new_time = date_add($check_token->updated_at, date_interval_create_from_date_string($time.' Hours'));
|
||||
if (date('Y-m-d H:i:s') > $new_time) {
|
||||
return redirect()->route('form')->with('fails', Lang::get('lang.sorry_your_ticket_token_has_expired_please_try_to_resend_the_ticket_link_request'));
|
||||
}
|
||||
$tickets = Tickets::where('id', '=', $ticket_id)->first();
|
||||
|
||||
return view('themes.default1.client.helpdesk.unauth.showticket', compact('tickets', 'token'));
|
||||
} else {
|
||||
return redirect()->route('form')->with('fails', Lang::get('lang.sorry_you_are_not_allowed_token_expired'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
return redirect()->route('form')->with('fails', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store ratings of the user.
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function rating($id, Request $request, \App\Model\helpdesk\Ratings\RatingRef $rating_ref)
|
||||
{
|
||||
foreach ($request->all() as $key => $value) {
|
||||
if (strpos($key, '_') !== false) {
|
||||
$ratName = str_replace('_', ' ', $key);
|
||||
} else {
|
||||
$ratName = $key;
|
||||
}
|
||||
$ratID = \App\Model\helpdesk\Ratings\Rating::where('name', '=', $ratName)->first();
|
||||
$ratingrefs = $rating_ref->where('rating_id', '=', $ratID->id)->where('ticket_id', '=', $id)->first();
|
||||
if ($ratingrefs !== null) {
|
||||
$ratingrefs->rating_id = $ratID->id;
|
||||
$ratingrefs->ticket_id = $id;
|
||||
|
||||
$ratingrefs->thread_id = '0';
|
||||
$ratingrefs->rating_value = $value;
|
||||
$ratingrefs->save();
|
||||
} else {
|
||||
$rating_ref->rating_id = $ratID->id;
|
||||
$rating_ref->ticket_id = $id;
|
||||
|
||||
$rating_ref->thread_id = '0';
|
||||
$rating_ref->rating_value = $value;
|
||||
$rating_ref->save();
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->back()->with('Success', Lang::get('lang.thank_you_for_your_rating'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store Client rating about reply of agent quality.
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function ratingReply($id, Request $request, \App\Model\helpdesk\Ratings\RatingRef $rating_ref)
|
||||
{
|
||||
foreach ($request->all() as $key => $value) {
|
||||
$key1 = explode(',', $key);
|
||||
if (strpos($key1[0], '_') !== false) {
|
||||
$ratName = str_replace('_', ' ', $key1[0]);
|
||||
} else {
|
||||
$ratName = $key1[0];
|
||||
}
|
||||
$ratID = \App\Model\helpdesk\Ratings\Rating::where('name', '=', $ratName)->first();
|
||||
$ratingrefs = $rating_ref->where('rating_id', '=', $ratID->id)->where('thread_id', '=', $key1[1])->first();
|
||||
if ($ratingrefs !== null) {
|
||||
$ratingrefs->rating_id = $ratID->id;
|
||||
$ratingrefs->ticket_id = $id;
|
||||
$ratingrefs->thread_id = $key1[1];
|
||||
$ratingrefs->rating_value = $value;
|
||||
$ratingrefs->save();
|
||||
} else {
|
||||
$rating_ref->rating_id = $ratID->id;
|
||||
$rating_ref->ticket_id = $id;
|
||||
$rating_ref->thread_id = $key1[1];
|
||||
$rating_ref->rating_value = $value;
|
||||
$rating_ref->save();
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->back()->with('Success', Lang::get('lang.thank_you_for_your_rating'));
|
||||
}
|
||||
|
||||
/**
|
||||
* function to change the status of the ticket.
|
||||
*
|
||||
* @param type $status
|
||||
* @param type $id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function changeStatus($status, $id)
|
||||
{
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$tickets->status = $status;
|
||||
$ticket_status = Ticket_Status::where('id', '=', $status)->first();
|
||||
if ($ticket_status->state == 'closed') {
|
||||
$tickets->closed = $ticket_status->id;
|
||||
$tickets->closed_at = date('Y-m-d H:i:s');
|
||||
}
|
||||
$tickets->save();
|
||||
$ticket_thread = Ticket_Thread::where('ticket_id', '=', $ticket_status->id)->first();
|
||||
$ticket_subject = $ticket_thread->title;
|
||||
|
||||
$user = User::where('id', '=', $tickets->user_id)->first();
|
||||
|
||||
$thread = new Ticket_Thread();
|
||||
$thread->ticket_id = $tickets->id;
|
||||
$thread->user_id = $tickets->user_id;
|
||||
$thread->is_internal = 1;
|
||||
$thread->body = $ticket_status->message.' '.$user->user_name;
|
||||
$thread->save();
|
||||
|
||||
$email = $user->email;
|
||||
$user_name = $user->user_name;
|
||||
|
||||
$ticket_number = $tickets->ticket_number;
|
||||
|
||||
$sending_emails = Emails::where('department', '=', $ticket_status->dept_id)->first();
|
||||
if ($sending_emails == null) {
|
||||
$from_email = $this->system_mail();
|
||||
} else {
|
||||
$from_email = $sending_emails->id;
|
||||
}
|
||||
try {
|
||||
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $tickets->dept_id), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'close-ticket'], $template_variables = ['ticket_number' => $ticket_number]);
|
||||
} catch (\Exception $e) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Lang::get('lang.your_ticket_has_been').' '.$ticket_status->state;
|
||||
}
|
||||
}
|
@@ -15,15 +15,18 @@ use Redirect;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class WelcomepageController extends Controller
|
||||
{
|
||||
class WelcomepageController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
// $this->middleware('board');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function get(System $note)
|
||||
{
|
||||
public function get(System $note) {
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
@@ -35,12 +38,12 @@ class WelcomepageController extends Controller
|
||||
return view('themes.default1.client.guest-user.guest', compact('heading', 'content'));
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
public function index() {
|
||||
if (Config::get('database.install') == '%0%') {
|
||||
return Redirect::route('licence');
|
||||
}
|
||||
|
||||
return view('themes.default1.client.helpdesk.guest-user.index');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user