Skip to content

Commit

Permalink
Eleccion de encuesta a visualizar para Navieras
Browse files Browse the repository at this point in the history
  • Loading branch information
elyambay committed Sep 7, 2017
1 parent 69b31e5 commit 1cd7e6f
Show file tree
Hide file tree
Showing 19 changed files with 990 additions and 218 deletions.
2 changes: 1 addition & 1 deletion app/Cargo.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Cargo extends Model
{
protected $table = "cargos";

protected $fillable = ["descripcion", "area_id", "nivel_id", "detalle"];
protected $fillable = ["descripcion", "area_id", "nivel_id", "is_temporal", "detalle"];

public function encuestasCargo(){
return $this->hasMany("App\Encuestas_cargo");
Expand Down
11 changes: 11 additions & 0 deletions app/Http/Controllers/CargosController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public function create(){

public function store(Request $request){
$dbData = new Cargo($request->all());
if(!is_null($request->is_temporal)){
$dbData->is_temporal = 1;
}else{
$dbData->is_temporal = 0;
}

$dbData->save();
return redirect()->route('cargos.index');
}
Expand All @@ -47,6 +53,11 @@ public function update(Request $request, $id){

$dbData = Cargo::find($id);
$dbData->fill($request->all());
if(!is_null($request->is_temporal)){
$dbData->is_temporal = 1;
}else{
$dbData->is_temporal = 0;
}
$dbData->save();
return redirect()->route('cargos.index');
}
Expand Down
8 changes: 6 additions & 2 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ public function index()
return view('home');
}else{
$dbEmpresa = Auth::user()->empresa;
$dbEncuesta = Cabecera_encuesta::where('empresa_id', $dbEmpresa->id)->whereRaw('id = (select max(id) from cabecera_encuestas where empresa_id = '. $dbEmpresa->id.')')->first();
return view('clientes.home')->with('dbEmpresa', $dbEmpresa)->with('dbEncuesta', $dbEncuesta);
$dbEncuestas = Cabecera_encuesta::where('empresa_id', $dbEmpresa->id)->orderBy('id', 'DESC')->get();
$dbEncuesta = $dbEncuestas->first();
$dbEncuestaAnt = $dbEncuestas->get(1);
return view('clientes.home')->with('dbEmpresa', $dbEmpresa)
->with('dbEncuesta', $dbEncuesta)
->with('dbEncuestaAnt' , $dbEncuestaAnt);
}

}
Expand Down
270 changes: 221 additions & 49 deletions app/Http/Controllers/ReporteController.php

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*"
"laravel/framework": "5.3.*",
"maatwebsite/excel": "^2.1",
"barryvdh/laravel-dompdf": "^0.8.1"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
Expand Down
Loading

0 comments on commit 1cd7e6f

Please sign in to comment.