diff --git a/portal/templates/app/project.html b/portal/templates/app/project.html index 9a63c8a..b3dd0b6 100644 --- a/portal/templates/app/project.html +++ b/portal/templates/app/project.html @@ -185,6 +185,13 @@

Enter an email address or domain name — we'll look up the organization automatically.

+ +
- + +
@@ -302,7 +310,10 @@
- +
+ + +
@@ -314,12 +325,6 @@

Choose which request list templates to include in this project.

-
- - -
-
@@ -1271,6 +1277,9 @@ document.getElementById('scrapeError').classList.add('hidden'); document.getElementById('scrapeLoading').classList.add('hidden'); document.getElementById('scrapeBtn').disabled = false; + // Hide wizard-only fields + document.getElementById('wizProjectNameWrap').classList.add('hidden'); + document.getElementById('wizProjectName').value = ''; // Step 2 — clear all org fields const clearIds = ['orgName','orgDesc','orgRole','orgIndustry','orgWebsite','orgPhone', 'orgAddress','orgCity','orgState','orgFounded','orgLinkedIn']; @@ -1320,8 +1329,19 @@ async function createNewProject() { const btn = document.getElementById('wizCreateBtn'); const projectName = document.getElementById('wizProjectName').value.trim(); - if (!projectName) { alert('Project name is required.'); return; } - if (!validateStep2()) { showAddOrgStep(2); return; } + const wizErr = document.getElementById('wizError'); + if (wizErr) wizErr.classList.add('hidden'); + const projNameEl = document.getElementById('wizProjectName'); + if (!projectName) { + if (projNameEl) projNameEl.classList.add('field-error'); + if (wizErr) { wizErr.textContent = 'Deal name is required.'; wizErr.classList.remove('hidden'); } + return; + } + if (projNameEl) projNameEl.classList.remove('field-error'); + if (!validateStep2()) { + if (wizErr) { wizErr.textContent = 'Please fill in all required org fields. Go back to step 2.'; wizErr.classList.remove('hidden'); } + return; + } btn.disabled = true; btn.textContent = 'Creating...'; @@ -1440,6 +1460,8 @@ document.getElementById('addOrgStep2').classList.toggle('hidden', n !== 2); document.getElementById('addOrgStep3').classList.toggle('hidden', n !== 3); document.getElementById('addOrgStep4').classList.toggle('hidden', n !== 4); + // Clear error banners when navigating + ['step2Error','step3Error','wizError'].forEach(id => { const el=document.getElementById(id); if(el) el.classList.add('hidden'); }); if (n === 3) renderPeople(); if (n === 4) { // Pre-fill project name from org name @@ -1466,8 +1488,29 @@ return requiredFields.every(id => document.getElementById(id).value.trim()); } + function showStep2Error(msg) { + const el = document.getElementById('step2Error'); + if (!el) return; + el.textContent = msg || 'Please fill in all required fields.'; + el.classList.remove('hidden'); + } + + function hideStep2Error() { + const el = document.getElementById('step2Error'); + if (el) el.classList.add('hidden'); + } + + function advanceFromStep2() { + if (!validateStep2()) { + showStep2Error('Please fill in all required fields (highlighted in red).'); + return; + } + hideStep2Error(); + showAddOrgStep(3); + } + // Clear red border on input/change - requiredFields.forEach(id => { + [...requiredFields, 'wizProjectName'].forEach(id => { const el = document.getElementById(id); if (el) { const clear = () => el.classList.remove('field-error'); @@ -1623,7 +1666,12 @@ } async function submitAddOrg() { - if (!validateStep2()) { showAddOrgStep(2); return; } + const s3err = document.getElementById('step3Error'); + if (s3err) s3err.classList.add('hidden'); + if (!validateStep2()) { + if (s3err) { s3err.textContent = 'Required fields missing: go back and fill in Name and Role.'; s3err.classList.remove('hidden'); } + return; + } const name = document.getElementById('orgName').value.trim(); const role = document.getElementById('orgRole').value;