34 lines
1.6 KiB
HTML
34 lines
1.6 KiB
HTML
{% extends "base.html" %}
|
|
{% block content %}
|
|
<h1>{% if item %}Редактирование инвентаря{% else %}Новый инвентарь{% endif %}</h1>
|
|
<form method="post">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<div class="form-group">
|
|
<label>Наименование</label>
|
|
<input type="text" name="name" value="{{ item.name if item else '' }}" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Категория</label>
|
|
<select name="category_id" required>
|
|
{% for cat in categories %}
|
|
<option value="{{ cat.id }}" {% if item and item.category_id == cat.id %}selected{% endif %}>{{ cat.name }}</option>
|
|
{% else %}
|
|
<option value="" disabled>Сначала добавьте категорию</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Базовая цена (₽)</label>
|
|
<input type="number" step="0.01" min="0.01" name="base_price" value="{{ item.base_price if item else '' }}" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Сезонный тип</label>
|
|
<select name="season_type" required>
|
|
<option value="winter" {% if item and item.season_type == 'winter' %}selected{% endif %}>Зима</option>
|
|
<option value="summer" {% if item and item.season_type == 'summer' %}selected{% endif %}>Лето</option>
|
|
</select>
|
|
</div>
|
|
<button type="submit" class="btn">Сохранить</button>
|
|
<a href="{{ url_for('main.inventory') }}" class="btn btn-secondary">Отмена</a>
|
|
</form>
|
|
{% endblock %} |