update v1.0.5

This commit is contained in:
sujitprasad
2016-01-25 20:45:35 +05:30
parent 0b8ebb9c70
commit e7149e34e4
252 changed files with 9008 additions and 3152 deletions

View File

@@ -1,10 +1,13 @@
<?php namespace App\Http\Controllers\Admin\helpdesk;
// controller
use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\SettingsController;
// request
use App\Http\Requests\helpdesk\AgentRequest;
use App\Http\Requests\helpdesk\AgentUpdate;
// model
use App\User;
use App\Model\helpdesk\Agent\Assign_team_agent;
@@ -13,13 +16,16 @@ use App\Model\helpdesk\Agent\Groups;
use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Utility\Timezones;
use App\Model\helpdesk\Settings\Company;
// classes
use DB;
use Mail;
use Hash;
use Exception;
/**
* AgentController
* This controller is used to CRUD category
*
* @package Controllers
* @subpackage Controller
@@ -27,18 +33,25 @@ use Hash;
*/
class AgentController extends Controller {
/**
* Create a new controller instance.
* @return Response
* constructor to check
* 1. authentication
* 2. user roles
* 3. roles must be agent
* @return void
*/
public function __construct() {
SettingsController::smtp();
// checking authentication
$this->middleware('auth');
// checking admin roles
$this->middleware('roles');
}
/**
* get index page
* Get all agent list page
* @param type User $user
* @return type Response
*/
@@ -51,13 +64,13 @@ class AgentController extends Controller {
}
/**
* Show the form for creating a new resource.
* creating a new agent
* @param type Assign_team_agent $team_assign_agent
* @param type Timezones $timezone
* @param type Groups $group
* @param type Department $department
* @param type Teams $team
* @return type Response
* @return type view
*/
public function create(Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) {
try {
@@ -68,19 +81,19 @@ class AgentController extends Controller {
$teams = $team->lists('id', 'name');
return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team'));
} catch (Exception $e) {
return view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
/**
* Store a newly created resource in storage.
* store a new agent
* @param type User $user
* @param type AgentRequest $request
* @param type Assign_team_agent $team_assign_agent
* @return type Response
*/
public function store(User $user, AgentRequest $request, Assign_team_agent $team_assign_agent) {
try {
/* Insert to user table */
$user->role = 'agent';
$user->fill($request->input())->save();
@@ -88,6 +101,7 @@ class AgentController extends Controller {
$user->password = Hash::make($password);
$requests = $request->input('team_id');
$id = $user->id;
// insert team
foreach ($requests as $req) {
DB::insert('insert into team_assign_agent (team_id, agent_id) values (?,?)', [$req, $id]);
}
@@ -96,29 +110,22 @@ class AgentController extends Controller {
$name = $user->user_name;
$email = $user->email;
$from = $this->company();
Mail::send('emails.pass', ['name' => $name, 'password' => $password, 'from' => $from, 'emailadd' => $email], function ($message) use ($email, $name) {
$message->to($email, $name)->subject('[password]');
});
// send mail on registration
try{
Mail::send('emails.pass', ['name' => $name, 'password' => $password, 'from' => $from, 'emailadd' => $email], function ($message) use ($email, $name) {
$message->to($email, $name)->subject('[password]');
});
} catch (Exception $e) {
return redirect('agents')->with('fails', 'Some error occuren while sending mail to the agent. Please check email settings'.'<li>'.$e->errorInfo[2].'</li>');
}
return redirect('agents')->with('success', 'Agent Created sucessfully');
} else {
return redirect('agents')->with('fails', 'Agent can not Create');
}
} catch (Exception $e) {
return redirect('agents')->with('fails', 'Agent can not Create');
}
}
}
/**
* Display the specified resource.
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
* Editing a selected agent
* @param type int $id
* @param type User $user
* @param type Assign_team_agent $team_assign_agent
@@ -146,7 +153,7 @@ class AgentController extends Controller {
}
/**
* Update the specified resource in storage.
* Update the specified agent in storage.
* @param type int $id
* @param type User $user
* @param type AgentUpdate $request
@@ -154,53 +161,53 @@ class AgentController extends Controller {
* @return type Response
*/
public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent) {
try {
// storing all the details
$user = $user->whereId($id)->first();
$daylight_save = $request->input('daylight_save');
$limit_access = $request->input('limit_access');
$directory_listing = $request->input('directory_listing');
$vocation_mode = $request->input('vocation_mode');
//==============================================
$user->daylight_save = $daylight_save;
$user->limit_access = $limit_access;
$user->directory_listing = $directory_listing;
$user->vocation_mode = $vocation_mode;
//==============================================
$table = $team_assign_agent->where('agent_id', $id);
$table->delete();
$requests = $request->input('team_id');
// inserting team details
foreach ($requests as $req) {
DB::insert('insert into team_assign_agent (team_id, agent_id) values (?,?)', [$req, $id]);
}
//Todo For success and failure conditions
$user->fill($request->except('daylight_save', 'limit_access', 'directory_listing', 'vocation_mode', 'assign_team'))->save();
return redirect('agents')->with('success', 'Agent Updated sucessfully');
} catch (Exception $e) {
return redirect('agents')->with('fails', 'Agent did not update');
}
try {
$user->fill($request->except('daylight_save', 'limit_access', 'directory_listing', 'vocation_mode', 'assign_team'))->save();
return redirect('agents')->with('success', 'Agent Updated sucessfully');
} catch (Exception $e) {
return redirect('agents')->with('fails', 'Agent did not update'.'<li>'.$e->errorInfo[2].'</li>');
}
}
/**
* Remove the specified resource from storage.
* Remove the specified agent from storage.
* @param type int $id
* @param type User $user
* @param type Assign_team_agent $team_assign_agent
* @return type Response
*/
public function destroy($id, User $user, Assign_team_agent $team_assign_agent) {
try {
/* Becouse of foreign key we delete team_assign_agent first */
error_reporting(E_ALL & ~E_NOTICE);
$team_assign_agent = $team_assign_agent->where('agent_id', $id);
$team_assign_agent->delete();
$user = $user->whereId($id)->first();
if ($user->delete()) {
try {
$error = 'This staff is related to some tickets';
$user->id;
$user->delete();
throw new \Exception($error);
return redirect('agents')->with('success', 'Agent Deleted sucessfully');
} else {
return redirect('agents')->with('fails', 'Agent can not Delete ');
} catch (\Exception $e) {
dd($e->errorInfo);
return redirect('agents')->with('fails', $error);
}
} catch (Exception $e) {
return redirect('agents')->with('fails', 'Agent can not Delete if the team Excist');
}
}
@@ -220,11 +227,10 @@ class AgentController extends Controller {
}
/**
* company
* Fetching comapny name to send mail
* @return type
*/
public function company()
{
public function company() {
$company = Company::Where('id','=','1')->first();
if($company->company_name == null){
$company = "Support Center";
@@ -234,11 +240,9 @@ class AgentController extends Controller {
return $company;
}
public function agent_profile($id) {
$agent = User::where('id','=',$id)->first();
return \View::make('themes.default1.admin.helpdesk.agent.agents.agent-profile',compact('agent'));
}
// public function agent_profile($id) {
// $agent = User::where('id','=',$id)->first();
// return \View::make('themes.default1.admin.helpdesk.agent.agents.agent-profile',compact('agent'));
// }
}

View File

@@ -1,27 +1,39 @@
<?php namespace App\Http\Controllers\Admin\helpdesk;
// controller
use App\Http\Controllers\Controller;
// request
use App\Http\Requests\helpdesk\BanlistRequest;
use App\Http\Requests\helpdesk\BanRequest;
// model
use App\User;
use App\Model\helpdesk\Email\Banlist;
//classes
use Exception;
/**
* BanlistController
*
* In this controller in the CRUD function for all the banned emails
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com>
*/
class BanlistController extends Controller {
/**
/**
* Create a new controller instance.
* @return type void
* 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');
}
@@ -59,27 +71,28 @@ class BanlistController extends Controller {
* @return type Response
*/
public function store(BanRequest $request, User $user) {
// try {
// dd($request);
try {
//adding field to user whether it is banned or not
$adban = $request->input('email');
$use = $user->where('email', $adban)->first();
if ($use != null) {
$use->ban = $request->input('ban_status');
$use->ban = $request->input('ban');
$use->internal_note = $request->input('internal_note');
$use->save();
// $user->create($request->input())->save();
return redirect()->back()->with('success', 'Email Banned sucessfully');
return redirect('banlist')->with('success', 'Email Banned sucessfully');
} else {
$user = new User;
$user->email = $adban;
$user->ban = $request->input('ban_status');
$user->ban = $request->input('ban');
$user->internal_note = $request->input('internal_note');
$user->save();
return redirect()->back()->with('success', 'Email Banned sucessfully');
return redirect('banlist')->with('success', 'Email Banned sucessfully');
}
// } catch (Exception $e) {
// return redirect('banlist')->with('fails', 'Email can not Ban');
// }
} catch (Exception $e) {
return redirect('banlist')->with('fails', 'Email can not Ban');
}
}
/**
@@ -136,17 +149,15 @@ class BanlistController extends Controller {
* @param type Banlist $ban
* @return type Response
*/
public function destroy($id, Banlist $ban) {
try {
$bans = $ban->whereId($id)->first();
/* Success and Falure condition */
if ($bans->delete() == true) {
return redirect('banlist')->with('success', 'Banned Email Deleted sucessfully');
} else {
return redirect('banlist')->with('fails', 'Banned Email can not Delete');
}
} catch (Exception $e) {
return redirect('banlist')->with('fails', 'Banned Email can not Delete');
}
}
// public function destroy($id, Banlist $ban) {
// $bans = $ban->whereId($id)->first();
// dd($bans);
// /* Success and Falure condition */
// try{
// $bans->delete();
// return redirect('banlist')->with('success', 'Banned Email Deleted sucessfully');
// } catch (Exception $e) {
// return redirect('banlist')->with('fails', 'Banned Email can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
// }
// }
}

View File

@@ -12,9 +12,13 @@ use App\Model\helpdesk\Agent\Teams;
use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Email\Template;
use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Manage\Help_topic;
use App\User;
// classes
use DB;
use Exception;
/**
* DepartmentController
@@ -81,9 +85,14 @@ class DepartmentController extends Controller {
*/
public function store(Department $department, DepartmentRequest $request) {
try {
$department->fill($request->except('group_id'))->save();
$department->fill($request->except('group_id','manager'))->save();
$requests = $request->input('group_id');
$id = $department->id;
if($request->manager) {
$department->manager = $request->input('manager');
} else {
$department->manager = null;
}
// foreach ($requests as $req) {
// DB::insert('insert into group_assign_department(group_id, department_id) values (?,?)', [$req, $id]);
// }
@@ -99,16 +108,6 @@ class DepartmentController extends Controller {
}
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
* @param type int $id
@@ -146,6 +145,7 @@ class DepartmentController extends Controller {
* @return type Response
*/
public function update($id, Group_assign_department $group_assign_department, Department $department, DepartmentUpdate $request) {
// dd($id);
try {
$table = $group_assign_department->where('department_id', $id);
$table->delete();
@@ -154,7 +154,15 @@ class DepartmentController extends Controller {
// DB::insert('insert into group_assign_department (group_id, department_id) values (?,?)', [$req, $id]);
// }
$departments = $department->whereId($id)->first();
if ($departments->fill($request->except('group_access'))->save()) {
if($request->manager) {
$departments->manager = $request->input('manager');
} else {
$departments->manager = null;
}
$departments->save();
if ($departments->fill($request->except('group_access','manager'))->save()) {
return redirect('departments')->with('success', 'Department Updated sucessfully');
} else {
return redirect('departments')->with('fails', 'Department not Updated');
@@ -171,21 +179,64 @@ class DepartmentController extends Controller {
* @param type Group_assign_department $group_assign_department
* @return type Response
*/
public function destroy($id, Department $department, Group_assign_department $group_assign_department) {
try {
/* Becouse of foreign key we delete group_assign_department first */
$group_assign_department = $group_assign_department->where('department_id', $id);
$group_assign_department->delete();
$departments = $department->whereId($id)->first();
/* Check the function is Success or Fail */
if ($departments->delete() == true) {
return redirect('departments')->with('success', 'Department Deleted sucessfully');
public function destroy($id, Department $department, Group_assign_department $group_assign_department, System $system, Tickets $tickets) {
// try {
$system = $system->where('id','=','1')->first();
if($system->department == $id) {
return redirect('departments')->with('fails', 'You cannot delete default department');
} else {
return redirect('departments')->with('fails', 'Department can not Delete');
$tickets = DB::table('tickets')->where('dept_id','=',$id)->update(['dept_id' => $system->department]);
if($tickets > 0){
if($tickets > 1){
$text_tickets = "Tickets";
} else {
$text_tickets = "Ticket";
}
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default department</li>';
} else {
$ticket = "";
}
$users = DB::table('users')->where('primary_dpt','=',$id)->update(['primary_dpt' => $system->department]);
if($users > 0){
if($users > 1){
$text_user = "Users";
} else {
$text_user = "User";
}
$user = '<li>'.$users.' '.$text_user.' have been moved to default department</li>';
} else {
$user = "";
}
$emails = DB::table('emails')->where('department','=',$id)->update(['department' => $system->department]);
if($emails > 0){
if($emails > 1){
$text_emails = "Emails";
} else {
$text_emails = "Email";
}
$email = '<li>'.$emails.' System '.$text_emails.' have been moved to default department</li>';
} else {
$email = "";
}
$helptopic = DB::table('help_topic')->where('department','=',$id)->update(['department' => null],['status' => '1']);
if($helptopic > 0){
$helptopic = '<li>The associated helptopic has been deactivated</li>';
} else {
$helptopic = "";
}
$message = $ticket.$user.$email.$helptopic;
/* Becouse of foreign key we delete group_assign_department first */
$group_assign_department = $group_assign_department->where('department_id', $id);
$group_assign_department->delete();
$departments = $department->whereId($id)->first();
/* Check the function is Success or Fail */
if ($departments->delete() == true) {
return redirect('departments')->with('success', 'Department Deleted sucessfully'.$message);
} else {
return redirect('departments')->with('fails', 'Department can not Delete');
}
}
} catch (Exception $e) {
return redirect('departments')->with('fails', 'Department can not Delete');
}
}
}

View File

@@ -12,6 +12,7 @@ use App\Model\helpdesk\Utility\MailboxProtocol;
use App\Model\helpdesk\Ticket\Ticket_Priority;
// classes
use Crypt;
use Exception;
/**
* EmailsController

View File

@@ -1,12 +1,29 @@
<?php namespace App\Http\Controllers\Admin\helpdesk;
// Controller
use App\Http\Controllers\Controller;
// Model
use App\Model\helpdesk\Form\Fields;
use App\Model\helpdesk\Form\Forms;
use Illuminate\Http\Request;
use Input;
use App\Http\Controllers\Controller;
use Redirect;
use App\Model\helpdesk\Manage\Help_topic;
// Request
use Illuminate\Http\Request;
// Class
use Input;
use Redirect;
use Exception;
/**
* FormController
* This controller is used to CRUD Custom Forms
*
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com>
*/
class FormController extends Controller {
private $fields;
private $forms;
@@ -91,8 +108,13 @@ class FormController extends Controller {
public function delete($id,Forms $forms, Fields $field) {
public function delete($id,Forms $forms, Fields $field, Help_topic $help_topic) {
$fields = $field->where('forms_id',$id)->get();
$help_topics = $help_topic->where('custom_form','=',$id)->get();
foreach($help_topics as $help_topic) {
$help_topic->custom_form = null;
$help_topic->save();
}
foreach($fields as $field) {
$field->delete();
}

View File

@@ -8,9 +8,10 @@ use Illuminate\Http\Request;
use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Agent\Groups;
use App\Model\helpdesk\Agent\Group_assign_department;
use App\User;
// classes
use Illuminate\Support\Facades\Input;
use Exception;
/**
* GroupController
*
@@ -67,29 +68,14 @@ class GroupController extends Controller {
public function store(Groups $group, GroupRequest $request) {
try {
/* Check Whether function success or not */
if ($group->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
return redirect('groups')->with('success', 'Groups Created Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups can not Create');
}
$group->fill($request->input())->save();
return redirect('groups')->with('success', 'Group Created Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups can not Create');
return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
}
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id, Groups $group, Request $request) {
//
}
/**
* Show the form for editing the specified resource.
* @param type int $id
@@ -101,7 +87,7 @@ class GroupController extends Controller {
$groups = $group->whereId($id)->first();
return view('themes.default1.admin.helpdesk.agent.groups.edit', compact('groups'));
} catch (Exception $e) {
return view('404');
return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
}
}
@@ -113,7 +99,6 @@ class GroupController extends Controller {
* @return type Response
*/
public function update($id, Groups $group, Request $request) {
try {
$var = $group->whereId($id)->first();
//Updating Status
$status = $request->Input('group_status');
@@ -158,17 +143,14 @@ class GroupController extends Controller {
$adminNotes = $request->Input('admin_notes');
$var->admin_notes = $adminNotes;
/* Check whether function success or not */
if ($var->save() == true) {
try {
$var->save();
/* redirect to Index page with Success Message */
return redirect('groups')->with('success', 'Group Updated Successfully');
} else {
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Group can not Update');
return redirect('groups')->with('fails', 'Groups can not Create'.'<li>'.$e->errorInfo[2].'</li>');
}
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups can not Create');
}
}
/**
@@ -178,21 +160,22 @@ class GroupController extends Controller {
* @param type Group_assign_department $group_assign_department
* @return type Response
*/
public function destroy($id, Groups $group, Group_assign_department $group_assign_department) {
try {
public function destroy($id, Groups $group, Group_assign_department $group_assign_department) {
$users = User::where('assign_group', '=', $id)->first();
if($users){
$user = '<li>There are agents assigned to this group. Please unassign them from this group to delete</li>';
return redirect('groups')->with('fails', 'Group cannot Delete ' . $user);
}
$group_assign_department->where('group_id', $id)->delete();
$groups = $group->whereId($id)->first();
/* Check whether function success or not */
if ($groups->delete() == true) {
try {
$groups->delete();
/* redirect to Index page with Success Message */
return redirect('groups')->with('success', 'Group Deleted Successfully');
} else {
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Group can not Delete');
return redirect('groups')->with('fails', 'Groups cannot Create'.'<li>'.$e->errorInfo[2].'</li>');
}
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups can not Create');
}
}
}

View File

@@ -11,7 +11,11 @@ use App\Model\helpdesk\Form\Forms;
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\Settings\Ticket;
use App\User;
// classes
use DB;
use Exception;
/**
* HelptopicController
@@ -88,29 +92,15 @@ class HelptopicController extends Controller {
public function store(Help_topic $topic, HelptopicRequest $request) {
try {
/* Check whether function success or not */
if ($topic->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
return redirect('helptopic')->with('success', 'Helptopic Created Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
}
$topic->fill($request->input())->save();
/* redirect to Index page with Success Message */
return redirect('helptopic')->with('success', 'Helptopic Created Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
return redirect('helptopic')->with('fails', 'Helptopic can not Create'.'<li>'.$e->errorInfo[2].'</li>');
}
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
* @param type $id
@@ -132,7 +122,7 @@ class HelptopicController extends Controller {
$priority = $priority->get();
return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas'));
} catch (Exception $e) {
return view('404');
return redirect('helptopic')->with('fails', '<li>'.$e->errorInfo[2].'</li>');
}
}
@@ -144,19 +134,29 @@ class HelptopicController extends Controller {
* @return type Response
*/
public function update($id, Help_topic $topic, HelptopicUpdate $request) {
// dd($request);
try {
$topics = $topic->whereId($id)->first();
if($request->custom_form){
$custom_form = $request->custom_form;
} else {
$custom_form = null;
}
if($request->auto_assign){
$auto_assign = $request->auto_assign;
} else {
$auto_assign = null;
}
/* Check whether function success or not */
if ($topics->fill($request->input())->save() == true) {
$topics->fill($request->except('custom_form','auto_assign'))->save();
$topics->custom_form = $custom_form;
$topics->auto_assign = $auto_assign;
$topics->save();
/* redirect to Index page with Success Message */
return redirect('helptopic')->with('success', 'Helptopic Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Updated');
}
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
return redirect('helptopic')->with('fails', 'Helptopic can not Update'.'<li>'.$e->errorInfo[2].'</li>');
}
}
@@ -166,20 +166,50 @@ class HelptopicController extends Controller {
* @param type Help_topic $topic
* @return type Response
*/
public function destroy($id, Help_topic $topic) {
try {
$topics = $topic->whereId($id)->first();
/* Check whether function success or not */
if ($topics->delete() == true) {
/* redirect to Index page with Success Message */
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully');
public function destroy($id, Help_topic $topic, Ticket $ticket_setting) {
$ticket_settings = $ticket_setting->where('id','=','1')->first();
if($ticket_settings->help_topic == $id) {
return redirect('departments')->with('fails', 'You cannot delete default department');
} else {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Delete');
$tickets = DB::table('tickets')->where('help_topic_id','=',$id)->update(['help_topic_id' => $ticket_settings->help_topic]);
if($tickets > 0){
if($tickets > 1){
$text_tickets = "Tickets";
} else {
$text_tickets = "Ticket";
}
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default Help Topic</li>';
} else {
$ticket = "";
}
$emails = DB::table('emails')->where('help_topic','=',$id)->update(['help_topic' => $ticket_settings->help_topic]);
if($emails > 0){
if($emails > 1){
$text_emails = "Emails";
} else {
$text_emails = "Email";
}
$email = '<li>'.$emails.' System '.$text_emails.' have been moved to default Help Topic</li>';
} else {
$email = "";
}
$message = $ticket.$email;
$topics = $topic->whereId($id)->first();
/* Check whether function success or not */
try{
$topics->delete();
/* redirect to Index page with Success Message */
return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully'.$message);
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
}
}
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('helptopic')->with('fails', 'Helptopic can not Create');
}
}
}

View File

@@ -17,6 +17,7 @@ use App;
use Lang;
use Cache;
use File;
use Exception;
/**
* SlaController

View File

@@ -10,6 +10,7 @@ use App\User;
use Auth;
use Hash;
use Input;
use Exception;
/**
* ProfileController

View File

@@ -20,13 +20,13 @@ use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Settings\Ticket;
use App\Model\helpdesk\Utility\Date_format;
use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Utility\Logs;
use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Utility\Timezones;
use App\Model\helpdesk\Utility\Time_format;
// classes
use Illuminate\Http\Request;
use Input;
use Exception;
/**
* SettingsController
@@ -69,7 +69,7 @@ class SettingsController extends Controller {
/* Direct to Company Settings Page */
return view('themes.default1.admin.helpdesk.settings.company', compact('companys'));
} catch (Exception $e) {
return view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -81,7 +81,7 @@ class SettingsController extends Controller {
* @return Response
*/
public function postcompany($id, Company $company, CompanyRequest $request) {
try {
/* fetch the values of company request */
$companys = $company->whereId('1')->first();
if (Input::file('logo')) {
@@ -96,17 +96,14 @@ class SettingsController extends Controller {
$companys->use_logo = '0';
}
/* Check whether function success or not */
if ($companys->fill($request->except('logo'))->save() == true) {
try {
$companys->fill($request->except('logo'))->save();
/* redirect to Index page with Success Message */
return redirect('getcompany')->with('success', 'Company Updated Successfully');
} else {
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getcompany')->with('fails', 'Company can not Updated');
return redirect('getcompany')->with('fails', 'Company can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
}
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getcompany')->with('fails', 'Company can not Updated');
}
}
/**
@@ -117,10 +114,9 @@ class SettingsController extends Controller {
* @param type Date_format $date
* @param type Date_time_format $date_time
* @param type Time_format $time
* @param type Logs $log
* @return type Response
*/
public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time, Logs $log) {
public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time) {
try {
/* fetch the values of system from system table */
$systems = $system->whereId('1')->first();
@@ -129,9 +125,9 @@ class SettingsController extends Controller {
/* Fetch the values from Timezones table */
$timezones = $timezone->get();
/* Direct to System Settings Page */
return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time', 'log'));
return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time'));
} catch (Exception $e) {
return view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -144,20 +140,17 @@ class SettingsController extends Controller {
*/
public function postsystem($id, System $system, SystemRequest $request) {
try {
// dd($request);
/* fetch the values of system request */
$systems = $system->whereId('1')->first();
/* fill the values to coompany table */
/* Check whether function success or not */
if ($systems->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
return redirect('getsystem')->with('success', 'System Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('getsystem')->with('fails', 'System can not Updated');
}
$systems->fill($request->input())->save();
/* redirect to Index page with Success Message */
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');
return redirect('getsystem')->with('fails', 'System can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
}
}
@@ -180,7 +173,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 view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -206,16 +199,12 @@ class SettingsController extends Controller {
$tickets->html = $request->input('html');
$tickets->client_update = $request->input('client_update');
/* Check whether function success or not */
if ($tickets->save() == true) {
/* redirect to Index page with Success Message */
return redirect('getticket')->with('success', 'Ticket Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('getticket')->with('fails', 'Ticket can not Updated');
}
$tickets->save();
/* redirect to Index page with Success Message */
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');
return redirect('getticket')->with('fails', 'Ticket can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
}
}
@@ -237,7 +226,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 view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -262,16 +251,12 @@ class SettingsController extends Controller {
$emails->strip = $request->input('strip');
$emails->attachment = $request->input('attachment');
/* Check whether function success or not */
if ($emails->save() == true) {
/* redirect to Index page with Success Message */
return redirect('getemail')->with('success', 'Email Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('getemail')->with('fails', 'Email can not Updated');
}
$emails->save();
/* redirect to Index page with Success Message */
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');
return redirect('getemail')->with('fails', 'Email can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
}
}
@@ -334,7 +319,7 @@ class SettingsController extends Controller {
/* Direct to Responder Settings Page */
return view('themes.default1.admin.helpdesk.settings.responder', compact('responders'));
} catch (Exception $e) {
return view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -356,16 +341,12 @@ class SettingsController extends Controller {
$responders->overlimit = $request->input('overlimit');
/* fill the values to coompany table */
/* Check whether function success or not */
if ($responders->save() == true) {
/* redirect to Index page with Success Message */
return redirect('getresponder')->with('success', 'Responder Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('getresponder')->with('fails', 'Responder can not Updated');
}
$responders->save();
/* redirect to Index page with Success Message */
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');
return redirect('getresponder')->with('fails', 'Responder can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
}
}
@@ -381,7 +362,7 @@ class SettingsController extends Controller {
/* Direct to Alert Settings Page */
return view('themes.default1.admin.helpdesk.settings.alert', compact('alerts'));
} catch (Exception $e) {
return view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -442,16 +423,12 @@ class SettingsController extends Controller {
}
/* fill the values to coompany table */
/* Check whether function success or not */
if ($alerts->save() == true) {
/* redirect to Index page with Success Message */
return redirect('getalert')->with('success', 'Alert Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('getalert')->with('fails', 'Alert can not Updated');
}
$alerts->save();
/* redirect to Index page with Success Message */
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');
return redirect('getalert')->with('fails', 'Alert can not Updated'.'<li>'.$e->errorInfo[2].'</li>');
}
}

View File

@@ -1,11 +1,19 @@
<?php namespace App\Http\Controllers\Admin\helpdesk;
// controllers
use App\Http\Controllers\Controller;
// requests
use App\Http\Requests\helpdesk\SlaRequest;
use App\Http\Requests\helpdesk\SlaUpdate;
// models
use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Settings\Ticket;
//classes
use DB;
use Exception;
/**
* SlaController
@@ -37,7 +45,7 @@ class SlaController extends Controller {
/* Listing the values From Sla_plan Table */
return view('themes.default1.admin.helpdesk.manage.sla.index', compact('slas'));
} catch (Exception $e) {
return view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -50,7 +58,7 @@ class SlaController extends Controller {
/* Direct to Create Page */
return view('themes.default1.admin.helpdesk.manage.sla.create');
} catch (Exception $e) {
return view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -64,29 +72,15 @@ class SlaController extends Controller {
try {
/* Fill the request values to Sla_plan Table */
/* Check whether function success or not */
if ($sla->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
return redirect('sla')->with('success', 'SLA Plan Created Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Create');
}
$sla->fill($request->input())->save();
/* redirect to Index page with Success Message */
return redirect('sla')->with('success', 'SLA Plan Created Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Create');
return redirect('sla')->with('fails', 'SLA Plan can not Create'.'<li>'.$e->errorInfo[2].'</li>');
}
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
* @param type int $id
@@ -100,7 +94,7 @@ class SlaController extends Controller {
$slas->get();
return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas'));
} catch (Exception $e) {
return view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -121,16 +115,12 @@ class SlaController extends Controller {
/* Update ticket_overdue checkox field */
$slas->ticket_overdue = $request->input('ticket_overdue');
/* Check whether function success or not */
if ($slas->save() == true) {
/* redirect to Index page with Success Message */
return redirect('sla')->with('success', 'SLA Plan Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Update');
}
$slas->save();
/* redirect to Index page with Success Message */
return redirect('sla')->with('success', 'SLA Plan Updated Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Update');
return redirect('sla')->with('fails', 'SLA Plan can not Update'.'<li>'.$e->errorInfo[2].'</li>');
}
}
@@ -141,20 +131,55 @@ class SlaController extends Controller {
* @return type Response
*/
public function destroy($id, Sla_plan $sla) {
try {
$default_sla = Ticket::where('id','=','1')->first();
if($default_sla->sla == $id) {
return redirect('departments')->with('fails', 'You cannot delete default department');
} else {
$tickets = DB::table('tickets')->where('sla','=',$id)->update(['sla' => $default_sla->sla]);
if($tickets > 0) {
if($tickets > 1) {
$text_tickets = "Tickets";
} else {
$text_tickets = "Ticket";
}
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default SLA</li>';
} else {
$ticket = "";
}
$dept = DB::table('department')->where('sla','=',$id)->update(['sla' => $default_sla->sla]);
if($dept > 0){
if($dept > 1){
$text_dept = "Emails";
} else {
$text_dept = "Email";
}
$dept = '<li>Associated department have been moved to default SLA</li>';
} else {
$dept = "";
}
$topic = DB::table('help_topic')->where('sla_plan','=',$id)->update(['sla_plan' => $default_sla->sla]);
if($topic > 0){
if($topic > 1){
$text_topic = "Emails";
} else {
$text_topic = "Email";
}
$topic = '<li>Associated Help Topic have been moved to default SLA</li>';
} else {
$topic = "";
}
$message = $ticket.$dept.$topic;
/* Delete a perticular field from the database by delete() using Id */
$slas = $sla->whereId($id)->first();
/* Check whether function success or not */
if ($slas->delete() == true) {
try{
$slas->delete();
/* redirect to Index page with Success Message */
return redirect('sla')->with('success', 'SLA Plan Deleted Successfully');
} else {
return redirect('sla')->with('success', 'SLA Plan Deleted Successfully'.$message);
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Delete');
return redirect('sla')->with('fails', 'SLA Plan can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
}
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Delete');
}
}

View File

@@ -1,14 +1,21 @@
<?php namespace App\Http\Controllers\Admin\helpdesk;
// controllers
use App\Http\Controllers\Controller;
// requests
use App\Http\Requests\helpdesk\TeamRequest;
use App\Http\Requests\helpdesk\TeamUpdate;
// models
use App\Model\helpdesk\Agent\Assign_team_agent;
use App\Model\helpdesk\Agent\Teams;
use App\User;
// classes
use DB;
use Exception;
/**
* TeamController
*
@@ -41,7 +48,7 @@ class TeamController extends Controller {
$assign_team_agent = $assign_team_agent->get();
return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams'));
} catch (Exception $e) {
return view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -55,7 +62,7 @@ class TeamController extends Controller {
$user = $user->get();
return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user'));
} catch (Exception $e) {
return view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -66,31 +73,24 @@ class TeamController extends Controller {
* @return type Response
*/
public function store(Teams $team, TeamRequest $request) {
if($request->team_lead){
$team_lead = $request->team_lead;
} else {
$team_lead = null;
}
$team->team_lead = $team_lead;
try {
/* Check whether function success or not */
if ($team->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
return redirect('teams')->with('success', 'Teams Created Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Create');
}
$team->fill($request->except('team_lead'))->save();
/* redirect to Index page with Success Message */
return redirect('teams')->with('success', 'Teams Created Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Create');
return redirect('teams')->with('fails', 'Teams can not Create'.'<li>'.$e->errorInfo[2].'</li>');
}
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
* @param type $id
@@ -107,7 +107,7 @@ class TeamController extends Controller {
$agent_id = $agent_team->lists('agent_id', 'agent_id');
return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents'));
} catch (Exception $e) {
return view('404');
return redirect()->back()->with('fails',$e->errorInfo[2]);
}
}
@@ -119,24 +119,29 @@ class TeamController extends Controller {
* @return type Response
*/
public function update($id, Teams $team, TeamUpdate $request) {
try {
$teams = $team->whereId($id)->first();
//updating check box
if($request->team_lead){
$team_lead = $request->team_lead;
} else {
$team_lead = null;
}
$teams->team_lead = $team_lead;
$teams->save();
$alert = $request->input('assign_alert');
$teams->assign_alert = $alert;
$teams->save(); //saving check box
//updating whole field
/* Check whether function success or not */
if ($teams->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
return redirect('teams')->with('success', 'Teams Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Update');
}
try {
$teams->fill($request->except('team_lead'))->save();
/* redirect to Index page with Success Message */
return redirect('teams')->with('success', 'Teams Updated Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Update');
return redirect('teams')->with('fails', 'Teams can not Update'.'<li>'.$e->errorInfo[2].'</li>');
}
}
@@ -151,17 +156,14 @@ class TeamController extends Controller {
try {
$assign_team_agent->where('team_id', $id)->delete();
$teams = $team->whereId($id)->first();
$tickets = DB::table('tickets')->where('team_id','=',$id)->update(['team_id' => null]);
/* Check whether function success or not */
if ($teams->delete() == true) {
/* redirect to Index page with Success Message */
return redirect('teams')->with('success', 'Teams Deleted Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Delete');
}
$teams->delete();
/* redirect to Index page with Success Message */
return redirect('teams')->with('success', 'Teams Deleted Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('teams')->with('fails', 'Teams can not Delete');
return redirect('teams')->with('fails', 'Teams can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
}
}
}

View File

@@ -12,6 +12,7 @@ use App\Model\helpdesk\Utility\Languages;
// classes
use Illuminate\Http\Request;
use Mail;
use Exception;
/**
* TemplateController

View File

@@ -1,10 +1,14 @@
<?php namespace App\Http\Controllers\Admin\helpdesk;
// controllers
use App\Http\Controllers\Controller;
// models
use App\Model\helpdesk\Priority;
use App\Model\helpdesk\Ticket_thread;
// classes
use Exception;
/**
* ThreadController
*