public function search_programaciones()
 {
     if (!Request::ajax() || !Auth::check()) {
         return Response::json(array('success' => false), 200);
     }
     $id = Auth::id();
     $data["inside_url"] = Config::get('app.inside_url');
     $data["user"] = Session::get('user');
     if ($data["user"]->idrol == 1 || $data["user"]->idrol == 2 || $data["user"]->idrol == 3 || $data["user"]->idrol == 4) {
         // Check if the current user is the "System Admin"
         $fecha_ini = date("Y-m-d", strtotime("first day of january"));
         $fecha_fin = date("Y-m-d", strtotime('last day of december'));
         $array_ot = null;
         $array_ot = OtRetiro::getOtXPeriodo(9, $fecha_ini, $fecha_fin)->orderBy('fecha_programacion', 'desc')->get()->toArray();
         $programaciones = [];
         $horas = [];
         $estados = [];
         $codigos = [];
         $length = sizeof($array_ot);
         $ids = [];
         for ($i = 0; $i < $length; $i++) {
             $programaciones[] = date("Y-m-d", strtotime($array_ot[$i]['fecha_programacion']));
             $codigo_ot = $array_ot[$i]['ot_tipo_abreviatura'] . $array_ot[$i]['ot_correlativo'] . $array_ot[$i]['ot_activo_abreviatura'];
             $hora = date("H:i", strtotime($array_ot[$i]['fecha_programacion']));
             $id = $array_ot[$i]['idot_retiro'];
             $idestado = $array_ot[$i]['idestado_ot'];
             $estado = Estado::getEstadoById($idestado)->get();
             $estado = $estado[0];
             array_push($horas, $hora);
             array_push($estados, $estado);
             array_push($codigos, $codigo_ot);
             array_push($ids, $id);
         }
         return Response::json(array('success' => true, 'programaciones' => $programaciones, 'horas' => $horas, 'estados' => $estados, 'ots' => $array_ot), 200);
     } else {
         return Response::json(array('success' => false), 200);
     }
 }