Skip to content

Commit

Permalink
last
Browse files Browse the repository at this point in the history
  • Loading branch information
SgcWeb2 committed Nov 6, 2021
1 parent 10396cc commit e0d3d8b
Show file tree
Hide file tree
Showing 49 changed files with 943 additions and 322 deletions.
41 changes: 40 additions & 1 deletion app/Http/Controllers/Admin/CtrUnidad.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Http\Controllers\Controller;
use App\Models\Unidad;
use PDF;

class CtrUnidad extends Controller
{
Expand All @@ -12,7 +13,45 @@ public function index()
return view('admin.unidad.index');
}

public function show(Unidad $unidad) {
public function show(Unidad $unidad)
{
return view('admin.unidad.show', compact('unidad'));
}

public function exportarConPropietario()
{
$titulo = 'Lista de unidades con propietario';
$unidades = Unidad::has('propietario')->get();
// return view('admin.unidad.pdf', compact('unidades', 'titulo'));

$pdf = PDF::loadView('admin.unidad.pdf', compact('unidades', 'titulo'));
return $pdf->stream('unidades-con-propietario.pdf');
}

public function exportarSinPropietario()
{
$titulo = 'Lista de unidades sin propietario';
$unidades = Unidad::doesntHave('propietario')->get();

$pdf = PDF::loadView('admin.unidad.pdf', compact('unidades', 'titulo'));
return $pdf->stream('unidades-sin-propietario.pdf');
}

public function exportarConHabitantes()
{
$titulo = 'Lista de unidades con habitantes';
$unidades = Unidad::has('integrantes')->get();

$pdf = PDF::loadView('admin.unidad.pdf', compact('unidades', 'titulo'));
return $pdf->stream('unidades-con-habitantes.pdf');
}

public function exportarSinHabitantes()
{
$titulo = 'Lista de unidades sin habitantes';
$unidades = Unidad::doesntHave('integrantes')->get();

$pdf = PDF::loadView('admin.unidad.pdf', compact('unidades', 'titulo'));
return $pdf->stream('unidades-sin-habitantes.pdf');
}
}
12 changes: 10 additions & 2 deletions app/Http/Controllers/CtrBanco.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
namespace App\Http\Controllers;

use App\Models\Banco;
use PDF;

class CtrBanco extends Controller
{
public function __construct()
{
$this->middleware('can:banco.index')->only('index');
$this->middleware('can:banco.show')->only('show');
// $this->middleware('can:banco.index')->only('index');
// $this->middleware('can:banco.show')->only('show');
}
public function index()
{
Expand All @@ -20,4 +21,11 @@ public function show(Banco $banco)
{
return view('banco.show', compact('banco'));
}

public function exportar() {
$bancos = Banco::all();

$pdf = PDF::loadView('banco.pdf', compact('bancos'));
return $pdf->stream('bancos.pdf');
}
}
8 changes: 8 additions & 0 deletions app/Http/Controllers/CtrCategoria.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http\Controllers;

use App\Models\Categoria;
use PDF;

class CtrCategoria extends Controller
{
Expand All @@ -15,4 +16,11 @@ public function show(Categoria $categoria)
{
return view('categoria.show', compact('categoria'));
}

public function exportar() {
$categorias = Categoria::all();

$pdf = PDF::loadView('categoria.pdf', compact('categorias'));
return $pdf->stream('categorias.pdf');
}
}
12 changes: 11 additions & 1 deletion app/Http/Controllers/CtrCuenta.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@
namespace App\Http\Controllers;

use App\Models\Cuenta;
use PDF;

class CtrCuenta extends Controller
{
public function index()
public function index()
{
return view('cuenta.index');
}

public function show(Cuenta $cuenta)
{
return view('cuenta.show', compact('cuenta'));
}

public function exportar()
{
$cuentas = Cuenta::all();

$pdf = PDF::loadView('cuenta.pdf', compact('cuentas'));
return $pdf->stream('cuentas.pdf');
}
}
15 changes: 13 additions & 2 deletions app/Http/Controllers/CtrEnfermedad.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@
namespace App\Http\Controllers;

use App\Models\Enfermedad;
use PDF;

class CtrEnfermedad extends Controller
{
public function index() {
public function index()
{
return view('enfermedad.index');
}

public function show(Enfermedad $enfermedad) {
public function show(Enfermedad $enfermedad)
{
return view('enfermedad.show', compact('enfermedad'));
}

public function exportar()
{
$enfermedades = Enfermedad::all();

$pdf = PDF::loadView('enfermedad.pdf', compact('enfermedades'));
return $pdf->stream('enfermedades.pdf');
}
}
16 changes: 13 additions & 3 deletions app/Http/Controllers/CtrPagoPropietario.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,29 @@
namespace App\Http\Controllers;

use App\Models\PagoPropietario;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\Auth;

class CtrPagoPropietario extends Controller
{
public function index() {
public function index()
{
return view('pago-propietario.index');
}

public function create() {
public function create()
{
return view('pago-propietario.create');
}

public function show(PagoPropietario $pagoPropietario) {
public function show(PagoPropietario $pagoPropietario)
{
$pago = $pagoPropietario;
return view('pago-propietario.show', compact('pago'));
}

public function confirmar()
{
return view('pago-propietario.confirmar');
}
}
26 changes: 0 additions & 26 deletions app/Http/Controllers/PDFController.php

This file was deleted.

6 changes: 5 additions & 1 deletion app/Http/Livewire/Admin/Administracion.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Http\Livewire\Admin;

use App\Models\Interes;
use App\Models\Mensualidad;
use Livewire\Component;

Expand Down Expand Up @@ -42,6 +41,11 @@ public function render()
'ruta' => 'admin.habitante.index',
'imagen' => 'img/iconos/lista-habitantes.png',
],
[
'nombre' => 'Confirmar pagos',
'ruta' => 'pago.confirmar',
'imagen' => 'img/iconos/pagar-gastos.png',
],
[
'nombre' => 'Pagar gastos',
'ruta' => 'pago.create',
Expand Down
52 changes: 4 additions & 48 deletions app/Http/Livewire/Admin/Unidad/TablaUnidad.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ class TablaUnidad extends Component

public $readyToLoad = false;

public $openEdit = false;
public $openDestroy = false;

protected $rules = [
'categoria.nombre' => 'required|max:25',
'categoria.descripcion' => 'max:255',
];

protected $listeners = ['render'];

public function mount()
Expand All @@ -37,11 +29,12 @@ public function mount()
public function render()
{
if ($this->readyToLoad) {
$unidades = Unidad::where('numero', 'LIKE', '%'.$this->busqueda.'%')
->orWhere('direccion', 'LIKE', '%'.$this->busqueda.'%')
$unidades = Unidad::where('numero', 'LIKE', '%' . $this->busqueda . '%')
->orWhere('direccion', 'LIKE', '%' . $this->busqueda . '%')
->orderBy($this->orden, $this->direccion)
->paginate($this->cantidad);
} else {
// $unidades = Unidad::doesntHave('propietario');
} else {
$unidades = [];
}

Expand All @@ -58,11 +51,6 @@ public function updatingCantidad()
$this->resetPage();
}

public function loadUnidades()
{
$this->readyToLoad = true;
}

public function orden($orden)
{
if ($this->orden == $orden) {
Expand All @@ -76,36 +64,4 @@ public function orden($orden)
$this->direccion = 'asc';
}
}

public function edit(Unidad $unidad)
{
$this->unidad = $unidad;
$this->openEdit = true;
}

public function update()
{
$this->validate();

$this->unidad->save();

$this->reset('openEdit');

$this->emit('alert', 'La unidad se actualizó satisfactoriamente');
}

public function destroy(Unidad $unidad)
{
$this->unidad = $unidad;
$this->openDestroy = true;
}

public function delete()
{
$this->unidad->delete();

$this->reset('openDestroy');

$this->emit('alert', 'La unidad se eliminó satisfactoriamente');
}
}
Loading

0 comments on commit e0d3d8b

Please sign in to comment.