63 lines
3.0 KiB
JavaScript
63 lines
3.0 KiB
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
// Evidence Governance Toggle Logic
|
|
const approveBtn = document.getElementById('approve-btn');
|
|
const rejectBtn = document.getElementById('reject-btn');
|
|
const agentBadge = document.getElementById('agent-badge');
|
|
const finalBadge = document.getElementById('final-badge');
|
|
const statusText = document.getElementById('review-status');
|
|
|
|
if (approveBtn && rejectBtn) {
|
|
// Human Approves the Finding
|
|
approveBtn.addEventListener('click', () => {
|
|
agentBadge.className = 'badge-tier2 line-through opacity-50';
|
|
finalBadge.className = 'badge-tier1';
|
|
finalBadge.textContent = 'Tier 1 Verified (Human Approved)';
|
|
statusText.textContent = 'SUCCESS: Finding verified by human analyst. Promoted to Tier 1.';
|
|
statusText.className = 'text-green-400 text-sm mb-6 font-mono font-bold';
|
|
disableButtons();
|
|
});
|
|
|
|
// Human Rejects the Finding (Triggers the Fallback Protocol)
|
|
rejectBtn.addEventListener('click', () => {
|
|
agentBadge.className = 'badge-tier2';
|
|
finalBadge.className = 'badge-tier2';
|
|
finalBadge.textContent = 'Tier 2: Indicative (Fallback Applied)';
|
|
statusText.textContent = 'FALLBACK: Tier 1 rejected. Defaulted to Tier 2 as per governance protocol.';
|
|
statusText.className = 'text-yellow-400 text-sm mb-6 font-mono font-bold';
|
|
disableButtons();
|
|
});
|
|
}
|
|
|
|
function disableButtons() {
|
|
approveBtn.disabled = true;
|
|
rejectBtn.disabled = true;
|
|
approveBtn.classList.add('opacity-50', 'cursor-not-allowed');
|
|
rejectBtn.classList.add('opacity-50', 'cursor-not-allowed');
|
|
}
|
|
|
|
// --- COLD AUDIT FORM LOGIC ---
|
|
const auditForm = document.getElementById('audit-form');
|
|
if (auditForm) {
|
|
auditForm.addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
const submitBtn = document.getElementById('submit-btn');
|
|
const formStatus = document.getElementById('form-status');
|
|
|
|
submitBtn.disabled = true;
|
|
submitBtn.textContent = 'Transmitting...';
|
|
submitBtn.classList.add('opacity-75', 'cursor-not-allowed');
|
|
|
|
// Mocking the POST to Formspree / VPS Endpoint (74.208.111.99)
|
|
// In production, replace this setTimeout with a real fetch() POST
|
|
setTimeout(() => {
|
|
formStatus.className = 'mt-4 p-4 rounded border text-sm border-green-300 bg-green-50 text-green-800';
|
|
formStatus.innerHTML = '<strong>Protocol Initiated:</strong> Your Layer 1a Cold Audit request has been received. A human analyst will review your entity footprint within 24 hours.';
|
|
formStatus.classList.remove('hidden');
|
|
auditForm.reset();
|
|
submitBtn.textContent = 'Initiate Audit';
|
|
submitBtn.disabled = false;
|
|
submitBtn.classList.remove('opacity-75', 'cursor-not-allowed');
|
|
}, 1500);
|
|
});
|
|
}
|
|
}); |