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

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;
}
}