<?php

namespace App\Livewire\Admin\Client;

use App\Livewire\Forms\ClientForm;
use Livewire\Component;
use Livewire\Attributes\On;
use App\Models\Client;
use Illuminate\Support\Facades\Crypt;

class DetailClient extends Component
{

    public ClientForm $clientForm;
    public Client $client;

    #[On('client-detail')]
    public function detailClient($id)
    {
        $this->client = Client::findOrFail($id);
        $decryptedPassword = Crypt::decryptString($this->client->root_password);
        $this->client->root_password = $decryptedPassword; 
        
    }

    public function render()
    {
        return view('livewire.admin.clients.detail-client');
    }
}
