const monthSelector = document.getElementById('month-selector'); const tableBody = document.getElementById('table-body'); var reassignButtons = document.getElementsByClassName('reassign-button'); function startEditMode(id){ for(let i = 0; i < reassignButtons.length; i++){ reassignButtons[i].disabled = true; } const handleKeydown = (e) => { if (e.key === 'Enter') { document.removeEventListener('keydown', handleKeydown); const vendor = document.getElementById(`vendor-line-${id}`); const vendorInput = document.getElementById(`vendor-input-${id}`); vendor.innerText = vendorInput.value; if (vendorInput.parentNode) { vendorInput.parentNode.removeChild(vendorInput); } for(let i = 0; i < reassignButtons.length; i++){ reassignButtons[i].disabled = false; } } }; document.addEventListener('keydown', handleKeydown); const vendor = document.getElementById(`vendor-line-${id}`); var placeholderText = vendor.innerText vendor.innerText = '' var inputElem = document.createElement("input"); inputElem.value = placeholderText; inputElem.id = `vendor-input-${id}` vendor.appendChild(inputElem); inputElem.focus() } async function displayMonthLineItems(dateString){ const [month, year] = dateString.split(' '); var result = await fetch(`/get_month_line_items/${month}/${year}`, {method:'POST'}); var data = await result.json(); tableBody.innerHTML = '' data.forEach(li => { const row = `