Revised the JavaScript account reorder code to avoid nested template literals, for readability.

This commit is contained in:
依瑪貓 2023-04-03 21:20:24 +08:00
parent 8286c0c6d8
commit 9a704c8185

View File

@ -32,7 +32,8 @@ document.addEventListener("DOMContentLoaded", () => {
const no = document.getElementById(`accounting-order-${accounts[i].dataset.id}-no`);
const code = document.getElementById(`accounting-order-${accounts[i].dataset.id}-code`);
no.value = String(i + 1);
code.innerText = `${list.dataset.baseCode}-${`000${i + 1}`.slice(-3)}`;
const zeroPaddedNo = `000${no.value}`.slice(-3)
code.innerText = `${list.dataset.baseCode}-${zeroPaddedNo}`;
}
};
initializeDragAndDropReordering(list, onReorder);