diff --git a/app/Http/Livewire/ShowClientes.php b/app/Http/Livewire/ShowClientes.php index 5aaf1b6..beeef99 100644 --- a/app/Http/Livewire/ShowClientes.php +++ b/app/Http/Livewire/ShowClientes.php @@ -45,7 +45,7 @@ class ShowClientes extends Component public $configuracion; public $msj; - + public $entradas = 10; public function render() { @@ -53,7 +53,8 @@ class ShowClientes extends Component $this->fechaActual = date('d/m/Y'); $fechaVencimiento = Carbon::now()->subDay(30); - $consulta_clientes = Historiale::where('vendedor_id', Auth()->user()->id)->whereDate('fecha_final', '>', $fechaVencimiento); + // $consulta_clientes = Historiale::where('vendedor_id', Auth()->user()->id)->whereDate('fecha_final', '>', $fechaVencimiento); + $consulta_clientes = Historiale::whereDate('fecha_final', '>', $fechaVencimiento); $this->configuracion = User::where('id', Auth::user()->id)->whereDate('updated_at', '!=', $fechaHoy)->first(); @@ -82,7 +83,7 @@ class ShowClientes extends Component $consulta_clientes = $consulta_clientes->with('tarifa', 'promocion', 'cliente') ->orderBy('id', 'DESC') - ->paginate(15); + ->paginate($this->entradas); @@ -96,12 +97,21 @@ class ShowClientes extends Component public function verCliente($id) { $this->consulta_historial = Historiale::with('promocion', 'tarifa', 'cliente', 'cuentas')->where('id', $id)->first(); - // dd($this->consulta_historial ); $this->verCliente = true; } + public function consultaPassword($id) + { + $historiale = Historiale::with('promocion', 'tarifa', 'cliente', 'cuentas')->where('id', $id)->first(); + if ($historiale && $historiale->cuentas->isNotEmpty()) { + // Assuming 'password' is a property on the Cuentas model + return $historiale->cuentas->first()->password ?? ''; + } else { + return ''; + } + } public function enviarNotificacion($id) { diff --git a/resources/views/components/primary-table.blade.php b/resources/views/components/primary-table.blade.php index dbfbcf2..8785d87 100644 --- a/resources/views/components/primary-table.blade.php +++ b/resources/views/components/primary-table.blade.php @@ -1,5 +1,5 @@ -
| Nombre | -Correo | -Compra | -Servicio | -Vence | -Restante | -- | - | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Nombre | +Usuario | +ContraseƱa | +Servicio | +Compra | +Estado | +Restante | +Acciones | ++ | + | ||||||||||||||||||||
| {{ $cliente->nombre_cliente ?? $cliente->cliente->name }} | -{{ $cliente->nombre_cliente ?? $cliente->cliente->name }} | -{{ $cliente->cliente->email ?? '' }} | +{{ $cliente->cliente->email ?? '' }} | + +{{ $this->consultaPassword($cliente->id) }} | + + @if (!empty($cliente->tarifa_id)) +{{ $cliente->tarifa->servicio->nombre }} + + @if ($cliente->tarifa->servicio->nombre != 'Spotify Premium' && $cliente->tarifa->servicio->nombre != 'Youtube Premium') + {{ $cliente->tarifa->pantallas }} Pantallas + @endif + + | + @endif + + @if (!empty($cliente->promocion_id)) +{{ $cliente->promocion->nombre }} | + @endif + ++ {{ Carbon\Carbon::parse($cliente->created_at)->locale('co')->Format('d M Y, h:m a') ?? '' }} + | +{{ $cliente->estado ?? '' }} | + @php + $date1 = new DateTime(strtr(strval($fechaActual), '/', '-')); + $date2 = new DateTime(strtr(strval($cliente->fecha_final), '/', '-')); + @endphp + + @if ($date1 < $date2)- {{ Carbon\Carbon::parse($cliente->created_at)->locale('co')->Format('d M Y, h:m a') ?? '' }} + @php + $diff = $date1->diff($date2); + echo $diff->days . ' dias'; + @endphp | + @endif - @if (!empty($cliente->tarifa_id)) -{{ $cliente->tarifa->servicio->nombre }} - - @if ($cliente->tarifa->servicio->nombre != 'Spotify Premium' && $cliente->tarifa->servicio->nombre != 'Youtube Premium') - {{ $cliente->tarifa->pantallas }} Pantallas - @endif - - | - @endif - - @if (!empty($cliente->promocion_id)) -{{ $cliente->promocion->nombre }} - | - @endif - -{{ Carbon\Carbon::parse($cliente->fecha_final)->format('M j') ?? '' }} + @if ($date1 > $date2) + | + @php + echo 'Vencido'; + @endphp | + @endif - @php - - $date1 = new DateTime(strtr(strval($fechaActual), '/', '-')); - $date2 = new DateTime(strtr(strval($cliente->fecha_final), '/', '-')); - - @endphp + @if ($date1 == $date2) ++ @php + echo 'Vence hoy!!'; + @endphp + | + @endif - @if ($date1 < $date2) -- @php - $diff = $date1->diff($date2); - echo $diff->days . ' dias'; - @endphp - | - @endif - - @if ($date1 > $date2) -- @php - echo 'Vencido'; - @endphp - | - @endif - - @if ($date1 == $date2) -- @php - echo 'Vence hoy!!'; - @endphp - | - @endif - - @if (!empty($cliente->tarifa_id)) -- - | -- |
Ver
- -entradas
-