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 += ` <tr> <td>${i.date}<br/> ${i.startTime}-${i.endTime} (${i.duration})</td> <td class='text-center'>${i.location}</td> <td class='text-center'>${i.method}</td> <td'>${i.members}</td> <td style='text-align: right;'> <a href='/edit-note/${i.noteType}/${i.id}' class='text-secondary' title='Edit Note'> <i class="material-symbols-rounded opacity-5">edit</i> </a> </td> </tr>`; }) }); }