From 578e26f5da25a3ee1f60fe4aba3dce4c67b6b895 Mon Sep 17 00:00:00 2001 From: LukiBeg Date: Tue, 25 Nov 2025 16:43:52 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Visualiza=C3=A7=C3=A3o=20de=20detalhes?= =?UTF-8?q?=20dos=20clientes=20(Commit=20anterior=20n=C3=A3o=20condiz=20co?= =?UTF-8?q?m=20essa=20feature).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Livewire/Admin/Client/DeleteClient.php | 1 - app/Livewire/Admin/Client/DetailClient.php | 30 +++ app/Livewire/Admin/Client/EditClient.php | 2 - app/Models/Client.php | 13 ++ app/Services/ClientService.php | 6 + .../0001_01_01_000000_create_users_table.php | 2 +- ...2025_11_06_142841_create_clients_table.php | 49 ++--- resources/views/dashboard.blade.php | 1 + resources/views/layouts/app.blade.php | 6 + .../admin/clients/add-client.blade.php | 46 +++- .../admin/clients/detail-client.blade.php | 197 ++++++++++++++++++ .../admin/clients/edit-client.blade.php | 38 +++- .../livewire/admin/show-client.blade.php | 60 +++--- .../views/livewire/admin/show-users.blade.php | 62 +++--- 14 files changed, 401 insertions(+), 112 deletions(-) create mode 100644 app/Livewire/Admin/Client/DetailClient.php create mode 100644 resources/views/livewire/admin/clients/detail-client.blade.php diff --git a/app/Livewire/Admin/Client/DeleteClient.php b/app/Livewire/Admin/Client/DeleteClient.php index 85b722f..e1ad1f6 100644 --- a/app/Livewire/Admin/Client/DeleteClient.php +++ b/app/Livewire/Admin/Client/DeleteClient.php @@ -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!'); } diff --git a/app/Livewire/Admin/Client/DetailClient.php b/app/Livewire/Admin/Client/DetailClient.php new file mode 100644 index 0000000..5a905c2 --- /dev/null +++ b/app/Livewire/Admin/Client/DetailClient.php @@ -0,0 +1,30 @@ +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'); + } +} diff --git a/app/Livewire/Admin/Client/EditClient.php b/app/Livewire/Admin/Client/EditClient.php index 811ee00..0dc71da 100644 --- a/app/Livewire/Admin/Client/EditClient.php +++ b/app/Livewire/Admin/Client/EditClient.php @@ -21,8 +21,6 @@ class EditClient extends Component // public ClientService $clientService; #[On('update-client')] - - public function loadClient($id) { try { diff --git a/app/Models/Client.php b/app/Models/Client.php index 8ca4daf..3ccf58e 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -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. * diff --git a/app/Services/ClientService.php b/app/Services/ClientService.php index 11d53c8..aabe59c 100644 --- a/app/Services/ClientService.php +++ b/app/Services/ClientService.php @@ -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(); + } } diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index 3a6f800..e01ce60 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -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(); diff --git a/database/migrations/2025_11_06_142841_create_clients_table.php b/database/migrations/2025_11_06_142841_create_clients_table.php index ff53844..58a3fd8 100644 --- a/database/migrations/2025_11_06_142841_create_clients_table.php +++ b/database/migrations/2025_11_06_142841_create_clients_table.php @@ -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'); } -}; \ No newline at end of file +}; diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 9060843..5faa88e 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -8,6 +8,7 @@ + diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 4b99110..5b14c93 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -76,6 +76,12 @@ +
  • + + VPN's + +
  • + @endauth diff --git a/resources/views/livewire/admin/clients/add-client.blade.php b/resources/views/livewire/admin/clients/add-client.blade.php index 4b62956..af17eb7 100644 --- a/resources/views/livewire/admin/clients/add-client.blade.php +++ b/resources/views/livewire/admin/clients/add-client.blade.php @@ -22,7 +22,7 @@ class="fixed inset-y-0 right-0 flex max-w-full pl-10" @click.away="showClientMod Adicionar Novo Cliente + + + + @if($client) +
    +
    + +
    +

    Informações Principais

    + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + +
    + @if($client->profile_image_path) +
    + Logo +
    + Abrir imagem + @else + Sem logo + @endif +
    +
    +
    +
    + +
    + +
    +

    Detalhes do Servidor PBX

    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    + +
    + + +
    +
    + + +
    + +
    + + +
    +
    + +
    + + +
    +
    +
    +
    + +
    + +
    +

    Observações e Credenciais Internas

    +
    + +
    +
    + +
    + +
    +

    WhatsApp

    +
    +
    + + +
    +
    + + +
    +
    +
    + +
    +
    +
    +

    Módulos & Recursos

    + +
    + + + +
    + +
    + + +
    +
    +
    +
    + +
    +
    + @else +
    +
    + + Carregando... +
    +
    + @endif + +
    +
    + +
    +
    + + + + + \ No newline at end of file diff --git a/resources/views/livewire/admin/clients/edit-client.blade.php b/resources/views/livewire/admin/clients/edit-client.blade.php index b3641b5..144031d 100644 --- a/resources/views/livewire/admin/clients/edit-client.blade.php +++ b/resources/views/livewire/admin/clients/edit-client.blade.php @@ -22,7 +22,7 @@ class="fixed inset-y-0 right-0 flex max-w-full pl-10" @click.away="showEditClien Edição de cliente - - - - +
    +
    +
    + Avatar do Cliente
    -
    - {{ $client->name }} +
    + + + +
    +
    + {{ $client->name }} +
    +
    @endforeach
    \ No newline at end of file diff --git a/resources/views/livewire/admin/show-users.blade.php b/resources/views/livewire/admin/show-users.blade.php index ef699eb..467fb74 100644 --- a/resources/views/livewire/admin/show-users.blade.php +++ b/resources/views/livewire/admin/show-users.blade.php @@ -10,43 +10,43 @@
    @forelse ($users as $user) -
    - -
    - {{-- {{ ucfirst($user->permissions) }} --}} - Ativo +
    + +
    + {{-- {{ $user->permissions }} --}} + Ativo -
    +
    @empty -

    Nenhum usuário cadastrado.

    +

    Nenhum usuário cadastrado.

    @endforelse