// New project modal with auto-generated project number const { useState: useStateModal, useEffect: useEffectModal } = React; const NewProjectModal = ({ onClose }) => { const [klantId, setKlantId] = useStateModal('hak'); const [naam, setNaam] = useStateModal(''); const [prio, setPrio] = useStateModal('gemiddeld'); const [labels, setLabels] = useStateModal(['HAK']); const [sauzen, setSauzen] = useStateModal(['']); const [generated] = useStateModal(() => { // Auto-generate: P-YY-NNNN const year = 26; const nextNr = 426; // mock: next one after P-26-0425 return `P-${year}-${String(nextNr).padStart(4, '0')}`; }); return ( <>
NIEUWE AANVRAAG

Project aanmaken

{/* Project number — auto */}
PROJECTNUMMER · AUTOMATISCH
{generated}
setNaam(e.target.value)} placeholder="bijv. Appelmoes lijn 2026" style={inputStyle} />
{Object.entries(window.PRIORITY).map(([id, v]) => ( ))}
{labels.map((l, i) => ( {l} ))} { if (e.key === 'Enter' && e.target.value.trim()) { setLabels([...labels, e.target.value.trim()]); e.target.value = ''; } }} style={{ border: 'none', outline: 'none', fontSize: 12, flex: 1, minWidth: 100, background: 'transparent' }} />
{sauzen.map((s, i) => (
{ const next = [...sauzen]; next[i] = e.target.value; setSauzen(next); }} placeholder={`Saus ${i+1}`} style={inputStyle} /> {sauzen.length > 1 && ( )}
))}
); }; const inputStyle = { width: '100%', padding: '8px 10px', fontSize: 13, border: '1px solid var(--line)', borderRadius: 7, background: 'var(--paper)', color: 'var(--ink-1)', fontFamily: 'inherit', outline: 'none', boxSizing: 'border-box', }; const Field = ({ label, hint, children }) => (
{hint && {hint}}
{children}
); window.NewProjectModal = NewProjectModal;