jewelry_inventory/templates/product_form.html
2026-03-27 12:02:41 +05:00

49 lines
2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% block content %}
<h1>{% if product %}✏️ Редактирование товара{% else %}➕ Добавление товара{% endif %}</h1>
<form method="post" class="form-card">
<div class="form-group">
<label>Тип металла *</label>
<select name="metal_type_id" required>
{% for mt in metal_types %}
<option value="{{ mt.id }}" {% if product and product.metal_type_id == mt.id %}selected{% endif %}>
{{ mt.name }} ({{ mt.purity }} проба) - {{ "%.2f"|format(mt.price_per_gram) }} ₽/г
</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label>Артикул *</label>
<input type="text" name="sku" value="{{ product.sku if product else '' }}" required>
</div>
<div class="form-group">
<label>Название *</label>
<input type="text" name="name" value="{{ product.name if product else '' }}" required>
</div>
<div class="form-group">
<label>Вес (граммы) *</label>
<input type="number" step="0.01" name="weight_grams" value="{{ product.weight_grams if product else '' }}" required>
</div>
<div class="form-group">
<label>Коэффициент сложности *</label>
<input type="number" step="0.1" name="complexity_factor" value="{{ product.complexity_factor if product else '1.0' }}" required>
<small>1.0 - простые, 1.5 - сложные, 2.0 - эксклюзивные</small>
</div>
<div class="form-group">
<label>Описание</label>
<textarea name="description" rows="3">{{ product.description if product else '' }}</textarea>
</div>
<div style="display: flex; gap: 10px;">
<button type="submit" class="btn btn-primary">💾 Сохранить</button>
<a href="/products" class="btn btn-secondary">❌ Отмена</a>
</div>
</form>
{% endblock %}