Skip to content

Commit

Permalink
last
Browse files Browse the repository at this point in the history
  • Loading branch information
SgcWeb2 committed Nov 18, 2021
1 parent c989c3d commit 3aaa649
Show file tree
Hide file tree
Showing 31 changed files with 753 additions and 542 deletions.
16 changes: 9 additions & 7 deletions app/Http/Controllers/CtrBanco.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

class CtrBanco extends Controller
{
public function __construct()
{
// $this->middleware('can:banco.index')->only('index');
// $this->middleware('can:banco.show')->only('show');
}
public function __construct()
{
$this->middleware('can:banco.index')->only('index');
$this->middleware('can:banco.show')->only('show');
}

public function index()
{
return view('banco.index');
Expand All @@ -22,9 +23,10 @@ public function show(Banco $banco)
return view('banco.show', compact('banco'));
}

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

$pdf = PDF::loadView('banco.pdf', compact('bancos'));
return $pdf->stream('bancos.pdf');
}
Expand Down
12 changes: 10 additions & 2 deletions app/Http/Controllers/CtrComunicado.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@

class CtrComunicado extends Controller
{
public function index() {
public function __construct()
{
$this->middleware('can:comunicado.index')->only('index');
$this->middleware('can:comunicado.show')->only('show');
}

public function index()
{
return view('comunicado.index');
}

public function show(Comunicado $comunicado) {
public function show(Comunicado $comunicado)
{
return view('comunicado.show', compact('comunicado'));
}
}
6 changes: 6 additions & 0 deletions app/Http/Controllers/CtrEnfermedad.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

class CtrEnfermedad extends Controller
{
public function __construct()
{
$this->middleware('can:enfermedad.index')->only('index');
$this->middleware('can:enfermedad.show')->only('show');
}

public function index()
{
return view('enfermedad.index');
Expand Down
6 changes: 6 additions & 0 deletions app/Http/Controllers/CtrFondo.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

class CtrFondo extends Controller
{
public function __construct()
{
$this->middleware('can:fondo.index')->only('index');
$this->middleware('can:fondo.show')->only('show');
}

public function index()
{
return view('fondo.index');
Expand Down
8 changes: 7 additions & 1 deletion app/Http/Controllers/CtrGasto.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@

class CtrGasto extends Controller
{
public function index() {
public function __construct()
{
$this->middleware('can:gasto.index')->only('index');
$this->middleware('can:gasto.show')->only('show');
}

public function index() {
return view('gasto.index');
}

Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/CtrInicio.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public function __invoke()
// Si el usuario es un portero

return redirect()->route('visita.index');
} else if ($usuario->hasRole('Propietario')) {

} else if (!$usuario->hasRole('Propietario')) {
// Si el usaurio es un propietario

if (Condominio::first()) {
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/CtrIntegrante.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
class CtrIntegrante extends Controller
{
public function show(Integrante $integrante) {
$this->authorize('view', $integrante);

return view('integrante.show', compact('integrante'));
}

Expand Down
6 changes: 6 additions & 0 deletions app/Http/Controllers/CtrMedicamento.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

class CtrMedicamento extends Controller
{
public function __construct()
{
$this->middleware('can:medicamento.index')->only('index');
$this->middleware('can:medicamento.show')->only('show');
}

public function index() {
return view('medicamento.index');
}
Expand Down
11 changes: 0 additions & 11 deletions app/Http/Controllers/CtrNosotros.php

This file was deleted.

6 changes: 6 additions & 0 deletions app/Http/Controllers/CtrPago.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

class CtrPago extends Controller
{
public function __construct()
{
$this->middleware('can:pago-condominio.index')->only('index');
$this->middleware('can:pago-condominio.show')->only('show');
}

public function create() {
return view('pago.create');
}
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Controllers/CtrPagoPropietario.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@

class CtrPagoPropietario extends Controller
{
public function __construct()
{
$this->middleware('can:pago-propietario.index')->only('index');
$this->middleware('can:pago-propietario.show')->only('show');
$this->middleware('can:pago-propietario.confirmar')->only('confirmar');
}

public function index()
{
return view('pago-propietario.index');
Expand Down
5 changes: 5 additions & 0 deletions app/Http/Controllers/CtrProveedor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

class CtrProveedor extends Controller
{
public function __construct()
{
$this->middleware('can:proveedor.index')->only('index');
$this->middleware('can:proveedor.show')->only('show');
}

public function index()
{
Expand Down
12 changes: 10 additions & 2 deletions app/Http/Controllers/CtrServicio.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@

class CtrServicio extends Controller
{
public function index() {
public function __construct()
{
$this->middleware('can:servicio.index')->only('index');
$this->middleware('can:servicio.show')->only('show');
}

public function index()
{
return view('servicio.index');
}

public function show(Servicio $servicio) {
public function show(Servicio $servicio)
{
return view('servicio.show', compact('servicio'));
}

Expand Down
5 changes: 5 additions & 0 deletions app/Http/Controllers/CtrTipoUnidad.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

class CtrTipoUnidad extends Controller
{
public function __construct()
{
$this->middleware('can:tipo-unidad.index')->only('index');
$this->middleware('can:tipo-unidad.show')->only('show');
}

public function index()
{
Expand Down
77 changes: 18 additions & 59 deletions app/Http/Livewire/Admin/Administracion.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,158 +2,117 @@

namespace App\Http\Livewire\Admin;

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

class Administracion extends Component
{
public $monto;
public $moneda = 'Bolívar';

public $openMensualidad = false;

public $busqueda = '';
public $orden = 'created_at';
public $direccion = 'desc';
public $cantidad = '10';

protected $rules = [
'monto' => 'required|numeric|gt:0',
'moneda' => 'required',
];

public function mount()
{
$this->monto = Mensualidad::orderBy('created_at', 'desc')->first()->monto;
$this->moneda = Mensualidad::orderBy('created_at', 'desc')->first()->moneda;
}

public function render()
{
$menu = [
[
'nombre' => 'Lista de unidades',
'ruta' => 'admin.unidad.index',
'imagen' => 'img/iconos/lista-unidades.png',
'can' => 'admin.unidad.index',
],
[
'nombre' => 'Lista de habitantes',
'ruta' => 'admin.habitante.index',
'imagen' => 'img/iconos/lista-habitantes.png',
'can' => 'integrante.index',
],
[
'nombre' => 'Confirmar pagos',
'ruta' => 'pago.confirmar',
'imagen' => 'img/iconos/confirmarPagos.png',
'can' => 'pago-propietario.confirmar',
],
[
'nombre' => 'Pagar gastos',
'ruta' => 'pago.create',
'imagen' => 'img/iconos/pagar-gastos.png',
'can' => 'pago-condominio.create',
],
[
'nombre' => 'Comunicados',
'ruta' => 'comunicado.index',
'imagen' => 'img/iconos/comunicados.png',
'can' => 'comunicado.index',
],
[
'nombre' => 'Registrar gastos',
'ruta' => 'gasto.index',
'imagen' => 'img/iconos/registrar-gastos.png',
'can' => 'gasto.index',
],
[
'nombre' => 'Aplicar sanciones',
'ruta' => 'aplicar-sancion.index',
'imagen' => 'img/iconos/aplicar-sanciones.png',

'can' => 'sancion.aplicar',
],
[
'nombre' => 'Lista de usuarios',
'ruta' => 'admin.usuario.index',
'imagen' => 'img/iconos/ListaUsuario.png',

'can' => 'admin.usuario.index',
],
[
'nombre' => 'Gestionar responsables',
'ruta' => 'admin.administrador.index',
'imagen' => 'img/iconos/gestionarResponsable.png',

'can' => 'admin.administrador.index',
],
[
'nombre' => 'Gestionar bancos',
'ruta' => 'banco.index',
'imagen' => 'img/iconos/banco.png',

'can' => 'banco.index',
],
[
'nombre' => 'Gestionar cuentas',
'ruta' => 'cuenta.index',
'imagen' => 'img/iconos/cuentaBanco.png',

'can' => 'cuenta.index',
],
[
'nombre' => 'Gestionar sanciones',
'ruta' => 'admin.sancion.index',
'imagen' => 'img/iconos/gestionar-sanciones.png',
'can' => 'sancion.index',
],
[
'nombre' => 'Gestionar categorías',
'ruta' => 'categoria.index',
'imagen' => 'img/iconos/gestionar-categorias.png',

'can' => 'categoria.index',
],
[
'nombre' => 'Gestionar servicios',
'ruta' => 'servicio.index',
'imagen' => 'img/iconos/servicios.png',

'can' => 'servicio.index',
],
[
'nombre' => 'Gestionar enfermedades',
'ruta' => 'enfermedad.index',
'imagen' => 'img/iconos/gestionar-enfermedades.png',

'can' => 'enfermedad.index',
],
[
'nombre' => 'Gestionar medicamentos',
'ruta' => 'medicamento.index',
'imagen' => 'img/iconos/gestionar-medicamentos.png',

'can' => 'medicamento.index',
],
[
'nombre' => 'Gestionar tipos de unidad',
'ruta' => 'tipo-unidad.index',
'imagen' => 'img/iconos/gestionarUnidad.png',

'can' => 'tipo-unidad.index',
],
];

$mensualidades = Mensualidad::where('fecha', 'LIKE', '%' . $this->busqueda . '%')
->orderBy($this->orden, $this->direccion)
->paginate($this->cantidad);

return view('livewire.admin.administracion', compact('mensualidades', 'menu'));
}

public function updated($propertyName)
{
$this->validateOnly($propertyName);
}

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

Mensualidad::create([
'monto' => $this->monto,
'moneda' => $this->moneda,
]);

$this->reset('openMensualidad');

$this->monto = Mensualidad::orderBy('created_at', 'desc')->first()->monto;
$this->moneda = Mensualidad::orderBy('created_at', 'desc')->first()->moneda;

$this->emit('alert', 'La mensaulidad fue actualizada con éxito');
return view('livewire.admin.administracion', compact('menu'));
}
}
Loading

0 comments on commit 3aaa649

Please sign in to comment.