scrape fix

This commit is contained in:
Oli Passey
2025-06-27 17:25:56 +01:00
parent ee0142121a
commit 5726183115
27 changed files with 2353 additions and 621 deletions

View File

@@ -97,6 +97,16 @@
<i class="fas fa-sync-alt me-1"></i>Scrape Now
</button>
</div>
<div class="btn-group" role="group">
<a href="{{ url_for('edit_product', product_id=product.id) }}" class="btn btn-outline-secondary">
<i class="fas fa-edit me-1"></i>Edit
</a>
<button class="btn btn-outline-danger delete-product-btn"
data-product-id="{{ product.id }}"
data-product-name="{{ product.name }}">
<i class="fas fa-trash me-1"></i>Delete
</button>
</div>
</div>
</div>
@@ -181,4 +191,58 @@
</div>
</div>
{% endif %}
<!-- Delete Confirmation Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deleteModalLabel">
<i class="fas fa-exclamation-triangle me-2 text-warning"></i>Confirm Delete
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>Are you sure you want to delete <strong id="deleteProductName"></strong>?</p>
<div class="alert alert-warning">
<i class="fas fa-warning me-2"></i>
<strong>Warning:</strong> This action cannot be undone. All price history for this product will be permanently deleted.
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<form id="deleteForm" method="POST" style="display: inline;">
<button type="submit" class="btn btn-danger">
<i class="fas fa-trash me-2"></i>Delete Product
</button>
</form>
</div>
</div>
</div>
</div>
<script>
// Handle delete product buttons
document.addEventListener('DOMContentLoaded', function() {
const deleteButtons = document.querySelectorAll('.delete-product-btn');
const deleteModal = document.getElementById('deleteModal');
const deleteForm = document.getElementById('deleteForm');
const deleteProductName = document.getElementById('deleteProductName');
deleteButtons.forEach(button => {
button.addEventListener('click', function() {
const productId = this.getAttribute('data-product-id');
const productName = this.getAttribute('data-product-name');
// Update modal content
deleteProductName.textContent = productName;
deleteForm.action = `/delete_product/${productId}`;
// Show modal
const modal = new bootstrap.Modal(deleteModal);
modal.show();
});
});
});
</script>
{% endblock %}