Register warehouse blueprint and update dashboard for warehouse module integration.
This commit is contained in:
@@ -12,8 +12,9 @@ def create_app():
|
|||||||
|
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
|
|
||||||
from app.routes import bp as main_bp
|
from app.routes import bp as main_bp, warehouse_bp
|
||||||
app.register_blueprint(main_bp, url_prefix='/')
|
app.register_blueprint(main_bp, url_prefix='/')
|
||||||
|
app.register_blueprint(warehouse_bp)
|
||||||
|
|
||||||
# Add 'now' function to Jinja2 globals
|
# Add 'now' function to Jinja2 globals
|
||||||
app.jinja_env.globals['now'] = datetime.now
|
app.jinja_env.globals['now'] = datetime.now
|
||||||
|
|||||||
@@ -6,8 +6,20 @@ from .models import User
|
|||||||
from . import db
|
from . import db
|
||||||
from reportlab.lib.pagesizes import letter
|
from reportlab.lib.pagesizes import letter
|
||||||
from reportlab.pdfgen import canvas
|
from reportlab.pdfgen import canvas
|
||||||
|
from flask import Blueprint, render_template, request, redirect, url_for, flash
|
||||||
|
import csv
|
||||||
|
from .warehouse import add_location
|
||||||
|
|
||||||
bp = Blueprint('main', __name__)
|
bp = Blueprint('main', __name__)
|
||||||
|
warehouse_bp = Blueprint('warehouse', __name__)
|
||||||
|
|
||||||
|
@bp.route('/store_articles')
|
||||||
|
def store_articles():
|
||||||
|
return render_template('store_articles.html')
|
||||||
|
|
||||||
|
@bp.route('/warehouse_reports')
|
||||||
|
def warehouse_reports():
|
||||||
|
return render_template('warehouse_reports.html')
|
||||||
|
|
||||||
def get_db_connection():
|
def get_db_connection():
|
||||||
"""Reads the external_server.conf file and returns a MariaDB database connection."""
|
"""Reads the external_server.conf file and returns a MariaDB database connection."""
|
||||||
@@ -83,7 +95,7 @@ def warehouse():
|
|||||||
if 'role' not in session or session['role'] not in ['superadmin', 'warehouse']:
|
if 'role' not in session or session['role'] not in ['superadmin', 'warehouse']:
|
||||||
flash('Access denied: Warehouse users only.')
|
flash('Access denied: Warehouse users only.')
|
||||||
return redirect(url_for('main.dashboard'))
|
return redirect(url_for('main.dashboard'))
|
||||||
return render_template('warehouse.html')
|
return render_template('main_page_warehouse.html')
|
||||||
|
|
||||||
@bp.route('/scan', methods=['GET', 'POST'])
|
@bp.route('/scan', methods=['GET', 'POST'])
|
||||||
def scan():
|
def scan():
|
||||||
@@ -307,7 +319,7 @@ def get_report_data():
|
|||||||
elif report == "4": # Logic for the report with non-zero quality_code (5 days)
|
elif report == "4": # Logic for the report with non-zero quality_code (5 days)
|
||||||
five_days_ago = datetime.now() - timedelta(days=5)
|
five_days_ago = datetime.now() - timedelta(days=5)
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
SELECT Id, operator_code, CP_full_code, OC1_code, OC2_code, quality_code, date, time, approved_quantity, rejected_quantity
|
SELECT Id, operator_code, CP_full_code, OC1_code, OC2 Code, quality_code, date, time, approved_quantity, rejected_quantity
|
||||||
FROM scan1_orders
|
FROM scan1_orders
|
||||||
WHERE date >= ? AND quality_code != 0
|
WHERE date >= ? AND quality_code != 0
|
||||||
ORDER BY date DESC, time DESC
|
ORDER BY date DESC, time DESC
|
||||||
@@ -421,3 +433,13 @@ def generate_pdf():
|
|||||||
c.save()
|
c.save()
|
||||||
|
|
||||||
return jsonify({'message': 'PDF generated successfully!', 'pdf_path': f'/static/label_templates/label_template.pdf'})
|
return jsonify({'message': 'PDF generated successfully!', 'pdf_path': f'/static/label_templates/label_template.pdf'})
|
||||||
|
|
||||||
|
@warehouse_bp.route('/create_locations', methods=['GET', 'POST'])
|
||||||
|
def create_locations():
|
||||||
|
from app.warehouse import create_locations_handler
|
||||||
|
return create_locations_handler()
|
||||||
|
|
||||||
|
@warehouse_bp.route('/import_locations_csv', methods=['GET', 'POST'])
|
||||||
|
def import_locations_csv():
|
||||||
|
from app.warehouse import import_locations_csv_handler
|
||||||
|
return import_locations_csv_handler()
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
<div class="dashboard-card">
|
<div class="dashboard-card">
|
||||||
<h3>Accesare modul magazie</h3>
|
<h3>Accesare modul magazie</h3>
|
||||||
<p>Modul pentru managementul magaziei</p>
|
<p>Acceseaza functionalitatile modulului de magazie.</p>
|
||||||
<a href="{{ url_for('main.warehouse') }}" class="btn">Lansare modul Magazie</a>
|
<a href="{{ url_for('main.warehouse') }}" class="btn" id="launch-warehouse">Deschide magazie</a>
|
||||||
</div>
|
</div>
|
||||||
<!-- New Card: Accesare modul Etichete -->
|
<!-- New Card: Accesare modul Etichete -->
|
||||||
<div class="dashboard-card">
|
<div class="dashboard-card">
|
||||||
|
|||||||
Reference in New Issue
Block a user