log con filtro y solo cuando editen el usuario
This commit is contained in:
@@ -14,6 +14,7 @@ class ShowLogHistorial extends Component
|
||||
public $entradas;
|
||||
|
||||
public $buscar;
|
||||
public $tipo;
|
||||
public $filtro_fecha;
|
||||
|
||||
public $user_id;
|
||||
@@ -32,6 +33,10 @@ class ShowLogHistorial extends Component
|
||||
}
|
||||
|
||||
|
||||
if ($this->tipo) {
|
||||
$query->where('detalle', 'like', '%' . $this->tipo . '%');
|
||||
}
|
||||
|
||||
if ($this->filtro_fecha) {
|
||||
$query->whereDate('created_at', $this->filtro_fecha);
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ class ShowPlanes extends Component
|
||||
|
||||
|
||||
public $usuario_renovar;
|
||||
public $usuario_renovar_old;
|
||||
public $password_renovar;
|
||||
public $fecha_inicial_renovar;
|
||||
public $fecha_inicial_renovar_old;
|
||||
@@ -211,6 +212,7 @@ class ShowPlanes extends Component
|
||||
$id = $this->id_cuentaVer;
|
||||
|
||||
$renovarCuenta = Cuentas::findOrFail($id);
|
||||
$this->usuario_renovar_old = $renovarCuenta->correo;
|
||||
$this->usuario_renovar = $renovarCuenta->correo;
|
||||
$this->password_renovar = $renovarCuenta->password;
|
||||
$this->fecha_inicial_renovar_old = $renovarCuenta->inicio;
|
||||
@@ -250,10 +252,12 @@ class ShowPlanes extends Component
|
||||
'estado' => $this->estado,
|
||||
]);
|
||||
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha editado la cuenta ' . $cuenta_renovar->correo
|
||||
]);
|
||||
if ( $this->usuario_renovar_old !== $this->usuario_renovar) {
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha editado el usuario de la cuenta ' . $cuenta_renovar->correo
|
||||
]);
|
||||
}
|
||||
|
||||
$this->alert('success', 'Cuenta actualizada correctamente!', [
|
||||
'position' => 'top'
|
||||
@@ -281,7 +285,7 @@ class ShowPlanes extends Component
|
||||
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha editado, renovado y liberado la cuenta ' . $cuenta_renovar->correo
|
||||
'detalle' => 'El usuario ha renovado y liberado la cuenta ' . $cuenta_renovar->correo
|
||||
]);
|
||||
|
||||
$this->alert('success', 'Cuenta renovada y liberada correctamente!', [
|
||||
@@ -307,7 +311,7 @@ class ShowPlanes extends Component
|
||||
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha editado y renovado la cuenta ' . $cuenta_renovar->correo
|
||||
'detalle' => 'El usuario ha renovado la cuenta ' . $cuenta_renovar->correo
|
||||
]);
|
||||
|
||||
$this->alert('success', 'Cuenta renovada correctamente!', [
|
||||
@@ -443,6 +447,12 @@ class ShowPlanes extends Component
|
||||
|
||||
public function confirm_delete_cuenta()
|
||||
{
|
||||
$this->validate([
|
||||
'nota_eliminacion' => 'required',
|
||||
],[
|
||||
'nota_eliminacion.required' => 'La nota es obligatoria',
|
||||
]);
|
||||
|
||||
$cuenta = Cuentas::findOrFail($this->delete_cuenta);
|
||||
|
||||
Log_historial::create([
|
||||
@@ -465,6 +475,12 @@ class ShowPlanes extends Component
|
||||
|
||||
public function confirm_delete_cuentas()
|
||||
{
|
||||
$this->validate([
|
||||
'nota_eliminacion' => 'required',
|
||||
],[
|
||||
'nota_eliminacion.required' => 'La nota es obligatoria',
|
||||
]);
|
||||
|
||||
$cuentas = Cuentas::whereIn('id', $this->delete_1)->get();
|
||||
if ($cuentas) {
|
||||
forEach ($cuentas as $cuenta) {
|
||||
|
||||
Reference in New Issue
Block a user