File size: 3,848 Bytes
58668c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}Library Management System{% endblock %}</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f5f5f5; }
        nav { background: #2c3e50; color: white; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; }
        nav h1 { font-size: 1.5rem; }
        nav ul { list-style: none; display: flex; gap: 2rem; }
        nav a { color: white; text-decoration: none; padding: 0.5rem 1rem; border-radius: 4px; }
        nav a:hover { background: #34495e; }
        .container { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; }
        .flash { padding: 1rem; margin-bottom: 1rem; border-radius: 4px; }
        .flash.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
        .flash.danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
        .flash.warning { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }
        .card { background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 2rem; }
        .btn { display: inline-block; padding: 0.75rem 1.5rem; background: #3498db; color: white; text-decoration: none; border-radius: 4px; border: none; cursor: pointer; }
        .btn:hover { background: #2980b9; }
        .btn-danger { background: #e74c3c; }
        .btn-danger:hover { background: #c0392b; }
        .btn-success { background: #27ae60; }
        .btn-success:hover { background: #229954; }
        table { width: 100%; border-collapse: collapse; }
        table th, table td { padding: 1rem; text-align: left; border-bottom: 1px solid #ddd; }
        table th { background: #ecf0f1; font-weight: 600; }
        form label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
        form input, form select { width: 100%; padding: 0.75rem; margin-bottom: 1rem; border: 1px solid #ddd; border-radius: 4px; }
        .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
        .stat-card { background: white; padding: 1.5rem; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
        .stat-card h3 { color: #7f8c8d; font-size: 0.9rem; margin-bottom: 0.5rem; }
        .stat-card p { font-size: 2rem; font-weight: bold; color: #2c3e50; }
    </style>
</head>
<body>
    {% if current_user.is_authenticated %}
    <nav>
        <h1>📚 Library Management System</h1>
        <ul>
            <li><a href="{{ url_for('dashboard') }}">Dashboard</a></li>
            {% if current_user.can_manage_books() %}
            <li><a href="{{ url_for('students') }}">Students</a></li>
            <li><a href="{{ url_for('books') }}">Books</a></li>
            <li><a href="{{ url_for('issue_book') }}">Issue</a></li>
            <li><a href="{{ url_for('return_book') }}">Return</a></li>
            <li><a href="{{ url_for('reports') }}">Reports</a></li>
            {% else %}
            <li><a href="{{ url_for('books') }}">Browse Books</a></li>
            {% endif %}
            <li><a href="{{ url_for('logout') }}">Logout ({{ current_user.name }})</a></li>
        </ul>
    </nav>
    {% endif %}
    
    <div class="container">
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                <div class="flash {{ category }}">{{ message }}</div>
                {% endfor %}
            {% endif %}
        {% endwith %}
        
        {% block content %}{% endblock %}
    </div>
</body>
</html>