Update v1.0.6.6

This commit is contained in:
sujitprasad
2016-03-11 18:36:32 +05:30
parent a77b7bf3e7
commit d54019198f
51 changed files with 4234 additions and 2401 deletions

16
.env
View File

@@ -1,17 +1,17 @@
APP_ENV=local APP_ENV=local
APP_DEBUG=false APP_DEBUG=false
APP_KEY=SomeRandomString APP_KEY=SomeRandomString
DB_TYPE=mysql
DB_HOST=localhost DB_HOST=localhost
DB_DATABASE=faveo-dev DB_PORT=
DB_USERNAME=ladybird DB_DATABASE=faveo
DB_PASSWORD=ladybird DB_USERNAME=root
CACHE_DRIVER=file DB_PASSWORD=
SESSION_DRIVER=file
QUEUE_DRIVER=sync
MAIL_DRIVER=smtp MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io MAIL_HOST=mailtrap.io
MAIL_PORT=2525 MAIL_PORT=2525
MAIL_USERNAME=null MAIL_USERNAME=null
MAIL_PASSWORD=null MAIL_PASSWORD=null
DB_TYPE=mysql CACHE_DRIVER=file
DB_PORT= SESSION_DRIVER=file
QUEUE_DRIVER=sync

View File

@@ -1,10 +1,10 @@
<h3>About Faveo</h3> <h3>Development Branch of Faveo</h3>
<br><img src="https://travis-ci.org/ladybirdweb/faveo-helpdesk.svg?branch=master">&nbsp;<img src="https://img.shields.io/badge/License-OSL-blue.svg">&nbsp;<a href="https://gitter.im/ladybirdweb/faveo-helpdesk" target="_blank"><img src="https://badges.gitter.im/ladybirdweb/faveo-helpdesk.svg"></a>&nbsp;<a href="https://styleci.io/repos/34716238"><img src="https://styleci.io/repos/34716238/shield" alt="StyleCI" height="19px"></a>&nbsp;<a href="http://squizlabs.github.io/PHP_CodeSniffer/analysis/ladybirdweb/faveo-helpdesk/index.html" target="_blank"><img src="http://squizlabs.github.io/PHP_CodeSniffer/analysis/ladybirdweb/faveo-helpdesk/grade.svg" height="20px"></a>&nbsp;<a href="https://scrutinizer-ci.com/g/ladybirdweb/faveo-helpdesk/?branch=master" target="_blank"><img src="https://scrutinizer-ci.com/g/ladybirdweb/faveo-helpdesk/badges/quality-score.png?b=master" height="20px"></a></br> <br><a href="https://travis-ci.org/mverma16/faveo-helpdesk"><img src="https://travis-ci.org/mverma16/faveo-helpdesk.svg?branch=master"></a>&nbsp;<img src="https://img.shields.io/badge/License-OSL-blue.svg">&nbsp;<a href="https://gitter.im/ladybirdweb/faveo-helpdesk" target="_blank"><img src="https://badges.gitter.im/ladybirdweb/faveo-helpdesk.svg"></a>&nbsp;<a href="https://styleci.io/repos/52062487"><img src="https://styleci.io/repos/52062487/shield" alt="StyleCI"></a>&nbsp;<a href="http://squizlabs.github.io/PHP_CodeSniffer/analysis/ladybirdweb/faveo-helpdesk/index.html" target="_blank"><img src="http://squizlabs.github.io/PHP_CodeSniffer/analysis/ladybirdweb/faveo-helpdesk/grade.svg" height="21px"></a></br>
<p>Headquartered in Bangalore, Faveo HELPDESK provides Businesses with an automated Helpdesk system to manage customer support. <p>Headquartered in Bangalore, Faveo HELPDESK provides Businesses with an automated Helpdesk system to manage customer support.
<br/><br/> <br/><br/>
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 SMEs empowering them with state of art, ticket based support system. In todays 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. 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 SMEs empowering them with state of art, ticket based support system. In todays 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.
<br/><br/> <br/><br/>
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.
<br/><br/> <br/><br/>
Faveo can also be customised according to requirement and we do undertake such request. Faveo can also be customised according to requirement and we do undertake such request.
<br/><br/> <br/><br/>

View File

@@ -54,29 +54,30 @@ class Handler extends ExceptionHandler
*/ */
public function render($request, Exception $e) public function render($request, Exception $e)
{ {
if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) { // $phpmail = new PhpMailController;
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); // if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
} elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) { // return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
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) { // // This is to check if the debug is true or false
// checking if the error is actually an error page or if its an system error page // if (config('app.debug') == false) {
if ($this->isHttpException($e) && $e->getStatusCode() == 404) { // // checking if the error is actually an error page or if its an system error page
return response()->view('errors.404', []); // if ($this->isHttpException($e) && $e->getStatusCode() == 404) {
} else { // return response()->view('errors.404', []);
// checking if the application is installed // } else {
if (\Config::get('database.install') == 1) { // // checking if the application is installed
// checking if the error log send to Ladybirdweb is enabled or not // if (\Config::get('database.install') == 1) {
if (\Config::get('app.ErrorLog') == '%1%') { // // checking if the error log send to Ladybirdweb is enabled or not
//$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]); // 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', []); //
} // return response()->view('errors.500', []);
} // }
// returns non oops error message // }
// // returns non oops error message
return parent::render($request, $e); return parent::render($request, $e);
// checking if the error is related to http error i.e. page not found // checking if the error is related to http error i.e. page not found
if ($this->isHttpException($e)) { if ($this->isHttpException($e)) {

View File

@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Admin\helpdesk;
// controller // controller
use App\Http\Controllers\Common\PhpMailController; use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
// request // request
use App\Http\Requests\helpdesk\AgentRequest; 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\Department;
use App\Model\helpdesk\Agent\Groups; use App\Model\helpdesk\Agent\Groups;
use App\Model\helpdesk\Agent\Teams; 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\Model\helpdesk\Utility\Timezones;
use App\User; use App\User;
// classes // classes
use DB; use DB;
use Exception; use Exception;
use Hash; use Hash;
use Mail;
/** /**
* AgentController * AgentController
* This controller is used to CRUD category. * This controller is used to CRUD Agents.
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
@@ -44,8 +39,8 @@ class AgentController extends Controller
*/ */
public function __construct(PhpMailController $PhpMailController) public function __construct(PhpMailController $PhpMailController)
{ {
// creating an instance for the PhpmailController
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
SettingsController::smtp();
// checking authentication // checking authentication
$this->middleware('auth'); $this->middleware('auth');
// checking admin roles // checking admin roles
@@ -55,84 +50,89 @@ class AgentController extends Controller
/** /**
* Get all agent list page. * Get all agent list page.
* *
* @param type User $user * @return type view
*
* @return type Response
*/ */
public function index() public function index()
{ {
try { try {
return view('themes.default1.admin.helpdesk.agent.agents.index'); return view('themes.default1.admin.helpdesk.agent.agents.index');
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails', $e->getMessage());
} }
} }
/** /**
* creating a new agent. * creating a new agent.
* *
* @param type Assign_team_agent $team_assign_agent * @param Assign_team_agent $team_assign_agent
* @param type Timezones $timezone * @param Timezones $timezone
* @param type Groups $group * @param Groups $group
* @param type Department $department * @param Department $department
* @param type Teams $team * @param Teams $team_all
* *
* @return type view * @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 { try {
$team = $team->get(); // gte all the teams
$team = $team_all->get();
// get all the timezones
$timezones = $timezone->get(); $timezones = $timezone->get();
// get all the groups
$groups = $group->get(); $groups = $group->get();
// get all department
$departments = $department->get(); $departments = $department->get();
// list all the teams in a single variable
$teams = $team->lists('id', 'name'); $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')); return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team'));
} catch (Exception $e) { } 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. * store a new agent.
* *
* @param type User $user * @param User $user
* @param type AgentRequest $request * @param AgentRequest $request
* @param type Assign_team_agent $team_assign_agent * @param Assign_team_agent $team_assign_agent
* *
* @return type Response * @return type Response
*/ */
public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent) public function store(User $user, AgentRequest $request)
{ {
// fixing the user role to agent
// dd($this->system_mail());
/* Insert to user table */
$user->role = 'agent';
$user->fill($request->input())->save(); $user->fill($request->input())->save();
$password = $this->generateRandomString(); // generate password and has immediately to store
$user->password = Hash::make($password); $user->password = Hash::make($this->generateRandomString());
// fetching all the team details checked for this user
$requests = $request->input('team_id'); $requests = $request->input('team_id');
// get user id of the inserted user detail
$id = $user->id; $id = $user->id;
// insert team // insert team
foreach ($requests as $req) { 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) { if ($user->save() == true) {
// fetch user credentails to send mail
$name = $user->user_name; $name = $user->user_name;
$email = $user->email; $email = $user->email;
$system_from = $this->company();
try { try {
// send mail on registration // 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]); $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) { } 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'); 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'); return redirect('agents')->with('success', 'Agent Created sucessfully');
} else { } else {
// returns if fails
return redirect('agents')->with('fails', 'Agent can not Create'); return redirect('agents')->with('fails', 'Agent can not Create');
} }
} }
@@ -209,9 +209,11 @@ class AgentController extends Controller
/** /**
* Remove the specified agent from storage. * Remove the specified agent from storage.
* *
* @param type int $id * @param type $id
* @param type User $user * @param User $user
* @param type Assign_team_agent $team_assign_agent * @param Assign_team_agent $team_assign_agent
*
* @throws Exception
* *
* @return type Response * @return type Response
*/ */
@@ -230,8 +232,6 @@ class AgentController extends Controller
return redirect('agents')->with('success', 'Agent Deleted sucessfully'); return redirect('agents')->with('success', 'Agent Deleted sucessfully');
} catch (\Exception $e) { } catch (\Exception $e) {
dd($e->errorInfo);
return redirect('agents')->with('fails', $error); return redirect('agents')->with('fails', $error);
} }
} }
@@ -241,47 +241,21 @@ class AgentController extends Controller
* *
* @param type $length * @param type $length
* *
* @return type string * @return string
*/ */
public function generateRandomString($length = 10) public function generateRandomString($length = 10)
{ {
// list of supported characters
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
// character length checked
$charactersLength = strlen($characters); $charactersLength = strlen($characters);
// creating an empty variable for random string
$randomString = ''; $randomString = '';
// fetching random string
for ($i = 0; $i < $length; $i++) { for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)]; $randomString .= $characters[rand(0, $charactersLength - 1)];
} }
// return random string
return $randomString; 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;
// }
} }

View File

@@ -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
*
* @return type Response
*/ */
public function index() 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 * @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 BanRequest $request
* @param type BanRequest $request * @param User $user
* @param type User $user
* *
* @return type Response * @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 * @param type $id
* * @param User $ban
* @return Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param type int $id
* @param type Banlist $ban
* *
* @return type Response * @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 $id
* @param type Banlist $ban * @param User $ban
* @param type BanlistRequest $request * @param BanlistRequest $request
* *
* @return type Response * @return type Response
*/ */
@@ -152,7 +137,6 @@ class BanlistController extends Controller
$bans = $ban->whereId($id)->first(); $bans = $ban->whereId($id)->first();
$bans->internal_note = $request->input('internal_note'); $bans->internal_note = $request->input('internal_note');
$bans->ban = $request->input('ban'); $bans->ban = $request->input('ban');
// dd($request->input('ban'));
if ($bans->save()) { if ($bans->save()) {
return redirect('banlist')->with('success', 'Banned Email Updated sucessfully'); return redirect('banlist')->with('success', 'Banned Email Updated sucessfully');
} else { } else {
@@ -162,22 +146,4 @@ class BanlistController extends Controller
return redirect('banlist')->with('fails', 'Banned Email not Updated'); 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'.'<li>'.$e->errorInfo[2].'</li>');
// }
// }
} }

View File

@@ -7,26 +7,32 @@ use App\Http\Controllers\Controller;
// request // request
use App\Http\Requests\helpdesk\EmailsEditRequest; use App\Http\Requests\helpdesk\EmailsEditRequest;
use App\Http\Requests\helpdesk\EmailsRequest; use App\Http\Requests\helpdesk\EmailsRequest;
// model
use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Department;
// model
use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Settings\Email; use App\Model\helpdesk\Settings\Email;
use App\Model\helpdesk\Ticket\Ticket_Priority; use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Utility\MailboxProtocol; use App\Model\helpdesk\Utility\MailboxProtocol;
// classes
use Crypt; use Crypt;
// classes
use Exception; use Exception;
use Illuminate\Http\Request;
//use PhpImap\Mailbox as ImapMailbox;
/** /**
* ======================================
* EmailsController. * EmailsController.
* ======================================
* This Controller is used to define below mentioned set of functions applied to the Emails in the system.
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class EmailsController extends Controller class EmailsController extends Controller
{ {
/** /**
* Create a new controller instance. * Defining constructor variables.
* *
* @return type * @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 * @param type Emails $emails
* *
* @return type Response * @return type view
*/ */
public function index(Emails $emails) public function index(Emails $email)
{ {
try { 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')); return view('themes.default1.admin.helpdesk.emails.emails.index', compact('emails'));
} catch (Exception $e) { } catch (Exception $e) {
return view('404'); return redirect()->back()->with('fails', $e->getMessage());
} }
} }
@@ -64,81 +71,155 @@ class EmailsController extends Controller
* *
* @return type Response * @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 { try {
// fetch all the departments from the department table
$departments = $department->get(); $departments = $department->get();
// fetch all the helptopics from the helptopic table
$helps = $help->get(); $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(); $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')); return view('themes.default1.admin.helpdesk.emails.emails.create', compact('mailbox_protocols', 'priority', 'departments', 'helps'));
} catch (Exception $e) { } 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. * Store a newly created resource in storage.
* *
* @param type Emails $email * @param type Emails $email
* @param type EmailsRequest $request * @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 { try {
$password = $request->input('password'); // getConnection($request->input('email_name'), $request->input('email_address'), $request->input('email_address'))
$encrypted = Crypt::encrypt($password); // saving all the fields to the database
$department = $request->input('department'); if ($email->fill($request->except('password', 'department', 'priority', 'help_topic', 'fetching_status', 'sending_status'))->save() == true) {
$priority = $request->input('priority'); if ($request->fetching_status == 'on') {
$help_topic = $request->input('help_topic'); $email->fetching_status = 1;
if ($email->fill($request->except('password', 'department', 'priority', 'help_topic'))->save() == true) {
if ($request->input('department')) {
$email->department = $request->input('department');
} else { } else {
$email->department = null; $email->fetching_status = 0;
} }
if ($request->input('priority')) { if ($request->sending_status == 'on') {
$email->priority = $request->input('priority'); $email->sending_status = 1;
} else { } else {
$email->priority = null; $email->sending_status = 0;
} }
if ($request->input('help_topic')) { // fetching department value
$email->help_topic = $request->input('help_topic'); $email->department = $this->departmentValue($request->input('department'));
} else { // fetching priority value
$email->help_topic = null; $email->priority = $this->priorityValue($request->input('priority'));
} // fetching helptopic value
$email->password = $encrypted; $email->help_topic = $this->helpTopicValue($request->input('help_topic'));
$email->save(); // 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 = Email::where('id', '=', '1')->first();
$email_settings->sys_email = $email->id; $email_settings->sys_email = $email->id;
$email_settings->save(); $email_settings->save();
// returns success message for successful email creation
return redirect('emails')->with('success', 'Email Created sucessfully'); // return redirect('emails')->with('success', 'Email Created sucessfully');
return 1;
} else { } 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) { } 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. * Show the form for editing the specified resource.
* *
@@ -151,21 +232,104 @@ class EmailsController extends Controller
* *
* @return type Response * @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 { try {
// fetch the selected emails
$emails = $email->whereId($id)->first(); $emails = $email->whereId($id)->first();
// get all the departments
$departments = $department->get(); $departments = $department->get();
// get all the helptopic
$helps = $help->get(); $helps = $help->get();
$priority = $priority->get(); // get all the priority
$priority = $ticket_priority->get();
// get all the mailbox protocols
$mailbox_protocols = $mailbox_protocol->get(); $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')); return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails'));
} catch (Exception $e) { } 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. * Update the specified resource in storage.
* *
@@ -175,39 +339,40 @@ class EmailsController extends Controller
* *
* @return type Response * @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 { try {
$emails = $email->whereId($id)->first(); // fetch the selected emails
// $emails->password = $encrypted; $emails = Emails::whereId($id)->first();
$emails->fill($request->except('password', 'department', 'priority', 'help_topic'))->save(); // insert all the requested parameters with except
if ($request->input('department')) { $emails->fill($request->except('password', 'department', 'priority', 'help_topic', 'fetching_status', 'sending_status'))->save();
$emails->department = $request->input('department'); if ($request->fetching_status == 'on') {
$emails->fetching_status = 1;
} else { } else {
$emails->department = null; $emails->fetching_status = 0;
} }
if ($request->input('priority')) { if ($request->sending_status == 'on') {
$emails->priority = $request->input('priority'); $emails->sending_status = 1;
} else { } else {
$emails->priority = null; $emails->sending_status = 0;
} }
if ($request->input('help_topic')) { // fetching department value
$emails->help_topic = $request->input('help_topic'); $emails->department = $this->departmentValue($request->input('department'));
} else { // fetching priority value
$emails->help_topic = null; $emails->priority = $this->priorityValue($request->input('priority'));
} // fetching helptopic value
$emails->password = $encrypted; $emails->help_topic = $this->helpTopicValue($request->input('help_topic'));
// inserting the encrypted value of password
$emails->password = Crypt::encrypt($request->input('password'));
$emails->save(); $emails->save();
// returns success message for successful email update
return redirect('emails')->with('success', 'Email Updated sucessfully'); $return = 1;
} catch (Exception $e) { } 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 int $id
* @param type Emails $email * @param type Emails $email
* *
* @return type Response * @return type Redirect
*/ */
public function destroy($id, Emails $email) 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(); $default_system_email = Email::where('id', '=', '1')->first();
if ($default_system_email->sys_email) { if ($default_system_email->sys_email) {
// checking if the default system email is the passed email
if ($id == $default_system_email->sys_email) { if ($id == $default_system_email->sys_email) {
return redirect('emails')->with('fails', 'You cannot delete system default Email'); return redirect('emails')->with('fails', 'You cannot delete system default Email');
} }
} }
try { try {
// fetching the database instance of the current email
$emails = $email->whereId($id)->first(); $emails = $email->whereId($id)->first();
// checking if deleting the email is success or if it's carrying any dependencies
if ($emails->delete() == true) { if ($emails->delete() == true) {
return redirect('emails')->with('success', 'Email Deleted sucessfully'); return redirect('emails')->with('success', 'Email Deleted sucessfully');
} else { } else {
return redirect('emails')->with('fails', 'Email can not Delete '); return redirect('emails')->with('fails', 'Email can not Delete ');
} }
} catch (Exception $e) { } 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;
}
} }

View File

@@ -24,15 +24,14 @@ use Mail;
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class TemplateController extends Controller class TemplateController extends Controller {
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @return type void * @return type void
*/ */
public function __construct(PhpMailController $PhpMailController) public function __construct(PhpMailController $PhpMailController) {
{
$this->PhpMailController = $PhpMailController; $this->PhpMailController = $PhpMailController;
SettingsController::smtp(); SettingsController::smtp();
$this->middleware('auth'); $this->middleware('auth');
@@ -46,8 +45,7 @@ class TemplateController extends Controller
* *
* @return type Response * @return type Response
*/ */
public function index(Template $template) public function index(Template $template) {
{
try { try {
$templates = $template->get(); $templates = $template->get();
@@ -65,8 +63,7 @@ class TemplateController extends Controller
* *
* @return type Response * @return type Response
*/ */
public function create(Languages $language, Template $template) public function create(Languages $language, Template $template) {
{
try { try {
$templates = $template->get(); $templates = $template->get();
$languages = $language->get(); $languages = $language->get();
@@ -85,8 +82,7 @@ class TemplateController extends Controller
* *
* @return type Response * @return type Response
*/ */
public function store(Template $template, TemplateRequest $request) public function store(Template $template, TemplateRequest $request) {
{
try { try {
/* Check whether function success or not */ /* Check whether function success or not */
if ($template->fill($request->input())->save() == true) { if ($template->fill($request->input())->save() == true) {
@@ -109,8 +105,7 @@ class TemplateController extends Controller
* *
* @return Response * @return Response
*/ */
public function show($id) public function show($id) {
{
// //
} }
@@ -123,8 +118,7 @@ class TemplateController extends Controller
* *
* @return type Response * @return type Response
*/ */
public function listdirectories() public function listdirectories() {
{
$path = '../resources/views/emails/'; $path = '../resources/views/emails/';
$directories = scandir($path); $directories = scandir($path);
$directory = str_replace('/', '-', $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')); 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); $paths = str_replace('-', '/', $path);
$directory2 = $paths.$template; $directory2 = $paths . $template;
$templates = scandir($directory2); $templates = scandir($directory2);
$directory = str_replace('/', '-', $directory2.'/'); $directory = str_replace('/', '-', $directory2 . '/');
return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates', 'directory')); 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); $directory = str_replace('-', '/', $path);
$handle = fopen($directory.$template, 'r'); $handle = fopen($directory . $template, 'r');
$contents = fread($handle, filesize($directory.$template)); $contents = fread($handle, filesize($directory . $template));
fclose($handle); fclose($handle);
return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents', 'template', 'path')); return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents', 'template', 'path'));
} }
public function createtemplate() public function createtemplate() {
{
$directory = '../resources/views/emails/'; $directory = '../resources/views/emails/';
$fname = Input::get('folder_name'); $fname = Input::get('folder_name');
$filename = $directory.$fname; $filename = $directory . $fname;
// images folder creation using php // images folder creation using php
// $mydir = dirname( __FILE__ )."/html/images"; // $mydir = dirname( __FILE__ )."/html/images";
@@ -169,7 +160,7 @@ class TemplateController extends Controller
if (!file_exists($filename)) { if (!file_exists($filename)) {
mkdir($filename, 0777); mkdir($filename, 0777);
} }
$files = array_filter(scandir($directory.'default')); $files = array_filter(scandir($directory . 'default'));
foreach ($files as $file) { foreach ($files as $file) {
if ($file === '.' or $file === '..') { if ($file === '.' or $file === '..') {
@@ -177,29 +168,27 @@ class TemplateController extends Controller
} }
if (!is_dir($file)) { if (!is_dir($file)) {
// $file_to_go = str_replace("code/resources/views/emails/",'code/resources/views/emails/'.$fname,$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'); return \Redirect::back()->with('success', 'Successfully copied');
} }
public function writetemplate($template, $path) public function writetemplate($template, $path) {
{
$directory = str_replace('-', '/', $path); $directory = str_replace('-', '/', $path);
$b = Input::get('templatedata'); $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'); return \Redirect::back()->with('success', 'Successfully updated');
} }
public function deletetemplate($template, $path) public function deletetemplate($template, $path) {
{
$directory = str_replace('-', '/', $path); $directory = str_replace('-', '/', $path);
$dir = $directory.$template; $dir = $directory . $template;
$status = \DB::table('settings_email')->first(); $status = \DB::table('settings_email')->first();
if ($template == 'default' or $template == $status->template) { if ($template == 'default' or $template == $status->template) {
return \Redirect::back()->with('fails', 'You cannot delete a default or active directory!'); return \Redirect::back()->with('fails', 'You cannot delete a default or active directory!');
@@ -208,7 +197,7 @@ class TemplateController extends Controller
$objects = scandir($dir); $objects = scandir($dir);
foreach ($objects as $object) { foreach ($objects as $object) {
if ($object != '.' && $object != '..') { if ($object != '.' && $object != '..') {
unlink($dir.'/'.$object); unlink($dir . '/' . $object);
} }
} }
rmdir($dir); rmdir($dir);
@@ -219,15 +208,13 @@ class TemplateController extends Controller
return \Redirect::back()->with('success', 'Successfully Deleted'); return \Redirect::back()->with('success', 'Successfully Deleted');
} }
public function activateset($setname) public function activateset($setname) {
{
\DB::table('settings_email')->update(['template' => $setname]); \DB::table('settings_email')->update(['template' => $setname]);
return \Redirect::back()->with('success', 'You have Successfully Activated this Set'); 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 { try {
$templates = $template->whereId($id)->first(); $templates = $template->whereId($id)->first();
$languages = $language->get(); $languages = $language->get();
@@ -247,8 +234,7 @@ class TemplateController extends Controller
* *
* @return type Response * @return type Response
*/ */
public function update($id, Template $template, TemplateUdate $request) public function update($id, Template $template, TemplateUdate $request) {
{
try { try {
//TODO validation //TODO validation
$templates = $template->whereId($id)->first(); $templates = $template->whereId($id)->first();
@@ -274,8 +260,7 @@ class TemplateController extends Controller
* *
* @return type Response * @return type Response
*/ */
public function destroy($id, Template $template) public function destroy($id, Template $template) {
{
try { try {
$templates = $template->whereId($id)->first(); $templates = $template->whereId($id)->first();
/* Check whether function success or not */ /* Check whether function success or not */
@@ -299,8 +284,7 @@ class TemplateController extends Controller
* *
* @return type Response * @return type Response
*/ */
public function formDiagno(Emails $email) public function formDiagno(Emails $email) {
{
try { try {
$emails = $email->get(); $emails = $email->get();
@@ -317,15 +301,21 @@ class TemplateController extends Controller
* *
* @return type * @return type
*/ */
public function postDiagno(Request $request) public function postDiagno(Request $request) {
{
$email = $request->input('to'); $email = $request->input('to');
if ($email == null) { if ($email == null) {
return redirect('getdiagno')->with('fails', 'Please provide E-mail address !'); return redirect('getdiagno')->with('fails', 'Please provide E-mail address !');
} }
// sending mail via php mailer // 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']);
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'); return redirect('getdiagno')->with('success', 'Please check your mail. An E-mail has been sent to your E-mail address');
} }
}
} }

View File

@@ -51,34 +51,43 @@ class MailController extends Controller
if ($settings_email->first()->email_fetching == 1) { if ($settings_email->first()->email_fetching == 1) {
if ($settings_email->first()->all_emails == 1) { if ($settings_email->first()->all_emails == 1) {
// $helptopic = $this->TicketController->default_helptopic(); // $helptopic = $this->TicketController->default_helptopic();
// $sla = $this->TicketController->default_sla(); // $sla = $this->TicketController->default_sla();
$email = $emails->get(); $email = $emails->get();
foreach ($email as $e_mail) { foreach ($email as $e_mail) {
if ($e_mail->fetching_status == 1) {
$priority = $e_mail->priority; $priority = $e_mail->priority;
$dept = $e_mail->department; $dept = $e_mail->department;
$helptopic = $e_mail->help_topic; $helptopic = $e_mail->help_topic;
if ($priority == null) { if ($priority == null) {
$priority = $ticket->first()->priority; $priority = $ticket->first()->priority;
} }
if ($dept == null) { if ($dept == null) {
$dept = $system->first()->department; $dept = $system->first()->department;
} }
if ($helptopic == null) { if ($helptopic == null) {
$helptopic = $ticket->first()->help_topic; $helptopic = $ticket->first()->help_topic;
} }
// dd($dept);
$get_helptopic = Help_topic::where('id', '=', $helptopic)->first(); $get_helptopic = Help_topic::where('id', '=', $helptopic)->first();
$sla = $get_helptopic->sla_plan; $sla = $get_helptopic->sla_plan;
// $dept = $e_mail->department;
$host = $e_mail->fetching_host; $host = $e_mail->fetching_host;
$port = $e_mail->fetching_port; $port = $e_mail->fetching_port;
$protocol = $e_mail->mailbox_protocol; if ($e_mail->mailbox_protocol) {
$get_mailboxprotocol = MailboxProtocol::where('id', '=', $protocol)->first(); $protocol_value = $e_mail->mailbox_protocol;
$get_mailboxprotocol = MailboxProtocol::where('id', '=', $protocol_value)->first();
$protocol = $get_mailboxprotocol->value; $protocol = $get_mailboxprotocol->value;
} else {
if ($e_mail->fetching_protocol) {
$fetching_protocol = '/'.$e_mail->fetching_protocol;
} else {
$fetching_protocol = '';
}
if ($e_mail->fetching_encryption) {
$fetching_encryption = '/'.$e_mail->fetching_encryption;
} else {
$fetching_encryption = '';
}
$protocol = $fetching_protocol.$fetching_encryption;
}
$imap_config = '{'.$host.':'.$port.$protocol.'}INBOX'; $imap_config = '{'.$host.':'.$port.$protocol.'}INBOX';
$password = Crypt::decrypt($e_mail->password); $password = Crypt::decrypt($e_mail->password);
$mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__); $mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__);
@@ -101,22 +110,17 @@ class MailController extends Controller
if ($body == null) { if ($body == null) {
$body = $mailbox->backup_getmail($mailId); $body = $mailbox->backup_getmail($mailId);
$body = str_replace('\r\n', '<br/>', $body); $body = str_replace('\r\n', '<br/>', $body);
// var_dump($body);
} }
$date = $mail->date; $date = $mail->date;
$datetime = $overview[0]->date; $datetime = $overview[0]->date;
$date_time = explode(' ', $datetime); $date_time = explode(' ', $datetime);
$date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4]; $date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4];
$date = date('Y-m-d H:i:s', strtotime($date)); $date = date('Y-m-d H:i:s', strtotime($date));
// dd($date);
if (isset($mail->subject)) { if (isset($mail->subject)) {
$subject = $mail->subject; $subject = $mail->subject;
} else { } else {
$subject = 'No Subject'; $subject = 'No Subject';
} }
// dd($subject);
$fromname = $mail->fromName; $fromname = $mail->fromName;
$fromaddress = $mail->fromAddress; $fromaddress = $mail->fromAddress;
$ticket_source = Ticket_source::where('name', '=', 'email')->first(); $ticket_source = Ticket_source::where('name', '=', 'email')->first();
@@ -126,25 +130,25 @@ class MailController extends Controller
$assign = $get_helptopic->auto_assign; $assign = $get_helptopic->auto_assign;
$form_data = null; $form_data = null;
$result = $this->TicketController->create_user($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $form_data); $result = $this->TicketController->create_user($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $form_data);
// dd($result); // dd($result);
if ($result[1] == true) { if ($result[1] == true) {
$ticket_table = Tickets::where('ticket_number', '=', $result[0])->first(); $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::where('ticket_id', '=', $ticket_table->id)->max('id');
// $thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first(); // $thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first();
$thread_id = $thread_id; $thread_id = $thread_id;
foreach ($mail->getAttachments() as $attachment) { foreach ($mail->getAttachments() as $attachment) {
$support = 'support'; $support = 'support';
// echo $_SERVER['DOCUMENT_ROOT']; // echo $_SERVER['DOCUMENT_ROOT'];
$dir_img_paths = __DIR__; $dir_img_paths = __DIR__;
$dir_img_path = explode('/code', $dir_img_paths); $dir_img_path = explode('/code', $dir_img_paths);
// dd($attachment->filePath); // dd($attachment->filePath);
$filepath = explode('../../../../../public', $attachment->filePath); $filepath = explode('../../../../../public', $attachment->filePath);
// var_dump($attachment->filePath); // var_dump($attachment->filePath);
// dd($filepath); // dd($filepath);
// $path = $dir_img_path[0]."/code/public/".$filepath[1]; // $path = $dir_img_path[0]."/code/public/".$filepath[1];
$path = public_path().$filepath[1]; $path = public_path().$filepath[1];
// dd($path); // dd($path);
$filesize = filesize($path); $filesize = filesize($path);
$file_data = file_get_contents($path); $file_data = file_get_contents($path);
$ext = pathinfo($attachment->filePath, PATHINFO_EXTENSION); $ext = pathinfo($attachment->filePath, PATHINFO_EXTENSION);
@@ -189,6 +193,7 @@ class MailController extends Controller
} }
} }
} }
}
/** /**
* separate reply. * separate reply.

View File

@@ -102,11 +102,10 @@ class TicketController extends Controller
} else { } else {
$collabString = null; $collabString = null;
} }
// dd($ticket->id);
$threads = Ticket_Thread::where('ticket_id', '=', $ticket->id)->first(); // $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 = 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(); $attachment = Ticket_attachments::where('thread_id', '=', $threads->id)->get();
$attachCount = count($attachment); $attachCount = count($attachment);
if ($attachCount > 0) { if ($attachCount > 0) {
@@ -114,7 +113,6 @@ class TicketController extends Controller
} else { } else {
$attachString = ''; $attachString = '';
} }
//return $threads->id;
return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$collabString.$attachString; return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$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(); $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>'; return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>';
//return "loda";
}) })
->addColumn('from', function ($ticket) { ->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); $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() public function get_open()
{ {
if (Auth::user()->role == 'admin') { if (Auth::user()->role == 'admin') {
// $tickets = Tickets::where('status','=',1)->get();; $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->get();
$tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', 0)->get();
} else { } 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(); $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)) return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) { ->addColumn('id', function ($ticket) {
return "<input type='checkbox' name='select_all[]' class='icheckbox_flat-blue' value='".$ticket->id."'></input>"; return "<input type='checkbox' name='select_all[]' id='".$ticket->id."' onclick='someFunction(this.id)' class='selectval icheckbox_flat-blue' value='".$ticket->id."'></input>";
}) })
->addColumn('subject', function ($ticket) { ->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -225,7 +217,6 @@ class TicketController extends Controller
} else { } else {
$attachString = ''; $attachString = '';
} }
//return $threads->id;
return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$collabString.$attachString; return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$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(); $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>'; return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>';
//return "loda";
}) })
->addColumn('from', function ($ticket) { ->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); $from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first();
@@ -244,7 +234,7 @@ class TicketController extends Controller
return "<span style='color:#508983'>".$from->user_name.'</span>'; return "<span style='color:#508983'>".$from->user_name.'</span>';
}) })
->addColumn('Last Replier', function ($ticket) { ->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(); $TicketDatarow = Ticket_Thread::where('id', '=', $TicketData)->first();
$LastResponse = User::where('id', '=', $TicketDatarow->user_id)->first(); $LastResponse = User::where('id', '=', $TicketDatarow->user_id)->first();
if ($LastResponse->role == 'user') { if ($LastResponse->role == 'user') {
@@ -273,7 +263,6 @@ class TicketController extends Controller
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id'); $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); $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); return UTC::usertimezone($TicketDatarow->updated_at);
}) })
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -294,20 +283,15 @@ class TicketController extends Controller
public function get_answered() public function get_answered()
{ {
if (Auth::user()->role == 'admin') { 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(); $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 1)->get();
} else { } 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(); $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
$tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 1)->where('dept_id', '=', $dept->id)->get(); $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 1)->where('dept_id', '=', $dept->id)->get();
} }
return \Datatable::collection(new Collection($tickets)) return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) { ->addColumn('id', function ($ticket) {
return "<input type='checkbox' name='select_all[]' class='icheckbox_flat-blue' value='".$ticket->id."'></input>"; return "<input type='checkbox' name='select_all[]' id='".$ticket->id."' onclick='someFunction(this.id)' class='selectval icheckbox_flat-blue' value='".$ticket->id."'></input>";
}) })
->addColumn('subject', function ($ticket) { ->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -337,7 +321,6 @@ class TicketController extends Controller
} else { } else {
$attachString = ''; $attachString = '';
} }
//return $threads->id;
return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$collabString.$attachString; return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$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(); $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>'; return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>';
//return "loda";
}) })
->addColumn('from', function ($ticket) { ->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); $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'); $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); $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); return UTC::usertimezone($TicketDatarow->updated_at);
}) })
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -414,7 +395,7 @@ class TicketController extends Controller
return \Datatable::collection(new Collection($tickets)) return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) { ->addColumn('id', function ($ticket) {
return "<input type='checkbox' name='select_all[]' class='icheckbox_flat-blue' value='".$ticket->id."'></input>"; return "<input type='checkbox' name='select_all[]' id='".$ticket->id."' onclick='someFunction(this.id)' class='selectval icheckbox_flat-blue' value='".$ticket->id."'></input>";
}) })
->addColumn('subject', function ($ticket) { ->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -444,7 +425,6 @@ class TicketController extends Controller
} else { } else {
$attachString = ''; $attachString = '';
} }
//return $threads->id;
return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$collabString.$attachString; return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$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(); $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>'; return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>';
//return "loda";
}) })
->addColumn('from', function ($ticket) { ->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); $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'); $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); $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); return UTC::usertimezone($TicketDatarow->updated_at);
}) })
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -531,7 +509,7 @@ class TicketController extends Controller
return \Datatable::collection(new Collection($tickets)) return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) { ->addColumn('id', function ($ticket) {
return "<input type='checkbox' name='select_all[]' class='icheckbox_flat-blue' value='".$ticket->id."'></input>"; return "<input type='checkbox' name='select_all[]' id='".$ticket->id."' onclick='someFunction(this.id)' class='selectval icheckbox_flat-blue' value='".$ticket->id."'></input>";
}) })
->addColumn('subject', function ($ticket) { ->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -561,7 +539,7 @@ class TicketController extends Controller
} else { } else {
$attachString = ''; $attachString = '';
} }
//return $threads->id;
return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$collabString.$attachString; return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$collabString.$attachString;
}) })
->addColumn('ticket_number', function ($ticket) { ->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(); $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>'; return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>';
//return "loda";
}) })
->addColumn('from', function ($ticket) { ->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); $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'); $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); $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); return UTC::usertimezone($TicketDatarow->updated_at);
}) })
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -637,7 +613,7 @@ class TicketController extends Controller
return \Datatable::collection(new Collection($tickets)) return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) { ->addColumn('id', function ($ticket) {
return "<input type='checkbox' name='select_all[]' class='icheckbox_flat-blue' value='".$ticket->id."'></input>"; return "<input type='checkbox' name='select_all[]' id='".$ticket->id."' onclick='someFunction(this.id)' class='selectval icheckbox_flat-blue' value='".$ticket->id."'></input>";
}) })
->addColumn('subject', function ($ticket) { ->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -667,7 +643,6 @@ class TicketController extends Controller
} else { } else {
$attachString = ''; $attachString = '';
} }
//return $threads->id;
return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$collabString.$attachString; return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$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(); $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>'; return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>';
//return "loda";
}) })
->addColumn('from', function ($ticket) { ->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); $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'); $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); $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); return UTC::usertimezone($TicketDatarow->updated_at);
}) })
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -768,8 +741,6 @@ class TicketController extends Controller
return Redirect('newticket')->with('fails', 'fails'); return Redirect('newticket')->with('fails', 'fails');
} }
} catch (Exception $e) { } catch (Exception $e) {
// dd($e);
return Redirect()->back()->with('fails', '<li>'.$e->errorInfo.'</li>'); return Redirect()->back()->with('fails', '<li>'.$e->errorInfo.'</li>');
} }
} }
@@ -783,21 +754,6 @@ class TicketController extends Controller
*/ */
public function thread($id) 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') { if (Auth::user()->role == 'agent') {
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
@@ -807,11 +763,11 @@ class TicketController extends Controller
} elseif (Auth::user()->role == 'user') { } elseif (Auth::user()->role == 'user') {
$thread = Ticket_Thread::where('ticket_id', '=', $id)->first(); $thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
$ticket_id = \Crypt::encrypt($id); $ticket_id = \Crypt::encrypt($id);
// dd($ticket_id);
return redirect()->route('check_ticket', compact('ticket_id')); return redirect()->route('check_ticket', compact('ticket_id'));
} }
$thread = Ticket_Thread::where('ticket_id', '=', $id)->first(); $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')); return view('themes.default1.agent.helpdesk.ticket.timeline', compact('tickets'), compact('thread'));
} }
@@ -834,16 +790,14 @@ class TicketController extends Controller
$source = $eventthread->source; $source = $eventthread->source;
$form_data = $request->except('reply_content', 'ticket_ID', 'attachment'); $form_data = $request->except('reply_content', 'ticket_ID', 'attachment');
\Event::fire(new \App\Events\ClientTicketFormPost($form_data, $emailadd, $source)); \Event::fire(new \App\Events\ClientTicketFormPost($form_data, $emailadd, $source));
// dd($attachments);
// }
//return $attachments;
$reply_content = $request->input('reply_content'); $reply_content = $request->input('reply_content');
$thread->ticket_id = $request->input('ticket_ID'); $thread->ticket_id = $request->input('ticket_ID');
$thread->poster = 'support'; $thread->poster = 'support';
$thread->body = $request->input('reply_content'); $thread->body = $request->input('reply_content');
$thread->user_id = Auth::user()->id; $thread->user_id = Auth::user()->id;
$ticket_id = $request->input('ticket_ID'); $ticket_id = $request->input('ticket_ID');
//dd($ticket_id);
$tickets = Tickets::where('id', '=', $ticket_id)->first(); $tickets = Tickets::where('id', '=', $ticket_id)->first();
$tickets->isanswered = '1'; $tickets->isanswered = '1';
$tickets->save(); $tickets->save();
@@ -871,19 +825,13 @@ class TicketController extends Controller
} }
$thread->save(); $thread->save();
//$atachPath = '';
foreach ($attachments as $attachment) { foreach ($attachments as $attachment) {
if ($attachment != null) { if ($attachment != null) {
$name = $attachment->getClientOriginalName(); $name = $attachment->getClientOriginalName();
//dd(dirname($attachment));
$type = $attachment->getClientOriginalExtension(); $type = $attachment->getClientOriginalExtension();
$size = $attachment->getSize(); $size = $attachment->getSize();
$data = file_get_contents($attachment->getRealPath()); $data = file_get_contents($attachment->getRealPath());
// $tem_path = $attachment->getRealPath();
// $tem = basename($tem_path).PHP_EOL;
// //dd($tem);
$attachPath = $attachment->getRealPath(); $attachPath = $attachment->getRealPath();
//dd($attachPath);
$ta->create(['thread_id' => $thread->id, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $data, 'poster' => 'ATTACHMENT']); $ta->create(['thread_id' => $thread->id, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $data, 'poster' => 'ATTACHMENT']);
$check_attachment = 1; $check_attachment = 1;
@@ -914,7 +862,6 @@ class TicketController extends Controller
$message = ''; $message = '';
if ($check_attachment == 1) { if ($check_attachment == 1) {
$attachment_files = $attachments; $attachment_files = $attachments;
// dd($attachment_files);
} else { } else {
$attachment_files = null; $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) public function create_user($emailadd, $username, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $from_data)
{ {
// define global variables // define global variables
// dd($source);
// dd($emailadd);
$email; $email;
$username; $username;
@@ -1083,17 +1028,10 @@ class TicketController extends Controller
$user_id = $user->id; $user_id = $user->id;
// Event fire // Event fire
\Event::fire(new \App\Events\ReadMailEvent($user_id, $password)); \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 { 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]); $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) { } catch (\Exception $e) {
// return 0;
} }
// $message->to($emailadd, $username)->subject('Welcome to '.$company.' helpdesk');
// })) {
// need to do something here....
} }
} else { } else {
$username = $checkemail->username; $username = $checkemail->username;
@@ -1103,14 +1041,6 @@ class TicketController extends Controller
$ticket_number2 = $ticket_number[0]; $ticket_number2 = $ticket_number[0];
$ticketdata = Tickets::where('ticket_number', '=', $ticket_number2)->first(); $ticketdata = Tickets::where('ticket_number', '=', $ticket_number2)->first();
$threaddata = Ticket_Thread::where('ticket_id', '=', $ticketdata->id)->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]; $is_reply = $ticket_number[1];
$system = $this->system(); $system = $this->system();
$updated_subject = $threaddata->title.'[#'.$ticket_number2.']'; $updated_subject = $threaddata->title.'[#'.$ticket_number2.']';
@@ -1125,19 +1055,12 @@ class TicketController extends Controller
} }
if ($source == 3) { 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 { 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]); $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) { } catch (\Exception $e) {
} }
} else { } else {
$body2 = null; $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 { 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' => '']); $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) { } catch (\Exception $e) {
@@ -1149,13 +1072,9 @@ class TicketController extends Controller
if (Alert::first()->ticket_status == 1 || Alert::first()->ticket_admin_email == 1) { if (Alert::first()->ticket_status == 1 || Alert::first()->ticket_admin_email == 1) {
// send email to admin // send email to admin
$admins = User::where('role', '=', 'admin')->get(); $admins = User::where('role', '=', 'admin')->get();
// $ticket_creator = $user->user_name;
foreach ($admins as $admin) { foreach ($admins as $admin) {
$admin_email = $admin->email; $admin_email = $admin->email;
$admin_user = $admin->first_name; $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 { 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]); $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) { } catch (\Exception $e) {
@@ -1167,16 +1086,12 @@ class TicketController extends Controller
if (Alert::first()->ticket_status == 1 || Alert::first()->ticket_department_member == 1) { if (Alert::first()->ticket_status == 1 || Alert::first()->ticket_department_member == 1) {
// send email to agents // send email to agents
$agents = User::where('role', '=', 'agent')->get(); $agents = User::where('role', '=', 'agent')->get();
// dd($agents);
foreach ($agents as $agent) { foreach ($agents as $agent) {
$department_data = Department::where('id', '=', $ticketdata->dept_id)->first(); $department_data = Department::where('id', '=', $ticketdata->dept_id)->first();
if ($department_data->name == $agent->primary_dpt) { if ($department_data->name == $agent->primary_dpt) {
$agent_email = $agent->email; $agent_email = $agent->email;
$agent_user = $agent->first_name; $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 { 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]); $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) { } catch (\Exception $e) {
@@ -1190,9 +1105,6 @@ class TicketController extends Controller
$assigned_to = User::where('id', '=', $ticketdata->assigned_to)->first(); $assigned_to = User::where('id', '=', $ticketdata->assigned_to)->first();
$agent_email = $assigned_to->email; $agent_email = $assigned_to->email;
$agent_user = $assigned_to->first_name; $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 { 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]); $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) { } 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) 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); $read_ticket_number = explode('[#', $subject);
if (isset($read_ticket_number[1])) { 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]); $separate = explode(']', $read_ticket_number[1]);
$new_subject = substr($separate[0], 0, 20); $new_subject = substr($separate[0], 0, 20);
$find_number = Tickets::where('ticket_number', '=', $new_subject)->first(); $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(); $sla_plan = Sla_plan::where('id', '=', $sla)->first();
$ovdate = $ticket->created_at; $ovdate = $ticket->created_at;
// dd($sla_plan->grace_period);
$new_date = date_add($ovdate, date_interval_create_from_date_string($sla_plan->grace_period)); $new_date = date_add($ovdate, date_interval_create_from_date_string($sla_plan->grace_period));
$ticket->duedate = $new_date; $ticket->duedate = $new_date;
$ticket->save(); $ticket->save();
// dd($ticket->duedate);
$ticket_number = $ticket->ticket_number; $ticket_number = $ticket->ticket_number;
$id = $ticket->id; $id = $ticket->id;
// store Form Data // store Form Data
// Form Data comes from raising a ticket from client panel // Form Data comes from raising a ticket from client panel
// dd($helptopic);
if ($form_data != null) { if ($form_data != null) {
$help_topic = Help_topic::where('id', '=', $helptopic)->first(); $help_topic = Help_topic::where('id', '=', $helptopic)->first();
$forms = Fields::where('forms_id', '=', $help_topic->custom_form)->get(); $forms = Fields::where('forms_id', '=', $help_topic->custom_form)->get();
@@ -1374,7 +1279,6 @@ class TicketController extends Controller
} }
} }
// store collaborators // store collaborators
// dd($headers);
$this->storeCollaborators($headers, $id); $this->storeCollaborators($headers, $id);
if ($this->ticketThread($subject, $body, $id, $user_id) == true) { if ($this->ticketThread($subject, $body, $id, $user_id) == true) {
return $ticket_number; return $ticket_number;
@@ -1456,10 +1360,6 @@ class TicketController extends Controller
$system_from = $this->company(); $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(); $sending_emails = Emails::where('department', '=', $ticket_status->dept_id)->first();
if ($sending_emails == null) { if ($sending_emails == null) {
$from_email = $this->system_mail(); $from_email = $this->system_mail();
@@ -1538,15 +1438,15 @@ class TicketController extends Controller
{ {
$ticket_delete = $ticket->where('id', '=', $id)->first(); $ticket_delete = $ticket->where('id', '=', $id)->first();
if ($ticket_delete->status == 5) { if ($ticket_delete->status == 5) {
$ticket_delete->delete();
$ticket_threads = Ticket_Thread::where('ticket_id', '=', $id)->get(); $ticket_threads = Ticket_Thread::where('ticket_id', '=', $id)->get();
foreach ($ticket_threads as $ticket_thread) { foreach ($ticket_threads as $ticket_thread) {
$ticket_thread->delete(); $ticket_attachments = Ticket_attachments::where('thread_id', '=', $ticket_thread->id)->get();
}
$ticket_attachments = Ticket_attachments::where('ticket_id', '=', $id)->get();
foreach ($ticket_attachments as $ticket_attachment) { foreach ($ticket_attachments as $ticket_attachment) {
$ticket_attachment->delete(); $ticket_attachment->delete();
} }
$ticket_thread->delete();
}
$ticket_delete->delete();
return 'your ticket has been delete'; return 'your ticket has been delete';
} else { } else {
@@ -1615,14 +1515,6 @@ class TicketController extends Controller
$thread->is_internal = 1; $thread->is_internal = 1;
$thread->body = 'This Ticket has been assigned to '.$assignee; $thread->body = 'This Ticket has been assigned to '.$assignee;
$thread->save(); $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') { } elseif ($assign_to[0] == 'user') {
$ticket->assigned_to = $assign_to[1]; $ticket->assigned_to = $assign_to[1];
$user_detail = User::where('id', '=', $assign_to[1])->first(); $user_detail = User::where('id', '=', $assign_to[1])->first();
@@ -1648,24 +1540,11 @@ class TicketController extends Controller
$agent_email = $user_detail->email; $agent_email = $user_detail->email;
$master = Auth::user()->first_name.' '.Auth::user()->last_name; $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 { 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]); $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) { } catch (\Exception $e) {
return 0; return 0;
} }
// }
} }
return 1; return 1;
@@ -1685,7 +1564,6 @@ class TicketController extends Controller
$NewThread = new Ticket_Thread(); $NewThread = new Ticket_Thread();
$NewThread->ticket_id = $thread->ticket_id; $NewThread->ticket_id = $thread->ticket_id;
$NewThread->user_id = Auth::user()->id; $NewThread->user_id = Auth::user()->id;
// $NewThread->thread_type = 'M';
$NewThread->is_internal = 1; $NewThread->is_internal = 1;
$NewThread->poster = Auth::user()->role; $NewThread->poster = Auth::user()->role;
$NewThread->title = $thread->title; $NewThread->title = $thread->title;
@@ -1705,9 +1583,6 @@ class TicketController extends Controller
public function surrender($id) public function surrender($id)
{ {
$ticket = Tickets::where('id', '=', $id)->first(); $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'; $InternalContent = Auth::user()->first_name.' '.Auth::user()->last_name.' has Surrendered the assigned Ticket';
$thread = Ticket_Thread::where('ticket_id', '=', $id)->first(); $thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
$NewThread = new Ticket_Thread(); $NewThread = new Ticket_Thread();
@@ -1718,7 +1593,6 @@ class TicketController extends Controller
$NewThread->title = $thread->title; $NewThread->title = $thread->title;
$NewThread->body = $InternalContent; $NewThread->body = $InternalContent;
$NewThread->save(); $NewThread->save();
// }
$ticket->assigned_to = null; $ticket->assigned_to = null;
$ticket->save(); $ticket->save();
@@ -1791,16 +1665,6 @@ class TicketController extends Controller
$create_user->password = Hash::make($password); $create_user->password = Hash::make($password);
$create_user->save(); $create_user->save();
$user_id = $create_user->id; $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 { 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]); $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) { } catch (\Exception $e) {
@@ -1855,36 +1719,6 @@ class TicketController extends Controller
return $system; 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. * shows trashed tickets.
* *
@@ -1898,24 +1732,15 @@ class TicketController extends Controller
public function get_trash() public function get_trash()
{ {
if (Auth::user()->role == 'admin') { 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('status', '=', 5)->get();
// $tickets = Tickets::where('assigned_to', '=', null)->where('status','1')->get();
} else { } else {
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
$tickets = Tickets::where('status', '=', 5)->where('dept_id', '=', $dept->id)->get(); $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)) return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) { ->addColumn('id', function ($ticket) {
return "<input type='checkbox' name='select_all[]' class='icheckbox_flat-blue' value='".$ticket->id."'></input>"; return "<input type='checkbox' name='select_all[]' id='".$ticket->id."' onclick='someFunction(this.id)' class='selectval icheckbox_flat-blue' value='".$ticket->id."'></input>";
}) })
->addColumn('subject', function ($ticket) { ->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -1945,7 +1770,6 @@ class TicketController extends Controller
} else { } else {
$attachString = ''; $attachString = '';
} }
//return $threads->id;
return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$collabString.$attachString; return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$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(); $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>'; return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>';
//return "loda";
}) })
->addColumn('from', function ($ticket) { ->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); $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'); $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); $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); return UTC::usertimezone($TicketDatarow->updated_at);
}) })
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -2014,20 +1836,15 @@ class TicketController extends Controller
public function get_unassigned() public function get_unassigned()
{ {
if (Auth::user()->role == 'admin') { 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(); $tickets = Tickets::where('assigned_to', '=', null)->where('status', '1')->get();
} else { } else {
$dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first();
$tickets = Tickets::where('assigned_to', '=', null)->where('dept_id', '=', $dept->id)->get(); $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)) return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) { ->addColumn('id', function ($ticket) {
return "<input type='checkbox' name='select_all[]' class='icheckbox_flat-blue' value='".$ticket->id."'></input>"; return "<input type='checkbox' name='select_all[]' id='".$ticket->id."' onclick='someFunction(this.id)' class='selectval icheckbox_flat-blue' value='".$ticket->id."'></input>";
}) })
->addColumn('subject', function ($ticket) { ->addColumn('subject', function ($ticket) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
@@ -2057,7 +1874,6 @@ class TicketController extends Controller
} else { } else {
$attachString = ''; $attachString = '';
} }
//return $threads->id;
return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$collabString.$attachString; return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$subject->title."'>".$string."&nbsp;<span style='color:green'>(".$count.")<i class='fa fa-comment'></i></span></a>".$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(); $priority = DB::table('ticket_priority')->select('priority_desc', 'priority_color')->where('priority_id', '=', $ticket->priority_id)->first();
return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>'; return '<span class="btn btn-'.$priority->priority_color.' btn-xs">'.$priority->priority_desc.'</span>';
//return "loda";
}) })
->addColumn('from', function ($ticket) { ->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); $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'); $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first(); $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); return UTC::usertimezone($TicketDatarow->updated_at);
}) })
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority') ->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
@@ -2222,16 +2036,6 @@ class TicketController extends Controller
if ($user->save()) { if ($user->save()) {
$user_id = $user->id; $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]); $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(); $ticket_collaborator = new Ticket_Collaborator();
@@ -2243,7 +2047,6 @@ class TicketController extends Controller
return '<div id="alert11" class="alert alert-dismissable" style="color:#60B23C;background-color:#F2F2F2;"><button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-user"></i>'.$user->user_name.'</h4><div id="message-success1">'.$user->email.'</div></div>'; return '<div id="alert11" class="alert alert-dismissable" style="color:#60B23C;background-color:#F2F2F2;"><button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-user"></i>'.$user->user_name.'</h4><div id="message-success1">'.$user->email.'</div></div>';
} }
// return '<div id="alert11" class="alert alert-dismissable" ><button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-user"></i>'.$data->user_name.'</h4><div id="message-success1">'.$data->email.'</div></div>';
} }
/** /**
@@ -2285,6 +2088,7 @@ class TicketController extends Controller
$ticket->reopened_at = date('Y-m-d H:i:s'); $ticket->reopened_at = date('Y-m-d H:i:s');
$ticket->closed = 0; $ticket->closed = 0;
$ticket->closed_at = null; $ticket->closed_at = null;
$ticket->save(); $ticket->save();
} }
} }
@@ -2490,9 +2294,9 @@ class TicketController extends Controller
$name = Input::get('name'); $name = Input::get('name');
$returnValue = $this->changeOwnerAdd($email, $name, $ticket_id); $returnValue = $this->changeOwnerAdd($email, $name, $ticket_id);
if ($returnValue === 0) { if ($returnValue === 0) {
return 4; //'<div id="alert11" class="alert alert-warning alert-dismissable" ><button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-alert"></i>Alert!</h4><div id="message-success1">This user already Exists</div></div>'; return 4;
} elseif ($returnValue === 2) { } elseif ($returnValue === 2) {
return 5; //'<div id="alert11" class="alert alert-warning alert-dismissable" ><button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-alert"></i>Alert!</h4><div id="message-success1">Enter valid email address.</div></div>'; return 5;
} else { } else {
//do nothing //do nothing
} }
@@ -2555,9 +2359,9 @@ class TicketController extends Controller
$user = User::where('email', '=', $email)->first(); $user = User::where('email', '=', $email)->first();
$count = count($user); $count = count($user);
if ($count === 1) { if ($count === 1) {
return 0; //'<div id="alert11" class="alert alert-warning alert-dismissable" ><button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-alert"></i>Alert!</h4><div id="message-success1">This user already Exists</div></div>'; return 0;
} elseif ($validator->fails()) { } elseif ($validator->fails()) {
return 2; //'<div id="alert11" class="alert alert-warning alert-dismissable" ><button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-alert"></i>Alert!</h4><div id="message-success1">Enter valid email address. Exists</div></div>'; return 2;
} else { } else {
$company = $this->company(); $company = $this->company();
$user = new User(); $user = new User();
@@ -2571,13 +2375,11 @@ class TicketController extends Controller
try { 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]); $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) { } catch (\Exception $e) {
// dd($e);
} }
} }
return 1; // '<div id="alert11" class="alert alert-dismissable" style="color:#60B23C;background-color:#F2F2F2;"><button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-user"></i>'.$user->user_name.'</h4><div id="message-success1">'.$user->email.'</div></div>'; return 1;
} }
// return '<div id="alert11" class="alert alert-dismissable" ><button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-user"></i>'.$data->user_name.'</h4><div id="message-success1">'.$data->email.'</div></div>';
} }
public function getMergeTickets($id) public function getMergeTickets($id)
@@ -2693,7 +2495,6 @@ class TicketController extends Controller
"'>#".$parent_ticket->ticket_number.'</a><br>'.$reason; "'>#".$parent_ticket->ticket_number.'</a><br>'.$reason;
$new_thread->format = $thread->format; $new_thread->format = $thread->format;
$new_thread->ip_address = $thread->ip_address; $new_thread->ip_address = $thread->ip_address;
//$new_thread->save();
$new_parent_thread = new Ticket_thread(); $new_parent_thread = new Ticket_thread();
$new_parent_thread->ticket_id = $p_id; $new_parent_thread->ticket_id = $p_id;
@@ -2705,7 +2506,6 @@ class TicketController extends Controller
$new_parent_thread->body = Lang::get('lang.ticket')."&nbsp;<a href='".route('ticket.thread', [$value])."'>#".$ticket->ticket_number.'</a>&nbsp'.Lang::get('lang.ticket_merged').'<br>'.$reason; $new_parent_thread->body = Lang::get('lang.ticket')."&nbsp;<a href='".route('ticket.thread', [$value])."'>#".$ticket->ticket_number.'</a>&nbsp'.Lang::get('lang.ticket_merged').'<br>'.$reason;
$new_parent_thread->format = $parent_thread->format; $new_parent_thread->format = $parent_thread->format;
$new_parent_thread->ip_address = $parent_thread->ip_address; $new_parent_thread->ip_address = $parent_thread->ip_address;
//$new_parent_thread->save();
if ($new_thread->save() && $new_parent_thread->save()) { if ($new_thread->save() && $new_parent_thread->save()) {
$success = 1; $success = 1;
} else { } else {

View File

@@ -38,7 +38,6 @@ class UserController extends Controller
* 1. authentication * 1. authentication
* 2. user roles * 2. user roles
* 3. roles must be agent. * 3. roles must be agent.
*
* @return void * @return void
*/ */
public function __construct() public function __construct()
@@ -51,9 +50,7 @@ class UserController extends Controller
/** /**
* Display all list of the users. * Display all list of the users.
*
* @param type User $user * @param type User $user
*
* @return type view * @return type view
*/ */
public function index() public function index()
@@ -68,15 +65,14 @@ class UserController extends Controller
/** /**
* This function is used to display the list of users using chumper datatables. * This function is used to display the list of users using chumper datatables.
*
* @return datatable * @return datatable
*/ */
public function user_list() public function user_list()
{ {
// displaying list of users with chumper datatables // displaying list of users with chumper datatables
return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get()) return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get())
/* searchable column username */ /* searchable column username and email*/
->searchColumns('user_name') ->searchColumns('user_name', 'email', 'phone')
/* order column username and email */ /* order column username and email */
->orderColumns('user_name', 'email') ->orderColumns('user_name', 'email')
/* column username */ /* column username */
@@ -85,14 +81,14 @@ class UserController extends Controller
$username = substr($model->user_name, 0, 30); $username = substr($model->user_name, 0, 30);
$username = substr($username, 0, strrpos($username, ' ')).' ...'; $username = substr($username, 0, strrpos($username, ' ')).' ...';
} else { } else {
$username = $model->user_name; $username = "<a href='".route('user.edit', $model->id)."'>".$model->user_name."</a>";
} }
return $username; return $username;
}) })
/* column email */ /* column email */
->addColumn('email', function ($model) { ->addColumn('email', function ($model) {
$email = $model->email; $email = "<a href='".route('user.edit', $model->id)."'>".$model->email."</a>";
return $email; return $email;
}) })
@@ -147,7 +143,6 @@ class UserController extends Controller
/** /**
* Show the form for creating a new users. * Show the form for creating a new users.
*
* @return type view * @return type view
*/ */
public function create() public function create()
@@ -161,10 +156,8 @@ class UserController extends Controller
/** /**
* Store a newly created users in storage. * Store a newly created users in storage.
*
* @param type User $user * @param type User $user
* @param type Sys_userRequest $request * @param type Sys_userRequest $request
*
* @return type redirect * @return type redirect
*/ */
public function store(User $user, Sys_userRequest $request) public function store(User $user, Sys_userRequest $request)
@@ -191,10 +184,8 @@ class UserController extends Controller
/** /**
* Display the specified users. * Display the specified users.
*
* @param type int $id * @param type int $id
* @param type User $user * @param type User $user
*
* @return type view * @return type view
*/ */
public function show($id, User $user) public function show($id, User $user)
@@ -211,10 +202,8 @@ class UserController extends Controller
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
*
* @param type int $id * @param type int $id
* @param type User $user * @param type User $user
*
* @return type Response * @return type Response
*/ */
public function edit($id, User $user) public function edit($id, User $user)
@@ -231,16 +220,13 @@ class UserController extends Controller
/** /**
* Update the specified user in storage. * Update the specified user in storage.
*
* @param type int $id * @param type int $id
* @param type User $user * @param type User $user
* @param type Sys_userUpdate $request * @param type Sys_userUpdate $request
*
* @return type Response * @return type Response
*/ */
public function update($id, User $user, Sys_userUpdate $request) public function update($id, User $user, Sys_userUpdate $request)
{ {
/* select the field where id = $id(request Id) */ /* select the field where id = $id(request Id) */
$users = $user->whereId($id)->first(); $users = $user->whereId($id)->first();
/* Update the value by selected field */ /* Update the value by selected field */
@@ -257,7 +243,6 @@ class UserController extends Controller
/** /**
* get agent profile page. * get agent profile page.
*
* @return type view * @return type view
*/ */
public function getProfile() public function getProfile()
@@ -272,7 +257,6 @@ class UserController extends Controller
/** /**
* get profile edit page. * get profile edit page.
*
* @return type view * @return type view
*/ */
public function getProfileedit() public function getProfileedit()
@@ -287,10 +271,8 @@ class UserController extends Controller
/** /**
* post profile edit. * post profile edit.
*
* @param type int $id * @param type int $id
* @param type ProfileRequest $request * @param type ProfileRequest $request
*
* @return type Redirect * @return type Redirect
*/ */
public function postProfileedit(ProfileRequest $request) public function postProfileedit(ProfileRequest $request)
@@ -339,10 +321,8 @@ class UserController extends Controller
/** /**
* Post profile password. * Post profile password.
*
* @param type int $id * @param type int $id
* @param type ProfilePassword $request * @param type ProfilePassword $request
*
* @return type Redirect * @return type Redirect
*/ */
public function postProfilePassword($id, ProfilePassword $request) public function postProfilePassword($id, ProfilePassword $request)
@@ -354,7 +334,6 @@ class UserController extends Controller
$user->password = Hash::make($request->input('new_password')); $user->password = Hash::make($request->input('new_password'));
try { try {
$user->save(); $user->save();
return redirect('profile-edit')->with('success1', 'Password Updated sucessfully'); return redirect('profile-edit')->with('success1', 'Password Updated sucessfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect('profile-edit')->with('fails', $e->errorInfo[2]); return redirect('profile-edit')->with('fails', $e->errorInfo[2]);
@@ -366,9 +345,7 @@ class UserController extends Controller
/** /**
* Assigning an user to an organization. * Assigning an user to an organization.
*
* @param type $id * @param type $id
*
* @return type boolean * @return type boolean
*/ */
public function UserAssignOrg($id) public function UserAssignOrg($id)
@@ -378,15 +355,12 @@ class UserController extends Controller
$user_org->org_id = $org; $user_org->org_id = $org;
$user_org->user_id = $id; $user_org->user_id = $id;
$user_org->save(); $user_org->save();
return 1; return 1;
} }
/** /**
* creating an organization in user profile page via modal popup. * creating an organization in user profile page via modal popup.
*
* @param type $id * @param type $id
*
* @return type * @return type
*/ */
public function User_Create_Org($id) public function User_Create_Org($id)

View File

@@ -555,9 +555,10 @@ class ApiController extends Controller
$result[$key]['picture'] = $path; $result[$key]['picture'] = $path;
} }
$result = $this->createPagination($result, 10); $result = $this->createPagination($result, 10);
//dd($result);
//$result->toJson(); //$result->toJson();
return $result->toJson(); return $result->toJson();
} catch (Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
$line = $e->getLine(); $line = $e->getLine();
$file = $e->getFile(); $file = $e->getFile();

View File

@@ -0,0 +1,114 @@
<?php
namespace App\Http\Controllers\Api\v1;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class ApiExceptAuthController extends Controller
{
public $api_controller;
public function __construct(Request $request)
{
$this->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);
}
}

View File

@@ -473,6 +473,13 @@ class TestController extends Controller
public function getCustomersWith() public function getCustomersWith()
{ {
try { 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) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
$line = $e->getLine(); $line = $e->getLine();

View File

@@ -64,6 +64,7 @@ class ClientTicketController extends Controller
$tickets->closed = 0; $tickets->closed = 0;
$tickets->reopened_at = date('Y-m-d H:i:s'); $tickets->reopened_at = date('Y-m-d H:i:s');
$tickets->reopened = 1; $tickets->reopened = 1;
$tickets->isanswered = 0;
$threads = new Ticket_Thread(); $threads = new Ticket_Thread();
$threads->user_id = Auth::user()->id; $threads->user_id = Auth::user()->id;
$threads->ticket_id = $tickets->id; $threads->ticket_id = $tickets->id;

View File

@@ -10,13 +10,16 @@ use App\Model\helpdesk\Settings\Email;
use App\User; use App\User;
use Auth; use Auth;
class PhpMailController extends Controller class PhpMailController extends Controller {
{
public function fetch_smtp_details($id)
{
$emails = Emails::where('id', '=', $id)->first();
public function fetch_smtp_details($id) {
$emails = Emails::where('id', '=', $id)->first();
if ($emails->sending_status == 1) {
return $emails; return $emails;
} else {
$emails = null;
return $emails;
}
} }
/** /**
@@ -24,11 +27,12 @@ class PhpMailController extends Controller
* *
* @return Mail * @return Mail
*/ */
public function sendmail($from, $to, $message, $template_variables) public function sendmail($from, $to, $message, $template_variables) {
{
// dd($from); // dd($from);
$from_address = $this->fetch_smtp_details($from); $from_address = $this->fetch_smtp_details($from);
if ($from_address == null) {
return $from_address;
} else {
// dd($from_address); // dd($from_address);
$username = $from_address->email_address; $username = $from_address->email_address;
$fromname = $from_address->email_name; $fromname = $from_address->email_name;
@@ -175,10 +179,10 @@ class PhpMailController extends Controller
$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'); $handle = fopen($directory . $template . '.blade.php', 'r');
$contents = fread($handle, filesize($directory.$template.'.blade.php')); $contents = fread($handle, filesize($directory . $template . '.blade.php'));
fclose($handle); 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!!}'];
@@ -237,7 +241,7 @@ class PhpMailController extends Controller
$mail->Subject = $subject; $mail->Subject = $subject;
if ($template == 'ticket-reply-agent') { if ($template == 'ticket-reply-agent') {
$line = '---Reply above this line--- <br/><br/>'; $line = '---Reply above this line--- <br/><br/>';
$mail->Body = $line.$messagebody; $mail->Body = $line . $messagebody;
} else { } else {
$mail->Body = $messagebody; $mail->Body = $messagebody;
} }
@@ -245,20 +249,22 @@ class PhpMailController extends Controller
// $mail->AltBody = $altbody; // $mail->AltBody = $altbody;
if (!$mail->send()) { if (!$mail->send()) {
return null;
// echo 'Message could not be sent.'; // echo 'Message could not be sent.';
// echo 'Mailer Error: '.$mail->ErrorInfo; // echo 'Mailer Error: '.$mail->ErrorInfo;
} else { } else {
return 1;
// echo 'Message has been sent'; // echo 'Message has been sent';
} }
} }
}
/** /**
* Fetching comapny name to send mail. * Fetching comapny name to send mail.
* *
* @return type * @return type
*/ */
public function company() public function company() {
{
$company = Company::Where('id', '=', '1')->first(); $company = Company::Where('id', '=', '1')->first();
if ($company->company_name == null) { if ($company->company_name == null) {
$company = 'Support Center'; $company = 'Support Center';
@@ -320,8 +326,7 @@ class PhpMailController extends Controller
* *
* @return type integer * @return type integer
*/ */
public function mailfrom($reg, $dept_id) public function mailfrom($reg, $dept_id) {
{
$email = Email::where('id', '=', '1')->first(); $email = Email::where('id', '=', '1')->first();
if ($reg == 1) { if ($reg == 1) {
return $email->sys_email; return $email->sys_email;
@@ -334,4 +339,5 @@ class PhpMailController extends Controller
} }
} }
} }
} }

View File

@@ -203,6 +203,13 @@ class InstallController extends Controller
$port = Input::get('port'); $port = Input::get('port');
// Setting environment values // Setting environment values
// $_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_ENV'] = 'local';
$ENV['APP_DEBUG'] = 'false'; $ENV['APP_DEBUG'] = 'false';
$ENV['APP_KEY'] = 'SomeRandomString'; $ENV['APP_KEY'] = 'SomeRandomString';

View File

@@ -26,11 +26,14 @@ class ApiKey
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
$set = $this->setting->where('id', '1')->first(); $set = $this->setting->where('id', '1')->first();
if ($set->api_key_mandatory == 1) {
if ($set->api_enable == 1) { if ($set->api_enable == 1) {
$key = $set->api_key; $key = $set->api_key;
if ($key == $request->input('api_key')) { $check = $this->test($key, $request->input('api_key'));
if ($check == '1') {
return $next($request); return $next($request);
} else { }
if ($check == '0') {
$result = 'wrong api key'; $result = 'wrong api key';
return response()->json(compact('result')); return response()->json(compact('result'));
@@ -40,5 +43,17 @@ class ApiKey
return response()->json(compact('result')); return response()->json(compact('result'));
} }
} else {
return $next($request);
}
}
public function test($v1, $v2)
{
if ($v1 == $v2) {
return '1';
} else {
return '0';
}
} }
} }

View File

@@ -32,7 +32,7 @@ class AgentRequest extends Request
'user_name' => 'required|unique:users', 'user_name' => 'required|unique:users',
'first_name' => 'required', 'first_name' => 'required',
'last_name' => 'required', 'last_name' => 'required',
'email' => 'required', 'email' => 'required|unique:users',
'active' => 'required', 'active' => 'required',
// 'account_status' => 'required', // 'account_status' => 'required',
'assign_group' => 'required', 'assign_group' => 'required',

View File

@@ -40,9 +40,9 @@ class EmailsEditRequest extends Request
// 'sending_host' => 'required', // 'sending_host' => 'required',
// 'sending_port' => 'required', // 'sending_port' => 'required',
//'mailbox_protocol' => 'required' //'mailbox_protocol' => 'required'
'fetching_host' => 'required', // 'fetching_host' => 'required',
'fetching_port' => 'required', // 'fetching_port' => 'required',
'mailbox_protocol' => 'required', // 'mailbox_protocol' => 'required',
]; ];
} }
} }

View File

@@ -39,9 +39,9 @@ class EmailsRequest extends Request
// 'user_name' => 'required', // 'user_name' => 'required',
// 'sending_host' => 'required', // 'sending_host' => 'required',
// 'sending_port' => 'required', // 'sending_port' => 'required',
'fetching_host' => 'required', // 'fetching_host' => 'required',
'fetching_port' => 'required', // 'fetching_port' => 'required',
'mailbox_protocol' => 'required', // 'mailbox_protocol' => 'required',
]; ];
} }
} }

View File

@@ -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('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::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::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('customer', 'Api\v1\ApiController@getCustomer');
Route::get('ticket-search', 'Api\v1\ApiController@searchTicket'); Route::get('ticket-search', 'Api\v1\ApiController@searchTicket');
Route::get('ticket-thread', 'Api\v1\ApiController@ticketThreads'); Route::get('ticket-thread', 'Api\v1\ApiController@ticketThreads');
Route::get('url', 'Api\v1\ApiController@checkUrl'); Route::get('url', 'Api\v1\ApiExceptAuthController@checkUrl');
Route::get('check-url', 'Api\v1\ApiController@urlResult'); Route::get('check-url', 'Api\v1\ApiExceptAuthController@urlResult');
Route::get('api_key', 'Api\v1\ApiController@generateApiKey'); Route::get('api_key', 'Api\v1\ApiController@generateApiKey');
Route::get('help-topic', 'Api\v1\ApiController@getHelpTopic'); Route::get('help-topic', 'Api\v1\ApiController@getHelpTopic');
Route::get('sla-plan', 'Api\v1\ApiController@getSlaPlan'); Route::get('sla-plan', 'Api\v1\ApiController@getSlaPlan');
@@ -688,7 +691,7 @@ Route::group(['prefix' => 'api/v1'], function () {
/* /*
* Newly added * 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('generate/token', 'Api\v1\TestController@generateToken');
Route::get('get/user', 'Api\v1\TestController@getAuthUser'); Route::get('get/user', 'Api\v1\TestController@getAuthUser');

View File

@@ -9,8 +9,8 @@ class Emails extends Model
protected $table = 'emails'; protected $table = 'emails';
protected $fillable = [ protected $fillable = [
'email_address', 'email_name', 'department', 'priority', 'help_topic', 'email_address', 'email_name', 'department', 'priority', 'help_topic',
'user_name', 'password', 'fetching_host', 'fetching_port', 'mailbox_protocol', 'user_name', 'password', 'fetching_host', 'fetching_port', 'fetching_protocol', 'fetching_encryption', 'mailbox_protocol',
'folder', 'sending_host', 'sending_port', 'sending_encryption', 'internal_notes', 'auto_response', 'folder', 'sending_host', 'sending_port', 'sending_protocol', 'sending_encryption', 'internal_notes', 'auto_response',
'fetching_status', 'move_to_folder', 'delete_email', 'do_nothing', 'fetching_status', 'move_to_folder', 'delete_email', 'do_nothing',
'sending_status', 'authentication', 'header_spoofing', 'imap_config', 'sending_status', 'authentication', 'header_spoofing', 'imap_config',
]; ];

View File

@@ -12,6 +12,6 @@ class System extends Model
protected $fillable = [ protected $fillable = [
'id', 'status', 'url', 'name', 'department', 'page_size', 'log_level', 'purge_log', 'name_format', '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',
]; ];
} }

View File

@@ -38,7 +38,7 @@ return [
| |
*/ */
'version' => 'Community 1.0.6.5', 'version' => 'Community 1.0.6.6',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@@ -23,11 +23,14 @@ class CreateEmailsTable extends Migration
$table->string('password'); $table->string('password');
$table->string('fetching_host'); $table->string('fetching_host');
$table->string('fetching_port'); $table->string('fetching_port');
$table->string('fetching_protocol');
$table->string('fetching_encryption');
$table->string('mailbox_protocol'); $table->string('mailbox_protocol');
$table->string('imap_config'); $table->string('imap_config');
$table->string('folder'); $table->string('folder');
$table->string('sending_host'); $table->string('sending_host');
$table->string('sending_port'); $table->string('sending_port');
$table->string('sending_protocol');
$table->string('sending_encryption'); $table->string('sending_encryption');
$table->string('internal_notes'); $table->string('internal_notes');
$table->boolean('auto_response'); $table->boolean('auto_response');

View File

@@ -22,6 +22,7 @@ class CreateSettingsSystemTable extends Migration
$table->string('log_level'); $table->string('log_level');
$table->string('purge_log'); $table->string('purge_log');
$table->integer('api_enable'); $table->integer('api_enable');
$table->integer('api_key_mandatory');
$table->string('api_key'); $table->string('api_key');
$table->string('name_format'); $table->string('name_format');
$table->integer('time_farmat')->unsigned()->nullable()->index('time_farmat'); $table->integer('time_farmat')->unsigned()->nullable()->index('time_farmat');

View File

12
nbproject/project.xml Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>laravel</name>
</data>
<spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1">
<word>endif</word>
</spellchecker-wordlist>
</configuration>
</project>

View File

@@ -6,7 +6,8 @@ $.extend( true, $.fn.dataTable.defaults, {
"t"+ "t"+
"<'row'<'col-xs-6'i><'col-xs-6'p>>", "<'row'<'col-xs-6'i><'col-xs-6'p>>",
"oLanguage": { "oLanguage": {
"sLengthMenu": "_MENU_ records per page" "sLengthMenu": "_MENU_ Records per page",
"sSearch" : "Search: "
} }
} ); } );

View File

@@ -105,6 +105,16 @@ return [
'header_spoofing' => 'Header Spoofing', 'header_spoofing' => 'Header Spoofing',
'allow_for_this_email' => 'Allow For This Email', 'allow_for_this_email' => 'Allow For This Email',
'imap_config' => 'IMAP Configuration', '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 | Ban Emails Create Page
@@ -203,6 +213,7 @@ return [
'timezone' => 'Default Time Zone', 'timezone' => 'Default Time Zone',
'api' => 'Api', 'api' => 'Api',
'api_key' => 'Api Key', 'api_key' => 'Api Key',
'api_key_mandatory' => 'Api key mandatory',
'api_configurations' => 'Api Configurations', 'api_configurations' => 'Api Configurations',
'generate_key' => 'Generate key', 'generate_key' => 'Generate key',
/* /*
@@ -443,6 +454,19 @@ return [
'footer2' => 'Footer2', 'footer2' => 'Footer2',
'footer3' => 'Footer3', 'footer3' => 'Footer3',
'footer4' => 'Footer4', '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)] | Staff Pages [English(en)]
@@ -634,7 +658,7 @@ return [
'organization' => 'Organization', 'organization' => 'Organization',
'create_organization' => 'Create Organization', 'create_organization' => 'Create Organization',
'account_manager' => 'Account Manager', 'account_manager' => 'Account Manager',
'update' => 'update', 'update' => 'Update',
'please_select_an_organization' => 'Please select an Organization', 'please_select_an_organization' => 'Please select an Organization',
'please_select_an_user' => 'Please select an user', 'please_select_an_user' => 'Please select an user',
'organization_profile' => 'Organization Profile', 'organization_profile' => 'Organization Profile',
@@ -805,7 +829,7 @@ return [
'published' => 'Published', 'published' => 'Published',
'draft' => 'Draft', 'draft' => 'Draft',
'create_a_category' => 'Create a Category', 'create_a_category' => 'Create a Category',
'add' => 'add', 'add' => 'Add',
'social' => 'Social', 'social' => 'Social',
'comment' => 'Comment', 'comment' => 'Comment',
'not_published' => 'Not Published', 'not_published' => 'Not Published',

View File

@@ -16,267 +16,404 @@ class="active"
@stop @stop
<!-- header --> <!-- header -->
@section('PageHeader') @section('PageHeader')
<h1>{{Lang::get('lang.add_an_email')}}</h1>
@stop @stop
<!-- /header --> <!-- /header -->
<!-- breadcrumbs --> <!-- breadcrumbs -->
@section('breadcrumbs') @section('breadcrumbs')
<ol class="breadcrumb"> <ol class="breadcrumb">
</ol> </ol>
@stop @stop
<!-- /breadcrumbs --> <!-- /breadcrumbs -->
<!-- content --> <!-- content -->
@section('content') @section('content')
<!-- open a form --> <!-- open a form -->
<form id="form">
{!!Form::open(['action'=>'Admin\helpdesk\EmailsController@store','method'=>'POST'])!!} <input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="box box-primary"> <div class="box box-primary">
<div class="box-header"> <div class="box-header with-border">
<h3 class="box-title">{!! Lang::get('lang.email_information_and_settings') !!}</h3>
<h4 class="box-title">{{Lang::get('lang.create')}}</h4> {!! Form::submit(Lang::get('lang.save'),['class'=>'form-group btn btn-primary pull-right'])!!} </div>
<div class="box-body">
<div id="alert" style="display:none;">
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<div id="alert-message"></div>
</div>
</div>
</div> </div>
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="row">
<!-- email address --> <!-- email address -->
<div class="col-xs-6 form-group {{ $errors->has('email_address') ? 'has-error' : '' }}"> <div class="col-xs-4 form-group {!! $errors->has('email_address') ? 'has-error' : '' !!}" id = "email_address_error">
{!! Form::label('email_address',Lang::get('lang.email_address')) !!} {!! Form::label('email_address',Lang::get('lang.email_address')) !!}
{!! $errors->first('email_address', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('email_address', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('email_address',null,['class' => 'form-control']) !!} {!! Form::text('email_address',null,['class' => 'form-control', 'id' => 'email_address']) !!}
</div> </div>
<!-- Email name --> <!-- Email name -->
<div class="col-xs-6 form-group {{ $errors->has('email_name') ? 'has-error' : '' }}"> <div class="col-xs-4 form-group {!! $errors->has('email_name') ? 'has-error' : ''!!}" id="email_name_error">
{!! Form::label('email_name',Lang::get('lang.from_name')) !!}
{!! Form::label('email_name',Lang::get('lang.email_name')) !!}
{!! $errors->first('email_name', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('email_name', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('email_name',null,['class' => 'form-control']) !!} {!! Form::text('email_name',null,['class' => 'form-control', 'id' => 'email_name']) !!}
</div> </div>
</div>
<div class="row">
<!-- department -->
<div class="col-xs-4 form-group {{ $errors->has('department') ? 'has-error' : '' }}">
{!! Form::label('department',Lang::get('lang.department')) !!}
{!! $errors->first('department', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('department', [''=>'--System Default--','departments'=>$departments->lists('name','id')],null,['class' => 'form-control select']) !!}
</div>
<!-- Priority -->
<div class="col-xs-4 form-group {{ $errors->has('priority') ? 'has-error' : '' }}">
{!! Form::label('priority',Lang::get('lang.priority')) !!}
{!! $errors->first('priority', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('priority', [''=>'--System Default--','Priorities'=>$priority->lists('priority_desc','priority_id')],null,['class' => 'form-control select']) !!}
</div>
<!-- Help topic -->
<div class="col-xs-4 form-group {{ $errors->has('help_topic') ? 'has-error' : '' }}">
{!! Form::label('help_topic',Lang::get('lang.help_topic')) !!}
{!! $errors->first('help_topic', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('help_topic', [''=>'--System Default--','Help Topics'=>$helps->lists('topic','id')],null,['class' => 'form-control select']) !!}
</div>
</div>
<hr>
<div class="row">
<div class="col-md-6 form-group">
<h4>{!! Lang::get('lang.reuired_authentication') !!}</h4>
</div>
</div>
<div class="row">
<!-- password --> <!-- password -->
<div class="col-xs-6 form-group {{ $errors->has('password') ? 'has-error' : '' }}"> <div class="col-xs-4 form-group {!! $errors->has('password') ? 'has-error' : ''!!}" id="password_error">
{!! Form::label('password',Lang::get('lang.password')) !!} {!! Form::label('password',Lang::get('lang.password')) !!}
{!! $errors->first('password', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('password', '<spam class="help-block">:message</spam>') !!}
{!! Form::password('password',['class' => 'form-control']) !!} {!! Form::password('password',['class' => 'form-control', 'id' => 'password']) !!}
</div> </div>
</div> </div>
</div>
<hr> <div class="box-header with-border">
<h3 class="box-title">{!! Lang::get('lang.new_ticket_settings') !!}</h3>
</div>
<div class="box-body">
<div class="row"> <div class="row">
<!-- department -->
<div class="col-md-6 form-group"> <div class="col-xs-4 form-group {!! $errors->has('department') ? 'has-error' : ''!!}" id="department_error">
{!! Form::label('department',Lang::get('lang.department')) !!}
<h4>{!! Lang::get('lang.fetching_email_via_imap') !!}</h4> {!! $errors->first('department', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('department', [''=>'--System Default--','departments'=>$departments->lists('name','id')],null,['class' => 'form-control select', 'id' => 'department' ]) !!}
</div> </div>
<!-- Priority -->
<div class="col-xs-4 form-group {!! $errors->has('priority') ? 'has-error' : ''!!}" id="priority_error">
{!! Form::label('priority',Lang::get('lang.priority')) !!}
{!! $errors->first('priority', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('priority', [''=>'--System Default--','Priorities'=>$priority->lists('priority_desc','priority_id')],null,['class' => 'form-control select', 'id' => 'priority']) !!}
</div> </div>
<!-- Help topic -->
<div class="col-xs-4 form-group {!! $errors->has('help_topic') ? 'has-error' : ''!!}" id="help_topic_error">
{!! Form::label('help_topic',Lang::get('lang.help_topic')) !!}
{!! $errors->first('help_topic', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('help_topic', [''=>'--System Default--','Help Topics'=>$helps->lists('topic','id')],null,['class' => 'form-control select', 'id' => 'help_topic']) !!}
</div>
</div>
</div>
<div class="box-header with-border">
<h3 class="box-title">{!! Lang::get('lang.incoming_email_information') !!}</h3>
</div>
<div class="box-body">
<div class="row"> <div class="row">
<div class="form-group"> <div class="form-group">
<!-- status --> <!-- status -->
<div class="col-xs-1 form-group"> <div class="col-xs-1 form-group">
{!! Form::label('fetching_status',Lang::get('lang.status')) !!} {!! Form::label('fetching_status',Lang::get('lang.status')) !!}
</div> </div>
<div class="col-xs-2 form-group"> <div class="col-xs-2 form-group">
{!! Form::radio('fetching_status','1',true) !!} {{Lang::get('lang.enable')}} <!--{!! Form::radio('fetching_status','1',true) !!} {{Lang::get('lang.enable')}}-->
<input type="checkbox" name="fetching_status" id="fetching_status"> {{Lang::get('lang.enable')}}
</div> </div>
<div class="col-xs-2 form-group"> <div class="col-xs-2 form-group">
{!! Form::radio('fetching_status','0',null) !!} {{Lang::get('lang.disabled')}} <!--<input type="radio" name="fetching_status" id="fetching_status" value="0"> {{Lang::get('lang.disabled')}}-->
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-3 form-group {!! $errors->has('fetching_protocol') ? 'has-error' : ''!!}" id="fetching_protocol_error">
<div class="col-xs-4 form-group {{ $errors->has('fetching_host') ? 'has-error' : '' }}"> {!! Form::label('fetching_protocol',Lang::get('lang.fetching_protocol')) !!}
{!! $errors->first('fetching_protocol', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('fetching_protocol',['imap' => 'IMAP'],null,['class' => 'form-control select', 'id' => 'fetching_protocol']) !!}
</div>
<div class="col-xs-3 form-group {!! $errors->has('fetching_host') ? 'has-error' : ''!!}" id="fetching_host_error">
{!! Form::label('fetching_host',Lang::get('lang.host_name')) !!} {!! Form::label('fetching_host',Lang::get('lang.host_name')) !!}
{!! $errors->first('fetching_host', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('fetching_host', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('fetching_host',null,['class' => 'form-control']) !!} {!! Form::text('fetching_host',null,['class' => 'form-control', 'id' => 'fetching_host']) !!}
</div> </div>
<div class="col-xs-3 form-group {!! $errors->has('fetching_port') ? 'has-error' : ''!!}" id="fetching_port_error">
<div class="col-xs-4 form-group {{ $errors->has('fetching_port') ? 'has-error' : '' }}">
{!! Form::label('fetching_port',Lang::get('lang.port_number')) !!} {!! Form::label('fetching_port',Lang::get('lang.port_number')) !!}
{!! $errors->first('fetching_port', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('fetching_port', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('fetching_port',null,['class' => 'form-control']) !!} {!! Form::text('fetching_port',null,['class' => 'form-control', 'id' => 'fetching_port']) !!}
</div> </div>
<div class="col-xs-3 form-group {!! $errors->has('fetching_encryption') ? 'has-error' : ''!!}" id="fetching_encryption_error">
{!! Form::label('fetching_encryption',Lang::get('lang.encryption')) !!}
<div class="col-xs-4 form-group {{ $errors->has('mailbox_protocol') ? 'has-error' : '' }}"> {!! $errors->first('fetching_encryption', '<spam class="help-block">:message</spam>') !!}
{!!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']) !!}
{!! Form::label('mailbox_protocol',Lang::get('lang.mail_box_protocol')) !!}
{!! $errors->first('mailbox_protocol', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('mailbox_protocol',['Mailbox Protocols'=>$mailbox_protocols->lists('name','id')],null,['class' => 'form-control select']) !!}
</div> </div>
<!-- imap config -->
{{-- <div class="col-md-6 form-group {{ $errors->has('imap_config') ? 'has-error' : '' }}">
{!! Form::label('imap_config',Lang::get('lang.imap_config')) !!}
{!! $errors->first('imap_config', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('imap_config',null,['class' => 'form-control']) !!}
</div> --}}
</div> </div>
<hr>
<div class="row">
<div class="col-md-6 form-group">
<h4>Sending Email via SMTP</h4>
</div> </div>
<div class="box-header with-border">
<h3 class="box-title">{!! Lang::get('lang.outgoing_email_information') !!}</h3>
</div> </div>
<div class="box-body">
<div class="row"> <div class="row">
<!-- status --> <!-- status -->
<div class="form-group"> <div class="form-group">
<div class="col-xs-1 form-group"> <div class="col-xs-1 form-group">
{!! Form::label('sending_status',Lang::get('lang.status')) !!} {!! Form::label('sending_status',Lang::get('lang.status')) !!}
</div> </div>
<div class="col-xs-2 form-group"> <div class="col-xs-2 form-group">
{!! Form::radio('sending_status','1',true) !!} {{Lang::get('lang.enable')}} <input type="checkbox" name="sending_status" id="sending_status"> {!! Lang::get('lang.enable') !!}
</div> </div>
<div class="col-xs-2 form-group"> <div class="col-xs-2 form-group">
{!! Form::radio('sending_status','0',null) !!} {{Lang::get('lang.disabled')}} <!--<input type="radio" name="sending_status" id="sending_status" value=""> {!! Lang::get('lang.disabled') !!}-->
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<!-- Encryption -->
<div class="col-xs-3 form-group {!! $errors->has('sending_protocol') ? 'has-error' : ''!!}" id="sending_protocol_error">
{!! Form::label('sending_protocol',Lang::get('lang.transfer_protocol')) !!}
{!! $errors->first('sending_protocol', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('sending_protocol',['smtp'=>'SMTP'],null,['class' => 'form-control select']) !!}
</div>
<!-- sending hoost --> <!-- sending hoost -->
<div class="col-xs-4 form-group {{ $errors->has('sending_host') ? 'has-error' : '' }}"> <div class="col-xs-3 form-group {!! $errors->has('sending_host') ? 'has-error' : ''!!}" id="sending_host_error">
{!! Form::label('sending_host',Lang::get('lang.host_name')) !!} {!! Form::label('sending_host',Lang::get('lang.host_name')) !!}
{!! $errors->first('sending_host', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('sending_host', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('sending_host',null,['class' => 'form-control']) !!} {!! Form::text('sending_host',null,['class' => 'form-control']) !!}
</div> </div>
<!-- sending port --> <!-- sending port -->
<div class="col-xs-4 form-group {{ $errors->has('sending_port') ? 'has-error' : '' }}"> <div class="col-xs-3 form-group {!! $errors->has('sending_port') ? 'has-error' : ''!!}" id="sending_port_error">
{!! Form::label('sending_port',Lang::get('lang.port_number')) !!} {!! Form::label('sending_port',Lang::get('lang.port_number')) !!}
{!! $errors->first('sending_port', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('sending_port', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('sending_port',null,['class' => 'form-control']) !!} {!! Form::text('sending_port',null,['class' => 'form-control']) !!}
</div> </div>
<!-- Encryption --> <!-- Encryption -->
<div class="col-xs-4 form-group {{ $errors->has('sending_encryption') ? 'has-error' : '' }}"> <div class="col-xs-3 form-group {!! $errors->has('sending_encryption') ? 'has-error' : ''!!}" id="sending_encryption_error">
{!! Form::label('sending_encryption',Lang::get('lang.encryption')) !!} {!! Form::label('sending_encryption',Lang::get('lang.encryption')) !!}
{!! $errors->first('sending_encryption', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('sending_encryption', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('sending_encryption',['ssl'=>'SSL','tls'=>'TLS'],null,['class' => 'form-control select']) !!} {!!Form::select('sending_encryption',['ssl'=>'SSL','tls'=>'TLS'],null,['class' => 'form-control select']) !!}
</div> </div>
</div> </div>
<!-- <div class="row"> -->
<!-- authentication required -->
<!-- <div class="form-group"> -->
<!-- <div class="col-xs-2 form-group"> -->
<!-- {!! Form::label('authentication',Lang::get('lang.authentication_required')) !!} -->
<!-- </div> -->
<!-- <div class="col-xs-2 form-group"> -->
<!-- {!! Form::radio('authentication','1',true) !!} {{Lang::get('lang.enable')}} -->
<!-- </div> -->
<!-- <div class="col-xs-2 form-group"> -->
<!-- {!! Form::radio('authentication','0',null) !!} {{Lang::get('lang.disabled')}} -->
<!-- </div> -->
<!-- </div> -->
<!-- <div class="form-group"> -->
<!-- header snoofing -->
<!-- <div class="col-xs-2"> -->
<!-- // {!! Form::label('',Lang::get('lang.header_spoofing')) !!} -->
<!-- // {!! Form::checkbox('header_spoofing',1,null,['class' => 'checkbox']) !!} -->
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<!-- Internal notes --> <!-- Internal notes -->
<div class="form-group"> <div class="form-group">
{!! Form::label('internal_notes',Lang::get('lang.internal_notes')) !!} {!! Form::label('internal_notes',Lang::get('lang.internal_notes')) !!}
{!! Form::textarea('internal_notes',null,['class' => 'form-control','size' => '30x5']) !!} {!! Form::textarea('internal_notes',null,['class' => 'form-control','size' => '30x10']) !!}
</div>
</div>
<div class="box-footer">
{!! Form::button('<i id="spin" class="fa fa-spinner" style="display:none;"></i> <b>' . Lang::get("lang.create").'</b>' ,['class'=>'btn btn-primary', 'type' => 'submit'])!!}
</div> </div>
</div>
</form>
{!!Form::close()!!} <div class="modal fade" id="loadingpopup" style="padding:200px;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div id="head">
<button type="button" class="close" id="close" data-dismiss="modal" aria-label="Close" style="display:none;"><span aria-hidden="true">×</span></button>
<div class="col-md-5"></div><div class="col-md-2"><img src="{{asset("lb-faveo/media/images/gifloader.gif")}}" ></div><div class="col-md-5"></div>
<br/>
<br/>
<br/>
<center><h3 style="color:#80DE02;">Testing incoming & outgoing mail server</h3></center>
<br/>
<center><h4>Please wait while testing is in progress ...</h4></center>
<center><h4>(Please do not use "Refresh" or "Back" button)</h4></center>
<br/>
</div>
</div>
</div>
</div>
</div>
</div> <button style="display:none" data-toggle="modal" data-target="#loadingpopup" id="click"></button>
</div>
<script type="text/javascript">
//submit form
$('#form').on('submit', function () {
var form_data = $(this).serialize();
$("#spin").addClass("fa-spin");
var email_address = document.getElementById('email_address').value;
var email_name = document.getElementById('email_name').value;
var department = document.getElementById('department').value;
var priority = document.getElementById('priority').value;
var help_topic = document.getElementById('help_topic').value;
var password = document.getElementById('password').value;
var fetching_status = $('input#fetching_status[type="checkbox"]:checked', this).val();
var fetching_protocol = document.getElementById('fetching_protocol').value;
var fetching_host = document.getElementById('fetching_host').value;
var fetching_port = document.getElementById('fetching_port').value;
var fetching_encryption = document.getElementById('fetching_encryption').value;
var sending_status = $('input#sending_status[type="checkbox"]:checked', this).val();
var sending_protocol = document.getElementById('sending_protocol').value;
var sending_host = document.getElementById('sending_host').value;
var sending_port = document.getElementById('sending_port').value;
var sending_encryption = document.getElementById('sending_encryption').value;
var filter_number = /^([0-9])/;
var error_list = [];
var error = "";
// checking for validation of email
if (email_address) {
var filter_email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter_email.test(email_address)) {
var error = "Please provide a valid email address";
error_list.push(error);
$("#email_address_error").addClass("has-error");
}
} else if (email_address == "") {
var error = "Email Address is a required field";
error_list.push(error);
$("#email_address_error").addClass("has-error");
}
// checking for validation of email name
if (email_name == "") {
var error = "Email Name is a required field";
error_list.push(error);
$("#email_name_error").addClass("has-error");
}
// checking for validation of department
if (department == "") {
} else if (department) {
if (!filter_number.test(department)) {
var error = "Please provide a valid department";
error_list.push(error);
$("#department_error").addClass("has-error");
}
}
// checking for validation of priority
if (priority == "") {
} else if (priority) {
if (!filter_number.test(priority)) {
var error = "Please provide a valid priority";
error_list.push(error);
$("#priority_error").addClass("has-error");
}
}
// checking for validation of help topic
if (help_topic == "") {
} else if (priority) {
if (!filter_number.test(priority)) {
var error = "Please provide a valid priority";
error_list.push(error);
$("#priority_error").addClass("has-error");
}
}
// checking for validation of password
if (password == "") {
var error = "Password is a required field";
error_list.push(error);
$("#password_error").addClass("has-error");
}
// checking for validation of fetching host
if (fetching_status == 'on') {
if (fetching_host == "") {
var error = "Fetching Host is a required field";
error_list.push(error);
$("#fetching_host_error").addClass("has-error");
}
// checking for validation of fetching port
if (fetching_port == "") {
var error = "Fetching Port is a required field";
error_list.push(error);
$("#fetching_port_error").addClass("has-error");
}
// checking for validation of mailbox protocol
if (fetching_encryption == "") {
var error = "Fetching Encryption is a required field";
error_list.push(error);
$("#fetching_encryption_error").addClass("has-error");
}
// checking for validation of mailbox protocol
if (fetching_protocol == "") {
var error = "Fetching Protocol is a required field";
error_list.push(error);
$("#fetching_protocol_error").addClass("has-error");
}
} else {
// checking for validation of fetching port
if (fetching_port) {
if (!filter_number.test(fetching_port)) {
var error = "The Fetching Port Number must be an integer";
error_list.push(error);
$("#fetching_port_error").addClass("has-error");
}
}
}
// checking for validation of sending status
if (sending_status == 'on') {
// checking for validation of sending host
if (sending_host == "") {
var error = "Sending Host is a required field";
error_list.push(error);
$("#sending_host_error").addClass("has-error");
}
// checking for validation of sending port
if (sending_port == "") {
var error = "Sending Port is a required field";
error_list.push(error);
$("#sending_port_error").addClass("has-error");
}
// checking for validation of sending encryption
if (sending_encryption == "") {
var error = "Sending Encryption is a required field";
error_list.push(error);
$("#sending_encryption_error").addClass("has-error");
}
// checking for validation of sending protocol
if (sending_protocol == "") {
var error = "Transfer Protocol is a required field";
error_list.push(error);
$("#sending_protocol_error").addClass("has-error");
}
} else {
// checking for validation of fetching port
if (sending_port) {
if (!filter_number.test(sending_port)) {
var error = "The Sending Port Number must be an integer";
error_list.push(error);
$("#sending_port_error").addClass("has-error");
}
}
}
// executing error chatch
if (error) {
var ssss = "";
$.each(error_list, function (key, value) {
ssss += "<li class='error-message-padding'>" + value + "</li>";
});
if (ssss) {
var error_result = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><div id='alert-message'>" + ssss + "</div></div>";
$('#alert').empty();
$('#alert').html(error_result);
$('#alert').show();
$("#spin").removeClass("fa-spin");
return false;
}
}
// Ajax communicating to backend for further Checking/Saving the details
$.ajax({
type: "POST",
url: "{!! route('validating.email.settings') !!}",
dataType: "html",
data: form_data,
headers: {
'X-CSRF-Token': $('meta[name="_token"]').attr('content')
},
beforeSend: function () {
$('#alert').empty();
$("#click").trigger("click");
},
success: function (response) {
if (response == 1) {
$("#close").trigger("click");
var error_result = "<div class='alert alert-success alert-dismissable'> <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><div id='alert-message'>Your details saved successfully</div></div>";
$('#alert').html(error_result);
$('#alert').show();
} else {
$("#close").trigger("click");
var error_result = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><div id='alert-message'>" + response + "</div></div>";
$('#alert').html(error_result);
$('#alert').show();
}
},
error: function (response) {
$("#close").trigger("click");
var errorsHtml = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><div id='alert-message'>Unable to process the details </div></div>";
$('#alert').empty();
$('#alert').html(errorsHtml);
$('#alert').show();
return false;
}
});
return false;
});
</script>
@stop @stop

View File

@@ -16,7 +16,7 @@ class="active"
@stop @stop
<!-- header --> <!-- header -->
@section('PageHeader') @section('PageHeader')
<h1>{{Lang::get('lang.edit_an_email')}}</h1>
@stop @stop
<!-- /header --> <!-- /header -->
@@ -31,37 +31,48 @@ class="active"
@section('content') @section('content')
<!-- open a form --> <!-- open a form -->
{!!Form::model($emails,['url'=>'','id'=>'form'])!!}
{!!Form::model($emails,['url'=>'emails/'.$emails->id,'method'=>'PATCH'])!!} <input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="box box-primary"> <div class="box box-primary">
<div class="box-header"> <div class="box-header with-border">
<h3 class="box-title">{!! Lang::get('lang.email_information_and_settings') !!}</h3>
<h4 class="box-title">{{Lang::get('lang.create')}}</h4> {!! Form::submit(Lang::get('lang.save'),['class'=>'form-group btn btn-primary pull-right'])!!} </div>
<div class="box-body">
<div id="alert" style="display:none;">
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<div id="alert-message"></div>
</div>
</div>
</div> </div>
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="row">
<!-- email address --> <!-- email address -->
<div class="col-xs-6 form-group {{ $errors->has('email_address') ? 'has-error' : '' }}"> <div class="col-xs-4 form-group {{ $errors->has('email_address') ? 'has-error' : '' }}" id="email_address_error">
{!! Form::label('email_address',Lang::get('lang.email_address')) !!} {!! Form::label('email_address',Lang::get('lang.email_address')) !!}
{!! $errors->first('email_address', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('email_address', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('email_address',null,['disabled'=>'disabled','class' => 'form-control']) !!} {!! Form::text('email_address',null,['class' => 'form-control']) !!}
</div> </div>
<!-- email name --> <!-- Email name -->
<div class="col-xs-6 form-group {{ $errors->has('email_name') ? 'has-error' : '' }}"> <div class="col-xs-4 form-group {!! $errors->has('email_name') ? 'has-error' : ''!!}" id="email_name_error">
{!! Form::label('email_name',Lang::get('lang.from_name')) !!}
{!! Form::label('email_name',Lang::get('lang.email_name')) !!}
{!! $errors->first('email_name', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('email_name', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('email_name',null,['class' => 'form-control']) !!} {!! Form::text('email_name',null,['class' => 'form-control', 'id' => 'email_name']) !!}
</div> </div>
<!-- password -->
<div class="col-xs-4 form-group {!! $errors->has('password') ? 'has-error' : ''!!}" id="password_error">
{!! Form::label('password',Lang::get('lang.password')) !!}
{!! $errors->first('password', '<spam class="help-block">:message</spam>') !!}
<input type="password" name="password" class="form-control" id="password" value={!! Crypt::decrypt($emails->password) !!} >
</div> </div>
</div>
</div>
<div class="box-header with-border">
<h3 class="box-title">{!! Lang::get('lang.new_ticket_settings') !!}</h3>
</div>
<div class="box-body">
<div class="row"> <div class="row">
<!-- department --> <!-- department -->
<div class="col-xs-4 form-group {{ $errors->has('department') ? 'has-error' : '' }}"> <div class="col-xs-4 form-group {{ $errors->has('department') ? 'has-error' : '' }}">
@@ -88,169 +99,338 @@ class="active"
</div> </div>
</div> </div>
<!-- auto response --> </div>
{{-- <div class="form-group"> --}} <div class="box-header with-border">
<h3 class="box-title">{!! Lang::get('lang.incoming_email_information') !!}</h3>
{{-- {!! Form::label('',Lang::get('lang.auto_response')) !!} --}} </div>
{{-- <div class="col-xs-1"> --}} <div class="box-body">
{{-- {!! Form::checkbox('auto_response',1,null,['class' => 'checkbox']) !!} --}}
{{-- </div> --}}
{{-- </div> --}}
<hr>
<div class="row"> <div class="row">
<div class="col-md-6 form-group">
<h4>{!! Lang::get('lang.reuired_authentication') !!}</h4>
</div>
</div>
<div class="row">
<!-- password -->
<div class="col-xs-6 form-group {{ $errors->has('password') ? 'has-error' : '' }}">
{!! Form::label('password',Lang::get('lang.password')) !!}
{!! $errors->first('password', '<spam class="help-block">:message</spam>') !!}
<input type="password" name="password" value="<?php echo Crypt::decrypt($emails->password); ?>" class="form-control" >
</div>
</div>
<hr>
<div class="row">
<div class="col-md-6 form-group">
<h4>{!! Lang::get('lang.fetching_email_via_imap') !!}</h4>
</div>
</div>
<div class="row">
<div class="form-group"> <div class="form-group">
<!-- status --> <!-- status -->
<div class="col-xs-1 form-group"> <div class="col-xs-1 form-group">
{!! Form::label('fetching_status',Lang::get('lang.status')) !!} {!! Form::label('fetching_status',Lang::get('lang.status')) !!}
</div> </div>
<div class="col-xs-2 form-group"> <div class="col-xs-2 form-group">
{!! Form::radio('fetching_status','1',true) !!} {{Lang::get('lang.enable')}} <!--{!! Form::radio('fetching_status','1',true) !!} {{Lang::get('lang.enable')}}-->
<input type="checkbox" name="fetching_status" id="fetching_status" <?php if ($emails->fetching_status == 1) {
echo "checked='checked'";
} ?>> {{Lang::get('lang.enable')}}
</div> </div>
<div class="col-xs-2 form-group"> <div class="col-xs-2 form-group">
{!! Form::radio('fetching_status','0',null) !!} {{Lang::get('lang.disabled')}} <!--<input type="radio" name="fetching_status" id="fetching_status" value="0"> {{Lang::get('lang.disabled')}}-->
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-3 form-group {!! $errors->has('fetching_protocol') ? 'has-error' : ''!!}" id="fetching_protocol_error">
<div class="col-xs-4 form-group"> {!! Form::label('fetching_protocol',Lang::get('lang.fetching_protocol')) !!}
{!! $errors->first('fetching_protocol', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('fetching_protocol',['imap' => 'IMAP'],null,['class' => 'form-control select', 'id' => 'fetching_protocol']) !!}
</div>
<div class="col-xs-3 form-group {!! $errors->has('fetching_host') ? 'has-error' : ''!!}" id="fetching_host_error">
{!! Form::label('fetching_host',Lang::get('lang.host_name')) !!} {!! Form::label('fetching_host',Lang::get('lang.host_name')) !!}
{!! Form::text('fetching_host',null,['class' => 'form-control']) !!} {!! $errors->first('fetching_host', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('fetching_host',null,['class' => 'form-control', 'id' => 'fetching_host']) !!}
</div> </div>
<div class="col-xs-3 form-group {!! $errors->has('fetching_port') ? 'has-error' : ''!!}" id="fetching_port_error">
<div class="col-xs-4 form-group">
{!! Form::label('fetching_port',Lang::get('lang.port_number')) !!} {!! Form::label('fetching_port',Lang::get('lang.port_number')) !!}
{!! Form::text('fetching_port',null,['class' => 'form-control']) !!} {!! $errors->first('fetching_port', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('fetching_port',null,['class' => 'form-control', 'id' => 'fetching_port']) !!}
</div> </div>
<div class="col-xs-3 form-group {!! $errors->has('fetching_encryption') ? 'has-error' : ''!!}" id="fetching_encryption_error">
{!! Form::label('fetching_encryption',Lang::get('lang.encryption')) !!}
<div class="col-xs-4 form-group {{ $errors->has('mailbox_protocol') ? 'has-error' : '' }}"> {!! $errors->first('fetching_encryption', '<spam class="help-block">:message</spam>') !!}
{!!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']) !!}
{!! Form::label('mailbox_protocol',Lang::get('lang.mail_box_protocol')) !!}
{!! $errors->first('mailbox_protocol', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('mailbox_protocol',['Mailbox Protocols'=>$mailbox_protocols->lists('name','id')],null,['class' => 'form-control select']) !!}
</div> </div>
<!-- imap config -->
</div> </div>
<hr>
<div class="row">
<div class="col-md-6 form-group">
<h4>Sending Email via SMTP</h4>
</div> </div>
<div class="box-header with-border">
<h3 class="box-title">{!! Lang::get('lang.outgoing_email_information') !!}</h3>
</div> </div>
<div class="box-body">
<div class="row"> <div class="row">
<!-- status --> <!-- status -->
<div class="form-group"> <div class="form-group">
<div class="col-xs-1 form-group"> <div class="col-xs-1 form-group">
{!! Form::label('sending_status',Lang::get('lang.status')) !!} {!! Form::label('sending_status',Lang::get('lang.status')) !!}
</div> </div>
<div class="col-xs-2 form-group"> <div class="col-xs-2 form-group">
{!! Form::radio('sending_status','1',true) !!} {{Lang::get('lang.enable')}} <input type="checkbox" name="sending_status" id="sending_status" <?php if ($emails->sending_status == 1) {
echo "checked='checked'";
} ?>> {!! Lang::get('lang.enable') !!}
</div> </div>
<div class="col-xs-2 form-group"> <div class="col-xs-2 form-group">
{!! Form::radio('sending_status','0',null) !!} {{Lang::get('lang.disabled')}} <!--<input type="radio" name="sending_status" id="sending_status" value=""> {!! Lang::get('lang.disabled') !!}-->
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<!-- Encryption -->
<div class="col-xs-3 form-group {!! $errors->has('sending_protocol') ? 'has-error' : ''!!}" id="sending_protocol_error">
{!! Form::label('sending_protocol',Lang::get('lang.transfer_protocol')) !!}
{!! $errors->first('sending_protocol', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('sending_protocol',['smtp'=>'SMTP'],null,['class' => 'form-control select']) !!}
</div>
<!-- sending hoost --> <!-- sending hoost -->
<div class="col-xs-4 form-group {{ $errors->has('sending_host') ? 'has-error' : '' }}"> <div class="col-xs-3 form-group {!! $errors->has('sending_host') ? 'has-error' : ''!!}" id="sending_host_error">
{!! Form::label('sending_host',Lang::get('lang.host_name')) !!} {!! Form::label('sending_host',Lang::get('lang.host_name')) !!}
{!! $errors->first('sending_host', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('sending_host', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('sending_host',null,['class' => 'form-control']) !!} {!! Form::text('sending_host',null,['class' => 'form-control']) !!}
</div> </div>
<!-- sending port --> <!-- sending port -->
<div class="col-xs-4 form-group {{ $errors->has('sending_port') ? 'has-error' : '' }}"> <div class="col-xs-3 form-group {!! $errors->has('sending_port') ? 'has-error' : ''!!}" id="sending_port_error">
{!! Form::label('sending_port',Lang::get('lang.port_number')) !!} {!! Form::label('sending_port',Lang::get('lang.port_number')) !!}
{!! $errors->first('sending_port', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('sending_port', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('sending_port',null,['class' => 'form-control']) !!} {!! Form::text('sending_port',null,['class' => 'form-control']) !!}
</div> </div>
<!-- Encryption --> <!-- Encryption -->
<div class="col-xs-4 form-group {{ $errors->has('sending_encryption') ? 'has-error' : '' }}"> <div class="col-xs-3 form-group {!! $errors->has('sending_encryption') ? 'has-error' : ''!!}" id="sending_encryption_error">
{!! Form::label('sending_encryption',Lang::get('lang.encryption')) !!} {!! Form::label('sending_encryption',Lang::get('lang.encryption')) !!}
{!! $errors->first('sending_encryption', '<spam class="help-block">:message</spam>') !!} {!! $errors->first('sending_encryption', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('sending_encryption',['ssl'=>'SSL','tls'=>'TLS'],null,['class' => 'form-control select']) !!} {!!Form::select('sending_encryption',['ssl'=>'SSL','tls'=>'TLS'],null,['class' => 'form-control select']) !!}
</div> </div>
</div> </div>
<!-- Internal notes -->
<!-- internal notes -->
<div class="form-group"> <div class="form-group">
{!! Form::label('internal_notes',Lang::get('lang.internal_notes')) !!} {!! Form::label('internal_notes',Lang::get('lang.internal_notes')) !!}
{!! Form::textarea('internal_notes',null,['class' => 'form-control','size' => '30x5']) !!} {!! Form::textarea('internal_notes',null,['class' => 'form-control','size' => '30x10']) !!}
</div>
</div>
<div class="box-footer">
{!! Form::button('<i id="spin" class="fa fa-spinner" style="display:none;"></i> <b>' . Lang::get("lang.update").'</b>' ,['class'=>'btn btn-primary', 'type' => 'submit'])!!}
</div> </div>
{!!Form::close()!!}
</div> </div>
{!!Form::close()!!}
<div class="modal fade" id="loadingpopup" style="padding:200px;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div id="head">
<button type="button" class="close" id="close" data-dismiss="modal" aria-label="Close" style="display:none;"><span aria-hidden="true">×</span></button>
<div class="col-md-5"></div><div class="col-md-2"><img src="{{asset("lb-faveo/media/images/gifloader.gif")}}" ></div><div class="col-md-5"></div>
<br/>
<br/>
<br/>
<center><h3 style="color:#80DE02;">Testing incoming & outgoing mail server</h3></center>
<br/>
<center><h4>Please wait while testing is in progress ...</h4></center>
<center><h4>(Please do not use "Refresh" or "Back" button)</h4></center>
<br/>
</div>
</div>
</div>
</div>
</div> </div>
<button style="display:none" data-toggle="modal" data-target="#loadingpopup" id="click"></button>
<script>
//submit form
$('#form').on('submit', function () {
var form_data = $(this).serialize();
$("#spin").addClass("fa-spin");
var email_address = document.getElementById('email_address').value;
var email_name = document.getElementById('email_name').value;
var department = document.getElementById('department').value;
var priority = document.getElementById('priority').value;
var help_topic = document.getElementById('help_topic').value;
var password = document.getElementById('password').value;
var fetching_status = $('input#fetching_status[type="checkbox"]:checked', this).val();
var fetching_protocol = document.getElementById('fetching_protocol').value;
var fetching_host = document.getElementById('fetching_host').value;
var fetching_port = document.getElementById('fetching_port').value;
var fetching_encryption = document.getElementById('fetching_encryption').value;
var sending_status = $('input#sending_status[type="checkbox"]:checked', this).val();
var sending_protocol = document.getElementById('sending_protocol').value;
var sending_host = document.getElementById('sending_host').value;
var sending_port = document.getElementById('sending_port').value;
var sending_encryption = document.getElementById('sending_encryption').value;
var filter_number = /^([0-9])/;
var error_list = [];
var error = "";
// checking for validation of email
if (email_address) {
var filter_email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter_email.test(email_address)) {
var error = "Please provide a valid email address";
error_list.push(error);
$("#email_address_error").addClass("has-error");
}
} else if (email_address == "") {
var error = "Email Address is a required field";
error_list.push(error);
$("#email_address_error").addClass("has-error");
}
// checking for validation of email name
if (email_name == "") {
var error = "Email Name is a required field";
error_list.push(error);
$("#email_name_error").addClass("has-error");
}
// checking for validation of department
if (department == "") {
} else if (department) {
if (!filter_number.test(department)) {
var error = "Please provide a valid department";
error_list.push(error);
$("#department_error").addClass("has-error");
}
}
// checking for validation of priority
if (priority == "") {
} else if (priority) {
if (!filter_number.test(priority)) {
var error = "Please provide a valid priority";
error_list.push(error);
$("#priority_error").addClass("has-error");
}
}
// checking for validation of help topic
if (help_topic == "") {
} else if (priority) {
if (!filter_number.test(priority)) {
var error = "Please provide a valid priority";
error_list.push(error);
$("#priority_error").addClass("has-error");
}
}
// checking for validation of password
if (password == "") {
var error = "Password is a required field";
error_list.push(error);
$("#password_error").addClass("has-error");
}
// checking for validation of fetching host
if (fetching_status == 'on') {
if (fetching_host == "") {
var error = "Fetching Host is a required field";
error_list.push(error);
$("#fetching_host_error").addClass("has-error");
}
// checking for validation of fetching port
if (fetching_port == "") {
var error = "Fetching Port is a required field";
error_list.push(error);
$("#fetching_port_error").addClass("has-error");
}
// checking for validation of mailbox protocol
if (fetching_encryption == "") {
var error = "Fetching Encryption is a required field";
error_list.push(error);
$("#fetching_encryption_error").addClass("has-error");
}
// checking for validation of mailbox protocol
if (fetching_protocol == "") {
var error = "Fetching Protocol is a required field";
error_list.push(error);
$("#fetching_protocol_error").addClass("has-error");
}
} else {
// checking for validation of fetching port
if (fetching_port) {
if (!filter_number.test(fetching_port)) {
var error = "The Fetching Port Number must be an integer";
error_list.push(error);
$("#fetching_port_error").addClass("has-error");
}
}
}
// checking for validation of sending status
if (sending_status == 'on') {
// checking for validation of sending host
if (sending_host == "") {
var error = "Sending Host is a required field";
error_list.push(error);
$("#sending_host_error").addClass("has-error");
}
// checking for validation of sending port
if (sending_port == "") {
var error = "Sending Port is a required field";
error_list.push(error);
$("#sending_port_error").addClass("has-error");
}
// checking for validation of sending encryption
if (sending_encryption == "") {
var error = "Sending Encryption is a required field";
error_list.push(error);
$("#sending_encryption_error").addClass("has-error");
}
// checking for validation of sending protocol
if (sending_protocol == "") {
var error = "Transfer Protocol is a required field";
error_list.push(error);
$("#sending_protocol_error").addClass("has-error");
}
} else {
// checking for validation of fetching port
if (sending_port) {
if (!filter_number.test(sending_port)) {
var error = "The Sending Port Number must be an integer";
error_list.push(error);
$("#sending_port_error").addClass("has-error");
}
}
}
// executing error chatch
if (error) {
var ssss = "";
$.each(error_list, function (key, value) {
ssss += "<li class='error-message-padding'>" + value + "</li>";
});
if (ssss) {
var error_result = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><div id='alert-message'>" + ssss + "</div></div>";
$('#alert').empty();
$('#alert').html(error_result);
$('#alert').show();
$("#spin").removeClass("fa-spin");
return false;
}
}
// Ajax communicating to backend for further Checking/Saving the details
$.ajax({
type: "POST",
url: "{!! route('validating.email.settings.update', $emails->id ) !!}",
dataType: "html",
data: form_data,
headers: {
'X-CSRF-Token': $('meta[name="_token"]').attr('content')
},
beforeSend: function () {
$('#alert').empty();
$("#click").trigger("click");
},
success: function (response) {
if (response == 1) {
$("#close").trigger("click");
var error_result = "<div class='alert alert-success alert-dismissable'> <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><div id='alert-message'>Your details saved successfully</div></div>";
$('#alert').html(error_result);
$('#alert').show();
} else {
$("#close").trigger("click");
var error_result = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><div id='alert-message'>" + response + "</div></div>";
$('#alert').html(error_result);
$('#alert').show();
}
},
error: function (response) {
$("#close").trigger("click");
var errorsHtml = "<div class='alert alert-danger alert-dismissable'> <i class='fa fa-ban'> </i> <b> Alert!</b><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><div id='alert-message'>Unable to process the details </div></div>";
$('#alert').empty();
$('#alert').html(errorsHtml);
$('#alert').show();
return false;
}
});
return false;
});
</script>
@stop @stop

View File

@@ -3,9 +3,7 @@
@stop @stop
<!-- header --> <!-- header -->
@section('PageHeader') @section('PageHeader')
<div class="box-header"> <h1>{!! Lang::get('lang.admin_panel') !!}</h1>
<h3 class="box-title">{!! Lang::get('lang.admin_panel') !!}</h3>
</div>
@stop @stop
<!-- /header --> <!-- /header -->
<!-- breadcrumbs --> <!-- breadcrumbs -->
@@ -16,7 +14,6 @@
<!-- /breadcrumbs --> <!-- /breadcrumbs -->
<!-- content --> <!-- content -->
@section('content') @section('content')
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">{!! Lang::get('lang.staffs') !!}</h3> <h3 class="box-title">{!! Lang::get('lang.staffs') !!}</h3>

View File

@@ -29,23 +29,17 @@ class="active"
@section('content') @section('content')
<!-- open a form --> <!-- open a form -->
{!! Form::model($emails,['url' => 'postemail/'.$emails->id, 'method' => 'PATCH']) !!}
{!! Form::model($emails,['url' => 'postemail/'.$emails->id, 'method' => 'PATCH']) !!} <div class="row">
<div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="box box-primary"> <div class="box box-primary">
<div class="box-header"> <div class="box-header">
<h3 class="box-title">{{Lang::get('lang.email')}}</h3> <div class="pull-right"> <h3 class="box-title">{{Lang::get('lang.email')}}</h3> <div class="pull-right">
{!! Form::submit(Lang::get('lang.save'),['class'=>'btn btn-primary'])!!} {!! Form::submit(Lang::get('lang.save'),['class'=>'btn btn-primary'])!!}
</div> </div>
</div> </div>
<!-- check whether success or not --> <!-- check whether success or not -->
@if(Session::has('success'))
@if(Session::has('success'))
<div class="alert alert-success alert-dismissable"> <div class="alert alert-success alert-dismissable">
<i class="fa fa-check-circle"></i> <i class="fa fa-check-circle"></i>
<b>Success!</b> <b>Success!</b>
@@ -62,19 +56,8 @@ class="active"
{{Session::get('fails')}} {{Session::get('fails')}}
</div> </div>
@endif @endif
<div class="box-body table-responsive"style="overflow:hidden;"> <div class="box-body table-responsive"style="overflow:hidden;">
<div class="row"> <div class="row">
<!-- Default Template Set: DROPDOWN value from template table : Required -->
{{-- <div class="col-md-3"> --}}
{{-- <div class="form-group {{ $errors->has('template') ? 'has-error' : '' }}"> --}}
{{-- {!! Form::label('template',Lang::get('lang.default_template')) !!} --}}
{{-- {!! $errors->first('template', '<spam class="help-block">:message</spam>') !!} --}}
{{-- {!!Form::select('template', $templates->lists('name','name'),null,['class'=>'form-control']) !!} --}}
{{-- </div> --}}
{{-- </div> --}}
<!-- Default System Email: DROPDOWN value from emails table : Required --> <!-- Default System Email: DROPDOWN value from emails table : Required -->
<div class="col-md-12"> <div class="col-md-12">
<div class="col-md-3 no-padding"> <div class="col-md-3 no-padding">
@@ -85,26 +68,9 @@ class="active"
</div> </div>
</div> </div>
</div> </div>
<!-- Default Alert Email: DROPDOWN value from emails table : Required -->
{{-- <div class="col-md-3"> --}}
{{-- <div class="form-group {{ $errors->has('alert_email') ? 'has-error' : '' }}"> --}}
{{-- {!! Form::label('alert_email',Lang::get('lang.default_alert_email')) !!} --}}
{{-- {!! $errors->first('alert_email', '<spam class="help-block">:message</spam>') !!} --}}
{{-- {!!Form::select('alert_email', $emails1->lists('email_address','email_address'),null,['class'=>'form-control']) !!} --}}
{{-- </div> --}}
{{-- </div> --}}
<!-- Default MTA: DROPDOWN : manual -->
{{-- <div class="col-md-3"> --}}
{{-- <div class="form-group"> --}}
{{-- {!! Form::label('alert_email',Lang::get('lang.default_MTA')) !!} --}}
{{-- {!!Form::select('alert_email',['use PHP Mail function'],null,['class'=>'form-control']) !!} --}}
{{-- </div> --}}
{{-- </div> --}}
<!-- Email Fetching: CHECKBOX : Enable ,Fetch on auto-cron --> <!-- Email Fetching: CHECKBOX : Enable ,Fetch on auto-cron -->
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
{!! Form::label('email_fetching',Lang::get('lang.email_fetch')) !!}<br> {!! Form::label('email_fetching',Lang::get('lang.email_fetch')) !!}<br>
{!! Form::checkbox('email_fetching',1,true) !!}&nbsp;{{Lang::get('lang.fetch_auto-corn')}} {!! Form::checkbox('email_fetching',1,true) !!}&nbsp;{{Lang::get('lang.fetch_auto-corn')}}
</div> </div>
@@ -122,71 +88,30 @@ class="active"
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
{!! Form::checkbox('all_emails',1,true) !!}&nbsp;{{Lang::get('lang.accept_all_email')}} {!! Form::checkbox('all_emails',1,true) !!}&nbsp;{{Lang::get('lang.accept_all_email')}}
</div> </div>
</div> </div>
</div> </div>
<!-- Admin's Email Address: Text : Required --> <!-- Admin's Email Address: Text : Required -->
<div class="row"> <div class="row">
{{-- <div class="col-md-6"> --}}
{{-- <div class="form-group {{ $errors->has('admin_email') ? 'has-error' : '' }}"> --}}
{{-- {!! Form::label('admin_email',Lang::get('lang.admin_email')) !!} --}}
{{-- {!! $errors->first('admin_email', '<spam class="help-block">:message</spam>') !!} --}}
{{-- {!! Form::text('admin_email',null,['class' => 'form-control']) !!} --}}
{{-- </div> --}}
{{-- </div> --}}
<!-- Reply Separator Tag: text -->
{{-- <div class="col-md-6"> --}}
{{-- <div class="form-group {{ $errors->has('separator') ? 'has-error' : '' }}"> --}}
{{-- {!! Form::label('separator',Lang::get('lang.reply_separator')) !!} --}}
{{-- {!! $errors->first('separator', '<spam class="help-block">:message</spam>') !!} --}}
{{-- {!! Form::text('separator',null,['class' => 'form-control']) !!} --}}
{{-- </div> --}}
{{-- </div> --}}
</div> </div>
<!-- Accept Email Collaborators: CHECKBOX : Automatically add collaborators from email fields --> <!-- Accept Email Collaborators: CHECKBOX : Automatically add collaborators from email fields -->
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
{!! Form::checkbox('email_collaborator',1) !!}&nbsp;{{Lang::get('lang.accept_email_collab')}} {!! Form::checkbox('email_collaborator',1) !!}&nbsp;{{Lang::get('lang.accept_email_collab')}}
</div> </div>
</div> </div>
</div> </div>
<!-- Strip Quoted Reply: CHECKBOX -->
{{-- <div class="row"> --}}
{{-- <div class="col-md-4"> --}}
{{-- <div class="form-group"> --}}
{{-- {!! Form::checkbox('strip',1,['class' => 'form-control']) !!}&nbsp;{{Lang::get('lang.strip_quoted_reply')}} --}}
{{-- </div> --}}
{{-- </div> --}}
{{-- </div> --}}
<!-- Attachments: CHECKBOX : Email attachments to the user --> <!-- Attachments: CHECKBOX : Email attachments to the user -->
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
{!! Form::checkbox('attachment',1) !!}&nbsp;{{Lang::get('lang.attachments')}} {!! Form::checkbox('attachment',1) !!}&nbsp;{{Lang::get('lang.attachments')}}
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
@stop @stop

View File

@@ -32,18 +32,18 @@ class="active"
<!-- open a form --> <!-- open a form -->
{!! Form::model($systems,['url' => 'postsystem/'.$systems->id, 'method' => 'PATCH' , 'id'=>'formID']) !!} {!! Form::model($systems,['url' => 'postsystem/'.$systems->id, 'method' => 'PATCH' , 'id'=>'formID']) !!}
<div class="box box-primary"> <div class="box box-primary">
<div class="box-header"> <div class="box-header">
<h3 class="box-title">{{Lang::get('lang.system')}}</h3> {!! Form::submit('Save',['onclick'=>'sendForm()','class'=>'btn btn-primary pull-right'])!!} <h3 class="box-title">{{Lang::get('lang.system')}}</h3> {!! Form::submit('Save',['onclick'=>'sendForm()','class'=>'btn btn-primary pull-right'])!!}
<!-- <input type="submit" value="sumit" onclick="sendForm();"> --> <!-- <input type="submit" value="sumit" onclick="sendForm();"> -->
</div> </div>
<!-- check whether success or not --> <!-- check whether success or not -->
@if(Session::has('success')) @if(Session::has('success'))
<div class="alert alert-success alert-dismissable"> <div class="alert alert-success alert-dismissable">
<i class="fa fa-check-circle"></i> <i class="fa fa-check-circle"></i>
<b>Success!</b> <b>Success!</b>
@@ -136,12 +136,12 @@ class="active"
</div> </div>
<hr/> <hr/>
<h4>{!! Lang::get('lang.api_configurations') !!}</h4> <h4>{!! Lang::get('lang.api_configurations') !!}</h4>
<!-- Guest user page Content --> <!-- Guest user page Content -->
<div class="row"> <div class="row">
<!-- Default Time Zone: Drop down: timezones table : Required -->
<div class="col-md-3"> <div class="col-md-3">
<div class="form-group {{ $errors->has('api_enable') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('api_enable') ? 'has-error' : '' }}">
{!! Form::label('api',Lang::get('lang.api')) !!} {!! Form::label('api',Lang::get('lang.api')) !!}
@@ -157,9 +157,24 @@ class="active"
</div> </div>
</div> </div>
<div class="col-md-3">
<div class="form-group {{ $errors->has('api_key_mandatory') ? 'has-error' : '' }}">
{!! Form::label('api_key_mandatory',Lang::get('lang.api_key_mandatory')) !!}
{!! $errors->first('api_key_mandatory', '<spam class="help-block">:message</spam>') !!}
<div class="row">
<div class="col-xs-5">
{!! Form::radio('api_key_mandatory','1',true) !!} {{Lang::get('lang.enable')}}
</div>
<div class="col-xs-5">
{!! Form::radio('api_key_mandatory','0') !!} {{Lang::get('lang.disable')}}
</div>
</div>
</div>
</div>
<!-- Date and Time Format: text: required: eg - 03/25/2015 7:14 am --> <!-- Date and Time Format: text: required: eg - 03/25/2015 7:14 am -->
<div class="col-md-6"> <div class="col-md-3">
<div class="form-group {{ $errors->has('api_key') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('api_key') ? 'has-error' : '' }}">
{!! Form::label('api_key',Lang::get('lang.api_key')) !!} {!! Form::label('api_key',Lang::get('lang.api_key')) !!}
@@ -174,9 +189,8 @@ class="active"
<a class="btn btn-primary" id="generate"> <i class="fa fa-refresh"> </i> {!! Lang::get('lang.generate_key') !!}</a> <a class="btn btn-primary" id="generate"> <i class="fa fa-refresh"> </i> {!! Lang::get('lang.generate_key') !!}</a>
</div> </div>
</div> </div>
</div> </div>
<a href="#" id="clickGenerate" data-toggle="modal" data-target="#generateModal"></a> <a href="#" id="clickGenerate" data-toggle="modal" data-target="#generateModal"></a>
<div class="modal fade" id="generateModal"> <div class="modal fade" id="generateModal">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
@@ -193,21 +207,20 @@ class="active"
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
<script src="{{asset("lb-faveo/js/ajax-jquery.min.js")}}"></script>
<script src="{{asset("lb-faveo/js/ajax-jquery.min.js")}}"></script> <script type="text/javascript">
<script type="text/javascript"> jQuery(document).ready(function () {
jQuery(document).ready(function() {
// Close a ticket // Close a ticket
$('#generate').on('click', function(e) { $('#generate').on('click', function (e) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "{!! url('generate-api-key') !!}", url: "{!! url('generate-api-key') !!}",
beforeSend: function() { beforeSend: function () {
$("#generate").empty(); $("#generate").empty();
var message = "<i class='fa fa-refresh fa-spin'> </i> <?php echo Lang::get('lang.generate_key'); ?>"; var message = "<i class='fa fa-refresh fa-spin'> </i> <?php echo Lang::get('lang.generate_key'); ?>";
$('#generate').html(message); $('#generate').html(message);
}, },
success: function(response) { success: function (response) {
// alert(response); // alert(response);
$("#messageBody").empty(); $("#messageBody").empty();
@@ -223,6 +236,6 @@ class="active"
return false; return false;
}); });
}); });
</script> </script>
@stop @stop

View File

@@ -1,272 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Faveo Knowledge Base</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- Bootstrap 3.3.2 -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- Font Awesome Icons -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="http://code.ionicframework.com/ionicons/2.0.0/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<!-- fullCalendar 2.2.5-->
<link href="{{asset("lb-faveo/plugins/fullcalendar/fullcalendar.min.css")}}" rel="stylesheet" type="text/css" />
<link href="{{asset("lb-faveo/plugins/fullcalendar/fullcalendar.print.css")}}" rel="stylesheet" type="text/css" media='print' />
<!-- Theme style -->
<link href="{{asset("lb-faveo/dist/css/AdminLTE.min.css")}}" rel="stylesheet" type="text/css" />
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link href="{{asset("lb-faveo/dist/css/skins/_all-skins.min.css")}}" rel="stylesheet" type="text/css" />
<!-- iCheck -->
<link href="{{asset("lb-faveo/plugins/iCheck/flat/blue.css")}}" rel="stylesheet" type="text/css" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<link rel="stylesheet" href="{{asset("lb-faveo/dist/css/tabby.css")}}" type="text/css">
<link href="http://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<link type="text/css" href="http://code.jquery.com/ui/1.9.1/themes/redmond/jquery-ui.css" rel="stylesheet">
<link href="http://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>
<link href="{{asset("lb-faveo/plugins/filebrowser/plugin.js")}}" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="{{asset('lb-faveo/dist/js/nicEdit.js')}}"></script>
@yield('HeadInclude')
</head>
<body class="skin-blue">
<div class="wrapper" id="RefreshAssign">
<header class="main-header">
<?php $settings = App\Model\kb\Settings::where('id', '=', '1')->first();?>
@if($settings->logo)
<a href=""><img src="{{asset('lb-faveo/Img/icon/'.$settings->logo)}}" class="logo" alt="KNOWLEDGE BASE"/></a>
@else
<a href="" class="logo">KNOWLEDGE BASE</a>
@endif
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navbar-collapse">
<ul class="tabs tabs-horizontal nav navbar-nav">
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
@if(Auth::user())
@if(Auth::user()->profile_pic)
<img src="{{asset('lb-faveo/dist/img')}}{{'/'}}{{Auth::user()->profile_pic}}" class="user-image" alt="User Image"/>
@else
<img src="{{ Gravatar::src(Auth::user()->email) }}" class="user-image" alt="User Image">
@endif
@endif
<span class="hidden-xs">{!! Auth::user()->firstname." ".Auth::user()->lastname !!}</span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
@if(Auth::user())
@if(Auth::user()->profile_pic)
<img src="{{asset('lb-faveo/dist/img')}}{{'/'}}{{Auth::user()->profile_pic}}" class="img-circle" alt="User Image"/>
@else
<img src="{{ Gravatar::src(Auth::user()->email) }}" class="img-circle" alt="User Image">
@endif
@endif
<p>
<span class="hidden-xs">{!! Auth::user()->firstname." ".Auth::user()->lastname !!}</span>
</p>
</li>
<!-- Menu Body -->
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<a href="{{url('profile')}}" class="btn btn-default btn-flat">{{Lang::get('lang.profile')}}</a>
</div>
<div class="pull-right">
<a href="{{ url('/auth/logout') }}" class="btn btn-default btn-flat">{{Lang::get('lang.signout')}}</a>
</div>
</li>
</ul>
</li>
</ul>
<!-- <form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" id="navbar-search-input" placeholder="Search">
</div>
</form> -->
</div><!-- /.navbar-collapse -->
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<!-- search form -->
<!-- /.search form -->
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<div class="user-panel">
<div class="pull-left image">
@if(Auth::user() && Auth::user()->profile_pic)
<img src="{{asset('lb-faveo/dist/img')}}{{'/'}}{{Auth::user()->profile_pic}}" class="img-circle" alt="User Image" />
@else
<img src="{{ Gravatar::src(Auth::user()->email) }}" class="img-circle" alt="User Image">
@endif
</div>
<div class="pull-left info">
@if(Auth::user())
<p>{!! Auth::user()->firstname !!}{!! " ". Auth::user()->lastname !!}</p>
@endif
@if(Auth::user() && Auth::user()->active==1)
<a href="#"><i class="fa fa-circle text-success"></i> Online</a>
@else
<a href="#"><i class="fa fa-circle"></i> Offline</a>
@endif
</div>
</div>
<li class="treeview @yield('category')">
<a href="#">
<i class="fa fa-list-ul"></i> <span>{{Lang::get('lang.category')}}</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li @yield('add-category')><a href="{{url('category/create')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.addcategory')}}</a></li>
<li @yield('all-category')><a href="{{url('category')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.allcategory')}}</a></li>
</ul>
</li>
<li class="treeview @yield('article')">
<a href="#">
<i class="fa fa-edit"></i> <span>{{Lang::get('lang.article')}}</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li @yield('add-article')><a href="{{url('article/create')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.addarticle')}}</a></li>
<li @yield('all-article')><a href="{{url('article')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.allarticle')}}</a></li>
</ul>
</li>
<li class="treeview @yield('pages')">
<a href="#">
<i class="fa fa-file-text"></i> <span>{{Lang::get('lang.pages')}}</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li @yield('add-pages')><a href="{{url('page/create')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.addpages')}}</a></li>
<li @yield('all-pages')><a href="{{url('page')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.allpages')}}</a></li>
</ul>
</li>
<li class="treeview @yield('widget')">
<a href="#">
<i class="fa fa-th"></i> <span>{{Lang::get('lang.widgets')}}</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li @yield('footer1')><a href="{{url('create-footer')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.footer1')}}</a></li>
<li @yield('footer2')><a href="{{url('create-footer2')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.footer2')}}</a></li>
<li @yield('footer3')><a href="{{url('create-footer3')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.footer3')}}</a></li>
<li @yield('footer4')><a href="{{url('create-footer4')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.footer4')}}</a></li>
<li @yield('side1')><a href="{{url('side1')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.sidewidget1')}}</a></li>
<li @yield('side2')><a href="{{url('side2')}}"><i class="fa fa-circle-o"></i> {{Lang::get('lang.sidewidget2')}}</a></li>
<li @yield('social')><a href="{{url('social')}}"><i class="fa fa-circle-o"></i> Social</a></li>
</ul>
</li>
<li @yield('comment')>
<a href="{{url('comment')}}">
<i class="fa fa-comments-o"></i>
<span>{{Lang::get('lang.comments')}}</span>
</a>
</li>
<li @yield('settings')>
<a href="{{url('settings')}}">
<i class="fa fa-wrench"></i>
<span>{{Lang::get('lang.settings')}}</span>
</a>
</li>
</ul>
</section>
<!-- /.sidebar -->
</aside>
<!-- Right side column. Contains the navbar and content of the page -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="tab-content" style="background-color: white; border-top:1px solid #F0F0F0;">
<div class="collapse navbar-collapse" id="navbar-collapse">
<div class="tabs-content">
</div>
</div>
</div>
<section class="content-header">
@yield('PageHeader')
@yield('breadcrumbs')
</section>
<!-- Main content -->
<section class="content">
@yield('content')
</section><!-- /.content -->
<!-- /.content-wrapper -->
</div>
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> {{$settings->version}}
</div>
<strong>Copyright &copy; {{date("Y")}} <a href="{{$settings->website}}"> {{$settings->company_name}}</a>. Powered By <a href="http://www.faveohelpdesk.com">Faveo</a>.</strong>
</footer>
</div><!-- ./wrapper -->
<!-- jQuery 2.1.3 -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Bootstrap 3.3.2 JS -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>
<!-- Slimscroll -->
<script src="{{asset("lb-faveo/plugins/slimScroll/jquery.slimscroll.min.js")}}" type="text/javascript"></script>
<!-- FastClick -->
<script src='{{asset("lb-faveo/plugins/fastclick/fastclick.min.js")}}'></script>
<!-- AdminLTE App -->
<script src="{{asset("lb-faveo/dist/js/app.min.js")}}" type="text/javascript"></script>
<!-- iCheck -->
<script src="{{asset("lb-faveo/plugins/iCheck/icheck.min.js")}}" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.maskedinput.min.js"></script>
<script src="{{asset("lb-faveo/plugins/filebrowser/plugin.js")}}"></script>
<!-- Bootstrap WYSIHTML5 -->
<script src="{{asset('lb-faveo/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js')}}" type="text/javascript"></script>
<script type="text/javascript">
bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
</script>
@yield('FooterInclude')
</body>
</html>

View File

@@ -51,12 +51,13 @@ class="active"
@endif @endif
<div class="box-body"> <div class="box-body">
{!! Form::open(['route'=>'select_all','method'=>'post']) !!} {!! Form::open(['id'=>'modalpopup', 'route'=>'select_all','method'=>'post']) !!}
<div class="mailbox-controls"> <div class="mailbox-controls">
<!-- Check all button --> <!-- Check all button -->
<a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a> <a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a>
<input type="submit" class="btn btn-default text-orange btn-sm" name="submit" value="{!! Lang::get('lang.delete') !!}"> <input type="submit" class="submit btn btn-default text-orange btn-sm" id="delete" name="submit" value="{!! Lang::get('lang.delete') !!}">
<input type="submit" class="btn btn-default text-yellow btn-sm" name="submit" value="{!! Lang::get('lang.close') !!}"> <input type="submit" class="submit btn btn-default text-yellow btn-sm" id="close" name="submit" value="{!! Lang::get('lang.close') !!}">
<button type="button" class="btn btn-sm btn-default text-green" id="Edit_Ticket" data-toggle="modal" data-target="#MergeTickets"><i class="fa fa-code-fork"> </i> {!! Lang::get('lang.merge') !!}</button>
</div> </div>
<div class="mailbox-messages" id="refresh"> <div class="mailbox-messages" id="refresh">
@@ -82,8 +83,97 @@ class="active"
</div><!-- /.box-body --> </div><!-- /.box-body -->
</div><!-- /. box --> </div><!-- /. box -->
<!-- merge tickets modal -->
<div class="modal fade" id="MergeTickets">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" id="merge-close" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{!! Lang::get('lang.merge-ticket') !!} </h4>
</div><!-- /.modal-header-->
<div class ="modal-body">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-6" id="merge_loader" style="display:none;">
<img src="{{asset("lb-faveo/media/images/gifloader.gif")}}"><br/><br/><br/>
</div><!-- /.merge-loader -->
</div>
<div id="merge_body">
<div id="merge-body-alert">
<div class="row">
<div class="col-md-12">
<div id="merge-succ-alert" class="alert alert-success alert-dismissable" style="display:none;" >
<!--<button id="dismiss-merge" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-check"></i>Alert!</h4>
<div id="message-merge-succ"></div>
</div>
<div id="merge-err-alert" class="alert alert-danger alert-dismissable" style="display:none;">
<!--<button id="dismiss-merge2" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-ban"></i>Alert!</h4>
<div id="message-merge-err"></div>
</div>
</div>
</div>
</div><!-- /.merge-alert -->
<div id="merge-body-form">
<div class="row">
<div class="col-md-6">
{!! Form::open(['id'=>'merge-form','method' => 'PATCH'] )!!}
<label>{!! Lang::get('lang.title') !!}</label>
<input type="text" name='title' class="form-control" value="" placeholder="Optional" />
</div>
<div class="col-md-6">
<label>{!! Lang::get('lang.select-pparent-ticket') !!}</label>
<select class="form-control" id="select-merge-parent" name='p_id' data-placeholder="{!! Lang::get('lang.select_tickets') !!}" style="width: 100%;"><option value=""></option></select>
</div>
</div>
<div class="row">
<div class="col-md-8">
<label>{!! Lang::get('lang.merge-reason') !!}</label>
<textarea name="reason" class="form-control"></textarea>
</div>
</div>
</div><!-- mereg-body-form -->
</div><!-- merge-body -->
</div><!-- /.modal-body -->
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">{!! Lang::get('lang.close') !!}</button>
<input type="submit" id="merge-btn" class="btn btn-primary pull-right" value="{!! Lang::get('lang.merge') !!}"></input>
{!! Form::close() !!}
</div><!-- /.modal-footer -->
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none; padding-right: 15px;background-color: rgba(0, 0, 0, 0.7);">
<div class="modal-dialog" role="document">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close closemodal" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body" id="custom-alert-body" >
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary pull-left yes" data-dismiss="modal">{{Lang::get('lang.ok')}}</button>
<button type="button" class="btn btn-default no">{{Lang::get('lang.cancel')}}</button>
</div>
</div>
</div>
</div>
</div>
<script> <script>
var t_id =[];
var option = null;
$(function () { $(function () {
//Enable check and uncheck all functionality //Enable check and uncheck all functionality
$(".checkbox-toggle").click(function () { $(".checkbox-toggle").click(function () {
@@ -101,33 +191,236 @@ class="active"
}); });
}); });
$(function() { $(function() {
// Enable check and uncheck all functionality // Enable check and uncheck all functionality
$(".checkbox-toggle").click(function() { $(".checkbox-toggle").click(function() {
var clicks = $(this).data('clicks'); var clicks = $(this).data('clicks');
if (clicks) { if (clicks) {
//Uncheck all checkboxes //Uncheck all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck"); $("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck");
// alert($("input[type='checkbox']").val());
t_id = $('.selectval').map(function() {
return $(this).val();
}).get();
// alert(checkboxValues);
} else { } else {
//Check all checkboxes //Check all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("check"); $("input[type='checkbox']", ".mailbox-messages").iCheck("check");
// alert('Hallo');
t_id = [];
} }
$(this).data("clicks", !clicks); $(this).data("clicks", !clicks);
}); });
}); });
$(document).ready(function() { /// Wait till page is loaded $(document).ready(function() { /// Wait till page is loaded
$('#click').click(function() { $('#click').click(function() {
$('#refresh').load('answered #refresh'); $('#refresh').load('inbox #refresh');
$('#title_refresh').load('answered #title_refresh'); $('#title_refresh').load('inbox #title_refresh');
$('#count_refresh').load('answered #count_refresh'); $('#count_refresh').load('inbox #count_refresh');
$("#show").show(); $("#show").show();
}); });
$(".select2").select2();
$('#delete').on('click', function(){
option = 0;
$('#myModalLabel').html("{{Lang::get('lang.delete-tickets')}}");
});
$('#close').on('click', function(){
option = 1;
$('#myModalLabel').html("{{Lang::get('lang.close-tickets')}}");
});
$("#modalpopup").on('submit', function(e){
e.preventDefault();
var msg ="{{Lang::get('lang.confirm')}}";
var values = getValues();
if(values == ""){
msg = "{{Lang::get('lang.select-ticket')}}";
$('.yes').html("{{Lang::get('lang.ok')}}");
$('#myModalLabel').html("{{Lang::get('lang.alert')}}");
} else {
$('.yes').html("Yes");
}
$('#custom-alert-body').html(msg);
$("#myModal").css("display", "block");
});
$(".closemodal, .no").click(function(){
$("#myModal").css("display", "none");
});
$('.yes').click(function(){
var values = getValues();
if(values == ""){
$("#myModal").css("display", "none");
} else {
$("#myModal").css("display", "none");
$("#modalpopup").unbind('submit');
if (option == 0) {
//alert('delete');
$('#delete').click();
} else {
//alert('close');
$('#close').click();
}
}
});
function getValues(){
var values = $('.selectval:checked').map(function() {
return $(this).val();
}).get();
return values;
}
//checking merging tickets
$('#MergeTickets').on('show.bs.modal', function () {
// alert("hi");
$.ajax({
type: "GET",
url: "{{route('check.merge.tickets',0)}}",
dataType: "html",
data:{data1: t_id},
beforeSend: function() {
$("#merge_body").hide();
$("#merge_loader").show();
},
success: function(response) {
if(response == 0) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.select-tickets-to merge')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else if(response == 2) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.different-users')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else {
$("#merge_body").show();
$("#merge-body-alert").hide();
$("#merge-body-form").show();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', false);
$("#merge_loader").hide();
$.ajax({
url: "{{ route('get.merge.tickets',0) }}",
dataType: "html",
data:{data1: t_id},
success: function(data) {
$('#select-merge-parent').html(data);
}
// return false;
});
}
}
});
}); });
//submit merging form
$('#merge-form').on('submit', function(){
$.ajax({
type: "POST",
url: "{!! url('merge-tickets/') !!}/"+t_id,
dataType: "json",
data: $(this).serialize(),
beforeSend: function() {
$("#merge_body").hide();
$("#merge_loader").show();
},
success: function(response) {
if(response == 0) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.merge-error')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else {
$("#merge_body").show();
$("#merge-err-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.merge-success')}}";
$("#merge-succ-alert").show();
$('#message-merge-succ').html(message);
setInterval(function(){
$("#alert11").hide();
setTimeout(function() {
var link = document.querySelector('#load-answered');
if(link) {
link.click();
}
}, 500);
},2000);
}
}
})
return false;
});
});
function someFunction(id){
if(document.getElementById(id).checked) {
t_id.push(id);
// alert(t_id);
} else {
var index = t_id.indexOf(id);
t_id.splice(index, 1);
// alert(t_id);
}
// thisid.push(id);
// alert(thisid);
// document.getElementById("demo").innerHTML = thisid;
// push.thisid;
// alert(thisid);
// document.getElementByID('demo').innerHTML = thisid;
}
</script> </script>
@stop @stop

View File

@@ -43,13 +43,14 @@ class="active"
@endif @endif
<div class="box-body"> <div class="box-body">
{!! Form::open(['route'=>'select_all','method'=>'post']) !!} {!! Form::open(['id'=>'modalpopup', 'route'=>'select_all','method'=>'post']) !!}
<div class="mailbox-controls"> <div class="mailbox-controls">
<!-- Check all button --> <!-- Check all button -->
<a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a> <a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a>
<input type="submit" class="btn btn-default text-orange btn-sm" name="submit" value="{!! Lang::get('lang.delete') !!}"> <input type="submit" class="submit btn btn-default text-orange btn-sm" id="delete" name="submit" value="{!! Lang::get('lang.delete') !!}">
<input type="submit" class="btn btn-default text-yellow btn-sm" name="submit" value="{!! Lang::get('lang.close') !!}"> <input type="submit" class="submit btn btn-default text-yellow btn-sm" id="close" name="submit" value="{!! Lang::get('lang.close') !!}">
<button type="button" class="btn btn-sm btn-default text-green" id="Edit_Ticket" data-toggle="modal" data-target="#MergeTickets"><i class="fa fa-code-fork"> </i> {!! Lang::get('lang.merge') !!}</button>
</div> </div>
<div class="mailbox-messages" id="refresh"> <div class="mailbox-messages" id="refresh">
<p style="display:none;text-align:center; position:fixed; margin-left:40%;margin-top:-70px;" id="show" class="text-red"><b>{!! Lang::get('lang.loading') !!}...</b></p> <p style="display:none;text-align:center; position:fixed; margin-left:40%;margin-top:-70px;" id="show" class="text-red"><b>{!! Lang::get('lang.loading') !!}...</b></p>
@@ -73,8 +74,96 @@ class="active"
</div><!-- /.box-body --> </div><!-- /.box-body -->
</div><!-- /. box --> </div><!-- /. box -->
<!-- merge tickets modal -->
<div class="modal fade" id="MergeTickets">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" id="merge-close" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{!! Lang::get('lang.merge-ticket') !!} </h4>
</div><!-- /.modal-header-->
<div class ="modal-body">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-6" id="merge_loader" style="display:none;">
<img src="{{asset("lb-faveo/media/images/gifloader.gif")}}"><br/><br/><br/>
</div><!-- /.merge-loader -->
</div>
<div id="merge_body">
<div id="merge-body-alert">
<div class="row">
<div class="col-md-12">
<div id="merge-succ-alert" class="alert alert-success alert-dismissable" style="display:none;" >
<!--<button id="dismiss-merge" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-check"></i>Alert!</h4>
<div id="message-merge-succ"></div>
</div>
<div id="merge-err-alert" class="alert alert-danger alert-dismissable" style="display:none;">
<!--<button id="dismiss-merge2" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-ban"></i>Alert!</h4>
<div id="message-merge-err"></div>
</div>
</div>
</div>
</div><!-- /.merge-alert -->
<div id="merge-body-form">
<div class="row">
<div class="col-md-6">
{!! Form::open(['id'=>'merge-form','method' => 'PATCH'] )!!}
<label>{!! Lang::get('lang.title') !!}</label>
<input type="text" name='title' class="form-control" value="" placeholder="Optional" />
</div>
<div class="col-md-6">
<label>{!! Lang::get('lang.select-pparent-ticket') !!}</label>
<select class="form-control" id="select-merge-parent" name='p_id' data-placeholder="{!! Lang::get('lang.select_tickets') !!}" style="width: 100%;"><option value=""></option></select>
</div>
</div>
<div class="row">
<div class="col-md-8">
<label>{!! Lang::get('lang.merge-reason') !!}</label>
<textarea name="reason" class="form-control"></textarea>
</div>
</div>
</div><!-- mereg-body-form -->
</div><!-- merge-body -->
</div><!-- /.modal-body -->
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">{!! Lang::get('lang.close') !!}</button>
<input type="submit" id="merge-btn" class="btn btn-primary pull-right" value="{!! Lang::get('lang.merge') !!}"></input>
{!! Form::close() !!}
</div><!-- /.modal-footer -->
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none; padding-right: 15px;background-color: rgba(0, 0, 0, 0.7);">
<div class="modal-dialog" role="document">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close closemodal" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body" id="custom-alert-body" >
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary pull-left yes" data-dismiss="modal">{{Lang::get('lang.ok')}}</button>
<button type="button" class="btn btn-default no">{{Lang::get('lang.cancel')}}</button>
</div>
</div>
</div>
</div>
</div>
<script> <script>
var t_id =[];
var option = null;
$(function () { $(function () {
//Enable check and uncheck all functionality //Enable check and uncheck all functionality
$(".checkbox-toggle").click(function () { $(".checkbox-toggle").click(function () {
@@ -92,66 +181,238 @@ class="active"
}); });
}); });
$(function() { $(function() {
// Enable check and uncheck all functionality // Enable check and uncheck all functionality
$(".checkbox-toggle").click(function() { $(".checkbox-toggle").click(function() {
var clicks = $(this).data('clicks'); var clicks = $(this).data('clicks');
if (clicks) { if (clicks) {
//Uncheck all checkboxes //Uncheck all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck"); $("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck");
// alert($("input[type='checkbox']").val());
t_id = $('.selectval').map(function() {
return $(this).val();
}).get();
// alert(checkboxValues);
} else { } else {
//Check all checkboxes //Check all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("check"); $("input[type='checkbox']", ".mailbox-messages").iCheck("check");
// alert('Hallo');
t_id = [];
} }
$(this).data("clicks", !clicks); $(this).data("clicks", !clicks);
}); });
}); });
$(document).ready(function() { /// Wait till page is loaded $(document).ready(function() { /// Wait till page is loaded
$('#click').click(function() { $('#click').click(function() {
$('#refresh').load('assigned #refresh'); $('#refresh').load('inbox #refresh');
$('#title_refresh').load('assigned #title_refresh'); $('#title_refresh').load('inbox #title_refresh');
$('#count_refresh').load('assigned #count_refresh'); $('#count_refresh').load('inbox #count_refresh');
$("#show").show(); $("#show").show();
}); });
$(".select2").select2();
$('#delete').on('click', function(){
option = 0;
$('#myModalLabel').html("{{Lang::get('lang.delete-tickets')}}");
});
$('#close').on('click', function(){
option = 1;
$('#myModalLabel').html("{{Lang::get('lang.close-tickets')}}");
});
$("#modalpopup").on('submit', function(e){
e.preventDefault();
var msg ="{{Lang::get('lang.confirm')}}";
var values = getValues();
if(values == ""){
msg = "{{Lang::get('lang.select-ticket')}}";
$('.yes').html("{{Lang::get('lang.ok')}}");
$('#myModalLabel').html("{{Lang::get('lang.alert')}}");
} else {
$('.yes').html("Yes");
}
$('#custom-alert-body').html(msg);
$("#myModal").css("display", "block");
});
$(".closemodal, .no").click(function(){
$("#myModal").css("display", "none");
});
$('.yes').click(function(){
var values = getValues();
if(values == ""){
$("#myModal").css("display", "none");
} else {
$("#myModal").css("display", "none");
$("#modalpopup").unbind('submit');
if (option == 0) {
//alert('delete');
$('#delete').click();
} else {
//alert('close');
$('#close').click();
}
}
});
function getValues(){
var values = $('.selectval:checked').map(function() {
return $(this).val();
}).get();
return values;
}
//checking merging tickets
$('#MergeTickets').on('show.bs.modal', function () {
// alert("hi");
$.ajax({
type: "GET",
url: "{{route('check.merge.tickets',0)}}",
dataType: "html",
data:{data1: t_id},
beforeSend: function() {
$("#merge_body").hide();
$("#merge_loader").show();
},
success: function(response) {
if(response == 0) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.select-tickets-to merge')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else if(response == 2) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.different-users')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else {
$("#merge_body").show();
$("#merge-body-alert").hide();
$("#merge-body-form").show();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', false);
$("#merge_loader").hide();
$.ajax({
url: "{{ route('get.merge.tickets',0) }}",
dataType: "html",
data:{data1: t_id},
success: function(data) {
$('#select-merge-parent').html(data);
}
// return false;
});
}
}
});
});
//submit merging form
$('#merge-form').on('submit', function(){
$.ajax({
type: "POST",
url: "{!! url('merge-tickets/') !!}/"+t_id,
dataType: "json",
data: $(this).serialize(),
beforeSend: function() {
$("#merge_body").hide();
$("#merge_loader").show();
},
success: function(response) {
if(response == 0) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.merge-error')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else {
$("#merge_body").show();
$("#merge-err-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.merge-success')}}";
$("#merge-succ-alert").show();
$('#message-merge-succ').html(message);
setInterval(function(){
$("#alert11").hide();
setTimeout(function() {
var link = document.querySelector('#load-assigned');
if(link) {
link.click();
}
}, 500);
},2000);
}
}
})
return false;
});
}); });
// check box get data
// jQuery(function($) {
// $("form input[id='check_all']").click(function() { // triggred check
// var inputs = $("form input[type='checkbox']"); // get the checkbox
// for(var i = 0; i < inputs.length; i++) { // count input tag in the form
// var type = inputs[i].getAttribute("type"); // get the type attribute
// if(type == "checkbox") {
// if(this.checked) {
// inputs[i].checked = true; // checked
// } else {
// inputs[i].checked = false; // unchecked
// }
// }
// }
// });
// $("form input[id='submit']").click(function() { // triggred submit function someFunction(id){
if(document.getElementById(id).checked) {
t_id.push(id);
// alert(t_id);
} else {
var index = t_id.indexOf(id);
t_id.splice(index, 1);
// alert(t_id);
}
// var count_checked = $("[name='data[]']:checked").length; // count the checked // thisid.push(id);
// if(count_checked == 0) { // alert(thisid);
// alert("Please select a product(s) to delete."); // document.getElementById("demo").innerHTML = thisid;
// return false;
// }
// if(count_checked == 1) { // push.thisid;
// return confirm("Are you sure you want to delete these product?"); // alert(thisid);
// } else {
// return confirm("Are you sure you want to delete these products?"); // document.getElementByID('demo').innerHTML = thisid;
// } }
// });
// }); // jquery end
</script> </script>
@stop @stop

View File

@@ -43,14 +43,14 @@ class="active"
@endif @endif
<div class="box-body"> <div class="box-body">
{!! Form::open(['route'=>'select_all','method'=>'post']) !!} {!! Form::open(['id'=>'modalpopup', 'route'=>'select_all','method'=>'post']) !!}
<div class="mailbox-controls"> <div class="mailbox-controls">
<!-- Check all button --> <!-- Check all button -->
<a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a> <a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a>
{{-- <a class="btn btn-default btn-sm" id="click"><i class="fa fa-refresh"></i></a> --}} {{-- <a class="btn btn-default btn-sm" id="click"><i class="fa fa-refresh"></i></a> --}}
<input type="submit" class="btn btn-default text-orange btn-sm" name="submit" value="{!! Lang::get('lang.delete') !!}"> <input type="submit" class="btn btn-default text-orange btn-sm" name="submit" id="delete" value="{!! Lang::get('lang.delete') !!}">
<input type="submit" class="btn btn-default text-blue btn-sm" name="submit" value="{!! Lang::get('lang.open') !!}"> <input type="submit" class="btn btn-default text-blue btn-sm" name="submit" id="close" value="{!! Lang::get('lang.open') !!}">
</div> </div>
<div class="mailbox-messages" id="refresh"> <div class="mailbox-messages" id="refresh">
<p style="display:none;text-align:center; position:fixed; margin-left:40%;margin-top:-70px;" id="show" class="text-red"><b>{!! Lang::get('lang.loading') !!}...</b></p> <p style="display:none;text-align:center; position:fixed; margin-left:40%;margin-top:-70px;" id="show" class="text-red"><b>{!! Lang::get('lang.loading') !!}...</b></p>
@@ -75,8 +75,31 @@ class="active"
</div><!-- /.box-body --> </div><!-- /.box-body -->
</div><!-- /. box --> </div><!-- /. box -->
<!-- Modal -->
<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none; padding-right: 15px;background-color: rgba(0, 0, 0, 0.7);">
<div class="modal-dialog" role="document">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close closemodal" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body" id="custom-alert-body" >
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary pull-left yes" data-dismiss="modal">{{Lang::get('lang.ok')}}</button>
<button type="button" class="btn btn-default no">{{Lang::get('lang.cancel')}}</button>
</div>
</div>
</div>
</div>
</div>
<script> <script>
var option = null;
$(function () { $(function () {
//Enable check and uncheck all functionality //Enable check and uncheck all functionality
$(".checkbox-toggle").click(function () { $(".checkbox-toggle").click(function () {
@@ -119,6 +142,62 @@ class="active"
$('#count_refresh').load('closed #count_refresh'); $('#count_refresh').load('closed #count_refresh');
$("#show").show(); $("#show").show();
}); });
$('#delete').on('click', function(){
option = 0;
$('#myModalLabel').html("{{Lang::get('lang.delete-tickets')}}");
});
$('#close').on('click', function(){
option = 1;
$('#myModalLabel').html("{{Lang::get('lang.open-tickets')}}");
});
$("#modalpopup").on('submit', function(e){
e.preventDefault();
var msg ="{{Lang::get('lang.confirm')}}";
var values = getValues();
if(values == ""){
msg = "{{Lang::get('lang.select-ticket')}}";
$('.yes').html("{{Lang::get('lang.ok')}}");
$('#myModalLabel').html("{{Lang::get('lang.alert')}}");
} else {
$('.yes').html("Yes");
}
$('#custom-alert-body').html(msg);
$("#myModal").css("display", "block");
});
$(".closemodal, .no").click(function(){
$("#myModal").css("display", "none");
});
$('.yes').click(function(){
var values = getValues();
if(values == ""){
$("#myModal").css("display", "none");
} else {
$("#myModal").css("display", "none");
$("#modalpopup").unbind('submit');
if (option == 0) {
//alert('delete');
$('#delete').click();
} else {
//alert('close');
$('#close').click();
}
}
});
function getValues(){
var values = $('.selectval:checked').map(function() {
return $(this).val();
}).get();
return values;
}
}); });
</script> </script>
@stop @stop

View File

@@ -42,14 +42,14 @@ class="active"
</div> </div>
@endif @endif
<div class="box-body "> <div class="box-body ">
{!! Form::open(['route'=>'select_all','method'=>'post']) !!} {!! Form::open(['id'=>'modalpopup', 'route'=>'select_all','method'=>'post']) !!}
<div class="mailbox-controls"> <div class="mailbox-controls">
<!-- Check all button --> <!-- Check all button -->
<a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a> <a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a>
{{-- <a class="btn btn-default btn-sm" id="click"><i class="fa fa-refresh"></i></a> --}} {{-- <a class="btn btn-default btn-sm" id="click"><i class="fa fa-refresh"></i></a> --}}
<input type="submit" class="btn btn-default text-orange btn-sm" name="submit" value="{!! Lang::get('lang.delete') !!}"> <input type="submit" class="submit btn btn-default text-orange btn-sm" id="delete" name="submit" value="{!! Lang::get('lang.delete') !!}">
<input type="submit" class="btn btn-default text-yellow btn-sm" name="submit" value="{!! Lang::get('lang.close') !!}"> <input type="submit" class="submit btn btn-default text-yellow btn-sm" id="close" name="submit" value="{!! Lang::get('lang.close') !!}">
<button type="button" class="btn btn-sm btn-default text-yellow" id="Edit_Ticket" data-toggle="modal" data-target="#MergeTickets"><i class="fa fa-chain"> </i> {!! Lang::get('lang.merge') !!}</button> <button type="button" class="btn btn-sm btn-default text-green" id="Edit_Ticket" data-toggle="modal" data-target="#MergeTickets"><i class="fa fa-code-fork"> </i> {!! Lang::get('lang.merge') !!}</button>
</div> </div>
<div class="mailbox-messages" id="refresh"> <div class="mailbox-messages" id="refresh">
@@ -95,12 +95,12 @@ class="active"
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div id="merge-succ-alert" class="alert alert-success alert-dismissable" style="display:none;" > <div id="merge-succ-alert" class="alert alert-success alert-dismissable" style="display:none;" >
<button id="dismiss-merge" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <!--<button id="dismiss-merge" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-check"></i>Alert!</h4> <h4><i class="icon fa fa-check"></i>Alert!</h4>
<div id="message-merge-succ"></div> <div id="message-merge-succ"></div>
</div> </div>
<div id="merge-err-alert" class="alert alert-danger alert-dismissable" style="display:none;"> <div id="merge-err-alert" class="alert alert-danger alert-dismissable" style="display:none;">
<button id="dismiss-merge2" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <!--<button id="dismiss-merge2" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-ban"></i>Alert!</h4> <h4><i class="icon fa fa-ban"></i>Alert!</h4>
<div id="message-merge-err"></div> <div id="message-merge-err"></div>
</div> </div>
@@ -139,9 +139,31 @@ class="active"
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
<!-- Modal -->
<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none; padding-right: 15px;background-color: rgba(0, 0, 0, 0.7);">
<div class="modal-dialog" role="document">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close closemodal" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body" id="custom-alert-body" >
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary pull-left yes" data-dismiss="modal">{{Lang::get('lang.ok')}}</button>
<button type="button" class="btn btn-default no">{{Lang::get('lang.cancel')}}</button>
</div>
</div>
</div>
</div>
</div>
<script> <script>
var t_id =[]; var t_id =[];
var option = null;
$(function () { $(function () {
//Enable check and uncheck all functionality //Enable check and uncheck all functionality
$(".checkbox-toggle").click(function () { $(".checkbox-toggle").click(function () {
@@ -167,14 +189,25 @@ class="active"
if (clicks) { if (clicks) {
//Uncheck all checkboxes //Uncheck all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck"); $("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck");
// alert($("input[type='checkbox']").val());
t_id = $('.selectval').map(function() {
return $(this).val();
}).get();
// alert(checkboxValues);
} else { } else {
//Check all checkboxes //Check all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("check"); $("input[type='checkbox']", ".mailbox-messages").iCheck("check");
// alert('Hallo');
t_id = [];
} }
$(this).data("clicks", !clicks); $(this).data("clicks", !clicks);
}); });
}); });
$(document).ready(function() { /// Wait till page is loaded $(document).ready(function() { /// Wait till page is loaded
$('#click').click(function() { $('#click').click(function() {
$('#refresh').load('inbox #refresh'); $('#refresh').load('inbox #refresh');
@@ -184,13 +217,77 @@ class="active"
}); });
$(".select2").select2(); $(".select2").select2();
//checking merging tickets
$('#delete').on('click', function(){
option = 0;
$('#myModalLabel').html("{{Lang::get('lang.delete-tickets')}}");
});
$('#close').on('click', function(){
option = 1;
$('#myModalLabel').html("{{Lang::get('lang.close-tickets')}}");
});
$("#modalpopup").on('submit', function(e){
e.preventDefault();
var msg ="{{Lang::get('lang.confirm')}}";
var values = getValues();
if(values == ""){
msg = "{{Lang::get('lang.select-ticket')}}";
$('.yes').html("{{Lang::get('lang.ok')}}");
$('#myModalLabel').html("{{Lang::get('lang.alert')}}");
} else {
$('.yes').html("Yes");
}
$('#custom-alert-body').html(msg);
$("#myModal").css("display", "block");
});
$(".closemodal, .no").click(function(){
$("#myModal").css("display", "none");
});
$(".closemodal, .no").click(function(){
$("#myModal").css("display", "none");
});
$('.yes').click(function(){
var values = getValues();
if(values == ""){
$("#myModal").css("display", "none");
} else {
$("#myModal").css("display", "none");
$("#modalpopup").unbind('submit');
if (option == 0) {
//alert('delete');
$('#delete').click();
} else {
//alert('close');
$('#close').click();
}
}
});
function getValues(){
var values = $('.selectval:checked').map(function() {
return $(this).val();
}).get();
return values;
}
//checking merging tickets
$('#MergeTickets').on('show.bs.modal', function () { $('#MergeTickets').on('show.bs.modal', function () {
// alert("hi"); // alert("hi");
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "../check-merge-ticket/"+0, url: "{{route('check.merge.tickets',0)}}",
dataType: "html", dataType: "html",
data:{data1: t_id}, data:{data1: t_id},
beforeSend: function() { beforeSend: function() {
@@ -200,6 +297,7 @@ class="active"
success: function(response) { success: function(response) {
if(response == 0) { if(response == 0) {
$("#merge_body").show(); $("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show(); $("#merge-body-alert").show();
$("#merge-body-form").hide(); $("#merge-body-form").hide();
$("#merge_loader").hide(); $("#merge_loader").hide();
@@ -210,6 +308,7 @@ class="active"
} else if(response == 2) { } else if(response == 2) {
$("#merge_body").show(); $("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show(); $("#merge-body-alert").show();
$("#merge-body-form").hide(); $("#merge-body-form").hide();
$("#merge_loader").hide(); $("#merge_loader").hide();
@@ -226,7 +325,7 @@ class="active"
$("#merge-btn").attr('disabled', false); $("#merge-btn").attr('disabled', false);
$("#merge_loader").hide(); $("#merge_loader").hide();
$.ajax({ $.ajax({
url: "../get-merge-tickets/"+0, url: "{{ route('get.merge.tickets',0) }}",
dataType: "html", dataType: "html",
data:{data1: t_id}, data:{data1: t_id},
success: function(data) { success: function(data) {
@@ -245,7 +344,7 @@ class="active"
$('#merge-form').on('submit', function(){ $('#merge-form').on('submit', function(){
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "../merge-tickets/"+t_id, url: "{!! url('merge-tickets/') !!}/"+t_id,
dataType: "json", dataType: "json",
data: $(this).serialize(), data: $(this).serialize(),
beforeSend: function() { beforeSend: function() {
@@ -256,6 +355,7 @@ class="active"
success: function(response) { success: function(response) {
if(response == 0) { if(response == 0) {
$("#merge_body").show(); $("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show(); $("#merge-body-alert").show();
$("#merge-body-form").hide(); $("#merge-body-form").hide();
$("#merge_loader").hide(); $("#merge_loader").hide();
@@ -266,6 +366,7 @@ class="active"
} else { } else {
$("#merge_body").show(); $("#merge_body").show();
$("#merge-err-alert").hide();
$("#merge-body-alert").show(); $("#merge-body-alert").show();
$("#merge-body-form").hide(); $("#merge-body-form").hide();
$("#merge_loader").hide(); $("#merge_loader").hide();
@@ -290,11 +391,6 @@ class="active"
return false; return false;
}); });
}); });

View File

@@ -43,13 +43,14 @@ class="active"
@endif @endif
<div class="box-body"> <div class="box-body">
{!! Form::open(['route'=>'select_all','method'=>'post']) !!} {!! Form::open(['id'=>'modalpopup', 'route'=>'select_all','method'=>'post']) !!}
<div class="mailbox-controls"> <div class="mailbox-controls">
<!-- Check all button --> <!-- Check all button -->
<a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a> <a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a>
{{-- <a class="btn btn-default btn-sm" id="click"><i class="fa fa-refresh"></i></a> --}} {{-- <a class="btn btn-default btn-sm" id="click"><i class="fa fa-refresh"></i></a> --}}
<input type="submit" class="btn btn-default text-orange btn-sm" name="submit" value="{!! Lang::get('lang.delete') !!}"> <input type="submit" class="submit btn btn-default text-orange btn-sm" id="delete" name="submit" value="{!! Lang::get('lang.delete') !!}">
<input type="submit" class="btn btn-default text-yellow btn-sm" name="submit" value="{!! Lang::get('lang.close') !!}"> <input type="submit" class="submit btn btn-default text-yellow btn-sm" id="close" name="submit" value="{!! Lang::get('lang.close') !!}">
<button type="button" class="btn btn-sm btn-default text-green" id="Edit_Ticket" data-toggle="modal" data-target="#MergeTickets"><i class="fa fa-code-fork"> </i> {!! Lang::get('lang.merge') !!}</button>
</div> </div>
<div class="mailbox-messages" id="refresh"> <div class="mailbox-messages" id="refresh">
<p style="display:none;text-align:center; position:fixed; margin-left:40%;margin-top:-70px;" id="show" class="text-red"><b>{!! Lang::get('lang.loading') !!}...</b></p> <p style="display:none;text-align:center; position:fixed; margin-left:40%;margin-top:-70px;" id="show" class="text-red"><b>{!! Lang::get('lang.loading') !!}...</b></p>
@@ -74,8 +75,98 @@ class="active"
</div><!-- /.box-body --> </div><!-- /.box-body -->
</div><!-- /. box --> </div><!-- /. box -->
<!-- merge tickets modal -->
<div class="modal fade" id="MergeTickets">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" id="merge-close" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{!! Lang::get('lang.merge-ticket') !!} </h4>
</div><!-- /.modal-header-->
<div class ="modal-body">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-6" id="merge_loader" style="display:none;">
<img src="{{asset("lb-faveo/media/images/gifloader.gif")}}"><br/><br/><br/>
</div><!-- /.merge-loader -->
</div>
<div id="merge_body">
<div id="merge-body-alert">
<div class="row">
<div class="col-md-12">
<div id="merge-succ-alert" class="alert alert-success alert-dismissable" style="display:none;" >
<!--<button id="dismiss-merge" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-check"></i>Alert!</h4>
<div id="message-merge-succ"></div>
</div>
<div id="merge-err-alert" class="alert alert-danger alert-dismissable" style="display:none;">
<!--<button id="dismiss-merge2" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-ban"></i>Alert!</h4>
<div id="message-merge-err"></div>
</div>
</div>
</div>
</div><!-- /.merge-alert -->
<div id="merge-body-form">
<div class="row">
<div class="col-md-6">
{!! Form::open(['id'=>'merge-form','method' => 'PATCH'] )!!}
<label>{!! Lang::get('lang.title') !!}</label>
<input type="text" name='title' class="form-control" value="" placeholder="Optional" />
</div>
<div class="col-md-6">
<label>{!! Lang::get('lang.select-pparent-ticket') !!}</label>
<select class="form-control" id="select-merge-parent" name='p_id' data-placeholder="{!! Lang::get('lang.select_tickets') !!}" style="width: 100%;"><option value=""></option></select>
</div>
</div>
<div class="row">
<div class="col-md-8">
<label>{!! Lang::get('lang.merge-reason') !!}</label>
<textarea name="reason" class="form-control"></textarea>
</div>
</div>
</div><!-- mereg-body-form -->
</div><!-- merge-body -->
</div><!-- /.modal-body -->
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">{!! Lang::get('lang.close') !!}</button>
<input type="submit" id="merge-btn" class="btn btn-primary pull-right" value="{!! Lang::get('lang.merge') !!}"></input>
{!! Form::close() !!}
</div><!-- /.modal-footer -->
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none; padding-right: 15px;background-color: rgba(0, 0, 0, 0.7);">
<div class="modal-dialog" role="document">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close closemodal" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body" id="custom-alert-body" >
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary pull-left yes" data-dismiss="modal">{{Lang::get('lang.ok')}}</button>
<button type="button" class="btn btn-default no">{{Lang::get('lang.cancel')}}</button>
</div>
</div>
</div>
</div>
</div>
<script> <script>
var t_id =[];
var option = null;
$(function () { $(function () {
//Enable check and uncheck all functionality //Enable check and uncheck all functionality
$(".checkbox-toggle").click(function () { $(".checkbox-toggle").click(function () {
@@ -93,31 +184,237 @@ class="active"
}); });
}); });
$(function() { $(function() {
// Enable check and uncheck all functionality // Enable check and uncheck all functionality
$(".checkbox-toggle").click(function() { $(".checkbox-toggle").click(function() {
var clicks = $(this).data('clicks'); var clicks = $(this).data('clicks');
if (clicks) { if (clicks) {
//Uncheck all checkboxes //Uncheck all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck"); $("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck");
// alert($("input[type='checkbox']").val());
t_id = $('.selectval').map(function() {
return $(this).val();
}).get();
// alert(checkboxValues);
} else { } else {
//Check all checkboxes //Check all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("check"); $("input[type='checkbox']", ".mailbox-messages").iCheck("check");
// alert('Hallo');
t_id = [];
} }
$(this).data("clicks", !clicks); $(this).data("clicks", !clicks);
}); });
}); });
$(document).ready(function() { /// Wait till page is loaded $(document).ready(function() { /// Wait till page is loaded
$('#click').click(function() { $('#click').click(function() {
$('#refresh').load('myticket #refresh'); $('#refresh').load('inbox #refresh');
$('#title_refresh').load('myticket #title_refresh'); $('#title_refresh').load('inbox #title_refresh');
$('#count_refresh').load('myticket #count_refresh'); $('#count_refresh').load('inbox #count_refresh');
$("#show").show(); $("#show").show();
}); });
$(".select2").select2();
$('#delete').on('click', function(){
option = 0;
$('#myModalLabel').html("{{Lang::get('lang.delete-tickets')}}");
}); });
$('#close').on('click', function(){
option = 1;
$('#myModalLabel').html("{{Lang::get('lang.close-tickets')}}");
});
$("#modalpopup").on('submit', function(e){
e.preventDefault();
var msg ="{{Lang::get('lang.confirm')}}";
var values = getValues();
if(values == ""){
msg = "{{Lang::get('lang.select-ticket')}}";
$('.yes').html("{{Lang::get('lang.ok')}}");
$('#myModalLabel').html("{{Lang::get('lang.alert')}}");
} else {
$('.yes').html("Yes");
}
$('#custom-alert-body').html(msg);
$("#myModal").css("display", "block");
});
$(".closemodal, .no").click(function(){
$("#myModal").css("display", "none");
});
$('.yes').click(function(){
var values = getValues();
if(values == ""){
$("#myModal").css("display", "none");
} else {
$("#myModal").css("display", "none");
$("#modalpopup").unbind('submit');
if (option == 0) {
//alert('delete');
$('#delete').click();
} else {
//alert('close');
$('#close').click();
}
}
});
function getValues(){
var values = $('.selectval:checked').map(function() {
return $(this).val();
}).get();
return values;
}
//checking merging tickets
$('#MergeTickets').on('show.bs.modal', function () {
// alert("hi");
$.ajax({
type: "GET",
url: "{{route('check.merge.tickets',0)}}",
dataType: "html",
data:{data1: t_id},
beforeSend: function() {
$("#merge_body").hide();
$("#merge_loader").show();
},
success: function(response) {
if(response == 0) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.select-tickets-to merge')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else if(response == 2) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.different-users')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else {
$("#merge_body").show();
$("#merge-body-alert").hide();
$("#merge-body-form").show();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', false);
$("#merge_loader").hide();
$.ajax({
url: "{{ route('get.merge.tickets',0) }}",
dataType: "html",
data:{data1: t_id},
success: function(data) {
$('#select-merge-parent').html(data);
}
// return false;
});
}
}
});
});
//submit merging form
$('#merge-form').on('submit', function(){
$.ajax({
type: "POST",
url: "{!! url('merge-tickets/') !!}/"+t_id,
dataType: "json",
data: $(this).serialize(),
beforeSend: function() {
$("#merge_body").hide();
$("#merge_loader").show();
},
success: function(response) {
if(response == 0) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.merge-error')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else {
$("#merge_body").show();
$("#merge-err-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.merge-success')}}";
$("#merge-succ-alert").show();
$('#message-merge-succ').html(message);
setInterval(function(){
$("#alert11").hide();
setTimeout(function() {
var link = document.querySelector('#load-myticket');
if(link) {
link.click();
}
}, 500);
},2000);
}
}
})
return false;
});
});
function someFunction(id){
if(document.getElementById(id).checked) {
t_id.push(id);
// alert(t_id);
} else {
var index = t_id.indexOf(id);
t_id.splice(index, 1);
// alert(t_id);
}
// thisid.push(id);
// alert(thisid);
// document.getElementById("demo").innerHTML = thisid;
// push.thisid;
// alert(thisid);
// document.getElementByID('demo').innerHTML = thisid;
}
</script> </script>
@stop @stop

View File

@@ -49,12 +49,13 @@ class="active"
</div> </div>
@endif @endif
<div class="box-body"> <div class="box-body">
{!! Form::open(['route'=>'select_all','method'=>'post']) !!} {!! Form::open(['id'=>'modalpopup', 'route'=>'select_all','method'=>'post']) !!}
<div class="mailbox-controls"> <div class="mailbox-controls">
<!-- Check all button --> <!-- Check all button -->
<a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a> <a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a>
<input type="submit" class="btn btn-default text-orange btn-sm" name="submit" value="{!! Lang::get('lang.delete') !!}"> <input type="submit" class="submit btn btn-default text-orange btn-sm" id="delete" name="submit" value="{!! Lang::get('lang.delete') !!}">
<input type="submit" class="btn btn-default text-yellow btn-sm" name="submit" value="{!! Lang::get('lang.close') !!}"> <input type="submit" class="submit btn btn-default text-yellow btn-sm" id="close" name="submit" value="{!! Lang::get('lang.close') !!}">
<button type="button" class="btn btn-sm btn-default text-green" id="Edit_Ticket" data-toggle="modal" data-target="#MergeTickets"><i class="fa fa-code-fork"> </i> {!! Lang::get('lang.merge') !!}</button>
</div> </div>
<div class="mailbox-messages" id="refresh"> <div class="mailbox-messages" id="refresh">
<p style="display:none;text-align:center; position:fixed; margin-left:40%;margin-top:-70px;" id="show" class="text-red"><b>{!! Lang::get('lang.loading') !!}...</b></p> <p style="display:none;text-align:center; position:fixed; margin-left:40%;margin-top:-70px;" id="show" class="text-red"><b>{!! Lang::get('lang.loading') !!}...</b></p>
@@ -79,8 +80,97 @@ class="active"
</div><!-- /.box-body --> </div><!-- /.box-body -->
</div><!-- /. box --> </div><!-- /. box -->
<!-- merge tickets modal -->
<div class="modal fade" id="MergeTickets">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" id="merge-close" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{!! Lang::get('lang.merge-ticket') !!} </h4>
</div><!-- /.modal-header-->
<div class ="modal-body">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-6" id="merge_loader" style="display:none;">
<img src="{{asset("lb-faveo/media/images/gifloader.gif")}}"><br/><br/><br/>
</div><!-- /.merge-loader -->
</div>
<div id="merge_body">
<div id="merge-body-alert">
<div class="row">
<div class="col-md-12">
<div id="merge-succ-alert" class="alert alert-success alert-dismissable" style="display:none;" >
<!--<button id="dismiss-merge" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-check"></i>Alert!</h4>
<div id="message-merge-succ"></div>
</div>
<div id="merge-err-alert" class="alert alert-danger alert-dismissable" style="display:none;">
<!--<button id="dismiss-merge2" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-ban"></i>Alert!</h4>
<div id="message-merge-err"></div>
</div>
</div>
</div>
</div><!-- /.merge-alert -->
<div id="merge-body-form">
<div class="row">
<div class="col-md-6">
{!! Form::open(['id'=>'merge-form','method' => 'PATCH'] )!!}
<label>{!! Lang::get('lang.title') !!}</label>
<input type="text" name='title' class="form-control" value="" placeholder="Optional" />
</div>
<div class="col-md-6">
<label>{!! Lang::get('lang.select-pparent-ticket') !!}</label>
<select class="form-control" id="select-merge-parent" name='p_id' data-placeholder="{!! Lang::get('lang.select_tickets') !!}" style="width: 100%;"><option value=""></option></select>
</div>
</div>
<div class="row">
<div class="col-md-8">
<label>{!! Lang::get('lang.merge-reason') !!}</label>
<textarea name="reason" class="form-control"></textarea>
</div>
</div>
</div><!-- mereg-body-form -->
</div><!-- merge-body -->
</div><!-- /.modal-body -->
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">{!! Lang::get('lang.close') !!}</button>
<input type="submit" id="merge-btn" class="btn btn-primary pull-right" value="{!! Lang::get('lang.merge') !!}"></input>
{!! Form::close() !!}
</div><!-- /.modal-footer -->
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none; padding-right: 15px;background-color: rgba(0, 0, 0, 0.7);">
<div class="modal-dialog" role="document">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close closemodal" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body" id="custom-alert-body" >
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary pull-left yes" data-dismiss="modal">{{Lang::get('lang.ok')}}</button>
<button type="button" class="btn btn-default no">{{Lang::get('lang.cancel')}}</button>
</div>
</div>
</div>
</div>
</div>
<script> <script>
var t_id =[];
$(function () { $(function () {
//Enable check and uncheck all functionality //Enable check and uncheck all functionality
$(".checkbox-toggle").click(function () { $(".checkbox-toggle").click(function () {
@@ -98,32 +188,235 @@ class="active"
}); });
}); });
$(function() { $(function() {
// Enable check and uncheck all functionality // Enable check and uncheck all functionality
$(".checkbox-toggle").click(function() { $(".checkbox-toggle").click(function() {
var clicks = $(this).data('clicks'); var clicks = $(this).data('clicks');
if (clicks) { if (clicks) {
//Uncheck all checkboxes //Uncheck all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck"); $("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck");
// alert($("input[type='checkbox']").val());
t_id = $('.selectval').map(function() {
return $(this).val();
}).get();
// alert(checkboxValues);
} else { } else {
//Check all checkboxes //Check all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("check"); $("input[type='checkbox']", ".mailbox-messages").iCheck("check");
// alert('Hallo');
t_id = [];
} }
$(this).data("clicks", !clicks); $(this).data("clicks", !clicks);
}); });
}); });
$(document).ready(function() { /// Wait till page is loaded $(document).ready(function() { /// Wait till page is loaded
$('#click').click(function() { $('#click').click(function() {
$('#refresh').load('open #refresh'); $('#refresh').load('inbox #refresh');
$('#title_refresh').load('open #title_refresh'); $('#title_refresh').load('inbox #title_refresh');
$('#count_refresh').load('open #count_refresh'); $('#count_refresh').load('inbox #count_refresh');
$("#show").show(); $("#show").show();
}); });
$(".select2").select2();
$('#delete').on('click', function(){
option = 0;
$('#myModalLabel').html("{{Lang::get('lang.delete-tickets')}}");
});
$('#close').on('click', function(){
option = 1;
$('#myModalLabel').html("{{Lang::get('lang.close-tickets')}}");
});
$("#modalpopup").on('submit', function(e){
e.preventDefault();
var msg ="{{Lang::get('lang.confirm')}}";
var values = getValues();
if(values == ""){
msg = "{{Lang::get('lang.select-ticket')}}";
$('.yes').html("{{Lang::get('lang.ok')}}");
$('#myModalLabel').html("{{Lang::get('lang.alert')}}");
} else {
$('.yes').html("Yes");
}
$('#custom-alert-body').html(msg);
$("#myModal").css("display", "block");
});
$(".closemodal, .no").click(function(){
$("#myModal").css("display", "none");
});
$('.yes').click(function(){
var values = getValues();
if(values == ""){
$("#myModal").css("display", "none");
} else {
$("#myModal").css("display", "none");
$("#modalpopup").unbind('submit');
if (option == 0) {
//alert('delete');
$('#delete').click();
} else {
//alert('close');
$('#close').click();
}
}
});
function getValues(){
var values = $('.selectval:checked').map(function() {
return $(this).val();
}).get();
return values;
}
//checking merging tickets
$('#MergeTickets').on('show.bs.modal', function () {
// alert("hi");
$.ajax({
type: "GET",
url: "{{route('check.merge.tickets',0)}}",
dataType: "html",
data:{data1: t_id},
beforeSend: function() {
$("#merge_body").hide();
$("#merge_loader").show();
},
success: function(response) {
if(response == 0) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.select-tickets-to merge')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else if(response == 2) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.different-users')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else {
$("#merge_body").show();
$("#merge-body-alert").hide();
$("#merge-body-form").show();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', false);
$("#merge_loader").hide();
$.ajax({
url: "{{ route('get.merge.tickets',0) }}",
dataType: "html",
data:{data1: t_id},
success: function(data) {
$('#select-merge-parent').html(data);
}
// return false;
});
}
}
});
}); });
//submit merging form
$('#merge-form').on('submit', function(){
$.ajax({
type: "POST",
url: "{!! url('merge-tickets/') !!}/"+t_id,
dataType: "json",
data: $(this).serialize(),
beforeSend: function() {
$("#merge_body").hide();
$("#merge_loader").show();
},
success: function(response) {
if(response == 0) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.merge-error')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else {
$("#merge_body").show();
$("#merge-err-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.merge-success')}}";
$("#merge-succ-alert").show();
$('#message-merge-succ').html(message);
setInterval(function(){
$("#alert11").hide();
setTimeout(function() {
var link = document.querySelector('#load-open');
if(link) {
link.click();
}
}, 500);
},2000);
}
}
})
return false;
});
});
function someFunction(id){
if(document.getElementById(id).checked) {
t_id.push(id);
// alert(t_id);
} else {
var index = t_id.indexOf(id);
t_id.splice(index, 1);
// alert(t_id);
}
// thisid.push(id);
// alert(thisid);
// document.getElementById("demo").innerHTML = thisid;
// push.thisid;
// alert(thisid);
// document.getElementByID('demo').innerHTML = thisid;
}
</script> </script>
@stop @stop

View File

@@ -113,7 +113,7 @@ active
</button> </button>
<ul class="dropdown-menu pull-right"> <ul class="dropdown-menu pull-right">
<li data-toggle="modal" data-target="#ChangeOwner"><a href="#"><i class="fa fa-users" style="color:green;"> </i>Change Owner</a></li> <li data-toggle="modal" data-target="#ChangeOwner"><a href="#"><i class="fa fa-users" style="color:green;"> </i>Change Owner</a></li>
<li data-toggle="modal" data-target="#MergeTickets"><a href="#"><i class="fa fa-chain" style="color:teal;"> </i>{!! Lang::get('lang.merge-ticket') !!}</a></li> <li data-toggle="modal" data-target="#MergeTickets"><a href="#"><i class="fa fa-code-fork" style="color:teal;"> </i>{!! Lang::get('lang.merge-ticket') !!}</a></li>
<?php if ($group->can_delete_ticket == 1) {?> <?php if ($group->can_delete_ticket == 1) {?>
<li id="delete"><a href="#"><i class="fa fa-trash-o" style="color:red;"> </i>{!! Lang::get('lang.delete_ticket') !!}</a></li> <li id="delete"><a href="#"><i class="fa fa-trash-o" style="color:red;"> </i>{!! Lang::get('lang.delete_ticket') !!}</a></li>
<?php } <?php }
@@ -1163,12 +1163,12 @@ $count_teams = count($teams);
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div id="merge-succ-alert" class="alert alert-success alert-dismissable" style="display:none;" > <div id="merge-succ-alert" class="alert alert-success alert-dismissable" style="display:none;" >
<button id="dismiss-merge" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <!-- <button id="dismiss-merge" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> -->
<h4><i class="icon fa fa-check"></i>Alert!</h4> <h4><i class="icon fa fa-check"></i>Alert!</h4>
<div id="message-merge-succ"></div> <div id="message-merge-succ"></div>
</div> </div>
<div id="merge-err-alert" class="alert alert-danger alert-dismissable" style="display:none;"> <div id="merge-err-alert" class="alert alert-danger alert-dismissable" style="display:none;">
<button id="dismiss-merge2" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <!-- <button id="dismiss-merge2" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> -->
<h4><i class="icon fa fa-ban"></i>Alert!</h4> <h4><i class="icon fa fa-ban"></i>Alert!</h4>
<div id="message-merge-err"></div> <div id="message-merge-err"></div>
</div> </div>
@@ -1803,6 +1803,7 @@ jQuery(document).ready(function() {
success: function(response) { success: function(response) {
if(response == 0) { if(response == 0) {
$("#merge_body").show(); $("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show(); $("#merge-body-alert").show();
$("#merge-body-form").hide(); $("#merge-body-form").hide();
$("#merge_loader").hide(); $("#merge_loader").hide();
@@ -1848,6 +1849,7 @@ jQuery(document).ready(function() {
success: function(response) { success: function(response) {
if(response == 0) { if(response == 0) {
$("#merge_body").show(); $("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show(); $("#merge-body-alert").show();
$("#merge-body-form").hide(); $("#merge-body-form").hide();
$("#merge_loader").hide(); $("#merge_loader").hide();
@@ -1858,6 +1860,7 @@ jQuery(document).ready(function() {
} else if(response == 2) { } else if(response == 2) {
$("#merge_body").show(); $("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show(); $("#merge-body-alert").show();
$("#merge-body-form").hide(); $("#merge-body-form").hide();
$("#merge_loader").hide(); $("#merge_loader").hide();
@@ -1868,6 +1871,7 @@ jQuery(document).ready(function() {
} else { } else {
$("#merge_body").show(); $("#merge_body").show();
$("#merge-err-alert").hide();
$("#merge-body-alert").show(); $("#merge-body-alert").show();
$("#merge-body-form").hide(); $("#merge-body-form").hide();
$("#merge_loader").hide(); $("#merge_loader").hide();

View File

@@ -45,12 +45,12 @@ class="active"
@endif @endif
<div class="box-body"> <div class="box-body">
{!! Form::open(['route'=>'select_all','method'=>'post']) !!} {!! Form::open(['id'=>'modalpopup', 'route'=>'select_all','method'=>'post']) !!}
<div class="mailbox-controls"> <div class="mailbox-controls">
<!-- Check all button --> <!-- Check all button -->
<a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a> <a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a>
<input type="submit" class="btn btn-default text-blue btn-sm" name="submit" value="{!! Lang::get('lang.open') !!}"> <input type="submit" class="btn btn-default text-blue btn-sm" id="delete" name="submit" value="{!! Lang::get('lang.open') !!}">
<input type="submit" class="btn btn-default text-yellow btn-sm" name="submit" value="{!! Lang::get('lang.close') !!}"> <input type="submit" class="btn btn-default text-yellow btn-sm" name="submit" id="close" value="{!! Lang::get('lang.close') !!}">
</div> </div>
<div class="mailbox-messages" id="refresh"> <div class="mailbox-messages" id="refresh">
@@ -76,8 +76,30 @@ class="active"
{!! Form::close() !!} {!! Form::close() !!}
</div><!-- /.box-body --> </div><!-- /.box-body -->
</div><!-- /. box --> </div><!-- /. box -->
<!-- Modal -->
<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none; padding-right: 15px;background-color: rgba(0, 0, 0, 0.7);">
<div class="modal-dialog" role="document">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close closemodal" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body" id="custom-alert-body" >
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary pull-left yes" data-dismiss="modal">{{Lang::get('lang.ok')}}</button>
<button type="button" class="btn btn-default no">{{Lang::get('lang.cancel')}}</button>
</div>
</div>
</div>
</div>
</div>
<script> <script>
var option = null;
$(function () { $(function () {
//Enable check and uncheck all functionality //Enable check and uncheck all functionality
$(".checkbox-toggle").click(function () { $(".checkbox-toggle").click(function () {
@@ -117,6 +139,61 @@ class="active"
$('#count_refresh').load('trash #count_refresh'); $('#count_refresh').load('trash #count_refresh');
$("#show").show(); $("#show").show();
}); });
$('#delete').on('click', function(){
option = 0;
$('#myModalLabel').html("{{Lang::get('lang.open-tickets')}}");
});
$('#close').on('click', function(){
option = 1;
$('#myModalLabel').html("{{Lang::get('lang.close-tickets')}}");
});
$("#modalpopup").on('submit', function(e){
e.preventDefault();
var msg ="{{Lang::get('lang.confirm')}}";
var values = getValues();
if(values == ""){
msg = "{{Lang::get('lang.select-ticket')}}";
$('.yes').html("{{Lang::get('lang.ok')}}");
$('#myModalLabel').html("{{Lang::get('lang.alert')}}");
} else {
$('.yes').html("Yes");
}
$('#custom-alert-body').html(msg);
$("#myModal").css("display", "block");
});
$(".closemodal, .no").click(function(){
$("#myModal").css("display", "none");
});
$('.yes').click(function(){
var values = getValues();
if(values == ""){
$("#myModal").css("display", "none");
} else {
$("#myModal").css("display", "none");
$("#modalpopup").unbind('submit');
if (option == 0) {
//alert('delete');
$('#delete').click();
} else {
//alert('close');
$('#close').click();
}
}
});
function getValues(){
var values = $('.selectval:checked').map(function() {
return $(this).val();
}).get();
return values;
}
}); });
</script> </script>

View File

@@ -47,13 +47,14 @@ class="active"
@endif @endif
<div class="box-body"> <div class="box-body">
{!! Form::open(['route'=>'select_all','method'=>'post']) !!} {!! Form::open(['id'=>'modalpopup', 'route'=>'select_all','method'=>'post']) !!}
<div class="mailbox-controls"> <div class="mailbox-controls">
<!-- Check all button --> <!-- Check all button -->
<a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a> <a class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></a>
<input type="submit" class="btn btn-default text-orange btn-sm" name="submit" value="{!! Lang::get('lang.delete') !!}"> <input type="submit" class="submit btn btn-default text-orange btn-sm" id="delete" name="submit" value="{!! Lang::get('lang.delete') !!}">
<input type="submit" class="btn btn-default text-yellow btn-sm" name="submit" value="{!! Lang::get('lang.close') !!}"> <input type="submit" class="submit btn btn-default text-yellow btn-sm" id="close" name="submit" value="{!! Lang::get('lang.close') !!}">
<button type="button" class="btn btn-sm btn-default text-green" id="Edit_Ticket" data-toggle="modal" data-target="#MergeTickets"><i class="fa fa-code-fork"> </i> {!! Lang::get('lang.merge') !!}</button>
</div> </div>
<div class="mailbox-messages" id="refresh"> <div class="mailbox-messages" id="refresh">
<p style="display:none;text-align:center; position:fixed; margin-left:40%;margin-top:-70px;" id="show" class="text-red"><b>{!! Lang::get('lang.loading') !!}...</b></p> <p style="display:none;text-align:center; position:fixed; margin-left:40%;margin-top:-70px;" id="show" class="text-red"><b>{!! Lang::get('lang.loading') !!}...</b></p>
@@ -79,8 +80,96 @@ class="active"
</div><!-- /.box-body --> </div><!-- /.box-body -->
</div><!-- /. box --> </div><!-- /. box -->
<!-- merge tickets modal -->
<div class="modal fade" id="MergeTickets">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" id="merge-close" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{!! Lang::get('lang.merge-ticket') !!} </h4>
</div><!-- /.modal-header-->
<div class ="modal-body">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-6" id="merge_loader" style="display:none;">
<img src="{{asset("lb-faveo/media/images/gifloader.gif")}}"><br/><br/><br/>
</div><!-- /.merge-loader -->
</div>
<div id="merge_body">
<div id="merge-body-alert">
<div class="row">
<div class="col-md-12">
<div id="merge-succ-alert" class="alert alert-success alert-dismissable" style="display:none;" >
<!--<button id="dismiss-merge" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-check"></i>Alert!</h4>
<div id="message-merge-succ"></div>
</div>
<div id="merge-err-alert" class="alert alert-danger alert-dismissable" style="display:none;">
<!--<button id="dismiss-merge2" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
<h4><i class="icon fa fa-ban"></i>Alert!</h4>
<div id="message-merge-err"></div>
</div>
</div>
</div>
</div><!-- /.merge-alert -->
<div id="merge-body-form">
<div class="row">
<div class="col-md-6">
{!! Form::open(['id'=>'merge-form','method' => 'PATCH'] )!!}
<label>{!! Lang::get('lang.title') !!}</label>
<input type="text" name='title' class="form-control" value="" placeholder="Optional" />
</div>
<div class="col-md-6">
<label>{!! Lang::get('lang.select-pparent-ticket') !!}</label>
<select class="form-control" id="select-merge-parent" name='p_id' data-placeholder="{!! Lang::get('lang.select_tickets') !!}" style="width: 100%;"><option value=""></option></select>
</div>
</div>
<div class="row">
<div class="col-md-8">
<label>{!! Lang::get('lang.merge-reason') !!}</label>
<textarea name="reason" class="form-control"></textarea>
</div>
</div>
</div><!-- mereg-body-form -->
</div><!-- merge-body -->
</div><!-- /.modal-body -->
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">{!! Lang::get('lang.close') !!}</button>
<input type="submit" id="merge-btn" class="btn btn-primary pull-right" value="{!! Lang::get('lang.merge') !!}"></input>
{!! Form::close() !!}
</div><!-- /.modal-footer -->
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none; padding-right: 15px;background-color: rgba(0, 0, 0, 0.7);">
<div class="modal-dialog" role="document">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close closemodal" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body" id="custom-alert-body" >
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary pull-left yes" data-dismiss="modal">{{Lang::get('lang.ok')}}</button>
<button type="button" class="btn btn-default no">{{Lang::get('lang.cancel')}}</button>
</div>
</div>
</div>
</div>
</div>
<script> <script>
var t_id =[];
var option = null;
$(function () { $(function () {
//Enable check and uncheck all functionality //Enable check and uncheck all functionality
$(".checkbox-toggle").click(function () { $(".checkbox-toggle").click(function () {
@@ -98,33 +187,234 @@ class="active"
}); });
}); });
$(function() { $(function() {
// Enable check and uncheck all functionality // Enable check and uncheck all functionality
$(".checkbox-toggle").click(function() { $(".checkbox-toggle").click(function() {
var clicks = $(this).data('clicks'); var clicks = $(this).data('clicks');
if (clicks) { if (clicks) {
//Uncheck all checkboxes //Uncheck all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck"); $("input[type='checkbox']", ".mailbox-messages").iCheck("uncheck");
// alert($("input[type='checkbox']").val());
t_id = $('.selectval').map(function() {
return $(this).val();
}).get();
// alert(checkboxValues);
} else { } else {
//Check all checkboxes //Check all checkboxes
$("input[type='checkbox']", ".mailbox-messages").iCheck("check"); $("input[type='checkbox']", ".mailbox-messages").iCheck("check");
// alert('Hallo');
t_id = [];
} }
$(this).data("clicks", !clicks); $(this).data("clicks", !clicks);
}); });
}); });
$(document).ready(function() { /// Wait till page is loaded $(document).ready(function() { /// Wait till page is loaded
$('#click').click(function() { $('#click').click(function() {
$('#refresh').load('unassigned #refresh'); $('#refresh').load('inbox #refresh');
$('#title_refresh').load('unassigned #title_refresh'); $('#title_refresh').load('inbox #title_refresh');
$('#count_refresh').load('unassigned #count_refresh'); $('#count_refresh').load('inbox #count_refresh');
$("#show").show(); $("#show").show();
}); });
$(".select2").select2();
$('#delete').on('click', function(){
option = 0;
$('#myModalLabel').html("{{Lang::get('lang.delete-tickets')}}");
});
$('#close').on('click', function(){
option = 1;
$('#myModalLabel').html("{{Lang::get('lang.close-tickets')}}");
});
$("#modalpopup").on('submit', function(e){
e.preventDefault();
var msg ="{{Lang::get('lang.confirm')}}";
var values = getValues();
if(values == ""){
msg = "{{Lang::get('lang.select-ticket')}}";
$('.yes').html("{{Lang::get('lang.ok')}}");
$('#myModalLabel').html("{{Lang::get('lang.alert')}}");
} else {
$('.yes').html("Yes");
}
$('#custom-alert-body').html(msg);
$("#myModal").css("display", "block");
});
$(".closemodal, .no").click(function(){
$("#myModal").css("display", "none");
});
$('.yes').click(function(){
var values = getValues();
if(values == ""){
$("#myModal").css("display", "none");
} else {
$("#myModal").css("display", "none");
$("#modalpopup").unbind('submit');
if (option == 0) {
//alert('delete');
$('#delete').click();
} else {
//alert('close');
$('#close').click();
}
}
});
function getValues(){
var values = $('.selectval:checked').map(function() {
return $(this).val();
}).get();
return values;
}
//checking merging tickets
$('#MergeTickets').on('show.bs.modal', function () {
// alert("hi");
$.ajax({
type: "GET",
url: "{{route('check.merge.tickets',0)}}",
dataType: "html",
data:{data1: t_id},
beforeSend: function() {
$("#merge_body").hide();
$("#merge_loader").show();
},
success: function(response) {
if(response == 0) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.select-tickets-to merge')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else if(response == 2) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.different-users')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else {
$("#merge_body").show();
$("#merge-body-alert").hide();
$("#merge-body-form").show();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', false);
$("#merge_loader").hide();
$.ajax({
url: "{{ route('get.merge.tickets',0) }}",
dataType: "html",
data:{data1: t_id},
success: function(data) {
$('#select-merge-parent').html(data);
}
// return false;
});
}
}
});
}); });
//submit merging form
$('#merge-form').on('submit', function(){
$.ajax({
type: "POST",
url: "{!! url('merge-tickets/') !!}/"+t_id,
dataType: "json",
data: $(this).serialize(),
beforeSend: function() {
$("#merge_body").hide();
$("#merge_loader").show();
},
success: function(response) {
if(response == 0) {
$("#merge_body").show();
$("#merge-succ-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.merge-error')}}";
$("#merge-err-alert").show();
$('#message-merge-err').html(message);
} else {
$("#merge_body").show();
$("#merge-err-alert").hide();
$("#merge-body-alert").show();
$("#merge-body-form").hide();
$("#merge_loader").hide();
$("#merge-btn").attr('disabled', true);
var message = "{{Lang::get('lang.merge-success')}}";
$("#merge-succ-alert").show();
$('#message-merge-succ').html(message);
setInterval(function(){
$("#alert11").hide();
setTimeout(function() {
var link = document.querySelector('#load-unassigned');
if(link) {
link.click();
}
}, 500);
},2000);
}
}
})
return false;
});
});
function someFunction(id){
if(document.getElementById(id).checked) {
t_id.push(id);
// alert(t_id);
} else {
var index = t_id.indexOf(id);
t_id.splice(index, 1);
// alert(t_id);
}
// thisid.push(id);
// alert(thisid);
// document.getElementById("demo").innerHTML = thisid;
// push.thisid;
// alert(thisid);
// document.getElementByID('demo').innerHTML = thisid;
}
</script> </script>
@stop @stop

View File

@@ -1,6 +1,5 @@
@extends('themes.default1.agent.layout.agent') @extends('themes.default1.agent.layout.agent')
@section('Users') @section('Users')
class="active" class="active"
@stop @stop
@@ -17,87 +16,78 @@ class="active"
@stop @stop
<!-- header --> <!-- header -->
@section('PageHeader') @section('PageHeader')
<h1>{!! Lang::get('lang.create') !!}</h1>
@stop @stop
<!-- /header --> <!-- /header -->
<!-- breadcrumbs --> <!-- breadcrumbs -->
@section('breadcrumbs') @section('breadcrumbs')
<ol class="breadcrumb"> <ol class="breadcrumb">
</ol> </ol>
@stop @stop
<!-- /breadcrumbs --> <!-- /breadcrumbs -->
<!-- content --> <!-- content -->
@section('content') @section('content')
<!-- open a form --> <!-- open a form -->
{!! Form::open(['action'=>'Agent\helpdesk\UserController@store','method'=>'post']) !!} {!! Form::open(['action'=>'Agent\helpdesk\UserController@store','method'=>'post']) !!}
<div class="box box-primary"> <div class="box box-primary">
<div class="content-header"> <div class="box-header with-border">
<h3 class="box-title">
<h4>{!! Lang::get('lang.create') !!} {!! Form::submit(Lang::get('lang.save'),['class'=>'form-group btn btn-primary pull-right'])!!}</h4> User Credentials
</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
@if(Session::has('errors'))
<!-- Email Address : Email : Required --> <div class="alert alert-danger alert-dismissable">
<i class="fa fa-ban"></i>
<b>Alert!</b>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<br/>
@if($errors->first('email'))
<li class="error-message-padding">{!! $errors->first('email', ':message') !!}</li>
@endif
@if($errors->first('full_name'))
<li class="error-message-padding">{!! $errors->first('full_name', ':message') !!}</li>
@endif
@if($errors->first('mobile'))
<li class="error-message-padding">{!! $errors->first('mobile', ':message') !!}</li>
@endif
@if($errors->first('ext'))
<li class="error-message-padding">{!! $errors->first('ext', ':message') !!}</li>
@endif
@if($errors->first('phone_number'))
<li class="error-message-padding">{!! $errors->first('phone_number', ':message') !!}</li>
@endif
@if($errors->first('active'))
<li class="error-message-padding">{!! $errors->first('active', ':message') !!}</li>
@endif
</div>
@endif
<!-- Email Address : Email : Required -->
<div class="row"> <div class="row">
<div class="col-xs-4 form-group {{ $errors->has('email') ? 'has-error' : '' }}"> <div class="col-xs-4 form-group {{ $errors->has('email') ? 'has-error' : '' }}">
{!! Form::label('email',Lang::get('lang.email')) !!} {!! Form::label('email',Lang::get('lang.email')) !!}
{!! $errors->first('email', '<spam class="help-block">:message</spam>') !!}
{!! Form::email('email',null,['class' => 'form-control']) !!} {!! Form::email('email',null,['class' => 'form-control']) !!}
</div> </div>
<!-- Full Name : Text : Required-->
<!-- Full Name : Text : Required-->
<div class="col-xs-4 form-group {{ $errors->has('full_name') ? 'has-error' : '' }}"> <div class="col-xs-4 form-group {{ $errors->has('full_name') ? 'has-error' : '' }}">
{!! Form::label('full_name',Lang::get('lang.full_name')) !!} {!! Form::label('full_name',Lang::get('lang.full_name')) !!}
{!! $errors->first('full_name', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('full_name',null,['class' => 'form-control']) !!} {!! Form::text('full_name',null,['class' => 'form-control']) !!}
</div> </div>
<!-- mobile Number : Text : -->
<!-- mobile Number : Text : -->
<div class="col-md-4 form-group {{ $errors->has('mobile') ? 'has-error' : '' }}"> <div class="col-md-4 form-group {{ $errors->has('mobile') ? 'has-error' : '' }}">
{!! Form::label('mobile',Lang::get('lang.mobile')) !!} {!! Form::label('mobile',Lang::get('lang.mobile')) !!}
{!! $errors->first('mobile', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('mobile',null,['class' => 'form-control']) !!} {!! Form::text('mobile',null,['class' => 'form-control']) !!}
</div> </div>
<div class="col-xs-1 form-group {{ $errors->has('ext') ? 'has-error' : '' }}"> <div class="col-xs-1 form-group {{ $errors->has('ext') ? 'has-error' : '' }}">
<label for="ext">{!! Lang::get('lang.ext') !!}</label> <label for="ext">{!! Lang::get('lang.ext') !!}</label>
{!! $errors->first('ext', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('ext',null,['class' => 'form-control']) !!} {!! Form::text('ext',null,['class' => 'form-control']) !!}
</div> </div>
<div class="col-xs-5 form-group {{ $errors->has('phone_number') ? 'has-error' : '' }}"> <div class="col-xs-5 form-group {{ $errors->has('phone_number') ? 'has-error' : '' }}">
<label for="phone_number">{!! Lang::get('lang.phone') !!}</label> <label for="phone_number">{!! Lang::get('lang.phone') !!}</label>
{!! $errors->first('phone_number', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('phone_number',null,['class' => 'form-control']) !!} {!! Form::text('phone_number',null,['class' => 'form-control']) !!}
</div> </div>
<div class="col-md-4 form-group {{ $errors->has('active') ? 'has-error' : '' }}"> <div class="col-md-4 form-group {{ $errors->has('active') ? 'has-error' : '' }}">
{!! Form::label('active',Lang::get('lang.status')) !!} {!! Form::label('active',Lang::get('lang.status')) !!}
{!! $errors->first('active', '<spam class="help-block">:message</spam>') !!}
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
{!! Form::radio('active','1',true) !!} {{Lang::get('lang.active')}} {!! Form::radio('active','1',true) !!} {{Lang::get('lang.active')}}
@@ -106,29 +96,22 @@ class="active"
{!! Form::radio('active','0') !!} {{Lang::get('lang.inactive')}} {!! Form::radio('active','0') !!} {{Lang::get('lang.inactive')}}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Internal Notes : Textarea -->
<!-- Internal Notes : Textarea -->
<div class="form-group"> <div class="form-group">
{!! Form::label('internal_note',Lang::get('lang.internal_notes')) !!} {!! Form::label('internal_note',Lang::get('lang.internal_notes')) !!}
{!! Form::textarea('internal_note',null,['class' => 'form-control']) !!} {!! Form::textarea('internal_note',null,['class' => 'form-control', 'size' => '30x5']) !!}
</div>
</div>
<div class="box-footer">
{!! Form::submit(Lang::get('lang.save'),['class'=>'form-group btn btn-primary'])!!}
</div> </div>
</div>
</div> </div>
<script>
<script>
$(function () { $(function () {
$("textarea").wysihtml5(); $("textarea").wysihtml5();
}); });
</script> </script>
@stop @stop

View File

@@ -13,78 +13,75 @@ active
class="active" class="active"
@stop @stop
<!-- /breadcrumbs --> <!-- header -->
@section('PageHeader')
<h1>{!! Lang::get('lang.edit') !!}</h1>
@stop
<!-- /header -->
<!-- content --> <!-- content -->
@section('content') @section('content')
<!-- open a form --> <!-- open a form -->
{!! Form::model($users,['url'=>'user/'.$users->id,'method'=>'PATCH']) !!} {!! Form::model($users,['url'=>'user/'.$users->id,'method'=>'PATCH']) !!}
<div class="box box-primary"> <div class="box box-primary">
<div class="content-header"> <div class="box-header with-border">
<h3 class="box-title">
<h4>{{Lang::get('lang.edit')}} {!! Form::submit(Lang::get('lang.save'),['class'=>'form-group btn btn-primary pull-right'])!!}</h4> User Credentials
</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
@if(Session::has('errors'))
<!-- Email Address : Email : Required --> <div class="alert alert-danger alert-dismissable">
<i class="fa fa-ban"></i>
<b>Alert!</b>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<br/>
@if($errors->first('email'))
<li class="error-message-padding">{!! $errors->first('email', ':message') !!}</li>
@endif
@if($errors->first('user_name'))
<li class="error-message-padding">{!! $errors->first('user_name', ':message') !!}</li>
@endif
@if($errors->first('mobile'))
<li class="error-message-padding">{!! $errors->first('mobile', ':message') !!}</li>
@endif
@if($errors->first('ext'))
<li class="error-message-padding">{!! $errors->first('ext', ':message') !!}</li>
@endif
@if($errors->first('phone_number'))
<li class="error-message-padding">{!! $errors->first('phone_number', ':message') !!}</li>
@endif
@if($errors->first('active'))
<li class="error-message-padding">{!! $errors->first('active', ':message') !!}</li>
@endif
</div>
@endif
<!-- Email Address : Email : Required -->
<div class="row"> <div class="row">
<div class="col-md-4 form-group {{ $errors->has('email') ? 'has-error' : '' }}"> <div class="col-md-4 form-group {{ $errors->has('email') ? 'has-error' : '' }}">
{!! Form::label('email',Lang::get('lang.email')) !!} {!! Form::label('email',Lang::get('lang.email')) !!}
{!! $errors->first('email', '<spam class="help-block">:message</spam>') !!}
{!! Form::email('email',null,['disabled'=>'disabled', 'class' => 'form-control']) !!} {!! Form::email('email',null,['disabled'=>'disabled', 'class' => 'form-control']) !!}
</div> </div>
<!-- Full Name : Text : Required-->
<!-- Full Name : Text : Required-->
<div class="col-md-4 form-group {{ $errors->has('user_name') ? 'has-error' : '' }}"> <div class="col-md-4 form-group {{ $errors->has('user_name') ? 'has-error' : '' }}">
{!! Form::label('user_name',Lang::get('lang.full_name')) !!} {!! Form::label('user_name',Lang::get('lang.full_name')) !!}
{!! $errors->first('user_name', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('user_name',null,['class' => 'form-control']) !!} {!! Form::text('user_name',null,['class' => 'form-control']) !!}
</div> </div>
<!-- mobile Number : Text : -->
<!-- mobile Number : Text : -->
<div class="col-md-4 form-group {{ $errors->has('mobile') ? 'has-error' : '' }}"> <div class="col-md-4 form-group {{ $errors->has('mobile') ? 'has-error' : '' }}">
{!! Form::label('mobile',Lang::get('lang.mobile')) !!} {!! Form::label('mobile',Lang::get('lang.mobile')) !!}
{!! $errors->first('mobile', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('mobile',null,['class' => 'form-control']) !!} {!! Form::text('mobile',null,['class' => 'form-control']) !!}
</div> </div>
<div class="col-xs-1 form-group {{ $errors->has('ext') ? 'has-error' : '' }}"> <div class="col-xs-1 form-group {{ $errors->has('ext') ? 'has-error' : '' }}">
<label for="ext">{!! Lang::get('lang.ext') !!}</label> <label for="ext">{!! Lang::get('lang.ext') !!}</label>
{!! $errors->first('ext', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('ext',null,['class' => 'form-control']) !!} {!! Form::text('ext',null,['class' => 'form-control']) !!}
</div> </div>
<div class="col-xs-5 form-group {{ $errors->has('phone_number') ? 'has-error' : '' }}"> <div class="col-xs-5 form-group {{ $errors->has('phone_number') ? 'has-error' : '' }}">
<label for="phone_number">{!! Lang::get('lang.phone') !!}</label> <label for="phone_number">{!! Lang::get('lang.phone') !!}</label>
{!! $errors->first('phone_number', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('phone_number',null,['class' => 'form-control']) !!} {!! Form::text('phone_number',null,['class' => 'form-control']) !!}
</div> </div>
<div class="col-xs-3 form-group {{ $errors->has('active') ? 'has-error' : '' }}"> <div class="col-xs-3 form-group {{ $errors->has('active') ? 'has-error' : '' }}">
{!! Form::label('active',Lang::get('lang.status')) !!} {!! Form::label('active',Lang::get('lang.status')) !!}
{!! $errors->first('active', '<spam class="help-block">:message</spam>') !!}
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
{!! Form::radio('active','1',true) !!} {{Lang::get('lang.active')}} {!! Form::radio('active','1',true) !!} {{Lang::get('lang.active')}}
@@ -93,14 +90,9 @@ class="active"
{!! Form::radio('active','0') !!} {{Lang::get('lang.inactive')}} {!! Form::radio('active','0') !!} {{Lang::get('lang.inactive')}}
</div> </div>
</div> </div>
</div> </div>
<div class="col-xs-3 form-group {{ $errors->has('ban') ? 'has-error' : '' }}"> <div class="col-xs-3 form-group {{ $errors->has('ban') ? 'has-error' : '' }}">
{!! Form::label('ban',Lang::get('lang.ban')) !!} {!! Form::label('ban',Lang::get('lang.ban')) !!}
{!! $errors->first('ban', '<spam class="help-block">:message</spam>') !!}
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
{!! Form::radio('ban','1',true) !!} {{Lang::get('lang.enable')}} {!! Form::radio('ban','1',true) !!} {{Lang::get('lang.enable')}}
@@ -111,19 +103,19 @@ class="active"
</div> </div>
</div> </div>
</div> </div>
<!-- Internal Notes : Textarea --> <!-- Internal Notes : Textarea -->
<div class="form-group"> <div class="form-group">
{!! Form::label('internal_note',Lang::get('lang.internal_notes')) !!} {!! Form::label('internal_note',Lang::get('lang.internal_notes')) !!}
{!! Form::textarea('internal_note',null,['class' => 'form-control']) !!} {!! Form::textarea('internal_note',null,['class' => 'form-control']) !!}
</div>
</div>
<div class="box-footer">
{!! Form::submit(Lang::get('lang.save'),['class'=>'form-group btn btn-primary'])!!}
</div> </div>
</div> </div>
</div> <script>
<script>
$(function () { $(function () {
$("textarea").wysihtml5(); $("textarea").wysihtml5();
}); });
</script> </script>
@stop @stop

View File

@@ -1,6 +1,5 @@
@extends('themes.default1.agent.layout.agent') @extends('themes.default1.agent.layout.agent')
@section('Users') @section('Users')
class="active" class="active"
@stop @stop
@@ -17,30 +16,23 @@ class="active"
@stop @stop
<!-- header --> <!-- header -->
@section('PageHeader') @section('PageHeader')
@stop @stop
<!-- /header --> <!-- /header -->
<!-- breadcrumbs --> <!-- breadcrumbs -->
@section('breadcrumbs') @section('breadcrumbs')
<ol class="breadcrumb"> <ol class="breadcrumb">
</ol> </ol>
@stop @stop
<!-- /breadcrumbs --> <!-- /breadcrumbs -->
<!-- content --> <!-- content -->
@section('content') @section('content')
<!-- open a form --> <!-- open a form -->
<div class="box box-primary"> <div class="box box-primary">
<div class="box-header"> <div class="box-header">
<h3 class="box-title">{{Lang::get('lang.user')}}</h3><a href="{{route('user.create')}}" class="btn btn-primary pull-right">{{Lang::get('lang.create_user')}}</a></div> <h3 class="box-title">{{Lang::get('lang.user')}}</h3><a href="{{route('user.create')}}" class="btn btn-primary pull-right">{{Lang::get('lang.create_user')}}</a></div>
<div class="box-body">
<div class="box-body"> <!-- check whether success or not -->
<!-- check whether success or not --> @if(Session::has('success'))
@if(Session::has('success'))
<div class="alert alert-success alert-dismissable"> <div class="alert alert-success alert-dismissable">
<i class="fa fa-check-circle"></i> <i class="fa fa-check-circle"></i>
<b>Success</b> <b>Success</b>
@@ -57,9 +49,9 @@ class="active"
{{Session::get('fails')}} {{Session::get('fails')}}
</div> </div>
@endif @endif
<?php <?php
$users = App\User::where('role','=','user')->orderBy('id', 'ASC')->paginate(20); $users = App\User::where('role', '=', 'user')->orderBy('id', 'ASC')->paginate(20);
?> ?>
{!! Datatable::table() {!! Datatable::table()
->addColumn(Lang::get('lang.name'), ->addColumn(Lang::get('lang.name'),
Lang::get('lang.email'), Lang::get('lang.email'),
@@ -70,9 +62,7 @@ class="active"
Lang::get('lang.action')) // these are the column headings to be shown Lang::get('lang.action')) // these are the column headings to be shown
->setUrl(route('user.list')) // this is the route where data will be retrieved ->setUrl(route('user.list')) // this is the route where data will be retrieved
->render() !!} ->render() !!}
</div> </div>
</div> </div>
@stop @stop
<!-- /content --> <!-- /content -->

View File

@@ -16,7 +16,7 @@ class="active"
@stop @stop
<!-- header --> <!-- header -->
@section('PageHeader') @section('PageHeader')
<div class="box-header" style="margin-top:-15px;margin-bottom:-15px;"><h3 class="box-title">{!! Lang::get('lang.user_profile') !!}</h3><a href="{{route('user.edit', $users->id)}}" class="btn btn-info btn-sm btn-flat pull-right"><i class="fa fa-edit" style="color:black;"> </i> {!! Lang::get('lang.edit') !!}</a></div> <h1>{!! Lang::get('lang.user_profile') !!} <a href="{{route('user.edit', $users->id)}}" class="btn btn-info btn-sm btn-flat pull-right"><i class="fa fa-edit" style="color:black;"> </i> {!! Lang::get('lang.edit') !!}</a></h1>
@stop @stop
<!-- /header --> <!-- /header -->
<!-- breadcrumbs --> <!-- breadcrumbs -->
@@ -26,7 +26,6 @@ class="active"
<!-- /breadcrumbs --> <!-- /breadcrumbs -->
<!-- content --> <!-- content -->
@section('content') @section('content')
{{-- style="display:none" --}}
<!-- success message --> <!-- success message -->
<div id="alert-success" class="alert alert-success alert-dismissable" style="display:none;"> <div id="alert-success" class="alert alert-success alert-dismissable" style="display:none;">
<i class="fa fa-check-circle"> </i> <b> Success <span id="get-success"></span></b> <i class="fa fa-check-circle"> </i> <b> Success <span id="get-success"></span></b>
@@ -165,7 +164,6 @@ $deleted = count(App\Model\helpdesk\Ticket\Tickets::where('user_id', '=', $users
<th>{!! Lang::get('lang.subject') !!}</th> <th>{!! Lang::get('lang.subject') !!}</th>
<th>{!! Lang::get('lang.ticket_id') !!}</th> <th>{!! Lang::get('lang.ticket_id') !!}</th>
<th>{!! Lang::get('lang.priority') !!}</th> <th>{!! Lang::get('lang.priority') !!}</th>
<th>{!! Lang::get('lang.from') !!}</th>
<th>{!! Lang::get('lang.last_replier') !!}</th> <th>{!! Lang::get('lang.last_replier') !!}</th>
<th>{!! Lang::get('lang.assigned_to') !!}</th> <th>{!! Lang::get('lang.assigned_to') !!}</th>
<th>{!! Lang::get('lang.last_activity') !!}</th> <th>{!! Lang::get('lang.last_activity') !!}</th>
@@ -220,11 +218,6 @@ $deleted = count(App\Model\helpdesk\Ticket\Tickets::where('user_id', '=', $users
<?php $priority = App\Model\helpdesk\Ticket\Ticket_Priority::where('priority_id', '=', $ticket->priority_id)->first();?> <?php $priority = App\Model\helpdesk\Ticket\Ticket_Priority::where('priority_id', '=', $ticket->priority_id)->first();?>
<td class="mailbox-priority"><spam class="btn btn-{{$priority->priority_color}} btn-xs">{{$priority->priority}}</spam></td> <td class="mailbox-priority"><spam class="btn btn-{{$priority->priority_color}} btn-xs">{{$priority->priority}}</spam></td>
<?php $from = App\User::where('id','=',$ticket->user_id)->first(); ?> <?php $from = App\User::where('id','=',$ticket->user_id)->first(); ?>
@if($from->role == "user")
<td class="mailbox-from" >{!! $from->user_name !!}</td>
@else
<td class="mailbox-from" >{!! $from->first_name." ".$from->last_name !!}</td>
@endif
<td class="mailbox-last-reply" style="color:{!! $rep !!}">{!! $username !!}</td> <td class="mailbox-last-reply" style="color:{!! $rep !!}">{!! $username !!}</td>
<td>{!! $assigned !!}</td> <td>{!! $assigned !!}</td>
<td class="mailbox-last-activity">{!! UTC::usertimezone($title->updated_at) !!}</td> <td class="mailbox-last-activity">{!! UTC::usertimezone($title->updated_at) !!}</td>
@@ -288,7 +281,6 @@ $deleted = count(App\Model\helpdesk\Ticket\Tickets::where('user_id', '=', $users
<th>{!! Lang::get('lang.subject') !!}</th> <th>{!! Lang::get('lang.subject') !!}</th>
<th>{!! Lang::get('lang.ticket_id') !!}</th> <th>{!! Lang::get('lang.ticket_id') !!}</th>
<th>{!! Lang::get('lang.priority') !!}</th> <th>{!! Lang::get('lang.priority') !!}</th>
<th>{!! Lang::get('lang.from') !!}</th>
<th>{!! Lang::get('lang.last_replier') !!}</th> <th>{!! Lang::get('lang.last_replier') !!}</th>
<th>{!! Lang::get('lang.assigned_to') !!}</th> <th>{!! Lang::get('lang.assigned_to') !!}</th>
<th>{!! Lang::get('lang.last_activity') !!}</th> <th>{!! Lang::get('lang.last_activity') !!}</th>
@@ -342,11 +334,6 @@ $deleted = count(App\Model\helpdesk\Ticket\Tickets::where('user_id', '=', $users
<?php $priority = App\Model\helpdesk\Ticket\Ticket_Priority::where('priority_id', '=', $ticket->priority_id)->first();?> <?php $priority = App\Model\helpdesk\Ticket\Ticket_Priority::where('priority_id', '=', $ticket->priority_id)->first();?>
<td class="mailbox-priority"><spam class="btn btn-{{$priority->priority_color}} btn-xs">{{$priority->priority}}</spam></td> <td class="mailbox-priority"><spam class="btn btn-{{$priority->priority_color}} btn-xs">{{$priority->priority}}</spam></td>
<?php $from = App\User::where('id','=',$ticket->user_id)->first(); ?> <?php $from = App\User::where('id','=',$ticket->user_id)->first(); ?>
@if($from->role == "user")
<td class="mailbox-from" >{!! $from->user_name !!}</td>
@else
<td class="mailbox-from" >{!! $from->first_name." ".$from->last_name !!}</td>
@endif
<td class="mailbox-last-reply" style="color:{!! $rep !!}">{!! $username !!}</td> <td class="mailbox-last-reply" style="color:{!! $rep !!}">{!! $username !!}</td>
<td>{!! $assigned !!}</td> <td>{!! $assigned !!}</td>
<td class="mailbox-last-activity">{!! UTC::usertimezone($title->updated_at) !!}</td> <td class="mailbox-last-activity">{!! UTC::usertimezone($title->updated_at) !!}</td>
@@ -413,7 +400,6 @@ $deleted = count(App\Model\helpdesk\Ticket\Tickets::where('user_id', '=', $users
<th>{!! Lang::get('lang.subject') !!}</th> <th>{!! Lang::get('lang.subject') !!}</th>
<th>{!! Lang::get('lang.ticket_id') !!}</th> <th>{!! Lang::get('lang.ticket_id') !!}</th>
<th>{!! Lang::get('lang.priority') !!}</th> <th>{!! Lang::get('lang.priority') !!}</th>
<th>{!! Lang::get('lang.from') !!}</th>
<th>{!! Lang::get('lang.last_replier') !!}</th> <th>{!! Lang::get('lang.last_replier') !!}</th>
<th>{!! Lang::get('lang.assigned_to') !!}</th> <th>{!! Lang::get('lang.assigned_to') !!}</th>
<th>{!! Lang::get('lang.last_activity') !!}</th> <th>{!! Lang::get('lang.last_activity') !!}</th>
@@ -472,11 +458,6 @@ $deleted = count(App\Model\helpdesk\Ticket\Tickets::where('user_id', '=', $users
<?php $priority = App\Model\helpdesk\Ticket\Ticket_Priority::where('priority_id', '=', $ticket->priority_id)->first();?> <?php $priority = App\Model\helpdesk\Ticket\Ticket_Priority::where('priority_id', '=', $ticket->priority_id)->first();?>
<td class="mailbox-priority"><spam class="btn btn-{{$priority->priority_color}} btn-xs">{{$priority->priority}}</spam></td> <td class="mailbox-priority"><spam class="btn btn-{{$priority->priority_color}} btn-xs">{{$priority->priority}}</spam></td>
<?php $from = App\User::where('id','=',$ticket->user_id)->first(); ?> <?php $from = App\User::where('id','=',$ticket->user_id)->first(); ?>
@if($from->role == "user")
<td class="mailbox-from" >{!! $from->user_name !!}</td>
@else
<td class="mailbox-from" >{!! $from->first_name." ".$from->last_name !!}</td>
@endif
<td class="mailbox-last-reply" style="color:{!! $rep !!}">{!! $username !!}</td> <td class="mailbox-last-reply" style="color:{!! $rep !!}">{!! $username !!}</td>
<td>{!! $assigned !!}</td> <td>{!! $assigned !!}</td>
<td class="mailbox-last-activity">{!! UTC::usertimezone($title->updated_at) !!}</td> <td class="mailbox-last-activity">{!! UTC::usertimezone($title->updated_at) !!}</td>
@@ -750,6 +731,10 @@ $orgs = App\Model\helpdesk\Agent_panel\Organization::all();
</script> </script>
<script>
$(function () {
$("textarea").wysihtml5();
});
</script>
@stop @stop
<!-- /content --> <!-- /content -->

View File

@@ -177,13 +177,13 @@ $i = count($tickets);
<i class="fa fa-envelope"></i> <span>{!! Lang::get('lang.inbox') !!}</span> <small class="label pull-right bg-green"><?php echo $i;?></small> </a> <i class="fa fa-envelope"></i> <span>{!! Lang::get('lang.inbox') !!}</span> <small class="label pull-right bg-green"><?php echo $i;?></small> </a>
</li> </li>
<li @yield('myticket')> <li @yield('myticket')>
<a href="{{url('ticket/myticket')}}"> <a href="{{url('ticket/myticket')}}" id="load-myticket">
<i class="fa fa-user"></i> <span>{!! Lang::get('lang.my_tickets') !!} </span> <i class="fa fa-user"></i> <span>{!! Lang::get('lang.my_tickets') !!} </span>
<small class="label pull-right bg-green">{{count($myticket) }}</small> <small class="label pull-right bg-green">{{count($myticket) }}</small>
</a> </a>
</li> </li>
<li @yield('unassigned')> <li @yield('unassigned')>
<a href="{{url('unassigned')}}"> <a href="{{url('unassigned')}}" id="load-unassigned">
<i class="fa fa-th"></i> <span>{!! Lang::get('lang.unassigned') !!}</span> <i class="fa fa-th"></i> <span>{!! Lang::get('lang.unassigned') !!}</span>
<small class="label pull-right bg-green">{{count($unassigned)}}</small> <small class="label pull-right bg-green">{{count($unassigned)}}</small>
</a> </a>
@@ -262,12 +262,12 @@ $group = App\Model\helpdesk\Agent\Groups::where('id', '=', $agent_group)->where(
</div> </div>
<div class="tabs-pane @yield('ticket-bar')" id="tabC"> <div class="tabs-pane @yield('ticket-bar')" id="tabC">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li id="bar" @yield('open')><a href="{{ url('/ticket/open') }}" >{!! Lang::get('lang.open') !!}</a></li> <li id="bar" @yield('open')><a href="{{ url('/ticket/open') }}" id="load-open">{!! Lang::get('lang.open') !!}</a></li>
<li id="bar" @yield('answered')><a href="{{ url('/ticket/answered') }}" >{!! Lang::get('lang.answered') !!}</a></li> <li id="bar" @yield('answered')><a href="{{ url('/ticket/answered') }}" id="load-answered">{!! Lang::get('lang.answered') !!}</a></li>
<li id="bar" @yield('myticket')><a href="{{ url('/ticket/myticket') }}" >{!! Lang::get('lang.my_tickets') !!}</a></li> <li id="bar" @yield('myticket')><a href="{{ url('/ticket/myticket') }}" >{!! Lang::get('lang.my_tickets') !!}</a></li>
{{-- <li id="bar" @yield('ticket')><a href="{{ url('ticket') }}" >Ticket</a></li> --}} {{-- <li id="bar" @yield('ticket')><a href="{{ url('ticket') }}" >Ticket</a></li> --}}
{{-- <li id="bar" @yield('overdue')><a href="{{ url('/ticket/overdue') }}" >Overdue</a></li> --}} {{-- <li id="bar" @yield('overdue')><a href="{{ url('/ticket/overdue') }}" >Overdue</a></li> --}}
<li id="bar" @yield('assigned')><a href="{{ url('/ticket/assigned') }}" >{!! Lang::get('lang.assigned') !!}</a></li> <li id="bar" @yield('assigned')><a href="{{ url('/ticket/assigned') }}" id="load-assigned" >{!! Lang::get('lang.assigned') !!}</a></li>
<li id="bar" @yield('closed')><a href="{{ url('/ticket/closed') }}" >{!! Lang::get('lang.closed') !!}</a></li> <li id="bar" @yield('closed')><a href="{{ url('/ticket/closed') }}" >{!! Lang::get('lang.closed') !!}</a></li>
<?php if ($group->can_create_ticket == 1) {?> <?php if ($group->can_create_ticket == 1) {?>
<li id="bar" @yield('newticket')><a href="{{ url('/newticket') }}" >{!! Lang::get('lang.create_ticket') !!}</a></li> <li id="bar" @yield('newticket')><a href="{{ url('/newticket') }}" >{!! Lang::get('lang.create_ticket') !!}</a></li>

View File

@@ -383,11 +383,11 @@ $data = $ConvDate[0];
$(document).ready(function() { $(document).ready(function() {
var Data = $('input[name="rating"]:checked').val(); var Data = $('input[name="rating"]:checked').val();
var Data2 = $('input[name="rating2"]:checked').val(); var Data2 = $('input[name="rating2"]:checked').val();
// if (Data) { if (Data) {
// $('input[name=rating]').rating('readOnly'); $('input[name=rating]').rating('readOnly');
// jQuery('.star').attr('disabled', true); jQuery('.star').attr('disabled', true);
// } }
$('input[name=rating]').change(function() { $('input[name=rating]').change(function() {
$('#foo').submit(); $('#foo').submit();
}); });