From 56f3f8805d351db4efff5f1fddd78b6eb32fa220 Mon Sep 17 00:00:00 2001 From: ske087 Date: Wed, 30 Apr 2025 11:57:48 +0300 Subject: [PATCH] updated to modul etichete --- py_app/app/__init__.py | 4 ++-- .../app/__pycache__/__init__.cpython-311.pyc | Bin 1393 -> 1427 bytes py_app/app/__pycache__/routes.cpython-311.pyc | Bin 22105 -> 22629 bytes py_app/app/routes.py | 9 +++++++- py_app/app/static/script.js | 20 ++++++++++++++++++ py_app/app/templates/dashboard.html | 8 +++++++ py_app/app/templates/main_page_etichete.html | 10 +++++++++ 7 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 py_app/app/templates/main_page_etichete.html 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 790d91963bfc6766ae776587eccb3f9771ba7355..d24961c1fa45760a36037a053e882592868fea39 100644 GIT binary patch delta 249 zcmey!HJO`tIWI340}xDkD45Ybk#`~El!@yPbER;u;abMTz_6NWas{I~BlqMDjFTC8 zCc7}@$P@vE88jJhF(noJV$=sRxJrw1;tPsW(=sb2?`G2FElDjd;-37G zNtTgsGC#99=PmZ!#LT?-q=L!b%zj)lKvUR(xcJZH#mrus8W&hl&nu{2Sfpl{ zuPDC2B6X3)_zH{h1s3DUf-I8+#HE~UnGe~rI5V;zW?^(@oV=MuS5XjXS`oB5*_JUfFsx>rT*GM2$!Ptth{=B(=DRXEGPFEFJp3845N!Ia#vX7F0jZ=HfEV5AS&f# z&3wq3#mS!iFcYJb{p71Gx{3logNi^Vu4MQOBpHe%fy6Hko80`A(wtPgBKgV6tT`-l GKtTYpe>vy? diff --git a/py_app/app/__pycache__/routes.cpython-311.pyc b/py_app/app/__pycache__/routes.cpython-311.pyc index 8e1e18801e74ca902f0f44d88c661eef684aacb1..534dcab22a4cb41a3992c009054bccabe86bc88f 100644 GIT binary patch delta 364 zcmcb)hVkhJM!w~|yj%=GaQ2B{Mv?hMJ_*J{8`WExC$5v!R9VKzz_1#KAs|Jyg<%Tm78fg| zq~>L&rdTPsLX|3%7N-^!E9B?pRO%I(1C6c{&rQtCi!Vq_PmPD^*2^f#%_;H*$`(0- z2s;pA03tTRh(Mq_ivxkY28IXhyi>z3u*+OvpM1cOUE+dy-~|N`y34_PfzS9NhshNV zlM5UslP8Es315&lxyWsLh1>K3iz(PxP36f8f;Ka5oa`Sg%e@0=9?1X2Ow60hgD)|e q$1yQ5v9wDxNpxsmWE8u?DE5Jgh0*K-1CaR0%)lg$A_5i$8wvnwTxL7~ delta 108 zcmaF5f$`=VM!w~|yj%=Ga3h5~BhqXlp9EvuM)g)^wiL!-22GXC@0j2CF=;AIZV1_| y;s{h$WCtP)fW$8jo80`A(wtPgqHRDfBM=wgX4)JRdWlJZ!IzOy@&lLzYXAUsavTf* 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 +

Accesare modul magazie

Modul pentru managementul magaziei

Lansare modul Magazie
+ +
+

Accesare modul Etichete

+

Modul pentru gestionarea etichetelor.

+ Lansare modul Etichete +

Manage Settings

Access and manage application settings.

Access Settings Page
+ {% 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 %} +
+

Modul Etichete

+

Aceasta este pagina pentru gestionarea etichetelor.

+
+{% endblock %} \ No newline at end of file