From f3dbaf2b81a91d641f243a38a28b7e89f83870ae Mon Sep 17 00:00:00 2001 From: Nguyen Ngo Date: Mon, 1 Sep 2025 10:41:22 -0400 Subject: [PATCH] Update dashboard --- app.py | 7 + static/css/dashboard.css | 185 +- templates/base.html | 8 +- templates/base_authenticated.html | 35 +- templates/dashboard.html | 2846 +++++++++++++++-------------- 5 files changed, 1679 insertions(+), 1402 deletions(-) diff --git a/app.py b/app.py index 9428984..3526b94 100644 --- a/app.py +++ b/app.py @@ -31,6 +31,13 @@ app.config['TEMPLATES_AUTO_RELOAD'] = os.environ.get('TEMPLATES_AUTO_RELOAD') # Initialize database db = SQLAlchemy(app) +@app.context_processor +def inject_company_name(): + """Make COMPANY_NAME available to all templates""" + return { + 'COMPANY_NAME': os.environ.get('COMPANY_NAME', 'QR Code Management System') + } + def create_performance_indexes(): """Create performance optimization indexes""" try: diff --git a/static/css/dashboard.css b/static/css/dashboard.css index a5fb2db..ac777f1 100644 --- a/static/css/dashboard.css +++ b/static/css/dashboard.css @@ -4,31 +4,163 @@ */ /* Dashboard Header */ -.dashboard-header { +.header-stats { display: flex; - justify-content: space-between; - align-items: flex-start; - margin-bottom: var(--spacing-8); - padding: var(--spacing-6); - background: var(--white); - border-radius: var(--radius-xl); - box-shadow: var(--shadow); + align-items: center; +} + +.header-stats-grid { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 1rem; + min-width: 400px; +} + +@media (min-width: 1200px) { + .header-stats-grid { + grid-template-columns: repeat(4, 1fr); + min-width: 500px; + } +} + +.header-stat-card { + background: rgba(255, 255, 255, 0.95); + padding: 1rem; + border-radius: 0.5rem; + border: 1px solid #e2e8f0; + box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1); + display: flex; + align-items: center; + gap: 0.75rem; + transition: all 0.2s ease-in-out; + backdrop-filter: blur(10px); position: relative; overflow: hidden; } -.dashboard-header::before { +.header-stat-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; - height: 4px; - background: linear-gradient( - 90deg, - var(--primary-color), - var(--primary-hover) - ); + height: 2px; +} + +.header-stat-card.primary::before { + background: linear-gradient(90deg, #2563eb, #1d4ed8); +} + +.header-stat-card.success::before { + background: linear-gradient(90deg, #10b981, #047857); +} + +.header-stat-card.danger::before { + background: linear-gradient(90deg, #ef4444, #dc2626); +} + +.header-stat-card.info::before { + background: linear-gradient(90deg, #8b5cf6, #7c3aed); +} + +.header-stat-card:hover { + transform: translateY(-1px); + box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15); +} + +.header-stat-icon { + width: 36px; + height: 36px; + border-radius: 0.375rem; + display: flex; + align-items: center; + justify-content: center; + font-size: 1rem; + color: #ffffff; + flex-shrink: 0; +} + +.header-stat-card.primary .header-stat-icon { + background: linear-gradient(135deg, #2563eb, #1d4ed8); +} + +.header-stat-card.success .header-stat-icon { + background: linear-gradient(135deg, #10b981, #047857); +} + +.header-stat-card.danger .header-stat-icon { + background: linear-gradient(135deg, #ef4444, #dc2626); +} + +.header-stat-card.info .header-stat-icon { + background: linear-gradient(135deg, #8b5cf6, #7c3aed); +} + +.header-stat-content h3 { + font-size: 1.25rem; + font-weight: 700; + color: #0f172a; + margin-bottom: 0.125rem; + line-height: 1; +} + +.header-stat-content p { + color: #64748b; + font-size: 0.75rem; + margin: 0; + line-height: 1.2; +} + +/* Update existing dashboard header to accommodate new layout */ +.dashboard-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 2rem; + background: linear-gradient(135deg, #a0aff1 0%, #ebdef8 100%); + border-radius: 0.75rem; + color: white; + margin-bottom: 2rem; + box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); + flex-wrap: wrap; + gap: 2rem; +} + +/* Responsive Design for Header */ +@media (max-width: 1024px) { + .dashboard-header { + flex-direction: column; + text-align: center; + gap: 1.5rem; + } + + .header-stats-grid { + grid-template-columns: repeat(2, 1fr); + min-width: 300px; + } +} + +@media (max-width: 768px) { + .dashboard-header { + padding: 1.5rem; + } + + .header-stats-grid { + grid-template-columns: 1fr; + min-width: 250px; + } + + .header-stat-card { + padding: 0.75rem; + } + + .header-stat-content h3 { + font-size: 1.125rem; + } + + .header-stat-content p { + font-size: 0.6875rem; + } } .welcome-section h1 { @@ -892,7 +1024,7 @@ } .qr-url { - font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; + font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace; background: var(--gray-100); padding: var(--spacing-1) var(--spacing-2); border-radius: var(--radius-sm); @@ -927,7 +1059,8 @@ flex-wrap: wrap; } -.qr-status, .qr-project { +.qr-status, +.qr-project { display: flex; align-items: center; gap: var(--spacing-1); @@ -1088,8 +1221,12 @@ /* Animations */ @keyframes fadeIn { - from { opacity: 0; } - to { opacity: 1; } + from { + opacity: 0; + } + to { + opacity: 1; + } } @keyframes slideIn { @@ -1108,26 +1245,26 @@ .detail-grid { grid-template-columns: 1fr; } - + .qr-actions { flex-direction: column; } - + .qr-actions .btn { width: 100%; justify-content: center; } - + .bulk-actions-bar { flex-direction: column; text-align: center; } - + .bulk-actions-buttons { width: 100%; justify-content: center; } - + .modal-content { margin: var(--spacing-4); max-width: calc(100vw - 2rem); diff --git a/templates/base.html b/templates/base.html index 1d018f1..892735e 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,7 +3,7 @@ - {% block title %}QR Code Management System{% endblock %} + {% block title %}{{ COMPANY_NAME }}{% endblock %} {% if turnstile_enabled %} - + {% endif %} diff --git a/templates/base_authenticated.html b/templates/base_authenticated.html index 624bb3e..525be0d 100644 --- a/templates/base_authenticated.html +++ b/templates/base_authenticated.html @@ -3,7 +3,7 @@ - {% block title %}QR Code Management System{% endblock %} + {% block title %}{{ COMPANY_NAME }}{% endblock %} {% if session.role == 'admin' %} - + Projects @@ -65,8 +67,8 @@ Users - - Employees + + Employees @@ -76,12 +78,17 @@ Payroll - + Statistics - + System Logs @@ -137,9 +144,11 @@ -

{% block page_title %}QR Code Management System{% endblock %}

+

+ {% block page_title %}{{ COMPANY_NAME }}{% endblock %} +

- +