Основы блюпринта для отчетов
This commit is contained in:
21
App/Report/__init__.py
Normal file
21
App/Report/__init__.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
from flask import request, Blueprint, render_template
|
||||||
|
from ..checker import check_auth
|
||||||
|
from os import path
|
||||||
|
import json
|
||||||
|
|
||||||
|
with open(path.join(path.dirname(__file__), 'zapros_menu.json')) as f:
|
||||||
|
report_list = json.load(f)
|
||||||
|
|
||||||
|
report_bp = Blueprint('report_bp', __name__, template_folder='templates')
|
||||||
|
|
||||||
|
@report_bp.route('/', methods=['GET', 'POST'])
|
||||||
|
@check_auth
|
||||||
|
def menu():
|
||||||
|
if request.method == 'GET':
|
||||||
|
return render_template('report_menu.html', options=report_list)
|
||||||
|
|
||||||
|
@report_bp.route('/quarterly', methods=['GET', 'POST'])
|
||||||
|
@check_auth
|
||||||
|
def quarterly():
|
||||||
|
if request.method == 'GET':
|
||||||
|
return render_template('quarterly.html')
|
||||||
3
App/Report/reports.json
Normal file
3
App/Report/reports.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[
|
||||||
|
{"name": "Квартальный отчет передвижений заготовок", "url": "report_bp.quaterly"}
|
||||||
|
]
|
||||||
18
App/Report/templates/quartely.html
Normal file
18
App/Report/templates/quartely.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Квартальный отчет</title>
|
||||||
|
<link href="/static/css/main.css" type="text/css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="logout">
|
||||||
|
<a href="{{ url_for('logout') }}"><button>Выход</button></a>
|
||||||
|
</div>
|
||||||
|
<!-- Not implemented -->
|
||||||
|
<h1>Заглушка для квартального отчета</h1>
|
||||||
|
<div class="return">
|
||||||
|
<a href="{{ url_for('index') }}"><button>Главное меню</button></a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
22
App/Report/templates/report_menu.html
Normal file
22
App/Report/templates/report_menu.html
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Меню отчетов</title>
|
||||||
|
<link href="/static/css/main.css" type="text/css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="logout">
|
||||||
|
<a href="{{ url_for('logout') }}"><button>Выход</button></a>
|
||||||
|
</div>
|
||||||
|
<h1>Выберите вариант отчетов</h1>
|
||||||
|
<nav class="menu">
|
||||||
|
{% for point in options %}
|
||||||
|
<a href="{{ url_for(point['url']) }}"><button>{{ point['name'] }}</button></a>
|
||||||
|
{% endfor %}
|
||||||
|
</nav>
|
||||||
|
<div class="return">
|
||||||
|
<a href="{{ url_for('index') }}"><button>Главное меню</button></a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user