connect_error) { die("Connection failed: " . $mysqli->connect_error); } if (isset($_GET['id'])) { $client_id = $_GET['id']; $result = $mysqli->query("SELECT * FROM clients WHERE id = $client_id"); if ($result->num_rows > 0) { $client = $result->fetch_assoc(); echo "

Detalhes do Cliente: " . htmlspecialchars($client['name'] ?? '') . "

"; echo ""; echo ""; echo "
"; if (!empty($client['cpf'])) { echo "
CPF: " . htmlspecialchars($client['cpf'] ?? '') . "
"; // Adicione id="numero-cpf" } if (!empty($client['rg'])) { echo "
RG: " . htmlspecialchars($client['rg'] ?? '') . " (" . htmlspecialchars($client['rg_emissor'] ?? '') . ")
"; } if (!empty($client['sexo'])) { echo "
Sexo: " . htmlspecialchars($client['sexo'] ?? '') . "
"; } if (!empty($client['estado_civil'])) { echo "
Estado Civil: " . htmlspecialchars($client['estado_civil'] ?? '') . "
"; } if (!empty($client['phone'])) { echo "
Telefone: " . htmlspecialchars($client['phone'] ?? '') . ($client['whatsapp'] ? " (WhatsApp)" : "") . "
"; // Adicione id="numero-telefone" } if (!empty($client['email'])) { echo "
Email: " . htmlspecialchars($client['email'] ?? '') . "
"; } if (!empty($client['senha_meu_inss'])) { echo "
Senha do Meu INSS: " . htmlspecialchars($client['senha_meu_inss'] ?? '') . "
"; } if (!empty($client['perfil_instagram'])) { echo "
Perfil do Instagram: @" . htmlspecialchars($client['perfil_instagram'] ?? '') . "
"; } if (!empty($client['tipo_logradouro']) || !empty($client['endereco']) || !empty($client['bairro']) || !empty($client['cidade']) || !empty($client['estado']) || !empty($client['cep'])) { echo "
Endereço: " . htmlspecialchars($client['tipo_logradouro'] ?? '') . " " . htmlspecialchars($client['endereco'] ?? '') . ", " . htmlspecialchars($client['bairro'] ?? '') . ", " . htmlspecialchars($client['cidade'] ?? '') . " - " . htmlspecialchars($client['estado'] ?? '') . ", " . htmlspecialchars($client['cep'] ?? '') . "
"; } if (!empty($client['certidao_nascimento'])) { echo "
Certidão de Nascimento/Casamento: " . htmlspecialchars($client['certidao_nascimento'] ?? '') . "
"; } if (!empty($client['pis_pasep'])) { echo "
PIS/PASEP: " . htmlspecialchars($client['pis_pasep'] ?? '') . "
"; } if (!empty($client['inss_beneficio'])) { echo "
Número do Benefício INSS: " . htmlspecialchars($client['inss_beneficio'] ?? '') . "
"; } if (!empty($client['filiacao_pai'])) { echo "
Filiação (Pai): " . htmlspecialchars($client['filiacao_pai'] ?? '') . "
"; } if (!empty($client['filiacao_mae'])) { echo "
Filiação (Mãe): " . htmlspecialchars($client['filiacao_mae'] ?? '') . "
"; } echo "
"; // Abas echo "
"; // Conteúdo das abas echo "
"; echo "

Notas

"; // Formulário de nova nota echo "
"; // Inserir nova nota no banco de dados if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['note'])) { $note = $_POST['note']; $stmt = $mysqli->prepare("INSERT INTO notes (client_id, note) VALUES (?, ?)"); $stmt->bind_param("is", $client_id, $note); $stmt->execute(); $stmt->close(); } // Listar notas $notes_result = $mysqli->query("SELECT * FROM notes WHERE client_id = $client_id"); if ($notes_result->num_rows > 0) { while ($note = $notes_result->fetch_assoc()) { echo "
"; echo "

" . htmlspecialchars($note['note'] ?? '') . " (" . $note['created_at'] . ")

"; echo "
"; echo ""; echo ""; echo "
"; echo "
"; } } else { echo "

Sem notas.

"; } echo "
"; echo ""; echo ""; echo ""; } else { echo "

Cliente não encontrado.

"; } } else { echo "

ID do cliente não fornecido.

"; } $mysqli->close(); ?>