update 1.0.7

This commit is contained in:
Sujit Prasad
2016-04-19 19:19:42 +05:30
parent 723ef47e19
commit 5327b0c0da
153 changed files with 20711 additions and 1727 deletions

2
.env
View File

@@ -4,7 +4,7 @@ APP_KEY=SomeRandomString
DB_TYPE=mysql
DB_HOST=localhost
DB_PORT=
DB_DATABASE=faveo
DB_DATABASE=faveo-dev
DB_USERNAME=root
DB_PASSWORD=
MAIL_DRIVER=smtp

View File

@@ -1,4 +1,4 @@
<h3>About Faveo</h3>
<h3>About 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>
<p>Headquartered in Bangalore, Faveo HELPDESK provides Businesses with an automated Helpdesk system to manage customer support.
<br/><br/>

View File

@@ -9,6 +9,8 @@ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
public $phpmailer;
/**
* A list of the exception types that should not be reported.
*
@@ -18,18 +20,6 @@ class Handler extends ExceptionHandler
'Symfony\Component\HttpKernel\Exception\HttpException',
];
/**
* Create a new controller instance.
* constructor to check
* 1. php mailer.
*
* @return void
*/
// public function __construct(PhpMailController $PhpMailController)
// {
// $this->PhpMailController = $PhpMailController;
// }
/**
* Report or log an exception.
*
@@ -54,30 +44,34 @@ class Handler extends ExceptionHandler
*/
public function render($request, Exception $e)
{
// $phpmail = new PhpMailController;
// if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
// } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
// }
// // This is to check if the debug is true or false
// if (config('app.debug') == false) {
// // checking if the error is actually an error page or if its an system error page
// if ($this->isHttpException($e) && $e->getStatusCode() == 404) {
// return response()->view('errors.404', []);
// } else {
// // checking if the application is installed
// if (\Config::get('database.install') == 1) {
// // checking if the error log send to Ladybirdweb is enabled or not
// if (\Config::get('app.ErrorLog') == '1') {
// $this->phpmail->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario' => 'error-report'], $template_variables = ['e' => $e]);
// }
// }
//
// return response()->view('errors.500', []);
// }
// }
// // returns non oops error message
//dd($e);
$phpmail = new PhpMailController();
$this->PhpMailController = $phpmail;
if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
} elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]);
}
// This is to check if the debug is true or false
if (config('app.debug') == false) {
// checking if the error is actually an error page or if its an system error page
if ($this->isHttpException($e) && $e->getStatusCode() == 404) {
return response()->view('errors.404', []);
} else {
// checking if the application is installed
if (\Config::get('database.install') == 1) {
// checking if the error log send to Ladybirdweb is enabled or not
if (\Config::get('app.ErrorLog') == '1') {
try {
$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 = ['system_error' => "<pre style='background-color: #FFC7C7;/* border-color: red; */border: 1px solid red;border-radius: 3px;'> <b>Message:</b>".$e->getMessage().'<br/> <b>Code:</b>'.$e->getCode().'<br/> <b>File:</b>'.$e->getFile().'<br/> <b>Line:</b>'.$e->getLine().'</pre>']);
} catch (Exception $exx) {
}
}
}
return response()->view('errors.500', []);
}
}
// returns non oops error message
return parent::render($request, $e);
// checking if the error is related to http error i.e. page not found
if ($this->isHttpException($e)) {

View File

@@ -107,7 +107,8 @@ class AgentController extends Controller
// fixing the user role to agent
$user->fill($request->input())->save();
// generate password and has immediately to store
$user->password = Hash::make($this->generateRandomString());
$password = $this->generateRandomString();
$user->password = Hash::make($password);
// fetching all the team details checked for this user
$requests = $request->input('team_id');
// get user id of the inserted user detail
@@ -127,7 +128,7 @@ class AgentController extends Controller
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]);
} catch (Exception $e) {
// returns if try fails
return redirect('agents')->with('fails', 'Some error occured while sending mail to the agent. Please check email settings and try again');
return redirect('agents')->with('fails', 'Some error occurred 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');

View File

@@ -19,8 +19,6 @@ use Crypt;
use Exception;
use Illuminate\Http\Request;
//use PhpImap\Mailbox as ImapMailbox;
/**
* ======================================
* EmailsController.
@@ -120,9 +118,14 @@ class EmailsController extends Controller
return $return_data;
}
if ($request->validate == 'on') {
$validate = '/validate-cert';
} else {
$validate = '/novalidate-cert';
}
if ($request->fetching_status == 'on') {
$imap_check = $this->getImapStream($request);
if ($imap_check == 0) {
$imap_check = $this->getImapStream($request, $validate);
if ($imap_check[0] == 0) {
return 'Incoming email connection failed';
}
$need_to_check_imap = 1;
@@ -143,17 +146,17 @@ class EmailsController extends Controller
if ($need_to_check_imap == 1 && $need_to_check_smtp == 1) {
if ($imap_check != 0 && $smtp_check != 0) {
$this->store($request);
$this->store($request, $imap_check[1]);
$return = 1;
}
} elseif ($need_to_check_imap == 1 && $need_to_check_smtp == 0) {
if ($imap_check != 0 && $smtp_check == 0) {
$this->store($request);
$this->store($request, $imap_check[1]);
$return = 1;
}
} elseif ($need_to_check_imap == 0 && $need_to_check_smtp == 1) {
if ($imap_check == 0 && $smtp_check != 0) {
$this->store($request);
$this->store($request, null);
$return = 1;
}
} elseif ($need_to_check_imap == 0 && $need_to_check_smtp == 0) {
@@ -174,14 +177,14 @@ class EmailsController extends Controller
*
* @return type Redirect
*/
public function store($request)
public function store($request, $imap_check)
{
// dd($request);
$email = new Emails();
try {
// getConnection($request->input('email_name'), $request->input('email_address'), $request->input('email_address'))
// saving all the fields to the database
if ($email->fill($request->except('password', 'department', 'priority', 'help_topic', 'fetching_status', 'sending_status', 'auto_response'))->save() == true) {
if ($email->fill($request->except('password', 'department', 'priority', 'help_topic', 'fetching_status', 'fetching_encryption', 'sending_status', 'auto_response'))->save() == true) {
if ($request->fetching_status == 'on') {
$email->fetching_status = 1;
} else {
@@ -197,7 +200,12 @@ class EmailsController extends Controller
} else {
$email->auto_response = 0;
}
// fetching department value
if ($imap_check !== null) {
$email->fetching_encryption = $imap_check;
} else {
$email->fetching_encryption = $request->fetching_encryption;
}
// fetching department value
$email->department = $this->departmentValue($request->input('department'));
// fetching priority value
$email->priority = $this->priorityValue($request->input('priority'));
@@ -289,8 +297,13 @@ class EmailsController extends Controller
return $return_data;
}
// return $request;
if ($request->validate == 'on') {
$validate = '/validate-cert';
} else {
$validate = '/novalidate-cert';
}
if ($request->fetching_status == 'on') {
$imap_check = $this->getImapStream($request);
$imap_check = $this->getImapStream($request, $validate);
if ($imap_check == 0) {
return 'Incoming email connection failed';
}
@@ -425,7 +438,7 @@ class EmailsController extends Controller
*
* @return type int
*/
public function getImapStream($request)
public function getImapStream($request, $validate)
{
$fetching_status = $request->input('fetching_status');
$username = $request->input('email_address');
@@ -433,13 +446,20 @@ class EmailsController extends Controller
$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';
if ($fetching_encryption == '/none') {
$fetching_encryption2 = '/novalidate-cert';
$mailbox_protocol = $fetching_encryption2;
$host = $request->input('fetching_host');
$port = $request->input('fetching_port');
$mailbox = '{'.$host.':'.$port.$mailbox_protocol.'}INBOX';
} else {
$mailbox_protocol = $fetching_protocol.$fetching_encryption;
$host = $request->input('fetching_host');
$port = $request->input('fetching_port');
$mailbox = '{'.$host.':'.$port.$mailbox_protocol.$validate.'}INBOX';
$mailbox_protocol = $fetching_encryption.$validate;
}
$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) {
@@ -447,9 +467,9 @@ class EmailsController extends Controller
}
$imap_stream = imap_open($mailbox, $username, $password);
if ($imap_stream) {
$return = 1;
$return = [0 => 1, 1 => $mailbox_protocol];
} else {
$return = 0;
$return = [0 => 0];
}
return $return;

View File

@@ -139,9 +139,6 @@ class GroupController extends Controller
//Updating can_assign_ticket field
$assignTicket = $request->Input('can_assign_ticket');
$var->can_assign_ticket = $assignTicket;
//Updating can_trasfer_ticket field
$trasferTicket = $request->Input('can_trasfer_ticket');
$var->can_trasfer_ticket = $trasferTicket;
//Updating can_delete_ticket field
$deleteTicket = $request->Input('can_delete_ticket');
$var->can_delete_ticket = $deleteTicket;

View File

@@ -27,9 +27,11 @@ use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Utility\Time_format;
use App\Model\helpdesk\Utility\Timezones;
// classes
use DB;
use Exception;
use Illuminate\Http\Request;
use Input;
use Lang;
/**
* SettingsController.
@@ -76,7 +78,7 @@ class SettingsController extends Controller
/* Direct to Company Settings Page */
return view('themes.default1.admin.helpdesk.settings.company', compact('companys'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
return redirect()->back()->with('fails', $e->getMessage());
}
}
@@ -110,10 +112,31 @@ class SettingsController extends Controller
return redirect('getcompany')->with('success', 'Company Updated Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getcompany')->with('fails', 'Company can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
return redirect('getcompany')->with('fails', 'Company can not Updated'.'<li>'.$e->getMessage().'</li>');
}
}
/**
* function to delete system logo.
*
* @return type string
*/
public function deleteLogo()
{
$path = $_GET['data1']; //get file path of logo image
if (!unlink($path)) {
return 'false';
} else {
$companys = Company::where('id', '=', 1)->first();
$companys->logo = null;
$companys->use_logo = '0';
$companys->save();
return 'true';
}
// return $res;
}
/**
* get the form for System setting page.
*
@@ -138,7 +161,7 @@ class SettingsController extends Controller
/* Direct to System Settings Page */
return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
return redirect()->back()->with('fails', $e->getMessage());
}
}
@@ -164,7 +187,7 @@ class SettingsController extends Controller
return redirect('getsystem')->with('success', 'System Updated Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getsystem')->with('fails', 'System can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
return redirect('getsystem')->with('fails', 'System can not Updated'.'<li>'.$e->getMessage().'</li>');
}
}
@@ -190,7 +213,7 @@ class SettingsController extends Controller
/* Direct to Ticket Settings Page */
return view('themes.default1.admin.helpdesk.settings.ticket', compact('tickets', 'slas', 'topics', 'priority'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
return redirect()->back()->with('fails', $e->getMessage());
}
}
@@ -225,7 +248,7 @@ class SettingsController extends Controller
return redirect('getticket')->with('success', 'Ticket Updated Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getticket')->with('fails', 'Ticket can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
return redirect('getticket')->with('fails', 'Ticket can not Updated'.'<li>'.$e->getMessage().'</li>');
}
}
@@ -250,7 +273,7 @@ class SettingsController extends Controller
/* Direct to Email Settings Page */
return view('themes.default1.admin.helpdesk.settings.email', compact('emails', 'templates', 'emails1'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
return redirect()->back()->with('fails', $e->getMessage());
}
}
@@ -271,8 +294,8 @@ class SettingsController extends Controller
/* fill the values to email table */
$emails->fill($request->except('email_fetching', 'all_emails', 'email_collaborator', 'strip', 'attachment'))->save();
/* insert checkboxes to database */
$emails->email_fetching = $request->input('email_fetching');
$emails->notification_cron = $request->input('notification_cron');
// $emails->email_fetching = $request->input('email_fetching');
// $emails->notification_cron = $request->input('notification_cron');
$emails->all_emails = $request->input('all_emails');
$emails->email_collaborator = $request->input('email_collaborator');
$emails->strip = $request->input('strip');
@@ -283,7 +306,65 @@ class SettingsController extends Controller
return redirect('getemail')->with('success', 'Email Updated Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getemail')->with('fails', 'Email can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
return redirect('getemail')->with('fails', 'Email can not Updated'.'<li>'.$e->getMessage().'</li>');
}
}
/**
* get the form for cron job setting page.
*
* @param type Email $email
* @param type Template $template
* @param type Emails $email1
*
* @return type Response
*/
public function getSchedular(Email $email, Template $template, Emails $email1)
{
// try {
/* fetch the values of email from Email table */
$emails = $email->whereId('1')->first();
/* Fetch the values from Template table */
$templates = $template->get();
/* Fetch the values from Emails table */
$emails1 = $email1->get();
return view('themes.default1.admin.helpdesk.settings.crone', compact('emails', 'templates', 'emails1'));
// } catch {
// }
}
/**
* Update the specified resource in storage for cron job.
*
* @param type Email $email
* @param type EmailRequest $request
*
* @return type Response
*/
public function postSchedular(Email $email, Template $template, Emails $email1, Request $request)
{
// dd($request);
try {
/* fetch the values of email request */
$emails = $email->whereId('1')->first();
if ($request->email_fetching) {
$emails->email_fetching = $request->email_fetching;
} else {
$emails->email_fetching = 0;
}
if ($request->notification_cron) {
$emails->notification_cron = $request->notification_cron;
} else {
$emails->notification_cron = 0;
}
$emails->save();
/* redirect to Index page with Success Message */
return redirect('job-scheduler')->with('success', Lang::get('lang.job-scheduler-success'));
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('job-scheduler')->with('fails', Lang::get('lang.job-scheduler-error').'<li>'.$e->getMessage().'</li>');
}
}
@@ -353,7 +434,7 @@ class SettingsController extends Controller
/* Direct to Responder Settings Page */
return view('themes.default1.admin.helpdesk.settings.responder', compact('responders'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
return redirect()->back()->with('fails', $e->getMessage());
}
}
@@ -383,7 +464,7 @@ class SettingsController extends Controller
return redirect('getresponder')->with('success', 'Responder Updated Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getresponder')->with('fails', 'Responder can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
return redirect('getresponder')->with('fails', 'Responder can not Updated'.'<li>'.$e->getMessage().'</li>');
}
}
@@ -402,7 +483,7 @@ class SettingsController extends Controller
/* Direct to Alert Settings Page */
return view('themes.default1.admin.helpdesk.settings.alert', compact('alerts'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
return redirect()->back()->with('fails', $e->getMessage());
}
}
@@ -471,7 +552,7 @@ class SettingsController extends Controller
return redirect('getalert')->with('success', 'Alert Updated Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getalert')->with('fails', 'Alert can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
return redirect('getalert')->with('fails', 'Alert can not Updated'.'<li>'.$e->getMessage().'</li>');
}
}

View File

@@ -324,7 +324,7 @@ class TemplateController extends Controller
return redirect('getdiagno')->with('fails', 'Please provide E-mail address !');
}
// sending mail via php mailer
$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']);
$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' => 'Email Received Successfully']);
if ($mail == null) {
return redirect('getdiagno')->with('fails', 'Please check your E-mail settings. Unable to send mails');

View File

@@ -0,0 +1,456 @@
<?php
namespace App\Http\Controllers\Admin\helpdesk;
// controller
use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Controller;
// request
use App\Http\Requests\helpdesk\WorkflowCreateRequest;
use App\Http\Requests\helpdesk\WorkflowUpdateRequest;
use App\Model\helpdesk\Agent\Department;
// model
use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Ticket\Ticket_Status;
use App\Model\helpdesk\Workflow\WorkflowAction;
use App\Model\helpdesk\Workflow\WorkflowName;
use App\Model\helpdesk\Workflow\WorkflowRules;
use App\User;
use Datatable;
//classes
use Exception;
use Illuminate\Http\Request;
/**
* WorkflowController
* In this controller in the CRUD function for all the workflow applied in faveo.
*
* @author Ladybird <info@ladybirdweb.com>
*/
class WorkflowController extends Controller
{
/**
* Create a new controller instance.
* constructor to check
* 1. authentication
* 2. user roles
* 3. roles must be agent.
*
* @return void
*/
public function __construct()
{
// checking authentication
$this->middleware('auth');
// checking admin roles
$this->middleware('roles');
}
/**
* Display a listing of all the workflow.
*
* @return type
*/
public function index()
{
try {
return view('themes.default1.admin.helpdesk.manage.workflow.index');
} catch (Exception $e) {
return view('404');
}
}
/**
* List of all the workflow in the system.
*
* @return type
*/
public function workFlowList()
{
// returns chumper datatable
return Datatable::collection(WorkflowName::All())
/* searcable column name */
->searchColumns('name')
/* order column name and description */
->orderColumns('name')
/* add column name */
->addColumn('name', function ($model) {
return $model->name;
})
/* add column status */
->addColumn('status', function ($model) {
if ($model->status == 1) {
return 'Active';
} elseif ($model->status == 0) {
return 'Disabled';
}
})
/* add column order */
->addColumn('order', function ($model) {
return $model->order;
})
/* add column rules */
->addColumn('rules', function ($model) {
$rules = WorkflowRules::where('workflow_id', '=', $model->id)->count();
return $rules;
})
/* add column target */
->addColumn('target', function ($model) {
$target = $model->target;
$target1 = explode('-', $target);
if ($target1[0] == 'A') {
if ($target1[1] == 0) {
return 'Any';
} elseif ($target1[1] == 1) {
return 'Web Forms';
} elseif ($target1[1] == 2) {
return 'Email';
} elseif ($target1[1] == 4) {
return 'API';
}
} elseif ($target1[0] == 'E') {
$emails = Emails::where('id', '=', $target1[1])->first();
return $emails->email_address;
}
})
/* add column created */
->addColumn('Created', function ($model) {
return TicketController::usertimezone($model->created_at);
})
/* add column updated */
->addColumn('Updated', function ($model) {
return TicketController::usertimezone($model->updated_at);
})
/* add column action */
->addColumn('Actions', function ($model) {
$confirmation = 'Are you sure?';
return "<a class='btn btn-info btn-xs btn-flat' href='".route('workflow.edit', $model->id)."'><i class='fa fa-edit text-black'></i> Edit</a> <a class='btn btn-danger btn-xs btn-flat' href='".route('workflow.delete', $model->id)."'><i class='fa fa-trash text-black'></i> Delete</a>";
})
->make();
}
/**
* Show the form for creating a new workflow.
*
* @return type Response
*/
public function create(Emails $emails)
{
// dd($emails);
foreach ($emails->lists('email_address', 'id') as $key => $email) {
$email_data["E-$key"] = $email;
}
// dd($email_data);
// dd($emails->lists('email_address' , 'id'));
$emails = $email_data;
try {
// $emails = $emails->get();
return view('themes.default1.admin.helpdesk.manage.workflow.create', compact('emails'));
} catch (Exception $e) {
return view('404');
}
}
/**
* Store a new workflow in to the system.
*
* @param \App\Http\Requests\helpdesk\WorkflowCreateRequest $request
*
* @return type view
*/
public function store(WorkflowCreateRequest $request)
{
//dd($request);
try {
// store a new workflow credentials in to the system
$workflow_name = new WorkflowName();
$workflow_name->name = $request->name;
$workflow_name->status = $request->status;
$workflow_name->order = $request->execution_order;
$workflow_name->target = $request->target_channel;
$workflow_name->internal_note = $request->internal_note;
$workflow_name->save();
$rules = $request->rule;
$actions = $request->action;
// store workflow rules into the system
foreach ($rules as $rule) {
$workflow_rule = new WorkflowRules();
$workflow_rule->workflow_id = $workflow_name->id;
$workflow_rule->matching_scenario = $rule['a'];
$workflow_rule->matching_relation = $rule['b'];
$workflow_rule->matching_value = $rule['c'];
$workflow_rule->save();
}
// store a new workflow action into the system
foreach ($actions as $action) {
$workflow_action = new WorkflowAction();
$workflow_action->workflow_id = $workflow_name->id;
$workflow_action->condition = $action['a'];
$workflow_action->action = $action['b'];
$workflow_action->save();
}
return redirect('workflow')->with('success', 'Workflow Created Successfully');
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());
}
}
/**
* Editing the details of the banned users.
*
* @param type $id
* @param User $ban
*
* @return type Response
*/
public function edit($id, WorkflowName $work_flow_name, Emails $emails, WorkflowRules $workflow_rule, WorkflowAction $workflow_action)
{
try {
$emails = $emails->get();
$workflow = $work_flow_name->whereId($id)->first();
$workflow_rules = $workflow_rule->whereWorkflow_id($id)->get();
$workflow_actions = $workflow_action->whereWorkflow_id($id)->get();
return view('themes.default1.admin.helpdesk.manage.workflow.edit', compact('id', 'workflow', 'emails', 'workflow_rules', 'workflow_actions'));
} catch (Exception $e) {
return view('404');
}
}
/**
* Update ticket workflow.
*
* @param type $id
* @param \App\Http\Requests\helpdesk\WorkflowUpdateRequest $request
*
* @return type view
*/
public function update($id, WorkflowUpdateRequest $request)
{
try {
// store a new workflow credentials in to the system
$workflow_name = WorkflowName::whereId($id)->first();
$workflow_name->name = $request->name;
$workflow_name->status = $request->status;
$workflow_name->order = $request->execution_order;
$workflow_name->target = $request->target_channel;
$workflow_name->internal_note = $request->internal_note;
$workflow_name->save();
$rules = $request->rule;
$actions = $request->action;
// removing old foreign values to insert an updated one
WorkflowAction::where('workflow_id', '=', $id)->delete();
WorkflowRules::where('workflow_id', '=', $id)->delete();
// update workflow rules into the system
foreach ($rules as $rule) {
$workflow_rule = new WorkflowRules();
$workflow_rule->workflow_id = $workflow_name->id;
$workflow_rule->matching_scenario = $rule['a'];
$workflow_rule->matching_relation = $rule['b'];
$workflow_rule->matching_value = $rule['c'];
$workflow_rule->save();
}
// update workflow action into the system
foreach ($actions as $action) {
$workflow_action = new WorkflowAction();
$workflow_action->workflow_id = $workflow_name->id;
$workflow_action->condition = $action['a'];
$workflow_action->action = $action['b'];
$workflow_action->save();
}
return redirect('workflow')->with('success', 'Workflow Updated Successfully');
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());
}
}
/**
* function to delete workflow.
*
* @param type $id
*/
public function destroy($id)
{
try {
// remove all the contents of workflow
$workflow_action = WorkflowAction::where('workflow_id', '=', $id)->delete();
$workflow_rules = WorkflowRules::where('workflow_id', '=', $id)->delete();
$workflow = WorkflowName::whereId($id)->delete();
return redirect('workflow')->with('success', 'Workflow Deleted Successfully');
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());
}
}
/**
* function to select action.
*
* @param type $id
* @param \Illuminate\Http\Request $request
*
* @return type void
*/
public function selectAction($id, Request $request)
{
if ($request->option == 'reject') {
return $this->rejectTicket($id);
} elseif ($request->option == 'department') {
return $this->department($id);
} elseif ($request->option == 'priority') {
return $this->priority($id);
} elseif ($request->option == 'sla') {
return $this->slaPlan($id);
} elseif ($request->option == 'team') {
return $this->assignTeam($id);
} elseif ($request->option == 'agent') {
return $this->assignAgent($id);
} elseif ($request->option == 'helptopic') {
return $this->helptopic($id);
} elseif ($request->option == 'status') {
return $this->ticketStatus($id);
}
}
/**
* function to reject ticket.
*
* @return string
*/
public function rejectTicket($id)
{
$var = '<input type="hidden" name="action['.$id.'][b]" class="form-control" value="reject"><span text-red>Reject</span> ';
return $var;
}
/**
* function to return deprtment select option.
*
* @return type string
*/
public function department($id)
{
$departments = Department::all();
$var = "<select name='action[".$id."][b]' class='form-control' required>";
foreach ($departments as $department) {
$var .= "<option value='".$department->id."'>".$department->name.'</option>';
}
$var .= '</select>';
return $var;
}
/**
* function to return the priority select option.
*
* @return type string
*/
public function priority($id)
{
$priorities = Ticket_Priority::all();
$var = "<select name='action[".$id."][b]' class='form-control' required>";
foreach ($priorities as $priority) {
$var .= "<option value='".$priority->priority_id."'>".$priority->priority_desc.'</option>';
}
$var .= '</select>';
return $var;
}
/**
* function to return the slaplan select option.
*
* @return type string
*/
public function slaPlan($id)
{
$sla_plans = Sla_plan::where('status', '=', 1)->get();
$var = "<select name='action[".$id."][b]' class='form-control' required>";
foreach ($sla_plans as $sla_plan) {
$var .= "<option value='".$sla_plan->id."'>".$sla_plan->grace_period.'</option>';
}
$var .= '</select>';
return $var;
}
/**
* function to get system team select option.
*
* @return type string
*/
public function assignTeam($id)
{
$teams = Teams::where('status', '=', 1)->get();
$var = "<select name='action[".$id."][b]' class='form-control' required>";
foreach ($teams as $team) {
$var .= "<option value='".$team->id."'>".$team->name.'</option>';
}
$var .= '</select>';
return $var;
}
/**
* function to get system agents select option.
*
* @return type string
*/
public function assignAgent($id)
{
$users = User::where('role', '!=', 'user')->where('active', '=', 1)->get();
$var = "<select name='action[".$id."][b]' class='form-control' required>";
foreach ($users as $user) {
$var .= "<option value='".$user->id."'>".$user->first_name.' '.$user->last_name.'</option>';
}
$var .= '</select>';
return $var;
}
/**
* function to get the helptopic select option.
*
* @return type string
*/
public function helptopic($id)
{
$help_topics = Help_topic::where('status', '=', 1)->get();
$var = "<select name='action[".$id."][b]' class='form-control' required>";
foreach ($help_topics as $help_topic) {
$var .= "<option value='".$help_topic->id."'>".$help_topic->topic.'</option>';
}
$var .= '</select>';
return $var;
}
/**
* function to get the select option to choose the ticket status.
*
* @return type string
*/
public function ticketStatus($id)
{
$ticket_status = Ticket_Status::all();
$var = "<select name='action[".$id."][b]' class='form-control' required>";
foreach ($ticket_status as $status) {
$var .= "<option value='".$status->id."'>".$status->name.'</option>';
}
$var .= '</select>';
return $var;
}
}

View File

@@ -35,9 +35,9 @@ class MailController extends Controller
*
* @param type TicketController $TicketController
*/
public function __construct(TicketController $TicketController)
public function __construct(TicketWorkflowController $TicketWorkflowController)
{
$this->TicketController = $TicketController;
$this->TicketWorkflowController = $TicketWorkflowController;
}
/**
@@ -76,6 +76,9 @@ class MailController extends Controller
$protocol_value = $e_mail->mailbox_protocol;
$get_mailboxprotocol = MailboxProtocol::where('id', '=', $protocol_value)->first();
$protocol = $get_mailboxprotocol->value;
} elseif ($e_mail->fetching_encryption == '/none') {
$fetching_encryption2 = '/novalidate-cert';
$protocol = $fetching_encryption2;
} else {
if ($e_mail->fetching_protocol) {
$fetching_protocol = '/'.$e_mail->fetching_protocol;
@@ -83,7 +86,7 @@ class MailController extends Controller
$fetching_protocol = '';
}
if ($e_mail->fetching_encryption) {
$fetching_encryption = '/'.$e_mail->fetching_encryption;
$fetching_encryption = $e_mail->fetching_encryption;
} else {
$fetching_encryption = '';
}
@@ -130,7 +133,9 @@ class MailController extends Controller
$assign = $get_helptopic->auto_assign;
$form_data = null;
$result = $this->TicketController->create_user($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $form_data, $auto_response);
$team_assign = null;
$ticket_status = null;
$result = $this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response);
// dd($result);
if ($result[1] == true) {
$ticket_table = Tickets::where('ticket_number', '=', $result[0])->first();

View File

@@ -76,6 +76,10 @@ class NotificationController extends Controller
$view = View::make('emails.notifications.admin', ['company' => $company, 'name' => $user_name]);
$contents = $view->render();
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]);
// \Mail::send('emails.notifications.admin', ['company' => $company, 'name' => $user_name], function ($message) use ($email, $user_name, $company) {
// $message->to($email, $user_name)->subject($company.' Daily Report ');
// });
}
}
@@ -99,6 +103,10 @@ class NotificationController extends Controller
$view = View::make('emails.notifications.manager', ['company' => $company, 'name' => $user_name]);
$contents = $view->render();
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]);
// \Mail::send('emails.notifications.manager', ['company' => $company, 'name' => $user_name, 'dept_id' => $dept->id, 'dept_name' => $dept->name], function ($message) use ($email, $user_name, $company, $dept_name) {
// $message->to($email, $user_name)->subject($company.' Daily Report for department manager of '.$dept_name.' department.');
// });
}
}
}
@@ -124,6 +132,10 @@ class NotificationController extends Controller
$view = View::make('emails.notifications.lead', ['company' => $company, 'name' => $user_name]);
$contents = $view->render();
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]);
// \Mail::send('emails.notifications.lead', ['company' => $company, 'name' => $user_name, 'team_id' => $team->id], function ($message) use ($email, $user_name, $company, $team_name) {
// $message->to($email, $user_name)->subject($company.' Daily Report for Team Lead of team '.$team_name);
// });
}
}
}
@@ -145,6 +157,10 @@ class NotificationController extends Controller
$view = View::make('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => $user->id]);
$contents = $view->render();
$this->PhpMailController->sendEmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => 'Daily Report', 'scenario' => null, 'body' => $contents]);
// \Mail::send('emails.notifications.agent', ['company' => $company, 'name' => $user_name, 'user_id' => 1], function ($message) use ($email, $user_name, $company) {
// $message->to($email, $user_name)->subject($company.' Daily Report for Agents');
// });
}
}
@@ -166,4 +182,13 @@ class NotificationController extends Controller
return $company;
}
// // testing
// public function test(){
// $email = "sujit.prasad@ladybirdweb.com";
// $user_name = "sujit prasad";
// \Mail::send('emails.notifications.test', ['user_id' => 1], function ($message) use($email, $user_name) {
// $message->to($email, $user_name)->subject('testing reporting');
// });
// }
}

View File

@@ -8,18 +8,11 @@ use App\Http\Controllers\Controller;
// requests
// models
use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Ticket\Ticket_attachments;
use App\Model\helpdesk\Ticket\Ticket_Collaborator;
use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets;
use App\User;
use Auth;
use DB;
// classes
use Illuminate\support\Collection;
use Input;
use UTC;
use Ttable;
/**
* TicketController2.
@@ -67,89 +60,7 @@ class Ticket2Controller extends Controller
$tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('dept_id', '=', $dept->id)->get();
}
return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) {
return "<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) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
if (isset($subject->title)) {
$string = $subject->title;
if (strlen($string) > 20) {
$stringCut = substr($string, 0, 30);
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...';
}
} else {
$string = '(no subject)';
}
//collabrations
$collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get();
$collab = count($collaborators);
if ($collab > 0) {
$collabString = '&nbsp;<i class="fa fa-users"></i>';
} else {
$collabString = null;
}
$threads = Ticket_Thread::where('ticket_id', '=', $ticket->id)->first(); //
$count = Ticket_Thread::where('ticket_id', '=', $ticket->id)->count(); //
$attachment = Ticket_attachments::where('thread_id', '=', $threads->id)->get();
$attachCount = count($attachment);
if ($attachCount > 0) {
$attachString = '&nbsp;<i class="fa fa-paperclip"></i>';
} else {
$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) {
return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$ticket->ticket_number."'>#".$ticket->ticket_number.'</a>';
})
->addColumn('priority', function ($ticket) {
$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>';
})
->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first();
return "<span style='color:#508983'>".$from->user_name.'</span>';
})
->addColumn('Last Replier', function ($ticket) {
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->where('is_internal', '=', 0)->max('id');
$TicketDatarow = Ticket_Thread::where('id', '=', $TicketData)->first();
$LastResponse = User::where('id', '=', $TicketDatarow->user_id)->first();
if ($LastResponse->role == 'user') {
$rep = '#F39C12';
$username = $LastResponse->user_name;
} else {
$rep = '#000';
$username = $LastResponse->first_name.' '.$LastResponse->last_name;
if ($LastResponse->first_name == null || $LastResponse->last_name == null) {
$username = $LastResponse->user_name;
}
}
return "<span style='color:".$rep."'>".$username.'</span>';
})
->addColumn('assigned_to', function ($ticket) {
if ($ticket->assigned_to == null) {
return "<span style='color:red'>Unassigned</span>";
} else {
$assign = DB::table('users')->where('id', '=', $ticket->assigned_to)->first();
return "<span style='color:green'>".$assign->first_name.' '.$assign->last_name.'</span>';
}
})
->addColumn('Last', function ($ticket) {
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first();
return UTC::usertimezone($TicketDatarow->updated_at);
})
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
->orderColumns('subject', 'from', 'assigned_to', 'Last Replier', 'ticket_number', 'priority', 'Last')
->make();
return Ttable::getTable($tickets);
}
/**
@@ -180,89 +91,7 @@ class Ticket2Controller extends Controller
$tickets = Tickets::where('status', '=', '2')->where('dept_id', '=', $dept->id)->get();
}
return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) {
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) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
if (isset($subject->title)) {
$string = $subject->title;
if (strlen($string) > 20) {
$stringCut = substr($string, 0, 30);
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...';
}
} else {
$string = '(no subject)';
}
//collabrations
$collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get();
$collab = count($collaborators);
if ($collab > 0) {
$collabString = '&nbsp;<i class="fa fa-users"></i>';
} else {
$collabString = null;
}
$threads = Ticket_Thread::where('ticket_id', '=', $ticket->id)->first();
$count = Ticket_Thread::where('ticket_id', '=', $ticket->id)->count();
$attachment = Ticket_attachments::where('thread_id', '=', $threads->id)->get();
$attachCount = count($attachment);
if ($attachCount > 0) {
$attachString = '&nbsp;<i class="fa fa-paperclip"></i>';
} else {
$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) {
return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$ticket->ticket_number."'>#".$ticket->ticket_number.'</a>';
})
->addColumn('priority', function ($ticket) {
$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>';
})
->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first();
return "<span style='color:#508983'>".$from->user_name.'</span>';
})
->addColumn('Last Replier', function ($ticket) {
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->where('is_internal', '!=', 1)->max('id');
$TicketDatarow = Ticket_Thread::where('id', '=', $TicketData)->first();
$LastResponse = User::where('id', '=', $TicketDatarow->user_id)->first();
if ($LastResponse->role == 'user') {
$rep = '#F39C12';
$username = $LastResponse->user_name;
} else {
$rep = '#000';
$username = $LastResponse->first_name.' '.$LastResponse->last_name;
if ($LastResponse->first_name == null || $LastResponse->last_name == null) {
$username = $LastResponse->user_name;
}
}
return "<span style='color:".$rep."'>".$username.'</span>';
})
->addColumn('assigned_to', function ($ticket) {
if ($ticket->assigned_to == null) {
return "<span style='color:red'>Usernassigned</span>";
} else {
$assign = DB::table('users')->where('id', '=', $ticket->assigned_to)->first();
return "<span style='color:green'>".$assign->first_name.' '.$assign->last_name.'</span>';
}
})
->addColumn('Last', function ($ticket) {
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first();
return UTC::usertimezone($TicketDatarow->updated_at);
})
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
->orderColumns('subject', 'from', 'assigned_to', 'Last Replier', 'ticket_number', 'priority', 'Last')
->make();
return Ttable::getTable($tickets);
}
/**
@@ -298,88 +127,6 @@ class Ticket2Controller extends Controller
$tickets = Tickets::where('status', '=', '1')->where('assigned_to', '>', 0)->where('dept_id', '=', $dept->id)->get();
}
return \Datatable::collection(new Collection($tickets))
->addColumn('id', function ($ticket) {
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) {
$subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first();
if (isset($subject->title)) {
$string = $subject->title;
if (strlen($string) > 20) {
$stringCut = substr($string, 0, 30);
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...';
}
} else {
$string = '(no subject)';
}
//collabrations
$collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get();
$collab = count($collaborators);
if ($collab > 0) {
$collabString = '&nbsp;<i class="fa fa-users"></i>';
} else {
$collabString = null;
}
$threads = Ticket_Thread::where('ticket_id', '=', $ticket->id)->first();
$count = Ticket_Thread::where('ticket_id', '=', $ticket->id)->count();
$attachment = Ticket_attachments::where('thread_id', '=', $threads->id)->get();
$attachCount = count($attachment);
if ($attachCount > 0) {
$attachString = '&nbsp;<i class="fa fa-paperclip"></i>';
} else {
$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) {
return "<a href='".route('ticket.thread', [$ticket->id])."' title='".$ticket->ticket_number."'>#".$ticket->ticket_number.'</a>';
})
->addColumn('priority', function ($ticket) {
$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>';
})
->addColumn('from', function ($ticket) {
$from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first();
return "<span style='color:#508983'>".$from->user_name.'</span>';
})
->addColumn('Last Replier', function ($ticket) {
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->where('is_internal', '!=', 1)->max('id');
$TicketDatarow = Ticket_Thread::where('id', '=', $TicketData)->first();
$LastResponse = User::where('id', '=', $TicketDatarow->user_id)->first();
if ($LastResponse->role == 'user') {
$rep = '#F39C12';
$username = $LastResponse->user_name;
} else {
$rep = '#000';
$username = $LastResponse->first_name.' '.$LastResponse->last_name;
if ($LastResponse->first_name == null || $LastResponse->last_name == null) {
$username = $LastResponse->user_name;
}
}
return "<span style='color:".$rep."'>".$username.'</span>';
})
->addColumn('assigned_to', function ($ticket) {
if ($ticket->assigned_to == null) {
return "<span style='color:red'>Usernassigned</span>";
} else {
$assign = DB::table('users')->where('id', '=', $ticket->assigned_to)->first();
return "<span style='color:green'>".$assign->first_name.' '.$assign->last_name.'</span>';
}
})
->addColumn('Last', function ($ticket) {
$TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->max('id');
$TicketDatarow = Ticket_Thread::select('updated_at')->where('id', '=', $TicketData)->first();
return UTC::usertimezone($TicketDatarow->updated_at);
})
->searchColumns('subject', 'from', 'assigned_to', 'ticket_number', 'priority')
->orderColumns('subject', 'from', 'assigned_to', 'Last Replier', 'ticket_number', 'priority', 'Last')
->make();
return Ttable::getTable($tickets);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,510 @@
<?php
namespace App\Http\Controllers\Agent\helpdesk;
// controllers
use App\Http\Controllers\Controller;
// models
use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Ticket\Ticket_Status;
use App\Model\helpdesk\Workflow\WorkflowAction;
use App\Model\helpdesk\Workflow\WorkflowName;
use App\Model\helpdesk\Workflow\WorkflowRules;
use App\User;
/**
* TicketWorkflowController.
*
* @author Ladybird <info@ladybirdweb.com>
*/
class TicketWorkflowController extends Controller
{
/**
* constructor
* Create a new controller instance.
*
* @param type TicketController $TicketController
*/
public function __construct(TicketController $TicketController)
{
$this->TicketController = $TicketController;
}
/**
* This is the core function from where the workflow is applied.
*
* @return type response
*/
public function workflow($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response)
{
$contact_details = ['email' => $fromaddress, 'email_name' => $fromname, 'subject' => $subject, 'message' => $body];
$ticket_settings_details = ['help_topic' => $helptopic, 'sla' => $sla, 'priority' => $priority, 'source' => $source, 'dept' => $dept, 'assign' => $assign, 'team' => $team_assign, 'status' => $ticket_status, 'reject' => false];
// get all the workflow common to the entire system which includes any type of ticket creation where the execution order of the workflow should be starting with ascending order
$workflows = WorkflowName::where('target', '=', 'A-0')->where('status', '=', '1')->orderBy('order', 'asc')->get();
foreach ($workflows as $workflow) {
// checking if any workflow defined in the system
if ($workflow) {
// get all the rules of workflow which has a foreign key of those workflow which are applied to creating any ticket from any source
$worklfow_rules = WorkflowRules::where('workflow_id', '=', $workflow->id)->get();
foreach ($worklfow_rules as $worklfow_rule) {
// checking for the workflow rules to which workflow rule type it is
if ($worklfow_rule->matching_scenario == 'email') {
if ($rule_condition = $this->checkRuleCondition($contact_details['email'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflow->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'email_name') {
if ($rule_condition = $this->checkRuleCondition($contact_details['email_name'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflow->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'subject') {
if ($rule_condition = $this->checkRuleCondition($contact_details['subject'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflow->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'message') {
if ($rule_condition = $this->checkRuleCondition($contact_details['message'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflow->id, $ticket_settings_details);
}
}
}
}
}
if ($source == 1) {
// get all the workflow which are applied to ticket generated via webforms and in ascending order
$workflows_webs = WorkflowName::where('target', '=', 'A-1')->where('status', '=', '1')->orderBy('order', 'asc')->get();
foreach ($workflows_webs as $workflows_web) {
if ($workflows_web) {
$worklfow_rules = WorkflowRules::where('workflow_id', '=', $workflows_web->id)->get();
foreach ($worklfow_rules as $worklfow_rule) {
if ($worklfow_rule) {
// checking for the workflow rules to which workflow rule type it is
if ($worklfow_rule->matching_scenario == 'email') {
if ($this->checkRuleCondition($contact_details['email'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_web->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'email_name') {
if ($this->checkRuleCondition($contact_details['email_name'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_web->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'subject') {
if ($this->checkRuleCondition($contact_details['subject'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_web->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'message') {
if ($this->checkRuleCondition($contact_details['message'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_web->id, $ticket_settings_details);
}
}
}
}
}
}
}
if ($source == 2) {
// get all the workflow which are applied to ticket generated via emails and in ascending order
$workflows_emails = WorkflowName::where('target', '=', 'A-2')->where('status', '=', '1')->orderBy('order', 'asc')->get();
foreach ($workflows_emails as $workflows_email) {
if ($workflows_email) {
$worklfow_rules = WorkflowRules::where('workflow_id', '=', $workflows_email->id)->get();
foreach ($worklfow_rules as $worklfow_rule) {
if ($worklfow_rule) {
// checking for the workflow rules to which workflow rule type it is
if ($worklfow_rule->matching_scenario == 'email') {
if ($rule_condition = $this->checkRuleCondition($contact_details['email'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_email->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'email_name') {
if ($rule_condition = $this->checkRuleCondition($contact_details['email_name'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_email->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'subject') {
if ($rule_condition = $this->checkRuleCondition($contact_details['subject'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_email->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'message') {
if ($rule_condition = $this->checkRuleCondition($contact_details['message'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_email->id, $ticket_settings_details);
}
}
}
}
}
}
}
if ($source == 4) {
// get all the workflow which are applied to ticket generated via API and in ascending order
$workflows_apis = WorkflowName::where('target', '=', 'A-4')->where('status', '=', '1')->orderBy('order', 'asc')->get();
foreach ($workflows_apis as $workflows_api) {
if ($workflows_api) {
$worklfow_rules = WorkflowRules::where('workflow_id', '=', $workflows_api->id)->get();
foreach ($worklfow_rules as $worklfow_rule) {
if ($worklfow_rule) {
// checking for the workflow rules to which workflow rule type it is
if ($worklfow_rule->matching_scenario == 'email') {
if ($rule_condition = $this->checkRuleCondition($contact_details['email'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_api->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'email_name') {
if ($rule_condition = $this->checkRuleCondition($contact_details['email_name'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_api->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'subject') {
if ($rule_condition = $this->checkRuleCondition($contact_details['subject'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_api->id, $ticket_settings_details);
}
} elseif ($worklfow_rule->matching_scenario == 'message') {
if ($rule_condition = $this->checkRuleCondition($contact_details['message'], $worklfow_rule->matching_relation, $worklfow_rule->matching_value) == true) {
$ticket_settings_details = $this->applyActionCondition($workflows_api->id, $ticket_settings_details);
}
}
}
}
}
}
}
if ($ticket_settings_details['reject'] == true) {
return ['0' => false, '1' => false];
} else {
$create_ticket = $this->TicketController->create_user($contact_details['email'], $contact_details['email_name'], $contact_details['subject'], $contact_details['message'], $phone, $ticket_settings_details['help_topic'], $ticket_settings_details['sla'], $ticket_settings_details['priority'], $source, $collaborator, $ticket_settings_details['dept'], $ticket_settings_details['assign'], $form_data, $auto_response, $ticket_settings_details['status']);
return $create_ticket;
}
}
/**
* function to check the rules applied to the ticket workflow.
*
* @param type $to_check
* @param type $condition
* @param type $statement
*
* @return type boolean
*/
public function checkRuleCondition($to_check, $condition, $statement)
{
if ($condition == 'equal') {
$return = $this->checkEqual($statement, $to_check);
} elseif ($condition == 'not_equal') {
$return = $this->checkNotEqual($statement, $to_check);
} elseif ($condition == 'contains') {
$return = $this->checkContains($statement, $to_check);
} elseif ($condition == 'dn_contain') {
$return = $this->checkDoNotContain($statement, $to_check);
} elseif ($condition == 'starts') {
$return = $this->checkStarts($statement, $to_check);
} elseif ($condition == 'ends') {
$return = $this->checkEnds($statement, $to_check);
}
// elseif($condition == 'match') {
//
// } elseif($condition == 'not_match') {
//
// }
return $return;
}
/**
* function to check if the equal functions are applied.
*
* @param type $statement
* @param type $to_check
*
* @return bool
*/
public function checkEqual($statement, $to_check)
{
if ($statement == $to_check) {
return true;
} else {
return false;
}
}
/**
* function to check if the not-equal functions are applied.
*
* @param type $statement
* @param type $to_check
*
* @return bool
*/
public function checkNotEqual($statement, $to_check)
{
if ($statement != $to_check) {
return true;
} else {
return false;
}
}
/**
* function to check if the contains functions are applied.
*
* @param type $statement
* @param type $to_check
*
* @return bool
*/
public function checkContains($statement, $to_check)
{
if (strpos($to_check, $statement) !== false) {
return true;
} else {
return false;
}
}
/**
* function to check if the do not contain functions are applied.
*
* @param type $statement
* @param type $to_check
*
* @return bool
*/
public function checkDoNotContain($statement, $to_check)
{
if (strpos($to_check, $statement) == false) {
return true;
} else {
return false;
}
}
/**
* function to check if the start functions are applied.
*
* @param type $statement
* @param type $to_check
*
* @return bool
*/
public function checkStarts($statement, $to_check)
{
if (substr($to_check, 0, strlen($statement)) == $statement) {
return true;
} else {
return false;
}
}
/**
* function to check if the ends functions are applied.
*
* @param type $statement
* @param type $to_check
*
* @return bool
*/
public function checkEnds($statement, $to_check)
{
$to_check = strip_tags($to_check);
if (substr($to_check, -strlen($statement)) == $statement) {
return true;
} else {
return false;
}
}
// function startsWith($to_check, $statement) {
// // search backwards starting from haystack length characters from the end
// return $statement === "" || strrpos($to_check, $statement, -strlen($to_check)) !== false;
// }
// function endsWith($to_check, $statement) {
// // search forward starting from end minus needle length characters
// return $statement === "" || (($temp = strlen($to_check) - strlen($statement)) >= 0 && strpos($to_check, $statement, $temp) !== false);
// }
/**
* function to apply the action to a ticket.
*
* @param type $workflow_id
* @param type $ticket_settings_details
*
* @return type array
*/
public function applyActionCondition($workflow_id, $ticket_settings_details)
{
$workflow_actions = WorkflowAction::where('workflow_id', '=', $workflow_id)->get();
foreach ($workflow_actions as $workflow_action) {
if ($workflow_action->condition == 'reject') {
$ticket_settings_details = $this->rejectTicket($ticket_settings_details);
} elseif ($workflow_action->condition == 'department') {
$ticket_settings_details = $this->changeDepartment($workflow_action, $ticket_settings_details);
} elseif ($workflow_action->condition == 'priority') {
$ticket_settings_details = $this->changePriority($workflow_action, $ticket_settings_details);
} elseif ($workflow_action->condition == 'sla') {
$ticket_settings_details = $this->changeSla($workflow_action, $ticket_settings_details);
} elseif ($workflow_action->condition == 'team') {
$ticket_settings_details = $this->changeTeam($workflow_action, $ticket_settings_details);
} elseif ($workflow_action->condition == 'agent') {
$ticket_settings_details = $this->changeAgent($workflow_action, $ticket_settings_details);
} elseif ($workflow_action->condition == 'helptopic') {
$ticket_settings_details = $this->changeHelptopic($workflow_action, $ticket_settings_details);
} elseif ($workflow_action->condition == 'status') {
$ticket_settings_details = $this->changeStatus($workflow_action, $ticket_settings_details);
}
}
return $ticket_settings_details;
}
/**
* function to reject ticket.
*
* @param array $ticket_settings_details
*
* @return type array
*/
public function rejectTicket($ticket_settings_details)
{
$ticket_settings_details['reject'] = true;
return $ticket_settings_details;
}
/**
* function to change the department of a ticket.
*
* @param type $workflow_action
* @param type $ticket_settings_details
*
* @return type array
*/
public function changeDepartment($workflow_action, $ticket_settings_details)
{
$dept = Department::where('id', '=', $workflow_action->action)->first();
if ($dept == null) {
return $ticket_settings_details;
} else {
$ticket_settings_details['dept'] = $dept->id;
return $ticket_settings_details;
}
}
/**
* function to change the priority of a ticket.
*
* @param type $workflow_action
* @param type $ticket_settings_details
*
* @return type array
*/
public function changePriority($workflow_action, $ticket_settings_details)
{
$priority = Ticket_Priority::where('priority_id', '=', $workflow_action->action)->first();
if ($priority == null) {
return $ticket_settings_details;
} else {
$ticket_settings_details['priority'] = $priority->priority_id;
return $ticket_settings_details;
}
}
/**
* function to change the SLA of a ticket.
*
* @param type $workflow_action
* @param type $ticket_settings_details
*
* @return type array
*/
public function changeSla($workflow_action, $ticket_settings_details)
{
$sla_plan = Sla_plan::where('id', '=', $workflow_action->action)->first();
if ($sla_plan == null) {
return $ticket_settings_details;
} else {
$ticket_settings_details['sla'] = $sla_plan->id;
return $ticket_settings_details;
}
}
/**
* function to assign tean to a ticket.
*
* @param type $workflow_action
* @param type $ticket_settings_details
*
* @return type array
*/
public function changeTeam($workflow_action, $ticket_settings_details)
{
$team = Teams::where('id', '=', $workflow_action->action)->first();
if ($team == null) {
return $ticket_settings_details;
} else {
$ticket_settings_details['team'] = $team->id;
return $ticket_settings_details;
}
}
/**
* function to assing a ticket to an agent.
*
* @param type $workflow_action
* @param type $ticket_settings_details
*
* @return type array
*/
public function changeAgent($workflow_action, $ticket_settings_details)
{
$agent = User::where('id', '=', $workflow_action->action)->where('role', '!=', 'user')->first();
if ($agent == null) {
return $ticket_settings_details;
} else {
$ticket_settings_details['assign'] = $agent->id;
return $ticket_settings_details;
}
}
/**
* function to change the helptopic of a ticket.
*
* @param type $workflow_action
* @param type $ticket_settings_details
*
* @return type array
*/
public function changeHelptopic($workflow_action, $ticket_settings_details)
{
$help_topic = Help_topic::where('id', '=', $workflow_action->action)->first();
if ($help_topic == null) {
return $ticket_settings_details;
} else {
$ticket_settings_details['help_topic'] = $help_topic->id;
return $ticket_settings_details;
}
}
/**
* function to change the status of a ticket.
*
* @param type $workflow_action
* @param type $ticket_settings_details
*
* @return type array
*/
public function changeStatus($workflow_action, $ticket_settings_details)
{
$status = Ticket_Status::where('id', '=', $workflow_action->action)->first();
if ($status == null) {
return $ticket_settings_details;
} else {
$ticket_settings_details['status'] = $status->id;
return $ticket_settings_details;
}
}
}

View File

@@ -2,7 +2,8 @@
namespace App\Http\Controllers\Agent\kb;
// Controllersuse App\Http\Controllers\Agent\helpdesk\TicketController;
// Controllers
use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Controller;
// Request
use App\Http\Requests\kb\ProfilePassword;

View File

@@ -60,9 +60,12 @@ class ApiController extends Controller
$this->middleware('jwt.auth');
$this->middleware('api', ['except' => 'GenerateApiKey']);
$user = \JWTAuth::parseToken()->authenticate();
$this->user = $user;
try {
$user = \JWTAuth::parseToken()->authenticate();
$this->user = $user;
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
} catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
}
$ticket = new TicketController();
$this->ticket = $ticket;
@@ -82,6 +85,9 @@ class ApiController extends Controller
$faveoUser = new User();
$this->faveoUser = $faveoUser;
$faveoUser = new User();
$this->user = $faveoUser;
$team = new Teams();
$this->team = $team;
@@ -138,18 +144,23 @@ class ApiController extends Controller
$helptopic = $this->request->input('helptopic');
$sla = $this->request->input('sla');
$priority = $this->request->input('priority');
$headers = $this->request->input('headers');
$header = $this->request->input('cc');
$dept = $this->request->input('dept');
$assignto = $this->request->input('assignto');
$form_data = $this->request->input('form_data');
$source = $this->request->input('source');
$attach = $this->request->input('attachments');
$headers = [];
if ($header) {
$headers = explode(',', $header);
}
//return $headers;
/*
* return s ticket number
*/
$response = $this->ticket->createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach);
//return $response;
/*
* return ticket details
*/
@@ -166,7 +177,8 @@ class ApiController extends Controller
} catch (\TokenExpiredException $e) {
$error = $e->getMessage();
return response()->json(compact('error'));
return response()->json(compact('error'))
->header('Authenticate: xBasic realm', 'fake');
}
}
@@ -303,6 +315,7 @@ class ApiController extends Controller
->whereNotNull('title');
})
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('ticket_thread.updated_at', 'desc')
->groupby('tickets.id')
->distinct()
->paginate(10)
@@ -346,7 +359,8 @@ class ApiController extends Controller
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title');
})
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->select('user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('ticket_thread.updated_at', 'desc')
->groupby('tickets.id')
->distinct()
->paginate(10)
@@ -390,7 +404,8 @@ class ApiController extends Controller
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title');
})
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->select('user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('ticket_thread.updated_at', 'desc')
->groupby('tickets.id')
->distinct()
->paginate(10)
@@ -516,7 +531,8 @@ class ApiController extends Controller
$search = $this->request->input('search');
$result = $this->faveoUser->where('first_name', 'like', '%'.$search.'%')->orWhere('last_name', 'like', '%'.$search.'%')->orWhere('user_name', 'like', '%'.$search.'%')->orWhere('email', 'like', '%'.$search.'%')->get();
return response()->json(compact('result'));
return response()->json(compact('result'))
->header('X-Header-One', 'Header Value');
} catch (Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
@@ -526,7 +542,9 @@ class ApiController extends Controller
} catch (\TokenExpiredException $e) {
$error = $e->getMessage();
return response()->json(compact('error'));
return response()->json(compact('error'))
->header('X-Header-One', 'Header Value');
}
}
@@ -538,26 +556,16 @@ class ApiController extends Controller
public function getCustomersWith()
{
try {
$users = $this->faveoUser->select('id', 'user_name', 'first_name', 'last_name', 'email', 'phone_number', 'profile_pic')->where('role', 'user')->get();
$result = [];
foreach ($users as $key => $user) {
$result[$key]['id'] = $user->id;
$result[$key]['user_name'] = $user->user_name;
$result[$key]['first_name'] = $user->first_name;
$result[$key]['last_name'] = $user->last_name;
$result[$key]['email'] = $user->email;
$result[$key]['phone_number'] = $user->phone_number;
if ($user->profile_pic) {
$path = 'lb-faveo/media/profilepic/'.$user->profile_pic;
} else {
$path = \Gravatar::src($user->email);
}
$result[$key]['picture'] = $path;
}
$result = $this->createPagination($result, 10);
//dd($result);
//$result->toJson();
return $result->toJson();
$users = $this->user
->leftJoin('user_assign_organization', 'user_assign_organization.user_id', '=', 'users.id')
->leftJoin('organization', 'organization.id', '=', 'user_assign_organization.org_id')
->where('role', 'user')
->select('users.id', 'user_name', 'first_name', 'last_name', 'email', 'phone_number', 'users.profile_pic', 'organization.name AS company', 'users.active')
->paginate(10)
->toJson();
//dd($users);
return $users;
} catch (\Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
@@ -567,7 +575,8 @@ class ApiController extends Controller
} catch (\TokenExpiredException $e) {
$error = $e->getMessage();
return response()->json(compact('error'));
return response()->json(compact('error'))
->header('Authenticate: xBasic realm', 'fake');
}
}
@@ -654,9 +663,14 @@ class ApiController extends Controller
return response()->json(compact('error'));
}
$id = $this->request->input('id');
$result = $this->thread->where('ticket_id', $id)->get();
$result = $this->user
->leftjoin('ticket_thread', 'ticket_thread.user_id', '=', 'users.id')
->select('ticket_thread.id', 'ticket_id', 'user_id', 'poster', 'source', 'title', 'body', 'is_internal', 'format', 'ip_address', 'ticket_thread.created_at', 'ticket_thread.updated_at', 'users.first_name', 'users.last_name', 'users.user_name', 'users.email', 'users.profile_pic')
->where('ticket_id', $id)
->get()
->toJson();
return response()->json(compact('result'));
return $result;
} catch (\Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
@@ -689,6 +703,10 @@ class ApiController extends Controller
}
$url = $this->request->input('url');
if (!str_is('*/', $url)) {
$url = str_finish($url, '/');
}
$url = $url.'/api/v1/helpdesk/check-url?api_key='.$this->request->input('api_key').'&token='.\Config::get('app.token');
$result = $this->CallGetApi($url);
//dd($result);
@@ -903,7 +921,7 @@ class ApiController extends Controller
public function getTickets()
{
try {
$tickets = $this->model->paginate(10);
$tickets = $this->model->orderBy('created_at', 'desc')->paginate(10);
$tickets->toJson();
return $tickets;
@@ -938,7 +956,8 @@ class ApiController extends Controller
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title');
})
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->select('user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('ticket_thread.updated_at', 'desc')
->groupby('tickets.id')
->distinct()
->paginate(10)
@@ -946,9 +965,9 @@ class ApiController extends Controller
return $inbox;
} catch (\Exception $ex) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
$error = $ex->getMessage();
$line = $ex->getLine();
$file = $ex->getFile();
return response()->json(compact('error', 'file', 'line'));
} catch (\TokenExpiredException $e) {
@@ -1012,7 +1031,8 @@ class ApiController extends Controller
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title');
})
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->select('user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('ticket_thread.updated_at', 'desc')
->groupby('tickets.id')
->distinct()
->paginate(10)
@@ -1032,7 +1052,7 @@ class ApiController extends Controller
}
}
public function getMyTickets()
public function getMyTicketsAgent()
{
try {
$v = \Validator::make($this->request->all(), [
@@ -1045,7 +1065,58 @@ class ApiController extends Controller
}
$id = $this->request->input('user_id');
if ($this->user->where('id', $id)->first()->role == 'user') {
$error = 'This user is not an Aget or Admin';
$error = 'This user is not an Agent or Admin';
return response()->json(compact('error'));
}
$result = $this->user->join('tickets', function ($join) use ($id) {
$join->on('users.id', '=', 'tickets.assigned_to')
->where('user_id', '=', $id);
})
->join('department', 'department.id', '=', 'tickets.dept_id')
->join('ticket_priority', 'ticket_priority.priority_id', '=', 'tickets.priority_id')
->join('sla_plan', 'sla_plan.id', '=', 'tickets.sla')
->join('help_topic', 'help_topic.id', '=', 'tickets.help_topic_id')
->join('ticket_status', 'ticket_status.id', '=', 'tickets.status')
->join('ticket_thread', function ($join) {
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title');
})
->select('user_name', 'first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->orderBy('ticket_thread.updated_at', 'desc')
->groupby('tickets.id')
->distinct()
->paginate(10)
->toJson();
return $result;
} catch (\Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
return response()->json(compact('error', 'file', 'line'));
} catch (\TokenExpiredException $e) {
$error = $e->getMessage();
return response()->json(compact('error'));
}
}
public function getMyTicketsUser()
{
try {
$v = \Validator::make($this->request->all(), [
'user_id' => 'required|exists:users,id',
]);
if ($v->fails()) {
$error = $v->errors();
return response()->json(compact('error'));
}
$id = $this->request->input('user_id');
if ($this->user->where('id', $id)->first()->role == 'admin' || $this->user->where('id', $id)->first()->role == 'agent') {
$error = 'This is not a client';
return response()->json(compact('error'));
}
@@ -1062,10 +1133,12 @@ class ApiController extends Controller
$join->on('tickets.id', '=', 'ticket_thread.ticket_id')
->whereNotNull('title');
})
->select('first_name', 'last_name', 'email', 'profile_pic', 'ticket_number', 'tickets.id', 'title', 'tickets.created_at', 'department.name as department_name', 'ticket_priority.priority as priotity_name', 'sla_plan.name as sla_plan_name', 'help_topic.topic as help_topic_name', 'ticket_status.name as ticket_status_name')
->select('ticket_number', 'tickets.id', 'title', 'ticket_status.name as ticket_status_name')
->orderBy('ticket_thread.updated_at', 'desc')
->groupby('tickets.id')
->distinct()
->paginate(10)
->get()
// ->paginate(10)
->toJson();
return $result;
@@ -1143,4 +1216,160 @@ class ApiController extends Controller
return response()->json(compact('error'));
}
}
public function collaboratorSearch()
{
$this->validate($this->request, ['term' => 'required']);
try {
$emails = $this->ticket->autosearch();
//return $emails;
$user = new User();
if (count($emails) > 0) {
foreach ($emails as $key => $email) {
$user_model = $user->where('email', $email)->first();
//return $user_model;
$users[$key]['name'] = $user_model->first_name.' '.$user_model->last_name;
$users[$key]['email'] = $email;
$users[$key]['avatar'] = $this->avatarUrl($email);
}
}
//return $users;
return response()->json(compact('users'));
} catch (\Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
return response()->json(compact('error', 'file', 'line'));
}
}
public function avatarUrl($email)
{
try {
$user = new User();
$user = $user->where('email', $email)->first();
if ($user->profile_pic) {
$url = url('lb-faveo/media/profilepic/'.$user->profile_pic);
} else {
$url = \Gravatar::src($email);
}
return $url;
} catch (\Exception $ex) {
//return $ex->getMessage();
throw new \Exception($ex->getMessage());
}
}
public function addCollaboratorForTicket()
{
try {
$v = \Validator::make(\Input::get(), [
'email' => 'required|email|unique:users',
'ticket_id' => 'required',
]
);
if ($v->fails()) {
$error = $v->messages();
return response()->json(compact('error'));
}
$collaborator = $this->ticket->useradd();
return response()->json(compact('collaborator'));
} catch (\Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
return response()->json(compact('error', 'file', 'line'));
} catch (Tymon\JWTAuth\Exceptions\TokenExpiredException $ex) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
return response()->json(compact('error', 'file', 'line'));
}
}
public function getCollaboratorForTicket()
{
try {
$v = \Validator::make(\Input::get(), [
'ticket_id' => 'required',
]
);
if ($v->fails()) {
$error = $v->messages();
return response()->json(compact('error'));
}
$collaborator = $this->ticket->getCollaboratorForTicket();
return response()->json(compact('collaborator'));
} catch (\Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
return response()->json(compact('error', 'file', 'line'));
} catch (Tymon\JWTAuth\Exceptions\TokenExpiredException $ex) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
return response()->json(compact('error', 'file', 'line'));
}
}
public function deleteCollaborator()
{
try {
$v = \Validator::make(\Input::get(), [
'ticketid' => 'required',
'email' => 'required',
]
);
if ($v->fails()) {
$result = $v->messages();
return response()->json(compact('result'));
}
$collaborator = $this->ticket->userremove();
return response()->json(compact('collaborator'));
} catch (\Exception $ex) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
return response()->json(compact('error', 'file', 'line'));
}
}
public function dependency()
{
try {
$department = $this->department->select('name', 'id')->get()->toArray();
$sla = $this->slaPlan->select('name', 'id')->get()->toArray();
$staff = $this->user->where('role', 'agent')->select('email', 'id')->get()->toArray();
$team = $this->team->select('name', 'id')->get()->toArray();
$priority = \DB::table('ticket_priority')->select('priority', 'priority_id')->get();
$helptopic = $this->helptopic->select('topic', 'id')->get()->toArray();
$status = \DB::table('ticket_status')->select('name', 'id')->get();
$source = \DB::table('ticket_source')->select('name', 'id')->get();
$result = ['departments' => $department, 'sla' => $sla, 'staffs' => $staff, 'teams' => $team,
'priorities' => $priority, 'helptopics' => $helptopic, 'status' => $status, 'sources' => $source, ];
return response()->json(compact('result'));
} catch (\Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
return response()->json(compact('error', 'file', 'line'));
}
}
}

View File

@@ -12,7 +12,7 @@ class ApiExceptAuthController extends Controller
public function __construct(Request $request)
{
$this->request = $request;
$this->middleware('api');
//$this->middleware('api');
}
/**
@@ -34,7 +34,12 @@ class ApiExceptAuthController extends Controller
}
$url = $this->request->input('url');
$url = $url.'/api/v1/helpdesk/check-url';
if (!str_is('*/', $url)) {
$url = str_finish($url, '/');
}
$url = $url.'api/v1/helpdesk/check-url';
//return $url;
$result = $this->CallGetApi($url);
// dd($result);
return response()->json(compact('result'));

View File

@@ -58,6 +58,7 @@ class TicketController extends Controller
public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '')
{
try {
//return $headers;
$max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
//dd($max_number);
if ($max_number == null) {
@@ -97,7 +98,7 @@ class TicketController extends Controller
}
}
}
//return $headers;
$this->storeCollaborators($headers, $id);
$thread = $this->ticketThread($subject, $body, $id, $user_id);
@@ -123,10 +124,11 @@ class TicketController extends Controller
public function storeCollaborators($headers, $id)
{
try {
//return $headers;
$company = $this->company();
if (isset($headers)) {
foreach ($headers as $email => $name) {
$name = $name;
foreach ($headers as $email) {
$name = $email;
$email = $email;
if ($this->checkEmail($email) == false) {
$create_user = new User();
@@ -147,6 +149,7 @@ class TicketController extends Controller
$user = $this->checkEmail($email);
$user_id = $user->id;
}
//return $user_id;
$collaborator_store = new Ticket_Collaborator();
$collaborator_store->isactive = 1;
$collaborator_store->ticket_id = $id;
@@ -331,10 +334,10 @@ class TicketController extends Controller
// // }
// }, true);
try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket-by-agent', 'body' => $body], $template_variables = ['agent_sign' => Auth::user()->agent_sign, 'ticket_number' => $ticket_number2]);
} catch (\Exception $e) {
}
try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket-by-agent', 'body' => $body], $template_variables = ['agent_sign' => Auth::user()->agent_sign, 'ticket_number' => $ticket_number2]);
} catch (\Exception $e) {
}
$collaborators = Ticket_Collaborator::where('ticket_id', '=', $ticket_id)->get();
foreach ($collaborators as $collaborator) {
@@ -357,10 +360,10 @@ try {
// // }
// }, true);
try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $admin_user, 'email' => $admin_email], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $admin_user, 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $admin_user, 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]);
} catch (\Exception $e) {
}
try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $admin_user, 'email' => $admin_email], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $admin_user, 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $admin_user, 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]);
} catch (\Exception $e) {
}
}
return $thread;
@@ -548,7 +551,7 @@ try {
{
try {
$check = User::where('email', '=', $email)->first();
if ($check == true) {
if ($check) {
return $check;
} else {
return false;
@@ -601,4 +604,123 @@ try {
return $e->getMessage();
}
}
/**
* autosearch.
*
* @return type json
*/
public function autosearch()
{
$term = \Input::get('term');
$user = \App\User::where('email', 'LIKE', '%'.$term.'%')->orWhere('first_name', 'LIKE', '%'.$term.'%')->orWhere('last_name', 'LIKE', '%'.$term.'%')->orWhere('user_name', 'LIKE', '%'.$term.'%')->lists('email');
return $user;
}
/**
* useradd.
*
* @param type Image $image
*
* @return type json
*/
public function useradd()
{
$email = Input::get('email');
$ticket_id = Input::get('ticket_id');
$company = $this->company();
$user = new User();
$user->user_name = $email;
$user->email = $email;
$password = $this->generateRandomString();
$user->password = \Hash::make($password);
$user->role = 'user';
$user->active = 1;
if ($user->save()) {
$user_id = $user->id;
$php_mailer = new PhpMailController();
$php_mailer->sendmail($from = $php_mailer->mailfrom('1', '0'), $to = ['name' => $email, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $email, 'email_address' => $email, 'user_password' => $password]);
}
$ticket_collaborator = new Ticket_Collaborator();
$ticket_collaborator->isactive = 1;
$ticket_collaborator->ticket_id = $ticket_id;
$ticket_collaborator->user_id = $user->id;
$ticket_collaborator->role = 'ccc';
$ticket_collaborator->save();
$result = [$user->user_name => $user->email];
return $result;
}
/**
* user remove.
*
* @return type
*/
public function userremove()
{
$email = Input::get('email');
$ticketid = Input::get('ticketid');
$user = new User();
$user = $user->where('email', $email)->first();
$ticket_collaborator = Ticket_Collaborator::where('ticket_id', '=', $ticketid)
->where('user_id', $user->id)
->first();
if ($ticket_collaborator) {
$ticket_collaborator->delete();
return 'deleted successfully';
} else {
return 'not found';
}
}
public function getCollaboratorForTicket()
{
try {
$ticketid = Input::get('ticket_id');
$ticket_collaborator = \DB::table('users')
->join('ticket_collaborator', function ($join) use ($ticketid) {
$join->on('users.id', '=', 'ticket_collaborator.user_id')
->where('ticket_collaborator.ticket_id', '=', $ticketid);
})
->select('users.email', 'users.user_name')
->get();
if (count($ticket_collaborator) > 0) {
foreach ($ticket_collaborator as $key => $collaborator) {
$collab[$key]['email'] = $collaborator->email;
$collab[$key]['user_name'] = $collaborator->user_name;
$collab[$key]['avatar'] = $this->avatarUrl($collaborator->email);
}
} else {
$collab = $ticket_collaborator;
}
return $collab;
} catch (\Exception $ex) {
return $ex->getMessage();
throw new \Exception('get collaborator for ticket fails');
}
}
public function avatarUrl($email)
{
try {
$user = new User();
$user = $user->where('email', $email)->first();
if ($user->profile_pic) {
$url = url('lb-faveo/media/profilepic/'.$user->profile_pic);
} else {
$url = \Gravatar::src($email);
}
return $url;
} catch (\Exception $ex) {
//return $ex->getMessage();
throw new \Exception($ex->getMessage());
}
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Api\v1;
use App\Http\Controllers\Common\PhpMailController;
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Http\Request;
@@ -23,9 +24,14 @@ use Tymon\JWTAuth\Exceptions\JWTException;
*/
class TokenAuthController extends Controller
{
public $PhpMailController;
public function __construct()
{
$this->middleware('api');
$PhpMailController = new PhpMailController();
$this->PhpMailController = $PhpMailController;
}
/**
@@ -41,7 +47,7 @@ class TokenAuthController extends Controller
$password = $request->input('password');
$field = filter_var($usernameinput, FILTER_VALIDATE_EMAIL) ? 'email' : 'user_name';
//$credentials = $request->only('email', 'password');
//$credentials = $request->only('email', 'password');
try {
if (!$token = JWTAuth::attempt([$field => $usernameinput, 'password' => $password])) {
@@ -56,7 +62,7 @@ class TokenAuthController extends Controller
}
$user_id = \Auth::user()->id;
// if no errors are encountered we can return a JWT
// if no errors are encountered we can return a JWT
return response()->json(compact('token', 'user_id'));
}
@@ -72,18 +78,18 @@ class TokenAuthController extends Controller
if (!$user = JWTAuth::parseToken()->authenticate()) {
return response()->json(['user_not_found', 404]);
}
} catch (\Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
} catch (Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
return response()->json(['token_expired', $e->getStatusCode()]);
} catch (\Tymon\JWTAuth\Exceptions\TokenInvalidException $e) {
} catch (Tymon\JWTAuth\Exceptions\TokenInvalidException $e) {
return response()->json(['token_invalid', $e->getStatusCode()]);
} catch (\Tymon\JWTAuth\Exceptions\JWTException $e) {
} catch (Tymon\JWTAuth\Exceptions\JWTException $e) {
return response()->json(['token_absent', $e->getStatusCode()]);
} catch (\Exception $e) {
$error = $e->getMessage();
return response()->json(compact('error'));
}
//dd($user);
//dd($user);
return response()->json(compact('user'));
}
@@ -124,7 +130,7 @@ class TokenAuthController extends Controller
*
* @return type json
*/
public function checkUrl()
public function checkUrl(Request $request)
{
try {
$v = \Validator::make($request->all(), [
@@ -144,4 +150,43 @@ class TokenAuthController extends Controller
return response()->json(compact('error'));
}
}
public function forgotPassword(Request $request)
{
try {
$v = \Validator::make($request->all(), [
'email' => 'required|email|exists:users,email',
]);
if ($v->fails()) {
$error = $v->errors();
return response()->json(compact('error'));
}
$date = date('Y-m-d H:i:s');
$user = User::where('email', '=', $request->only('email'))->first();
if (isset($user)) {
$user1 = $user->email;
//gen new code and pass
$code = str_random(60);
$password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->first();
if (isset($password_reset_table)) {
$password_reset_table = \DB::table('password_resets')->where('email', '=', $user->email)->update(['token' => $code, 'created_at' => $date]);
// $password_reset_table->token = $code;
// $password_reset_table->update(['token' => $code]);
} else {
$create_password_reset = \DB::table('password_resets')->insert(['email' => $user->email, 'token' => $code, 'created_at' => $date]);
}
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $user->user_name, 'email' => $user->email], $message = ['subject' => 'Your Password Reset Link', 'scenario' => 'reset-password'], $template_variables = ['user' => $user->user_name, 'email_address' => $user->email, 'password_reset_link' => url('password/reset/'.$code)]);
$result = 'We have e-mailed your password reset link!';
return response()->json(compact('result'));
}
} catch (Exception $ex) {
$error = $e->getMessage();
return response()->json(compact('error'));
}
}
}

View File

@@ -3,7 +3,7 @@
namespace App\Http\Controllers\Client\helpdesk;
// controllers
use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Controllers\Agent\helpdesk\TicketWorkflowController;
use App\Http\Controllers\Common\SettingsController;
use App\Http\Controllers\Controller;
// requests
@@ -14,6 +14,7 @@ use App\Model\helpdesk\Form\Fields;
use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Settings\Ticket;
use App\Model\helpdesk\Ticket\Ticket_attachments;
use App\Model\helpdesk\Ticket\Ticket_source;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets;
@@ -39,12 +40,12 @@ class FormController extends Controller
*
* @return void
*/
public function __construct(TicketController $TicketController)
public function __construct(TicketWorkflowController $TicketWorkflowController)
{
// mail smtp settings
SettingsController::smtp();
// SettingsController::smtp();
// creating a TicketController instance
$this->TicketController = $TicketController;
$this->TicketWorkflowController = $TicketWorkflowController;
}
/**
@@ -129,7 +130,7 @@ class FormController extends Controller
* @param type Request $request
* @param type User $user
*/
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source)
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta)
{
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token');
@@ -147,13 +148,33 @@ class FormController extends Controller
$helptopic = $ticket_settings->first()->help_topic;
$sla = $ticket_settings->first()->sla;
$priority = $ticket_settings->first()->priority;
$source = $ticket_source->where('name', '=', 'web')->first();
$source = $ticket_source->where('name', '=', 'web')->first()->id;
$attachments = $request->file('attachment');
$collaborator = null;
$assignto = null;
$auto_response = 0;
if ($this->TicketController->create_user($email, $name, $subject, $details, $phone, $helptopic, $sla, $priority, $source->id, $collaborator, $department, $assignto, $form_extras, $auto_response)) {
return Redirect::route('guest.getform')->with('success', 'Ticket Created Successfully');
$team_assign = null;
$result = $this->TicketWorkflowController->workflow($email, $name, $subject, $details, $phone, $helptopic, $sla, $priority, $source, $collaborator, $department, $assignto, $team_assign, $status, $form_extras, $auto_response);
if ($result[1] == 1) {
$ticketId = Tickets::where('ticket_number', '=', $result[0])->first();
$thread = Ticket_Thread::where('ticket_id', '=', $ticketId->id)->first();
if ($attachments != null) {
foreach ($attachments as $attachment) {
if ($attachment != null) {
$name = $attachment->getClientOriginalName();
$type = $attachment->getClientOriginalExtension();
$size = $attachment->getSize();
$data = file_get_contents($attachment->getRealPath());
$attachPath = $attachment->getRealPath();
$ta->create(['thread_id' => $thread->id, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $data, 'poster' => 'ATTACHMENT']);
}
}
}
return Redirect::route('guest.getform')->with('success', 'Ticket has been created successfully, your ticket number is <b>'.$result[0].'</b> Please save this for future reference.');
}
}

View File

@@ -0,0 +1,83 @@
<?php
namespace App\Http\Controllers\Common;
use App\Http\Controllers\Controller;
use App\Model\helpdesk\Notification\Notification;
use App\Model\helpdesk\Notification\UserNotification;
use App\User;
class NotificationController extends Controller
{
public $user;
public function __construct()
{
$user = new User();
$this->user = $user;
}
/**
* get the page to list the notifications.
*
* @return response
*/
public static function getNotifications()
{
$notifications = UserNotification::join('notifications', 'user_notification.notification_id', '=', 'notifications.id')
->join('notification_types', 'notifications.type_id', '=', 'notification_types.id')
->where('user_notification.is_read', '=', '0')
->where('user_notification.user_id', '=', \Auth::user()->id)
->get();
return $notifications;
}
public function create($model_id, $userid_created, $type_id, $forwhome = [])
{
try {
if (empty($forwhome)) {
$forwhome = $this->user->where('role', '!=', 'user')->get()->toArray();
}
//dd($forwhome);
//system notification
$notification = new Notification();
$UN = new UserNotification();
$notify = $notification->create(['model_id' => $model_id, 'userid_created' => $userid_created, 'type_id' => $type_id]);
foreach ($forwhome as $agent) {
$user_notify = $UN->create(['notification_id' => $notify->id, 'user_id' => $agent['id'], 'is_read' => 0]);
}
} catch (\Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());
}
}
public function markRead($id)
{
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->where('is_read', '=', '0')->get();
foreach ($markasread as $mark) {
$mark->is_read = '1';
$mark->save();
}
return 1;
}
public function show()
{
$notifications = $this->getNotifications();
return view('notifications-all', compact('notifications'));
}
public function delete($id)
{
$markasread = UserNotification::where('notification_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->get();
foreach ($markasread as $mark) {
$mark->delete();
}
return 1;
}
}

View File

@@ -414,7 +414,7 @@ class SettingsController extends Controller
public function version_check()
{
$response_url = \URL::route('post-version-check');
echo "<form action='http://www.faveohelpdesk.com/bill/version' method='post' name='redirect'>";
echo "<form action='http://www.faveohelpdesk.com/billing/version' method='post' name='redirect'>";
echo "<input type='hidden' name='_token' value='csrf_token()'/>";
echo "<input type='hidden' name='title' value='helpdeskcommunityedition'/>";
echo "<input type='hidden' name='id' value='19'/>";

View File

@@ -298,7 +298,6 @@ class InstallController extends Controller
// checking is the installation was done previously
try {
$check_for_pre_installation = System::all();
dd($check_for_pre_installation);
if ($check_for_pre_installation) {
return redirect()->back()->with('fails', 'The data in database already exist. Please provide fresh database');
}

View File

@@ -30,7 +30,7 @@ class CompanyRequest extends Request
{
return [
'company_name' => 'required',
'website' => 'url',
'website' => 'active_url',
'phone' => 'numeric',
'logo' => 'image',
];

View File

@@ -31,7 +31,7 @@ class OrganizationRequest extends Request
return [
'name' => 'required|unique:organization',
'website' => 'url',
'website' => 'active_url',
// 'phone' => 'size:10',
];
}

View File

@@ -30,7 +30,7 @@ class OrganizationUpdate extends Request
{
return [
'website' => 'url',
'website' => 'active_url',
// 'phone' => 'size:10',
];
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request;
/**
* Sys_userRequest.
*
* @author Ladybird <info@ladybirdweb.com>
*/
class WorkflowCreateRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|unique:workflow_name,name',
'execution_order' => 'required',
'target_channel' => 'required',
'rule' => 'required',
'action' => 'required',
];
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request;
/**
* Sys_userRequest.
*
* @author Ladybird <info@ladybirdweb.com>
*/
class WorkflowUpdateRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required',
'execution_order' => 'required',
'target_channel' => 'required',
'rule' => 'required',
'action' => 'required',
];
}
}

View File

@@ -40,6 +40,14 @@ $router->get('getmail/{token}', 'Auth\AuthController@getMail');
|
*/
Route::group(['middleware' => 'roles', 'middleware' => 'auth'], function () {
//Notification marking
Route::post('mark-read/{id}', 'Common\NotificationController@markRead');
Route::get('notifications-list', ['as' => 'notification.list', 'uses' => 'Common\NotificationController@show']);
Route::post('notification-delete/{id}', ['as' => 'notification.delete', 'uses' => 'Common\NotificationController@delete']);
// resource is a function to process create,edit,read and delete
Route::resource('groups', 'Admin\helpdesk\GroupController'); // for group module, for CRUD
@@ -83,12 +91,18 @@ Route::group(['middleware' => 'roles', 'middleware' => 'auth'], function () {
//$router->model('id','getcompany');
Route::get('job-scheduler', ['as' => 'get.job.scheder', 'uses' => 'Admin\helpdesk\SettingsController@getSchedular']); //to get ob scheduler form page
Route::patch('post-scheduler', ['as' => 'post.job.scheduler', 'uses' => 'Admin\helpdesk\SettingsController@postSchedular']); //to update job scheduler
Route::get('agent-profile-page/{id}', ['as' => 'agent.profile.page', 'uses' => 'Admin\helpdesk\AgentController@agent_profile']);
Route::get('getcompany', 'Admin\helpdesk\SettingsController@getcompany'); // direct to company setting page
Route::patch('postcompany/{id}', 'Admin\helpdesk\SettingsController@postcompany'); // Updating the Company table with requests
Route::get('delete-logo', ['as' => 'delete.logo', 'uses' => 'Admin\helpdesk\SettingsController@deleteLogo']); // deleting a logo
Route::get('getsystem', 'Admin\helpdesk\SettingsController@getsystem'); // direct to system setting page
Route::patch('postsystem/{id}', 'Admin\helpdesk\SettingsController@postsystem'); // Updating the System table with requests
@@ -183,6 +197,15 @@ Route::group(['middleware' => 'roles', 'middleware' => 'auth'], function () {
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
Route::get('workflow', ['as' => 'workflow', 'uses' => 'Admin\helpdesk\WorkflowController@index']);
Route::get('workflow-list', ['as' => 'workflow.list', 'uses' => 'Admin\helpdesk\WorkflowController@workFlowList']);
Route::get('workflow/create', ['as' => 'workflow.create', 'uses' => 'Admin\helpdesk\WorkflowController@create']);
Route::post('workflow/store', ['as' => 'workflow.store', 'uses' => 'Admin\helpdesk\WorkflowController@store']);
Route::get('workflow/edit/{id}', ['as' => 'workflow.edit', 'uses' => 'Admin\helpdesk\WorkflowController@edit']);
Route::post('workflow/update/{id}', ['as' => 'workflow.update', 'uses' => 'Admin\helpdesk\WorkflowController@update']);
Route::get('workflow/action-rule/{id}', ['as' => 'workflow.dept', 'uses' => 'Admin\helpdesk\WorkflowController@selectAction']);
Route::get('workflow/delete/{id}', ['as' => 'workflow.delete', 'uses' => 'Admin\helpdesk\WorkflowController@destroy']);
});
/*
@@ -257,6 +280,9 @@ Route::group(['middleware' => 'role.agent', 'middleware' => 'auth'], function ()
Route::get('/ticket/overdue', ['as' => 'overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@overdue_ticket_list']); /* Get Overdue Ticket */
Route::get('/ticket/get-overdue', ['as' => 'get.overdue.ticket',
'uses' => 'Agent\helpdesk\TicketController@getOverdueTickets', ]);
Route::get('/ticket/closed', ['as' => 'closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@closed_ticket_list']); /* Get Closed Ticket */
Route::get('/ticket/get-closed', ['as' => 'get.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_closed']); /* Get tickets in datatable */
@@ -620,6 +646,7 @@ Route::get('/reportdata', 'HomeController@pushdata');
Route::group(['prefix' => 'api/v1'], function () {
Route::post('register', 'Api\v1\TokenAuthController@register');
Route::post('authenticate', 'Api\v1\TokenAuthController@authenticate');
Route::post('forgot', 'Api\v1\TokenAuthController@forgotPassword');
Route::get('authenticate/user', 'Api\v1\TokenAuthController@getAuthenticatedUser');
Route::get('/database-config', ['as' => 'database-config', 'uses' => 'Api\v1\InstallerApiController@config_database']);
@@ -656,7 +683,7 @@ Route::group(['prefix' => 'api/v1'], function () {
Route::get('ticket', 'Api\v1\ApiController@getTicketById');
Route::get('inbox', 'Api\v1\ApiController@inbox');
Route::get('trash', 'Api\v1\ApiController@getTrash');
Route::get('my-tickets', 'Api\v1\ApiController@getMyTickets');
Route::get('my-tickets-agent', 'Api\v1\ApiController@getMyTicketsAgent');
Route::post('internal-note', 'Api\v1\ApiController@internalNote');
/*
@@ -664,6 +691,12 @@ Route::group(['prefix' => 'api/v1'], function () {
*/
Route::get('customers-custom', 'Api\v1\ApiController@getCustomersWith');
Route::get('collaborator/search', 'Api\v1\ApiController@collaboratorSearch');
Route::post('collaborator/create', 'Api\v1\ApiController@addCollaboratorForTicket');
Route::post('collaborator/remove', 'Api\v1\ApiController@deleteCollaborator');
Route::post('collaborator/get-ticket', 'Api\v1\ApiController@getCollaboratorForTicket');
Route::get('my-tickets-user', 'Api\v1\ApiController@getMyTicketsUser');
Route::get('dependency', 'Api\v1\ApiController@dependency');
});
/*

View File

@@ -10,7 +10,7 @@ class Groups extends Model
protected $fillable = [
'name', 'group_status', 'can_create_ticket', 'can_edit_ticket',
'can_post_ticket', 'can_close_ticket', 'can_assign_ticket',
'can_transfer_ticket', 'can_delete_ticket', 'can_ban_email',
'can_delete_ticket', 'can_ban_email',
'can_manage_canned', 'can_manage_faq', 'can_view_agent_stats',
'department_access', 'admin_notes',
];

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Model\helpdesk\Notification;
use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
protected $table = 'notifications';
protected $fillable = [
'model_id', 'userid_created', 'type_id',
];
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Model\helpdesk\Notification;
use Illuminate\Database\Eloquent\Model;
class NotificationType extends Model
{
protected $table = 'notification_types';
protected $fillable = [
'message', 'type', 'icon_class',
];
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Model\helpdesk\Notification;
use Illuminate\Database\Eloquent\Model;
class UserNotification extends Model
{
protected $table = 'user_notification';
protected $fillable = [
'notification_id', 'user_id', 'is_read',
];
}

View File

@@ -18,7 +18,7 @@ class Ticket_Thread extends Model
public function delete()
{
$$this->attach()->delete();
$this->attach()->delete();
parent::delete();
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Model\helpdesk\Workflow;
use Illuminate\Database\Eloquent\Model;
class WorkflowAction extends Model
{
public $timestamps = false;
protected $table = 'workflow_action';
protected $fillable = ['id', 'workflow_id', 'condition', 'action', 'updated_at', 'created_at'];
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Model\helpdesk\Workflow;
use Illuminate\Database\Eloquent\Model;
class WorkflowName extends Model
{
public $timestamps = false;
protected $table = 'workflow_name';
protected $fillable = ['id', 'name', 'status', 'order', 'target', 'internal_note', 'updated_at', 'created_at'];
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Model\helpdesk\Workflow;
use Illuminate\Database\Eloquent\Model;
class WorkflowRules extends Model
{
public $timestamps = false;
protected $table = 'workflow_rules';
protected $fillable = ['id', 'workflow_id', 'matching_criteria', 'matching_scenario', 'matching_relation', 'matching_value', 'updated_at', 'created_at'];
}

View File

@@ -36,4 +36,13 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
* @var array
*/
protected $hidden = ['password', 'remember_token'];
public function getProfilePicAttribute($value)
{
if (!$value) {
return \Gravatar::src($this->attributes['email']);
} else {
return asset('lb-faveo/media/profilepic/'.$value);
}
}
}

View File

@@ -13,7 +13,7 @@ return [
|
*/
'debug' => true,
'debug' => false,
/*
|--------------------------------------------------------------------------
@@ -38,7 +38,7 @@ return [
|
*/
'version' => 'Community 1.0.6.10',
'version' => 'Community 1.0.7',
/*
|--------------------------------------------------------------------------
@@ -238,6 +238,7 @@ return [
'PDF' => 'Vsmoraes\Pdf\PdfFacade',
'Gravatar' => 'Thomaswelton\LaravelGravatar\Facades\Gravatar',
'UTC' => 'App\Http\Controllers\Agent\helpdesk\TicketController',
'Ttable' => 'App\Http\Controllers\Agent\helpdesk\TicketController', //to use getTable function.
'SMTPS' => 'App\Http\Controllers\HomeController',
'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade',
'Zipper' => 'Chumper\Zipper\Zipper',

View File

@@ -9,7 +9,7 @@ return [
'shared_folder_name' => 'shares',
'thumb_folder_name' => 'thumbs',
'images_dir' => 'public/photos/',
'images_url' => '%url%', //url('photos').'/',
'images_url' => '%url%',
'files_dir' => 'public/files/',
'files_url' => '/files/',
'file_type_array' => [

View File

@@ -18,6 +18,8 @@ class CreateTicketThreadTable extends Migration
$table->integer('user_id')->unsigned()->nullable()->index('user_id');
$table->string('poster');
$table->integer('source')->unsigned()->nullable()->index('source');
$table->integer('reply_rating');
$table->integer('rating_count');
$table->boolean('is_internal');
$table->string('title');
$table->text('body', 65535);

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->integer('model_id');
$table->integer('userid_created');
$table->integer('type_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('notifications');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateNotificationTypesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notification_types', function (Blueprint $table) {
$table->increments('id');
$table->string('message');
$table->string('type');
$table->string('icon_class');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('notification_types');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateUserNotificationTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_notification', function (Blueprint $table) {
$table->increments('id');
$table->integer('notification_id');
$table->integer('user_id');
$table->integer('is_read');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('user_notification');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateWorkflowNameTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('workflow_name', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('status');
$table->integer('order');
$table->string('target');
$table->text('internal_note');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('workflow_name');
}
}

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateWorkflowRuleTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('workflow_rules', function (Blueprint $table) {
$table->increments('id');
$table->integer('workflow_id')->unsigned();
$table->string('matching_criteria');
$table->string('matching_scenario');
$table->string('matching_relation');
$table->text('matching_value');
$table->timestamps();
});
Schema::table('workflow_rules', function (Blueprint $table) {
$table->foreign('workflow_id', 'workflow_rules_1')->references('id')->on('workflow_name')->onUpdate('NO ACTION')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('workflow_rules', function (Blueprint $table) {
$table->dropForeign('workflow_rules_1');
});
Schema::drop('workflow_rules');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateWorkflowActionTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('workflow_action', function (Blueprint $table) {
$table->increments('id');
$table->integer('workflow_id')->unsigned();
$table->string('condition');
$table->string('action');
$table->timestamps();
});
Schema::table('workflow_action', function (Blueprint $table) {
$table->foreign('workflow_id', 'workflow_action_1')->references('id')->on('workflow_name')->onUpdate('NO ACTION')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('workflow_action');
Schema::table('workflow_action', function (Blueprint $table) {
$table->dropForeign('workflow_action_idfk_1');
});
}
}

View File

@@ -196,10 +196,10 @@ class DatabaseSeeder extends Seeder
Ticket_status::create(['name' => 'Archived', 'state' => 'archived', 'mode' => '3', 'message' => 'Ticket have been Archived by', 'flags' => '0', 'sort' => '4', 'properties' => 'Tickets only adminstratively available but no longer accessible on ticket queues and client panel.']);
Ticket_status::create(['name' => 'Deleted', 'state' => 'deleted', 'mode' => '3', 'message' => 'Ticket have been Deleted by', 'flags' => '0', 'sort' => '5', 'properties' => 'Tickets queued for deletion. Not accessible on ticket queues.']);
/* Ticket priority */
Ticket_priority::create(['priority' => 'low', 'priority_desc' => 'Low', 'priority_color' => 'info', 'priority_urgency' => '4', 'ispublic' => '1']);
Ticket_priority::create(['priority' => 'normal', 'priority_desc' => 'Normal', 'priority_color' => 'info', 'priority_urgency' => '3', 'ispublic' => '1']);
Ticket_priority::create(['priority' => 'high', 'priority_desc' => 'High', 'priority_color' => 'warning', 'priority_urgency' => '2', 'ispublic' => '1']);
Ticket_priority::create(['priority' => 'emergency', 'priority_desc' => 'Emergency', 'priority_color' => 'danger', 'priority_urgency' => '1', 'ispublic' => '1']);
Ticket_priority::create(['priority' => 'Low', 'priority_desc' => 'Low', 'priority_color' => 'info', 'priority_urgency' => '4', 'ispublic' => '1']);
Ticket_priority::create(['priority' => 'Normal', 'priority_desc' => 'Normal', 'priority_color' => 'info', 'priority_urgency' => '3', 'ispublic' => '1']);
Ticket_priority::create(['priority' => 'High', 'priority_desc' => 'High', 'priority_color' => 'warning', 'priority_urgency' => '2', 'ispublic' => '1']);
Ticket_priority::create(['priority' => 'Emergency', 'priority_desc' => 'Emergency', 'priority_color' => 'danger', 'priority_urgency' => '1', 'ispublic' => '1']);
/* SLA Plans */
Sla_plan::create(['name' => 'Sla 1', 'grace_period' => '6 Hours', 'status' => '1']);
Sla_plan::create(['name' => 'Sla 2', 'grace_period' => '12 Hours', 'status' => '1']);

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>

22
public/css/notification-style.css vendored Normal file
View File

@@ -0,0 +1,22 @@
.textcontent{
display: inline-block;
padding-left: 5px;
font-weight: 600;
font-size: 14px;
font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,Arial,sans-serif;
}
.task{
opacity: 0.4;
}
.task h6{
text-decoration: line-through;
}
.marginzero{
margin: 0px;
}
.font700{
font-weight: 700;
}

Binary file not shown.

View File

@@ -2317,4 +2317,4 @@ class CF_Object
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/;
*/

View File

@@ -61,4 +61,4 @@ class ConnectionNotOpenException extends Exception
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/;
*/

View File

@@ -1454,4 +1454,4 @@ class CF_Http
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/;
*/

View File

@@ -19,4 +19,39 @@ span.stars2, span.stars2 span {
span.stars2 span {
background-position: 0 0;
}
.image {
position:relative;
}
.image img {
width:100%;
vertical-align:top;
}
.image:after, .image:before {
position:absolute;
opacity:0;
transition: all 0.5s;
-webkit-transition: all 0.5s;
}
.image:after {
content:'\A';
width:100%; height:100%;
top:0; left:0;
background:rgba(0,0,0,0.8);
}
.image:before {
content: attr(data-content);
width:80%;
color:#fff;
z-index:1;
bottom:40%;
padding:4px 10px;
text-align:center;
box-sizing:border-box;
-moz-box-sizing:border-box;
}
.image:hover:after, .image:hover:before {
opacity:1;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

11412
public/lb-faveo/plugins/moment/moment.js vendored Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

2671
release-notes.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -184,15 +184,17 @@ return [
| Company Settings Page
|--------------------------------------
*/
'company' => 'Company',
'website' => 'Website',
'phone' => 'Phone',
'address' => 'Address',
'landing' => 'Landing Page',
'offline' => 'Offline Page',
'thank' => 'Thank Page',
'logo' => 'Logo',
'save' => 'Save',
'company' => 'Company',
'website' => 'Website',
'phone' => 'Phone',
'address' => 'Address',
'landing' => 'Landing Page',
'offline' => 'Offline Page',
'thank' => 'Thank Page',
'logo' => 'Logo',
'save' => 'Save',
'delete-logo' => 'Delete logo',
'click-delete' => 'Click here to delete',
/*
|--------------------------------------
| System Settings Page
@@ -243,6 +245,15 @@ return [
'attachments' => 'Attachments',
'email_attahment_user' => 'Email attachments to the user',
'cron_notification' => 'Enable Notification cron',
'cron' => 'Job Scheduler',
'crone-url-message' => "These are Faveo's Job Scheduler(cron job) url for your system.",
'clipboard-copy-message' => 'Copied to clipboard.',
'click' => 'Click here',
'check-cron-set' => 'to check how to set cron jobs on your server.',
'notification-email' => 'Email notifications',
'click-url-copy' => 'Click here to copy URL',
'job-scheduler-error' => 'Job scheduler can not be updated.',
'job-scheduler-success' => 'Job scheduler updated successfully.',
/*
|--------------------------------------
| Ticket Settings Page
@@ -280,6 +291,10 @@ return [
'registration_method' => 'Registration Method',
'user_session_timeout' => 'User Session Timeout',
'client_quick_access' => 'Client Quick Access',
'cron' => 'Cron',
'system-settings' => 'System Settings',
'settings-2' => 'Settings',
/*
|--------------------------------------
| Auto-Response Settings Page
@@ -405,6 +420,28 @@ return [
*/
'transient' => 'Transient',
'ticket_overdue_alert' => 'Ticket Overdue Alerts',
/*
|--------------------------------------
| Work Flow
|--------------------------------------
*/
'workflow' => 'Workflow',
'ticket_workflow' => 'Ticket Workflow',
'create_workflow' => 'Create Workflow',
'edit_workflow' => 'Edit Workflow',
'updated' => 'Updated',
'target' => 'Target',
'target_channel' => 'Target Channel',
'exceution_order' => 'Exceution Order',
'target_channel' => 'Target Channel',
'workflow_rules' => 'Workflow Rules',
'workflow_action' => 'Workflow Action',
'rules' => 'Rules',
'order' => 'Order',
'condition' => 'Condition',
'statement' => 'Statement',
/*
|--------------------------------------
| Form Create Page
@@ -754,6 +791,10 @@ return [
'merge-error2' => 'Please select ticket to merge.',
'select-tickets-to merge' => 'select two or more tickets to merge.',
'different-users' => 'Ticktes from different users',
'clean-up' => 'Clean up',
'hard-delete-success-message' => 'Tickets have been deleted permanently.',
'overdue' => 'Overdue',
'change_owner_for_ticket' => 'Change Owner for Ticket',
/*
|------------------------------------------------

View File

@@ -0,0 +1,215 @@
@extends('themes.default1.agent.layout.agent')
@section('Users')
class="active"
@stop
@section('HeadInclude')
<style>
h1 {
color: #f2f2f2;
font-family: Arial;
font-size: 14px;
margin: 0 0 20px;
padding: 0;
text-align: center;
}
input[type="checkbox"]:not(old) {
width : 28px;
margin : 0;
padding : 0;
opacity : 0;
}
input[type="checkbox"]:not(old) + label {
color: #f2f2f2;
font-family: Arial,sans-serif;
font-size: 14px;
}
input[type="checkbox"]:not(old) + label span {
background: rgba(0, 0, 0, 0) url("lb-faveo/media/images/check_radio_sheet.png") no-repeat scroll left top;
cursor: pointer;
display: inline-block;
height: 19px;
margin-left : -28px;
vertical-align: middle;
width: 19px;
}
input[type="checkbox"]:checked + label span {
background: rgba(0, 0, 0, 0) url("lb-faveo/media/images/check_radio_sheet.png") no-repeat scroll -19px top;
}
</style>
@stop
@section('user-bar')
active
@stop
@section('user')
class="active"
@stop
<!-- /breadcrumbs -->
<!-- content -->
@section('content')
<section class="content">
@if(Session::has('success'))
<div class="alert alert-success alert-dismissable">
<i class="fa fa-ban"></i>
<b>Alert!</b> Success.
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
{{Session::get('success')}}
</div>
@endif
<!-- fail message -->
@if(Session::has('fails'))
<div class="alert alert-danger alert-dismissable">
<i class="fa fa-ban"></i>
<b>Alert!</b> Failed.
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
{{Session::get('fails')}}
</div>
@endif
<div id="alert21" class="alert alert-success alert-dismissable" style="display:none;">
<button id="dismiss11" type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4><i class="icon fa fa-check"></i>Alert!</h4>
<div id="message-success2"></div>
</div>
<div class="row" >
<div class="col-lg-10 col-lg-offset-1 col-md-10 col-md-offset-1">
<div class="box">
<div class="box-header">
<h3 class="box-title">Notification Page</h3>
</div>
<!-- /.box-header -->
<div class="row">
<!-- Left col -->
<section class="col-lg-12">
<!-- Custom tabs (Charts with tabs)-->
<!-- TO DO List -->
<div class="box box-default">
<!--
<div class="box-header">
<i class="ion ion-clipboard"></i>
<h3 class="box-title">Task</h3>
<div class="box-tools pull-right">
<ul class="pagination pagination-sm inline">
<li><a href="#">&laquo;</a>
</li>
<li><a href="#">1</a>
</li>
<li><a href="#">2</a>
</li>
<li><a href="#">3</a>
</li>
<li><a href="#">&raquo;</a>
</li>
</ul>
</div>
</div>
-->
<!-- /.box-header -->
<div class="box-body">
<ul class="todo-list">
@if(count($notifications))
@foreach($notifications as $notification)
@if($notification->type == 'registration')
<li>
<!-- drag handle -->
<!-- checkbox -->
<input type="checkbox" value="" name="cc" class="noti_User clickfun" id="{{$notification -> notification_id}}">
<label for='cl' data-toggle="tooltip" data-placement="top" title="Mark Read"><span></span>
<!-- todo text -->
<h6 class="textcontent marginzero"><a href="{!! route('user.show', $notification->notification_id) !!}" id="{{$notification -> notification_id}}" class='noti_User'>{!! $notification->message !!}</a><small class="label label-danger"><i class="fa fa-clock-o"></i> {{ $notification -> created_at }}</small></h6>
</label> <!-- Emphasis label -->
<!-- General tools such as edit or delete-->
<div class="tools">
<a href="{!! route('user.show', $notification->notification_id) !!}" data-toggle="tooltip" data-placement="top" title="View" id="{{$notification -> notification_id}}" class='noti_User'><i class="fa fa-eye"></i></a>
<a href="#" id='{{ $notification->notification_id }}' data-toggle="tooltip" data-placement="top" title="Delete" class='notification-delete clickfun'><i class="fa fa-trash-o"></i></a>
</div>
</li>
@else
<li>
<input type="checkbox" value="" name="cc" data-toggle="tooltip" data-placement="top" title="Mark Read" class="noti_User clickfun" id="{{$notification -> notification_id}}">
<label for='cl'><span></span>
<h6 class="textcontent marginzero"><a href="{!! route('ticket.thread', $notification->notification_id) !!}" id='{{ $notification->notification_id }}' class='noti_User'>{!! $notification->message !!}</a><small class="label label-info"><i class="fa fa-clock-o"></i> {{ $notification -> created_at }}</small></h6>
</label><div class="tools">
<a href="{!! route('ticket.thread', $notification->notification_id) !!}" id='{{ $notification->notification_id }}' data-toggle="tooltip" data-placement="top" title="View" class='noti_User'><i class="fa fa-eye"></i></a>
<a href="#" id='{{ $notification->notification_id }}' data-toggle="tooltip" data-placement="top" title="Delete" class='notification-delete clickfun'><i class="fa fa-trash-o"></i></a>
</div>
</li>
@endif
@endforeach
@else
<li>
<h6 class="textcontent marginzero">No Notifications Available!<small class="label label-warning" ><i class="fa fa-bell-slash-o"></i></small></h6>
</li>
@endif
</ul>
</div>
</div>
<!-- /.box -->
</section>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.row -->
</div>
</section>
<script>
$(document).ready(function() {
$(".clickfun").click(function() {
$(this).closest("li").toggleClass("task");
});
});
</script>
<script>
$(document).ready(function () {
$('.notification-delete').click(function () {
var id = this.id;
var dataString = 'id=' + id;
$.ajax
({
type: "POST",
url: "{{url('notification-delete')}}" + "/" + id,
data: dataString,
cache: false,
success: function (response)
{
if (response == 1)
{
var message = "Success! You have deleted this notification successfully!";
$("#alert21").show();
$('#message-success2').html(message);
}
}
});
});
});
</script>
@stop

View File

@@ -1,14 +1,14 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')
active
@stop
@section('staffs')
@section('agents')
class="active"
@stop

View File

@@ -1,14 +1,14 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')
active
@stop
@section('staffs')
@section('agents')
class="active"
@stop

View File

@@ -1,14 +1,14 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')
active
@stop
@section('staffs')
@section('agents')
class="active"
@stop

View File

@@ -1,14 +1,14 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')
active
@stop
@section('staffs')
@section('agents')
class="active"
@stop

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')
@@ -58,10 +58,10 @@ class="active"
{!! $errors->first('group_status', '<spam class="help-block">:message</spam>') !!}
<div class="row">
<div class="col-xs-2">
{!! Form::radio('group_status','1',true) !!} {{Lang::get('lang.enable')}}
{!! Form::radio('group_status','1',true) !!} {{Lang::get('lang.active')}}
</div>
<div class="col-xs-3">
{!! Form::radio('group_status','0',null) !!} {{Lang::get('lang.disabled')}}
{!! Form::radio('group_status','0',null) !!} {{Lang::get('lang.inactive')}}
</div>
</div>
</div>

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')
@@ -60,10 +60,10 @@ class="active"
{!! $errors->first('group_status', '<spam class="help-block">:message</spam>') !!}
<div class="row">
<div class="col-xs-2">
{!! Form::radio('group_status','1',true) !!} {{Lang::get('lang.enable')}}
{!! Form::radio('group_status','1',true) !!} {{Lang::get('lang.active')}}
</div>
<div class="col-xs-3">
{!! Form::radio('group_status','0',null) !!} {{Lang::get('lang.disabled')}}
{!! Form::radio('group_status','0',null) !!} {{Lang::get('lang.inactive')}}
</div>
</div>
</div>

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Staffs')
class="active"
active
@stop
@section('staffs-bar')

View File

@@ -2,7 +2,7 @@
@section('Emails')
class="active"
active
@stop
@section('emails-bar')
@@ -69,7 +69,7 @@ class="active"
{!! Form::radio('ban',1) !!} {{Lang::get('lang.active')}}
</div>
<div class="col-xs-3">
{!! Form::radio('ban',0) !!} {{Lang::get('lang.disabled')}}
{!! Form::radio('ban',0) !!} {{Lang::get('lang.inactive')}}
</div>
</div>
</div>

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')
@@ -49,7 +49,7 @@ class="active"
{!! Form::radio('ban',1) !!} {{Lang::get('lang.active')}}
</div>
<div class="col-xs-3">
{!! Form::radio('ban',0) !!} {{Lang::get('lang.disabled')}}
{!! Form::radio('ban',0) !!} {{Lang::get('lang.inactive')}}
</div>
</div>
</div>

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')
@@ -26,8 +26,7 @@ class="active"
@stop
<!-- /breadcrumbs -->
<!-- content -->
@section('content')
<!-- open a form -->
@section('content')<!-- open a form -->
<form id="form">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="box box-primary">
@@ -117,25 +116,30 @@ class="active"
</div>
</div>
<div class="row">
<div class="col-xs-3 form-group {!! $errors->has('fetching_protocol') ? 'has-error' : ''!!}" id="fetching_protocol_error">
<div class="col-xs-2 form-group {!! $errors->has('fetching_protocol') ? 'has-error' : ''!!}" id="fetching_protocol_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">
<div class="col-xs-2 form-group {!! $errors->has('fetching_host') ? 'has-error' : ''!!}" id="fetching_host_error">
{!! Form::label('fetching_host',Lang::get('lang.host_name')) !!}
{!! $errors->first('fetching_host', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('fetching_host',null,['class' => 'form-control', 'id' => 'fetching_host']) !!}
</div>
<div class="col-xs-3 form-group {!! $errors->has('fetching_port') ? 'has-error' : ''!!}" id="fetching_port_error">
<div class="col-xs-2 form-group {!! $errors->has('fetching_port') ? 'has-error' : ''!!}" id="fetching_port_error">
{!! Form::label('fetching_port',Lang::get('lang.port_number')) !!}
{!! $errors->first('fetching_port', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('fetching_port',null,['class' => 'form-control', 'id' => 'fetching_port']) !!}
</div>
<div class="col-xs-3 form-group {!! $errors->has('fetching_encryption') ? 'has-error' : ''!!}" id="fetching_encryption_error">
<div class="col-xs-2 form-group {!! $errors->has('fetching_encryption') ? 'has-error' : ''!!}" id="fetching_encryption_error">
{!! Form::label('fetching_encryption',Lang::get('lang.encryption')) !!}
{!! $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::select('fetching_encryption',['none' => 'None', 'ssl' => 'SSL', 'tls' => 'TLS'],null,['class' => 'form-control select', 'id' => 'fetching_encryption']) !!}
</div>
<div class="col-xs-4 form-group">
<div class="callout callout-default" style="font-style: oblique; margin-top: -47px; margin-bottom: -30px; margin-left: -12px; margin-right: -6px;">If this checkbox is not checked SSL certificates will not be validated</div>
<br/><br/>
<input type="checkbox" name="validate" id="validate">&nbsp; Validate certificates from TLS/SSL server
</div>
</div>
</div>
@@ -240,7 +244,7 @@ class="active"
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 validate = $('input#validate[type="checkbox"]:checked', this).val();
var filter_number = /^([0-9])/;
var error_list = [];

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')
@@ -29,7 +29,6 @@ class="active"
<!-- /breadcrumbs -->
<!-- content -->
@section('content')
<!-- open a form -->
{!!Form::model($emails,['url'=>'','id'=>'form'])!!}
<input type="hidden" name="_token" value="{{ csrf_token() }}">
@@ -49,11 +48,9 @@ class="active"
<div class="row">
<!-- email address -->
<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')) !!}
{!! $errors->first('email_address', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('email_address',null,['class' => 'form-control']) !!}
</div>
<!-- Email name -->
<div class="col-xs-4 form-group {!! $errors->has('email_name') ? 'has-error' : ''!!}" id="email_name_error">
@@ -76,38 +73,33 @@ class="active"
<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>
<!-- status -->
<div class="col-xs-2 form-group">
{!! Form::label('auto_response', Lang::get('lang.auto_response')) !!}
</div>
<div class="col-xs-3 form-group">
<input type="checkbox" name="auto_response" id="auto_response" <?php if ($emails->auto_response == 1) {
echo "checked='checked'";
} ?>> {!!Lang::get('lang.disable_for_this_email_address')!!}
<input type="checkbox" name="auto_response" id="auto_response" <?php
if ($emails->auto_response == 1) {
echo "checked='checked'";
}
?>> {!!Lang::get('lang.disable_for_this_email_address')!!}
</div>
</div>
</div>
<div class="box-header with-border">
@@ -122,9 +114,11 @@ class="active"
</div>
<div class="col-xs-2 form-group">
<!--{!! 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')}}
<input type="checkbox" name="fetching_status" id="fetching_status" <?php
if ($emails->fetching_status == 1) {
echo "checked='checked'";
}
?>> {{Lang::get('lang.enable')}}
</div>
<div class="col-xs-2 form-group">
<!--<input type="radio" name="fetching_status" id="fetching_status" value="0"> {{Lang::get('lang.disabled')}}-->
@@ -132,25 +126,30 @@ class="active"
</div>
</div>
<div class="row">
<div class="col-xs-3 form-group {!! $errors->has('fetching_protocol') ? 'has-error' : ''!!}" id="fetching_protocol_error">
<div class="col-xs-2 form-group {!! $errors->has('fetching_protocol') ? 'has-error' : ''!!}" id="fetching_protocol_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">
<div class="col-xs-2 form-group {!! $errors->has('fetching_host') ? 'has-error' : ''!!}" id="fetching_host_error">
{!! Form::label('fetching_host',Lang::get('lang.host_name')) !!}
{!! $errors->first('fetching_host', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('fetching_host',null,['class' => 'form-control', 'id' => 'fetching_host']) !!}
</div>
<div class="col-xs-3 form-group {!! $errors->has('fetching_port') ? 'has-error' : ''!!}" id="fetching_port_error">
<div class="col-xs-2 form-group {!! $errors->has('fetching_port') ? 'has-error' : ''!!}" id="fetching_port_error">
{!! Form::label('fetching_port',Lang::get('lang.port_number')) !!}
{!! $errors->first('fetching_port', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('fetching_port',null,['class' => 'form-control', 'id' => 'fetching_port']) !!}
</div>
<div class="col-xs-3 form-group {!! $errors->has('fetching_encryption') ? 'has-error' : ''!!}" id="fetching_encryption_error">
<div class="col-xs-2 form-group {!! $errors->has('fetching_encryption') ? 'has-error' : ''!!}" id="fetching_encryption_error">
{!! Form::label('fetching_encryption',Lang::get('lang.encryption')) !!}
{!! $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::select('fetching_encryption',['none' => 'None', 'ssl' => 'SSL', 'tls' => 'TLS'],null,['class' => 'form-control select', 'id' => 'fetching_encryption']) !!}
</div>
<div class="col-xs-4 form-group">
<div class="callout callout-default" style="font-style: oblique; margin-top: -47px; margin-bottom: -30px; margin-left: -12px; margin-right: -6px;">If this checkbox is not checked SSL certificates will not be validated</div>
<br/><br/>
<input type="checkbox" name="validate" value="/novalidate-cert">&nbsp; Validate certificates from TLS/SSL server
</div>
</div>
</div>
@@ -165,9 +164,11 @@ class="active"
{!! Form::label('sending_status',Lang::get('lang.status')) !!}
</div>
<div class="col-xs-2 form-group">
<input type="checkbox" name="sending_status" id="sending_status" <?php if ($emails->sending_status == 1) {
echo "checked='checked'";
} ?>> {!! 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 class="col-xs-2 form-group">
<!--<input type="radio" name="sending_status" id="sending_status" value=""> {!! Lang::get('lang.disabled') !!}-->
@@ -208,12 +209,9 @@ class="active"
</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 class="modal fade" id="loadingpopup" style="padding:200px;">
<div class="modal-dialog">
<div class="modal-content">
@@ -234,12 +232,10 @@ class="active"
</div>
</div>
</div>
<button style="display:none" data-toggle="modal" data-target="#loadingpopup" id="click"></button>
<script>
//submit form
$('#form').on('submit', function () {
$('#form').on('submit', function() {
var form_data = $(this).serialize();
$("#spin").addClass("fa-spin");
var email_address = document.getElementById('email_address').value;
@@ -258,8 +254,7 @@ class="active"
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 = "";
@@ -340,7 +335,6 @@ class="active"
error_list.push(error);
$("#fetching_protocol_error").addClass("has-error");
}
} else {
// checking for validation of fetching port
if (fetching_port) {
@@ -390,7 +384,7 @@ class="active"
// executing error chatch
if (error) {
var ssss = "";
$.each(error_list, function (key, value) {
$.each(error_list, function(key, value) {
ssss += "<li class='error-message-padding'>" + value + "</li>";
});
if (ssss) {
@@ -402,7 +396,6 @@ class="active"
return false;
}
}
// Ajax communicating to backend for further Checking/Saving the details
$.ajax({
type: "POST",
@@ -412,12 +405,11 @@ class="active"
headers: {
'X-CSRF-Token': $('meta[name="_token"]').attr('content')
},
beforeSend: function () {
beforeSend: function() {
$('#alert').empty();
$("#click").trigger("click");
},
success: function (response) {
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>";
@@ -429,18 +421,18 @@ class="active"
$('#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;
}
// ,
// 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

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')

View File

@@ -1,14 +1,14 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')
active
@stop
@section('diagno')
@section('diagnostics')
class="active"
@stop

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Emails')
class="active"
active
@stop
@section('emails-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Settings')
class="active"
active
@stop
@section('settings-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Settings')
class="active"
active
@stop
@section('settings-bar')

View File

@@ -1,14 +1,14 @@
@extends('themes.default1.admin.layout.admin')
@section('Manage')
class="active"
active
@stop
@section('manage-bar')
active
@stop
@section('form')
@section('forms')
class="active"
@stop

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Manage')
class="active"
active
@stop
@section('manage-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Manage')
class="active"
active
@stop
@section('manage-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Manage')
class="active"
active
@stop
@section('manage-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Manage')
class="active"
active
@stop
@section('manage-bar')

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Manage')
class="active"
active
@stop
@section('manage-bar')
@@ -52,9 +52,9 @@ class="active"
<div class="form-group {{ $errors->has('ticket_status') ? 'has-error' : '' }}">
{!! Form::label('ticket_status',Lang::get('lang.status')) !!}&nbsp;&nbsp;
{!! $errors->first('ticket_status', '<spam class="help-block">:message</spam>') !!}
{!! Form::radio('ticket_status','1',true) !!} {{Lang::get('lang.active')}}&nbsp;&nbsp;&nbsp;
{!! Form::radio('ticket_status','0') !!} {{Lang::get('lang.disabled')}}
{!! $errors->first('status', '<spam class="help-block">:message</spam>') !!}
{!! Form::radio('status','1',true) !!} {{Lang::get('lang.active')}}&nbsp;&nbsp;&nbsp;
{!! Form::radio('status','0') !!} {{Lang::get('lang.inactive')}}
</div>
</div>
@@ -92,7 +92,7 @@ class="active"
<div class="col-md-6">
<div class="form-group {{ $errors->has('custom_form') ? 'has-error' : '' }}">
{!! Form::label('custom_form',Lang::get('lang.custom')) !!}
{!! Form::label('custom_form',Lang::get('lang.Custom_form')) !!}
{!! $errors->first('custom_form', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('custom_form', [''=>'Select a Form','Custom Forms'=>$forms->lists('formname','id')],1,['class' => 'form-control']) !!}
</div>
@@ -139,7 +139,7 @@ class="active"
{!! Form::label('auto_assign',Lang::get('lang.auto_assign')) !!}
{!! $errors->first('auto_assign', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('auto_assign', [''=>'Select an Agent','Agents'=>$agents->lists('user_name','id')],null,['class' => 'form-control']) !!}
{!!Form::select('auto_assign', [''=>'Select an Agent','Agents'=>$agents->lists('first_name','id')],null,['class' => 'form-control']) !!}
</div>
</div>
</div>

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Manage')
class="active"
active
@stop
@section('manage-bar')
@@ -46,9 +46,9 @@ class="active"
<div class="form-group {{ $errors->has('ticket_status') ? 'has-error' : '' }}">
{!! Form::label('ticket_status',Lang::get('lang.status')) !!}&nbsp;&nbsp;
{!! $errors->first('ticket_status', '<spam class="help-block">:message</spam>') !!}
{!! Form::radio('ticket_status','1',true) !!} {{Lang::get('lang.active')}}&nbsp;&nbsp;&nbsp;
{!! Form::radio('ticket_status','0') !!} {{Lang::get('lang.disabled')}}
{!! $errors->first('status', '<spam class="help-block">:message</spam>') !!}
{!! Form::radio('status','1',true) !!} {{Lang::get('lang.active')}}&nbsp;&nbsp;&nbsp;
{!! Form::radio('status','0') !!} {{Lang::get('lang.inactive')}}
</div>
</div>
@@ -68,7 +68,7 @@ class="active"
{!! Form::label('topic',Lang::get('lang.topic')) !!}
{!! $errors->first('topic', '<spam class="help-block">:message</spam>') !!}
{!! Form::text('topic',null,['disabled'=>'disabled','class' => 'form-control']) !!}
{!! Form::text('topic',null,['class' => 'form-control']) !!}
</div>
</div>
<!-- Parent Topic: Drop down: value from helptopic table -->
@@ -85,7 +85,7 @@ class="active"
<div class="col-md-6">
<div class="form-group {{ $errors->has('custom_form') ? 'has-error' : '' }}">
{!! Form::label('custom_form',Lang::get('lang.custom')) !!}
{!! Form::label('custom_form',Lang::get('lang.Custom_form')) !!}
{!! $errors->first('custom_form', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('custom_form', [''=>'Select a Form','Custom Forms'=>$forms->lists('formname','id')],null,['class' => 'form-control']) !!}
</div>
@@ -106,8 +106,8 @@ class="active"
<div class="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', [''=>'Select a Proirity','Priorities'=>$priority->lists('priority_desc','priority_id')],null,['class' => 'form-control']) !!}
{!! $errors->first('priority', '<spam class="help-block">:message</spam>') !!}
</div>
</div>
<!-- SLA Plan: Drop down: value SLA Plan table-->
@@ -115,8 +115,9 @@ class="active"
<div class="form-group {{ $errors->has('sla_plan') ? 'has-error' : '' }}">
{!! Form::label('sla_plan',Lang::get('lang.SLA_plan')) !!}
{!! $errors->first('sla_plan', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('sla_plan', [''=>'Select a SLA Plan','SLA Plans'=>$slas->lists('name','id')],null,['class' => 'form-control']) !!}
{!! $errors->first('sla_plan', '<spam class="help-block">:message</spam>') !!}
</div>
</div>
@@ -127,7 +128,7 @@ class="active"
{!! Form::label('auto_assign',Lang::get('lang.auto_assign')) !!}
{!! $errors->first('auto_assign', '<spam class="help-block">:message</spam>') !!}
{!!Form::select('auto_assign', [''=>'Select an Agent','Agents'=>$agents->lists('user_name','id')],null,['class' => 'form-control']) !!}
{!!Form::select('auto_assign', [''=>'Select an Agent','Agents'=>$agents->lists('first_name','id')],null,['class' => 'form-control']) !!}
</div>
</div>
</div>

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Manage')
class="active"
active
@stop
@section('manage-bar')
@@ -93,7 +93,7 @@ class="active"
<!-- topic Status : if status==1 active -->
<td>
@if($topic->ticket_status=='1')
@if($topic->status=='1')
<span style="color:green">Active</span>
@else
<span style="color:red">Disable</span>

View File

@@ -1,7 +1,7 @@
@extends('themes.default1.admin.layout.admin')
@section('Manage')
class="active"
active
@stop
@section('manage-bar')
@@ -73,7 +73,7 @@ class="active"
{!! Form::label('status',Lang::get('lang.status')) !!}&nbsp;
{!! $errors->first('status', '<spam class="help-block">:message</spam>') !!}
{!! Form::radio('status','1',true) !!} {{Lang::get('lang.active')}}&nbsp;&nbsp;
{!! Form::radio('status','0') !!} {{Lang::get('lang.disabled')}}
{!! Form::radio('status','0') !!} {{Lang::get('lang.inactive')}}
</div>
</div>

Some files were not shown because too many files have changed in this diff Show More