/* Parent → Forms & Permission Slips: review, e-sign, track status. */
function FormsScreen({ onNav, onBack }) {
const [forms, setForms] = React.useState([
{ id:1, title:'Museum Field Trip', sub:'Houston Museum of Natural Science · Jun 10', due:'Due Jun 5', icon:'bus', tint:'var(--gold-100)', ic:'var(--gold-600)', status:'action', fee:'$15.00' },
{ id:2, title:'Media Release', sub:'Photos & video for school channels', due:'Due Jun 8', icon:'camera', tint:'var(--info-100)', ic:'var(--info-500)', status:'action', fee:null },
{ id:3, title:'Technology Use Agreement', sub:'Student device & internet policy', due:'Due Jun 12', icon:'laptop', tint:'var(--blue-100)', ic:'var(--blue-500)', status:'action', fee:null },
{ id:4, title:'Emergency Contact Update', sub:'Confirm your contacts for 2026\u201327', due:'Signed May 20', icon:'phone', tint:'var(--success-100)', ic:'var(--success-500)', status:'signed', fee:null },
{ id:5, title:'Photo Consent (Yearbook)', sub:'Include ' + jlChild().first + ' in the yearbook', due:'Signed May 12', icon:'book-image', tint:'var(--success-100)', ic:'var(--success-500)', status:'signed', fee:null },
]);
const [sheet, setSheet] = React.useState(null);
const [sig, setSig] = React.useState('');
const [agree, setAgree] = React.useState(false);
const openForm = (f) => { setSheet(f); setSig(''); setAgree(false); };
const sign = () => {
setForms(fs => fs.map(x => x.id===sheet.id ? { ...x, status:'signed', due:'Signed just now' } : x));
jlToast(sheet.title + ' signed' + (sheet.fee ? ' · ' + sheet.fee + ' charged' : ''), { icon:'check-check' });
setSheet(null);
};
const pending = forms.filter(f=>f.status==='action');
const signed = forms.filter(f=>f.status==='signed');
const Card = (f) => (
f.status==='action' ? openForm(f) : jlToast('Viewing signed ' + f.title, { icon:'file-check' })} style={{ width:'100%', display:'flex', alignItems:'center', gap:12, background:'#fff', border:'1px solid var(--gray-200)', borderRadius:14, padding:'13px 14px', boxShadow:'var(--shadow-sm)', cursor:'pointer', fontFamily:'var(--font-sans)', textAlign:'left' }}>
{f.title}
{f.sub}
{f.due}
{f.status==='action'
? Sign
: }
);
return (
{pending.length} forms need signing
Sign securely — no printing required
{jlT('l_action_required')}
{pending.length === 0
?
All caught up — nothing to sign.
:
{pending.map(Card)}
}
{jlT('l_completed')}
{signed.map(Card)}
{sheet && (
setSheet(null)} style={{ position:'absolute', inset:0, zIndex:60, background:'rgba(10,20,40,.4)', display:'flex', alignItems:'flex-end' }}>
e.stopPropagation()} style={{ width:'100%', background:'#fff', borderRadius:'22px 22px 0 0', padding:'10px 18px 30px', maxHeight:'88%', overflowY:'auto' }}>
{sheet.title}
{sheet.sub}
I give permission for my child,
{jlChild().name} , to participate as described above. I understand the details, release the school from liability for reasonable risks, and confirm the information on file is accurate.
{sheet.fee &&
Trip fee {sheet.fee}
}
setAgree(a=>!a)} style={{ width:24, height:24, borderRadius:7, border: agree?'0':'1.5px solid var(--gray-300)', background: agree?'var(--success-500)':'#fff', display:'flex', alignItems:'center', justifyContent:'center', cursor:'pointer', flex:'0 0 auto', marginTop:1 }}>{agree && }
I have read and agree to the terms above.
Type your full name to sign
setSig(e.target.value)} placeholder="Jermaine Hatten" style={{ width:'100%', boxSizing:'border-box', border:'1.5px solid var(--gray-200)', borderRadius:12, padding:'13px 14px', fontSize:18, fontFamily:'Georgia, serif', fontStyle:'italic', color:'var(--navy-600)', outline:'none', marginBottom:16 }} />
Sign{sheet.fee ? ' & Pay ' + sheet.fee : ' Form'}
)}
);
}
Object.assign(window, { FormsScreen });