File size: 8,543 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Academic Timetable Generator</title>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&family=Roboto+Mono&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet">
    <style>

        body {

            font-family: 'Roboto', sans-serif;

            line-height: 1.6;

            color: #333;

            max-width: 800px;

            margin: 0 auto;

            padding: 20px;

            background-color: #f0f4f8;

            background-image: url('../static/time.jpg');

            background-size: cover;

            background-position: center;

            background-repeat: no-repeat;

            background-attachment: fixed;

        }

        body::before {

            content: "";

            position: fixed;

            top: 0;

            left: 0;

            width: 100%;

            height: 100%;

            background-color: rgba(240, 244, 248, 0.2); /* Adjust the last value (0.8) for transparency */

            z-index: -1;

        }

        h1 {

            color: #2c3e50;

            text-align: center;

            margin-bottom: 30px;

        }

        form {

            background-color: #ffffff;

            padding: 30px;

            border-radius: 8px;

            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

        }

        label {

            font-weight: bold;

            color: #34495e;

        }

        textarea, input[type="number"] {

            width: 100%;

            padding: 10px;

            margin-top: 5px;

            margin-bottom: 20px;

            border: 1px solid #bdc3c7;

            border-radius: 4px;

            font-size: 16px;

        }

        input[type="submit"] {

            background-color: #3498db;

            color: white;

            padding: 12px 20px;

            border: none;

            border-radius: 4px;

            cursor: pointer;

            font-size: 16px;

            transition: background-color 0.3s;

        }

        input[type="submit"]:hover {

            background-color: #2980b9;

        }

        #loading {

            display: none;

            text-align: center;

            margin-top: 20px;

        }

        .loader {

            border: 5px solid #f3f3f3;

            border-top: 5px solid #3498db;

            border-radius: 50%;

            width: 50px;

            height: 50px;

            animation: spin 1s linear infinite;

            margin: 0 auto;

        }

        @keyframes spin {

            0% { transform: rotate(0deg); }

            100% { transform: rotate(360deg); }

        }

        #result {

            display: none;

            margin-top: 30px;

            background-color: #ffffff;

            padding: 30px;

            border-radius: 8px;

            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

        }

        #result h2 {

            color: #2c3e50;

            margin-top: 0;

        }

        pre {

            background-color: #f7f9fa;

            padding: 15px;

            border-radius: 4px;

            white-space: pre-wrap;

            word-wrap: break-word;

        }

        .icon-container {

            text-align: center;

            margin-bottom: 20px;

        }

        .icon-container i {

            font-size: 48px;

            color: #3498db;

            margin: 0 10px;

        }

        #result {

            display: none;

            margin-top: 30px;

            background-color: #ffffff;

            padding: 30px;

            border-radius: 8px;

            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

        }



        #result h2 {

            color: #2c3e50;

            margin-top: 0;

            font-size: 24px;

            border-bottom: 2px solid #3498db;

            padding-bottom: 10px;

            margin-bottom: 20px;

        }



        pre {

            background-color: #f7f9fa;

            padding: 20px;

            border-radius: 6px;

            white-space: pre-wrap;

            word-wrap: break-word;

            font-family: 'Roboto Mono', monospace;

            font-size: 14px;

            line-height: 1.6;

            color: #34495e;

            border-left: 4px solid #3498db;

        }



        .response-section {

            margin-bottom: 30px;

        }



        .response-content {

            font-family: 'Roboto', sans-serif;

            font-size: 16px;

            line-height: 1.8;

            color: #333;

        }



        .highlight {

            background-color: #f1c40f;

            padding: 2px 4px;

            border-radius: 3px;

        }

        .back-button {

            position: fixed;

            top: 20px;

            left: 20px;

            background-color: #3498db;

            color: white;

            border: none;

            border-radius: 50%;

            width: 50px;

            height: 50px;

            font-size: 24px;

            cursor: pointer;

            transition: all 0.3s ease;

            box-shadow: 0 2px 5px rgba(0,0,0,0.2);

            display: flex;

            justify-content: center;

            align-items: center;

            text-decoration: none;

        }



        .back-button:hover {

            background-color: #2980b9;

            transform: scale(1.1);

        }



        .back-button i {

            transition: transform 0.3s ease;

        }



        .back-button:hover i {

            transform: translateX(-5px);

        }

    </style>


</head>
<body>
    <a href="teacher" class="back-button" title="Back to Home">
    <i class="fas fa-arrow-left"></i>
    </a>
    <h1>Slow Learners Management</h1>
    <div class="icon-container">
        <i class="fas fa-graduation-cap"></i>
        <i class="fas fa-clock"></i>
        <i class="fas fa-calendar-alt"></i>
    </div>
    <form id="timetableForm">
        <label for="academic_topics"><i class="fas fa-book"></i> Enter a list of academic topics, separated by commas:</label><br>
        <textarea name="academic_topics" id="academic_topics" rows="4" required></textarea><br>

        <label for="hours_per_day"><i class="fas fa-hourglass-half"></i> Enter the number of hours per day:</label><br>
        <input type="number" name="hours_per_day" id="hours_per_day" required><br>

        <input type="submit" value="Generate Timetable">
    </form>

    <div id="loading">
        <div class="loader"></div>
        <p>Generating timetable...</p>
    </div>

<div id="result">
    <div class="response-section">
        <h2><i class="fas fa-list-ul"></i> Clustered Topics</h2>
        <div class="response-content">
            <pre id="clusteredTopics"></pre>
        </div>
    </div>

    <div class="response-section">
        <h2><i class="fas fa-table"></i> Special Timetable</h2>
        <div class="response-content">
            <pre id="specialTimetable"></pre>
        </div>
    </div>
</div>

    <script>

        document.getElementById('timetableForm').addEventListener('submit', function(e) {

            e.preventDefault();



            document.getElementById('loading').style.display = 'block';

            document.getElementById('result').style.display = 'none';



            var formData = new FormData(this);



            fetch('/generate_ai_timetable', {

                method: 'POST',

                body: formData

            })

            .then(response => response.json())

            .then(data => {

                document.getElementById('clusteredTopics').textContent = data.clustered_topics;

                document.getElementById('specialTimetable').textContent = data.special_timetable;

                document.getElementById('loading').style.display = 'none';

                document.getElementById('result').style.display = 'block';

            })

            .catch(error => {

                console.error('Error:', error);

                document.getElementById('loading').style.display = 'none';

                alert('An error occurred. Please try again.');

            });

        });

    </script>
</body>
</html>