Fix: одна строка за клик (extra_js вне content), подпись Удалить у чекбокса

Made-with: Cursor
This commit is contained in:
2026-02-26 12:40:27 +00:00
parent 7673a12027
commit 817fe38e87
4 changed files with 32 additions and 3 deletions

View File

@@ -72,7 +72,7 @@
<td class="ws-col-currency">{{ f.currency }}</td>
<td class="ws-col-qty">{{ f.quantity }}</td>
<td class="row-amount ws-col-cost ws-num"></td>
<td>{% if f.DELETE %}{{ f.DELETE }}{% endif %}</td>
<td class="ws-col-del"><label class="ws-delete-row-label">{% if f.DELETE %}{{ f.DELETE }}{% endif %} Удалить</label></td>
</tr>
{% endfor %}
</tbody>
@@ -88,6 +88,7 @@
</div>
</form>
</div>
{% endblock %}
{% block extra_js %}
<script>
(function() {
@@ -155,10 +156,14 @@
});
var amountCell = clone.querySelector('.row-amount');
if (amountCell) amountCell.textContent = '—';
var delCheckbox = clone.querySelector('input[name$="-DELETE"]');
if (delCheckbox) {
var delLabel = clone.querySelector('label.ws-delete-row-label');
if (delLabel) delLabel.setAttribute('for', delCheckbox.id);
}
tbody.appendChild(clone);
totalInput.value = nextIndex + 1;
});
})();
</script>
{% endblock %}
{% endblock %}

View File

@@ -79,7 +79,7 @@
<td class="ws-col-currency">{{ f.currency }}</td>
<td class="ws-col-qty">{{ f.quantity }}</td>
<td class="row-amount ws-col-cost ws-num"></td>
<td>{% if f.DELETE %}{{ f.DELETE }}{% endif %}</td>
<td class="ws-col-del"><label class="ws-delete-row-label">{% if f.DELETE %}{{ f.DELETE }}{% endif %} Удалить</label></td>
</tr>
{% endfor %}
</tbody>
@@ -161,6 +161,11 @@
});
var amountCell = clone.querySelector('.row-amount');
if (amountCell) amountCell.textContent = '—';
var delCheckbox = clone.querySelector('input[name$="-DELETE"]');
if (delCheckbox) {
var delLabel = clone.querySelector('label.ws-delete-row-label');
if (delLabel) delLabel.setAttribute('for', delCheckbox.id);
}
tbody.appendChild(clone);
totalInput.value = nextIndex + 1;
});