project_python_v6/templates/material_form.html
2026-04-21 09:26:47 +05:00

40 lines
2.3 KiB
HTML

{% extends "base.html" %}
{% block title %}{% if action=='add' %}Новый материал{% else %}Редактировать{% endif %} — Стройка{% endblock %}
{% block page_title %}{% if action=='add' %}Новый материал{% else %}Редактировать: {{ material.name }}{% endif %}{% endblock %}
{% block topbar_actions %}<a href="{{ url_for('index') }}" class="btn btn-secondary">← Назад</a>{% endblock %}
{% block content %}
<div class="form-card">
<form method="post">
<div class="form-grid">
<div class="form-group full-width">
<label class="form-label">Наименование <span class="required">*</span></label>
<input type="text" name="name" class="form-input" required value="{{ material.name if material else '' }}">
</div>
<div class="form-group">
<label class="form-label">Тип материала <span class="required">*</span></label>
<select name="material_type_id" class="form-input" required>
<option value="">— выбрать —</option>
{% for t in types %}<option value="{{ t.id }}" {% if material and material.material_type_id==t.id %}selected{% endif %}>{{ t.name }}</option>{% endfor %}
</select>
</div>
<div class="form-group">
<label class="form-label">Единица измерения</label>
<select name="unit" class="form-input">
{% for u in ['шт','м²','м³','м.п.','кг','т','мешок','рулон','лист'] %}
<option value="{{ u }}" {% if material and material.unit==u %}selected{% endif %}>{{ u }}</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label class="form-label">Цена, ₽ <span class="required">*</span></label>
<input type="number" name="current_price" class="form-input" required step="0.01" min="0" value="{{ material.current_price if material else '' }}">
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">💾 Сохранить</button>
<a href="{{ url_for('index') }}" class="btn btn-secondary">Отмена</a>
</div>
</form>
</div>
{% endblock %}