This commit is contained in:
lizandrogd
2024-04-29 15:34:42 -05:00
parent 82710bf517
commit 5890584bb8
+9 -1
View File
@@ -346,6 +346,10 @@ class ShowServicios extends Component
}
}
} else {
$logsGeneral = new Log_general();
$logsGeneral->user_id = Auth::user()->id;
$logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' Tuvo error de "No hay cuentas disponibles" Comprando el servicio ' . $servicioNombre . ' - ' . $cuentasMostar . ' cantidad de ' . $this->cantidad_tarjetaPlan . ' por un valor de $' . $total_valor;
$logsGeneral->save();
$this->alert('warning', 'No hay cuentas disponibles!', [
'position' => 'top'
]);
@@ -353,7 +357,7 @@ class ShowServicios extends Component
}
$descuento = Saldo::where('usuario_id', Auth::user()->id)->first();
$saldo_anterior = $descuento->valor;
$saldo_anterior = $descuento->valor ?? 0;
$nuevo_saldo = $saldo_anterior - $total_valor;
$cobro = $descuento->update(['valor' => $nuevo_saldo]);
if ($cobro) {
@@ -366,6 +370,10 @@ class ShowServicios extends Component
$this->credenciales($historial);
} else {
$logsGeneral = new Log_general();
$logsGeneral->user_id = Auth::user()->id;
$logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' Tuvo un error con el cobro del servicio ' . $servicioNombre . ' - ' . $cuentasMostar . ' cantidad de ' . $this->cantidad_tarjetaPlan . ' por un valor de $' . $total_valor;
$logsGeneral->save();
$eliminar = Historial_cuenta::where('historial_id', $historial->id)->delete();
$this->alert('warning', 'Error en el cobro, comuniquese con soporte!', [
'position' => 'top'