diff --git a/.env b/.env index 18df0e44d..1034f2d82 100644 --- a/.env +++ b/.env @@ -1,17 +1,17 @@ APP_ENV=local APP_DEBUG=false APP_KEY=SomeRandomString +DB_TYPE=mysql DB_HOST=localhost -DB_DATABASE=faveo-dev -DB_USERNAME=ladybird -DB_PASSWORD=ladybird -CACHE_DRIVER=file -SESSION_DRIVER=file -QUEUE_DRIVER=sync +DB_PORT= +DB_DATABASE=faveo +DB_USERNAME=root +DB_PASSWORD= MAIL_DRIVER=smtp MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null -DB_TYPE=mysql -DB_PORT= +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync diff --git a/README.md b/README.md index dc8679368..346be4803 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -

About Faveo

-
   StyleCI  
+

Development Branch of Faveo

+
   StyleCI 

Headquartered in Bangalore, Faveo HELPDESK provides Businesses with an automated Helpdesk system to manage customer support.

The word Faveo comes from Latin which means to be favourable. Which truly highlights vision and the scope as well as the functionality of the product that Faveo is. It is specifically designed to cater the needs of startups and SME’s empowering them with state of art, ticket based support system. In today’s competitive startup scenario customer retention is one of the major challenges. Handling client query diligently is all the difference between retaining or losing a long lasting relationship. The company is driven with passion of providing tools for managing consumer queries for strategic insights and helping companies take those decisive decisions.

-To date, Faveo has been integrated with 3 platforms and every month there is 1 to 2 update releases with new features & platform integration. +To date, Faveo has been integrated with 6 platforms and every month there is 1 to 2 update releases with new features & platform integration.

Faveo can also be customised according to requirement and we do undertake such request.

diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 28076e9e6..b538b2a8f 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -54,29 +54,30 @@ class Handler extends ExceptionHandler */ public function render($request, Exception $e) { - if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) { - return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); - } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) { - return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); - } - // This is to check if the debug is true or false - if (config('app.debug') == false) { - // checking if the error is actually an error page or if its an system error page - if ($this->isHttpException($e) && $e->getStatusCode() == 404) { - return response()->view('errors.404', []); - } else { - // checking if the application is installed - if (\Config::get('database.install') == 1) { - // checking if the error log send to Ladybirdweb is enabled or not - if (\Config::get('app.ErrorLog') == '%1%') { - //$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario' => 'error-report'], $template_variables = ['e' => $e]); - } - } - - return response()->view('errors.500', []); - } - } - // returns non oops error message +// $phpmail = new PhpMailController; +// if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) { +// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); +// } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) { +// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); +// } +// // This is to check if the debug is true or false +// if (config('app.debug') == false) { +// // checking if the error is actually an error page or if its an system error page +// if ($this->isHttpException($e) && $e->getStatusCode() == 404) { +// return response()->view('errors.404', []); +// } else { +// // checking if the application is installed +// if (\Config::get('database.install') == 1) { +// // checking if the error log send to Ladybirdweb is enabled or not +// if (\Config::get('app.ErrorLog') == '1') { +// $this->phpmail->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario' => 'error-report'], $template_variables = ['e' => $e]); +// } +// } +// +// return response()->view('errors.500', []); +// } +// } +// // returns non oops error message return parent::render($request, $e); // checking if the error is related to http error i.e. page not found if ($this->isHttpException($e)) { diff --git a/app/Http/Controllers/Admin/helpdesk/AgentController.php b/app/Http/Controllers/Admin/helpdesk/AgentController.php index b8ca005af..eb16521bf 100644 --- a/app/Http/Controllers/Admin/helpdesk/AgentController.php +++ b/app/Http/Controllers/Admin/helpdesk/AgentController.php @@ -4,7 +4,6 @@ namespace App\Http\Controllers\Admin\helpdesk; // controller use App\Http\Controllers\Common\PhpMailController; -use App\Http\Controllers\Common\SettingsController; use App\Http\Controllers\Controller; // request use App\Http\Requests\helpdesk\AgentRequest; @@ -14,20 +13,16 @@ use App\Model\helpdesk\Agent\Assign_team_agent; use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Groups; use App\Model\helpdesk\Agent\Teams; -use App\Model\helpdesk\Email\Emails; -use App\Model\helpdesk\Settings\Company; -use App\Model\helpdesk\Settings\Email; use App\Model\helpdesk\Utility\Timezones; use App\User; // classes use DB; use Exception; use Hash; -use Mail; /** * AgentController - * This controller is used to CRUD category. + * This controller is used to CRUD Agents. * * @author Ladybird */ @@ -44,8 +39,8 @@ class AgentController extends Controller */ public function __construct(PhpMailController $PhpMailController) { + // creating an instance for the PhpmailController $this->PhpMailController = $PhpMailController; - SettingsController::smtp(); // checking authentication $this->middleware('auth'); // checking admin roles @@ -55,84 +50,89 @@ class AgentController extends Controller /** * Get all agent list page. * - * @param type User $user - * - * @return type Response + * @return type view */ public function index() { try { return view('themes.default1.admin.helpdesk.agent.agents.index'); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } /** * creating a new agent. * - * @param type Assign_team_agent $team_assign_agent - * @param type Timezones $timezone - * @param type Groups $group - * @param type Department $department - * @param type Teams $team + * @param Assign_team_agent $team_assign_agent + * @param Timezones $timezone + * @param Groups $group + * @param Department $department + * @param Teams $team_all * * @return type view */ - public function create(Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) + public function create(Timezones $timezone, Groups $group, Department $department, Teams $team_all) { try { - $team = $team->get(); + // gte all the teams + $team = $team_all->get(); + // get all the timezones $timezones = $timezone->get(); + // get all the groups $groups = $group->get(); + // get all department $departments = $department->get(); + // list all the teams in a single variable $teams = $team->lists('id', 'name'); - + // returns to the page with all the variables and their datas return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team')); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + // returns if try fails with exception meaagse + return redirect()->back()->with('fails', $e->getMessage()); } } /** * store a new agent. * - * @param type User $user - * @param type AgentRequest $request - * @param type Assign_team_agent $team_assign_agent + * @param User $user + * @param AgentRequest $request + * @param Assign_team_agent $team_assign_agent * * @return type Response */ - public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent) + public function store(User $user, AgentRequest $request) { - - // dd($this->system_mail()); - - /* Insert to user table */ - $user->role = 'agent'; + // fixing the user role to agent $user->fill($request->input())->save(); - $password = $this->generateRandomString(); - $user->password = Hash::make($password); + // generate password and has immediately to store + $user->password = Hash::make($this->generateRandomString()); + // fetching all the team details checked for this user $requests = $request->input('team_id'); + // get user id of the inserted user detail $id = $user->id; // insert team foreach ($requests as $req) { - // DB::insert('insert into team_assign_agent (team_id, agent_id) values (?,?)', [$req, $id]); + // insert all the selected team id to the team and agent relationship table + DB::insert('insert into team_assign_agent (team_id, agent_id) values (?,?)', [$req, $id]); } - /* Succes And Failure condition */ + // save user credentails if ($user->save() == true) { + // fetch user credentails to send mail $name = $user->user_name; $email = $user->email; - $system_from = $this->company(); try { // send mail on registration $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); } catch (Exception $e) { + // returns if try fails return redirect('agents')->with('fails', 'Some error occured while sending mail to the agent. Please check email settings and try again'); } - + // returns for the success case return redirect('agents')->with('success', 'Agent Created sucessfully'); } else { + // returns if fails return redirect('agents')->with('fails', 'Agent can not Create'); } } @@ -209,9 +209,11 @@ class AgentController extends Controller /** * Remove the specified agent from storage. * - * @param type int $id - * @param type User $user - * @param type Assign_team_agent $team_assign_agent + * @param type $id + * @param User $user + * @param Assign_team_agent $team_assign_agent + * + * @throws Exception * * @return type Response */ @@ -230,8 +232,6 @@ class AgentController extends Controller return redirect('agents')->with('success', 'Agent Deleted sucessfully'); } catch (\Exception $e) { - dd($e->errorInfo); - return redirect('agents')->with('fails', $error); } } @@ -241,47 +241,21 @@ class AgentController extends Controller * * @param type $length * - * @return type string + * @return string */ public function generateRandomString($length = 10) { + // list of supported characters $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + // character length checked $charactersLength = strlen($characters); + // creating an empty variable for random string $randomString = ''; + // fetching random string for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } - + // return random string return $randomString; } - - /** - * Fetching comapny name to send mail. - * - * @return type - */ - public function company() - { - $company = Company::Where('id', '=', '1')->first(); - if ($company->company_name == null) { - $company = 'Support Center'; - } else { - $company = $company->company_name; - } - - return $company; - } - - /* - * System default email - */ - // public function system_mail() { - // $emails = Emails::all(); - // $count_emails = $emails->count(); - // if($count_emails > 1) { - // dd($emails); - // } - // $email = Email::where('id', '=', '1')->first(); - // return $email->sys_email; - // } } diff --git a/app/Http/Controllers/Admin/helpdesk/BanlistController.php b/app/Http/Controllers/Admin/helpdesk/BanlistController.php index 29b05d4a7..e55849dfc 100644 --- a/app/Http/Controllers/Admin/helpdesk/BanlistController.php +++ b/app/Http/Controllers/Admin/helpdesk/BanlistController.php @@ -39,11 +39,9 @@ class BanlistController extends Controller } /** - * Display a listing of the resource. + * Display a listing of all the banned users. * - * @param type Banlist $ban - * - * @return type Response + * @return type */ public function index() { @@ -57,7 +55,7 @@ class BanlistController extends Controller } /** - * Show the form for creating a new resource. + * Show the form for creating a banned user. * * @return type Response */ @@ -71,11 +69,10 @@ class BanlistController extends Controller } /** - * Store a newly created resource in storage. + * Store a new banned user credentials. * - * @param type banlist $ban - * @param type BanRequest $request - * @param type User $user + * @param BanRequest $request + * @param User $user * * @return type Response */ @@ -107,22 +104,10 @@ class BanlistController extends Controller } /** - * Display the specified resource. + * Editing the details of the banned users. * - * @param int $id - * - * @return Response - */ - public function show($id) - { - // - } - - /** - * Show the form for editing the specified resource. - * - * @param type int $id - * @param type Banlist $ban + * @param type $id + * @param User $ban * * @return type Response */ @@ -138,11 +123,11 @@ class BanlistController extends Controller } /** - * Update the specified resource in storage. + * Update the banned users. * - * @param type int $id - * @param type Banlist $ban - * @param type BanlistRequest $request + * @param type $id + * @param User $ban + * @param BanlistRequest $request * * @return type Response */ @@ -152,7 +137,6 @@ class BanlistController extends Controller $bans = $ban->whereId($id)->first(); $bans->internal_note = $request->input('internal_note'); $bans->ban = $request->input('ban'); - // dd($request->input('ban')); if ($bans->save()) { return redirect('banlist')->with('success', 'Banned Email Updated sucessfully'); } else { @@ -162,22 +146,4 @@ class BanlistController extends Controller return redirect('banlist')->with('fails', 'Banned Email not Updated'); } } - - /* - * Remove the specified resource from storage. - * @param type int $id - * @param type Banlist $ban - * @return type Response - */ - // public function destroy($id, Banlist $ban) { - // $bans = $ban->whereId($id)->first(); - // dd($bans); - // /* Success and Falure condition */ - // try{ - // $bans->delete(); - // return redirect('banlist')->with('success', 'Banned Email Deleted sucessfully'); - // } catch (Exception $e) { - // return redirect('banlist')->with('fails', 'Banned Email can not Delete'.'

  • '.$e->errorInfo[2].'
  • '); - // } - // } } diff --git a/app/Http/Controllers/Admin/helpdesk/EmailsController.php b/app/Http/Controllers/Admin/helpdesk/EmailsController.php index d518e352a..12d3176e2 100644 --- a/app/Http/Controllers/Admin/helpdesk/EmailsController.php +++ b/app/Http/Controllers/Admin/helpdesk/EmailsController.php @@ -7,26 +7,32 @@ use App\Http\Controllers\Controller; // request use App\Http\Requests\helpdesk\EmailsEditRequest; use App\Http\Requests\helpdesk\EmailsRequest; -// model use App\Model\helpdesk\Agent\Department; +// model use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Settings\Email; use App\Model\helpdesk\Ticket\Ticket_Priority; use App\Model\helpdesk\Utility\MailboxProtocol; -// classes use Crypt; +// classes use Exception; +use Illuminate\Http\Request; + +//use PhpImap\Mailbox as ImapMailbox; /** + * ====================================== * EmailsController. + * ====================================== + * This Controller is used to define below mentioned set of functions applied to the Emails in the system. * - * @author Ladybird + * @author Ladybird */ class EmailsController extends Controller { /** - * Create a new controller instance. + * Defining constructor variables. * * @return type */ @@ -37,20 +43,21 @@ class EmailsController extends Controller } /** - * Display a listing of the resource. + * Display a listing of the Emails. * * @param type Emails $emails * - * @return type Response + * @return type view */ - public function index(Emails $emails) + public function index(Emails $email) { try { - $emails = $emails->get(); + // fetch all the emails from emails table + $emails = $email->get(); return view('themes.default1.admin.helpdesk.emails.emails.index', compact('emails')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -64,81 +71,155 @@ class EmailsController extends Controller * * @return type Response */ - public function create(Department $department, Help_topic $help, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) + public function create(Department $department, Help_topic $help, Ticket_Priority $ticket_priority, MailboxProtocol $mailbox_protocol) { try { + // fetch all the departments from the department table $departments = $department->get(); + // fetch all the helptopics from the helptopic table $helps = $help->get(); - $priority = $priority->get(); + // fetch all the types of priority from the ticket_priority table + $priority = $ticket_priority->get(); + // fetch all the types of mailbox protocols from the mailbox_protocols table $mailbox_protocols = $mailbox_protocol->get(); - + // return with all the table data return view('themes.default1.admin.helpdesk.emails.emails.create', compact('mailbox_protocols', 'priority', 'departments', 'helps')); } catch (Exception $e) { - return view('404'); + // return error messages if any + return redirect()->back()->with('fails', $e->getMessage()); } } + /** + * Check for email input validation. + * + * @param EmailsRequest $request + * + * @return int + */ + public function validatingEmailSettings(Request $request) + { + $validator = \Validator::make( + [ + 'email_address' => $request->email_address, + 'email_name' => $request->email_name, + 'password' => $request->password, + ], [ + 'email_address' => 'required|email|unique:emails', + 'email_name' => 'required', + 'password' => 'required', + ] + ); + if ($validator->fails()) { + $jsons = $validator->messages(); + $val = ''; + foreach ($jsons->all() as $key => $value) { + $val .= $value; + } + $return_data = rtrim(str_replace('.', ',', $val), ','); + + return $return_data; + } + if ($request->fetching_status == 'on') { + $imap_check = $this->getImapStream($request); + if ($imap_check == 0) { + return 'Incoming email connection failed'; + } + $need_to_check_imap = 1; + } else { + $imap_check = 0; + $need_to_check_imap = 0; + } + if ($request->sending_status == 'on') { + $smtp_check = $this->getSmtp($request); + if ($smtp_check == 0) { + return 'Outgoing email connection failed'; + } + $need_to_check_smtp = 1; + } else { + $smtp_check = 0; + $need_to_check_smtp = 0; + } + + if ($need_to_check_imap == 1 && $need_to_check_smtp == 1) { + if ($imap_check != 0 && $smtp_check != 0) { + $this->store($request); + $return = 1; + } + } elseif ($need_to_check_imap == 1 && $need_to_check_smtp == 0) { + if ($imap_check != 0 && $smtp_check == 0) { + $this->store($request); + $return = 1; + } + } elseif ($need_to_check_imap == 0 && $need_to_check_smtp == 1) { + if ($imap_check == 0 && $smtp_check != 0) { + $this->store($request); + $return = 1; + } + } elseif ($need_to_check_imap == 0 && $need_to_check_smtp == 0) { + if ($imap_check == 0 && $smtp_check == 0) { + $this->store($request, null); + $return = 1; + } + } + + return $return; + } + /** * Store a newly created resource in storage. * * @param type Emails $email * @param type EmailsRequest $request * - * @return type Response + * @return type Redirect */ - public function store(Emails $email, EmailsRequest $request) + public function store($request) { + // dd($request); + $email = new Emails(); try { - $password = $request->input('password'); - $encrypted = Crypt::encrypt($password); - $department = $request->input('department'); - $priority = $request->input('priority'); - $help_topic = $request->input('help_topic'); - - if ($email->fill($request->except('password', 'department', 'priority', 'help_topic'))->save() == true) { - if ($request->input('department')) { - $email->department = $request->input('department'); + // getConnection($request->input('email_name'), $request->input('email_address'), $request->input('email_address')) + // saving all the fields to the database + if ($email->fill($request->except('password', 'department', 'priority', 'help_topic', 'fetching_status', 'sending_status'))->save() == true) { + if ($request->fetching_status == 'on') { + $email->fetching_status = 1; } else { - $email->department = null; + $email->fetching_status = 0; } - if ($request->input('priority')) { - $email->priority = $request->input('priority'); + if ($request->sending_status == 'on') { + $email->sending_status = 1; } else { - $email->priority = null; + $email->sending_status = 0; } - if ($request->input('help_topic')) { - $email->help_topic = $request->input('help_topic'); - } else { - $email->help_topic = null; - } - $email->password = $encrypted; - $email->save(); - + // fetching department value + $email->department = $this->departmentValue($request->input('department')); + // fetching priority value + $email->priority = $this->priorityValue($request->input('priority')); + // fetching helptopic value + $email->help_topic = $this->helpTopicValue($request->input('help_topic')); + // inserting the encrypted value of password + $email->password = Crypt::encrypt($request->input('password')); + $email->save(); // run save + // Creating a default system email as the first email is inserted to the system $email_settings = Email::where('id', '=', '1')->first(); $email_settings->sys_email = $email->id; $email_settings->save(); - - return redirect('emails')->with('success', 'Email Created sucessfully'); + // returns success message for successful email creation +// return redirect('emails')->with('success', 'Email Created sucessfully'); + return 1; } else { - return redirect('emails')->with('fails', 'Email can not Create'); + // returns fail message for unsuccessful save execution +// return redirect('emails')->with('fails', 'Email can not Create'); + return 0; } } catch (Exception $e) { - return redirect('emails')->with('fails', 'Email can not Create'); + // returns if try fails +// return redirect()->back()->with('fails', $e->getMessage()); + return 0; } } - /** - * Display the specified resource. - * - * @param int $id - * - * @return Response - */ - public function show($id) - { - // - } - /** * Show the form for editing the specified resource. * @@ -151,21 +232,104 @@ class EmailsController extends Controller * * @return type Response */ - public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $priority, MailboxProtocol $mailbox_protocol) + public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $ticket_priority, MailboxProtocol $mailbox_protocol) { try { + // fetch the selected emails $emails = $email->whereId($id)->first(); + // get all the departments $departments = $department->get(); + // get all the helptopic $helps = $help->get(); - $priority = $priority->get(); + // get all the priority + $priority = $ticket_priority->get(); + // get all the mailbox protocols $mailbox_protocols = $mailbox_protocol->get(); - + // return if the execution is succeeded return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails')); } catch (Exception $e) { - return view('404'); + // return if try fails + return redirect()->back()->with('fails', $e->getMessage()); } } + /** + * Check for email input validation. + * + * @param EmailsRequest $request + * + * @return int + */ + public function validatingEmailSettingsUpdate($id, Request $request) + { + $validator = \Validator::make( + [ + 'email_address' => $request->email_address, + 'email_name' => $request->email_name, + 'password' => $request->password, + ], [ + 'email_address' => 'email', + 'email_name' => 'required', + 'password' => 'required', + ] + ); + if ($validator->fails()) { + $jsons = $validator->messages(); + $val = ''; + foreach ($jsons->all() as $key => $value) { + $val .= $value; + } + $return_data = rtrim(str_replace('.', ',', $val), ','); + + return $return_data; + } +// return $request; + if ($request->fetching_status == 'on') { + $imap_check = $this->getImapStream($request); + if ($imap_check == 0) { + return 'Incoming email connection failed'; + } + $need_to_check_imap = 1; + } else { + $imap_check = 0; + $need_to_check_imap = 0; + } + if ($request->sending_status == 'on') { + $smtp_check = $this->getSmtp($request); + if ($smtp_check == 0) { + return 'Outgoing email connection failed'; + } + $need_to_check_smtp = 1; + } else { + $smtp_check = 0; + $need_to_check_smtp = 0; + } + + if ($need_to_check_imap == 1 && $need_to_check_smtp == 1) { + if ($imap_check != 0 && $smtp_check != 0) { + $this->update($id, $request); + $return = 1; + } + } elseif ($need_to_check_imap == 1 && $need_to_check_smtp == 0) { + if ($imap_check != 0 && $smtp_check == 0) { + $this->update($id, $request); + $return = 1; + } + } elseif ($need_to_check_imap == 0 && $need_to_check_smtp == 1) { + if ($imap_check == 0 && $smtp_check != 0) { + $this->update($id, $request); + $return = 1; + } + } elseif ($need_to_check_imap == 0 && $need_to_check_smtp == 0) { + if ($imap_check == 0 && $smtp_check == 0) { + $this->update($id, $request); + $return = 1; + } + } + + return $return; + } + /** * Update the specified resource in storage. * @@ -175,39 +339,40 @@ class EmailsController extends Controller * * @return type Response */ - public function update($id, Emails $email, EmailsEditRequest $request) + public function update($id, $request) { - $password = $request->input('password'); - $encrypted = Crypt::encrypt($password); - //echo $encrypted; - //$value = Crypt::decrypt($encrypted); - //echo $value; try { - $emails = $email->whereId($id)->first(); - // $emails->password = $encrypted; - $emails->fill($request->except('password', 'department', 'priority', 'help_topic'))->save(); - if ($request->input('department')) { - $emails->department = $request->input('department'); + // fetch the selected emails + $emails = Emails::whereId($id)->first(); + // insert all the requested parameters with except + $emails->fill($request->except('password', 'department', 'priority', 'help_topic', 'fetching_status', 'sending_status'))->save(); + if ($request->fetching_status == 'on') { + $emails->fetching_status = 1; } else { - $emails->department = null; + $emails->fetching_status = 0; } - if ($request->input('priority')) { - $emails->priority = $request->input('priority'); + if ($request->sending_status == 'on') { + $emails->sending_status = 1; } else { - $emails->priority = null; + $emails->sending_status = 0; } - if ($request->input('help_topic')) { - $emails->help_topic = $request->input('help_topic'); - } else { - $emails->help_topic = null; - } - $emails->password = $encrypted; + // fetching department value + $emails->department = $this->departmentValue($request->input('department')); + // fetching priority value + $emails->priority = $this->priorityValue($request->input('priority')); + // fetching helptopic value + $emails->help_topic = $this->helpTopicValue($request->input('help_topic')); + // inserting the encrypted value of password + $emails->password = Crypt::encrypt($request->input('password')); $emails->save(); - - return redirect('emails')->with('success', 'Email Updated sucessfully'); + // returns success message for successful email update + $return = 1; } catch (Exception $e) { - return redirect('emails')->with('fails', 'Email not updated'); + // returns if try fails + $return = $e->getMessage(); } + + return $return; } /** @@ -216,25 +381,168 @@ class EmailsController extends Controller * @param type int $id * @param type Emails $email * - * @return type Response + * @return type Redirect */ public function destroy($id, Emails $email) { + // fetching the details on the basis of the $id passed to the function $default_system_email = Email::where('id', '=', '1')->first(); if ($default_system_email->sys_email) { + // checking if the default system email is the passed email if ($id == $default_system_email->sys_email) { return redirect('emails')->with('fails', 'You cannot delete system default Email'); } } try { + // fetching the database instance of the current email $emails = $email->whereId($id)->first(); + // checking if deleting the email is success or if it's carrying any dependencies if ($emails->delete() == true) { return redirect('emails')->with('success', 'Email Deleted sucessfully'); } else { return redirect('emails')->with('fails', 'Email can not Delete '); } } catch (Exception $e) { - return redirect('emails')->with('fails', 'Email can not Delete '); + // returns if the try fails + return redirect()->back()->with('fails', $e->getMessage()); } } + + /** + * Create imap connection. + * + * @param type $request + * + * @return type int + */ + public function getImapStream($request) + { + $fetching_status = $request->input('fetching_status'); + $username = $request->input('email_address'); + $password = $request->input('password'); + $protocol_id = $request->input('mailbox_protocol'); + $fetching_protocol = '/'.$request->input('fetching_protocol'); + $fetching_encryption = '/'.$request->input('fetching_encryption'); + if ($fetching_encryption == 'none') { + $fetching_encryption = 'novalidate-cert'; + } + $mailbox_protocol = $fetching_protocol.$fetching_encryption; + $host = $request->input('fetching_host'); + $port = $request->input('fetching_port'); + $mailbox = '{'.$host.':'.$port.$mailbox_protocol.'}INBOX'; + try { + $imap_stream = imap_open($mailbox, $username, $password); + } catch (\Exception $ex) { + return $ex->getMessage(); + } + $imap_stream = imap_open($mailbox, $username, $password); + if ($imap_stream) { + $return = 1; + } else { + $return = 0; + } + + return $return; + } + + /** + * Check connection. + * + * @param type $imap_stream + * + * @return type int + */ + public function checkImapStream($imap_stream) + { + $check_imap_stream = imap_check($imap_stream); + if ($check_imap_stream) { + $imap_stream = 1; + } else { + $imap_stream = 0; + } + + return $imap_stream; + } + + /** + * Get smtp connection. + * + * @param type $request + * + * @return int + */ + public function getSmtp($request) + { + $sending_status = $request->input('sending_status'); + $mail = new \PHPMailer(); + $mail->isSMTP(); + $mail->Host = $request->input('sending_host'); + $mail->SMTPAuth = true; // Enable SMTP authentication + $mail->Username = $request->input('email_address'); + $mail->Password = $request->input('password'); + $mail->SMTPSecure = $request->input('sending_encryption'); + $mail->Port = $request->input('sending_port'); + if ($mail->smtpConnect() == true) { + $mail->smtpClose(); + $return = 1; + } else { + $return = 0; + } + + return $return; + } + + /** + * Checking if department value is null. + * + * @param type $dept + * + * @return type string or null + */ + public function departmentValue($dept) + { + if ($dept) { + $email_department = $dept; + } else { + $email_department = null; + } + + return $email_department; + } + + /** + * Checking if priority value is null. + * + * @param type $priority + * + * @return type string or null + */ + public function priorityValue($priority) + { + if ($priority) { + $email_priority = $priority; + } else { + $email_priority = null; + } + + return $email_priority; + } + + /** + * Checking if helptopic value is null. + * + * @param type $help_topic + * + * @return type string or null + */ + public function helpTopicValue($help_topic) + { + if ($help_topic) { + $email_help_topic = $help_topic; + } else { + $email_help_topic = null; + } + + return $email_help_topic; + } } diff --git a/app/Http/Controllers/Admin/helpdesk/TemplateController.php b/app/Http/Controllers/Admin/helpdesk/TemplateController.php index 02c639377..0547b6076 100644 --- a/app/Http/Controllers/Admin/helpdesk/TemplateController.php +++ b/app/Http/Controllers/Admin/helpdesk/TemplateController.php @@ -24,15 +24,14 @@ use Mail; * * @author Ladybird */ -class TemplateController extends Controller -{ +class TemplateController extends Controller { + /** * Create a new controller instance. * * @return type void */ - public function __construct(PhpMailController $PhpMailController) - { + public function __construct(PhpMailController $PhpMailController) { $this->PhpMailController = $PhpMailController; SettingsController::smtp(); $this->middleware('auth'); @@ -46,8 +45,7 @@ class TemplateController extends Controller * * @return type Response */ - public function index(Template $template) - { + public function index(Template $template) { try { $templates = $template->get(); @@ -65,8 +63,7 @@ class TemplateController extends Controller * * @return type Response */ - public function create(Languages $language, Template $template) - { + public function create(Languages $language, Template $template) { try { $templates = $template->get(); $languages = $language->get(); @@ -85,8 +82,7 @@ class TemplateController extends Controller * * @return type Response */ - public function store(Template $template, TemplateRequest $request) - { + public function store(Template $template, TemplateRequest $request) { try { /* Check whether function success or not */ if ($template->fill($request->input())->save() == true) { @@ -109,8 +105,7 @@ class TemplateController extends Controller * * @return Response */ - public function show($id) - { + public function show($id) { // } @@ -123,8 +118,7 @@ class TemplateController extends Controller * * @return type Response */ - public function listdirectories() - { + public function listdirectories() { $path = '../resources/views/emails/'; $directories = scandir($path); $directory = str_replace('/', '-', $path); @@ -132,32 +126,29 @@ class TemplateController extends Controller return view('themes.default1.admin.helpdesk.emails.template.listdirectories', compact('directories', 'directory')); } - public function listtemplates($template, $path) - { + public function listtemplates($template, $path) { $paths = str_replace('-', '/', $path); - $directory2 = $paths.$template; + $directory2 = $paths . $template; $templates = scandir($directory2); - $directory = str_replace('/', '-', $directory2.'/'); + $directory = str_replace('/', '-', $directory2 . '/'); return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates', 'directory')); } - public function readtemplate($template, $path) - { + public function readtemplate($template, $path) { $directory = str_replace('-', '/', $path); - $handle = fopen($directory.$template, 'r'); - $contents = fread($handle, filesize($directory.$template)); + $handle = fopen($directory . $template, 'r'); + $contents = fread($handle, filesize($directory . $template)); fclose($handle); return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents', 'template', 'path')); } - public function createtemplate() - { + public function createtemplate() { $directory = '../resources/views/emails/'; $fname = Input::get('folder_name'); - $filename = $directory.$fname; + $filename = $directory . $fname; // images folder creation using php // $mydir = dirname( __FILE__ )."/html/images"; @@ -169,7 +160,7 @@ class TemplateController extends Controller if (!file_exists($filename)) { mkdir($filename, 0777); } - $files = array_filter(scandir($directory.'default')); + $files = array_filter(scandir($directory . 'default')); foreach ($files as $file) { if ($file === '.' or $file === '..') { @@ -177,29 +168,27 @@ class TemplateController extends Controller } if (!is_dir($file)) { // $file_to_go = str_replace("code/resources/views/emails/",'code/resources/views/emails/'.$fname,$file); - $destination = $directory.$fname.'/'; + $destination = $directory . $fname . '/'; - copy($directory.'default/'.$file, $destination.$file); + copy($directory . 'default/' . $file, $destination . $file); } } return \Redirect::back()->with('success', 'Successfully copied'); } - public function writetemplate($template, $path) - { + public function writetemplate($template, $path) { $directory = str_replace('-', '/', $path); $b = Input::get('templatedata'); - file_put_contents($directory.$template, print_r($b, true)); + file_put_contents($directory . $template, print_r($b, true)); return \Redirect::back()->with('success', 'Successfully updated'); } - public function deletetemplate($template, $path) - { + public function deletetemplate($template, $path) { $directory = str_replace('-', '/', $path); - $dir = $directory.$template; + $dir = $directory . $template; $status = \DB::table('settings_email')->first(); if ($template == 'default' or $template == $status->template) { return \Redirect::back()->with('fails', 'You cannot delete a default or active directory!'); @@ -208,7 +197,7 @@ class TemplateController extends Controller $objects = scandir($dir); foreach ($objects as $object) { if ($object != '.' && $object != '..') { - unlink($dir.'/'.$object); + unlink($dir . '/' . $object); } } rmdir($dir); @@ -219,15 +208,13 @@ class TemplateController extends Controller return \Redirect::back()->with('success', 'Successfully Deleted'); } - public function activateset($setname) - { + public function activateset($setname) { \DB::table('settings_email')->update(['template' => $setname]); return \Redirect::back()->with('success', 'You have Successfully Activated this Set'); } - public function edit($id, Template $template, Languages $language) - { + public function edit($id, Template $template, Languages $language) { try { $templates = $template->whereId($id)->first(); $languages = $language->get(); @@ -247,8 +234,7 @@ class TemplateController extends Controller * * @return type Response */ - public function update($id, Template $template, TemplateUdate $request) - { + public function update($id, Template $template, TemplateUdate $request) { try { //TODO validation $templates = $template->whereId($id)->first(); @@ -274,8 +260,7 @@ class TemplateController extends Controller * * @return type Response */ - public function destroy($id, Template $template) - { + public function destroy($id, Template $template) { try { $templates = $template->whereId($id)->first(); /* Check whether function success or not */ @@ -299,8 +284,7 @@ class TemplateController extends Controller * * @return type Response */ - public function formDiagno(Emails $email) - { + public function formDiagno(Emails $email) { try { $emails = $email->get(); @@ -317,15 +301,21 @@ class TemplateController extends Controller * * @return type */ - public function postDiagno(Request $request) - { + public function postDiagno(Request $request) { $email = $request->input('to'); if ($email == null) { return redirect('getdiagno')->with('fails', 'Please provide E-mail address !'); } // sending mail via php mailer - $mail = $this->PhpMailController->sendmail($from = 1, $to = ['email' => $email], $message = ['subject' => 'Checking the connection', 'scenario' => 'error-report', 'content' => 'Email Received Successfully'], $template_variables = ['system_error' => 'hello']); + $mail = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['email' => $email], $message = ['subject' => 'Checking the connection', 'scenario' => 'error-report', 'content' => 'Email Received Successfully'], $template_variables = ['system_error' => 'hello']); - return redirect('getdiagno')->with('success', 'Please check your mail. An E-mail has been sent to your E-mail address'); + if($mail == null){ + return redirect('getdiagno')->with('fails', 'Please check your E-mail settings. Unable to send mails'); + } else { + return redirect('getdiagno')->with('success', 'Please check your mail. An E-mail has been sent to your E-mail address'); + } + + } + } diff --git a/app/Http/Controllers/Agent/helpdesk/MailController.php b/app/Http/Controllers/Agent/helpdesk/MailController.php index d0901da4c..283957e3f 100644 --- a/app/Http/Controllers/Agent/helpdesk/MailController.php +++ b/app/Http/Controllers/Agent/helpdesk/MailController.php @@ -51,137 +51,142 @@ class MailController extends Controller if ($settings_email->first()->email_fetching == 1) { if ($settings_email->first()->all_emails == 1) { // $helptopic = $this->TicketController->default_helptopic(); - // $sla = $this->TicketController->default_sla(); +// $sla = $this->TicketController->default_sla(); $email = $emails->get(); foreach ($email as $e_mail) { - $priority = $e_mail->priority; - $dept = $e_mail->department; - $helptopic = $e_mail->help_topic; - - if ($priority == null) { - $priority = $ticket->first()->priority; - } - - if ($dept == null) { - $dept = $system->first()->department; - } - - if ($helptopic == null) { - $helptopic = $ticket->first()->help_topic; - } - // dd($dept); - - $get_helptopic = Help_topic::where('id', '=', $helptopic)->first(); - $sla = $get_helptopic->sla_plan; - // $dept = $e_mail->department; - $host = $e_mail->fetching_host; - $port = $e_mail->fetching_port; - $protocol = $e_mail->mailbox_protocol; - $get_mailboxprotocol = MailboxProtocol::where('id', '=', $protocol)->first(); - $protocol = $get_mailboxprotocol->value; - $imap_config = '{'.$host.':'.$port.$protocol.'}INBOX'; - $password = Crypt::decrypt($e_mail->password); - $mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__); - $mails = []; - $mailsIds = $mailbox->searchMailBox('SINCE '.date('d-M-Y', strtotime('-1 day'))); - if (!$mailsIds) { - die('Mailbox is empty'); - } - foreach ($mailsIds as $mailId) { - $overview = $mailbox->get_overview($mailId); - $var = $overview[0]->seen ? 'read' : 'unread'; - if ($var == 'unread') { - $mail = $mailbox->getMail($mailId); - if ($settings_email->first()->email_collaborator == 1) { - $collaborator = $mail->cc; + if ($e_mail->fetching_status == 1) { + $priority = $e_mail->priority; + $dept = $e_mail->department; + $helptopic = $e_mail->help_topic; + if ($priority == null) { + $priority = $ticket->first()->priority; + } + if ($dept == null) { + $dept = $system->first()->department; + } + if ($helptopic == null) { + $helptopic = $ticket->first()->help_topic; + } + $get_helptopic = Help_topic::where('id', '=', $helptopic)->first(); + $sla = $get_helptopic->sla_plan; + $host = $e_mail->fetching_host; + $port = $e_mail->fetching_port; + if ($e_mail->mailbox_protocol) { + $protocol_value = $e_mail->mailbox_protocol; + $get_mailboxprotocol = MailboxProtocol::where('id', '=', $protocol_value)->first(); + $protocol = $get_mailboxprotocol->value; + } else { + if ($e_mail->fetching_protocol) { + $fetching_protocol = '/'.$e_mail->fetching_protocol; } else { - $collaborator = null; + $fetching_protocol = ''; } - $body = $mail->textHtml; - if ($body == null) { - $body = $mailbox->backup_getmail($mailId); - $body = str_replace('\r\n', '
    ', $body); - // var_dump($body); - } - $date = $mail->date; - $datetime = $overview[0]->date; - $date_time = explode(' ', $datetime); - $date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4]; - $date = date('Y-m-d H:i:s', strtotime($date)); - // dd($date); - - if (isset($mail->subject)) { - $subject = $mail->subject; + if ($e_mail->fetching_encryption) { + $fetching_encryption = '/'.$e_mail->fetching_encryption; } else { - $subject = 'No Subject'; + $fetching_encryption = ''; } + $protocol = $fetching_protocol.$fetching_encryption; + } + $imap_config = '{'.$host.':'.$port.$protocol.'}INBOX'; + $password = Crypt::decrypt($e_mail->password); + $mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__); + $mails = []; + $mailsIds = $mailbox->searchMailBox('SINCE '.date('d-M-Y', strtotime('-1 day'))); + if (!$mailsIds) { + die('Mailbox is empty'); + } + foreach ($mailsIds as $mailId) { + $overview = $mailbox->get_overview($mailId); + $var = $overview[0]->seen ? 'read' : 'unread'; + if ($var == 'unread') { + $mail = $mailbox->getMail($mailId); + if ($settings_email->first()->email_collaborator == 1) { + $collaborator = $mail->cc; + } else { + $collaborator = null; + } + $body = $mail->textHtml; + if ($body == null) { + $body = $mailbox->backup_getmail($mailId); + $body = str_replace('\r\n', '
    ', $body); + } + $date = $mail->date; + $datetime = $overview[0]->date; + $date_time = explode(' ', $datetime); + $date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4]; + $date = date('Y-m-d H:i:s', strtotime($date)); + if (isset($mail->subject)) { + $subject = $mail->subject; + } else { + $subject = 'No Subject'; + } + $fromname = $mail->fromName; + $fromaddress = $mail->fromAddress; + $ticket_source = Ticket_source::where('name', '=', 'email')->first(); + $source = $ticket_source->id; + $phone = ''; - // dd($subject); - $fromname = $mail->fromName; - $fromaddress = $mail->fromAddress; - $ticket_source = Ticket_source::where('name', '=', 'email')->first(); - $source = $ticket_source->id; - $phone = ''; + $assign = $get_helptopic->auto_assign; + $form_data = null; + $result = $this->TicketController->create_user($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $form_data); +// dd($result); + if ($result[1] == true) { + $ticket_table = Tickets::where('ticket_number', '=', $result[0])->first(); + $thread_id = Ticket_Thread::where('ticket_id', '=', $ticket_table->id)->max('id'); +// $thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first(); + $thread_id = $thread_id; - $assign = $get_helptopic->auto_assign; - $form_data = null; - $result = $this->TicketController->create_user($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $form_data); - // dd($result); - if ($result[1] == true) { - $ticket_table = Tickets::where('ticket_number', '=', $result[0])->first(); - $thread_id = Ticket_Thread::where('ticket_id', '=', $ticket_table->id)->max('id'); - // $thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first(); - $thread_id = $thread_id; + foreach ($mail->getAttachments() as $attachment) { + $support = 'support'; +// echo $_SERVER['DOCUMENT_ROOT']; + $dir_img_paths = __DIR__; + $dir_img_path = explode('/code', $dir_img_paths); +// dd($attachment->filePath); + $filepath = explode('../../../../../public', $attachment->filePath); +// var_dump($attachment->filePath); +// dd($filepath); +// $path = $dir_img_path[0]."/code/public/".$filepath[1]; + $path = public_path().$filepath[1]; +// dd($path); + $filesize = filesize($path); + $file_data = file_get_contents($path); + $ext = pathinfo($attachment->filePath, PATHINFO_EXTENSION); + $imageid = $attachment->id; + $string = str_replace('-', '', $attachment->name); + $filename = explode('src', $attachment->filePath); + $filename = str_replace('\\', '', $filename); + $body = str_replace('cid:'.$imageid, $filepath[1], $body); + $pos = strpos($body, $filepath[1]); - foreach ($mail->getAttachments() as $attachment) { - $support = 'support'; - // echo $_SERVER['DOCUMENT_ROOT']; - $dir_img_paths = __DIR__; - $dir_img_path = explode('/code', $dir_img_paths); - // dd($attachment->filePath); - $filepath = explode('../../../../../public', $attachment->filePath); - // var_dump($attachment->filePath); - // dd($filepath); - // $path = $dir_img_path[0]."/code/public/".$filepath[1]; - $path = public_path().$filepath[1]; - // dd($path); - $filesize = filesize($path); - $file_data = file_get_contents($path); - $ext = pathinfo($attachment->filePath, PATHINFO_EXTENSION); - $imageid = $attachment->id; - $string = str_replace('-', '', $attachment->name); - $filename = explode('src', $attachment->filePath); - $filename = str_replace('\\', '', $filename); - $body = str_replace('cid:'.$imageid, $filepath[1], $body); - $pos = strpos($body, $filepath[1]); - - if ($pos == false) { - if ($settings_email->first()->attachment == 1) { + if ($pos == false) { + if ($settings_email->first()->attachment == 1) { + $upload = new Ticket_attachments(); + $upload->file = $file_data; + $upload->thread_id = $thread_id; + $upload->name = $filepath[1]; + $upload->type = $ext; + $upload->size = $filesize; + $upload->poster = 'ATTACHMENT'; + $upload->save(); + } + } else { $upload = new Ticket_attachments(); $upload->file = $file_data; $upload->thread_id = $thread_id; $upload->name = $filepath[1]; $upload->type = $ext; $upload->size = $filesize; - $upload->poster = 'ATTACHMENT'; + $upload->poster = 'INLINE'; $upload->save(); } - } else { - $upload = new Ticket_attachments(); - $upload->file = $file_data; - $upload->thread_id = $thread_id; - $upload->name = $filepath[1]; - $upload->type = $ext; - $upload->size = $filesize; - $upload->poster = 'INLINE'; - $upload->save(); + unlink($path); } - unlink($path); + $body = Encoding::fixUTF8($body); + $thread = Ticket_Thread::where('id', '=', $thread_id)->first(); + $thread->body = $this->separate_reply($body); + $thread->save(); } - $body = Encoding::fixUTF8($body); - $thread = Ticket_Thread::where('id', '=', $thread_id)->first(); - $thread->body = $this->separate_reply($body); - $thread->save(); } } } diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php index 52eaa34ea..1a576464c 100644 --- a/app/Http/Controllers/Agent/helpdesk/TicketController.php +++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php @@ -81,7 +81,7 @@ class TicketController extends Controller return \Datatable::collection(new Collection($tickets)) ->addColumn('id', function ($ticket) { - return ""; + return ""; }) ->addColumn('subject', function ($ticket) { $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); @@ -102,11 +102,10 @@ class TicketController extends Controller } else { $collabString = null; } - // dd($ticket->id); + $threads = Ticket_Thread::where('ticket_id', '=', $ticket->id)->first(); // $count = Ticket_Thread::where('ticket_id', '=', $ticket->id)->count(); //Ticket_Thread::where('ticket_id', '=', $ticket->id)->get(); - // $count = count($threads); - // dd($threads); + $attachment = Ticket_attachments::where('thread_id', '=', $threads->id)->get(); $attachCount = count($attachment); if ($attachCount > 0) { @@ -114,7 +113,6 @@ class TicketController extends Controller } else { $attachString = ''; } - //return $threads->id; return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString; }) @@ -125,7 +123,6 @@ class TicketController extends Controller $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first(); return ''.$priority->priority_desc.''; - //return "loda"; }) ->addColumn('from', function ($ticket) { $from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); @@ -182,20 +179,15 @@ class TicketController extends Controller public function get_open() { if (Auth::user()->role == 'admin') { - // $tickets = Tickets::where('status','=',1)->get();; - - $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', 0)->get(); + $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->get(); } else { - // $dept = DB::table('department')->where('name','=',Auth::user()->primary_dpt)->first(); - // $tickets = Tickets::where('status',1)->where('dept_id', '=', $dept->id)->get(); - $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); - $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', 0)->where('dept_id', '=', $dept->id)->get(); + $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('dept_id', '=', $dept->id)->get(); } return \Datatable::collection(new Collection($tickets)) ->addColumn('id', function ($ticket) { - return ""; + return ""; }) ->addColumn('subject', function ($ticket) { $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); @@ -225,7 +217,6 @@ class TicketController extends Controller } else { $attachString = ''; } - //return $threads->id; return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString; }) @@ -236,7 +227,6 @@ class TicketController extends Controller $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first(); return ''.$priority->priority_desc.''; - //return "loda"; }) ->addColumn('from', function ($ticket) { $from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); @@ -244,7 +234,7 @@ class TicketController extends Controller return "".$from->user_name.''; }) ->addColumn('Last Replier', function ($ticket) { - $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id'); + $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->where('is_internal', '=', 0)->max('id'); $TicketDatarow = Ticket_Thread::where('id', '=', $TicketData)->first(); $LastResponse = User::where('id', '=', $TicketDatarow->user_id)->first(); if ($LastResponse->role == 'user') { @@ -273,7 +263,6 @@ class TicketController extends Controller $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id'); $TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); - // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at)); return UTC::usertimezone($TicketDatarow->updated_at); }) ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') @@ -294,20 +283,15 @@ class TicketController extends Controller public function get_answered() { if (Auth::user()->role == 'admin') { - // $tickets = Tickets::where('status', '=', 1)->where('assigned_to', '=', Auth::user()->id)->get(); - $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 1)->get(); } else { - // $dept = Department::where('name','=',Auth::user()->primary_dpt)->first(); - // $tickets = Tickets::where('status', '=', 1)->where('assigned_to', '=', Auth::user()->id)->get(); - $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 1)->where('dept_id', '=', $dept->id)->get(); } return \Datatable::collection(new Collection($tickets)) ->addColumn('id', function ($ticket) { - return ""; + return ""; }) ->addColumn('subject', function ($ticket) { $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); @@ -337,7 +321,6 @@ class TicketController extends Controller } else { $attachString = ''; } - //return $threads->id; return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString; }) @@ -348,7 +331,6 @@ class TicketController extends Controller $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first(); return ''.$priority->priority_desc.''; - //return "loda"; }) ->addColumn('from', function ($ticket) { $from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); @@ -385,7 +367,6 @@ class TicketController extends Controller $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id'); $TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); - // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at)); return UTC::usertimezone($TicketDatarow->updated_at); }) ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') @@ -414,7 +395,7 @@ class TicketController extends Controller return \Datatable::collection(new Collection($tickets)) ->addColumn('id', function ($ticket) { - return ""; + return ""; }) ->addColumn('subject', function ($ticket) { $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); @@ -444,7 +425,6 @@ class TicketController extends Controller } else { $attachString = ''; } - //return $threads->id; return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString; }) @@ -455,7 +435,6 @@ class TicketController extends Controller $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first(); return ''.$priority->priority_desc.''; - //return "loda"; }) ->addColumn('from', function ($ticket) { $from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); @@ -492,7 +471,6 @@ class TicketController extends Controller $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id'); $TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); - // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at)); return UTC::usertimezone($TicketDatarow->updated_at); }) ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') @@ -531,7 +509,7 @@ class TicketController extends Controller return \Datatable::collection(new Collection($tickets)) ->addColumn('id', function ($ticket) { - return ""; + return ""; }) ->addColumn('subject', function ($ticket) { $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); @@ -561,7 +539,7 @@ class TicketController extends Controller } else { $attachString = ''; } - //return $threads->id; + return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString; }) ->addColumn('ticket_number', function ($ticket) { @@ -571,7 +549,6 @@ class TicketController extends Controller $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first(); return ''.$priority->priority_desc.''; - //return "loda"; }) ->addColumn('from', function ($ticket) { $from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); @@ -608,7 +585,6 @@ class TicketController extends Controller $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id'); $TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); - // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at)); return UTC::usertimezone($TicketDatarow->updated_at); }) ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') @@ -637,7 +613,7 @@ class TicketController extends Controller return \Datatable::collection(new Collection($tickets)) ->addColumn('id', function ($ticket) { - return ""; + return ""; }) ->addColumn('subject', function ($ticket) { $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); @@ -667,7 +643,6 @@ class TicketController extends Controller } else { $attachString = ''; } - //return $threads->id; return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString; }) @@ -678,7 +653,6 @@ class TicketController extends Controller $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first(); return ''.$priority->priority_desc.''; - //return "loda"; }) ->addColumn('from', function ($ticket) { $from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); @@ -715,7 +689,6 @@ class TicketController extends Controller $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id'); $TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); - // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at)); return UTC::usertimezone($TicketDatarow->updated_at); }) ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') @@ -768,8 +741,6 @@ class TicketController extends Controller return Redirect('newticket')->with('fails', 'fails'); } } catch (Exception $e) { - // dd($e); - return Redirect()->back()->with('fails', '
  • '.$e->errorInfo.'
  • '); } } @@ -783,21 +754,6 @@ class TicketController extends Controller */ public function thread($id) { - /* $lock = Tickets::where('id','=',$id)->first(); - if($lock->lock_by == Auth::user()->id || $lock->lock_at < date('Y-m-d H:i:s', strtotime('-3 minutes', strtotime($lock->lock_at)))) { - if(Auth::user()->role == 'agent'){ - - $dept = Department::where('id','=',Auth::user()->primary_dpt)->first(); - - $tickets = Tickets::where('id', '=', $id)->where('dept_id','=', $dept->id)->first(); - } else { - $tickets = Tickets::where('id', '=', $id)->first(); - } - $thread = Ticket_Thread::where('ticket_id', '=', $id)->first(); - return view('themes.default1.agent.helpdesk.ticket.timeline', compact('tickets'), compact('thread')); - } else { - return Redirect()->back()->with('fails', 'This ticket has been locked by other agent'); - } */ if (Auth::user()->role == 'agent') { $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); @@ -807,11 +763,11 @@ class TicketController extends Controller } elseif (Auth::user()->role == 'user') { $thread = Ticket_Thread::where('ticket_id', '=', $id)->first(); $ticket_id = \Crypt::encrypt($id); - // dd($ticket_id); + return redirect()->route('check_ticket', compact('ticket_id')); } $thread = Ticket_Thread::where('ticket_id', '=', $id)->first(); - //$tickets = Tickets::where('id', '=', $id)->first(); + return view('themes.default1.agent.helpdesk.ticket.timeline', compact('tickets'), compact('thread')); } @@ -834,16 +790,14 @@ class TicketController extends Controller $source = $eventthread->source; $form_data = $request->except('reply_content', 'ticket_ID', 'attachment'); \Event::fire(new \App\Events\ClientTicketFormPost($form_data, $emailadd, $source)); - // dd($attachments); - // } - //return $attachments; $reply_content = $request->input('reply_content'); + $thread->ticket_id = $request->input('ticket_ID'); $thread->poster = 'support'; $thread->body = $request->input('reply_content'); $thread->user_id = Auth::user()->id; $ticket_id = $request->input('ticket_ID'); - //dd($ticket_id); + $tickets = Tickets::where('id', '=', $ticket_id)->first(); $tickets->isanswered = '1'; $tickets->save(); @@ -871,19 +825,13 @@ class TicketController extends Controller } $thread->save(); - //$atachPath = ''; foreach ($attachments as $attachment) { if ($attachment != null) { $name = $attachment->getClientOriginalName(); - //dd(dirname($attachment)); $type = $attachment->getClientOriginalExtension(); $size = $attachment->getSize(); $data = file_get_contents($attachment->getRealPath()); - // $tem_path = $attachment->getRealPath(); - // $tem = basename($tem_path).PHP_EOL; - // //dd($tem); $attachPath = $attachment->getRealPath(); - //dd($attachPath); $ta->create(['thread_id' => $thread->id, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $data, 'poster' => 'ATTACHMENT']); $check_attachment = 1; @@ -914,7 +862,6 @@ class TicketController extends Controller $message = ''; if ($check_attachment == 1) { $attachment_files = $attachments; - // dd($attachment_files); } else { $attachment_files = null; } @@ -1054,8 +1001,6 @@ class TicketController extends Controller public function create_user($emailadd, $username, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $from_data) { // define global variables - // dd($source); - // dd($emailadd); $email; $username; @@ -1083,17 +1028,10 @@ class TicketController extends Controller $user_id = $user->id; // Event fire \Event::fire(new \App\Events\ReadMailEvent($user_id, $password)); - // if (Mail::send('emails.pass', ['password' => $password, 'name' => $username, 'from'=>$company,'emailadd' => $emailadd], function ($message) use ($emailadd, $username,$company) { - // $message->to($emailadd, $username)->subject('Welcome to '.$company.' helpdesk'); - // })) { try { $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => 'Welcome to '.$company.' helpdesk', 'scenario' => 'registration-notification'], $template_variables = ['user' => $username, 'email_address' => $emailadd, 'user_password' => $password]); } catch (\Exception $e) { - // return 0; } - // $message->to($emailadd, $username)->subject('Welcome to '.$company.' helpdesk'); - // })) { - // need to do something here.... } } else { $username = $checkemail->username; @@ -1103,14 +1041,6 @@ class TicketController extends Controller $ticket_number2 = $ticket_number[0]; $ticketdata = Tickets::where('ticket_number', '=', $ticket_number2)->first(); $threaddata = Ticket_Thread::where('ticket_id', '=', $ticketdata->id)->first(); - - // $sending_emails = Emails::where('department', '=', $ticketdata->dept_id)->first(); - // if($sending_emails == null) { - // $from_email = $this->system_mail(); - // } else { - // $from_email = $sending_emails->id; - // } - // dd($threaddata); $is_reply = $ticket_number[1]; $system = $this->system(); $updated_subject = $threaddata->title.'[#'.$ticket_number2.']'; @@ -1125,19 +1055,12 @@ class TicketController extends Controller } if ($source == 3) { - // Mail::send('emails.Ticket_Create', ['sign'=>$sign, 'content' => $body, 'name' => $username, 'ticket_number' => $ticket_number2, 'system' => $system], function ($message) use ($emailadd, $username, $ticket_number2, $updated_subject) { - // $message->to($emailadd, $username)->subject($updated_subject); - // }); - // dd($body); try { $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket-by-agent', 'body' => $body], $template_variables = ['agent_sign' => Auth::user()->agent_sign, 'ticket_number' => $ticket_number2]); } catch (\Exception $e) { } } else { $body2 = null; - // Mail::send('emails.Ticket_Create', ['sign'=>$sign, 'content' => $body2, 'name' => $username, 'ticket_number' => $ticket_number2, 'system' => $system], function ($message) use ($emailadd, $username, $ticket_number2, $updated_subject) { - // $message->to($emailadd, $username)->subject($updated_subject); - // }); try { $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket'], $template_variables = ['user' => $username, 'ticket_number' => $ticket_number2, 'department_sign' => '']); } catch (\Exception $e) { @@ -1149,13 +1072,9 @@ class TicketController extends Controller if (Alert::first()->ticket_status == 1 || Alert::first()->ticket_admin_email == 1) { // send email to admin $admins = User::where('role', '=', 'admin')->get(); - // $ticket_creator = $user->user_name; foreach ($admins as $admin) { $admin_email = $admin->email; $admin_user = $admin->first_name; - // Mail::send('emails.'.$mail, ['agent' => $admin_user,'content'=>$body, 'ticket_number' => $ticket_number2, 'from'=>$company, 'email' => $emailadd, 'name' => $ticket_creator, 'system' => $system], function ($message) use ($admin_email, $admin_user, $ticket_number2, $updated_subject) { - // $message->to($admin_email, $admin_user)->subject($updated_subject); - // }); try { $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $admin_user, 'email' => $admin_email], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $admin_user, 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $admin_user, 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]); } catch (\Exception $e) { @@ -1167,16 +1086,12 @@ class TicketController extends Controller if (Alert::first()->ticket_status == 1 || Alert::first()->ticket_department_member == 1) { // send email to agents $agents = User::where('role', '=', 'agent')->get(); - // dd($agents); foreach ($agents as $agent) { $department_data = Department::where('id', '=', $ticketdata->dept_id)->first(); if ($department_data->name == $agent->primary_dpt) { $agent_email = $agent->email; $agent_user = $agent->first_name; - // Mail::send('emails.'.$mail, ['agent' => $agent_user ,'content'=>$body , 'ticket_number' => $ticket_number2, 'from'=>$company, 'email' => $emailadd, 'name' => $ticket_creator, 'system' => $system], function ($message) use ($agent_email, $agent_user, $ticket_number2, $updated_subject) { - // $message->to($agent_email, $agent_user)->subject($updated_subject); - // }); try { $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $agent_user, 'email' => $agent_email], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $admin_user, 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $agent_user, 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]); } catch (\Exception $e) { @@ -1190,9 +1105,6 @@ class TicketController extends Controller $assigned_to = User::where('id', '=', $ticketdata->assigned_to)->first(); $agent_email = $assigned_to->email; $agent_user = $assigned_to->first_name; - // Mail::send('emails.'.$mail, ['agent' => $assigned_to->user_name ,'content'=>$body , 'ticket_number' => $ticket_number2, 'from'=>$company, 'email' => $assigned_to->email, 'name' => $ticket_creator, 'system' => $system], function ($message) use ($agent_email, $agent_user, $ticket_number2, $updated_subject) { - // $message->to($agent_email, $agent_user)->subject($updated_subject); - // }); try { $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $agent_user, 'email' => $agent_email], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $admin_user, 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $assigned_to->user_name, 'ticket_number' => $ticket_number2, 'email_address' => $assigned_to->email, 'name' => $ticket_creator]); } catch (\Exception $e) { @@ -1253,12 +1165,8 @@ class TicketController extends Controller */ public function check_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data) { - // $read_ticket_number = substr($subject, 0, 6); $read_ticket_number = explode('[#', $subject); if (isset($read_ticket_number[1])) { - // dd($read_ticket_number); - // if ($read_ticket_number == 'Re: [#' or $read_ticket_number == 'RE: [#') { - // dd($read_ticket_number); $separate = explode(']', $read_ticket_number[1]); $new_subject = substr($separate[0], 0, 20); $find_number = Tickets::where('ticket_number', '=', $new_subject)->first(); @@ -1346,18 +1254,15 @@ class TicketController extends Controller $sla_plan = Sla_plan::where('id', '=', $sla)->first(); $ovdate = $ticket->created_at; - // dd($sla_plan->grace_period); $new_date = date_add($ovdate, date_interval_create_from_date_string($sla_plan->grace_period)); $ticket->duedate = $new_date; $ticket->save(); - // dd($ticket->duedate); $ticket_number = $ticket->ticket_number; $id = $ticket->id; // store Form Data // Form Data comes from raising a ticket from client panel - // dd($helptopic); if ($form_data != null) { $help_topic = Help_topic::where('id', '=', $helptopic)->first(); $forms = Fields::where('forms_id', '=', $help_topic->custom_form)->get(); @@ -1374,7 +1279,6 @@ class TicketController extends Controller } } // store collaborators - // dd($headers); $this->storeCollaborators($headers, $id); if ($this->ticketThread($subject, $body, $id, $user_id) == true) { return $ticket_number; @@ -1456,10 +1360,6 @@ class TicketController extends Controller $system_from = $this->company(); - // Mail::send('emails.close_ticket', ['ticket_number' => $ticket_number, 'from'=>$company], function ($message) use ($email, $user_name, $ticket_number, $ticket_subject) { - // $message->to($email, $user_name)->subject($ticket_subject.'[#' . $ticket_number . ']'); - // }); - $sending_emails = Emails::where('department', '=', $ticket_status->dept_id)->first(); if ($sending_emails == null) { $from_email = $this->system_mail(); @@ -1538,15 +1438,15 @@ class TicketController extends Controller { $ticket_delete = $ticket->where('id', '=', $id)->first(); if ($ticket_delete->status == 5) { - $ticket_delete->delete(); $ticket_threads = Ticket_Thread::where('ticket_id', '=', $id)->get(); foreach ($ticket_threads as $ticket_thread) { + $ticket_attachments = Ticket_attachments::where('thread_id', '=', $ticket_thread->id)->get(); + foreach ($ticket_attachments as $ticket_attachment) { + $ticket_attachment->delete(); + } $ticket_thread->delete(); } - $ticket_attachments = Ticket_attachments::where('ticket_id', '=', $id)->get(); - foreach ($ticket_attachments as $ticket_attachment) { - $ticket_attachment->delete(); - } + $ticket_delete->delete(); return 'your ticket has been delete'; } else { @@ -1615,14 +1515,6 @@ class TicketController extends Controller $thread->is_internal = 1; $thread->body = 'This Ticket has been assigned to '.$assignee; $thread->save(); - - // $master = Auth::user()->first_name . " " . Auth::user()->last_name; - // if(Alert::first()->internal_status == 1 || Alert::first()->internal_assigned_agent == 1) { - // // ticket assigned send mail - // Mail::send('emails.Ticket_assign', ['agent' => $agent, 'ticket_number' => $ticket_number, 'from'=>$company, 'master' => $master, 'system' => $system], function ($message) use ($agent_email, $agent, $ticket_number, $ticket_subject) { - // $message->to($agent_email, $agent)->subject($ticket_subject.'[#' . $ticket_number . ']'); - // }); - // } } elseif ($assign_to[0] == 'user') { $ticket->assigned_to = $assign_to[1]; $user_detail = User::where('id', '=', $assign_to[1])->first(); @@ -1648,24 +1540,11 @@ class TicketController extends Controller $agent_email = $user_detail->email; $master = Auth::user()->first_name.' '.Auth::user()->last_name; - // if(Alert::first()->internal_status == 1 || Alert::first()->internal_assigned_agent == 1) { - // ticket assigned send mail - // Mail::send('emails.Ticket_assign', ['agent' => $agent, 'ticket_number' => $ticket_number, 'from'=>$company, 'master' => $master, 'system' => $system], function ($message) use ($agent_email, $agent, $ticket_number, $ticket_subject) { - // $message->to($agent_email, $agent)->subject($ticket_subject.'[#' . $ticket_number . ']'); - // }); - // $sending_emails = Emails::where('department', '=', $ticket->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', $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]); } catch (\Exception $e) { return 0; } - - // } } return 1; @@ -1685,7 +1564,6 @@ class TicketController extends Controller $NewThread = new Ticket_Thread(); $NewThread->ticket_id = $thread->ticket_id; $NewThread->user_id = Auth::user()->id; - // $NewThread->thread_type = 'M'; $NewThread->is_internal = 1; $NewThread->poster = Auth::user()->role; $NewThread->title = $thread->title; @@ -1705,9 +1583,6 @@ class TicketController extends Controller public function surrender($id) { $ticket = Tickets::where('id', '=', $id)->first(); - - // if($ticket->assigned_to == Auth::user()->id) - // { $InternalContent = Auth::user()->first_name.' '.Auth::user()->last_name.' has Surrendered the assigned Ticket'; $thread = Ticket_Thread::where('ticket_id', '=', $id)->first(); $NewThread = new Ticket_Thread(); @@ -1718,7 +1593,6 @@ class TicketController extends Controller $NewThread->title = $thread->title; $NewThread->body = $InternalContent; $NewThread->save(); - // } $ticket->assigned_to = null; $ticket->save(); @@ -1791,16 +1665,6 @@ class TicketController extends Controller $create_user->password = Hash::make($password); $create_user->save(); $user_id = $create_user->id; - - // Mail::send('emails.pass', ['password' => $password, 'name' => $name, 'from'=>$company,'emailadd' => $email], function ($message) use ($email, $name) { - // $message->to($email, $name)->subject('password'); - // }); - // $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('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); } catch (\Exception $e) { @@ -1855,36 +1719,6 @@ class TicketController extends Controller return $system; } - /** - * function to search. - * - * @return type - */ - // public function search() { - // $product = Input::get('type'); - // $word = Input::get('name_startsWith'); - // if ($product == 'product') { - // $starts_with = strtoupper($word); - // $rows = DB::table('users')->select('user_name')->where('name', 'LIKE', $starts_with . '%')->get(); - // $data = array(); - // foreach ($rows as $row) { - // array_push($data, $row->name); - // } - // print_r(json_encode($data)); - // } - // if ($product == 'product_table') { - // $row_num = Input::get('row_num'); - // $starts_with = strtoupper($word); - // $rows = DB::table('product')->select('name', 'description', 'cost_price')->where('name', 'LIKE', $starts_with . '%')->get(); - // $data = array(); - // foreach ($rows as $row) { - // $name = $row->name . '|' . $row->description . '|' . $row->cost_price . '|' . $row_num; - // array_push($data, $name); - // } - // print_r(json_encode($data)); - // } - // } - /** * shows trashed tickets. * @@ -1898,24 +1732,15 @@ class TicketController extends Controller public function get_trash() { if (Auth::user()->role == 'admin') { - // $tickets = Tickets::where('status', '=', 1)->where('assigned_to', '=', Auth::user()->id)->get(); - $tickets = Tickets::where('status', '=', 5)->get(); - - // $tickets = Tickets::where('assigned_to', '=', null)->where('status','1')->get(); } else { $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $tickets = Tickets::where('status', '=', 5)->where('dept_id', '=', $dept->id)->get(); - - // $dept = Department::where('name','=',Auth::user()->primary_dpt)->first(); - // $tickets = Tickets::where('assigned_to', '=', null)->where('dept_id','=',$dept->id)->get(); - // $dept = Department::where('name','=',Auth::user()->primary_dpt)->first(); - // $tickets = Tickets::where('status', '=', 1)->where('assigned_to', '=', Auth::user()->id)->get(); } return \Datatable::collection(new Collection($tickets)) ->addColumn('id', function ($ticket) { - return ""; + return ""; }) ->addColumn('subject', function ($ticket) { $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); @@ -1945,7 +1770,6 @@ class TicketController extends Controller } else { $attachString = ''; } - //return $threads->id; return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString; }) @@ -1956,7 +1780,6 @@ class TicketController extends Controller $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first(); return ''.$priority->priority_desc.''; - //return "loda"; }) ->addColumn('from', function ($ticket) { $from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); @@ -1993,7 +1816,6 @@ class TicketController extends Controller $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id'); $TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); - // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at)); return UTC::usertimezone($TicketDatarow->updated_at); }) ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') @@ -2014,20 +1836,15 @@ class TicketController extends Controller public function get_unassigned() { if (Auth::user()->role == 'admin') { - // $tickets = Tickets::where('status', '=', 1)->where('assigned_to', '=', Auth::user()->id)->get(); - $tickets = Tickets::where('assigned_to', '=', null)->where('status', '1')->get(); } else { $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $tickets = Tickets::where('assigned_to', '=', null)->where('dept_id', '=', $dept->id)->get(); - - // $dept = Department::where('name','=',Auth::user()->primary_dpt)->first(); - // $tickets = Tickets::where('status', '=', 1)->where('assigned_to', '=', Auth::user()->id)->get(); } return \Datatable::collection(new Collection($tickets)) ->addColumn('id', function ($ticket) { - return ""; + return ""; }) ->addColumn('subject', function ($ticket) { $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); @@ -2057,7 +1874,6 @@ class TicketController extends Controller } else { $attachString = ''; } - //return $threads->id; return "id])."' title='".$subject->title."'>".$string." (".$count.")".$collabString.$attachString; }) @@ -2068,7 +1884,6 @@ class TicketController extends Controller $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first(); return ''.$priority->priority_desc.''; - //return "loda"; }) ->addColumn('from', function ($ticket) { $from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); @@ -2105,7 +1920,6 @@ class TicketController extends Controller $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id'); $TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); - // return date('d F Y, H:i:s', strtotime($TicketDatarow->updated_at)); return UTC::usertimezone($TicketDatarow->updated_at); }) ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') @@ -2222,16 +2036,6 @@ class TicketController extends Controller if ($user->save()) { $user_id = $user->id; - // Mail::send('emails.pass', ['password' => $password, 'name' => $name, 'from'=>$company,'emailadd'=>$email], function ($message) use ($email, $name) { - // $message->to($email, $name)->subject('password'); - // }); - // $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; - // } - $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); } $ticket_collaborator = new Ticket_Collaborator(); @@ -2243,7 +2047,6 @@ class TicketController extends Controller return '

    '.$user->user_name.'

    '.$user->email.'
    '; } - // return '

    '.$data->user_name.'

    '.$data->email.'
    '; } /** @@ -2285,6 +2088,7 @@ class TicketController extends Controller $ticket->reopened_at = date('Y-m-d H:i:s'); $ticket->closed = 0; $ticket->closed_at = null; + $ticket->save(); } } @@ -2490,9 +2294,9 @@ class TicketController extends Controller $name = Input::get('name'); $returnValue = $this->changeOwnerAdd($email, $name, $ticket_id); if ($returnValue === 0) { - return 4; //'

    Alert!

    This user already Exists
    '; + return 4; } elseif ($returnValue === 2) { - return 5; //'

    Alert!

    Enter valid email address.
    '; + return 5; } else { //do nothing } @@ -2555,9 +2359,9 @@ class TicketController extends Controller $user = User::where('email', '=', $email)->first(); $count = count($user); if ($count === 1) { - return 0; //'

    Alert!

    This user already Exists
    '; + return 0; } elseif ($validator->fails()) { - return 2; //'

    Alert!

    Enter valid email address. Exists
    '; + return 2; } else { $company = $this->company(); $user = new User(); @@ -2571,13 +2375,11 @@ class TicketController extends Controller try { $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); } catch (\Exception $e) { - // dd($e); } } - return 1; // '

    '.$user->user_name.'

    '.$user->email.'
    '; + return 1; } - // return '

    '.$data->user_name.'

    '.$data->email.'
    '; } public function getMergeTickets($id) @@ -2693,7 +2495,6 @@ class TicketController extends Controller "'>#".$parent_ticket->ticket_number.'
    '.$reason; $new_thread->format = $thread->format; $new_thread->ip_address = $thread->ip_address; - //$new_thread->save(); $new_parent_thread = new Ticket_thread(); $new_parent_thread->ticket_id = $p_id; @@ -2705,7 +2506,6 @@ class TicketController extends Controller $new_parent_thread->body = Lang::get('lang.ticket')." #".$ticket->ticket_number.' '.Lang::get('lang.ticket_merged').'
    '.$reason; $new_parent_thread->format = $parent_thread->format; $new_parent_thread->ip_address = $parent_thread->ip_address; - //$new_parent_thread->save(); if ($new_thread->save() && $new_parent_thread->save()) { $success = 1; } else { diff --git a/app/Http/Controllers/Agent/helpdesk/UserController.php b/app/Http/Controllers/Agent/helpdesk/UserController.php index b8376c49e..7ede3d829 100644 --- a/app/Http/Controllers/Agent/helpdesk/UserController.php +++ b/app/Http/Controllers/Agent/helpdesk/UserController.php @@ -38,7 +38,6 @@ class UserController extends Controller * 1. authentication * 2. user roles * 3. roles must be agent. - * * @return void */ public function __construct() @@ -51,9 +50,7 @@ class UserController extends Controller /** * Display all list of the users. - * * @param type User $user - * * @return type view */ public function index() @@ -68,15 +65,14 @@ class UserController extends Controller /** * This function is used to display the list of users using chumper datatables. - * * @return datatable */ public function user_list() { // displaying list of users with chumper datatables return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get()) - /* searchable column username */ - ->searchColumns('user_name') + /* searchable column username and email*/ + ->searchColumns('user_name', 'email', 'phone') /* order column username and email */ ->orderColumns('user_name', 'email') /* column username */ @@ -85,14 +81,14 @@ class UserController extends Controller $username = substr($model->user_name, 0, 30); $username = substr($username, 0, strrpos($username, ' ')).' ...'; } else { - $username = $model->user_name; + $username = "id)."'>".$model->user_name.""; } return $username; }) /* column email */ ->addColumn('email', function ($model) { - $email = $model->email; + $email = "id)."'>".$model->email.""; return $email; }) @@ -147,7 +143,6 @@ class UserController extends Controller /** * Show the form for creating a new users. - * * @return type view */ public function create() @@ -161,10 +156,8 @@ class UserController extends Controller /** * Store a newly created users in storage. - * * @param type User $user * @param type Sys_userRequest $request - * * @return type redirect */ public function store(User $user, Sys_userRequest $request) @@ -191,10 +184,8 @@ class UserController extends Controller /** * Display the specified users. - * * @param type int $id * @param type User $user - * * @return type view */ public function show($id, User $user) @@ -211,10 +202,8 @@ class UserController extends Controller /** * Show the form for editing the specified resource. - * * @param type int $id * @param type User $user - * * @return type Response */ public function edit($id, User $user) @@ -231,16 +220,13 @@ class UserController extends Controller /** * Update the specified user in storage. - * * @param type int $id * @param type User $user * @param type Sys_userUpdate $request - * * @return type Response */ public function update($id, User $user, Sys_userUpdate $request) { - /* select the field where id = $id(request Id) */ $users = $user->whereId($id)->first(); /* Update the value by selected field */ @@ -257,7 +243,6 @@ class UserController extends Controller /** * get agent profile page. - * * @return type view */ public function getProfile() @@ -272,7 +257,6 @@ class UserController extends Controller /** * get profile edit page. - * * @return type view */ public function getProfileedit() @@ -287,10 +271,8 @@ class UserController extends Controller /** * post profile edit. - * * @param type int $id * @param type ProfileRequest $request - * * @return type Redirect */ public function postProfileedit(ProfileRequest $request) @@ -339,10 +321,8 @@ class UserController extends Controller /** * Post profile password. - * * @param type int $id * @param type ProfilePassword $request - * * @return type Redirect */ public function postProfilePassword($id, ProfilePassword $request) @@ -354,7 +334,6 @@ class UserController extends Controller $user->password = Hash::make($request->input('new_password')); try { $user->save(); - return redirect('profile-edit')->with('success1', 'Password Updated sucessfully'); } catch (Exception $e) { return redirect('profile-edit')->with('fails', $e->errorInfo[2]); @@ -366,9 +345,7 @@ class UserController extends Controller /** * Assigning an user to an organization. - * * @param type $id - * * @return type boolean */ public function UserAssignOrg($id) @@ -378,15 +355,12 @@ class UserController extends Controller $user_org->org_id = $org; $user_org->user_id = $id; $user_org->save(); - return 1; } /** * creating an organization in user profile page via modal popup. - * * @param type $id - * * @return type */ public function User_Create_Org($id) diff --git a/app/Http/Controllers/Api/v1/ApiController.php b/app/Http/Controllers/Api/v1/ApiController.php index c7aa3a5aa..91dab4449 100644 --- a/app/Http/Controllers/Api/v1/ApiController.php +++ b/app/Http/Controllers/Api/v1/ApiController.php @@ -555,9 +555,10 @@ class ApiController extends Controller $result[$key]['picture'] = $path; } $result = $this->createPagination($result, 10); + //dd($result); //$result->toJson(); return $result->toJson(); - } catch (Exception $e) { + } catch (\Exception $e) { $error = $e->getMessage(); $line = $e->getLine(); $file = $e->getFile(); diff --git a/app/Http/Controllers/Api/v1/ApiExceptAuthController.php b/app/Http/Controllers/Api/v1/ApiExceptAuthController.php new file mode 100644 index 000000000..7480f60d6 --- /dev/null +++ b/app/Http/Controllers/Api/v1/ApiExceptAuthController.php @@ -0,0 +1,114 @@ +request = $request; + $this->middleware('api'); + } + + /** + * Check the url is valid or not. + * + * @return json + */ + public function checkUrl() + { + //dd($this->request); + try { + $v = \Validator::make($this->request->all(), [ + 'url' => 'required|url', + ]); + if ($v->fails()) { + $error = $v->errors(); + + return response()->json(compact('error')); + } + + $url = $this->request->input('url'); + $url = $url.'/api/v1/helpdesk/check-url'; + $result = $this->CallGetApi($url); +// dd($result); + return response()->json(compact('result')); + } catch (\Exception $ex) { + $error = $ex->getMessage(); + + return $error; + } catch (\Symfony\Component\HttpKernel\Exception\HttpException $ex) { + return ['status' => 'fails', 'code' => $ex->getStatusCode()]; + } + } + + /** + * Success for currect url. + * + * @return string + */ + public function urlResult() + { + try { + $result = ['status' => 'success']; + + return $result; + } catch (\Symfony\Component\HttpKernel\Exception\HttpException $ex) { + return ['status' => 'fails', 'code' => $ex->getStatusCode()]; + } + } + + /** + * Call curl function for Get Method. + * + * @param type $url + * + * @return type int|string|json + */ + public function callGetApi($url) + { + $curl = curl_init($url); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_HEADER, 0); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + $response = curl_exec($curl); + + if (curl_errno($curl)) { + //echo 'error:' . curl_error($curl); + } + + return $response; + curl_close($curl); + } + + /** + * Call curl function for POST Method. + * + * @param type $url + * @param type $data + * + * @return type int|string|json + */ + public function callPostApi($url, $data) + { + $curl = curl_init($url); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_HEADER, 0); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + $response = curl_exec($curl); + + if (curl_errno($curl)) { + echo 'error:'.curl_error($curl); + } + + return $response; + curl_close($curl); + } +} diff --git a/app/Http/Controllers/Api/v1/TestController.php b/app/Http/Controllers/Api/v1/TestController.php index d4631539a..ab961cad1 100644 --- a/app/Http/Controllers/Api/v1/TestController.php +++ b/app/Http/Controllers/Api/v1/TestController.php @@ -473,6 +473,13 @@ class TestController extends Controller public function getCustomersWith() { try { + //dd($this->server); + $url = $this->server.'helpdesk/customers-custom?api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token'); + $_this = new self(); + $respose = $_this->callGetApi($url); + dd($respose); + + return $respose; } catch (\Exception $e) { $error = $e->getMessage(); $line = $e->getLine(); diff --git a/app/Http/Controllers/Client/helpdesk/ClientTicketController.php b/app/Http/Controllers/Client/helpdesk/ClientTicketController.php index e92d9ac6d..66eb363c3 100644 --- a/app/Http/Controllers/Client/helpdesk/ClientTicketController.php +++ b/app/Http/Controllers/Client/helpdesk/ClientTicketController.php @@ -64,6 +64,7 @@ class ClientTicketController extends Controller $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; diff --git a/app/Http/Controllers/Common/PhpMailController.php b/app/Http/Controllers/Common/PhpMailController.php index 24b766079..283bc710a 100644 --- a/app/Http/Controllers/Common/PhpMailController.php +++ b/app/Http/Controllers/Common/PhpMailController.php @@ -10,13 +10,16 @@ use App\Model\helpdesk\Settings\Email; use App\User; use Auth; -class PhpMailController extends Controller -{ - public function fetch_smtp_details($id) - { - $emails = Emails::where('id', '=', $id)->first(); +class PhpMailController extends Controller { - return $emails; + public function fetch_smtp_details($id) { + $emails = Emails::where('id', '=', $id)->first(); + if ($emails->sending_status == 1) { + return $emails; + } else { + $emails = null; + return $emails; + } } /** @@ -24,231 +27,235 @@ class PhpMailController extends Controller * * @return Mail */ - public function sendmail($from, $to, $message, $template_variables) - { + public function sendmail($from, $to, $message, $template_variables) { // dd($from); $from_address = $this->fetch_smtp_details($from); + if ($from_address == null) { + return $from_address; + } else { + // dd($from_address); + $username = $from_address->email_address; + $fromname = $from_address->email_name; + $password = \Crypt::decrypt($from_address->password); + $smtpsecure = $from_address->sending_encryption; + $host = $from_address->sending_host; + $port = $from_address->sending_port; - // dd($from_address); - $username = $from_address->email_address; - $fromname = $from_address->email_name; - $password = \Crypt::decrypt($from_address->password); - $smtpsecure = $from_address->sending_encryption; - $host = $from_address->sending_host; - $port = $from_address->sending_port; + if (isset($to['email'])) { + $recipants = $to['email']; + } else { + $recipants = null; + } + if (isset($to['name'])) { + $recipantname = $to['name']; + } else { + $recipantname = null; + } + if (isset($to['cc'])) { + $cc = $to['cc']; + } else { + $cc = null; + } + if (isset($to['bc'])) { + $bc = $to['bc']; + } else { + $bc = null; + } + if (isset($message['subject'])) { + $subject = $message['subject']; + } else { + $subject = null; + } + if (isset($message['body'])) { + $content = $message['body']; + } else { + $content = null; + } + if (isset($message['scenario'])) { + $template = $message['scenario']; + } else { + $template = null; + } + if (isset($message['attachments'])) { + $attachment = $message['attachments']; + } else { + $attachment = null; + } - if (isset($to['email'])) { - $recipants = $to['email']; - } else { - $recipants = null; - } - if (isset($to['name'])) { - $recipantname = $to['name']; - } else { - $recipantname = null; - } - if (isset($to['cc'])) { - $cc = $to['cc']; - } else { - $cc = null; - } - if (isset($to['bc'])) { - $bc = $to['bc']; - } else { - $bc = null; - } - if (isset($message['subject'])) { - $subject = $message['subject']; - } else { - $subject = null; - } - if (isset($message['body'])) { - $content = $message['body']; - } else { - $content = null; - } - if (isset($message['scenario'])) { - $template = $message['scenario']; - } else { - $template = null; - } - if (isset($message['attachments'])) { - $attachment = $message['attachments']; - } else { - $attachment = null; - } + // template variables + if (Auth::user()) { + $agent = Auth::user()->user_name; + } else { + $agent = null; + } + if (isset($template_variables['ticket_agent_name'])) { + $ticket_agent_name = $template_variables['ticket_agent_name']; + } else { + $ticket_agent_name = null; + } + if (isset($template_variables['ticket_number'])) { + $ticket_number = $template_variables['ticket_number']; + } else { + $ticket_number = null; + } + if (isset($template_variables['ticket_client_name'])) { + $ticket_client_name = $template_variables['ticket_client_name']; + } else { + $ticket_client_name = null; + } + if (isset($template_variables['ticket_client_email'])) { + $ticket_client_email = $template_variables['ticket_client_email']; + } else { + $ticket_client_email = null; + } + if (isset($template_variables['ticket_body'])) { + $ticket_body = $template_variables['ticket_body']; + } else { + $ticket_body = null; + } + if (isset($template_variables['ticket_assigner'])) { + $ticket_assigner = $template_variables['ticket_assigner']; + } else { + $ticket_assigner = null; + } + if (isset($template_variables['ticket_link_with_number'])) { + $ticket_link_with_number = $template_variables['ticket_link_with_number']; + } else { + $ticket_link_with_number = null; + } + // if (isset($template_variables['system_from'])) { + // $system_from = $template_variables['system_from']; + // } else { + // $system_from = null; + // } + if (isset($template_variables['system_link'])) { + $system_link = $template_variables['system_link']; + } else { + $system_link = null; + } + if (isset($template_variables['system_error'])) { + $system_error = $template_variables['system_error']; + } else { + $system_error = null; + } + if (isset($template_variables['agent_sign'])) { + $agent_sign = $template_variables['agent_sign']; + } else { + $agent_sign = null; + } + if (isset($template_variables['department_sign'])) { + $department_sign = $template_variables['department_sign']; + } else { + $department_sign = null; + } + if (isset($template_variables['password_reset_link'])) { + $password_reset_link = $template_variables['password_reset_link']; + } else { + $password_reset_link = null; + } + if (isset($template_variables['user_password'])) { + $user_password = $template_variables['user_password']; + } else { + $user_password = null; + } + if (isset($template_variables['email_address'])) { + $email_address = $template_variables['email_address']; + } else { + $email_address = null; + } + if (isset($template_variables['user'])) { + $user = $template_variables['user']; + } else { + $user = null; + } - // template variables - if (Auth::user()) { - $agent = Auth::user()->user_name; - } else { - $agent = null; - } - if (isset($template_variables['ticket_agent_name'])) { - $ticket_agent_name = $template_variables['ticket_agent_name']; - } else { - $ticket_agent_name = null; - } - if (isset($template_variables['ticket_number'])) { - $ticket_number = $template_variables['ticket_number']; - } else { - $ticket_number = null; - } - if (isset($template_variables['ticket_client_name'])) { - $ticket_client_name = $template_variables['ticket_client_name']; - } else { - $ticket_client_name = null; - } - if (isset($template_variables['ticket_client_email'])) { - $ticket_client_email = $template_variables['ticket_client_email']; - } else { - $ticket_client_email = null; - } - if (isset($template_variables['ticket_body'])) { - $ticket_body = $template_variables['ticket_body']; - } else { - $ticket_body = null; - } - if (isset($template_variables['ticket_assigner'])) { - $ticket_assigner = $template_variables['ticket_assigner']; - } else { - $ticket_assigner = null; - } - if (isset($template_variables['ticket_link_with_number'])) { - $ticket_link_with_number = $template_variables['ticket_link_with_number']; - } else { - $ticket_link_with_number = null; - } - // if (isset($template_variables['system_from'])) { - // $system_from = $template_variables['system_from']; - // } else { - // $system_from = null; - // } - if (isset($template_variables['system_link'])) { - $system_link = $template_variables['system_link']; - } else { - $system_link = null; - } - if (isset($template_variables['system_error'])) { - $system_error = $template_variables['system_error']; - } else { - $system_error = null; - } - if (isset($template_variables['agent_sign'])) { - $agent_sign = $template_variables['agent_sign']; - } else { - $agent_sign = null; - } - if (isset($template_variables['department_sign'])) { - $department_sign = $template_variables['department_sign']; - } else { - $department_sign = null; - } - if (isset($template_variables['password_reset_link'])) { - $password_reset_link = $template_variables['password_reset_link']; - } else { - $password_reset_link = null; - } - if (isset($template_variables['user_password'])) { - $user_password = $template_variables['user_password']; - } else { - $user_password = null; - } - if (isset($template_variables['email_address'])) { - $email_address = $template_variables['email_address']; - } else { - $email_address = null; - } - if (isset($template_variables['user'])) { - $user = $template_variables['user']; - } else { - $user = null; - } + $system_link = url('/'); - $system_link = url('/'); + $system_from = $this->company(); - $system_from = $this->company(); + $mail = new \PHPMailer(); - $mail = new \PHPMailer(); + $status = \DB::table('settings_email')->first(); - $status = \DB::table('settings_email')->first(); + $path2 = \Config::get('view.paths'); - $path2 = \Config::get('view.paths'); + $directory = $path2[0] . '\emails' . DIRECTORY_SEPARATOR . $status->template . DIRECTORY_SEPARATOR; - $directory = $path2[0].'\emails'.DIRECTORY_SEPARATOR.$status->template.DIRECTORY_SEPARATOR; + $handle = fopen($directory . $template . '.blade.php', 'r'); + $contents = fread($handle, filesize($directory . $template . '.blade.php')); + fclose($handle); - $handle = fopen($directory.$template.'.blade.php', 'r'); - $contents = fread($handle, filesize($directory.$template.'.blade.php')); - fclose($handle); + $variables = ['{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}']; - $variables = ['{!!$user!!}', '{!!$agent!!}', '{!!$ticket_number!!}', '{!!$content!!}', '{!!$from!!}', '{!!$ticket_agent_name!!}', '{!!$ticket_client_name!!}', '{!!$ticket_client_email!!}', '{!!$ticket_body!!}', '{!!$ticket_assigner!!}', '{!!$ticket_link_with_number!!}', '{!!$system_error!!}', '{!!$agent_sign!!}', '{!!$department_sign!!}', '{!!$password_reset_link!!}', '{!!$email_address!!}', '{!!$user_password!!}', '{!!$system_from!!}', '{!!$system_link!!}']; + $data = [$user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link]; - $data = [$user, $agent, $ticket_number, $content, $from, $ticket_agent_name, $ticket_client_name, $ticket_client_email, $ticket_body, $ticket_assigner, $ticket_link_with_number, $system_error, $agent_sign, $department_sign, $password_reset_link, $email_address, $user_password, $system_from, $system_link]; + // dd($variables,$data,$contents); + // $messagebody = str_replace($variables, $data, $contents); - // dd($variables,$data,$contents); - // $messagebody = str_replace($variables, $data, $contents); + foreach ($variables as $key => $variable) { + $messagebody = str_replace($variables[$key], $data[$key], $contents); + // dd($messagebody); + + $contents = $messagebody; + } - foreach ($variables as $key => $variable) { - $messagebody = str_replace($variables[$key], $data[$key], $contents); // dd($messagebody); + //$mail->SMTPDebug = 3; // Enable verbose debug output - $contents = $messagebody; - } + $mail->isSMTP(); // Set mailer to use SMTP + $mail->Host = $host; // Specify main and backup SMTP servers + $mail->SMTPAuth = true; // Enable SMTP authentication + $mail->Username = $username; // SMTP username + $mail->Password = $password; // SMTP password + $mail->SMTPSecure = $smtpsecure; // Enable TLS encryption, `ssl` also accepted + $mail->Port = $port; // TCP port to connect to - // dd($messagebody); - //$mail->SMTPDebug = 3; // Enable verbose debug output - - $mail->isSMTP(); // Set mailer to use SMTP - $mail->Host = $host; // Specify main and backup SMTP servers - $mail->SMTPAuth = true; // Enable SMTP authentication - $mail->Username = $username; // SMTP username - $mail->Password = $password; // SMTP password - $mail->SMTPSecure = $smtpsecure; // Enable TLS encryption, `ssl` also accepted - $mail->Port = $port; // TCP port to connect to - - $mail->setFrom($username, $fromname); - $mail->addAddress($recipants); // Add a recipient - // Name is optional - // $mail->addReplyTo('sada059@gmail.com', 'Information'); - // Optional name - $mail->isHTML(true); // Set email format to HTML - if ($cc != null) { - foreach ($cc as $collaborator) { - //mail to collaborators - $collab_user_id = $collaborator->user_id; - $user_id_collab = User::where('id', '=', $collab_user_id)->first(); - $collab_email = $user_id_collab->email; - $mail->addCC($collab_email); + $mail->setFrom($username, $fromname); + $mail->addAddress($recipants); // Add a recipient + // Name is optional + // $mail->addReplyTo('sada059@gmail.com', 'Information'); + // Optional name + $mail->isHTML(true); // Set email format to HTML + if ($cc != null) { + foreach ($cc as $collaborator) { + //mail to collaborators + $collab_user_id = $collaborator->user_id; + $user_id_collab = User::where('id', '=', $collab_user_id)->first(); + $collab_email = $user_id_collab->email; + $mail->addCC($collab_email); + } } - } - $mail->addBCC($bc); + $mail->addBCC($bc); - if ($attachment != null) { - $size = count($message['attachments']); - $attach = $message['attachments']; - for ($i = 0; $i < $size; $i++) { - $file_path = $attach[$i]->getRealPath(); - $file_name = $attach[$i]->getClientOriginalName(); - $mail->addAttachment($file_path, $file_name); + if ($attachment != null) { + $size = count($message['attachments']); + $attach = $message['attachments']; + for ($i = 0; $i < $size; $i++) { + $file_path = $attach[$i]->getRealPath(); + $file_name = $attach[$i]->getClientOriginalName(); + $mail->addAttachment($file_path, $file_name); + } } - } - $mail->Subject = $subject; - if ($template == 'ticket-reply-agent') { - $line = '---Reply above this line---

    '; - $mail->Body = $line.$messagebody; - } else { - $mail->Body = $messagebody; - } + $mail->Subject = $subject; + if ($template == 'ticket-reply-agent') { + $line = '---Reply above this line---

    '; + $mail->Body = $line . $messagebody; + } else { + $mail->Body = $messagebody; + } - // $mail->AltBody = $altbody; + // $mail->AltBody = $altbody; - if (!$mail->send()) { - // echo 'Message could not be sent.'; - // echo 'Mailer Error: '.$mail->ErrorInfo; - } else { - // echo 'Message has been sent'; + if (!$mail->send()) { + return null; + // echo 'Message could not be sent.'; + // echo 'Mailer Error: '.$mail->ErrorInfo; + } else { + return 1; + // echo 'Message has been sent'; + } } } @@ -257,8 +264,7 @@ class PhpMailController extends Controller * * @return type */ - public function company() - { + public function company() { $company = Company::Where('id', '=', '1')->first(); if ($company->company_name == null) { $company = 'Support Center'; @@ -320,8 +326,7 @@ class PhpMailController extends Controller * * @return type integer */ - public function mailfrom($reg, $dept_id) - { + public function mailfrom($reg, $dept_id) { $email = Email::where('id', '=', '1')->first(); if ($reg == 1) { return $email->sys_email; @@ -334,4 +339,5 @@ class PhpMailController extends Controller } } } + } diff --git a/app/Http/Controllers/Installer/helpdesk/InstallController.php b/app/Http/Controllers/Installer/helpdesk/InstallController.php index db3681dbc..a35ca72ff 100644 --- a/app/Http/Controllers/Installer/helpdesk/InstallController.php +++ b/app/Http/Controllers/Installer/helpdesk/InstallController.php @@ -203,23 +203,30 @@ class InstallController extends Controller $port = Input::get('port'); // Setting environment values - $ENV['APP_ENV'] = 'local'; - $ENV['APP_DEBUG'] = 'false'; - $ENV['APP_KEY'] = 'SomeRandomString'; - $ENV['DB_TYPE'] = $default; - $ENV['DB_HOST'] = $host; - $ENV['DB_PORT'] = $port; - $ENV['DB_DATABASE'] = $database; - $ENV['DB_USERNAME'] = $dbusername; - $ENV['DB_PASSWORD'] = $dbpassword; - $ENV['MAIL_DRIVER'] = 'smtp'; - $ENV['MAIL_HOST'] = 'mailtrap.io'; - $ENV['MAIL_PORT'] = '2525'; - $ENV['MAIL_USERNAME'] = 'null'; - $ENV['MAIL_PASSWORD'] = 'null'; - $ENV['CACHE_DRIVER'] = 'file'; - $ENV['SESSION_DRIVER'] = 'file'; - $ENV['QUEUE_DRIVER'] = 'sync'; + // $_ENV['DB_TYPE'] = $default; + // $_ENV['DB_HOST'] = $host; + // $_ENV['DB_PORT'] = $port; + // $_ENV['DB_DATABASE'] = $database; + // $_ENV['DB_USERNAME'] = $dbusername; + // $_ENV['DB_PASSWORD'] = $dbpassword; + + $ENV['APP_ENV'] = 'local'; + $ENV['APP_DEBUG'] = 'false'; + $ENV['APP_KEY'] = 'SomeRandomString'; + $ENV['DB_TYPE'] = $default; + $ENV['DB_HOST'] = $host; + $ENV['DB_PORT'] = $port; + $ENV['DB_DATABASE'] = $database; + $ENV['DB_USERNAME'] = $dbusername; + $ENV['DB_PASSWORD'] = $dbpassword; + $ENV['MAIL_DRIVER'] = 'smtp'; + $ENV['MAIL_HOST'] = 'mailtrap.io'; + $ENV['MAIL_PORT'] = '2525'; + $ENV['MAIL_USERNAME'] = 'null'; + $ENV['MAIL_PASSWORD'] = 'null'; + $ENV['CACHE_DRIVER'] = 'file'; + $ENV['SESSION_DRIVER'] = 'file'; + $ENV['QUEUE_DRIVER'] = 'sync'; $config = ''; foreach ($ENV as $key => $val) { diff --git a/app/Http/Middleware/ApiKey.php b/app/Http/Middleware/ApiKey.php index 67d689888..7ad0170c0 100644 --- a/app/Http/Middleware/ApiKey.php +++ b/app/Http/Middleware/ApiKey.php @@ -26,19 +26,34 @@ class ApiKey public function handle($request, Closure $next) { $set = $this->setting->where('id', '1')->first(); - if ($set->api_enable == 1) { - $key = $set->api_key; - if ($key == $request->input('api_key')) { - return $next($request); + if ($set->api_key_mandatory == 1) { + if ($set->api_enable == 1) { + $key = $set->api_key; + $check = $this->test($key, $request->input('api_key')); + if ($check == '1') { + return $next($request); + } + if ($check == '0') { + $result = 'wrong api key'; + + return response()->json(compact('result')); + } } else { - $result = 'wrong api key'; + $result = 'please enable api'; return response()->json(compact('result')); } } else { - $result = 'please enable api'; + return $next($request); + } + } - return response()->json(compact('result')); + public function test($v1, $v2) + { + if ($v1 == $v2) { + return '1'; + } else { + return '0'; } } } diff --git a/app/Http/Requests/helpdesk/AgentRequest.php b/app/Http/Requests/helpdesk/AgentRequest.php index 13b8e7288..44cf0b1f4 100644 --- a/app/Http/Requests/helpdesk/AgentRequest.php +++ b/app/Http/Requests/helpdesk/AgentRequest.php @@ -32,7 +32,7 @@ class AgentRequest extends Request 'user_name' => 'required|unique:users', 'first_name' => 'required', 'last_name' => 'required', - 'email' => 'required', + 'email' => 'required|unique:users', 'active' => 'required', // 'account_status' => 'required', 'assign_group' => 'required', diff --git a/app/Http/Requests/helpdesk/EmailsEditRequest.php b/app/Http/Requests/helpdesk/EmailsEditRequest.php index 498ec4c87..5f6e9ef3a 100644 --- a/app/Http/Requests/helpdesk/EmailsEditRequest.php +++ b/app/Http/Requests/helpdesk/EmailsEditRequest.php @@ -40,9 +40,9 @@ class EmailsEditRequest extends Request // 'sending_host' => 'required', // 'sending_port' => 'required', //'mailbox_protocol' => 'required' - 'fetching_host' => 'required', - 'fetching_port' => 'required', - 'mailbox_protocol' => 'required', +// 'fetching_host' => 'required', +// 'fetching_port' => 'required', +// 'mailbox_protocol' => 'required', ]; } } diff --git a/app/Http/Requests/helpdesk/EmailsRequest.php b/app/Http/Requests/helpdesk/EmailsRequest.php index fd290d58e..2502cb8d0 100644 --- a/app/Http/Requests/helpdesk/EmailsRequest.php +++ b/app/Http/Requests/helpdesk/EmailsRequest.php @@ -39,9 +39,9 @@ class EmailsRequest extends Request // 'user_name' => 'required', // 'sending_host' => 'required', // 'sending_port' => 'required', - 'fetching_host' => 'required', - 'fetching_port' => 'required', - 'mailbox_protocol' => 'required', +// 'fetching_host' => 'required', +// 'fetching_port' => 'required', +// 'mailbox_protocol' => 'required', ]; } } diff --git a/app/Http/routes.php b/app/Http/routes.php index 7a9a56a73..dcac4fd08 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -180,6 +180,9 @@ Route::group(['middleware' => 'roles', 'middleware' => 'auth'], function () { Route::get('delete-language/{lang}', ['as' => 'lang.delete', 'uses' => 'Admin\helpdesk\LanguageController@deleteLanguage']); Route::get('generate-api-key', 'Admin\helpdesk\SettingsController@GenerateApiKey'); // route to generate api key + + Route::post('validating-email-settings', ['as' => 'validating.email.settings', 'uses' => 'Admin\helpdesk\EmailsController@validatingEmailSettings']); // route to check email input validation + Route::post('validating-email-settings-on-update/{id}', ['as' => 'validating.email.settings.update', 'uses' => 'Admin\helpdesk\EmailsController@validatingEmailSettingsUpdate']); // route to check email input validation }); /* @@ -354,7 +357,7 @@ Route::group(['middleware' => 'role.agent', 'middleware' => 'auth'], function () Route::get('/get-parent-tickets/{id}', ['as' => 'get.parent.ticket', 'uses' => 'Agent\helpdesk\TicketController@getParentTickets']); - Route::patch('/merge-tickets/{id}', 'Agent\helpdesk\TicketController@mergeTickets'); + Route::patch('/merge-tickets/{id}', ['as' => 'merge.tickets', 'uses' => 'Agent\helpdesk\TicketController@mergeTickets']); }); @@ -633,8 +636,8 @@ Route::group(['prefix' => 'api/v1'], function () { Route::get('customer', 'Api\v1\ApiController@getCustomer'); Route::get('ticket-search', 'Api\v1\ApiController@searchTicket'); Route::get('ticket-thread', 'Api\v1\ApiController@ticketThreads'); - Route::get('url', 'Api\v1\ApiController@checkUrl'); - Route::get('check-url', 'Api\v1\ApiController@urlResult'); + Route::get('url', 'Api\v1\ApiExceptAuthController@checkUrl'); + Route::get('check-url', 'Api\v1\ApiExceptAuthController@urlResult'); Route::get('api_key', 'Api\v1\ApiController@generateApiKey'); Route::get('help-topic', 'Api\v1\ApiController@getHelpTopic'); Route::get('sla-plan', 'Api\v1\ApiController@getSlaPlan'); @@ -688,7 +691,7 @@ Route::group(['prefix' => 'api/v1'], function () { /* * Newly added */ - Route::get('customers-custom', 'Api\v1\TestController@getCustomersWith'); + Route::get('ticket/customers-custom', 'Api\v1\TestController@getCustomersWith'); Route::get('generate/token', 'Api\v1\TestController@generateToken'); Route::get('get/user', 'Api\v1\TestController@getAuthUser'); diff --git a/app/Model/helpdesk/Email/Emails.php b/app/Model/helpdesk/Email/Emails.php index d98ccaf34..2d4bc6ea5 100644 --- a/app/Model/helpdesk/Email/Emails.php +++ b/app/Model/helpdesk/Email/Emails.php @@ -9,8 +9,8 @@ class Emails extends Model protected $table = 'emails'; protected $fillable = [ 'email_address', 'email_name', 'department', 'priority', 'help_topic', - 'user_name', 'password', 'fetching_host', 'fetching_port', 'mailbox_protocol', - 'folder', 'sending_host', 'sending_port', 'sending_encryption', 'internal_notes', 'auto_response', + 'user_name', 'password', 'fetching_host', 'fetching_port', 'fetching_protocol', 'fetching_encryption', 'mailbox_protocol', + 'folder', 'sending_host', 'sending_port', 'sending_protocol', 'sending_encryption', 'internal_notes', 'auto_response', 'fetching_status', 'move_to_folder', 'delete_email', 'do_nothing', 'sending_status', 'authentication', 'header_spoofing', 'imap_config', ]; diff --git a/app/Model/helpdesk/Settings/System.php b/app/Model/helpdesk/Settings/System.php index 1244b0d09..43aaed68f 100644 --- a/app/Model/helpdesk/Settings/System.php +++ b/app/Model/helpdesk/Settings/System.php @@ -12,6 +12,6 @@ class System extends Model protected $fillable = [ 'id', 'status', 'url', 'name', 'department', 'page_size', 'log_level', 'purge_log', 'name_format', - 'time_farmat', 'date_format', 'date_time_format', 'day_date_time', 'time_zone', 'content', 'api_key', 'api_enable', + 'time_farmat', 'date_format', 'date_time_format', 'day_date_time', 'time_zone', 'content', 'api_key', 'api_enable', 'api_key_mandatory', ]; } diff --git a/config/app.php b/config/app.php index 0800b8f82..8f8e40cc2 100644 --- a/config/app.php +++ b/config/app.php @@ -38,7 +38,7 @@ return [ | */ - 'version' => 'Community 1.0.6.5', + 'version' => 'Community 1.0.6.6', /* |-------------------------------------------------------------------------- diff --git a/database/migrations/2016_02_16_140450_create_emails_table.php b/database/migrations/2016_02_16_140450_create_emails_table.php index dd9f372be..0aa0b3c7a 100644 --- a/database/migrations/2016_02_16_140450_create_emails_table.php +++ b/database/migrations/2016_02_16_140450_create_emails_table.php @@ -23,11 +23,14 @@ class CreateEmailsTable extends Migration $table->string('password'); $table->string('fetching_host'); $table->string('fetching_port'); + $table->string('fetching_protocol'); + $table->string('fetching_encryption'); $table->string('mailbox_protocol'); $table->string('imap_config'); $table->string('folder'); $table->string('sending_host'); $table->string('sending_port'); + $table->string('sending_protocol'); $table->string('sending_encryption'); $table->string('internal_notes'); $table->boolean('auto_response'); diff --git a/database/migrations/2016_02_16_140450_create_settings_system_table.php b/database/migrations/2016_02_16_140450_create_settings_system_table.php index 85d33128b..59b140c4c 100644 --- a/database/migrations/2016_02_16_140450_create_settings_system_table.php +++ b/database/migrations/2016_02_16_140450_create_settings_system_table.php @@ -22,6 +22,7 @@ class CreateSettingsSystemTable extends Migration $table->string('log_level'); $table->string('purge_log'); $table->integer('api_enable'); + $table->integer('api_key_mandatory'); $table->string('api_key'); $table->string('name_format'); $table->integer('time_farmat')->unsigned()->nullable()->index('time_farmat'); diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 000000000..e69de29bb diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 000000000..067bd4be4 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,12 @@ + + + org.netbeans.modules.php.project + + + laravel + + + endif + + + diff --git a/public/lb-faveo/plugins/datatables/dataTables.bootstrap.js b/public/lb-faveo/plugins/datatables/dataTables.bootstrap.js index 92f9d40e9..0833b4f23 100644 --- a/public/lb-faveo/plugins/datatables/dataTables.bootstrap.js +++ b/public/lb-faveo/plugins/datatables/dataTables.bootstrap.js @@ -6,7 +6,8 @@ $.extend( true, $.fn.dataTable.defaults, { "t"+ "<'row'<'col-xs-6'i><'col-xs-6'p>>", "oLanguage": { - "sLengthMenu": "_MENU_ records per page" + "sLengthMenu": "_MENU_ Records per page", + "sSearch" : "Search: " } } ); diff --git a/resources/lang/en/lang.php b/resources/lang/en/lang.php index 72f8801da..2026557c9 100644 --- a/resources/lang/en/lang.php +++ b/resources/lang/en/lang.php @@ -87,24 +87,34 @@ return [ | Emails Create Page |-------------------------------------- */ - 'emails' => 'Emails', - 'incoming_emails' => 'Incoming Emails', - 'reuired_authentication' => 'Reuired Authentication', - 'fetching_email_via_imap' => 'Fetching Email via IMAP', - 'create_email' => 'Create Email', - 'email_address' => 'Email Address', - 'email_name' => 'Email Name', - 'help_topic' => 'Help Topic', - 'auto_response' => 'Auto Response', - 'host_name' => 'Host Name', - 'port_number' => 'Port Number', - 'mail_box_protocol' => 'Mail Box Protocol', - 'authentication_required' => 'Authentication Required', - 'yes' => 'Yes', - 'no' => 'No', - 'header_spoofing' => 'Header Spoofing', - 'allow_for_this_email' => 'Allow For This Email', - 'imap_config' => 'IMAP Configuration', + 'emails' => 'Emails', + 'incoming_emails' => 'Incoming Emails', + 'reuired_authentication' => 'Reuired Authentication', + 'fetching_email_via_imap' => 'Fetching Email via IMAP', + 'create_email' => 'Create Email', + 'email_address' => 'Email Address', + 'email_name' => 'Email Name', + 'help_topic' => 'Help Topic', + 'auto_response' => 'Auto Response', + 'host_name' => 'Host Name', + 'port_number' => 'Port Number', + 'mail_box_protocol' => 'Mail Box Protocol', + 'authentication_required' => 'Authentication Required', + 'yes' => 'Yes', + 'no' => 'No', + 'header_spoofing' => 'Header Spoofing', + 'allow_for_this_email' => 'Allow For This Email', + 'imap_config' => 'IMAP Configuration', + 'email_information_and_settings' => 'Email Information and Settings', + 'incoming_email_information' => 'Incoming Email Information', + 'outgoing_email_information' => 'Outgoing Email Information', + 'new_ticket_settings' => 'New Ticket Settings', + 'protocol' => 'Protocol', + 'fetching_protocol' => 'Fetching Protocol', + 'transfer_protocol' => 'Transfer Protocol', + 'from_name' => 'From Name', + 'add_an_email' => 'Add an Email', + 'edit_an_email' => 'Edit an Email', /* |-------------------------------------- | Ban Emails Create Page @@ -203,6 +213,7 @@ return [ 'timezone' => 'Default Time Zone', 'api' => 'Api', 'api_key' => 'Api Key', + 'api_key_mandatory' => 'Api key mandatory', 'api_configurations' => 'Api Configurations', 'generate_key' => 'Generate key', /* @@ -443,6 +454,19 @@ return [ 'footer2' => 'Footer2', 'footer3' => 'Footer3', 'footer4' => 'Footer4', + /* + |-------------------------------------- + | Custom alert box + |-------------------------------------- + */ + 'ok' => 'Ok', + 'cancel' => 'Cancel', + 'select-ticket' => 'Please select tickets.', + 'confirm' => 'Are you sure?', + 'delete-tickets' => 'Delete Tickets', + 'close-tickets' => 'Close Tickets', + 'open-tickets' => 'Open Tickets', + /* |---------------------------------------------------------------------------------------- | Staff Pages [English(en)] @@ -634,7 +658,7 @@ return [ 'organization' => 'Organization', 'create_organization' => 'Create Organization', 'account_manager' => 'Account Manager', - 'update' => 'update', + 'update' => 'Update', 'please_select_an_organization' => 'Please select an Organization', 'please_select_an_user' => 'Please select an user', 'organization_profile' => 'Organization Profile', @@ -805,7 +829,7 @@ return [ 'published' => 'Published', 'draft' => 'Draft', 'create_a_category' => 'Create a Category', - 'add' => 'add', + 'add' => 'Add', 'social' => 'Social', 'comment' => 'Comment', 'not_published' => 'Not Published', diff --git a/resources/views/themes/default1/admin/helpdesk/emails/emails/create.blade.php b/resources/views/themes/default1/admin/helpdesk/emails/emails/create.blade.php index c9893cc64..7571d2c9c 100644 --- a/resources/views/themes/default1/admin/helpdesk/emails/emails/create.blade.php +++ b/resources/views/themes/default1/admin/helpdesk/emails/emails/create.blade.php @@ -16,267 +16,404 @@ class="active" @stop @section('PageHeader') - - +

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

    @stop @section('breadcrumbs') @stop @section('content') - - - {!!Form::open(['action'=>'Admin\helpdesk\EmailsController@store','method'=>'POST'])!!} -
    -
    - -

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

    {!! Form::submit(Lang::get('lang.save'),['class'=>'form-group btn btn-primary pull-right'])!!} - -
    - -
    - -
    - -
    - - {!! Form::label('email_address',Lang::get('lang.email_address')) !!} - {!! $errors->first('email_address', ':message') !!} - {!! Form::text('email_address',null,['class' => 'form-control']) !!} - -
    - -
    - - {!! Form::label('email_name',Lang::get('lang.email_name')) !!} - {!! $errors->first('email_name', ':message') !!} - {!! Form::text('email_name',null,['class' => 'form-control']) !!} - -
    - -
    - -
    - -
    - - {!! Form::label('department',Lang::get('lang.department')) !!} - {!! $errors->first('department', ':message') !!} - {!!Form::select('department', [''=>'--System Default--','departments'=>$departments->lists('name','id')],null,['class' => 'form-control select']) !!} - -
    - -
    - - {!! Form::label('priority',Lang::get('lang.priority')) !!} - {!! $errors->first('priority', ':message') !!} - {!!Form::select('priority', [''=>'--System Default--','Priorities'=>$priority->lists('priority_desc','priority_id')],null,['class' => 'form-control select']) !!} - -
    - -
    - - {!! Form::label('help_topic',Lang::get('lang.help_topic')) !!} - {!! $errors->first('help_topic', ':message') !!} - {!!Form::select('help_topic', [''=>'--System Default--','Help Topics'=>$helps->lists('topic','id')],null,['class' => 'form-control select']) !!} - -
    - -
    - -
    - -
    - -
    - -

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

    - -
    - -
    - -
    - -
    - - {!! Form::label('password',Lang::get('lang.password')) !!} - {!! $errors->first('password', ':message') !!} - {!! Form::password('password',['class' => 'form-control']) !!} - -
    - -
    - -
    - -
    - -
    - -

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

    - -
    - -
    - -
    - -
    - -
    - {!! Form::label('fetching_status',Lang::get('lang.status')) !!} -
    -
    - {!! Form::radio('fetching_status','1',true) !!} {{Lang::get('lang.enable')}} -
    -
    - {!! Form::radio('fetching_status','0',null) !!} {{Lang::get('lang.disabled')}} -
    - -
    - -
    - -
    - -
    - - {!! Form::label('fetching_host',Lang::get('lang.host_name')) !!} - {!! $errors->first('fetching_host', ':message') !!} - {!! Form::text('fetching_host',null,['class' => 'form-control']) !!} - -
    - -
    - - {!! Form::label('fetching_port',Lang::get('lang.port_number')) !!} - {!! $errors->first('fetching_port', ':message') !!} - {!! Form::text('fetching_port',null,['class' => 'form-control']) !!} - -
    - - -
    - - {!! Form::label('mailbox_protocol',Lang::get('lang.mail_box_protocol')) !!} - {!! $errors->first('mailbox_protocol', ':message') !!} - {!!Form::select('mailbox_protocol',['Mailbox Protocols'=>$mailbox_protocols->lists('name','id')],null,['class' => 'form-control select']) !!} - -
    - -{{--
    - - {!! Form::label('imap_config',Lang::get('lang.imap_config')) !!} - {!! $errors->first('imap_config', ':message') !!} - {!! Form::text('imap_config',null,['class' => 'form-control']) !!} - -
    --}} - -
    - -
    - -
    - -
    - -

    Sending Email via SMTP

    - -
    - -
    - -
    - -
    - -
    - {!! Form::label('sending_status',Lang::get('lang.status')) !!} -
    -
    - {!! Form::radio('sending_status','1',true) !!} {{Lang::get('lang.enable')}} -
    -
    - {!! Form::radio('sending_status','0',null) !!} {{Lang::get('lang.disabled')}} -
    - -
    - -
    - -
    - -
    - - {!! Form::label('sending_host',Lang::get('lang.host_name')) !!} - {!! $errors->first('sending_host', ':message') !!} - {!! Form::text('sending_host',null,['class' => 'form-control']) !!} - -
    - -
    - - {!! Form::label('sending_port',Lang::get('lang.port_number')) !!} - {!! $errors->first('sending_port', ':message') !!} - {!! Form::text('sending_port',null,['class' => 'form-control']) !!} - -
    - -
    - - {!! Form::label('sending_encryption',Lang::get('lang.encryption')) !!} - {!! $errors->first('sending_encryption', ':message') !!} - {!!Form::select('sending_encryption',['ssl'=>'SSL','tls'=>'TLS'],null,['class' => 'form-control select']) !!} - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - {!! Form::label('internal_notes',Lang::get('lang.internal_notes')) !!} - {!! Form::textarea('internal_notes',null,['class' => 'form-control','size' => '30x5']) !!} - -
    - - {!!Form::close()!!} - +
    + +
    +
    +

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

    +
    +
    + +
    +
    +
    + +
    + {!! Form::label('email_address',Lang::get('lang.email_address')) !!} + {!! $errors->first('email_address', ':message') !!} + {!! Form::text('email_address',null,['class' => 'form-control', 'id' => 'email_address']) !!} +
    + +
    + {!! Form::label('email_name',Lang::get('lang.from_name')) !!} + {!! $errors->first('email_name', ':message') !!} + {!! Form::text('email_name',null,['class' => 'form-control', 'id' => 'email_name']) !!} +
    + +
    + {!! Form::label('password',Lang::get('lang.password')) !!} + {!! $errors->first('password', ':message') !!} + {!! Form::password('password',['class' => 'form-control', 'id' => 'password']) !!} +
    +
    +
    +
    +

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

    +
    +
    +
    + +
    + {!! Form::label('department',Lang::get('lang.department')) !!} + {!! $errors->first('department', ':message') !!} + {!!Form::select('department', [''=>'--System Default--','departments'=>$departments->lists('name','id')],null,['class' => 'form-control select', 'id' => 'department' ]) !!} +
    + +
    + {!! Form::label('priority',Lang::get('lang.priority')) !!} + {!! $errors->first('priority', ':message') !!} + {!!Form::select('priority', [''=>'--System Default--','Priorities'=>$priority->lists('priority_desc','priority_id')],null,['class' => 'form-control select', 'id' => 'priority']) !!} +
    + +
    + {!! Form::label('help_topic',Lang::get('lang.help_topic')) !!} + {!! $errors->first('help_topic', ':message') !!} + {!!Form::select('help_topic', [''=>'--System Default--','Help Topics'=>$helps->lists('topic','id')],null,['class' => 'form-control select', 'id' => 'help_topic']) !!} +
    +
    +
    +
    +

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

    +
    +
    +
    +
    + +
    + {!! Form::label('fetching_status',Lang::get('lang.status')) !!} +
    +
    + + {{Lang::get('lang.enable')}} +
    +
    + +
    +
    +
    +
    +
    + {!! Form::label('fetching_protocol',Lang::get('lang.fetching_protocol')) !!} + {!! $errors->first('fetching_protocol', ':message') !!} + {!!Form::select('fetching_protocol',['imap' => 'IMAP'],null,['class' => 'form-control select', 'id' => 'fetching_protocol']) !!} +
    +
    + {!! Form::label('fetching_host',Lang::get('lang.host_name')) !!} + {!! $errors->first('fetching_host', ':message') !!} + {!! Form::text('fetching_host',null,['class' => 'form-control', 'id' => 'fetching_host']) !!} +
    +
    + {!! Form::label('fetching_port',Lang::get('lang.port_number')) !!} + {!! $errors->first('fetching_port', ':message') !!} + {!! Form::text('fetching_port',null,['class' => 'form-control', 'id' => 'fetching_port']) !!} +
    +
    + {!! Form::label('fetching_encryption',Lang::get('lang.encryption')) !!} + {!! $errors->first('fetching_encryption', ':message') !!} + {!!Form::select('fetching_encryption',['none' => 'None', 'ssl' => 'SSL', 'tls' => 'TLS', 'ssl/novalidate-cert' => 'SSL (Accept all certificates)', 'tls/novalidate-cert' => 'TLS (Accept all certificates)'],null,['class' => 'form-control select', 'id' => 'fetching_encryption']) !!} +
    +
    +
    +
    +

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

    +
    +
    +
    + +
    +
    + {!! Form::label('sending_status',Lang::get('lang.status')) !!} +
    +
    + {!! Lang::get('lang.enable') !!} +
    +
    + +
    +
    +
    +
    + +
    + {!! Form::label('sending_protocol',Lang::get('lang.transfer_protocol')) !!} + {!! $errors->first('sending_protocol', ':message') !!} + {!!Form::select('sending_protocol',['smtp'=>'SMTP'],null,['class' => 'form-control select']) !!} +
    + +
    + {!! Form::label('sending_host',Lang::get('lang.host_name')) !!} + {!! $errors->first('sending_host', ':message') !!} + {!! Form::text('sending_host',null,['class' => 'form-control']) !!} +
    + +
    + {!! Form::label('sending_port',Lang::get('lang.port_number')) !!} + {!! $errors->first('sending_port', ':message') !!} + {!! Form::text('sending_port',null,['class' => 'form-control']) !!} +
    + +
    + {!! Form::label('sending_encryption',Lang::get('lang.encryption')) !!} + {!! $errors->first('sending_encryption', ':message') !!} + {!!Form::select('sending_encryption',['ssl'=>'SSL','tls'=>'TLS'],null,['class' => 'form-control select']) !!} +
    +
    + +
    + {!! Form::label('internal_notes',Lang::get('lang.internal_notes')) !!} + {!! Form::textarea('internal_notes',null,['class' => 'form-control','size' => '30x10']) !!} +
    +
    + +
    +
    + + -
    -@stop + + + + +@stop \ No newline at end of file diff --git a/resources/views/themes/default1/admin/helpdesk/emails/emails/edit.blade.php b/resources/views/themes/default1/admin/helpdesk/emails/emails/edit.blade.php index 587ff61b8..20c71b662 100644 --- a/resources/views/themes/default1/admin/helpdesk/emails/emails/edit.blade.php +++ b/resources/views/themes/default1/admin/helpdesk/emails/emails/edit.blade.php @@ -16,7 +16,7 @@ class="active" @stop @section('PageHeader') - +

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

    @stop @@ -31,226 +31,406 @@ class="active" @section('content') - - {!!Form::model($emails,['url'=>'emails/'.$emails->id,'method'=>'PATCH'])!!} -
    -
    - -

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

    {!! Form::submit(Lang::get('lang.save'),['class'=>'form-group btn btn-primary pull-right'])!!} - -
    - -
    - -
    - -
    - - {!! Form::label('email_address',Lang::get('lang.email_address')) !!} - {!! $errors->first('email_address', ':message') !!} - {!! Form::text('email_address',null,['disabled'=>'disabled','class' => 'form-control']) !!} - -
    - -
    - - {!! Form::label('email_name',Lang::get('lang.email_name')) !!} - {!! $errors->first('email_name', ':message') !!} - {!! Form::text('email_name',null,['class' => 'form-control']) !!} - -
    - -
    - -
    - -
    - - {!! Form::label('department',Lang::get('lang.department')) !!} - {!! $errors->first('department', ':message') !!} - {!!Form::select('department', [''=>'--System Default--','departments'=>$departments->lists('name','id')],null,['class' => 'form-control select']) !!} - -
    - -
    - - {!! Form::label('priority',Lang::get('lang.priority')) !!} - {!! $errors->first('priority', ':message') !!} - {!!Form::select('priority', [''=>'--System Default--','Priorities'=>$priority->lists('priority_desc','priority_id')],null,['class' => 'form-control select']) !!} - -
    - -
    - - {!! Form::label('help_topic',Lang::get('lang.help_topic')) !!} - {!! $errors->first('help_topic', ':message') !!} - {!!Form::select('help_topic', [''=>'--System Default--','Help Topics'=>$helps->lists('topic','id')],null,['class' => 'form-control select']) !!} -
    - -
    - - {{--
    --}} - - {{-- {!! Form::label('',Lang::get('lang.auto_response')) !!} --}} - {{--
    --}} - {{-- {!! Form::checkbox('auto_response',1,null,['class' => 'checkbox']) !!} --}} - {{--
    --}} - {{--
    --}} -
    - -
    - -
    - -

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

    - -
    - -
    - -
    - - -
    - - {!! Form::label('password',Lang::get('lang.password')) !!} - {!! $errors->first('password', ':message') !!} - - -
    - -
    - -
    - -
    - -
    - -

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

    - -
    - -
    - -
    - -
    - -
    - {!! Form::label('fetching_status',Lang::get('lang.status')) !!} -
    -
    - {!! Form::radio('fetching_status','1',true) !!} {{Lang::get('lang.enable')}} -
    -
    - {!! Form::radio('fetching_status','0',null) !!} {{Lang::get('lang.disabled')}} -
    - -
    - -
    - -
    - -
    - - {!! Form::label('fetching_host',Lang::get('lang.host_name')) !!} - {!! Form::text('fetching_host',null,['class' => 'form-control']) !!} - -
    - -
    - - {!! Form::label('fetching_port',Lang::get('lang.port_number')) !!} - {!! Form::text('fetching_port',null,['class' => 'form-control']) !!} - -
    - - -
    - - {!! Form::label('mailbox_protocol',Lang::get('lang.mail_box_protocol')) !!} - {!! $errors->first('mailbox_protocol', ':message') !!} - {!!Form::select('mailbox_protocol',['Mailbox Protocols'=>$mailbox_protocols->lists('name','id')],null,['class' => 'form-control select']) !!} - -
    - -
    - -
    - -
    - -
    - -

    Sending Email via SMTP

    - -
    - -
    - -
    - -
    - -
    - {!! Form::label('sending_status',Lang::get('lang.status')) !!} -
    -
    - {!! Form::radio('sending_status','1',true) !!} {{Lang::get('lang.enable')}} -
    -
    - {!! Form::radio('sending_status','0',null) !!} {{Lang::get('lang.disabled')}} -
    - -
    - -
    - -
    - -
    - - {!! Form::label('sending_host',Lang::get('lang.host_name')) !!} - {!! $errors->first('sending_host', ':message') !!} - {!! Form::text('sending_host',null,['class' => 'form-control']) !!} - -
    - - -
    - - {!! Form::label('sending_port',Lang::get('lang.port_number')) !!} - {!! $errors->first('sending_port', ':message') !!} - {!! Form::text('sending_port',null,['class' => 'form-control']) !!} - -
    - - -
    - - {!! Form::label('sending_encryption',Lang::get('lang.encryption')) !!} - {!! $errors->first('sending_encryption', ':message') !!} - {!!Form::select('sending_encryption',['ssl'=>'SSL','tls'=>'TLS'],null,['class' => 'form-control select']) !!} - - -
    - -
    - - - - -
    - - {!! Form::label('internal_notes',Lang::get('lang.internal_notes')) !!} - {!! Form::textarea('internal_notes',null,['class' => 'form-control','size' => '30x5']) !!} - -
    - - {!!Form::close()!!} - +{!!Form::model($emails,['url'=>'','id'=>'form'])!!} + +
    +
    +

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

    +
    +
    + +
    +
    +
    + +
    + + {!! Form::label('email_address',Lang::get('lang.email_address')) !!} + {!! $errors->first('email_address', ':message') !!} + {!! Form::text('email_address',null,['class' => 'form-control']) !!} + +
    + +
    + {!! Form::label('email_name',Lang::get('lang.from_name')) !!} + {!! $errors->first('email_name', ':message') !!} + {!! Form::text('email_name',null,['class' => 'form-control', 'id' => 'email_name']) !!} +
    + +
    + {!! Form::label('password',Lang::get('lang.password')) !!} + {!! $errors->first('password', ':message') !!} + password) !!} > +
    +
    +
    +
    +

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

    +
    +
    +
    + +
    + + {!! Form::label('department',Lang::get('lang.department')) !!} + {!! $errors->first('department', ':message') !!} + {!!Form::select('department', [''=>'--System Default--','departments'=>$departments->lists('name','id')],null,['class' => 'form-control select']) !!} + +
    + +
    + + {!! Form::label('priority',Lang::get('lang.priority')) !!} + {!! $errors->first('priority', ':message') !!} + {!!Form::select('priority', [''=>'--System Default--','Priorities'=>$priority->lists('priority_desc','priority_id')],null,['class' => 'form-control select']) !!} + +
    + +
    + + {!! Form::label('help_topic',Lang::get('lang.help_topic')) !!} + {!! $errors->first('help_topic', ':message') !!} + {!!Form::select('help_topic', [''=>'--System Default--','Help Topics'=>$helps->lists('topic','id')],null,['class' => 'form-control select']) !!} +
    + +
    +
    +
    +

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

    +
    +
    +
    +
    + +
    + {!! Form::label('fetching_status',Lang::get('lang.status')) !!} +
    +
    + + fetching_status == 1) { + echo "checked='checked'"; +} ?>> {{Lang::get('lang.enable')}} +
    +
    + +
    +
    +
    +
    +
    + {!! Form::label('fetching_protocol',Lang::get('lang.fetching_protocol')) !!} + {!! $errors->first('fetching_protocol', ':message') !!} + {!!Form::select('fetching_protocol',['imap' => 'IMAP'],null,['class' => 'form-control select', 'id' => 'fetching_protocol']) !!} +
    +
    + {!! Form::label('fetching_host',Lang::get('lang.host_name')) !!} + {!! $errors->first('fetching_host', ':message') !!} + {!! Form::text('fetching_host',null,['class' => 'form-control', 'id' => 'fetching_host']) !!} +
    +
    + {!! Form::label('fetching_port',Lang::get('lang.port_number')) !!} + {!! $errors->first('fetching_port', ':message') !!} + {!! Form::text('fetching_port',null,['class' => 'form-control', 'id' => 'fetching_port']) !!} +
    +
    + {!! Form::label('fetching_encryption',Lang::get('lang.encryption')) !!} + {!! $errors->first('fetching_encryption', ':message') !!} + {!!Form::select('fetching_encryption',['none' => 'None', 'ssl' => 'SSL', 'tls' => 'TLS', 'ssl/novalidate-cert' => 'SSL (Accept all certificates)', 'tls/novalidate-cert' => 'TLS (Accept all certificates)'],null,['class' => 'form-control select', 'id' => 'fetching_encryption']) !!} +
    +
    +
    +
    +

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

    +
    +
    +
    + +
    +
    + {!! Form::label('sending_status',Lang::get('lang.status')) !!} +
    +
    + sending_status == 1) { + echo "checked='checked'"; +} ?>> {!! Lang::get('lang.enable') !!} +
    +
    + +
    +
    +
    +
    + +
    + {!! Form::label('sending_protocol',Lang::get('lang.transfer_protocol')) !!} + {!! $errors->first('sending_protocol', ':message') !!} + {!!Form::select('sending_protocol',['smtp'=>'SMTP'],null,['class' => 'form-control select']) !!} +
    + +
    + {!! Form::label('sending_host',Lang::get('lang.host_name')) !!} + {!! $errors->first('sending_host', ':message') !!} + {!! Form::text('sending_host',null,['class' => 'form-control']) !!} +
    + +
    + {!! Form::label('sending_port',Lang::get('lang.port_number')) !!} + {!! $errors->first('sending_port', ':message') !!} + {!! Form::text('sending_port',null,['class' => 'form-control']) !!} +
    + +
    + {!! Form::label('sending_encryption',Lang::get('lang.encryption')) !!} + {!! $errors->first('sending_encryption', ':message') !!} + {!!Form::select('sending_encryption',['ssl'=>'SSL','tls'=>'TLS'],null,['class' => 'form-control select']) !!} +
    +
    + +
    + {!! Form::label('internal_notes',Lang::get('lang.internal_notes')) !!} + {!! Form::textarea('internal_notes',null,['class' => 'form-control','size' => '30x10']) !!} +
    +
    +
    +{!!Form::close()!!} + + + + + + + @stop diff --git a/resources/views/themes/default1/admin/helpdesk/setting.blade.php b/resources/views/themes/default1/admin/helpdesk/setting.blade.php index 28fab2361..3c0858989 100644 --- a/resources/views/themes/default1/admin/helpdesk/setting.blade.php +++ b/resources/views/themes/default1/admin/helpdesk/setting.blade.php @@ -3,9 +3,7 @@ @stop @section('PageHeader') -
    -

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

    -
    +

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

    @stop @@ -16,7 +14,6 @@ @section('content') -

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

    diff --git a/resources/views/themes/default1/admin/helpdesk/settings/email.blade.php b/resources/views/themes/default1/admin/helpdesk/settings/email.blade.php index 75f7ee851..cd9b6cf86 100644 --- a/resources/views/themes/default1/admin/helpdesk/settings/email.blade.php +++ b/resources/views/themes/default1/admin/helpdesk/settings/email.blade.php @@ -29,164 +29,89 @@ class="active" @section('content') - - {!! Form::model($emails,['url' => 'postemail/'.$emails->id, 'method' => 'PATCH']) !!} - -
    - -
    - -
    -
    +{!! Form::model($emails,['url' => 'postemail/'.$emails->id, 'method' => 'PATCH']) !!} +
    +
    +
    +

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

    - {!! Form::submit(Lang::get('lang.save'),['class'=>'btn btn-primary'])!!} -
    + {!! Form::submit(Lang::get('lang.save'),['class'=>'btn btn-primary'])!!} +
    - - -@if(Session::has('success')) -
    - - Success! - - {{Session::get('success')}} -
    - @endif - - @if(Session::has('fails')) -
    - - Fail! - - {{Session::get('fails')}} -
    - @endif - - -
    -
    - - {{--
    --}} - {{--
    --}} - {{-- {!! Form::label('template',Lang::get('lang.default_template')) !!} --}} - {{-- {!! $errors->first('template', ':message') !!} --}} - {{-- {!!Form::select('template', $templates->lists('name','name'),null,['class'=>'form-control']) !!} --}} - {{--
    --}} - {{--
    --}} - - -
    -
    -
    - {!! Form::label('sys_email',Lang::get('lang.default_system_email')) !!} - {!! $errors->first('sys_email', ':message') !!} - {!!Form::select('sys_email', [ 'Select an Email', 'Emails' => $emails1->lists('email_name','id')],null,['class'=>'form-control']) !!} -
    -
    -
    - - - {{--
    --}} - {{--
    --}} - {{-- {!! Form::label('alert_email',Lang::get('lang.default_alert_email')) !!} --}} - {{-- {!! $errors->first('alert_email', ':message') !!} --}} - {{-- {!!Form::select('alert_email', $emails1->lists('email_address','email_address'),null,['class'=>'form-control']) !!} --}} - {{--
    --}} - {{--
    --}} - - {{--
    --}} - {{--
    --}} - {{-- {!! Form::label('alert_email',Lang::get('lang.default_MTA')) !!} --}} - {{-- {!!Form::select('alert_email',['use PHP Mail function'],null,['class'=>'form-control']) !!} --}} - {{--
    --}} - {{--
    --}} - -
    -
    - - {!! Form::label('email_fetching',Lang::get('lang.email_fetch')) !!}
    - {!! Form::checkbox('email_fetching',1,true) !!} {{Lang::get('lang.fetch_auto-corn')}} -
    -
    -
    -
    -
    -
    - {!! Form::checkbox('notification_cron',1,true) !!} {{Lang::get('lang.cron_notification')}} -
    -
    -
    - -
    -
    + @if(Session::has('success')) +
    + + Success! + + {{Session::get('success')}} +
    + @endif + + @if(Session::has('fails')) +
    + + Fail! + + {{Session::get('fails')}} +
    + @endif +
    +
    + +
    +
    +
    + {!! Form::label('sys_email',Lang::get('lang.default_system_email')) !!} + {!! $errors->first('sys_email', ':message') !!} + {!!Form::select('sys_email', [ 'Select an Email', 'Emails' => $emails1->lists('email_name','id')],null,['class'=>'form-control']) !!} +
    +
    +
    + +
    - {!! Form::checkbox('all_emails',1,true) !!} {{Lang::get('lang.accept_all_email')}} - -
    -
    -
    - - -
    - {{--
    --}} - {{--
    --}} - - {{-- {!! Form::label('admin_email',Lang::get('lang.admin_email')) !!} --}} - {{-- {!! $errors->first('admin_email', ':message') !!} --}} - {{-- {!! Form::text('admin_email',null,['class' => 'form-control']) !!} --}} - {{--
    --}} - {{--
    --}} - - {{--
    --}} - {{--
    --}} - {{-- {!! Form::label('separator',Lang::get('lang.reply_separator')) !!} --}} - {{-- {!! $errors->first('separator', ':message') !!} --}} - {{-- {!! Form::text('separator',null,['class' => 'form-control']) !!} --}} - {{--
    --}} - {{--
    --}} -
    - -
    -
    -
    - {!! Form::checkbox('email_collaborator',1) !!} {{Lang::get('lang.accept_email_collab')}} - - -
    -
    -
    - - {{--
    --}} - {{--
    --}} - {{--
    --}} - {{-- {!! Form::checkbox('strip',1,['class' => 'form-control']) !!} {{Lang::get('lang.strip_quoted_reply')}} --}} - - - {{--
    --}} - {{--
    --}} - {{--
    --}} - -
    -
    -
    - {!! Form::checkbox('attachment',1) !!} {{Lang::get('lang.attachments')}} - - -
    -
    -
    - - - - - - - -
    -
    -
    -
    -
    - + {!! Form::label('email_fetching',Lang::get('lang.email_fetch')) !!}
    + {!! Form::checkbox('email_fetching',1,true) !!} {{Lang::get('lang.fetch_auto-corn')}} +
    +
    +
    +
    +
    +
    + {!! Form::checkbox('notification_cron',1,true) !!} {{Lang::get('lang.cron_notification')}} +
    +
    +
    + +
    +
    +
    + {!! Form::checkbox('all_emails',1,true) !!} {{Lang::get('lang.accept_all_email')}} +
    +
    +
    + +
    +
    + +
    +
    +
    + {!! Form::checkbox('email_collaborator',1) !!} {{Lang::get('lang.accept_email_collab')}} +
    +
    +
    + +
    +
    +
    + {!! Form::checkbox('attachment',1) !!} {{Lang::get('lang.attachments')}} +
    +
    +
    +
    +
    +
    +
    @stop diff --git a/resources/views/themes/default1/admin/helpdesk/settings/system.blade.php b/resources/views/themes/default1/admin/helpdesk/settings/system.blade.php index 21721b47a..7467998a0 100644 --- a/resources/views/themes/default1/admin/helpdesk/settings/system.blade.php +++ b/resources/views/themes/default1/admin/helpdesk/settings/system.blade.php @@ -32,18 +32,18 @@ class="active" - {!! Form::model($systems,['url' => 'postsystem/'.$systems->id, 'method' => 'PATCH' , 'id'=>'formID']) !!} +{!! Form::model($systems,['url' => 'postsystem/'.$systems->id, 'method' => 'PATCH' , 'id'=>'formID']) !!} -
    +
    -

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

    {!! Form::submit('Save',['onclick'=>'sendForm()','class'=>'btn btn-primary pull-right'])!!} - +

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

    {!! Form::submit('Save',['onclick'=>'sendForm()','class'=>'btn btn-primary pull-right'])!!} +
    -@if(Session::has('success')) + @if(Session::has('success'))
    Success! @@ -62,122 +62,136 @@ class="active" @endif - - -
    -
    -
    -
    - {!! Form::label('status',Lang::get('lang.status')) !!} -
    -
    - {!! Form::radio('status','1',true) !!} {{Lang::get('lang.online')}} -
    -
    - {!! Form::radio('status','0') !!} {{Lang::get('lang.offline')}} -
    -
    -
    -
    + + +
    +
    +
    +
    + {!! Form::label('status',Lang::get('lang.status')) !!} +
    +
    + {!! Form::radio('status','1',true) !!} {{Lang::get('lang.online')}} +
    +
    + {!! Form::radio('status','0') !!} {{Lang::get('lang.offline')}} +
    +
    +
    +
    - - -
    -
    - {!! Form::label('name',Lang::get('lang.name/title')) !!} - {!! $errors->first('name', ':message') !!} - {!! Form::text('name',$systems->name,['class' => 'form-control']) !!} -
    -
    - - - -
    -
    - {!! Form::label('url',Lang::get('lang.url')) !!} - {!! $errors->first('url', ':message') !!} - {!! Form::text('url',$systems->url,['class' => 'form-control']) !!} -
    -
    - - -
    -
    - - {!! Form::label('department',Lang::get('lang.default_department')) !!} - {!! $errors->first('department', ':message') !!} - {!!Form::select('department', [''=>'Select a Department','Department'=>$departments->lists('name','id')],null,['class'=>'form-control']) !!} - -
    -
    - - -
    -
    - {!! Form::label('time_zone',Lang::get('lang.timezone')) !!} - {!! $errors->first('time_zone', ':message') !!} - {!!Form::select('time_zone',[''=>'Select a Time Zone','Time Zones'=>$timezones->lists('name','id')],null,['class'=>'form-control']) !!} -
    -
    - - - +
    -
    +
    + {!! Form::label('name',Lang::get('lang.name/title')) !!} + {!! $errors->first('name', ':message') !!} + {!! Form::text('name',$systems->name,['class' => 'form-control']) !!} +
    +
    - {!! Form::label('date_time_format',Lang::get('lang.date_time')) !!} - {!! $errors->first('date_time_format', ':message') !!} - {!! Form::select('date_time_format',[''=>'Select a date Time Format','Date Time Formats'=>$date_time->lists('format','id')],null,['class' => 'form-control']) !!} -
    -
    + +
    +
    + {!! Form::label('url',Lang::get('lang.url')) !!} + {!! $errors->first('url', ':message') !!} + {!! Form::text('url',$systems->url,['class' => 'form-control']) !!} +
    +
    -
    + +
    +
    -
    -

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

    + {!! Form::label('department',Lang::get('lang.default_department')) !!} + {!! $errors->first('department', ':message') !!} + {!!Form::select('department', [''=>'Select a Department','Department'=>$departments->lists('name','id')],null,['class'=>'form-control']) !!} - -
    - -
    -
    - {!! Form::label('api',Lang::get('lang.api')) !!} - {!! $errors->first('api_enable', ':message') !!} -
    -
    - {!! Form::radio('api_enable','1',true) !!} {{Lang::get('lang.enable')}} -
    -
    - {!! Form::radio('api_enable','0') !!} {{Lang::get('lang.disable')}} -
    -
    -
    -
    +
    +
    - + +
    +
    + {!! Form::label('time_zone',Lang::get('lang.timezone')) !!} + {!! $errors->first('time_zone', ':message') !!} + {!!Form::select('time_zone',[''=>'Select a Time Zone','Time Zones'=>$timezones->lists('name','id')],null,['class'=>'form-control']) !!} +
    +
    -
    -
    - {!! Form::label('api_key',Lang::get('lang.api_key')) !!} - {!! $errors->first('api_key', ':message') !!} - {!! Form::text('api_key',$systems->api_key,['class' => 'form-control']) !!} + -
    -
    + - - - +
    + +
    + +
    +

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

    + + +
    + +
    +
    + {!! Form::label('api',Lang::get('lang.api')) !!} + {!! $errors->first('api_enable', ':message') !!} +
    +
    + {!! Form::radio('api_enable','1',true) !!} {{Lang::get('lang.enable')}} +
    +
    + {!! Form::radio('api_enable','0') !!} {{Lang::get('lang.disable')}} +
    +
    +
    +
    + +
    +
    + {!! Form::label('api_key_mandatory',Lang::get('lang.api_key_mandatory')) !!} + {!! $errors->first('api_key_mandatory', ':message') !!} +
    +
    + {!! Form::radio('api_key_mandatory','1',true) !!} {{Lang::get('lang.enable')}} +
    +
    + {!! Form::radio('api_key_mandatory','0') !!} {{Lang::get('lang.disable')}} +
    +
    +
    +
    + + + +
    +
    + + {!! Form::label('api_key',Lang::get('lang.api_key')) !!} + {!! $errors->first('api_key', ':message') !!} + {!! Form::text('api_key',$systems->api_key,['class' => 'form-control']) !!} + +
    +
    + + +
    +
    + + @endif
    - {!! Form::open(['route'=>'select_all','method'=>'post']) !!} + {!! Form::open(['id'=>'modalpopup', 'route'=>'select_all','method'=>'post']) !!}
    {{-- --}} - - - + + +
    @@ -95,12 +95,12 @@ class="active"
    @@ -139,23 +139,45 @@ class="active"
    + + + @stop \ No newline at end of file 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 7ee568a9f..d58a281b4 100644 --- a/resources/views/themes/default1/agent/helpdesk/ticket/open.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/ticket/open.blade.php @@ -49,12 +49,13 @@ class="active"
    @endif
    - {!! Form::open(['route'=>'select_all','method'=>'post']) !!} + {!! Form::open(['id'=>'modalpopup', 'route'=>'select_all','method'=>'post']) !!}
    - - + + +
    @@ -79,51 +80,343 @@ class="active"
    + + + + + + + + @stop \ No newline at end of file diff --git a/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php b/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php index ded489b18..cc962362a 100644 --- a/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php +++ b/resources/views/themes/default1/agent/helpdesk/ticket/timeline.blade.php @@ -113,7 +113,7 @@ active