updated to modul etichete

This commit is contained in:
2025-04-30 11:57:48 +03:00
parent e6878495a1
commit 56f3f8805d
7 changed files with 48 additions and 3 deletions

View File

@@ -12,8 +12,8 @@ def create_app():
db.init_app(app) db.init_app(app)
from .routes import bp from app.routes import bp as main_bp
app.register_blueprint(bp) app.register_blueprint(main_bp, url_prefix='/')
# 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

View File

@@ -332,4 +332,11 @@ def get_report_data():
data["error"] = "Error fetching report data." data["error"] = "Error fetching report data."
print("Data being returned:", data) print("Data being returned:", data)
return jsonify(data) 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')

View File

@@ -7,16 +7,29 @@ document.addEventListener('DOMContentLoaded', () => {
const themeToggleButton = document.getElementById('theme-toggle'); const themeToggleButton = document.getElementById('theme-toggle');
const body = document.body; 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 // Check and apply the saved theme from localStorage
const savedTheme = localStorage.getItem('theme'); const savedTheme = localStorage.getItem('theme');
if (savedTheme) { if (savedTheme) {
body.classList.toggle('dark-mode', savedTheme === 'dark'); body.classList.toggle('dark-mode', savedTheme === 'dark');
} }
// Update the button text based on the current theme
updateThemeToggleButtonText();
// Toggle the theme on button click // Toggle the theme on button click
themeToggleButton.addEventListener('click', () => { themeToggleButton.addEventListener('click', () => {
const isDarkMode = body.classList.toggle('dark-mode'); const isDarkMode = body.classList.toggle('dark-mode');
localStorage.setItem('theme', isDarkMode ? 'dark' : 'light'); localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
updateThemeToggleButtonText(); // Update the button text after toggling
}); });
// Helper function to format dates // Helper function to format dates
@@ -145,4 +158,11 @@ document.addEventListener('DOMContentLoaded', () => {
alert('Exporting current report as PDF...'); alert('Exporting current report as PDF...');
// Add logic to export the current report as PDF // Add logic to export the current report as PDF
}); });
}); });

View File

@@ -18,16 +18,24 @@
<a href="{{ url_for('main.quality') }}" class="btn">Lansare modul calitate</a> <a href="{{ url_for('main.quality') }}" class="btn">Lansare modul calitate</a>
</div> </div>
<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>Modul pentru managementul magaziei</p>
<a href="{{ url_for('main.warehouse') }}" class="btn">Lansare modul Magazie</a> <a href="{{ url_for('main.warehouse') }}" class="btn">Lansare modul Magazie</a>
</div> </div>
<!-- New Card: Accesare modul Etichete -->
<div class="dashboard-card">
<h3>Accesare modul Etichete</h3>
<p>Modul pentru gestionarea etichetelor.</p>
<a href="{{ url_for('main.etichete') }}" class="btn">Lansare modul Etichete</a>
</div>
<div class="dashboard-card"> <div class="dashboard-card">
<h3>Manage Settings</h3> <h3>Manage Settings</h3>
<p>Access and manage application settings.</p> <p>Access and manage application settings.</p>
<a href="{{ url_for('main.settings') }}" class="btn">Access Settings Page</a> <a href="{{ url_for('main.settings') }}" class="btn">Access Settings Page</a>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block title %}Modul Etichete{% endblock %}
{% block content %}
<div class="etichete-container">
<h1>Modul Etichete</h1>
<p>Aceasta este pagina pentru gestionarea etichetelor.</p>
</div>
{% endblock %}