public function getCrear()
 {
     $productores = Productor::all();
     $departamentos = Departamento::all();
     $municipios = Municipio::all();
     return view('fincas.crear', array('productores' => $productores, 'departamentos' => $departamentos, 'municipios' => $municipios));
 }
 public function ver($idProyecto)
 {
     $departamentos = \App\Departamento::all();
     $tipo_participantes = \App\TipoParticipante::all();
     $tipoTerrenos = \App\TipoTerreno::all();
     $abastecimientoAguas = \App\AbastecimientoAgua::all();
     $tipoPlantaciones = \App\TipoPlantacion::all();
     //obteniendo datos de solicitante
     $planificacion = \App\Planificacion::find($idProyecto);
     //  $proyecto = \App\Proyecto:: find($idProyecto);
     $entidadSolicitante = $planificacion->entidadSolicitante;
     $tipoPlantacion = $planificacion->tipoPlantacion;
     $responsable = $planificacion->responsable;
     $abastecimientoAguasPlanificacion = $planificacion->abastecimientoAguas;
     //  $comunidades= $proyecto-> comunidades;
     // return $comunidades;
     //--- estableciendo los abastecimiento de agua que son del proyecto ---
     for ($i = 0; $i < count($abastecimientoAguas); $i++) {
         $abastecimientoAguas[$i]['seleccionado'] = 0;
         for ($j = 0; $j < count($abastecimientoAguasPlanificacion); $j++) {
             if ($abastecimientoAguas[$i]['id_abastecimiento_agua'] == $abastecimientoAguasPlanificacion[$j]['id_abastecimiento_agua']) {
                 $abastecimientoAguas[$i]['seleccionado'] = 1;
                 break;
             }
         }
     }
     return view('adicion_plantacion', ['departamentos' => $departamentos, 'tipo_participantes' => $tipo_participantes, 'tipo_plantaciones' => $tipoPlantaciones, 'abastecimiento_aguas' => $abastecimientoAguas, 'entidad_solicitante' => $entidadSolicitante, 'tipo_terrenos' => $tipoTerrenos, 'tipo_plantacion' => $tipoPlantacion, 'responsable' => $responsable]);
 }
Example #3
0
 /**
  * Muestra la vista principal para editar un municipio - Metodo edit()     *
  * @param  int $id - el id primary key tabla municipio
  * @return vista de edicion municipio
  */
 public function edit($id)
 {
     $mun = Municipio::find($id);
     $list_dep = Departamento::lists('nom_departamento', 'id');
     $list_mun = Municipio::lists('nom_municipio', 'id');
     return view('template.CRUD_municipio.edit_municipio')->with('mun', $mun)->with('list_dep', $list_dep)->with('list_mun', $list_mun);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $evento = Evento::findOrFail($id);
     $categorias = Categoria::lists('titulo', 'id');
     $departamentos = Departamento::lists('titulo', 'id');
     return view('backend.admin.eventos.edit', compact('evento', 'categorias', 'departamentos'));
 }
 public function destroy($id)
 {
     $departamento = Departamento::findOrFail($id);
     if ($departamento->delete()) {
         return redirect()->action('Backend\\DepartamentosController@index')->with('status', 'Departamento ' . $departamento->titulo . ' excluído.');
     }
 }
Example #6
0
 /**
  * 
  * @return a list of objects.
  */
 public static function listByFullName()
 {
     $items = Departamento::all();
     $key = 'id';
     $value = 'full_name';
     return Departamento::getListFields($items, $key, $value);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function ver()
 {
     //
     //return view('planificacion.create');
     $departamentos = \App\Departamento::all();
     $tipo_participantes = \App\TipoParticipante::all();
     return view('planificacion.create', ['departamentos' => $departamentos, 'tipo_participantes' => $tipo_participantes]);
 }
Example #8
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $whereAmI = $this->ruta . $this->listOneBreadcrumb('editar localidad', '', 1);
     $departamentos = Departamento::listByFullName();
     $localidad = Localidad::with('departamento')->with('departamento.provincia')->with('departamento.provincia.pais')->findOrFail($id);
     $donde_estoy[0] = \HTML::entities(\Html::linkRoute('cities.localidades.index', 'localidades'));
     $data = ['whereAmI' => $whereAmI, 'departamentos' => $departamentos, 'donde_estoy' => $donde_estoy, 'localidad' => $localidad];
     return view('admin.cities.localidades.edit', $data);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $this->webpage['whereAmI'] .= $this->listOneBreadcrumb('editar localidad', '', 1);
     $this->webpage['tab_title'] = 'Editar - Localidad';
     $departamentos = Departamento::listByFullName();
     $localidad = Localidad::with('departamento')->with('departamento.provincia')->with('departamento.provincia.pais')->findOrFail($id);
     $data = array_merge(['webpage' => $this->webpage, 'departamentos' => $departamentos, 'localidad' => $localidad], $this->data);
     return view('admin.cities.localidades.edit', $data);
 }
 public function postEliminar()
 {
     $departamento = Departamento::find(Input::get('id'));
     $finca = Finca::where('departamento_id', '=', Input::get('id'));
     if ($finca->count()) {
         $finca = $finca->first();
         $finca->departamento_id = 0;
         $finca->save();
     }
     $departamento->delete();
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $tipo = array('Movilidad estudiantil', 'Relaciones internacionales');
     $campus_sede = CampusSede::all();
     $samples_temp = [];
     foreach ($campus_sede as $item) {
         $samples_temp[] = ['tipo' => $tipo[$faker->numberBetween($min = 0, $max = 1)], 'sitio_web' => $faker->url, 'nombre_encargado' => $faker->firstName . ' ' . $faker->lastName, 'telefono' => $faker->phoneNumber, 'email' => $faker->email, 'campus_sede' => $item->id];
     }
     Departamento::insert($samples_temp);
 }
Example #12
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     die;
     $paises = Pais::all();
     $provincias = Provincia::all();
     $departamentos = Departamento::all();
     $localidades = Localidad::all();
     $calles = Calle::all();
     $domicilios = Domicilio::all();
     $telefonos = Telefono::all();
     $emails = Email::all();
     $webs = Web::all();
 }
 public function getServicio(Request $request)
 {
     $data = $request->all();
     $validator = Validator::make($data, ['servicio' => 'required', 'fechaI' => 'required', 'fechaF' => 'required'], $this->menssage);
     if ($validator->fails()) {
         return Response()->json(['status' => 'danger', 'menssage' => $validator->errors()->first()]);
     } else {
         $deposito = Auth::user()->deposito;
         $servicio = Departamento::where('id', $data['servicio'])->value('nombre');
         $insumos = DB::table('salidas')->whereBetween(DB::raw('DATE_FORMAT(insumos_salidas.created_at,"%Y-%m-%d")'), [$data['fechaI'], $data['fechaF']])->where('salidas.departamento', $data['servicio'])->where('salidas.deposito', $deposito)->join('insumos_salidas', 'insumos_salidas.salida', '=', 'salidas.id')->join('insumos', 'insumos.id', '=', 'insumos_salidas.insumo')->select('insumos.descripcion as name', DB::raw('sum(insumos_salidas.despachado) as y'))->groupBy('insumos.descripcion')->orderBy('y', 'desc')->get();
         $title = 'Salidas de ' . $servicio . ', del (' . $data['fechaI'] . ' a ' . $data['fechaF'] . ')';
         return ['status' => 'success', 'data' => $insumos, 'title' => $title];
     }
 }
Example #14
0
 public function showtest($id)
 {
     $testid = $id;
     $resultado = Resultado::where('testmd5', $id)->first();
     if ($resultado == null or $resultado["sexo"] != null) {
         return "Test ya tomado o no existe";
     } else {
         $tests = Prueba::where('proyecto_id', $resultado["proyecto_id"])->get()->toArray();
         $pais = Paise::all();
         $departamento = Departamento::all();
         $proyecto = Proyecto::find($resultado["proyecto_id"]);
         $empresa = Empresa::find($proyecto["user_id"]);
         return view('tests', compact('pais', 'departamento', 'testid', 'tests', 'empresa', 'proyecto'));
     }
 }
Example #15
0
 /**
  * Muestra la vista principal para editar una biblioteca - Metodo edit()     *
  * @param  int $id - el id primary key tabla biblioteca
  * @return vista de edicion biblioteca
  */
 public function edit($id)
 {
     $list_dep = Departamento::lists('nom_departamento', 'id');
     $biblioteca = Bibliotecas::find($id);
     return view('template.CRUD_biblioteca.edit_biblioteca')->with('biblioteca', $biblioteca)->with('list_dep', $list_dep);
 }
Example #16
0
 public function allTerceros($tipo = null)
 {
     switch ($tipo) {
         case 'proveedor':
             return Provedore::get(['id', 'nombre', DB::raw('("proveedor") as type')]);
             break;
         case 'servicio':
             return Departamento::get(['id', 'nombre', DB::raw('("servicio") as type')]);
             break;
         case 'deposito':
             $deposito = Auth::user()->deposito;
             return Deposito::where('id', '!=', $deposito)->get(['id', 'nombre', DB::raw('("deposito") as type')]);
         default:
             $deposito = Auth::user()->deposito;
             $provedores = DB::table('provedores')->where('deleted_at', null)->select('id', 'nombre', DB::raw('("proveedor") as type'));
             $servicios = DB::table('departamentos')->where('deleted_at', null)->select('id', 'nombre', DB::raw('("servicio") as type'));
             $depositos = DB::table('depositos')->where('id', '!=', $deposito)->where('deleted_at', null)->select('id', 'nombre', DB::raw('("deposito") as type'));
             $interno = DB::table('depositos')->where('id', $deposito)->select('id', 'nombre', DB::raw('("interno") as type'));
             return $provedores->unionAll($servicios)->unionAll($depositos)->unionAll($interno)->orderBy('id', 'desc')->get();
             break;
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Departamento::destroy($id);
     return \Redirect::route('departamento.index');
 }
 /**
  * Elimina un registro de la tabla departamento - Metodo destroy()
  * Realiza las validaciones usando el recurso \Validator
  * @param  int $id - primary key tabla departamento
  * @return Redirecciona a la vista principal de departamento luego de eliminar el registro
  */
 public function destroy($id)
 {
     $data = array('id_dep' => "{$id}");
     $rules = array('id_dep' => 'exists:municipio,id_departamento');
     $ifExistsDepInMunTable = \Validator::make($data, $rules);
     if ($ifExistsDepInMunTable->passes()) {
         return \Redirect::route('departamento')->with('ValidationDelete', 'No se puede eliminar el registro seleccionado ya que el Departamento tiene Municipios asignados.!');
     } else {
         $post = Departamento::find($id)->delete();
         return \Redirect::route('departamento')->with('alert', 'Registro eliminado con exito!');
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Departamento::create(array('nombre' => 'Huila'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     Departamento::destroy($id);
     Session::flash('flash_message', 'Departamento deleted!');
     return redirect('admin/departamento');
 }
Example #21
0
 public function departamentos()
 {
     return \App\Departamento::with('facultad')->where('facultad_id', $this->id)->get();
 }
 public function createmateria($depa)
 {
     $Departamento = Departamento::findOrFail($depa);
     $sigla_materia = $Departamento->nombre_departamento;
     $sigla_materia = $sigla_materia . $depa;
     return view('admin.materia.create', compact('depa', 'sigla_materia'));
 }
Example #23
0
 /**
  * Muestra la vista principal para editar una noticia - Metodo edit()     *
  * @param  int $id - el id primary key tabla noticia
  * @return vista de edicion noticia
  */
 public function edit($id)
 {
     $list_dep = Departamento::lists('nom_departamento', 'id');
     $noticia = Noticia::find($id);
     return view('template.CRUD_noticia.edit_noticia')->with('noticia', $noticia)->with('list_dep', $list_dep);
 }
Example #24
0
 public function getDepartamentos()
 {
     return Departamento::All();
 }
Example #25
0
 public function updatedepartamento()
 {
     $data = Departamento::find(Input::get("id"));
     $data->fill(Input::all());
     $data->save();
 }
 public function cadastrarEvento()
 {
     $categorias = Categoria::lists('titulo', 'id');
     $departamentos = Departamento::lists('titulo', 'id');
     return view('backend.dashboard.criarEvento', compact('categorias', 'departamentos'));
 }
 public function run()
 {
     Departamento::create(['nom_departamento' => 'Nariño', 'cod_dane_dep' => '52']);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     \App\Departamento::destroy($id);
     return redirect('/departamento');
 }
Example #29
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     /**
      * Custom validation rules
      */
     Validator::extend('alpha_spaces', function ($attribute, $value) {
         return preg_match('/^[\\pL\\s]+$/u', $value);
     });
     Validator::extend('cedula', function ($attribute, $value) {
         return preg_match('/^([0-9]{6,8})$/', $value);
     });
     Validator::extend('rif', function ($attribute, $value) {
         return preg_match('/^([J,G,N]-([0-9]{8,12}))$/', $value);
     });
     Validator::extend('equal_provedor', function ($attribute, $value, $parameters) {
         $orden = Input::get($parameters[0]);
         $entrada = Entrada::where('orden', $orden)->value('provedor');
         if (!$entrada) {
             return true;
         } else {
             if ($value != $entrada) {
                 return false;
             }
             return true;
         }
     });
     Validator::extend('diff_provedor', function ($attribute, $value, $parameters) {
         if (empty($value)) {
             return true;
         } else {
             $id = Input::get($parameters[0]);
             $entrada = Entrada::where('id', $id)->value('provedor');
             if ($value == $entrada) {
                 return false;
             }
             return true;
         }
     });
     Validator::extend('diff_orden', function ($attribute, $value, $parameters) {
         if (empty($value)) {
             return true;
         } else {
             $id = Input::get($parameters[0]);
             $entrada = Entrada::where('id', $id)->value('orden');
             if ($value == $entrada) {
                 return false;
             }
             return true;
         }
     });
     Validator::extend('diff_departamento', function ($attribute, $value, $parameters) {
         $id = Input::get($parameters[0]);
         $salida = Salida::where('id', $id)->value('departamento');
         if ($value == $salida) {
             return false;
         }
         return true;
     });
     Validator::extend('insumos', function ($attribute, $value) {
         if (empty($value) || !is_array($value)) {
             return false;
         } else {
             foreach ($value as $insumo) {
                 if (!isset($insumo['cantidad']) || !isset($insumo['id']) || $insumo['cantidad'] <= 0 || !Insumo::where('id', $insumo['id'])->first()) {
                     return false;
                 }
             }
         }
         return true;
     });
     Validator::extend('insumos_salida', function ($attribute, $value) {
         if (empty($value) || !is_array($value)) {
             return false;
         } else {
             foreach ($value as $insumo) {
                 if (!isset($insumo['solicitado']) || !isset($insumo['despachado']) || !isset($insumo['id']) || $insumo['solicitado'] <= 0 || $insumo['despachado'] <= 0 || $insumo['solicitado'] < $insumo['despachado'] || !Insumo::withTrashed()->where('id', $insumo['id'])->first()) {
                     return false;
                 }
             }
         }
         return true;
     });
     Validator::extend('insumos_alarmas', function ($attribute, $value) {
         if (empty($value) || !is_array($value)) {
             return false;
         } else {
             foreach ($value as $insumo) {
                 if (!isset($insumo['id']) || !isset($insumo['min']) || !isset($insumo['med'])) {
                     return false;
                 }
                 if ($insumo['min'] <= 0 || $insumo['med'] <= 0 || $insumo['min'] >= $insumo['med']) {
                     return false;
                 }
             }
         }
         return true;
     });
     Validator::extend('insumos_validate_e', function ($attribute, $value) {
         foreach ($value as $insumo) {
             if (!isset($insumo['cantidad'])) {
                 continue;
             }
             $originalI = Insumos_entrada::where('id', $insumo['id'])->first();
             if (!isset($insumo['id']) || !$originalI || $originalI['cantidad'] == $insumo['cantidad'] || $insumo['cantidad'] < 0) {
                 return false;
             }
         }
         return true;
     });
     Validator::extend('insumos_validate_s', function ($attribute, $value) {
         foreach ($value as $insumo) {
             if (!isset($insumo['despachado'])) {
                 continue;
             }
             $originalI = insumos_salida::where('id', $insumo['id'])->first();
             if (!isset($insumo['id']) || !$originalI || $insumo['despachado'] == $originalI['despachado'] || $insumo['despachado'] < 0) {
                 return false;
             }
             if (!isset($insumo['solicitado'])) {
                 if ($originalI['solicitado'] < $insumo['despachado']) {
                     return false;
                 }
             } else {
                 if (!is_int($insumo['solicitado']) || $insumo['solicitado'] < 0 || $insumo['solicitado'] == $originalI['solicitado']) {
                     return false;
                 }
             }
         }
         return true;
     });
     Validator::extend('one_insumo_entrada', function ($attribute, $value, $parameters) {
         $entrada = Input::get($parameters[0]);
         $insumos = Insumos_entrada::where('entrada', $entrada)->get();
         if ($insumos->count() == 1 && isset($value[0]['cantidad']) && $value[0]['cantidad'] == 0) {
             return false;
         }
         return true;
     });
     Validator::extend('one_insumo_salida', function ($attribute, $value, $parameters) {
         $salida = Input::get($parameters[0]);
         $insumos = Insumos_salida::where('salida', $salida)->get();
         if ($insumos->count() == 1 && isset($value[0]['despachado']) && $value[0]['despachado'] == 0) {
             return false;
         }
         return true;
     });
     Validator::extend('insumo', function ($attribute, $value) {
         if (!Insumo::where('id', $value)->first()) {
             return false;
         }
         return true;
     });
     Validator::extend('insumo_with_daleted', function ($attribute, $value) {
         if (!insumo::withTrashed()->where('id', $value)->first()) {
             return false;
         }
         return true;
     });
     Validator::extend('deposito', function ($attribute, $value) {
         if (!Deposito::where('id', $value)->first()) {
             return false;
         }
         return true;
     });
     Validator::extend('date_limit_current', function ($attribute, $value) {
         $value = str_replace('/', '-', $value);
         if (strtotime($value) > strtotime(date("Y-m-d"))) {
             return false;
         }
         return true;
     });
     Validator::extend('insumos_ids_array', function ($attribute, $value) {
         if (!is_array($value)) {
             return false;
         }
         foreach ($value as $v) {
             if (!insumos_salida::where('id', $v)->first()) {
                 return false;
             }
         }
         return true;
     });
     Validator::extend('documento_salida', function ($attribute, $value) {
         $documento = Documento::where('id', $value)->first();
         if (!$documento) {
             return false;
         }
         return $documento->naturaleza == 'salida';
     });
     Validator::extend('documento_entrada', function ($attribute, $value) {
         $documento = Documento::where('id', $value)->first();
         if (!$documento) {
             return false;
         }
         return $documento->naturaleza == 'entrada';
     });
     Validator::extend('tercero', function ($attribute, $value, $parameters) {
         $documento = Input::get($parameters[0]);
         $tipo = Documento::where('id', $documento)->value('tipo');
         if ($tipo == 'interno') {
             return true;
         }
         if ($tipo == 'proveedor') {
             return Provedore::where('id', $value)->first();
         }
         if ($tipo == 'servicio') {
             return Departamento::where('id', $value)->first();
         }
         if ($tipo == 'deposito') {
             $deposito = Auth::user()->deposito;
             return Deposito::where('id', $value)->where('id', '!=', $deposito)->first();
         }
     });
     Validator::extend('permissions', function ($attribute, $value) {
         if (!is_array($value)) {
             return false;
         } else {
             foreach ($value as $permiso) {
                 if (!Permission::where('id', $permiso)->first()) {
                     return false;
                 }
             }
         }
         return true;
     });
     Validator::extend('rol', function ($attribute, $value) {
         return Role::where('id', $value)->first();
     });
     Validator::extend('movimiento', function ($attribute, $value, $parameters) {
         $documento = Input::get($parameters[0]);
         $documento = Documento::where('id', $documento)->value('id');
         $deposito = Auth::user()->deposito;
         if (Entrada::where('id', $value)->where('documento', $documento)->where('deposito', $deposito)->first()) {
             return true;
         } else {
             if (Salida::where('id', $value)->where('documento', $documento)->where('deposito', $deposito)->first()) {
                 return true;
             } else {
                 return false;
             }
         }
     });
     Validator::extend('documento', function ($attribute, $value) {
         return Documento::where('id', $value)->first();
     });
     Validator::extend('documento_same_nature', function ($attribute, $value, $parameters) {
         $id = Input::get($parameters[0]);
         $ori_naturaleza = Documento::where('id', $id)->value('naturaleza');
         $up_naturaleza = Documento::where('id', $value)->value('naturaleza');
         return $ori_naturaleza == $up_naturaleza;
     });
     Validator::extend('document_not_equal', function ($attribute, $value, $parameters) {
         $id = Input::get($parameters[0]);
         $ori_documento = Documento::where('id', $id)->value('id');
         $up_documento = Documento::where('id', $value)->value('id');
         return !($ori_documento == $up_documento);
     });
 }
Example #30
0
 public function setGerencias(Request $request)
 {
     $division = Division::where('division', Input::get('division'))->get();
     $division = $division[0]['attributes']['id'];
     $gerencias = Gerencia::all()->where('division_id', $division);
     $departamentos = Departamento::all()->where('division_id', $division);
     if ($request->ajax()) {
         return response()->json(['gerencias' => $gerencias->toArray(), 'departamentos' => $departamentos->toArray()]);
     }
 }