/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $req)
 {
     //
     if ($this->auth->user()->type == "administrator") {
         return view('dashboard.admin_dashboard');
     } elseif ($this->auth->user()->type == "support") {
         parent::$_data['tiket_open'] = Tiket::where(['status' => 'open', 'id_support' => Auth::user()->id_user])->count();
         parent::$_data['tiket_process'] = Tiket::where(['status' => 'process', 'id_support' => Auth::user()->id_user])->count();
         parent::$_data['tiket_finish'] = Tiket::where(['status' => 'finish', 'id_support' => Auth::user()->id_user])->count();
         parent::$_data['tiket_cancel'] = Tiket::where(['status' => 'cancelled', 'id_support' => Auth::user()->id_user])->count();
         parent::$_data['sm_waiting'] = ServerMaintenance::where(['status' => 'waiting', 'id_support' => Auth::user()->id_user])->count();
         parent::$_data['sm_approved'] = ServerMaintenance::where(['status' => 'approved', 'id_support' => Auth::user()->id_user])->count();
         parent::$_data['rk_waiting'] = RencanaKunjungan::where(['status' => 'waiting', 'id_support' => Auth::user()->id_user])->count();
         parent::$_data['rk_approved'] = RencanaKunjungan::where(['status' => 'approved', 'id_support' => Auth::user()->id_user])->count();
         return view('dashboard.support_dashboard', parent::$_data);
     } elseif ($this->auth->user()->type == "pm") {
         parent::$_data['tiket_open'] = Tiket::where('status', '=', 'open')->count();
         parent::$_data['tiket_process'] = Tiket::where('status', '=', 'process')->count();
         parent::$_data['tiket_finish'] = Tiket::where('status', '=', 'finish')->count();
         parent::$_data['tiket_cancel'] = Tiket::where('status', '=', 'cancelled')->count();
         parent::$_data['sm_waiting'] = ServerMaintenance::where('status', '=', 'waiting')->count();
         parent::$_data['sm_approved'] = ServerMaintenance::where('status', '=', 'approved')->count();
         parent::$_data['rk_waiting'] = RencanaKunjungan::where('status', '=', 'waiting')->count();
         parent::$_data['rk_approved'] = RencanaKunjungan::where('status', '=', 'approved')->count();
         return view('dashboard.pm_dashboard', parent::$_data);
     } elseif ($this->auth->user()->type == "client") {
         return view('dashboard.client_dashboard');
     }
 }
 public function ls_post(Request $req)
 {
     if ($req->type == "periode_client") {
         $range = explode('to', trim($req->range));
         $client = $req->client;
         $data = Tiket::whereHas('rk', function ($q) use($req, $range) {
             $q->where('tiket.id_client', '=', $req->client);
             $q->where('tiket.status', '=', "process");
             $q->whereBetween('rencana_kunjungan.created_at', [$range[0] . ' 00:00:01', $range[1] . ' 23:59:59']);
         })->get();
     } else {
         $range = explode('to', trim($req->range));
         $data = Tiket::where('tiket.status', '=', 'process')->whereHas('rk', function ($q) use($req, $range) {
             $q->whereBetween('rencana_kunjungan.created_at', [$range[0] . ' 00:00:01', $range[1] . ' 23:59:59']);
         })->get();
     }
     parent::$_data['results'] = $data;
     return view('report.result_ls', parent::$_data);
 }
 public function create($id_tiket)
 {
     parent::$_data['tiket'] = Tiket::where("id_tiket", '=', $id_tiket)->first();
     parent::$_data['id_tiket'] = $id_tiket;
     return view("rencana_kunjungan.rencana_kunjungan_add", parent::$_data);
 }