+
`;
@@ -914,6 +964,26 @@ function removeInvoiceItem(itemId) {
updateInvoiceTotals();
}
+function moveInvoiceItemUp(itemId) {
+ const item = document.getElementById(`invoice-item-${itemId}`);
+ const prevItem = item.previousElementSibling;
+
+ if (prevItem) {
+ item.parentNode.insertBefore(item, prevItem);
+ updateInvoiceTotals();
+ }
+}
+
+function moveInvoiceItemDown(itemId) {
+ const item = document.getElementById(`invoice-item-${itemId}`);
+ const nextItem = item.nextElementSibling;
+
+ if (nextItem) {
+ item.parentNode.insertBefore(nextItem, item);
+ updateInvoiceTotals();
+ }
+}
+
function updateInvoiceTotals() {
const items = getInvoiceItems();
const taxExempt = document.getElementById('invoice-tax-exempt').checked;
@@ -1020,4 +1090,4 @@ async function deleteInvoice(id) {
function viewInvoicePDF(id) {
window.open(`/api/invoices/${id}/pdf`, '_blank');
-}
\ No newline at end of file
+}