allow for editing of vendor in one line, just front end

This commit is contained in:
Yisroel Baum 2024-10-07 14:03:38 +03:00
parent 71727b58a7
commit 6afd48aa6e

View file

@ -10,12 +10,31 @@ function startEditMode(id){
for(let i = 0; i < reassignButtons.length; i++){
reassignButtons[i].disabled = true;
}
document.addEventListener('')
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);
}