From 98ee3c06961de9e28e10b16c36b51a8125de9bb7 Mon Sep 17 00:00:00 2001 From: Felipe Date: Wed, 25 Oct 2023 15:50:18 -0500 Subject: [PATCH] botones y color en estado --- app/Http/Livewire/ShowPlanes.php | 2 +- app/Imports/UsersImport.php | 12 +- .../views/components/primary-table.blade.php | 6 +- .../views/livewire/show-clientes.blade.php | 323 ++++++++---------- 4 files changed, 147 insertions(+), 196 deletions(-) diff --git a/app/Http/Livewire/ShowPlanes.php b/app/Http/Livewire/ShowPlanes.php index 9536937..8f3a451 100644 --- a/app/Http/Livewire/ShowPlanes.php +++ b/app/Http/Livewire/ShowPlanes.php @@ -260,7 +260,7 @@ class ShowPlanes extends Component $consulta->remitente_id = Auth::user()->id; $consulta->destinatario_id = $historial_cuenta->historial->vendedor_id; $consulta->titulo = "Licencia asignada para $servicioName"; - $consulta->descripcion = 'La licencia de $servicioName ha sido activada y ahora puedes utilizar tu cuenta sin problemas. Tus credenciales son: correo: '.$historial_cuenta->cuenta->correo.' contraseña: '. $historial_cuenta->cuenta->password; + $consulta->descripcion = 'La licencia de ' . $servicioName . ' ha sido activada y ahora puedes utilizar tu cuenta sin problemas. Tus credenciales son: correo: ' . $historial_cuenta->cuenta->correo . ' contraseña: ' . $historial_cuenta->cuenta->password; $consulta->estado = true; $consulta->todos = false; $consulta->save(); diff --git a/app/Imports/UsersImport.php b/app/Imports/UsersImport.php index d7fda50..f74a897 100644 --- a/app/Imports/UsersImport.php +++ b/app/Imports/UsersImport.php @@ -29,18 +29,18 @@ class UsersImport implements ToModel 'vencimiento' => \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[4]), 'servicio_id' => $row[5], ]); - + $cuenta->save(); - + // Aquí realizamos operaciones similares a las cuentas manuales if ($row[2] === 'activo') { $servicioPantallas = Servicio::find($row[5])->pantallas; - + $cuentasPendientes = Pendientes::where('estado', 'pendiente') ->where('servicio_id', $row[5]) ->take($servicioPantallas) ->get(); - + foreach ($cuentasPendientes as $i => $cuentaPendiente) { $servicioName = $cuentaPendiente->servicio->nombre; @@ -57,13 +57,13 @@ class UsersImport implements ToModel $consulta->remitente_id = Auth::user()->id; $consulta->destinatario_id = $historial_cuenta->historial->vendedor_id; $consulta->titulo = "Licencia asignada para $servicioName"; - $consulta->descripcion = 'La licencia de $servicioName ha sido activada y ahora puedes utilizar tu cuenta sin problemas. Tus credenciales son: correo: '.$historial_cuenta->cuenta->correo.' contraseña: '. $historial_cuenta->cuenta->password; + $consulta->descripcion = 'La licencia de ' . $servicioName . ' ha sido activada y ahora puedes utilizar tu cuenta sin problemas. Tus credenciales son: correo: ' . $historial_cuenta->cuenta->correo . ' contraseña: ' . $historial_cuenta->cuenta->password; $consulta->estado = true; $consulta->todos = false; $consulta->save(); } } - + return $cuenta; } public function headingRow(): int diff --git a/resources/views/components/primary-table.blade.php b/resources/views/components/primary-table.blade.php index 8785d87..aac156b 100644 --- a/resources/views/components/primary-table.blade.php +++ b/resources/views/components/primary-table.blade.php @@ -1,9 +1,9 @@
- - +
+ {{ $thead }} - + {{ $tbody }}
diff --git a/resources/views/livewire/show-clientes.blade.php b/resources/views/livewire/show-clientes.blade.php index 2d01f48..3b6c288 100644 --- a/resources/views/livewire/show-clientes.blade.php +++ b/resources/views/livewire/show-clientes.blade.php @@ -1,8 +1,8 @@
-
+ wire:target="verCliente,enviarNotificacion,renovar"> +

Cargando

@@ -11,12 +11,13 @@
{{-- Buscador --}} -
+
+ xmlns:svgjs="http://svgjs.com/svgjs" version="1.1" x="0" y="0" viewBox="0 0 24 24" + style="enable-background:new 0 0 512 512" xml:space="preserve"> Clientes
-
+
+ class=" shadow-sm border-2 active:border-neutral-200 focus:ring-0 border-neutral-200 w-64 md:w-auto rounded-md pr-7 py-1 m-auto focus:border-neutral-300 focus:outline-none focus:shadow-outline"> + x="0" y="0" viewBox="0 0 24 24" style="enable-background:new 0 0 512 512;rotate: 90deg;" + xml:space="preserve" class="">
@@ -55,41 +55,38 @@ - Nombre - Usuario - Contraseña - Servicio - Compra - Estado - Restante - Acciones - - + Nombre + Usuario + Contraseña + Servicio + Compra + Estado + Restante + Acciones @foreach ($clientes as $cliente) - - {{ $cliente->nombre_cliente ?? $cliente->cliente->name }} + + {{ $cliente->nombre_cliente ?? $cliente->cliente->name }} - + @if (!empty($cliente->cuentas_obsoletas->unique())) @foreach ($cliente->cuentas_obsoletas->unique() as $cuenta) - {{ $cuenta->correo }}
+ {{ $cuenta->correo }}
@endforeach @endif @if (!empty($cliente->cuentas->unique())) @foreach ($cliente->cuentas->unique() as $cuenta1) - {{ $cuenta1->correo }}
+ {{ $cuenta1->correo }}
@endforeach @endif - {{ $this->consultaPassword($cliente->id) }} + {{ $this->consultaPassword($cliente->id) }} @if (!empty($cliente->tarifa_id)) - {{ $cliente->tarifa->servicio->nombre }} + {{ $cliente->tarifa->servicio->nombre }} @if ($cliente->tarifa->servicio->nombre != 'Spotify Premium' && $cliente->tarifa->servicio->nombre != 'Youtube Premium') {{ $cliente->tarifa->pantallas }} Pantallas @@ -99,20 +96,25 @@ @endif @if (!empty($cliente->promocion_id)) - {{ $cliente->promocion->nombre }} + {{ $cliente->promocion->nombre }} @endif - + {{ Carbon\Carbon::parse($cliente->created_at)->locale('co')->Format('d M Y, h:m a') ?? '' }} - {{ $cliente->estado ?? '' }} + +

+ {{ $cliente->estado ?? '' }} +

+ @php $date1 = new DateTime(strtr(strval($fechaActual), '/', '-')); $date2 = new DateTime(strtr(strval($cliente->fecha_final), '/', '-')); @endphp @if ($date1 < $date2) - + @php $diff = $date1->diff($date2); echo $diff->days . ' dias'; @@ -121,7 +123,7 @@ @endif @if ($date1 > $date2) - + @php echo 'Vencido'; @endphp @@ -129,7 +131,7 @@ @endif @if ($date1 == $date2) - + @php echo 'Vence hoy!!'; @endphp @@ -137,162 +139,111 @@ @endif @if (!empty($cliente->tarifa_id)) - - - - - - - -
- - - @if (!empty($cliente->cuentas->first()->estado)) - @if ($cliente->cuentas->first()->estado == 'pendiente' && $cliente->tarifa->servicio->renovacion == true) - {{-- renovar --}} - - @if (Auth::user()->saldo->valor >= $cliente->tarifa->valor) - - @else - - @endif - @endif - @endif - - {{-- whatsapp --}} - Notificar - - - - - - - + +
+

Ver

+ @if (!empty($cliente->cuentas->first()->estado)) + @if ($cliente->cuentas->first()->estado == 'pendiente' && $cliente->tarifa->servicio->renovacion == true) + {{-- renovar --}} + @if (Auth::user()->saldo->valor >= $cliente->tarifa->valor) +

Renovar

+ @else +

Renovar

+ @endif + @endif + @endif +
+ + + +
+

+ Notificar + + + +

+

+ Notificar + + + + + +

+

+ SMS + + + +

+
@elseif(!empty($cliente->promocion_id)) - - - - - - - -
- - {{-- whatsapp --}} - Notificar - - - - - - - - + +
+

Ver

+ @if (!empty($cliente->cuentas->first()->estado)) + @if ($cliente->cuentas->first()->estado == 'pendiente' && $cliente->tarifa->servicio->renovacion == true) + {{-- renovar --}} + @if (Auth::user()->saldo->valor >= $cliente->tarifa->valor) +

Renovar

+ @else +

Renovar

+ @endif + @endif + @endif
- + + + +
+

+ Notificar + + + +

+

+ Notificar + + + + + +

+

+ SMS + + + +

+
+
+ @endif @endforeach @@ -537,8 +488,8 @@ wire:click="enviarNotificacion({{ $h->id }})">Notificar Notificar