Сформировано меню запросов

This commit is contained in:
Anton Kamalov
2024-10-22 23:35:49 +03:00
parent bd4edd39e0
commit ac7541ce29
4 changed files with 36 additions and 0 deletions

View File

@@ -3,12 +3,24 @@ from os import path
from Database.sql_provider import SQLProvider
from checker import check_auth
from .requests_route import route
import json
with open(path.join(path.dirname(__file__), 'zapros_menu.json')) as f:
options = json.load(f)
sql_provider = SQLProvider(path.join(path.dirname(__file__), 'sql'))
requests_bp = Blueprint('requests_bp', __name__, template_folder='templates')
@requests_bp.route('/', methods=['GET', 'POST'])
@check_auth
def requests():
if request.method == 'GET':
return render_template('zapros_menu.html', options=options)
else:
return 'error'
@requests_bp.route('/req1', methods=['GET', 'POST'])
@check_auth
def sklad_zapros():
if request.method == 'GET':
zagotovki = route(session['db_config'], {}, sql_provider, 'zagotovki.sql')

View File

@@ -19,6 +19,7 @@
</form>
{% else %}
<!-- Output -->
{% if items %}
<h1>Заготовки на складе</h1>
<table>
<tr>
@@ -36,7 +37,11 @@
</tr>
{% endfor %}
</table>
{% else %}
<h1>Заготовок нет</h1>
{% endif %}
{% endif %}
<button><a href="{{ url_for('requests_bp.requests') }}">Обратно в меню запросов</a></button>
</body>
</html>

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Запросы</title>
</head>
<body>
<h1>Выберите вариант запроса</h1>
<a href="{{ url_for('logout') }}">Выход</a>
<nav class="menu">
{% for point in options %}
<a href="{{ url_for(point['url']) }}">{{ point['name'] }}</a>
{% endfor %}
</nav>
</body>
</html>

View File

@@ -0,0 +1,3 @@
[
{"name": "Материалы заготовок", "url": "requests_bp.sklad_zapros"}
]