From 4cb5f33ccea2f6d8cbf3b42052f887338c2314d2 Mon Sep 17 00:00:00 2001 From: Felipe Date: Tue, 30 Apr 2024 09:40:36 -0500 Subject: [PATCH] logpromociones y menu mas arriba --- app/Http/Livewire/ShowPromociones.php | 16 ++++++++++++++-- resources/views/layouts/navigation.blade.php | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/ShowPromociones.php b/app/Http/Livewire/ShowPromociones.php index c8c6608..834a28c 100755 --- a/app/Http/Livewire/ShowPromociones.php +++ b/app/Http/Livewire/ShowPromociones.php @@ -7,6 +7,7 @@ use App\Models\Configuracione; use App\Models\Cuentas; use App\Models\Historial_cuenta; use App\Models\Historiale; +use App\Models\Log_general; use App\Models\Pendientes; use App\Models\Promocion_tarifa; use App\Models\Promociones; @@ -207,6 +208,8 @@ class ShowPromociones extends Component public function pagar() { + dd($this->consulta); + $this->validate(); if ($this->cantidad_comprarPromo == 0) { @@ -331,8 +334,6 @@ class ShowPromociones extends Component 'confirmButtonText' => 'Sí, comprar.', ]); } - - } else { $descuento = Saldo::where('usuario_id', Auth::user()->id)->first(); $saldo_anterior = $descuento->valor; @@ -341,6 +342,12 @@ class ShowPromociones extends Component if ($cobro) { $historial->update(['estado' => 'activo']); + + $logsGeneral = new Log_general(); + $logsGeneral->user_id = Auth::user()->id; + $logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' ha comprado la promocion ' . $this->consulta->nombre . ' - ' . $this->consulta->descripcion . ' cantidad de ' . $this->historial->cantidad ?? '' . ' por un valor de $' . $this->historial->valor ?? ''; + $logsGeneral->save(); + $this->modalComprarPromo = false; $this->credenciales($historial); } else { @@ -376,6 +383,11 @@ class ShowPromociones extends Component } } + $logsGeneral = new Log_general(); + $logsGeneral->user_id = Auth::user()->id; + $logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' ha comprado la promocion ' . $this->consulta->nombre . ' - ' . $this->consulta->descripcion . ' cantidad de ' . $this->historial->cantidad ?? '' . ' por un valor de $' . $this->historial->valor ?? '' . ' y algunos han quedado pendientes'; + $logsGeneral->save(); + $this->credenciales($this->historial); } else { Historial_cuenta::whereIn('id', $this->n)->delete(); diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php index 3c808da..cc42b75 100755 --- a/resources/views/layouts/navigation.blade.php +++ b/resources/views/layouts/navigation.blade.php @@ -91,7 +91,7 @@