fecha actual + 30 dias

This commit is contained in:
Felipe
2024-04-29 10:16:53 -05:00
parent 581f0e2d7d
commit 09050275c2
2 changed files with 21 additions and 11 deletions
+13 -8
View File
@@ -219,6 +219,12 @@ class ShowPlanes extends Component
$this->estado = $renovarCuenta->estado; $this->estado = $renovarCuenta->estado;
} }
public function calcularFechas()
{
$this->fecha_inicial_renovar = Carbon::now()->format('Y-m-d');
$this->fecha_final_renovar = Carbon::now()->addDays(30)->format('Y-m-d');
}
public function getListeners() public function getListeners()
{ {
return [ return [
@@ -252,7 +258,7 @@ class ShowPlanes extends Component
'estado' => $this->estado, 'estado' => $this->estado,
]); ]);
if ( $this->usuario_renovar_old !== $this->usuario_renovar) { if ($this->usuario_renovar_old !== $this->usuario_renovar) {
Log_historial::create([ Log_historial::create([
'user_id' => Auth::user()->id, 'user_id' => Auth::user()->id,
'detalle' => 'El usuario ha editado el usuario de la cuenta ' . $cuenta_renovar->correo 'detalle' => 'El usuario ha editado el usuario de la cuenta ' . $cuenta_renovar->correo
@@ -449,7 +455,7 @@ class ShowPlanes extends Component
{ {
$this->validate([ $this->validate([
'nota_eliminacion' => 'required', 'nota_eliminacion' => 'required',
],[ ], [
'nota_eliminacion.required' => 'La nota es obligatoria', 'nota_eliminacion.required' => 'La nota es obligatoria',
]); ]);
@@ -477,13 +483,13 @@ class ShowPlanes extends Component
{ {
$this->validate([ $this->validate([
'nota_eliminacion' => 'required', 'nota_eliminacion' => 'required',
],[ ], [
'nota_eliminacion.required' => 'La nota es obligatoria', 'nota_eliminacion.required' => 'La nota es obligatoria',
]); ]);
$cuentas = Cuentas::whereIn('id', $this->delete_1)->get(); $cuentas = Cuentas::whereIn('id', $this->delete_1)->get();
if ($cuentas) { if ($cuentas) {
forEach ($cuentas as $cuenta) { foreach ($cuentas as $cuenta) {
Log_historial::create([ Log_historial::create([
'user_id' => Auth::user()->id, 'user_id' => Auth::user()->id,
'detalle' => 'El usuario ha eliminado la cuenta ' . $cuenta->correo . ' nota de eliminacion: ' . $this->nota_eliminacion 'detalle' => 'El usuario ha eliminado la cuenta ' . $cuenta->correo . ' nota de eliminacion: ' . $this->nota_eliminacion
@@ -498,7 +504,6 @@ class ShowPlanes extends Component
$this->alert('success', 'Cuentas eliminadas correctamente!', [ $this->alert('success', 'Cuentas eliminadas correctamente!', [
'position' => 'top' 'position' => 'top'
]); ]);
} }
/* ------------- ACTUALIZAR ------------- */ /* ------------- ACTUALIZAR ------------- */
public function updateTarifas() public function updateTarifas()
@@ -741,9 +746,10 @@ class ShowPlanes extends Component
$this->editarTarifaRol = false; $this->editarTarifaRol = false;
} }
public function seleccionarTodos(){ public function seleccionarTodos()
{
if (count($this->delete_1)== 0) { if (count($this->delete_1) == 0) {
$this->delete_1 = array_column($this->cont['data'], 'id'); $this->delete_1 = array_column($this->cont['data'], 'id');
} else { } else {
$this->delete_1 = []; $this->delete_1 = [];
@@ -752,5 +758,4 @@ class ShowPlanes extends Component
//dd($this->delete_1); //dd($this->delete_1);
} }
} }
@@ -13,7 +13,7 @@
}" class="h-full w-full md:my-2"> }" 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 <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="noRenovar,siRenovar,ver,openRenovar,confirm_delete_cuenta,saveRenovar,createNewCuenta,createServicio,verObservacion,update,verObservacion1,update_observaciones1,eliminarCuentas,updateTarifas"> wire:target="noRenovar,calcularFechas,siRenovar,ver,openRenovar,confirm_delete_cuenta,saveRenovar,createNewCuenta,createServicio,verObservacion,update,verObservacion1,update_observaciones1,eliminarCuentas,updateTarifas">
<div class="grid h-full place-items-center"> <div class="grid h-full place-items-center">
<div class="max-w-xs"> <div class="max-w-xs">
<img src="./img/loading.gif" alt="" class="w-full text-center"> <img src="./img/loading.gif" alt="" class="w-full text-center">
@@ -410,9 +410,14 @@
<option value="pendiente">Cuenta completa</option> <option value="pendiente">Cuenta completa</option>
<option value="inactivo">Inactivo</option> <option value="inactivo">Inactivo</option>
</select> </select>
</div> </div>
<div class="mb-4">
<button wire:click="calcularFechas" type="button" class="inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 text-white bg-[#B221FD] hover:bg-[#7a02b8] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5" >
+ 30 dias
</button>
</div>
<div date-rangepicker class="flex items-center gap-2 mb-4"> <div date-rangepicker class="flex items-center gap-2 mb-4">
<div class="relative"> <div class="relative">
<label for="fecha_inicial_renovar" class="block text-gray-700 text-sm font-bold mb-2">Fecha <label for="fecha_inicial_renovar" class="block text-gray-700 text-sm font-bold mb-2">Fecha