Отдельная страница для вывода результатов
This commit is contained in:
@@ -25,14 +25,14 @@ def sklad_zapros():
|
|||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
zagotovki = route(session['db_config'], {}, sql_provider, 'zagotovki.sql')
|
zagotovki = route(session['db_config'], {}, sql_provider, 'zagotovki.sql')
|
||||||
if zagotovki.status:
|
if zagotovki.status:
|
||||||
return render_template('sklad_zapros.html', materials=zagotovki.result, status=True)
|
return render_template('sklad_zapros.html', materials=zagotovki.result)
|
||||||
else:
|
else:
|
||||||
return zagotovki.error_message
|
return zagotovki.error_message
|
||||||
else:
|
else:
|
||||||
material = dict(request.form)
|
material = dict(request.form)
|
||||||
zagotovki = route(session['db_config'], material, sql_provider, 'zapros1.sql')
|
zagotovki = route(session['db_config'], material, sql_provider, 'zapros1.sql')
|
||||||
if zagotovki.status:
|
if zagotovki.status:
|
||||||
print(zagotovki.result)
|
categories = ['Материал', 'Вес', 'Цена', 'Количество']
|
||||||
return render_template('sklad_zapros.html', items=zagotovki.result)
|
return render_template('output.html', items=zagotovki.result, categories = categories)
|
||||||
else:
|
else:
|
||||||
return zagotovki.error_message
|
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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<button><a href="{{ url_for('logout') }}">Выход</a></button>
|
<button><a href="{{ url_for('logout') }}">Выход</a></button>
|
||||||
{% if status %}
|
|
||||||
<!-- Input -->
|
<!-- Input -->
|
||||||
<h1>Выберите материал</h1>
|
<h1>Выберите материал</h1>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
@@ -17,30 +16,6 @@
|
|||||||
</select>
|
</select>
|
||||||
<input type="submit" value="Отправить">
|
<input type="submit" value="Отправить">
|
||||||
</form>
|
</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>
|
<button><a href="{{ url_for('requests_bp.requests') }}">Обратно в меню запросов</a></button>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user