behring-bjj-face-api / index.html
FelipeFavalli's picture
Upload 15 files
98e9bb3 verified
Raw History Blame Contribute Delete
107 kB
<!DOCTYPE html> <html lang="pt-BR"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Behring Jiu-Jitsu - São Bento do Sapucaí</title> <link rel="stylesheet" href="style.css"> <!-- jsPDF & AutoTable CDNs for generating attendance reports --> <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.29/jspdf.plugin.autotable.min.js"></script> <!-- Global Script Error Debugger --> <script> window.onerror = function(message, source, lineno, colno, error) { var div = document.createElement('div'); div.style.position = 'fixed'; div.style.top = '0'; div.style.left = '0'; div.style.width = '100%'; div.style.background = '#ef4444'; div.style.color = '#ffffff'; div.style.padding = '20px'; div.style.zIndex = '99999'; div.style.fontFamily = 'monospace'; div.style.fontSize = '14px'; div.style.boxSizing = 'border-box'; div.style.lineHeight = '1.5'; div.innerHTML = '<strong>Erro de Script Detectado:</strong><br>' + message + '<br>Arquivo: ' + source + '<br>Linha: ' + lineno + ' Coluna: ' + colno; document.body.appendChild(div); return false; }; </script> <!-- Supabase CDN Client --> <script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script> </head> <body> <!-- ==================== LOGIN SCREEN ==================== --> <div id="auth-screen" class="auth-wrapper"> <div class="card auth-card"> <div class="auth-logo"> <img src="logo.png" alt="Logo Behring Jiu-Jitsu" style="width: 180px; height: auto; margin-bottom: 8px; filter: drop-shadow(0 0 10px rgba(224, 90, 0, 0.3));"> </div> <h1 class="auth-title">Behring BJJ</h1> <p class="auth-subtitle">São Bento do Sapucaí • Associação</p> <!-- LOGIN FORM --> <form id="login-form" onsubmit="handleLogin(event); return false;"> <div class="form-group"> <label class="form-label" for="username">Usuário / Nome</label> <input type="text" id="username" class="form-control" placeholder="professor ou seu nome de aluno" required> </div> <div class="form-group"> <label class="form-label" for="password">Senha</label> <input type="password" id="password" class="form-control" placeholder="••••••••" required> </div> <div class="form-group"> <label class="form-label" for="login-role">Entrar como</label> <select id="login-role" class="form-control form-select"> <option value="student">Aluno</option> <option value="professor">Professor / Admin</option> </select> </div> <button type="submit" class="btn btn-primary btn-block" style="margin-top: 24px;">Entrar no App</button> <div style="margin-top: 16px; font-size: 13px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;"> <a href="#" onclick="toggleAuthForm('register'); return false;">Não tem uma conta? Cadastre-se</a> <a href="#" onclick="openModal('recover-password-modal'); return false;" style="color: var(--text-muted);">Esqueci minha senha</a> </div> </form> <!-- REGISTER FORM --> <form id="register-form" onsubmit="handleRegister(event); return false;" style="display: none;"> <div class="form-group"> <label class="form-label" for="reg-name">Nome Completo</label> <input type="text" id="reg-name" class="form-control" placeholder="Ex: Lucas Souza" required> </div> <div class="form-group"> <label class="form-label" for="reg-email">Endereço de E-mail</label> <input type="email" id="reg-email" class="form-control" placeholder="Ex: lucas@provedor.com" required> </div> <div class="form-group"> <label class="form-label" for="reg-whatsapp">WhatsApp</label> <input type="tel" id="reg-whatsapp" class="form-control" placeholder="Ex: (35) 99999-9999" required> </div> <div class="form-group"> <label class="form-label" for="reg-password">Senha de Acesso</label> <input type="password" id="reg-password" class="form-control" placeholder="Mínimo 4 caracteres" required minlength="4"> </div> <div class="form-group"> <label class="form-label" for="reg-confirm">Confirmar Senha</label> <input type="password" id="reg-confirm" class="form-control" placeholder="Digite a senha novamente" required minlength="4"> </div> <button type="submit" class="btn btn-primary btn-block" style="margin-top: 24px;">Criar Conta e Entrar</button> <div style="margin-top: 16px; font-size: 13px;"> <a href="#" onclick="toggleAuthForm('login'); return false;">Já tem uma conta? Faça Login</a> </div> </form> </div> </div> <!-- ==================== MAIN APPLICATION CONTAINER ==================== --> <!-- ==================== MAIN APPLICATION CONTAINER ==================== --> <div id="app-container" style="display: none; flex-direction: row; flex: 1; min-height: 100vh;"> <!-- COLLAPSIBLE SIDEBAR --> <aside id="app-sidebar" class="app-sidebar"> <div class="sidebar-header"> <div class="brand"> <div class="brand-logo"> <img src="logo.png" alt="Logo Behring Jiu-Jitsu" style="width: 36px; height: 36px; object-fit: contain;"> </div> <div class="brand-text"> <h2 style="font-size: 15px; font-weight: 700; margin: 0; white-space: nowrap;">Behring BJJ</h2> <span style="font-size: 10px; color: var(--text-muted); display: block; white-space: nowrap;">S.B. do Sapucaí</span> </div> </div> <button id="sidebar-toggle" class="sidebar-toggle-btn" aria-label="Recolher Menu"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path id="toggle-icon-path" d="M15 19l-7-7 7-7"/> </svg> </button> </div> <nav class="sidebar-nav" style="flex: 1; padding: 16px 0; overflow-y: auto;"> <!-- Professor Tabs --> <ul id="professor-tabs" class="nav-tabs-vertical" style="display: none;"> <li class="nav-tab-item active" onclick="switchTab('prof-presence')"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg> <span class="nav-tab-label">Fazer Chamada</span> </li> <li class="nav-tab-item" onclick="switchTab('prof-dashboard')"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="9"/><rect x="14" y="3" width="7" height="5"/><rect x="14" y="12" width="7" height="9"/><rect x="3" y="16" width="7" height="5"/></svg> <span class="nav-tab-label">Dashboard</span> </li> <li class="nav-tab-item" onclick="switchTab('prof-students')"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg> <span class="nav-tab-label">Alunos</span> </li> <li class="nav-tab-item" onclick="switchTab('prof-history')"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg> <span class="nav-tab-label">Histórico Geral</span> </li> <li class="nav-tab-item" onclick="switchTab('prof-events')"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg> <span class="nav-tab-label">Eventos & Avisos</span> </li> <li class="nav-tab-item" onclick="switchTab('prof-settings')"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg> <span class="nav-tab-label">Configurações</span> </li> </ul> <!-- Student Tabs --> <ul id="student-tabs" class="nav-tabs-vertical" style="display: none;"> <li class="nav-tab-item active" onclick="switchTab('stud-home')"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg> <span class="nav-tab-label">Início</span> </li> <li class="nav-tab-item" onclick="switchTab('stud-profile')"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg> <span class="nav-tab-label">Perfil & Faixa</span> </li> <li class="nav-tab-item" onclick="switchTab('stud-history')"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg> <span class="nav-tab-label">Minhas Presenças</span> </li> </ul> </nav> </aside> <!-- MAIN LAYOUT WRAPPER --> <div id="main-layout-wrapper" style="display: flex; flex-direction: column; flex: 1; min-width: 0; background: var(--bg-primary);"> <!-- TOP BAR (HEADER) --> <header class="app-header" style="border-bottom: 1px solid var(--border-color); background: var(--bg-secondary);"> <div style="padding: 0 24px; height: 70px; display: flex; align-items: center; justify-content: flex-end;"> <div class="user-profile-nav" style="display: flex; align-items: center; gap: 16px;"> <div class="nav-user-info" style="text-align: right;"> <div id="nav-user-display" class="nav-user-name">Felipe</div> <div id="nav-user-role-display" class="nav-user-role">Professor</div> </div> <button class="btn btn-secondary btn-sm" onclick="handleLogout()">Sair</button> </div> </div> </header> <!-- MAIN VIEW AREA --> <main class="main-content" style="overflow-y: auto; flex: 1;"> <div class="container"> <!-- ==================== PROFESSOR VIEWS ==================== --> <!-- 1. PROFESSOR DASHBOARD --> <section id="view-prof-dashboard" class="view-section active"> <div class="view-header"> <div class="view-title"> <h1>Painel Geral</h1> <p>Visão geral das atividades da associação</p> </div> </div> <!-- Stats Row --> <div class="grid-4 mb-24"> <div class="card stat-card clickable-card" onclick="switchTab('prof-students')"> <div class="stat-icon"> <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"/></svg> </div> <div> <div id="dashboard-total-students" class="stat-value">0</div> <div class="stat-label">Alunos Ativos</div> </div> </div> <div class="card stat-card clickable-card" onclick="switchTab('prof-presence')"> <div class="stat-icon"> <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"/></svg> </div> <div> <div id="dashboard-today-presence" class="stat-value">0</div> <div class="stat-label">Presenças Hoje</div> </div> </div> <div class="card stat-card clickable-card" onclick="switchTab('prof-events')"> <div class="stat-icon"> <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg> </div> <div> <div id="dashboard-next-events" class="stat-value">0</div> <div class="stat-label">Eventos Agendados</div> </div> </div> <div class="card stat-card clickable-card" onclick="switchTab('prof-events')"> <div class="stat-icon"> <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"/></svg> </div> <div> <div id="dashboard-announcements-count" class="stat-value">0</div> <div class="stat-label">Avisos no Mural</div> </div> </div> </div> <!-- Charts & Recent Events --> <div class="grid-2"> <div class="card"> <h3 class="mb-24">Distribuição de Faixas</h3> <div id="belt-chart-container" style="display: flex; flex-direction: column; gap: 16px;"> <!-- Will be dynamically populated with custom visual bars --> </div> </div> <div class="card"> <h3 class="mb-24">Próximos Eventos</h3> <div id="dashboard-events-list"> <!-- Dynamic events list --> </div> </div> </div> <!-- Mural de Avisos & Grade de Aulas (Adicionado) --> <div class="grid-2 mt-24"> <div class="card"> <h3 class="mb-24">Mural de Avisos</h3> <div id="dashboard-announcements-list" class="announcements-timeline"> <!-- Dynamic announcements list --> </div> </div> <div class="card"> <h3 class="mb-24">Grade de Aulas</h3> <div class="grid-2" style="gap: 20px;"> <div> <h4 class="text-accent mb-12" style="font-size: 13px;">1. Dojo Centro</h4> <table class="table" style="font-size: 12px; width: 100%;"> <tbody id="dashboard-schedule-centro-tbody"> <!-- Dynamically populated --> </tbody> </table> </div> <div> <h4 class="text-accent mb-12" style="font-size: 13px;">2. Dojo Quilombo</h4> <table class="table" style="font-size: 12px; width: 100%;"> <tbody id="dashboard-schedule-quilombo-tbody"> <!-- Dynamically populated --> </tbody> </table> </div> </div> </div> </div> </section> <!-- 2. PROFESSOR STUDENTS LIST --> <section id="view-prof-students" class="view-section"> <div class="view-header"> <div class="view-title"> <h1>Gestão de Alunos</h1> <p>Graduações, frequência e dados cadastrais</p> </div> <button class="btn btn-primary" onclick="openModal('add-student-modal')">Cadastrar Aluno 🥋+</button> </div> <!-- Search and filters --> <div class="search-bar-container"> <input type="text" id="search-students" class="form-control" placeholder="Buscar aluno por nome..." oninput="filterStudents()"> <select id="filter-belt" class="form-control form-select" style="max-width: 200px;" onchange="filterStudents()"> <option value="all">Todas as Faixas</option> <option value="Branca">Branca</option> <option value="Azul">Azul</option> <option value="Roxa">Roxa</option> <option value="Marrom">Marrom</option> <option value="Preta">Preta</option> </select> </div> <!-- Students Table --> <div class="card" style="padding: 0; overflow: hidden;"> <div class="table-responsive"> <table class="table-bjj"> <thead> <tr> <th>Aluno</th> <th>Faixa / Graus</th> <th>Frequência</th> <th>Selfie de Ref.</th> <th>Ações</th> </tr> </thead> <tbody id="students-table-body"> <!-- Dynamic rows --> </tbody> </table> </div> </div> </section> <!-- 3. PROFESSOR COMBINED PRESENCE (Manual & IA) --> <section id="view-prof-presence" class="view-section"> <div class="view-header"> <div class="view-title"> <h1>Fazer Chamada Diária</h1> <p>Registre a presença dos alunos de forma automática por foto ou manual</p> </div> <div style="font-size: 14px; font-weight: 600; color: var(--text-muted); background: var(--bg-secondary); padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-color);" id="presence-current-date"> 04/06/2026 </div> </div> <!-- Sub-navigation toggle tabs --> <div style="display: flex; gap: 8px; margin-bottom: 24px; background: rgba(255, 255, 255, 0.02); padding: 4px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); max-width: 440px;"> <button type="button" id="btn-presence-toggle-ia" class="btn btn-primary btn-sm" style="flex: 1; padding: 10px 16px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s;" onclick="setPresenceTab('ia')"> Chamada por Foto (IA) </button> <button type="button" id="btn-presence-toggle-manual" class="btn btn-secondary btn-sm" style="flex: 1; padding: 10px 16px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; background: transparent; border: none; color: var(--text-muted);" onclick="setPresenceTab('manual')"> Chamada Manual (Lista) </button> </div> <!-- IA Photo Presence Container --> <div id="presence-ia-container" style="display: block;"> <div class="grid-2 mb-24"> <div class="card"> <h3 class="mb-24">1. Enviar Foto do Treino</h3> <!-- Class selector for AI presence --> <div class="form-group mb-16"> <label class="form-label" for="ia-class-filter">Horário do Treino para Registro</label> <select id="ia-class-filter" class="form-control form-select"> <option value="Qualquer Horário">Qualquer Horário</option> <option value="Manhã (07:00)">Manhã (07:00)</option> <option value="Almoço (12:00)">Almoço (12:00)</option> <option value="Tarde (16:00)">Tarde (16:00)</option> <option value="Noite 1 (18:30)">Noite 1 (18:30)</option> <option value="Noite 2 (20:00)">Noite 2 (20:00)</option> </select> </div> <!-- File inputs --> <div class="dropzone" onclick="document.getElementById('group-photo-input').click()"> <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/> </svg> <h4>Arraste a foto da turma ou clique para selecionar</h4> <p style="margin-top: 8px; font-size: 13px;">Formatos suportados: JPG, PNG. Máximo 10MB.</p> </div> <input type="file" id="group-photo-input" style="display: none;" accept="image/*" onchange="previewGroupPhoto(event)"> <div id="group-photo-preview-container" class="preview-container"> <img id="group-photo-preview" class="group-photo-preview" src="#" alt="Preview do grupo"> <div class="mt-12"> <button id="btn-run-ia" class="btn btn-primary" onclick="simulateIARecognition()">Reconhecer Faces com InsightFace</button> </div> </div> <!-- Collapsible Advanced Settings --> <details style="margin-top: 24px; font-size: 12px; color: var(--text-muted); cursor: pointer;"> <summary style="font-weight: 600; color: var(--text-secondary); outline: none; margin-bottom: 8px; user-select: none;"> ⚙️ Configurações Avançadas (Conexão da IA) </summary> <div style="background: rgba(255, 255, 255, 0.01); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px; margin-top: 8px; cursor: default;" onclick="event.stopPropagation()"> <div class="form-group mb-12"> <label class="form-label" for="ia-api-url" style="font-size: 11px;">URL da API de Reconhecimento</label> <input type="url" id="ia-api-url" class="form-control" style="font-size: 12px; padding: 6px 10px;" placeholder="Ex: https://sua-api.com" value="http://localhost:8000" onchange="updatePresenceFaceApiUrl(this.value)"> </div> <div class="form-group mb-12"> <label class="form-label" for="ia-threshold" style="font-size: 11px; display: flex; justify-content: space-between;"> <span>Limite de Similaridade (Limiar)</span> <span id="ia-threshold-value" style="font-weight: bold; color: var(--accent-color);">0.40</span> </label> <input type="range" id="ia-threshold" class="form-control" style="padding: 0; cursor: pointer; accent-color: var(--accent-color);" min="0.10" max="0.90" step="0.05" value="0.40" oninput="document.getElementById('ia-threshold-value').textContent = parseFloat(this.value).toFixed(2); updatePresenceFaceApiThreshold(this.value)"> </div> <div style="border-top: 1px dashed var(--border-color); padding-top: 12px; font-size: 11px;"> <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;"> <span style="color: var(--text-muted);">Alunos sem Vetor IA (com selfie):</span> <span id="ia-backfill-count" style="font-weight: bold; color: var(--warning-color);">0</span> </div> <button type="button" id="btn-ia-backfill" class="btn btn-secondary btn-sm" style="width: 100%; font-size: 11px; padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); background: rgba(255,255,255,0.03); color: var(--text-color); cursor: pointer;" onclick="runManualBackfill()"> Sincronizar Vetores Faltantes </button> </div> </div> </details> </div> <div class="card"> <h3 class="mb-24">2. Resultado do Reconhecimento</h3> <div id="ia-no-result" style="text-align: center; padding: 40px 0; color: var(--text-muted);"> <svg width="48" height="48" fill="none" viewBox="0 0 24 24" stroke="currentColor" style="opacity: 0.5; margin-bottom: 16px;"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.663 17h4.673M12 3v1m6.364.364l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"/> </svg> <p>Aguardando o upload do treino de grupo para computar as presenças via reconhecimento facial.</p> </div> <div id="ia-result-container" style="display: none;"> <!-- Connection Status Banners --> <div id="ia-connection-warning" style="display: none; padding: 12px; margin-bottom: 20px; border-radius: var(--radius-sm); border: 1.5px dashed var(--warning-color); background: rgba(224, 134, 0, 0.05); color: var(--text-color); font-size: 13px; align-items: center; gap: 10px;"> <span style="font-size: 16px;">⚠️</span> <div> <strong>Servidor de IA Indisponível:</strong> Não foi possível conectar ao servidor de Reconhecimento Facial em nuvem. Usando modo de simulação local. </div> </div> <div id="ia-connection-success" style="display: none; padding: 12px; margin-bottom: 20px; border-radius: var(--radius-sm); border: 1.5px solid var(--success-color); background: rgba(34, 197, 94, 0.05); color: var(--text-color); font-size: 13px; align-items: center; gap: 10px;"> <span style="font-size: 16px;">✅</span> <div> <strong>Conexão Estabelecida:</strong> Reconhecimento facial processado com sucesso pelo servidor de IA em nuvem. </div> </div> <!-- Teacher Responsible Card --> <div id="ia-teacher-info" style="display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding: 12px; background: rgba(224, 90, 0, 0.05); border: 1.5px solid var(--accent-color); border-radius: var(--radius-sm);"> <div id="ia-teacher-photo-container"> <!-- Will be dynamically populated with professor photo or initials --> </div> <div> <div style="font-size: 10px; color: var(--text-muted); font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px;">Professor da Aula</div> <div id="ia-teacher-name" style="font-weight: 700; font-size: 14px; color: var(--text-primary);">Sensei Hugo</div> </div> </div> <div id="ia-stats" class="mb-24" style="background: var(--bg-secondary); padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); font-size: 13px;"> <!-- Dynamic stats --> </div> <div class="table-responsive" style="max-height: 300px; overflow-y: auto;"> <table class="table-bjj"> <thead> <tr> <th>Aluno</th> <th>Status</th> <th>Confiança</th> </tr> </thead> <tbody id="ia-result-tbody"> <!-- Dynamic matched list --> </tbody> </table> </div> <div class="flex-center mt-24"> <button class="btn btn-primary" onclick="applyIAPresence()">Aplicar Presenças</button> </div> </div> </div> </div> </div> <!-- Manual Presence Container --> <div id="presence-manual-container" style="display: none;"> <!-- Filtros e Montagem de Turma --> <div class="card mb-24" style="padding: 16px;"> <div class="grid-2" style="gap: 16px;"> <div class="form-group" style="margin-bottom: 0;"> <label class="form-label" for="presence-class-filter">Selecione a Turma / Horário (Montagem da Turma)</label> <select id="presence-class-filter" class="form-control form-select" onchange="renderPresenceChecklist()"> <option value="all">Todas as Turmas (Montagem Livre)</option> <option value="Manhã (07:00)">Manhã (07:00)</option> <option value="Almoço (12:00)">Almoço (12:00)</option> <option value="Tarde (16:00)">Tarde (16:00)</option> <option value="Noite 1 (18:30)">Noite 1 (18:30)</option> <option value="Noite 2 (20:00)">Noite 2 (20:00)</option> <option value="Qualquer Horário">Qualquer Horário</option> </select> </div> <div class="form-group" style="margin-bottom: 0;"> <label class="form-label" for="presence-search-input">Pesquisar por Nome ou Faixa (Adicionar Aluno Eventual)</label> <input type="text" id="presence-search-input" class="form-control" placeholder="Digite o nome ou a faixa..." oninput="renderPresenceChecklist()"> </div> </div> </div> <div class="card mb-24"> <div class="grid-3" id="presence-checklist-grid"> <!-- Cards of all students to easily click checkin --> </div> </div> <div class="flex-center"> <button class="btn btn-primary" onclick="saveManualPresence()">Salvar Lista de Presença</button> </div> </div> </section> <!-- 5. PROFESSOR GENERAL PRESENCE HISTORY --> <section id="view-prof-history" class="view-section"> <div class="view-header"> <div class="view-title"> <h1>Histórico Geral de Presenças</h1> <p>Histórico detalhado de frequências e métodos de verificação</p> </div> </div> <div class="search-bar-container"> <input type="text" id="search-history-student" class="form-control" placeholder="Buscar por aluno..." oninput="filterGeneralHistory()"> <input type="date" id="filter-history-date" class="form-control" onchange="filterGeneralHistory()"> <select id="filter-history-method" class="form-control form-select" style="max-width: 180px;" onchange="filterGeneralHistory()"> <option value="all">Qualquer Método</option> <option value="manual">Manual</option> <option value="ia">Foto IA</option> </select> <button class="btn btn-primary" onclick="exportAttendanceToPDF()" style="background-color: #2563eb; border-color: #2563eb; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px;"> <svg width="14" height="14" fill="currentColor" viewBox="0 0 16 16" style="margin-top: -1px;"> <path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/> <path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"/> </svg> Exportar PDF </button> </div> <div class="card" style="padding: 0; overflow: hidden;"> <div class="table-responsive"> <table class="table-bjj"> <thead> <tr> <th>Data / Hora</th> <th>Aluno</th> <th>Faixa</th> <th>Turma</th> <th>Método</th> <th>Ações</th> </tr> </thead> <tbody id="prof-history-tbody"> <!-- Dynamic list of records --> </tbody> </table> </div> </div> </section> <!-- 6. PROFESSOR ANNOUNCEMENTS & EVENTS --> <section id="view-prof-events" class="view-section"> <div class="view-header"> <div class="view-title"> <h1>Eventos & Mural de Avisos</h1> <p>Publique comunicados e eventos na agenda da associação</p> </div> </div> <div class="grid-2"> <div class="card"> <div class="view-header" style="margin-bottom: 20px;"> <h3>Gerenciar Eventos</h3> <button class="btn btn-secondary btn-sm" onclick="openCreateEventModal()">+ Evento</button> </div> <div id="prof-events-list"> <!-- Dynamic list --> </div> </div> <div class="card"> <div class="view-header" style="margin-bottom: 20px;"> <h3>Mural de Avisos</h3> <button class="btn btn-secondary btn-sm" onclick="openCreateAnnouncementModal()">+ Aviso</button> </div> <div id="prof-announcements-list"> <!-- Dynamic list --> </div> </div> </div> <!-- Grade de Aulas Editor Card --> <div class="card mt-24"> <h3 class="mb-12">Grade de Aulas (Horários)</h3> <p class="mb-24 text-muted" style="font-size: 13px;">Adicione, remova ou altere os horários de aulas de cada Dojo. Clique em "Salvar Grade de Aulas" no final para atualizar o banco de dados.</p> <div class="grid-2" style="gap: 24px;"> <!-- Dojo Centro Column --> <div class="card" style="background: rgba(0,0,0,0.15); border: 1px solid var(--border-color); padding: 16px;"> <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;"> <h4 class="text-accent" style="margin-bottom: 0;">1. Dojo Centro</h4> <button class="btn btn-secondary btn-sm" onclick="addScheduleRow('centro')">+ Adicionar Horário</button> </div> <div id="prof-schedule-centro-list" style="display: flex; flex-direction: column; gap: 12px;"> <!-- Dynamic rows of inputs --> </div> </div> <!-- Dojo Quilombo Column --> <div class="card" style="background: rgba(0,0,0,0.15); border: 1px solid var(--border-color); padding: 16px;"> <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;"> <h4 class="text-accent" style="margin-bottom: 0;">2. Dojo Quilombo</h4> <button class="btn btn-secondary btn-sm" onclick="addScheduleRow('quilombo')">+ Adicionar Horário</button> </div> <div id="prof-schedule-quilombo-list" style="display: flex; flex-direction: column; gap: 12px;"> <!-- Dynamic rows of inputs --> </div> </div> </div> <div class="flex-center mt-24"> <button class="btn btn-primary" onclick="saveDojoSchedules()">Salvar Grade de Aulas</button> </div> </div> </section> <!-- 7. PROFESSOR SETTINGS --> <section id="view-prof-settings" class="view-section"> <div class="view-header"> <div class="view-title"> <h1>Configurações do Sistema</h1> <p>Gerencie o servidor de inteligência artificial e outras configurações globais</p> </div> </div> <div class="grid-2"> <div class="card"> <h3 class="mb-24">Servidor de Reconhecimento Facial (InsightFace Cloud)</h3> <div class="form-group mb-16"> <label class="form-label" for="settings-ia-api-url">URL da API de Reconhecimento</label> <input type="url" id="settings-ia-api-url" class="form-control" placeholder="Ex: https://sua-api.com" value="http://localhost:8000"> <span class="text-muted" style="font-size: 11px; display: block; margin-top: 4px;">Este endereço é usado para sincronizar selfies de alunos e processar presenças automáticas.</span> </div> <div class="form-group mb-24"> <label class="form-label" for="settings-ia-threshold" style="display: flex; justify-content: space-between;"> <span>Limite de Similaridade (Limiar)</span> <span id="settings-ia-threshold-value" style="font-weight: bold; color: var(--accent-color);">0.40</span> </label> <input type="range" id="settings-ia-threshold" class="form-control" style="padding: 0; cursor: pointer; accent-color: var(--accent-color);" min="0.10" max="0.90" step="0.05" value="0.40" oninput="document.getElementById('settings-ia-threshold-value').textContent = parseFloat(this.value).toFixed(2)"> <span class="text-muted" style="font-size: 11px; display: block; margin-top: 4px;">Valores menores são mais tolerantes; valores maiores exigem mais semelhança física. Padrão: 0.40.</span> </div> <div style="background: rgba(255,255,255,0.02); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 24px;"> <h4 style="margin-top: 0; margin-bottom: 12px; font-size: 13px;">Status do Servidor</h4> <div id="settings-ia-status-msg" style="font-size: 13px; margin-bottom: 12px;"> <span style="color: var(--text-muted);">Clique no botão abaixo para verificar a conectividade do servidor configurado.</span> </div> <button type="button" class="btn btn-secondary btn-sm" onclick="testFaceApiConnection()">Testar Conexão</button> </div> <button type="button" class="btn btn-primary btn-block" onclick="saveFaceApiConfig()">Salvar Configurações</button> </div> <div class="card"> <h3 class="mb-24">Sincronização de Vetores Faltantes</h3> <p class="text-muted mb-24" style="font-size: 13px;">Se você trocou de servidor de IA recentemente ou possui alunos com selfies enviadas mas sem o vetor biométrico gerado (devido a falhas temporárias de conexão), você pode recalcular os vetores de todos esses alunos de uma vez.</p> <div style="background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 24px;"> <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;"> <span style="font-weight: 500; font-size: 13px;">Alunos sem Vetor IA (com selfie salva):</span> <span id="settings-ia-backfill-count" style="font-weight: bold; color: var(--warning-color); font-size: 14px;">0</span> </div> <div id="settings-backfill-progress-container" style="display: none; margin-bottom: 16px;"> <div style="display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px;"> <span id="settings-backfill-progress-text">Processando...</span> <span id="settings-backfill-progress-percent">0%</span> </div> <div style="width: 100%; height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden;"> <div id="settings-backfill-progress-bar" style="width: 0%; height: 100%; background: var(--accent-color); transition: width 0.3s;"></div> </div> </div> <button type="button" id="btn-settings-ia-backfill" class="btn btn-secondary btn-block" style="font-size: 13px;" onclick="runSettingsManualBackfill()"> Sincronizar Vetores Faltantes Agora </button> </div> <h3 class="mb-16" style="margin-top: 32px;">Informações Adicionais</h3> <div style="display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--text-muted);"> <div style="display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.02); padding-bottom: 8px;"> <span>Servidor do Banco de Dados:</span> <span style="color: var(--text-primary); font-weight: 500;">Supabase Cloud (PostgreSQL)</span> </div> <div style="display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.02); padding-bottom: 8px;"> <span>Hospedagem Web:</span> <span style="color: var(--text-primary); font-weight: 500;">Netlify Production CDN</span> </div> <div style="display: flex; justify-content: space-between; padding-bottom: 8px;"> <span>Segurança RLS:</span> <span style="color: var(--success-color); font-weight: 500;">Ativado e Configurado</span> </div> </div> </div> </div> </section> <!-- ==================== STUDENT VIEWS ==================== --> <!-- 1. STUDENT HOME --> <section id="view-stud-home" class="view-section"> <div class="view-header"> <div class="view-title"> <h1 id="student-welcome-title">Olá, Lucas!</h1> <p>Bem-vindo de volta ao tatame</p> </div> </div> <!-- Warning banner if missing selfie --> <div id="student-selfie-alert" class="alert-banner" style="display: none;"> <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/> </svg> <div> <span>Você ainda não enviou sua selfie de referência para o check-in por foto IA! </span> <a href="#" onclick="switchTab('stud-profile'); return false;">Cadastre agora no seu perfil.</a> </div> </div> <!-- Student stats (Agrupados e Clicáveis) --> <div class="grid-2 mb-24"> <!-- Card 1: Métricas de Treino (Total de Treinos & Frequência) --> <div class="card stat-card clickable-card" onclick="switchTab('stud-history')" style="display: flex; flex-direction: row; justify-content: space-around; align-items: center; padding: 20px;"> <div style="display: flex; align-items: center; gap: 16px; flex: 1; justify-content: center; border-right: 1px solid var(--border-color); padding-right: 16px;"> <div class="stat-icon" style="margin: 0;"> <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"/></svg> </div> <div> <div id="student-total-classes" class="stat-value">0</div> <div class="stat-label">Total de Treinos</div> </div> </div> <div style="display: flex; align-items: center; gap: 16px; flex: 1; justify-content: center; padding-left: 16px;"> <div class="stat-icon" style="margin: 0;"> <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/></svg> </div> <div> <div id="student-streak" class="stat-value">0</div> <div class="stat-label">Frequência/Mês</div> </div> </div> </div> <!-- Card 2: Minha Faixa --> <div class="card stat-card clickable-card" onclick="switchTab('stud-profile')" style="display: flex; align-items: center; gap: 16px; justify-content: center; padding: 20px;"> <div class="stat-icon" style="margin: 0;"> <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138z"/></svg> </div> <div> <div id="student-belt-name" class="stat-value" style="font-size: 18px; font-weight: 700; margin-top: 5px;">Branca</div> <div class="stat-label">Minha Faixa</div> </div> </div> </div> <div class="grid-2"> <div class="card"> <h3 class="mb-24">Últimos Comunicados</h3> <div id="student-home-announcements" class="announcements-timeline"> <!-- Dynamic list --> </div> </div> <div class="card"> <h3 class="mb-24">Agenda do Tatame</h3> <div id="student-home-events" class="events-list"> <!-- Dynamic list --> </div> </div> </div> <!-- Grade de Aulas (Adicionado) --> <div class="card mt-24"> <h3 class="mb-24">Grade de Aulas (Horários)</h3> <div class="grid-2" style="gap: 24px;"> <div> <h4 class="text-accent mb-12">1. Dojo Centro</h4> <table class="table" style="font-size: 13px; width: 100%;"> <tbody id="student-schedule-centro-tbody"> <!-- Dynamically populated --> </tbody> </table> </div> <div> <h4 class="text-accent mb-12">2. Dojo Quilombo</h4> <table class="table" style="font-size: 13px; width: 100%;"> <tbody id="student-schedule-quilombo-tbody"> <!-- Dynamically populated --> </tbody> </table> </div> </div> </div> </section> <!-- 2. STUDENT PROFILE & GRADUATION --> <section id="view-stud-profile" class="view-section"> <div class="view-header"> <div class="view-title"> <h1>Meu Perfil</h1> <p>Gerencie sua foto de reconhecimento e acompanhe sua graduação</p> </div> </div> <div class="grid-2"> <!-- Selfie Card --> <div class="card text-center"> <h3 class="mb-24">Selfie de Referência</h3> <div class="avatar-container" style="cursor: default;"> <img id="student-profile-pic" class="avatar-img" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236f6f78'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z'/%3E%3C/svg%3E" alt="Foto do aluno"> </div> <div style="display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap;"> <button class="btn btn-primary btn-sm" onclick="openStudentCamera()" style="padding: 8px 16px;">📷 Tirar Selfie</button> <button class="btn btn-secondary btn-sm" onclick="document.getElementById('student-selfie-upload-input').click()" style="padding: 8px 16px;">📁 Enviar Foto</button> <input type="file" id="student-selfie-upload-input" style="display: none;" accept="image/*" onchange="uploadStudentSelfie(event)"> </div> <div id="student-selfie-embedding-warning" style="display: none; padding: 12px; margin-bottom: 20px; border-radius: var(--radius-sm); border: 1.5px dashed var(--warning-color); background: rgba(224, 134, 0, 0.05); color: var(--text-color); font-size: 11px; line-height: 1.4; text-align: left; margin-left: 16px; margin-right: 16px;"> ⚠️ <strong>Servidor de IA Indisponível:</strong> Sua selfie está salva localmente, mas não foi possível extrair sua assinatura facial biométrica na nuvem. O check-in por foto do treino não funcionará até que você envie a selfie novamente quando o servidor de IA estiver online. </div> <h3 id="student-profile-name" class="mb-8">Lucas</h3> <div class="mb-24"> <span id="student-profile-belt-badge" class="belt-badge belt-white">Faixa Branca</span> </div> <button class="btn btn-secondary btn-sm mb-24" onclick="openEditProfileModal()">✏️ Editar Dados do Perfil</button> <p style="font-size: 13px; max-width: 320px; margin: 0 auto; margin-bottom: 24px;">Esta foto é usada pelo sistema de IA do professor para marcar sua presença nos treinos de forma automática. <strong>Atenção: tem que ser uma selfie nítida tirada pela câmera!</strong> Tire uma foto bem iluminada do seu rosto para que a IA (InsightFace) o detecte corretamente.</p> </div> <!-- Graduation timeline --> <div class="card"> <h3 class="mb-24">Minha Graduação</h3> <p class="mb-24">Acompanhe seu caminho na Behring Jiu-Jitsu. Atualmente você possui <strong id="student-profile-degrees" class="text-accent">0 graus</strong>.</p> <!-- Belt Visual Roadmap --> <div class="belt-roadmap" id="student-belt-roadmap"> <!-- Dynamically populated by renderStudentProfile() --> </div> <div style="background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 16px; margin-top: 32px;"> <h4 class="mb-8">Progresso até o próximo nível</h4> <div style="display: flex; gap: 8px; margin-top: 12px;" id="degrees-tracker"> <!-- Degrees (graus) dots will go here --> </div> <p style="font-size: 12px; color: var(--text-muted); margin-top: 12px;">Para graduações de faixa, o professor avalia a assiduidade nos treinos, postura e competência técnica. A associação Behring preza pela qualidade e dedicação.</p> </div> <!-- Kids Evaluation Status Info --> <div id="student-kids-evaluation-status" style="display: none; margin-top: 24px; padding: 16px; background: rgba(224, 90, 0, 0.05); border: 1px solid var(--border-color); border-radius: var(--radius-sm); text-align: left;"> <h4 class="text-accent mb-12" style="font-size: 13px;">Status dos 3 Pilares da Graduação (Infantil)</h4> <div style="display: flex; flex-direction: column; gap: 8px; font-size: 12px;"> <div style="display: flex; justify-content: space-between; align-items: center;"> <span>🥋 1. Dojo (Assiduidade - 100 Treinos):</span> <strong id="stud-status-dojo" class="text-muted">Pendente (0/100)</strong> </div> <div style="display: flex; justify-content: space-between; align-items: center;"> <span>🏠 2. Comportamento (Avaliação dos Pais):</span> <strong id="stud-status-parents" class="text-muted">Pendente</strong> </div> <div style="display: flex; justify-content: space-between; align-items: center;"> <span>🏫 3. Desempenho Escolar / Familiar:</span> <strong id="stud-status-school" class="text-muted">Pendente</strong> </div> </div> <div id="stud-eligibility-alert" style="margin-top: 12px; font-size: 11px; color: var(--text-muted); line-height: 1.4;"> *A promoção de faixa exige aprovação nos 3 pilares e será avaliada pelo professor responsável. </div> </div> </div> </div> <!-- Second row: Student details and Kimono loan --> <div class="grid-2 mt-24"> <!-- Student Details card --> <div class="card"> <h3 class="mb-24">Ficha do Aluno</h3> <div style="display: flex; flex-direction: column; gap: 12px; font-size: 14px;"> <div><strong style="color: var(--text-secondary);">E-mail:</strong> <span id="profile-detail-email">Não informado</span></div> <div><strong style="color: var(--text-secondary);">WhatsApp:</strong> <span id="profile-detail-whatsapp">Não informado</span></div> <div><strong style="color: var(--text-secondary);">Endereço:</strong> <span id="profile-detail-address">Não informado</span></div> <div><strong style="color: var(--text-secondary);">Idade:</strong> <span id="profile-detail-age">Não informado</span></div> <div><strong style="color: var(--text-secondary);">Responsável:</strong> <span id="profile-detail-guardian">Não informado</span></div> <div><strong style="color: var(--text-secondary);">Profissão / Escola:</strong> <span id="profile-detail-profession">Não informado</span></div> <div><strong style="color: var(--text-secondary);">Objetivo no BJJ:</strong> <span id="profile-detail-objective">Não informado</span></div> <div><strong style="color: var(--text-secondary);">Frequência de Treino Almejada:</strong> <span id="profile-detail-weekly-goal">Não informado</span></div> </div> </div> <!-- Kimono Loan Card --> <div class="card" id="kimono-loan-card"> <h3 class="mb-24">Empréstimo de Kimono</h3> <div id="kimono-loan-inactive" style="color: var(--text-muted); font-size: 14px; text-align: center; padding: 20px 0;"> <svg width="32" height="32" fill="none" viewBox="0 0 24 24" stroke="currentColor" style="opacity: 0.5; margin-bottom: 8px;"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z"/> </svg> <p>Nenhum kimono emprestado atualmente.</p> </div> <div id="kimono-loan-active" style="display: none; font-size: 14px; flex-direction: column; gap: 12px;"> <div style="display: flex; align-items: center; gap: 8px; color: var(--warning-color); font-weight: 600; margin-bottom: 8px;"> <span class="badge badge-orange" style="font-size: 10px;">Com Empréstimo</span> <span>Kimono Retirado</span> </div> <div><strong style="color: var(--text-secondary);">Marca do Kimono:</strong> <span id="loan-kimono-brand">-</span></div> <div><strong style="color: var(--text-secondary);">Tamanho:</strong> <span id="loan-kimono-size">-</span></div> <div><strong style="color: var(--text-secondary);">Data de Retirada:</strong> <span id="loan-kimono-date">-</span></div> </div> </div> </div> <!-- Third row: History Study Material --> <div class="card mt-24"> <h3 class="mb-24">História do Jiu-jitsu (Cobrada no Confere)</h3> <p id="student-bjj-history-text" style="font-size: 14px; line-height: 1.7; margin-bottom: 24px; white-space: pre-wrap;"> Carregando conteúdo da história... </p> <h4 class="mb-16">Vídeos Recomendados para Estudo</h4> <div id="student-bjj-history-videos" class="grid-2"> <!-- YouTube Embed Cards --> </div> </div> </section> <!-- 3. STUDENT HISTORY --> <section id="view-stud-history" class="view-section"> <div class="view-header"> <div class="view-title"> <h1>Meu Histórico de Presenças</h1> <p>Registro individual de treinos computados</p> </div> </div> <div class="search-bar-container"> <input type="date" id="student-filter-history-date" class="form-control" onchange="filterStudentHistory()"> <select id="student-filter-history-method" class="form-control form-select" style="max-width: 200px;" onchange="filterStudentHistory()"> <option value="all">Qualquer Método</option> <option value="manual">Manual</option> <option value="ia">Foto IA</option> </select> </div> <div class="card" style="padding: 0; overflow: hidden;"> <div class="table-responsive"> <table class="table-bjj"> <thead> <tr> <th>Data e Horário</th> <th>Turma</th> <th>Presença</th> <th>Método</th> </tr> </thead> <tbody id="student-history-tbody"> <!-- Dynamic logs --> </tbody> </table> </div> </div> </section> <!-- 4. STUDENT EVENTS & ANNOUNCEMENTS --> </div> </main> </div> </div> <!-- ==================== MODALS ==================== --> <!-- Modal: Add Student --> <div id="add-student-modal" class="modal"> <div class="card modal-content"> <div class="modal-header"> <h3>Cadastrar Novo Aluno</h3> <button class="modal-close" onclick="closeModal('add-student-modal')">&times;</button> </div> <form onsubmit="handleAddStudent(event); return false;"> <div class="form-group"> <label class="form-label" for="new-student-name">Nome Completo</label> <input type="text" id="new-student-name" class="form-control" required placeholder="Ex: Carlos Silva"> </div> <div class="form-group"> <label class="form-label" for="new-student-belt">Faixa Inicial</label> <select id="new-student-belt" class="form-control form-select"> <option value="Branca">Branca</option> <option value="Azul">Azul</option> <option value="Roxa">Roxa</option> <option value="Marrom">Marrom</option> <option value="Preta">Preta</option> </select> </div> <div class="form-group"> <label class="form-label" for="new-student-degrees">Graus Iniciais</label> <select id="new-student-degrees" class="form-control form-select"> <option value="0">0 Graus</option> <option value="1">1 Grau</option> <option value="2">2 Graus</option> <option value="3">3 Graus</option> <option value="4">4 Graus</option> </select> </div> <button type="submit" class="btn btn-primary btn-block">Confirmar Cadastro</button> </form> </div> </div> <!-- Modal: Add Event --> <div id="add-event-modal" class="modal"> <div class="card modal-content"> <div class="modal-header"> <h3>Agendar Novo Evento</h3> <button class="modal-close" onclick="closeModal('add-event-modal')">&times;</button> </div> <form onsubmit="handleAddEvent(event); return false;"> <input type="hidden" id="edit-event-id"> <div class="form-group"> <label class="form-label" for="event-title">Nome do Evento</label> <input type="text" id="event-title" class="form-control" required placeholder="Ex: Graduação Geral 2026"> </div> <div class="form-group"> <label class="form-label" for="event-type">Tipo de Evento</label> <select id="event-type" class="form-control form-select"> <option value="Treino">Treino Especial</option> <option value="Graduação">Cerimônia de Graduação</option> <option value="Seminário">Seminário Técnico</option> <option value="Campeonato">Campeonato Interno / Externo</option> </select> </div> <div class="form-group"> <label class="form-label" for="event-date">Data</label> <input type="date" id="event-date" class="form-control" required> </div> <div class="form-group"> <label class="form-label" for="event-time">Horário</label> <input type="time" id="event-time" class="form-control" required value="19:00"> </div> <div class="form-group" style="display: flex; align-items: center; gap: 8px; margin-top: 16px;"> <input type="checkbox" id="event-publish-app" checked style="accent-color: var(--accent-color); cursor: pointer; width: 16px; height: 16px;"> <label for="event-publish-app" style="font-size: 12px; color: var(--text-secondary); cursor: pointer; margin-bottom: 0; text-transform: none; user-select: none;">Publicar na Agenda do Aplicativo</label> </div> <div class="form-group" style="display: flex; align-items: center; gap: 8px; margin-bottom: 24px;"> <input type="checkbox" id="event-share-whatsapp" style="accent-color: var(--accent-color); cursor: pointer; width: 16px; height: 16px;"> <label for="event-share-whatsapp" style="font-size: 12px; color: var(--text-secondary); cursor: pointer; margin-bottom: 0; text-transform: none; user-select: none;">Compartilhar/Notificar via WhatsApp</label> </div> <button type="submit" class="btn btn-primary btn-block">Publicar Evento</button> </form> </div> </div> <!-- Modal: Add Announcement --> <div id="add-announcement-modal" class="modal"> <div class="card modal-content"> <div class="modal-header"> <h3>Novo Aviso no Mural</h3> <button class="modal-close" onclick="closeModal('add-announcement-modal')">&times;</button> </div> <form onsubmit="handleAddAnnouncement(event); return false;"> <input type="hidden" id="edit-ann-id"> <div class="form-group"> <label class="form-label" for="ann-title">Título do Aviso</label> <input type="text" id="ann-title" class="form-control" required placeholder="Ex: Treino Suspenso no Feriado"> </div> <div class="form-group"> <label class="form-label" for="ann-content">Conteúdo</label> <textarea id="ann-content" class="form-control" rows="4" required placeholder="Digite a mensagem oficial para os alunos da associação..."></textarea> </div> <div class="form-group" style="display: flex; align-items: center; gap: 8px; margin-top: 16px;"> <input type="checkbox" id="ann-publish-app" checked style="accent-color: var(--accent-color); cursor: pointer; width: 16px; height: 16px;"> <label for="ann-publish-app" style="font-size: 12px; color: var(--text-secondary); cursor: pointer; margin-bottom: 0; text-transform: none; user-select: none;">Publicar no Mural do Aplicativo</label> </div> <div class="form-group" style="display: flex; align-items: center; gap: 8px; margin-bottom: 24px;"> <input type="checkbox" id="ann-share-whatsapp" style="accent-color: var(--accent-color); cursor: pointer; width: 16px; height: 16px;"> <label for="ann-share-whatsapp" style="font-size: 12px; color: var(--text-secondary); cursor: pointer; margin-bottom: 0; text-transform: none; user-select: none;">Compartilhar/Notificar via WhatsApp</label> </div> <button type="submit" class="btn btn-primary btn-block">Publicar Comunicado</button> </form> </div> </div> <!-- Modal: Student Graduation Adjustments --> <div id="grad-student-modal" class="modal"> <div class="card modal-content" style="max-width: 600px; max-height: 90vh; overflow-y: auto;"> <div class="modal-header"> <h3>Graduação & Ficha do Aluno</h3> <button class="modal-close" onclick="closeModal('grad-student-modal')">&times;</button> </div> <div style="margin-bottom: 20px; display: flex; align-items: center; gap: 16px;"> <img id="grad-modal-avatar" style="width: 50px; height: 50px; border-radius: 50%; object-fit: cover;" src=""> <div> <h4 id="grad-modal-student-name">Nome do Aluno</h4> <p id="grad-modal-student-info" style="font-size: 13px;">Faixa Azul • 2 Graus</p> </div> </div> <hr style="border: 0; border-top: 1px solid var(--border-color); margin-bottom: 20px;"> <form onsubmit="handleSaveGraduation(event); return false;"> <input type="hidden" id="grad-modal-student-id"> <h4 class="mb-16 text-accent">Graduação</h4> <div class="grid-2"> <div class="form-group"> <label class="form-label" for="grad-student-belt">Alterar Faixa</label> <select id="grad-student-belt" class="form-control form-select" onchange="updateGradModalBeltDisplay()"> <option value="Branca">Branca</option> <option value="Azul">Azul</option> <option value="Roxa">Roxa</option> <option value="Marrom">Marrom</option> <option value="Preta">Preta</option> </select> </div> <div class="form-group"> <label class="form-label" for="grad-student-degrees">Graus (0 a 4)</label> <select id="grad-student-degrees" class="form-control form-select"> <option value="0">0 Graus</option> <option value="1">1 Grau</option> <option value="2">2 Graus</option> <option value="3">3 Graus</option> <option value="4">4 Graus</option> </select> </div> </div> <h4 class="mb-16 mt-24 text-accent">Dados Pessoais</h4> <div class="form-group"> <label class="form-label" for="grad-student-name">Nome Completo</label> <input type="text" id="grad-student-name" class="form-control" required> </div> <div class="form-group"> <label class="form-label" for="grad-student-email">E-mail</label> <input type="email" id="grad-student-email" class="form-control"> </div> <div class="form-group"> <label class="form-label" for="grad-student-whatsapp">WhatsApp</label> <input type="tel" id="grad-student-whatsapp" class="form-control" placeholder="Ex: (35) 99999-9999"> </div> <div class="form-group"> <label class="form-label" for="grad-student-password">Senha de Acesso</label> <input type="text" id="grad-student-password" class="form-control" placeholder="Digite a senha de acesso (padrão: aluno123)"> </div> <div class="grid-2"> <div class="form-group"> <label class="form-label" for="grad-student-age">Idade</label> <input type="number" id="grad-student-age" class="form-control" oninput="handleGradAgeChange()"> </div> <div class="form-group" id="grad-guardian-group"> <label class="form-label" for="grad-student-guardian">Responsável Legal</label> <input type="text" id="grad-student-guardian" class="form-control" placeholder="Obrigatório para menores de 18"> </div> </div> <div class="form-group"> <label class="form-label" for="grad-student-address">Endereço Completo</label> <input type="text" id="grad-student-address" class="form-control" placeholder="Rua, Número, Bairro, Cidade"> </div> <div class="grid-2"> <div class="form-group"> <label class="form-label" for="grad-student-profession">Profissão / Situação Escolar</label> <input type="text" id="grad-student-profession" class="form-control" placeholder="Profissão ou 'Estudante'"> </div> <div class="form-group"> <label class="form-label" for="grad-student-school-name">Qual Escola? (se estudante)</label> <input type="text" id="grad-student-school-name" class="form-control" placeholder="Nome da Escola"> </div> </div> <h4 class="mb-16 mt-24 text-accent">Objetivos e Treinos</h4> <div class="grid-2"> <div class="form-group"> <label class="form-label" for="grad-student-objective">Objetivo no Jiu-jitsu</label> <input type="text" id="grad-student-objective" class="form-control" placeholder="Ex: Defesa Pessoal, Competição, Saúde"> </div> <div class="form-group"> <label class="form-label" for="grad-student-weekly-goal">Frequência Almejada (Treinos/Semana)</label> <select id="grad-student-weekly-goal" class="form-control form-select"> <option value="1">1 vez por semana</option> <option value="2">2 vezes por semana</option> <option value="3">3 vezes por semana</option> <option value="4">4 vezes por semana</option> <option value="5">5+ vezes por semana</option> </select> </div> </div> <!-- 3 Pillars Kids Evaluation Panel --> <div id="kids-evaluation-panel" style="display: none; padding: 16px; background: rgba(224, 90, 0, 0.05); border: 1px solid var(--accent-color); border-radius: var(--radius-sm); margin-top: 24px; margin-bottom: 24px; text-align: left;"> <h4 class="text-accent mb-12" style="font-size: 14px;">Avaliação de Graduação Infantil (3 Pilares)</h4> <div id="kids-eligibility-badge" class="mb-16"> <!-- Will display eligibility based on attendance --> </div> <div class="grid-3" style="gap: 12px;"> <div class="form-group" style="margin-bottom: 0;"> <label class="form-label" style="font-size: 11px;">1. Dojo (Assiduidade)</label> <input type="text" id="grad-pillar-dojo" class="form-control" readonly style="font-size: 12px; font-weight: bold; background: var(--bg-secondary); border: 1px solid var(--border-color);"> </div> <div class="form-group" style="margin-bottom: 0;"> <label class="form-label" style="font-size: 11px;" for="grad-pillar-parents">2. Pais (Comportamento)</label> <select id="grad-pillar-parents" class="form-control form-select" style="font-size: 12px; font-weight: bold;"> <option value="Pendente">Pendente</option> <option value="Aprovado">Aprovado</option> <option value="Reprovado">Reprovado</option> </select> </div> <div class="form-group" style="margin-bottom: 0;"> <label class="form-label" style="font-size: 11px;" for="grad-pillar-school">3. Escola / Familiar</label> <select id="grad-pillar-school" class="form-control form-select" style="font-size: 12px; font-weight: bold;"> <option value="Pendente">Pendente</option> <option value="Aprovado">Aprovado</option> <option value="Reprovado">Reprovado</option> </select> </div> </div> </div> <h4 class="mb-16 mt-24 text-accent">Empréstimo de Kimono</h4> <div class="form-group" style="display: flex; gap: 8px; align-items: center; margin-bottom: 16px;"> <input type="checkbox" id="grad-student-has-loan" style="accent-color: var(--accent-color);" onchange="toggleGradKimonoInputs()"> <label for="grad-student-has-loan" class="form-label" style="margin-bottom: 0; cursor: pointer; text-transform: none;">Estou usando Kimono emprestado da escola</label> </div> <div id="grad-kimono-loan-inputs" style="display: none; padding: 12px; background: rgba(0,0,0,0.15); border-radius: var(--radius-sm); border: 1px solid var(--border-color); margin-bottom: 20px;"> <div class="grid-3"> <div class="form-group" style="margin-bottom: 0;"> <label class="form-label" for="grad-student-kimono-brand">Marca</label> <input type="text" id="grad-student-kimono-brand" class="form-control" placeholder="Ex: Atama, Koral"> </div> <div class="form-group" style="margin-bottom: 0;"> <label class="form-label" for="grad-student-kimono-size">Tamanho</label> <input type="text" id="grad-student-kimono-size" class="form-control" placeholder="Ex: A1, A2, M2"> </div> <div class="form-group" style="margin-bottom: 0;"> <label class="form-label" for="grad-student-kimono-date">Data da Retirada</label> <input type="date" id="grad-student-kimono-date" class="form-control"> </div> </div> </div> <div style="margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap;"> <button type="button" class="btn btn-secondary" onclick="closeModal('grad-student-modal')" style="flex: 1; min-width: 100px;">Cancelar</button> <button type="button" class="btn" onclick="handleDeleteStudent()" style="background-color: #dc3545; color: white; flex: 1; min-width: 120px;">Excluir Aluno</button> <button type="submit" class="btn btn-primary" style="flex: 1; min-width: 120px;">Salvar Alterações</button> </div> </form> </div> </div> <!-- Modal: Edit Student Profile --> <div id="edit-profile-modal" class="modal"> <div class="card modal-content" style="max-width: 600px; max-height: 90vh; overflow-y: auto;"> <div class="modal-header"> <h3>Editar Dados do Perfil</h3> <button class="modal-close" onclick="closeModal('edit-profile-modal')">&times;</button> </div> <form onsubmit="handleSaveProfile(event); return false;"> <h4 class="mb-16 text-accent">Dados Pessoais</h4> <div class="form-group"> <label class="form-label" for="edit-profile-name">Nome Completo</label> <input type="text" id="edit-profile-name" class="form-control" required> </div> <div class="form-group"> <label class="form-label" for="edit-profile-email">E-mail</label> <input type="email" id="edit-profile-email" class="form-control" required> </div> <div class="form-group"> <label class="form-label" for="edit-profile-whatsapp">WhatsApp</label> <input type="tel" id="edit-profile-whatsapp" class="form-control" placeholder="Ex: (35) 99999-9999" required> </div> <div class="form-group"> <label class="form-label" for="edit-profile-password">Senha de Acesso</label> <input type="password" id="edit-profile-password" class="form-control" required minlength="4" placeholder="Mínimo 4 caracteres"> </div> <div class="grid-2"> <div class="form-group"> <label class="form-label" for="edit-profile-age">Idade</label> <input type="number" id="edit-profile-age" class="form-control" oninput="toggleGuardianInput()"> </div> <div class="form-group" id="guardian-group"> <label class="form-label" for="edit-profile-guardian">Responsável Legal</label> <input type="text" id="edit-profile-guardian" class="form-control" placeholder="Obrigatório para menores de 18"> </div> </div> <div class="form-group"> <label class="form-label" for="edit-profile-address">Endereço Completo</label> <input type="text" id="edit-profile-address" class="form-control" placeholder="Rua, Número, Bairro, Cidade"> </div> <div class="grid-2"> <div class="form-group"> <label class="form-label" for="edit-profile-profession">Profissão / Situação Escolar</label> <input type="text" id="edit-profile-profession" class="form-control" placeholder="Profissão ou 'Estudante'"> </div> <div class="form-group"> <label class="form-label" for="edit-profile-school-name">Qual Escola? (se estudante)</label> <input type="text" id="edit-profile-school-name" class="form-control" placeholder="Nome da Escola"> </div> </div> <h4 class="mb-16 mt-24 text-accent">Objetivos e Treinos</h4> <div class="grid-2"> <div class="form-group"> <label class="form-label" for="edit-profile-objective">Objetivo no Jiu-jitsu</label> <input type="text" id="edit-profile-objective" class="form-control" placeholder="Ex: Defesa Pessoal, Competição, Saúde"> </div> <div class="form-group"> <label class="form-label" for="edit-profile-weekly-goal">Frequência Almejada (Treinos/Semana)</label> <select id="edit-profile-weekly-goal" class="form-control form-select"> <option value="1">1 vez por semana</option> <option value="2">2 vezes por semana</option> <option value="3">3 vezes por semana</option> <option value="4">4 vezes por semana</option> <option value="5">5+ vezes por semana</option> </select> </div> </div> <h4 class="mb-16 mt-24 text-accent">Empréstimo de Kimono</h4> <div class="form-group" style="display: flex; gap: 8px; align-items: center; margin-bottom: 16px;"> <input type="checkbox" id="edit-profile-has-loan" style="accent-color: var(--accent-color);" onchange="toggleKimonoInputs()"> <label for="edit-profile-has-loan" class="form-label" style="margin-bottom: 0; cursor: pointer; text-transform: none;">Estou usando Kimono emprestado da escola</label> </div> <div id="kimono-loan-inputs" style="display: none; padding: 12px; background: rgba(0,0,0,0.15); border-radius: var(--radius-sm); border: 1px solid var(--border-color); margin-bottom: 20px;"> <div class="grid-3"> <div class="form-group" style="margin-bottom: 0;"> <label class="form-label" for="edit-profile-kimono-brand">Marca</label> <input type="text" id="edit-profile-kimono-brand" class="form-control" placeholder="Ex: Atama, Koral"> </div> <div class="form-group" style="margin-bottom: 0;"> <label class="form-label" for="edit-profile-kimono-size">Tamanho</label> <input type="text" id="edit-profile-kimono-size" class="form-control" placeholder="Ex: A1, A2, M2"> </div> <div class="form-group" style="margin-bottom: 0;"> <label class="form-label" for="edit-profile-kimono-date">Data da Retirada</label> <input type="date" id="edit-profile-kimono-date" class="form-control"> </div> </div> </div> <button type="submit" class="btn btn-primary btn-block">Salvar Dados do Perfil</button> </form> </div> </div> <!-- Modal: Camera Selfie Capture --> <div id="camera-modal" class="modal"> <div class="card modal-content" style="max-width: 500px;"> <div class="modal-header"> <h3>Tirar Selfie</h3> <button class="modal-close" onclick="closeCameraModal()">&times;</button> </div> <div style="position: relative; overflow: hidden; border-radius: var(--radius-sm); margin-bottom: 20px; background: #000; display: flex; align-items: center; justify-content: center; aspect-ratio: 4/3;"> <video id="camera-video" style="width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);" autoplay playsinline muted></video> <canvas id="camera-canvas" style="display: none;"></canvas> </div> <div style="display: flex; gap: 12px;"> <button type="button" class="btn btn-secondary" onclick="closeCameraModal()" style="flex: 1;">Cancelar</button> <button type="button" class="btn btn-primary" onclick="captureSelfie()" style="flex: 1;">📸 Capturar</button> </div> </div> </div> <!-- Modal: Recover Password Email Input --> <div id="recover-password-modal" class="modal"> <div class="card modal-content" style="max-width: 420px;"> <div class="modal-header"> <h3>Recuperar Senha</h3> <button class="modal-close" onclick="closeModal('recover-password-modal')">&times;</button> </div> <p class="mb-16" style="font-size: 13px; color: var(--text-secondary);">Digite seu e-mail cadastrado. Um link de redefinição de senha será simulado e enviado para você.</p> <form onsubmit="handleRecoverPassword(event); return false;"> <div class="form-group"> <label class="form-label" for="recover-email">Endereço de E-mail</label> <input type="email" id="recover-email" class="form-control" placeholder="Ex: seuemail@provedor.com" required> </div> <button type="submit" class="btn btn-primary btn-block">Solicitar Envio</button> </form> </div> </div> <!-- Modal: Reset Password New Input --> <div id="reset-password-modal" class="modal"> <div class="card modal-content" style="max-width: 420px;"> <div class="modal-header"> <h3>Redefinir Senha</h3> <button class="modal-close" onclick="closeModal('reset-password-modal')">&times;</button> </div> <p class="mb-16" style="font-size: 13px; color: var(--text-secondary);"><strong id="reset-student-name">Aluno</strong>, digite sua nova senha de acesso abaixo:</p> <form onsubmit="handleResetPassword(event); return false;"> <input type="hidden" id="reset-student-id"> <div class="form-group"> <label class="form-label" for="reset-new-password">Nova Senha</label> <input type="password" id="reset-new-password" class="form-control" placeholder="Mínimo 4 caracteres" required minlength="4"> </div> <div class="form-group"> <label class="form-label" for="reset-confirm-password">Confirmar Nova Senha</label> <input type="password" id="reset-confirm-password" class="form-control" placeholder="Repita a nova senha" required minlength="4"> </div> <button type="submit" class="btn btn-primary btn-block">Alterar Minha Senha</button> </form> </div> </div> <!-- Dev Email Simulator Popup --> <div id="dev-email-simulator" style="display: none; position: fixed; bottom: 20px; right: 20px; width: 360px; z-index: 999999; border: 1.5px solid var(--accent-color); box-shadow: 0 10px 30px rgba(0,0,0,0.6); animation: slideUp 0.4s ease-out;"> <div class="card" style="padding: 16px; background: #181820; border-radius: var(--radius-md);"> <div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; margin-bottom: 12px;"> <h4 style="color: var(--accent-color); font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 6px; margin: 0;"> ✉️ SIMULADOR DE E-MAIL DEV </h4> <button onclick="document.getElementById('dev-email-simulator').style.display = 'none'" style="background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer;">&times;</button> </div> <div style="font-size: 12px; color: var(--text-secondary); line-height: 1.4; text-align: left;"> <div style="margin-bottom: 4px;"><strong>De:</strong> Behring BJJ &lt;suporte@behringbjj.com.br&gt;</div> <div style="margin-bottom: 8px;"><strong>Para:</strong> <span id="simulator-to-email">aluno@email.com</span></div> <hr style="border:0; border-top: 1px solid var(--border-color); margin: 8px 0;"> <div style="padding: 12px; background: rgba(0,0,0,0.2); border-radius: 4px; text-align: center; border: 1px dashed rgba(255,255,255,0.05);"> <h4 style="font-size: 13px; margin-bottom: 8px; color: var(--text-primary);">Recuperação de Senha</h4> <p style="font-size: 11px; margin-bottom: 12px; color: var(--text-secondary);">Você solicitou a redefinição de senha para a conta de <strong id="simulator-student-name">Lucas</strong>.</p> <button class="btn btn-primary btn-sm" onclick="triggerResetPasswordFromSimulator()" style="font-size: 10px; padding: 6px 12px; text-transform: none;">Redefinir Senha</button> </div> </div> </div> </div> <!-- Modal: Professor Photo Upload on First Login --> <div id="professor-photo-modal" class="modal"> <div class="card modal-content" style="max-width: 450px; text-align: center;"> <h3 class="mb-12" style="color: var(--accent-color);">Foto de Identificação</h3> <p class="mb-24" style="font-size: 13px; color: var(--text-secondary);"> Olá, <strong id="prof-photo-modal-name">Professor</strong>! Para que a IA e os alunos o identifiquem nas aulas, por favor cadastre uma foto de perfil no seu primeiro acesso. </p> <div style="margin: 0 auto 24px; width: 120px; height: 120px; border-radius: 50%; overflow: hidden; background: var(--bg-secondary); border: 2.5px solid var(--border-color); display: flex; align-items: center; justify-content: center;"> <img id="prof-photo-modal-preview" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236f6f78'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z'/%3E%3C/svg%3E" style="width: 100%; height: 100%; object-fit: cover;"> </div> <!-- Belt selection for Senpais --> <div id="prof-belt-selection-group" style="display: none; text-align: left; margin-bottom: 24px;"> <label class="form-label" for="prof-photo-modal-belt" style="font-size: 12px; margin-bottom: 6px; font-weight: bold;">Qual é a sua Faixa atual?</label> <select id="prof-photo-modal-belt" class="form-control form-select" style="font-size: 13px;"> <option value="Branca">Branca</option> <option value="Azul">Azul</option> <option value="Roxa">Roxa</option> <option value="Marrom">Marrom</option> <option value="Preta">Preta</option> </select> </div> <div style="display: flex; flex-direction: column; gap: 12px;"> <button class="btn btn-secondary" onclick="openProfessorCamera()" style="font-size: 12px;">📷 Tirar Selfie</button> <button class="btn btn-secondary" onclick="document.getElementById('prof-photo-upload-input').click()" style="font-size: 12px;">📁 Enviar Foto (Galeria)</button> <input type="file" id="prof-photo-upload-input" style="display: none;" accept="image/*" onchange="uploadProfessorPhoto(event)"> <button class="btn btn-primary btn-block" id="btn-save-prof-photo" onclick="saveProfessorPhoto()" disabled style="margin-top: 12px;">Salvar e Continuar</button> </div> </div> </div> <!-- Core App Logic --> <script src="app.js"></script> </body> </html>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Behring Jiu-Jitsu - São Bento do Sapucaí</title>
<link rel="stylesheet" href="style.css">
<!-- jsPDF & AutoTable CDNs for generating attendance reports -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.29/jspdf.plugin.autotable.min.js"></script>
<!-- Global Script Error Debugger -->
<script>
window.onerror = function(message, source, lineno, colno, error) {
var div = document.createElement('div');
div.style.position = 'fixed';
div.style.top = '0';
div.style.left = '0';
div.style.width = '100%';
div.style.background = '#ef4444';
div.style.color = '#ffffff';
div.style.padding = '20px';
div.style.zIndex = '99999';
div.style.fontFamily = 'monospace';
div.style.fontSize = '14px';
div.style.boxSizing = 'border-box';
div.style.lineHeight = '1.5';
div.innerHTML = '<strong>Erro de Script Detectado:</strong><br>' +
message + '<br>Arquivo: ' + source + '<br>Linha: ' + lineno + ' Coluna: ' + colno;
document.body.appendChild(div);
return false;
};
</script>
<!-- Supabase CDN Client -->
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
</head>
<body>
<!-- ==================== LOGIN SCREEN ==================== -->
<div id="auth-screen" class="auth-wrapper">
<div class="card auth-card">
<div class="auth-logo">
<img src="logo.png" alt="Logo Behring Jiu-Jitsu" style="width: 180px; height: auto; margin-bottom: 8px; filter: drop-shadow(0 0 10px rgba(224, 90, 0, 0.3));">
</div>
<h1 class="auth-title">Behring BJJ</h1>
<p class="auth-subtitle">São Bento do Sapucaí • Associação</p>
<!-- LOGIN FORM -->
<form id="login-form" onsubmit="handleLogin(event); return false;">
<div class="form-group">
<label class="form-label" for="username">Usuário / Nome</label>
<input type="text" id="username" class="form-control" placeholder="professor ou seu nome de aluno" required>
</div>
<div class="form-group">
<label class="form-label" for="password">Senha</label>
<input type="password" id="password" class="form-control" placeholder="••••••••" required>
</div>
<div class="form-group">
<label class="form-label" for="login-role">Entrar como</label>
<select id="login-role" class="form-control form-select">
<option value="student">Aluno</option>
<option value="professor">Professor / Admin</option>
</select>
</div>
<button type="submit" class="btn btn-primary btn-block" style="margin-top: 24px;">Entrar no App</button>
<div style="margin-top: 16px; font-size: 13px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;">
<a href="#" onclick="toggleAuthForm('register'); return false;">Não tem uma conta? Cadastre-se</a>
<a href="#" onclick="openModal('recover-password-modal'); return false;" style="color: var(--text-muted);">Esqueci minha senha</a>
</div>
</form>
<!-- REGISTER FORM -->
<form id="register-form" onsubmit="handleRegister(event); return false;" style="display: none;">
<div class="form-group">
<label class="form-label" for="reg-name">Nome Completo</label>
<input type="text" id="reg-name" class="form-control" placeholder="Ex: Lucas Souza" required>
</div>
<div class="form-group">
<label class="form-label" for="reg-email">Endereço de E-mail</label>
<input type="email" id="reg-email" class="form-control" placeholder="Ex: lucas@provedor.com" required>
</div>
<div class="form-group">
<label class="form-label" for="reg-whatsapp">WhatsApp</label>
<input type="tel" id="reg-whatsapp" class="form-control" placeholder="Ex: (35) 99999-9999" required>
</div>
<div class="form-group">
<label class="form-label" for="reg-password">Senha de Acesso</label>
<input type="password" id="reg-password" class="form-control" placeholder="Mínimo 4 caracteres" required minlength="4">
</div>
<div class="form-group">
<label class="form-label" for="reg-confirm">Confirmar Senha</label>
<input type="password" id="reg-confirm" class="form-control" placeholder="Digite a senha novamente" required minlength="4">
</div>
<button type="submit" class="btn btn-primary btn-block" style="margin-top: 24px;">Criar Conta e Entrar</button>
<div style="margin-top: 16px; font-size: 13px;">
<a href="#" onclick="toggleAuthForm('login'); return false;">Já tem uma conta? Faça Login</a>
</div>
</form>
</div>
</div>