This commit is contained in:
Felipe
2024-04-27 11:52:54 -05:00
parent 8098a7d358
commit c5ef476396
4 changed files with 19 additions and 10 deletions
+14 -5
View File
@@ -5,6 +5,7 @@ namespace App\Http\Livewire;
use App\Models\Cuentas;
use App\Models\Historiale;
use App\Models\Historial_cuenta;
use App\Models\Log_general;
use App\Models\Log_historial;
use App\Models\Notificacion;
use App\Models\Pendientes;
@@ -193,12 +194,13 @@ class ShowPlanes extends Component
}
//modal Ver
public function ver($id, $nom)
public function ver(Cuentas $cuenta)
{
$this->id_cuentaVer = $id;
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $id)->first();
//dd($this->consulta_verUsuarios);
$this->nombre_servicios = $nom;
$this->id_cuentaVer = $cuenta->id;
$this->consulta_verUsuarios = $cuenta;
$this->nombre_servicios = $this->consulta_verUsuarios->servicio->nombre;
$this->ver = true;
}
public function openRenovar()
{
@@ -683,6 +685,13 @@ class ShowPlanes extends Component
'position' => 'top'
]);
}
$logsGeneral = new Log_general();
$logsGeneral->user_id = Auth::user()->id;
$logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' ha añadido el usuario ' . $this->searchTerm . ' a una cuenta ';
// . ' a la cuenta ' . $this->consulta_verUsuarios->name . ' - ' . $this->consulta_verUsuarios->email;
$logsGeneral->save();
$this->addUser = false;
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $this->id_cuentaVer)->first();
}
+2 -2
View File
@@ -277,9 +277,9 @@ class ShowPromociones extends Component
$cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio', '>=', $this->fecha)->whereDate('vencimiento', '>=', $this->fecha_final_1)
->whereDate('vencimiento', '<=', $this->fecha_final_2)
->Orderby('created_at', 'ASC')->with('historiales')->withCount('historiales')->where('estado', 'pendiente')->having('historiales_count', '==', 0)->first();
->Orderby('created_at', 'DESC')->with('historiales')->withCount('historiales')->where('estado', 'pendiente')->having('historiales_count', '==', 0)->first();
} else {
$cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio', '>=', $this->fecha)->Orderby('created_at', 'ASC')->with('historiales')->withCount('historiales')->where('estado', 'activo')->having('historiales_count', '<=', (int)$faltante)->first();
$cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio', '>=', $this->fecha)->Orderby('created_at', 'DESC')->with('historiales')->withCount('historiales')->where('estado', 'activo')->having('historiales_count', '<=', (int)$faltante)->first();
}
if (!is_null($cuenta)) {
@@ -72,7 +72,7 @@
@endif
</td>
<td class="m-auto hidden md:table-cell">
<button x-on:click="ver=true" wire:click="ver({{ $cuenta->id }},'{{ $servicioNom }}')"
<button wire:click="ver({{ $cuenta->id }})"
class="bg-[#B221FD] hover:bg-[#7a02b8] text-white px-4 py-1 rounded-lg">Ver</button>
</td>
<td class="pl-2">
@@ -260,10 +260,10 @@
@endif
<td class="pl-[2rem]">
{{ \Carbon\Carbon::parse($verUsuarios->fecha_inicio)->format('y/m/d') }}
{{ \Carbon\Carbon::parse($consulta_verUsuarios->inicio)->format('d/m/Y') }}
</td>
<td class="pl-[2rem]">
{{ \Carbon\Carbon::parse($verUsuarios->fecha_final)->format('y/m/d') }}
{{ \Carbon\Carbon::parse($consulta_verUsuarios->vencimiento)->format('d/m/Y') }}
</td>
@php