start work on deleting line items

This commit is contained in:
Yisroel Baum 2024-10-29 15:33:10 +02:00
parent 86b1ccb3de
commit a2f9cc31f5
4 changed files with 21 additions and 1 deletions

View file

@ -57,6 +57,7 @@ async function displayMonthLineItems(dateString){
<th scope="row">${li.note || ''}</th>
<th scope="row"><button id="${li.id}" class="btn btn-primary reassign-button">Click to reassign vendor</button></th>
<th scope="row"><a class="btn btn-primary" href="/split_line/${li.id}">Click to split line</a></th>
<th scope="row"><button id="${li.id}" class="btn btn-danger delete-button">Delete</button></th>
</tr>
`;
@ -74,6 +75,7 @@ async function displayMonthLineItems(dateString){
<th scope="row">${li.confirmation_code}</th>
<th scope="row">${li.note || ''}</th>
<th scope="row"><button id="${li.id}" class="btn btn-primary reassign-button">Click to reassign vendor</button></th>
<th scope="row"><button id="${li.id}" class="btn btn-danger delete-button">Delete</button></th>
</tr>
`;
@ -94,6 +96,15 @@ function addListenersToReassignButtons() {
}
}
function addListenersToDeleteButtons() {
deleteButtons = document.getElementsByClassName('delete-button');
for(let i = 0; i < deleteButtons.length; i++){
deleteButtons[i].addEventListener('click', e => {
// startEditMode(parseInt(e.target.id));
})
}
}
document.addEventListener("DOMContentLoaded", (event) => {
displayMonthLineItems(monthSelector.value);
monthSelector.addEventListener('change', (e) => {