From c5ef47639688ed5110369e021d22522898513ac3 Mon Sep 17 00:00:00 2001 From: Felipe Date: Sat, 27 Apr 2024 11:52:54 -0500 Subject: [PATCH] update --- app/Http/Livewire/ShowPlanes.php | 19 ++++++++++++++----- app/Http/Livewire/ShowPromociones.php | 4 ++-- .../views/components/listado-planes.blade.php | 2 +- .../views/livewire/show-planes.blade.php | 4 ++-- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/Http/Livewire/ShowPlanes.php b/app/Http/Livewire/ShowPlanes.php index b4a232d..5c77ed3 100755 --- a/app/Http/Livewire/ShowPlanes.php +++ b/app/Http/Livewire/ShowPlanes.php @@ -5,6 +5,7 @@ namespace App\Http\Livewire; use App\Models\Cuentas; use App\Models\Historiale; use App\Models\Historial_cuenta; +use App\Models\Log_general; use App\Models\Log_historial; use App\Models\Notificacion; use App\Models\Pendientes; @@ -193,12 +194,13 @@ class ShowPlanes extends Component } //modal Ver - public function ver($id, $nom) + public function ver(Cuentas $cuenta) { - $this->id_cuentaVer = $id; - $this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $id)->first(); - //dd($this->consulta_verUsuarios); - $this->nombre_servicios = $nom; + $this->id_cuentaVer = $cuenta->id; + $this->consulta_verUsuarios = $cuenta; + $this->nombre_servicios = $this->consulta_verUsuarios->servicio->nombre; + + $this->ver = true; } public function openRenovar() { @@ -683,6 +685,13 @@ class ShowPlanes extends Component 'position' => 'top' ]); } + + $logsGeneral = new Log_general(); + $logsGeneral->user_id = Auth::user()->id; + $logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' ha añadido el usuario ' . $this->searchTerm . ' a una cuenta '; + // . ' a la cuenta ' . $this->consulta_verUsuarios->name . ' - ' . $this->consulta_verUsuarios->email; + $logsGeneral->save(); + $this->addUser = false; $this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $this->id_cuentaVer)->first(); } diff --git a/app/Http/Livewire/ShowPromociones.php b/app/Http/Livewire/ShowPromociones.php index 9b3f64d..d0c7d14 100755 --- a/app/Http/Livewire/ShowPromociones.php +++ b/app/Http/Livewire/ShowPromociones.php @@ -277,9 +277,9 @@ class ShowPromociones extends Component $cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio', '>=', $this->fecha)->whereDate('vencimiento', '>=', $this->fecha_final_1) ->whereDate('vencimiento', '<=', $this->fecha_final_2) - ->Orderby('created_at', 'ASC')->with('historiales')->withCount('historiales')->where('estado', 'pendiente')->having('historiales_count', '==', 0)->first(); + ->Orderby('created_at', 'DESC')->with('historiales')->withCount('historiales')->where('estado', 'pendiente')->having('historiales_count', '==', 0)->first(); } else { - $cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio', '>=', $this->fecha)->Orderby('created_at', 'ASC')->with('historiales')->withCount('historiales')->where('estado', 'activo')->having('historiales_count', '<=', (int)$faltante)->first(); + $cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio', '>=', $this->fecha)->Orderby('created_at', 'DESC')->with('historiales')->withCount('historiales')->where('estado', 'activo')->having('historiales_count', '<=', (int)$faltante)->first(); } if (!is_null($cuenta)) { diff --git a/resources/views/components/listado-planes.blade.php b/resources/views/components/listado-planes.blade.php index 62b5c58..1e4e22d 100755 --- a/resources/views/components/listado-planes.blade.php +++ b/resources/views/components/listado-planes.blade.php @@ -72,7 +72,7 @@ @endif - diff --git a/resources/views/livewire/show-planes.blade.php b/resources/views/livewire/show-planes.blade.php index fd87562..570ebb9 100755 --- a/resources/views/livewire/show-planes.blade.php +++ b/resources/views/livewire/show-planes.blade.php @@ -260,10 +260,10 @@ @endif - {{ \Carbon\Carbon::parse($verUsuarios->fecha_inicio)->format('y/m/d') }} + {{ \Carbon\Carbon::parse($consulta_verUsuarios->inicio)->format('d/m/Y') }} - {{ \Carbon\Carbon::parse($verUsuarios->fecha_final)->format('y/m/d') }} + {{ \Carbon\Carbon::parse($consulta_verUsuarios->vencimiento)->format('d/m/Y') }} @php