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\Cuentas;
use App\Models\Historiale; use App\Models\Historiale;
use App\Models\Historial_cuenta; use App\Models\Historial_cuenta;
use App\Models\Log_general;
use App\Models\Log_historial; use App\Models\Log_historial;
use App\Models\Notificacion; use App\Models\Notificacion;
use App\Models\Pendientes; use App\Models\Pendientes;
@@ -193,12 +194,13 @@ class ShowPlanes extends Component
} }
//modal Ver //modal Ver
public function ver($id, $nom) public function ver(Cuentas $cuenta)
{ {
$this->id_cuentaVer = $id; $this->id_cuentaVer = $cuenta->id;
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $id)->first(); $this->consulta_verUsuarios = $cuenta;
//dd($this->consulta_verUsuarios); $this->nombre_servicios = $this->consulta_verUsuarios->servicio->nombre;
$this->nombre_servicios = $nom;
$this->ver = true;
} }
public function openRenovar() public function openRenovar()
{ {
@@ -683,6 +685,13 @@ class ShowPlanes extends Component
'position' => 'top' '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->addUser = false;
$this->consulta_verUsuarios = Cuentas::with('historiales', 'servicio')->where('id', $this->id_cuentaVer)->first(); $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) $cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio', '>=', $this->fecha)->whereDate('vencimiento', '>=', $this->fecha_final_1)
->whereDate('vencimiento', '<=', $this->fecha_final_2) ->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 { } 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)) { if (!is_null($cuenta)) {
@@ -72,7 +72,7 @@
@endif @endif
</td> </td>
<td class="m-auto hidden md:table-cell"> <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> class="bg-[#B221FD] hover:bg-[#7a02b8] text-white px-4 py-1 rounded-lg">Ver</button>
</td> </td>
<td class="pl-2"> <td class="pl-2">
@@ -260,10 +260,10 @@
@endif @endif
<td class="pl-[2rem]"> <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>
<td class="pl-[2rem]"> <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> </td>
@php @php