Отдельная страница для вывода результатов
This commit is contained in:
@@ -25,14 +25,14 @@ def sklad_zapros():
|
||||
if request.method == 'GET':
|
||||
zagotovki = route(session['db_config'], {}, sql_provider, 'zagotovki.sql')
|
||||
if zagotovki.status:
|
||||
return render_template('sklad_zapros.html', materials=zagotovki.result, status=True)
|
||||
return render_template('sklad_zapros.html', materials=zagotovki.result)
|
||||
else:
|
||||
return zagotovki.error_message
|
||||
else:
|
||||
material = dict(request.form)
|
||||
zagotovki = route(session['db_config'], material, sql_provider, 'zapros1.sql')
|
||||
if zagotovki.status:
|
||||
print(zagotovki.result)
|
||||
return render_template('sklad_zapros.html', items=zagotovki.result)
|
||||
categories = ['Материал', 'Вес', 'Цена', 'Количество']
|
||||
return render_template('output.html', items=zagotovki.result, categories = categories)
|
||||
else:
|
||||
return zagotovki.error_message
|
||||
26
App/Queries/templates/output.html
Normal file
26
App/Queries/templates/output.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Заготовки на складе</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Заготовки на складе</h1>
|
||||
<!-- Output -->
|
||||
<table>
|
||||
<tr>
|
||||
{% for category in categories %}
|
||||
<th>{{ category }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% for item in items %}
|
||||
<tr>
|
||||
<td>{{ item['material'] }}</td>
|
||||
<td>{{ item['weight'] }}</td>
|
||||
<td>{{ item['price'] }}</td>
|
||||
<td>{{ item['count'] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -6,7 +6,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<button><a href="{{ url_for('logout') }}">Выход</a></button>
|
||||
{% if status %}
|
||||
<!-- Input -->
|
||||
<h1>Выберите материал</h1>
|
||||
<form action="" method="post">
|
||||
@@ -17,30 +16,6 @@
|
||||
</select>
|
||||
<input type="submit" value="Отправить">
|
||||
</form>
|
||||
{% else %}
|
||||
<!-- Output -->
|
||||
{% if items %}
|
||||
<h1>Заготовки на складе</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Материал</th>
|
||||
<th>Вес</th>
|
||||
<th>Цена</th>
|
||||
<th>Количество</th>
|
||||
</tr>
|
||||
{% for item in items %}
|
||||
<tr>
|
||||
<td>{{ item['material'] }}</td>
|
||||
<td>{{ item['weight'] }}</td>
|
||||
<td>{{ item['price'] }}</td>
|
||||
<td>{{ item['count'] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<h1>Заготовок нет</h1>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<button><a href="{{ url_for('requests_bp.requests') }}">Обратно в меню запросов</a></button>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user