File size: 9,438 Bytes
88db748
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343bf49
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Smart-Learn</title>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
    <style>
        body, html {
            margin: 0;
            padding: 0;
            height: 100%;
            font-family: 'Roboto', sans-serif;
            color: #fff;
            overflow: hidden;
        }
        .video-container {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            overflow: hidden;
        }
        #background-video {
            min-width: 100%;
            min-height: 100%;
            width: auto;
            height: auto;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
        .content {
            position: relative;
            z-index: 1;
            text-align: center;
            padding: 20px;
            background: rgba(0, 0, 0, 0.5);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }
        .header {
            padding: 20px 0;
        }
        .logo-circle {
            width: 150px;
            height: 150px;
            border-radius: 50%;
            overflow: hidden;
            margin: 0 auto;
            box-shadow: 0 4px 8px rgba(0,0,0,0.3);
        }
        .logo-circle img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .school-name {
            font-size: 2.5em;
            margin-top: 20px;
            color: #ffffff;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
        }
        .login-text {
            font-size: 1.2em;
            margin-top: 20px;
            margin-bottom: 10px;
        }
        .login-buttons {
            margin-top: 10px;
        }
        .login-button {
            background-color: rgba(52, 152, 219, 0.8);
            border: none;
            color: white;
            padding: 12px 24px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin: 4px 10px;
            cursor: pointer;
            border-radius: 25px;
            transition: background-color 0.3s, transform 0.3s;
        }
        .login-button:hover {
            background-color: rgba(41, 128, 185, 0.9);
            transform: translateY(-2px);
        }
        .modal {
            display: none;
            position: fixed;
            z-index: 2;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0,0,0,0.8);
        }
        .modal-content {
            background-color: #fefefe;
            margin: 10% auto;
            padding: 30px;
            border: 1px solid #888;
            width: 300px;
            border-radius: 8px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }
        .close {
            color: #aaa;
            float: right;
            font-size: 28px;
            font-weight: bold;
        }
        .close:hover,
        .close:focus {
            color: black;
            text-decoration: none;
            cursor: pointer;
        }
        #login-form input {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        #login-form button {
            width: 100%;
            padding: 10px;
            background-color: #2ecc71;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        #login-form button:hover {
            background-color: #27ae60;
        }
        .info-section {
            width: 100% ;
            color: #ecf0f1;
            padding: 20px 0;
            text-align: center;
        }
        .contact-info {
            max-width: 600px;
            margin: 0 auto;
        }
        #login-title {
            color: #333;
            margin-bottom: 15px;
        }
        #login-instructions {
            color: #666;
            margin-bottom: 20px;
        }
    </style>
</head>

<body>
    <div class="video-container">
        <video autoplay muted loop id="background-video">
            <source src="../static/background.mp4" type="video/mp4">
            Your browser does not support the video tag.
        </video>
    </div>
    
    <div class="content" id="main-content">
        <div class="header">
            <div class="logo-circle">
                <img src="../static/smart-learn.jpeg" alt="Smart Learn Logo">
            </div>
            <h1 class="school-name">Smart-Learn</h1>
            
            <!-- Login Text and Buttons -->
            <p class="login-text">Login whether you are a student or teacher</p>
            <div class="login-buttons">
                <button class="login-button" onclick="showLogin('student')">Student Portal</button>
                <button class="login-button" onclick="showLogin('teacher')">Teacher Portal</button>
            </div>
        </div>

        <!-- Contact Information Section -->
        <div class="info-section">
            <div class="contact-info">
                <h2>Contact Information</h2>
                <p><strong>Email:</strong> [email protected]</p>
                <p><strong>Phone:</strong> (123) 456-7890</p>
                <p><strong>Address:</strong> 123 Education Street, Knowledge City, ST 12345</p>
            </div>
        </div>
    </div>

    <!-- Login Modal -->
    <div id="login-modal" class="modal">
        <div class="modal-content">
            <span class="close" onclick="closeLogin()">&times;</span>
            <h2 id="login-title"></h2>
            <p id="login-instructions">Enter your details:</p>
            <form id="login-form">
                <input type="text" id="username" name="username" placeholder="Username" required>
                <input type="password" id="password" name="password" placeholder="Password" required>
                <button type="submit">Login</button>
            </form>
            <p id="login-hint" style="color: #666; font-size: 0.9em; margin-top: 10px;"></p>
            <p id="login-error" style="color: red; display: none;">Invalid username or password. Please try again.</p>
        </div>
    </div>

    <script>
        let currentLoginType = '';

        function showLogin(type) {
            currentLoginType = type;
            document.getElementById('main-content').style.display = 'none';
            document.getElementById('login-modal').style.display = 'block';
            document.getElementById('login-title').innerText = type.charAt(0).toUpperCase() + type.slice(1) + ' Login';
            document.getElementById('login-error').style.display = 'none';
            
            // Set placeholders and hint based on login type
            if (type === 'student') {
                document.getElementById('username').placeholder = "Student ID (e.g., 'Alice Johnson')";
                document.getElementById('password').placeholder = "Password (e.g., '12345')";
                document.getElementById('login-hint').innerText = "Hint: Use your student ID as 'Alice Johnson' and default password is '12345'";
            } else {
                document.getElementById('username').placeholder = "Teacher ID (e.g., 'John Doe')";
                document.getElementById('password').placeholder = "Password (e.g., '12345')";
                document.getElementById('login-hint').innerText = "Hint: Use your Teacher ID as 'John Doe' and default password is '12345'";
            }
        }

        function closeLogin() {
            document.getElementById('login-modal').style.display = 'none';
            document.getElementById('main-content').style.display = 'flex';
        }

        document.getElementById('login-form').addEventListener('submit', function(event) {
            event.preventDefault();
            const username = document.getElementById('username').value;
            const password = document.getElementById('password').value;

            fetch('/' + currentLoginType + '_login', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify({ name: username, password: password }),
            })
            .then(response => response.json())
            .then(data => {
                if (data.success) {
                    window.location.href = '/' + currentLoginType;
                } else {
                    document.getElementById('login-error').style.display = 'block';
                }
            })
            .catch(error => {
                console.error('Error:', error);
            });
        });

        // Close the modal if clicked outside
        window.onclick = function(event) {
            if (event.target == document.getElementById('login-modal')) {
                closeLogin();
            }
        }
    </script>
</body>
</html>