update v 1.0.7.5

This commit is contained in:
Sujit Prasad
2016-06-13 20:41:55 +05:30
parent aa9786d829
commit 283d97e3ea
5078 changed files with 339851 additions and 175995 deletions

View File

@@ -7,6 +7,8 @@ use App\Http\Controllers\Controller;
// requests
use App\Http\Requests\helpdesk\CompanyRequest;
use App\Http\Requests\helpdesk\EmailRequest;
use App\Http\Requests\helpdesk\RatingUpdateRequest;
use App\Http\Requests\helpdesk\StatusRequest;
use App\Http\Requests\helpdesk\SystemRequest;
// models
use App\Model\helpdesk\Agent\Department;
@@ -14,7 +16,8 @@ use App\Model\helpdesk\Email\Emails;
use App\Model\helpdesk\Email\Template;
use App\Model\helpdesk\Manage\Help_topic;
use App\Model\helpdesk\Manage\Sla_plan;
use App\Model\helpdesk\Settings\Access;
use App\Model\helpdesk\Notification\UserNotification;
use App\Model\helpdesk\Ratings\Rating;
use App\Model\helpdesk\Settings\Alert;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Settings\Email;
@@ -26,9 +29,11 @@ use App\Model\helpdesk\Utility\Date_format;
use App\Model\helpdesk\Utility\Date_time_format;
use App\Model\helpdesk\Utility\Time_format;
use App\Model\helpdesk\Utility\Timezones;
use DateTime;
// classes
use DB;
use Exception;
use File;
use Illuminate\Http\Request;
use Input;
use Lang;
@@ -52,16 +57,6 @@ class SettingsController extends Controller
$this->middleware('roles');
}
/**
* Main Settings Page.
*
* @return type view
*/
public function settings()
{
return view('themes.default1.admin.helpdesk.setting');
}
/**
* @param int $id
* @param $compant instance of company table
@@ -109,10 +104,10 @@ class SettingsController extends Controller
try {
$companys->fill($request->except('logo'))->save();
/* redirect to Index page with Success Message */
return redirect('getcompany')->with('success', 'Company Updated Successfully');
return redirect('getcompany')->with('success', Lang::get('lang.company_updated_successfully'));
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getcompany')->with('fails', 'Company can not Updated'.'<li>'.$e->getMessage().'</li>');
return redirect('getcompany')->with('fails', Lang::get('lang.company_can_not_updated').'<li>'.$e->getMessage().'</li>');
}
}
@@ -158,6 +153,9 @@ class SettingsController extends Controller
$departments = $department->get();
/* Fetch the values from Timezones table */
$timezones = $timezone->get();
//$debug = \Config::get('app.debug');
//dd($value);
/* Direct to System Settings Page */
return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time'));
} catch (Exception $e) {
@@ -184,10 +182,13 @@ class SettingsController extends Controller
/* Check whether function success or not */
$systems->fill($request->input())->save();
/* redirect to Index page with Success Message */
return redirect('getsystem')->with('success', 'System Updated Successfully');
// dd($datacontent);
//\Config::set('app.debug', $request->input('debug'));
return redirect('getsystem')->with('success', Lang::get('lang.system_updated_successfully'));
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getsystem')->with('fails', 'System can not Updated'.'<li>'.$e->getMessage().'</li>');
return redirect('getsystem')->with('fails', Lang::get('lang.system_can_not_updated').'<br>'.$e->getMessage());
}
}
@@ -245,10 +246,10 @@ class SettingsController extends Controller
/* Check whether function success or not */
$tickets->save();
/* redirect to Index page with Success Message */
return redirect('getticket')->with('success', 'Ticket Updated Successfully');
return redirect('getticket')->with('success', Lang::get('lang.ticket_updated_successfully'));
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getticket')->with('fails', 'Ticket can not Updated'.'<li>'.$e->getMessage().'</li>');
return redirect('getticket')->with('fails', Lang::get('lang.ticket_can_not_updated').'<li>'.$e->getMessage().'</li>');
}
}
@@ -303,10 +304,10 @@ class SettingsController extends Controller
/* Check whether function success or not */
$emails->save();
/* redirect to Index page with Success Message */
return redirect('getemail')->with('success', 'Email Updated Successfully');
return redirect('getemail')->with('success', Lang::get('lang.email_updated_successfully'));
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getemail')->with('fails', 'Email can not Updated'.'<li>'.$e->getMessage().'</li>');
return redirect('getemail')->with('fails', Lang::get('lang.email_can_not_updated').'<li>'.$e->getMessage().'</li>');
}
}
@@ -322,16 +323,15 @@ class SettingsController extends Controller
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();
/* 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 {
// }
}
@@ -368,57 +368,6 @@ class SettingsController extends Controller
}
}
/**
* get the form for Access setting page.
*
* @param type Access $access
*
* @return type Response
*/
// public function getaccess(Access $access) {
// try {
// /* fetch the values of access from access table */
// $accesses = $access->whereId('1')->first();
// // Direct to Access Settings Page
// return view('themes.default1.admin.helpdesk.settings.access', compact('accesses'));
// } catch (Exception $e) {
// return view('404');
// }
// }
/**
* Update the specified resource in storage.
*
* @param type Access $access
* @param type Request $request
*
* @return type Response
*/
// public function postaccess(Access $access, Request $request) {
// try {
// /* fetch the values of access request */
// $accesses = $access->whereId('1')->first();
// /* fill the values to access table */
// $accesses->fill($request->except('password_reset', 'bind_agent_ip', 'reg_require', 'quick_access'))->save();
// /* insert checkbox value to DB */
// $accesses->password_reset = $request->input('password_reset');
// $accesses->bind_agent_ip = $request->input('bind_agent_ip');
// $accesses->reg_require = $request->input('reg_require');
// $accesses->quick_access = $request->input('quick_access');
// /* Check whether function success or not */
// if ($accesses->save() == true) {
// /* redirect to Index page with Success Message */
// return redirect('getaccess')->with('success', 'Access Updated Successfully');
// } else {
// /* redirect to Index page with Fails Message */
// return redirect('getaccess')->with('fails', 'Access can not Updated');
// }
// } catch (Exception $e) {
// /* redirect to Index page with Fails Message */
// return redirect('getaccess')->with('fails', 'Access can not Updated');
// }
// }
/**
* get the form for Responder setting page.
*
@@ -461,10 +410,10 @@ class SettingsController extends Controller
/* Check whether function success or not */
$responders->save();
/* redirect to Index page with Success Message */
return redirect('getresponder')->with('success', 'Responder Updated Successfully');
return redirect('getresponder')->with('success', Lang::get('lang.auto_response_updated_successfully'));
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getresponder')->with('fails', 'Responder can not Updated'.'<li>'.$e->getMessage().'</li>');
return redirect('getresponder')->with('fails', Lang::get('lang.auto_response_can_not_updated').'<li>'.$e->getMessage().'</li>');
}
}
@@ -549,52 +498,13 @@ class SettingsController extends Controller
/* Check whether function success or not */
$alerts->save();
/* redirect to Index page with Success Message */
return redirect('getalert')->with('success', 'Alert Updated Successfully');
return redirect('getalert')->with('success', Lang::get('lang.alert_&_notices_updated_successfully'));
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('getalert')->with('fails', 'Alert can not Updated'.'<li>'.$e->getMessage().'</li>');
return redirect('getalert')->with('fails', Lang::get('lang.alert_&_notices_can_not_updated').'<li>'.$e->getMessage().'</li>');
}
}
/**
* To display the list of ratings in the system.
*
* @return type View
*/
public function RatingSettings()
{
$ratings = DB::table('settings_ratings')->get();
return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings'));
}
/**
* To store rating data.
*
* @return type Redirect
*/
public function PostRatingSettings($slug)
{
$name = Input::get('rating_name');
$publish = Input::get('publish');
$modify = Input::get('modify');
DB::table('settings_ratings')->whereSlug($slug)->update(['rating_name' => $name, 'publish' => $publish, 'modify' => $modify]);
return redirect()->back()->with('success', 'Successfully updated');
}
/**
* To delete a type of rating.
*
* @return type Redirect
*/
public function RatingDelete($slug)
{
DB::table('settings_ratings')->whereSlug($slug)->delete();
return redirect()->back()->with('success', 'Successfully Deleted');
}
/**
* Generate Api key.
*
@@ -606,4 +516,297 @@ class SettingsController extends Controller
return $key;
}
/**
* Main Settings Page.
*
* @return type view
*/
public function settings()
{
return view('themes.default1.admin.helpdesk.setting');
}
/**
* @param int $id
* @param $compant instance of company table
*
* get the form for company setting page
*
* @return Response
*/
public function getStatuses()
{
try {
/* fetch the values of company from company table */
$statuss = \DB::table('ticket_status')->get();
/* Direct to Company Settings Page */
return view('themes.default1.admin.helpdesk.settings.status', compact('statuss'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());
}
}
/**
* @param int $id
* @param $compant instance of company table
*
* get the form for company setting page
*
* @return Response
*/
public function getEditStatuses($id)
{
try {
/* fetch the values of company from company table */
$status = \DB::table('ticket_status')->where('id', '=', $id)->first();
/* Direct to Company Settings Page */
return view('themes.default1.admin.helpdesk.settings.status-edit', compact('status'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());
}
}
/**
* @param int $id
* @param $compant instance of company table
*
* get the form for company setting page
*
* @return Response
*/
public function editStatuses($id, StatusRequest $request)
{
try {
/* fetch the values of company from company table */
$statuss = \App\Model\helpdesk\Ticket\Ticket_Status::whereId($id)->first();
$statuss->name = $request->input('name');
$statuss->icon_class = $request->input('icon_class');
$statuss->email_user = $request->input('email_user');
$statuss->sort = $request->input('sort');
$delete = $request->input('deleted');
if ($delete == 'yes') {
$statuss->state = 'delete';
} else {
$statuss->state = $request->input('state');
}
$statuss->sort = $request->input('sort');
$statuss->save();
/* Direct to Company Settings Page */
return redirect()->back()->with('success', Lang::get('lang.status_has_been_updated_successfully'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());
}
}
/**
* create a status.
*
* @param \App\Model\helpdesk\Ticket\Ticket_Status $statuss
* @param \App\Http\Requests\helpdesk\StatusRequest $request
*
* @return type redirect
*/
public function createStatuses(\App\Model\helpdesk\Ticket\Ticket_Status $statuss, StatusRequest $request)
{
try {
/* fetch the values of company from company table */
$statuss->name = $request->input('name');
$statuss->icon_class = $request->input('icon_class');
$statuss->email_user = $request->input('email_user');
$statuss->sort = $request->input('sort');
$delete = $request->input('delete');
if ($delete == 'yes') {
$statuss->state = 'deleted';
} else {
$statuss->state = $request->input('state');
}
$statuss->sort = $request->input('sort');
$statuss->save();
/* Direct to Company Settings Page */
return redirect()->back()->with('success', Lang::get('lang.status_has_been_created_successfully'));
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
}
}
/**
* delete a status.
*
* @param type $id
*
* @return type redirect
*/
public function deleteStatuses($id)
{
try {
if ($id > 5) {
/* fetch the values of company from company table */
\App\Model\helpdesk\Ticket\Ticket_Status::whereId($id)->delete();
/* Direct to Company Settings Page */
return redirect()->back()->with('success', Lang::get('lang.status_has_been_deleted'));
} else {
return redirect()->back()->with('failed', Lang::get('lang.you_cannot_delete_this_status'));
}
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());
}
}
/**
* get the page of notification settings.
*
* @return type view
*/
public function notificationSettings()
{
return view('themes.default1.admin.helpdesk.settings.notification');
}
/**
* delete a notification.
*
* @return type redirect
*/
public function deleteReadNoti()
{
$markasread = UserNotification::where('is_read', '=', 1)->get();
foreach ($markasread as $mark) {
$mark->delete();
\App\Model\helpdesk\Notification\Notification::whereId($mark->notification_id)->delete();
}
return redirect()->back()->with('success', Lang::get('lang.you_have_deleted_all_the_read_notifications'));
}
/**
* delete a notification log.
*
* @return type redirect
*/
public function deleteNotificationLog()
{
$days = Input::get('no_of_days');
if ($days == null) {
return redirect()->back()->with('fails', 'Please enter valid no of days');
}
$date = new DateTime();
$date->modify($days.' day');
$formatted_date = $date->format('Y-m-d H:i:s');
$markasread = UserNotification::where('created_at', '<=', $formatted_date)->get();
foreach ($markasread as $mark) {
$mark->delete();
\App\Model\helpdesk\Notification\Notification::whereId($mark->notification_id)->delete();
}
return redirect()->back()->with('success', Lang::get('lang.you_have_deleted_all_the_notification_records_since').$days.' days.');
}
/**
* To display the list of ratings in the system.
*
* @return type View
*/
public function RatingSettings()
{
try {
$ratings = Rating::orderBy('display_order', 'asc')->get();
return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings'));
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
}
}
/**
* edit a rating.
*
* @param type $id
*
* @return type view
*/
public function editRatingSettings($id)
{
try {
$rating = Rating::whereId($id)->first();
return view('themes.default1.admin.helpdesk.settings.edit-ratings', compact('rating'));
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
}
}
/**
* To store rating data.
*
* @return type Redirect
*/
public function PostRatingSettings($id, Rating $ratings, RatingUpdateRequest $request)
{
try {
$rating = $ratings->whereId($id)->first();
$rating->name = $request->input('name');
$rating->display_order = $request->input('display_order');
$rating->allow_modification = $request->input('allow_modification');
$rating->rating_scale = $request->input('rating_scale');
// $rating->rating_area = $request->input('rating_area');
$rating->restrict = $request->input('restrict');
$rating->save();
return redirect()->back()->with('success', Lang::get('lang.ratings_updated_successfully'));
} catch (Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
}
}
/**
* get the create rating page.
*
* @return type redirect
*/
public function createRating()
{
try {
return view('themes.default1.admin.helpdesk.settings.create-ratings');
} catch (Exception $ex) {
return redirect('getratings')->with('fails', Lang::get('lang.ratings_can_not_be_created').'<li>'.$ex->getMessage().'</li>');
}
}
/**
* store a rating value.
*
* @param \App\Model\helpdesk\Ratings\Rating $rating
* @param \App\Model\helpdesk\Ratings\RatingRef $ratingrefs
* @param \App\Http\Requests\helpdesk\RatingRequest $request
*
* @return type redirect
*/
public function storeRating(Rating $rating, \App\Model\helpdesk\Ratings\RatingRef $ratingrefs, \App\Http\Requests\helpdesk\RatingRequest $request)
{
$rating->name = $request->input('name');
$rating->display_order = $request->input('display_order');
$rating->allow_modification = $request->input('allow_modification');
$rating->rating_scale = $request->input('rating_scale');
$rating->rating_area = $request->input('rating_area');
$rating->restrict = $request->input('restrict');
$rating->save();
$ratingrefs->rating_id = $rating->id;
$ratingrefs->save();
return redirect()->back()->with('success', Lang::get('lang.successfully_created_this_rating'));
}
/**
* To delete a type of rating.
*
* @return type Redirect
*/
public function RatingDelete($slug, \App\Model\helpdesk\Ratings\RatingRef $ratingrefs)
{
$ratingrefs->where('rating_id', '=', $slug)->delete();
Rating::whereId($slug)->delete();
return redirect()->back()->with('success', Lang::get('lang.rating_deleted_successfully'));
}
}