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()
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
</button>
|
||||
|
||||
<div x-cloak x-show="openOption" @click.away="openOption = false"
|
||||
class="sm:absolute bg-white text-center w-[8rem] rounded-[1rem] border-b border-gray-200 shadow-lg">
|
||||
class="sm:absolute bg-white text-center w-[8rem] rounded-[1rem] border-b border-gray-200 shadow-lg z-20">
|
||||
<button x-on:click="openOption=false,ver=true"
|
||||
wire:click="ver({{ $cuenta->id }},'{{ $servicioNom }}')"
|
||||
class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300 hover:rounded-t-[1rem]">Ver
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
newCuenta: @entangle('newCuenta'),
|
||||
modTarifas: @entangle('modTarifas'),
|
||||
serviciosModal: @entangle('serviciosModal'),
|
||||
notaEliminarModal: @entangle('notaEliminarModal'),
|
||||
notaEliminarVariosModal: @entangle('notaEliminarVariosModal'),
|
||||
ver: @entangle('ver'),
|
||||
renovar: @entangle('renovar'),
|
||||
addUser: @entangle('addUser'),
|
||||
@@ -11,7 +13,7 @@
|
||||
|
||||
}" class="h-full w-full md:my-2">
|
||||
<div class=" fixed backdrop-blur-sm bg-white/70 left-0 bottom-0 top-0 right-0 h-full z-40" wire:loading
|
||||
wire:target="ver,openRenovar,saveRenovar,createNewCuenta,createServicio,verObservacion,update,verObservacion1,update_observaciones1,delete_cuenta,updateTarifas">
|
||||
wire:target="ver,openRenovar,saveRenovar,createNewCuenta,createServicio,verObservacion,update,verObservacion1,update_observaciones1,eliminarCuentas,updateTarifas">
|
||||
<div class="grid h-full place-items-center">
|
||||
<div class="max-w-xs">
|
||||
<img src="./img/loading.gif" alt="" class="w-full text-center">
|
||||
@@ -998,7 +1000,42 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div x-cloak x-show="notaEliminarModal" x-transition:enter="transition duration-350" x-transition:enter-start="opacity-0 scale-100" x-transition:enter-end="opacity-100 scale-100" x-transition:leave="transition duration-350" x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 scale-100" class="fixed backdrop-blur-sm bg-black/20 left-0 bottom-0 top-0 right-0 h-full z-20">
|
||||
<div class="grid h-full place-items-center">
|
||||
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4 rounded-lg shadow-md">
|
||||
|
||||
<div class="mb-4 flex flex-col">
|
||||
<label for="nota_eliminacion" class="block text-gray-700 text-sm font-bold mb-2">Nota:</label>
|
||||
<textarea type="text" id="nota_eliminacion" wire:model="nota_eliminacion" placeholder="Porque quieres eliminar esta cuenta?" class="border-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:ring-0 focus:border-neutral-300 w-full py-2 px-3 h-40 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="bg-white py-3 sm:flex sm:flex-row-reverse sm:justify-between gap-5 mt-4">
|
||||
<button wire:click="confirm_delete_cuenta" type="button" class="inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 sm:mb-[0] mb-2 text-white bg-[#B221FD] hover:bg-[#7a02b8] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Eliminar</button>
|
||||
<button x-on:click="notaEliminarModal=false" class="inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 text-white bg-[#585858] hover:bg-[#3a3a3a] ease-in-out sm-text-sm sm-leading-5">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div x-cloak x-show="notaEliminarVariosModal" x-transition:enter="transition duration-350" x-transition:enter-start="opacity-0 scale-100" x-transition:enter-end="opacity-100 scale-100" x-transition:leave="transition duration-350" x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 scale-100" class="fixed backdrop-blur-sm bg-black/20 left-0 bottom-0 top-0 right-0 h-full z-20">
|
||||
<div class="grid h-full place-items-center">
|
||||
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4 rounded-lg shadow-md">
|
||||
|
||||
<div class="mb-4 flex flex-col">
|
||||
<label for="nota_eliminacion" class="block text-gray-700 text-sm font-bold mb-2">Nota:</label>
|
||||
<textarea type="text" id="nota_eliminacion" wire:model="nota_eliminacion" placeholder="Porque quieres eliminar esta cuenta?" class="border-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:ring-0 focus:border-neutral-300 w-full py-2 px-3 h-40 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="bg-white py-3 sm:flex sm:flex-row-reverse sm:justify-between gap-5 mt-4">
|
||||
<button wire:click="confirm_delete_cuentas" type="button" class="inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 sm:mb-[0] mb-2 text-white bg-[#B221FD] hover:bg-[#7a02b8] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Eliminar</button>
|
||||
<button x-on:click="notaEliminarVariosModal=false" class="inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 text-white bg-[#585858] hover:bg-[#3a3a3a] ease-in-out sm-text-sm sm-leading-5">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('layouts.footer')
|
||||
|
||||
<script>
|
||||
function copiarAlPortapapeles(id_elemento) {
|
||||
var aux = document.createElement("input");
|
||||
|
||||
Reference in New Issue
Block a user