Сформировано меню запросов
This commit is contained in:
@@ -3,12 +3,24 @@ from os import path
|
|||||||
from Database.sql_provider import SQLProvider
|
from Database.sql_provider import SQLProvider
|
||||||
from checker import check_auth
|
from checker import check_auth
|
||||||
from .requests_route import route
|
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'))
|
sql_provider = SQLProvider(path.join(path.dirname(__file__), 'sql'))
|
||||||
requests_bp = Blueprint('requests_bp', __name__, template_folder='templates')
|
requests_bp = Blueprint('requests_bp', __name__, template_folder='templates')
|
||||||
|
|
||||||
@requests_bp.route('/', methods=['GET', 'POST'])
|
@requests_bp.route('/', methods=['GET', 'POST'])
|
||||||
@check_auth
|
@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():
|
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')
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
<!-- Output -->
|
<!-- Output -->
|
||||||
|
{% if items %}
|
||||||
<h1>Заготовки на складе</h1>
|
<h1>Заготовки на складе</h1>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -36,7 +37,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<h1>Заготовок нет</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
<button><a href="{{ url_for('requests_bp.requests') }}">Обратно в меню запросов</a></button>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
16
App/Queries/templates/zapros_menu.html
Normal file
16
App/Queries/templates/zapros_menu.html
Normal 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>
|
||||||
3
App/Queries/zapros_menu.json
Normal file
3
App/Queries/zapros_menu.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[
|
||||||
|
{"name": "Материалы заготовок", "url": "requests_bp.sklad_zapros"}
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user