diff --git a/py_app/app/__init__.py b/py_app/app/__init__.py index 0458074..b34e36d 100644 --- a/py_app/app/__init__.py +++ b/py_app/app/__init__.py @@ -12,8 +12,8 @@ def create_app(): db.init_app(app) - from .routes import bp - app.register_blueprint(bp) + from app.routes import bp as main_bp + app.register_blueprint(main_bp, url_prefix='/') # Add 'now' function to Jinja2 globals app.jinja_env.globals['now'] = datetime.now diff --git a/py_app/app/__pycache__/__init__.cpython-311.pyc b/py_app/app/__pycache__/__init__.cpython-311.pyc index 790d919..d24961c 100644 Binary files a/py_app/app/__pycache__/__init__.cpython-311.pyc and b/py_app/app/__pycache__/__init__.cpython-311.pyc differ diff --git a/py_app/app/__pycache__/routes.cpython-311.pyc b/py_app/app/__pycache__/routes.cpython-311.pyc index 8e1e188..534dcab 100644 Binary files a/py_app/app/__pycache__/routes.cpython-311.pyc and b/py_app/app/__pycache__/routes.cpython-311.pyc differ diff --git a/py_app/app/routes.py b/py_app/app/routes.py index 7913e20..fc487b8 100644 --- a/py_app/app/routes.py +++ b/py_app/app/routes.py @@ -332,4 +332,11 @@ def get_report_data(): data["error"] = "Error fetching report data." print("Data being returned:", data) - return jsonify(data) \ No newline at end of file + return jsonify(data) + +@bp.route('/etichete') +def etichete(): + if 'role' not in session or session['role'] not in ['superadmin', 'etichete']: + flash('Access denied: Etichete users only.') + return redirect(url_for('main.dashboard')) + return render_template('main_page_etichete.html') \ No newline at end of file diff --git a/py_app/app/static/script.js b/py_app/app/static/script.js index d996744..424542a 100644 --- a/py_app/app/static/script.js +++ b/py_app/app/static/script.js @@ -7,16 +7,29 @@ document.addEventListener('DOMContentLoaded', () => { const themeToggleButton = document.getElementById('theme-toggle'); const body = document.body; + // Helper function to update the theme toggle button text + function updateThemeToggleButtonText() { + if (body.classList.contains('dark-mode')) { + themeToggleButton.textContent = 'Change to Light Mode'; + } else { + themeToggleButton.textContent = 'Change to Dark Mode'; + } + } + // Check and apply the saved theme from localStorage const savedTheme = localStorage.getItem('theme'); if (savedTheme) { body.classList.toggle('dark-mode', savedTheme === 'dark'); } + // Update the button text based on the current theme + updateThemeToggleButtonText(); + // Toggle the theme on button click themeToggleButton.addEventListener('click', () => { const isDarkMode = body.classList.toggle('dark-mode'); localStorage.setItem('theme', isDarkMode ? 'dark' : 'light'); + updateThemeToggleButtonText(); // Update the button text after toggling }); // Helper function to format dates @@ -145,4 +158,11 @@ document.addEventListener('DOMContentLoaded', () => { alert('Exporting current report as PDF...'); // Add logic to export the current report as PDF }); + + + + + + + }); \ No newline at end of file diff --git a/py_app/app/templates/dashboard.html b/py_app/app/templates/dashboard.html index abf56d4..7270cd4 100644 --- a/py_app/app/templates/dashboard.html +++ b/py_app/app/templates/dashboard.html @@ -18,16 +18,24 @@ Lansare modul calitate +
+ + + {% endblock %} \ No newline at end of file diff --git a/py_app/app/templates/main_page_etichete.html b/py_app/app/templates/main_page_etichete.html new file mode 100644 index 0000000..94cadba --- /dev/null +++ b/py_app/app/templates/main_page_etichete.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} + +{% block title %}Modul Etichete{% endblock %} + +{% block content %} +Aceasta este pagina pentru gestionarea etichetelor.
+