nota de eliminacion
This commit is contained in:
@@ -110,10 +110,14 @@ class ShowPlanes extends Component
|
||||
|
||||
public $editarTarifaRol = false;
|
||||
|
||||
public $notaEliminarModal = false;
|
||||
public $notaEliminarVariosModal = false;
|
||||
public $nota_eliminacion;
|
||||
|
||||
public function getListeners()
|
||||
{
|
||||
return [
|
||||
'confirmed', 'siRenovar', 'noRenovar'
|
||||
'siRenovar', 'noRenovar'
|
||||
];
|
||||
}
|
||||
|
||||
@@ -215,7 +219,7 @@ class ShowPlanes extends Component
|
||||
}
|
||||
public function saveRenovar()
|
||||
{
|
||||
if($this->fecha_inicial_renovar_old !== $this->fecha_inicial_renovar || $this->fecha_final_renovar_old !== $this->fecha_final_renovar){
|
||||
if ($this->fecha_inicial_renovar_old !== $this->fecha_inicial_renovar || $this->fecha_final_renovar_old !== $this->fecha_final_renovar) {
|
||||
$this->alert('warning', '¿Desea también desvincular todos los usuarios de esta cuenta?', [
|
||||
'position' => 'center',
|
||||
'timer' => '60000',
|
||||
@@ -231,7 +235,7 @@ class ShowPlanes extends Component
|
||||
'cancelButtonText' => 'No, solo renovar',
|
||||
'confirmButtonText' => 'Si, liberar cuenta',
|
||||
]);
|
||||
}else{
|
||||
} else {
|
||||
$cuenta_renovar = Cuentas::find($this->id_cuentaVer);
|
||||
|
||||
Cuentas::where('id', $this->id_cuentaVer)->update([
|
||||
@@ -255,7 +259,6 @@ class ShowPlanes extends Component
|
||||
$this->ver = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function siRenovar()
|
||||
{
|
||||
$id = $this->id_cuentaVer;
|
||||
@@ -284,7 +287,6 @@ class ShowPlanes extends Component
|
||||
$this->renovar = false;
|
||||
$this->ver = false;
|
||||
}
|
||||
|
||||
public function noRenovar()
|
||||
{
|
||||
$id = $this->id_cuentaVer;
|
||||
@@ -311,7 +313,6 @@ class ShowPlanes extends Component
|
||||
$this->renovar = false;
|
||||
$this->ver = false;
|
||||
}
|
||||
|
||||
/* ------------- CREAR ------------- */
|
||||
public function createNewCuenta()
|
||||
{
|
||||
@@ -432,31 +433,53 @@ class ShowPlanes extends Component
|
||||
public function delete_cuenta($id)
|
||||
{
|
||||
$this->delete_cuenta = $id;
|
||||
$this->alert('warning', '¿Eliminar cuenta?', [
|
||||
'position' => 'center',
|
||||
'timer' => '10000',
|
||||
'toast' => false,
|
||||
'text' => 'Esta seguro',
|
||||
'showConfirmButton' => true,
|
||||
'onConfirmed' => 'confirmed',
|
||||
'showDenyButton' => false,
|
||||
'onDenied' => '',
|
||||
'showCancelButton' => true,
|
||||
'onDismissed' => '',
|
||||
'cancelButtonText' => 'Salir',
|
||||
'confirmButtonText' => 'Si',
|
||||
]);
|
||||
|
||||
$this->notaEliminarModal = true;
|
||||
}
|
||||
|
||||
public function confirmed()
|
||||
public function confirm_delete_cuenta()
|
||||
{
|
||||
Cuentas::where('id', $this->delete_cuenta)->delete();
|
||||
$cuenta = Cuentas::findOrFail($this->delete_cuenta);
|
||||
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha eliminado la cuenta ' . $cuenta->correo . ' nota de eliminacion: ' . $this->nota_eliminacion
|
||||
]);
|
||||
|
||||
$cuenta->delete();
|
||||
$this->notaEliminarModal = false;
|
||||
|
||||
$this->alert('success', 'Cuenta eliminada correctamente!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
}
|
||||
|
||||
public function eliminarCuentas()
|
||||
{
|
||||
$this->notaEliminarVariosModal = true;
|
||||
}
|
||||
|
||||
public function confirm_delete_cuentas()
|
||||
{
|
||||
$cuentas = Cuentas::whereIn('id', $this->delete_1)->get();
|
||||
if ($cuentas) {
|
||||
forEach ($cuentas as $cuenta) {
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha eliminado la cuenta ' . $cuenta->correo . ' nota de eliminacion: ' . $this->nota_eliminacion
|
||||
]);
|
||||
}
|
||||
}
|
||||
$consulta_cuentas = Cuentas::whereIn('id', $this->delete_1)->delete();
|
||||
|
||||
$this->delete_1 = [];
|
||||
$this->notaEliminarVariosModal = false;
|
||||
|
||||
$this->alert('success', 'Cuentas eliminadas correctamente!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
}
|
||||
/* ------------- ACTUALIZAR ------------- */
|
||||
public function updateTarifas()
|
||||
{
|
||||
@@ -499,9 +522,7 @@ class ShowPlanes extends Component
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ------------- ELIMINAR ------------- */
|
||||
|
||||
public function eliminarModTarifa($id)
|
||||
{
|
||||
Tarifas::where('id', $id)->delete();
|
||||
@@ -539,31 +560,8 @@ class ShowPlanes extends Component
|
||||
$this->color_servicio = null;
|
||||
}
|
||||
|
||||
public function eliminarCuentas()
|
||||
{
|
||||
$cuentas = Cuentas::whereIn('id', $this->delete_1)->get();
|
||||
|
||||
if ($cuentas) {
|
||||
forEach ($cuentas as $cuenta) {
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha eliminado la cuenta ' . $cuenta->correo
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$consulta_cuentas = Cuentas::whereIn('id', $this->delete_1)->delete();
|
||||
|
||||
$this->alert('success', 'Cuentas eliminadas correctamente!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
$this->delete_1 = [];
|
||||
}
|
||||
|
||||
public function openAdd()
|
||||
{
|
||||
|
||||
$this->addUser = true;
|
||||
}
|
||||
public function saveUser()
|
||||
|
||||
Reference in New Issue
Block a user