From 65de858755c30576a03192443649479d0311b6b5 Mon Sep 17 00:00:00 2001 From: Sidney Date: Thu, 28 May 2026 08:49:10 -0300 Subject: [PATCH] feat: enhance pre-enrollment with direct link, custom allowed classes, and matricular conversion flow --- manager/components/PreMatricula.tsx | 53 +++++++++++-- manager/components/Students.tsx | 74 ++++++++++++++++++- manager/index.tsx | 23 +++++- .../update_prematricula_config_table.cjs | 23 ++++++ manager/server.selfhosted.js | 33 +++++++-- manager/types.ts | 1 + 6 files changed, 190 insertions(+), 17 deletions(-) create mode 100644 manager/scratch/update_prematricula_config_table.cjs diff --git a/manager/components/PreMatricula.tsx b/manager/components/PreMatricula.tsx index af64315..9b0a1da 100644 --- a/manager/components/PreMatricula.tsx +++ b/manager/components/PreMatricula.tsx @@ -3,12 +3,13 @@ import { SchoolData, PreMatriculaCampo, PreMatriculaConfig, PreMatriculaInscrica import { Plus, Trash2, Save, Eye, EyeOff, Download, GripVertical, Link2, ClipboardPen, Copy, Check, ChevronDown, ChevronRight, Users, RefreshCw, - FileText, X, Settings2, ArrowLeft, ExternalLink, AlertCircle + FileText, X, Settings2, ArrowLeft, ExternalLink, AlertCircle, UserCheck } from 'lucide-react'; interface Props { data: SchoolData; updateData: (d: Partial) => void; + onConvert?: (preData: any) => void; } const FIELD_TYPES: Record = { @@ -16,7 +17,7 @@ const FIELD_TYPES: Record = { date: 'Data', select: 'Seleção', textarea: 'Texto Longo', number: 'Número' }; -const PreMatricula: React.FC = ({ data }) => { +const PreMatricula: React.FC = ({ data, onConvert }) => { const [config, setConfig] = useState(null); const [campos, setCampos] = useState([]); const [inscricoes, setInscricoes] = useState([]); @@ -144,7 +145,9 @@ const PreMatricula: React.FC = ({ data }) => { const copyLink = () => { if (!config) return; - const url = `${window.location.origin}/pre-matricula/${config.slug}`; + const url = config.slug === 'pre-matricula' + ? `${window.location.origin}/pre-matricula` + : `${window.location.origin}/pre-matricula/${config.slug}`; navigator.clipboard.writeText(url); setCopied(true); setTimeout(() => setCopied(false), 2000); @@ -241,6 +244,35 @@ const PreMatricula: React.FC = ({ data }) => { {config?.corPrimaria} +
+ +
+ {turmas.map(t => { + const isChecked = config?.turmasPermitidas?.includes(t.id); + return ( + + ); + })} + {turmas.length === 0 && ( +

Nenhuma turma cadastrada

+ )} +
+

Se nenhuma for marcada, todas as turmas aparecerão por padrão.

+