scrape fix
This commit is contained in:
@@ -14,6 +14,16 @@
|
||||
<button class="btn btn-success me-2" onclick="scrapeProduct({{ product.id }})">
|
||||
<i class="fas fa-sync-alt me-1"></i>Scrape Now
|
||||
</button>
|
||||
<a href="{{ url_for('edit_product', product_id=product.id) }}" class="btn btn-outline-primary me-2">
|
||||
<i class="fas fa-edit me-1"></i>Edit
|
||||
</a>
|
||||
<button class="btn btn-outline-danger me-2 delete-product-btn"
|
||||
data-product-id="{{ product.id }}"
|
||||
data-product-name="{{ product.name }}"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#deleteModal">
|
||||
<i class="fas fa-trash me-1"></i>Delete
|
||||
</button>
|
||||
<a href="{{ url_for('index') }}" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-arrow-left me-1"></i>Back to Dashboard
|
||||
</a>
|
||||
@@ -222,6 +232,35 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 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>"{{ product.name }}"</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 method="POST" action="{{ url_for('delete_product', product_id=product.id) }}" 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>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
@@ -231,4 +270,20 @@
|
||||
Plotly.newPlot('priceChart', chartData.data, chartData.layout, {responsive: true});
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
// Handle delete product button
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const deleteButton = document.querySelector('.delete-product-btn');
|
||||
const deleteModal = document.getElementById('deleteModal');
|
||||
|
||||
if (deleteButton) {
|
||||
deleteButton.addEventListener('click', function() {
|
||||
// Show modal
|
||||
const modal = new bootstrap.Modal(deleteModal);
|
||||
modal.show();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user