При наведении на строку курсор меняется на pointer
Двойной клик открывает заказ на редактирование (как клик на карандаш)
This commit is contained in:
@@ -17,6 +17,15 @@
|
||||
.table td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.table tbody tr {
|
||||
border-bottom: 2px solid #dee2e6;
|
||||
}
|
||||
.table tbody tr:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.table tbody tr[data-edit-url] {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
@@ -106,7 +115,6 @@
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Номер</th>
|
||||
<th>Дата</th>
|
||||
<th>Время</th>
|
||||
<th>Тип</th>
|
||||
@@ -115,16 +123,13 @@
|
||||
<th>Сумма</th>
|
||||
<th>Оплата</th>
|
||||
<th>Действия</th>
|
||||
<th>Номер заказа</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for order in page_obj %}
|
||||
<tr {% if order.status and order.status.is_negative_end and order.amount_paid > 0 %}class="table-warning"{% endif %}>
|
||||
<td>
|
||||
<a href="{% url 'orders:order-detail' order.order_number %}" class="text-decoration-none">
|
||||
<strong>{{ order.order_number }}</strong>
|
||||
</a>
|
||||
</td>
|
||||
<tr {% if order.status and order.status.is_negative_end and order.amount_paid > 0 %}class="table-warning"{% endif %}
|
||||
data-edit-url="{% url 'orders:order-update' order.order_number %}">
|
||||
<td>
|
||||
{% if order.delivery_date %}
|
||||
{{ order.delivery_date|date:"d.m.Y" }}
|
||||
@@ -203,6 +208,11 @@
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'orders:order-detail' order.order_number %}" class="text-decoration-none">
|
||||
<strong>{{ order.order_number }}</strong>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -368,6 +378,16 @@
|
||||
}, 200);
|
||||
});
|
||||
});
|
||||
|
||||
// Двойной клик на строку для перехода к редактированию
|
||||
document.querySelectorAll('tbody tr[data-edit-url]').forEach(function(row) {
|
||||
row.addEventListener('dblclick', function() {
|
||||
const editUrl = this.dataset.editUrl;
|
||||
if (editUrl) {
|
||||
window.location.href = editUrl;
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user