diff --git a/public/app.js b/public/app.js index abed82d..7f20945 100644 --- a/public/app.js +++ b/public/app.js @@ -411,18 +411,39 @@ function addQuoteItem(item = null) { itemDiv.innerHTML = ` -
-
- +
+ +
+ + +
+ + +
+ - + Qty: ${previewQty} - ${previewDesc} + ${previewDesc} ${previewAmount}
+ + +
@@ -434,7 +455,7 @@ function addQuoteItem(item = null) { value="${item ? item.quantity : ''}" class="quote-item-input w-full px-2 py-2 border border-gray-300 rounded-md text-sm">
-
+
-
+
-
- -
`; @@ -539,6 +554,26 @@ function removeQuoteItem(itemId) { updateQuoteTotals(); } +function moveQuoteItemUp(itemId) { + const item = document.getElementById(`quote-item-${itemId}`); + const prevItem = item.previousElementSibling; + + if (prevItem) { + item.parentNode.insertBefore(item, prevItem); + updateQuoteTotals(); + } +} + +function moveQuoteItemDown(itemId) { + const item = document.getElementById(`quote-item-${itemId}`); + const nextItem = item.nextElementSibling; + + if (nextItem) { + item.parentNode.insertBefore(nextItem, item); + updateQuoteTotals(); + } +} + function updateQuoteTotals() { const items = getQuoteItems(); const taxExempt = document.getElementById('quote-tax-exempt').checked; @@ -786,18 +821,39 @@ function addInvoiceItem(item = null) { itemDiv.innerHTML = ` -
-
- +
+ +
+ + +
+ + +
+ - + Qty: ${previewQty} - ${previewDesc} + ${previewDesc} ${previewAmount}
+ + +
@@ -809,7 +865,7 @@ function addInvoiceItem(item = null) { value="${item ? item.quantity : ''}" class="invoice-item-input w-full px-2 py-2 border border-gray-300 rounded-md text-sm">
-
+
-
+
-
- -
`; @@ -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 +}