36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
/*
|
|
* Welcome to your app's main JavaScript file!
|
|
*
|
|
* This file will be included onto the page via the importmap() Twig function,
|
|
* which should already be in your base.html.twig.
|
|
*/
|
|
import './styles/app.css';
|
|
|
|
function filterCasesByUser(userId) {
|
|
fetch('/index.php/api/filter-cases-by-user', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ userId: userId })
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
const caseList = document.getElementById('case-list');
|
|
caseList.innerHTML = '';
|
|
data.forEach(c => {
|
|
caseList.innerHTML += `
|
|
<tr>
|
|
<td>${c.clientName}</td>
|
|
<td>${c.caseNumber}</td>
|
|
<td>${c.dcsCaseId}</td>
|
|
<td>${c.referralType}/${c.referralSource.name}<br/><a href='mailto:${c.referralSource.email}'>${c.referralSource.email}</a></td>
|
|
<td>${c.county.value}</td>
|
|
<td>${c.referrals.length}</td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>`;
|
|
})
|
|
});
|
|
}
|