Feature: тёмная тема, минималистичный UI, улучшения UX
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,44 +1,58 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}{{ title }} — ERP WaterSurf{% endblock %}
|
||||
{% block content %}
|
||||
<h2>{% if object %}Редактировать{% else %}Создать{% endif %} {{ title }}</h2>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<h3>Товары</h3>
|
||||
{{ formset.management_form }}
|
||||
<table class="table" id="supplier-order-items">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Товар</th>
|
||||
<th>Цена</th>
|
||||
<th>Валюта</th>
|
||||
<th>Количество</th>
|
||||
<th>Стоимость</th>
|
||||
<th>Удалить</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for f in formset %}
|
||||
<tr class="item-row">
|
||||
<td>{{ f.id }}{{ f.product }}</td>
|
||||
<td>{{ f.price }}</td>
|
||||
<td>{{ f.currency }}</td>
|
||||
<td>{{ f.quantity }}</td>
|
||||
<td class="row-amount">—</td>
|
||||
<td>{% if f.DELETE %}{{ f.DELETE }}{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<button type="submit" class="btn btn-primary">Сохранить</button>
|
||||
<a href="{% url 'documents:supplier_order_list' %}" class="btn btn-secondary">Отмена</a>
|
||||
</form>
|
||||
<div class="ws-card">
|
||||
<h2 class="ws-page-title">{% if object %}Редактировать{% else %}Создать{% endif %} {{ title }}</h2>
|
||||
<form method="post" class="ws-form-card">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<div class="ws-form-group">
|
||||
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
|
||||
{{ field }}
|
||||
{% if field.errors %}<small class="ws-text-danger">{{ field.errors.0 }}</small>{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="ws-form-section">
|
||||
<h3 class="ws-form-section-title">Товары</h3>
|
||||
{{ formset.management_form }}
|
||||
<div class="ws-table-wrap">
|
||||
<table class="ws-table" id="supplier-order-items">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Товар</th>
|
||||
<th>Цена</th>
|
||||
<th>Валюта</th>
|
||||
<th>Количество</th>
|
||||
<th class="ws-num">Стоимость</th>
|
||||
<th>Удалить</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for f in formset %}
|
||||
<tr class="item-row">
|
||||
<td>{{ f.id }}{{ f.product }}</td>
|
||||
<td>{{ f.price }}</td>
|
||||
<td>{{ f.currency }}</td>
|
||||
<td>{{ f.quantity }}</td>
|
||||
<td class="row-amount ws-num">—</td>
|
||||
<td>{% if f.DELETE %}{{ f.DELETE }}{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ws-btn-group" style="margin-top: 1.25rem;">
|
||||
<button type="submit" class="btn btn-ws-primary">Сохранить</button>
|
||||
<a href="{% url 'documents:supplier_order_list' %}" class="btn btn-ws-secondary">Отмена</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
document.querySelector('form').addEventListener('input', function() {
|
||||
document.querySelector('.ws-form-card').addEventListener('input', function() {
|
||||
document.querySelectorAll('#supplier-order-items .item-row').forEach(function(row) {
|
||||
var price = parseFloat(row.querySelector('input[name$=\"-price\"]')?.value) || 0;
|
||||
var qty = parseFloat(row.querySelector('input[name$=\"-quantity\"]')?.value) || 0;
|
||||
var price = parseFloat(row.querySelector('input[name$="-price"]')?.value) || 0;
|
||||
var qty = parseFloat(row.querySelector('input[name$="-quantity"]')?.value) || 0;
|
||||
row.querySelector('.row-amount').textContent = (price * qty).toFixed(2);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user