move
This commit is contained in:
parent
048f474d26
commit
91094a74dc
|
|
@ -316,8 +316,21 @@ function addQuoteItem(item = null) {
|
||||||
|
|
||||||
itemDiv.innerHTML = `
|
itemDiv.innerHTML = `
|
||||||
<!-- Summary Header (always visible) -->
|
<!-- Summary Header (always visible) -->
|
||||||
<div class="item-header bg-gray-50 px-4 py-3 cursor-pointer flex items-center justify-between" onclick="toggleItem(${itemId})">
|
<div class="item-header bg-gray-50 px-4 py-3 flex items-center justify-between">
|
||||||
<div class="flex items-center space-x-4 flex-1">
|
<div class="flex items-center space-x-2">
|
||||||
|
<!-- Move buttons -->
|
||||||
|
<button type="button" onclick="moveItemUp(${itemId})" class="text-gray-500 hover:text-gray-700 p-1" title="Move up">
|
||||||
|
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<button type="button" onclick="moveItemDown(${itemId})" class="text-gray-500 hover:text-gray-700 p-1" title="Move down">
|
||||||
|
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center space-x-4 flex-1 cursor-pointer" onclick="toggleItem(${itemId})">
|
||||||
<span class="text-sm font-medium text-gray-700">Qty: <span class="item-summary-qty">${summaryQty}</span></span>
|
<span class="text-sm font-medium text-gray-700">Qty: <span class="item-summary-qty">${summaryQty}</span></span>
|
||||||
<span class="text-sm text-gray-600 flex-1 truncate item-summary-desc">${summaryDesc}</span>
|
<span class="text-sm text-gray-600 flex-1 truncate item-summary-desc">${summaryDesc}</span>
|
||||||
<span class="text-sm font-medium text-gray-900">$<span class="item-summary-amount">${summaryAmount}</span></span>
|
<span class="text-sm font-medium text-gray-900">$<span class="item-summary-amount">${summaryAmount}</span></span>
|
||||||
|
|
@ -468,6 +481,22 @@ function removeQuoteItem(itemId) {
|
||||||
updateTotals();
|
updateTotals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function moveItemUp(itemId) {
|
||||||
|
const item = document.getElementById(`item-${itemId}`);
|
||||||
|
const prev = item.previousElementSibling;
|
||||||
|
if (prev) {
|
||||||
|
item.parentNode.insertBefore(item, prev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveItemDown(itemId) {
|
||||||
|
const item = document.getElementById(`item-${itemId}`);
|
||||||
|
const next = item.nextElementSibling;
|
||||||
|
if (next) {
|
||||||
|
item.parentNode.insertBefore(next, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function toggleItem(itemId) {
|
function toggleItem(itemId) {
|
||||||
const itemDiv = document.getElementById(`item-${itemId}`);
|
const itemDiv = document.getElementById(`item-${itemId}`);
|
||||||
const content = itemDiv.querySelector('.item-content');
|
const content = itemDiv.querySelector('.item-content');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue