export function filterNotes() { let referralId = document.getElementById('referralList').value; let startDate = document.getElementById('startDate').value; let endDate = document.getElementById('endDate').value; let caseId = null; if (referralId.substr(0, 5) == 'case-') { caseId = referralId.substr(5); referralId = null; } fetch('/api/filter-notes', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ 'referral': referralId, 'startDate': startDate, 'endDate': endDate, 'case': caseId }) }) .then(response => response.json()) .then(data => { const noteList = document.getElementById('note-list'); noteList.innerHTML = ''; data.forEach(i => { noteList.innerHTML += `