public function destroy(ServiceTime $service_time) { if (!Helper::getMode()) { return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE')); } $service_time->delete(); return redirect('/configuration#service_time')->withSuccess(config('constants.DELETED')); }
public static function getServiceTime($priority) { $service_time = \App\ServiceTime::where('priority', '=', $priority)->first(); $time = array(); if ($service_time) { $time['response_time'] = $service_time->response_time; $time['response_time_type'] = $service_time->response_time_type; $time['resolution_time'] = $service_time->resolution_time; $time['resolution_time_type'] = $service_time->resolution_time_type; if ($service_time->response_unit == 'hour') { $time['response_time'] *= 60; } elseif ($service_time->response_unit == 'days') { $time['response_time'] *= 60 * 24; } if ($service_time->resolution_unit == 'hour') { $time['resolution_time'] *= 60; } elseif ($service_time->resolution_unit == 'days') { $time['resolution_time'] *= 60 * 24; } } else { $time['response_time'] = config('config.default_response_time'); $time['response_time_type'] = config('config.default_time_unit'); $time['resolution_time'] = config('config.default_resolution_time'); $time['resolution_time_type'] = config('config.default_time_unit'); } return $time; }
public function showBusinessHour() { if (!config('config.show_business_hour')) { return redirect('/'); } $business_hours = \App\BusinessHour::all(); $service_times = \App\ServiceTime::all(); $assets = ['hide_sidebar']; return view('page.business_hour', compact('assets', 'business_hours', 'service_times')); }
public function index() { $ticket_types = TicketType::all(); $departments = Department::all(); $business_hours = BusinessHour::all(); $service_times = ServiceTime::all(); $languages = Helper::getAllLanguages(); $config = Helper::getConfiguration(); $mail_config = Helper::getMail(); $services = Helper::getServices(); $next_ticket_no = \App\Ticket::max('ticket_no'); $next_ticket_no = isset($next_ticket_no) ? $next_ticket_no + 1 : 1; $assets = ['datetimepicker', 'mail_config']; $week_days = config('list.week'); $time_unit = config('list.time_unit'); $priority = config('list.priority'); $time_type = config('list.time_type'); $roles = DB::table('roles')->get(); $permissions = DB::table('permissions')->orderBy('category')->get(); $permission_role = DB::table('permission_role')->select(DB::raw('CONCAT(role_id,"-",permission_id) AS detail,id'))->lists('detail', 'id'); $data = ['languages' => $languages, 'config' => $config, 'mail_config' => $mail_config, 'services' => $services, 'roles' => $roles, 'permissions' => $permissions, 'permission_role' => $permission_role, 'assets' => $assets, 'ticket_types' => $ticket_types, 'departments' => $departments, 'week_days' => $week_days, 'business_hours' => $business_hours, 'service_times' => $service_times, 'time_unit' => $time_unit, 'priority' => $priority, 'time_type' => $time_type, 'next_ticket_no' => $next_ticket_no, 'category' => null]; return view('configuration.index', $data); }