pre-commit changes
This commit is contained in:
@@ -1,44 +1,55 @@
|
||||
from flask import request, Blueprint, render_template, url_for
|
||||
from os import path
|
||||
from checker import check_auth
|
||||
from .requests_model import sklad, materials_per_seller, sellers_names, materials_names
|
||||
import json
|
||||
from os import path
|
||||
|
||||
with open(path.join(path.dirname(__file__), 'zapros_menu.json'), encoding='utf-8') as f:
|
||||
from checker import check_auth
|
||||
from flask import Blueprint, render_template, request, url_for
|
||||
|
||||
from .requests_model import (materials_names, materials_per_seller,
|
||||
sellers_names, sklad)
|
||||
|
||||
with open(path.join(path.dirname(__file__), "zapros_menu.json"), encoding="utf-8") as f:
|
||||
requests_list = json.load(f)
|
||||
|
||||
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
|
||||
def requests():
|
||||
if request.method == 'GET':
|
||||
return render_template('zapros_menu.html', options=requests_list)
|
||||
if request.method == "GET":
|
||||
return render_template("zapros_menu.html", options=requests_list)
|
||||
|
||||
@requests_bp.route('/sklad', methods=['GET', 'POST'])
|
||||
|
||||
@requests_bp.route("/sklad", methods=["GET", "POST"])
|
||||
@check_auth
|
||||
def sklad_zapros():
|
||||
if request.method == 'GET':
|
||||
return render_template('zagotovki.html')
|
||||
if request.method == "GET":
|
||||
return render_template("zagotovki.html")
|
||||
else:
|
||||
zagotovki = sklad(request)
|
||||
if zagotovki.status:
|
||||
material = dict(request.form)
|
||||
header = f'Заготовки на складе из материала \"{material["material"]}\"'
|
||||
return render_template('output.html', items=zagotovki.result, header=header)
|
||||
header = f'Заготовки на складе из материала "{material["material"]}"'
|
||||
return render_template("output.html", items=zagotovki.result, header=header)
|
||||
else:
|
||||
return render_template('error.html', error_message=zagotovki.error_message)
|
||||
|
||||
@requests_bp.route('/shipments', methods=['GET', 'POST'])
|
||||
return render_template("error.html", error_message=zagotovki.error_message)
|
||||
|
||||
|
||||
@requests_bp.route("/shipments", methods=["GET", "POST"])
|
||||
@check_auth
|
||||
def sellers_ship():
|
||||
if request.method == 'GET':
|
||||
return render_template('sellers_ship.html')
|
||||
if request.method == "GET":
|
||||
return render_template("sellers_ship.html")
|
||||
else:
|
||||
zagotovki = materials_per_seller(request)
|
||||
if zagotovki.status:
|
||||
seller = dict(request.form)
|
||||
header = f'Поставки от поставщика \"{seller["seller"]}\"'
|
||||
return render_template('output.html', items=zagotovki.result, header=header, link=url_for('requests_bp.requests'))
|
||||
header = f'Поставки от поставщика "{seller["seller"]}"'
|
||||
return render_template(
|
||||
"output.html",
|
||||
items=zagotovki.result,
|
||||
header=header,
|
||||
link=url_for("requests_bp.requests"),
|
||||
)
|
||||
else:
|
||||
return render_template('error.html', error_message=zagotovki.error_message)
|
||||
return render_template("error.html", error_message=zagotovki.error_message)
|
||||
|
||||
Reference in New Issue
Block a user