diff --git a/dados/dados.xlsx b/dados/dados.xlsx index 805b2e0..4046c6d 100755 Binary files a/dados/dados.xlsx and b/dados/dados.xlsx differ diff --git a/header.php b/header.php index f5a5f8e..9350221 100755 --- a/header.php +++ b/header.php @@ -1,7 +1,8 @@ - + - + + -
+
diff --git a/quiz/js/controllers.js b/quiz/js/controllers.js index 6c1f425..b19223f 100755 --- a/quiz/js/controllers.js +++ b/quiz/js/controllers.js @@ -286,7 +286,7 @@ S.derrotas = 0; S.play("success1", 1) S.v5by5 = false } - S.setupTransitionOut(); + //S.setupTransitionOut(); }, S.transitionDuration); }, 3000) } else { @@ -299,7 +299,7 @@ S.derrotas = 0; S.showGame = false S.lose = true S.play('wawawa', 0.5) - S.setupTransitionOut(); + //S.setupTransitionOut(); }, S.transitionDuration); }, 3000) } diff --git a/salvar.php b/salvar.php index 47756e1..6e09f64 100755 --- a/salvar.php +++ b/salvar.php @@ -8,7 +8,8 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; // Função para embaralhar um código -function embaralharCodigo($codigo) { +function embaralharCodigo($codigo) +{ $alpha = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $alphaReverso = strrev($alpha); $codigoArray = str_split($codigo); @@ -29,7 +30,7 @@ try { $dbname = "xcmg"; $conn = new mysqli($servername, $username, $password, $dbname); - + if ($conn->connect_error) { throw new Exception("Conexão falhou: " . $conn->connect_error); } @@ -37,6 +38,15 @@ try { if ($_SERVER["REQUEST_METHOD"] == "POST") { $arquivo = "dados/dados.xlsx"; + // Sanitiza os dados básicos + $nome = isset($_POST["nome"]) ? $conn->real_escape_string($_POST["nome"]) : ""; + $email = isset($_POST["email"]) ? $conn->real_escape_string($_POST["email"]) : ""; + $empresa = isset($_POST["empresa"]) ? $conn->real_escape_string($_POST["empresa"]) : ""; + $cargo = isset($_POST["cargo"]) ? $conn->real_escape_string($_POST["cargo"]) : ""; + $setor = isset($_POST["setor"]) ? $conn->real_escape_string($_POST["setor"]) : ""; + $segmento = isset($_POST["segmento"]) ? $conn->real_escape_string($_POST["segmento"]) : ""; + $funcionarios = isset($_POST["funcionarios"]) ? $conn->real_escape_string($_POST["funcionarios"]) : ""; + // Verifica se o arquivo existe if (file_exists($arquivo)) { $planilha = \PhpOffice\PhpSpreadsheet\IOFactory::load($arquivo); @@ -44,44 +54,27 @@ try { } else { $planilha = new Spreadsheet(); $sheet = $planilha->getActiveSheet(); - $sheet->setCellValue("A1", "Nome"); - $sheet->setCellValue("B1", "Empresa"); - $sheet->setCellValue("C1", "Cargo"); - $sheet->setCellValue("D1", "Telefone"); - $sheet->setCellValue("E1", "Email"); - $sheet->setCellValue("F1", "Cliente XCMG"); - $sheet->setCellValue("G1", "Usa Banco XCMG"); + $sheet->setCellValue("A1", "Data"); + $sheet->setCellValue("B1", "Nome"); + $sheet->setCellValue("C1", "Email"); + $sheet->setCellValue("D1", "Empresa"); + $sheet->setCellValue("E1", "Cargo"); + $sheet->setCellValue("F1", "Setor"); + $sheet->setCellValue("G1", "Segmento"); + $sheet->setCellValue("H1", "Funcionários"); } - // Sanitiza os dados básicos - $nome = $conn->real_escape_string($_POST["nome"]); - $empresa = $conn->real_escape_string($_POST["empresa"]); - $cargo = $conn->real_escape_string($_POST["cargo"]); - $telefone = $conn->real_escape_string($_POST["telefone"]); - - // Determina se é cliente XCMG - $cliente_xcmg = "Não"; - if (isset($_POST["conhece_xcmg"]) && isset($_POST["adquiriu_xcmg"])) { - $cliente_xcmg = "Sim"; - } - - // Determina se usa banco XCMG - $usa_banco_xcmg = "Não"; - if (isset($_POST["conhece_banco_xcmg"]) && isset($_POST["interesse_financiar_xcmg"])) { - $usa_banco_xcmg = "Sim"; - } - - // Email (mantemos no dados_adicionais para não requerer alteração da tabela) - $email = isset($_POST['email']) ? trim($_POST['email']) : ''; - // validação simples do formato do e-mail (se informado) + // Email validation if ($email !== '' && !filter_var($email, FILTER_VALIDATE_EMAIL)) { throw new Exception('E-mail inválido'); } - // Cria array com dados adicionais (incluindo e-mail) + // Cria array com dados adicionais $dados_adicionais = [ 'email' => $email, - 'topicos' => isset($_POST['topicos']) ? (array)$_POST['topicos'] : [], + 'setor' => $setor, + 'segmento' => $segmento, + 'funcionarios' => $funcionarios, 'data_cadastro' => date('Y-m-d H:i:s'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '' @@ -92,18 +85,22 @@ try { // Salva na planilha $linha = $sheet->getHighestRow() + 1; - $sheet->setCellValue("A$linha", $nome); - $sheet->setCellValue("B$linha", $empresa); - $sheet->setCellValue("C$linha", $cargo); - $sheet->setCellValue("D$linha", $telefone); - $sheet->setCellValue("E$linha", $email); - $sheet->setCellValue("F$linha", $cliente_xcmg); - $sheet->setCellValue("G$linha", $usa_banco_xcmg); + $sheet->setCellValue("A$linha", date('d/m/Y H:i:s')); + $sheet->setCellValue("B$linha", $nome); + $sheet->setCellValue("C$linha", $email); + $sheet->setCellValue("D$linha", $empresa); + $sheet->setCellValue("E$linha", $cargo); + $sheet->setCellValue("F$linha", $setor); + $sheet->setCellValue("G$linha", $segmento); + $sheet->setCellValue("H$linha", $funcionarios); $escritor = new Xlsx($planilha); $escritor->save($arquivo); - // Insere no banco + // Insere no banco (mantendo colunas antigas com valores padrão para evitar erros de esquema) + $telefone_vazio = ""; + $xcmg_vazio = "Não"; + $sql = "INSERT INTO cadastros ( nome, empresa, cargo, telefone, cliente_xcmg, usa_banco_xcmg, dados_adicionais, @@ -111,9 +108,15 @@ try { ) VALUES (?, ?, ?, ?, ?, ?, ?, 0, 0)"; $stmt = $conn->prepare($sql); - $stmt->bind_param("sssssss", - $nome, $empresa, $cargo, $telefone, - $cliente_xcmg, $usa_banco_xcmg, $dados_json + $stmt->bind_param( + "sssssss", + $nome, + $empresa, + $cargo, + $telefone_vazio, + $xcmg_vazio, + $xcmg_vazio, + $dados_json ); if (!$stmt->execute()) { @@ -122,18 +125,20 @@ try { $codigo = $conn->insert_id; $codigoEmbaralhado = embaralharCodigo($codigo); - + // Atualiza o código $sql_update = "UPDATE cadastros SET codigo = ? WHERE id = ?"; $stmt_update = $conn->prepare($sql_update); $stmt_update->bind_param("si", $codigoEmbaralhado, $codigo); - + if (!$stmt_update->execute()) { throw new Exception("Erro ao atualizar código: " . $stmt_update->error); } - if (isset($stmt_update)) $stmt_update->close(); - if (isset($stmt)) $stmt->close(); + if (isset($stmt_update)) + $stmt_update->close(); + if (isset($stmt)) + $stmt->close(); $conn->close(); // Limpa qualquer saída anterior @@ -151,7 +156,7 @@ try { } catch (Exception $e) { error_log($e->getMessage()); $_SESSION['erro'] = "Erro ao processar o cadastro. Por favor, tente novamente."; - + ob_clean(); header("Location: index.php"); exit(); @@ -161,4 +166,4 @@ try { ob_clean(); header("Location: index.php"); exit(); -?> +?> \ No newline at end of file diff --git a/style.css b/style.css index 605f46a..8b6c00c 100755 --- a/style.css +++ b/style.css @@ -1,7 +1,22 @@ -@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Rubik:ital,wght@0,300..900;1,300..900&display=swap'); +:root { + --cor-fundo-principal: #83B81A; + --cor-fundo-escuro: #537813; + --cor-texto-principal: #FFFFFF; + --cor-accent: #537813; + --tw-scale-x: 99% !important; +} + +@font-face { + font-family: 'General Sans'; + src: url('quiz/lib/ionic/css/GeneralSans-Variable.ttf'); +} +@font-face { + font-family: 'Inter'; + src: url('quiz/lib/ionic/css/Inter-VariableFont_opsz\,wght.ttf'); +} * { - font-family: poppins; + font-family: 'Inter'; } /* Definindo o fade-in */ @@ -20,10 +35,11 @@ p#codigo { } body { - background-color: #f8f9fa; - background-image: url(img/bg.jpg); - background-size: cover; - background-position: bottom; + background-color: var(--cor-fundo-principal); + background-image: url(/ius/quiz/img/quiz_patternBG.png); + background-size: 600px; + background-repeat: repeat; + background-position: center; touch-action: manipulation; -ms-touch-action: manipulation; -webkit-user-select: none; @@ -32,9 +48,14 @@ body { user-select: none; } +h2 { + font-family: 'General Sans'; + font-weight: 600; +} + #login button { - background-color: #007bff; - color: #fff; + background-color: var(--cor-fundo-escuro); + color: var(--cor-texto-principal); } /* Estilos específicos para mobile */ @@ -44,30 +65,40 @@ body { } input[type="text"], - input[type="date"] { + input[type="date"], + input[type="email"], + select { font-size: 16px !important; /* Previne zoom em iOS */ } } -:root { - --tw-scale-x: 99% !important; - -} button { - background-color: #0a0791; + background-color: var(--cor-fundo-escuro); + transition: transform 0.2s ease; +} + +button:active { + transform: scale(0.98); +} + +.bg-gold-xcmg { + background-color: var(--cor-fundo-escuro) !important; } .text-gold-xcmg, .peer-focus\:dark\:text-gold-xcmg { - color: #00f4bc; + color: var(--cor-fundo-escuro); } .border-gold-xcmg { - border-color: #00f4bc; + border-color: var(--cor-fundo-escuro); } .focus\:border-gold-xcmg, .dark\:border-gold-xcmg { - border-color: #00f4bc ; + border-color: var(--cor-fundo-escuro) ; +} +.peer-focus\:text-gold-xcmg { + color: var(--cor-fundo-escuro) !important; } .peer-focus\:-translate-y-4 {