Skip to content

Commit

Permalink
last
Browse files Browse the repository at this point in the history
ok
  • Loading branch information
SgcWeb2 committed Nov 7, 2021
1 parent 1ca1337 commit 2421c67
Show file tree
Hide file tree
Showing 28 changed files with 588 additions and 122 deletions.
12 changes: 10 additions & 2 deletions app/Http/Controllers/CtrPagoPropietario.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Http\Controllers;

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

class CtrPagoPropietario extends Controller
{
Expand All @@ -28,4 +28,12 @@ public function confirmar()
{
return view('pago-propietario.confirmar');
}

public function exportarRecibo(PagoPropietario $pago)
{
$condominio = Condominio::first();

$pdf = PDF::loadView('pago-propietario.recibo', compact('pago', 'condominio'));
return $pdf->stream('recibo.pdf');
}
}
6 changes: 6 additions & 0 deletions app/Http/Livewire/Admin/Administracion.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ public function render()
'ruta' => 'admin.usuario.index',
'imagen' => 'img/iconos/banco.png',

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

],
[
'nombre' => 'Gestionar bancos',
Expand Down
10 changes: 9 additions & 1 deletion app/Http/Livewire/Admin/Administrador/NuevoAdministrador.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Models\Administrador;
use App\Models\Integrante;
use Carbon\Carbon;
use Illuminate\Support\Str;
use Illuminate\Validation\Rule;
use Livewire\Component;
Expand All @@ -20,6 +21,7 @@ class NuevoAdministrador extends Component
public $apellido;
public $segundoApellido = null;
public $fecha_nacimiento;
public $edad;
public $codigo = '0412';
public $telefono = null;
public $email;
Expand All @@ -35,7 +37,6 @@ protected function rules()
'documento' => [
'required',
'digits_between:6,8',
// Rule::unique()
],
'nombre' => 'required|max:20',
'segundoNombre' => 'nullable|max:20',
Expand Down Expand Up @@ -89,6 +90,11 @@ public function updatedDocumento()
$this->buscarAdministrador();
}

public function updatedFechaNacimiento()
{
$this->edad = Carbon::parse($this->fecha_nacimiento)->age;
}

private function buscarIntegrante()
{
$integrante = Integrante::where('letra', $this->letra)
Expand Down Expand Up @@ -119,6 +125,8 @@ private function buscarIntegrante()
'email',
]);
}

$this->edad = Carbon::parse($this->integrante->fecha_nacimiento)->age;
}

public function buscarAdministrador()
Expand Down
61 changes: 9 additions & 52 deletions app/Http/Livewire/Admin/Unidad/ShowUnidad.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Models\Propietario;
use App\Models\Unidad;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Support\Str;
use Livewire\Component;

Expand All @@ -19,6 +20,7 @@ class ShowUnidad extends Component
public $ci;
public $codigo = '0412';
public $telefono;
public $edad;

public $openAsignar = false;
public $openCambiar = false;
Expand Down Expand Up @@ -77,6 +79,11 @@ public function updatedCi()
$this->buscarIntegrante();
}

public function updatedIntegranteFechaNacimiento()
{
$this->edad = Carbon::parse($this->integrante->fecha_nacimiento)->age;
}

private function buscarIntegrante()
{
$integrante = Integrante::where('letra', $this->letra)
Expand All @@ -90,6 +97,8 @@ private function buscarIntegrante()
$this->integrante = new Integrante;
$this->reset(['codigo', 'telefono']);
}

$this->edad = Carbon::parse($this->integrante->fecha_nacimiento)->age;
}

public function asignarPropietario()
Expand Down Expand Up @@ -143,42 +152,6 @@ public function cambiarPropietario()
$this->asignarPropietario();

$this->reset('openCambiar');

// $integrante = Integrante::where('letra', $this->integrante->letra)
// ->where('documento', $this->integrante->documento)->first();

// if ($integrante) {
// $this->integrante = $integrante;
// } else {
// $this->integrante->telefono = $this->codigo . '-' . $this->telefono;
// $this->integrante->save();
// }

// $propietario = new Propietario;
// $propietario->documento = $this->documento;
// $propietario->integrante()->associate($this->integrante);
// $propietario->user()->associate(User::create([
// 'name' => $this->integrante->nombre . ' ' . $this->integrante->apellido,
// 'email' => $this->integrante->email,
// 'password' => bcrypt('password'),
// ]));

// $propietario->save();

// $this->unidad->propietario()->associate($propietario);
// $this->unidad->save();

// $this->reset([
// 'openCambiar',
// 'documento',
// 'codigo',
// 'telefono',
// ]);

// $this->unidad = new Unidad;
// $this->integrante = new Integrante;

// $this->emit('alert', 'El propietario fue cambiado satisfactoriamente');
}

public function retirar()
Expand All @@ -196,20 +169,4 @@ public function retirar()

$this->reset('openRetirar');
}

// public function destroy(Integrante $integrante)
// {
// $this->integrante = $integrante;
// $this->openDestroy = true;
// }

// public function remove()
// {
// $this->integrante->delete();

// $this->reset('openDestroy');

// $this->emitTo('unidad.show-unidad', 'render');
// $this->emit('alert', 'El integrante fue removido satisfactoriamente');
// }
}
76 changes: 56 additions & 20 deletions app/Http/Livewire/Gasto/NuevoGasto.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,47 @@ class NuevoGasto extends Component
public $selectAll = false;
public $selectPage = false;

protected function rules()
{
return [
'descripcion' => 'required|max:255',
'tipo' => 'required',
'numeroMeses' => 'required_if:tipo,Extraordinario',
'asamblea.id' => 'exclude_if:tipo,Ordinario|required_if:elegidoAsamblea,si',
'calculo' => 'required|not_in:----',
'comienzoCobro' => 'required|date|after:last month',
'moneda' => 'required',
'monto' => 'required|numeric',
'observaciones' => 'nullable',
'proveedor.id' => 'required|not_in:0',
'factura' => 'required',
'servicios' => 'exclude_if:proveedor.id,0|min:1',
'montos.*' => 'exclude_if:servicios.*,false|required_with:servicios.*|numeric|gt:0',
];
}
protected $rules = [
'descripcion' => [
'required',
'max:255',
],
'tipo' => 'required',
'numeroMeses' => 'required_if:tipo,Extraordinario',
'asamblea.id' => [
'exclude_if:tipo,Ordinario',
'required_if:elegidoAsamblea,si',
],
'calculo' => 'required',
'comienzoCobro' => [
'required',
'date',
'after:last month',
],
'moneda' => 'required',
'monto' => [
'required',
'numeric',
],
'observaciones' => 'nullable',
'proveedor.id' => [
'required',
'not_in:0',
],
'factura' => 'required',
'servicios' => [
'exclude_if:proveedor.id,0',
'array',
'min:1',
],
'montos.*' => [
// Parece ser que esta validación es la que está causando el error -_-
// 'exclude_if:servicios.*,false',
'required_with:servicios.*',
'numeric',
'gt:0',
],
];

protected $messages = [
'comienzoCobro.after' => 'El comienzo de cobro no puede ser un mes anterior al actual.',
Expand All @@ -74,6 +97,7 @@ public function mount()
{
$this->asamblea = new Asamblea;
$this->proveedor = new Proveedor;
$this->proveedor->id = 0;
}

public function render()
Expand Down Expand Up @@ -125,9 +149,20 @@ public function updatingAsamblea($value)
$this->asamblea = $value == '--' ? new Asamblea : Asamblea::find($value);
}

public function updatingCalculo($value)
{
$this->calculo = $value == '----' ? '' : $value;
$this->validateOnly('calculo');
}

public function updatingProveedor($value)
{
$this->proveedor = $value == '----' ? new Proveedor : Proveedor::find($value);
if ($value == '----') {
$this->proveedor = new Proveedor;
$this->proveedor->id = 0;
} else {
Proveedor::find($value);
}
}

public function updatedProveedor()
Expand All @@ -136,10 +171,10 @@ public function updatedProveedor()
$this->selectPage = false;

$this->servicios = [];
$this->montos = [];

foreach ($this->listaServicios as $servicio) {
$this->montos[$servicio->id] = '';
// $this->montos = [];
}
}

Expand Down Expand Up @@ -253,6 +288,7 @@ public function save()

$this->asamblea = new Asamblea;
$this->proveedor = new Proveedor;
$this->proveedor->id = 0;

$this->emitTo('gasto.tabla-gasto', 'render');
$this->emit('alert', 'El gasto se registró satisfactoriamente');
Expand Down
Loading

0 comments on commit 2421c67

Please sign in to comment.