feat: Visualização de detalhes dos clientes (Commit anterior não condiz com essa feature).

This commit is contained in:
LukiBeg 2025-11-25 16:43:52 -03:00
parent 9141763f22
commit 578e26f5da
14 changed files with 401 additions and 112 deletions

View File

@ -19,7 +19,6 @@ public function deleteClient($payload)
}
$this->dispatch('client-deleted');
// (Opcional) Envia uma notificação de sucesso
$this->dispatch('notify', message: 'Cliente excluído com sucesso!');
}

View File

@ -0,0 +1,30 @@
<?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 = null;
#[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');
}
}

View File

@ -21,8 +21,6 @@ class EditClient extends Component
// public ClientService $clientService;
#[On('update-client')]
public function loadClient($id)
{
try {

View File

@ -28,6 +28,9 @@ class Client extends Model
'carrier',
'access_type',
'server_ip',
'port',
'ddr_key',
'ddr_out',
'root_password', // Lembre-se de criptografar isso!
'has_call_center',
'has_voice_gateway',
@ -35,8 +38,18 @@ class Client extends Model
'modules',
'whatsapp_number',
'whatsapp_activation_date',
'observation',
];
/*
- Número chave, número de saída
- Credenciais de acesso VPN
- Anexos
- Porta de acesso
*/
/**
* Os atributos que devem ser convertidos para tipos nativos.
*

View File

@ -25,4 +25,10 @@ public function updateClient(Client $client, $data)
$data['name'] = $data['client_name'];
return $client->update($data);
}
public function detailClient(Client $client)
{
//Detail method
return $client->all();
}
}

View File

@ -12,7 +12,7 @@
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->uuid('id')->primary();
$table->string('name');
$table->json('permissions')->nullable();
$table->string('email')->unique();

View File

@ -12,45 +12,40 @@
public function up(): void
{
Schema::create('clients', function (Blueprint $table) {
// 1. Alterado de $table->id() para $table->uuid()
$table->uuid('id')->primary();
$table->uuid('id')->primary();
// Informações de Cadastro
$table->string('name');
$table->string('legal_name');
$table->string('cnpj')->unique()->nullable();
// 2. Adicionado o path da imagem
$table->string('profile_image_path')->nullable(); // "path da imagem do cliente"
$table->string('name');
$table->string('legal_name');
$table->string('cnpj')->unique()->nullable();
$table->string('profile_image_path')->nullable();
// Informações Técnicas
$table->string('pbx_hosting')->nullable();
$table->date('activation_date')->nullable();
$table->string('carrier')->nullable();
$table->string('access_type')->nullable();
$table->ipAddress('server_ip')->nullable();
$table->text('root_password')->nullable();
$table->string('pbx_hosting')->nullable();
$table->date('activation_date')->nullable();
$table->string('carrier')->nullable();
$table->string('access_type')->nullable();
$table->ipAddress('server_ip')->nullable();
$table->text('root_password')->nullable();
$table->text('ddr_out')->nullable();
$table->text('ddr_key')->nullable();
$table->longText('observation')->nullable();
// Módulos e Features
$table->boolean('has_call_center')->default(false);
$table->boolean('has_voice_gateway')->default(false);
$table->boolean('has_fop2')->default(false);
$table->boolean('has_call_center')->default(false);
$table->boolean('has_voice_gateway')->default(false);
$table->boolean('has_fop2')->default(false);
// Módulos
$table->json('modules')->nullable();
$table->string('whatsapp_number')->nullable();
$table->date('whatsapp_activation_date')->nullable();
$table->json('modules')->nullable();
$table->string('whatsapp_number')->nullable();
$table->date('whatsapp_activation_date')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('clients');
}
};
};

View File

@ -8,6 +8,7 @@
<livewire:admin.client.add-client />
<livewire:admin.user.delete-user>
<livewire:admin.show-users />
<livewire:admin.client.detail-client />
<livewire:admin.client.delete-client />
<x-are-you-sure />
<livewire:show-client />

View File

@ -76,6 +76,12 @@
</a>
</li>
<li class="profile-items">
<a @click="$dispatch('vpn-show-links')" class="profile-link">
VPN's
</a>
</li>
</ul>
</div>
@endauth

View File

@ -22,7 +22,7 @@ class="fixed inset-y-0 right-0 flex max-w-full pl-10" @click.away="showClientMod
Adicionar Novo Cliente
</h2>
<button type="button" @click="showClientModal = false"
class="rounded-md text-blue-200 hover:text-white cursor-pointer focus:outline-none focus:ring-2 focus:ring-white">
class="rounded-md text-blue-400 hover:text-white cursor-pointer focus:outline-none focus:ring-2 focus:ring-white">
<span class="sr-only">Fechar painel</span>
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
stroke-width="1.5" stroke="currentColor">
@ -44,7 +44,7 @@ class="rounded-md text-blue-200 hover:text-white cursor-pointer focus:outline-no
<div>
<label for="client_name" class="form-label">Nome Fantasia *</label>
<input type="text" wire:model="form.client_name" id="client_name"
class="form-input">
class="form-input" placeholder="Eletrônicos Mota">
@error('form.client_name') <span
class="text-red-500 text-sm">{{ $message }}</span>
@enderror
@ -52,14 +52,14 @@ class="text-red-500 text-sm">{{ $message }}</span>
<div>
<label for="legal_name" class="form-label">Razão Social *</label>
<input type="text" wire:model="form.legal_name" id="legal_name"
class="form-input">
class="form-input" placeholder="Mota Germano Eletrônicos LTDA">
@error('form.legal_name') <span
class="text-red-500 text-sm">{{ $message }}</span> @enderror
class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
</div>
<div class="mt-4">
<label for="cnpj" class="form-label">CNPJ *</label>
<input type="text" wire:model="form.cnpj" id="cnpj" class="form-input">
<input type="text" wire:model="form.cnpj" id="cnpj" class="form-input" placeholder="54.505.316/0001-64">
@error('form.cnpj') <span class="text-red-500 text-sm">{{ $message }}</span>
@enderror
</div>
@ -73,7 +73,7 @@ class="text-sm text-blue-600 mt-1">
Enviando...
</div>
@error('form.profile_image_path') <span
class="text-red-500 text-sm">{{ $message }}</span> @enderror
class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
</div>
@ -94,37 +94,61 @@ class="form-input">
</div>
<div>
<label for="carrier" class="form-label">Operadora</label>
<input type="text" wire:model="form.carrier" id="carrier" class="form-input">
<input type="text" wire:model="form.carrier" id="carrier" class="form-input" placeholder="ALGAR">
</div>
<div>
<label for="access_type" class="form-label">Tipo de Acesso</label>
<input type="text" wire:model="form.access_type" id="access_type"
class.="form-input" placeholder="Ex: SSH, AnyDesk, VPN">
</div>
<div>
<label for="ddr_out" class="form-label">Número de saída chave</label>
<input type="text" wire:model="form.ddr_out" id="ddr_out"
class="form-input" placeholder="(71) 3034-8350">
</div>
<div>
<label for="ddr_key" class="form-label">Número de entrada chave</label>
<input type="text" wire:model="form.ddr_key" id="ddr_key"
class="form-input" placeholder="(71) 3034-8350">
</div>
<div>
<label for="server_ip" class="form-label">IP do Servidor</label>
<input type="text" wire:model="form.server_ip" id="server_ip"
class="form-input">
class="form-input" placeholder="10.0.0.1">
@error('form.server_ip') <span
class="text-red-500 text-sm">{{ $message }}</span> @enderror
class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<div>
<label for="root_password" class="form-label">Senha (root)</label>
<input type="password" wire:model="form.root_password" id="root_password"
class="form-input">
class="form-input" placeholder="************">
</div>
</div>
</div>
<hr class="form-divider">
<div class="form-group">
<h2 class="form-section-title">Observações e Credenciais Internas</h2>
<div>
<label for="observation" class="form-label">Detalhes da Configuração, VPN, ou Notas</label>
<textarea wire:model="form.observation" id="observation" rows="5" class="form-input" placeholder="VPN: Fortclient, SENHA: *******"></textarea>
@error('form.observation') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
</div>
<hr class="form-divider">
<div class="form-group">
<h2 class="form-section-title">WhatsApp</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="whatsapp_number" class="form-label">Número do WhatsApp</label>
<input type="text" wire:model="form.whatsapp_number" id="whatsapp_number"
class="form-input">
class="form-input" placeholder="(71) 3034-8350">
</div>
<div>
<label for="whatsapp_activation_date" class="form-label">Data Ativação

View File

@ -0,0 +1,197 @@
<div x-data="{ showClientDetails: false }" x-cloak
@keydown.escape.window="showClientDetails = false"
x-on:client-detail.window="showClientDetails = true"
class="relative z-50"
>
<div x-show="showClientDetails"
x-transition:enter="ease-out duration-300" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-25"
x-transition:leave="ease-in duration-200" x-transition:leave-start="opacity-0" x-transition:leave-end="opacity-0"
class="fixed inset-0 bg-white/50 transition-opacity"
></div>
<div x-show="showClientDetails"
x-transition:enter="transform transition ease-in-out duration-300 sm:duration-500" x-transition:enter-start="translate-x-full" x-transition:enter-end="translate-x-0"
x-transition:leave="transform transition ease-in-out duration-300 sm:duration-500" x-transition:leave-start="translate-x-0" x-transition:leave-end="translate-x-full"
class="fixed inset-y-0 right-0 flex max-w-full pl-10"
@click.away="showClientDetails = false"
>
<div class="w-screen max-w-4xl">
<div class="flex h-full flex-col overflow-y-scroll bg-white shadow-xl">
<div class="bg-gray px-4 py-6 sm:px-6">
<div class="flex items-center justify-between">
<h2 class="text-lg font-semibold leading-6 text-black" id="slide-over-title">
Detalhes do cliente
</h2>
<button type="button" @click="showClientDetails = false"
class="rounded-md text-blue-400 hover:text-white cursor-pointer focus:outline-none focus:ring-2 focus:ring-white">
<span class="sr-only">Fechar painel</span>
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
@if($client)
<div class="form-wrapper-modal">
<div class="form-grid-container">
<div class="form-main-panel-modal space-y-8"> <div class="form-group">
<h2 class="form-section-title">Informações Principais</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
<div>
<label class="form-label">Nome Fantasia</label>
<input type="text" value="{{ $client->name }}" class="form-input bg-gray-50" placeholder="Eletrônicos Mota" readonly>
</div>
<div>
<label class="form-label">Razão Social</label>
<input type="text" value="{{ $client->legal_name }}" class="form-input bg-gray-50" placeholder="Mota Germano Eletrônicos LTDA" readonly>
</div>
<div>
<label class="form-label">CNPJ</label>
<input type="text" value="{{ $client->cnpj }}" class="form-input bg-gray-50" placeholder="54.505.316/0001-64" readonly>
</div>
<div>
<label class="form-label">Logo</label>
<div class="mt-1 flex items-center">
@if($client->profile_image_path)
<div class="h-10 w-10 rounded overflow-hidden border border-gray-200">
<img src="{{ asset('storage/' . $client->profile_image_path) }}" alt="Logo" class="h-full w-full object-cover">
</div>
<a href="{{ asset('storage/' . $client->profile_image_path) }}" target="_blank" class="ml-3 text-sm text-blue-600 hover:underline">Abrir imagem</a>
@else
<span class="text-sm text-gray-400 italic p-2 border border-dashed border-gray-300 rounded">Sem logo</span>
@endif
</div>
</div>
</div>
</div>
<hr class="form-divider">
<div class="form-group">
<h2 class="form-section-title">Detalhes do Servidor PBX</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
<div>
<label class="form-label">Hospedagem PBX</label>
<input type="text" value="{{ $client->pbx_hosting }}" placeholder="Ex: Vultr, Local, AWS" class="form-input bg-gray-50" readonly>
</div>
<div>
<label class="form-label">Data de Ativação</label>
<input type="text" value="{{ $client->activation_date ? $client->activation_date->format('d/m/Y') : '-' }}" class="form-input bg-gray-50" readonly>
</div>
<div>
<label class="form-label">Operadora</label>
<input type="text" value="{{ $client->carrier }}" placeholder="ALGAR" class="form-input bg-gray-50" readonly>
</div>
<div>
<label class="form-label">Tipo de Acesso</label>
<input type="text" value="{{ $client->access_type }}" placeholder="Ex: SSH, AnyDesk, VPN" class="form-input bg-gray-50" readonly>
</div>
<div>
<label class="form-label">Número de saída chave</label>
<input type="text" value="{{ $client->ddr_out }}" placeholder="(71) 3034-8350" class="form-input bg-gray-50 font-mono text-sm" readonly>
</div>
<div>
<label class="form-label">Número de entrada chave</label>
<input type="text" value="{{ $client->ddr_key }}" placeholder="(71) 3034-8350" class="form-input bg-gray-50 font-mono text-sm" readonly>
</div>
<div>
<label class="form-label">IP do Servidor</label>
<input type="text" value="{{ $client->server_ip }}" placeholder="10.0.0.1" class="form-input bg-gray-50 font-mono cursor-text select-all" readonly>
</div>
<div x-data="{ show: false }">
<label class="form-label">Senha (root)</label>
<div class="relative">
<input placeholder="************" :type="show ? 'text' : 'password'" value="{{ $client->root_password }}" class="form-input bg-gray-50 font-mono pr-20" readonly>
<button type="button" @click="show = !show" class="absolute inset-y-0 right-0 px-3 flex items-center text-xs font-bold uppercase text-blue-600 hover:text-blue-800 cursor-pointer">
<span x-text="show ? 'Ocultar' : 'Mostrar'"></span>
</button>
</div>
</div>
</div>
</div>
<hr class="form-divider">
<div class="form-group">
<h2 class="form-section-title">Observações e Credenciais Internas</h2>
<div class="mt-4">
<textarea rows="5" class="form-input bg-gray-50 resize-none" placeholder="VPN: Fortclient, SENHA: *******" readonly>{{ $client->observation }}</textarea>
</div>
</div>
<hr class="form-divider">
<div class="form-group">
<h2 class="form-section-title">WhatsApp</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
<div>
<label class="form-label">Número do WhatsApp</label>
<input type="text" placeholder="(71) 3034-8350" value="{{ $client->whatsapp_number }}" class="form-input bg-gray-50 font-mono" readonly>
</div>
<div>
<label class="form-label">Data Ativação WhatsApp</label>
<input type="text" value="{{ $client->whatsapp_activation_date ? $client->whatsapp_activation_date->format('d/m/Y') : '-' }}" class="form-input bg-gray-50" readonly>
</div>
</div>
</div>
</div> <div class="form-sidebar-column">
<div class="form-sticky-sidebar-modal">
<div class="form-section-card">
<h2 class="form-section-title mb-4">Módulos & Recursos</h2>
<div class="form-checkbox-group">
<label class="form-checkbox-item opacity-80">
<input type="checkbox" disabled {{ $client->has_call_center ? 'checked' : '' }} class="form-checkbox">
<span>Possui Call Center?</span>
</label>
<label class="form-checkbox-item opacity-80">
<input type="checkbox" disabled {{ $client->has_voice_gateway ? 'checked' : '' }} class="form-checkbox">
<span>Possui Gateway de Voz?</span>
</label>
<label class="form-checkbox-item opacity-80">
<input type="checkbox" disabled {{ $client->has_fop2 ? 'checked' : '' }} class="form-checkbox">
<span>Possui FOP2?</span>
</label>
</div>
<div class="mt-4">
<label class="form-label">Módulos Adicionais (JSON)</label>
<textarea rows="4" placeholder="Ex: {&quot;bi&quot;: true}" class="form-input bg-gray-50 text-xs font-mono" readonly>{{ json_encode($client->modules, JSON_PRETTY_PRINT) }}</textarea>
</div>
</div>
</div>
</div>
</div>
</div>
@else
<div class="flex-1 flex items-center justify-center h-full">
<div class="text-gray-500 flex flex-col items-center">
<svg class="animate-spin h-8 w-8 text-blue-600 mb-3" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>
<span>Carregando...</span>
</div>
</div>
@endif
<div class="flex-shrink-0 border-t border-gray-200 px-4 py-4 sm:px-6">
<div class="flex justify-end">
<button type="button" @click="showClientDetails = false" class="form-button-secondary">
Fechar
</button>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -22,7 +22,7 @@ class="fixed inset-y-0 right-0 flex max-w-full pl-10" @click.away="showEditClien
Edição de cliente
</h2>
<button type="button" @click="showEditClientModal = false"
class="rounded-md text-blue-200 hover:text-white cursor-pointer focus:outline-none focus:ring-2 focus:ring-white">
class="rounded-md text-blue-400 hover:text-white cursor-pointer focus:outline-none focus:ring-2 focus:ring-white">
<span class="sr-only">Fechar painel</span>
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
stroke-width="1.5" stroke="currentColor">
@ -44,14 +44,14 @@ class="rounded-md text-blue-200 hover:text-white cursor-pointer focus:outline-no
<div>
<label for="client_name" class="form-label">Nome Fantasia *</label>
<input type="text" wire:model="clientForm.client_name" id="client_name"
class="form-input">
class="form-input" placeholder="Eletrônicos Mota">
@error('clientForm.client_name') <span
class="text-red-500 text-sm">{{ $message }}</span>
@enderror
</div>
<div>
<label for="legal_name" class="form-label">Razão Social *</label>
<input type="text" wire:model="clientForm.legal_name" id="legal_name"
<input type="text" wire:model="clientForm.legal_name" placeholder="Mota Germano Eletrônicos LTDA" id="legal_name"
class="form-input">
@error('clientForm.legal_name') <span
class="text-red-500 text-sm">{{ $message }}</span> @enderror
@ -59,7 +59,7 @@ class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<div class="mt-4">
<label for="cnpj" class="form-label">CNPJ *</label>
<input type="text" wire:model="clientForm.cnpj" id="cnpj" class="form-input">
<input placeholder="54.505.316/0001-64" type="text" wire:model="clientForm.cnpj" id="cnpj" class="form-input">
@error('clientForm.cnpj') <span class="text-red-500 text-sm">{{ $message }}</span>
@enderror
</div>
@ -94,37 +94,57 @@ class="form-input">
</div>
<div>
<label for="carrier" class="form-label">Operadora</label>
<input type="text" wire:model="clientForm.carrier" id="carrier" class="form-input">
<input type="text" wire:model="clientForm.carrier" id="carrier" placeholder="ALGAR" class="form-input">
</div>
<div>
<label for="access_type" class="form-label">Tipo de Acesso</label>
<input type="text" wire:model="clientForm.access_type" id="access_type"
class.="form-input" placeholder="Ex: SSH, AnyDesk, VPN">
</div>
<div>
<label for="ddr_out" class="form-label">Número de saída chave</label>
<input type="text" wire:model="clientForm.ddr_out" id="ddr_out"
class="form-input" placeholder="(71) 3034-8350">
</div>
<div>
<label for="ddr_key" class="form-label">Número de entrada chave</label>
<input type="text" wire:model="clientForm.ddr_key" id="ddr_key"
class="form-input" placeholder="(71) 3034-8350">
</div>
<div>
<label for="server_ip" class="form-label">IP do Servidor</label>
<input type="text" wire:model="clientForm.server_ip" id="server_ip"
class="form-input">
@error('clientForm.server_ip') <span
class="form-input" placeholder="10.0.0.1">
@error('form.server_ip') <span
class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<div>
<label for="root_password" class="form-label">Senha (root)</label>
<input type="password" wire:model="clientForm.root_password" id="root_password"
class="form-input">
class="form-input" placeholder="************">
</div>
</div>
</div>
<hr class="form-divider">
<div class="form-group">
<h2 class="form-section-title">Observações e Credenciais Internas</h2>
<div>
<label for="observation" class="form-label">Detalhes da Configuração, VPN, ou Notas</label>
<textarea wire:model="clientForm.observation" id="observation" rows="5" class="form-input" placeholder="VPN: Fortclient, SENHA: *******"></textarea>
@error('clientForm.observation') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
</div>
<div class="form-group">
<h2 class="form-section-title">WhatsApp</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="whatsapp_number" class="form-label">Número do WhatsApp</label>
<input type="text" wire:model="clientForm.whatsapp_number" id="whatsapp_number"
class="form-input">
class="form-input" placeholder="(71) 3034-8350">
</div>
<div>
<label for="whatsapp_activation_date" class="form-label">Data Ativação

View File

@ -1,37 +1,37 @@
<div class="container grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6">
@foreach ($clients as $client)
<div class="client-card">
<div class="client-card-header">
<div class="client-avatar">
<img src="{{ asset('storage/' . $client->profile_image_path) }}" alt="Avatar do Cliente"
class="w-32 h-32 rounded-full object-cover">
</div>
<div x-data="{ open: false }" @click.outside="open = false" class="client-options-menu">
<button @click="open = !open" class="client-options-button">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400 hover:text-gray-700"
viewBox="0 0 20 20" fill="currentColor">
<path
d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z" />
</svg>
</button>
<ul x-show="open" class="client-options-list" x-transition>
<li><a href="#" class="client-option-item"
x-on:click.prevent="$dispatch('view-client', { id: '{{ $client->id }}' })">Ver Detalhes</a>
</li>
<li><a href=" #" class="client-option-item"
x-on:click.prevent="$dispatch('update-client', { id: '{{ $client->id }}' })">Editar
Cliente</a></li>
<li><a href="#" class="client-option-item text-red-600"
x-on:click.prevent="$dispatch('sure', { id: '{{ $client->id }}' })"> Excluir Cliente</a>
</li>
</ul>
</div>
<div class="client-card">
<div class="client-card-header">
<div class="client-avatar">
<img src="{{ asset('storage/' . $client->profile_image_path) }}" alt="Avatar do Cliente"
class="w-32 h-32 rounded-full object-cover">
</div>
<div class="client-card-name">
{{ $client->name }}
<div x-data="{ open: false }" @click.outside="open = false" class="client-options-menu">
<button @click="open = !open" class="client-options-button">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400 hover:text-gray-700"
viewBox="0 0 20 20" fill="currentColor">
<path
d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z" />
</svg>
</button>
<ul x-show="open" class="client-options-list" x-transition>
<li><a href="#" class="client-option-item"
x-on:click.prevent="$dispatch('client-detail', { id: '{{ $client->id }}' })">Ver Detalhes</a>
</li>
<li><a href="#" class="client-option-item"
x-on:click.prevent="$dispatch('update-client', { id: '{{ $client->id }}' })">Editar
Cliente</a></li>
<li><a href="#" class="client-option-item text-red-600"
x-on:click.prevent="$dispatch('sure', { id: '{{ $client->id }}' })"> Excluir Cliente</a>
</li>
</ul>
</div>
</div>
<div class="client-card-name">
{{ $client->name }}
</div>
</div>
@endforeach
</div>

View File

@ -10,43 +10,43 @@
<div class="user-list-content">
<div class="user-grid">
@forelse ($users as $user)
<div class="user-card-item">
<div class="user-info">
<span class="user-name">{{ $user->name }}</span>
<span class="user-email">{{ $user->email }}</span>
</div>
<div class="user-details">
{{-- <span class="user-permission">{{ ucfirst($user->permissions) }}</span> --}}
<span class="user-status">Ativo</span>
<div class="user-card-item">
<div class="user-info">
<span class="user-name">{{ $user->name }}</span>
<span class="user-email">{{ $user->email }}</span>
</div>
<div class="user-details">
{{-- <span class="user-permission">{{ $user->permissions }}</span> --}}
<span class="user-status">Ativo</span>
<div class="user-actions-group">
<div class="user-actions-group">
<button
@click="$dispatch('update-user', { id: '{{ $user->id }}' }); showUsers = false"
class="action-button text-blue-600 hover:text-blue-800 cursor-pointer"
title="Editar Usuário">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none"
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z" />
</svg>
</button>
<button
@click="$dispatch('update-user', { id: '{{ $user->id }}' }); showUsers = false"
class="action-button text-blue-600 hover:text-blue-800 cursor-pointer"
title="Editar Usuário">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none"
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z" />
</svg>
</button>
<button
@click="$dispatch('sure', { id: '{{ $user->id }}', isUser: true }); showUsers = false"
class="action-button text-red-600 hover:text-red-800 cursor-pointer"
title="Excluir Usuário">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none"
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M19 7l-.86 11.2a2 2 0 01-2 1.8H7.86a2 2 0 01-2-1.8L4.01 7h14.98zM9 5h6" />
</svg>
</button>
</div>
<button
@click="$dispatch('sure', { id: '{{ $user->id }}', isUser: true }); showUsers = false"
class="action-button text-red-600 hover:text-red-800 cursor-pointer"
title="Excluir Usuário">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none"
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M19 7l-.86 11.2a2 2 0 01-2 1.8H7.86a2 2 0 01-2-1.8L4.01 7h14.98zM9 5h6" />
</svg>
</button>
</div>
</div>
</div>
@empty
<p class="text-gray-500 col-span-full p-4">Nenhum usuário cadastrado.</p>
<p class="text-gray-500 col-span-full p-4">Nenhum usuário cadastrado.</p>
@endforelse
</div>
</div>