logpromociones y menu mas arriba

This commit is contained in:
Felipe
2024-04-30 09:40:36 -05:00
parent 80c8748182
commit 4cb5f33cce
2 changed files with 15 additions and 3 deletions
+14 -2
View File
@@ -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();