Divide a interface Minha Turma em abas separando a configuração da sala e equipe dos alunos

This commit is contained in:
2026-06-07 15:49:58 +00:00
parent 2e462cf310
commit 03f9317853
2 changed files with 144 additions and 50 deletions
+78 -18
View File
@@ -3002,10 +3002,6 @@ const initApp = () => {
// Fields
const cFormId = document.getElementById('childFormId');
const cFormTurma = document.getElementById('childFormTurma');
const cFormSala = document.getElementById('childFormSala');
const cFormPeriodo = document.getElementById('childFormPeriodo');
const cFormAuxiliares = document.getElementById('childFormAuxiliares');
const cFormNome = document.getElementById('childFormNome');
const cFormApelido = document.getElementById('childFormApelido');
const cFormDataNasc = document.getElementById('childFormDataNasc');
@@ -3015,6 +3011,47 @@ const initApp = () => {
const cFormPais = document.getElementById('childFormPais');
const cFormAutorizados = document.getElementById('childFormAutorizados');
// Fields Turma Config
const tabTurmaConfig = document.getElementById('tabTurmaConfig');
const tabTurmaAlunos = document.getElementById('tabTurmaAlunos');
const turmaConfigSection = document.getElementById('turmaConfigSection');
const turmaAlunosSection = document.getElementById('turmaAlunosSection');
const configTurmaNome = document.getElementById('configTurmaNome');
const configTurmaSala = document.getElementById('configTurmaSala');
const configTurmaPeriodo = document.getElementById('configTurmaPeriodo');
const configTurmaProfTitular = document.getElementById('configTurmaProfTitular');
const configTurmaProfAux1 = document.getElementById('configTurmaProfAux1');
const configTurmaProfAux2 = document.getElementById('configTurmaProfAux2');
const configTurmaCuidadora = document.getElementById('configTurmaCuidadora');
const btnSaveTurmaConfig = document.getElementById('btnSaveTurmaConfig');
// Tab Logic
if (tabTurmaConfig) {
tabTurmaConfig.addEventListener('click', () => {
tabTurmaConfig.classList.add('active');
tabTurmaConfig.style.borderBottomColor = 'var(--brand-green)';
tabTurmaConfig.style.color = 'var(--brand-green)';
tabTurmaAlunos.classList.remove('active');
tabTurmaAlunos.style.borderBottomColor = 'transparent';
tabTurmaAlunos.style.color = 'var(--text-secondary)';
turmaConfigSection.style.display = 'flex';
turmaAlunosSection.style.display = 'none';
});
}
if (tabTurmaAlunos) {
tabTurmaAlunos.addEventListener('click', () => {
tabTurmaAlunos.classList.add('active');
tabTurmaAlunos.style.borderBottomColor = 'var(--brand-green)';
tabTurmaAlunos.style.color = 'var(--brand-green)';
tabTurmaConfig.classList.remove('active');
tabTurmaConfig.style.borderBottomColor = 'transparent';
tabTurmaConfig.style.color = 'var(--text-secondary)';
turmaAlunosSection.style.display = 'flex';
turmaConfigSection.style.display = 'none';
});
}
// Toggle Especial Fields
if (cFormEspecial) {
cFormEspecial.addEventListener('change', () => {
@@ -3034,6 +3071,40 @@ const initApp = () => {
localStorage.setItem('camila_turma', JSON.stringify(turma));
};
const loadTurmaConfig = () => {
return JSON.parse(localStorage.getItem('camila_config_turma') || '{}');
};
const saveTurmaConfig = (cfg) => {
localStorage.setItem('camila_config_turma', JSON.stringify(cfg));
showCustomAlert('Sucesso', 'Configurações da turma salvas com sucesso!');
};
if (btnSaveTurmaConfig) {
btnSaveTurmaConfig.addEventListener('click', () => {
saveTurmaConfig({
nome: configTurmaNome.value,
sala: configTurmaSala.value,
periodo: configTurmaPeriodo.value,
profTitular: configTurmaProfTitular.value,
profAux1: configTurmaProfAux1.value,
profAux2: configTurmaProfAux2.value,
cuidadora: configTurmaCuidadora.value
});
});
}
const populateTurmaConfig = () => {
const cfg = loadTurmaConfig();
if(configTurmaNome) configTurmaNome.value = cfg.nome || '';
if(configTurmaSala) configTurmaSala.value = cfg.sala || '';
if(configTurmaPeriodo) configTurmaPeriodo.value = cfg.periodo || 'Integral';
if(configTurmaProfTitular) configTurmaProfTitular.value = cfg.profTitular || '';
if(configTurmaProfAux1) configTurmaProfAux1.value = cfg.profAux1 || '';
if(configTurmaProfAux2) configTurmaProfAux2.value = cfg.profAux2 || '';
if(configTurmaCuidadora) configTurmaCuidadora.value = cfg.cuidadora || '';
};
const renderTurmaList = () => {
if (!childrenList) return;
const turma = loadTurma();
@@ -3049,7 +3120,7 @@ const initApp = () => {
<div style="background: var(--bg-secondary); border: 1px solid var(--border-light); padding: 12px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<div>
<div style="font-weight: 600; color: var(--text-primary);">${escapeHtml(c.nome)} ${c.especial ? '⭐' : ''}</div>
<div style="font-size: 0.8rem; color: var(--text-secondary);">${escapeHtml(c.turma || '')} - ${escapeHtml(c.periodo || '')}</div>
<div style="font-size: 0.8rem; color: var(--text-secondary);">${escapeHtml(c.apelido || '')}</div>
</div>
<div style="display: flex; gap: 8px;">
<button onclick="editChild('${c.id}')" style="background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px;" title="Editar"></button>
@@ -3061,10 +3132,6 @@ const initApp = () => {
const clearChildForm = () => {
cFormId.value = '';
cFormTurma.value = '';
cFormSala.value = '';
cFormPeriodo.value = 'Integral';
cFormAuxiliares.value = '';
cFormNome.value = '';
cFormApelido.value = '';
cFormDataNasc.value = '';
@@ -3082,10 +3149,6 @@ const initApp = () => {
if (!c) return;
cFormId.value = c.id;
cFormTurma.value = c.turma || '';
cFormSala.value = c.sala || '';
cFormPeriodo.value = c.periodo || 'Integral';
cFormAuxiliares.value = c.auxiliares || '';
cFormNome.value = c.nome || '';
cFormApelido.value = c.apelido || '';
cFormDataNasc.value = c.dataNasc || '';
@@ -3112,6 +3175,7 @@ const initApp = () => {
if (btnMinhaTurma) {
btnMinhaTurma.addEventListener('click', () => {
minhaTurmaModal.style.display = 'flex';
populateTurmaConfig();
renderTurmaList();
clearChildForm();
});
@@ -3139,10 +3203,6 @@ const initApp = () => {
const newChild = {
id,
turma: cFormTurma.value.trim(),
sala: cFormSala.value.trim(),
periodo: cFormPeriodo.value,
auxiliares: cFormAuxiliares.value.trim(),
nome: cFormNome.value.trim(),
apelido: cFormApelido.value.trim(),
dataNasc: cFormDataNasc.value,
@@ -3194,7 +3254,7 @@ const initApp = () => {
role: 'user',
content: `A professora ditou as seguintes informações para cadastrar uma criança na turma: "${transcript}".
Por favor, extraia os dados e retorne APENAS um JSON válido com os seguintes campos:
"turma", "sala", "periodo", "auxiliares", "nome", "apelido", "dataNasc" (formato YYYY-MM-DD), "especial" (boolean), "especialDetalhes", "pais", "autorizados".
"nome", "apelido", "dataNasc" (formato YYYY-MM-DD), "especial" (boolean), "especialDetalhes", "pais", "autorizados".
Se algum dado não for mencionado, deixe a string vazia ou false para boolean.`
}],
temperature: 0.1