Estiliza pagina de upload externo - responsiva (novo47)
This commit is contained in:
1 parent
05cd7b9c79
commit
631afa1c46
15 files changed
+1818
-24
No files matched your search
@@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Documentos Processados</title>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; margin: 20px; }
|
||||
.file-list {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
}
|
||||
.file-item {
|
||||
padding: 15px;
|
||||
border-bottom: 1px solid #eee;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.file-info { flex: 1; }
|
||||
.file-actions { margin-left: 15px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="file-list">
|
||||
<?php
|
||||
require_once 'config.php';
|
||||
|
||||
// Debug mode
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
echo "<!-- Debug: Iniciando listagem -->\n";
|
||||
|
||||
if ($conn->connect_error) {
|
||||
die("<div class='error'>Erro de conexão: " . $conn->connect_error . "</div>");
|
||||
}
|
||||
|
||||
if (!isset($_GET['client_id'])) {
|
||||
echo "<p>Selecione um cliente para ver seus documentos:</p>";
|
||||
$sql = "SELECT id, name FROM clients";
|
||||
echo "<!-- Debug: Executando query: $sql -->\n";
|
||||
|
||||
$result = $conn->query($sql);
|
||||
|
||||
if ($result === false) {
|
||||
echo "<div class='error'>Erro na query: " . $conn->error . "</div>";
|
||||
echo "<!-- Debug: Erro SQL: " . $conn->error . " -->\n";
|
||||
} else {
|
||||
echo "<!-- Debug: Encontrados " . $result->num_rows . " clientes -->\n";
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
echo "<div class='file-item'>";
|
||||
echo "<div class='file-info'>";
|
||||
echo "<strong>" . $row['name'] . "</strong>";
|
||||
echo "</div>";
|
||||
echo "<div class='file-actions'>";
|
||||
echo "<a href='index.php?page=doc_list&client_id=" . $row['id'] . "'>Ver documentos</a>";
|
||||
echo "</div>";
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$client_id = intval($_GET['client_id']);
|
||||
echo "<!-- Debug: Buscando documentos do cliente $client_id -->\n";
|
||||
|
||||
// Buscar documentos do cliente
|
||||
$sql = "SELECT d.*, c.name as client_name
|
||||
FROM documentos d
|
||||
JOIN clients c ON d.client_id = c.id
|
||||
WHERE d.client_id = ?
|
||||
ORDER BY d.data_upload DESC";
|
||||
|
||||
echo "<!-- Debug: Query documentos: $sql -->\n";
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
if ($stmt === false) {
|
||||
echo "<div class='error'>Erro ao preparar query: " . $conn->error . "</div>";
|
||||
} else {
|
||||
$stmt->bind_param("i", $client_id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
echo "<!-- Debug: Encontrados " . $result->num_rows . " documentos -->\n";
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
while ($doc = $result->fetch_assoc()) {
|
||||
echo "<div class='file-item'>";
|
||||
echo "<div class='file-info'>";
|
||||
echo "<strong>Tipo: " . ucfirst($doc['tipo']) . "</strong><br>";
|
||||
echo "Data: " . date("d/m/Y H:i", strtotime($doc['data_upload']));
|
||||
echo "</div>";
|
||||
echo "<div class='file-actions'>";
|
||||
echo "<a href='" . $doc['arquivo'] . "' target='_blank'>Visualizar</a> | ";
|
||||
echo "<a href='#' onclick='deleteDocument(" . $doc['id'] . ")'>Excluir</a>";
|
||||
echo "</div>";
|
||||
echo "</div>";
|
||||
}
|
||||
} else {
|
||||
echo "<p>Nenhum documento encontrado para este cliente.</p>";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Status messages -->
|
||||
<?php if (isset($_GET['status'])): ?>
|
||||
<div id="status" style="margin: 10px 0; padding: 10px; background: #e8f5e9;">
|
||||
<?php
|
||||
switch($_GET['status']) {
|
||||
case 'success':
|
||||
echo "Documento processado com sucesso!";
|
||||
break;
|
||||
case 'deleted':
|
||||
echo "Documento excluído com sucesso!";
|
||||
break;
|
||||
default:
|
||||
echo htmlspecialchars($_GET['status']);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function deleteDocument(id) {
|
||||
if (confirm('Deseja realmente excluir este documento?')) {
|
||||
window.location.href = 'index.php?page=delete_document&id=' + id;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user